1"use strict";(self.webpackChunksuivo_web=self.webpackChunksuivo_web||[]).push([[5274],{1863:(O,C,m)=>{m.d(C,{m:()=>T});var t=m(73664),a=m(87531);let T=(()=>{class p{set alignRight(u){this.classes+=u?" float-end":" float-start"}constructor(u,r){this.elementRef=u,this.translation=r,this.classes="",this.element=u.nativeElement,this.element.innerText="("+this.translation.get("allpages.optional")+")",this.element.style.marginLeft="5px",this.element.style.fontSize="11px",this.element.style.textTransform="lowercase",this.element.style.fontStyle="italic"}static{this.\u0275fac=function(r){return new(r||p)(t.rXU(t.aKT),t.rXU(a.L))}}static{this.\u0275dir=t.FsC({type:p,selectors:[["","field-optional",""]],hostVars:2,hostBindings:function(r,f){2&r&&t.HbH(f.classes)},inputs:{alignRight:"alignRight"},standalone:!1})}}return p})()},75274:(O,C,m)=>{m.r(C),m.d(C,{TransportOrdersFormComponent:()=>Pt});var t=m(73664),a=m(89417),T=m(27208),p=m(50413),h=m(60516),u=m(69243),r=m(2615),f=m(5899),k=m(87531),F=m(73807),G=m(87788),$=m(52003),I=m(48926),M=m(86806),V=m(10772),P=m(44977),E=m(34098),_=m(72200),U=m(88141),x=m(55271),w=m(81738),A=m(51727),S=m(38215),B=m(97647),j=m(96354),Y=m(13803),L=m(1863),b=m(77120);const g=n=>({"has-error":n});function X(n,d){if(1&n&&(t.EFF(0),t.nI1(1,"translate")),2&n){const e=t.XpG();t.SpI(" ",t.bMT(1,1,"transport.payload.types."+e.type)," ")}}function J(n,d){1&n&&(t.j41(0,"select",4)(1,"option",8),t.EFF(2,"---"),t.k0s(),t.j41(3,"option",9),t.EFF(4),t.nI1(5,"translate"),t.k0s(),t.j41(6,"option",10),t.EFF(7),t.nI1(8,"translate"),t.k0s(),t.j41(9,"option",11),t.EFF(10),t.nI1(11,"translate"),t.k0s()()),2&n&&(t.R7$(4),t.JRh(t.bMT(5,3,"transport.payload.types.GOODS")),t.R7$(3),t.JRh(t.bMT(8,5,"transport.payload.types.CONTAINER")),t.R7$(3),t.JRh(t.bMT(11,7,"transport.payload.types.TRAILER")))}function q(n,d){if(1&n&&(t.j41(0,"div",1)(1,"label",2),t.EFF(2),t.nI1(3,"translate"),t.k0s(),t.j41(4,"div",3),t.nrm(5,"input",12),t.k0s(),t.nrm(6,"show-errors",13),t.k0s()),2&n){const e=t.XpG();t.R7$(2),t.JRh(t.bMT(3,3,"allpages.licensePlate")),t.R7$(2),t.Y8G("ngClass",t.eq3(5,g,e.submitted&&!e.licensePlate.valid)),t.R7$(2),t.Y8G("control",e.licensePlate)}}function Q(n,d){if(1&n&&(t.j41(0,"div",1)(1,"label",2),t.EFF(2),t.nI1(3,"translate"),t.k0s(),t.j41(4,"div",3),t.nrm(5,"input",14),t.k0s(),t.nrm(6,"show-errors",13),t.k0s(),t.j41(7,"div",1)(8,"span",2)(9,"label"),t.EFF(10),t.nI1(11,"translate"),t.k0s(),t.nrm(12,"span",15),t.k0s(),t.j41(13,"div",3),t.nrm(14,"input",16),t.k0s(),t.nrm(15,"show-errors",13),t.k0s()),2&n){const e=t.XpG();t.R7$(2),t.JRh(t.bMT(3,6,"transport.payload.container.containerNr")),t.R7$(2),t.Y8G("ngClass",t.eq3(10,g,e.submitted&&!e.containerNr.valid)),t.R7$(2),t.Y8G("control",e.containerNr),t.R7$(4),t.JRh(t.bMT(11,8,"transport.payload.container.sealNr")),t.R7$(3),t.Y8G("ngClass",t.eq3(12,g,e.submitted&&!e.sealNr.valid)),t.R7$(2),t.Y8G("control",e.sealNr)}}function z(n,d){if(1&n&&(t.j41(0,"option",20),t.EFF(1),t.k0s()),2&n){const e=d.$implicit;t.Y8G("value",t.mNQ(e.key)),t.R7$(),t.JRh(e.label)}}function H(n,d){if(1&n&&(t.j41(0,"option",20),t.EFF(1),t.k0s()),2&n){const e=d.$implicit;t.Y8G("value",t.mNQ(e.key)),t.R7$(),t.JRh(e.label)}}function Z(n,d){if(1&n&&(t.j41(0,"div",1)(1,"label",2),t.EFF(2),t.nI1(3,"translate"),t.k0s(),t.j41(4,"div",3),t.nrm(5,"input",17),t.k0s(),t.nrm(6,"show-errors",13),t.k0s(),t.j41(7,"div",1)(8,"label",2),t.EFF(9),t.nI1(10,"translate"),t.k0s(),t.j41(11,"div",3),t.nrm(12,"input",18),t.k0s(),t.nrm(13,"show-errors",13),t.k0s(),t.j41(14,"div",1)(15,"label",2),t.EFF(16),t.nI1(17,"translate"),t.k0s(),t.j41(18,"div",3)(19,"select",19),t.Z7z(20,z,2,3,"option",20,t.fX1),t.nI1(22,"async"),t.k0s()(),t.nrm(23,"show-errors",13),t.k0s(),t.j41(24,"div",1)(25,"label",2),t.EFF(26),t.nI1(27,"translate"),t.k0s(),t.j41(28,"div",3)(29,"select",21),t.Z7z(30,H,2,3,"option",20,t.fX1),t.nI1(32,"async"),t.k0s()(),t.nrm(33,"show-errors",13),t.k0s()),2&n){const e=t.XpG();t.R7$(2),t.JRh(t.bMT(3,12,"transport.payload.goods.description")),t.R7$(2),t.Y8G("ngClass",t.eq3(24,g,e.submitted&&!e.goodsDescription.valid)),t.R7$(2),t.Y8G("control",e.goodsDescription),t.R7$(3),t.JRh(t.bMT(10,14,"transport.payload.goods.quantity")),t.R7$(2),t.Y8G("ngClass",t.eq3(26,g,e.submitted&&!e.goodsQuantity.val
1id)),t.R7$(2),t.Y8G("control",e.goodsQuantity),t.R7$(3),t.JRh(t.bMT(17,16,"transport.payload.goods.type")),t.R7$(2),t.Y8G("ngClass",t.eq3(28,g,e.submitted&&!e.goodsType.valid)),t.R7$(2),t.Dyx(t.bMT(22,18,e.goodsPayloadTypes)),t.R7$(3),t.Y8G("control",e.goodsType),t.R7$(3),t.JRh(t.bMT(27,20,"transport.payload.goods.units")),t.R7$(2),t.Y8G("ngClass",t.eq3(30,g,e.submitted&&!e.goodsUnits.valid)),t.R7$(2),t.Dyx(t.bMT(32,22,e.goodsPayloadUnits)),t.R7$(3),t.Y8G("control",e.goodsUnits)}}function K(n,d){if(1&n&&(t.j41(0,"div",1)(1,"div",2),t.nrm(2,"input",23),t.k0s()()),2&n){const e=d.$index;t.R7$(2),t.Y8G("placeholder",t.VkB("Tag ",e+1))("formControlName",e)}}function W(n,d){if(1&n){const e=t.RV6();t.j41(0,"div",5)(1,"div",2)(2,"button",24),t.bIt("click",function(i){r.eBV(e);const o=t.XpG(2);return r.Njj(o.addTag(i))}),t.nrm(3,"i",25),t.k0s()()()}}function tt(n,d){if(1&n&&(t.j41(0,"div",1)(1,"span",2)(2,"label"),t.EFF(3),t.nI1(4,"translate"),t.k0s(),t.nrm(5,"span",15),t.k0s(),t.j41(6,"div",2)(7,"div",22),t.Z7z(8,K,3,3,"div",1,t.fX1),t.nVh(10,W,4,0,"div",5),t.k0s()()()),2&n){const e=t.XpG();t.R7$(3),t.JRh(t.bMT(4,2,"transportOrders.tags")),t.R7$(5),t.Dyx(e.tags.controls),t.R7$(2),t.vxM(e.tags.controls.length<5?10:-1)}}function et(n,d){1&n&&(t.EFF(0),t.nI1(1,"translate")),2&n&&t.SpI(" ",t.bMT(1,1,"allpages.button.add")," ")}function it(n,d){1&n&&(t.EFF(0),t.nI1(1,"translate")),2&n&&t.SpI(" ",t.bMT(1,1,"allpages.button.submit")," ")}let st=(()=>{class n{set item(e){this.inputItem=e,(0,h.b0)(this.form)||this.setInitialFormValues()}get type(){return this.form.value.payloadItemType}constructor(e){this.formBuilder=e,this.cancelled=new t.bkB,this.itemCreated=new t.bkB,this.itemUpdated=new t.bkB,this.submitted=!1}ngOnInit(){let e=[a.k0.required];this.validateContainerNumber&&e.push(this.containerNumberValidator),this.form=this.formBuilder.group({payloadItemType:["",[a.k0.required]],tags:this.formBuilder.array([]),licensePlate:[null,[a.k0.required,a.k0.maxLength(15)]],containerNr:[null,e],sealNr:null,goodsDescription:[null,a.k0.required],goodsUnits:[null,a.k0.required],goodsType:[null,a.k0.required],goodsQuantity:[null,[a.k0.required,a.k0.min(0),(0,Y.D)()]]}),this.updateControlsEnabled(null),this.payloadTypeChangesSubscription=this.form.get("payloadItemType").valueChanges.subscribe(s=>{this.updateControlsEnabled(s)}),this.setInitialFormValues()}updateControlsEnabled(e){const i="CONTAINER"===e,o="GOODS"===e;function l(c,y){y?c.enable():c.disable()}l(this.licensePlate,"TRAILER"===e),l(this.containerNr,i),l(this.sealNr,i),l(this.goodsDescription,o),l(this.goodsQuantity,o),l(this.goodsType,o),l(this.goodsUnits,o)}ngOnDestroy(){this.payloadTypeChangesSubscription.unsubscribe()}submit(e){if(e.valid){this.buttonDisabled=!0;let s=this.inputItem?this.inputItem:this.createItem(e.value.payloadItemType);switch(s.tags=this.getTags(e.value),e.value.payloadItemType){case"TRAILER":s.licensePlate=e.value.licensePlate;break;case"CONTAINER":const o=s;o.number=e.value.containerNr,o.sealNumber=e.value.sealNr;break;case"GOODS":const l=s;l.description=e.value.goodsDescription,l.quantity=e.value.goodsQuantity,l.units=e.value.goodsUnits,l.goodsType=e.value.goodsType}this.inputItem?this.itemUpdated.emit(this.inputItem):(this.itemCreated.emit(s),this.setInitialFormValues()),this.buttonDisabled=!1}else this.submitted=!0}cancelPayload(){this.cancelled.emit()}addTag(e){this.form.get("tags").push(new a.hs)}containerNumberValidator(e){return e&&e.value&&!function s(i){if(!i||""==i||11!=i.length)return!1;if(i=i.toUpperCase(),/^[A-Z]{4}\d{7}/.test(i)){let l=0;for(let c=0;c<10;c++){let y=i.substr(c,1);c<4&&(y="0123456789A?BCDEFGHIJK?LMNOPQRSTU?VWXYZ".indexOf(i.substr(c,1))),y*=Math.pow(2,c),l+=y}return"HLCU"==i.substr(0,4)&&(l-=2),l%=11,l%=10,l==i.substr(10)}return!1}(e.value)?{invalid:{value:e.value}}:null}createItem(e){switch(e){case"GOODS":return new p.QU;case"CONTAINER":return new p.rD;case"TRAILER":return new p.LJ}return null}getTags(e){let s=[];if(e.tags)for(let i of e.tags)i&&i.length>0&&s.push(i);return s.length?s:null}setInitialFormValues(){this.submitted=!1,this.form.get("payloadItemType").setValue(this.inputItem?p.d2[this.inputItem.type]:"");let e=this.form.get("tags"),i=0;this.inputItem&&this.inputItem.tags&&(i=this.inputItem.tags.length-1);for(let o=e.length-1;o>i;o--)e.removeAt(o);if(this.inputItem&&this.inputItem.tags){if(e.length<this.inputItem.tags.length)for(let l=e.length;l<this.inputItem.tags.length;l++)e.push(new a.hs);let o=0;for(let l of this.inputItem.tags)e.at(o++).setValue(l)}else 0==e.length?e.push(new a.hs(null)):e.at(0).setValue(null);if(this.inputItem)switch(this.inputItem.type){case p.d2.TRAILER:this.form.get("licensePlate").setValue(this.inputItem.licensePlate);break;case p.d2.CONTAINER:const o=this.inputItem;this.form.get("containerNr").setValue(o.number),this.form.get("sealNr").setValue(o.sealNumber);break;case p.d2.GOODS:const l=this.inputItem;this.form.get("goodsDescription").setValue(l.description),this.form.get("goodsQuantity").setValue(l.quantity),this.form.get("goodsType").setValue(l.goodsType),this.form.get("goodsUnits").setValue(l.units)}else this.form.get("licensePlate").setValue(null),this.form.get("containerNr").setValue(null),this.form.get("sealNr").setValue(null),this.form.get("goodsDescription").setValue(null),this.form.get("goodsQuantity").setValue(null),this.form.get("goodsType").setValue(null),this.form.get("goodsUnits").setValue(null)}get payloadItemType(){return this.form.get("payloadItemType")}get licensePlate(){return this.form.get("licensePlate")}
1get containerNr(){return this.form.get("containerNr")}get sealNr(){return this.form.get("sealNr")}get goodsDescription(){return this.form.get("goodsDescription")}get goodsUnits(){return this.form.get("goodsUnits")}get goodsType(){return this.form.get("goodsType")}get goodsQuantity(){return this.form.get("goodsQuantity")}get tags(){return this.form.get("tags")}static{this.\u0275fac=function(s){return new(s||n)(t.rXU(a.ze))}}static{this.\u0275cmp=t.VBU({type:n,selectors:[["payload-item-edit"]],inputs:{item:"item",goodsPayloadTypes:"goodsPayloadTypes",goodsPayloadUnits:"goodsPayloadUnits",validateContainerNumber:"validateContainerNumber"},outputs:{cancelled:"cancelled",itemCreated:"itemCreated",itemUpdated:"itemUpdated"},standalone:!1,decls:20,vars:19,consts:[[3,"ngSubmit","formGroup"],[1,"row","form-group"],[1,"col-12"],[1,"col-12",3,"ngClass"],["formControlName","payloadItemType",1,"form-select"],[1,"row"],["type","button",1,"btn","btn-secondary","btn-sm","float-start",3,"click"],["type","submit",1,"btn","btn-secondary","btn-sm","submit","float-end",3,"disabled"],["value",""],["value","GOODS"],["value","CONTAINER"],["value","TRAILER"],["type","text","formControlName","licensePlate",1,"form-control","form-control-sm"],[1,"col-md-12",3,"control"],["type","text","formControlName","containerNr",1,"form-control","form-control-sm"],["field-optional",""],["type","text","formControlName","sealNr",1,"form-control","form-control-sm"],["type","text","formControlName","goodsDescription",1,"form-control","form-control-sm"],["type","text","formControlName","goodsQuantity",1,"form-control","form-control-sm"],["formControlName","goodsType",1,"form-select"],[3,"value"],["formControlName","goodsUnits",1,"form-select"],["formArrayName","tags"],["type","text",1,"form-control","form-control-sm",3,"formControlName","placeholder"],["type","button",1,"btn","btn-secondary","btn-sm","addButton","float-end",3,"click"],[1,"fas","fa-plus"]],template:function(s,i){1&s&&(t.j41(0,"form",0),t.bIt("ngSubmit",function(){return i.submit(i.form)}),t.j41(1,"div",1)(2,"label",2),t.EFF(3),t.nI1(4,"translate"),t.k0s(),t.j41(5,"div",3),t.nVh(6,X,2,3),t.nVh(7,J,12,9,"select",4),t.k0s()(),t.nVh(8,q,7,7,"div",1),t.nVh(9,Q,16,14),t.nVh(10,Z,34,32),t.nVh(11,tt,11,4,"div",1),t.j41(12,"div",5)(13,"div",2)(14,"button",6),t.bIt("click",function(){return i.cancelPayload()}),t.EFF(15),t.nI1(16,"translate"),t.k0s(),t.j41(17,"button",7),t.nVh(18,et,2,3),t.nVh(19,it,2,3),t.k0s()()()()),2&s&&(t.Y8G("formGroup",i.form),t.R7$(3),t.JRh(t.bMT(4,13,"allpages.type")),t.R7$(2),t.Y8G("ngClass",t.eq3(17,g,i.submitted&&!i.payloadItemType.valid)),t.R7$(),t.vxM(null!=i.inputItem?6:-1),t.R7$(),t.vxM(i.inputItem?-1:7),t.R7$(),t.vxM("TRAILER"==i.type?8:-1),t.R7$(),t.vxM("CONTAINER"==i.type?9:-1),t.R7$(),t.vxM("GOODS"==i.type?10:-1),t.R7$(),t.vxM(i.type?11:-1),t.R7$(4),t.SpI(" ",t.bMT(16,15,"allpages.button.cancel")," "),t.R7$(2),t.Y8G("disabled",!i.type||i.form.invalid||i.buttonDisabled),t.R7$(),t.vxM(i.inputItem?-1:18),t.R7$(),t.vxM(i.inputItem?19:-1))},dependencies:[a.qT,a.xH,a.y7,a.me,a.wz,a.BC,a.cb,a.j4,a.JD,a.v8,I.w,L.m,_.YU,b.D,_.Jj],styles:[".itemList[_ngcontent-%COMP%]{padding:6px 12px}.addButton[_ngcontent-%COMP%]{margin:0 0 5px}"]})}}return n})();var nt=m(39061);function ot(n,d){if(1&n){const e=t.RV6();t.j41(0,"payload-list-item",10),t.bIt("edit",function(i){r.eBV(e);const o=t.XpG();return r.Njj(o.editItem(i))})("delete",function(){const i=r.eBV(e).$index,o=t.XpG();return r.Njj(o.deleteItem(i))}),t.k0s()}if(2&n){const e=d.$implicit,s=t.XpG();t.Y8G("item",e)("goodsPayloadTypes",s.historyGoodsPayloadTypes)("goodsPayloadUnits",s.historyGoodsPayloadUnits)("editable",!0)}}function rt(n,d){if(1&n){const e=t.RV6();t.j41(0,"div")(1,"payload-item-edit",11),t.bIt("cancelled",function(){r.eBV(e);const i=t.XpG();return r.Njj(i.cancelEdit())})("itemCreated",function(i){r.eBV(e);const o=t.XpG();return r.Njj(o.addPayloadItem(i))})("itemUpdated",function(i){r.eBV(e);const o=t.XpG();return r.Njj(o.itemUpdated(i))}),t.k0s()()}if(2&n){const e=t.XpG();t.R7$(),t.Y8G("item",e.selectedItem)("goodsPayloadTypes",e.goodsPayloadTypes)("goodsPayloadUnits",e.goodsPayloadUnits)("validateContainerNumber",e.validateContainerNumber)}}let at=(()=>{class n{constructor(e,s){this.translation=e,this.transportService=s,this.onSubmit=new t.bkB,this.empties=!1,this.formVisible=!1;let i=this.transportService.getCustomerConfig().pipe((0,B.u)());this.goodsPayloadTypes=i.pipe((0,j.T)(o=>o.goodsPayloadTypes)),this.goodsPayloadUnits=i.pipe((0,j.T)(o=>o.goodsPayloadUnits))}createNewItem(e){this.selectedItem=null,this.formVisible=!0}editItem(e){this.selectedItem=e,this.formVisible=!0}cancelEdit(){this.formVisible=!1}deleteItem(e){let s=this.payload.items[e];confirm(this.translation.get("allpages.list.confirmdelete"))&&(null!=s.id?this.transportService.deletePayload(s.id,this.tripI
1d,this.driveId).subscribe(()=>{this.payload.items.splice(e,1)}):this.payload.items.splice(e,1))}itemUpdated(e){this.formVisible=!1}addPayloadItem(e){this.payload.items.push(e),this.selectedItem=null}static{this.\u0275fac=function(s){return new(s||n)(t.rXU(k.L),t.rXU(f.g))}}static{this.\u0275cmp=t.VBU({type:n,selectors:[["payload-form"]],inputs:{payload:"payload",empties:"empties",tripId:"tripId",driveId:"driveId",historyGoodsPayloadTypes:"historyGoodsPayloadTypes",historyGoodsPayloadUnits:"historyGoodsPayloadUnits",validateContainerNumber:"validateContainerNumber"},outputs:{onSubmit:"onSubmit"},standalone:!1,decls:16,vars:4,consts:[[1,"row"],[1,"col-md-6","itemAddList"],[1,"col-9"],[1,"col-3"],["type","button",1,"btn","btn-secondary","btn-sm","float-end","addButton",3,"click"],[1,"fas","fa-plus"],[1,"col-12"],[1,"form-control","itemList"],[3,"item","goodsPayloadTypes","goodsPayloadUnits","editable"],[1,"col-md-6"],[3,"edit","delete","item","goodsPayloadTypes","goodsPayloadUnits","editable"],[3,"cancelled","itemCreated","itemUpdated","item","goodsPayloadTypes","goodsPayloadUnits","validateContainerNumber"]],template:function(s,i){1&s&&(t.j41(0,"div",0)(1,"div",1)(2,"div",0)(3,"label",2),t.EFF(4),t.nI1(5,"translate"),t.k0s(),t.j41(6,"div",3)(7,"button",4),t.bIt("click",function(l){return i.createNewItem(l)}),t.nrm(8,"i",5),t.k0s()()(),t.j41(9,"div",0)(10,"div",6)(11,"div",7),t.Z7z(12,ot,1,4,"payload-list-item",8,t.fX1),t.k0s()()()(),t.j41(14,"div",9),t.nVh(15,rt,2,4,"div"),t.k0s()()),2&s&&(t.R7$(4),t.JRh(t.bMT(5,2,i.empties?"transportOrders.empties":"transportOrders.payload")),t.R7$(8),t.Dyx(i.payload.items),t.R7$(3),t.vxM(i.formVisible?15:-1))},dependencies:[st,nt.j,b.D],styles:[".form-control.itemList[_ngcontent-%COMP%]{height:268px;overflow-y:auto}.itemAddList[_ngcontent-%COMP%] .addButton[_ngcontent-%COMP%]{margin:0 0 5px}"]})}}return n})();const R=n=>({active:n}),N=n=>({active:n}),v=n=>({"has-error":n});function lt(n,d){1&n&&(t.EFF(0),t.nI1(1,"translate")),2&n&&t.SpI(" ",t.bMT(1,1,"transportOrders.drive.edit")," ")}function dt(n,d){1&n&&(t.EFF(0),t.nI1(1,"translate")),2&n&&t.SpI(" ",t.bMT(1,1,"transportOrders.drive.new")," ")}function mt(n,d){if(1&n){const e=t.RV6();t.j41(0,"li",2),t.bIt("click",function(){r.eBV(e);const i=t.XpG();return r.Njj(i.visibleTab="empties")}),t.j41(1,"a",3),t.EFF(2),t.nI1(3,"translate"),t.k0s()()}if(2&n){const e=t.XpG();t.Y8G("ngClass",t.eq3(4,R,"empties"===e.visibleTab)),t.R7$(2),t.JRh(t.bMT(3,2,"transportOrders.empties"))}}function pt(n,d){if(1&n){const e=t.RV6();t.j41(0,"div")(1,"div",6)(2,"div",10)(3,"div",11)(4,"button",12),t.bIt("click",function(){r.eBV(e);const i=t.XpG();return r.Njj(i.setDelivery(!1))}),t.EFF(5),t.nI1(6,"translate"),t.k0s(),t.j41(7,"button",12),t.bIt("click",function(){r.eBV(e);const i=t.XpG();return r.Njj(i.setDelivery(!0))}),t.EFF(8),t.nI1(9,"translate"),t.k0s()(),t.j41(10,"div",13)(11,"label",7),t.EFF(12),t.nI1(13,"translate"),t.nrm(14,"span",14),t.k0s(),t.j41(15,"div",15),t.nrm(16,"input",16),t.k0s()(),t.j41(17,"div",6)(18,"label",7),t.EFF(19),t.nI1(20,"translate"),t.nrm(21,"span",14),t.k0s()(),t.j41(22,"div",13)(23,"div",15),t.nrm(24,"geocoder",17),t.k0s()(),t.j41(25,"div",6)(26,"label",7),t.EFF(27),t.nI1(28,"translate"),t.k0s(),t.j41(29,"div",15),t.nrm(30,"date-input",18),t.k0s()(),t.j41(31,"div",6)(32,"label",7),t.EFF(33),t.nI1(34,"translate"),t.k0s(),t.j41(35,"div",15)(36,"div",19),t.nrm(37,"input",20),t.j41(38,"div",21),t.EFF(39),t.nI1(40,"translate"),t.k0s()()()()(),t.j41(41,"div",10)(42,"div",22)(43,"h3"),t.EFF(44),t.nI1(45,"translate"),t.k0s(),t.j41(46,"div",13)(47,"label",7),t.EFF(48),t.nI1(49,"translate"),t.nrm(50,"span",14),t.k0s(),t.j41(51,"div",15),t.nrm(52,"input",23),t.k0s()(),t.j41(53,"div",13)(54,"label",7),t.EFF(55),t.nI1(56,"translate"),t.k0s(),t.j41(57,"div",15),t.nrm(58,"input",24)(59,"show-errors",25),t.k0s()(),t.j41(60,"div",13)(61,"label",7),t.EFF(62),t.nI1(63,"translate"),t.k0s(),t.j41(64,"div",15),t.nrm(65,"input",26),t.k0s()()(),t.j41(66,"h3"),t.EFF(67),t.nI1(68,"translate"),t.k0s(),t.j41(69,"div",13)(70,"label",7),t.EFF(71),t.nI1(72,"translate"),t.k0s(),t.j41(73,"div",15),t.nrm(74,"input",27),t.k0s()(),t.j41(75,"div",13)(76,"label",7),t.EFF(77),t.nI1(78,"translate"),t.k0s(),t.j41(79,"div",7)(80,"div",6)(81,"label",7)(82,"input",28),t.bIt("change",function(){r.eBV(e);const i=t.XpG();
1return r.Njj(i.toggleUseDestinationAddress())}),t.k0s(),t.EFF(83),t.nI1(84,"translate"),t.k0s()(),t.j41(85,"div",6)(86,"label",29)(87,"input",28),t.bIt("change",function(){r.eBV(e);const i=t.XpG();return r.Njj(i.toggleUseDestinationAddress())}),t.k0s()(),t.j41(88,"div",30),t.nrm(89,"input",31),t.k0s()()()(),t.j41(90,"h3"),t.EFF(91),t.nI1(92,"translate"),t.k0s(),t.j41(93,"div",6)(94,"div",15),t.nrm(95,"textarea",32),t.k0s()()()()()}if(2&n){const e=t.XpG();t.R7$(4),t.Y8G("ngClass",t.eq3(66,N,!e.isDelivery)),t.R7$(),t.SpI(" ",t.bMT(6,34,"transportOrders.type.pickup")," "),t.R7$(2),t.Y8G("ngClass",t.eq3(68,N,e.isDelivery)),t.R7$(),t.SpI(" ",t.bMT(9,36,"transportOrders.type.delivery")," "),t.R7$(4),t.SpI(" ",t.bMT(13,38,"allpages.description")," "),t.R7$(3),t.Y8G("ngClass",t.eq3(70,v,e.submitted&&!e.description.valid)),t.R7$(4),t.SpI(" ",t.bMT(20,40,"allpages.destination")," "),t.R7$(4),t.Y8G("ngClass",t.eq3(72,v,e.submitted&&!e.destination.valid)),t.R7$(),t.Y8G("extended",!0),t.R7$(3),t.JRh(t.bMT(28,42,"transportOrders.drive.expectedArrival")),t.R7$(2),t.Y8G("ngClass",t.eq3(74,v,e.submitted&&!e.expectedArrival.valid)),t.R7$(),t.Y8G("includeTime",!0)("optional",!0),t.R7$(3),t.JRh(t.bMT(34,44,"allpages.distance")),t.R7$(2),t.Y8G("ngClass",t.eq3(76,v,e.submitted&&!e.distance.valid)),t.R7$(4),t.SpI(" ",t.bMT(40,46,"kilometers"==e.distanceUnit?"allpages.unit.kilometers.short":"allpages.unit.miles.short")," "),t.R7$(5),t.JRh(t.bMT(45,48,"transportOrders.info.customer")),t.R7$(4),t.SpI(" ",t.bMT(49,50,"allpages.name")," "),t.R7$(3),t.Y8G("ngClass",t.eq3(78,v,e.submitted&&!e.customerName.valid)),t.R7$(4),t.JRh(t.bMT(56,52,"allpages.form.email")),t.R7$(2),t.Y8G("ngClass",t.eq3(80,v,e.submitted&&!e.customerEmail.valid)),t.R7$(2),t.Y8G("control",e.form.get("customer").get("email")),t.R7$(3),t.JRh(t.bMT(63,54,"transportOrders.remarks")),t.R7$(2),t.Y8G("ngClass",t.eq3(82,v,e.submitted&&!e.customerRemarks.valid)),t.R7$(3),t.JRh(t.bMT(68,56,"transportOrders.info.invoice")),t.R7$(4),t.JRh(t.bMT(72,58,"allpages.name")),t.R7$(2),t.Y8G("ngClass",t.eq3(84,v,e.submitted&&!e.invoiceName.valid)),t.R7$(4),t.JRh(t.bMT(78,60,"allpages.form.address")),t.R7$(5),t.Y8G("value",!0),t.R7$(),t.SpI(" ",t.bMT(84,62,"transportOrders.invoice.destinationAddress")," "),t.R7$(4),t.Y8G("value",!1),t.R7$(),t.Y8G("ngClass",t.eq3(86,v,e.submitted&&!e.invoiceAddress.valid&&!e.invoiceAddress.disabled)),t.R7$(3),t.JRh(t.bMT(92,64,"allpages.comment")),t.R7$(3),t.Y8G("ngClass",t.eq3(88,v,e.submitted&&!e.comment.valid))}}function ct(n,d){if(1&n&&(t.j41(0,"div"),t.nrm(1,"payload-form",33),t.k0s()),2&n){const e=t.XpG();t.R7$(),t.Y8G("payload",e.payload)("tripId",e.tripId)("driveId",e.drive?e.drive.id:null)("historyGoodsPayloadTypes",e.historyGoodsPayloadTypes)("historyGoodsPayloadUnits",e.historyGoodsPayloadUnits)("validateContainerNumber",e.validateContainerNumber)}}function ut(n,d){if(1&n&&(t.j41(0,"div"),t.nrm(1,"payload-form",34),t.k0s()),2&n){const e=t.XpG();t.R7$(),t.Y8G("payload",e.empties)("empties",!0)("tripId",e.tripId)("driveId",e.drive?e.drive.id:null)("historyGoodsPayloadTypes",e.historyGoodsPayloadTypes)("historyGoodsPayloadUnits",e.historyGoodsPayloadUnits)("validateContainerNumber",e.validateContainerNumber)}}function vt(n,d){1&n&&(t.EFF(0),t.nI1(1,"translate")),2&n&&t.SpI(" ",t.bMT(1,1,"allpages.button.submit")," ")}function ht(n,d){1&n&&(t.EFF(0),t.nI1(1,"translate")),2&n&&t.SpI(" ",t.bMT(1,1,"allpages.button.add")," ")}let gt=(()=>{class n{set drive(e){this._drive=e,this.resetDrive(),this.initFormValues()}get drive(){return this._drive}constructor(e,s,i,o,l){this.fb=e,this.locationService=s,this.transportOrdersService=i,this.permissionService=o,this.geocodingService=l,this.onNewDrive=new t.bkB,this.onDriveUpdate=new t.bkB,this.onCancel=new t.bkB,this.visibleTab="general",this.isDelivery=!0,this.showEmptiesTab=!1,this.driveType=p.xH,this.submitted=!1,this.form=this.fb.group({description:[null,[a.k0.required]],destination:[null,a.k0.required],expectedArrival:[null,[]],distance:[null,[a.k0.min(0)]],customer:this.fb.group({name:[null,[a.k0.required]],email:[null,[this.customEmailValidator]],remarks:null}),invoiceName:[null,[]],invoiceAddress:null,invoiceUseDestinationAddress:!0,comment:[null,[]]}),this.transportOrdersService.getCustomerConfig().subscribe(c=>{this.showEmptiesTab=c.hasEmpties,this.historyGoodsPayloadTypes=c.historyGoodsPayloadTypes,this.historyGoodsPayloadUnits=c.historyGoodsPayloadUnits,this.validateContainerNumber=c.validateContainerNumbers}),this.distanceUnit=this.permissionService.getPreference("distance_unit")}get description(){return this.form.get("description")}get expectedArrival(){return this.form.get("expectedArrival")}get distance(){return this.form.get("distance")}get customerName(){return this.form.get("customer.name")}get customerEmail(){return this.form.get("customer.email")}get customerRemarks(){return this.form.get("customer.remarks")}get invoiceName(){return this.form.get("invoiceName")}get invoiceAddress(){return this.form.get("invoiceAddress")}get comment(){return this.form.get("comment")}get destination(){return this.form.get("destination")}get valid(){return this.form.valid}ngOnDestroy(){}initFormValues(){if(this.destinationChangedSubscription&&this.destinationChangedSubscription.unsubscribe(),this._drive){this.description.setValue(this._drive.de
1scription),this.expectedArrival.setValue(this._drive.expectedArrival),this.destination.setValue(this._drive.destination),this.distance.setValue(this._drive.distance),this.form.get("customer").setValue({name:this.customer.name?this.customer.name:null,email:this.customer.email?this.customer.email:null,remarks:this.customer.remarks?this.customer.remarks:null}),this.invoiceName.setValue(this.invoice.name),this.comment.setValue(this._drive.comment);const e=this.getAddressString(this._drive.destination),s=(0,h.b0)(this.invoice.address)||this.invoice.address&&this.invoice.address===e;this.form.get("invoiceUseDestinationAddress").setValue(s),this.form.get("invoiceUseDestinationAddress").value?this.invoiceAddress.disable():this.invoiceAddress.setValue(this.invoice.address),this._drive.expectedArrival&&this.expectedArrival.setValue(new Date(this._drive.expectedArrival)),this._drive.canEditDestination?this.destination.enable():this.destination.disable()}else this.form.reset(),this.form.get("invoiceUseDestinationAddress").setValue(!0),this.invoiceAddress.disable();this.destinationChangedSubscription=this.destination.valueChanges.pipe((0,U.M)(()=>this.updateInvoiceDestination())).subscribe(e=>this.updateCustomerInfo(e))}cancelDriveEdit(){this.resetDrive(),this.onCancel.emit()}resetDrive(){function e(i){const o=new p.Tt;if(o.items=[],i&&i.items.length>0)for(const l of i.items)"string"==typeof l.type&&(l.type=p.d2[l.type]),o.items.push(s(l));return o}function s(i){switch(i.type){case p.d2.GOODS:return Object.assign(new p.QU,i);case p.d2.CONTAINER:return Object.assign(new p.rD,i);case p.d2.TRAILER:return Object.assign(new p.LJ,i)}}this._drive?(this.isDelivery=("string"==typeof this._drive.type?this.driveType[this._drive.type]:this._drive.type)===p.xH.DELIVERY,this.customer=this._drive.customer,this.payload=e(this._drive.payload),this.empties=e(this._drive.empties),this.invoice=this._drive.invoice):(this.isDelivery=!0,this.customer=new p.nD,this.payload=new p.Tt,this.payload.items=[],this.empties=new p.Tt,this.empties.items=[],this.invoice=new p.qO),this.submitted=!1}submit(e){if(this.submitted=!0,e.valid){this.buttonDisabled=!0;const s=this._drive?this._drive:new p.fq;s.type=this.isDelivery?p.xH.DELIVERY:p.xH.PICKUP,s.description=e.value.description,s.expectedArrival=this.form.value.expectedArrival,s.distance=this.form.value.distance,s.customer=this.customer,s.customer.name=this.form.value.customer.name,s.customer.email=this.form.value.customer.email,s.customer.remarks=this.form.value.customer.remarks,s.invoice=this.invoice,s.invoice.name=this.form.value.invoiceName;const i=this.getAddressString(this.destination.value);s.invoice.address=this.form.get("invoiceUseDestinationAddress").value?i:this.form.value.invoiceAddress,s.comment=this.form.value.comment,s.payload=this.payload,s.empties=this.empties,s.destination=this.destination.value,s.destination.coordinate||(s.destination.coordinate=this.destination.value.address.coordinate),s.destination.address=i,this._drive?this.onDriveUpdate.emit(s):this.onNewDrive.emit(s),this.buttonDisabled=!1}}updateCustomerInfo(e){if(!e)return;const s=this.form.get("customer").value;e.locationId&&(!s||!s.name&&!s.email&&!s.remarks)&&this.locationService.getLocation(e.locationId).subscribe(o=>{this.customerName.setValue(o.contact?o.contact:o.description),this.invoiceName.value||this.invoiceName.setValue(this.customerName.value),this.customerEmail.setValue(o.email),this.customerRemarks.setValue(o.comment1)})}toggleUseDestinationAddress(){if(this.form.get("invoiceUseDestinationAddress").value){if(this.destination.value){const s=this.getAddressString(this.destination.value);this.invoiceAddress.setValue(s)}this.invoiceAddress.disable()}else this.invoiceAddress.enable(),this.invoiceAddress.setValue("")}updateInvoiceDestination(){if(this.form.get("invoiceUseDestinationAddress").value){const e=this.getAddressString(this.destination.value);this.invoiceAddress.setValue(e)}}setDelivery(e){this.isDelivery=e}getAddressString(e){return"string"==typeof e.address?e.address:this.geocodingService.toAddressString(e.address)}customEmailValidator(e){return e.value?(0,w.B)(e):null}static{this.\u0275fac=function(s){return new(s||n)(t.rXU(a.ze),t.rXU(A.N),t.rXU(f.g),t.rXU(F.n),t.rXU(S.l))}}static{this.\u0275cmp=t.VBU({type:n,selectors:[["drive-form"]],viewQuery:function(s,i){if
1(1&s&&t.GBs(x.w,5),2&s){let o;t.mGM(o=t.lsd())&&(i.geocoder=o.first)}},inputs:{tripId:"tripId",drive:"drive"},outputs:{onNewDrive:"onNewDrive",onDriveUpdate:"onDriveUpdate",onCancel:"onCancel"},standalone:!1,decls:26,vars:26,consts:[[3,"ngSubmit","formGroup"],[1,"nav","nav-tabs"],[1,"nav-item",3,"click","ngClass"],[1,"nav-link"],[1,"nav-item",3,"ngClass"],[1,"container-fluid","driveFormContent"],[1,"row"],[1,"col-12"],["type","button",1,"btn","btn-secondary","btn-sm","float-start",3,"click","disabled"],["type","submit",1,"btn","btn-secondary","btn-sm","submit","float-end",3,"disabled"],[1,"col-md-6","col-12"],["role","group",1,"btn-group","driveTypeButtons"],["type","button",1,"btn","btn-secondary","btn-sm","col-6",3,"click","ngClass"],[1,"row","form-group"],["field-required",""],[1,"col-12",3,"ngClass"],["type","text","formControlName","description","required","",1,"form-control-sm","form-control"],["formControlName","destination",3,"extended"],["formControlName","expectedArrival",3,"includeTime","optional"],[1,"input-group","input-group-sm"],["type","number","min","0","formControlName","distance",1,"form-control-sm","form-control"],[1,"input-group-text","form-control-sm"],["formGroupName","customer"],["type","text","formControlName","name",1,"form-control-sm","form-control"],["type","text","formControlName","email",1,"form-control-sm","form-control"],[3,"control"],["type","text","formControlName","remarks",1,"form-control-sm","form-control"],["type","text","formControlName","invoiceName",1,"form-control-sm","form-control"],["type","radio","formControlName","invoiceUseDestinationAddress",3,"change","value"],[1,"col-1"],[1,"col-11",3,"ngClass"],["type","text","formControlName","invoiceAddress",1,"form-control-sm","form-control"],["name","comment","formControlName","comment","rows","4",1,"form-control-sm","form-control"],[3,"payload","tripId","driveId","historyGoodsPayloadTypes","historyGoodsPayloadUnits","validateContainerNumber"],[3,"payload","empties","tripId","driveId","historyGoodsPayloadTypes","historyGoodsPayloadUnits","validateContainerNumber"]],template:function(s,i){1&s&&(t.j41(0,"form",0),t.bIt("ngSubmit",function(){return i.submit(i.form)}),t.j41(1,"h3"),t.nVh(2,lt,2,3),t.nVh(3,dt,2,3),t.k0s(),t.j41(4,"ul",1)(5,"li",2),t.bIt("click",function(){return i.visibleTab="general"}),t.j41(6,"a",3),t.EFF(7),t.nI1(8,"translate"),t.k0s()(),t.j41(9,"li",2),t.bIt("click",function(){return i.visibleTab="payload"}),t.j41(10,"a",3),t.EFF(11),t.nI1(12,"translate"),t.k0s()(),t.nVh(13,mt,4,6,"li",4),t.k0s(),t.j41(14,"div",5),t.nVh(15,pt,96,90,"div"),t.nVh(16,ct,2,6,"div"),t.nVh(17,ut,2,7,"div"),t.k0s(),t.j41(18,"div",6)(19,"div",7)(20,"button",8),t.bIt("click",function(){return i.cancelDriveEdit()}),t.EFF(21),t.nI1(22,"translate"),t.k0s(),t.j41(23,"button",9),t.nVh(24,vt,2,3),t.nVh(25,ht,2,3),t.k0s()()()()),2&s&&(t.Y8G("formGroup",i.form),t.R7$(2),t.vxM(i.tripId?2:-1),t.R7$(),t.vxM(i.tripId?-1:3),t.R7$(2),t.Y8G("ngClass",t.eq3(22,R,"general"===i.visibleTab)),t.R7$(2),t.JRh(t.bMT(8,16,"allpages.general")),t.R7$(2),t.Y8G("ngClass",t.eq3(24,R,"payload"===i.visibleTab)),t.R7$(2),t.JRh(t.bMT(12,18,"transportOrders.payload")),t.R7$(2),t.vxM(i.showEmptiesTab?13:-1),t.R7$(2),t.vxM("general"===i.visibleTab?15:-1),t.R7$(),t.vxM("payload"===i.visibleTab?16:-1),t.R7$(),t.vxM("empties"===i.visibleTab?17:-1),t.R7$(3),t.Y8G("disabled","general"!==i.visibleTab),t.R7$(),t.SpI(" ",t.bMT(22,20,i.tripId?"allpages.button.close":"allpages.button.cancel")," "),t.R7$(2),t.Y8G("disabled","general"!==i.visibleTab||!i.form.valid||i.buttonDisabled),t.R7$(),t.vxM(i.drive?24:-1),t.R7$(),t.vxM(i.drive?-1:25))},dependencies:[a.qT,a.me,a.Q0,a.Fm,a.BC,a.cb,a.YS,a.VZ,a.j4,a.JD,a.$R,I.w,P.G,E.T,_.YU,x.w,at,b.D],styles:[".driveFormContent[_ngcontent-%COMP%]{border:1px solid var(--colors-general-soft-grey);border-top:none;padding-top:10px;padding-bottom:10px}.driveFormContent[_ngcontent-%COMP%] .driveTypeButtons[_ngcontent-%COMP%]{width:100%}.driveFormContent[_ngcontent-%COMP%] .addButton[_ngcontent-%COMP%]{margin:0 0 5px}.driveFormContent[_ngcontent-%COMP%] .itemAddList[_ngcontent-%COMP%]{margin-top:10px}.driveFormContent[_ngcontent-%COMP%] .itemList[_ngcontent-%COMP%]{height:150px}[_nghost-%COMP%] .nav[_ngcontent-%COMP%]{margin:0}"]})}}return n})();
1const ft=n=>({selected:n});function _t(n,d){1&n&&(t.j41(0,"div",5),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&n&&(t.R7$(),t.SpI(" ",t.bMT(2,1,"transportOrders.type.pickup")," "))}function bt(n,d){1&n&&(t.j41(0,"div",5),t.EFF(1),t.nI1(2,"translate"),t.k0s()),2&n&&(t.R7$(),t.SpI(" ",t.bMT(2,1,"transportOrders.type.delivery")," "))}function yt(n,d){if(1&n&&(t.j41(0,"span"),t.EFF(1),t.k0s()),2&n){const e=t.XpG();t.R7$(),t.SpI(" \xa0-\xa0",e.drive.destination.name," ")}}function Ct(n,d){if(1&n){const e=t.RV6();t.j41(0,"i",9),t.nI1(1,"translate"),t.bIt("click",function(i){r.eBV(e);const o=t.XpG();return r.Njj(o.onDelete(i))}),t.k0s()}2&n&&t.Y8G("title",t.mNQ(t.bMT(1,2,"allpages.button.delete")))}function Tt(n,d){if(1&n){const e=t.RV6();t.j41(0,"i",10),t.nI1(1,"translate"),t.bIt("click",function(i){r.eBV(e);const o=t.XpG();return r.Njj(o.onEdit(i))}),t.k0s()}2&n&&t.Y8G("title",t.mNQ(t.bMT(1,2,"allpages.button.edit")))}let It=(()=>{class n{constructor(){this.delete=new t.bkB,this.edit=new t.bkB,this.moveUp=new t.bkB,this.moveDown=new t.bkB,this.actionsVisible=!1}ngOnInit(){}onEdit(e){this.edit.emit(this.drive)}onDelete(e){this.delete.emit()}onMoveUp(){this.moveUp.emit(this.drive)}onMoveDown(){this.moveDown.emit(this.drive)}toggleActions(e){this.actionsVisible=!this.selected&&e}isPickup(){return("string"==typeof this.drive.type?p.xH[this.drive.type]:this.drive.type)===p.xH.PICKUP}static{this.\u0275fac=function(s){return new(s||n)}}static{this.\u0275cmp=t.VBU({type:n,selectors:[["drive-list-item"]],inputs:{drive:"drive",index:"index",selected:"selected"},outputs:{delete:"delete",edit:"edit",moveUp:"moveUp",moveDown:"moveDown"},standalone:!1,decls:15,vars:14,consts:[[1,"driveListItem",3,"mouseenter","mouseleave","ngClass"],[1,"fa","fa-grip-vertical","action"],[1,"drive"],[1,"driveTitle"],[1,"driveDescription"],[1,"float-end"],[1,"driveInfo"],[1,"fas","fa-trash-alt","action","fa-pull-right",3,"title"],[1,"fas","fa-pen","action","fa-pull-right",3,"title"],[1,"fas","fa-trash-alt","action","fa-pull-right",3,"click","title"],[1,"fas","fa-pen","action","fa-pull-right",3,"click","title"]],template:function(s,i){1&s&&(t.j41(0,"div",0),t.bIt("mouseenter",function(){return i.toggleActions(!0)})("mouseleave",function(){return i.toggleActions(!1)}),t.nrm(1,"i",1),t.j41(2,"div",2)(3,"div",3)(4,"h3")(5,"div",4),t.EFF(6),t.nI1(7,"translate"),t.k0s(),t.nVh(8,_t,3,3,"div",5),t.nVh(9,bt,3,3,"div",5),t.k0s()(),t.j41(10,"div",6),t.EFF(11),t.nVh(12,yt,2,1,"span"),t.nVh(13,Ct,2,4,"
1i",7),t.nVh(14,Tt,2,4,"i",8),t.k0s()()()),2&s&&(t.Y8G("ngClass",t.eq3(12,ft,i.selected)),t.R7$(6),t.E5c(" ",t.bMT(7,10,"transportOrders.drive")," ",i.index+1,": ",i.drive.description," "),t.R7$(2),t.vxM(i.isPickup()?8:-1),t.R7$(),t.vxM(i.isPickup()?-1:9),t.R7$(2),t.SpI(" ",i.drive.customer.name," "),t.R7$(),t.vxM(i.drive.destination.name&&i.drive.destination.name!=i.drive.customer.name?12:-1),t.R7$(),t.vxM(i.drive.canDelete?13:-1),t.R7$(),t.vxM(i.drive.canEdit?14:-1))},dependencies:[_.YU,b.D],styles:[".driveListItem[_ngcontent-%COMP%]{display:flex}.driveListItem[_ngcontent-%COMP%] .drive[_ngcontent-%COMP%]{flex:1}.selected[_ngcontent-%COMP%]{background-color:var(--colors-attention-soft)}h3[_ngcontent-%COMP%]{padding:0!important;border:none!important;margin-bottom:0!important;display:flex;width:100%;margin-top:0}.driveTitle[_ngcontent-%COMP%]{margin-bottom:5px!important}.driveTitle[_ngcontent-%COMP%] .driveDescription[_ngcontent-%COMP%]{flex:1}.driveTitle[_ngcontent-%COMP%]{align-items:center;display:flex}.fa-grip-vertical[_ngcontent-%COMP%]{cursor:move!important;align-self:center}.fa-grip-vertical[_ngcontent-%COMP%]{padding-right:8px;color:var(--colors-general-soft-grey)!important;z-index:2}.cdk-drag-preview[_ngcontent-%COMP%]{background-color:#000!important}"]})}}return n})();const D=n=>({"has-error":n});function Rt(n,d){1&n&&(t.j41(0,"div",25),t.nrm(1,"div",26),t.k0s())}function Dt(n,d){if(1&n){const e=t.RV6();t.j41(0,"div",22),t.DNE(1,Rt,2,0,"div",23),t.j41(2,"drive-list-item",24),t.bIt("edit",function(i){r.eBV(e);const o=t.XpG(2);return r.Njj(o.editDrive(i))})("delete",function(){const i=r.eBV(e).$index,o=t.XpG(2);return r.Njj(o.deleteDrive(i))})("moveDown",function(i){r.eBV(e);const o=t.XpG(2);return r.Njj(o.moveDown(i))})("moveUp",function(i){r.eBV(e);const o=t.XpG(2);return r.Njj(o.moveUp(i))}),t.k0s()()}if(2&n){const e=d.$implicit,s=d.$index,i=d.$count,o=t.XpG(2);t.AVh("notLast",s!==i-1),t.R7$(2),t.Y8G("drive",e)("selected",o.selectedDrive===e)("index",s)}}function kt(n,d){if(1&n){const e=t.RV6();t.j41(0,"drive-form",27),t.bIt("onCancel",function(){r.eBV(e);const i=t.XpG(2);return r.Njj(i.cancelDrive())})("onNewDrive",function(i){r.eBV(e);const o=t.XpG(2);return r.Njj(o.addDrive(i))})("onDriveUpdate",function(i){r.eBV(e);const o=t.XpG(2);return r.Njj(o.driveUpdated(i))}),t.k0s()}if(2&n){const e=t.XpG(2);t.Y8G("tripId",e.trip?e.trip.id:null)("drive",e.selectedDrive)}}function Ft(n,d){if(1&n){const e=t.RV6();t.j41(0,"form",0)(1,"div",1)(2,"h3"),t.EFF(3),t.nI1(4,"translate"),t.k0s(),t.j41(5,"div",2)(6,"label",3),t.EFF(7),t.nI1(8,"translate"),t.k0s(),t.j41(9,"div",4),t.nrm(10,"entity-search-box",5),t.k0s()(),t.j41(11,"div",2)(12,"span",3)(13,"label"),t.EFF(14),t.nI1(15,"translate"),t.k0s(),t.nrm(16,"span",6),t.k0s(),t.j41(17,"div",4),t.nrm(18,"input",7)(19,"show-errors",8),t.k0s()(),t.j41(20,"div",2)(21,"label",3),t.EFF(22),t.nI1(23,"translate"),t.k0s(),t.j41(24,"div",4),t.nrm(25,"date-input",9),t.k0s(),t.nrm(26,"show-errors",10),t.k0s(),t.j41(27,"div",11)(28,"div",3)(29,"div",12)(30,"label",13),t.EFF(31),t.nI1(32,"translate"),t.k0s(),t.j41(33,"div",14)(34,"button",15),t.bIt("click",function(){r.eBV(e);const i=t.XpG();return r.Njj(i.addNewDrive())}),t.nrm(35,"i",16),t.k0s()()(),t.j41(36,"div",17),t.bIt("cdkDropListDropped",function(i){r.eBV(e);const o=t.XpG();return r.Njj(o.drop(i))}),t.Z7z(37,Dt,3,5,"div",18,t.fX1),t.k0s()()(),t.j41(39,"div",12)(40,"div",3)(41,"success-submit-button",19),t.bIt("onButtonClick",function(){r.eBV(e);const i=t.XpG();return r.Njj(i.saveTransportOrder())}),t.k0s()()()(),t.j41(42,"div",20),t.nVh(43,kt,1,2,"drive-form",21),t.k0s()()}if(2&n){const e=t.XpG();t.Y8G("formGroup",e.form),t.R7$(3),t.JRh(t.bMT(4,18,e.editTrip?"transportOrders.trip.edit":"transportOrders.trip.new")),t.R7$(4),t.JRh(t.bMT(8,20,"allpages.unit")),t.R7$(2),t.Y8G("ngClass",t.eq3(28,D,e.submitted&&!e.assetId.valid)),t.R7$(),t.Y8G("extended",!1)("options",e.entityOptions),t.R7$(4),t.JRh(t.bMT(15,22,"allpages.description")),t.R7$(3),t.Y8G("ngClass",t.eq3(30,D,e.submitted&&!e.description.valid)),t.R7$(2),t.Y8G("control",e.description),t.R7$(3),t.JRh(t.bMT(23,24,"allpages.date")),t.R7$(2),t.Y8G("ngClass",t.eq3(32,D,e.submitted&&!e.executionDate.valid)),t.R7$(2),t.Y8G("control",e.executionDate),t.R7$(5),t.JRh(t.bMT(32,26,"dayReport.form.drives")),t.R7$(6),t.Dyx(e.drives),t.R7$(4),t.Y8G("success",e.success)("failed",e.failed)("alignRight",!0)("buttonDisabled",e.showDriveForm||e.form.invali
1d||!!e.success||e.buttonDisabled),t.R7$(2),t.vxM(e.showDriveForm?43:-1)}}let Pt=(()=>{class n{set trip(e){this._trip=e,this.resetTrip()}get trip(){return this._trip}set editTrip(e){null!=e?this.setupEditForm(e):null!=this.editTrip&&(this.trip=null),this._editTrip=e}get editTrip(){return this._editTrip}constructor(e,s,i,o,l,c){this.fb=e,this.transportService=s,this.translation=i,this.permissionService=o,this.sortService=l,this.globalEvents=c,this.valuesChanged=!1,this.onSubmit=new t.bkB,this.submitted=!1,this.showDriveForm=!1,this.success=!1,this.permissions=new Map}ngOnInit(){this.transportService.getAvailableUnits().subscribe(e=>{this.entityOptions={entities:e.units,groups:e.groups,entityType:T.cm.VEHICLES,addNoGroup:!0,emptyOption:"allpages.none",bigLayout:!0}}),this.permissions=new Map([["TRANSPORT_ORDER_ADD",1==this.permissionService.get("TRANSPORT_ORDER_ADD")],["TRANSPORT_ORDER_EDIT",1==this.permissionService.get("TRANSPORT_ORDER_EDIT")]]),this.form=this.fb.group({assetId:[{value:this.trip?this.trip.assetId:null,disabled:this.trip&&this.trip.status&&"INACTIVE"!=this.trip.status&&"NEW"!=this.trip.status}],executionDate:[this.trip?this.trip.date:new Date,[a.k0.required,this.dateValidator]],description:[this.trip?this.trip.description:null,[a.k0.required]]}),this.resetTrip(),this.form.valueChanges.subscribe(e=>{this.updateEntityPopupState()})}updateEntityPopupState(){this.valuesChanged!=this.form.dirty&&(this.valuesChanged=this.form.dirty,this.globalEvents.setEntityOptionsChanged(this.form.dirty))}drop(e){(0,u.HD)(this.drives,e.previousIndex,e.currentIndex)}resetTrip(){if(this.trip){if((0,h.b0)(this.trip.assetId)&&(this.trip.assetId=null),this.drives=[],!(0,h.b0)(this.trip.drives)&&null!=this.trip.drives)for(let e of this.trip.drives)this.drives.push(Object.assign(new p.fq,e))}else this.trip=new p.WD,this.trip.date=new Date,this.drives=[];(0,h.b0)(this.form)||(this.assetId.setValue(this.trip.assetId),this.description.setValue(this.trip.description),this.executionDate.setValue(this.trip.date))}get assetId(){return this.form.get("assetId")}get description(){return this.form.get("description")}get executionDate(){return this.form.get("executionDate")}setupEditForm(e){let s=this;this.transportService.getTripToEdit(e).subscribe(i=>{!(0,h.b0)(i.drives)&&null!=i.drives&&(i.drives=this.sortService.sort(i.drives,"order")),i.date=new Date(i.date),s.trip=i})}hasError(e){return this.form.get(e)&&!this.form.get(e).valid&&this.submitted}saveTransportOrder(){if(this.submitted=!0,this.failed=!1,this.form.valid){this.buttonDisabled=!0;let e=this;this.serverErrors=null;let s=new p.WD;!(0,h.b0)(this.trip)&&null!=this.trip&&(s.id=this.trip.id),s.assetId=this.assetId.value,s.description=this.description.value,s.date=this.executionDate.value,s.drives=this.drives,this.transportService.saveTrip(s).subscribe(i=>{this.buttonDisabled=!1,i.errors?(this.failed=!0,this.parseErrors.call(this)):(!(0,h.b0)(i.trip.drives)&&null!=i.trip.drives&&(i.trip.drives=this.sortService.sort(i.trip.drives,"order")),i.trip.date=new Date(i.trip.date),e.trip=i.trip,e.submitted=!1,e.success=!0,e.onSubmit.emit(s),setTimeout(function(){e.form.markAsPristine(),e.updateEntityPopupState()},1e3),setTimeout(function(){e.success=!1,e.submitted=!1},3e3))})}}addNewDrive(){this.selectedDrive=null,this.showDriveForm=!0}cancelDrive(){this.showDriveForm=!1,this.selectedDrive=null}addDrive(e){this.updateEntityPopupState(),this.drives.push(e),this.showDriveForm=!1}driveUpdated(e){this.updateEntityPopupState(),this.showDriveForm=!1,this.selectedDrive=null}selectDrive(e){this.selectedDrive=this.drives[e]}editDrive(e){this.selectedDrive=e,this.showDriveForm=!0}deleteDrive(e){this.selectedDrive==this.drives[e]&&(this.selectedDrive=null,this.showDriveForm&&(this.showDriveForm=!1));let s=this.drives[e];confirm(this.translation.get("allpages.list.confirmdelete"))&&(null!=s.id?this.transportService.deleteDrive(s.id).subscribe(()=>{this.drives.splice(e,1)}):this.drives.splice(e,1))}moveUp(e){let s=this.drives.findIndex(i=>i===e);0!=s&&1!=this.drives.length&&(this.drives[s]=this.drives[s-1],this.drives[s-1]=e,this.arrangeDrivesOrder())}moveDown(e){let s=this.drives.findIndex(i=>i===e);s!=this.drives.length-1&&1!=this.drives.length&&(this.drives[s]=this.drives[s+1],this.drives[s+1]=e,this.arrangeDrivesOrder())}
1arrangeDrivesOrder(){this.drives.forEach(function(e,s){e.order=s})}dateValidator(e){let s=new Date;return s.setHours(0),s.setMinutes(0),s.setSeconds(0),s.setMilliseconds(0),e.value&&e.value.getTime()<s.getTime()?{invalid:{message:"transportOrders.trip.date.error.past"}}:null}parseErrors(e){this.serverErrors=[];for(let s in e){let i="",o=s.split("."),l=o[0].split("_");switch(o[0]){case"trip":i=this.translation.get("transportOverview.trip");break;case"drive":i=this.translation.get("transportOrders.drive");break;case"payload":i=this.translation.get("transportOrders.payload")}switch(l.length>1&&(i+=" "+(l[1]+1)),i+=" - ",o[1]){case"assetId":i+=this.translation.get("allpages.unit");break;case"description":i+=this.translation.get("allpages.description");break;case"date":i+=this.translation.get("allpages.date");break;case"destination":i+=this.translation.get("allpages.destination");break;case"customer":i+=this.translation.get("transportOrders.info.customer");break;case"email":i+=this.translation.get("allpages.form.email");break;case"number":i+=this.translation.get("transport.payload.container.containerNr");break;case"licensePlate":i+=this.translation.get("allpages.licensePlate");break;case"quantity":i+=this.translation.get("transport.payload.goods.quantity");break;case"type":i+=this.translation.get("allpages.type")}i+=": "+this.translation.get(e[s]),this.serverErrors.push(i)}}static{this.\u0275fac=function(s){return new(s||n)(t.rXU(a.ze),t.rXU(f.g),t.rXU(k.L),t.rXU(F.n),t.rXU(G.a),t.rXU($.g))}}static{this.\u0275cmp=t.VBU({type:n,selectors:[["transport-orders-form"]],inputs:{trip:"trip",editTrip:"editTrip"},outputs:{onSubmit:"onSubmit"},standalone:!1,decls:1,vars:1,consts:[[1,"inlineLabel","row",3,"formGroup"],[1,"col-md-4"],[1,"row","form-group"],[1,"col-12"],[1,"col-12",3,"ngClass"],["formControlName","assetId",3,"extended","options"],["field-required",""],["type","text","formControlName","description",1,"form-control-sm","form-control"],[3,"control"],["formControlName","executionDate"],[1,"col-12",3,"control"],[1,"row","itemAddList"],[1,"row"],[1,"col-9"],[1,"col-3"],["type","button",1,"btn","btn-secondary","btn-sm","float-end","addButton",3,"click"],[1,"fas","fa-plus"],["cdkDropList","",1,"form-control","itemList",3,"cdkDropListDropped"],["cdkDrag","","cdkDragBoundary",".itemList",1,"driveItem",3,"notLast"],[3,"onButtonClick","success","failed","alignRight","buttonDisabled"],[1,"col-md-8"],[3,"tripId","drive"],["cdkDrag","","cdkDragBoundary",".itemList",1,"driveItem"],["class","dragPlaceholder",4,"cdkDragPlaceholder"],[3,"edit","delete","moveDown","moveUp","drive","selected","index"],[1,"dragPlaceholder"],[1,"placeholderElement"],[3,"onCancel","onNewDrive","onDriveUpdate","tripId","drive"]],template:function(s,i){1&s&&t.nVh(0,Ft,44,34,"form",0),2&s&&t.vxM(i.permissions.get("TRANSPORT_ORDER_ADD")||i.permissions.get("TRANSPORT_ORDER_EDIT")?0:-1)},dependencies:[a.qT,a.me,a.BC,a.cb,a.j4,a.JD,I.w,M.l,V.s,P.G,E.T,_.YU,u.O7,u.T1,u.EM,gt,It,b.D],styles:[".addButton[_ngcontent-%COMP%]{margin:0 0 5px}.itemAddList[_ngcontent-%COMP%]{margin-top:10px}.itemAddList[_ngcontent-%COMP%] .itemList[_ngcontent-%COMP%]{padding:8px;height:150px;overflow-y:auto}.fa-grip-vertical[_ngcontent-%COMP%]{padding:8px;color:var(--colors-general-soft-grey)!important;z-index:2}.cdk-drag-preview[_ngcontent-%COMP%]{height:auto!important;z-index:99999!important;box-sizing:border-box;background-color:var(--colors-attention-light);box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f;padding:8px}.dragPlaceholder[_ngcontent-%COMP%]{transition:transform .25s cubic-bezier(0,0,.2,1);display:flex;margin:8px 0}.dragPlaceholder[_ngcontent-%COMP%] .placeholderElement[_ngcontent-%COMP%]{flex:1;min-height:40px;border:dashed 1px var(--colors-general-soft-grey)}.cdk-drag-preview[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{cursor:move!important}.cdk-drag-preview[_ngcontent-%COMP%] .fa-trash-alt, .cdk-drag-preview[_ngcontent-%COMP%] .fa-pen{display:none!important}.cdk-drag-preview[_ngcontent-%COMP%] .driveListItem{margin-bottom:0!important}.driveItem[_ngcontent-%COMP%]{margin-bottom:8px;padding-bottom:8px}.driveItem.notLast[_ngcontent-%COMP%]{border-bottom:solid var(--colors-general-soft-grey) 1px}"]})}}return n})()}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.