"use strict";(self["webpackChunkcarabi_x2"]=self["webpackChunkcarabi_x2"]||[]).push([[5624],{8005:function(e,t,i){i.r(t),i.d(t,{default:function(){return f}});var n=function(){var e=this,t=e._self._c;return e.model.loaded?t("ViewportPanels",{attrs:{leftSize:e.panelSize,leftTitle:"Редактирование/создание зон"},on:{resize:e.panelsChange},scopedSlots:e._u([{key:"left",fn:function(){return[t("LogisticCities",{attrs:{model:e.model},on:{changecity:e.changecity}}),t("LogisticZones",{attrs:{model:e.model},on:{currentzone:e.currentzone,savezones:e.savezones,cancel:e.cancel,edt:e.edt,newzone:e.newzone,delet:e.delet,saverename:e.saverename}})]},proxy:!0},{key:"default",fn:function(){return[t("LogisticMap",{ref:"mainMap",attrs:{panelSize:e.panelSize,model:e.model},on:{"open-panel":function(t){e.panelSize=400}}})]},proxy:!0}],null,!1,2636643553)}):t("Loader")},a=[],s=i(6848),l=i(4505),o=i(3216);const c={name:"LogisticModel",render:()=>null,data:()=>({loaded:!1,cities:[],zones:null,editMode:null,namezone:null,curCityId:null,homePoints:null,cityBlocks:null,curBlockId:null,curPoint:null,create:null,wait:!1,nameNewZone:"",newZoneId:null,editnullzone:!1,renameid:"",newName:""}),computed:{},watch:{async curCityId(){this.loaded&&await Promise.all[this.loadZones()]}},async created(){await(0,l.A)([{name:"cities",func:this.loadCities},{name:"zones",func:this.loadZones,req:["cities"]}]),this.loaded=!0},methods:{async loadCities(){let e=await o.vd.select("GET_CITY_LIST_CS",{},100);if(!e.length)throw"Не настроен ни один город!";this.cities=e.map((e=>({...e,MAPCENTERLAT:parseFloat(e.MAPCENTERLAT),MAPCENTERLNG:parseFloat(e.MAPCENTERLNG),ZOOM:parseInt(e.ZOOM)}))),this.curCityId=this.cities.find((e=>e.IS_MAIN)).CITY_ID,this.curCityId||(this.curCityId=this.cities[0].CITY_ID)},async loadPoints(){await o.vd.select("UPDATE_ZONE_GEO_POINTS_CS",{zone_id:"",coords:""},1)},async loadZones(){let e=await o.vd.select("GET_CITY_ZONE_COORDS_CS",{city_id:this.curCityId},1e5),t=[];for(let n of e){let e=t.find((e=>e.ZONE_ID===n.ZONE_ID));e||(e={ZONE_ID:n.ZONE_ID,coords:[]},t.push(e)),e.coords.push([parseFloat(n.LAT),parseFloat(n.LNG)])}let i=await o.vd.select("GET_CITY_ZONES_CS",{city_id:this.curCityId},1e3);for(let n of t){let e=i.find((e=>e.ZONE_ID===n.ZONE_ID));n.name=e.ZONE_NAME}this.namezone=i,this.zones=t}}};var d=c,r=i(5512),h={name:"logisticmapzones",components:{Loader:()=>i.e(8326).then(i.bind(i,1259)),ViewportPanels:()=>i.e(6344).then(i.bind(i,7177)),LogisticCities:()=>i.e(3835).then(i.bind(i,3094)),LogisticZones:()=>i.e(3835).then(i.bind(i,458)),LogisticMap:()=>Promise.all([i.e(3454),i.e(6985)]).then(i.bind(i,8914))},props:{view:Object},data:()=>({model:new s.Ay(d),panelSize:300}),computed:{active(){return r.A.activeView===this.view}},watch:{active(){this.active&&this.$refs.mainMap&&this.$refs.mainMap.fixSize()}},methods:{panelsChange(e){this.panelSize=e.left},changecity(e){this.$refs.mainMap.delBlock(),this.$refs.mainMap.setCenterr(e)},currentzone(e){this.$refs.mainMap.cityBlockClick(e)},savezones(){"edit"===this.model.editMode?this.$refs.mainMap.submitEdit():"create"===this.model.editMode&&this.$refs.mainMap.submitCreate()},cancel(){"edit"===this.model.editMode?this.$refs.mainMap.cancelEdit():"create"===this.model.editMode&&this.$refs.mainMap.cancelCreate()},edt(){this.$refs.mainMap.editBlock()},newzone(){this.$refs.mainMap.createBlock()},delet(){this.$refs.mainMap.deleteBlock()},saverename(){this.$refs.mainMap.saveRename()}}},u=h,m=i(1656),p=(0,m.A)(u,n,a,!1,null,null,null),f=p.exports}}]);
//# sourceMappingURL=MapZones.ac6778cf.js.map