function rootService(n,t,i){function f(){if($m.defined(window.MOGI)===!1){setTimeout(f,5);return}r.Profile.getInfo();MOGI.IsAuth?(r.Profile.Message.GetMessage(),$cache.remove("mogi:info")):$cache.setJson("mogi:info",MOGI);r.Favorite.loadCache()}var r=n,u;r.ngMsg=function(n){return(n.$touched||n.$submitted||!1)&&n.$error};r.isSlideOpened=!1;r.openSlideMenu=function(){if(r.isSlideOpened){r.closeSlideMenu();return}r.isSlideOpened=!0;$getById("mogi-slide-menu").style.left="0px";$getById("mogi-slide-overlay").style.display="block";document.body.style.overflow="hidden"};r.closeSlideMenu=function(){$getById("mogi-slide-menu").style.left="calc(-100vw - 100px)";$getById("mogi-slide-overlay").style.display="none";document.body.style.overflow="auto";r.isSlideOpened=!1};r.isOpenNav=!1;r.openNav=function(){if(r.isOpenNav){r.closeNav();return}r.isOpenNav=!0;$getById("slidemenu").style.left="0px";$getById("mogi-overlay").style.display="block";document.body.style.overflow="hidden"};r.closeNav=function(){$getById("slidemenu").style.left="-250px";$getById("mogi-overlay").style.display="none";document.body.style.overflow="auto";r.isOpenNav=!1};r.Profile={Data:{ClientId:null,ProfileId:0,FirstName:"",LastName:"",Avatar:"",Email:"",TotalFavorite:0,IsAuth:!1,Alert:null,LevelId:0,SupportStaff:{FullName:"",Mobile:"",Skype:"",Zalo:"",UserName:""}},getInfo:function(){var i=r.Profile.Data,n=window.MOGI;for(var u in i)i[u]=n[u];n.Token!==""&&(t.defaults.headers.common.Authorization=n.Token)},isAuth:function(){return this.Data.IsAuth},isNormal:function(){return this.Data.LevelId===0||this.Data.LevelId===1},getUserTypeLabel:function(){let n=mogiResUtils.getLevelById(this.Data.LevelId);return!n||!n.n?"":"Thành viên "+n.n},openZalo:function(){if(this.Data.SupportStaff.Zalo!==""||this.Data.SupportStaff.Zalo!==null){let n="https://zalo.me/"+this.Data.SupportStaff.Zalo;window.open(n,"_blank")}},openDialer:function(){this.Data.SupportStaff.Mobile!==""&&this.Data.SupportStaff.Mobile!==null&&(document.location.href="tel:"+this.Data.SupportStaff.Mobile)},getAvatar:function(){var n=this.Data.Avatar;return n===""?'<\/i>':'avatar'},getFavorite:function(){var n=this.Data.TotalFavorite;return n<10?n:"9+"},savedAlert:function(){var n=r.Profile.Data.Alert;return n?n.AlertSearchId>0:!1},Message:{Total:0,Items:[],Inboxs:[],HasValue:!1,HasMsg:!1,HasInbox:!1,KeyMsg:"mogi:msg",KeyInbox:"mogi:inbox",IsRead:function(n,t,i,r){var u=t.MessageId;n.push(t);t.Read=t.Read||!1;i[u]&&(t.Read=!0,r[u]=!0)},GetMessage:function(){var n={msg:{},inbox:{}},i={};i.msg=$cache.getJson(this.KeyMsg,{});i.inbox=$cache.getJson(this.KeyInbox,{});t({method:"GET",url:mogiRoutes.Common.GetMessage+"/"+MOGI.Member}).then(function(t){var f=t.data,u=r.Profile.Message,e,o;for(u.Total+=f.length,u.HasMsg=f.length>0,u.HasValue|=u.HasMsg,e=0,o=f.length;e0,u.HasValue|=u.HasInbox,e=0,o=f.length;e0&&t.get(n).then(function(n){n.data.forEach(function(n){n!==null&&(t.items[parseInt(n,10)]=!0)})}):this.loadCache()},loadCache:function(){var n=this,t;n.loaded||(n.loaded=!0,t=$cache.getJson(this.key,[]),r.Profile.Data.TotalFavorite=t.length,t.forEach(function(t){n.items[t]=!0}))},get:function(n){return t({method:"POST",url:mogiRoutes.Common.Favorite_GetList,data:n})},remove:function(n){return t({method:"POST",url:mogiRoutes.Common.Favorite_Remove+"?propertyId="+n})},add:function(n){return t({method:"POST",url:mogiRoutes.Common.Favorite_Add+"?propertyId="+n})},update:function(n){var t=r.Profile.Data;n=t.TotalFavorite+n;t.TotalFavorite=Math.max(0,n)},addRemove:function(n,t,i){var r=this.items[n]||!1;this.cache(n,r);r===!1?(this.items[n]=!0,this.add(n).then(function(){}),this.update(1),i&&window.mogiTracking&&mogiTracking.savePost(i)):(delete this.items[n],this.remove(n).then(function(){}),this.update(-1));t&&t.currentTarget.classList.toggle("favorited")},cache:function(n,t){var i=$cache.getJson(this.key,[]),r=i.indexOf(n);t?r!==-1&&i.splice(r,1):r===-1&&i.push(n);i.length>this.max&&(i=i.slice(i.length-this.max));$cache.setJson(this.key,i)}};r.TemplateTopMenuUrl=window.TemplateTopMenuUrl;u=window.template_layout_topmenu;$m.object(u)===!0&&$m.defined(i.get(u.url))===!1&&i.put(u.url,u.data);f()}function lazyLoad(n){if(lazy.length===0||lazyLoadCounter>3e3){var t=lozad(".lozad",{threshold:.1,root:n});t.observe()}else lazyLoadCounter+=20,setTimeout(lazyLoad,20)}function cleanChartName(n){var t=n.toLowerCase();switch(t){case"polararea":return"polarArea";case"horizontalbar":return"horizontalBar";default:return n}}function agent(n){function t(t){return n({method:"POST",url:mogiRoutes.Agent.SendMessageToAgent,data:t})}return{SendMessageToAgent:t}}function cityServices(n){function t(t){return n({method:"GET",url:mogiRoutes.City.GetZoneByCityId+"?cityId="+t})}function i(t){return n({method:"GET",url:mogiRoutes.City.GetStreetById+"?streetId="+t})}return{GetZoneByCity:t,GetStreetById:i}}function cmsServices(n){function t(t){return n({method:"GET",url:mogiRoutes.Cms.GetNews+"?id="+t})}function i(t){return n({method:"POST",url:mogiRoutes.Cms.GetListNews,data:t})}function r(t){return n({method:"POST",url:mogiRoutes.Cms.GetCategoriesByGroup+"?id="+t})}function u(t,i){return n({method:"POST",url:mogiRoutes.Cms.GetByUrlCode+"?groupId="+t+"&urlCode="+i})}function f(){return n({method:"GET",url:mogiRoutes.Cms.GetNotarizeOffices})}return{GetNews:t,GetListNews:i,GetCategoriesByGroup:r,GetByUrlCode:u,GetNotarizeOffices:f}}function commonServices(n,t,i){this.AlertSearch=function(n,r){var u=t.open({templateUrl:"/scripts/app/templates/alertsearchstatus.html",controller:["$scope","$filter","$uibModalInstance","profileServices","obj",function(n,t,i,r,u){n.Msg=mogiDatas.Msg;n.Data={AlertSearchId:u.AlertSearchId||0,Title:u.Title||"Nhận thông báo",ReceiveEmailType:u.ReceiveEmailType||136,HashKey:u.HashKey,Rent:u.ForRent,json:u.json||null};n.List=mogiResUtils.syscodeUtils.getAlertType();n.close=function(){i.dismiss("cancel")};n.update=function(){r.updateAlertSearch(n.Data).then(function(t){t=t.data;t.Status&&(u.ReceiveEmailType=t.Data.ReceiveEmailType,u.ReceiveEmailTypeName=mogiResUtils.getSysCode(u.ReceiveEmailType));i.close(n.Data)})}}],backdrop:"static",resolve:{obj:function(){return n}}});u.result.then(function(n){i.getUserData().then(function(t){if(t=t.data,t.Status&&!t.Data.IsVerifiedEmail&&n.ReceiveEmailType!==mogiConst.ReceiveEmailType.None){window.location.assign("/profile/verifyemail");return}return r(!0)})},function(){return r(!1)})};this.SendFeedBack=function(t){return n({method:"POST",url:mogiRoutes.Common.FeedBack,data:t})}}function homeServices(n){function t(t){return n({method:"POST",url:mogiRoutes.Home.RefreshCaptcha,data:{gid:t}})}function i(t){return n({method:"POST",url:mogiRoutes.Home.FeedBack,data:t})}return{RefreshCaptcha:t,SendFeedBack:i}}function imageServices(n){function t(t,i,r,u){if(t.type.indexOf("image/")!=0){u(mogiDatas.Msg.Msg_ProfileImage_Type_Error);return}if(t.size>=5242880){u(mogiDatas.Msg.Msg_ProfileImage_Size_Error);return}t.upload=n.upload({url:mogiRoutes.Upload.UploadImage,headers:{"optional-header":"header-value"},data:{referCode:i,file:t}});t.upload.then(function(n){if(t.result=n.data,n.data!=null&&n.data.success){var i={Url:n.data.PublishUrl,MediaId:n.data.MediaId,isUsed:!1,isChecked:!1,MediaTypeId:n.data.MediaTypeId,ServerId:n.data.ServerId,MediaUrl:n.data.MediaUrl,style:{},SmallUrl:function(){return this.Url.replace(this.MediaUrl,"thumb-small/"+this.MediaUrl)},AvatarUrl:function(){return this.Url.replace(this.MediaUrl,"thumb-avatar/"+this.MediaUrl)}};r&&r(i)}else u(n.data.error)},function(n){n.status>0&&u&&u(mogiDatas.Msg.Msg_ProfileImage_Type_Error)},function(n){t.progress=Math.min(100,parseInt(100*n.loaded/n.total))});t.upload.xhr(function(){})}return service={UploadImage:t}}function marketPrice(n){function t(t,i){return n({method:"GET",url:mogiRoutes.HousePrice.GetHousePriceSummary_ByDistrict+"?districtId="+t+"&month="+i})}function i(t,i,r){return n({method:"GET",url:mogiRoutes.HousePrice.GetHousePriceSummary_ByStreet+"?districtId="+t+"&wardId="+i+"&streetId="+r})}function r(t,i,r){return n({method:"GET",url:mogiRoutes.HousePrice.GetHousePriceMonthly_ByStreet+"?districtId="+t+"&wardId="+i+"&streetId="+r})}function u(t){return n({method:"GET",url:mogiRoutes.HousePrice.GetHousePrice_TopBy_AvgPrice+"?districtId="+t})}function f(t){return n({method:"GET",url:mogiRoutes.HousePrice.GetHousePrice_LowBy_AvgPrice+"?districtId="+t})}function e(t){return n({method:"GET",url:mogiRoutes.HousePrice.GetHousePrice_TopBy_Total+"?districtId="+t})}function o(t,i,r){return n({method:"GET",url:mogiRoutes.HousePrice.GetHousePrice_Street_vs_District+"?districtId="+t+"&wardId="+i+"&streetId="+r})}function s(t){return n({method:"POST",url:mogiRoutes.HousePrice.PropertySummaryByPriceRange,params:t})}return{GetHousePriceSummary_ByDistrict:t,GetHousePriceSummary_ByStreet:i,GetHousePriceMonthly_ByStreet:r,GetHousePrice_TopBy_AvgPrice:u,GetHousePrice_LowBy_AvgPrice:f,GetHousePrice_TopBy_Total:e,GetHousePrice_Street_vs_District:o,PropertySummaryByPriceRange:s}}function mbnAgentServices(n){function t(t){return n({method:"GET",url:mogiRoutes.MBNAgent.GetLocationAgent+t})}function i(t,i){return n({method:"GET",url:mogiRoutes.MBNAgent.GetMBNAgents+"?cityId="+t+"&districtId="+i})}return{GetLocationAgent:t,GetMBNAgents:i}}function messageService(n,t){var i=n;this.Messages=i.Profile.Messages;this.Data=[];this.Key="mogimsg";this.IsAuth=!1;this.Init=function(n,t){data=n;isAuth=t;this.Messages.Total=this.Data.length;this.IsReadAll()};this.GetData=function(n){t({method:"GET",url:mogiRoutes.Profile.getMessage,data:{code:n}}).then(function(n){i.Profile.Messages=n.data;this.Messages=n.data})};this.IsReadAll=function(){var n=$cache.get(this.Key),t;if(n===null)return this.Messages.ShowBadge=this.Data.length>0,!1;n=JSON.parse(n);t=this.Data.filter(function(t){return n.msg[t.MessageId]===!0});this.Messages.ShowBadge=t.length!==this.Data.length};this.OnRead=function(n){var r,i;if(this.IsAuth&&(r=mogiRoutes.Profile.ReadMessage+"?id="+n,t({method:"GET",url:r}).then(function(){})),i=$cache.get(this.Key),i!==null){if(i=JSON.parse(i),i.msg[n])return;i.msg[n]=!0}else i={msg:{}},i.msg[n]=!0;$cache.set(this.Key,JSON.stringify(i));this.IsReadAll()}}function projectServices(n){function t(t){return n({method:"GET",url:mogiRoutes.Project.GetQuestionsFromAsk+t})}function i(t){return n({method:"POST",url:mogiRoutes.Project.GetTopicCodeFromAsk+t})}return{GetQuestionsFromAsk:t,GetTopicCodeFromAsk:i}}function propertyServices(n){function i(t){return n({method:"POST",url:mogiRoutes.Property.TopService,data:t})}function r(t){return n({method:"POST",url:mogiRoutes.Property.SendMessageToBroker,data:t})}function t(n){var i=$("#favorite-total"),t=parseInt(i.html(),0),r;t+=n;t=Math.max(0,t);i.html(t);r=$("#favorite-icon");r.toggleClass("favorited",t>0)}function u(t){return n({method:"POST",url:mogiRoutes.Property.MapViewData,data:t})}function f(i){return t(1),n({method:"POST",url:mogiRoutes.Common.Favorite_GetList,data:i})}function e(i){return t(-1),n({method:"POST",url:mogiRoutes.Common.Favorite_Remove+"?propertyId="+i})}function o(i){return t(1),n({method:"POST",url:mogiRoutes.Common.Favorite_Add+"?propertyId="+i})}function s(){return n({method:"GET",url:mogiRoutes.Property.ReportMessages})}function h(t){return n({method:"POST",url:mogiRoutes.Property.ReportAbuse,data:t})}function c(t){return n({method:"GET",url:mogiRoutes.Property.MarketGetByDistrict+"?districtId="+t})}function l(){return n({method:"GET",url:mogiRoutes.Property.GetBankInterestRates})}function a(t,i){return n({method:"GET",url:mogiRoutes.Property.GetPropertyByStreet+"?streetId="+t+"&p="+i})}function v(t,i,r){return n({method:"GET",url:mogiRoutes.HousePrice.GetHistoryPropertyByStreet+"?streetId="+t+"&fromArea="+i+"&toArea="+r})}return{SearchMap:u,RemoveFavorite:e,AddFavorite:o,GetFavorites:f,SendMessageToAgent:r,GetMessages:s,SendReport:h,TopService:i,GetNext:function(t){var i=$.param(t);return n({method:"GET",url:mogiRoutes.Property.GetNext+"?"+i})},MarketGetByDistrict:c,GetBankInterestRates:l,GetPropertyByStreet:a,GetHistoryPropertyByStreet:v}}function researchProvinceServices(n){function t(){return n({method:"POST",url:"/ResearchProvince/GetExternalData"})}function i(){return n({method:"POST",url:"/ResearchProvince/GetOldCitiesData"})}function r(t){return n({method:"POST",url:"/ResearchProvince/GetCitySeoUrl",data:t})}function u(t){return n({method:"POST",url:"/ResearchProvince/GetWards",data:t})}return{GetExternalData:t,GetOldCitiesData:i,GetCitySeoUrl:r,GetWards:u}}function suggest(n){function i(){return{MapId:0,Name:"",ReferTypeId:0,ReferId:0,CityId:0,DistrictId:0,WardId:0,StreetId:0,ProjectId:0,PlaceId:0,SEOId:0,CodeUrl:"",FullName:function(n){return n.replace(/<.?b>/g,"")},Url:function(){return this.CodeUrl+"-mid"+this.MapId}}}function r(n,t){var r=[],e=t.data.suggest.startwith_suggester[n].suggestions,o=t.data.suggest.contain_suggester[n].suggestions,u=["MapId","ReferTypeId","ReferId","CityId","DistrictId","WardId","StreetId","ProjectId","PlaceId","SEOId","CodeUrl"],f={};return angular.forEach(e,function(n){var o=JSON.parse(n.payload),t=new i,e;for(t.Name=n.term,e=0;e=10)){for(o=JSON.parse(n.payload),t=new i,t.Name=n.term,e=0;e/g,"")}}}function c(n,t){var i=[],u=t.data.suggest.startwith_suggester[n].suggestions,e=t.data.suggest.contain_suggester[n].suggestions,r={};return angular.forEach(u,function(n){var t=new f;(t.Id=n.payload,t.Name=n.term,r[t.Id])||(r[t.Id]=t,i.push(t))}),angular.forEach(e,function(n){if(!(i.length>=10)){var t=new f;(t.Id=n.payload,t.Name=n.term,r[t.Id])||(r[t.Id]=t,i.push(t))}}),i}function l(i,r){i=i.toLowerCase();var u=t[i];return u?u:n({method:"GET",url:mogiRoutes.Common.Suggest_Project,params:{q:i},responseType:"json"}).then(function(n){return u=a(i,n),t[i]=u,r&&r(u[0]),u},function(){return t[i]=[],[]})}function e(){return{Id:"",Name:"",FullName:function(n){return n.replace(/<.?b>/g,"")}}}function a(n,t){var i=[],u=t.data.suggest.startwith_suggester[n].suggestions,f=t.data.suggest.contain_suggester[n].suggestions,r={};return angular.forEach(u,function(n){var t=new e;(t.Id=n.payload,t.Name=n.term,r[t.Id])||(r[t.Id]=t,i.push(t))}),angular.forEach(f,function(n){if(!(i.length>=10)){var t=new e;(t.Id=n.payload,t.Name=n.term,r[t.Id])||(r[t.Id]=t,i.push(t))}}),i}function u(){return{Name:"",Type:0,Id:0,Url:"",FullName:function(n){return n.replace(/<.?b>/g,"")}}}function v(n,t){var i=[],e=t.data.suggest.startwith_suggester[n].suggestions,o=t.data.suggest.contain_suggester[n].suggestions,r=["Type","Id","Url"],f={};return angular.forEach(e,function(n){var o=JSON.parse(n.payload),t=new u,e;for(t.Name=n.term,e=0;e=10)){for(o=JSON.parse(n.payload),t=new u,t.Name=n.term,e=0;e0?e.GetStreetById(i).then(function(n){if(n=n.data,n.Status===!0){var i="gia-nha-dat-";i+=n.Data.CodeUrl;i+="-d"+t.i+"-s"+n.Data.StreetId;location.href=i}}):(n="/gia-nha-dat-",n+=t.u,n+="-qd"+t.i,location.href=n)},GetStreetSuggest:function(n){return u.Street(n,null)},Values:[],Data:[],GotoStreetList:function(n){var t=mogiResUtils.GetCityById(n),i="/gia-nha-dat-";return i+=t.u,i+("-qd"+t.i)},GetDistrict:function(t){n.List.did=t;var i=this.Values[t];i!==null&&i!==undefined?(this.Value=i,n.List.Data=angular.copy(n.List.Value)):(n.List.GetMarketPriceSummary(t),f.MarketGetByDistrict(t).then(function(i){i=i.data;i.Status===!0&&(n.List.Value=i.Data,n.List.Values[t]=i.Data,n.List.Data=angular.copy(n.List.Value));var r=document.getElementById("street-list");r.classList.add("loaded")}))},Value:[],ResetKeyWord:function(){n.List.Keyword=null;n.List.Filter()},OnKeyUp:function(){n.List.Filter()},Filter:function(){var i=n.List.Data,t,r;n.List.Keyword!==void 0&&n.List.Keyword!==null&&n.List.Keyword!=""&&(t=n.List.Keyword,t=t.replace(/ă/ig,"[ăắằẳẵặ]"),t=t.replace(/â/ig,"[âấầẩẫậ]"),t=t.replace(/a/ig,"[aáàảãạăắằẳẵặâấầẩẫậ]"),t=t.replace(/d/ig,"[dđ]"),t=t.replace(/ê/ig,"[êếềểễệ]"),t=t.replace(/e/ig,"[eéèẻẽẹêếềểễệ]"),t=t.replace(/i/ig,"[iíìỉĩị]"),t=t.replace(/ô/ig,"[ôốồổỗộ]"),t=t.replace(/ơ/ig,"[ơớờởỡợ]"),t=t.replace(/o/ig,"[oóòỏõọôốồổỗộơớờởỡợ]"),t=t.replace(/ư/ig,"[ưứừửữự]"),t=t.replace(/u/ig,"[uúùủũụưứừửữự]"),t=t.replace(/y/ig,"[yýỳỷỹỵ]"),r=new RegExp(t,"i"),i=_.filter(i,function(n){return r.test(n.StreetName)}));n.List.Value=i},GotoDetail:function(n){location.href=n.FrontEnd_SearchUrl},MonthRangeOptions:[{i:3,n:"3 tháng"},{i:6,n:"6 tháng"},{i:12,n:"12 tháng"}],MonthRange:12,MonthRangeChanged:function(){n.List.GetMarketPriceSummary(n.List.did)},GetMarketPriceSummary:function(t){o.GetHousePriceSummary_ByDistrict(t,n.List.MonthRange).then(function(t){t=t.data;t.Status===!0&&(n.List.MarketPriceSummary=t.Data);var i=document.getElementById("district-summary");i.classList.add("loaded")})}};n.Detail={Value:{s:0,d:0},MonthRangeOptions:[{i:3,n:"3 tháng"},{i:6,n:"6 tháng"},{i:12,n:"12 tháng"}],MonthRange:12,MaxMonth:0,MarketPriceSummary:[],MTChartData:[],MTChartChartOptions:{responsive:!0,scales:{xAxes:[{display:!0,scaleLabel:{display:!1,labelString:"Month",showLine:!1},gridLines:{display:!1}}],yAxes:[{display:!0,scaleLabel:{display:!1,labelString:"Value",showLine:!1},ticks:{autoSkip:!1,maxTicksLimit:10},gridLines:{display:!0}}]},maintainAspectRatio:!1,elements:{line:{tension:0}},tooltips:{enabled:!1},legend:{display:!1}},Init:function(){var r,n,u,f,t,i,e;if(dataChart!==null){for(r=[],n=0;n<=items.length-1;n++)if(u=items[n]||null,u!==null){for(f=[],t=0;t<=dataChart.length-1;t++)(i=dataChart[t]||null,i!==null)&&i.PropertyStyle===u.PropertyStyle&&f.push(parseInt(i.AvgPrice));e={labels:months,datasets:[{label:"",fill:!1,backgroundColor:"#45bfb7",borderColor:"#45bfb7",pointBackgroundColor:"#45bfb7",pointBorderColor:"#45bfb7",data:f}]};r.push(e)}this.MTChartData=r}},GetHousePriceSummary_ByStreet:function(t,i,r){o.GetHousePriceSummary_ByStreet(r,i,t).then(function(t){t=t.data;t.Status===!0&&n.Detail.CurrentMonthChart.Init(t.Data)});o.GetHousePriceMonthly_ByStreet(r,i,t).then(function(t){t=t.data;t.Status===!0&&(n.Detail.PriceTrendChart.Init(t.Data),n.Detail.PriceMonthlyChange.Init(t.Data))})},GetMarketPriceTopPrice:function(t){o.GetHousePrice_TopBy_AvgPrice(t).then(function(t){t=t.data;t.Status===!0&&(n.Detail.MarketPriceTopPrice=t.Data)})},GetMarketPriceLowPrice:function(t){o.GetHousePrice_LowBy_AvgPrice(t).then(function(t){t=t.data;t.Status==!0&&(n.Detail.MarketPriceLowPrice=t.Data)})},GetMarketPriceTopTotal:function(t){o.GetHousePrice_TopBy_Total(t).then(function(t){t=t.data;t.Status==!0&&(n.Detail.MarketPriceTopTotal=t.Data)})},GetMarketPriceStreetVsDistrict:function(t,i,r){o.GetHousePrice_Street_vs_District(r,i,t).then(function(t){t=t.data;t.Status==!0&&n.Detail.StreetVsDistrictChart.Init(t.Data)})},AvgPriceChart:{Data:[],Options:{legend:{display:!1},title:{display:!0,text:"Giá trung bình"},responsive:!0,maintainAspectRatio:!1,scales:{xAxes:[{gridLines:{display:!1},display:!0,barPercentage:.25,categoryPercentage:1,barThickness:30,maxBarThickness:30,scaleLabel:{display:!1}}],yAxes:[{display:!0,scaleLabel:{display:!0,labelString:"tr/m2"},ticks:{beginAtZero:!0}}]}},Init:function(t){var u={labels:[],datasets:[]},r=[{bg:"#32A8EA",d:[]},{bg:"#FF9802",d:[]},{bg:"#28D178",d:[]},{bg:"#FF6362",d:[]},{bg:"#0000FF",d:[]}],i=0,f=0,e,o;angular.forEach(t,function(n){n.AvgPrice>=0&&(n.AvgPrice>f&&(f=n.AvgPrice),u.labels.push(n.PropertyTypeName),r[i].d.push({x:n.PropertyTypeName,y:Math.round(parseInt(n.AvgPrice/1e6))}),u.datasets.push({label:n.PropertyTypeName,fill:!1,backgroundColor:r[i].bg,borderColor:r[i].bg,data:r[i].d}));i=i+1});e=n.Detail.CalcChartHeight(f);o=n.Detail.AvgPriceChart.Options.scales.yAxes[0].ticks;o.max=10*e;o.stepSize=e;n.Detail.AvgPriceChart.Data=u}},PriceTrendChart:{Data:[],MonthId:6,SourceData:[],Options:{legend:{display:!0,position:"bottom"},title:{display:!1,text:"Xu thế giá 12 tháng gần đây"},responsive:!0,maintainAspectRatio:!1,scales:{xAxes:[{display:!0,scaleLabel:{display:!1},gridLines:{display:!1}}],yAxes:[{display:!0,scaleLabel:{display:!0,labelString:"tr/m2"},ticks:{beginAtZero:!0,max:0}}]}},Init:function(t){n.Detail.PriceTrendChart.SourceData=t;n.Detail.PriceTrendChart.LoadData(24)},LoadData:function(t){var h,c;n.Detail.PriceRangeChart.MonthId=t;var e=n.Detail.GetMonthRanges(t),o={labels:[],datasets:[]},u=[{bg:"#32A8EA",d:[]},{bg:"#FF9802",d:[]},{bg:"#28D178",d:[]},{bg:"#FF6362",d:[]},{bg:"#0000FF",d:[]},{bg:"#0000FF",d:[]},{bg:"#0000FF",d:[]},{bg:"#0000FF",d:[]}],l=[],r=0,a=[],s=0,f=n.Detail.PriceTrendChart.SourceData;angular.forEach(f,function(n){n.AvgPrice>s&&(s=n.AvgPrice);$.inArray(n.MonthId,a)===-1&&n.MonthId>0&&$.inArray(n.MonthId,e)>=0&&a.push(n.MonthId)});angular.forEach(f,function(n){$.inArray(n.PropertyTypeName,l)===-1&&$.inArray(n.MonthId,e)>=0&&(n.MonthId>0&&l.push(n.PropertyTypeName),angular.forEach(e,function(t){var s=i("filter")(f,function(i){return i.PropertyTypeName===n.PropertyTypeName&&i.MonthId==t}),o,e;s.length>0?u[r].d.push(Math.round(parseInt(s[0].AvgPrice/1e6))):(o=u[r].d[u[r].d.length-1],o===undefined||o===null?(e=i("filter")(f,function(i){return i.PropertyTypeName===n.PropertyTypeName&&i.AvgPrice&&i.AvgPrice!=null&&i.MonthId0?(e=e.sort(function(n,t){return t.MonthId-n.MonthId}),u[r].d.push(Math.round(parseInt(e[0].AvgPrice/1e6)))):(e=i("filter")(f,function(i){return i.PropertyTypeName===n.PropertyTypeName&&i.AvgPrice&&i.AvgPrice!=null&&i.MonthId>t}),e.length>0&&(e=e.sort(function(n,t){return n.MonthId-t.MonthId}),u[r].d.push(Math.round(parseInt(e[0].AvgPrice/1e6)))))):u[r].d.push(o))}),n.MonthId>0&&o.datasets.push({label:n.PropertyTypeName,fill:!1,lineTension:0,borderWidth:2,pointBorderWidth:0,backgroundColor:u[r].bg,borderColor:u[r].bg,data:u[r].d}),r=r+1)});angular.forEach(e,function(n,t){(t+1)%3==0&&t>1||t===0?(n=n+"",o.labels.push(n.substring(4,6)+"/"+n.substring(0,4))):o.labels.push("")});h=n.Detail.CalcChartHeight(s);c=n.Detail.PriceTrendChart.Options.scales.yAxes[0].ticks;c.max=10*h;c.stepSize=h;n.Detail.PriceTrendChart.Data=o}},PriceMonthlyChange:{Month:{Range:[],Min:0,Max:0,Current:0,Change:function(t){n.Detail.PriceMonthlyChange.Month.Current+t5&&(n.Detail.PriceMonthlyChange.Month.Current+=t,n.Detail.PriceMonthlyChange.LoadData())}},Data:[],SourceData:[],Init:function(t){n.Detail.PriceMonthlyChange.SourceData=t;var i=n.Detail.GetMonthRanges(24);n.Detail.PriceMonthlyChange.Month.Range=i;n.Detail.PriceMonthlyChange.Month.Max=Math.max.apply(Math,i);n.Detail.PriceMonthlyChange.Month.Min=Math.min.apply(Math,i);n.Detail.PriceMonthlyChange.Month.Current=n.Detail.PriceMonthlyChange.Month.Range.findIndex(function(t){return t===n.Detail.PriceMonthlyChange.Month.Max});n.Detail.PriceMonthlyChange.LoadData()},LoadData:function(){var t=n.Detail.PriceMonthlyChange.Month.Current,r=$.grep(n.Detail.PriceMonthlyChange.Month.Range,function(n,i){return i<=t&&i>t-7}),u=n.Detail.PriceMonthlyChange.SourceData,i;n.Detail.PriceMonthlyChange.Data=[];i=["Mặt tiền, phố","Hẻm, ngõ","Mb6623 nạp rút nhanh chóng","Đất"];angular.forEach(i,function(t){var f={Type:t,M:[],V:[]},i=[];angular.forEach(r,function(n,r){var o=$.grep(u,function(i){return i.MonthId===n&&i.PropertyTypeName===t}),e;if(r===0){o.length>0?i.push(o[0].AvgPrice):i.push(0);return}n=n+"";f.M.push(n.substring(4,6)+"/"+n.substring(0,4));o.length>0?(i.push(o[0].AvgPrice),e=r>0&&i[r]>0&&i[r-1]>0?((i[r]-i[r-1])/i[r-1]*100).toFixed(2):0,e=e<0?e+'% ▼<\/i>':e>0?e+'% ▲<\/i>':"",f.V.push(Math.round(parseInt(o[0].AvgPrice/1e6))+' tr/m2<\/sup>'+e+"<\/sup>")):(r>0?i.push(i[r-1]):i.push(0),f.V.push("-"))});n.Detail.PriceMonthlyChange.Data.push(f)})}},StreetVsDistrictChart:{Data:[],Options:{title:{display:!1,text:"So sánh giá trung bình đường và quận"},responsive:!0,maintainAspectRatio:!1,scales:{xAxes:[{display:!0,scaleLabel:{display:!1},gridLines:{display:!1}}],yAxes:[{display:!0,scaleLabel:{display:!0,labelString:"tr/m2"},ticks:{beginAtZero:!0}}]}},Init:function(t){var e={labels:[],datasets:[]},r={label:"Đường",fill:!1,lineTension:0,borderWidth:2,pointBorderWidth:0,backgroundColor:"#ef114b",borderColor:"#ef114b",data:[]},u={label:"Quận",fill:!1,lineTension:0,borderWidth:2,pointBorderWidth:0,backgroundColor:"#28d178",borderColor:"#28d178",data:[]},h=n.Detail.GetMonthRanges(12),f,o,s;angular.forEach(h,function(n,t){if((t+1)%3==0&&t>1||t==0){var i=n+"";e.labels.push(i.substring(4,6)+"/"+i.substring(0,4))}else e.labels.push("")});f=0;angular.forEach(h,function(n){var c=i("filter")(t,function(t){return t.MonthId==n}),o,s,h,e;c.length>0?(o=c[0],o.StreetAvgPrice>f&&(f=o.StreetAvgPrice),o.DistrictAvgPrice>f&&(f=o.DistrictAvgPrice),o.StreetAvgPrice>0?r.data.push(Math.round(parseInt(o.StreetAvgPrice/1e6))):(s=r.data[r.data-1],(s==undefined||s==null)&&(e=i("filter")(t,function(t){return t.StreetAvgPrice>0&&t.MonthId0?(e=e.sort(function(n,t){return t.MonthId-n.MonthId}),r.data.push(Math.round(parseInt(e[0].StreetAvgPrice/1e6)))):(e=i("filter")(t,function(t){return t.StreetAvgPrice>0&&t.MonthId>n}),e.length>0&&(e=e.sort(function(n,t){return n.MonthId-t.MonthId}),r.data.push(Math.round(parseInt(e[0].StreetAvgPrice/1e6))))))),o.DistrictAvgPrice>0?u.data.push(Math.round(parseInt(o.DistrictAvgPrice/1e6))):(h=u.data[u.data-1],(h==undefined||h==null)&&(e=i("filter")(t,function(t){return t.DistrictAvgPrice>0&&t.MonthId0?(e=e.sort(function(n,t){return t.MonthId-n.MonthId}),u.data.push(Math.round(parseInt(e[0].DistrictAvgPrice/1e6)))):(e=i("filter")(t,function(t){return t.DistrictAvgPrice>0&&t.MonthId>n}),e.length>0&&(e=e.sort(function(n,t){return n.MonthId-t.MonthId}),u.data.push(Math.round(parseInt(e[0].DistrictAvgPrice/1e6)))))))):(s=r.data[r.data-1],(s==undefined||s==null)&&(e=i("filter")(t,function(t){return t.StreetAvgPrice>0&&t.MonthId0?(e=e.sort(function(n,t){return t.MonthId-n.MonthId}),r.data.push(Math.round(parseInt(e[0].StreetAvgPrice/1e6)))):(e=i("filter")(t,function(t){return t.StreetAvgPrice>0&&t.MonthId>n}),e.length>0&&(e=e.sort(function(n,t){return n.MonthId-t.MonthId}),r.data.push(Math.round(parseInt(e[0].StreetAvgPrice/1e6)))))),h=u.data[u.data-1],(h==undefined||h==null)&&(e=i("filter")(t,function(t){return t.DistrictAvgPrice>0&&t.MonthId0?(e=e.sort(function(n,t){return t.MonthId-n.MonthId}),u.data.push(Math.round(parseInt(e[0].DistrictAvgPrice/1e6)))):(e=i("filter")(t,function(t){return t.DistrictAvgPrice>0&&t.MonthId>n}),e.length>0&&(e=e.sort(function(n,t){return n.MonthId-t.MonthId}),u.data.push(Math.round(parseInt(e[0].DistrictAvgPrice/1e6)))))))});e.datasets.push(r);e.datasets.push(u);o=n.Detail.CalcChartHeight(f);s=n.Detail.StreetVsDistrictChart.Options.scales.yAxes[0].ticks;s.max=10*o;s.stepSize=o;n.Detail.StreetVsDistrictChart.Data=e;n.Detail.GetMonthRanges(12)}},CurrentMonthChart:{Data:[],DataTbl:[],Options:{legend:{display:!1},title:{display:!1},responsive:!0,maintainAspectRatio:!1,plugins:{datalabels:{align:"top",anchor:"end",offset:1,padding:{top:1},color:"#262637",font:{family:"Open Sans",size:11}}},layout:{padding:{top:20}},scales:{yAxes:[{gridLines:{display:!0},display:!0,ticks:{beginAtZero:!0}}],xAxes:[{gridLines:{display:!1,offsetGridLines:!0},display:!0,barPercentage:.3,categoryPercentage:1,barThickness:n.barWidth,maxBarThickness:n.barWidth,minBarLength:2}]}},Init:function(t){var i={labels:[],datasets:[]},r;i.datasets.push({backgroundColor:[],data:[]});r=["#32A8EA","#FF9802","#28D178","#FF6362"];angular.forEach(t,function(t){n.Detail.CurrentMonthChart.DataTbl.push(t)});angular.forEach(t,function(n,t){i.labels.push(n.PropertyTypeName);i.datasets[0].data.push(Math.round(n.AvgPrice/1e6));i.datasets[0].backgroundColor.push(r[t])});n.Detail.CurrentMonthChart.Data=i}},PriceRangeChart:{Data:[],Fetch:function(t){var i=Math.max.apply(Math,n.Detail.GetMonthRanges(1)),r={monthId:i,streetId:t,cityId:0,propertyTypeId:1};o.PropertySummaryByPriceRange(r).then(function(t){t.data.Status===!0&&n.Detail.PriceRangeChart.Init(t.data.Data)})},Options:{legend:{display:!1},title:{display:!1},responsive:!0,maintainAspectRatio:!1,plugins:{datalabels:{formatter:function(n){return n+"%"},align:"top",anchor:"end",offset:1,padding:{top:1},color:"#262637",font:{family:"Open Sans",size:11}}},layout:{padding:{top:20}},scales:{yAxes:[{gridLines:{display:!1},display:!1,scaleLabel:{display:!1},ticks:{beginAtZero:!0}}],xAxes:[{gridLines:{display:!1,offsetGridLines:!0},display:!0,barPercentage:.3,categoryPercentage:1,barThickness:n.barWidth,maxBarThickness:n.barWidth,minBarLength:2}]}},Init:function(t){var i={labels:[],datasets:[]},u,r;i.datasets.push({backgroundColor:[],data:[]});u=["#00A285","#03AF90","#04BF9E","#00CEA9","#00DEB6","#15EBC4","#33F2D0","#4EF6D8","#72FEE5","#94FBE8","#94FBE8"];r=0;t.map(function(n){return r+=n.Value,n});angular.forEach(t,function(n,t){i.labels.push(n.Name);i.datasets[0].data.push(s(n.Value,r));i.datasets[0].backgroundColor.push(u[t])});n.Detail.PriceRangeChart.Data=i}},CalcChartHeight:function(n){var r=Math.round(parseInt(n/1e6))+2,t=Math.ceil(r/10),i=t%10;return i>0&&(t=t+10-i),t},GetMonthRanges:function(t){var u=n.Detail.MaxMonth,f=u?new Date(parseInt(u.substr(0,4)),parseInt(u.substr(4,2))):new Date,e,r,i,o;for(console.log(f),e=[],r=1;r<=t;r++)i=new Date(f.getFullYear(),f.getMonth()),i.setMonth(i.getMonth()-r),o=i.getFullYear()+""+(i.getMonth()+1<10?"0":"")+(i.getMonth()+1),e.push(parseInt(o));return e.sort()}};n.GotoDetail=function(n,t){e.GetStreetById(n).then(function(n){if(n=n.data,n.Status==!0){var i="gia-nha-dat-";i+=n.Data.CodeUrl;i+="-d"+t+"-s"+n.Data.StreetId;location.href=i}})};n.DetailInit=function(t,i,r,u){n.Detail.Value.s=t;n.Detail.Value.d=r;n.Detail.MaxMonth=u;n.Detail.GetHousePriceSummary_ByStreet(t,i,r);n.Detail.GetMarketPriceTopPrice(r);n.Detail.GetMarketPriceLowPrice(r);n.Detail.GetMarketPriceStreetVsDistrict(t,i,r)};Chart.defaults.global.title.fontSize=15;Chart.defaults.global.legend.position="bottom";Chart.defaults.global.legend.labels.boxWidth=15;Chart.defaults.global.tooltips.backgroundColor="#000";Chart.defaults.global.legend.labels.usePointStyle=!0}var ngFileUpload,mogiPropertyTypes,mogiResUtils,mogiApp;if(window.Modernizr=function(n,t,i){function a(n){c.cssText=n}function vt(n,t){return a(y.join(n+";")+(t||""))}function h(n,t){return typeof n===t}function v(n,t){return!!~(""+n).indexOf(t)}function lt(n,t){var u,r;for(u in n)if(r=n[u],!v(r,"-")&&c[r]!==i)return t=="pfx"?r:!0;return!1}function yt(n,t,r){var f,u;for(f in n)if(u=t[n[f]],u!==i)return r===!1?n[f]:h(u,"function")?u.bind(r||t):u;return!1}function f(n,t,i){var r=n.charAt(0).toUpperCase()+n.slice(1),u=(n+" "+ot.join(r+" ")+r).split(" ");return h(t,"string")||h(t,"undefined")?lt(u,t):(u=(n+" "+st.join(r+" ")+r).split(" "),yt(u,t,i))}function pt(){u.input=function(i){for(var r=0,u=i.length;r',n,"<\/style>"].join(""),f.id=e,(h?f:o).innerHTML+=l,o.appendChild(f),h||(o.style.background="",o.style.overflow="hidden",v=s.style.overflow,s.style.overflow="hidden",s.appendChild(o)),a=i(f,n),h?f.parentNode.removeChild(f):(o.parentNode.removeChild(o),s.style.overflow=v),!!a},at=function(t){var i=n.matchMedia||n.msMatchMedia,r;return i?i(t).matches:(l("@media "+t+" { #"+e+" { position: absolute; } }",function(t){r=(n.getComputedStyle?getComputedStyle(t,null):t.currentStyle).position=="absolute"}),r)},ct=function(){function r(r,u){u=u||t.createElement(n[r]||"div");r="on"+r;var f=r in u;return f||(u.setAttribute||(u=t.createElement("div")),u.setAttribute&&u.removeAttribute&&(u.setAttribute(r,""),f=h(u[r],"function"),h(u[r],"undefined")||(u[r]=i),u.removeAttribute(r))),u=null,f}var n={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return r}(),it={}.hasOwnProperty,rt,k;rt=h(it,"undefined")||h(it.call,"undefined")?function(n,t){return t in n&&h(n.constructor.prototype[t],"undefined")}:function(n,t){return it.call(n,t)};Function.prototype.bind||(Function.prototype.bind=function(n){var t=this,i,r;if(typeof t!="function")throw new TypeError;return i=tt.call(arguments,1),r=function(){var f,e,u;return this instanceof r?(f=function(){},f.prototype=t.prototype,e=new f,u=t.apply(e,i.concat(tt.call(arguments))),Object(u)===u)?u:e:t.apply(n,i.concat(tt.call(arguments)))},r});r.flexbox=function(){return f("flexWrap")};r.flexboxlegacy=function(){return f("boxDirection")};r.canvas=function(){var n=t.createElement("canvas");return!!(n.getContext&&n.getContext("2d"))};r.canvastext=function(){return!!(u.canvas&&h(t.createElement("canvas").getContext("2d").fillText,"function"))};r.webgl=function(){return!!n.WebGLRenderingContext};r.touch=function(){var i;return"ontouchstart"in n||n.DocumentTouch&&t instanceof DocumentTouch?i=!0:l(["@media (",y.join("touch-enabled),("),e,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(n){i=n.offsetTop===9}),i};r.geolocation=function(){return"geolocation"in navigator};r.postmessage=function(){return!!n.postMessage};r.websqldatabase=function(){return!!n.openDatabase};r.indexedDB=function(){return!!f("indexedDB",n)};r.hashchange=function(){return ct("hashchange",n)&&(t.documentMode===i||t.documentMode>7)};r.history=function(){return!!(n.history&&history.pushState)};r.draganddrop=function(){var n=t.createElement("div");return"draggable"in n||"ondragstart"in n&&"ondrop"in n};r.websockets=function(){return"WebSocket"in n||"MozWebSocket"in n};r.rgba=function(){return a("background-color:rgba(150,255,150,.5)"),v(c.backgroundColor,"rgba")};r.hsla=function(){return a("background-color:hsla(120,40%,100%,.5)"),v(c.backgroundColor,"rgba")||v(c.backgroundColor,"hsla")};r.multiplebgs=function(){return a("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(c.background)};r.backgroundsize=function(){return f("backgroundSize")};r.borderimage=function(){return f("borderImage")};r.borderradius=function(){return f("borderRadius")};r.boxshadow=function(){return f("boxShadow")};r.textshadow=function(){return t.createElement("div").style.textShadow===""};r.opacity=function(){return vt("opacity:.55"),/^0.55$/.test(c.opacity)};r.cssanimations=function(){return f("animationName")};r.csscolumns=function(){return f("columnCount")};r.cssgradients=function(){var n="background-image:";return a((n+"-webkit- ".split(" ").join("gradient(linear,left top,right bottom,from(#9f9),to(white));"+n)+y.join("linear-gradient(left top,#9f9, white);"+n)).slice(0,-n.length)),v(c.backgroundImage,"gradient")};r.cssreflections=function(){return f("boxReflect")};r.csstransforms=function(){return!!f("transform")};r.csstransforms3d=function(){var n=!!f("perspective");return n&&"webkitPerspective"in s.style&&l("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(t){n=t.offsetLeft===9&&t.offsetHeight===3}),n};r.csstransitions=function(){return f("transition")};r.fontface=function(){var n;return l('@font-face {font-family:"font";src:url("https://")}',function(i,r){var f=t.getElementById("smodernizr"),u=f.sheet||f.styleSheet,e=u?u.cssRules&&u.cssRules[0]?u.cssRules[0].cssText:u.cssText||"":"";n=/src/i.test(e)&&e.indexOf(r.split(" ")[0])===0}),n};r.generatedcontent=function(){var n;return l(["#",e,"{font:0/0 a}#",e,':after{content:"',g,'";visibility:hidden;font:3px/1 a}'].join(""),function(t){n=t.offsetHeight>=3}),n};r.video=function(){var i=t.createElement("video"),n=!1;try{(n=!!i.canPlayType)&&(n=new Boolean(n),n.ogg=i.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),n.h264=i.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),n.webm=i.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,""))}catch(r){}return n};r.audio=function(){var i=t.createElement("audio"),n=!1;try{(n=!!i.canPlayType)&&(n=new Boolean(n),n.ogg=i.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),n.mp3=i.canPlayType("audio/mpeg;").replace(/^no$/,""),n.wav=i.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),n.m4a=(i.canPlayType("audio/x-m4a;")||i.canPlayType("audio/aac;")).replace(/^no$/,""))}catch(r){}return n};r.localstorage=function(){try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(n){return!1}};r.sessionstorage=function(){try{return sessionStorage.setItem(e,e),sessionStorage.removeItem(e),!0}catch(n){return!1}};r.webworkers=function(){return!!n.Worker};r.applicationcache=function(){return!!n.applicationCache};r.svg=function(){return!!t.createElementNS&&!!t.createElementNS(p.svg,"svg").createSVGRect};r.inlinesvg=function(){var n=t.createElement("div");return n.innerHTML="",(n.firstChild&&n.firstChild.namespaceURI)==p.svg};r.smil=function(){return!!t.createElementNS&&/SVGAnimate/.test(ft.call(t.createElementNS(p.svg,"animate")))};r.svgclippaths=function(){return!!t.createElementNS&&/SVGClipPath/.test(ft.call(t.createElementNS(p.svg,"clipPath")))};for(k in r)rt(r,k)&&(b=k.toLowerCase(),u[b]=r[k](),nt.push((u[b]?"":"no-")+b));return u.input||pt(),u.addTest=function(n,t){if(typeof n=="object")for(var r in n)rt(n,r)&&u.addTest(r,n[r]);else{if(n=n.toLowerCase(),u[n]!==i)return u;t=typeof t=="function"?t():t;typeof d!="undefined"&&d&&(s.className+=" "+(t?"":"no-")+n);u[n]=t}return u},a(""),ut=o=null,function(n,t){function p(n,t){var i=n.createElement("p"),r=n.getElementsByTagName("head")[0]||n.documentElement;return i.innerHTML="x