SALE. define("controllers/Property/PropertyHistory",["require","ControllerObjects","Application","lodash","Objects"],function(e){return function(t){function r(e){if(0!==e.data.length){var t=e.data;C.add("mortgages",new u.ChildController({type:"controllers/Property/PropertyHistoryMortgages",namespace:b.get(),register:{bubble:s}}),!0),w.updateController("mortgages",{$dom:v.mortgagesContent,data:{mortgages:t,allExpanded:A,propertyStatus:S}}),v.mortgagesTab.parent().removeClass("hidden")}}function o(e){if(0!==e.data.length){var t=e.data;C.add("taxes",new u.ChildController({type:"controllers/Property/PropertyHistoryTaxes",namespace:b.get(),register:{bubble:s}}),!0),w.updateController("taxes",{$dom:v.taxContent,data:{taxes:t,allExpanded:A,propertyStatus:S}}),v.taxTab.parent().removeClass("hidden")}}function a(e){if(0!==e.data.length){var t=e.data;C.add("deeds",new u.ChildController({type:"controllers/Property/PropertyHistoryDeeds",namespace:b.get(),register:{bubble:s}}),!0),w.updateController("deeds",{$dom:v.deedContent,data:{deeds:t,allExpanded:A,propertyStatus:S}}),v.deedTab.parent().removeClass("hidden")}}function n(){A=null}function s(e){f.call("bubble",e)}function d(e){w.update(e),i()}function i(){try{w.requireDom(),w.optional("listing")}catch(e){throw e}var e=w.get("listing");S=w.get("propertyStatus"),e&&e.sListingStatus&&e.sListingStatus.removed&&S&&(S.text="Off-Market"),x=w.get("history"),e&&(x=e.history),x&&(n(),g.getCurrentUser(function(e){h=e.user,T.main.get({$dom:w.$dom,data:{propertyAddressItem:w.get("propertyAddressItem"),history:x,propertyStatus:S,pro:m.get(h,"currentDetails.products.pro.availableForUse")}})},!0))}function l(e){v=e.$dom;var t=e.data,r={promoMedium:"web-".concat(P)};if(w.updateController("summaryRows",{$dom:v.summaryRow,data:x.map(function(t,r){return{historyItems:t,dataIndex:r,propertyStatus:S,pro:e.data.pro,open:A,proPlus:m.get(h,"currentDetails.products.proPlus.availableForUse"),propertyListingID:e.data.propertyAddressItem.listing&&e.data.propertyAddressItem.listing.id}})}),e.data.pro){var o=e.data.propertyAddressItem.propertyID;T.mortgages.get({$dom:v.mortgagesContent,data:{propertyID:o}}),T.taxes.get({$dom:v.taxContent,data:{propertyID:o}}),T.deeds.get({$dom:v.deedContent,data:{propertyID:o}}),v.expandAll.on("click",function(){A=!A,v.expandAll.text(A? Homesnap.templates["controllers/ImageSlider.html"] = '{{#with data}}
{{/with}}'; (!o||!o.transactionType)&&o.transactionType.forRent,siteRootUrl:g?window.Homesnap.siteRootUrl:"https://www.homesnap.com",propertyAddressItem:o}})}function o(e){var r,a,n=e.data||{};l=e.$dom;var o=n.propertyAddressItem,d=null!==(r=null===(a=c)||void 0===a?void 0:a.getUrl())&&void 0!==r?r:{};l.ulBreadcrumbs.find("li").children().each(function(r,a){var n=$(a),l=n.data("type"),p=n.data("index");if("area"===l&&n.is("a")){var u,f,m,h,v,A,g=e.data.area[p].item,b=(null===o||void 0===o?void 0:null===(u=o.transactionType)||void 0===u?void 0:u.forRent)||2===(null===(f=c)||void 0===f?void 0:null===(m=f.transactionType)||void 0===m?void 0:m.value),w=null===(h=c)||void 0===h?void 0:null===(v=h.specialFeatures)||void 0===v?void 0:v.isOn(1);A=b&&w?y.area.getAreaForRentOpenHouseUrl(g):b?y.area.getAreaForRentUrl(g):w?y.area.getAreaOpenHouseUrl(g):y.area.getAreaSearchUrl(g),n.attr("href",i(A,d.suffix)).on("click",function(e){return t({type:"url.unhandled",url:$(e.currentTarget).attr("href"),data:g}),!1})}else"propertyAddress"===l&&s(n,o)})}function i(e,r){return r&&-1!==r.indexOf("f_1")&&e&&-1!==e.indexOf("f_1")?e+r.replace("/f_1",""):r?e+r:e}function s(e,r){var a;null!==r&&void 0!==r&&null!==(a=r.status)&&void 0!==a&&a.belongsToMultiUnitAddress&&A.itemByIds.get({data:{propertyAddressID:r.id},success:function(r){try{var a=null===r||void 0===r?void 0:r.data;if(null!==a&&void 0!==a&&a.id&&!a.propertyID){var n=$("");n.attr("href",a.url).addClass("paint-first-font"),n.on("click",function(){return t({type:"url.unhandled",url:a.url,data:a}),!1}),e.before(n),n.append(e)}}catch(e){throw v&&console.info(v),e}}})}function d(e,r,t){var a=!1,n=!1,o={1:!1,2:!1,3:!0},i=[];return Array.isArray(e)&&e.forEach(function(e){switch(e.areaTypeID){case 1:case 2:n=!0,i.push({name:e.name,type:"area",item:e});break;case 3:i.push({name:n?e.shortName:e.name,type:"area",item:e});break;case 4:a=!0,i.push({name:e.shortName,type:"area",item:e});break;case 5:i.push({name:a?e.shortName:e.name,type:"area",item:e});break;case 6:e.subTypeID&&(o[e.subTypeID.toString()]||i.push({name:e.name,type:"area",item:e}),o[e.subTypeID.toString()]=!0)}}),r&&!t&&(i.push({name:r.address.fullStreetAddressWithoutUnit,type:"propertyAddress",url:r.url}),r.address.unitNumber&&i.push({name:r.address.unitNumber.string,type:"unit",url:r.url})),i}var l,c,p=e("ControllerObjects"),u=e("Objects"),y=e("Utilities"),f=new p.Unique(r),m=new p.Callbacks,h=new p.ChildControllerManager,v=new p.StateManager(h,{}),A={listHierarchy:new p.Getter({type:[u.HSAreaItem],webService:"/service/Areas/ListHierarchy",success:function(e){try{n(e,"/service/Areas/ListHierarchy")}catch(e){throw v&&console.info(v),e}},failure:function(){throw v&&console.info(v),new Error("Search Breadcrumbs List Hierarchy controller: Unhandled Error")}}),areas:new p.Getter({type:[u.HSAreaItem],webService:"/service/Areas/ListByPropertyAddress",success:function(e){try{n(e,"/Areas/ListByPropertyAddress")}catch(e){throw v&&console.info(v),e}},failure:function(){throw v&&console.info(v),new Error("Search Breadcrumbs Areas List controller: Unhandled Error")}}),template:new p.Getter({namespace:f.get(),success:function(e){try{o(e)}catch(e){throw v&&console.info(v),e}},template:{url:"controllers/SearchBreadCrumbs.html",dom:["ulBreadcrumbs"]}}),itemByIds:new p.Getter({namespace:f.get(),type:u.HSPropertyAddressItem,webService:"/service/PropertyAddresses/GetByIDs",failure:function(){throw v&&console.info(v),new Error("Search Breadcrumbs Item by IDs controller: Unhandled Error")}})},g=y.coStarBrand.is("citysnap");return{update:function(e){v.update(e),a()},restore:function(e){v.restore(e,a)},uninit:function(){h.uninit()},getState:v.getState.bind(v),register:m.register.bind(m),event:function(e,r){h.event(e,r)}}}}); "Click to Unfavorite":"Click to Favorite"),n.spanFavoriteText.text(e? Homesnap.templates["controllers/Property/PropertyFeatures.html"] = '{{#with data}}{{#if details}}Features expand_more
{{name}}
- {{#each fields}}
- {{name}}: {{#if dataType.url}} {{else}} {{value}} {{/if}} {{/each}}
