(function(){"use strict";var n=angular.module("app",["ngResource","ngSanitize","ui.router","photo","ngToast","ngMap","ui.bootstrap.datetimepicker","angularUtils.directives.dirPagination","angular-carousel","cgBusy","ngDialog"]);n.config(["ngToastProvider",function(n){n.configure({animation:"fade",additionalClasses:"my-animation"})}]);n.directive("owlCarousel",function(){return{restrict:"E",transclude:!1,link:function(n){n.initCarousel=function(t){var r={},u=n.$eval($(t).attr("data-options")),i,f;for(i in u)r[i]=u[i];f=$(t).data("owlCarousel");angular.isDefined(f)||$(t).owlCarousel(r);n.cnt++}}}}).directive("owlCarouselItem",[function(){return{restrict:"A",transclude:!1,link:function(n,t){n.$last&&n.initCarousel(t.parent())}}}])})(),function(){"use strict";angular.module("photo",[])}(),function(){"use strict";angular.module("app").service("categoryHelperService",["$q","$http","USER_ROLES","AUTH_EVENTS","MESSAGE","myToast","CategoryService",function(n,t,i,r,u,f,e){function o(n){var t=[];return angular.forEach(n,function(n){n.parentCategory!==null?n.parentCategory.parentCategory!==null?t.push({name:n.parentCategory.parentCategory.name+"-"+n.parentCategory.name+"-"+n.name,level:3,category:n}):t.push({name:n.parentCategory.name+"-"+n.name,level:2,category:n}):t.push({name:n.name,level:1,category:n})}),t}function s(){var n=[];e.getAll({},function(t){return console.log(t),n=o(t.Categories),console.log(n),n},function(){return f.errorToastr(u.LOAD_ERROR),null})}return{getCategories:s,createCategoryTree:o}}])}(),function(){"use strict";angular.module("app").service("houseService",function(n){return n("/Data/houses.json",{},{update:{method:"PUT"},getSomething:{}})})}(),function(){"use strict";angular.module("app").factory("locationHelperService",["$q","$http","USER_ROLES","AUTH_EVENTS","MESSAGE","LocationService",function(){var n={};return n.createLocationTree=function(n){var t=[];return angular.forEach(n,function(n){n.parentLocation!==null?n.parentLocation.parentLocation!==null?t.push({name:n.parentLocation.parentLocation.name+"-"+n.parentLocation.name+"-"+n.name,level:3,location:n}):t.push({name:n.parentLocation.name+"-"+n.name,level:2,location:n}):t.push({name:n.name,level:1,location:n})}),t},n.getTopLevel=function(n){var t=[];return n.map(function(n){n.parentLocation===null&&t.push(n)}),t},n.getSubLocations=function(n){console.log(n);var t=[];return n.map(function(n){n.subLocations!==null&&t.push(n)}),t},n}])}(),function(){"use strict";angular.module("app").service("mapService",function(n,t){this.init=function(){var n={center:new google.maps.LatLng(-36.8529888,174.7677936),zoom:30,disableDefaultUI:!0};this.map=new google.maps.Map(document.getElementById("map-canvas"),n);this.places=new google.maps.places.PlacesService(this.map)};this.search=function(n){var i=t.defer();return this.places.textSearch({query:n},function(n,t){t=="OK"?i.resolve(n[0]):i.reject(t)}),i.promise};this.addMarker=function(n){this.marker&&this.marker.setMap(null);this.marker=new google.maps.Marker({map:this.map,position:n.geometry.location,animation:google.maps.Animation.DROP});this.map.setCenter(n.geometry.location)};this.get_custom_ranges=function(){var n=[],t="orange";return n.push({latitude:"-36.851942",longitude:"174.757164",color:t,price:3232,address:"Auckland city",describtion:"very good house!",phone:232423232,owner:"Smith"}),n.push({latitude:"-36.857378",longitude:"174.766755",color:t,price:324,address:"Auckland city",describtion:"very good house!",phone:232423232,owner:"Smith"}),n.push({latitude:"-36.8532342",longitude:"174.743464",color:t,price:3244,address:"Auckland city",describtion:"very good house!",phone:232423232,owner:"Smith"}),n.push({latitude:"-36.852322",longitude:"174.753164",color:t,price:423,address:"Auckland city",describtion:"very good house!",phone:232423232,owner:"Smith"}),n.push({latitude:"-36.855442",longitude:"174.755564",color:t,price:543,address:"Auckland city",describtion:"very good house!",phone:232423232,owner:"Smith"}),n.push({latitude:"-36.856442",longitude:"174.755564",color:t,price:543,address:"Auckland city",describtion:"very good house!",phone:232423232,owner:"Smith"}),n.push({latitude:"-36.857642",longitude:"174.7554564",color:t,price:543,address:"Auckland city",describtion:"very good house!",phone:232423232,owner:"Smith"}),n.push({latitude:"-36.858642",longitude:"174.7553564",color:t,price:543,address:"Auckland city",describtion:"very good house!",phone:232423232,owner:"Smith"}),n.push({latitude:"-36.859842",longitude:"174.7553564",color:t,price:543,address:"Auckland city",describtion:"very good house!",phone:232423232,owner:"Smith"}),n.push({latitude:"-36.8523442",longitude:"174.75345564",color:t,price:543,address:"Auckland city",describtion:"very good house!",phone:232423232,owner:"Smith"}),n.push({latitude:"-36.853442",longitude:"174.75534564",color:t,price:543,address:"Auckland city",describtion:"very good house!",phone:232423232,owner:"Smith"}),n.push({latitude:"-36.8543442",longitude:"174.755564",color:t,price:543,address:"Auckland city",describtion:"very good house!",phone:232423232,owner:"Smith"}),n.push({latitude:"-36.855542",longitude:"174.7523464",color:t,price:543,address:"Auckland city",describtion:"very good house!",phone:232423232,owner:"Smith"}),n.push({latitude:"-36.851342",longitude:"174.755564",color:t,price:543,address:"Auckland city",describtion:"very good house!",phone:232423232,owner:"Smith"}),n.push({latitude:"-36.851342",longitude:"174.752364",color:t,price:543,address:"Auckland city",describtion:"very good house!",phone:232423232,owner:"Smith"}),n}})}(),function(){"use strict";angular.module("app").factory("categoryFactory",["CategoryService","$q",function(n,t){var i={};return i.getAllCategories=function(){return t(function(t,i){n.get({pageNumber:1,pageSize:100},function(n){t(n)},function(n){i(n)})})},i.getCategories=function(){return t(function(t,i){n.get({},function(n){t(n)},function(n){i(n)})})},i.getCategory=function(i){return t(function(t,r){n.get({id:i},function(n){t(n)},function(n){r(n)})})},i.saveCategory=function(i,r){if(r)return t(function(t,r){n.save({},i,function(n){myToast.success(MESSAGE.SAVE_SUCCESS);t(n)},function(n){myToast.fail(MESSAGE.SAVE_FAIL);r(n)})});myToast.fail(MESSAGE.FORM_ERROR)},i.updateCategory=function(i,r){if(r)return t(function(t,r){n.update({},i,function(n){myToast.success(MESSAGE.UPDATE_SUCCESS);t(n)},function(n){myToast.fail(MESSAGE.UPDATE_FAIL);r(n)})});myToast.fail(MESSAGE.FORM_ERROR)},i.deleteCategory=function(n){return t(function(t,i){categoryCategoryService.delete({id:n.Id},{},function(n){t(n)},function(n){i(n)})})},i}])}(),function(){"use strict";angular.module("app").factory("customerFactory",["CustomerService","$q","myToast","MESSAGE","$rootScope","EVENT",function(n,t,i,r,u,f){var e={};return e.updateInfo=function(){u.$broadcast(f.CUSTOMER_CHANGE)},e.login=function(i,r){return t(function(t,u){n.login({},{Username:i,Password:r},function(n){t(n)},function(n){u(n)})})},e.logout=function(){return t(function(t,i){n.logout({},{},function(n){t(n)},function(n){i(n)})})},e.register=function(i){return t(function(t,r){n.register({},i,function(n){t(n)},function(n){r(n)})})},e.getCustomers=function(){return t(function(t,i){n.get({},function(n){t(n)},function(n){i(n)})})},e.getCustomer=function(i){return t(function(t,r){n.get({id:i},function(n){t(n)},function(n){r(n)})})},e.saveCustomer=function(u,f){if(f)return t(function(t,f){n.save({},u,function(n){i.success(r.SAVE_SUCCESS);t(n)},function(n){i.fail(r.SAVE_FAIL);f(n)})});i.fail(r.FORM_ERROR)},e.updateCustomer=function(u,f){if(f)return t(function(t,f){n.update({},u,function(n){i.success(r.UPDATE_SUCCESS);t(n)},function(n){i.fail(r.UPDATE_FAIL);f(n)})});i.fail(r.FORM_ERROR)},e.deleteCustomer=function(n){return t(function(t,i){customerCustomerService.delete({id:n.Id},{},function(n){t(n)},function(n){i(n)})})},e}])}(),function(){"use strict";angular.module("app").factory("locationFactory",["LocationService","$q",function(n,t){var i={};return i.getAllLocations=function(){return t(function(t,i){n.get({pageNumber:1,pageSize:1e3},function(n){t(n)},function(n){i(n)})})},i.getLocations=function(){return t(function(t,i){n.get({},function(n){t(n)},function(n){i(n)})})},i.getLocation=function(i){return t(function(t,r){n.get({id:i},function(n){t(n)},function(n){r(n)})})},i.saveLocation=function(i,r){if(r)return t(function(t,r){n.save({},i,function(n){myToast.success(MESSAGE.SAVE_SUCCESS);t(n)},function(n){myToast.fail(MESSAGE.SAVE_FAIL);r(n)})});myToast.fail(MESSAGE.FORM_ERROR)},i.updateLocation=function(i,r){if(r)return t(function(t,r){n.update({},i,function(n){myToast.success(MESSAGE.UPDATE_SUCCESS);t(n)},function(n){myToast.fail(MESSAGE.UPDATE_FAIL);r(n)})});myToast.fail(MESSAGE.FORM_ERROR)},i.deleteLocation=function(n){return t(function(t,i){locationLocationService.delete({id:n.Id},{},function(n){t(n)},function(n){i(n)})})},i}])}(),function(){"use strict";angular.module("app").factory("propertyFactory",["PropertyService","$q","myToast","MESSAGE",function(n,t,i,r){var u={};return u.search=function(i,r,u,f,e,o,s,h,c,l,a,v,y,p,w){return t(function(t,b){n.search({keywords:i,pageNumber:r,pageSize:u,orderBy:f,locationId:e,categoryIds:o,supplierIds:s,bedroomsFrom:h,bedroomsTo:c,bathroomsFrom:l,bathroomsTo:a,priceFrom:v,priceTo:y,availableNow:p,IsAllowPets:w},function(n){t(n)},function(n){b(n)})})},u.getProperties=function(i,r){return t(function(t,u){n.get({pageNumber:i,pageSize:r},function(n){t(n)},function(n){u(n)})})},u.getProperty=function(i){return t(function(t,r){n.get({id:i},function(n){t(n)},function(n){r(n)})})},u.saveProperty=function(u,f){return t(function(t,e){f?n.save({},u,function(n){i.success(r.SAVE_SUCCESS);t(n)},function(n){i.fail(r.SAVE_FAIL);e(n)}):(e(r.FORM_ERROR),i.fail(r.FORM_ERROR))})},u.updateProperty=function(u,f){if(f)return t(function(t,f){n.update(null,u,function(n){i.success(r.UPDATE_SUCCESS);t(n)},function(n){i.fail(r.UPDATE_FAIL);f(n)})});i.fail(r.FORM_ERROR)},u.deleteProperty=function(i){return t(function(t,r){n.delete({id:i.id},{},function(n){t(n)},function(n){r(n)})})},u}])}(),function(){"use strict";angular.module("app").service("MailService",["$resource",function(n){return n("Contact/SendEmail",{},{sendBooking:{method:"POST",url:"Contact/SendBooking"}})}]).service("PropertyService",["$resource",function(n){return n("api/products/:id",{id:"@id"},{update:{method:"PUT",url:"api/products"},search:{method:"GET",url:"api/search"}})}]).service("LocationService",["$resource",function(n){return n("/api/locations/:id",{id:"@id"},{update:{method:"PUT"}})}]).service("CustomerService",["$resource",function(n){return n("api/customers/:id",{id:"@id"},{update:{method:"PUT",url:"api/customers"},search:{method:"GET",url:"api/customers/search"},login:{method:"POST",url:"/api/customer/login"},logout:{method:"POST",url:"/api/customer/logout"},register:{method:"POST",url:"/api/customer/register"}})}]).service("CategoryService",["$resource",function(n){return n("api/categories/:id",{id:"@id"},{update:{method:"PUT"}})}]).service("ProductReviewService",["$resource",function(n){return n("api/productreviews/:id",{id:"@id"},{update:{method:"PUT"}})}]).service("SupplierService",["$resource",function(n){return n("api/suppliers/:id",{id:"@id"},{update:{method:"PUT"}})}]).service("OtherService",["$resource",function(n){return n("api/properties/:id",{id:"@id"},{update:{method:"PUT"}})}])}(),function(){"use strict";angular.module("app").service("ExampleService",["$resource",function(n){return n("api/locations/:id",{id:"@id"},{update:{method:"PUT"},getAll:{method:"GET",url:"/api/locations"},getSomething:{method:"GET",url:""}})}])}(),function(){"use strict";angular.module("app").factory("reviewFactory",["ProductReviewService","$q",function(n,t){var i={};return i.getReviews=function(){return t(function(t,i){n.get({},function(n){t(n)},function(n){i(n)})})},i.getReview=function(i){return t(function(t,r){n.get({id:i},function(n){t(n)},function(n){r(n)})})},i.saveReview=function(i,r){if(r)return t(function(t,r){n.save({},i,function(n){myToast.success(MESSAGE.SAVE_SUCCESS);t(n)},function(n){myToast.fail(MESSAGE.SAVE_FAIL);r(n)})});myToast.fail(MESSAGE.FORM_ERROR)},i.updateReview=function(i,r){if(r)return t(function(t,r){n.update({},i,function(n){myToast.success(MESSAGE.UPDATE_SUCCESS);t(n)},function(n){myToast.fail(MESSAGE.UPDATE_FAIL);r(n)})});myToast.fail(MESSAGE.FORM_ERROR)},i.deleteReview=function(n){return t(function(t,i){reviewProductReviewService.delete({id:n.Id},{},function(n){t(n)},function(n){i(n)})})},i}])}(),function(){"use strict";angular.module("app").factory("supplierFactory",["SupplierService","$q",function(n,t){var i={};return i.getSuppliers=function(){return t(function(t,i){n.get({},function(n){t(n)},function(n){i(n)})})},i.getSupplier=function(i){return t(function(t,r){n.get({id:i},function(n){t(n)},function(n){r(n)})})},i.saveSupplier=function(i,r){if(r)return t(function(t,r){n.save({},i,function(n){myToast.success(MESSAGE.SAVE_SUCCESS);t(n)},function(n){myToast.fail(MESSAGE.SAVE_FAIL);r(n)})});myToast.fail(MESSAGE.FORM_ERROR)},i.updateSupplier=function(i,r){if(r)return t(function(t,r){n.update({},i,function(n){myToast.success(MESSAGE.UPDATE_SUCCESS);t(n)},function(n){myToast.fail(MESSAGE.UPDATE_FAIL);r(n)})});myToast.fail(MESSAGE.FORM_ERROR)},i.deleteSupplier=function(n){return t(function(t,i){customerSupplierService.delete({id:n.Id},{},function(n){t(n)},function(n){i(n)})})},i}])}(),function(){"use strict";angular.module("app").factory("mailFactory",["MailService","$q","myToast","MESSAGE",function(n,t,i,r){var u={};return u.sendMail=function(u,f){return console.log(u),t(function(t,e){f?n.save({},u,function(n){t(n)},function(n){i.fail(r.SAVE_FAIL);e(n)}):(e(r.FORM_ERROR),i.fail(r.FORM_ERROR))})},u.sendBooking=function(u,f){return t(function(t,e){f?n.sendBooking({},u,function(n){console.log(n);t(n)},function(n){i.fail(r.SAVE_FAIL);e(n)}):(e(r.FORM_ERROR),i.fail(r.FORM_ERROR))})},u}])}(),function(){"use strict";angular.module("app").service("myToast",["ngToast",function(n){var t=function(t,i){console.log(t);console.log(i);n.create({className:t,content:i})},i=function(t){n.create({className:"success",content:t})},r=function(t){n.create({className:"info",content:t})},u=function(t){n.create({className:"warning",content:t})},f=function(t){n.create({className:"danger",content:t})},e=function(n,t){toastr.success(n,t)},o=function(n,t){toastr.warning(n,t)},s=function(n,t){toastr.error(n,t)};return{toast:t,success:i,info:r,warn:u,fail:f,successToastr:e,warningToastr:o,errorToastr:s}}])}(),function(){"use strict";angular.module("app").constant("MY_EVENTS",{CLICK:"click",DESTROY:"$destroy",GET_NOTIFICATION:"myNewNotification"}).constant("AUTH_EVENTS",{Authenticated:"auth-authenticated",notAuthenticated:"auth-not-authenticated",Authorized:"auth-authorized",notAuthorized:"auth-not-authorized"}).constant("EVENT",{CUSTOMER_CHANGE:"customer-login-or-logout-or-update"}).constant("USER_ROLES",{admin:"admin_role","public":"public_role"}).constant("ADMIN_ROLES",{admin:"admin_role","public":"public_role"}).constant("MESSAGE",{FORM_ERROR:"Something Wrong With The Form！",LOAD_SUCESS:"Load Data Successfully！",LOAD_FAIL:"Fail To Load Data！",DELETE_SUCCESS:"Delete Successfully！",DELETE_FAIL:"Fail To Delete！",UPDATE_SUCCESS:"Update Successfully！",UPDATE_FAIL:"Update Successfully！",SAVE_SUCCESS:"Add Successfully！",SAVE_FAIL:"Fail To Update！",TITLE_TIP:"Information！",DELETE_CONFIRM:"Are You Sure To Delete？",LOGIN_FIRST:"Please Login First！"})}(),function(){"use strict";function n(){function n(n,t){t.bind("change",function(){n.$apply(function(){t[0].files&&(n.files.length=0,angular.forEach(t[0].files,function(t){n.files.push(t)}),n.hasFiles=!0)})});t[0].form&&angular.element(t[0].form).bind("reset",function(){n.$apply(function(){n.files.length=0;n.hasFiles=!1})})}return{link:n,restrict:"A",scope:{files:"=egFiles",hasFiles:"="}}}angular.module("photo").directive("egFiles",n)}(),function(){"use strict";function n(n,t){function u(r){return i.photos.length=0,t.getById({productId:r}).$promise.then(function(t){return console.log(t),t.Images!==null?(t.Images.forEach(function(n){i.photos.push(n)}),t.$promise):n.reject(t)},function(t){return n.reject(t)})}function f(u){i.status.uploading=!0;var f=new FormData;return angular.forEach(u,function(n){f.append(n.name,n)}),t.save({},f).$promise.then(function(n){return n&&n.photos&&n.photos.forEach(function(n){r(n.name)||i.photos.push(n)}),n.$promise},function(t){return console.log(t),n.reject(t)})}function e(i){return t.remove({filename:i}).$promise.then(function(n){return n.$promise},function(t){return n.reject(t)})}function r(n){var t=!1;return i.photos.forEach(function(i){i.name===n&&(t=!0)}),t}var i={photos:[],load:u,upload:f,remove:e,photoExists:r,status:{uploading:!1}};return i}angular.module("photo").factory("photoManager",n);n.$inject=["$q","photoManagerClient"]}(),function(){"use strict";function n(n){return n("api/images/:id",{id:"@id"},{getById:{method:"GET",isArray:!1,params:{productId:"@productId"}},query:{method:"GET"},save:{method:"POST",transformRequest:angular.identity,headers:{"Content-Type":undefined}},remove:{method:"DELETE",url:"api/images"}})}angular.module("photo").factory("photoManagerClient",n);n.$inject=["$resource"]}(),function(){"use strict";angular.module("app").directive("complexPassword",function(){return{require:"ngModel",link:function(n,t,i,r){r.$parsers.unshift(function(n){var t=/[A-Z]/.test(n),i=/[a-z]/.test(n),u=/\d/.test(n),f=/\W/.test(n),e=t+i+u+f;return n.length>=8&&e>=3?(r.$setValidity("complexity",!0),n):(r.$setValidity("complexity",!1),undefined)})}}})}(),function(){"use strict";function n(){return function(n){if(console.log(n),n!==null&&n!==undefined)return n===1||n==="1"?"暂定":n===2||n==="2"?"已经支付":n===3||n==="3"?"已经确认":n===4||n==="4"?"已经发货":n===5||n==="5"?"已经取消":void 0}}angular.module("app").filter("orderStatus",n);n.$inject=["$window"]}(),function(){"use strict";angular.module("app").directive("owlCarousel",function(){return console.log("owlCarousel"),{restrict:"E",transclude:!1,link:function(n){n.initCarousel=function(t){var i={},r=n.$eval($(t).attr("data-options"));for(var u in r)i[u]=r[u];$(t).owlCarousel(i)}}}}).directive("owlCarouselItem",[function(){return{restrict:"A",transclude:!1,link:function(n,t){n.$last&&n.initCarousel(t.parent())}}}])}(),function(){"use strict";function n(){return function(n){if(n!==null&&n!==undefined)return n===1||n==="1"?"已支付":n===2||n==="2"?"未支付":void 0}}angular.module("app").filter("paymentStatus",n);n.$inject=["$window"]}(),function(){"use strict";function n(){return function(n){if(n!==null&&n!==undefined)return n===1||n==="1"?"Wechat":n===2||n==="2"?"POLI":n===3||n==="3"?"PaymentExpress":void 0}}angular.module("app").filter("paymentType",n);n.$inject=["$window"]}(),function(){"use strict";function n(n){return function(t,i){if(t)return t.indexOf("Z")===-1&&t.indexOf("+")===-1&&(t+="Z"),n("date")(t,i)}}angular.module("app").filter("utcToLocal",n);n.$inject=["$filter"]}(),function(){"use strict";angular.module("app").controller("headerController",["$location","AUTH_EVENTS","$rootScope","customerFactory","EVENT",function(n,t,i,r,u){function e(){r.getCustomer().then(function(n){f.customer=n.customer},function(){f.customer=""})}window.loading_screen.finish();var f=this;e();f.logout=function(){r.logout().then(function(){f.customer=""})};i.$on(u.CUSTOMER_CHANGE,function(){e()});i.$on(t.Authenticated,function(){e()})}])}(),function(){"use strict";function n(){return function(n){var f,i;switch(typeof n){case"number":break;case"string":n=+new Date(n);break;case"object":n.constructor===Date&&(n=n.getTime());break;default:n=+new Date}var e=[[60,"seconds",1],[120,"1 minute ago","1 minute from now"],[3600,"minutes",60],[7200,"1 hour ago","1 hour from now"],[86400,"hours",3600],[172800,"Yesterday","Tomorrow"],[604800,"days",86400],[1209600,"Last week","Next week"],[2419200,"weeks",604800],[4838400,"Last month","Next month"],[29030400,"months",2419200],[58060800,"Last year","Next year"],[290304e4,"years",29030400],[580608e4,"Last century","Next century"],[580608e5,"centuries",290304e4]],t=(+new Date-n)/1e3,r="ago",u=1;if(t===0)return"Just now";for(t<0&&(t=Math.abs(t),r="from now",u=2),f=0;i=e[f++];)if(t<i[0])return typeof i[2]=="string"?i[u]:Math.floor(t/i[2])+" "+i[1]+" "+r;return n}}angular.module("app").filter("timeAgo",n);n.$inject=["$window"]}(),function(){"use strict";angular.module("app").controller("detailController",["$scope","$location","propertyFactory",function(n,t,i){function e(){typeof WeixinJSBridge=="undefined"?alert("请先通过微信添加好友"):WeixinJSBridge.invoke("shareTimeline",{title:r.property.name,link:"SingleProperty/index/"+r.property.id,desc:"Awesome Property",img_url:r.property.productImages[0].imageUrl})}var r=this,u,f;r.slides=[{image:"http://lorempixel.com/400/200/"},{image:"http://lorempixel.com/400/200/food"},{image:"http://lorempixel.com/400/200/sports"},{image:"http://lorempixel.com/400/200/people"}];r.items=[1,2,3,4,5,6,7,8,9,10];n.dataOptions={navigation:!0,pagination:!1,rewindNav:!1,responsive:{0:{items:4},480:{items:4},768:{items:4},980:{items:4},1200:{items:4},1600:{items:4}},autoplay:200,loop:!0};u=window.location.pathname;f=u.substring(u.lastIndexOf("/")+1);i.getProperty(f).then(function(n){r.property=n.product;r.latitude=n.product.latitude;r.longitude=n.product.longitude});r.changeDisplayImage=function(n){r.displayImageUrl=n.imageUrl};r.shareWechat=function(){e()}}])}(),function(){"use strict";angular.module("app").config(["$stateProvider","$urlRouterProvider",function(n,t){t.otherwise("");n.state("dashboard",{url:"",controller:"dashboardController",controllerAs:"dashCtrl",templateUrl:"Scripts/property/app/controllers/dashboard/dashboard.html"}).state("dashboard.profile",{url:"/profile",templateUrl:"Scripts/property/app/controllers/dashboard/profile/profile.html",controller:"profileController",controllerAs:"prflCtrl"}).state("dashboard.edit",{url:"/edit",templateUrl:"Scripts/property/app/controllers/dashboard/edit/edit.html",controller:"editController",controllerAs:"editCtrl"}).state("dashboard.myProperties",{url:"/Properties",templateUrl:"Scripts/property/app/controllers/dashboard/my-properties/properties.html",controller:"myPropertiesController",controllerAs:"mpCtrl"}).state("dashboard.wishlist",{url:"/wishlist",templateUrl:"Scripts/property/app/controllers/dashboard/wishlist/wishlist.html",controller:"wishlistController",controllerAs:"wishCtrl"})}])}(),function(){"use strict";angular.module("app").controller("profileController",["$scope","customerFactory",function(n,t){function r(){t.getCustomer().then(function(n){i.customer=n.customer;console.log(n.customer)},function(){i.customer=""})}var i=this;r()}])}(),function(){"use strict";angular.module("app").controller("dashboardController",["$location","$rootScope","customerFactory","EVENT","$window",function(n,t,i,r,u){function e(){i.getCustomer().then(function(n){f.customer=n.customer},function(){f.customer=""})}window.loading_screen.finish();var f=this;e();f.logout=function(){i.logout().then(function(){f.customer="";u.location.href="Home/Index"})};t.$on(r.CUSTOMER_CHANGE,function(){e()})}])}(),function(){"use strict";angular.module("app").controller("wishlistController",["$scope",function(){}])}(),function(){"use strict";angular.module("app").controller("editController",["CustomerService","MESSAGE","customerFactory",function(n,t,i){function u(){i.getCustomer().then(function(n){r.formData=n.customer})}var r=this;u();r.processForm=function(n){console.log(r.formData);i.updateCustomer(r.formData,n).then(function(){u();i.updateInfo()})}}])}(),function(){"use strict";angular.module("app").controller("myPropertiesController",["$scope","propertyFactory","ngDialog",function(n,t,i){function f(){r.pagination={pageNumber:1,pageSize:12,totalCount:""}}function u(){r.myPromise=t.getProperties(r.pagination.pageNumber,r.pagination.pageSize).then(function(n){r.properties=n.products;r.pagination.totalCount=n.totalCount})}function e(n){r.myPromise=t.deleteProperty(n).then(function(){u();i.close()})}var r=this;f();u();r.pageChanged=function(n){r.pagination.pageNumber=n;u()};r.changePagination=function(){u()};r.remove=function(n){i.open({template:"Scripts/property/app/templates/popupTmpl.html",className:"ngdialog-theme-default",overlay:!0,showClose:!1,closeByDocument:!1,controller:["$scope",function(t){t.yes=function(){e(n)};t.no=function(){i.close()}}]})};r.changeStatus=function(n){n.isPublish=!n.isPublish;r.myPromise=t.updateProperty(n,!0).then(function(){u()})}}])}(),function(){"use strict";angular.module("app").controller("propertyEditController",["PropertyService","$window","LocationService","locationHelperService","photoManager","myToast","CategoryService","categoryHelperService","SupplierService","MESSAGE","NgMap","propertyFactory",function(n,t,i,r,u,f,e,o,s,h,c,l){function p(){var n=new Quill("#editor-container",{modules:{toolbar:[[{header:[1,2,3,4,5,6,!1]}],["bold","italic","underline"],[{list:"ordered"},{list:"bullet"}],[{indent:"-1"},{indent:"+1"}],[{size:["small",!1,"large","huge"]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["link","image","video"]]},placeholder:"请输入详细描述...",theme:"snow"})}var a=this,v,y;a.types="['establishment']";a.placeChanged=function(){a.place=this.getPlace();a.map.setCenter(a.place.geometry.location);a.property.latitude=a.place.geometry.location.lat();a.property.longitude=a.place.geometry.location.lng();var n=new google.maps.Marker({position:a.place.geometry.location,map:a.map})};c.getMap().then(function(n){a.map=n});v=window.location.pathname;y=v.substring(v.lastIndexOf("/")+1);l.getProperty(y).then(function(n){console.log(n);a.property=n.product;window.setTimeout(function(){p()},100)});a.myPromise=s.get({},function(n){a.suppliers=n.Suppliers},function(){f.errorToastr(h.LOAD_ERROR)});e.get({},function(n){a.categories=o.createCategoryTree(n.categories);a.categories=o.createCategoryTree(n.categories)},function(){f.fail(h.LOAD_ERROR)});i.get({},function(n){a.locations=r.createLocationTree(n.locations);a.l1Locations=r.getTopLevel(n.locations)},function(){f.fail(h.LOAD_ERROR)});a.changeL1=function(){if(a.l2Locations=[],a.l3Locations=[],a.l2Location="",a.l3Location="",a.l1Location!==undefined&&a.l1Location!==null&&a.l1Location!==""&&a.l1Location!=={}){var n=JSON.parse(a.l1Location);a.property.LocationId=n.id;a.l2Locations=r.getSubLocations(n.subLocations)}};a.changeL2=function(){if(a.l3Locations=[],a.l3Location="",a.l2Location!==undefined&&a.l2Location!==null&&a.l2Location!==""&&a.l2Location!=={}){var n=JSON.parse(a.l2Location);a.property.locationId=n.id;a.l3Locations=r.getSubLocations(n.subLocations)}};a.changeL3=function(){var n=JSON.parse(a.l3Location);a.property.locationId=n.id};a.photos=[];a.images=[];a.upload=function(){u.upload(a.photos).then(function(n){a.images=n.images;a.property.productImages=n.images;f.success("上传图片完成")},function(){f.fail("发生错误，请勿上传太大的图片！")})};a.remove=function(n){u.remove(n.name).then(function(){var t=a.property.productImages.indexOf(n);a.property.productImages.splice(t,1);f.success("删除图片传成功")})};a.processForm=function(n){a.property.description=document.querySelector(".ql-editor").innerHTML;l.updateProperty(a.property,n).then(function(){t.location.href="Profile#/Properties"})}}])}(),function(){"use strict";angular.module("app").controller("registerController",["$location","MESSAGE","myToast","customerFactory","$window",function(n,t,i,r,u){var f=this;f.processRegisterForm=function(n){if(n){if(f.repeatPassword!==f.formData.Password){i.fail("Please input same password��");return}r.register(f.formData).then(function(){i.success("Register successfully��");u.location.href="Account/index"},function(){i.fail("Fail��")})}else i.fail(t.FORM_ERROR)}}])}(),function(){"use strict";angular.module("app").controller("loginController",["customerFactory","myToast","ngToast","$window","$rootScope","EVENT",function(n,t,i,r,u,f){var e=this;e.logout=function(){n.logout()};e.error=!1;e.processForm=function(t){e.error=!1;t?e.myPromise=n.login(e.formData.username,e.formData.password).then(function(){r.location.href="Home/index";u.$broadcast(f.CUSTOMER_CHANGE);e.error=!1},function(){e.error=!0}):e.error=!0}}])}(),function(){"use strict";angular.module("app").controller("propertiesController",["propertyFactory","$scope","$http","$interval","NgMap","categoryFactory","locationFactory","locationHelperService",function(n,t,i,r,u,f,e,o){function v(){s.l2Locations=[];s.l3Locations=[];s.l2Location="";s.l3Location="";s.l1Location="";s.pagination={keywords:"",pageNumber:1,pageSize:12,totalCount:"",current:1,orderBy:"",locationId:"",categoryIds:[],supplierIds:[],bedroomsFrom:"",bedroomsTo:"",bathroomsFrom:"",bathroomsTo:"",priceFrom:"",priceTo:"",availableNow:!1,IsAllowPets:!0}}function h(){s.myPromise=n.search(s.pagination.keywords,s.pagination.pageNumber,s.pagination.pageSize,s.pagination.orderBy,s.pagination.locationId,s.pagination.categoryIds,s.pagination.supplierIds,s.pagination.bedroomsFrom,s.pagination.bedroomsTo,s.pagination.bathroomsFrom,s.pagination.bathroomsTo,s.pagination.priceFrom,s.pagination.priceTo,s.pagination.availableNow,s.pagination.IsAllowPets).then(function(n){s.properties=n.products;s.pagination.totalCount=n.totalCount;p()})}function p(){s.myPromise=n.search(s.pagination.keywords,1,1e4,s.pagination.orderBy,s.pagination.locationId,s.pagination.categoryIds,s.pagination.supplierIds,s.pagination.bedroomsFrom,s.pagination.bedroomsTo,s.pagination.bathroomsFrom,s.pagination.bathroomsTo,s.pagination.priceFrom,s.pagination.priceTo,s.pagination.availableNow,s.pagination.IsAllowPets).then(function(n){s.propertiesMap=n.products;w()})}function l(){function b(n,t,i,r,u,f){return'<a href="'+n+'" class="listing-img-container"><div class="infoBox-close"><i class="fa fa-times"><\/i><\/div><div class="listing-img-content"><span class="listing-price">'+t+"<i>"+i+'<\/i><\/span><\/div><img src="'+r+'" alt=""><\/a><div class="listing-content"><div class="listing-title"><h4><a>'+u+"<\/a><\/h4><p>"+f+"<\/p><\/div><\/div>"}function g(n,t){var i,r,u;a.index=1;t.controls[google.maps.ControlPosition.RIGHT_CENTER].push(a);n.style.padding="5px";i=document.createElement("div");n.appendChild(i);r=document.createElement("div");r.className="custom-zoom-in";i.appendChild(r);u=document.createElement("div");u.className="custom-zoom-out";i.appendChild(u);google.maps.event.addDomListener(r,"click",function(){t.setZoom(t.getZoom()+1)});google.maps.event.addDomListener(u,"click",function(){t.setZoom(t.getZoom()-1)})}function nt(){navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(t){var i=new google.maps.LatLng(t.coords.latitude,t.coords.longitude);n.setCenter(i);n.setZoom(12)})}var i=[],f,e,v,y,n,o,u,p,w;s.propertiesMap.map(function(n){i.push([b("SingleProperty/index/"+n.id,"$"+n.price,"Bedrooms: "+n.bedrooms+" Bathrooms: "+n.bathrooms,"data:"+n.productImages[0].imageType+";base64,"+n.productImages[0].imageData,n.name,n.address),n.latitude,n.longitude,1,c])});f=$("#map").attr("data-map-zoom");e=$("#map").attr("data-map-scroll");v=typeof f!=typeof undefined&&f!==!1?parseInt(f):5;y=typeof e!=typeof undefined&&e!==!1?parseInt(e):!1;n=new google.maps.Map(document.getElementById("map"),{zoom:v,scrollwheel:y,center:new google.maps.LatLng(-36.854722,174.762418),mapTypeId:google.maps.MapTypeId.ROADMAP,zoomControl:!1,mapTypeControl:!1,scaleControl:!1,panControl:!1,navigationControl:!1,streetViewControl:!1,styles:[{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#747474"},{lightness:"23"}]},{featureType:"poi.attraction",elementType:"geometry.fill",stylers:[{color:"#f38eb0"}]},{featureType:"poi.government",elementType:"geometry.fill",stylers:[{color:"#ced7db"}]},{featureType:"poi.medical",elementType:"geometry.fill",stylers:[{color:"#ffa5a8"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{color:"#c7e5c8"}]},{featureType:"poi.place_of_worship",elementType:"geometry.fill",stylers:[{color:"#d6cbc7"}]},{featureType:"poi.school",elementType:"geometry.fill",stylers:[{color:"#c4c9e8"}]},{featureType:"poi.sports_complex",elementType:"geometry.fill",stylers:[{color:"#b1eaf1"}]},{featureType:"road",elementType:"geometry",stylers:[{lightness:"100"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"},{lightness:"100"}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#ffd4a5"}]},{featureType:"road.arterial",elementType:"geometry.fill",stylers:[{color:"#ffe9d2"}]},{featureType:"road.local",elementType:"all",stylers:[{visibility:"simplified"}]},{featureType:"road.local",elementType:"geometry.fill",stylers:[{weight:"3.00"}]},{featureType:"road.local",elementType:"geometry.stroke",stylers:[{weight:"0.30"}]},{featureType:"road.local",elementType:"labels.text",stylers:[{visibility:"on"}]},{featureType:"road.local",elementType:"labels.text.fill",stylers:[{color:"#747474"},{lightness:"36"}]},{featureType:"road.local",elementType:"labels.text.stroke",stylers:[{color:"#e9e5dc"},{lightness:"30"}]},{featureType:"transit.line",elementType:"geometry",stylers:[{visibility:"on"},{lightness:"100"}]},{featureType:"water",elementType:"all",stylers:[{color:"#d2e7f7"}]}]});o=document.createElement("div");o.className="map-box";for(var h,k={content:o,disableAutoPan:!0,alignBottom:!0,maxWidth:0,pixelOffset:new google.maps.Size(-60,-55),zIndex:null,boxStyle:{width:"260px"},closeBoxMargin:"0",closeBoxURL:"",infoBoxClearance:new google.maps.Size(1,1),isHidden:!1,pane:"floatPane",enableEventPropagation:!1},d,l,t=[],a=document.createElement("div"),tt=new g(a,n),r=0;r<i.length;r++)l=new google.maps.Marker({position:new google.maps.LatLng(i[r][1],i[r][2]),icon:i[r][4],id:r}),t.push(l),u=new InfoBox,google.maps.event.addListener(l,"click",function(t,r){return function(){u.setOptions(k);o.innerHTML=i[r][0];u.open(n,t);h=t.id;var f=new google.maps.LatLng(i[r][1],i[r][2]);n.panTo(f);n.panBy(0,-180);google.maps.event.addListener(u,"domready",function(){$(".infoBox-close").click(function(n){n.preventDefault();u.close()})})}}(l,r));p={imagePath:"Bundles/images/",styles:[{textColor:"white",url:"Bundles/images/m1.png",height:50,width:50}],minClusterSize:2};d=new MarkerClusterer(n,t,p);google.maps.event.addDomListener(window,"resize",function(){var t=n.getCenter();google.maps.event.trigger(n,"resize");n.setCenter(t)});w=$("#scrollEnabling");$(w).click(function(t){t.preventDefault();$(this).toggleClass("enabled");$(this).is(".enabled")?n.setOptions({scrollwheel:!0}):n.setOptions({scrollwheel:!1})});$("#geoLocation").click(function(n){n.preventDefault();nt()});$("#nextpoint").click(function(i){i.preventDefault();n.setZoom(15);var r=h;r+1<t.length?google.maps.event.trigger(t[r+1],"click"):google.maps.event.trigger(t[0],"click")});$("#prevpoint").click(function(i){if(i.preventDefault(),n.setZoom(15),typeof h=="undefined")google.maps.event.trigger(t[t.length-1],"click");else{var r=h;r-1<0?google.maps.event.trigger(t[t.length-1],"click"):google.maps.event.trigger(t[r-1],"click")}});/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&n.setOptions({draggable:!1})}function w(){var n=document.getElementById("map");typeof n!="undefined"&&n!==null&&(google.maps.event.addDomListener(window,"load",l),google.maps.event.addDomListener(window,"resize",l));l()}function y(){function r(n,t){var r,u,f;i.index=1;t.controls[google.maps.ControlPosition.RIGHT_CENTER].push(i);n.style.padding="5px";r=document.createElement("div");n.appendChild(r);u=document.createElement("div");u.className="custom-zoom-in";r.appendChild(u);f=document.createElement("div");f.className="custom-zoom-out";r.appendChild(f);google.maps.event.addDomListener(u,"click",function(){t.setZoom(t.getZoom()+1)});google.maps.event.addDomListener(f,"click",function(){t.setZoom(t.getZoom()-1)})}var n={lng:$("#propertyMap").data("longitude"),lat:$("#propertyMap").data("latitude")},t=new google.maps.Map(document.getElementById("propertyMap"),{zoom:13,center:n,scrollwheel:!1,zoomControl:!1,mapTypeControl:!1,scaleControl:!1,panControl:!1,navigationControl:!1,streetViewControl:!1,styles:[{featureType:"poi",elementType:"labels.text.fill",stylers:[{color:"#747474"},{lightness:"23"}]},{featureType:"poi.attraction",elementType:"geometry.fill",stylers:[{color:"#f38eb0"}]},{featureType:"poi.government",elementType:"geometry.fill",stylers:[{color:"#ced7db"}]},{featureType:"poi.medical",elementType:"geometry.fill",stylers:[{color:"#ffa5a8"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{color:"#c7e5c8"}]},{featureType:"poi.place_of_worship",elementType:"geometry.fill",stylers:[{color:"#d6cbc7"}]},{featureType:"poi.school",elementType:"geometry.fill",stylers:[{color:"#c4c9e8"}]},{featureType:"poi.sports_complex",elementType:"geometry.fill",stylers:[{color:"#b1eaf1"}]},{featureType:"road",elementType:"geometry",stylers:[{lightness:"100"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"},{lightness:"100"}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#ffd4a5"}]},{featureType:"road.arterial",elementType:"geometry.fill",stylers:[{color:"#ffe9d2"}]},{featureType:"road.local",elementType:"all",stylers:[{visibility:"simplified"}]},{featureType:"road.local",elementType:"geometry.fill",stylers:[{weight:"3.00"}]},{featureType:"road.local",elementType:"geometry.stroke",stylers:[{weight:"0.30"}]},{featureType:"road.local",elementType:"labels.text",stylers:[{visibility:"on"}]},{featureType:"road.local",elementType:"labels.text.fill",stylers:[{color:"#747474"},{lightness:"36"}]},{featureType:"road.local",elementType:"labels.text.stroke",stylers:[{color:"#e9e5dc"},{lightness:"30"}]},{featureType:"transit.line",elementType:"geometry",stylers:[{visibility:"on"},{lightness:"100"}]},{featureType:"water",elementType:"all",stylers:[{color:"#d2e7f7"}]}]}),u=new google.maps.Marker({position:n,map:t,icon:c}),i=document.createElement("div"),f=new r(i,t);$("#streetView").click(function(i){i.preventDefault();t.getStreetView().setOptions({visible:!0,position:n});$(this).css("display","none")})}var s=this,c,a;v();h();f.getAllCategories().then(function(n){s.categories=n.categories});e.getAllLocations().then(function(n){s.locations=o.createLocationTree(n.locations);s.l1Locations=o.getTopLevel(n.locations)});s.pageChanged=function(n){s.pagination.pageNumber=n;h()};s.changePagination=function(){h()};s.changeL1=function(){if(s.l2Locations=[],s.l3Locations=[],s.l2Location="",s.l3Location="",s.l1Location!==undefined&&s.l1Location!==null&&s.l1Location!==""){var n=JSON.parse(s.l1Location);s.pagination.locationId=n.id;s.l2Locations=o.getSubLocations(n.subLocations)}h()};s.changeL2=function(){if(s.l3Locations=[],s.l3Location="",s.l2Location!==undefined&&s.l2Location!==null&&s.l2Location!==""){var n=JSON.parse(s.l2Location);s.pagination.locationId=n.id;s.l3Locations=o.getSubLocations(n.subLocations)}h()};s.changeL3=function(){var n=JSON.parse(s.l3Location);s.pagination.locationId=n.id;h()};s.changeDisplayMethod=function(){s.displayMethod=s.displayMethod};s.reset=function(){s.categoryId="";v();h()};s.changePropertyType=function(){s.pagination.categoryIds=[];s.categoryId!==undefined&&s.categoryId!==null&&s.pagination.categoryIds.push(s.categoryId);h()};s.layout="list";s.switchLayout=function(n){s.layout=n};c={path:"M19.9,0c-0.2,0-1.6,0-1.8,0C8.8,0.6,1.4,8.2,1.4,17.8c0,1.4,0.2,3.1,0.5,4.2c-0.1-0.1,0.5,1.9,0.8,2.6c0.4,1,0.7,2.1,1.2,3 c2,3.6,6.2,9.7,14.6,18.5c0.2,0.2,0.4,0.5,0.6,0.7c0,0,0,0,0,0c0,0,0,0,0,0c0.2-0.2,0.4-0.5,0.6-0.7c8.4-8.7,12.5-14.8,14.6-18.5 c0.5-0.9,0.9-2,1.3-3c0.3-0.7,0.9-2.6,0.8-2.5c0.3-1.1,0.5-2.7,0.5-4.1C36.7,8.4,29.3,0.6,19.9,0z M2.2,22.9 C2.2,22.9,2.2,22.9,2.2,22.9C2.2,22.9,2.2,22.9,2.2,22.9C2.2,22.9,3,25.2,2.2,22.9z M19.1,26.8c-5.2,0-9.4-4.2-9.4-9.4 s4.2-9.4,9.4-9.4c5.2,0,9.4,4.2,9.4,9.4S24.3,26.8,19.1,26.8z M36,22.9C35.2,25.2,36,22.9,36,22.9C36,22.9,36,22.9,36,22.9 C36,22.9,36,22.9,36,22.9z M13.8,17.3a5.3,5.3 0 1,0 10.6,0a5.3,5.3 0 1,0 -10.6,0",strokeOpacity:0,strokeWeight:1,fillColor:"#274abb",fillOpacity:1,rotation:0,scale:1,anchor:new google.maps.Point(19,50)};$(window).on("load resize",function(){var n=$("#top-bar").height(),t=$("#header").innerHeight()+n;$(".fs-container").css("height",""+$(window).height()-t+"px")});return a=document.getElementById("propertyMap"),typeof a!="undefined"&&a!==null&&(google.maps.event.addDomListener(window,"load",y),google.maps.event.addDomListener(window,"resize",y)),s}])}(),function(){"use strict";angular.module("app").controller("contactController",["mailFactory","$window","ngDialog","$scope",function(n,t,i){function u(){i.open({template:"Scripts/property/app/templates/popupTmpl.html",className:"ngdialog-theme-default",overlay:!0,showClose:!1,closeByDocument:!1,controller:["$scope",function(n){n.yes=function(){r.mail={};t.location.href="Home/index"};n.no=function(){r.mail={};t.location.href="Home/index"}}]})}var r=this;return r.mail={},r.processForm=function(t){r.myPromise=n.sendMail(r.mail,t).then(function(){u()})},r.processBookingForm=function(t){console.log(r.booking);r.myPromise=n.sendBooking(r.booking,t).then(function(n){console.log(n);n.Result===!0&&u()})},r}])}(),function(){"use strict";angular.module("app").controller("roomsController",["mailFactory","$window","ngDialog","$scope",function(n,t,i){function u(){i.open({template:"Scripts/property/app/templates/popupTmpl.html",className:"ngdialog-theme-default",overlay:!0,showClose:!1,closeByDocument:!1,controller:["$scope",function(n){n.yes=function(){i.close()}}]})}window.loading_screen.finish();var r=this;return r.mail={},r.processForm=function(t){r.mail.accommodationId=accommodationId;r.myPromise=n.sendBooking(r.mail,t).then(function(){u()})},r}])}()