!function(){"use strict";function PropertyPriceBox($scope,propertyPriceBox,propertyContact,propertyPriceQuoteDialog,propertyEnquiryDialog,util,property){var vm=this;vm.init=function(ownerId,propertyId,minPricePerWeek){void 0!==minPricePerWeek&&(propertyPriceBox.adwordsRemarketing.hrental_totalvalue=minPricePerWeek);propertyPriceBox.init(propertyId),propertyPriceQuoteDialog.init(propertyId)},vm.property=property,vm.getStatusCssClass=function(){var result="";vm&&vm.price.statusMessage&&vm.price.statusMessage.status&&(result="status--"+vm.price.statusMessage.status,vm.price.statusMessage.field&&(result+=" status--"+vm.price.statusMessage.status+"-"+vm.price.statusMessage.field));return result},vm.openEnquiryDialog=function(enquiryUrl){var criteria=vm.criteria;propertyEnquiryDialog.open(enquiryUrl,criteria.dateFrom,criteria.dateTo,criteria.adults,criteria.children,criteria.infants)},vm.openPriceQuoteDialog=function(propertyId){propertyPriceQuoteDialog.open(propertyId)},vm.minDateFrom=function(){return _minDateFromTo.getMinDateFrom()},vm.minDateTo=function(){return _minDateFromTo.getMinDateTo(vm.criteria.dateFrom)},vm.price=propertyPriceBox.priceResult,vm.criteria=propertyPriceBox.criteria,vm.status=propertyPriceBox.status,vm.phoneVisible=!1,vm.showPhoneAndIncrement=function(propertyId){propertyContact.showPhoneAndIncrement(propertyId).then((function(){vm.phoneVisible=!0}),(function(errors){}))};var _minDateFromTo=util.createMinDateFromTo(0,1)}angular.module("app").controller("PropertyPriceBox",PropertyPriceBox),PropertyPriceBox.$inject=["$scope","propertyPriceBox","propertyContact","propertyPriceQuoteDialog","propertyEnquiryDialog","util","property"]}(),function(){"use strict";function propertyPriceBox($rootScope,propertyPriceQuote,propertySearch,util){var service={criteria:propertyPriceQuote.criteria,priceResult:{},status:{isBusy:!1},settings:{throttleStartTime:0,throttleTime:400},init:function(propertyId){service.criteria.propertyId=propertyId,service.criteria.dateFrom=propertySearch.criteria.dateFrom,service.criteria.dateTo=propertySearch.criteria.dateTo,service.criteria.adults=getAdults(propertySearch.criteria.sleepsFrom),service.adwordsRemarketing.hrental_id=propertyId,service.adwordsRemarketing.hrental_pagetype="offerdetail",dataLayer.push({google_tag_params:service.adwordsRemarketing})},adwordsRemarketing:{}};return $rootScope.$watch((function(){return propertySearch.criteria.dateFrom+"-"+propertySearch.criteria.dateTo+"-"+propertySearch.criteria.sleepsFrom}),(function(){service.criteria.dateFrom||service.criteria.dateTo||(service.criteria.dateFrom=propertySearch.criteria.dateFrom,service.criteria.dateTo=propertySearch.criteria.dateTo,service.criteria.adults=getAdults(propertySearch.criteria.sleepsFrom))})),$rootScope.__propertyPriceBox=propertyPriceQuote,$rootScope.$watch("__propertyPriceBox.criteria",(function(){service.criteria&&service.criteria.dateFrom&&(service.adwordsRemarketing.hrental_startdate=util.formatDate(service.criteria.dateFrom)),service.criteria&&service.criteria.dateTo&&(service.adwordsRemarketing.hrental_enddate=util.formatDate(service.criteria.dateTo)),_getPrice()}),!0),$rootScope.$watch("__propertyPriceBox.priceDetailsResult.price.total",(function(){_getPrice()}),!0),service;function getAdults(sleeps){return-1==(sleeps||-1)?2:sleeps}function _getPrice(){return util.showProgressIndicatorWhen((function(){return propertyPriceQuote.getPrice()}),service.settings.throttleStartTime,service.settings.throttleTime,(function(){service.status.isBusy=!0})).then((function(data){angular.copy(propertyPriceQuote.priceResult,service.priceResult),angular.equals(propertyPriceQuote.priceResult,{})||null===propertyPriceQuote.priceResult.price||(service.adwordsRemarketing.hrental_totalvalue=parseFloat(propertyPriceQuote.priceResult.price.replace(/[^0-9\.-]+/g,"")),dataLayer.push({google_tag_params:service.adwordsRemarketing}),dataLayer.push({event:"remarketingPriceChange"})),service.status.isBusy=!1}),(function(){service.status.isBusy=!1}))}}angular.module("app").factory("propertyPriceBox",propertyPriceBox),propertyPriceBox.$inject=["$rootScope","propertyPriceQuote","propertySearchUI","util"]}(),function(){"use strict";function propertyPriceQuoteApi(api,util){return{getPriceDetails:function(propertyId,dateFrom,dateTo,adults,children,currencyId,extras){if(!dateFrom||!dateTo||dateFrom>=dateTo)return util.promiseResolvedWith("");var request=mapRequest(dateFrom,dateTo,adults,children,currencyId,extras);return api.get("/api/property/"+propertyId+"/price/get/detailed",request)},getPrice:function(propertyId,dateFrom,dateTo,adults,children,currencyId,extras){if(!dateFrom||!dateTo||dateFrom>=dateTo)return util.promiseResolvedWith("");var request=mapRequest(dateFrom,dateTo,adults,children,currencyId,extras);return api.get("/api/property/"+propertyId+"/price/get",request)}};function mapRequest(dateFrom,dateTo,adults,children,currencyId,extras){return{dateFrom:api.mapRequestDate(dateFrom),dateTo:api.mapRequestDate(dateTo),adults:adults,children:children,currency:currencyId,extras:extras}}}angular.module("app").factory("propertyPriceQuoteApi",propertyPriceQuoteApi),propertyPriceQuoteApi.$inject=["cshApi","util"]}(),function(){"use strict";angular.module("app").controller("PropertyPriceQuoteCtrl",["$scope","propertyPriceQuote","propertyEnquiryDialog","calendarDates","occupationalRulesService","util","property",function($scope,propertyPriceQuote,propertyEnquiryDialog,calendarDates,occupationalRulesService,util,property){var vm=this;function getPriceDetails(){return vm.isBusy=!0,propertyPriceQuote.getPriceDetails().then((function(){vm.isBusy=!1}))}vm.isBusy=!1,vm.property=property,vm.statusCssClass=function(){if(vm&&vm.response&&vm.response.statusMessage){var message=vm.response.statusMessage;return"status--"+message.status+" status--"+message.status+"-"+message.field}return""},vm.openEnquiryDialog=function(enquiryUrl){propertyEnquiryDialog.open(enquiryUrl,vm.request.dateFrom,vm.request.dateTo,vm.request.adults,vm.request.children,vm.request.infants)},vm.minDateFrom=function(){return _minDateFromTo.getMinDateFrom()},vm.minDateTo=function(){return _minDateFromTo.getMinDateTo(vm.request.dateFrom)},vm.request=propertyPriceQuote.criteria,vm.response=propertyPriceQuote.priceDetailsResult,vm.dateStates=calendarDates.dateStates,vm.occupationalRules=occupationalRulesService.rules,$scope.$watch("vm.request",(function(){getPriceDetails()}),!0),$scope.$watch("vm.response.price.fees.optional",(function(){getPriceDetails()}),!0);var _minDateFromTo=util.createMinDateFromTo(0,1);vm.getFeeRange=function(min,max){for(var returnVal=[],i=min;i<=max;i++)returnVal.push(i);return returnVal}}])}(),function(){"use strict";function propertyPriceQuoteDialog($modal,$http,hitsAndClicks){var initialized,service={init:function(propertyId){if(initialized)return;initialized=!0;var dialogUrl="/dialog/pricequote?propertyId="+propertyId;$http.get(dialogUrl).then((function(data){_.template=data.data}))},open:function(propertyId,enquiryUrl,dateFrom,dateTo,adults,children,infants){hitsAndClicks.propertyQuoteBoxShown(propertyId),function(propertyId){dataLayer.push({event:"viewTotalPrice",eventCat:"View Total Price",eventAction:"totalPriceClicked",eventLabel:propertyId})}(propertyId),$modal.open({template:_.template,controllerAs:"dialog",controller:["$modalInstance",function($modalInstance){this.close=$modalInstance.close}]})}},_={template:null};return service}angular.module("app").factory("propertyPriceQuoteDialog",propertyPriceQuoteDialog),propertyPriceQuoteDialog.$inject=["$modal","$http","propertyHitsAndClicksApi"]}(),function(){"use strict";function propertyPriceQuote(propertyPriceQuoteApi,siteCurrency,takeLastPromiseResult){var service={criteria:{propertyId:0,dateFrom:null,dateTo:null,adults:2,children:[],currency:siteCurrency},getPriceDetails:function(){var extras=getExtras(),children=getChildren();return doGetPriceDetails(service.criteria.propertyId,service.criteria.dateFrom,service.criteria.dateTo,service.criteria.adults,children,service.criteria.currency.id,extras).then((function(result){angular.copy(result,service.priceDetailsResult),service.adwordsRemarketing.hrental_id=service.criteria.propertyId,service.adwordsRemarketing.hrental_pagetype="conversionintent",service.criteria.dateFrom&&(service.adwordsRemarketing.hrental_startdate=formatDate(service.criteria.dateFrom)),service.criteria.dateTo&&(service.adwordsRemarketing.hrental_enddate=formatDate(service.criteria.dateTo)),angular.equals(service.priceResult,{})||null===service.priceResult.price||(service.adwordsRemarketing.hrental_totalvalue=parseFloat(service.priceResult.price.replace(/[^0-9\.-]+/g,""))),service.adwordsRemarketing.hrental_totalvalue&&(dataLayer.push({google_tag_params:service.adwordsRemarketing}),dataLayer.push({event:"remarketingPriceChange"}))}))},priceDetailsResult:{},getPrice:function(){var extras=getExtras(),children=getChildren();return doGetSimplePrice(service.criteria.propertyId,service.criteria.dateFrom,service.criteria.dateTo,service.criteria.adults,children,service.criteria.currency.id,extras).then((function(result){angular.copy(result,service.priceResult)}))},priceResult:{price:"",daysMessage:null,statusMessage:null},adwordsRemarketing:{}},doGetPriceDetails=takeLastPromiseResult(propertyPriceQuoteApi.getPriceDetails),doGetSimplePrice=takeLastPromiseResult(propertyPriceQuoteApi.getPrice);return service;function getExtras(){var hasPrice=service.priceDetailsResult&&service.priceDetailsResult.price&&service.priceDetailsResult.price.fees,extras=[];return hasPrice&&service.priceDetailsResult.price.fees.optional&&service.priceDetailsResult.price.fees.optional.forEach((function(f){f.selectedCount>0&&extras.push({key:f.id,value:f.selectedCount})})),extras}function getChildren(){return $.map(service.criteria.children,(function(c){return c.age}))}function formatDate(date){var month=""+(date.getMonth()+1),day=""+date.getDate(),year=date.getFullYear();return month.length<2&&(month="0"+month),day.length<2&&(day="0"+day),[year,month,day].join("-")}}angular.module("app").factory("propertyPriceQuote",propertyPriceQuote),propertyPriceQuote.$inject=["propertyPriceQuoteApi","siteCurrency","takeLastPromiseResult"]}();