1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7239],{51943:function(t,e,l){l.d(e,{Z:function(){return E}});var s=l(57437),a=l(2265),r=l(89256),o=l(43104),i=l(91584),n=l(46596),d=l(56582),w=l(50852),c=l(40071),u=l(85691),x=l(33145),p=l(73021),h=l(21770),g=l(88573),m=l(18133),b=l(17058),f=l(33700),v=l(2443),y=l(72105);let j=/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([\/\w .-]*)*\/?(\?[\w=&-]+)?$/;var N=t=>{let{initialVideos:e,propertyId:l,isDeletable:r,onHide:o,refetchProperty:n,refetch:d}=t,[w,c]=(0,a.useState)(e),[N,k]=(0,a.useState)([]),[S,C]=(0,a.useState)(null),[_,F]=(0,a.useState)(!1),[P,E]=(0,a.useState)(""),[V,D]=(0,a.useState)(!1);(0,u.PW)(V||N.some(t=>!!(null==t?void 0:t.url))),(0,a.useEffect)(()=>{c(t=>{if(!V)return e;if(!(null==e?void 0:e.length)&&t.length)return t;let l=new Set(t.map(t=>t.id)),s=new Set(e.map(t=>t.id)),a=e.filter(t=>!l.has(t.id));return[...t.filter(t=>s.has(t.id)),...a]})},[e,V]);let{mutate:M}=(0,h.D)({mutationFn:t=>(0,g.qb)({body:null==t?void 0:t.body}),onSuccess:t=>{n(),E(""),m.Toast.success("Success","".concat((null==t?void 0:t.title)||"Media"," added successfully."))},onError:t=>{E("")}}),T=t=>{if(!t)return;let e=t.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]{11})/);return e?"https://www.youtube.com/embed/".concat(e[1]):void 0},I=t=>t.includes("youtube.com")||t.includes("youtu.be"),A=(t,e)=>{E("video"),M({body:{title:"Video",resource_id:l,resource_type:"Property",category:"Video",is_external:!0,watermark:!0,order:e,file:t},type:"Video"})},B=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";try{E(e.toLowerCase()),await (0,g.JW)(t),n(),m.Toast.success("Success","".concat(e," deleted successfully.")),E("")}catch(t){console.error("Error deleting media:",t),E("")}},z=(0,v.Dy)((0,v.VT)(v.we,{activationConstraint:{distance:6}})),R=t=>{c(e=>[t,...e.filter(e=>e.id!==t.id)]),D(!0)},O=async()=>{if(V){F(!0);try{await (0,g.tm)({media:w.map((t,e)=>({id:t.id,order:e}))}),n(),null==d||d()}catch(s){var t,e,l;m.Toast.error("Error",(null==s?void 0:null===(l=s.response)||void 0===l?void 0:null===(e=l.data)||void 0===e?void 0:null===(t=e.message)||void 0===t?void 0:t.message)||"Error reordering videos."),F(!1);return}F(!1)}o()};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(p.u_,{show:!!S,onHide:()=>C(null),size:"lg",centered:!0,className:"prevent-close",children:(0,s.jsxs)(p.u_.Body,{className:"tw-p-0 tw-relative",children:[S&&(0,s.jsx)("div",{className:"tw-flex tw-justify-center tw-items-center",children:(0,s.jsx)("div",{style:{position:"relative",width:"100%",maxHeight:"70vh"},children:I(S.url)?(0,s.jsx)("iframe",{src:T(S.url),className:"tw-w-full tw-rounded-md",style:{height:"500px",border:"none"},title:"Video Preview",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0}):(0,s.jsx)("div",{className:"tw-p-6 tw-flex tw-flex-col tw-gap-4 tw-items-center tw-justify-center",style:{minHeight:"300px"},children:(0,s.jsx)("div",{className:"tw-text-center",children:(0,s.jsxs)("a",{href:S.url,target:"_blank",rel:"noopener noreferrer",className:"btn tw-items-center tw-gap-2",children:[(0,s.jsx)("span",{children:S.title||"Video Link"}),(0,s.jsx)("div",{className:"tw-text-bs-muted small tw-break-words tw-w-full tw-text-center",children:S.url})]})})})})}),(0,s.jsx)("button",{className:"tw-absolute tw-top-0 tw-right-0 tw-m-4 tw-rounded-[50%] tw-p-2 tw-flex tw-items-center tw-justify-center tw-p-2 tw-border-0",onClick:()=>C(null),children:(0,s.jsx)(x.default,{src:"/Closedark.svg",width:30,height:30,alt:"X"})})]})}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-h-full tw-min-h-0",style:{position:"relative"},children:[(0,s.jsx)(i.Z,{isVisible:!!(_||P)}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-px-4 tw-pb-4 tw-flex-1 tw-overflow-y-auto tw-min-h-0",children:[(0,s.jsxs)("div",{className:"tw-sticky tw-top-0 tw-bg-white tw-mb-4",style:{zIndex:10},children:[(0,s.jsxs)("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-3",style:{paddingTop:16,paddingBottom:16},children:[(0,s.jsxs)("div",{className:"tw-flex tw-items-center tw-gap-2",children:[(0,s.jsx)("span",{className:"tw-inline-flex tw-items-center tw-rounded-full tw-bg-gray-100 tw-px-2.5 tw-py-0.5 tw-text-xs tw-font-semibold tw-text-gray-600",children:w.length}),(0,s.jsx)("span",{className:"tw-text-xs tw-text-gray-400",children:"videos \xb7 drag to reorder"})]}),0===N.length&&(0,s.jsx)("button",{className:"tw-inline-flex tw-items-center tw-gap-1.5 tw-h-8 tw-cursor-pointer tw-rounded-md tw-bg-white tw-px-3 tw-text-xs tw-font-semibold tw-text-gray-700 tw-transition-colors hover:tw-border-gray-500 hover:tw-bg-gray-50 disabled:tw-cursor-not-allowed disabled:tw-opacity-40",style:{border:"1px dashed #D1D5DB"},disabled:"video"===P,onClick:()=>k(t=>[...t,{url:""}]),children:"+ Add video link"})]}),(0,s.jsx)("div",{style:{borderBottom:"0.5px solid #E5E7EB"}})]}),null==N?void 0:N.map((t,e)=>(0,s.jsxs)("div",{className:"tw-mb-4",children:[(0,s.jsx)("label",{htmlFor:"video".concat(e),className:"tw-block tw-text-xs tw-font-semibold tw-text-gray-600 tw-mb-1.5",children:"New Video URL"}),(0,s.jsxs)("div",{className:"tw-flex tw-gap-2",children:[(0,s.jsx)("input",{type:"text",id:"video".concat(e),placeholder:"Paste YouTube or video link hereâ¦",className:"tw-flex-1 tw-h-12 tw-rounded-md tw-border tw-border-solid tw-border-gray-300 tw-bg-white tw-px-3 tw-text-sm tw-text-gray-800 tw-outline-none focus:tw-border-gray-600",value:(null==t?void 0:t.url)||"",readOnly:"video"===P,onChange:t=>k(l=>l.map((l,s)=>s!==e?l:{...l,url:t.target.value}))}),(0,s.jsx)("button",{className:"tw-h-12 tw-cursor-pointer tw-rounded-md tw-border-0 tw-bg-gray-900 tw-px-4 tw-text-xs tw-font-semibold tw-text-white tw-transition-colors hover:tw-bg-gray-700 disabled:tw-cursor-not-allowed disabled:tw-opacity-40",disabled:(null==t?void 0:t.url)&&!j.test(null==t?void 0:t.url)||"video"===P,onClick:()=>{(null==t?void 0:t.url)?(A(t.url,(null==w?void 0:w.length)||0),k([])):k(t=>t.filter((t,l)=>l!==e))},children:"video"===P?"Loadingâ¦":(null==t?void 0:t.url)?"Submit":"Cancel"})]})]},e)),(null==w?void 0:w.length)>0&&(0,s.jsx)(v.LB,{sensors:z,collisionDetection:v.pE,onDragEnd:t=>{let{active:e,over:l}=t;if(!l||e.id===l.id)return;let s=w.findIndex(t=>String(t.id)===String(e.id)),a=w.findIndex(t=>String(t.id)===String(l.id));s<0||a<0||(c(t=>
1(0,f.Rp)(t,s,a)),D(!0))},children:(0,s.jsx)(f.Fo,{items:w.map(t=>String(t.id)),strategy:f.U2,children:(0,s.jsx)("div",{className:"tw-grid tw-grid-cols-1 tw-gap-2 md:tw-grid-cols-2",children:null==w?void 0:w.map((t,e)=>(0,s.jsx)(b.Z,{vid:t,index:e,videos:w,setVideos:c,reorderVideoMedia:R,deleteMedia:B,isDeletable:r,isYouTubeUrl:I,getYouTubeEmbedUrl:T,onVideoPreview:C,noCol:!0},t.id))})})})]}),(0,s.jsx)(y.Z,{preventClose:!0,children:(0,s.jsx)("button",{type:"button",onClick:O,disabled:_||!!P,className:"tw-h-8 tw-cursor-pointer tw-rounded-md tw-border-0 tw-bg-gray-900 tw-px-3.5 tw-text-xs tw-font-bold tw-text-white tw-transition-colors hover:tw-bg-gray-700 disabled:tw-cursor-not-allowed disabled:tw-opacity-40",children:"Save"})})]})]})},k=l(56518),S=l(40932),C=t=>{let{floorPlan:e,propertyId:l,onHide:r,refetchProperty:o,refetch:n}=t,d=(0,k.aF)(),{uploadFiles:w}=(0,S.z)(),[c,u]=(0,a.useState)(!1),[h,b]=(0,a.useState)(""),[f,v]=(0,a.useState)(!1),j=(0,a.useRef)(null),N=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";try{b(e.toLowerCase()),await (0,g.JW)(t),o(),m.Toast.success("Success","".concat(e," deleted successfully.")),b("")}catch(t){console.error("Error deleting media:",t),b("")}},C=async t=>{if(0!==t.length){b("floorplan");try{var e;await w(t,{resourceId:l,resourceType:"Property",category:"Floor Plan",title:"Floor plan",isExternal:!1,watermark:!0,order:0,divisionId:null==d?void 0:null===(e=d.branch)||void 0===e?void 0:e.division_id},{mode:"sequential",onSuccess:()=>{o(),n(),b(""),(null==j?void 0:j.current)&&(j.current.value="")},onError:()=>{b(""),(null==j?void 0:j.current)&&(j.current.value="")},successMessage:"Floor Plan uploaded successfully.",errorMessage:"Error uploading."})}catch(t){console.error("Error during upload:",t),b(""),(null==j?void 0:j.current)&&(j.current.value="")}}},_=async t=>{C(Array.from(t.target.files||[]))},F=t=>{t.preventDefault(),t.stopPropagation(),v(!0)};return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-h-full tw-min-h-0",style:{position:"relative"},children:[(0,s.jsx)(i.Z,{isVisible:!!(c||h)}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-px-4 tw-pb-4 tw-flex-1 tw-overflow-y-auto tw-min-h-0",children:[(0,s.jsxs)("div",{className:"tw-sticky tw-top-0 tw-bg-white tw-mb-4",style:{zIndex:2},children:[(0,s.jsx)("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-3",style:{paddingTop:16,paddingBottom:16},children:(0,s.jsxs)("div",{className:"tw-flex tw-items-center tw-gap-2",children:[(0,s.jsx)("span",{className:"tw-inline-flex tw-items-center tw-rounded-full tw-bg-gray-100 tw-px-2.5 tw-py-0.5 tw-text-xs tw-font-semibold tw-text-gray-600",children:(null==e?void 0:e.id)?1:0}),(0,s.jsx)("span",{className:"tw-text-xs tw-text-gray-400",children:"floor plan"})]})}),(0,s.jsx)("div",{style:{borderBottom:"0.5px solid #E5E7EB"}})]}),(null==e?void 0:e.id)?(0,s.jsx)(p.X2,{children:(0,s.jsx)(p.JX,{xs:12,md:6,children:(0,s.jsxs)("div",{className:"tw-relative tw-rounded-lg tw-overflow-hidden tw-bg-gray-100",style:{aspectRatio:"16/9",border:"1px solid #E5E7EB"},children:[(null==e?void 0:e.file_type)==="Image"?(0,s.jsx)(x.default,{src:null==e?void 0:e.url,alt:"floor plan",fill:!0,style:{objectFit:"contain"},className:"common-background tw-rounded-md"}):(0,s.jsxs)("div",{className:"tw-absolute tw-inset-0 tw-flex tw-flex-col tw-items-center tw-justify-center tw-bg-gray-50 tw-p-4",children:[(0,s.jsx)("div",{className:"tw-flex tw-items-center tw-justify-center tw-w-10 tw-h-10 tw-rounded-full tw-bg-gray-200 tw-mb-2",children:(0,s.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",className:"tw-text-gray-400",children:[(0,s.jsx)("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8l-6-6z",stroke:"currentColor",strokeWidth:"1.5",fill:"none"}),(0,s.jsx)("path",{d:"M14 2v6h6M16 13H8M16 17H8M10 9H8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}),(0,s.jsx)("span",{className:"tw-text-xs tw-text-gray-500 tw-truncate tw-max-w-full tw-px-2 tw-text-center",children:null==e?void 0:e.name})]}),(0,s.jsx)("button",{type:"button",style:{position:"absolute",top:8,right:8,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:5,background:"#fff",border:"none",cursor:"pointer",boxShadow:"0 1px 4px rgba(0,0,0,0.15)"},onClick:()=>N(null==e?void 0:e.id,"Floor Plan"),title:"Remove",children:(0,s.jsx)(x.default,{src:"/remove.
1svg",alt:"remove",width:13,height:13})})]})})}):(0,s.jsx)(p.X2,{onDragOver:F,onDragEnter:F,onDragLeave:t=>{t.preventDefault(),t.stopPropagation(),v(!1)},onDrop:t=>{t.preventDefault(),t.stopPropagation(),v(!1);let e=Array.from(t.dataTransfer.files).filter(t=>t.type.match(/^image\/(jpg|jpeg|png|gif)$/)||"application/pdf"===t.type);e.length>0&&C(e)},children:(0,s.jsx)(p.JX,{xs:12,md:6,children:(0,s.jsx)("div",{className:"tw-rounded-lg tw-flex tw-items-center tw-justify-center tw-cursor-pointer",style:{aspectRatio:"16/9",border:"2px dashed ".concat(f?"#6366F1":"#D1D5DB"),backgroundColor:f?"rgba(99,102,241,0.04)":"#FAFAFA",transition:"all 0.2s ease"},onClick:()=>{var t;return null==j?void 0:null===(t=j.current)||void 0===t?void 0:t.click()},children:(0,s.jsxs)("div",{className:"tw-text-center tw-flex tw-flex-col tw-items-center tw-gap-2",children:[(0,s.jsx)("div",{className:"tw-flex tw-items-center tw-justify-center tw-w-10 tw-h-10 tw-rounded-full tw-bg-gray-100",children:(0,s.jsx)(x.default,{src:"/Upload.svg",alt:"Upload",width:20,height:20})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"tw-text-sm tw-font-semibold tw-text-gray-700 tw-mb-0.5",children:"Click to upload floor plan"}),(0,s.jsx)("p",{className:"tw-text-xs tw-text-gray-400 tw-mb-0",children:"or drag and drop"})]})]})})})})]}),(0,s.jsx)("input",{type:"file",className:"tw-hidden",ref:j,accept:".jpg,.jpeg,.png,.gif,.pdf",onChange:_}),(0,s.jsx)(y.Z,{preventClose:!0,children:(0,s.jsx)("button",{type:"button",onClick:r,disabled:c||!!h,className:"tw-h-8 tw-cursor-pointer tw-rounded-md tw-border-0 tw-bg-gray-900 tw-px-3.5 tw-text-xs tw-font-bold tw-text-white tw-transition-colors hover:tw-bg-gray-700 disabled:tw-cursor-not-allowed disabled:tw-opacity-40",children:"Done"})})]})})};let _=/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([\/\w .-]*)*\/?(\?[\w=&-]+)?$/;var F=t=>{let e,{virtualTour:l,propertyId:r,onHide:o,refetchProperty:i}=t,[n,d]=(0,a.useState)(null);(0,u.PW)(!!(null==n?void 0:n.url));let w=(0,u.Le)(!!(null==n?void 0:n.url)),[c,b]=(0,a.useState)(!1),[f,v]=(0,a.useState)(""),{mutate:j}=(0,h.D)({mutationFn:t=>(0,g.qb)({body:null==t?void 0:t.body}),onSuccess:t=>{i(),v(""),m.Toast.success("Success","".concat((null==t?void 0:t.title)||"Media"," added successfully."))},onError:t=>{v("")}}),N=t=>{v("tour"),j({body:{title:"Virtual Tour",resource_id:r,resource_type:"Property",category:"Virtual Tour",is_external:!0,watermark:!0,order:0,file:t},type:"Virtual Tour"})},k=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";try{v(e.toLowerCase().replace(" ","")),await (0,g.JW)(t),i(),m.Toast.success("Success","".concat(e," deleted successfully.")),v("")}catch(t){console.error("Error deleting media:",t),v("")}};return(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-h-full tw-min-h-0",children:[(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-px-4 tw-pb-4 tw-flex-1 tw-overflow-y-auto tw-min-h-0",children:[(0,s.jsxs)("div",{className:"tw-sticky tw-top-0 tw-bg-white tw-mb-4",style:{zIndex:2},children:[(0,s.jsx)("div",{className:"tw-flex tw-items-center tw-justify-between tw-gap-3",style:{paddingTop:16,paddingBottom:16},children:(0,s.jsxs)("div",{className:"tw-flex tw-items-center tw-gap-2",children:[(0,s.jsx)("span",{className:"tw-inline-flex tw-items-center tw-rounded-full tw-bg-gray-100 tw-px-2.5 tw-py-0.5 tw-text-xs tw-font-semibold tw-text-gray-600",children:(null==l?void 0:l.id)?1:0}),(0,s.jsx)("span",{className:"tw-text-xs tw-text-gray-400",children:"virtual tour"})]})}),(0,s.jsx)("div",{style:{borderBottom:"0.5px solid #E5E7EB"}})]}),(null==l?void 0:l.id)?(0,s.jsx)(p.X2,{children:(0,s.jsx)(p.JX,{xs:12,md:6,children:(0,s.jsxs)("div",{className:"tw-relative tw-rounded-lg tw-overflow-hidden tw-bg-gray-100",style:{aspectRatio:"16/9",border:"1px solid #E5E7EB"},children:[(e=l.url).includes("youtube.com")||e.includes("youtu.be")?(0,s.jsx)("iframe",{src:(t=>{if(!t)return;let e=t.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]{11})/);return e?"https://www.youtube.com/embed/".concat(e[1]):void 0})(l.url),className:"tw-absolute tw-inset-0 tw-w-full tw-h-full",style:{border:"none"},title:"Virtual Tour",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0}):(0,s.jsxs)("div",{className:"tw-absolute tw-inset-0 tw-flex tw-flex-col tw-items-center tw-justify-center tw-bg-gray-50 tw-p-4",children:[(0,s.jsx)("div",{className:"tw-flex tw-items-center tw-justify-center tw-w-10 tw-h-10 tw-rounded-full tw-bg-gray-200 tw-mb-2",children:(0,s.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",className:"tw-text-gray-400",children:[(0,s.jsx)("path",{d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z",fill:"
1currentColor"}),(0,s.jsx)("path",{d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]})}),(0,s.jsx)("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",className:"tw-text-xs tw-text-gray-500 tw-break-all tw-text-center hover:tw-text-gray-700",children:l.title||l.url})]}),(0,s.jsx)("button",{type:"button",style:{position:"absolute",top:8,right:8,zIndex:2,display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:5,background:"#fff",border:"none",cursor:"pointer",boxShadow:"0 1px 4px rgba(0,0,0,0.15)"},onClick:()=>k(null==l?void 0:l.id,"Virtual Tour"),title:"Remove",children:(0,s.jsx)(x.default,{src:"/remove.svg",alt:"remove",width:13,height:13})})]})})}):(0,s.jsxs)("div",{className:"tw-flex tw-gap-2",children:[(0,s.jsx)("input",{type:"text",placeholder:"Paste virtual tour link hereâ¦",className:"tw-flex-1 tw-h-12 tw-rounded-md tw-border tw-border-solid tw-border-gray-300 tw-bg-white tw-px-3 tw-text-sm tw-text-gray-800 tw-outline-none focus:tw-border-gray-600",value:(null==n?void 0:n.url)||"",readOnly:"tour"===f,onChange:t=>d({url:t.target.value})}),(0,s.jsx)("button",{className:"tw-h-12 tw-cursor-pointer tw-rounded-md tw-border-0 tw-bg-gray-900 tw-px-4 tw-text-xs tw-font-semibold tw-text-white tw-transition-colors hover:tw-bg-gray-700 disabled:tw-cursor-not-allowed disabled:tw-opacity-40",disabled:(null==n?void 0:n.url)&&!_.test(null==n?void 0:n.url)||"tour"===f,onClick:()=>{(null==n?void 0:n.url)&&N(n.url)},children:"tour"===f?"Loadingâ¦":"Submit"})]})]}),(0,s.jsx)(y.Z,{preventClose:!0,children:(0,s.jsx)("button",{type:"button",onClick:()=>w(o),disabled:c||!!f,className:"tw-h-8 tw-cursor-pointer tw-rounded-md tw-border-0 tw-bg-gray-900 tw-px-3.5 tw-text-xs tw-font-bold tw-text-white tw-transition-colors hover:tw-bg-gray-700 disabled:tw-cursor-not-allowed disabled:tw-opacity-40",children:"Done"})})]})},P=l(33233),E=t=>{let{propertyId:e,property:l,onHide:u,refetch:x,isDeletable:p=!0,successMessage:h="Reordered",isProperty:g=!1,dndKey:m}=t,[b,f]=(0,a.useState)("images"),[v,y]=(0,a.useState)([]),[j,k]=(0,a.useState)([]),[S,_]=(0,a.useState)(null),[E,V]=(0,a.useState)(null),{data:D}=(0,r.kP)();null==D||D.user;let{propertyData:M,propertyLoading:T,RefetchProperty:I,isRefetchingProperty:A}=(0,n.Pi)(!0,{and:[{field:"id",op:"=",value:e}]});return(0,a.useEffect)(()=>{y((0,o.sortBy)((null==M?void 0:M.images)||[],"order")),k((0,o.sortBy)((null==M?void 0:M.videos)||[],"order")),_(null==M?void 0:M.virtual_tour),V(null==M?void 0:M.floor_plan)},[M]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.Z,{isVisible:A}),(0,s.jsxs)("div",{className:"tw-flex tw-h-full tw-min-h-0 tw-flex-col",children:[(0,s.jsx)(d.Z,{title:"Edit Property Media",onBack:u,onClose:u}),(0,s.jsx)(w.Z,{tabs:[{id:"images",label:"Images"},{id:"archives",label:"Archived images"},{id:"videos",label:"Videos"},{id:"floorplan",label:"Floor plan"},{id:"virtualtour",label:"Virtual tour"}],activeTab:b,onTabChange:t=>f(t)}),(0,s.jsxs)("div",{className:"tw-flex-1 tw-min-h-0 tw-flex tw-flex-col tw-overflow-hidden",children:["images"===b&&(0,s.jsx)(c.Z,{initialImages:v,propertyId:null==l?void 0:l.id,isDeletable:p,onHide:u,refetchProperty:I,refetch:x}),"videos"===b&&(0,s.jsx)(N,{initialVideos:j,propertyId:null==l?void 0:l.id,isDeletable:p,onHide:u,refetchProperty:I,refetch:x}),"floorplan"===b&&(0,s.jsx)(C,{floorPlan:E,propertyId:null==l?void 0:l.id,onHide:u,refetchProperty:I,refetch:x}),"virtualtour"===b&&(0,s.jsx)(F,{virtualTour:S,propertyId:null==l?void 0:l.id,onHide:u,refetchProperty:I}),"archives"===b&&(0,s.jsx)(P.Z,{refetch:x,propertyId:null==l?void 0:l.id,onHide:u,refetchProperty:I})]})]})]})}},17058:function(t,e,l){var s=l(57437),a=l(2265),r=l(33145),o=l(73021),i=l(71104),n=l(58710);e.Z=t=>{let{vid:e,index:l,reorderVideoMedia:d,deleteMedia:w,isDeletable:c=!0,isYouTubeUrl:u,getYouTubeEmbedUrl:x,onVideoPreview:p,enableDragDrop:h=!0,noCol:g=!1}=t,[m,b]=(0,a.useState)(!1),{attributes:f,listeners:v,setNodeRef:y,transform:j,transition:N,isDragging:k}=(0,i.nB)({id:String(e.id),disabled:!h}),S=(0,s.jsxs)("div",{ref:y,className:"tw-relative tw-rounded-lg tw-overflow-hidden tw-bg-gray-100",style:{aspectRatio:"16/9",isolation:"isolate",cursor:h?"grab":"default",transform:n.ux.Transform.toString(j),transition:N,border:"1px solid #E5E7EB",opacity:k?.5:1},...f,...v,onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),children:[u(e.url)?(0,s.jsx)("iframe",{src:x(e.url),className:"tw-absolute tw-inset-0 tw-w-full tw-h-full",style:{border:"none",pointerEvents:"none"},title:"Video ".concat(l+1),allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0}):(0,s.jsxs)("div",{className:"tw-absolute tw-inset-0 tw-flex tw-flex-col tw-items-center tw-justify-center tw-bg-gray-50 tw-p-3 tw-gap-2",children:[(0,s.jsx)("div",{className:"tw-flex tw-items-center tw-justify-center tw-w-10 tw-h-10 tw-rounded-full tw-bg-gray-200",children:(0,s.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",className:"tw-text-gray-400",children:[(0,s.jsx)("path",{d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z",fill:"
1currentColor"}),(0,s.jsx)("path",{d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})]})}),(0,s.jsx)("span",{className:"tw-text-xs tw-text-gray-400 tw-truncate tw-max-w-full tw-px-2 tw-text-center",children:e.title||e.url})]}),0===l&&(0,s.jsxs)("div",{style:{position:"absolute",top:8,left:8,zIndex:2,display:"flex",alignItems:"center",gap:4,background:"rgba(255,255,255,0.92)",borderRadius:4,padding:"2px 8px",fontSize:11,fontWeight:600,color:"#374151",boxShadow:"0 1px 3px rgba(0,0,0,0.1)",pointerEvents:"none"},children:[(0,s.jsx)(r.default,{src:"/star.svg",alt:"",width:11,height:11}),"Primary"]}),m&&(0,s.jsx)("div",{style:{position:"absolute",inset:0,zIndex:1,background:"rgba(0,0,0,0.30)",pointerEvents:"none"}}),m&&(0,s.jsxs)("div",{style:{position:"absolute",top:8,right:8,zIndex:3,display:"flex",flexDirection:"column",gap:4},children:[c&&(0,s.jsx)("button",{type:"button",style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:5,background:"#fff",border:"none",cursor:"pointer",boxShadow:"0 1px 4px rgba(0,0,0,0.15)"},onClick:t=>{t.stopPropagation(),w(e.id,"Video")},title:"Delete",children:(0,s.jsx)(r.default,{src:"/remove.svg",alt:"",width:13,height:13})}),(0,s.jsx)("button",{type:"button",style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:5,background:"#fff",border:"none",cursor:"pointer",boxShadow:"0 1px 4px rgba(0,0,0,0.15)"},onClick:t=>{t.stopPropagation(),p(e)},title:"Preview",children:(0,s.jsx)(r.default,{src:"/Eye-fill.svg",alt:"",width:13,height:13})})]}),m&&h&&0!==l&&d&&(0,s.jsx)("button",{type:"button",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:3,background:"rgba(0,0,0,0.65)",border:"none",borderRadius:4,padding:"6px 14px",fontSize:12,fontWeight:600,color:"#fff",cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 1px 4px rgba(0,0,0,0.15)"},onClick:t=>{t.stopPropagation(),d(e)},children:"Set as primary"})]});return g?S:(0,s.jsx)(o.JX,{xs:12,md:6,style:{opacity:k?.5:1},children:S})}},42026:function(t,e,l){l.d(e,{Z:function(){return H}});var s=l(57437),a=l(2265),r=l(33145),o=l(29501),i=l(85994),n=l.n(i),d=l(5375);l(21005);var w=l(69650);let c=t=>{let e=Number(t);return isNaN(e)||""===t?null:e},u=[1,2,3,4,5,6,7,8,9,10].map(t=>({label:t,value:t,size:"number"})),x="tw-flex tw-flex-1 tw-h-9 tw-cursor-pointer tw-items-center tw-justify-center tw-rounded tw-border-solid tw-text-xs tw-transition-colors tw-select-none tw-bg-white",p="tw-border-2 tw-border-gray-900 tw-text-gray-900 tw-font-semibold",h="tw-border tw-border-gray-200 tw-text-gray-500 tw-font-normal hover:tw-border-gray-300 hover:tw-text-gray-700",g="tw-h-[48px] tw-rounded tw-border tw-border-solid tw-bg-white tw-px-3.5 tw-text-left tw-text-sm tw-text-gray-900 tw-outline-none placeholder:tw-text-gray-400 focus:tw-ring-2 focus:tw-ring-gray-100 focus:tw-ring-offset-0",m="tw-h-[48px] tw-rounded tw-border tw-border-solid tw-bg-white tw-pl-3.5 tw-pr-12 tw-text-left tw-text-sm tw-text-gray-900 tw-outline-none placeholder:tw-text-gray-400 focus:tw-ring-2 focus:tw-ring-gray-100 focus:tw-ring-offset-0",b=t=>{let{label:e}=t;return(0,s.jsxs)("div",{className:"tw-flex tw-items-center tw-gap-3",children:[(0,s.jsx)("span",{className:"tw-shrink-0 tw-text-[10px] tw-font-semibold tw-uppercase tw-tracking-widest tw-text-gray-400",children:e}),(0,s.jsx)("div",{className:"tw-h-px tw-flex-1 tw-bg-gray-100"})]})},f=t=>{let{children:e}=t;return(0,s.jsx)("span",{className:"tw-text-xs tw-font-medium tw-text-gray-500",children:e})};var v=t=>{let{property:e,isLastTab:l,onPrevious:i,formData:v,setFormData:y,isLoading:j,onSaveAll:N}=t,{register:k,watch:S,setValue:C,formState:{errors:_}}=(0,o.cI)({mode:"onChange",defaultValues:v,values:v}),F=S();(0,a.useEffect)(()=>{let t=S(t=>y(t));return()=>t.unsubscribe()},[S,y]);let P=()=>!!F.occupancy_status&&("Rented"===F.occupancy_status?!!(F.leased_at&&F.leased_till):"Off Plan"!==F.completion_status||!!F.handover_date),E=async t=>{await N(t)},V=(t,e)=>(0,s.jsxs)("div",{className:"tw-flex tw-h-[48px] tw-cursor-pointer tw-items-center tw-gap-2 tw-rounded tw-border tw-border-solid tw-px-3.5 tw-shadow-sm tw-transition-colors ".concat(e?"tw-border-red-300":"tw-border-gray-200 hover:tw-border-gray-400"),children:[(0,s.jsx)(r.default,{src:"/calendar.svg",alt:"calendar",width:16,height:16,className:"tw-opacity-50 tw-shrink-0"}),(0,s.jsx)("span",{className:"tw-text-sm tw-text-gray-900",children:t})]});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"tw-flex-1 tw-min-h-0 tw-overflow-y-auto tw-p-6",children:(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-6",children:[(0,s.jsx)("input",{type:"hidden",...k("occupancy_status",{required:"Occupancy is required."})}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-4",children:[(0,s.jsx)(b,{label:"Basic facts"}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1",children:[(0,s.jsx)(f,{children:"Bedrooms"}),(0,s.jsx)(w.ZP,{options:w.H4,selected:F.bedrooms,onSelect:t=>C("bedrooms",t)})]}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1",children:[(0,s.jsx)(f,{children:"Bathrooms"}),(0,s.jsx)(w.ZP,{options:u,selected:F.bathrooms,onSelect:t=>C("bathrooms",t)})]}
1),(0,s.jsxs)("div",{className:"tw-grid tw-grid-cols-2 tw-gap-4",children:[(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1.5",children:[(0,s.jsx)(f,{children:"BUA size"}),(0,s.jsxs)("div",{className:"tw-relative",children:[(0,s.jsx)("input",{type:"number",className:m,style:{width:"100%",boxShadow:"none",textAlign:"left",borderColor:"#e5e7eb"},...k("size",{setValueAs:c}),placeholder:"Build up area"}),(0,s.jsx)("span",{className:"tw-pointer-events-none tw-absolute tw-right-3.5 tw-top-1/2 -tw-translate-y-1/2 tw-text-xs tw-font-medium tw-text-gray-400",children:"sq.ft"})]})]}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1.5",children:[(0,s.jsx)(f,{children:"Plot size"}),(0,s.jsxs)("div",{className:"tw-relative",children:[(0,s.jsx)("input",{type:"number",className:m,style:{width:"100%",boxShadow:"none",textAlign:"left",borderColor:"#e5e7eb"},...k("plot_size",{setValueAs:c}),placeholder:"Plot area"}),(0,s.jsx)("span",{className:"tw-pointer-events-none tw-absolute tw-right-3.5 tw-top-1/2 -tw-translate-y-1/2 tw-text-xs tw-font-medium tw-text-gray-400",children:"sq.ft"})]})]})]}),(0,s.jsxs)("div",{className:"tw-grid tw-grid-cols-2 tw-gap-4",children:[(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1.5",children:[(0,s.jsx)(f,{children:"Floor"}),(0,s.jsx)("input",{type:"number",className:g,style:{width:"100%",boxShadow:"none",textAlign:"left",borderColor:"#e5e7eb"},...k("floor"),placeholder:"Floor number"})]}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1.5",children:[(0,s.jsx)(f,{children:"Stories"}),(0,s.jsx)("input",{type:"number",className:g,style:{width:"100%",boxShadow:"none",textAlign:"left",borderColor:"#e5e7eb"},...k("stories",{setValueAs:c}),placeholder:"Number of stories"})]})]}),(0,s.jsxs)("div",{className:"tw-grid tw-grid-cols-2 tw-gap-4",children:[(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1.5",children:[(0,s.jsx)(f,{children:"Plot number"}),(0,s.jsx)("input",{type:"text",className:g,style:{width:"100%",boxShadow:"none",textAlign:"left",borderColor:"#e5e7eb"},...k("plot_number"),placeholder:"Plot number"})]}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1.5",children:[(0,s.jsx)(f,{children:"Makani number"}),(0,s.jsx)("input",{type:"text",className:g,style:{width:"100%",boxShadow:"none",textAlign:"left",borderColor:"#e5e7eb"},...k("makani"),placeholder:"Makani number"})]})]}),(0,s.jsx)("div",{className:"tw-grid tw-grid-cols-2 tw-gap-4",children:(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1.5",children:[(0,s.jsx)(f,{children:"Service charges"}),(0,s.jsxs)("div",{className:"tw-relative",children:[(0,s.jsx)("input",{type:"number",className:m,style:{width:"100%",boxShadow:"none",textAlign:"left",borderColor:"#e5e7eb"},...k("service_charges",{setValueAs:c}),placeholder:"Amount"}),(0,s.jsx)("span",{className:"tw-pointer-events-none tw-absolute tw-right-3.5 tw-top-1/2 -tw-translate-y-1/2 tw-text-xs tw-font-medium tw-text-gray-400",children:"AED"})]})]})})]}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-4",children:[(0,s.jsx)(b,{label:"Occupancy"}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1.5",children:[(0,s.jsxs)(f,{children:["Vacancy status ",(0,s.jsx)("span",{className:"tw-text-red-500",children:"*"})]}),(0,s.jsxs)("div",{className:"tw-flex tw-gap-2",children:[(0,s.jsx)("label",{className:"".concat(x," ").concat("Vacant"===F.occupancy_status?p:h),onClick:()=>{C("occupancy_status","Vacant",{shouldValidate:!0}),C("leased_at","",{shouldValidate:!0}),C("leased_till","",{shouldValidate:!0})},children:"Vacant"}),(0,s.jsx)("label",{className:"".concat(x," ").concat("Rented"===F.occupancy_status?p:h),onClick:()=>C("occupancy_status","Rented",{shouldValidate:!0}),children:"Rented"}),(0,s.jsx)("label",{className:"".concat(x," ").concat("VOT"===F.occupancy_status?p:h),onClick:()=>{C("occupancy_status","VOT",{shouldValidate:!0}),C("leased_at","",{shouldValidate:!0}),C("leased_till","",{shouldValidate:!0})},children:"Vacant on transfer"})]})]}),"Rented"===F.occupancy_status&&(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1.5",children:[(0,s.jsx)(f,{children:"Leasing period"}),(0,s.jsxs)("div",{className:"tw-flex tw-items-center tw-gap-3",children:[(0,s.jsx)("div",{className:"tw-flex-1",children:(0,s.jsx)(n(),{selected:F.leased_at?new Date(F.leased_at):null,onChange:t=>{C("leased_at",t?(0,d.Z)(t).startOf("day").toISOString():"",{shouldValidate:!0})},maxDate:F.leased_till?(0,d.Z)(F.leased_till).subtract(1,"day").toDate():void 0,dateFormat:"dd MMM, yyyy",popperPlacement:"right-start",placeholderText:"From",wrapperClassName:"tw-w-full",customInput:V(F.leased_at?(0,d.Z)(F.leased_at).format("DD MMM, YYYY"):"From",!!_.leased_at)})}),(0,s.jsx)("span",{className:"tw-shrink-0 tw-text-sm tw-text-gray-400",children:"â"}),(0,s.jsx)("div",{className:"tw-flex-1",children:(0,s.jsx)(n(),{selected:F.leased_till?new Date(F.leased_till):null,onChange:t=>{C("leased_till",t?(0,d.Z)(t).endOf("day").toISOString():"",{shouldValidate:!0})},minDate:F.leased_at?(0,d.Z)(F.leased_at).add(1,"day").toDate():new Date,dateFormat:"dd MMM, yyyy",placeholderText:"To",wrapperClassName:"tw-w-full",customInput:V(F.leased_till?(0,d.Z)(F.leased_till).format("DD MMM, YYYY"):"To",!!_.leased_till)})})]})]})]}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-4",children:[(0,s.jsx)(b,{label:"Completion"}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1.5",children:[(0,s.jsx)(f,{children:"Completion status"}),(0,s.jsxs)("div",{className:"tw-flex tw-gap-2",children:[(0,s.jsx)("label",{className:"".concat(x," ").concat("Ready"===F.completion_status?p:h),onClick:()=>{C("completion_status","Ready",{shouldValidate:!0}),C("handover_date","",{shouldValidate:!0})},children:"Ready"}),(0,s.jsx)("label",{className:"".concat(x," ").concat("Off Plan"===F.completion_status?p:h),onClick:()=>C("completion_status","Off Plan",{shouldValidate:!0}),children:"Off Plan"})]})]}),"Off Plan"===F.completion_status&&(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1.5",children:[(0,s.jsx)(f,{children:"Handover date"}),(0,s.jsx)("div",{className:"tw-w-1/2",children:(0,s.jsx)(n(),{selected:F.handover_date?new Date(F.handover_date):null,onChange:t=>{C("handover_date",t?(0,d.Z)(t).toISOString():"",{shouldValidate:!0})},minDate:new Date,dateFormat:"dd MMM, yyyy",placeholderText:"Select handover date",wrapperClassName:"tw-w-full",customInput:V(F.handover_date?(0,d.Z)(F.handover_date).format("DD MMM, YYYY"):"Select date",!!_.handover_date)})})]})]})]})}),(0,s.jsx)("div",{className:"tw-shrink-0 tw-flex tw-items-center tw-justify-end tw-gap-3 tw-bg-white tw-px-6 tw-py-3",style:{borderTop:"1px solid #F3F4F6"},children:l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",onClick:i,disabled:j,className:"tw-h-8 tw-cursor-pointer tw-rounded-md tw-bg-white tw-px-3.5 tw-text-xs tw-font-bold tw-text-gray-900 tw-transition-colors hover:tw-bg-gray-50 disabled:tw-opacity-40",style:{border:"1.5px solid #111827"},children:"Previous"}),(0,s.jsx)("button",{type:"button",onClick:()=>E(!0),disabled:!P()||j,className:"tw-h-8 tw-cursor-pointer tw-rounded-md tw-border-0 tw-bg-gray-900 tw-px-3.5 tw-text-xs tw-font-bold tw-text-white tw-transition-colors hover:tw-bg-gray-700 disabled:tw-cursor-not-allowed disabled:tw-opacity-40",children:j?"Savingâ¦":"Save & Close"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",onClick:()=>E(!0),disabled:!P()||j,className:"tw-h-8 tw-cursor-pointer tw-rounded-md tw-bg-white tw-px-3.5 tw-text-xs tw-font-bold tw-text-gray-900 tw-transition-colors hover:tw-bg-gray-50 disabled:tw-cursor-not-allowed disabled:tw-opacity-40",style:{border:"1.5px solid #111827"},children:"Save & Close"}),(0,s.jsx)("button",{type:"button",onClick:()=>E(!1),disabled:!P()||j,className:"tw-h-8 tw-cursor-pointer tw-rounded-md tw-border-0 tw-bg-gray-900 tw-px-3.5 tw-text-xs tw-font-bold tw-text-white tw-transition-colors hover:tw-bg-gray-700 disabled:tw-cursor-not-allowed disabled:tw-opacity-40",children:j?"Savingâ¦":"Save & Next"})]})})]})},y=l(55008);let j="tw-flex tw-h-9 tw-cursor-pointer tw-items-center tw-justify-center tw-rounded tw-border-solid tw-bg-white tw-text-xs tw-font-medium tw-transition-colors tw-select-none",N="tw-border-2 tw-border-gray-900 tw-text-gray-900",k="tw-border tw-border-gray-200 tw-text-gray-500 hover:tw-border-gray-400",S="tw-flex tw-flex-1 tw-h-9 tw-cursor-pointer tw-items-center tw-justify-center tw-rounded tw-border-solid tw-text-xs tw-transition-colors tw-select-none tw-bg-white",C="tw-border-2 tw-border-gray-900 tw-text-gray-900 tw-font-semibold",_="tw-border tw-border-gray-200 tw-text-gray-500 tw-font-normal hover:tw-border-gray-300 hover:tw-text-gray-700",F=t=>{let{label:e}=t;return(0,s.jsxs)("div",{className:"tw-flex tw-items-center tw-gap-3",children:[(0,s.jsx)("span",{className:"tw-shrink-0 tw-text-[10px] tw-font-semibold tw-uppercase tw-tracking-widest tw-text-gray-400",children:e}),(0,s.jsx)("div",{className:"tw-h-px tw-flex-1 tw-bg-gray-100"})]})},P=t=>{let{children:e}=t;return(0,s.jsx)("span",{className:"tw-text-xs tw-font-medium tw-text-gray-500",children:e})};var E=t=>{var e;let{property:l,isLastTab:r,onPrevious:i,formData:n,setFormData:d,isLoading:w,onSaveAll:c}=t,{watch:u,setValue:x}=(0,o.cI)({mode:"onChange",defaultValues:n,values:n}),p=u();(0,a.useEffect)(()=>{let t=u(t=>d(t));return()=>t.unsubscribe()},[u,d]);let h=t=>{let e=p.view||[];e.includes(t)?x("view",e.filter(e=>e!==t)):e.length<3&&x("view",[...e,t])},g=async t=>{await c(t)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"tw-flex-1 tw-min-h-0 tw-overflow-y-auto tw-p-6",children:(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-6",children:[(0,s.jsx)(F,{label:"Property features"}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1",children:[(0,s.jsx)(P,{children:"Furnishing status"}),(0,s.jsx)("div",{className:"tw-flex tw-gap-2",children:[{value:"Furnished",label:"Furnished"},{value:"Partially Furnished",label:"Partly furnished"},{value:"Unfurnished",label:"Unfurnished"}].map(t=>{let{value:e,label:l}=t;return(0,s.jsx)("label",{className:"".concat(S," ").concat(p.furnishing===e?C:_),onClick:()=>x("furnishing",e),children:l},e)})})]}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1",children:[(0,s.jsx)(P,{children:"Renovation status"}),(0,s.jsx)("div",{className:"tw-flex tw-gap-2",children:[{value:"Partially Upgraded",label:"Partially upgraded"},{value:"Upgraded",label:"Upgraded"}].map(t=>{let{value:e,label:l}=t;return(0,s.jsx)("label",{className:"".concat(S," ").concat(p.renovation===e?C:_),onClick:()=>x("renovation",e),children:l},e)})})]}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1",children:[(0,s.jsx)(P,{children:"Managed"}),(0,s.jsxs)("div",{className:"tw-flex tw-gap-2",children:[(0,s.jsx)("label",{className:"".concat(S," ").concat(!0===p.is_managed?C:_),onClick:()=>x("is_managed",!0),children:"Managed"}),(0,s.jsx)("label",{className:"".concat(S," ").concat(!1===p.is_managed?C:_),onClick:()=>x("is_managed",!1),children:"Not managed"})]})]}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1",children:[(0,s.jsx)(P,{children:"Parking space
1s"}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-wrap tw-gap-1.5",children:[(0,s.jsx)("label",{className:"".concat(j," tw-px-2.5 ").concat(0===p.parkings?N:k),onClick:()=>x("parkings",0),children:"None"}),[1,2,3,4,5,6,7,8,9,10].map(t=>(0,s.jsx)("label",{className:"".concat(j," tw-w-9 ").concat(p.parkings===t?N:k),onClick:()=>x("parkings",t),children:t},t))]})]}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1",children:[(0,s.jsxs)("div",{className:"tw-flex tw-items-center tw-gap-2",children:[(0,s.jsx)(P,{children:"Views"}),(0,s.jsxs)("span",{className:"tw-text-[10px] tw-text-gray-400",children:[(null===(e=p.view)||void 0===e?void 0:e.length)||0,"/3 selected"]})]}),(0,s.jsx)("div",{className:"tw-flex tw-flex-wrap tw-gap-1.5",children:null===y.views||void 0===y.views?void 0:y.views.map(t=>{var e,l;let a=null===(e=p.view)||void 0===e?void 0:e.includes(t),r=!a&&((null===(l=p.view)||void 0===l?void 0:l.length)||0)>=3;return(0,s.jsx)("label",{className:"".concat(j," tw-px-3 ").concat(a?N:r?"tw-border tw-border-gray-100 tw-text-gray-300 tw-cursor-not-allowed":k),onClick:()=>!r&&h(t),style:{cursor:r?"not-allowed":"pointer"},children:t},t)})})]})]})}),(0,s.jsx)("div",{className:"tw-shrink-0 tw-flex tw-items-center tw-justify-end tw-gap-3 tw-bg-white tw-px-6 tw-py-3",style:{borderTop:"1px solid #F3F4F6"},children:r?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",onClick:i,disabled:w,className:"tw-h-8 tw-cursor-pointer tw-rounded-md tw-bg-white tw-px-3.5 tw-text-xs tw-font-bold tw-text-gray-900 tw-transition-colors hover:tw-bg-gray-50 disabled:tw-opacity-40",style:{border:"1.5px solid #111827"},children:"Previous"}),(0,s.jsx)("button",{type:"button",onClick:()=>g(!0),disabled:w,className:"tw-h-8 tw-cursor-pointer tw-rounded-md tw-border-0 tw-bg-gray-900 tw-px-3.5 tw-text-xs tw-font-bold tw-text-white tw-transition-colors hover:tw-bg-gray-700 disabled:tw-cursor-not-allowed disabled:tw-opacity-40",children:w?"Savingâ¦":"Save & Close"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",onClick:()=>g(!0),disabled:w,className:"tw-h-8 tw-cursor-pointer tw-rounded-md tw-bg-white tw-px-3.5 tw-text-xs tw-font-bold tw-text-gray-900 tw-transition-colors hover:tw-bg-gray-50 disabled:tw-cursor-not-allowed disabled:tw-opacity-40",style:{border:"1.5px solid #111827"},children:"Save & Close"}),(0,s.jsx)("button",{type:"button",onClick:()=>g(!1),disabled:w,className:"tw-h-8 tw-cursor-pointer tw-rounded-md tw-border-0 tw-bg-gray-900 tw-px-3.5 tw-text-xs tw-font-bold tw-text-white tw-transition-colors hover:tw-bg-gray-700 disabled:tw-cursor-not-allowed disabled:tw-opacity-40",children:w?"Savingâ¦":"Save & Next"})]})})]})},V=l(53665),D=l(25685),M=t=>{let{property:e,isLastTab:l,onPrevious:a,amenities:o,setAmenities:i,isLoading:n,onSaveAll:d,hasAmenities:w}=t,{listingAmenitiesData:c,listingAmenitiesLoading:u}=(0,V.hN)(),x=(0,D.sortBy)(c,"name"),p=t=>{o.includes(t)?i(o.filter(e=>e!==t)):i([...o,t])},h=async t=>{await d(t)},g=0===o.length;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"tw-flex-1 tw-min-h-0 tw-overflow-y-auto tw-p-6",children:(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-4",children:[(0,s.jsxs)("div",{className:"tw-flex tw-items-center tw-gap-3",children:[(0,s.jsx)("span",{className:"tw-shrink-0 tw-text-[10px] tw-font-semibold tw-uppercase tw-tracking-widest tw-text-gray-400",children:"Amenities"}),o.length>0&&(0,s.jsxs)("span",{className:"tw-text-[10px] tw-text-gray-400",children:[o.length," selected"]}),(0,s.jsx)("div",{className:"tw-h-px tw-flex-1 tw-bg-gray-100"})]}),u?(0,s.jsx)("div",{className:"tw-flex tw-items-center tw-justify-center tw-py-10",children:(0,s.jsxs)("svg",{className:"tw-h-5 tw-w-5 tw-animate-spin tw-text-gray-400",viewBox:"0 0 24 24",fill:"none",children:[(0,s.jsx)("circle",{className:"tw-opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"tw-opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"})]})}):(0,s.jsx)("div",{className:"tw-flex tw-flex-wrap tw-gap-2",children:x.map(t=>{let e=o.includes(t.id);return(0,s.jsxs)("div",{onClick:()=>p(t.id),className:"tw-flex tw-h-9 tw-cursor-pointer tw-items-center tw-gap-1.5 tw-rounded tw-border-solid tw-bg-white tw-px-2.5 tw-transition-colors tw-select-none ".concat(e?"tw-border-2 tw-border-gray-900":"tw-border tw-border-gray-200 hover:tw-border-gray-400"),children:[(0,s.jsx)(r.default,{src:"data:image/svg+xml;utf8,".concat(encodeURIComponent((0,D.get)(t,"icon",null))),alt:"amenity icon",width:14,height:14,className:e?"":"tw-opacity-40"}),(0,s.jsx)("span",{className:"tw-text-xs tw-font-medium ".concat(e?"tw-text-gray-900":"tw-text-gray-500"),children:(0,D.get)(t,"name")})]},t.id)})})]})}),(0,s.jsx)("div",{className:"tw-shrink-0 tw-flex tw-items-center tw-justify-end tw-gap-3 tw-bg-white tw-px-6 tw-py-3",style:{borderTop:"1px solid #F3F4F6"},children:l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",onClick:a,disabled:n,className:"tw-h-8 tw-cursor-pointer tw-rounded-md tw-bg-white tw-px-3.5 tw-text-xs tw-font-bold tw-text-gray-900 tw-transition-colors hover:tw-bg-gray-50 disabled:tw-opacity-40",style:{border:"1.5px solid #111827"},children:"Previous"}),(0,s.jsx)("button",{type:"button",onClick:()=>h(!0),disabled:n||g,className:"tw-h-8 tw-cursor-pointer tw-rounded-md tw-border-0 tw-bg-gray-900 tw-px-3.5 tw-text-xs tw-font-bold tw-text-white tw-transition-colors hover:tw-bg-gray-700 disabled:tw-cursor-not-allowed disabled:tw-opacity-40",children:n?"Savingâ¦":"Save & Close"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",onClick:()=>h(!0),disabled:n||g,className:"tw-h-8 tw-cursor-pointer tw-rounded-md tw-bg-white tw-px-3.5 tw-text-xs tw-font-bold tw-text-gray-900 tw-transition-colors hover:tw-bg-gray-50 disabled:tw-cursor-not-allowed disabled:tw-opacity-40",style:{border:"1.5px solid #111827"},children:"Save & Close"}),(0,s.jsx)("button",{type:"button",onClick:()=>h(!1),disabled:n||g,className:"tw-h-8 tw-cursor-pointer tw-rounded-md tw-border-0 tw-bg-gray-900 tw-px-3.5 tw-text-xs tw-font-bold tw-text-white tw-transition-colors hover:tw-bg-gray-700 disabled:tw-cursor-not-allowed disabled:tw-opacity-40",children:n?"Savingâ¦":"Save & Next"})]})})]})},T=l(46596),I=l(22799),A=l(68306),B=l(18133),z=l(89256),R=l(56740),O=l(85691);let Z={general:"General",features:"Features",amenities:"Amenities"},L=["general","features","amenities"];var H=t=>{let{property:e,onClose:l,refetch:r,onSuccess:o}=t,[i,n]=(0,a.useState)("general"),[d,w]=(0,a.useState)(!1),{propertyData:c,RefetchProperty:u}=(0,T.ns)(!0,{and:[{field:"id",op:"=",value:e.id}]}),{data:x}=(0,z.kP)(),{logEvent:p}=(0,R.U)(),[h,g]=(0,a.useState)(null),[m,b]=(0,a.useState)(null),[f,y]=(0,a.useState)([]);(0,a.useEffect)(()=>
1{if(c){var t,e,l,s,a,r,o;g({bedrooms:null!==(t=null==c?void 0:c.bedrooms)&&void 0!==t?t:null,bathrooms:null!==(e=null==c?void 0:c.bathrooms)&&void 0!==e?e:null,size:null!==(l=null==c?void 0:c.size)&&void 0!==l?l:null,plot_size:null!==(s=null==c?void 0:c.plot_size)&&void 0!==s?s:null,floor:(null==c?void 0:c.floor)||null,stories:null!==(a=null==c?void 0:c.stories)&&void 0!==a?a:null,plot_number:(null==c?void 0:c.plot_number)||null,makani:(null==c?void 0:c.makani)||null,service_charges:null!==(r=null==c?void 0:c.service_charges)&&void 0!==r?r:null,occupancy_status:(null==c?void 0:c.occupancy_status)||null,leased_at:(null==c?void 0:c.leased_at)||null,leased_till:(null==c?void 0:c.leased_till)||null,completion_status:(null==c?void 0:c.completion_status)||"Ready",handover_date:(null==c?void 0:c.handover_date)||null}),b({furnishing:(null==c?void 0:c.furnishing)||null,renovation:(null==c?void 0:c.renovation)||null,is_managed:!!(null==c?void 0:c.is_managed),parkings:null!==(o=null==c?void 0:c.parkings)&&void 0!==o?o:null,view:(null==c?void 0:c.view)||[]}),y((0,I.get)(c,"amenities",[]).map(t=>t.id))}},[c]);let{resetBaseline:j}=(0,O.us)({generalFormData:h,featuresFormData:m,amenitiesData:f},!!h&&!!m),N=async function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(h&&m){w(!0);try{let e={};Object.keys(h).forEach(t=>{h[t]!==c[t]&&(e[t]=h[t])}),Object.keys(m).forEach(t=>{m[t]!==c[t]&&(e[t]=m[t])});let s=(0,I.get)(c,"amenities",[]).map(t=>t.id),a=f.length!==s.length||!f.every(t=>s.includes(t)),r="amenities"===i||t&&f.length>0||!t&&f.length>0;a&&r&&(e.amenities=f),Object.keys(e).length>0&&p("update_property",e);let n={};Object.keys(h).forEach(t=>{null!==h[t]&&void 0!==h[t]&&(n[t]=h[t])});let d={};Object.keys(m).forEach(t=>{null!==m[t]&&void 0!==m[t]&&(d[t]=m[t])}),await (0,A.n8)({id:null==c?void 0:c.id,...n,...d}),r&&f.length>0&&await (0,A.Gc)({id:c.id,amenities:f}),B.Toast.success("Success","Updated property successfully."),j(),u(),t?(o(),l()):k()}catch(t){var e,s,a;B.Toast.error("Error",(null==t?void 0:null===(a=t.response)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:null===(e=s.message)||void 0===e?void 0:e.message)||"Error while updating property.")}finally{w(!1)}}},k=()=>{let t=L.indexOf(i);t<L.length-1&&n(L[t+1])},S=()=>{let t=L.indexOf(i);t>0&&n(L[t-1])},C=i===L[L.length-1],_=!h||!m;return(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-flex-1 tw-min-h-0",children:[(0,s.jsx)("div",{className:"tw-shrink-0 tw-flex tw-border-0 tw-border-b tw-border-solid tw-border-b-gray-100 tw-px-6 tw-bg-white",children:L.map(t=>(0,s.jsxs)("button",{type:"button",onClick:()=>n(t),disabled:_,className:"tw-relative tw-border-0 tw-bg-transparent tw-px-1.5 tw-py-3.5 tw-text-sm tw-transition-colors tw-cursor-pointer disabled:tw-cursor-not-allowed ".concat(i===t?"tw-font-semibold tw-text-gray-900":"tw-font-normal tw-text-gray-400 hover:tw-text-gray-600 disabled:tw-text-gray-300"),children:[Z[t],i===t&&(0,s.jsx)("span",{className:"tw-absolute tw-bottom-0 tw-left-0 tw-right-0 tw-h-0.5 tw-rounded-full tw-bg-gray-900"})]},t))}),(0,s.jsx)("div",{className:"tw-flex tw-flex-col tw-flex-1 tw-min-h-0",children:_?(0,s.jsx)("div",{className:"tw-flex-1 tw-min-h-0 tw-overflow-y-auto tw-p-6",children:(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-6",children:[(0,s.jsxs)("div",{className:"tw-flex tw-items-center tw-gap-3",children:[(0,s.jsx)("div",{className:"tw-h-3.5 tw-w-20 tw-animate-pulse tw-rounded tw-bg-gray-100"}),(0,s.jsx)("div",{className:"tw-h-px tw-flex-1 tw-animate-pulse tw-bg-gray-100"})]}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-2",children:[(0,s.jsx)("div",{className:"tw-h-3 tw-w-16 tw-animate-pulse tw-rounded tw-bg-gray-100"}),(0,s.jsx)("div",{className:"tw-flex tw-gap-2",children:Array.from({length:7}).map((t,e)=>(0,s.jsx)("div",{className:"tw-h-9 tw-w-9 tw-animate-pulse tw-rounded tw-bg-gray-100"},e))})]}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-2",children:[(0,s.jsx)("div",{className:"tw-h-3 tw-w-20 tw-animate-pulse tw-rounded tw-bg-gray-100"}),(0,s.jsx)("div",{className:"tw-flex tw-gap-2",children:Array.from({length:6}).map((t,e)=>(0,s.jsx)("div",{className:"tw-h-9 tw-w-9 tw-animate-pulse tw-rounded tw-bg-gray-100"},e))})]}
1),(0,s.jsx)("div",{className:"tw-grid tw-grid-cols-2 tw-gap-4",children:Array.from({length:4}).map((t,e)=>(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-1.5",children:[(0,s.jsx)("div",{className:"tw-h-3 tw-w-14 tw-animate-pulse tw-rounded tw-bg-gray-100"}),(0,s.jsx)("div",{className:"tw-h-[48px] tw-animate-pulse tw-rounded tw-bg-gray-100"})]},e))}),(0,s.jsxs)("div",{className:"tw-flex tw-items-center tw-gap-3",children:[(0,s.jsx)("div",{className:"tw-h-3.5 tw-w-24 tw-animate-pulse tw-rounded tw-bg-gray-100"}),(0,s.jsx)("div",{className:"tw-h-px tw-flex-1 tw-animate-pulse tw-bg-gray-100"})]}),(0,s.jsxs)("div",{className:"tw-flex tw-flex-col tw-gap-2",children:[(0,s.jsx)("div",{className:"tw-h-3 tw-w-20 tw-animate-pulse tw-rounded tw-bg-gray-100"}),(0,s.jsx)("div",{className:"tw-flex tw-gap-2",children:Array.from({length:3}).map((t,e)=>(0,s.jsx)("div",{className:"tw-h-[40px] tw-flex-1 tw-animate-pulse tw-rounded tw-bg-gray-100"},e))})]})]})}):(0,s.jsxs)(s.Fragment,{children:["general"===i&&h&&(0,s.jsx)(v,{property:c,onPrevious:S,isLastTab:C,formData:h,setFormData:g,isLoading:d,onSaveAll:N}),"features"===i&&m&&(0,s.jsx)(E,{property:c,onPrevious:S,isLastTab:C,formData:m,setFormData:b,isLoading:d,onSaveAll:N}),"amenities"===i&&(0,s.jsx)(M,{property:c,onPrevious:S,isLastTab:C,amenities:f,setAmenities:y,isLoading:d,onSaveAll:N,hasAmenities:f.length>0})]})})]})}},68306:function(t,e,l){l.d(e,{Gc:function(){return a},n8:function(){return r},ux:function(){return o}});var s=l(83302);let a=async t=>{let{id:e,amenities:l}=t,{data:a}=await (0,s.Mr)("v1/portfolio/properties/".concat(e,"/amenities"),{id:e,amenities:l});return a.data},r=async t=>{let{data:e}=t.status?await (0,s.Mr)("v1/portfolio/properties/".concat(t.id,"/status"),t):await (0,s.qF)("v1/portfolio/properties/".concat(t.id),t);return e.data},o=async t=>{let{id:e,status:l}=t,{data:a}=await (0,s.Mr)("v1/portfolio/properties/".concat(e,"/status"),{id:e,status:l});return a.data}},25685:function(t,e,l){var s=l(8946);l.o(s,"get")&&l.d(e,{get:function(){return s.get}}),l.o(s,"sortBy")&&l.d(e,{sortBy:function(){return s.sortBy}})}}]);
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.