import{a as V,b as W}from"./chunk-5TTXT2K2.js";import{a as L,b as G,c as q,h as B}from"./chunk-BQPO535K.js";import{a as P,b as R,c as j}from"./chunk-U5Y75IZ5.js";import{E as w,a as O,c as F,h as k,o as A}from"./chunk-MDIMQ3H3.js";import{a as S}from"./chunk-3DEA4WWC.js";import{n as E}from"./chunk-TKVDP62Z.js";import{Ad as f,Bb as N,Bc as T,Db as M,Ec as I,F as C,Ib as p,Jb as t,Kb as m,Xb as u,Za as r,eb as a,ib as c,mc as s,nd as D,oc as d,rc as h,sc as _,tc as y}from"./chunk-GJDGQISV.js";import{k as g}from"./chunk-SNAKHGZS.js";var b=class n{constructor(e,i,o){this.dialogRef=e;this.data=i;this.toastr=o;this.config.title=`Edit ${i.transactionType} Number`,this.config.customWidth="300px",this.invoiceNumber=i.invoiceNumber,this.transactionType=i.transactionType}config=new R;invoiceNumber;transactionType;ok(){S.IsNotEmpty(this.invoiceNumber)?this.dialogRef.close(this.invoiceNumber):this.toastr.info("Invoice number can not be empty",P.Info)}static \u0275fac=function(i){return new(i||n)(a(L),a(G),a(E))};static \u0275cmp=c({type:n,selectors:[["POS-modal-invoice-number"]],decls:6,vars:3,consts:[[3,"onOk","onCancel","onClose","config"],[1,"form-floating-outline","m-0"],["type","text","id","invoiceNumber","name","invoiceNumber",1,"form-control",3,"ngModelChange","ngModel"],["for","invoiceNumber"]],template:function(i,o){i&1&&(t(0,"modal-material",0),u("onOk",function(){return o.ok()})("onCancel",function(){return o.dialogRef.close()})("onClose",function(){return o.dialogRef.close()}),t(1,"content")(2,"div",1)(3,"input",2),y("ngModelChange",function(v){return _(o.invoiceNumber,v)||(o.invoiceNumber=v),v}),m(),t(4,"label",3),s(5),m()()()()),i&2&&(p("config",o.config),r(3),h("ngModel",o.invoiceNumber),r(2),d("",o.transactionType," Number"))},dependencies:[f,w,F,k,A,j],encapsulation:2})};var K=(n,e)=>({"px-2 py-2 number-disabled":n,pointer:e});function Q(n,e){n&1&&(t(0,"span"),s(1,"Editing"),m())}var H=class n{constructor(e){this.matDialog=e}isEdit=!1;transactionType="Purchase Order";disabled=!1;invoiceNumber="";onChange=e=>{};onTouched=()=>{};writeValue(e){this.invoiceNumber=e}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){this.disabled=e}openModalSelectOutlet(){return g(this,null,function*(){this.disabled||this.matDialog.open(b,{data:{transactionType:this.transactionType,invoiceNumber:this.invoiceNumber}}).afterClosed().pipe(C(e=>e)).subscribe(e=>{this.invoiceNumber=e,this.onChange(this.invoiceNumber)})})}static \u0275fac=function(i){return new(i||n)(a(q))};static \u0275cmp=c({type:n,selectors:[["POS-invoice-number-form"]],inputs:{isEdit:"isEdit",transactionType:"transactionType"},features:[T([{provide:O,multi:!0,useExisting:n}])],decls:3,vars:7,consts:[[1,"fw-normal",3,"click","ngClass","matTooltip"]],template:function(i,o){i&1&&(t(0,"h6",0),u("click",function(){return o.openModalSelectOutlet()}),N(1,Q,2,0,"span"),s(2),m()),i&2&&(p("ngClass",I(4,K,o.disabled,!o.disabled))("matTooltip",o.disabled?"Number Edit role is required":""),r(),M(o.isEdit?1:-1),r(),d(" ",o.invoiceNumber?o.transactionType+" #"+o.invoiceNumber:"Order Number"," "))},dependencies:[f,D,B,W,V],styles:[".number-disabled[_ngcontent-%COMP%]{background-color:#ebebe4}"]})};export{H as a};
