1import{o as e}from"./chunk-zsgVPwQN.js";import{t}from"./react-D4cBbUL-.js";import{i as n}from"./react-redux-DU6-rADu.js";import{t as r}from"./jsx-runtime-1samV3Jg.js";import{t as i}from"./Typography-C6ppdz4R.js";import{n as a,r as o}from"./theme-CJu5RNGS.js";import{t as s}from"./Box-7NX9LWO8.js";import{t as c}from"./Divider-C74X2u3m.js";import{t as l}from"./Info-D09wN5v0.js";import{t as u}from"./Button-DS-yIoRQ.js";import{t as d}from"./TickmarkCircle-C-mnw9eU.js";import{a as f}from"./property-hooks-DIuW5jqf.js";import{t as p}from"./useIsLandlord-FQijYsIm.js";import{t as m}from"./myTenanciesService-z_uH11x8.js";import{t as h}from"./Tooltip-BavphlBj.js";var{palette:g}=o,_={mainHeading:{color:g.primary.main,...a(700,{xs:`1.25rem`,md:`1.5rem`},{xs:`1.125rem`,md:`1.75rem`}),mb:`0.75rem`},subHeading:{...a(500,{xs:`0.875rem`,md:`1rem`},{xs:`1.125rem`,md:`normal`}),mb:`1.5rem`,color:g.grey.main},vacateDate:{fontWeight:800}},v=r(),y=({heading:e,description:t})=>(0,v.jsxs)(s,{children:[(0,v.jsx)(s,{children:(0,v.jsx)(i,{sx:_.mainHeading,children:e})}),(0,v.jsx)(s,{children:(0,v.jsx)(i,{sx:_.subHeading,variant:`body2`,children:t})})]}),{palette:b,spacing:x}=o,S={container:{display:`flex`,gap:x(.5),flexWrap:{md:`nowrap`,xs:`wrap`},paddingY:x(1)},badge:{height:`2.25rem`,fontSize:`1.25rem`,fontWeight:`bold`,textAlign:`center`,lineHeight:`2.25rem`,borderRadius:`50%`,flexGrow:0,flexBasis:`2.25rem`,flexShrink:0,bgcolor:b.secondary.main},textContainer:{display:`flex`,flexGrow:1,gap:x(1.5),color:b.grey.main,alignItems:{xs:`flex-start`,md:`center`}},title:{fontSize:{xs:`0.875rem`,md:`1rem`},fontWeight:400,lineHeight:`1.25rem`,color:b.grey.main},description:{...a(500,`0.75rem`,`0.875rem`),color:b.grey[600],mt:x(.5)},button:{width:{lg:`auto`,md:`auto`,xs:`100%`},mt:{xs:x(.75),md:0}},divider:{my:x(1),borderBottom:`0.063rem solid ${b.grey[200]}`},infoIcon:{color:b.lightishBlue.main,fontSize:`2.5rem`},tickIcon:{fontSize:`2.25rem`}},C=e(t()),w=({taskNumber:e,icon:t})=>t===`task`?e?(0,v.jsx)(s,{sx:S.badge,children:e}):null:t===`completed`?(0,v.jsx)(d,{sx:S.tickIcon}):t===`info`?(0,v.jsx)(l,{sx:S.infoIcon}):null,T=({taskNumber:e,title:t,description:n,button:r,icon:a,disabled:o,buttonTooltip:l})=>{let d=(0,C.useMemo)(()=>r?(0,v.jsx)(u,{variant:`secondary`,size:`small`,onClick:r.handleClick,...r.props,sx:{...S.button,...r?.props?.sx||{}},disabled:o,children:r.label}):null,[r,o]);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(s,{sx:S.container,children:[(0,v.jsxs)(s,{sx:S.textContainer,children:[(0,v.jsx)(w,{icon:a,taskNumber:e}),(0,v.jsxs)(s,{children:[(0,v.jsx)(i,{sx:S.title,children:t}),(0,v.jsx)(i,{sx:S.description,children:n})]})]}),r&&l&&(0,v.jsx)(h,{label:l,arrow:!0,placement:`top`,children:(0,v.jsx)(v.Fragment,{children:d})}),r&&!l&&d]}),(0,v.jsx)(c,{sx:S.divider})]})},{palette:E,spacing:D}=o,O={documentWrapper:{backgroundColor:E.lightishAqua[500],marginX:{xs:D(-2),md:D(-3)},paddingX:{xs:D(2),md:D(3)},pt:D(1)},noTaskContainer:{display:`flex`,justifyContent:`center`,textAlign:`center`,marginX:0,paddingX:0,padding:D(3),border:`0.063rem solid ${E.grey[200]}`,borderRadius:D(1),".MuiTypography-body2":{m:`0`}}},k=({tasks:e,hasBackgroundColor:t=!0,containerProps:n,headingProps:r,onlyIncompleteTask:i,hideHeading:a})=>{let{incompleteTaskCount:o,taskArray:c}=(0,C.useMemo)(()=>{let t=e.filter(e=>e.isCompleted),n=e.filter(e=>!e.isCompleted),r=n?.length,a=[...n,...i?[]:t];return{sortedTaskList:[...n,...t],incompleteTaskCount:r,incompleteTasks:n,taskArray:a}},[i,e]);return(0,v.jsx)(v.Fragment,{children:(0,v.jsxs)(s,{...n,sx:t?{...O.documentWrapper,...c.length?{}:O.noTaskContainer,...n?.sx||{}}:void 0,children:[!a&&(0,v.jsx)(s,{children:(0,v.jsx)(y,{heading:o?`${o} Task${o>1?`s`:``} to complete`:`All tasks are completed`,description:o?`Please complete the following tasks`:`No tasks need your attention`,...r})}),c.length>0?c.map((e,t)=>(0,v.jsx)(T,{icon:e.isCompleted?`completed`:`task`,taskNumber:t+1,title:e.documentName,description:e.documentDescription,button:e.button,disabled:e.disabled,buttonTooltip:e.buttonTooltip},t)):null]})})},A=e=>e.toLowerCase().includes(`preparation for tenancy`)?`preparation-of-property-for-tenancy`:e.replaceAll(` `,`-`).toLowerCase(),j=e=>e.replaceAll(`Move-in Monies`,`payments`).replaceAll(` `,`-`).toLowerCase(),M=(e,t)=>j(e)===A(t),N=(e,t)=>{let n=[...e],r=t.reduce((e,t)=>
1{let n=j(t.taskPriorityName);return e[n]=t.taskPriorityDisplayOrder,e},{});return n.sort((e,t)=>e.documentName.toLowerCase()===`payments`&&e.isPartiallyPaid?1:t.documentName.toLowerCase()===`payments`&&t.isPartiallyPaid?-1:(r[A(e.documentName)]||0)-(r[A(t.documentName)]||0))},P=({tasks:e})=>{let t=p(),{propertyId:r,tenancyId:i}=f(),{data:a}=m({propertyId:r,tenancyId:i}),o=location.pathname.includes(`tenancy-ending`),s=n(e=>e.tenancyEndingReducer?.data||null),{taskArray:c}=(0,C.useMemo)(()=>{let n=a?.taskPriorityOrders||[];return o&&(n=s?.[t?`landlordMoveOut`:`tenantMoveOut`]?.taskPriorityOrders||[]),{taskArray:N(e,n).map(e=>{let t=n.find(t=>M(t.taskPriorityName,e.documentName));if(t?.taskPriorityDescription){let n=e.documentName.toLowerCase()===`payments`,r=e.documentName.toLowerCase()===`proof of id`||e.documentName.toLowerCase()===`proof of address`,i=(0,v.jsxs)(v.Fragment,{children:[e.documentDescription,e.documentDescription?`. `:``,t?.taskPriorityDescription]});return{...e,documentDescription:n?i:r?e.documentDescription:t?.taskPriorityDescription}}return e})}},[t,o,a?.taskPriorityOrders,e,s]);return{taskArray:c}};export{y as i,k as n,T as r,P as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.