import{a as y}from"./chunk-TQI4DDDB.js";import{e as B}from"./chunk-BXZ5D2LN.js";import{h as a}from"./chunk-NMAI6SSY.js";import{e as d}from"./chunk-W3A2JYYI.js";import{V as F,g as T,h as j,i as Q,p as k}from"./chunk-HLHVLECB.js";import{g as L}from"./chunk-V47ENDL4.js";import{c as x}from"./chunk-S5VNTSUD.js";import{A as V,B as J,C as g,D as N,e as A,f as K,s as M,t as H,u as n,v as z,w as R,x as q}from"./chunk-PT2SMVM6.js";import{c as b,d as U}from"./chunk-PBM4LEG7.js";import{$b as l,F as s,Kb as w,Md as C,Sd as G,hc as u,ic as h,jc as v,k as r,la as I,nd as D,qa as S,va as p,wa as m,xb as c,yb as f}from"./chunk-PGS4AHIT.js";D();N();z();function ie(t){return()=>m(g).localization.isAnyLocalization([n.BA,n.MK])?(y.redirectTo(t),!1):!0}function te(t){return()=>m(g).localization.isAnyLocalization([n.BA,n.MK,n.RS])?(y.redirectTo(t),!1):!0}U();G();K();Q();I();H();D();q();var O=(()=>{class t{constructor(i,e){this.api=i,this.dialogService=e,this.depositData={depositValue:0},this.inputFields={depositValue:j.number({id:"depositValue",label:"Value",component:k,onReady:o=>{setTimeout(()=>o.focus?.(),0)}})},this.confirmDepositAction={id:"confirm-deposit-action",label:"Confirm",type:"mat-flat-button",icon:"far fa-check",onSelected:()=>r(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 r(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(M.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||t)(f(R),f(d))}}static{this.\u0275cmp=w({type:t,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,o){e&1&&(u(0,"div",0)(1,"div",1),v(2,"paw-input-field",2),h(),u(3,"div",3)(4,"div",4)(5,"div",5),v(6,"paw-action",6)(7,"paw-action",6),h()()()()),e&2&&(c(2),l("field",o.inputFields.depositValue)("model",o.depositData)("autofocus",!0),c(4),l("action",o.cancelDepositAction),c(),l("action",o.confirmDepositAction))},dependencies:[C,F,T,A,L,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 t})();z();I();D();J();var be=(()=>{class t{constructor(i,e,o){this.dialogService=i,this.localeService=e,this.moveService=o,this.dialogRef=null}checkDeposit(Re,Ve){return r(this,arguments,function*(i,e,o=a.Input,E=!1){if(this.localeService.defaultLocaleCode!==n.ME||!b.isSet(i))return;((yield this.checkDepositInitialized(e))===!1||E)&&this.openDepositDialog(this.dialogService,e,o)})}openDepositDialog(i,e,o=a.Input){this.isDepositDialogOpen()||(this.dialogRef=i.open({title:o===a.Input?"DepositInput":"DepositOutput",styleClass:"serial-numbers-container",component:O,bindings:{invoiceDeposit:{mode:o,workPlaceId:e}},size:"s",onClose:()=>{this.dialogRef=null}}))}checkDepositInitialized(i){return r(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||t)(p(d),p(V),p(B))}}static{this.\u0275prov=S({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();export{be as a,ie as b,te as c};
