"use strict";(self["webpackChunkcarabi_x2"]=self["webpackChunkcarabi_x2"]||[]).push([[4059],{8830:function(e,t,s){s.r(t),s.d(t,{default:function(){return r}});var a=function(){var e=this,t=e._self._c;return t("Modal",{ref:"modal",attrs:{title:"Создание маршрутных листов",autoOpen:!0,fullHeight:!1},on:{closed:function(t){return e.$emit("closed")}}},[e.loaded?t("div",{staticClass:"uk-padding-small",staticStyle:{"flex-grow":"1","min-height":"1px",overflow:"auto"}},[t("table",{staticClass:"uk-table uk-table-hover uk-table-striped uk-table-condensed"},[t("tr",[t("th",{staticStyle:{width:"30px"}}),t("th",[e._v("Водитель")]),t("th",[e._v("Авто")]),t("th",{staticClass:"uk-text-center",staticStyle:{width:"125px"}},[e._v("Разгрузка"),t("br"),e._v("в день выполн.")])]),e._l(e.newRoutes,(function(s){return t("tr",{key:s.DRIVER_ID,staticClass:"new-route-row"},[t("td",{staticClass:"uk-text-center"},[t("input",{directives:[{name:"model",rawName:"v-model",value:s.checked,expression:"route.checked"}],staticClass:"check-new-route",attrs:{type:"checkbox"},domProps:{checked:Array.isArray(s.checked)?e._i(s.checked,null)>-1:s.checked},on:{change:function(t){var a=s.checked,o=t.target,c=!!o.checked;if(Array.isArray(a)){var d=null,l=e._i(a,d);o.checked?l<0&&e.$set(s,"checked",a.concat([d])):l>-1&&e.$set(s,"checked",a.slice(0,l).concat(a.slice(l+1)))}else e.$set(s,"checked",c)}}})]),t("td",[e._v(e._s(s.DRIVER_FIO))]),t("td",[e._v(e._s(s.TRANSPORT_NAME)),t("br"),e._v(e._s(s.TRANSPORT_NUM))]),t("td",{staticClass:"uk-text-center"},[t("input",{directives:[{name:"model",rawName:"v-model",value:s.unloadToday,expression:"route.unloadToday"}],staticClass:"check-unload-today",attrs:{type:"checkbox"},domProps:{checked:Array.isArray(s.unloadToday)?e._i(s.unloadToday,null)>-1:s.unloadToday},on:{change:function(t){var a=s.unloadToday,o=t.target,c=!!o.checked;if(Array.isArray(a)){var d=null,l=e._i(a,d);o.checked?l<0&&e.$set(s,"unloadToday",a.concat([d])):l>-1&&e.$set(s,"unloadToday",a.slice(0,l).concat(a.slice(l+1)))}else e.$set(s,"unloadToday",c)}}})])])}))],2),t("div",[e._v(e._s(e.total))])]):t("div",{staticClass:"uk-padding-small",staticStyle:{height:"200px",position:"relative"}},[t("Loader")],1),t("div",{staticClass:"uk-modal-footer uk-text-center"},[e.saving?t("button",{staticClass:"uk-button uk-border-rounded uk-button-success",attrs:{disabled:!0}},[e._v("Идет расстановка...")]):t("button",{staticClass:"uk-button uk-border-rounded uk-button-success",attrs:{disabled:!e.loaded||!e.selectedRoutes.length},on:{click:e.save}},[e._v("Автоматическая расстановка")])])])},o=[],c=s(3216),d={name:"LogisticAutoAssign",components:{Modal:()=>s.e(8362).then(s.bind(s,2215)),Loader:()=>s.e(8326).then(s.bind(s,1259))},data:()=>({newRoutes:null,saving:!1}),props:{model:Object},computed:{loaded(){return null!==this.newRoutes&&!this.saving},selectedRoutes(){return this.newRoutes.filter((e=>e.checked))},total(){if(!this.newRoutes.length)return"Нет доступных водителей";let e=this.selectedRoutes.length;return e>0?"Выбрано водителей: "+e+" из "+this.newRoutes.length:"Выберите водителей для создания маршрута"}},async mounted(){let e=this.model.curDeliveryWindow;e=e||0;let t=await c.vd.select("WEB_LOGISTIC_GET_DRIVER_FP_CS",{CITY_ID:this.model.curCityId,DAY:this.model.curDateTxt,G_WINDOW_ID:e,DATE_FROM:"00:00",DATE_TO:"23:59"},1e3);this.newRoutes=t.map((e=>({...e,checked:!1,unloadToday:!1})))},methods:{async save(){try{this.saving=!0;let e=this.selectedRoutes.map((e=>e.DRIVER_ID+","+e.unloadToday?"1":"0")).join(";");await c.vd.query("CREATE_TRACE_LISTS_CS",{day:this.model.curDateTxt,date_from:"00:00",date_to:"23:59",city_id:this.model.curCityId,driver_list:e}),this.$emit("save"),this.$refs.modal.close()}catch(e){throw this.saving=!1,e}}}},l=d,i=s(1656),n=(0,i.A)(l,a,o,!1,null,null,null),r=n.exports}}]);
//# sourceMappingURL=LogisticAutoAssign.2eb74f96.js.map