function branchOfficeController(n,t){function r(i,r){n.MBNAgents=[];t.GetMBNAgents(i,r).then(function(t){t=t.data;n.MBNAgents=t.Data})}function u(i,r){i=i||0;r=r||0;n.BrandMaps=[];t.GetMBNAgents(i,r).then(function(t){t=t.data;t.Status==!0&&(n.BrandMaps=t.Data)})}function f(n){n=n.replace(/[\(\s\)]/g,"");var t=n.split(",");return t.length!=2?null:new google.maps.LatLng(t[0],t[1])}n.City={Options:[],Value:0,Changed:function(){n.District.GetOptions(this.Value);r(this.Value,0)},Init:function(){t.GetLocationAgent(0).then(function(t){t=t.data;n.City.Options=t.Data})}};n.District={Options:[],Value:0,Changed:function(){r(n.City.Value,this.Value)},GetOptions:function(i){t.GetLocationAgent(i).then(function(t){t=t.data;n.District.Options=t.Data})}};n.MBNAgents=[];n.GoBack=function(){window.history.back()};n.ShowInfo=function(n,t,i,r,u,f){var e="",s=n||1,o,h;return s==2&&(e="Đại lý"),s==3&&(e="Điểm NT"),o=-1,t!=undefined&&i!=undefined&&(h=i.toLowerCase().startsWith(t.toLowerCase()),h==!0&&(o=0)),t!=undefined&&t.length>0&&o<0&&(e+=" "+t),i!=undefined&&i.length>0&&(e+=o<0?", "+i:i),r!=undefined&&r.length>0&&(e+=", ĐT: "+r),u!=undefined&&u.length>0&&(e+=", "+u),f!=undefined&&f.length>0&&(e+=" bấm "+f),e};n.ShowMap=function(t){$("#modalBrand").one("shown.bs.modal",function(){var i=n.FullMaps([t]);i.length>0&&i[0].ShowInfo()}).one("hidden.bs.modal",function(){}).modal("show")};n.BrandMaps=[];n.ShowMapByCity=function(t,i){u(t,i);$("#modalBrand").one("shown.bs.modal",function(){n.FullMaps(n.BrandMaps)}).one("hidden.bs.modal",function(){}).modal("show")};n.FullMaps=function(t){function p(n,t,i,r){var f=new google.maps.Marker({position:n,map:u,title:t,icon:r});a.push(f);f.infowindow=new google.maps.InfoWindow({content:'
'+i+"<\/div>"});self.openedWindow=null;google.maps.event.addListener(f,"click",function(){self.openedWindow!=null&&self.openedWindow.close();f.infowindow.open(u,f);self.openedWindow=f.infowindow});google.maps.event.addListener(u,"click",function(){self.openedWindow!=null&&self.openedWindow.close()});f.ShowInfo=function(){this.infowindow.open(u,f);self.openedWindow=f.infowindow}}var s,e,h,l,o,r;if(document.getElementById("map_canvas").innerHTML="",t.length!=0){for(s=["/content/images/location-daily.png","/content/images/location-daily-hover.png","/content/images/location-vp.png","/content/images/location-vp-hover.png"],e=[],i=0;i=0)return s.$observe(r,function(n){var t;return t=String(o.attr(s.$attr[r])).slice(0,2),v[f(r)]="{{"===t?n:e.$eval(n),y()})}),b=function(){return o.addClass("loading").attr("disabled",!0).trigger("chosen:updated")},k=function(){return o.removeClass("loading"),angular.isDefined(s.disabled)?o.attr("disabled",s.disabled):o.attr("disabled",!1),o.trigger("chosen:updated")},c=null,l=!1,a=function(){var n;return c?(n=$(o.parent()).find("div.chosen-drop"),n&&n.length>0&&parseInt(n.css("left"))>=0)?void 0:o.trigger("chosen:updated"):(e.$evalAsync(function(){c=o.chosen(v).data("chosen")}),angular.isObject(c))?c.default_text:void 0},y=function(){return c&&l?o.attr("data-placeholder",c.results_none_found).attr("disabled",!0):o.removeAttr("data-placeholder"),o.trigger("chosen:updated")},h?(w=h.$render,h.$render=function(){return w(),a()},o.on("chosen:hiding_dropdown",function(){return e.$apply(function(){return h.$setTouched()})}),s.multiple&&(g=function(){return h.$viewValue},e.$watch(g,h.$render,!0))):a(),s.$observe("disabled",function(){return o.trigger("chosen:updated")}),s.ngOptions&&h)return p=s.ngOptions.match(r),d=p[7],e.$watchCollection(d,function(n){return t(function(){return angular.isUndefined(n)?b():(l=u(n),k(),y())})}),e.$on("$destroy",function(){if("undefined"!=typeof timer&&null!==timer)return t.cancel(timer)})}}}])}).call(this);branchOfficeController.$inject=["$scope","mbnAgentServices"];mogiApp.controller("branchOfficeController",branchOfficeController)