1import{a as At,b as fi,e as Mt,f as gi,g as Ft,h as Ci,i as Lt,j as xi}from"./chunk-YHACQ55R.js";import"./chunk-7EACIQ43.js";import{a as be,b as kt,c as Vt,d as _i}from"./chunk-6F3YB5WD.js";import"./chunk-X7ZW5SEB.js";import"./chunk-BMBQXE6T.js";import"./chunk-E22FFFNV.js";import"./chunk-R7H4PYJM.js";import"./chunk-SYOGNYFN.js";import"./chunk-23OWVYZN.js";import"./chunk-WKU5U5E2.js";import"./chunk-6UBGRMWQ.js";import{d as Dt,e as hi}from"./chunk-7KBH3BTM.js";import"./chunk-7AUP6KNR.js";import{$ as si,$g as Tt,Md as Pt,Nd as ci,Od as bt,Pd as ui,Sc as de,Tc as yt,Ud as Pe,Vd as pi,Yc as wt,Zc as di,_ as we,ah as mi,ic as It,jc as li}from"./chunk-VYO4RDGN.js";import{l as pt,m as mt,n as ht,o as _t,p as ni,s as G,t as ft}from"./chunk-Z7G2JRTJ.js";import"./chunk-7CS2RLJB.js";import{Lb as St,Mb as ri,Ra as ae,Rb as vt,Sa as gt,Sb as ai,db as le,eb as Ct,tb as xt,ub as oi}from"./chunk-SAB3JYQF.js";import{$ as q,La as re,Ma as lt,Na as z,Qa as ye,Ta as dt,Ua as ei,ca as Ie,d as F,e as xe,j as Jt}from"./chunk-RL7ZPIOE.js";import"./chunk-LWIBITZ2.js";import{Ba as ut,Ca as ii,wa as ct,ya as ti}from"./chunk-4SLMYJ2W.js";import{Ba as it,Da as O,Fa as Ce,G as et,Ga as ne,M as Kt,ca as tt,cc as nt,d as Ge,dc as st,fc as j,g as Ye,gc as ot,k as Qe,lc as se,mc as A,nc as Se,oc as oe,q as Ke,qc as rt,r as Ze,rc as at,s as Je,sc as Xt,tc as H,uc as ve,v as Xe,ya as Zt}from"./chunk-ZDLU5LI5.js";import{$ as Re,$b as R,Cb as U,Cc as X,Db as J,Dc as Q,Ga as Qt,Gc as p,H as Fe,Hc as f,Hd as W,Ic as P,J as Le,Ja as Ne,Jc as _e,M as Ee,Qc as fe,Rc as ge,Sc as ee,Vb as he,Xb as v,Yb as I,Yc as $,Z as Be,Zc as te,_b as B,ac as N,bc as x,bd as Oe,cc as a,cd as ie,dc as d,dd as je,ec as D,fa as Z,fd as He,gd as qe,hb as me,lc as V,nb as l,o as pe,pa as g,pc as y,qa as C,rc as r,t as Me,vc as Ue,wb as _,wc as $e,xa as M,xc as We,xd as ze}from"./chunk-MOBT6VNX.js";import"./chunk-2JDYGTA3.js";import"./chunk-5LQHPRAQ.js";import{a as S,b as k,f as Y,i as Yt,k as Ae}from"./chunk-OLNG5T5J.js";function wi(s,u){if(s&1){let e=V();a(0,"div",5),D(1,"div",7),a(2,"div",8),y("click",function(){g(e);let i=r();return C(i.goBack())}),D(3,"svg-icon",9),d()()}}function Pi(s,u){if(s&1){let e=V();a(0,"div",6)(1,"div",10)(2,"div",11),y("click",function(){g(e);let i=r();return C(i.clearSelectedInventory())}),D(3,"svg-icon",12),d()(),a(4,"app-basic-info",13),y("_refreshData",function(){g(e);let i=r();return C(i.onBasicInfoRefresh())}),d()()}if(s&2){let e=r();l(4),x("leadData",e.selectedInventoryData)("moduleId",e.moduleId||"")("currentPipeline",e.currentPipeline)("embeddedInMapView",!0)}}var yi,K,$t,Te=Y(()=>{se();Re();Qt();Se();xe();di();yt();fi();W();se();ne();ye();Ct();gt();Ie();ve();gi();rt();yi=["mapContainer"];K=class extends google.maps.OverlayView{constructor(u,e,t){super(),this.position=u,this.map=t,this.contentDiv=document?.createElement("div"),this.contentDiv.innerHTML=e,this.contentDiv.style.position="absolute",this.contentDiv.style.transform="translate(-50%, -100%)",this.contentDiv.style.zIndex="9999",this.setMap?.(t)}onAdd(){this.getPanes?.()?.floatPane?.appendChild?.(this.contentDiv)}draw(){let e=this.getProjection?.()?.fromLatLngToDivPixel?.(this.position);e&&(this.contentDiv.style.left=e?.x+"px",this.contentDiv.style.top=e?.y+"px")}onRemove(){this.contentDiv?.parentNode&&this.contentDiv.parentNode?.removeChild(this.contentDiv)}close(){this.setMap?.(null)}},$t=(()=>{class s{constructor(e,t,i,n,o,c,m,h,w,b){this.dialogRef=e,this.data=t,this._router=i,this._utilities=n,this._inventoryService=o,this._leadService=c,this._loaderService=m,this._cd=h,this._dialog=w,this._toasterService=b,this.allInventory=[],this.selectedInventoryData=null,this.propertyInfo={},this.address="",this.propertyDetails="",this.statusTitle="",this.moduleId=null,this.moduleType=null,this.currentPipelineId=null,this.currentPipeline=null,this.allPipelines=[],this.splitTags=[],this.showAcquisitionTimeline=!1,this.PIN_ICON_PATH="M18.3641 4.63599C20.0164 6.28813 20.9614 8.51811 20.9993 10.8544C21.0372 13.1907 20.1649 15.4502 18.5671 17.155L18.3641 17.365L14.1211 21.607C13.5827 22.145 12.8599 22.4583 12.0992 22.4834C11.3385 22.5084 10.5967 22.2434 10.0241 21.742L9.88006 21.607L5.63606 17.364C3.94822 15.6762 3 13.387 3 11C3 8.61303 3.94822 6.32383 5.63606 4.63599C7.32389 2.94816 9.61309 1.99994 12.0001 1.99994C14.387 1.99994 16.6762 2.948
116 18.3641 4.63599ZM12.0001 7.99999C11.6061 7.99999 11.216 8.07759 10.852 8.22836C10.488 8.37912 10.1573 8.6001 9.87873 8.87867C9.60016 9.15725 9.37918 9.48797 9.22842 9.85194C9.07765 10.2159 9.00006 10.606 9.00006 11C9.00006 11.394 9.07765 11.7841 9.22842 12.148C9.37918 12.512 9.60016 12.8427 9.87873 13.1213C10.1573 13.3999 10.488 13.6209 10.852 13.7716C11.216 13.9224 11.6061 14 12.0001 14C12.7957 14 13.5588 13.6839 14.1214 13.1213C14.684 12.5587 15.0001 11.7956 15.0001 11C15.0001 10.2043 14.684 9.44128 14.1214 8.87867C13.5588 8.31606 12.7957 7.99999 12.0001 7.99999Z",this.inventoryMarkers=[],this.geocoder=null,this.currentMarkerWithInfoWindow=null,this.activeCustomWindow=null,this.pendingGeocodeCount=0,this.suppressMapClickClear=!1,this.messageConstant=F}ngOnInit(){this.data&&(this.allInventory=this.data?.allInventory||[],this.moduleId=this.data?.moduleId||null,this.moduleType=this.data?.moduleType||null,this.currentPipelineId=this.data?.currentPipelineId||null,this.currentPipeline=this.data?.currentPipeline||null,this.allPipelines=this.data?.allPipelines||[])}ngAfterViewInit(){let e=0,t=50,i=()=>{if(e++,this.mapContainer?.nativeElement&&typeof google<"u"&&google?.maps){let n=this.mapContainer?.nativeElement;if(n?.offsetWidth>0&&n?.offsetHeight>0){this.initializeMap();return}}e<t?setTimeout(i,100):this.mapContainer?.nativeElement&&typeof google<"u"&&google?.maps&&this.initializeMap()};setTimeout(i,300)}initializeData(){this.selectedInventoryData&&(this.propertyInfo=this.selectedInventoryData?.propertyInfo||{},this.address=this.getAddress(),this.statusTitle=this.getStatusTitle())}getAddress(){let e=this._utilities?.getMapViewLeadAddress(this.selectedInventoryData,this.propertyInfo);return e!=="Address not available"?e:this._utilities?.formatAddress?.(this.selectedInventoryData?.address,this.selectedInventoryData?.unitNo)||"N/A"}getPrimaryPrice(){return this.selectedInventoryData?this.selectedInventoryData?.yourOfferPrice??this.selectedInventoryData?.purchasePrice??null:null}getStatusTitle(){if(!this.selectedInventoryData)return"Status not available";let e=this.selectedInventoryData;return e?.mainStatusTitle||e?.status?.title||this.findStatusFromPipelines(e)||"Status not available"}findStatusFromPipelines(e){let t=e?.mainStatusId;if(!t)return"";if(this.currentPipeline?.mainStatusList?.length>0){let i=this.currentPipeline?.mainStatusList?.find(n=>n?._id===t);if(i?.title)return i?.title}return""}initializeMap(){if(!this.mapContainer?.nativeElement)return;google?.maps?.Geocoder&&(this.geocoder=new google.maps.Geocoder);let e={lat:39.8283,lng:-98.5795};google?.maps?.Map&&(this.map=new google.maps.Map(this.mapContainer?.nativeElement,{center:e,zoom:4,mapTypeId:google?.maps?.MapTypeId?.ROADMAP,scrollwheel:!0,gestureHandling:"greedy",disableDoubleClickZoom:!1}),setTimeout(()=>{this.map&&google?.maps?.event&&(google?.maps?.event?.trigger(this.map,"resize"),this.map?.setCenter(e))},300)),this.registerMapClickListener(),this.addAllInventoryMarkers()}addCurrentInventoryMarker(e){if(!this.map)return;this.updateMarkerSelection();let t=this.inventoryMarkers?.find(i=>i?.inventoryData?._id===this.selectedInventoryData?._id);t&&(google?.maps?.event?.clearListeners?.(t,"click"),t?.addListener?.("click",()=>{this.activeCustomWindow&&(this.activeCustomWindow.close(),this.activeCustomWindow=null),this.currentMarkerWithInfoWindow=t;let i=t?.inventoryData||this.selectedInventoryData;i?._id?this.fetchInventoryDetailsForMarker(i?._id,t):(this.selectedInventoryData=i,this.initializeData(),this._cd?.markForCheck(),this._cd?.detectChanges(),this.updateMapCenterAndMarkers(i),this.showInfoWindowForMarker(t,i))}))}updateMarkerSelection(){this.inventoryMarkers?.length&&this.inventoryMarkers?.forEach(e=>{let t=e?.inventoryData;if(!t)return;let i=t?._id===this.selectedInventoryData?._id,n=this.getStatusColor(t),o=this.createMarkerWithIcon(n,"assets/images/icons/inventory.svg",42,i);e?.setIcon(o),e?.setZIndex(i?1e3:1)})}addAllInventoryMarkers(){if(!this.map||!this.allInventory?.length)return;this.clearInventoryMarkers();let e=[];
1if(this.allInventory?.forEach(t=>{let i=this._utilities?.getMapItemCoordinates?.(t);if(i){let o=this._utilities?.getMapGeocodeAddress?.(t)||`${i?.lat}, ${i?.lng}`,c=google?.maps?.LatLng!=null?new google.maps.LatLng(i?.lat,i?.lng):i;this.createInventoryMarker(t,c,o);return}let n=this._utilities?.getMapGeocodeAddress?.(t);n&&e?.push({inventory:t,address:n})}),!e?.length){this.fitMapToMarkers();return}if(!this.geocoder){this.fitMapToMarkers();return}this.pendingGeocodeCount=e?.length,e?.forEach(({inventory:t,address:i},n)=>{setTimeout(()=>this.geocodeAndCreateMarker(t,i,!1),n*50)})}geocodeAndCreateMarker(e,t,i=!1){this.geocoder?.geocode({address:t},(n,o)=>{o===google?.maps?.GeocoderStatus?.OK&&n?.[0]?(this.createInventoryMarker(e,n?.[0]?.geometry?.location,t),this.onInventoryMarkerGeocoded()):o===google?.maps?.GeocoderStatus?.OVER_QUERY_LIMIT&&!i?setTimeout(()=>this.geocodeAndCreateMarker(e,t,!0),1e3):this.onInventoryMarkerGeocoded()})}onInventoryMarkerGeocoded(){this.pendingGeocodeCount--,this.pendingGeocodeCount<=0&&this.fitMapToMarkers()}fitMapToMarkers(){this._utilities?.fitMapViewToMarkers(this.map,this.inventoryMarkers)}createInventoryMarker(e,t,i){if(!google?.maps?.Marker)return;let n=new google.maps.Marker({position:t,map:this.map,title:i,icon:this.createMarkerWithIcon(this.getStatusColor(e),"assets/images/icons/inventory.svg",42,!1),optimized:!1,zIndex:1});n&&(n.inventoryData=e),n?.addListener?.("click",()=>this.onMarkerClick(n,e)),this.inventoryMarkers?.push?.(n)}onMarkerClick(e,t){this.preventMapClickClear(),this.activeCustomWindow&&(this.activeCustomWindow?.close(),this.activeCustomWindow=null),this.currentMarkerWithInfoWindow=e,this.setSelectedInventoryAndUpdate(t),this.updateMapCenterFromMarker(e,t),this.showInfoWindowForMarker(e,t),t?._id&&this.fetchInventoryDetailsForMarker(t?._id,e)}setSelectedInventoryAndUpdate(e){this.selectedInventoryData=e,this.initializeData(),this._cd?.markForCheck(),this._cd?.detectChanges()}getStatusColor(e){return e&&(e?.colorCode||e?.status?.colorCode||this.findStatusColorFromPipelines(e))||"#2196F3"}findStatusColorFromPipelines(e){let t=e?.mainStatusId;if(!t)return"";if(this.currentPipeline?.mainStatusList){let i=this.currentPipeline?.mainStatusList?.find(n=>n?._id===t);if(i?.colorCode)return i?.colorCode}return""}getStatusIcon(e){return"assets/images/icons/inventory.svg"}createMarkerWithIcon(e,t,i,n=!1){if(!google?.maps?.Size||!google?.maps?.Point)return null;let o=i/2,c=i/2-2,m=i*.5,h=(i-m)/2,w=m/24,b=`<svg width="${i}" height="${i}" viewBox="0 0 ${i} ${i}" xmlns="http://www.w3.org/2000/svg"><circle cx="${o}" cy="${o}" r="${c}" fill="${e}"/><g transform="translate(${h}, ${h}) scale(${w})"><path d="${this.PIN_ICON_PATH}" fill="white"/></g></svg>`;return{url:"data:image/svg+xml;charset=UTF-8,"+encodeURIComponent?.(b),scaledSize:new google.maps.Size(i,i),anchor:new google.maps.Point(i/2,i)}}getInfoWindowContent(e,t=0){let i=this._utilities?.getMapViewLeadAddress(e,e?.propertyInfo),n=i==="Address not available"?e?.address||"N/A":i,o=this.getStatusColor(e),c=this.getStatusIcon(e),m=e?.mainStatusTitle||e?.status?.title||this.findStatusFromPipelines(e),h=e?.salesDate?this.formatDate(e?.salesDate):"",w=e?.salesPrice!=null?this.formatCurrency(e?.salesPrice):"",b=this.formatDate(e?.inventoryCreated||e?.createdAt)||"N/A",T=this.formatCurrency(e?.valuation?.estValue||e?.estValue||e?.estimatedValue||e?.propertyInfo?.estValue||e?.propertyEstimatedValue||e?.listedPrice||e?.underCoPrice)||"N.A",E=[m?m?.charAt?.(0)?.toUpperCase?.()+m?.slice?.(1)?.toLowerCase?.():"",h||b!=="N/A"?h||b:"",w||(T!=="N.A"?T:"")].filter?.(Boolean)?.join(" \u2022 ");return` 2 <div class="w-[460px] mb-10 flex flex-col items-start gap-0 py-[16px] px-[20px] bg-transparency-0 rounded-[20px] border-[1px] border-solid border-transparency-25 shadow-[0_2px_8px_rgba(0,0,0,0.1)]"> 3 <div class="flex justify-between items-start w-full gap-[10px]"> 4 <div class="flex items-start gap-[20px] flex-1 min-w-0"> 5 <div class="w-[42px] h-[42px] p-[9px] rounded-full flex items-center justify-center flex-shrink-0" style="background-color: ${o};"> 6 <img src="${c}" class="w-6 h-6" style="filter: brightness(0) invert(1);" alt="status icon" /> 7 </div> 8 <div class="flex flex-col gap-[5px] flex-1 min-w-0"> 9 <h2 class="text-h2 font-semibold text-transparency-100 break-words">${n}</h2>
10 ${E?`<h4 class="text-h4 font-medium text-transparency-100 opacity-70 ">${E}</h4>`:""} 11 </div> 12 </div> 13 <div id="close-custom-${t}" class="flex items-center p-[5px] bg-transparency-white border-[1px] border-solid border-transparency-25 rounded-[30px] cursor-pointer"> 14 <img src="assets/images/icons/close-circle-outline.svg" class="w-6 h-6" alt="close"/> 15 </div> 16 </div> 17 </div> 18 `}clearInventoryMarkers(){this.inventoryMarkers?.forEach(e=>{e?.setMap(null)}),this.inventoryMarkers=[]}onInventoryClick(e){e&&(this.selectedInventoryData=e,this.initializeData(),this._cd?.detectChanges(),this.updateMapCenterAndMarkers(e),e?._id&&!e?.propertyInfo&&this.fetchInventoryDetails(e._id,!1))}updateMapCenterAndMarkers(e){if(!e)return;let t=this.getAddress();t&&t!=="N/A"?this.geocoder?.geocode({address:t},(i,n)=>{n===google?.maps?.GeocoderStatus?.OK&&i?.[0]&&this.setMapCenterAndUpdate(i?.[0]?.geometry?.location)}):e?.latitude&&e?.longitude&&this.setMapCenterAndUpdate({lat:Number(e?.latitude),lng:Number(e?.longitude)})}setMapCenterAndUpdate(e){this.map&&(this.map?.setCenter(e),this.map?.setZoom?.(this._utilities?.mapViewSelectedLeadZoom),this.addCurrentInventoryMarker(e),this.updateMarkerSelection(),this._cd?.detectChanges())}mergeLeadDataFromProjectInfo(e,t){let i=t?.leadData;if(!e||!i)return;e.analyticsInfo=S(S({},e?.analyticsInfo||{}),i?.analyticsInfo||{}),e?.leadCreated==null&&i?.leadCreated!=null&&(e.leadCreated=i?.leadCreated),e?.qualifiedAt==null&&i?.qualifiedAt!=null&&(e.qualifiedAt=i?.qualifiedAt),(e?.appointmentDate==null||e?.appointmentDate==="")&&i?.appointmentDate!=null&&(e.appointmentDate=i?.appointmentDate),e?.leadId==null&&i?.leadId!=null&&(e.leadId=i?.leadId),e?.leadsId==null&&i?.leadsId!=null&&(e.leadsId=i?.leadsId);let n=i?.propertyInfo?.leadId;n&&!e?.propertyInfo?.leadId&&(e.propertyInfo=k(S({},e?.propertyInfo||{}),{leadId:n}))}getLeadIdForCrmDetail(e){let t=e||{},i=t?.leadId||t?.leadsId||t?.propertyData?.leadId||t?.propertyInfo?.leadId||t?.leadData?.leadId||"";return i?String(i):null}applyCrmLeadDetailMerge(e,t){if(!e||!t)return;let i=e._id,n=k(S(S({},e.propertyInfo),t.propertyInfo),{latitude:t.propertyInfo?.latitude??e.propertyInfo?.latitude,longitude:t.propertyInfo?.longitude??e.propertyInfo?.longitude,address:t?.propertyInfo?.address??e?.propertyInfo?.address??t.address}),o=S(S({},t?.analyticsInfo||{}),e?.analyticsInfo||{});Object.assign(e,k(S(S({},t),e),{_id:i,propertyInfo:n,analyticsInfo:o,address:e?.address??t?.address??n?.address,leadCreated:e.leadCreated??t?.leadCreated??t.leadsData?.leadCreated,qualifiedAt:e?.qualifiedAt??t.qualifiedAt??t.leadsData?.qualifiedAt}))}enrichWithCrmLeadDetail(e){let t=this.getLeadIdForCrmDetail(e);return t?this._leadService?.leadInfo({leadId:t})?.pipe(Be(i=>{i?.statusCode===200&&i?.data?.leadData&&this.applyCrmLeadDetailMerge(e,i?.data?.leadData)}),Me(()=>{}),Fe(()=>pe(void 0))):pe(void 0)}fetchInventoryDetails(e,t=!1){this._loaderService?.start();let i={inventoryId:e};this._inventoryService?.projectInfo(i)?.subscribe(n=>{if(n?.statusCode===200&&n?.data){let o=n?.data?.propertyData||n?.data;this.mergeLeadDataFromProjectInfo(o,n?.data),this.enrichWithCrmLeadDetail(o).subscribe({next:()=>{this._loaderService?.stop(),this.selectedInventoryData=o,this.initializeData(),this._cd?.detectChanges();let c=this.getAddress();c&&c!==""&&c!=="N/A"&&this.geocoder?.geocode({address:c},(m,h)=>{if(h===google?.maps?.GeocoderStatus?.OK&&m?.[0]){let w=m?.[0]?.geometry?.location;if(this.map?.setCenter(w),this.addCurrentInventoryMarker(w),t&&this.inventoryMarkers?.length>0){let b=this.inventoryMarkers?.find(T=>T?.inventoryData?._id===this.selectedInventoryData?._id);if(b&&!this.activeCustomWindow){let T=this.inventoryMarkers?.findIndex(E=>E===b),L=this.getInfoWindowContent(this.selectedInventoryData,T!==-1?T:0);if(google?.maps?.OverlayView&&b?.getPosition){let E=new K(b?.getPosition?.(),L,this.map);this.activeCustomWindow=E,this.currentMarkerWithInfoWindow=b,this.attachCloseButtonToInfoWindow(T!==-1?T:0)}}}}})},error:()=>{this._loaderService?.stop()}})}else this._loaderService?.stop()},n=>{if(this._loaderService?.stop(),n?.error){let o=n?.error;this._toasterService?.showError(o?.message)}else this._toasterService?.showError(this.messageConstant?.unknownError)})}fetchInventoryDetailsForMarker(e,t){this._loaderService?.start(),this._inventoryService?.projectInfo({inventoryId:e})?.subscribe(i=>{let n=i?.statusCode===200?i?.data?.propertyData||i?.data:null,o=n||t?.inventoryData;if(o){n&&i?.data&&this.mergeLeadDataFromProjectInfo(n,i?.data);let c=n||o;this.enrichWithCrmLeadDetail(c).subscribe({next:()=>{this._loaderService?.stop(),this.selectedInventoryData=c,this.setSelectedInventoryAndUpdate(this.selectedInventoryData),this.updateMapCenterFromMarker(t,this.selectedInventoryData),this.showInfoWindowForMarker(t,this.selectedInventoryData)},error:()=>{this._loaderService?.stop(),this.selectedInventoryData=c,this.setSelectedInventoryAndUpdate(this.selectedInventoryData),this.updateMapCenterFromMarker(t,this.selectedInventoryData),this.showInfoWindowForMarker(t,this.selectedInventoryData)}})}else this._loaderService?.stop()},i=>{if(this._loaderService?.stop(),i?.error){let o=i?.error;this._toasterService?.showError(o?.message)}else this._toasterService?.showError(this.messageConstant?.unknownError);let n=t?.inventoryData;n&&(this.setSelectedInventoryAndUpdate(n),this.updateMapCenterAndMarkers(n),this.showInfoWindowForMarker(t,n))})}showInfoWindowForMarker(e,t){if(!e||!t)return;let i=this.inventoryMarkers?.findIndex(c=>c===e),n=i!==-1?i:this.inventoryMarkers?.length||0,o=this.getInfoWindowContent(t,n);google?.maps?.OverlayView&&e?.getPosition&&(this.activeCustomWindow=new K(e?.getPosition?.(),o,this.map),this.currentMarkerWithInfoWindow=e),this.attachCloseButtonToInfoWindow(n),this._cd?.markForCheck(),this._cd?.detectChanges()}attachCloseButtonToInfoWindow(e){let t=()=>{let i=document?.getElementById?.(`close-custom-${e}`);if(i){let n=i?.cloneNode?.(!0);i?.parentNode?.replaceChild?.(n,i),n?.addEventListener?.("click",o=>
18{o?.stopPropagation(),o?.preventDefault(),this.activeCustomWindow&&(this.activeCustomWindow?.close(),this.activeCustomWindow=null,this.currentMarkerWithInfoWindow=null)})}else requestAnimationFrame(t)};requestAnimationFrame(t)}navigateToInventory(e){if(!e)return;let t=this._router?.serializeUrl(this._router?.createUrlTree(["/sold/details"],{queryParams:{soldId:e}}));window.open(t,"_blank")}goBack(){this.dialogRef?.close()}formatCurrency(e){return e?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(e):""}formatDate(e){return e?typeof e=="number"?this._utilities?.dueDateFormat?.(e)?.date||"N/A":this._utilities?.dueDateFormat?.(new Date(e)?.getTime?.())?.date||"N/A":"N/A"}getCurrentInventoryData(){return this.selectedInventoryData||{}}getOfferMadeText(){return this.formatDateAndAmount(this.selectedInventoryData?.analyticsInfo?.dateOfYourOffer||this.selectedInventoryData?.firstOfferDate,this.selectedInventoryData?.analyticsInfo?.yourOfferPrice||this.selectedInventoryData?.lowestOffer||this.selectedInventoryData?.highestOffer||this.selectedInventoryData?.yourOfferPrice)}getUnderContractText(){return this.formatDateAndAmount(this.selectedInventoryData?.analyticsInfo?.underContractDate||this.selectedInventoryData?.underContractDate,this.selectedInventoryData?.analyticsInfo?.underContractPrice||this.selectedInventoryData?.underContractAmount)}getExpectedProfitText(){return this.formatDateAndAmount(this.selectedInventoryData?.analyticsInfo?.assignmentContractDate||this.selectedInventoryData?.expectedProfitDate,this.selectedInventoryData?.analyticsInfo?.assignmentFee||this.selectedInventoryData?.expectedProfit)}formatDateAndAmount(e,t){let i=[];return e&&i?.push?.(this.formatDate(e)),t&&(i?.length>0&&i?.push?.("-"),i?.push?.(this.formatCurrency(t))),i?.length>0?i?.join?.(" "):"N/A"}getFormattedCreatedDate(){let e=this.selectedInventoryData;if(!e)return"";let t=e?.inventoryCreated||e?.createdAt;return t?this.formatDate(t):"N/A"}getFormattedPrice(){if(!this.selectedInventoryData)return"N/A";let t=this.getPrimaryPrice();return t?this.formatCurrency(t):"N/A"}getFormattedEstimatedValue(){let e=this.selectedInventoryData;if(!e)return"N/A";let t=e?.valuation?.estValue||e?.estValue||e?.estimatedValue||e?.propertyInfo?.estValue||e?.propertyEstimatedValue||e?.listedPrice||e?.underCoPrice;return t?this.formatCurrency(t):"N/A"}getAiSummaryPoints(){let e=this.selectedInventoryData||{},t=e.aiSummaryPoints??e.aiSummary??e.leadData?.aiSummaryPoints??e.leadData?.aiSummary;return Array.isArray(t)&&t?.length>0?t.filter(i=>typeof i=="string"&&i?.trim()?.length>0):typeof t=="string"&&t?.trim()?t.split(/\n/).map(i=>i?.trim()).filter(Boolean):["6 calls, 2 SMS, and 3 meetings completed","Seller owns 6 properties","2 properties are active leads; remaining properties are in our database","Team is in regular contact with the seller and progressing toward securing the deal"]}getTags(){let e=this.selectedInventoryData?.tags||[];return this.splitTags=e?.map?.(t=>{let i=S({},t);return i?.name&&!i?.label&&(i.label=i?.name),(i?.colorIndex===void 0||i?.colorIndex===null)&&(i.colorIndex=0),i?._id||(i._id=i?.label),i}),this.splitTags}openAddTagDialog(){this._dialog?.open(wt,{width:"800px",panelClass:"re-new-custom-dialog",data:{subModule:"Add Tags",moduleId:this.moduleId,subModuleId:this.selectedInventoryData?._id,for:"inventory",edit:0,tagType:A?.TagsType?.LEADS,tagsDetails:this.splitTags||[]}})?.afterClosed()?.subscribe(t=>{t&&this.refreshInventoryData()})}openEditSoldInfoDialog(){if(!this.selectedInventoryData?._id)return;this._dialog?.open(de,{panelClass:"re-new-custom-dialog",disableClose:!0,width:"1120px",maxHeight:"92vh",data:k(S({},this.selectedInventoryData),{isEdit:!0,item:this.selectedInventoryData,inventoryId:this.selectedInventoryData?._id,moduleId:A?.ModuleStatusId?.SOLD})})?.afterClosed()?.subscribe(t=>{t&&this.refreshInventoryData()})}toggleAcquisitionTimeline(){this.showAcquisitionTimeline=!this.showAcquisitionTimeline}getMergedAcquisitionAnalytics(){let e=this.selectedInventoryData||{};return e.analyticsInfo||e.leadsData?.analyticsInfo||e.leadData?.analyticsInfo||e.propertyData?.analyticsInfo||{}}getCrmLeadIdForAcquisition(){let e=this.selectedInventoryData||{},t=e?.leadId||e?.leadsId||e?.propertyData?.leadId||e?.propertyInfo?.leadId||e?.leadData?.leadId||"";return t?String(t):""}acquisitionPurchaseDateRaw(){let e=this.selectedInventoryData||{};return e?.purchaseDate??e?.propertyData?.purchaseDate}acquisitionPurchasePriceRaw(){let e=this.selectedInventoryData||{};return e?.purchasePrice??e?.propertyData?.purchasePrice}openEditAcquisitionTimeline(){let e=this.getCrmLeadIdForAcquisition(),t=this.selectedInventoryData?._id?String(this.selectedInventoryData?._id
18):"",i=e||t;if(!i){this._toasterService?.showError?.("Lead not found");return}let n=this.getMergedAcquisitionAnalytics();this._dialog?.open(At,{panelClass:"re-new-custom-dialog",disableClose:!0,width:"600px",maxHeight:"92vh",data:{leadData:k(S({},this.selectedInventoryData),{_id:i,analyticsInfo:S({},n)})}})?.afterClosed()?.subscribe(c=>{c&&this.refreshInventoryData()})}refreshInventoryData(){if(!this.selectedInventoryData?._id)return;let e={inventoryId:this.selectedInventoryData?._id};this._loaderService?.start(),this._inventoryService?.projectInfo(e)?.subscribe(t=>{if(t?.statusCode===200&&t?.data){let i=t?.data?.propertyData||t?.data;this.mergeLeadDataFromProjectInfo(i,t?.data),this.enrichWithCrmLeadDetail(i).subscribe({next:()=>{this._loaderService?.stop(),this.selectedInventoryData=i;let n=this.allInventory?.findIndex(c=>c?._id===this.selectedInventoryData?._id);n!==-1&&this.allInventory&&(this.allInventory[n]=this.selectedInventoryData);let o=this.inventoryMarkers?.find(c=>c?.inventoryData?._id===this.selectedInventoryData?._id);if(o&&(o.inventoryData=this.selectedInventoryData),this.initializeData(),this._cd?.markForCheck(),this._cd?.detectChanges(),this.activeCustomWindow&&this.currentMarkerWithInfoWindow){let c=this.inventoryMarkers?.findIndex(h=>h===this.currentMarkerWithInfoWindow),m=this.getInfoWindowContent(this.selectedInventoryData,c!==-1?c:0);if(this.activeCustomWindow?.close(),google?.maps?.OverlayView&&this.currentMarkerWithInfoWindow?.getPosition){let h=new K(this.currentMarkerWithInfoWindow?.getPosition?.(),m,this.map);this.activeCustomWindow=h,this.attachCloseButtonToInfoWindow(c!==-1?c:0)}}},error:()=>{this._loaderService?.stop()}})}else this._loaderService?.stop()},t=>{if(this._loaderService?.stop(),t?.error){let i=t?.error;this._toasterService?.showError?.(i?.message)}else this._toasterService?.showError?.(this.messageConstant?.unknownError)})}registerMapClickListener(){this.map&&this.map?.addListener?.("click",()=>{this.suppressMapClickClear||this.clearSelectedInventory()})}clearSelectedInventory(){this.activeCustomWindow&&(this.activeCustomWindow?.close?.(),this.activeCustomWindow=null),this.selectedInventoryData&&(this.currentMarkerWithInfoWindow=null,this.selectedInventoryData=null,this.updateMarkerSelection(),this.fitMapToMarkers(),this._cd?.markForCheck(),this._cd?.detectChanges())}updateMapCenterFromMarker(e,t){let i=e?.getPosition?.();if(i){this.setMapCenterAndUpdate(i);return}this.updateMapCenterAndMarkers(t)}preventMapClickClear(){this.suppressMapClickClear=!0,setTimeout(()=>{this.suppressMapClickClear=!1},300)}onBasicInfoRefresh(){this.refreshInventoryData()}static{this.\u0275fac=function(t){return new(t||s)(_(nt),_(st),_(O),_(z),_(le),_(ae),_(q),_(ze),_(j),_(H))}}static{this.\u0275cmp=U({type:s,selectors:[["app-sold-map-view"]],viewQuery:function(t,i){if(t&1&&Ue(yi,5),t&2){let n;$e(n=We())&&(i.mapContainer=n.first)}},standalone:!1,decls:7,vars:2,consts:[["mapContainer",""],[1,"flex","flex-col","gap-5","h-[calc(100vh_-_50px)]"],[1,"flex","gap-[20px]","h-full","relative"],[1,"flex","flex-1","bg-transparency-0","rounded-[20px]","relative","overflow-hidden"],[1,"h-full","w-full","bg-transparency-30"],[1,"absolute","top-[10px]","right-[10px]","z-10","flex","flex-row-reverse","items-center","gap-[10px]","pointer-events-none"],[1,"flex-none","w-[560px]","flex","flex-col","self-stretch","gap-[20px]","p-[20px]","bg-transparency-15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","overflow-auto"],[1,"w-[40px]","h-[40px]","shrink-0"],["matDialogClose","",1,"flex","items-center","p-[5px]","bg-transparency-15","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","cursor-pointer","pointer-events-auto",3,"click"],["svgClass","w-[24px] h-[24px] text-transparency-100","src","assets/images/icons/close-circle-filled.svg"],[1,"flex","justify-end","self-stretch"],[1,"flex","items-center","p-[5px]","bg-transparency-15","border-[1px]","border-solid","border-transparency-25","rounded-[30px]","cursor-pointer",3,"click"],["svgClass","w-[24px] h-[24px] text-transparency-100","src","assets/images/icons/close-circle-outline.svg"],[3,"_refreshData","leadData","moduleId","currentPipeline","embeddedInMapView"]],template:function(t,i){t&1&&(a(0,"div",1)(1,"div",2)(2,"div",3),D(3,"div",4,0),v(5,wi,4,0,"div",5),d(),v(6,Pi,5,4,"div",6),d()()),t&2&&(l(5),I(i.selectedInventoryData?-1:5),l(),I(i.selectedInventoryData?6:-1))},dependencies:[Mt,ot,oe],encapsulation:2})}}return s})()});function Vi(s,u){s&1&&D(0,"svg-icon",11),s&2&&x("src","assets/images/icons/sort-ascending.svg")}function Ai(s,u){s&1&&D(0,"svg-icon",11),s&2&&x("src","assets/images/icons/sort-descending.svg")}function Mi(s,u){if(s&1&&(a(0,"span",10),v(1,Vi,1,1,"svg-icon",11),v(2,Ai,1,1,"svg-icon",11),d()),s&2){let e=u,t
18=r(2);Q("opacity-100",t.activeSortColumn===e)("opacity-30",t.activeSortColumn!==e),l(),I(t.activeSortColumn===e&&(t.sortDirections==null?null:t.sortDirections[e])===1?1:-1),l(),I(t.activeSortColumn!==e||t.activeSortColumn===e&&(t.sortDirections==null?null:t.sortDirections[e])===-1?2:-1)}}function Fi(s,u){if(s&1){let e=V();a(0,"th",8),y("click",function(){let i=g(e).$implicit,n=r();return C(n.getSortKeyForColumn(i)&&n.onSort(n.getSortKeyForColumn(i)))}),a(1,"span"),p(2),d(),v(3,Mi,3,6,"span",9),d()}if(s&2){let e,t=u.$implicit,i=r();X("width",i.getColumnWidth(t),"px"),Q("sticky",((t==null?null:t.label)||(t==null?null:t.key))==="Property Address/APN")("left-[50px]",(t.label||t.key)==="Property Address/APN")("z-[1]",(t.label||t.key)==="Property Address/APN")("bg-transparency-0",((t==null?null:t.label)||(t==null?null:t.key))==="Property Address/APN"),l(),Q("font-bold",i.activeSortColumn===i.getSortKeyForColumn(t)),l(),P(" ",(t==null?null:t.label)||(t==null?null:t.key)," "),l(),I((e=i.getSortKeyForColumn(t))?3:-1,e)}}function Li(s,u){if(s&1&&(a(0,"th",6)(1,"span",12),p(2),d()()),s&2){let e=u.$implicit;x("pTooltip",e==null?null:e.questionTitle),l(2),P(" ",e==null?null:e.questionTitle," ")}}function Ei(s,u){if(s&1&&(a(0,"span",23),p(1),d()),s&2){let e=r(3).$implicit,t=r();l(),P(" ",t.getSoldResidentialStreetLine(e)||"N/A"," ")}}function Bi(s,u){if(s&1&&(a(0,"span",23),p(1),d()),s&2){let e=r(3).$implicit,t=r();l(),P(" ",t.getSoldLandApnDisplay(e)||"N/A"," ")}}function Ri(s,u){if(s&1&&(a(0,"div",19),v(1,Ei,2,1,"span",23)(2,Bi,2,1,"span",23),d()),s&2){let e=r(2).$implicit,t=r();l(),I(t.getSoldPropertyTypeForList(e)=="residential"?1:2)}}function Ni(s,u){if(s&1){let e=V();a(0,"div",25),y("click",function(){g(e);let i=r(3).$implicit,n=r();return C(n.openChangeStatusModal(i))}),a(1,"div",26),D(2,"span",27),a(3,"span",28),p(4),ie(5,"titlecase"),d()(),D(6,"svg-icon",29),d()}if(s&2){let e=r(3).$implicit,t=r();x("ngStyle",te(6,Wt,t.getStatusColorCode(e))),l(2),x("ngStyle",te(8,ki,t.getStatusColorCode(e)||"#6B7280")),l(2),f(je(5,4,t.getStatusTitle(e))),l(2),x("ngStyle",te(10,Wt,t.getStatusColorCode(e)))}}function Ui(s,u){if(s&1&&v(0,Ni,7,12,"div",24),s&2){let e=r(2).$implicit,t=r();I(t.getStatusTitle(e)?0:-1)}}function $i(s,u){if(s&1&&(a(0,"span",20),p(1),ie(2,"currency"),d()),s&2){let e=r(2).$implicit;l(),f(qe(2,1,(e==null||e.valuation==null?null:e.valuation.estTotalLiens)||0,"USD","symbol","1.0-0"))}}function Wi(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit;l(),f((e==null?null:e.projectTypeTitle)||"N/A")}}function Oi(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.getCampaignDisplayName(e))}}function ji(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit;l(),P(" ",(e==null||e.propertyInfo==null?null:e.propertyInfo.city)||"N/A"," ")}}function Hi(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit;l(),P(" ",(e==null||e.propertyInfo==null?null:e.propertyInfo.state)||"N/A"," ")}}function qi(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit;l(),P(" ",(e==null||e.propertyInfo==null?null:e.propertyInfo.zip)||"N/A"," ")}}function zi(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),P("",t.getHoldingPeriodDays(e)," days")}}function Gi(s,u){if(s&1&&D(0,"img",35),s&2){let e=r().$implicit,t=r(5);x("src",t.getAssignUserImage(e),me)("alt",t.getAssignUserFullName(e)||"User")("pTooltip",t.getAssignUserFullName(e)||"N/A")}}function Yi(s,u){if(s&1&&(a(0,"span",36),p(1),d()),s&2){let e=r().$implicit,t=r(5);x("pTooltip",t.getAssignUserFullName(e)||"N/A"),l(),P(" ",t.getAssignUserInitials(e)||"N/A"," ")}}function Qi(s,u){if(s&1&&(a(0,"div",33),v(1,Gi,1,3,"img",35),v(2,Yi,2,2,"span",36),d()),s&2){let e=u.$implicit,t=r(5);l(),I(t.getAssignUserImage(e)?1:-1),l(),I(t.getAssignUserImage(e)?-1:2)}}function Ki(s,u){if(s&1){let e=V();a(0,"span",37),y("click",function(i){g(e);let n=r(4).$implicit,o=r();return i.stopPropagation(),C(o.openMembersDialog(o.getUniqueAssignUsers((n==null?null:n.assignUserData)||[])))}),p(1),d()}if(s&2){let e;r();let t=ee(0),i=r(3).$implicit,n=r();x("pTooltip",t)("escape",!1)("tooltipDisabled",!t),l(),P(" +",((e=n.getUniqueAssignUsers((i==null?null:i.assignUserData)||$(4,ue)))==null?null:e.length)-3," members ")}}function Zi(s,u){if(s&1&&(fe(0),a(1,"div",30)(2,"div",32),R(3,Qi,3,2,"div",33,B),ie(5,"slice"),d(),v(6,Ki,2,5,"span",34),d()),s&2){let e,t=r(3).$implicit,i=r();ge(i.getAssignUsersOverflowTooltip((t==null?null:t.assignUserData)||$(6,ue))),l(3),N(He(5,2,i.getUniqueAssignUsers((t==null?null:t.assignUserData)||$(7,ue)),0,3)),l(3),I(((e=i.getUniqueAssignUsers((t==null?null:t.assignUserData)||$(8,ue)))==null?null:e.length)>3?6:-1)}}
18function Ji(s,u){s&1&&(a(0,"span",31),p(1,"N/A"),d())}function Xi(s,u){if(s&1&&(v(0,Zi,7,9,"div",30),v(1,Ji,2,0,"span",31)),s&2){let e=r(2).$implicit;I(e!=null&&e.assignUser?0:-1),l(),I(e!=null&&e.assignUser?-1:1)}}function en(s,u){if(s&1&&(a(0,"div",21)(1,"div",38),D(2,"svg-icon",39),a(3,"h4",40),p(4),d()(),a(5,"div",38),D(6,"svg-icon",41),a(7,"h4",40),p(8),d()(),a(9,"div",38),D(10,"svg-icon",42),a(11,"h4",40),p(12),d()(),a(13,"div",38),D(14,"svg-icon",43),a(15,"h4",40),p(16),d()(),a(17,"div",38),D(18,"svg-icon",44),a(19,"h4",40),p(20),d()()()),s&2){let e=r(2).$implicit;l(4),P(" x",(e==null||e.filterRelatedData==null||e.filterRelatedData.outgoingCall==null?null:e.filterRelatedData.outgoingCall.count)??0," "),l(4),P(" x",(e==null||e.filterRelatedData==null||e.filterRelatedData.outgoingSms==null?null:e.filterRelatedData.outgoingSms.count)??0," "),l(4),P(" x",(e==null||e.filterRelatedData==null||e.filterRelatedData.outgoingRvm==null?null:e.filterRelatedData.outgoingRvm.count)??0," "),l(4),P(" x",(e==null||e.filterRelatedData==null||e.filterRelatedData.outgoingEmail==null?null:e.filterRelatedData.outgoingEmail.count)??0," "),l(4),P(" x",(e==null||e.filterRelatedData==null||e.filterRelatedData.outgoingDirectmail==null?null:e.filterRelatedData.outgoingDirectmail.count)??0," ")}}function tn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(3).$implicit,t=r();l(),f(t.formatLastTouch(e==null||e.filterRelatedData==null||e.filterRelatedData.lastOutgoingTouch==null?null:e.filterRelatedData.lastOutgoingTouch.time))}}function nn(s,u){s&1&&(a(0,"span",20),p(1,"No Activity"),d())}function sn(s,u){if(s&1&&v(0,tn,2,1,"span",20)(1,nn,2,0,"span",20),s&2){let e=r(2).$implicit;I(!(e==null||e.filterRelatedData==null||e.filterRelatedData.lastOutgoingTouch==null)&&e.filterRelatedData.lastOutgoingTouch.time?0:1)}}function on(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(3).$implicit,t=r();l(),f(t.formatLastTouch(e==null||e.filterRelatedData==null||e.filterRelatedData.lastIncomingTouch==null?null:e.filterRelatedData.lastIncomingTouch.time))}}function rn(s,u){s&1&&(a(0,"span",20),p(1,"No Activity"),d())}function an(s,u){if(s&1&&v(0,on,2,1,"span",20)(1,rn,2,0,"span",20),s&2){let e=r(2).$implicit;I(!(e==null||e.filterRelatedData==null||e.filterRelatedData.lastIncomingTouch==null)&&e.filterRelatedData.lastIncomingTouch.time?0:1)}}function ln(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),_e("",t.getPendingTaskCount(e)," ",t.getPendingTaskCount(e)>1?"Tasks":"Task")}}function dn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),_e("",t.getPendingTaskCount(e)," ",t.getPendingTaskCount(e)>1?"Tasks":"Task")}}function cn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatDate(e==null?null:e.salesDate))}}function un(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatCurrency((e==null?null:e.salesPrice)!=null?+e.salesPrice:null))}}function pn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatCurrency(t.getExpectedProfitValue(e)))}}function mn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatCurrency(t.getActualProfitValue(e)))}}function hn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatCurrency((e==null?null:e.purchasePrice)!=null?+(e==null?null:e.purchasePrice):null))}}function _n(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatDate(e==null?null:e.purchaseDate))}}function fn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatDate(t.getSowFinalizedDateValue(e)))}}function gn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatDate(t.getPossessionDateValue(e)))}}function Cn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatDate(e==null?null:e.rehabStart))}}function xn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatDate(e==null?null:e.rehabFinish))}}function Sn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatDate(t.getListingDateValue(e)))}}function vn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatCurrency((e==null?null:e.listedPrice)!=null?+(e==null?null:e.listedPrice):null))}}function In(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatDate(e==null?null:e.underCoClosingDate))}}function yn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatCurrency((e==null?null:e.underCoPrice)!=null?+(e==null?null:e.underCoPrice):null))}}function wn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();
18l(),f(t.formatDate((e==null?null:e.assignmentContractDate)||(e==null||e.analyticsInfo==null?null:e.analyticsInfo.assignmentContractDate)))}}function Pn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatCurrency(t.getExpProfitPrice(e)))}}function bn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatDate(e==null?null:e.leadCreated))}}function Tn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatLeadQualified(e))}}function Dn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatAppointmentCell(e))}}function kn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatDate(e==null||e.analyticsInfo==null?null:e.analyticsInfo.dateOfYourOffer))}}function Vn(s,u){if(s&1&&(a(0,"span",20),p(1),d()),s&2){let e=r(2).$implicit,t=r();l(),f(t.formatCurrency((e==null||e.analyticsInfo==null?null:e.analyticsInfo.yourOfferPrice)!=null?+(e==null||e.analyticsInfo==null?null:e.analyticsInfo.yourOfferPrice):null))}}function An(s,u){if(s&1){let e=V();a(0,"div",53),p(1),a(2,"svg-icon",54),y("click",function(){let i=g(e),n=i.$implicit,o=i.$index,c=r(4).$implicit,m=r();return C(m.removeTag(o,n,c))}),d()()}if(s&2){let e=u.$implicit,t=r(5);x("ngClass",t._utilities==null?null:t._utilities.getTagColorClass(e==null?null:e.colorIndex)),l(),P(" ",e==null?null:e.label," ")}}function Mn(s,u){if(s&1&&(a(0,"div",48),D(1,"div",49),a(2,"div",50)(3,"div",51),p(4," Tags "),d(),a(5,"div",52),R(6,An,3,2,"div",53,B),d()()()),s&2){let e=r(3).$implicit,t=r();X("left",t.getTagPopupLeft(e),"px")("top",t.getTagPopupTop(e),"px"),he("data-sold-tag-popup-id",e==null?null:e._id),l(),x("ngClass",t.getTagPopupPlacement(e)==="top"?"-bottom-[6px]":"-top-[6px]"),l(5),N(t.getSoldTags(e))}}function Fn(s,u){if(s&1){let e=V();a(0,"div",55)(1,"app-button",56),y("click",function(i){g(e);let n=r(3).$implicit,o=r();return C(o.editSold(n,i))}),d(),a(2,"app-button",57),y("click",function(i){g(e);let n=r(3).$implicit,o=r();return C(o.deleteSold(n,i))}),d()()}if(s&2){let e=r(3).$implicit,t=r();X("top",t.getRowTop(e),"px")("height",t.getRowHeight(e),"px"),l(),x("iconHeight","34px")("iconWidth","34px")("leftIcon",!0),l(),x("iconHeight","34px")("iconWidth","34px")("leftIcon",!0)}}function Ln(s,u){if(s&1){let e=V();a(0,"div",22)(1,"div",45),y("mouseenter",function(i){g(e);let n=r(2).$implicit,o=r();return C(o.onTagHoverEnter(i,n))})("mouseleave",function(){g(e);let i=r(3);return C(i.onTagHoverLeave())}),a(2,"span",20),p(3),d(),v(4,Mn,8,6,"div",46),d(),v(5,Fn,3,10,"div",47),d()}if(s&2){let e,t,i=r(2).$implicit,n=r();l(3),f(((i==null||i.tagIds==null?null:i.tagIds.length)||((e=n.getSoldTags(i))==null?null:e.length)||0)+" Tags"),l(),I(n.isTagPopupVisible(i)&&((t=n.getSoldTags(i))==null?null:t.length)>0?4:-1),l(),I(n.isRowHovered(i)?5:-1)}}function En(s,u){if(s&1){let e=V();a(0,"td",18),y("click",function(){let i=g(e).$implicit,n=r().$implicit,o=r();return C(((i==null?null:i.label)||(i==null?null:i.key))==="Property Address/APN"&&o.goToDetails(n==null?null:n._id))}),v(1,Ri,3,1,"div",19)(2,Ui,1,1)(3,$i,3,6,"span",20)(4,Wi,2,1,"span",20)(5,Oi,2,1,"span",20)(6,ji,2,1,"span",20)(7,Hi,2,1,"span",20)(8,qi,2,1,"span",20)(9,zi,2,1,"span",20)(10,Xi,2,2)(11,en,21,5,"div",21)(12,sn,2,1)(13,an,2,1)(14,ln,2,2,"span",20)(15,dn,2,2,"span",20)(16,cn,2,1,"span",20)(17,un,2,1,"span",20)(18,pn,2,1,"span",20)(19,mn,2,1,"span",20)(20,hn,2,1,"span",20)(21,_n,2,1,"span",20)(22,fn,2,1,"span",20)(23,gn,2,1,"span",20)(24,Cn,2,1,"span",20)(25,xn,2,1,"span",20)(26,Sn,2,1,"span",20)(27,vn,2,1,"span",20)(28,In,2,1,"span",20)(29,yn,2,1,"span",20)(30,wn,2,1,"span",20)(31,Pn,2,1,"span",20)(32,bn,2,1,"span",20)(33,Tn,2,1,"span",20)(34,Dn,2,1,"span",20)(35,kn,2,1,"span",20)(36,Vn,2,1,"span",20)(37,Ln,6,3,"div",22),d()}if(s&2){let e,t=u.$implicit;Q("sticky",((t==null?null:t.label)||(t==null?null:t.key))==="Property Address/APN")("left-[50px]",(t.label||t.key)==="Property Address/APN")("z-[1]",(t.label||t.key)==="Property Address/APN")("relative",((t==null?null:t.label)||(t==null?null:t.key))==="Tags")("cursor-pointer",((t==null?null:t.label)||(t==null?null:t.key))==="Property Address/APN"),l(),I((e=(t==null?null:t.label)||(t==null?null:t.key))==="Property Address/APN"?1:e==="Status"?2:e==="Estimated Profit"?3:e==="Exit Type"?4:e==="Campaign Name"?5:e==="City"?6:e==="State"?7:e==="Zip"?8:e==="Holding Perio
18d"?9:e==="Team"?10:e==="Communications"?11:e==="Last Outgoing Touch"?12:e==="Last Incoming Touch"?13:e==="Pending Task"?14:e==="Tasks"?15:e==="Sold Date"?16:e==="Sold Price"?17:e==="Expected Profit"?18:e==="Actual Profit"?19:e==="Purchase Price"?20:e==="Purchase Date"?21:e==="SOW Finalized"?22:e==="Possession Date"?23:e==="Under Rehab Start"?24:e==="Under Rehab End"?25:e==="Listing Date"?26:e==="Listing Price"?27:e==="U.C Date"?28:e==="U.C Price"?29:e==="Exp. Profit Date"?30:e==="Exp. Profit Price"?31:e==="Lead Created"?32:e==="Lead Qualified"?33:e==="Appointment"?34:e==="Offer Date"?35:e==="Offer Price"?36:e==="Tags"?37:-1)}}function Bn(s,u){if(s&1&&(a(0,"a",60),y("click",function(t){return t.stopPropagation()}),p(1),d()),s&2){r();let e=ee(0),t=r(2);x("href",t._utilities.getCustomFieldUrlHref(e),me)("pTooltip",e),l(),P(" ",e," ")}}function Rn(s,u){if(s&1&&(a(0,"span",59),p(1),d()),s&2){r();let e=ee(0);x("pTooltip",e),l(),P(" ",e," ")}}function Nn(s,u){if(s&1&&(fe(0),a(1,"td",17),v(2,Bn,2,3,"a",58)(3,Rn,2,2,"span",59),d()),s&2){let e=u.$implicit,t=r().$implicit,i=r(),n=ge(i.getCustomQuestionAnswer(t,e));l(2),I(i._utilities.isCustomFieldUrlType(e==null?null:e.questionType)&&i._utilities.getCustomFieldUrlHref(n)?2:3)}}function Un(s,u){if(s&1){let e=V();a(0,"tr",13),y("mouseenter",function(i){let n=g(e).$implicit,o=r();return C(o.onRowHover(i,n))})("mouseleave",function(){g(e);let i=r();return C(i.onRowLeave())}),a(1,"td",14)(2,"app-checkbox",15),y("checkedChange",function(i){let n=g(e).$implicit,o=r();return C(o.selectItem(n,i))}),d()(),R(3,En,38,11,"td",16,B),R(5,Nn,4,2,"td",17,B),d()}if(s&2){let e=u.$implicit,t=r();l(2),x("checked",e==null?null:e.isCompleted)("label",e==null?null:e.label),l(),N(t.getVisibleColumns()),l(2),N(t.getVisibleCustomQuestions())}}function $n(s,u){if(s&1&&(a(0,"tr",2)(1,"td",61)(2,"div",62),p(3," No record found "),d()()()),s&2){let e=r(2);x("hoverable",!1),l(),he("colspan",e.getEmptyStateColspan())}}function Wn(s,u){if(s&1&&v(0,$n,4,2,"tr",2),s&2){let e=r();I(e.isLoading?-1:0)}}var Ot,Ti,Di,Wt,ki,ue,jt,De=Y(()=>{W();Zt();Ot=Yt(Jt());Re();li();ui();ft();Se();xe();W();ye();ne();se();ve();Ie();lt();ri();Xe();rt();Xt();ii();ni();ft();ti();Ti=()=>[10,25,50,100],Di=(s,u,e,t,i)=>({currentPage:s,totalPages:u,totalCount:e,pageSize:t,pageSizeOptions:i}),Wt=s=>({color:s}),ki=s=>({"background-color":s}),ue=()=>[];jt=(()=>{class s{constructor(e,t,i,n,o,c,m){this._utilities=e,this._route=t,this._dialog=i,this._toasterService=n,this._loaderService=o,this._commonService=c,this._marketingCampaignService=m,this.data={},this.searchText="",this.totalInventory=1,this.itemsPerPage=10,this.pipeLine={},this.currentPipeline={},this.moduleId=A?.ModuleStatusId?.SOLD,this.selectedItems=[],this.listBulkSelectionMenu=null,this.listBulkToolbarVirtualCount=null,this.listBulkExcludedIds=[],this.listBulkCustomRangeMin=null,this.listBulkCustomRangeMax=null,this.moduleActions=[],this.useDropdownForModuleActions=!1,this.isLoading=!0,this._emitterPage=new M,this._emitterLimit=new M,this._emitterSort=new M,this._searchEmit=new M,this._statusChangeEmitter=new M,this._refreshData=new M,this._selectedItem=new M,this._actionSelected=new M,this._listViewAction=new M,this._listViewSelectionMenu=new M,this.hoveredRowTop=0,this.hoveredRowHeight=0,this.hoveredSold=null,this.hoveredRowElement=null,this.hoveredTagSoldId=null,this.tagPopupPositionBySold=new Map,this.soldHeader=[{label:"Property Address/APN",isShowColumn:!0},{label:"Campaign Name",isShowColumn:!0},{label:"City",isShowColumn:!0},{label:"State",isShowColumn:!0},{label:"Zip",isShowColumn:!0},{label:"Holding Period",isShowColumn:!0},{label:"Tasks",isShowColumn:!0},{label:"Exit Type",isShowColumn:!0},{label:"Team",isShowColumn:!0},{label:"Sold Date",isShowColumn:!0},{label:"Sold Price",isShowColumn:!0},{label:"Expected Profit",isShowColumn:!0},{label:"Actual Profit",isShowColumn:!0},{label:"Purchase Price",isShowColumn:!0},{label:"Purchase Date",isShowColumn:!0},{label:"SOW Finalized",isShowColumn:!0},{label:"Possession Date",isShowColumn:!0},{label:"Under Rehab Start",isShowColumn:!0},{label:"Under Rehab End",isShowColumn:!0},{label:"Listing Date",isShowColumn:!0},{label:"Listing Price",isShowColumn:!0},{label:"U.C Date",isShowColumn:!0},{label:"U.C Price",isShowColumn:!0},{label:"Exp. Profit Date",isShowColumn:!0},{label:"Exp. Profit Price",isShowColumn:!0},{label:"Lead Created",isShowColumn:!0},{label:"Lead Qualified",isShowColumn:!0},{label:"Appointment",isShowColumn:!0},{label:"Offer Date",isShowColumn:!0},{label:"Offer Price",isShowColumn:!0},{label:"Tags",isShowColumn:!0}],this.currentPage=1,this.searchControl=new tt(""),this.selectedItem=[],this.selectionToolbarDropdownItems=[],this.lastCustomSelectionRangeSubtitle="",this.masterGroups=[],this.customFieldsList=[],this.customFieldsHiddenIds=new Set,this.customFieldsOrderedIds=[],this.customFieldsPreferenceExists=!1,this.messageConstant=F,this.sortDirections={address:1,status:1,estTotalLiens:1,projectType:1,createdAt:1,outgoingTime:1,incomingTime:1,pendingTask:1,campaignName:1,"propertyInfo.city":1,"propertyInfo.state":1,"propertyInfo.zip":1,holdingPerio
18d:1,tasks:1,exitType:1,team:1,soldDate:-1,soldPrice:1,expectedProfit:1,actualProfit:1,sowFinalizedDate:1,purchasePrice:1,purchaseDate:1,goingOnMarket:1,listedPrice:1,rehabStart:1,rehabFinish:1,underCoClosingDate:1,underCoPrice:1,tags:1},this.activeSortColumn="soldDate",this.marketingCampaignList=[]}ngOnChanges(e){let t=e.selectedItems;if(t&&t.currentValue!==t.previousValue){let i=t.currentValue;if(Array.isArray(i)&&i.length===0)this.selectedItem=[],this.listBulkSelectionMenu!=="custom"&&(this.lastCustomSelectionRangeSubtitle=""),this.data?.forEach(n=>n.isCompleted=!1);else if(Array.isArray(i)&&i?.length>0){this.selectedItem=[...i];let n=new Set(i?.map(o=>o?._id)?.filter(o=>o!=null));this.data?.forEach(o=>{o.isCompleted=n?.has(o?._id)})}}(e.data||e.listBulkSelectionMenu||e.listBulkCustomRangeMin||e.listBulkCustomRangeMax||e.listBulkExcludedIds||e.itemsPerPage)&&this.applyListBulkSelectionToVisibleRowsIfApplicable()}ngOnInit(){this.loadMasterGroups(),this.loadMarketingCampaigns(),this.searchControl?.valueChanges?.pipe(Le(500),Ee())?.subscribe(e=>{this.clearSelectionOnSearchChange(),this.searchText=e||"",this.currentPage=1,this._searchEmit?.emit(this.searchText)}),this.getColumns(),this.getCustomFieldsPreference(),this.refreshSelectionToolbarDropdown()}get totalPages(){return Math?.ceil(this.totalInventory/this.itemsPerPage)}onPageChange(e){this.currentPage=e,this._emitterPage?.emit(this.currentPage)}onItemsPerPageChange(e){this.itemsPerPage=e,this.currentPage=1,this._emitterLimit?.emit(this.itemsPerPage)}isChecked(){return this.data?.length?(this.data?.filter(t=>t?.isCompleted)?.length||0)===this.data?.length:!1}selectAll(e){this.data?.forEach(t=>t.isCompleted=e),this.selectedItem=e?[...this.data||[]]:[],this._selectedItem?.emit(this.selectedItem)}refreshSelectionToolbarDropdown(){this.selectionToolbarDropdownItems=[{label:"Select Visible",action:"selectVisible",icon:"assets/images/icons/view.svg",menuItemClass:"!min-h-[53px] !gap-[10px] !rounded-none !px-[10px] !py-[10px]"},{label:"Select All",action:"selectAll",icon:"assets/images/icons/check-mark.svg",menuItemClass:"!min-h-[53px] !gap-[10px] !rounded-none !px-[10px] !py-[10px]"},{divider:!0,label:"",action:"_divider",menuItemClass:"!w-full !px-0 !py-0"},{label:"Custom",action:"custom",icon:"assets/images/icons/settings.svg",disableActiveHighlight:!0,menuItemClass:"!min-h-[53px] !gap-[10px] !rounded-none !border-0 !px-[10px] !py-[10px] !text-transparency-100 hover:!bg-activity-outbound-hover-bg hover:!text-transparency-100"},{divider:!0,label:"",action:"_divider",menuItemClass:"!w-full !px-0 !py-0"},{label:"Clear Selection",action:"clearSelection",icon:"assets/images/icons/close-simple.svg",menuItemClass:"!min-h-[53px] !gap-[10px] !rounded-none !px-[10px] !py-[10px]",menuTextClass:"text-secondary-red",menuIconClass:"w-[24px] h-[24px] text-secondary-red flex-shrink-0 [&_svg]:!stroke-[2] [&_svg_*]:!stroke-[2]"}]}onListViewToolbarMenu(e){if(e!=="custom"){if(e==="clearSelection"){this.lastCustomSelectionRangeSubtitle="",this.selectAll(!1),this._listViewSelectionMenu?.emit("");return}if(e==="selectVisible"){if(this.listBulkSelectionMenu===e){this.selectAll(!1),this._listViewSelectionMenu?.emit("");return}this.lastCustomSelectionRangeSubtitle="",this._listViewSelectionMenu?.emit(e),this.selectAll(!0);return}if(e==="selectAll"){if(this.listBulkSelectionMenu===e){this.selectAll(!1),this._listViewSelectionMenu?.emit("");return}this.lastCustomSelectionRangeSubtitle="",this._listViewSelectionMenu?.emit(e)}}}onToolbarCustomRangeApplied(e){let t=Math?.max(1,Number(e?.start)||1),i=Math?.max(t,Number(e?.end)||t);this.lastCustomSelectionRangeSubtitle=`${t} - ${i}`,this._listViewSelectionMenu?.emit({action:"custom",min:t,max:i})}applyListBulkSelectionToVisibleRowsIfApplicable(){if(this.listBulkSelectionMenu==="selectAll"){this.listBulkExcludedIds?.length?G.applySelectAllSelectionToRowsWithExclusions(this.data,this.listBulkExcludedIds):G?.applySelectAllSelectionToRows(this.data);return}this.listBulkSelectionMenu==="custom"&&(this.listBulkCustomRangeMin==null||this.listBulkCustomRangeMax==null||G?.applyCustomListRangeSelectionToRows(this.data,{min:this.listBulkCustomRangeMin,max:this.listBulkCustomRangeMax,currentPage:this.currentPage,itemsPerPage:this.itemsPerPage}))}get toolbarSelectedCount(){return(this.listBulkSelectionMenu==="selectAll"||this.listBulkSelectionMenu==="custom")&&this.listBulkToolbarVirtualCount!=null?this.listBulkToolbarVirtualCount:this.listBulkSelectionMenu==="selectAll"?typeof this.totalInventory=="number"&&this.totalInventory>=0?this.totalInventory:0:this.listBulkSelectionMenu==="custom"&&this.listBulkToolbarVirtualCount!=null?this.listBulkToolbarVirtualCount:this.selectedItem?.length||0}selectItem(e,t){let i=e?._id,n=this.selectedItem?.findIndex(c=>c?._id===i)??-1,o=this.data?.findIndex(c=>c?._id===i)??-1;o!==-1&&this.data[o]&&(this.data[o].isCompleted=t),t&&n===-1?this.selectedItem?.push(e):!t&&n>-1&&this.selectedItem?.splice(n,1),this._selectedItem?.emit(this.selectedItem)}onActionSelected(e){e&&this._actionSelected?.emit(e)}getColumnsForTable(){let e=this.soldViewPreferenceData;return Array?.isArray(e)?e:this.soldHeader||[]}getVisibleColumns(){return this.getColumnsForTable()?.filter(t=>t?.isShowColumn!==!1)}isColumnVisible(e){let t=this.getColumnsForTable()?.find(i=>i?.label===e);return t?t?.isShowColumn!==!1:!0}getCustomFieldsForPanel(){return this.customFieldsList?.length?this.customFieldsList:(this.masterGroups||[])?.map(e=>k(S({},e),{isShowColumn:!0}))}getVisibleCustomQuestions(){return(this.customFieldsList?.length?this.customFieldsList:this.masterGroups||[])?.filter(t=>t?.isShowColumn!==!1)}onCustomFieldsChange(e){Array.isArray(e)&&(this.customFieldsList=[...e],this.saveCustomFieldsPreference())}getSortKeyForColumn(e){let t=e?.label||e?.key;return t&&{"Property Address/APN":"address",Campaign:"campaignName","Campaign Name":"campaignName",City:"propertyInfo.city",State:"propertyInfo.state",Zip:"propertyInfo.zip","Holding Perio
18d":"holdingPeriod","Exit Type":"exitType",Team:"team","Sold Date":"soldDate","Sold Price":"soldPrice","Expected Profit":"expectedProfit","Actual Profit":"actualProfit","SOW Finalized":"sowFinalizedDate","Purchase Price":"purchasePrice","Purchase Date":"purchaseDate","Listing Date":"goingOnMarket","Listing Price":"listedPrice","Under Rehab Start":"rehabStart","Under Rehab End":"rehabFinish","U.C Date":"underCoClosingDate","U.C Price":"underCoPrice",estTotalLiens:"estTotalLiens","Project Type":"projectType","Created At":"createdAt"}[t]||null}getColumnWidth(e){let t=e?.label||e?.key;return t?{"Property Address/APN":300,"Campaign Name":200,City:150,State:200,Zip:150,"Holding Period":170,Tasks:150,"Exit Type":150,Team:220,"Sold Date":150,"Sold Price":150,"Expected Profit":170,"Actual Profit":150,"SOW Finalized":150,"Estimated Profit":170,"Project Type":150,"Created At":150,"Purchase Price":170,"Purchase Date":150,"Possession Date":150,"Under Rehab Start":200,"Under Rehab End":200,"Listing Date":150,"Listing Price":150,"U.C Date":150,"U.C Price":150,"Exp. Profit Date":160,"Exp. Profit Price":160,"Lead Created":150,"Lead Qualified":160,Ap
18pointment:130,"Offer Date":150,"Offer Price":150,Tags:150}[t]??150:150}getPendingTaskCount(e){return e?.pendingTaskCount!=null&&e?.pendingTaskCount!==void 0?Number(e?.pendingTaskCount):this.getTasksCount(e?.userList)??0}formatLastTouch(e){if(!e)return"No Activity";let t=localStorage?.getItem("timezoneOffset")||"America/New_York";return Ot.default?.tz(e,t)?.format("MMM DD, YYYY h:mm A")}getUniqueAssignUsers(e){return this._utilities.getUniqueAssignUsers(e)}getAssignUserImage(e){return this._utilities.getAssignUserImage(e)}getUserInitials(e){return(e?.fullName||"")?.split(" ")?.map(n=>n?.charAt(0)?.toUpperCase())?.join("")||""}getAssignUserFullName(e){return this._utilities.getAssignUserFullName(e)}getAssignUserInitials(e){return this._utilities.getAssignUserInitials(e)}getAssignUsersOverflowTooltip(e){return this._utilities.getAssignUsersOverflowTooltip(e)}openMembersDialog(e){this.dialogRef=this._dialog?.open(bt,{panelClass:"re-new-custom-dialog",disableClose:!0,width:"600px",data:{header:"Members",members:e||[],moduleId:this.moduleId}}),this.dialogRef?.afterClosed()?.subscribe(()=>{})}onSort(e){e&&(typeof this.sortDirections[e]>"u"&&(this.sortDirections[e]=-1),this.activeSortColumn===e?this.sortDirections[e]=this.sortDirections[e]===-1?1:-1:(Object.keys(this.sortDirections)?.forEach(t=>{t!==e&&(this.sortDirections[t]=-1)}),this.sortDirections[e]=1,this.activeSortColumn=e),this.currentPage=1,this._emitterSort?.emit({sortBy:e,sortMode:this.sortDirections[e]}))}formatAddress(e){if(!e)return"N/A";let t=e?.address||e?.leadId?.address,i=e?.unitNo||e?.leadId?.unitNo;return this._utilities?.formatAddress(t,i)??t??"N/A"}getSoldAddressRaw(e){return e?.address||e?.leadId?.address||""}getCampaignDisplayName(e){return this.getCampaignTitleById(e)||"N/A"}getExpectedProfitValue(e){if(e==null)return null;let t=this.getMergedAcquisitionAnalyticsForSold(e)?.assignmentFee??e?.analyticsInfo?.assignmentFee??e?.expectedProfit,i=e?.netProfit,n=this.parseExpectedProfitNumber(t),o=this.parseExpectedProfitNumber(i);return n!=null&&n!==0?n:o!=null&&o!==0?o:n??o??null}getActualProfitValue(e){if(e==null)return null;let t=e?.netProfit??e?.actualProfit;if(t===""||t===void 0||t===null)return null;let i=Number(t);return Number?.isFinite(i)?i:null}getExpProfitPrice(e){if(e==null)return null;let t=e?.analyticsInfo?.assignmentFee??e?.assignmentFee;if(t===""||t===void 0||t===null)return null;let i=Number(t);return Number?.isFinite(i)?i:null}getListingDateValue(e){return e?.goingOnMarket??null}getSowFinalizedDateValue(e){return e==null?null:e?.sowFinalizedDate??null}getPossessionDateValue(e){return e==null?null:e?.possessionDate??null}formatLeadQualified(e){return!e?.isQualified&&e?.qualifiedAt==null?"N/A":e?.qualifiedAt?this.formatDate(e?.qualifiedAt):e?.isQualified?"Yes":"N/A"}formatAppointmentCell(e){let t=e?.pendingAppointmentCount,i=e?.analyticsInfo?.appointmentDate;return t!=null&&Number(t)>0?`${t} pending`:i?this.formatDate(i):"N/A"}getStatusTitle(e){if(!e)return"";if(e?.mainStatusTitle)return e?.mainStatusTitle;if(e?.status?.title)return e?.status?.title;let t=e?.mainStatusId;return!t||!this.currentPipeline?.mainStatusList?.length?"":this.currentPipeline?.mainStatusList?.find(n=>n?._id===t)?.title||""}getStatusColorCode(e){if(!e)return"";if(e?.colorCode)return e?.colorCode;if(e?.status?.colorCode)return e?.status?.colorCode;let t=e?.mainStatusId;return!t||!this.currentPipeline?.mainStatusList?.length?"":this.currentPipeline?.mainStatusList?.find(n=>n?._id===t)?.colorCode||""}openChangeStatusModal(e){let t=e?.mainStatusId,i=e?.pipelineData||this.currentPipeline;if(!i){this._toasterService?.showError("Pipeline data not found");return}this.dialogRef=this._dialog?.open(It,{panelClass:"re-new-custom-dialog",disableClose:!0,width:"600px",maxHeight:"92vh",data:{currentStatusId:t,statusData:k(S({},e),{pipelineData:i}),subModuleId:e?._id,moduleId:this.moduleId}}),this.dialogRef?.afterClosed()?.subscribe(n=>{n?.statusId&&this.changeInventoryStatus(e,n?.statusId,n)})}changeInventoryStatus(e,t,i){if(!t||!e?._id)return;let n=e?.pipelineId||e?.pipelineData?._id;this._loaderService?.start();let o={mainStatusId:t,pipelineId:n,inventoryId:e?._id};i?.payload&&(o=S(S({},o),i?.payload)),this._commonService?.changeInventoryStatus(o)?.subscribe(c=>{this._loaderService?.stop(),c?.statusCode===200&&(this._refreshData?.emit(!0),this._commonService?.refreshLeadsGrid?.next(!0),this._commonService?.refreshActivityLog?.next(""))},c=>{this._loaderService?.stop(),this._toasterService?.showError(c?.error?.message||this.messageConstant?.unknownError)})}
18getPrimaryPrice(e){return e?e?.yourOfferPrice??e?.purchasePrice??null:null}formatCurrency(e){if(e==null)return"N/A";try{return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(e)}catch(t){return`${e}`}}getPipelineDays(e){if(!e)return 0;let t=new Date(e)?.getTime(),i=Date?.now(),n=Math?.round((i-t)/(1e3*3600*24));return n>0?n:0}getTasksCount(e=[]){return Array.isArray(e)?e?.reduce((t,i)=>t+(i?.count||0),0):0}formatDate(e){if(!e)return"N/A";try{return this._utilities?.getDate(e,"MMM DD, YYYY")||"N/A"}catch(t){return"N/A"}}loadMasterGroups(){this._commonService?.getMasterGroupsDropdown({page:1,limit:1e3,moduleId:this.moduleId})?.subscribe(e=>{e?.statusCode===200&&e?.data?.items&&(this.masterGroups=e?.data?.items?.reduce((t,i)=>[...t,...i?.masterQuestions||[]],[]),this.customFieldsList=this.buildCustomFieldsList())},()=>{})}setColumn(){if(Object?.keys(this.soldHeader||{})?.length>0){let e={title:this.soldViewPreferenceData?.title||"userViewPreference",displayPreferences:JSON.stringify(this.soldHeader),moduleId:this.moduleId,subType:"sold"};this._commonService?.updateUserViewPreference(e,!0)?.subscribe(t=>{t?.statusCode===200&&this.getColumns()})}}getColumns(){let e={moduleId:this.moduleId,subType:"sold",page:1,limit:10};this._commonService?.getUserViewPreference(e)?.subscribe(t=>{if(t?.statusCode===200)try{let i=t?.data?.items[0];if(!i){this.setColumn(),this.soldViewPreferenceData=this.soldHeader||[];return}let n=JSON.parse(i?.displayPreferences||"[]");this.soldViewPreferenceData=Array.isArray(n)?n:this.soldHeader||[]}catch(i){this.soldViewPreferenceData=this.soldHeader||[]}})}onColumnUpdate(e){Array.isArray(e)&&(this.soldViewPreferenceData=[...e]);let t=this.getColumnsForTable(),i={displayPreferences:JSON.stringify(t),title:this.soldViewPreferenceData?.title||"userViewPreference",moduleId:this.moduleId,subType:"sold"};this._commonService?.updateUserViewPreference(i,!1)?.subscribe(n=>{n?.statusCode===200&&this.getColumns()})}goToDetails(e){this._route?.navigate(["/sold/details"],{queryParams:{soldId:e},state:{currentPipelineId:this.currentPipeline?._id??"all"}})}getCustomQuestionAnswer(e,t){let i=t?._id!=null?String(t?._id):t?.questionId!=null?String(t?.questionId):t?.question?._id!=null?String(t?.question?._id
18):"";if(!i||!e?.questions)return"N/A";let o=[...e?.questions?.soldPreferenceAnswers||[],...e?.questions?.inventoryPreferenceAnswers||[]]?.find(h=>h?.questionId!=null&&String(h?.questionId)===i),c=o?.value;if(c==null||typeof c=="string"&&c?.trim()==="")return"N/A";if(String(t?.questionType||o?.questionType||"")?.toUpperCase()==="DATE"){let h=this._utilities?.formatOccasionDate(c,"MMM D, YYYY");if(h)return h}return String(c)}editSold(e,t){this._listViewAction?.emit({type:"editSold",item:e,event:t})}deleteSold(e,t){this._listViewAction?.emit({type:"deleteSold",item:e,event:t})}onRowHover(e,t){let i=e?.currentTarget;this.hoveredSold=t,this.hoveredRowElement=i,this.updateRowPosition(i)}updateRowPosition(e){let t=e?.getBoundingClientRect();this.hoveredRowTop=t?.top,this.hoveredRowHeight=t?.height}getRowTop(e){if(!e?._id)return 0;if(this.hoveredSold?._id===e?._id&&this.hoveredRowElement)return this.hoveredRowTop;let t=document?.querySelectorAll("tbody tr[apptr]"),n=(this.data||[])?.findIndex(o=>o?._id===e?._id);return n>=0&&n<t?.length?t[n]?.getBoundingClientRect()?.top:0}getRowHeight(e){if(!e?._id)return 0;if(this.hoveredSold?._id===e?._id&&this.hoveredRowElement)return this.hoveredRowHeight;let t=document?.querySelectorAll("tbody tr[apptr]"),n=(this.data||[])?.findIndex(o=>o?._id===e?._id);return n>=0&&n<t?.length?t[n]?.getBoundingClientRect()?.height:0}onRowLeave(){this.hoveredSold=null,this.hoveredRowElement=null,this.hoveredTagSoldId=null}onTagHoverEnter(e,t){let i=t?._id||null;if(!i)return;let n=e?.currentTarget;n&&(this.hoveredTagSoldId=i,this.updateTagPopupPosition(n,t),window?.requestAnimationFrame?.(()=>{this.hoveredTagSoldId===i&&this.updateTagPopupPosition(n,t)}))}onTagHoverLeave(){this.hoveredTagSoldId=null}getSoldTags(e){return Array.isArray(e?.tagsDetails)?e?.tagsDetails:Array.isArray(e?.tags)?e?.tags:[]}isTagPopupVisible(e){let t=e?._id||null;return!!t&&this.hoveredTagSoldId===t}isRowHovered(e){let t=e?._id||null;return!!t&&this.hoveredSold?._id===t}getTagPopupLeft(e){let t=e?._id||null;return t?this.tagPopupPositionBySold?.get(t)?.left??0:0}getTagPopupTop(e){let t=e?._id||null;return t?this.tagPopupPositionBySold?.get(t)?.top??0:0}removeTag(e,t,i){if(!i?._id||!t?._id)return;this._loaderService?.start();let n={leadId:i?._id,moduleId:this.moduleId,tagIds:[t?._id],isTagAdd:!1,for:"inventory"};this._commonService?.addTags(n)?.subscribe(()=>{this._loaderService?.stop();let o=Array.isArray(i?.tagsDetails)?i?.tagsDetails:Array.isArray(i?.tags)?i?.tags:[];if(e>-1&&e<(o?.length||0))o?.splice(e,1);else{let c=o?.findIndex(m=>(m?._id||"")===(t?._id||""));c>-1&&o?.splice(c,1)}if(Array.isArray(i?.tagIds)){let c=i?.tagIds?.findIndex(m=>String(m)===String(t?._id));c>-1&&i?.tagIds?.splice(c,1)}this._refreshData?.emit(!0)},()=>{this._loaderService?.stop()})}getEmptyStateColspan(){return 1+(this.getVisibleColumns()?.length||0)+(this.getVisibleCustomQuestions()?.length||0)}getSoldResidentialStreetLine(e){let t=this.getSoldAddressRaw(e);return t&&t.split(",")[0]?.trim()||""}getSoldLandApnDisplay(e){return(e?.apn??"")?.toString()?.trim()||(e?.apnwithoutFormat??"")?.toString()?.trim()||(e?.propertyInfo?.apn??"")?.toString()?.trim()}getSoldPropertyTypeForList(e){return(e?.propertyType??e?.leadId?.propertyType??e?.propertyInfo?.propertyType??"")?.toString()?.trim()?.toLowerCase()==="land"?"land":"residential"}getCustomFieldsPreference(){this._commonService?.getUserViewPreference({moduleId:this.moduleId,subType:"soldCustomFields",page:1,limit:10})?.subscribe(e=>{if(e?.statusCode!==200)return;let t=e?.data?.items?.[0];this.customFieldsPreferenceExists=!!t;try{let i=JSON.parse(t?.displayPreferences||"{}");this.customFieldsHiddenIds=new Set(i?.hiddenIds||[]),this.customFieldsOrderedIds=i?.orderedIds||[]}catch(i){this.customFieldsHiddenIds=new Set,this.customFieldsOrderedIds=[]}this.masterGroups?.length&&(this.customFieldsList=this.buildCustomFieldsList())})}buildCustomFieldsList(){let e=new Map(this.customFieldsOrderedIds?.map((t,i)=>[t,i]));return[...this.masterGroups||[]].sort((t,i)=>(e.get(this.getCustomFieldPreferenceId(t))??Number.MAX_SAFE_INTEGER)-(e.get(this.getCustomFieldPreferenceId(i))??Number.MAX_SAFE_INTEGER))?.map(t=>k(S({},t),{isShowColumn:!this.customFieldsHiddenIds.has(this.getCustomFieldPreferenceId(t))}))}saveCustomFieldsPreference(){let e=(this.customFieldsList||[])?.map(i=>this.getCustomFieldPreferenceId(i)),t=(this.customFieldsList||[])?.filter(i=>i?.isShowColumn===!1)?.map(i=>this.getCustomFieldPreferenceId(i));this._commonService?.updateUserViewPreference({title:"userViewPreference",displayPreferences:JSON.stringify({hiddenIds:t,orderedIds:e}),moduleId:this.moduleId,subType:"soldCustomFields"},!this.customFieldsPreferenceExists)?.subscribe(i=>{i?.statusCode===200&&(this.customFieldsPreferenceExists=!0,this.customFieldsHiddenIds=new Set(t),this.customFieldsOrderedIds=e)})}getCustomFieldPreferenceId(e){return String(e?._id||e?.id||e?.questionId||"")}clearSelectionOnSearchChange(){!this.selectedItem?.length&&!this.listBulkSelectionMenu||(this.lastCustomSelectionRangeSubtitle="",this.selectAll(!1),this.listBulkSelectionMenu&&this._listViewSelectionMenu?.emit(""))}getTagPopupPlacement(e){let t=e?._id||null;return t?this.tagPopupPositionBySold?.get(t)?.placement??"bottom":"bottom"}updateTagPopupPosition(e,t){let i=t?._id||null;if(!i)return;let n=e?.getBoundingClientRect(),o=400,c=12,m=0,w=document?.querySelector(`[data-sold-tag-popup-id="${i}"]`)?.offsetHeight||this.getTagPopupHeight(t),b=Math?.max(c,window?.innerWidth-o-c),T=n?.left+n?.width/2-o/2,L=Math?.min(Math?.max(T,c),b),Ve=window?.innerHe
18ight-n?.bottom-c>=w?"bottom":"top",Gt=Ve==="bottom"?n?.bottom+m:Math?.max(c,n?.top-w-m);this.tagPopupPositionBySold?.set(i,{left:L,top:Gt,placement:Ve})}getTagPopupHeight(e){let t=this.getSoldTags(e)?.length||0;return 75+Math?.max(1,Math?.ceil(t/3))*32}loadMarketingCampaigns(){this._marketingCampaignService?.getMarketingCampaignDropDownList({campaignType:1,moduleId:A.ModuleStatusId.LEAD})?.subscribe(e=>{e?.statusCode===200&&(this.marketingCampaignList=e?.data?.items||[])})}getCampaignTitleById(e){let t=e?.marketingCampignId||e?.leadInfo?.marketingCampignId||e?.leadId?.marketingCampignId;return t&&this.marketingCampaignList?.find(n=>n?._id===t)?.name||null}getMergedAcquisitionAnalyticsForSold(e){return e?.analyticsInfo||e?.leadsData?.analyticsInfo||e?.leadData?.analyticsInfo||e?.propertyData?.analyticsInfo||{}}parseExpectedProfitNumber(e){if(e==null||e==="")return null;let t=typeof e=="number"?e:Number(String(e)?.replace(/[$,\s]/g,""));return Number.isNaN(t)?null:t}getHoldingPeriodDays(e){return this.pipeline(e?.purchaseDate,e?.salesDate)}pipeline(e,t){let i=new Date(t)?.getTime(),n=new Date(e)?.getTime(),o=i-n,c=Math?.round(o/(1e3*3600*24));return c>0?c:0}static{this.\u0275fac=function(t){return new(t||s)(_(z),_(O),_(j),_(H),_(q),_(re),_(St))}}static{this.\u0275cmp=U({type:s,selectors:[["app-sold-list-view"]],inputs:{data:"data",searchText:"searchText",totalInventory:"totalInventory",itemsPerPage:"itemsPerPage",pipeLine:"pipeLine",currentPipeline:"currentPipeline",moduleId:"moduleId",selectedItems:"selectedItems",listBulkSelectionMenu:"listBulkSelectionMenu",listBulkToolbarVirtualCount:"listBulkToolbarVirtualCount",listBulkExcludedIds:"listBulkExcludedIds",listBulkCustomRangeMin:"listBulkCustomRangeMin",listBulkCustomRangeMax:"listBulkCustomRangeMax",moduleActions:"moduleActions",useDropdownForModuleActions:"useDropdownForModuleActions",isLoading:"isLoading"},outputs:{_emitterPage:"_emitterPage",_emitterLimit:"_emitterLimit",_emitterSort:"_emitterSort",_searchEmit:"_searchEmit",_statusChangeEmitter:"_statusChangeEmitter",_refreshData:"_refreshData",_selectedItem:"_selectedItem",_actionSelected:"_actionSelected",_listViewAction:"_listViewAction",_listViewSelectionMenu:"_listViewSelectionMenu"},standalone:!1,features:[Ne],decls:14,vars:36,consts:[[3,"selectedDropdownSelect","selectedCustomRangeApply","searchChange","pageChange","pageSizeChange","columnSettingClick","customFieldsChange","actionSelected","enableStickyDefaultHeader","showHeader","showSearch","immediateColumnSettingsSave","showViewTypeColumn","showViewType","selectedDropdownItems","selectedDropdownActiveAction","selectedDropdownClass","selectedCustomRangeEnabled","selectedCustomRangeSubLabel","customRangeTotalRecordCount","alwaysShowSelectedButton","searchPlaceholder","searchTerm","showPagination","columns","pagination","loading","moduleId","moduleActions","useDropdownForModuleActions","selectedListItemCount","selectedCount","customFields"],["appTable","",1,"min-w-[1100px]",3,"bordered"],["appTr","",3,"hoverable"],["appTh","","width","60px",1,"cursor-pointer","select-none","sticky","left-0","z-[1]","bg-transparency-0"],[3,"checkedChange","checked"],["appTh","",1,"cursor-pointer","select-none",3,"sticky","left-[50px]","z-[1]","bg-transparency-0","width"],["appTh","","width","140px","tooltipPosition","top",1,"cursor-pointer","select-none",3,"pTooltip"],["appTr","",1,"group","relative"],["appTh","",1,"cursor-pointer","select-none",3,"click"],[1,"ml-1",3,"opacity-100","opacity-30"],[1,"ml-1"],[1,"w-[12px]","h-[12px]","inline-block",3,"src"],[1,"block","max-w-[120px]","truncate"],["appTr","",1,"group","relative",3,"mouseenter","mouseleave"],["appTd","",1,"sticky","left-0","z-[1]","bg-transparency-0","group-hover:bg-activity-outbound-bg"],[3,"checkedChange","checked","label"],["appTd","",1,"bg-transparency-0","group-hover:bg-activity-outbound-bg",3,"sticky","left-[50px]","z-[1]","relative","cursor-pointer"],["appTd",""],["appTd","",1,"bg-transparency-0","group-hover:bg-activity-outbound-bg",3,"click"],[1,"flex","flex-col","items-start","self-stretch","gap-[2px]"],[1,"text-p"],[1,"flex","items-center","gap-[5px]"],[1,"relative","inline-flex","items-center"],[1,"text-h4","font-semibold"],[1,"flex","items-center","justify-between","py-[2px]","px-[5px]","gap-[5px]","text-label","font-medium","cursor-pointer","hover:opacity-90","transition-opacity",3,"ngStyle"],[1,"flex","items-center","justify-between","py-[2px]","px-[5px]","gap-[5px]","text-label","font-medium","cursor-pointer","hover:opacity-90","transition-opacity",3,"click","ngStyle"],[1,"flex","items-center","gap-[6px]","truncate","min-w-0"],[1,"inline-block","w-[6px]","h-[6px]","rounded-full","shrink-0",3,"ngStyle"],[1,"text-p","truncate"],["svgClass","w-[12px] h-[12px] rotate-90 shrink-0","src","assets/images/icons/arrow-right.svg",3,"ngStyle"],[1,"flex","items-center","gap-[3px]"],[1,"text-p","text-transparency-70"],[1,"flex","items-center","-space-x-[10px]"],[1,"flex-none","flex","items-center","justify-center","bg-primary-5","rounded-full","border-[2px]","border-solid","border-transparency-0","text-h5","text-primary-90","font-semibold","w-[30px]","h-[30px]","relative","overflow-hidden"],["tooltipPosition","top",1,"text-h4","text-primary-90","font-semibold","cursor-pointer",3,"pTooltip","escape","tooltipDisabled"],["width","30","height","30","tooltipPosition","bottom",1,"w-full","h-full","object-cover","rounded-full",3,"src","alt","pTooltip"],["tooltipPosition","bottom",1,"flex-none","flex","items-center","justify-center","bg-primary-5","rounded-full","border-[2px]","border-solid","border-transparency-0","overflow-hidden","text-h5","text-primary-90","font-semibold","w-[34px]","h-[34px]",3,"pTooltip"],["tooltipPosition","top",1,"text-h4","text-primary-90","font-semibold","cursor-pointer",3,"click","pTooltip","escape","tooltipDisabled"],[1,"flex","items-center","gap-[3px]","p-[4px]","bg-transparency-1
185","rounded-[20px]","border-[1px]","border-solid","border-transparency-15","group-hover:bg-transparency-0","group-hover:border-transparency-25"],["src","assets/images/icons/call-2.svg","svgClass","w-[18px] h-[18px] inline-block",1,"text-transparency-90"],[1,"text-h4","text-transparency-100","font-semibold"],["src","assets/images/icons/sms-2.svg","svgClass","w-[18px] h-[18px] inline-block",1,"text-transparency-90"],["src","assets/images/icons/voice-mail-2.svg","svgClass","w-[18px] h-[18px] inline-block",1,"text-transparency-90"],["src","assets/images/icons/email-2.svg","svgClass","w-[18px] h-[18px] inline-block",1,"text-transparency-90"],["src","assets/images/icons/direct-mail-2.svg","svgClass","w-[18px] h-[18px] inline-block",1,"text-transparency-90"],[1,"relative","inline-flex","items-center",3,"mouseenter","mouseleave"],[1,"fixed","z-[50]",3,"left","top"],[1,"fixed","right-[26px]","xl:right-[41px]","z-[49]","flex","items-center","gap-[10px]","bg-activity-outbound-bg","px-2",3,"top","height"],[1,"fixed","z-[50]"],[1,"absolute","left-1/2","-translate-x-1/2","w-[12px]","h-[12px]","bg-transparency-0","rotate-45",3,"ngClass"],[1,"bg-transparency-0","p-[20px]","rounded-[20px]","w-[400px]","max-w-[400px]","shadow-[0px_0px_30px_0px_rgba(1,1,11,0.05)]"],[1,"text-h4","text-transparency-100","font-semibold","py-[5px]","mb-[10px]"],[1,"flex","flex-wrap","gap-[10px]"],[1,"h-[22px]","px-[8px]","py-[3px]","rounded-[10px]","inline-flex","items-center","gap-[5px]","text-[13px]","leading-[13px]","font-medium",3,"ngClass"],["svgClass","w-[12px] h-[12px]","src","assets/images/icons/close-circle-filled_gray.svg",1,"cursor-pointer",3,"click"],[1,"fixed","right-[26px]","xl:right-[41px]","z-[49]","flex","items-center","gap-[10px]","bg-activity-outbound-bg","px-2"],["icon","assets/images/icons/edit-action-1.svg","variant","ghost","type","light","size","28","customClass","!p-0",3,"click","iconHeight","iconWidth","leftIcon"],["icon","assets/images/icons/delete-action-1.svg","variant","ghost","type","light","size","28","customClass","!p-0",3,"click","iconHeight","iconWidth","leftIcon"],["target","_blank","rel","noopener noreferrer","tooltipPosition","top",1,"block","max-w-[120px]","truncate","text-p","text-primary-90","underline","cursor-pointer",3,"href","pTooltip"],["tooltipPosition","top",1,"block","max-w-[120px]","truncate","text-p",3,"pTooltip"],["target","_blank","rel","noopener noreferrer","tooltipPosition","top",1,"block","max-w-[120px]","truncate","text-p","text-primary-90","underline","cursor-pointer",3,"click","href","pTooltip"],["appTd","",1,"py-[30px]","text-p","font-medium","text-transparency-90"],[1,"sticky","left-0","flex","w-[calc(100vw-160px)]","justify-center"]],template:function(t,i){t&1&&(a(0,"app-table-container",0),y("selectedDropdownSelect",function(o){return i.onListViewToolbarMenu(o)})("selectedCustomRangeApply",function(o){return i.onToolbarCustomRangeApplied(o)})("searchChange",function(o){return i.searchControl==null?null:i.searchControl.setValue(o)})("pageChange",function(o){return i.onPageChange(o)})("pageSizeChange",function(o){return i.onItemsPerPageChange(o)})("columnSettingClick",function(o){return i.onColumnUpdate(o)})("customFieldsChange",function(o){return i.onCustomFieldsChange(o)})("actionSelected",function(o){return i.onActionSelected(o)}),a(1,"table",1)(2,"thead")(3,"tr",2)(4,"th",3)(5,"app-checkbox",4),y("checkedChange",function(o){return i.selectAll(o)}),d()(),R(6,Fi,4,14,"th",5,B),R(8,Li,3,2,"th",6,B),d()(),a(10,"tbody"),R(11,Un,7,2,"tr",7,B,!1,Wn,1,1),d()()()),t&2&&(x("enableStickyDefaultHeader",!0)("showHeader",!0)("showSearch",!0)("immediateColumnSettingsSave",!0)("showViewTypeColumn",!0)("showViewType",!1)("selectedDropdownItems",i.selectionToolbarDropdownItems)("selectedDropdownActiveAction",i.listBulkSelectionMenu)("selectedDropdownClass","!w-[187px] !min-w-[187px] !p-0 !gap-[5px] rounded-[10px] shadow-[0px_0px_30px_5px_rgba(1,1,11,0.05)] border-transparency-25 !overflow-hidden")("selectedCustomRangeEnabled",!0)("selectedCustomRangeSubLabel",i.lastCustomSelectionRangeSubtitle)("customRangeTotalRecordCount",i.totalInventory)("alwaysShowSelectedButton",!0)("searchPlaceholder","Search data")("searchTerm",i.searchText)("showPagination",!0)("columns",i.getColumnsForTable())("pagination",Oe(30,Di,i.currentPage,i.totalPages,i.totalInventory,i.itemsPerPage,$(29,Ti)))("loading",i.isLoading)("moduleId",i.moduleId)("moduleActions",i.moduleActions)("useDropdownForModuleActions",i.useDropdownForModuleActions)("selectedListItemCount",i.toolbarSelectedCount)("selectedCount",i.toolbarSelectedCount)("customFields",i.getCustomFieldsForPanel()),l(),x("bordered",!0),l(2),x("hoverable",!1),l(2),x("checked",i.isChecked()),l(),N(i.getVisibleColumns()),l(2),N(i.getVisibleCustomQuestions()),l(3),N(i.data))},dependencies:[Ge,Ye,oe,at,ut,pt,mt,ht,_t,G,ct,Ze,Qe,Ke],encapsulation:2})}}return s})()});function jn(s,u){if(s&1){let e=V();a(0,"app-sold-list-view",5),y("_emitterPage",function(i){g(e);let n=r();return C(n.onPageChange(i))})("_emitterLimit",function(i){g(e);let n=r();return C(n.onItemsPerPageChange(i))})("_emitterSort",function(i){g(e);let n=r();return C(n.onSort(i))})("_searchEmit",function(i){g(e);let n=r();return C(n.onSearch(i))})("_statusChangeEmitter",function(i){g(e);let n=r();return C(n.onStatusChange(i))})("_refreshData",function(){g(e);let i=r();return C(i.onRefreshData())})("_selectedItem",function(i){g(e);let n=r();return C(n.selectItems(i))})("_listViewSelectionMenu",function(i){g(e);let n=r();return C(n.onListViewSelectionMenu(i))})("_listViewAction",function(i){g(e);let n=r();return C(n.onListViewAction(i))})("_actionSelected",function(i){g(e);let n=r();return C(n.onSoldListModuleAction(i))}),d()}if(s&2){let e=r();x("data",e.allInventory)("pipeLine",e.allPipelineList)("currentPipeline",e.currentPipeline)("totalInventory",e.totalInventory)("searchText",e.searchText)("itemsPerPage",e.itemsPerPage)("moduleId",e.moduleId)("selectedItems",e.selectedItems)("listBulkSelectionMenu",e.listViewBulkSelectionMenu)("listBulkToolbarVirtualCount",e.listBulkToolbarVirtualCountForListView)("listBulkExcludedIds",e.listViewBulkExcludedIdsForList)("listBulkCustomRangeMin",e.listViewBulkCustomRangeMin)("listBulkCustomRangeMax",e.listViewBulkCustomRangeMax)("moduleActions",e.headerConfig.moduleActions)("useDropdownForModuleActions",!0)("isLoading",e.isLoading||!e.listDataReady)}}var Ht,ke=Y(()=>{Te();yt();si();pi();Se();_i();xe();W();Ct();Ie();ve();ye();gt();ei();se();ne();ai();oi();lt();ci();De();Ht=(()=>{class s{constructor(e,t,i,n,o,c,m,h,w,b,T,L){this._inventoryService=e,this._loaderServices=t,this._toasterService=i,this._globalService=n,this._leadsService=o,this._userService=c,this._dialog=m,this._router=h,this._activatedRoute=w,this._pipelineService=b,this._creditService=T,this._commonService=L,this.VIEW_TYPES={LIST:"LIST",MAP:"MAP"},this.headerConfig={icon:"assets/images/icons/money-2.svg",iconBgClass:"bg-added-crayolaorange",iconStyle:"#F3722C",title:"Sold",count:null,showCount:!0,showViewToggle:!0,currentView:this.VIEW_TYPES.LIST,availableViews:[this.VIEW_TYPES.LIST,this.VIEW_TYPES.MAP],showAddButton:!1,showExportButton:!1,exportButtonIcon:"assets/images/icons/download.svg",showFilter:!1,toggleActionBar:!1,moduleActions:[]},this.allInventory=[],this.totalInventory=0,this.currentPage=1,this.itemsPerPage=10,this.searchText="",this.sort={sortBy:"sales
18Date",sortMode:-1},this.isLoading=!0,this.listDataReady=!1,this.filterData=[],this.currentView=this.VIEW_TYPES.LIST,this.viewType="list",this.previousViewBeforeMap=null,this.gridViewStatuses=[],this.currentPipeline={_id:"all",title:"Sold",isListViewEnable:!0,isEditable:!1,mainStatusList:[]},this.currentPipelineId=null,this.allPipelineList=[],this.mainUserList=[],this.messageConstant=F,this.moduleId=A?.ModuleStatusId?.SOLD,this.moduleType=A?.CallSMSModule?.LEADS,this.masterDataPayload={},this.staticStatusIds=[],this.defaultNumberList=[],this.selectedItems=[],this.listViewBulkSelectionMenu=null,this.listViewBulkToolbarVirtualCount=null,this.listViewBulkCustomRangeMin=null,this.listViewBulkCustomRangeMax=null,this.listViewBulkExcludedIds=new Set,this.currentView=this.VIEW_TYPES.LIST,this.viewType="list",this.headerConfig.currentView=this.VIEW_TYPES.LIST,this.getUser(),this.getSMSCredit(),this.getCallCredit(),this.getNumberList()}ngOnInit(){this._pipelineService?._setCurrentModule?.("sold");let e=`sidebarPipelineId:${window?.location?.pathname}`,t=this._activatedRoute?.snapshot?.queryParamMap?.get("pipelineId"),i=sessionStorage?.getItem(e);if(t){sessionStorage?.setItem(e,t);let n=new URL(window?.location?.href);n?.searchParams?.delete("pipelineId"),window?.history?.replaceState(history.state,"",`${n?.pathname}${n?.search}${n?.hash}`)}this.currentPipelineId=t||i||this._pipelineService?.getCurrentPipelineId(),this.headerConfig.showViewToggle=!0,this.headerConfig.availableViews=[this.VIEW_TYPES.LIST,this.VIEW_TYPES.MAP],this.initializeSoldListModuleActions(),this.isLoading=!0,this.initializePipelines()}setView(e,t=!1){this.currentView=e,this.headerConfig.currentView=e,this.viewType="list",t&&localStorage.setItem("SoldPipelineView",e)}initializePipelines(e=!1){return Ae(this,null,function*(){try{let t=yield this._pipelineService?.fetchPipelinesForModule(this.moduleId,e);if(!t?.length){this.resetToEmptyState();return}this.allPipelineList=t;let i=this.currentPipelineId,n=t?.find(o=>o?._id===i);if(n)this.currentPipelineId=i,this.initializePipelineMode(n);else{let o=t[0];this.currentPipelineId=o?._id||null,this.initializePipelineMode(o)}this.loadInventoryForAllStatuses()}catch(t){this.resetToEmptyState()}})}initializePipelineMode(e){this.currentPipeline=k(S({},e),{mainStatusList:e?.mainStatusList||[]}),this.staticStatusIds=(e?.mainStatusList||[]).map(t=>t?._id).filter(t=>t!=null),this.initializeStatuses()}resetToEmptyState(){this.staticStatusIds=[],this.initializeStatuses(),this.allInventory=[],this.totalInventory=0,this.headerConfig.count=0,this.isLoading=!1,this.listDataReady=!0,this._loaderServices?.stop(),this.currentPipeline={_id:this.currentPipelineId||"all",title:"Sold",isListViewEnable:!0,isEditable:!1,mainStatusList:[]}}initializeStatuses(){this.currentPipeline?.mainStatusList?.length?this.gridViewStatuses=this.currentPipeline?.mainStatusList?.map(e=>k(S({},e),{items:e?.items||[],count:e?.count||0})):this.gridViewStatuses=[],this.filterData=[]}loadInventoryForAllStatuses(){this.listDataReady=!1,this.getInventoriesListing()}resetInventoryData(){this.allInventory=[],this.totalInventory=0,this.headerConfig.count=0}getInventoriesListing(){let e={mainStatusId:this.staticStatusIds,page:this.currentPage,limit:this.itemsPerPage};this.sort&&(e.sort=[{fieldName:this.sort?.sortBy,order:this.sort?.sortMode??1}]),this.searchText&&(e.searchText=this.searchText),this.isLoading=!0,this._loaderServices.start(),this._inventoryService.getInventories(e)?.subscribe(t=>{if(t?.statusCode===200){let i=t?.data?.items||[];this.processInventoryResponse(i,t?.data?.count||0)}else this.handleInventoryError();this._loaderServices?.stop(),this.isLoading=!1,this.listDataReady=!0},t=>{this.handleInventoryError(),this._toasterService?.showError(t?.error?.message||F?.unknownError),this._loaderServices?.stop(),this.isLoading=!1,this.listDataReady=!0})}updateInventoryItem(e){if(!e)return;let t=[],i=this.pipeline(e?.inventoryCreated||e?.createdAt);e?.mainStatusId&&(t.push({title:"Created",value:e?.inventoryCreated||e?.createdAt,pipe:"DATE"}),t.push({title:"In pipeline",value:i+" days"})),e.displayArray=t}pipeline(e){if(!e)return 0;let t=new Date().getTime(),i=new Date(e).getTime(),n=t-i,o=Math.round(n/(1e3*3600*24));return o>0?o:0}assignUser(e){let t=[],i=e?.assignUser;if(!i||typeof i!="object"){e.assignUserData=t;return}let n=[];Object.keys(i||{}
18).forEach(m=>{let h=i?.[m];Array.isArray(h)?h.forEach(w=>{w!=null&&w!==""&&n.push(String(w))}):h!=null&&h!==""&&n.push(String(h))}),Array.from(new Set(n)).forEach(m=>{let h=this.mainUserList?.find(T=>String(T?._id??"")===String(m??""));if(!h)return;let w=(h?.firstName?.charAt(0)||"")+(h?.lastName?.charAt(0)||""),b=Object.keys(i||{}).filter(T=>{let L=i?.[T];return Array.isArray(L)?L?.some(E=>String(E)===String(m)):String(L??"")===String(m)});t.push({firstName:h?.firstName,lastName:h?.lastName,name:w?.toUpperCase(),profileImage:h?.profileImage,roleNames:this.resolveAssignedRoleNames(h,b)})});let c=m=>`${m?.firstName||""} ${m?.lastName||""}`?.toLowerCase()?.trim()||String(m?._id||"");e.assignUserData=t.sort((m,h)=>c(m).localeCompare(c(h)))}resolveAssignedRoleNames(e,t){let i=[],n=new Set,o=c=>{let m=String(c??"").trim();if(!m)return;let h=m.toLowerCase();n.has(h)||(n.add(h),i.push(m))};return(t||[]).forEach(c=>{let m=(e?.roleData||[]).find(h=>String(h?._id??"")===String(c??""));m?.name&&o(m.name)}),i.length||(Array.isArray(e?.roleNames)?e.roleNames.forEach(c=>o(c)):e?.roleNames&&String(e.roleNames).split(",").forEach(c=>o(c)),e?.roleName&&String(e.roleName).split(",").forEach(c=>o(c))),i}reprocessAssignUserData(){if(!this.mainUserList?.length)return;(Array.isArray(this.allInventory)?this.allInventory:this.allInventory?[this.allInventory]:[]).forEach(t=>this.assignUser(t))}getUser(){this._userService?.getUsers({})?.subscribe(e=>{e?.statusCode==200&&(this.mainUserList=e?.data||[],this.reprocessAssignUserData())},()=>{this.mainUserList=[]})}onViewChange(e){if(this._loaderServices?.stop(),this.isLoading=!1,e===this.VIEW_TYPES.MAP){this.previousViewBeforeMap=this.currentView,this.openMapViewDetails();return}this.setView(e,!0),this.loadInventoryForAllStatuses()}onPageChange(e){this.currentPage=e,this.loadInventoryForAllStatuses()}onItemsPerPageChange(e){this.itemsPerPage=e,this.currentPage=1,this.loadInventoryForAllStatuses()}onSearch(e){this.searchText=e,this.currentPage=1,this.loadInventoryForAllStatuses()}onSort(e){if(e?.sortBy){let t={address:"address",status:"mainStatusTitle",projectType:"projectTypeTitle",price:"purchasePrice",createdAt:"createdAt",inPipeline:"purchaseDate",campaignName:"crmQuestionTitle","propertyInfo.city":"propertyInfo.city","propertyInfo.state":"propertyInfo.state","propertyInfo.zip":"propertyInfo.zip",holdingPeriod:"purchaseDate",tasks:"pendingTask",exitType:"projectTypeTitle",team:"createdAt",soldDate:"salesDate",soldPrice:"salesPrice",expectedProfit:"analyticsInfo.assignmentFee",actualProfit:"netProfit",purchasePrice:"purchasePrice",purchaseDate:"purchaseDate",goingOnMarket:"goingOnMarket",listedPrice:"listedPrice",rehabStart:"rehabStart",rehabFinish:"rehabFinish",underCoClosingDate:"underCoClosingDate",underCoPrice:"underCoPrice"};this.sort={sortBy:t[e?.sortBy]||e?.sortBy,sortMode:e?.sortMode||1},this.currentPage=1}this.loadInventoryForAllStatuses()}onRefreshData(){this._pipelineService?.refreshPipelines(),this.initializePipelines(!0)}getInventoryDetails(e){e?._id&&this._router?.navigate(["/sold/details"],{queryParams:{soldId:e?._id},state:{currentPipelineId:this.currentPipelineId??this.currentPipeline?._id??"all"}})}onListViewAction(e){switch(e?.type){case"editSold":this.openEditSoldPropertyDialog(e?.item);break;case"deleteSold":this.handleDeleteSoldAction(e?.item,e?.event);break;default:break}}selectItems(e){let t=e||[];if(!t.length)this.clearListViewBulkSelection(),this.selectedItems=[];else if(this.listViewBulkSelectionMenu==="selectAll"){let i=Vt({selectedRows:t,menu:this.listViewBulkSelectionMenu,visibleRows:this.allInventory||[],excludedIds:this.listViewBulkExcludedIds,totalCount:this.totalInventory??0});i.shouldClearAll?(this.clearListViewBulkSelection(),this.selectedItems=[]):(this.listViewBulkExcludedIds=i.excludedIds,this.listViewBulkSelectionMenu=i.menu,this.selectedItems=i.selectedRows)}else this.selectedItems=t}onListViewSelectionMenu(e){if(!e){this.selectedItems=[],this.clearListViewBulkSelection();return}if(e==="selectVisible"){this.listViewBulkSelectionMenu="selectVisible",this.listViewBulkToolbarVirtualCount=null,this.listViewBulkExcludedIds=new Set;return}if(e==="selectAll"){this.selectedItems=[],this.listViewBulkSelectionMenu="selectAll",this.listViewBulkToolbarVirtualCount=null,this.listViewBulkCustomRangeMin=null,this.listViewBulkCustomRangeMax=null,this.listViewBulkExcludedIds=new Set;return}if(typeof e=="object"&&e?.action==="custom"){let t=Math.abs(e.max-e.min)+1;this.selectedItems=[],this.listViewBulkSelectionMenu="custom",this.listViewBulkToolbarVirtualCount=t,this.listViewBulkCustomRangeMin=e.min,this.listViewBulkCustomRangeMax=e.max,this.listViewBulkExcludedIds=new Set}}clearListViewBulkSelection(){this.listViewBulkSelectionMenu=null,this.listViewBulkToolbarVirtualCount=null,this.listViewBulkCustomRangeMin=null,this.listViewBulkCustomRangeMax=null,this.listViewBulkExcludedIds=new Set}get listBulkToolbarVirtualCountForListView(){return this.listViewBulkSelectionMenu==="selectAll"?be(this.totalInventory??0,this.listViewBulkExcludedIds):this.listViewBulkSelectionMenu==="custom"?this.listViewBulkToolbarVirtualCount:null}get listViewBulkExcludedIdsForList(){return kt(this.listViewBulkExcludedIds)}isListViewBulkSelection(){return this.listViewBulkSelectionMenu==="selectAll"||this.listViewBulkSelectionMenu==="custom"}getListViewBulkSelectedCount(){return this.listViewBulkSelectionMenu==="selectAll"?be(this.totalInventory??0,this.listViewBulkExcludedIds):this.listViewBulkSelectionMenu==="custom"?this.listViewBulkToolbarVirtualCount||0:this.selectedItems?.length||0}buildSoldBulkPayload(){let e={mainStatusId:this.staticStatusIds||[],holdingSort:!0,filterType:this.isListViewBulkSelection()?this.listViewBulkSelectionMenu==="custom"?"range":"all":"manual"};return this.searchText&&(e.searchText=this.searchText),this.sort?.sortBy&&(e.sort=[{fieldName:this.sort.sortBy,order:this.sort.sortMode??1}]),this.listViewBulkSelectionMenu==="custom"&&this.listViewBulkCustomRangeMin!=null&&this.listViewBulkCustomRangeMax!=null&&(e.rangeFilter={start:this.listViewBulkCustomRangeMin,end:this.listViewBulkCustomRangeMax}),e.filterType==="manual"&&(e.inventoryIds=this.selectedItems?.map(t=>t?._id)?.filter(Boolean)),e}openEditSoldPropertyDialog(e){e?._id&&(this.dialogRef=this._dialog?.open(de,{panelClass:"re-new-custom-dialog",disableClose:!0,width:"800px",maxHeight:"92vh",data:k(S({},e),{isEdit:!0,item:e,inventoryId:e._id,moduleId:A?.ModuleStatusId?.SOLD,pipelineMainStatusList:this.currentPipeline?.mainStatusList||[],pipelineId:e?.pipelineId||this.currentPipelineId,page:this.currentPage,limit:this.itemsPerPage})}),this.dialogRef?.afterClosed()?.subscribe(t=>{t&&this.loadInventoryForAllStatuses()}))}handleDeleteSoldAction(e,t){t&&t.stopPropagation(),e?._id&&(this.dialogRef=this._dialog?.open(we,{panelClass:"re-new-custom-dialog",disableClose:!0,width:"600px",data:{header:"Delete Sold Property",subHeader:"Are you sure you want to delete this sold property?",message:`The ${e?.address??"property"} record will be deleted upon confirmation. Once confirmed, you cannot undo these changes.`,icon:"assets/images/icons/money-2.svg",buttonLabel:"Delete"}}),this.dialogRef?.afterClosed()?.subscribe(i=>{i&&(this._loaderServices?.start(),this._leadsService.deleteInventory({inventoryId:e._id}).subscribe({next:n=>{this._loaderServices?.stop(),n?.statusCode===200?this.onActionCompleted({action:"deleteSold",needsRefresh:!0}):this._toasterService?.showError(n?.message||F?.unknownError)},error:n=>{this._loaderServices?.stop(),this._toasterService?.showError(this.extractDeleteErrorMessage(n))}}))}))}processInventoryResponse(e,t){e?.forEach(i=>
18{if(this.updateInventoryItem(i),this.assignUser(i),i?.mainStatusId){let n=this.gridViewStatuses?.find(o=>o?._id===i?.mainStatusId);i.mainStatusTitle=n?.title||""}}),this.allInventory=e,this.totalInventory=t,this.headerConfig.count=t}handleInventoryError(){this.resetInventoryData()}onStatusChange(e){if(!e)return;let t=e?.inventoryId??e?.subModuleId??e?.item?._id??e?.item?.inventoryId;this._commonService.changeInventoryStatus(k(S({},e),{inventoryId:t}))?.subscribe(i=>{i?.statusCode===200&&this.loadInventoryForAllStatuses()})}getSMSCredit(){this._loaderServices?.start(),this._creditService?.getSMSCredit({})?.subscribe(e=>{this._loaderServices?.stop(),e?.statusCode==200&&(this.SMSBalance=e?.data)},()=>this._loaderServices?.stop())}getCallCredit(){this._loaderServices?.start(),this._creditService?.getCallCredit({})?.subscribe(e=>{this._loaderServices?.stop(),e?.statusCode==200&&(this.callBalance=e?.data)},()=>this._loaderServices?.stop())}getNumberList(){this._commonService?.getNumberList({page:1,limit:100})?.subscribe(e=>{e?.statusCode==200&&(this.defaultNumberList=e?.data?.items?.map(t=>({_id:t?._id,name:`${t?.marketingTitle||"Number"} | ${this._globalService?.maskNumber(t?.number)}`,value:t?.number,callFlow:t?.callFlow}))||[])},()=>this.defaultNumberList=[])}setQuickFilter(e){this.filterData=e?.filterData||[],this.loadInventoryForAllStatuses()}onExportClick(){if(!this.totalInventory||this.totalInventory<1){this._toasterService?.showInfo("No sold properties to export");return}this.dialogRef=this._dialog?.open(Pe,{width:"800px",panelClass:"re-new-custom-dialog",data:{moduleId:A?.MainStatusId?.SOLD,selectedItems:[],moduleType:"inventory",selectedCount:this.totalInventory,searchText:this.searchText,filterData:this.filterData,mainStatusId:this.staticStatusIds,inventoryBulkFilterPayload:this.buildSoldExportAllPayload()}})}openMapViewDetails(){if(this.currentPipelineId&&this.currentPipelineId!=="all"&&this.staticStatusIds?.length){let e={mainStatusId:this.staticStatusIds,page:1,limit:1e3};this._loaderServices?.start(),this._inventoryService?.getInventories(e)?.subscribe(t=>{if(this._loaderServices?.stop(),t?.statusCode===200){let i=t?.data?.items||[];i?.forEach(n=>{if(this.updateInventoryItem(n),this.assignUser(n),n?.mainStatusId){let o=this.gridViewStatuses?.find(c=>c?._id===n?.mainStatusId);n.mainStatusTitle=o?.title||""}}),this.openMapDialog(i)}else this._toasterService?.showError("Failed to load sold for map view")},t=>{this._loaderServices?.stop(),this._toasterService?.showError(t?.error?.message||F?.unknownError||"")})}else this.openMapDialog(this.allInventory||[])}openMapDialog(e){let t=e?.filter?.((n,o,c)=>o===c?.findIndex?.(m=>m?._id===n?._id))??[];this._dialog?.open($t,{backdropClass:"re-mapview-backdrop-dialer",disableClose:!1,width:"100%",maxWidth:"96vw",data:{allInventory:t,moduleId:this.moduleId,moduleType:this.moduleType,currentPipelineId:this.currentPipelineId,currentPipeline:this.currentPipeline,allPipelines:this.allPipelineList||[]}})?.afterClosed()?.subscribe(()=>{this.previousViewBeforeMap&&(this.setView(this.previousViewBeforeMap,!0),this.previousViewBeforeMap=null,this.loadInventoryForAllStatuses())})}initializeSoldListModuleActions(){this.headerConfig?.moduleActions?.length||(this.headerConfig.moduleActions=this.getSoldListModuleActions())}getSoldListModuleActions(){return[{category:"Actions",actions:[{title:"Export",icon:"assets/images/icons/file-download-2.svg",actionKey:"exportInventory",iconColor:"text-primary-90"},{title:"Delete",icon:"assets/images/icons/delete.svg",actionKey:"deleteSelected",iconColor:"text-secondary-red"}]}]}onSoldListModuleAction(e){switch(e){case"exportInventory":this.exportSelectedSold();break;case"deleteSelected":this.deleteSelectedSold();break}}exportSelectedSold(){let e=this.isListViewBulkSelection(),t=this.listViewBulkSelectionMenu==="selectAll",i=this.listViewBulkSelectionMenu==="custom";if(e){if(!this.totalInventory||this.totalInventory<1){this._toasterService?.showInfo("No sold properties to export");return}else if(i&&(this.listViewBulkCustomRangeMin==null||this.listViewBulkCustomRangeMax==null)){this._toasterService?.showInfo("Invalid selection range");return}}else if(!this.selectedItems?.length){this._toasterService?.showInfo("Please select at least one sold property");return}let n={moduleId:A?.MainStatusId?.SOLD,selectedItems:this.selectedItems,moduleType:"inventory",selectedCount:t?this.totalInventory:i?this.getListViewBulkSelectedCount():this.selectedItems?.length??0,searchText:this.searchText,filterData:this.filterData,mainStatusId:this.staticStatusIds,inventoryBulkFilterPayload:this.buildSoldBulkPayload()};this.dialogRef=this._dialog?.open(Pe,{width:"800px",panelClass:"re-new-custom-dialog",data:n}),this.dialogRef?.afterClosed()?.subscribe(o=>{o?.success&&(this.selectedItems=[],this.listViewBulkSelectionMenu=null,this.listViewBulkToolbarVirtualCount=null,this.headerConfig.toggleActionBar=!1)})}deleteSelectedSold(){if(!this.selectedItems?.length&&!this.isListViewBulkSelection()){this._toasterService?.showInfo("Please select at least one sold property");return}let e=this.getListViewBulkSelectedCount(),t=e>1,i=t?`Are you sure you want to delete ${e} sold properties?`:"Are you sure you want to delete this sold property?",n=t?`${e} sold properties will be deleted upon confirmation. Once confirmed, you cannot undo these changes.`:"The sold property will be deleted upon confirmation. Once confirmed, you cannot undo these changes.";this.dialogRef=this._dialog?.open(we,{panelClass:"re-new-custom-dialog",disableClose:!0,width:"600px",data:{header:"Delete Sold Property",subHeader:i,message:n,icon:"assets/images/icons/money-2.svg",buttonLabel:"Delete"}}),this.dialogRef?.afterClosed()?.subscribe(o=>{o&&this.deleteMultipleSold()})}deleteMultipleSold(){if(!this.selectedItems?.length&&!this.isListViewBulkSelection())return;let e=this.buildSoldBulkPayload();if(e.filterType==="manual"&&!e.inventoryIds?.length){this._toasterService?.showError("No valid sold property IDs found");return}this._loaderServices?.start(),this._leadsService?.deleteMultipleInventory(e)?.subscribe({next:t=>{this._loaderServices?.stop(),t?.statusCode===200?(this.selectedItems=[],this.clearListViewBulkSelection(),this.loadInventoryForAllStatuses()):this._toasterService?.showError(t?.message||F?.unknownError)},error:t=>{this._loaderServices?.stop(),this._toasterService?.showError(this.extractDeleteErrorMessage(t))}})}extractDeleteErrorMessage(e){let t=e,i=t?.error;if(i&&typeof i=="object"&&i!==null&&"message"in i){let n=i.message;if(n)return n}return typeof i=="string"&&i.trim()?i:t?.message?t.message:F?.unknownError}buildSoldExportAllPayload(){let e={mainStatusId:this.staticStatusIds||[],holdingSort:!0,filterType:"all"};return this.searchText&&(e.searchText=this.searchText),this.sort?.sortBy&&(e.sort=[{fieldName:this.sort.sortBy,order:this.sort.sortMode??1}]),e}onActionCompleted(e){e?.needsRefresh&&this.loadInventoryForAllStatuses(),this.selectedItems=[],this.clearListViewBulkSelection(),this.headerConfig.toggleActionBar=!1,(this.allInventory||[]).forEac
18h(t=>{t&&(t.isCompleted=!1)})}static{this.\u0275fac=function(t){return new(t||s)(_(le),_(q),_(H),_(z),_(ae),_(dt),_(j),_(O),_(it),_(vt),_(xt),_(re))}}static{this.\u0275cmp=U({type:s,selectors:[["app-sold"]],standalone:!1,decls:5,vars:5,consts:[["moduleTopHeader",""],[1,"flex","flex-col","h-[calc(100vh_-_75px)]"],[1,"flex-shrink-0",3,"viewChange","setMasterFilter","moduleId","currentPipelineId","headerConfig","masterDataPayload"],[1,"flex-1","min-h-0","overflow-hidden"],[3,"data","pipeLine","currentPipeline","totalInventory","searchText","itemsPerPage","moduleId","selectedItems","listBulkSelectionMenu","listBulkToolbarVirtualCount","listBulkExcludedIds","listBulkCustomRangeMin","listBulkCustomRangeMax","moduleActions","useDropdownForModuleActions","isLoading"],[3,"_emitterPage","_emitterLimit","_emitterSort","_searchEmit","_statusChangeEmitter","_refreshData","_selectedItem","_listViewSelectionMenu","_listViewAction","_actionSelected","data","pipeLine","currentPipeline","totalInventory","searchText","itemsPerPage","moduleId","selectedItems","listBulkSelectionMenu","listBulkToolbarVirtualCount","listBulkExcludedIds","listBulkCustomRangeMin","listBulkCustomRangeMax","moduleActions","useDropdownForModuleActions","isLoading"]],template:function(t,i){t&1&&(a(0,"div",1)(1,"app-module-top-header",2,0),y("viewChange",function(o){return i.onViewChange(o)})("setMasterFilter",function(o){return i.setQuickFilter(o)}),d(),a(3,"div",3),v(4,jn,1,16,"app-sold-list-view",4),d()()),t&2&&(l(),x("moduleId",i.moduleId)("currentPipelineId",i.currentPipelineId)("headerConfig",i.headerConfig)("masterDataPayload",i.masterDataPayload),l(3),I(i.viewType==="list"&&i.currentView!=="MAP"?4:-1))},dependencies:[Pt,jt],encapsulation:2})}}return s})()});var Hn,qt,zt=Y(()=>{ne();ke();Ci();W();Hn=[{path:"",component:Ht},{path:"details",component:Ft,data:{viewType:"sold"}}],qt=(()=>{class s{static{this.\u0275fac=function(t){return new(t||s)}}static{this.\u0275mod=J({type:s})}static{this.\u0275inj=Z({imports:[Ce.forChild(Hn),Ce]})}}return s})()});var Zs,qn=Y(()=>{Xe();Kt();zt();hi();xi();mi();ke();De();Te();W();Zs=(()=>{class s{static{this.\u0275fac=function(t){return new(t||s)}}static{this.\u0275mod=J({type:s})}static{this.\u0275inj=Z({providers:[{provide:et,useClass:Dt,multi:!0}],imports:[Je,qt,Lt,Tt]})}}return s})()});qn();export{Zs as SoldModule};
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.