import{a as L}from"./chunk-X7ZBCGYK.js";import{a as B}from"./chunk-XM453W3G.js";import{h as a}from"./chunk-NMAI6SSY.js";import{e as d}from"./chunk-KC3FDC76.js";import{V as T,g as j,h as k,i as N,p as F}from"./chunk-PPSZCPHP.js";import{g as z}from"./chunk-RWQFHLB3.js";import{c as x}from"./chunk-L7ZSBQSX.js";import{A as R,B as q,C as V,D as J,e as S,f as U,s as b,t as H,u as r,v as M,w as A,x as K}from"./chunk-DLQQOPQN.js";import{c as C,d as G}from"./chunk-PBM4LEG7.js";import{$b as c,F as s,Kb as I,Md as w,Sd as E,hc as f,ic as u,jc as h,k as n,la as D,nd as v,qa as g,va as p,wa as y,xb as l,yb as m}from"./chunk-PGS4AHIT.js";v();J();M();function ie(o){return()=>y(V).localization.isAnyLocalization([r.BA,r.RS,r.MK])?(L.redirectTo(o),!1):!0}G();E();U();N();D();H();v();K();var O=(()=>{class o{constructor(i,e){this.api=i,this.dialogService=e,this.depositData={depositValue:0},this.inputFields={depositValue:k.number({id:"depositValue",label:"Value",component:F,onReady:t=>{setTimeout(()=>t.focus?.(),0)}})},this.confirmDepositAction={id:"confirm-deposit-action",label:"Confirm",type:"mat-flat-button",icon:"far fa-check",onSelected:()=>n(this,null,function*(){return yield this.registerDeposit()})},this.cancelDepositAction={id:"cancel-deposit-action",label:"Cancel",type:"paw-icon-btn",icon:"far fa-times",onSelected:()=>{this.dialogRef.close()}}}registerDeposit(){return n(this,null,function*(){this.invoiceDeposit?.mode!==a.Input&&this.depositData.depositValue>0&&(this.depositData.depositValue=-this.depositData.depositValue);let i=yield s(this.api.post(b.fiscalWorkPlace.registerCash,{amount:this.depositData.depositValue,workPlaceId:this.invoiceDeposit?.workPlaceId}));i.isSuccessful?this.dialogRef.close():this.dialogService.openTyped({type:"error",text:i.errors,confirmButtonLabel:"Confirm",denyButtonLabel:null})})}static{this.\u0275fac=function(e){return new(e||o)(m(A),m(d))}}static{this.\u0275cmp=I({type:o,selectors:[["paw-invoice-deposit"]],inputs:{invoiceDeposit:"invoiceDeposit",dialogRef:"dialogRef"},decls:8,vars:5,consts:[[1,"paw-area-v","paw-holder"],[1,"paw-col","paw-offset"],[1,"paw-label-width-m",3,"field","model","autofocus"],[1,"paw-col","text-right"],[1,"modal-footer"],[1,"footer-actions"],[3,"action"]],template:function(e,t){e&1&&(f(0,"div",0)(1,"div",1),h(2,"paw-input-field",2),u(),f(3,"div",3)(4,"div",4)(5,"div",5),h(6,"paw-action",6)(7,"paw-action",6),u()()()()),e&2&&(l(2),c("field",t.inputFields.depositValue)("model",t.depositData)("autofocus",!0),l(4),c("action",t.cancelDepositAction),l(),c("action",t.confirmDepositAction))},dependencies:[w,T,j,S,z,x],styles:[".modal-footer[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;align-items:center;padding-top:10px;padding-right:10px;border-top:1px solid var(--paw-color-divider);gap:.5rem}.footer-actions[_ngcontent-%COMP%]{display:flex;gap:.5rem}"]})}}return o})();M();D();v();q();var be=(()=>{class o{constructor(i,e,t){this.dialogService=i,this.localeService=e,this.moveService=t,this.dialogRef=null}checkDeposit(Re,Ve){return n(this,arguments,function*(i,e,t=a.Input,P=!1){if(this.localeService.defaultLocaleCode!==r.ME||!C.isSet(i))return;((yield this.checkDepositInitialized(e))===!1||P)&&this.openDepositDialog(this.dialogService,e,t)})}openDepositDialog(i,e,t=a.Input){this.isDepositDialogOpen()||(this.dialogRef=i.open({title:t===a.Input?"DepositInput":"DepositOutput",styleClass:"serial-numbers-container",component:O,bindings:{invoiceDeposit:{mode:t,workPlaceId:e}},size:"s",onClose:()=>{this.dialogRef=null}}))}checkDepositInitialized(i){return n(this,null,function*(){if(!i)return!0;let e=yield s(this.moveService.workPlaceInitialTodayExist(i));return console.log("Deposit initialized:",e),e})}isDepositDialogOpen(){return console.log("Deposit dialog open:",!!this.dialogRef),!!this.dialogRef}static{this.\u0275fac=function(e){return new(e||o)(p(d),p(R),p(B))}}static{this.\u0275prov=g({token:o,factory:o.\u0275fac,providedIn:"root"})}}return o})();export{be as a,ie as b};
