1"use strict";(self.webpackChunkfuse=self.webpackChunkfuse||[]).push([[3004],{87132:(N,P,l)=>{l.d(P,{W:()=>e});var d=l(97048),s=l(36716),T=l(46700),t=l(19212),M=l(54704),G=l(54496);let e=(()=>{class D{constructor(m){this._httpClient=m,this._carrierRoutes=new T.g(null),this._selectedCarrierRoute=new T.g(null),this._isInsertPricingForm=new T.g(null),this._alternativeCarriers=new T.g([]),this._isUIForm=new T.g(null),this._carrierRoutesPaginator=new T.g(null),this.carrierRouteCounte$$=new T.g(null),this.carrierRouteCounte$=this.carrierRouteCounte$$.asObservable()}get carrierRoutes$(){return this._carrierRoutes.asObservable()}get fetchedNodesPaginator$(){return this._carrierRoutesPaginator.asObservable()}get selectedCarrierRoute$(){return this._selectedCarrierRoute.asObservable()}get alternativeCarriers$(){return this._alternativeCarriers.asObservable()}set isInsertPricingForm$(m){this._isInsertPricingForm.next(m)}set alternativeCarriers$(m){m.subscribe(R=>{this._alternativeCarriers.next(R)})}setIsUIForm$(m){this._isUIForm.next(m)}get isInsertPricingForm$(){return this._isInsertPricingForm.asObservable()}get isUIForm$(){return this._isUIForm.asObservable()}getCarrierRoutes(m,R){return this._httpClient.get(`${s.O.apiUrl}/api/carrier-routes?skip=${m}&limit=${R}`).pipe((0,t.y)(y=>this.total=y.total),(0,M.k)(y=>y.carrierRoutes.map(_=>({carrierId:_.carrierId,routeId:_?.routeId._id,transitTime:_?.transitTime,frequency:_?.frequency,currency:_?.currency,prices:_?.prices,nodeA:_?.routeId?.nodeA?.name,nodeB:_?.routeId?.nodeB?.name,countryId:_?.routeId?.nodeB.countryId,carrierName:_?.carrierId?.name}))),(0,t.y)(y=>this._carrierRoutes.next({carrierRoutes:y,total:this.total})))}getCarrierRoutesByRoute(m){const R=(new d.i4).set("nodeA",m.nodeA).set("nodeB",m.nodeB);return this._httpClient.get(`${s.O.apiUrl}/api/carrier-routes/by-route`,{params:R}).pipe((0,t.y)(y=>this.total=y.total),(0,M.k)(y=>y.carrierRoutes.map(_=>({carrierId:_.carrierId,routeId:_?.routeId._id,transitTime:_?.transitTime,frequency:_?.frequency,currency:_?.currency,prices:_?.prices,nodeA:_?.routeId?.nodeA?.name,nodeB:_?.routeId?.nodeB?.name,countryId:_?.routeId?.nodeB.countryId,carrierName:_?.carrierId?.name}))),(0,t.y)(y=>this._carrierRoutes.next({carrierRoutes:y,total:y.total})))}getCarrierRoutesByCarrier(m,R,y){const _=(new d.i4).set("skip",R).set("limit",y).set("carrierId",m);return this._httpClient.get(`${s.O.apiUrl}/api/carrier-routes/by-carrier`,{params:_}).pipe((0,t.y)(g=>{this.carrierRouteCounte$$.next(g.total)}),(0,M.k)(g=>g.carrierRoutes.map(x=>({carrierId:x.carrierId,routeId:x?.routeId._id,transitTime:x?.transitTime,frequency:x?.frequency,currency:x?.currency,prices:x?.prices,nodeA:x?.routeId?.nodeA?.name,nodeB:x?.routeId?.nodeB?.name,countryId:x?.routeId?.nodeB.countryId,carrierName:x?.carrierId?.name}))),(0,t.y)(g=>this._carrierRoutes.next({carrierRoutes:g,total:this.carrierRouteCounte$$.value})))}getOneCarrierRoute(m){return this._httpClient.get(`${s.O.apiUrl}/api/carrier-routes/${m}`)}getAlternativeCarriers(m){return this._httpClient.post(`${s.O.apiUrl}/api/carrier-routes/find/by-route`,m).pipe((0,M.k)(R=>this._alternativeCarriers.next(R)))}getOneCarrierRouteByName(m){const R=(new d.i4).set("name",m);return this._httpClient.get(`${s.O.apiUrl}/api/carrier-routes/find/by-name`,{params:R})}deleteCarrierRoute(m){return this._httpClient.delete(`${s.O.apiUrl}/api/carrier-routes/`+m)}editCarrierRoute(m,R,y){const _=(new d.i4).set("carrierId",R).set("routeId",y);return this._httpClient.patch(`${s.O.apiUrl}/api/carrier-routes`,m,{params:_})}inserMany(m){return this._httpClient.post(`${s.O.apiUrl}/api/carrier-routes/insert-many`,m)}setSelectedCarrierRoute(m){return this._selectedCarrierRoute.next(m)}getRouteCarriers(m){return this._httpClient.post(`${s.O.apiUrl}/api/graph/searchTrafic`,m)}createRouteCarriersByNodes(m){return this._httpClient.post(`${s.O.apiUrl}/api/carrier-routes/create-from-nodes`,m)}checkCarrierRouteAvailability(m){return this._httpClient.post(`${s.O.apiUrl}/api/carrier-routes/check/carrier-route-availability`,m)}static#e=this.\u0275fac=function(R){return new(R||D)(G.CoB(d.KK))};static#t=this.\u0275prov=G.wxM({token:D,factory:D.\u0275fac,providedIn:"root"})}return D})()},39648:(N,P,l)=>{l.d(P,{Q:()=>ce});var d=l(1528),s=l(6504),T=l(3756),t=l.n(T),M=l(17504),G=l(69552),e=l(54496),D=l(87132),W=l(97048),m=l(36716),R=l(46700);let y=(()=>{class o{constructor(r){this._httpClient=r,this._nodesNetwork=new R.g(null)}get nodesNetworks$(){return this._nodesNetwork.asObservable()}getRelatedRoutes(r){let i=(new W.i4).set("nodeB",r);return this._httpClient.get(`${m.O.apiUrl}/api/routes/network`,{params:i})}static#e=this.\u0275fac=function(i){return new(i||o)(e.CoB(W.KK))};static#t=this.\u0275prov=e.wxM({token:o,factory:o.\u0275fac,providedIn:"root"})}return o}
1)();var _=l(99344),g=l(28496),x=l(2864);let n=(()=>{class o{constructor(){}downloadFile(r,i,a,u){let I=this.ConvertToCSV(r,i,a),O=new Blob(["\ufeff"+I],{type:"text/csv;charset=utf-8;"}),E=document.createElement("a"),Y=URL.createObjectURL(O);-1!=navigator.userAgent.indexOf("Safari")&&-1==navigator.userAgent.indexOf("Chrome")&&E.setAttribute("target","_blank"),E.setAttribute("href",Y),E.setAttribute("download",u+".csv"),E.style.visibility="hidden",document.body.appendChild(E),E.click(),document.body.removeChild(E)}ConvertToCSV(r,i,a){let u="",I="",O="",E="";var Y=0;for(let k in i)I+=i[k]+",",++Y===i.length&&(u+=I+"\r\n");for(let k in r)O+=r[k]+",";u+=O+"\r\n";for(let k in a)E+=a[k]+",";return u+=E+"\r\n",u}static#e=this.\u0275fac=function(i){return new(i||o)};static#t=this.\u0275prov=e.wxM({token:o,factory:o.\u0275fac,providedIn:"root"})}return o})();var c=l(88500),w=l(63360),b=l(27816),v=l(50768),B=l(1560),f=l(8416),p=l(2096),C=l(75960),A=l(16496),F=l(60964),$=l(91368),S=l(33596);function L(o,h){1&o&&e.wR5(0,"a",24),2&o&&e.E7m("innerHTML",h.$implicit.name,e.E3n)}function U(o,h){1&o&&e.wR5(0,"div",24),2&o&&e.E7m("innerHTML",h.$implicit,e.E3n)}function K(o,h){if(1&o){const r=e.KQA();e.SAx(0),e.I0R(1,"div",1)(2,"div",2)(3,"div",3)(4,"div",4)(5,"form",5)(6,"div",6),e.OEk(7,"Ajouter une tarification "),e.C$Y(),e.I0R(8,"div",7)(9,"mat-form-field",8)(10,"mat-label",9),e.OEk(11,"Uploader les tarifs"),e.C$Y(),e.I0R(12,"div")(13,"mat-toolbar",10),e.wR5(14,"input",11),e.I0R(15,"button",12)(16,"span",13),e.OEk(17,"Parcourir fichiers"),e.C$Y()()(),e.I0R(18,"input",14,15),e.qCj("change",function(a){e.usT(r);const u=e.GaO();return e.CGJ(u.fileUpload(a))}),e.C$Y()()()(),e.I0R(20,"div",16)(21,"div",17)(22,"mat-label",18),e.OEk(23,"Devise"),e.C$Y(),e.I0R(24,"ng-autocomplete",19),e.qCj("selected",function(a){e.usT(r);const u=e.GaO();return e.CGJ(u.selectCurrencyEvent(a))}),e.C$Y(),e.yuY(25,L,1,1,"ng-template",null,20,e.gJz)(27,U,1,1,"ng-template",null,21,e.gJz),e.C$Y()(),e.I0R(29,"div",22)(30,"button",23),e.qCj("click",function(){e.usT(r);const a=e.GaO();return e.CGJ(a.createCarrierRoute())}),e.OEk(31," Enregistrer "),e.C$Y()()()()()()(),e.k70()}if(2&o){const r=e.Gew(26),i=e.Gew(28),a=e.GaO();e.yG2(5),e.E7m("formGroup",a.createCarrierRouteForm),e.yG2(9),e.E7m("formControlName","fileName"),e.yG2(10),e.E7m("data",a.currencies)("searchKeyword",a.filterKeyword)("itemTemplate",r)("notFoundTemplate",i),e.yG2(6),e.E7m("color","primary")("matTooltip","Save")}}function Q(o,h){1&o&&e.wR5(0,"a",24),2&o&&e.E7m("innerHTML",h.$implicit.name,e.E3n)}function j(o,h){1&o&&e.wR5(0,"div",24),2&o&&e.E7m("innerHTML",h.$implicit,e.E3n)}function H(o,h){if(1&o){const r=e.KQA();e.SAx(0),e.I0R(1,"div",3)(2,"div",4)(3,"form")(4,"div",6),e.OEk(5,"T\xe9l\xe9chargement de mod\xe8le de tarification"),e.C$Y(),e.I0R(6,"div",25)(7,"div",17)(8,"mat-label",18),e.OEk(9,"Choisissez un centre de tri"),e.C$Y(),e.I0R(10,"ng-autocomplete",19),e.qCj("selected",function(a){e.usT(r);const u=e.GaO();return e.CGJ(u.selectNodeId(a))}),e.C$Y(),e.yuY(11,Q,1,1,"ng-template",null,26,e.gJz)(13,j,1,1,"ng-template",null,27,e.gJz),e.C$Y()(),e.I0R(15,"div",22)(16,"button",23),e.qCj("click",function(){e.usT(r);const a=e.GaO();return e.CGJ(a.downloadTemplate())}),e.OEk(17," Telecharger "),e.C$Y()()()()(),e.k70()}if(2&o){const r=e.Gew(12),i=e.GaO();e.yG2(10),e.E7m("data",i.filteredNodes)("searchKeyword",i.sortingCenterFilterKeyword)("itemTemplate",r)("notFoundTemplate",i.notFoundTemplate),e.yG2(6),e.E7m("color","primary")("matTooltip","Save")}}function J(o,h){if(1&o&&(e.I0R(0,"mat-option",46),e.OEk(1),e.C$Y()),2&o){const r=h.$implicit;e.E7m("value",r._id),e.yG2(),e.cNF(r.frenchName)}}function V(o,h){if(1&o&&(e.I0R(0,"mat-option",46),e.OEk(1),e.C$Y()),2&o){const r=h.$implicit;e.E7m("value",r._id),e.yG2(),e.cNF(r.name)}}function z(o,h){if(1&o&&(e.I0R(0,"mat-option",46),e.OEk(1),e.C$Y()),2&o){const r=h.$implicit;e.E7m("value",r._id),e.yG2(),e.cNF(r.frenchName)}}function q(o,h){if(1&o&&(e.I0R(0,"mat-option",46),e.OEk(1),e.C$Y()),2&o){const r=h.$implicit;e.E7m("value",r._id),e.yG2(),e.cNF(r.name)}}function X(o,h){1&o&&e.wR5(0,"a",24),2&o&&e.E7m("innerHTML",h.$implicit.name,e.E3n)}function Z(o,h){1&o&&e.wR5(0,"div",24),2&o&&e.E7m("innerHTML",h.$implicit,e.E3n)}function ee(o,h){1&o&&(e.I0R(0,"mat-label"),e.OEk(1,"Poid minimun"),e.C$Y())}function te(o,h){1&o&&(e.I0R(0,"mat-label"),e.OEk(1,"Poid maximun"),e.C$Y())}function re(o,h){1&o&&(e.I0R(0,"mat-label"),e.OEk(1,"Prix"),e.C$Y())}const ie=o=>({"-mt-2":o});function ne(o,h){if(1&o){const r=e.KQA();e.SAx(0),e.I0R(1,"div",58)(2,"button",59),e.qCj("click",function(){e.usT(r);const a=e.GaO().index,u=e.GaO(2);return e.CGJ(u.removePrice(a))}),e.wR5(3,"mat-icon",49),e.C$Y()(),e.k70()}if(2&o){const r=e.GaO().first;
1e.yG2(),e.E7m("ngClass",e.S45(2,ie,!r)),e.yG2(2),e.E7m("svgIcon","heroicons_solid:trash")}}function oe(o,h){if(1&o){const r=e.KQA();e.SAx(0),e.I0R(1,"div",54)(2,"div",55)(3,"mat-form-field",33),e.yuY(4,ee,2,0,"mat-label",0),e.I0R(5,"input",56),e.qCj("change",function(){const u=e.usT(r).$implicit,I=e.GaO(2);return e.CGJ(I.checkWeightRangeValidity(u))}),e.C$Y()(),e.I0R(6,"mat-form-field",33),e.yuY(7,te,2,0,"mat-label",0),e.I0R(8,"input",56),e.qCj("change",function(){const u=e.usT(r).$implicit,I=e.GaO(2);return e.CGJ(I.checkWeightRangeValidity(u))}),e.C$Y()(),e.I0R(9,"mat-form-field",33),e.yuY(10,re,2,0,"mat-label",0),e.wR5(11,"input",57),e.C$Y(),e.yuY(12,ne,4,4,"ng-container",0),e.C$Y()(),e.k70()}if(2&o){const r=h.$implicit,i=h.first;e.yG2(4),e.E7m("ngIf",i),e.yG2(),e.E7m("formControl",r.get("weightRange").get("min"))("placeholder","*Poids minimum.")("spellcheck",!1),e.yG2(2),e.E7m("ngIf",i),e.yG2(),e.E7m("formControl",r.get("weightRange").get("max"))("placeholder","*poid maximun.")("spellcheck",!1),e.yG2(2),e.E7m("ngIf",i),e.yG2(),e.E7m("formControl",r.get("price"))("placeholder","*prix.")("spellcheck",!1),e.yG2(),e.E7m("ngIf",!i)}}function ae(o,h){1&o&&(e.I0R(0,"span",60),e.OEk(1," 2 plage de poids ne peuvent pas se cheveaucher. "),e.C$Y())}function se(o,h){1&o&&(e.I0R(0,"span",60),e.OEk(1," Le poids minimun ne peux etre superieur au poids maximun . "),e.C$Y())}function le(o,h){if(1&o){const r=e.KQA();e.SAx(0),e.I0R(1,"div",28)(2,"div",2)(3,"div",29)(4,"div",4)(5,"form",30),e.qCj("ngSubmit",function(){e.usT(r);const a=e.GaO();return e.CGJ(a.createTarification())}),e.I0R(6,"div",6),e.OEk(7,"Ajout des tarifications"),e.C$Y(),e.I0R(8,"div",31)(9,"div",32)(10,"mat-form-field",33)(11,"mat-label"),e.OEk(12,"Pays A"),e.C$Y(),e.wR5(13,"mat-icon",34),e.I0R(14,"mat-select",35),e.qCj("selectionChange",function(a){e.usT(r);const u=e.GaO();return e.CGJ(u.getDepartureNodes(a))}),e.I0R(15,"mat-option"),e.OEk(16,"---"),e.C$Y(),e.yuY(17,J,2,2,"mat-option",36),e.C$Y()(),e.I0R(18,"div",33)(19,"mat-form-field",37)(20,"mat-label"),e.OEk(21,"Node A"),e.C$Y(),e.wR5(22,"mat-icon",34),e.I0R(23,"mat-select",38)(24,"mat-option"),e.OEk(25,"---"),e.C$Y(),e.yuY(26,V,2,2,"mat-option",36),e.C$Y()()()(),e.I0R(27,"div",39)(28,"mat-form-field",33)(29,"mat-label"),e.OEk(30,"Pays B"),e.C$Y(),e.wR5(31,"mat-icon",34),e.I0R(32,"mat-select",35),e.qCj("selectionChange",function(a){e.usT(r);const u=e.GaO();return e.CGJ(u.getIncomingNodes(a))}),e.I0R(33,"mat-option"),e.OEk(34,"---"),e.C$Y(),e.yuY(35,z,2,2,"mat-option",36),e.C$Y()(),e.I0R(36,"div",33)(37,"mat-form-field",40)(38,"mat-label"),e.OEk(39,"Node B"),e.C$Y(),e.wR5(40,"mat-icon",34),e.I0R(41,"mat-select",41)(42,"mat-option"),e.OEk(43,"---"),e.C$Y(),e.yuY(44,q,2,2,"mat-option",36),e.C$Y()()()(),e.I0R(45,"div",42)(46,"mat-form-field",33)(47,"mat-label"),e.OEk(48,"Temps de transite"),e.C$Y(),e.wR5(49,"input",43),e.C$Y(),e.I0R(50,"div",33)(51,"div",17)(52,"mat-label",9),e.OEk(53,"Devise*"),e.C$Y(),e.I0R(54,"ng-autocomplete",19),e.qCj("selected",function(a){e.usT(r);const u=e.GaO();return e.CGJ(u.selectCurrencyEvent(a))}),e.C$Y(),e.yuY(55,X,1,1,"ng-template",null,20,e.gJz)(57,Z,1,1,"ng-template",null,21,e.gJz),e.C$Y()()(),e.I0R(59,"div",44)(60,"mat-form-field",9)(61,"mat-label"),e.OEk(62,"Type de distance"),e.C$Y(),e.wR5(63,"mat-icon",34),e.I0R(64,"mat-select",45)(65,"mat-option",46),e.OEk(66,"Courte distance"),e.C$Y(),e.I0R(67,"mat-option",46),e.OEk(68,"Moyenne distance"),e.C$Y(),e.I0R(69,"mat-option",46),e.OEk(70,"Longue distance"),e.C$Y()()()(),e.yuY(71,oe,13,13,"ng-container",47),e.I0R(72,"div",48),e.qCj("click",function(){e.usT(r);const a=e.GaO();return e.CGJ(a.addPrice())}),e.wR5(73,"mat-icon",49),e.I0R(74,"span",50),e.OEk(75,"Ajouter un prix"),e.C$Y()()(),e.I0R(76,"div",51)(77,"button",52),e.OEk(78," Enregistrer "),e.C$Y()(),e.yuY(79,ae,2,0,"span",53)(80,se,2,0,"span",53),e.C$Y()()()()(),e.k70()}if(2&o){const r=e.Gew(56),i=e.Gew(58),a=e.GaO();e.yG2(5),e.E7m("formGroup",a.createTarificationForm),e.yG2(8),e.E7m("svgIcon","heroicons_solid:map"),e.yG2(),e.E7m("formControlName","countryA"),e.yG2(3),e.E7m("ngForOf",a.countries),e.yG2(5),e.E7m("svgIcon","heroicons_solid:location-marker"),e.yG2(),e.E7m("formControlName","nodeA"),e.yG2(3),e.E7m("ngForOf",a.departureNodes),e.yG2(5),e.E7m("svgIcon","heroicons_solid:map"),e.yG2(),e.E7m("formControlName","countryB"),e.yG2(3),e.E7m("ngForOf",a.countries),e.yG2(5),e.E7m("svgIcon","heroicons_solid:location-marker"),e.yG2(),e.E7m("formControlName","nodeB"),e.yG2(3),e.E7m("ngForOf",a.incomingNodes),e.yG2(5),e.E7m("formControlName","transitTime")("placeholder","temps de transite.")("spellcheck",!1),e.yG2(5),e.E7m("data",a.currencies)("searchKeyword",a.filterKeyword)("itemTemplate",r)("notFoundTemplate",i
1),e.yG2(9),e.E7m("svgIcon","heroicons_solid:location-marker"),e.yG2(),e.E7m("formControlName","type"),e.yG2(),e.E7m("value","LAST_MILES"),e.yG2(2),e.E7m("value","MIDDLE_MILES"),e.yG2(2),e.E7m("value","LONG_MILES"),e.yG2(2),e.E7m("ngForOf",a.createTarificationForm.get("prices").controls),e.yG2(2),e.E7m("svgIcon","heroicons_solid:plus-circle"),e.yG2(4),e.E7m("color","primary"),e.yG2(2),e.E7m("ngIf",a.overlap),e.yG2(),e.E7m("ngIf",a.minHigherMax)}}let ce=(()=>{class o{constructor(r,i,a,u,I,O,E,Y,k){this._formBuilder=r,this._carrierRouteService=i,this._routeService=a,this._carrierService=u,this._nodeService=I,this._matDialog=O,this._downloadCSVService=E,this._countryService=Y,this._activatedRoute=k,this.dataXlsx=[],this.fileName="",this.filterKeyword="name",this.nodeKeyword="name",this.sortingCenterFilterKeyword="name",this.nodeId=new s.yM(""),this.currencies=G.u,this.overlap=!1,this.minHigherMax=!1}ngOnInit(){this._carrierService.selectedCarrier.subscribe({next:r=>this.currentCarrier=r,error:r=>console.log(r)}),this.getCountries(),this._carrierRouteService.isUIForm$.subscribe({next:r=>{this.isUIForm=r},error:r=>{console.log(r)}}),this._carrierRouteService.isInsertPricingForm$.subscribe({next:r=>{this.isInsertPricingForm=r,this.isInsertPricingForm||this.getFilterNodes()}}),this.createCarrierRouteForm=this._formBuilder.group({carrier:[this.currentCarrier._id,s.AQ.required],file:["",s.AQ.required],currency:["",s.AQ.required],fileName:[]}),this.getCarriers(),this.weightRangeForm=this._formBuilder.group({min:["",s.AQ.required,s.AQ.min(0)],max:["",s.AQ.required,s.AQ.min(0)]}),this.createTarificationForm=this._formBuilder.group({countryA:["",s.AQ.required],nodeA:["",s.AQ.required],countryB:["",s.AQ.required],nodeB:["",s.AQ.required],type:["",s.AQ.required],carrierId:[this.currentCarrier._id,s.AQ.required],transitTime:["",s.AQ.required],currency:["",s.AQ.required],prices:this._formBuilder.array([])}),this.createCarrierForm=this._formBuilder.group({weightRange:this.weightRangeForm,price:["",s.AQ.required,s.AQ.min(0)]}),this.createTarificationForm.get("prices").push(this.createCarrierForm)}getCarriers(){this._carrierService.getCarrier({skip:0,limit:1e3}).subscribe({next:r=>{this.filteredCarriers=r},error:r=>{console.log(r)}})}getFilterNodes(){this._nodeService.filteredNodes().subscribe({next:r=>{this.filteredNodes=r}})}selectNodeId(r){this.nodeId.setValue(r._id)}selectCurrencyEvent(r){this.createTarificationForm.get("currency").setValue(r.code)}fileUpload(r){const i=r.target.files[0],a=new FileReader;this.createCarrierRouteForm.get("fileName").setValue(i.name),a.readAsBinaryString(i),a.onload=u=>{const O=M.read(u.target.result,{type:"binary"});O.SheetNames.forEach(E=>{const Y=M.utils.sheet_to_json(O.Sheets[E]);this.dataXlsx=Y})}}transformPayload(r){var i=this;return(0,d.c)(function*(){const a=[],u=r[0],I=r[1];r.splice(1,1);for(const O in u){const E=yield i.getPrice(r,O,I);a.push(E)}return a.filter(O=>O.prices.length>0&&"ID"!==O.routeId)})()}getPrice(r,i,a){var u=this;return(0,d.c)(function*(){let I=i,O=[];return yield r.forEach(E=>{E[i]&&"number"==typeof E[i]&&O.push({price:E[i],weight:E.ID})}),{routeId:I,prices:O,transitTime:a[I]||101,carrierId:u.createCarrierRouteForm.get("carrier").value,currency:u.createTarificationForm.get("currency").value}})()}createCarrierRoute(){var r=this;return(0,d.c)(function*(){r.createCarrierRouteForm.disable();const i=yield r.transformPayload(r.dataXlsx);r._carrierRouteService.inserMany(i).subscribe({next:()=>{r.createCarrierRouteForm.enable(),r._matDialog.closeAll(),t().fire({position:"top-end",icon:"success",text:"Les tarifs ont \xe9t\xe9 ajout\xe9s avec succ\xe8s",showConfirmButton:!1,timer:1500})},error:a=>{r.createCarrierRouteForm.enable(),t().fire({position:"top-end",icon:"error",text:"Oups\xa0! quelque chose s'est mal pass\xe9",showConfirmButton:!1,timer:2500}),console.log(a)}})})()}downloadTemplate(){this._routeService.getRelatedRoutes(this.nodeId.value).subscribe({next:r=>{let i=["ID"],a=["Poids"],u=["Transit Time"];for(let I=0;I<r.length;I++){const O=r[I];i.push(O._id),a.push(O.depart),u.push("")}this._downloadCSVService.downloadFile(a,i,u,`Tarification ${r[0]?.destination}`),this._matDialog.closeAll()}})}addPrice(){this.createTarificationForm.get("prices").push(this._formBuilder.group({price:["",s.AQ.required,s.AQ.min(0)],weightRange:this._formBuilder.group({min:["",s.AQ.required,s.AQ.min(0)],max:["",s.AQ.required,s.AQ.min(0)]})}))}removePrice(r){this.createTarificationForm.get("prices").removeAt(r)}createTarification(){const r=Object.assign({},this.createTarificationForm.value);delete r.countryA,delete r.countryB,this._carrierRouteService.createRouteCarriersByNodes(r).subscribe({next:()=>{this.createTarificationForm.enable(),this._matDialog.closeAll(),t().fire({position:"top-end",icon:"success",text:"Les tarifs ont \xe9t\xe9 ajout\xe9s avec succ\xe8s",showConfirmButton:!1,timer:1500})},error:i=>{this.createTarificationForm.enable(),t().fire({position:"top-end",icon:"error",text:"Oups! quelque chose s'est mal pass\xe9",showConfirmButton:!1,timer:2500}),console.log(i)}})}getCountries(){this._countryService.getDeliverableCountries().subscribe({next:r=>{this.countries=r},error:r=>{console.log(r)}})}getDepartureNodes(r){this._nodeService.filterNodesByCountryId(this.createTarificationForm.get("countryA").value).subscribe({next:i=>{this.sameNode=!1,this.departureNodes=i.node},error:i=>{console.log(i)}})}getIncomingNodes(r){this.createTarificationForm.get("countryA").value!==this.createTarificationForm.get("countryB").value?this._nodeService.filterNodesByCountryId(this.createTarificationForm.get("countryB").value).subscribe({next:i=>{this.sameNode=!1,this.incomingNodes=i.node},error:i=>{console.log(i)}}):(this.sameNode=!1,this.incomingNodes=this.departureNodes)}checkWeightRangeValidity(r){const i=r.get("weightRange.min")?.value,a=r.get("weightRange.max")?.value;this.isMinWeightHigherThanMaxWeight(i,a)}isMinWeightHigherThanMaxWeight(r,i){return this.minHigherMax=r>i,this.minHigherMax}static#e=this.\u0275fac=function(i){return new(i||o)(e.GI1(s.KE),e.GI1(D.W),e.GI1(y),e.GI1(_.q),e.GI1(g.e),e.GI1(x.qW),e.GI1(n),e.GI1(c.C),e.GI1(w.gV))};static#t=this.\u0275cmp=e.In1({type:o,selectors:[["app-create"]],decls:3,vars:3,consts:[[4,"ngIf"],[1,"flex","flex-col","flex-auto","md:w-120","md:min-w-120","-m-6"],[1,"w-full","sm:w-auto","py-8","px-4","sm:p-12","sm:rounded-2xl","sm:sh
1adow","sm:bg-card"],[1,"relative","flex","flex-col","flex-auto","items-center","px-6","sm:px-6"],[1,"w-full","max-w-3xl"],[3,"formGroup"],[1,"text-2xl","text-center","font-extrabold","tracking-tight","leading-tight"],[1,"mt-6","flex","w-full"],["appearance","fill",1,"w-full"],[1,"w-full"],[1,"w-full","p-0"],["matInput","","placeholder","Ex: tarifs.xlsx","readonly","","name","name",1,"text-base","font-normal",3,"formControlName"],["mat-raised-button","","color","primary",1,"rounded-md"],[1,"px-3"],["type","file","id","uploadFile","name","uploadFile","multiple","multiple","accept",".xlsx,.xls,.ods",1,"top-0","left-0","w-96","z-auto","opacity-0","h-full","cursor-pointer","absolute",3,"change"],["fileInput",""],[1,"flex","justify-center","space-x-2"],[1,"ng-autocomplete","w-full"],[1,"w-full","text-base","font-medium"],["placeholder","",3,"data","searchKeyword","itemTemplate","notFoundTemplate","selected"],["itemTemplateCurrency",""],["notFoundTemplateCurrency",""],[1,"flex","justify-center","mt-8","py-4","pr-4","pl-1","sm:pr-12","sm:pl-7","border-t","bg-gray-50","dark:bg-transparent"],["mat-flat-button","",1,"ml-2",3,"color","matTooltip","click"],[3,"innerHTML"],[1,"mt-6","flex","justify-center","space-x-2"],["pricingFileTemplate",""],["notFoundPricingFileTemplateTemplate",""],[1,"flex","flex-col","flex-auto","md:w-256","md:min-w-256","h-auto"],[1,"relative","flex","flex-col","flex-auto","items-center","px-3","sm:px-3"],[3,"formGroup","ngSubmit"],[1,"flex","justify-center","items-center","flex-col","mt-5"],[1,"mt-4","flex","w-2/3"],[1,"w-1/2"],["matPrefix","",1,"hidden","sm:flex","icon-size-5",3,"svgIcon"],[3,"formControlName","selectionChange"],[3,"value",4,"ngFor","ngForOf"],[1,"w-full","ml-2","mt-0"],["placeholder","Commune, ville ...",3,"formControlName"],[1,"flex","w-2/3"],[1,"w-full","ml-2"],["placeholder","Commune, ville ....",3,"formControlName"],[1,"gap-2","flex","w-2/3"],["matInput","","type","number",3,"formControlName","placeholder","spellcheck"],[1,"w-2/3","flex","gap-2"],[3,"formControlName"],[3,"value"],[4,"ngFor","ngForOf"],[1,"group","inline-flex","items-center","mt-2","-ml-4","py-2","px-4","rounded","cursor-pointer",3,"click"],[1,"icon-size-5",3,"svgIcon"],[1,"ml-2","font-medium","text-secondary","group-hover:underline"],[1,"flex","justify-center","mt-8","py-4","pr-4","pl-1","sm:pr-12","sm:pl-7","dark:bg-transparent"],["mat-flat-button","","type","submit",1,"ml-2",3,"color"],["class","text-sm text-red-600",4,"ngIf"],[1,"flex-col","flex","lg:flex-row","lg","w-2/3","items-center","gap-2"],[1,"w-full","flex","justify-center","gap-2"],["matInput","","type","number","min","0",3,"formControl","placeholder","spellcheck","change"],["matInput","","type","number","min","0",3,"formControl","placeholder","spellcheck"],[1,"flex","items-center","w-10",3,"ngClass"],["mat-icon-button","","matTooltip","Supprimer",1,"w-8","h-8","min-h-8",3,"click"],[1,"text-sm","text-red-600"]],template:function(i,a){1&i&&e.yuY(0,K,32,8,"ng-container",0)(1,H,18,6,"ng-container",0)(2,le,81,30,"ng-container",0),2&i&&(e.E7m("ngIf",a.isInsertPricingForm&&!a.isUIForm),e.yG2(),e.E7m("ngIf",!a.isInsertPricingForm&&!a.isUIForm),e.yG2(),e.E7m("ngIf",a.isUIForm))},dependencies:[b.Gw,b.um,v.Up,v.w5,v.is,B.qL,f.yi,p.kX,C.I5,A.a4,F.EZ,$.QF,$.ay,$.u_,s.sz,s.ot,s.O4,s.ue,s.u,s.Gu,s.SC,s.ug,s.uW,s.Wo,S.yX],encapsulation:2})}return o})()},91800:(N,P,l)=>{l.d(P,{S:()=>b});var d=l(6504),s=l(3756),T=l.n(s),t=l(54496),M=l(63360),G=l(87132),e=l(2864),D=l(27816),W=l(50768),m=l(1560),R=l(8416),y=l(16496),_=l(91368);function g(v,B){1&v&&(t.I0R(0,"div",24),t.OEk(1," 2 plage de poids ne peuvent pas se cheveaucher. "),t.C$Y())}function x(v,B){1&v&&(t.I0R(0,"span",24),t.OEk(1," Le poids minimun ne peux etre superieur au poids maximun . "),t.C$Y())}function n(v,B){1&v&&(t.I0R(0,"span",24),t.OEk(1," Le poids minimun ne peux etre superieur au poids maximun . "),t.C$Y())}const c=v=>({"-mt-2":v});function w(v,B){if(1&v){const f=t.KQA();t.I0R(0,"tr",25)(1,"td",26)(2,"mat-form-field",27),t.wR5(3,"input",28),t.C$Y(),t.yuY(4,x,2,0,"span",17),t.C$Y(),t.I0R(5,"td",26)(6,"mat-form-field",27),t.wR5(7,"input",28),t.C$Y(),t.yuY(8,n,2,0,"span",17),t.C$Y(),t.I0R(9,"td",26)(10,"mat-form-field",29),t.wR5(11,"input",28),t.C$Y()(),t.I0R(12,"td",26),t.SAx(13,30),t.I0R(14,"div",31)(15,"button",32),t.qCj("click",function(){const A=t.usT(f).index,F=t.GaO();return t.CGJ(F.removePrice(A))}),t.wR5(16,"mat-icon",20),t.C$Y()(),t.k70(),t.C$Y()()}if(2&v){const f=B.$implicit,p=B.first,C=t.GaO();t.yG2(3),t.E7m("formControl",f.get("minWeight"))("spellcheck",!1),t.yG2(),t.E7m("ngIf",C.isMinWeightHigherThanMaxWeight(f.get("minWeight").value,f.get("maxWeight").value)),t.yG2(3),t.E7m("formControl",f.get("maxWeight"))("spellcheck",!1),t.yG2(),t.E7m("ngIf",C.isMinWeightHigherThanMaxWeight(f.get("minWeight").value,f.get("maxWeight").value)),t.yG2(3),t.E7m("formControl",f.get("price"))("spellcheck",!1),t.yG2(3),t.E7m("ngClass",t.S45(10,c,!p)),t.yG2(2),t.E7m("svgIcon","heroicons_solid:trash")}}let b=(()=>{class v{constructor(f,p,C,A){this._router=f,this._formBuilder=p,this._carrierRouteService=C,this._matDialog=A,this.overlap=!1,this.minHigherMax=!1}ngOnInit(){this.getCurrentCarrierRoute(),this.selectedCarrierRouteForm=this._formBuilder.group({nodeA:[],nodeB:[],carrierName:[],prices:this._formBuilder.array([],[this.validatePriceArray()]),transitTime:[,d.AQ.required]}),this.selectedCarrierRouteForm.patchValue(this.currentCarrierRoute);const f=[];this.currentCarrierRoute.prices.length>
10&&this.currentCarrierRoute.prices.forEach((p,C)=>{f.push(this._formBuilder.group({price:[p.price,d.AQ.required],maxWeight:[p.weightRange.max,d.AQ.required],minWeight:[p.weightRange.min,d.AQ.required]}))}),f.forEach(p=>{this.selectedCarrierRouteForm.get("prices").push(p)})}getCurrentCarrierRoute(){this._carrierRouteService.selectedCarrierRoute$.subscribe({next:f=>{this.currentCarrierRoute=f}})}addPrice(){this.selectedCarrierRouteForm.get("prices").push(this._formBuilder.group({price:["",[d.AQ.required,d.AQ.min(0)]],maxWeight:["",[d.AQ.required,d.AQ.min(0)]],minWeight:["",[d.AQ.required,d.AQ.min(0)]]}))}updateCarrierRoute(){const f=this.transformData(Object.assign({},this.selectedCarrierRouteForm.value));f.prices.currency="XOF",this._carrierRouteService.editCarrierRoute(f.prices,this.currentCarrierRoute.carrierId._id,this.currentCarrierRoute.routeId).subscribe({next:p=>{T().fire({position:"top-end",icon:"success",text:"Tarification mise \xe0 jour avec succ\xe8s",showConfirmButton:!1,timer:1500}),this._carrierRouteService.getCarrierRoutesByCarrier(this.currentCarrierRoute.carrierId._id,0,200).subscribe(),this._matDialog.closeAll()},error:p=>{T().fire({position:"top-end",icon:"error",text:"Quelque chose a mal tourn\xe9",showConfirmButton:!1,timer:1500}),this._matDialog.closeAll()}})}transformData(f){const p={...f};return p.prices&&p.prices.length>0&&(p.prices=p.prices.map(C=>{const{maxWeight:A,minWeight:F}=C,$={...C,weightRange:{max:A,min:F}};return delete $.maxWeight,delete $.minWeight,$})),p}removePrice(f){this.selectedCarrierRouteForm.get("prices").removeAt(f)}validatePriceArray(){return f=>{const p=f.value;if(p)for(let C=0;C<p.length-1;C++)for(let A=C+1;A<p.length;A++){const F=p[C],$=p[A];if(F.minWeight<=$.maxWeight&&F.maxWeight>=$.minWeight||$.minWeight<=F.maxWeight&&$.maxWeight>=F.minWeight)return this.overlap=!0,{priceOverlap:!0}}return this.overlap=!1,null}}isMinWeightHigherThanMaxWeight(f,p){return this.minHigherMax=f>p,this.minHigherMax}static#e=this.\u0275fac=function(p){return new(p||v)(t.GI1(M.E5),t.GI1(d.KE),t.GI1(G.W),t.GI1(e.qW))};static#t=this.\u0275cmp=t.In1({type:v,selectors:[["app-details"]],decls:43,vars:11,consts:[[1,"flex","flex-col","flex-auto","md:w-200","md:min-w-200","-m-6"],[1,"w-full","sm:w-auto","py-8","px-4","sm:p-12","sm:rounded-2xl","sm:shadow","sm:bg-card"],[1,"relative","flex","flex-col","flex-auto","items-center","px-6","sm:px-12"],[1,"w-full","max-w-3xl"],[3,"formGroup"],[1,"text-4xl","text-center","font-extrabold","tracking-tight","leading-tight"],[1,"mt-6","flex","gap-2"],[1,"w-2/4"],["matInput","","type","string","readonly","","required","",3,"formControlName","placeholder","spellcheck"],[1,"flex"],[1,"w-full","general-info"],[1,"text-xl","mt-8","font-bold"],[1,"table-responsive","mt-8"],[1,"table","table-bordered"],[1,"thead-active"],[2,"background","gainsboro"],["scope","col",1,"text-md"],["class","text-sm text-red-600",4,"ngIf"],["class","h-10",4,"ngFor","ngForOf"],[1,"group","inline-flex","items-center","mt-2","-ml-4","py-2","px-4","rounded","cursor-pointer",3,"click"],[1,"icon-size-5",3,"svgIcon"],[1,"ml-2","font-medium","text-secondary","group-hover:underline"],[1,"flex","justify-center","mt-8","py-4","pr-4","pl-1","sm:pr-12","sm:pl-7","dark:bg-transparent"],["mat-flat-button","",1,"ml-2",3,"color","disabled","matTooltip","click"],[1,"text-sm","text-red-600"],[1,"h-10"],[1,"text-md","pb-0"],[1,"w-full","mb-0"],["matInput","","type","number","min","0",3,"formControl","spellcheck"],[1,"w-full"],[1,"flex","justify-center","items-center"],[1,"flex","justify-center","items-center","w-full",3,"ngClass"],["mat-icon-button","","matTooltip","Remove",1,"w-8","h-8","min-h-8",3,"click"]],template:function(p,C){1&p&&(t.I0R(0,"div",0)(1,"div",1),t.SAx(2),t.I0R(3,"div",2)(4,"div",3)(5,"form",4)(6,"div",5),t.OEk(7,"Modifier un transporteur"),t.C$Y(),t.I0R(8,"div",6)(9,"mat-form-field",7)(10,"mat-label"),t.OEk(11,"D\xe9part"),t.C$Y(),t.wR5(12,"input",8),t.C$Y(),t.I0R(13,"mat-form-field",7)(14,"mat-label"),t.OEk(15,"Destination"),t.C$Y(),t.wR5(16,"input",8),t.C$Y()(),t.I0R(17,"div",9)(18,"div",10)(19,"h5",11),t.OEk(20," Liste des prix par kilogrammes"),t.C$Y(),t.I0R(21,"div",12)(22,"table",13)(23,"thead",14)(24,"tr",15)(25,"th",16),t.OEk(26,"Poids min"),t.C$Y(),t.I0R(27,"th",16),t.OEk(28,"Poids max"),t.C$Y(),t.I0R(29,"th",16),t.OEk(30,"Prix"),t.C$Y(),t.I0R(31,"th",16),t.OEk(32,"Sup"),t.C$Y()()(),t.I0R(33,"tbody"),t.yuY(34,g,2,0,"div",17)(35,w,17,12,"tr",18),t.C$Y()(),t.I0R(36,"div",19),t.qCj("click",function(){return C.addPrice()}),t.wR5(37,"mat-icon",20),t.I0R(38,"span",21),t.OEk(39,"Ajouter une ligne"),t.C$Y()()()()(),t.I0R(40,"div",22)(41,"button",23),t.qCj("click",function(){return C.updateCarrierRoute()}),t.OEk(42," Modifier "),t.C$Y()()()()(),t.k70(),t.C$Y()()),2&p&&(t.yG2(5),t.E7m("formGroup",C.selectedCarrierRouteForm),t.yG2(7),t.E7m("formControlName","nodeA")("spellcheck",!1),t.yG2(4),t.E7m("formControlName","nodeB")("spellcheck",!1),t.yG2(18),t.E7m("ngIf",C.overlap),t.yG2(),t.E7m("ngForOf",C.selectedCarrierRouteForm.get("prices").controls),t.yG2(2),t.E7m("svgIcon","heroicons_solid:plus-circle"),t.yG2(4),t.E7m("color","primary")("disabled",C.overlap||!C.selectedCarrierRouteForm.valid||C.minHigherMax)("matTooltip","Save"))},dependencies:[D.Gw,D.um,W.Up,W.w5,m.qL,R.yi,y.a4,_.QF,_.ay,_.u_,d.sz,d.ot,d.O4,d.ue,d.u,d.eJ,d.Gu,d.ug,d.uW,d.Wo],styles:[".mat-form-field-wrapper[_ngcontent-%COMP%]{margin-bottom:0!important}"]})}return v})()},75696:(N,P,l)=>{var d;l.d(P,{KW:()=>y});var s=l(54496),T=l(75960),t=l(35908);const M=t||d||(d=l.t(t,2)),G=new s.UbH("MAT_MOMENT_DATE_ADAPTER_OPTIONS",{providedIn:"root",factory:function e(){return{useUtc:!1}}});function D(g,x){const n=Array(g);for(let c=0;c<g;c++)n[c]=x(c);return n}let W=(()=>{class g extends T.Wu{constructor(n,c){super(),this._options=c,this.setLocale(n||M.locale())}setLocale(n){super.setLocale(n);let c=M.localeData(n);this._localeData={firstDayOfWeek:c.firstDayOfWeek(),longMonths:c.months(),shortMonths:c.monthsShort(),dates:D(31,w=>this.createDate(2017,0,w+1).format("D")),longDaysOfWeek:c.weekdays(),shortDaysOfWeek:c.weekdaysShort(),narrowDaysOfWeek:c.weekdaysMin()}}getYear(n){return this.clone(n).year()}getMonth(n){return this.clone(n).month()}getDate(n){return this.clone(n).date()}getDayOfWeek(n){return this.clone(n).day()}getMonthNames(n){return"long"==n?this._localeData.longMonths:this._localeData.shortMonths}getDateNames(){return this._localeData.dates}getDayOfWeekNames(n){return"long"==n?this._localeData.longDaysOfWeek:"short"==n?this._localeData.shortDaysOfWeek:this._localeData.narrowDaysOfWeek}getYearName(n){return this.clone(n).format("YYYY")}getFirstDayOfWeek(){return this._localeData.firstDayOfWeek}getNumDaysInMonth(n){return this.clone(n).daysInMonth()}clone(n){return n.clone().locale(this.locale)}createDate(n,c,w){const b=this._createMoment({year:n,month:c,date:w}).locale(this.locale);return b.isValid(),b}today(){return this._createMoment().locale(this.locale)}parse(n,c){return n&&"string"==typeof n?this._createMoment(n,c,this.locale):n?this._createMoment(n).locale(this.locale):null}format(n,c){return n=this.clone(n),this.isValid(n),n.format(c)}addCalendarYears(n,c){return this.clone(n).add({years:c})}addCalendarMonths(n,c){return this.clone(n).add({months:c})}addCalendarDays(n,c){return this.clone(n).add({days:c})}toIso8601(n){return this.clone(n).format()}deserialize(n){let c;if(n instanceof Date)c=this._createMoment(n).locale(this.locale);else if(this.isDateInstance(n))return this.clone(n);if("string"==typeof n){if(!n)return null;c=this._createMoment(n,M.ISO_8601).locale(this.locale)}return c&&this.isValid(c)?this._createMoment(c).locale(this.locale):super.deserialize(n)}isDateInstance(n){return M.isMoment(n)}isValid(n){return this.clone(n).isValid()}invalid(){return M.invalid()}_createMoment(n,c,w){const{strict:b,useUtc:v}=this._options||{};return v?M.utc(n,c,w,b):M(n,c,w,b)}static#e=this.\u0275fac=function(c){return new(c||g)(s.CoB(T.KQ,8),s.CoB(G,8))};static#t=this.\u0275prov=s.wxM({token:g,factory:g.\u0275fac})}return g})();const m={parse:{dateInput:"l"},display:{dateInput:"l",monthYearLabel:"MMM YYYY",dateA11yLabel:"LL",monthYearA11yLabel:"MMMM YYYY"}};let y=(()=>{class g{static#e=this.\u0275fac=function(c){return new(c||g)};static#t=this.\u0275mod=s.a4G({type:g});static#r=this.\u0275inj=s.s3X({providers:[_()]})}return g})();function _(g=m,x){const n=[{provide:T.Wu,useClass:W,deps:[T.KQ,G]},{provide:T.IR,useValue:g}];return x&&n.push({provide:G,useValue:x}),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.