1import{o as ne,bg as R,q as B,e as O,r as n,fe as oe,j as t,B as h,bq as ae,ce as re,E as T,w as le,bZ as ie,cg as ce,cn as ue,cl as U,ff as de,ci as me,a1 as pe,b_ as De,F as fe,aB as ge,aC as xe,aD as ye,aE as be,S as Ce,a8 as we,co as Se,aI as he,c as $,J as je}from"./index-51b326a0.js";import Ae from"./index-e06fa4ce.js";const{palette:w}=B,Ie={mainContainer:{...ne("flex","center","flex-start"),flexDirection:"column",gap:"1rem",borderRadius:"0.5rem",bgcolor:w.grey[50]},loaderContainer:{height:"19.2rem",display:"flex",justifyContent:"center",alignItems:"center"},lettingsHeading:{...R(700,"2rem","2.5rem"),color:w.primary.main},archivedHeading:{...R(700,"2rem","2.5rem"),color:w.grey[400]}};function Fe({lettingsDocuments:s}){const e=O();return n.useEffect(()=>()=>{e(oe())},[e]),t.jsx(h,{sx:Ie.mainContainer,width:"100%",children:t.jsx(h,{width:"100%",children:t.jsx(Ae,{rowsData:s})})})}const S=(s,e)=>s==="PTW"&&e!==null?{label:"",type:"action-buttons"}:(s==="AUP"||s==="CRE")&&e!==null?{label:"",type:"action-buttons"}:{label:"View Document",type:"view-document"},ke=(s,e)=>{if((s==="AUP"||s==="CRE")&&e!==null)return{label:"",type:"action-buttons"}},{palette:Ee}=B,v={viewDocBox:{display:"flex",alignItems:"center",gap:"0.75rem"},infoIcon:{"& path":{fill:Ee.grey[400]}}},Pe=({documents:s=[]})=>{var P;const{phase:e}=ae(),o=O(),{sortDocuments:f}=re(),[g,a]=n.useState(!1),[i,l]=n.useState(!1),[M,j]=n.useState(""),[z,G]=n.useState(""),[N,A]=n.useState(!1),[V,q]=n.useState(""),[H,X]=n.useState(null),[Z,x]=n.useState(!1),[u,W]=n.useState({code:"",token:"",name:""}),{isSalesProperty:K}=T(),{instructionId:I,propertyId:F}=le(),{user:y}=ie(),Q=(P=y==null?void 0:y.profile)==null?void 0:P.termsAndConditionsStatus,{alertJSX:Y}=ce({downloadDocumentName:z,setGettingDocument:a}),k=n.useCallback((c,r)=>{o(ue(c)),a(!0),G(r)},[o]),J=n.useCallback((c,r,b)=>{if(r!==""){W({code:c,token:r,name:b}),x(!0);return}},[]),E=n.useMemo(()=>({id:"guide-rent",rowData:[{label:"Understanding the Renters' Rights Act as it becomes law: A guide for Landlords",type:"past-tenancies-view",icon:t.jsx(U,{})},{label:"",type:"action-buttons",actionButtons:[{buttonLabel:"View document",size:"small",variant:"secondary",onClick:()=>de("renters_rights_act","/files/renters_rights_act_nov_2025_version.pdf")}]}]}),[]),ee=n.useCallback((c=[])=>[...e==="in-tenancy"?[E]:[],...c.map(({documentId:r,documentCreatedDatetime:b,documentCode:_,documentSigningJavascript:d,documentUploadToken:m,documentStatus:p,documentDescription:C,documentName:te})=>{var L;const D=m&&((L=ke(p,m))==null?void 0:L.type)==="action-buttons";return{id:`${r}_${_}`,rowData:[{label:C,type:"past-tenancies-view",date:me(b,!0),icon:S(p,d).type==="view-document"&&!D?t.jsx(U,{}):t.jsx(pe,{sx:v.infoIcon})},{label:S(p,d).label,type:S(p,D?m:d).type,actionButtons:[{buttonLabel:D?"Upload":"Sign document",size:"small",variant:"primary-dark",onClick:D?()=>J(_,m??"",C):()=>{const se=De.signed===Q;q(te),j(d),se?l(!0):(X(r),A(!0))}}],onClick:()=>k(r,C)}]}})],[k,e,E]);return t.jsxs(h,{children:[Y,t.jsx(fe,{open:g,hasBackdrop:!0}),N&&t.jsx(ge,{isOpen:!0,onClose:()=>{A(!1),o(xe())},offerId:H,setOpen:l,setScript:j}),t.jsx(ye,{minFileSize:1,maxFileSize:be,uploadDocumentCode:u.code,documentUploadToken:u.token,drawerDescription:t.jsxs(Ce,{sx:v.drawerInfo,children:["Please upload a valid ",u.name," for your property"]}),title:`Please upload your ${u.name}`,onClose:()=>{x(!1)},onCloseAfterUpload:()=>{x(!1),o(we({propertyId:F,instructionId:I})),o(Se({propertyId:F,instructionId:I,isPropertyForSale:K}))},isOpen:Z,acceptedFiles:{"application/pdf":[]}}),t.jsx(he,{isOpen:i,onClose:()=>l(!1),script:M,drawerTitle:V}),t.jsx(Fe,{lettingsDocuments:ee(f(s))})]})};function _e(){const{property:s}=T(),e=$(a=>a.documentsReducer.allDocuments??{}),o=$(a=>{var i,l;return(l=(i=a.documentsReducer)==null?void 0:i.result)==null?void 0:l.data}),f=o==null?void 0:o.filter(a=>!["CONID","CONAD"].includes(a.documentCode)),g=e!=null&&e.lettingsDocuments?e==null?void 0:e.lettingsDocuments:[...e,...f];return t.jsxs(t.Fragment,{children:[t.jsx(je,{title:`My Foxtons: Documents${s?` for ${s.title}`:""}`,description:`My Foxtons: Documents${s?` for ${s.title}`:""}`}),t.jsx(Pe,{documents:g})]})}const Ue=n.memo(_e);export{Ue as default};
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.