import{a as k,b as u,c as ne,d as ie}from"./chunk-25DBGZBW.js";import{b as oe}from"./chunk-7RTUPMOT.js";import"./chunk-FQHVBFH2.js";import{b as te,c as re,d as F}from"./chunk-PXD7HZAV.js";import{b as ee}from"./chunk-OZFEFIQ7.js";import"./chunk-EQBT3VWO.js";import"./chunk-4YDR2C6I.js";import{b as Y}from"./chunk-2GM6OZVQ.js";import"./chunk-5JDP6REG.js";import"./chunk-7TRFVZ22.js";import"./chunk-VZWILB2O.js";import"./chunk-UYR7FEKC.js";import{d as W,j as K}from"./chunk-5YSUPGXK.js";import{b as H,m as J}from"./chunk-XBVMFZCA.js";import{b as Z}from"./chunk-NB44O3GA.js";import{$ as T,Ac as l,Ag as V,Cg as $,Jg as z,Kg as Q,Mf as O,Nf as w,Ng as D,Of as U,P as v,Pf as P,Qc as M,Rf as _,U as s,Ug as X,V as m,Va as j,X as p,Y as f,Zf as I,_b as C,aa as d,bf as A,cg as L,dc as b,eg as G,g as c,id as E,j as y,kd as x,ng as q,qf as g,ua as i,wb as R,wg as B}from"./chunk-O6GKIPTD.js";var h=(()=>{class e{constructor(t){this.restService=t}scanContainer(t){return this.restService.get(`${M.CONTAINERS}/idCode:${t}`,null)}processContainer(t){return this.restService.post(`${M.CONTAINERS}/processCheckpointScan`,t)}static{this.\u0275fac=function(r){return new(r||e)(p(W))}}static{this.\u0275prov=s({token:e,factory:e.\u0275fac})}}return e})();var a=(()=>{class e{constructor(t){this.containerCheckpointScanService=t}scanContainer(t){return this.containerCheckpointScanService.scanContainer(t)}processScan(t){return this.containerCheckpointScanService.processContainer(t)}static{this.\u0275fac=function(r){return new(r||e)(p(h))}}static{this.\u0275prov=s({token:e,factory:e.\u0275fac})}}return e})();var N=(()=>{class e{static{this.\u0275fac=function(r){return new(r||e)}}static{this.\u0275mod=d({type:e})}static{this.\u0275inj=m({providers:[h,a],imports:[C]})}}return e})();var ae=(()=>{class e{constructor(t,r,o,n){this.containerScanCardService=t,this.containerCheckpointScanFacade=r,this.toastMessageService=o,this.translateService=n,this.destroySubject=new y}ngAfterViewInit(){this.containerScanCardService.IDCodeScannedSubject$.pipe(v(this.destroySubject)).subscribe(t=>{this.scanContainer(t)})}ngOnDestroy(){this.destroySubject.next(),this.destroySubject.complete()}initializeContainerScanCardInfo(){this.containerScanCardInfo={container:null,errorMessage:null}}scanContainer(t){this.initializeContainerScanCardInfo(),this.containerCheckpointScanFacade.scanContainer(t).pipe(v(this.destroySubject)).subscribe({next:r=>{let o=this.getContainerValidationMessage(r);if(!g.isNullOrUndefined(o)){this.containerScanCardInfo.container=r,this.containerScanCardInfo.errorMessage=o,this.containerScanCardService.setProcessedContainerInfo(this.containerScanCardInfo);return}this.processContainer(r).then(n=>{n&&(this.containerScanCardInfo.container=r,this.containerScanCardService.setProcessedContainerInfo(this.containerScanCardInfo))}).catch(()=>{this.handleError()})},error:()=>{this.handleError()}})}getContainerValidationMessage(t){return g.isNullOrUndefined(t)?this.translateService.instant("MSG_ID_CODE_NOT_FOUND"):I.fromNumberToDate(t.dateInactive)<=I.getCurrentDateNoTime()?this.translateService.instant("MSG_CONTAINER_DEACTIVATED"):null}processContainer(t){return c(this,null,function*(){return new Promise((r,o)=>{this.containerCheckpointScanFacade.processScan(t).subscribe({next:()=>{r(!0)},error:n=>{o(n)}})})})}handleError(){this.toastMessageService.showToastPanel(q.getErrorDefaultConfig().withMessage(this.translateService.instant("MSG_ERROR_WHILE_SCANNING"))),this.containerScanCardInfo.errorMessage="",this.containerScanCardService.setProcessedContainerInfo(this.containerScanCardInfo)}static{this.\u0275fac=function(r){return new(r||e)(i(u),i(a),i($),i(P))}}static{this.\u0275cmp=T({type:e,selectors:[["abs-container-checkpoint-scan-frame"]],features:[R([u])],decls:1,vars:0,template:function(r,o){r&1&&j(0,"abs-container-scan-card")},dependencies:[ne],encapsulation:2})}}return e})();var pe=[{path:"",pathMatch:"full",component:ae,data:{title:x.Dialogs.ContainerCheckpointScan.title},resolve:{translations:()=>f(D).resolve(l.CONTAINER_SCAN_CARD),configuration:()=>f(k).resolve(),uniqueIDConfigurations:()=>c(void 0,null,function*(){return f(F).resolve([E.CONTAINER])})}}];function fe(e,ce){return new Q(e,[{prefix:l.GENERAL,suffix:".json"},{prefix:l.CONTAINER_SCAN_CARD,suffix:".json"}],ce)}var de=(()=>{class e{static{this.\u0275fac=function(r){return new(r||e)}}static{this.\u0275mod=d({type:e})}static{this.\u0275inj=m({providers:[D,F,re,k],imports:[C,X,V,L,B,Z,O,w,J,K,A,G,Y,ee,te,oe,N,ie,z.forChild(pe),_.forChild({loader:{provide:U,useFactory:fe,deps:[b,H]},isolate:!0})]})}}return e})();export{de as DeliveryContainerCheckpointScanFeatureModule};
