import{a as k,b as u,c as ne,d as ie}from"./chunk-IIFI2L7H.js";import{b as oe}from"./chunk-IMGA6JAP.js";import"./chunk-DUG5IE4G.js";import{b as te,c as re,d as F}from"./chunk-CCUWV6AB.js";import{b as ee}from"./chunk-KD4QUYWY.js";import"./chunk-GRPQEFDK.js";import"./chunk-TPACFMFL.js";import{b as Y}from"./chunk-F3Y565Y7.js";import"./chunk-YBMBTB55.js";import"./chunk-K66JC54F.js";import"./chunk-DC4AKQQR.js";import"./chunk-R2VBPE7X.js";import{d as W,j as K}from"./chunk-H2B22MYX.js";import{b as H,m as J}from"./chunk-5OI7DOM6.js";import{b as Z}from"./chunk-DILINSIM.js";import{$ as T,Ac as l,Bg as $,Ig as z,Jg as Q,Lf as O,Mf as w,Mg as D,Nf as U,Of as P,P as v,Pc as M,Qf as _,Tg as X,U as s,V as m,Va as j,X as p,Y as f,Yf as I,_b as C,aa as d,af as A,bg as L,dc as b,dg as G,g as c,hd as E,j as y,jd as x,mg as q,pf as g,ua as i,vg as B,wb as R,zg as V}from"./chunk-HONMJZOB.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};
