dealpos 25.37.0 → 25.37.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/{chunk-SNJEJYG2.js → chunk-2CJDU4L3.js} +1 -1
- package/browser/{chunk-FQVW7CGL.js → chunk-2LHNA5AI.js} +1 -1
- package/browser/chunk-2URCBLJ7.js +1 -0
- package/browser/{chunk-PKQIL6XI.js → chunk-2Z5J6Q7M.js} +1 -1
- package/browser/chunk-4ASACD3Q.js +1 -0
- package/browser/{chunk-ZCDMIPJU.js → chunk-4PBQC5P6.js} +1 -1
- package/browser/{chunk-AD6WDFXK.js → chunk-5432OTF7.js} +12 -12
- package/browser/{chunk-QZ3Q6NRS.js → chunk-5A5MC6CY.js} +1 -1
- package/browser/{chunk-QC47T2D6.js → chunk-5G6GUMV7.js} +1 -1
- package/browser/{chunk-RFWWJGW4.js → chunk-5MV4W4N6.js} +1 -1
- package/browser/{chunk-4WQSHRH2.js → chunk-5WG74DJT.js} +1 -1
- package/browser/{chunk-KH2UDF7R.js → chunk-5WHPKSFW.js} +1 -1
- package/browser/{chunk-OZURIMA5.js → chunk-5XLUITBY.js} +1 -1
- package/browser/{chunk-CHGBO35F.js → chunk-624G6F5C.js} +2 -2
- package/browser/{chunk-PNIMYMZP.js → chunk-6FKZY7NZ.js} +1 -1
- package/browser/chunk-6G2IT6WP.js +125 -0
- package/browser/{chunk-4DVZDOPA.js → chunk-6HQRARSZ.js} +1 -1
- package/browser/{chunk-O7KNQINR.js → chunk-6JCU4GNE.js} +1 -1
- package/browser/{chunk-BPRFPZEB.js → chunk-6WHOPHRH.js} +1 -1
- package/browser/{chunk-POVSBSKX.js → chunk-72KIMU7G.js} +1 -1
- package/browser/{chunk-UCICCJTH.js → chunk-76T3TRG4.js} +1 -1
- package/browser/{chunk-BVGEZF5R.js → chunk-7IFXHB4V.js} +1 -1
- package/browser/{chunk-XPQVQT3S.js → chunk-7ZD2267X.js} +1 -1
- package/browser/{chunk-TB75D3IU.js → chunk-A4RN7PGI.js} +1 -1
- package/browser/{chunk-UTZWX547.js → chunk-AASLGLOM.js} +1 -1
- package/browser/{chunk-TAJ6RGE7.js → chunk-ACGNZNFL.js} +1 -1
- package/browser/{chunk-RNTEPBDE.js → chunk-AHC27CIW.js} +1 -1
- package/browser/{chunk-EDWPAQ6M.js → chunk-AKPQZTEV.js} +1 -1
- package/browser/{chunk-2ROJZVYG.js → chunk-AQH2TWJK.js} +1 -1
- package/browser/{chunk-6VZV7MGQ.js → chunk-AUWH2QWX.js} +1 -1
- package/browser/{chunk-QHX47K74.js → chunk-AXEM33OC.js} +1 -1
- package/browser/{chunk-ODQBAQBJ.js → chunk-BO2Z4RGZ.js} +1 -1
- package/browser/{chunk-EWXIFMSD.js → chunk-BQJ7JR25.js} +1 -1
- package/browser/{chunk-V2XQVY7J.js → chunk-C2LSF7S2.js} +1 -1
- package/browser/{chunk-KRYHSAUY.js → chunk-CEOPBVEH.js} +1 -1
- package/browser/chunk-CFWQ2KY4.js +1 -0
- package/browser/{chunk-ZCFM5BQX.js → chunk-CJJZFHED.js} +1 -1
- package/browser/{chunk-7JQTRIEY.js → chunk-CZ2RXLZJ.js} +3 -3
- package/browser/{chunk-GTGAF77W.js → chunk-D5JRP2GG.js} +1 -1
- package/browser/{chunk-73LN2NNG.js → chunk-DGPCJB6P.js} +1 -1
- package/browser/{chunk-DJX5T4HW.js → chunk-DSIUUK4N.js} +1 -1
- package/browser/chunk-DSLMCH3G.js +1 -0
- package/browser/{chunk-5Y6LNGZI.js → chunk-DTFL44UO.js} +1 -1
- package/browser/{chunk-BJRHO7B6.js → chunk-DZ35QZ6L.js} +1 -1
- package/browser/{chunk-QZIRZTPY.js → chunk-E3GQ2VEU.js} +1 -1
- package/browser/{chunk-NZBTAJVH.js → chunk-E52CQ3NY.js} +1 -1
- package/browser/{chunk-SRND2A73.js → chunk-EANTJIRK.js} +1 -1
- package/browser/{chunk-AFOWQSNS.js → chunk-ELFCO6CE.js} +1 -1
- package/browser/{chunk-XZYKB3CY.js → chunk-EMYSF46P.js} +1 -1
- package/browser/{chunk-ZDC75EES.js → chunk-EQT4SGSU.js} +1 -1
- package/browser/{chunk-R2SCZAYC.js → chunk-FJULFWMX.js} +1 -1
- package/browser/{chunk-T3GW7VTG.js → chunk-FLEDIXNB.js} +1 -1
- package/browser/{chunk-ONUC6T7C.js → chunk-FY5VLGQC.js} +11 -11
- package/browser/chunk-G7B75J34.js +24 -0
- package/browser/{chunk-EBVXAICN.js → chunk-GAPY6IUE.js} +1 -1
- package/browser/{chunk-OYBCYKI3.js → chunk-GTRQV3VX.js} +1 -1
- package/browser/{chunk-O3BPVSF4.js → chunk-H4SCBKWD.js} +1 -1
- package/browser/{chunk-GW74DTO5.js → chunk-HHIBVND5.js} +1 -1
- package/browser/{chunk-JI5ZYBTO.js → chunk-HNX747EE.js} +1 -1
- package/browser/{chunk-LP34YRUB.js → chunk-HPGHC3LU.js} +1 -1
- package/browser/{chunk-UGMPRPX4.js → chunk-HUAA5QUE.js} +1 -1
- package/browser/{chunk-O2ZVYLBU.js → chunk-I3EBD4BM.js} +1 -1
- package/browser/{chunk-M7KCDBAN.js → chunk-IWIKKZRE.js} +1 -1
- package/browser/{chunk-YKOMJJTD.js → chunk-IWJJRPWB.js} +1 -1
- package/browser/{chunk-OQD6YPIV.js → chunk-J7WZSDR6.js} +1 -1
- package/browser/chunk-JDDFGHZC.js +1 -0
- package/browser/{chunk-USIHDJYD.js → chunk-JIYAVK6J.js} +1 -1
- package/browser/chunk-JZ7HH3AD.js +1 -0
- package/browser/{chunk-GRQCNGGD.js → chunk-K463QEUH.js} +1 -1
- package/browser/{chunk-M6LI6JL5.js → chunk-KEU6GUET.js} +1 -1
- package/browser/{chunk-TE4BS674.js → chunk-KOWDWAD2.js} +1 -1
- package/browser/{chunk-NF6DNR4C.js → chunk-KZU22HGO.js} +1 -1
- package/browser/{chunk-TKFYO4Z7.js → chunk-L4VLBO5X.js} +1 -1
- package/browser/{chunk-HN5FVXT3.js → chunk-L6G7INVR.js} +2 -2
- package/browser/{chunk-E5YR3WZZ.js → chunk-LD5LH2YH.js} +1 -1
- package/browser/{chunk-ZSHFCUED.js → chunk-LK3EGJFT.js} +1 -1
- package/browser/{chunk-NPQSMHJ5.js → chunk-LPFP4NOL.js} +1 -1
- package/browser/{chunk-D3PKJLSL.js → chunk-LUMOPVCB.js} +1 -1
- package/browser/{chunk-OJGFPN3S.js → chunk-M5R3Y6BD.js} +1 -1
- package/browser/{chunk-OPIK5VF5.js → chunk-MH3LXNOS.js} +2 -2
- package/browser/{chunk-46N7UCK4.js → chunk-N276B6EI.js} +1 -1
- package/browser/{chunk-L2BZNKXK.js → chunk-N2FNF62O.js} +1 -1
- package/browser/{chunk-CAB2DX2Y.js → chunk-N3XWBPCL.js} +1 -1
- package/browser/chunk-NDQYXKAN.js +1 -0
- package/browser/{chunk-CDHS2KPQ.js → chunk-ORFYFJKS.js} +1 -1
- package/browser/{chunk-BMXD4XFY.js → chunk-OXLXIWTF.js} +1 -1
- package/browser/{chunk-KC3ILZPL.js → chunk-PT4Y2VNN.js} +1 -1
- package/browser/{chunk-4PAT6OG2.js → chunk-PXNAXAQB.js} +1 -1
- package/browser/{chunk-UB3H2XOK.js → chunk-QRI23WCG.js} +1 -1
- package/browser/{chunk-5UVEMM3K.js → chunk-R5MMHEH6.js} +1 -1
- package/browser/{chunk-YFVKU4AG.js → chunk-RCW46J3Z.js} +1 -1
- package/browser/{chunk-2A2FK5LQ.js → chunk-SF3RHVSN.js} +1 -1
- package/browser/{chunk-N5LL2GVO.js → chunk-SOE2QU22.js} +1 -1
- package/browser/{chunk-KGEZPUKQ.js → chunk-SZDICN4P.js} +1 -1
- package/browser/{chunk-BWWLIKSO.js → chunk-TDMU55LA.js} +1 -1
- package/browser/{chunk-AIRALBLX.js → chunk-TOOIVKU3.js} +1 -1
- package/browser/{chunk-NCV64WUQ.js → chunk-TPDNCYEZ.js} +1 -1
- package/browser/{chunk-YTXPIPA3.js → chunk-UQKMHV26.js} +1 -1
- package/browser/{chunk-DTGBADKW.js → chunk-UR37FTL2.js} +1 -1
- package/browser/{chunk-VPYNMPI2.js → chunk-UTHVS7YI.js} +4 -4
- package/browser/{chunk-WNGIPTOJ.js → chunk-V55A6VFC.js} +1 -1
- package/browser/{chunk-4MQM5WKF.js → chunk-VGHP2OV6.js} +1 -1
- package/browser/{chunk-FSTU67H4.js → chunk-VWRUQ7XW.js} +1 -1
- package/browser/{chunk-YVLMNAFQ.js → chunk-VZLT2MGB.js} +1 -1
- package/browser/{chunk-6EYQ2WU4.js → chunk-WF6K2YER.js} +1 -1
- package/browser/{chunk-RQ6BETUF.js → chunk-WUZXIQKO.js} +1 -1
- package/browser/{chunk-5HPGSO2H.js → chunk-X3P7SVC6.js} +1 -1
- package/browser/{chunk-4SQ7LDSX.js → chunk-XNE22IC6.js} +2 -2
- package/browser/{chunk-BBBJXAJC.js → chunk-XOMO7AVU.js} +1 -1
- package/browser/{chunk-2N32YZ7F.js → chunk-XQCKNZ75.js} +2 -2
- package/browser/{chunk-R6DWCBDE.js → chunk-YFWHKWUO.js} +1 -1
- package/browser/{chunk-A6EXQHD5.js → chunk-YUSWA5RC.js} +1 -1
- package/browser/chunk-Z6TVE7B7.js +1 -0
- package/browser/{chunk-42GZELPL.js → chunk-ZAJBQGZU.js} +2 -2
- package/browser/{chunk-ZXBQDGF2.js → chunk-ZDJDS43F.js} +1 -1
- package/browser/{chunk-46YKB6FF.js → chunk-ZLGNHROO.js} +1 -1
- package/browser/{chunk-VTPT2NPM.js → chunk-ZWXGSLUJ.js} +1 -1
- package/browser/{chunk-D35OBUDE.js → chunk-ZZ7LHETD.js} +4 -4
- package/browser/index.html +2 -2
- package/browser/{main-ODGVJKPE.js → main-T6SFWIAO.js} +2 -2
- package/package.json +1 -1
- package/browser/chunk-24PZBJDX.js +0 -1
- package/browser/chunk-6GD3RYJT.js +0 -24
- package/browser/chunk-6KVSC3SY.js +0 -1
- package/browser/chunk-BAHRLYTL.js +0 -1
- package/browser/chunk-E7OGKKDF.js +0 -1
- package/browser/chunk-I7QI76VZ.js +0 -125
- package/browser/chunk-NKVJFEGS.js +0 -1
- package/browser/chunk-NMFTKX47.js +0 -1
- package/browser/chunk-X35FSHRI.js +0 -1
- package/browser/chunk-XQDOEZXX.js +0 -1
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import{a as ji}from"./chunk-NF6DNR4C.js";import{a as Li,c as Qi}from"./chunk-ZXBQDGF2.js";import{a as ki,b as Vi,c as Ri,d as $i,e as Bi,f as Be}from"./chunk-ZDC75EES.js";import{a as Kt}from"./chunk-BMXD4XFY.js";import"./chunk-WJWWBE6Y.js";import{a as Fi}from"./chunk-SNJEJYG2.js";import{a as Wt}from"./chunk-CFUU3EHR.js";import{a as hi}from"./chunk-6SK3XWNT.js";import{a as qt}from"./chunk-W4E3XWPN.js";import{a as In}from"./chunk-UU5RJKWG.js";import{c as Mi,d as Pi}from"./chunk-E5YR3WZZ.js";import"./chunk-7BU64MD2.js";import{a as Ni}from"./chunk-T3GW7VTG.js";import"./chunk-5JZJ4OL3.js";import{a as Ei}from"./chunk-P5PNY2PR.js";import"./chunk-SE7OFLAL.js";import"./chunk-NOLQHNIQ.js";import"./chunk-WLRXTHLM.js";import{a as Ht,b as Si,c as Ii}from"./chunk-5HPGSO2H.js";import"./chunk-ZCDMIPJU.js";import{a as Pt}from"./chunk-5VAXIJEW.js";import"./chunk-YOKPVEGO.js";import"./chunk-BYXBJQAS.js";import"./chunk-BYXBJQAS.js";import"./chunk-UCICCJTH.js";import{b as _i}from"./chunk-I5K3C5EY.js";import"./chunk-OLALZT3L.js";import"./chunk-DWWBB3GE.js";import"./chunk-6N4AU5UX.js";import{a as Ai}from"./chunk-ZSHFCUED.js";import"./chunk-A6YCCT6G.js";import{a as oi}from"./chunk-O7MCO2N7.js";import"./chunk-UZKYLAUE.js";import{b as Di}from"./chunk-EBVXAICN.js";import{a as Oi,b as Ti,c as wi}from"./chunk-47MDCKEY.js";import{a as Jt,b as Gt}from"./chunk-YVLMNAFQ.js";import{e as vt}from"./chunk-M6LI6JL5.js";import{a as xi}from"./chunk-TGAOY65D.js";import{d as vi,e as Ut}from"./chunk-WNGIPTOJ.js";import"./chunk-POVSBSKX.js";import"./chunk-3RK6DDJD.js";import"./chunk-L2EDFSBR.js";import{a as Qt}from"./chunk-XX6Z7QPA.js";import"./chunk-5Y6LNGZI.js";import"./chunk-TEFNN3TY.js";import"./chunk-CAB2DX2Y.js";import"./chunk-JKYTSC2D.js";import"./chunk-VQ7WKMGF.js";import"./chunk-OBNSNZON.js";import{a as ri,b as li,c as si}from"./chunk-DJX5T4HW.js";import"./chunk-RBCKIP6D.js";import"./chunk-FD5YMPRL.js";import"./chunk-MV3QRRW6.js";import"./chunk-3LBZWLLT.js";import"./chunk-LZNTSIJX.js";import"./chunk-C6ARCDXZ.js";import{a as ui,b as fi}from"./chunk-6EYQ2WU4.js";import"./chunk-52EOLV7I.js";import{a as ii}from"./chunk-5UL73W4S.js";import{a as ot,c as at}from"./chunk-LNVTHMH7.js";import{a as ci,d as pi,f as mi,h as di}from"./chunk-6ZOGADBZ.js";import{A as bi,G as Ci,q as ai,u as we,v as Ee,w as Ne,x as gi,z as yi}from"./chunk-ONUC6T7C.js";import{b as bt,c as Ct}from"./chunk-CIBQBSM6.js";import{P as $e}from"./chunk-IX5URHI7.js";import{a as zn,b as Yn,c as Xn}from"./chunk-GIKR6Y2K.js";import{d as _t}from"./chunk-LPGMI3V2.js";import{a as ee,e as Te,f as Re,g as ne,l as Lt}from"./chunk-D35OBUDE.js";import"./chunk-567HXZXC.js";import"./chunk-I7VBCYOO.js";import"./chunk-CGESXTHC.js";import{a as xe}from"./chunk-2FWFPV5I.js";import"./chunk-TLOTIYIE.js";import{E as ti,F as Oe,G as Ke,a as Ge,b as Zn,c as he,h as le,l as me,o as Pe,r as ei,s as qe}from"./chunk-2RSBMS36.js";import{a as ni}from"./chunk-OQD6YPIV.js";import{a as P,d as De}from"./chunk-AHCRE4GP.js";import"./chunk-FSTU67H4.js";import{$ as ct,$a as l,$b as At,Ac as y,Bc as Sn,D as tt,Db as mt,E as V,Fc as be,H as An,I as _e,Ib as a,Jb as r,Ka as Dn,Kb as I,Lb as Q,M as kn,Ma as pt,Mb as U,N as hn,Ob as B,Od as qn,Q as Vn,Qb as _,Qc as Hn,Qd as Kn,Rb as d,Rd as Bt,T as Rn,Td as jt,Ub as xn,Va as Bn,Vd as Je,W as Mt,Wa as nt,Wc as it,Y as te,Yc as He,Yd as se,Zb as Nt,Zc as pe,_a as jn,_b as Ft,aa as Z,bc as kt,ca as $n,cb as Ln,cc as Vt,cd as Ve,d as ve,db as f,dc as ue,e as Xe,ec as m,ed as Jn,f as En,fa as E,fb as Qn,fc as X,ga as de,gb as Et,gc as j,gd as Me,hc as We,ja as oe,jc as H,jd as F,k as Ae,kb as N,kc as L,lc as J,ma as W,n as Nn,na as ce,o as Ze,ob as Un,p as Fn,pc as ke,qb as D,qc as Rt,rc as ae,sc as $t,sd as Gn,t as u,u as Ie,v as _n,va as x,vb as c,wa as S,xb as yt,y as st,zb as Wn,zc as g}from"./chunk-DZT5XHBQ.js";import{a as T,b as R,d as wn,j as gt}from"./chunk-7DCB7DB2.js";var q=class i{constructor(t,e){this.http=e;this.buyForm=t.group({NewOrderID:[""],Order:t.group({Att:[""],SupplierID:[""],Number:[""],Date:[new Date],ID:[P.GuidEmpty]}),Invoice:t.group({ID:[P.GuidEmpty],Due:[new Date],Tax:[0]}),Payment:t.group({ID:[P.GuidEmpty],Amount:[0],MethodID:[0],Code:[""],Note:[""],ImageUrl:[""]})})}outlet=new me({ID:"",Name:"Choose an Outlet"});dueDays=new me(0);deliveryEntityID=new me(P.GuidEmpty);noteForm=new me({Note:"",TagID:"",Currency:{ID:"",ExchangeRate:0,Symbol:""},InvoiceNumber:""});discountAndTaxForm=new me({Discount:{Amount:0,Percentage:0},Tax:{ID:"",CalculationTypeName:"",Rate:0,Label:"",Discontinue:!1}});buyForm;setPONumber(t){let e="";if(t.Seed){let n=t.Seed+"";for(;n.length<t.Digit;)n="0"+n;e=P.StringFormat(t.Prefix,n)}this.buyForm.controls.Order.controls.Number.setValue(e)}setDueDateBasedOnDaysDue(t){console.log(t);let e=this.invoiceDate,n=new Date(P.cloneObject(e));n.setDate(n.getDate()+t),this.buyForm.controls.Invoice.controls.Due.setValue(n)}get dueDate(){return this.buyForm.controls.Invoice.controls.Due.value}get invoiceDate(){return this.buyForm.controls.Order.controls.Date.value}setAmount(t){this.buyForm.controls.Payment.controls.Amount.setValue(t)}setPaymentMethodID(t){this.buyForm.controls.Payment.controls.MethodID.setValue(t)}setTaxAmount(t){this.buyForm.controls.Invoice.controls.Tax.setValue(t)}setNewOrderID(t){this.buyForm.controls.NewOrderID.setValue(t)}setTax(t){let e=T({},this.discountAndTaxForm.value.Discount);this.discountAndTaxForm.setValue({Discount:e,Tax:t})}setCurrency(t){let e=this.noteForm.value;this.noteForm.setValue(R(T({},e),{Currency:t}))}setDeliveryEntityID(t){this.deliveryEntityID.setValue(t)}setdueDays(t){this.dueDays.setValue(t)}setBulkOrderForm(t){this.buyForm.controls.Order.setValue(t)}setBulkNoteForm(t){this.noteForm.setValue(t)}setBulkDiscountAndTaxForm(t){this.discountAndTaxForm.setValue(t)}setOutletForm(t){this.outlet.setValue(t)}setBulkInvoice(t){this.buyForm.controls.Invoice.setValue(T(T({},this.buyForm.controls.Invoice.value),t))}setBulkPayment(t){this.buyForm.controls.Payment.setValue(t)}resetOutletForm(){this.outlet.setValue({ID:"",Name:"Choose an Outlet"})}resetDueDaysForm(){this.dueDays.setValue(0)}resetDeliveryEntityID(){this.deliveryEntityID.setValue(P.GuidEmpty)}resetNoteForm(){this.noteForm.setValue(R(T({},this.noteForm.value),{Note:"",TagID:"",InvoiceNumber:""}))}resetDiscountAndTaxForm(){let t=this.discountAndTaxForm.value;this.discountAndTaxForm.setValue(R(T({},t),{Discount:{Amount:0,Percentage:0}}))}resetBuyForm(){this.buyForm.reset(),this.buyForm.controls.Invoice.controls.ID.setValue(P.GuidEmpty),this.buyForm.controls.Invoice.controls.Due.setValue(new Date),this.buyForm.controls.Order.controls.Date.setValue(new Date),this.buyForm.controls.Order.controls.ID.setValue(P.GuidEmpty),this.generateNumberOnNewTransaction()}generateNumberOnNewTransaction(){this.http.post("/API/Buy/GenerateNumber",{ID:this.outlet.value.ID}).subscribe(t=>{this.setNewOrderID(P.Guid_NewGuid()),this.buyForm.controls.Order.controls.Number.setValue(t.Number)})}static \u0275fac=function(e){return new(e||i)(W(ti),W(se))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};var ge=class i{entities$;appConfigJSON$;taxes$;currencies$;supplierPOTypes$;predefinedNotes$;denomination$;defaultDueDays$;constructor(t,e){let n=t.get("/API/Buy2/Load").pipe(E(o=>e.setCurrency(o.Currencies.find(s=>s.ID==o.AppConfigJSON.CoreDefaults.CurrencyID))),te(1));this.denomination$=n.pipe(u(o=>o.Denomination)),this.entities$=n.pipe(u(o=>o.Entities)),this.appConfigJSON$=n.pipe(u(o=>o.AppConfigJSON)),this.taxes$=n.pipe(u(o=>o.Taxes),te(1)),this.currencies$=n.pipe(u(o=>o.Currencies),te(1)),this.supplierPOTypes$=n.pipe(u(o=>o.SupplierPOTypes)),this.predefinedNotes$=n.pipe(u(o=>o.PredefinedNotes)),this.defaultDueDays$=n.pipe(u(o=>o.AppConfigJSON.ModuleBuy.PaymentDialog.DefaultDueDays),E(o=>e.setdueDays(o)),E(o=>e.setDueDateBasedOnDaysDue(o)))}updateDueDays(){this.defaultDueDays$.subscribe()}static \u0275fac=function(e){return new(e||i)(W(se),W(q))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};var rt=class i{returnInvoiceNumber=new me("");invoiceInfo$;constructor(t,e,n){let o=e.outlet.valueChanges.pipe(u(p=>p.ID),ee());this.invoiceInfo$=this.returnInvoiceNumber.valueChanges.pipe(V(p=>!!p),de(o),Z(([p,M])=>t.post("/API/Buy/GetSupplierInvoiceRetur2",{EntityID:M,Number:p}).pipe(_e(()=>Ae))),te(1),ee());let s=this.invoiceInfo$.pipe(u(p=>T({},p.Order)),E(p=>{let M={Att:p.Att,SupplierID:{Key:p.SupplierID,Value:p.SupplierName,OnSet:!0},Date:new Date,Number:e.buyForm.controls.Order.controls.Number.value,ID:P.GuidEmpty};e.setBulkOrderForm(M)}),ee()),O=this.invoiceInfo$.pipe(u(p=>p.Order),E(p=>{let M={Note:`Return #${p.Number}`,TagID:p.TypeID,Currency:{ID:p.CurrencyID,ExchangeRate:p.CurrencyRate,Symbol:p.CurrencySymbol??"$"},InvoiceNumber:p.Number};e.setBulkNoteForm(M)}),ee()),v=this.invoiceInfo$.pipe(u(p=>p.Order),de(n.taxes$),u(([p,M])=>R(T({},p),{Tax:M.find(G=>G.ID===p.TaxTypeID)})),E(p=>{let M={Discount:{Amount:p.DiscountAmount,Percentage:p.Discount},Tax:{ID:p.TaxTypeID,Rate:p.Tax?.Rate,CalculationTypeName:p.Tax?.CalculationTypeName,Label:p.Tax?.Label,Discontinue:!p.Tax?.Label}};e.setBulkDiscountAndTaxForm(M)}),ee()),$=this.invoiceInfo$.pipe(u(p=>p.DeliveryEntityID),E(p=>e.setDeliveryEntityID(p)),ee()),K=this.invoiceInfo$.pipe(u(p=>p.Invoice),E(p=>{let M={ID:p.ID,Tax:p.Tax};e.setBulkInvoice(M)}),ee()),h=this.invoiceInfo$.pipe(u(p=>p.Payment),E(p=>{let M={ID:P.GuidEmpty,Amount:p.Amount,MethodID:p.MethodID,Note:p.Note,Code:p.Code,ImageUrl:p.ImageUrl};e.setBulkPayment(M)}),ee());Ie(s,O,v,$,K,h).pipe(ee()).subscribe()}static \u0275fac=function(e){return new(e||i)(W(se),W(q),W(ge))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};var ie=class i{constructor(t,e,n,o){this.matDialog=o;let s=e.outlet.valueChanges.pipe(u(p=>p.ID));this.addVariantThroughSerial$=this._addVariantThroughSerial.asObservable().pipe(de(s),Z(([p,M])=>t.get($e.GetVariantBySerial,[{key:"Serial",value:p},{key:"EntityID",value:M}]).pipe(_e(()=>Ae))),u(p=>this.setUnitPrice(p)),u(p=>R(T({},p),{Quantity:1,Total:p.UnitPrice,VariantID:p.ID})),u(p=>({action:"addAsSerial",variant:p})));let O=this.variantAutocomplete.valueChanges.pipe(V(p=>P.IsNotEmpty(p)&&p.type=="Code"),u(p=>p.str),de(s),Z(([p,M])=>t.get($e.GetVariantByCode,[{key:"Code",value:p},{key:"EntityID",value:M},{key:"Promotion",value:!0}]).pipe(_e(()=>Ae))),u(p=>this.setUnitPrice(p)),u(p=>R(T({},p),{Quantity:1,Total:p.UnitPrice*((100-p.PriceDiscount)/100),Discount:p.PriceDiscount,VariantID:p.ID}))),v=this.variantAutocomplete.valueChanges.pipe(V(p=>P.IsNotEmpty(p)&&p.type=="ID"),u(p=>p.str)),$=this.variantQuickKey.valueChanges,K=tt(v,$).pipe(de(s),Z(([p,M])=>t.get($e.GetVariantByID,[{key:"ID",value:p},{key:"EntityID",value:M}]).pipe(_e(()=>Ae))),u(p=>this.setUnitPrice(p)),u(p=>R(T({},p),{Quantity:1,Total:p.UnitPrice*((100-p.OrderPriceDiscount)/100),Discount:p.OrderPriceDiscount,VariantID:p.ID}))),h=tt(K,O).pipe(E(p=>{p.CategoryTypeID===1&&this.toastr.info(`${p.Name} is sellable only.`,xe.Info)}),V(p=>p.CategoryTypeID!==1),u(p=>({action:"add",variant:p})),E(()=>{this.cartDisplayRef&&setTimeout(()=>{let p=this.cartDisplayRef.nativeElement.scrollHeight;this.cartDisplayRef.nativeElement.scrollTop=p},1)})),A=n.invoiceInfo$.pipe(u(p=>({action:"returnInvoice",variants:p.Items.map(M=>R(T({},M.Variant),{Quantity:M.Quantity,Total:M.Total,UnitPrice:M.UnitPrice,Discount:M.Discount,Serial:M.Serial,ID:M.ID,DiscountAmount:M.DiscountAmount,VariantID:M.VariantID,UnitQuantity:M.UnitQuantity}))})));this.cart$=tt(h,A,this.deleteVariant$,this.dragDropCart$,this.returnCart$,this.updateVariant$,this.returnVariant$,this.purchaseVariant$,this.clearCart$,this.onEditForm$,this.addVariantThroughSerial$,this.addVariant$,this.onUploadCart$,this.listenRFID$).pipe(Mt((p,M)=>{let G=[...p],Y=[],b=M.action;if(b=="add"){let C=M.variant;Y=!!G.find(k=>k.VariantID==C.ID)?G.map(k=>k.VariantID==C.ID?R(T({},k),{Quantity:k.Quantity+1,Total:k.Total+k.UnitPrice}):k):[...G,C]}else if(b=="returnInvoice"||b=="onEditForm")Y=M.variants;else if(b=="delete"){let C=M.index;Y=G.filter((w,k)=>k!=C)}else if(b=="sort"){let C=M.ev;Y=G,ci(Y,C.previousIndex,C.currentIndex)}else if(b=="returnCart")Y=G.map(C=>R(T({},C),{Quantity:-Math.abs(C.Quantity),Total:-Math.abs(C.Total)}));else if(b=="update"){let C=M.index;Y=G.map((w,k)=>k==C?M.variant:w)}else if(b=="returnVariant"){let C=M.index;Y=G.map((w,k)=>k==C?R(T({},w),{Quantity:-Math.abs(w.Quantity),Total:-Math.abs(w.Total)}):w)}else if(b=="purchaseVariant"){let C=M.index;Y=G.map((w,k)=>k==C?R(T({},w),{Quantity:Math.abs(w.Quantity),Total:Math.abs(w.Total)}):w)}else if(b=="clearCart")Y=[];else if(b=="addAsSerial"){let C=R(T({},M.variant),{Serial:[{Number:M.variant.Serial.Number,Quantity:1,ExpiryDate:M.variant.Serial.ExpiryDate}]});if(!!G.find(k=>k.ID==C.ID)){let k=C.Serial[0],Ce=G.find(fe=>fe.ID==C.ID),wt=!!Ce.Serial.find(fe=>fe.Number==k.Number)?[...Ce.Serial].map(fe=>fe.Number==k.Number?R(T({},fe),{Quantity:fe.Quantity+1}):fe):[...Ce.Serial,k];Y=G.map(fe=>fe.ID==C.ID?R(T({},fe),{Quantity:fe.Quantity+1,Total:fe.Total+fe.UnitPrice,Serial:wt}):fe)}else Y=[...G,R(T({},C),{Quantity:1,Total:C.UnitPrice})]}else if(b=="uploadCart")Y=[...G,...M.variants];else if(b=="addNewRow"){let C=M.variant;Y=[...G,C]}else if(b=="rfid"){let C=M.variants;Object.keys(C).forEach(w=>{if(C.hasOwnProperty(w)){let k=C[w];if(k&&Object.keys(k.variant).length>0){let Ce=G.findIndex(ft=>ft.Code.toLowerCase()===w.toLowerCase());if(Ce!==-1){let ft=Number(k.count);G[Ce].Quantity+=ft,G[Ce].Total=+G[Ce].UnitPrice*+G[Ce].Quantity,delete C[w],Y=[...G]}else{let ft=k.variant,wt=Number(k.count),fe=this.setUnitPrice(ft),Ki=this.formatItemObject(R(T({},fe),{Quantity:wt,Total:+fe.UnitPrice*+wt}));delete C[w],Y=[...G,Ki]}}}})}return Y},[]),ct([]),te(1)),this.totalVariantOrdered$=this.cart$.pipe(u(p=>p.map(M=>M.Quantity)),u(p=>p.reduce((M,G)=>M+G,0)),ct(0))}toastr=ce(Je);cartDisplayRef;variantAutocomplete=new me;variantQuickKey=new me;_listenRFID=new ve;listenRFID$=this._listenRFID.asObservable().pipe(u(t=>({action:"rfid",variants:t})));_deleteVariant=new ve;deleteVariant$=this._deleteVariant.asObservable().pipe(u(t=>({action:"delete",index:t})));_dragDropCart=new ve;dragDropCart$=this._dragDropCart.asObservable().pipe(u(t=>({action:"sort",ev:t})));_returnCart=new ve;returnCart$=this._returnCart.asObservable().pipe(u(()=>({action:"returnCart"})));_onEditForm=new Xe(null);onEditForm$=this._onEditForm.asObservable().pipe(V(t=>!!t),u(t=>({action:"onEditForm",variants:t})));_clearCart=new ve;clearCart$=this._clearCart.asObservable().pipe(u(()=>({action:"clearCart"})));_updateVariant=new ve;updateVariant$=this._updateVariant.asObservable().pipe(u(t=>({action:"update",variant:t.variant,index:t.index})));_returnVariant=new ve;returnVariant$=this._returnVariant.asObservable().pipe(u(t=>({action:"returnVariant",index:t})));_purchaseVariant=new ve;purchaseVariant$=this._purchaseVariant.asObservable().pipe(u(t=>({action:"purchaseVariant",index:t})));_addVariant=new ve;addVariant$=this._addVariant.asObservable().pipe(u(t=>({action:"addNewRow",variant:t})));_onUploadCart=new ve;onUploadCart$=this._onUploadCart.asObservable().pipe(u(t=>({action:"uploadCart",variants:t})));cart$;totalVariantOrdered$;_addVariantThroughSerial=new ve;addVariantThroughSerial$;deleteVariant(t){this._deleteVariant.next(t)}dragDropCart(t){this._dragDropCart.next(t)}returnCart(){this._returnCart.next()}updateVariant(t,e){this._updateVariant.next({variant:t,index:e})}returnVariant(t){this._returnVariant.next(t)}purchaseVariant(t){this._purchaseVariant.next(t)}clearCart(){this._clearCart.next()}editForm(t){this._onEditForm.next(t)}addVariant(t){this._addVariant.next(t)}addVariantThroughSerial(t){this._addVariantThroughSerial.next(t)}uploadCart(t){this._onUploadCart.next(t)}setUnitPrice(t){let e=T({},t);return P.IsNotEmpty(t.OrderPrice)?e.UnitPrice=t.OrderPrice:e.UnitPrice=t.UnitCost,e}formatItemObject=t=>{let o=t,{ID:e}=o,n=wn(o,["ID"]);return R(T({},n),{Quantity:n.Quantity??1,Total:n.Total??n.UnitPrice,VariantID:e})};addCartRFID(t){this._listenRFID.next(t)}static \u0275fac=function(e){return new(e||i)(W(se),W(q),W(rt),W(ne))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};var je=class i{_isEdit=new ve;isEdit$;id$;isUnpaid$;dialog=ce(ne);constructor(t,e,n,o,s){let O=Ze(t.snapshot.queryParams);this.isEdit$=tt(O.pipe(u(b=>!!b.ID)),this._isEdit.asObservable()).pipe(te(1)),this.id$=O.pipe(V(b=>b.ID),u(b=>b.ID));let v=this.id$.pipe(Z(b=>e.post("/api/Buy2/GetDataByID2",{ID:b})),te(1)),$=st(()=>o.entities$).pipe(Z(b=>v.pipe(u(C=>[C.Order,b]))),E(([b,C])=>{let w={Att:b.Att,SupplierID:{Key:b.SupplierID,Value:b.SupplierName,OnSet:!0},Date:b.Date,Number:b.Number,ID:b.ID};n.setBulkOrderForm(w)}),E(([b,C])=>{let w=C.find(k=>k.ID==b.EntityID);n.setOutletForm(w)})),K=v.pipe(u(b=>b.Items),u(b=>b.map(C=>R(T({},C.Variant),{Quantity:C.Quantity,Total:C.Total,Note:C.Note,UnitPrice:C.UnitPrice,Discount:C.Discount,Serial:C.Serial,ID:C.ID,VariantID:C.VariantID,UnitQuantity:C.UnitQuantity,QtyRequested:C.QtyRequested,DiscountAmount:C.DiscountAmount}))),E(b=>s.editForm(b))),h=st(()=>o.currencies$).pipe(Z(b=>v.pipe(u(C=>[C.Order,b,C.Invoice]))),u(([b,C,w])=>R(T({},b),{Number:b.Number!=w.Number?w.Number:b.Number,Currency:C.find(k=>k.ID===b.CurrencyID)})),E(b=>{let C={Note:b.Note,TagID:b.TypeID,Currency:T({},b.Currency),InvoiceNumber:b.Number};n.setBulkNoteForm(C)})),A=v.pipe(u(b=>b.DeliveryEntityID),E(b=>n.setDeliveryEntityID(b))),p=st(()=>o.taxes$).pipe(Z(b=>v.pipe(u(C=>[C.Order,b]))),u(([b,C])=>R(T({},b),{Taxes:C})),E(b=>{let C=b.Taxes.find(k=>k.ID===b.TaxTypeID);C?.Bin&&this.dialog.open(Ht,{id:"ModalInfo",data:{title:"Default Tax Discontinued",message:`
|
|
2
|
-
<div class="d-flex justify-content-center my-4">
|
|
3
|
-
<img class="img-2x" src="https://res.cloudinary.com/pos/image/upload/v1705387550/POS/Images/Cashier/globalerror.svg"
|
|
4
|
-
alt="Empty Sales Order Tag" />
|
|
5
|
-
</div>
|
|
6
|
-
<h4 class="text-center mb-4">
|
|
7
|
-
Your Default Tax for this outlet has been discontinued!
|
|
8
|
-
</h4>
|
|
9
|
-
<p class="text-center">
|
|
10
|
-
Please change the default tax or re-activate the tax <a href="/menu/Setup/Payment/Tax">here</a>.
|
|
11
|
-
</p>
|
|
12
|
-
`,headerType:xe.Error},width:"31rem"}),(P.IsEmpty(C)||C?.Bin)&&(C=b.Taxes[0],b.TaxTypeID=C.ID);let w={Discount:{Amount:b.DiscountAmount,Percentage:b.Discount},Tax:{ID:b.TaxTypeID,Rate:C?.Rate,CalculationTypeName:C?.CalculationTypeName,Label:C?.Label??C?.Name,Discontinue:C?.Bin}};n.setBulkDiscountAndTaxForm(w)})),M=v.pipe(u(b=>b.Invoice),E(b=>{let C={ID:b.ID,Due:b.Due,Tax:b.Tax};n.setBulkInvoice(C)})),G=this.isEdit$.pipe(Z(b=>v.pipe(u(C=>C.Payment),E(C=>{let w={ID:b?C?.ID:P.GuidEmpty,Amount:b?C?.Amount:0,MethodID:C?.MethodID,Note:b?C?.Note:null,Code:C?.Code,ImageUrl:b?C?.ImageUrl:null};w.Amount!==void 0&&n.setBulkPayment(w)}))));this.isUnpaid$=G.pipe(u(b=>P.IsEmpty(b))),Ie($,K,h,A,p,M,G).subscribe()}onNewPurchase(){this._isEdit.next(!1)}static \u0275fac=function(e){return new(e||i)(W(qn),W(se),W(q),W(ge),W(ie))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};var Le=class i{edit=ce(je);_paymentComplete=new ve;paymentComplete$=this._paymentComplete.asObservable().pipe(te(1));_createNewTransaction=new Xe(!1);createNewTransaction$=this._createNewTransaction.asObservable();constructor(){}paymentComplete(t){this._paymentComplete.next(t)}createNewTransaction(){this._createNewTransaction.next(!0),this.edit.onNewPurchase()}static \u0275fac=function(e){return new(e||i)};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};var ze=class i{quickKeyPack$;cardPayments$;cashPayments$;otherPayments$;updateDefaultTax$;isCashSuspended$;updatePaymentMethodID$;dialog=ce(ne);constructor(t,e,n,o,s){let O=e.outlet.valueChanges.pipe(u(h=>h?.ID),ee()),v=O.pipe(Vn(),V(h=>!!h),de(n.isEdit$),Z(([h,A])=>t.get("/API/Buy2/GetOutletInfo",[{key:"EntityID",value:h},{key:"IsEdit",value:A}])),te(1),ee()),$=v.pipe(de(n.isEdit$),V(([h,A])=>!A),u(([h,A])=>h),E(h=>e.setPONumber(h.NumberElement)),ee());this.quickKeyPack$=v.pipe(u(h=>h.QuickKeyPack),ee()),this.updateDefaultTax$=st(()=>o.taxes$).pipe(Z(h=>v.pipe(u(A=>[h,A]))),de(n.isEdit$),V(([[h,A],p])=>!p),u(([[h,A],p])=>[h,A]),E(([h,A])=>{let p=h.find(M=>M.ID==A.DefaultTaxType);p?.Bin&&this.dialog.open(Ht,{id:"ModalInfo",data:{title:"Default Tax Discontinued",message:`
|
|
13
|
-
<div class="d-flex justify-content-center my-4">
|
|
14
|
-
<img class="img-2x" src="https://res.cloudinary.com/pos/image/upload/v1705387550/POS/Images/Cashier/globalerror.svg"
|
|
15
|
-
alt="Empty Sales Order Tag" />
|
|
16
|
-
</div>
|
|
17
|
-
<h4 class="text-center mb-4">
|
|
18
|
-
Your Default Tax for this outlet has been discontinued!
|
|
19
|
-
</h4>
|
|
20
|
-
<p class="text-center">
|
|
21
|
-
Please change the default tax or re-activate the tax <a href="/menu/Setup/Payment/Tax">here</a>.
|
|
22
|
-
</p>
|
|
23
|
-
`,headerType:xe.Error},width:"31rem"}),(P.IsEmpty(p)||p.Bin)&&(p=h.find(M=>!M.Bin)),e.setTax(p)}),ee()),this.updatePaymentMethodID$=v.pipe(de(n.isEdit$),V(([h,A])=>!A),u(([h,A])=>h.Payments),u(h=>{let A=h.filter(p=>p.TypeID==1);return A.length?A:h.filter(p=>p.TypeID==2)}),E(h=>e.setPaymentMethodID(h[0].ID)),ee()),this.cashPayments$=v.pipe(u(h=>h.Payments),u(h=>h.filter(A=>A.TypeID==1)),ee()),this.cardPayments$=v.pipe(u(h=>h.Payments),u(h=>h.filter(A=>A.TypeID==2)),ee()),this.otherPayments$=v.pipe(u(h=>h.Payments),u(h=>h.filter(A=>A.TypeID==4)),ee()),this.isCashSuspended$=v.pipe(u(h=>h.Payments),u(h=>!!h.filter(p=>p.TypeID==1).length),ee()),st(()=>o.appConfigJSON$).pipe(de(n.isEdit$),V(([h,A])=>!A&&h.ModuleBuy.Shipping.BuyShippingDefault==0),Z(()=>Ie(O,s.createNewTransaction$)),E(([h,A])=>e.setDeliveryEntityID(h)),ee()).subscribe(),$.subscribe(),this.updateDefaultTax$.subscribe(),this.updatePaymentMethodID$.subscribe()}updateTax(){this.updateDefaultTax$.pipe(hn(1)).subscribe()}updatePaymentMethodID(){this.updatePaymentMethodID$.pipe(hn(1)).subscribe()}static \u0275fac=function(e){return new(e||i)(W(se),W(q),W(je),W(ge),W(Le))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};function Yi(i,t){if(i&1&&(a(0,"mat-option",6),m(1),r()),i&2){let e=t.$implicit;c("value",e),l(),j(" ",e.Value," ")}}var Yt=class i{constructor(t,e,n){this.http=t;this.form=e;this.matDialog=n}supplierPOTypes;appConfigJSON;filteredSuppliers$;supplier=new me("");disabled=!1;onChange=t=>{};onTouched=()=>{};ngOnInit(){this.filteredSuppliers$=this.supplier.valueChanges.pipe(V(n=>typeof n=="string"&&n.length>=3),kn(300),Z(n=>this.http.get("/API/AC/GetSupplierSuggestion",[{key:"count",value:100},{key:"prefix",value:n}]))),this.supplier.valueChanges.pipe(V(n=>typeof n!="string"),u(n=>n),E(n=>n?.Key!=P.GuidEmpty&&P.IsNotEmpty(n)?this.onChange(n.Key):this.onChange(null))).pipe(V(n=>P.IsNotEmpty(n)&&!n.OnSet),Z(n=>this.http.post("/API/Contact/GetSupplierDTO",{id:n.Key}).pipe(_e(()=>Ae))),u(n=>n.DaysDue),V(n=>n!=0),E(n=>this.form.setdueDays(n)),E(n=>this.form.setDueDateBasedOnDaysDue(n))).subscribe()}writeValue(t){this.supplier.setValue(t)}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}displaySupplierNameFn(t){return t?.Value}openNewSupplierModal(){this.matDialog.open(Mi,{data:{options:this.supplierPOTypes,config:this.appConfigJSON.ModuleContact,type:"supplier",title:"New Supplier Form"}}).afterClosed().pipe(V(t=>P.IsNotEmpty(t.supplier.Name)),Z(t=>{let e={contact:t.supplier,type:"supplier",groups:t.supplier.Group?t.supplier.Group:[]};return this.http.post("/API/Contact/Supplier/Create",e).pipe(u(n=>({Key:n.ID,Value:t.supplier.Name})))})).subscribe(t=>{this.writeValue(t),this.onChange(t.Key)})}static \u0275fac=function(e){return new(e||i)(f(se),f(q),f(ne))};static \u0275cmp=N({type:i,selectors:[["POS-supplier-autocomplete"]],inputs:{supplierPOTypes:"supplierPOTypes",appConfigJSON:"appConfigJSON"},features:[ke([{provide:Ge,multi:!0,useExisting:i}])],decls:7,vars:6,consts:[["auto","matAutocomplete"],[1,"d-flex","align-items-center","position-relative"],["matTooltipPosition","above","matTooltip","New Supplier Form",1,"fa-light","fa-user-plus","position-absolute",2,"font-size","12px",3,"click"],["type","text","placeholder","Assign Supplier",3,"formControl","matAutocomplete"],[3,"displayWith"],[3,"value",4,"ngFor","ngForOf"],[3,"value"]],template:function(e,n){if(e&1){let o=B();a(0,"div",1)(1,"i",2),_("click",function(){return x(o),S(n.openNewSupplierModal())}),r(),I(2,"input",3),a(3,"mat-autocomplete",4,0),D(5,Yi,2,2,"mat-option",5),g(6,"async"),r()()}if(e&2){let o=ue(4);l(2),c("formControl",n.supplier)("matAutocomplete",o),l(),c("displayWith",n.displaySupplierNameFn),l(2),c("ngForOf",y(6,4,n.filteredSuppliers$))}},dependencies:[F,He,Ve,bi,gi,ai,yi,Ke,he,le,qe,Ct,bt,Pi],styles:["input[_ngcontent-%COMP%]{width:100%;height:38px!important;border-radius:.375rem;border:1px solid #ced4da;padding-left:32px}input[_ngcontent-%COMP%]::placeholder{color:#ced4da}i[_ngcontent-%COMP%]{font-size:16px;top:10.6px;left:13px}"]})};var Zi=["quantity"],Ot=i=>({selected:i}),eo=()=>["/menu/Products/Catalog/Variants/Info"],to=i=>({ID:i}),no=i=>({"table-light":i});function io(i,t){if(i&1){let e=B();a(0,"a",16),_("click",function(){x(e);let o=d();return S(o.onTabChange("Discount"))}),m(1," Discount "),r()}if(i&2){let e=d();c("ngClass",ae(1,Ot,e.tabState=="Discount"))}}function oo(i,t){if(i&1){let e=B();a(0,"a",17),_("click",function(){x(e);let o=d();return S(o.onTabChange("Product"))}),m(1," Product "),r()}if(i&2){let e=d();c("ngClass",ae(1,Ot,e.tabState=="Product"))}}function ao(i,t){if(i&1){let e=B();Q(0),a(1,"a",18),_("click",function(){x(e);let o=d();return S(o.onTabChange("Serial"))}),m(2," Serial "),r(),U()}if(i&2){let e=d();l(),c("ngClass",ae(1,Ot,e.tabState=="Serial"))}}function ro(i,t){if(i&1&&(Q(0),a(1,"div",13)(2,"div",26),I(3,"POS-variant-autocomplete",27),r()(),U()),i&2){let e=d(2);l(3),c("formControl",e.variantAutocomplete)("isOnModalVariant",!0)}}function lo(i,t){if(i&1&&(a(0,"span"),m(1),r()),i&2){let e=d(2);l(),j("(",e.variant.UOMName,")")}}function so(i,t){if(i&1){let e=B();a(0,"div",28)(1,"strong")(2,"span"),m(3),r()(),a(4,"input",29),J("ngModelChange",function(o){x(e);let s=d(2);return L(s.variant.UnitQuantity,o)||(s.variant.UnitQuantity=o),S(o)}),_("ngModelChange",function(){x(e);let o=d(2);return S(o.onUnitQtyChange())}),r()()}if(i&2){let e=d(2);l(3),X(e.unitQtyLabel),l(),c("preventNegative",!0)("decimalPlaces",e.isSerialItem?0:4),H("ngModel",e.variant.UnitQuantity)}}function co(i,t){if(i&1){let e=B();a(0,"div",30)(1,"strong"),m(2,"Cost"),r(),a(3,"input",31,1),J("ngModelChange",function(o){x(e);let s=d(2);return L(s.variant.UnitPrice,o)||(s.variant.UnitPrice=o),S(o)}),_("ngModelChange",function(){x(e);let o=d(2);return S(o.onPriceChange())}),r()()}if(i&2){let e=d(2);l(3),c("simpleKeyboard",e.keyboard),H("ngModel",e.variant.UnitPrice)}}function po(i,t){if(i&1){let e=B();Q(0),a(1,"div",19),D(2,ro,4,2,"ng-container",10),a(3,"div",13)(4,"div",20)(5,"strong"),m(6," Qty "),D(7,lo,2,1,"span",10),r(),a(8,"input",21,0),J("ngModelChange",function(o){x(e);let s=d();return L(s.variant.Quantity,o)||(s.variant.Quantity=o),S(o)}),_("ngModelChange",function(){x(e);let o=d();return S(o.onQtyChange())}),r()(),D(10,so,5,4,"div",22)(11,co,5,2,"div",23),r(),a(12,"div",13)(13,"div",24)(14,"POS-tinymce-editor",25),J("ngModelChange",function(o){x(e);let s=d();return L(s.variant.Note,o)||(s.variant.Note=o),S(o)}),r()()()(),U()}if(i&2){let e=d();l(2),c("ngIf",e.isCreate),l(5),c("ngIf",e.variant.UOMName),l(),c("simpleKeyboard",e.keyboard)("decimalPlaces",e.isSerialItem?0:4),H("ngModel",e.variant.Quantity),c("disabled",e.isEditBuyForm&&e.isSerialItem),l(2),c("ngIf",e.unitQtyLabel),l(),c("ngIf",e.role.product.Cost),l(3),H("ngModel",e.variant.Note)}}function mo(i,t){if(i&1&&(a(0,"div",45)(1,"div",34)(2,"strong"),m(3,"Discount Amount / Qty"),r()(),a(4,"div",35)(5,"div",47)(6,"p"),m(7),g(8,"number"),r()()()()),i&2){let e=d(2);l(7),X(y(8,1,e.variant.DiscountAmount))}}function uo(i,t){if(i&1&&(Q(0),a(1,"div",56)(2,"h5",57),m(3),g(4,"number"),r()(),U()),i&2){let e=d(3);l(3),j(" ",y(4,1,e.variant.Discount),"% ")}}function fo(i,t){if(i&1&&(Q(0),a(1,"div",58)(2,"h5"),m(3),g(4,"number"),r(),a(5,"span",53),m(6,"x"),r(),a(7,"h5"),m(8),g(9,"number"),r()(),U()),i&2){let e=d(3);l(3),X(y(4,2,e.variant.Quantity)),l(5),X(y(9,4,e.variant.DiscountAmount))}}function go(i,t){if(i&1&&(Q(0),a(1,"h5",59),m(2),g(3,"number"),r(),U()),i&2){let e=d(3);l(2),j(" -",y(3,1,e.totalBeforeDiscount()*(e.variant.Discount/100))," ")}}function yo(i,t){if(i&1&&(Q(0),a(1,"div",55)(2,"h5",59),m(3),g(4,"number"),r()(),U()),i&2){let e=d(3);l(3),j(" -",y(4,1,e.variant.Quantity*e.variant.DiscountAmount)," ")}}function bo(i,t){if(i&1&&(Q(0),a(1,"div",60)(2,"div",61)(3,"h5"),m(4,"Grand Total"),r()(),a(5,"div",61)(6,"h5"),m(7),g(8,"number"),r()()(),U()),i&2){let e=d(3);l(7),X(y(8,1,e.totalAfterDiscount()))}}function Co(i,t){if(i&1&&(a(0,"div",48)(1,"div",49)(2,"h4"),m(3,"Discount Simulation"),r(),a(4,"h4",50),m(5),r()(),a(6,"div",51)(7,"div",34)(8,"div",52)(9,"h5"),m(10),g(11,"number"),r(),a(12,"span",53),m(13,"x"),r(),a(14,"h5"),m(15),g(16,"number"),r()(),D(17,uo,5,3,"ng-container",10)(18,fo,10,6,"ng-container",10),r(),a(19,"div",34)(20,"div",54)(21,"h5"),m(22),g(23,"number"),r()(),a(24,"div",55),D(25,go,4,3,"ng-container",10),r(),D(26,yo,5,3,"ng-container",10),r(),D(27,bo,9,3,"ng-container",10),r()()),i&2){let e=d(2);l(5),j(" ",e.variant==null?null:e.variant.Name," "),l(5),X(y(11,9,e.variant.Quantity)),l(5),X(y(16,11,e.variant.UnitPrice)),l(2),c("ngIf",e.variant.Discount),l(),c("ngIf",e.variant.DiscountAmount>0),l(4),X(y(23,13,e.totalBeforeDiscount())),l(3),c("ngIf",e.variant.Discount),l(),c("ngIf",e.variant.DiscountAmount>0),l(),c("ngIf",e.variant.DiscountAmount>0||e.variant.Discount>0)}}function vo(i,t){if(i&1){let e=B();a(0,"div",13)(1,"div",32)(2,"div",33)(3,"div",34)(4,"strong"),m(5,"Discount %"),r()(),a(6,"div",35)(7,"input",36,2),J("ngModelChange",function(o){x(e);let s=d();return L(s.variant.Discount,o)||(s.variant.Discount=o),S(o)}),_("ngModelChange",function(){x(e);let o=d();return S(o.onDiscountChange())}),r()()(),a(9,"div",37)(10,"div",34)(11,"strong"),m(12,"Discount Amount"),r()(),a(13,"div",35)(14,"input",38,2),J("ngModelChange",function(o){x(e);let s=d();return L(s.inputedDiscountAmount,o)||(s.inputedDiscountAmount=o),S(o)}),_("ngModelChange",function(o){x(e);let s=d();return S(s.onDiscountAmountChange(o))}),r()()(),a(16,"div",39)(17,"div",40)(18,"input",41),J("ngModelChange",function(o){x(e);let s=d();return L(s.isDiscMultipliciedQty,o)||(s.isDiscMultipliciedQty=o),S(o)}),_("ngModelChange",function(){x(e);let o=d();return S(o.onSwitchDiscountTypeChange())}),r()(),a(19,"div",42)(20,"strong"),m(21,"*Quantity"),r(),a(22,"span",43),I(23,"i",44),r()()(),D(24,mo,9,3,"div",45),r(),D(25,Co,28,15,"div",46),r()}if(i&2){let e=d();l(7),c("simpleKeyboard",e.keyboard),H("ngModel",e.variant.Discount),c("min",0)("readonly",!e.role.sell.Discount),l(7),c("simpleKeyboard",e.keyboard),H("ngModel",e.inputedDiscountAmount),c("max",e.variant.UnitPrice*e.variant.Quantity)("min",0)("readonly",!e.role.sell.Discount),l(4),H("ngModel",e.isDiscMultipliciedQty),l(6),mt(e.isDiscMultipliciedQty()?-1:24),l(),c("ngIf",e.role.product.Cost)}}function _o(i,t){i&1&&(Q(0),I(1,"i",68),a(2,"h6"),m(3,"No Image"),r(),U())}function ho(i,t){if(i&1&&I(0,"img",69),i&2){let e=d(2);c("src",e.variant.ThumbnailUrl,nt)}}function Do(i,t){if(i&1){let e=B();a(0,"button",82),_("click",function(){x(e);let o=d().ngIf,s=d(2);return S(s.setQuantityToMax(o))}),m(1," Place Order "),r()}}function xo(i,t){if(i&1&&(a(0,"tbody")(1,"tr")(2,"th",70),I(3,"i",71),m(4,"Inventory "),r(),a(5,"th",70),I(6,"i",72),m(7),r(),a(8,"th",70),I(9,"i",73),m(10," Diff "),r(),a(11,"th",70),I(12,"i",74),m(13," Action "),r()(),a(14,"tr")(15,"th",75),m(16,"On Hand"),r(),a(17,"td",76),m(18),g(19,"number"),r(),I(20,"td",77)(21,"td",78),r(),a(22,"tr")(23,"th",75),m(24,"Allocated"),r(),a(25,"td",76),m(26),g(27,"number"),r()(),a(28,"tr")(29,"th",75),m(30,"Available"),r(),a(31,"td",76),m(32),g(33,"number"),r()(),a(34,"tr")(35,"th",75),m(36,"ROP"),r(),a(37,"td",76),m(38),g(39,"number"),r(),a(40,"td",59),m(41),g(42,"number"),r()(),a(43,"tr")(44,"th",75),m(45,"Max"),r(),a(46,"td",76),m(47),g(48,"number"),r(),a(49,"td",79),m(50),g(51,"number"),r(),a(52,"td",80),D(53,Do,2,0,"button",81),r()()()),i&2){let e=t.ngIf,n=d(2);l(7),j("",n.outletName," "),l(11),j(" ",y(19,12,e.onHand)," "),l(8),j(" ",y(27,14,e.allocated)," "),l(6),j(" ",y(33,16,e.onHand-e.allocated)," "),l(6),j(" ",y(39,18,e.rop)," "),l(3),We(" ",e.ropDiff>=0?"+":"","",y(42,20,e.ropDiff)," "),l(6),j(" ",y(48,22,e.max)," "),l(3),We(" ",e.maxDiff>=0?"+":"","",y(51,24,e.maxDiff)," "),l(2),c("ngClass",ae(26,no,n.variant.Quantity==e.max-e.onHand-e.allocated)),l(),c("ngIf",n.variant.Quantity!=e.max-e.onHand-e.allocated)}}function So(i,t){if(i&1&&(Q(0),a(1,"div",62)(2,"div",63)(3,"a",64),D(4,_o,4,0,"ng-container",65)(5,ho,1,1,"ng-template",null,3,be),r()(),a(7,"div",66)(8,"table",67),D(9,xo,54,28,"tbody",10),g(10,"async"),r()()(),U()),i&2){let e=ue(6),n=d();l(3),c("routerLink",Rt(7,eo))("queryParams",ae(8,to,n.variant==null?null:n.variant.ID)),l(),c("ngIf",(n.variant==null?null:n.variant.ThumbnailUrl)==null)("ngIfElse",e),l(5),c("ngIf",y(10,5,n.variantStock$))}}function Io(i,t){if(i&1){let e=B();Q(0),a(1,"POS-tab-serial",83),J("variantChange",function(o){x(e);let s=d();return L(s.variant,o)||(s.variant=o),S(o)})("isFocusOnSerialInputChange",function(o){x(e);let s=d();return L(s.isFocusOnSerialInput,o)||(s.isFocusOnSerialInput=o),S(o)})("serialsChange",function(o){x(e);let s=d();return L(s.serials,o)||(s.serials=o),S(o)}),r(),U()}if(i&2){let e=d();l(),c("isEditBuyForm",e.isEditBuyForm)("outletID",e.outletID),H("variant",e.variant)("isFocusOnSerialInput",e.isFocusOnSerialInput)("serials",e.serials)}}var lt=class i{constructor(t,e,n,o,s,O){this.dialogRef=t;this.http=n;this.role=o;this.toastr=O;this.config=new we,this.config.title=e.variant?.Name??"Add Variant",this.config.customWidth="700px",this.config.noPadding=!0,this.appConfigJSON=e.appConfigJSON,this.unitQtyLabel=this.appConfigJSON.ModuleSell.ProductDialog.UnitQtyLabel,this.numpadVisible=this.appConfigJSON.ModuleSell.NumPadVisible,this.numpadVisible&&(this.keyboard=s.keyboard),this.isEditBuyForm=e.isEditBuyForm,this.outletID=e.outletID,this.outletName=e.outletName,this.variant=e.variant;let $=this.appConfigJSON?.ModuleSell?.ProductDialog?.QuantityToOneInDialog?1:null;if(this.variant)this.isSerialItem=this.variant.TypeID==4,this.variantStock$=this.getOnInventory(),this.inputedDiscountAmount.set(this.variant.DiscountAmount),this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount();else{this.isCreate=!0,this.variant={Name:"",Quantity:$,UnitQuantity:1,OrderPrice:0,Total:0,Note:"",UnitPrice:0,ThumbnailUrl:"",UOMName:"",TypeID:0,Discount:0,ID:"",DiscountAmount:0,Serial:[]};let K=this.variantAutocomplete.valueChanges.pipe(V(p=>p.type=="Code"),u(p=>p.str),Z(p=>n.get($e.GetVariantByCode,[{key:"Code",value:p},{key:"EntityID",value:this.outletID},{key:"Promotion",value:!0}]).pipe(_e(()=>Ae))),u(p=>this.setUnitPrice(p)),u(p=>R(T({},p),{Quantity:$,Total:p.UnitPrice,Discount:p.PriceDiscount}))),h=this.variantAutocomplete.valueChanges.pipe(V(p=>p.type=="ID"),u(p=>p.str),Z(p=>n.get($e.GetVariantByID,[{key:"ID",value:p},{key:"EntityID",value:this.outletID},{key:"Promotion",value:!1}]).pipe(_e(()=>Ae))),u(p=>this.setUnitPrice(p)),u(p=>R(T({},p),{Quantity:$,Total:p.UnitPrice,Discount:p.PriceDiscount})));tt(K,h).pipe(E(p=>this.setFocusField("quantity")),te(1)).subscribe(p=>{this.variant=p,this.isSerialItem=this.variant.TypeID==4,this.showInventory=!0,this.variantStock$=this.getOnInventory(),this.inputedDiscountAmount.set(this.variant.DiscountAmount),this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount()})}}calculatorTab=Et(qt);variantAutocomplete=new me;_quantityElement;variant;variantStock$=Ae;isSerialItem=!1;outletID;outletName;appConfigJSON;numpadVisible;keyboard;isEditBuyForm=!1;unitQtyLabel;config;tabState="Cart";isCreate=!1;showInventory=!1;serials=[];isFocusOnSerialInput=!1;_onGetInventory=new Xe(void 0);onGetInventory$=this._onGetInventory.asObservable();isDiscMultipliciedQty=pt(!0);totalBeforeDiscount=pt(0);totalAfterDiscount=pt(0);inputedDiscountAmount=pt(0);setFocusField(t){switch(t){case"quantity":this._quantityElement.nativeElement.focus();break}}onPriceChange(){this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount()}onQtyChange(){this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount()}onUnitQtyChange(){this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount()}onDiscountChange(){this.calculateTotalAfterDiscount(),this.calculateTotalAfterDiscount()}onDiscountAmountChange(t){this.calculateDiscountAmount(t),this.calculateTotalAfterDiscount()}onSwitchDiscountTypeChange(){this.calculateDiscAmountOnSwitch(),this.calculateTotalAfterDiscount()}calculateDiscountAmount(t){this.isDiscMultipliciedQty()?this.variant.DiscountAmount=t:this.variant.DiscountAmount=t/this.getQty()}calculateDiscAmountOnSwitch(){let t=this.variant.DiscountAmount,e=this.getQty();this.isDiscMultipliciedQty()?this.variant.DiscountAmount=t*e:this.variant.DiscountAmount=t/e}calculateTotalBeforeDiscount(){let t=this.variant.UnitPrice*this.getQty();this.totalBeforeDiscount.set(t)}calculateTotalAfterDiscount(){let t=this.totalBeforeDiscount()-this.getTotalDiscPercentage();this.validateDiscountAmount(t);let e=this.getTotalDiscAmount(),n=t-e;this.totalAfterDiscount.set(n)}validateDiscountAmount(t){let e=this.variant.Quantity%1===0;t>0&&this.variant.DiscountAmount>t&&e&&(this.variant.DiscountAmount=t)}getTotalDiscPercentage(){return this.variant.Discount?this.totalBeforeDiscount()*this.variant.Discount/100:0}getTotalDiscAmount(){return this.variant.DiscountAmount?this.variant.DiscountAmount*this.getQty():0}getQty(){return this.variant.Quantity*this.variant.UnitQuantity}onTabChange(t){this.tabState=t,t==="Calculator"&&(console.log(this.calculatorTab()?.priceInputNativeElement),setTimeout(()=>this.calculatorTab()?.priceInputNativeElement?.focus(),100))}ok(){if(!this.isFocusOnSerialInput){if(this.checkQuantityIsNull(),this.isSerialItem){if(this.serials.length){let n=this.serials.map(o=>({Quantity:1,Number:o}));this.variant.Serial=[...this.variant.Serial,...n]}let t=this.variant.Serial?.map(n=>n.Quantity).reduce((n,o)=>n+o,0)??0,e=this.variant.Quantity;t!=e&&this.toastr.warning("Serial Quantity must be equal to Variant Quantity","Warning"),this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount()}this.dialogRef.close(R(T({},this.variant),{Total:this.totalAfterDiscount()}))}}close(){this.dialogRef.close()}checkQuantityIsNull(){this.variant.Quantity==null&&(this.variant.Quantity=1)}setQuantityToMax(t){let e=t.onHand-t.allocated;t.max>=e?(this.variant.Quantity=t.max-e,this.toastr.success("Qty adjusted to Max Inventory","Success"),this.ok()):this.toastr.warning("Your Inventory Available is more than Max Inventory","Warning")}getOnInventory(){return this.onGetInventory$.pipe($n((t,e)=>t?Ze(t):this.http.get($e.GetVariantStockByID,[{key:"ID",value:this.variant.ID},{key:"EntityID",value:this.outletID}]).pipe(u(n=>{let o=n.OnHand-n.Allocated;return{onHand:n.OnHand,allocated:n.Allocated,rop:n.ROP,max:n.Max,maxDiff:n.Max-n.OnHand-o,ropDiff:n.ROP-n.OnHand-o}})),null),u(t=>t),te(1))}setUnitPrice(t){let e=T({},t);return P.IsNotEmpty(t.OrderPrice)?e.UnitPrice=t.OrderPrice:e.UnitPrice=t.UnitCost,e}static \u0275fac=function(e){return new(e||i)(f(Te),f(Re),f(se),f(De),f(Si),f(Je))};static \u0275cmp=N({type:i,selectors:[["POS-modal-variant"]],viewQuery:function(e,n){if(e&1&&(kt(n.calculatorTab,qt,5),Nt(Zi,5)),e&2){Vt();let o;Ft(o=At())&&(n._quantityElement=o.first)}},decls:19,vars:20,consts:[["quantity",""],["price",""],["discount",""],["SHOW_IMAGE",""],[3,"onOk","onCancel","onClose","config"],[1,"container","w-100","h-100"],[1,"row","border-bottom","mx-5","mt-8"],["data-cy","input_sell",1,"btn","btn-link",3,"click","ngClass"],["class","btn btn-link","data-cy","discount",3,"ngClass","click",4,"ngIf"],["class","btn btn-link","data-cy","product",3,"ngClass","click",4,"ngIf"],[4,"ngIf"],["data-cy","calculator",1,"btn","btn-link",3,"click","ngClass"],[1,"mx-8"],[1,"row"],[3,"hidden"],["priceLabel","Cost",3,"discountTotal","priceTotal","qtyTotal","noteChanges","price","discount","quantity","notes","variantName"],["data-cy","discount",1,"btn","btn-link",3,"click","ngClass"],["data-cy","product",1,"btn","btn-link",3,"click","ngClass"],["data-cy","serial",1,"btn","btn-link",3,"click","ngClass"],[1,"py-8"],[1,"col-auto","mb-4","pe-0",2,"width","82px"],["id","txtCartQuantity","keyboardType","number","type","text","autoNum","",1,"form-control","input-numpad",2,"height","38px",3,"ngModelChange","simpleKeyboard","decimalPlaces","ngModel","disabled"],["class","col-auto pe-0","style","width: 82px",4,"ngIf"],["class","col-auto pe-0","style","width: 112px",4,"ngIf"],[1,"col","tinymce"],["height","210px",3,"ngModelChange","ngModel"],[1,"col"],[3,"formControl","isOnModalVariant"],[1,"col-auto","pe-0",2,"width","82px"],["type","text","autoNum","",1,"form-control","input-numpad",2,"height","38px",3,"ngModelChange","preventNegative","decimalPlaces","ngModel"],[1,"col-auto","pe-0",2,"width","112px"],["id","inputPrice","keyboardType","number","type","text","autoNum","",1,"form-control",2,"height","38px",3,"ngModelChange","simpleKeyboard","ngModel"],[1,"col-6","border-end","py-8"],[1,"row","d-flex","align-items-center"],[1,"col-6"],[1,"col-auto","ps-0"],["id","inputDiscount","keyboardType","number","type","text","autoNum","","percentage","","decimalPlaces","2",1,"form-control",2,"width","112px","height","38px",3,"ngModelChange","simpleKeyboard","ngModel","min","readonly"],[1,"row","d-flex","align-items-center","mt-6"],["id","inputDiscount","keyboardType","number","type","text","autoNum","",1,"form-control",2,"width","112px","height","38px",3,"ngModelChange","simpleKeyboard","ngModel","max","min","readonly"],[1,"d-flex","align-items-center","mt-4"],[1,"form-check","form-switch","form-switch-lg","ms-1","mt-1"],["type","checkbox","id","flexSwitchCheckDefault",1,"form-check-input",3,"ngModelChange","ngModel"],[1,"ms-4"],["matTooltipPosition","above","matTooltip",`Use the final discount amount if you want to discount the price of the total
|
|
24
|
-
quantity of the product. The nominal will be calculated automatically and filled in the discount amount box.`,1,"pointer"],[1,"fa-solid","fa-info-circle","ms-2"],[1,"row","d-flex","align-items-center","justify-content-start","mt-4"],["class","col-6 py-8",4,"ngIf"],[1,"border","ps-6",2,"height","38px","padding-top","10px","width","112px","background-color","#e9ecef"],[1,"col-6","py-8"],[1,"w-100","text-center"],[1,"text-start","mt-12"],[1,"row","mt-12"],[1,"w-100","d-flex","align-items-center","justify-content-end"],[1,"mx-1","fw-bold"],[1,"w-100","d-flex","justify-content-end"],[1,"w-100","d-flex","justify-content-end","mt-2"],[1,"d-flex","align-items-center","justify-content-end","mt-2"],[1,"fw-bold","text-danger"],[1,"d-flex","align-items-center","justify-content-end","mt-2","text-danger"],[1,"text-danger"],[1,"row","border-top","mx-0","px-0","mt-4"],[1,"col-6","d-flex","justify-content-end","mt-4"],[1,"row","py-8"],[1,"col-sm-4","d-flex","justify-content-center","flex-column","align-items-center","text-body-secondary"],["target","_blank",2,"color","inherit",3,"routerLink","queryParams"],[4,"ngIf","ngIfElse"],[1,"col-sm-8"],[1,"table","table-bordered","text-center","inventory-table","w-auto"],["aria-hidden","true",1,"fa-solid","fa-image","fa-5x"],[1,"border","rounded",3,"src"],[1,"bg-light-orange"],["aria-hidden","true",1,"fa-box-archive","fa-solid","fa-1x","me-2"],["aria-hidden","true",1,"fa-solid","fa-house","fa-1x","me-2"],["aria-hidden","true",1,"fa-solid","fa-plus-minus","fa-1x","me-2"],["aria-hidden","true",1,"fa-solid","fa-sliders","fa-1x","me-2"],[1,"table-light","text-start"],[1,"text-end"],["rowspan","3",1,"table-light"],["rowspan","4",1,"table-light"],[1,"text-success"],[3,"ngClass"],["style","font-size: 12px","type","button","class","btn btn-success btn-sm me-2","matTooltipPosition","above","matTooltip","Adjust Bought Qty to max Inventory",3,"click",4,"ngIf"],["type","button","matTooltipPosition","above","matTooltip","Adjust Bought Qty to max Inventory",1,"btn","btn-success","btn-sm","me-2",2,"font-size","12px",3,"click"],[3,"variantChange","isFocusOnSerialInputChange","serialsChange","isEditBuyForm","outletID","variant","isFocusOnSerialInput","serials"]],template:function(e,n){e&1&&(a(0,"modal-material",4),_("onOk",function(){return n.ok()})("onCancel",function(){return n.close()})("onClose",function(){return n.close()}),a(1,"content")(2,"div",5)(3,"div",6)(4,"div")(5,"a",7),_("click",function(){return n.onTabChange("Cart")}),m(6," Cart "),r(),D(7,io,2,3,"a",8)(8,oo,2,3,"a",9)(9,ao,3,3,"ng-container",10),a(10,"a",11),_("click",function(){return n.onTabChange("Calculator")}),m(11," Calculator "),r()()(),a(12,"div",12),D(13,po,15,9,"ng-container",10)(14,vo,26,12,"div",13)(15,So,11,10,"ng-container",10)(16,Io,2,5,"ng-container",10),a(17,"div",14)(18,"item-calculator-tab",15),_("discountTotal",function(s){return n.variant.Discount=s,n.onDiscountChange()})("priceTotal",function(s){return n.variant.UnitPrice=s,n.onPriceChange()})("qtyTotal",function(s){return n.variant.Quantity=s,n.onQtyChange()})("noteChanges",function(s){return n.variant.Note=s}),r()()()()()()),e&2&&(c("config",n.config),l(5),c("ngClass",ae(16,Ot,n.tabState=="Cart")),l(2),c("ngIf",!n.isCreate||n.showInventory),l(),c("ngIf",!n.isCreate||n.showInventory),l(),c("ngIf",n.isSerialItem),l(),c("ngClass",ae(18,Ot,n.tabState=="Calculator")),l(3),c("ngIf",n.tabState=="Cart"),l(),mt(n.tabState=="Discount"?14:-1),l(),c("ngIf",n.tabState=="Product"),l(),c("ngIf",n.tabState=="Serial"),l(),c("hidden",n.tabState!="Calculator"),l(),c("price",n.variant.UnitPrice)("discount",n.variant.Discount)("quantity",n.variant.Quantity)("notes",n.variant.Note)("variantName",n.variant==null?null:n.variant.Name))},dependencies:[F,it,pe,Ve,Me,Gt,Jt,Oe,he,Zn,le,Pe,vt,Ne,Ee,ot,at,Ci,jt,Bt,Ei,Ii,Kt,Ke,qe,ji,qt],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}p-chips[_ngcontent-%COMP%] ul.p-inputtext{width:570px;max-width:570px;border:1px solid #C8D3DF}p-chips[_ngcontent-%COMP%] ul.p-inputtext li.p-chips-input-token>input[type=text]{border:none}p-chips[_ngcontent-%COMP%] .p-chips .p-chips-multiple-container:not(.p-disabled):hover{border:1px solid #C8D3DF}p-chips[_ngcontent-%COMP%] .p-chips-multiple-container{display:inline-block}p-chips[_ngcontent-%COMP%] .p-chips-multiple-container .p-chips-token{margin:2px;background:#96bf48}.inventory-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .inventory-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{line-height:6px!important}.btn-link[_ngcontent-%COMP%]{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.selected[_ngcontent-%COMP%]{color:#3b3b3b;border-bottom:4px solid #07a519}.form-check-input[_ngcontent-%COMP%]{clear:left}.form-switch.form-switch-lg[_ngcontent-%COMP%] .form-check-input[_ngcontent-%COMP%]{height:1.5rem;width:2.75rem;border-radius:3rem}.form-check-input[_ngcontent-%COMP%]:focus{border-color:#89b03e!important}.form-check-input[_ngcontent-%COMP%]:checked{border-color:#89b03e!important;background-color:#89b03e!important}"]})};var Dt=class i extends Li{connection;_Data=new En(1);Data=this._Data.asObservable();httpService=ce(se);toastService=ce(Je);_cache=new Map;previousCountByEpc={};_isConnected=new Xe(!1);isConnected=this._isConnected.asObservable();_bufferTime=new Xe(100);set bufferTime(t){this._bufferTime.next(t)}get bufferTime(){return this._bufferTime.getValue()}intializeWebSocket(t="/"){return gt(this,null,function*(){if(t.length<=0){this.toastService.error("RFID URL cannot be empty",xe.Error);return}if(!(this.connection&&this.connection.state===Yn.Connected)){this.connection=new Xn().withUrl(t).configureLogging(zn.Information).withAutomaticReconnect().build();try{yield this.connection.start(),yield this.initiateGroupSubscription(),this.onWebSocketMessageReceived(),this._isConnected.next(!0),this.toastService.success("RFID Connected",xe.Success)}catch(e){throw this._isConnected.next(!1),this.toastService.error(JSON.stringify(e),xe.Error),new Error(JSON.stringify(e))}}})}initiateGroupSubscription(){return gt(this,null,function*(){try{yield this.connection.invoke("SubscribeGroup",{CurrentID:"Buy"})}catch(t){throw this.toastService.error(JSON.stringify(t),xe.Error),new Error(JSON.stringify(t))}})}onWebSocketMessageReceived(){this.connection.on("ReceiveSignal",t=>{this._Data.next(t)})}getVariantByCode(t,e=P.GuidEmpty){let n=[{key:"Code",value:t},{key:"EntityID",value:e}];return this.httpService.get($e.GetVariantByCode,n).pipe(_e(o=>o instanceof Gn?Ze(null):Fn(()=>new Error(o.message))))}processGroupedData(t=P.GuidEmpty){return this._Data.pipe(V(e=>e!==null&&e&&Object.keys(e).length>0),An(this._bufferTime.getValue()),_n(e=>Nn(e)),Rn(e=>e.epc),_n(e=>e.pipe(Mt((n,o)=>[...n,o],[]),Z(n=>{let o=e.key;if(this._cache.has(o))return this._cache.get(o).pipe(u(s=>({epc:o,items:n,response:s})));{let s=this.getVariantByCode(o,t).pipe(V(O=>O),E(O=>this._cache.set(o,Ze(O))));return this._cache.set(o,s),s.pipe(u(O=>({epc:o,items:n,response:O})))}}))),Mt((e,n)=>{let o=this.previousCountByEpc&&this.previousCountByEpc[n.epc]||0,s=n.items.length,O=s-o;return e[n.epc]={data:n.items,count:O,variant:n.response},this.previousCountByEpc[n.epc]=s,e},{}),te({bufferSize:1,refCount:!0}))}constructor(){super(),this.connection&&(this.connection.onclose=t=>gt(this,null,function*(){console.error("SignalR connection closed:",t)}),this.connection.onreconnecting=t=>gt(this,null,function*(){console.warn("SignalR reconnecting:",t)}),this.connection.onreconnected=t=>gt(this,null,function*(){console.log("SignalR reconnected:",t)}))}static \u0275fac=function(e){return new(e||i)};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};function Po(i,t){if(i&1&&(a(0,"td",24),m(1),r()),i&2){let e=d().index;l(),j(" ",e+1,". ")}}function Oo(i,t){if(i&1&&(Q(0),a(1,"div",25),I(2,"img",26),r(),U()),i&2){let e=d().$implicit;l(2),c("src",e.ThumbnailUrl,nt)}}function To(i,t){i&1&&(a(0,"div",27),I(1,"i",28),r())}function wo(i,t){if(i&1&&(a(0,"span"),m(1),g(2,"quantityFraction"),r()),i&2){let e=d().$implicit;l(),X(y(2,1,e.Quantity))}}function Eo(i,t){i&1&&(a(0,"span",29),m(1," x "),r())}function No(i,t){if(i&1&&(a(0,"span"),m(1),g(2,"number"),r()),i&2){let e=d().$implicit;l(),X(y(2,1,e.UnitQuantity))}}function Fo(i,t){i&1&&(a(0,"span",29),m(1," x "),r())}function Ao(i,t){if(i&1&&(a(0,"span"),m(1),g(2,"number"),r()),i&2){let e=d().$implicit;l(),X(y(2,1,e.UnitPrice))}}function ko(i,t){if(i&1&&(Q(0),a(1,"div"),m(2),g(3,"number"),r(),U()),i&2){let e=d().$implicit;l(2),j("-",y(3,1,e.Discount),"%")}}function Vo(i,t){if(i&1&&(a(0,"div"),m(1),g(2,"number"),r()),i&2){let e=d().$implicit;l(),j("-",y(2,1,e.DiscountAmount),"")}}function Ro(i,t){if(i&1&&(Q(0),m(1),g(2,"number"),U()),i&2){let e=d().$implicit;l(),X(y(2,1,e.Total))}}function $o(i,t){i&1&&m(0,"-")}function Bo(i,t){if(i&1){let e=B();a(0,"tr",9),_("contextmenu",function(){let o=x(e).index,s=d(2);return S(s.onContextMenu(o))})("click",function(){let o=x(e),s=o.$implicit,O=o.index,v=d(2);return S(v.update(s,O))}),D(1,Po,2,1,"td",10),a(2,"td",11)(3,"div",12),D(4,Oo,3,1,"ng-container",13)(5,To,2,0,"ng-template",null,2,be),a(7,"div",14)(8,"div"),m(9),r(),a(10,"span",15),m(11),r(),I(12,"app-serial-note",16)(13,"small",17),r()()(),a(14,"td",18)(15,"span"),D(16,wo,3,3,"span",19)(17,Eo,2,0,"span",20)(18,No,3,3,"span",19)(19,Fo,2,0,"span",20)(20,Ao,3,3,"span",19),r()(),a(21,"td",21),D(22,ko,4,3,"ng-container",19)(23,Vo,3,3,"div"),r(),a(24,"td",18),D(25,Ro,3,3,"ng-container",13)(26,$o,1,0,"ng-template",null,3,be),r(),a(28,"td",22)(29,"i",23),_("click",function(){let o=x(e).index,s=d(2);return S(s.deleteVariant(o))}),r()()()}if(i&2){let e=t.$implicit,n=ue(6),o=ue(27),s=d(2);c("cdkDragDisabled",!s.enabledDragDrop),l(),c("ngIf",s.appConfigJSON==null?null:s.appConfigJSON.ModuleBuy.Grid.RowNumberVisible),l(),yt("ps-0",s.appConfigJSON==null?null:s.appConfigJSON.ModuleBuy.Grid.RowNumberVisible),l(2),c("ngIf",e.ThumbnailUrl)("ngIfElse",n),l(5),X(e.Name),l(2),X(e.Code),l(),c("serials",e.Serial),l(),c("innerHtml",e.Note,Bn),l(3),c("ngIf",e.Quantity!=1||e.UnitQuantity>1),l(),c("ngIf",e.UnitQuantity>1||e.UnitQuantity<=-1),l(),c("ngIf",e.UnitQuantity>1||e.UnitQuantity<=-1),l(),c("ngIf",(e.Quantity>1||e.Quantity<=-1)&&s.role.product.Cost),l(),c("ngIf",(e.Quantity>1||e.Quantity<=-1||e.Discount>0||e.DiscountAmount>0)&&s.role.product.Cost),l(2),c("ngIf",e.Discount),l(),mt(e.DiscountAmount?23:-1),l(2),c("ngIf",s.role.product.Cost)("ngIfElse",o)}}function jo(i,t){if(i&1){let e=B();a(0,"div",5)(1,"table",6)(2,"tbody",7),_("cdkDropListDropped",function(o){x(e);let s=d();return S(s.drop(o))}),D(3,Bo,30,19,"tr",8),r()()()}if(i&2){let e=d(),n=ue(4);c("cdkContextMenuTriggerFor",n),l(3),c("ngForOf",e.cart)}}function Lo(i,t){i&1&&(a(0,"div",30)(1,"div",31)(2,"div",32)(3,"div",33)(4,"div",34),I(5,"i",35),r(),a(6,"div",36)(7,"span"),m(8,"Empty Cart"),r(),I(9,"br"),a(10,"span"),m(11,"Add products to the cart"),r(),I(12,"br"),a(13,"span"),m(14,"or scan barcode"),r()()()()()())}function Qo(i,t){if(i&1){let e=B();a(0,"button",39),_("click",function(){x(e);let o=d(2);return S(o.onReturn())}),m(1," Return "),r()}}function Uo(i,t){if(i&1){let e=B();a(0,"div",37),D(1,Qo,2,0,"button",38),a(2,"button",39),_("click",function(){x(e);let o=d();return S(o.onPurchase())}),m(3," Purchase "),r()()}if(i&2){let e=d();l(),c("ngIf",e.role.sell.Return)}}var Xt=class i{constructor(t,e,n,o,s,O){this.cartService=t;this.matDialog=e;this.role=n;this.form=o;this.sf=O}cart=[];appConfigJSON;isEdit;outletID;outletName;RFIDService=ce(Dt);outletService=ce(q);enabledDragDrop=!0;onOpenContextMenuIndex=-1;ngOnInit(){this.initDragDropEnabled(),this.outletService.outlet.valueChanges.pipe(Z(t=>this.RFIDService.processGroupedData(t.ID)),E(t=>this.cartService.addCartRFID(t))).subscribe()}initDragDropEnabled(){P.isMobileDevice&&(this.enabledDragDrop=!1)}deleteVariant(t){this.cartService.deleteVariant(t)}drop(t){this.cartService.dragDropCart(t)}onContextMenu(t){this.onOpenContextMenuIndex=t}onReturn(){this.cartService.returnVariant(this.onOpenContextMenuIndex)}onPurchase(){this.cartService.purchaseVariant(this.onOpenContextMenuIndex)}update(t,e){let n=T({},t);this.matDialog.open(lt,{data:{variant:n,appConfigJSON:this.appConfigJSON,isEdit:this.isEdit,outletID:this.outletID,outletName:this.outletName,deliveryEntityID:this.form.deliveryEntityID.value}}).afterClosed().pipe(V(o=>!!o)).subscribe(o=>{this.cartService.updateVariant(o,e),this.sf.searchFilterNativeEl.focus()})}static \u0275fac=function(e){return new(e||i)(f(ie),f(ne),f(De),f(q),f(Wt),f(Pt))};static \u0275cmp=N({type:i,selectors:[["POS-cart-display"]],inputs:{cart:"cart",appConfigJSON:"appConfigJSON",isEdit:"isEdit",outletID:"outletID",outletName:"outletName"},decls:5,vars:2,consts:[["EMPTY_CART",""],["context_menu",""],["NO_IMAGE",""],["HIDDENCOST",""],[3,"cdkContextMenuTriggerFor",4,"ngIf","ngIfElse"],[3,"cdkContextMenuTriggerFor"],[1,"table","table-borderless"],["cdkDropList","",3,"cdkDropListDropped"],["class","border-bottom","cdkDrag","",3,"cdkDragDisabled","contextmenu","click",4,"ngFor","ngForOf"],["cdkDrag","",1,"border-bottom",3,"contextmenu","click","cdkDragDisabled"],["style","width: 10px",4,"ngIf"],[2,"width","50%"],[1,"d-flex"],[4,"ngIf","ngIfElse"],[1,"ms-4","d-flex","flex-column","justify-content-center",2,"line-height","18px"],[1,"fw-normal","fs-6","text-muted"],[3,"serials"],["title","Note",1,"special-TinyMCE","m-0","fst-italic","d-block",3,"innerHtml"],[1,"text-end"],[4,"ngIf"],["class","fs-6",4,"ngIf"],[1,"text-end","text-danger"],[1,"text-end",2,"width","75px"],[1,"fa-solid","fa-trash","fs-4","text-danger","pointer",3,"click"],[2,"width","10px"],[1,"ratio","ratio-1x1",2,"width","55px"],[1,"item-image",3,"src"],[1,"item-image","d-flex","justify-content-center","align-items-center","text-center","fs-1"],[1,"fa-solid","fa-image",2,"color","#b4b4b4c2"],[1,"fs-6"],[1,"row","g-0","h-100"],[1,"col-12"],[1,"d-flex","justify-content-center","align-items-center","h-100"],[1,"row"],[1,"col-12","d-flex","justify-content-center"],[1,"fa-regular","fa-cart-arrow-up","text-secondary",2,"font-size","110px"],[1,"col-12","justify-content-center","text-center","mt-5","empty-cart-description","text-secondary","headings-font-family"],["cdkMenu","",1,"example-menu"],["class","example-menu-item","cdkMenuItem","",3,"click",4,"ngIf"],["cdkMenuItem","",1,"example-menu-item",3,"click"]],template:function(e,n){if(e&1&&D(0,jo,4,2,"div",4)(1,Lo,15,0,"ng-template",null,0,be)(3,Uo,4,1,"ng-template",null,1,be),e&2){let o=ue(2);c("ngIf",n.cart.length)("ngIfElse",o)}},dependencies:[F,He,pe,Me,di,mi,pi,Bi,Ri,Vi,$i,xi,Qt],styles:[".item-image[_ngcontent-%COMP%]{height:50px;width:56px;display:block;border:solid 1px #dddddd;border-radius:5px;object-fit:contain}.example-menu[_ngcontent-%COMP%]{display:inline-flex;flex-direction:column;min-width:180px;max-width:280px;background-color:#fff;padding:6px 0}.example-menu-item[_ngcontent-%COMP%]{background-color:transparent;cursor:pointer;border:none;-webkit-user-select:none;user-select:none;min-width:64px;line-height:36px;padding:0 16px;display:flex;align-items:center;flex-direction:row;flex:1}.example-menu-item[_ngcontent-%COMP%]:hover{background-color:#f5f5f5}.example-menu-item[_ngcontent-%COMP%]:active{background-color:#dcdcdc}.table[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:not(caption) > *[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{padding:12px 10px} .cdk-menu.cdk-menu-group.example-menu{box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.empty-cart-description[_ngcontent-%COMP%]{font-size:14px;font-weight:500;color:#c7c7c7}"]})};var Zt=class i{constructor(t,e){this.dialogRef=t;this.data=e;this.config.title="Return",this.invoiceNumber=e.invoiceNumber}config=new we;invoiceNumber;ok(){this.dialogRef.close(this.invoiceNumber)}static \u0275fac=function(e){return new(e||i)(f(Te),f(Re))};static \u0275cmp=N({type:i,selectors:[["POS-modal-return-invoice"]],decls:6,vars:2,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(e,n){e&1&&(a(0,"modal-material",0),_("onOk",function(){return n.ok()})("onCancel",function(){return n.dialogRef.close()})("onClose",function(){return n.dialogRef.close()}),a(1,"content")(2,"div",1)(3,"input",2),J("ngModelChange",function(s){return L(n.invoiceNumber,s)||(n.invoiceNumber=s),s}),r(),a(4,"label",3),m(5,"Supplier Bill"),r()()()()),e&2&&(c("config",n.config),l(3),H("ngModel",n.invoiceNumber))},dependencies:[F,Oe,he,le,Pe,Ne,Ee],encapsulation:2})};var en=class i{constructor(t){this.matDialog=t}invoiceNumber;disabled=!1;onChange=t=>{};onTouched=()=>{};writeValue(t){this.invoiceNumber=t}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}openModalReturnInvoice(){this.matDialog.open(Zt,{data:{invoiceNumber:this.invoiceNumber}}).afterClosed().pipe(V(t=>!!t)).subscribe(t=>{this.invoiceNumber=t,this.onChange(this.invoiceNumber)})}static \u0275fac=function(e){return new(e||i)(f(ne))};static \u0275cmp=N({type:i,selectors:[["POS-return-invoice"]],features:[ke([{provide:Ge,multi:!0,useExisting:i}])],decls:1,vars:0,consts:[["icon","fa-solid fa-file-invoice","label","Return Bill",3,"click"]],template:function(e,n){e&1&&(a(0,"POS-dropdown-item-more-action",0),_("click",function(){return n.openModalReturnInvoice()}),r())},dependencies:[F,Lt,Be],encapsulation:2})};var tn=class i{constructor(t){this.cart=t}returnCart(){this.cart.returnCart()}static \u0275fac=function(e){return new(e||i)(f(ie))};static \u0275cmp=N({type:i,selectors:[["POS-return-cart"]],decls:1,vars:0,consts:[["icon","fa-cart-shopping fa-solid","label","Return Cart",3,"click"]],template:function(e,n){e&1&&(a(0,"POS-dropdown-item-more-action",0),_("click",function(){return n.returnCart()}),r())},dependencies:[F,Be],encapsulation:2})};var nn=class i{constructor(t){this.cart=t}clearCart(){this.cart.clearCart()}static \u0275fac=function(e){return new(e||i)(f(ie))};static \u0275cmp=N({type:i,selectors:[["POS-clear-cart"]],decls:1,vars:0,consts:[["icon","fa-trash fa-solid","label","Clear",3,"click"]],template:function(e,n){e&1&&(a(0,"POS-dropdown-item-more-action",0),_("click",function(){return n.clearCart()}),r())},dependencies:[F,Be],encapsulation:2})};var on=class i{constructor(t,e){this.matDialog=t;this.cart=e}appConfigJSON;isEditBuyForm;outletID;outletName;addVariant(){this.matDialog.open(lt,{data:{appConfigJSON:this.appConfigJSON,isEdit:this.isEditBuyForm,outletID:this.outletID,outletName:this.outletName}}).afterClosed().pipe(V(t=>!!t)).subscribe(t=>this.cart.addVariant(t))}static \u0275fac=function(e){return new(e||i)(f(ne),f(ie))};static \u0275cmp=N({type:i,selectors:[["POS-add-variant"]],inputs:{appConfigJSON:"appConfigJSON",isEditBuyForm:"isEditBuyForm",outletID:"outletID",outletName:"outletName"},decls:1,vars:0,consts:[["icon","fa-circle-plus fa-solid","label","Add",3,"click"]],template:function(e,n){e&1&&(a(0,"POS-dropdown-item-more-action",0),_("click",function(){return n.addVariant()}),r())},dependencies:[F,Be],encapsulation:2})};var an=class i{constructor(t,e){this.matDialog=t;this.cart=e}outletID;uploadCart(){this.matDialog.open(Ni,{data:{sampleUrl:"https://cdn.dealpos.xyz/web-import-template/ImportBuyV2_DealPOS_New.csv",outletID:this.outletID,fileEndpoint:"/API/Buy/UploadCsvV2",useUppy:!0}}).afterClosed().pipe(V(t=>!!t),u(t=>t.map(e=>R(T({},e.Variant),{UnitPrice:e.Cost,Total:e.Cost*e.Quantity*(1-e.Discount/100)-e.DiscountAmount,Quantity:e.Quantity,Serial:e.Serial,Note:e.Note,Discount:e.Discount,DiscountAmount:e.DiscountAmount})))).subscribe(t=>this.cart.uploadCart(t))}static \u0275fac=function(e){return new(e||i)(f(ne),f(ie))};static \u0275cmp=N({type:i,selectors:[["POS-upload-cart"]],inputs:{outletID:"outletID"},decls:1,vars:0,consts:[["icon","fa-upload fa-solid","label","Upload",3,"click"]],template:function(e,n){e&1&&(a(0,"POS-dropdown-item-more-action",0),_("click",function(){return n.uploadCart()}),r())},dependencies:[F,Be],encapsulation:2})};var Wo=["serialInput"],rn=class i{constructor(t,e,n){this.dialogRef=t;this.toastr=e;this.cart=n;this.modalConfig.title="Scan Serial",this.modalConfig.customWidth="350px",this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0}serialInputEl;modalConfig=new we;serial;ngOnInit(){}onKeyDown(t){t.key=="Enter"&&(P.IsNotEmpty(this.serial)?(this.cart.addVariantThroughSerial(this.serial),this.serial=null):this.toastr.warning("Serial Can`t be empty","Warning!"),this.setFocusInput())}setFocusInput(){this.serialInputEl&&setTimeout(()=>{this.serialInputEl?.nativeElement?.focus()},500)}static \u0275fac=function(e){return new(e||i)(f(Te),f(Je),f(ie))};static \u0275cmp=N({type:i,selectors:[["POS-modal-scan-serial"]],viewQuery:function(e,n){if(e&1&&Nt(Wo,5),e&2){let o;Ft(o=At())&&(n.serialInputEl=o.first)}},decls:7,vars:2,consts:[["serialInput",""],[3,"onClose","config"],[1,"input-group","mt-3"],["type","text","placeholder","Input Product By Serial","aria-label","Serial",1,"form-control",3,"ngModelChange","keydown","ngModel"],[1,"input-group-text"],[1,"fa-solid","fa-barcode","fs-4"]],template:function(e,n){if(e&1){let o=B();a(0,"modal-material",1),_("onClose",function(){return x(o),S(n.dialogRef.close())}),a(1,"content")(2,"div",2)(3,"input",3,0),J("ngModelChange",function(O){return x(o),L(n.serial,O)||(n.serial=O),S(O)}),_("keydown",function(O){return x(o),S(n.onKeyDown(O))}),r(),a(5,"span",4),I(6,"i",5),r()()()()}e&2&&(c("config",n.modalConfig),l(3),H("ngModel",n.serial))},dependencies:[F,Oe,he,le,Pe,Ne,Ee],styles:["input[_ngcontent-%COMP%]{height:55px;border-bottom-left-radius:4px;border-top-left-radius:4px}span.input-group-text[_ngcontent-%COMP%]{border-bottom-right-radius:4px;border-top-right-radius:4px}"]})};var ln=class i{constructor(t,e){this.matDialog=t;this.viewContainerRef=e}scanSerial(){this.matDialog.open(rn,{viewContainerRef:this.viewContainerRef})}static \u0275fac=function(e){return new(e||i)(f(ne),f(Qn))};static \u0275cmp=N({type:i,selectors:[["POS-scan-serial"]],decls:1,vars:0,consts:[["icon","fa-barcode-read fa-solid","label","Serial",3,"click"]],template:function(e,n){e&1&&(a(0,"POS-dropdown-item-more-action",0),_("click",function(){return n.scanSerial()}),r())},dependencies:[F,Be],encapsulation:2})};var Ho=i=>({disabled:i}),Jo=(i,t)=>({red:i,green:t}),sn=class i{RFIDService=ce(Dt);matDialog=ce(ne);constructor(){}onOpenModal(){this.matDialog.open(Qi).componentInstance.onOK.pipe(hi("onPayload"),E(({hostURL:e,bufferTime:n})=>{this.RFIDService.bufferTime=n,this.RFIDService.intializeWebSocket(e)}),te(1)).subscribe()}ngOnInit(){}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=N({type:i,selectors:[["pos-rfid-buy-action"]],decls:8,vars:13,consts:[[1,"dropdown-item","px-1","d-flex",3,"click","ngClass"],["aria-hidden","true",1,"fa-solid","fa-wifi","fs-2"],[1,"pe-0","ps-4","fs-6"],[1,"blob",2,"position","absolute","top","0","right","0",3,"ngClass"]],template:function(e,n){e&1&&(a(0,"div",0),g(1,"async"),_("click",function(){return n.onOpenModal()}),I(2,"i",1),a(3,"label",2),m(4,"Connect RFID"),r(),I(5,"div",3),g(6,"async"),g(7,"async"),r()),e&2&&(c("ngClass",ae(8,Ho,y(1,2,n.RFIDService.isConnected))),l(5),c("ngClass",$t(10,Jo,!y(6,4,n.RFIDService.isConnected),y(7,6,n.RFIDService.isConnected))))},dependencies:[F,it,Ve],styles:[".disabled[_ngcontent-%COMP%]{color:gray;pointer-events:none;cursor:not-allowed}.blob[_ngcontent-%COMP%]{background:#000;border-radius:50%;box-shadow:0 0 #000;height:15px;width:15px;transform:scale(1);animation:_ngcontent-%COMP%_pulse-black 2s infinite}@keyframes _ngcontent-%COMP%_pulse-black{0%{transform:scale(.95);box-shadow:0 0 #000000b3}70%{transform:scale(1);box-shadow:0 0 0 10px #0000}to{transform:scale(.95);box-shadow:0 0 #0000}}.blob.white[_ngcontent-%COMP%]{background:#fff;box-shadow:0 0 #fff;animation:_ngcontent-%COMP%_pulse-white 2s infinite}@keyframes _ngcontent-%COMP%_pulse-white{0%{transform:scale(.95);box-shadow:0 0 #ffffffb3}70%{transform:scale(1);box-shadow:0 0 0 10px #fff0}to{transform:scale(.95);box-shadow:0 0 #fff0}}.blob.red[_ngcontent-%COMP%]{background:#ff5252;box-shadow:0 0 #ff5252;animation:_ngcontent-%COMP%_pulse-red 2s infinite}@keyframes _ngcontent-%COMP%_pulse-red{0%{transform:scale(.95);box-shadow:0 0 #ff5252b3}70%{transform:scale(1);box-shadow:0 0 0 10px #ff525200}to{transform:scale(.95);box-shadow:0 0 #ff525200}}.blob.orange[_ngcontent-%COMP%]{background:#ff793f;box-shadow:0 0 #ff793f;animation:_ngcontent-%COMP%_pulse-orange 2s infinite}@keyframes _ngcontent-%COMP%_pulse-orange{0%{transform:scale(.95);box-shadow:0 0 #ff793fb3}70%{transform:scale(1);box-shadow:0 0 0 10px #ff793f00}to{transform:scale(.95);box-shadow:0 0 #ff793f00}}.blob.yellow[_ngcontent-%COMP%]{background:#ffb142;box-shadow:0 0 #ffb142;animation:_ngcontent-%COMP%_pulse-yellow 2s infinite}@keyframes _ngcontent-%COMP%_pulse-yellow{0%{transform:scale(.95);box-shadow:0 0 #ffb142b3}70%{transform:scale(1);box-shadow:0 0 0 10px #ffb14200}to{transform:scale(.95);box-shadow:0 0 #ffb14200}}.blob.blue[_ngcontent-%COMP%]{background:#34ace0;box-shadow:0 0 #34ace0;animation:_ngcontent-%COMP%_pulse-blue 2s infinite}@keyframes _ngcontent-%COMP%_pulse-blue{0%{transform:scale(.95);box-shadow:0 0 #34ace0b3}70%{transform:scale(1);box-shadow:0 0 0 10px #34ace000}to{transform:scale(.95);box-shadow:0 0 #34ace000}}.blob.green[_ngcontent-%COMP%]{background:#77d933;box-shadow:0 0 #77d933;animation:_ngcontent-%COMP%_pulse-green 2s infinite}@keyframes _ngcontent-%COMP%_pulse-green{0%{transform:scale(.95);box-shadow:0 0 #33d938b3}70%{transform:scale(1);box-shadow:0 0 0 10px #33d9b200}to{transform:scale(.95);box-shadow:0 0 #33d9b200}}.blob.purple[_ngcontent-%COMP%]{background:#8e44ad;box-shadow:0 0 #8e44ad;animation:_ngcontent-%COMP%_pulse-purple 2s infinite}@keyframes _ngcontent-%COMP%_pulse-purple{0%{transform:scale(.95);box-shadow:0 0 #8e44adb3}70%{transform:scale(1);box-shadow:0 0 0 10px #8e44ad00}to{transform:scale(.95);box-shadow:0 0 #8e44ad00}}"],changeDetection:0})};function Go(i,t){i&1&&(a(0,"li",11),I(1,"POS-return-cart"),r())}function qo(i,t){if(i&1&&(a(0,"li",11),I(1,"POS-return-invoice",16),r()),i&2){let e=d(2);l(),c("formControl",e.returnInvoiceNumber)}}function Ko(i,t){if(i&1&&(a(0,"div",8)(1,"div",9),m(2,"Order"),r(),I(3,"div",10),D(4,Go,2,0,"li",15)(5,qo,2,1,"li",15),r()),i&2){let e=d();l(4),c("ngIf",e.role.sell.Return),l(),c("ngIf",e.role.sell.Return)}}var cn=class i{constructor(t,e,n){this.role=t;this.matDialog=e;this.cart=n}returnInvoiceNumber=new me("");appConfigJSON;isEditBuyForm;outletID;outletName;handleKeyboardEvent(t){t.key==="F4"&&this.matDialog.openDialogs.length===0&&this.addVariant()}addVariant(){this.matDialog.open(lt,{data:{appConfigJSON:this.appConfigJSON,isEdit:this.isEditBuyForm,outletID:this.outletID,outletName:this.outletName}}).afterClosed().pipe(V(t=>!!t)).subscribe(t=>this.cart.addVariant(t))}static \u0275fac=function(e){return new(e||i)(f(De),f(ne),f(ie))};static \u0275cmp=N({type:i,selectors:[["POS-more-actions"]],hostBindings:function(e,n){e&1&&_("keydown",function(s){return n.handleKeyboardEvent(s)},!1,jn)},inputs:{returnInvoiceNumber:"returnInvoiceNumber",appConfigJSON:"appConfigJSON",isEditBuyForm:"isEditBuyForm",outletID:"outletID",outletName:"outletName"},decls:27,vars:6,consts:[["id","moreMenu","data-bs-toggle","dropdown",1,"d-flex","align-items-center","cursor-pointer"],[1,"me-2"],[1,"fa-solid","fa-caret-down","fa-lg"],[1,"fs-6","headings-font-family","pb-1"],[1,"h-100","d-flex","align-items-center","justify-content-between"],["aria-labelledby","moreMenu",1,"dropdown-menu","more-actions"],[1,"d-flex",2,"width","30rem"],["class","dropdown-header text-dark col",4,"ngIf"],[1,"dropdown-header","text-dark","col"],[1,"h5","mb-4"],[1,"dropdown-divider","m-0"],[1,"cursor-pointer"],[3,"appConfigJSON","isEditBuyForm","outletID","outletName"],[3,"outletID"],[1,"cursor-pointer","position-relative"],["class","cursor-pointer",4,"ngIf"],[3,"formControl"]],template:function(e,n){e&1&&(a(0,"span",0)(1,"span",1),I(2,"i",2),r(),a(3,"span",3),m(4,"More Actions"),r()(),a(5,"div",4)(6,"div",5)(7,"div",6),D(8,Ko,6,2,"div",7),a(9,"div",8)(10,"div",9),m(11,"Item"),r(),I(12,"div",10),a(13,"li",11),I(14,"POS-add-variant",12),r(),a(15,"li",11),I(16,"POS-scan-serial"),r(),a(17,"li",11),I(18,"POS-upload-cart",13),r(),a(19,"li",11),I(20,"POS-clear-cart"),r()(),a(21,"div",8)(22,"div",9),m(23,"Advanced"),r(),I(24,"div",10),a(25,"li",14),I(26,"pos-rfid-buy-action"),r()()()()()),e&2&&(l(8),c("ngIf",n.role.sell.Return),l(6),c("appConfigJSON",n.appConfigJSON)("isEditBuyForm",n.isEditBuyForm)("outletID",n.outletID)("outletName",n.outletName),l(4),c("outletID",n.outletID))},dependencies:[F,pe,Ke,le,qe,en,tn,nn,on,an,ln,sn],encapsulation:2})};var pn=class i{constructor(t,e){this.dialogRef=t;this.config.title="Discount and Tax",this.config.customWidth="400px";let n=e.discount;this.discountAmount=n.Amount,this.discountPercentage=n.Percentage;let o=e.tax;this.taxID=o.ID,this.taxRate=o.Rate,this.taxType=o.CalculationTypeName,this.taxLabel=o.Label,this.taxes=e.taxes.filter(s=>!s.Bin),this.currencySymbol=e.currencySymbol}config=new we;tabIndexActive;discountAmount=0;discountPercentage=0;taxes=[];taxID="";taxRate=0;taxType="";taxLabel="";discounts=[];currencySymbol="";ok(){this.dialogRef.close({Discount:{Amount:this.discountAmount,Percentage:this.discountPercentage},Tax:{ID:this.taxID,Rate:this.taxRate,CalculationTypeName:this.taxType,Label:this.taxLabel,Discontinue:!1}})}close(){this.dialogRef.close()}calculateDiscountCalculator(){let t=100;this.discounts.forEach(e=>{t=t*(100-e)/100}),this.discountPercentage=100-t}updateTax(t){this.taxID=t.ID,this.taxRate=t.Rate,this.taxType=t.CalculationTypeName,this.taxLabel=t.Label}static \u0275fac=function(e){return new(e||i)(f(Te),f(Re))};static \u0275cmp=N({type:i,selectors:[["POS-modal-discount-and-tax"]],decls:48,vars:10,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],["matTooltipPosition","above","matTooltip","Discount","tabTitle","Discount"],[1,"row","d-flex","align-items-center","justify-content-start"],[1,"col-3"],[1,"fw-bold","d-block"],[1,"col-9"],["type","text","data-cy","discount1","autoNum","","percentage","","decimalPlaces","2",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","ngModel"],[1,"ms-1"],[1,"row","d-flex","align-items-center","justify-content-start","mt-6"],["type","text","data-cy","discountamount","autoNum","",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","ngModel"],["matTooltipPosition","above","matTooltip","Tax","tabTitle","Tax"],["bindLabel","Label","appendTo","body","bindValue","ID","placeholder","Tax","data-cy","Tax",2,"width","150px",3,"change","clearable","ngModel","items"],["matTooltipPosition","above","matTooltip","Calculation","tabTitle","Calculator"],[1,"row","mt-6","g-0","d-flex","align-items-center","justify-content-start"],[1,"col-4"],[1,"col-8","ps-4"],["type","text","data-cy","discountCal1","autoNum","","percentage","","decimalPlaces","2",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],[1,"mx-2"],["type","text","data-cy","discountCal2","autoNum","","percentage","","decimalPlaces","2",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],["type","text","data-cy","discountCal3","autoNum","","percentage","","decimalPlaces","2",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"]],template:function(e,n){e&1&&(a(0,"modal-material",0),_("keydown.F2",function(){return n.ok()})("onOk",function(){return n.ok()})("onCancel",function(){return n.close()})("onClose",function(){return n.close()}),a(1,"content")(2,"div",1)(3,"custom-tabs"),Q(4),a(5,"tab",2)(6,"div",3)(7,"div",4)(8,"label",5),m(9,"Discount %"),r()(),a(10,"div",6)(11,"input",7),J("ngModelChange",function(s){return L(n.discountPercentage,s)||(n.discountPercentage=s),s}),r(),a(12,"span",8),m(13,"%"),r()()(),a(14,"div",9)(15,"div",4)(16,"label",5),m(17),r()(),a(18,"div",6)(19,"input",10),J("ngModelChange",function(s){return L(n.discountAmount,s)||(n.discountAmount=s),s}),r()()()(),U(),Q(20),a(21,"tab",11)(22,"div",3)(23,"div",4)(24,"label",5),m(25,"Tax"),r()(),a(26,"div",6)(27,"ng-select",12),_("change",function(s){return n.updateTax(s)}),r()()()(),U(),Q(28),a(29,"tab",13)(30,"div",14)(31,"div",15)(32,"label",5),m(33,"Discount Calculator"),r()(),a(34,"div",16)(35,"input",17),J("ngModelChange",function(s){return L(n.discounts[0],s)||(n.discounts[0]=s),s}),_("ngModelChange",function(){return n.calculateDiscountCalculator()}),r(),a(36,"span"),m(37," %"),r(),a(38,"span",18),m(39,"+"),r(),a(40,"input",19),J("ngModelChange",function(s){return L(n.discounts[1],s)||(n.discounts[1]=s),s}),_("ngModelChange",function(){return n.calculateDiscountCalculator()}),r(),a(41,"span"),m(42," %"),r(),a(43,"span",18),m(44,"+"),r(),a(45,"input",20),J("ngModelChange",function(s){return L(n.discounts[2],s)||(n.discounts[2]=s),s}),_("ngModelChange",function(){return n.calculateDiscountCalculator()}),r(),a(46,"span"),m(47," %"),r()()()(),U(),r()()()()),e&2&&(c("config",n.config),l(11),H("ngModel",n.discountPercentage),l(6),j("Discount ",n.currencySymbol,""),l(2),H("ngModel",n.discountAmount),l(8),c("clearable",!1)("ngModel",n.taxID)("items",n.taxes),l(8),H("ngModel",n.discounts[0]),l(5),H("ngModel",n.discounts[1]),l(5),H("ngModel",n.discounts[2]))},dependencies:[F,Oe,he,le,Pe,vt,Ne,Ee,Oi,wi,Ti,ot,at,Ct,bt,_t],encapsulation:2})};var mn=class i{constructor(t){this.matDialog=t}taxes=[];currencySymbol="";discTax;disabled=!1;onChange=t=>{};onTouched=()=>{};writeValue(t){this.discTax=t}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}openModalDiscountAndTax(){this.matDialog.open(pn,{data:{discount:T({},this.discTax.Discount),tax:T({},this.discTax.Tax),taxes:this.taxes,currencySymbol:this.currencySymbol}}).afterClosed().pipe(V(t=>!!t)).subscribe(t=>{this.discTax.Discount=T({},t.Discount),this.discTax.Tax=T({},t.Tax),this.onChange(this.discTax)})}static \u0275fac=function(e){return new(e||i)(f(ne))};static \u0275cmp=N({type:i,selectors:[["POS-discount-and-tax-form"]],inputs:{taxes:"taxes",currencySymbol:"currencySymbol"},features:[ke([{provide:Ge,multi:!0,useExisting:i}])],decls:2,vars:0,consts:[["type","button","matTooltip","Discount / Tax","matTooltipPosition","above",1,"btn","btn-success","fs-5",2,"border-right","0.1px solid #fff",3,"click"],[1,"fa-light","fa-percent"]],template:function(e,n){e&1&&(a(0,"button",0),_("click",function(){return n.openModalDiscountAndTax()}),I(1,"i",1),r())},dependencies:[F,Ct,bt,Lt],styles:["button[_ngcontent-%COMP%]{border-right:.1px solid #fff;border-top-right-radius:0;border-bottom-right-radius:0;position:relative;flex:1 1 auto}"]})};var Tt=i=>({selected:i}),zo=(i,t)=>({"col-sm-3":i,"col-sm-7":t});function Yo(i,t){if(i&1){let e=B();a(0,"div",11)(1,"label",12)(2,"input",13),J("ngModelChange",function(o){x(e);let s=d(2);return L(s.tagID,o)||(s.tagID=o),S(o)}),r(),m(3),r()()}if(i&2){let e=t.$implicit,n=t.index,o=d(2);l(),xn("for","potype-"+n),c("ngClass",ae(6,Tt,o.tagID==e.ID)),l(),xn("id","potype-"+n),H("ngModel",o.tagID),c("value",e.ID),l(),j(" ",e.Name," ")}}function Xo(i,t){if(i&1&&(Q(0),a(1,"div",9),D(2,Yo,4,8,"div",10),r(),U()),i&2){let e=d();l(2),c("ngForOf",e.supplierPOTypes)}}function Zo(i,t){if(i&1){let e=B();Q(0),a(1,"strong",14),m(2,"Supplier Bill Number"),r(),a(3,"input",15),J("ngModelChange",function(o){x(e);let s=d();return L(s.invoiceNumber,o)||(s.invoiceNumber=o),S(o)}),r(),U()}if(i&2){let e=d();l(3),H("ngModel",e.invoiceNumber)}}function ea(i,t){if(i&1){let e=B();Q(0),a(1,"div",16)(2,"POS-tinymce-editor",17),J("ngModelChange",function(o){x(e);let s=d();return L(s.note,o)||(s.note=o),S(o)}),r()(),U()}if(i&2){let e=d();l(2),H("ngModel",e.note)}}function ta(i,t){if(i&1){let e=B();a(0,"div",28)(1,"span",29),m(2,"@"),r(),a(3,"input",30),J("ngModelChange",function(o){x(e);let s=d(2);return L(s.exchangeRate,o)||(s.exchangeRate=o),S(o)}),r()()}if(i&2){let e=d(2);l(3),H("ngModel",e.exchangeRate)}}function na(i,t){if(i&1){let e=B();Q(0),a(1,"div",18)(2,"div",19)(3,"div",20),m(4,"Currency :"),r(),a(5,"div",21)(6,"ng-select",22),J("ngModelChange",function(o){x(e);let s=d();return L(s.currencyID,o)||(s.currencyID=o),S(o)}),r()(),D(7,ta,4,1,"div",23),r()(),a(8,"div",24)(9,"div",25),m(10,"Term :"),r(),a(11,"div",26)(12,"ng-select",27),J("ngModelChange",function(o){x(e);let s=d();return L(s.note,o)||(s.note=o),S(o)}),r()()(),U()}if(i&2){let e=d();l(5),c("ngClass",$t(8,zo,e.currencyID!=e.defaultCurrencyID,e.currencyID==e.defaultCurrencyID)),l(),c("items",e.currencies),H("ngModel",e.currencyID),c("clearable",!1),l(),c("ngIf",e.currencyID!=e.defaultCurrencyID),l(5),c("items",e.predefinedNotes),H("ngModel",e.note),c("clearable",!1)}}var dn=class i{constructor(t,e){this.dialogRef=t;this.config=new we,this.config.title="Purchase Order Note",this.config.customWidth="700px",this.note=e.note,this.tagID=e.tagID,this.currencyID=e.currencyID,this.exchangeRate=e.currencies.find(n=>n.ID==this.currencyID).ExchangeRate,this.supplierPOTypes=e.supplierPOTypes,this.predefinedNotes=e.predefinedNotes,this.currencies=e.currencies,this.defaultCurrencyID=e.defaultCurrencyID,this.invoiceNumber=e.invoiceNumber,P.IsEmpty(this.tagID)&&(this.tagID=this.supplierPOTypes[0]?.ID)}supplierPOTypes;predefinedNotes;currencies;currencyID;note;tagID;defaultCurrencyID;exchangeRate=0;invoiceNumber;tabState="Note";config;ok(){this.dialogRef.close({Note:this.note,TagID:this.tagID,Currency:R(T({},this.currencies.find(t=>t.ID==this.currencyID)),{ExchangeRate:this.exchangeRate}),InvoiceNumber:this.invoiceNumber})}close(){this.dialogRef.close()}onTabChange(t){this.tabState=t}static \u0275fac=function(e){return new(e||i)(f(Te),f(Re))};static \u0275cmp=N({type:i,selectors:[["POS-modal-note"]],decls:18,vars:17,consts:[[3,"onCancel","onClose","onOk","config"],[1,"container-fluid"],[1,"row","border-bottom"],["data-cy","note",1,"btn","btn-link",3,"click","ngClass"],["data-cy","type",1,"btn","btn-link",3,"click","ngClass"],["data-cy","number",1,"btn","btn-link",3,"click","ngClass"],["data-cy","other",1,"btn","btn-link",3,"click","ngClass"],[1,"row","mt-8"],[4,"ngIf"],[1,"col-12"],["class","rad-btn",4,"ngFor","ngForOf"],[1,"rad-btn"],[3,"for","ngClass"],["type","radio",3,"ngModelChange","ngModel","value","id"],[1,"mb-2","ps-0"],["type","text","placeholder","Same as Purchase Order Number when blank",1,"form-control","w-50",3,"ngModelChange","ngModel"],[1,"col-12","tinymce"],[3,"ngModelChange","ngModel"],[1,"col-7","pe-0"],[1,"row"],[1,"col-sm-3","d-flex","align-items-center"],[1,"ps-0",3,"ngClass"],["bindLabel","Name","bindValue","ID","placeholder","Outlet","appendTo","body",3,"ngModelChange","items","ngModel","clearable"],["class","col-sm-4 d-flex",4,"ngIf"],[1,"col-5","d-flex","align-items-center","ps-0"],[1,"col-sm-2"],[1,"col-sm-10"],["bindLabel","Label","bindValue","Description","placeholder","Term","appendTo","body",3,"ngModelChange","items","ngModel","clearable"],[1,"col-sm-4","d-flex"],[1,"pt-4"],["type","text","autoNum","",1,"border","border-light",2,"width","100px",3,"ngModelChange","ngModel"]],template:function(e,n){e&1&&(a(0,"modal-material",0),_("onCancel",function(){return n.close()})("onClose",function(){return n.close()})("onOk",function(){return n.ok()}),a(1,"content")(2,"div",1)(3,"div",2)(4,"div")(5,"a",3),_("click",function(){return n.onTabChange("Note")}),m(6," Note "),r(),a(7,"a",4),_("click",function(){return n.onTabChange("Tag")}),m(8," Tag "),r(),a(9,"a",5),_("click",function(){return n.onTabChange("Number")}),m(10," Number "),r(),a(11,"a",6),_("click",function(){return n.onTabChange("Other")}),m(12," Other "),r()()(),a(13,"div",7),D(14,Xo,3,1,"ng-container",8)(15,Zo,4,1,"ng-container",8)(16,ea,3,1,"ng-container",8)(17,na,13,11,"ng-container",8),r()()()()),e&2&&(c("config",n.config),l(5),c("ngClass",ae(9,Tt,n.tabState=="Note")),l(2),c("ngClass",ae(11,Tt,n.tabState=="Tag")),l(2),c("ngClass",ae(13,Tt,n.tabState=="Number")),l(2),c("ngClass",ae(15,Tt,n.tabState=="Other")),l(3),c("ngIf",n.tabState=="Tag"),l(),c("ngIf",n.tabState=="Number"),l(),c("ngIf",n.tabState=="Note"),l(),c("ngIf",n.tabState=="Other"))},dependencies:[F,it,He,pe,Oe,he,ei,le,Pe,vt,_t,Gt,Jt,ot,at,Ne,Ee],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}content[_ngcontent-%COMP%] > div.container-fluid[_ngcontent-%COMP%]{min-height:200px}.tinymce[_ngcontent-%COMP%] a[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{z-index:2;position:absolute;right:15px;bottom:19px}.tinymce[_ngcontent-%COMP%] editor[_ngcontent-%COMP%]{height:max-content;z-index:1}.rad-btn[_ngcontent-%COMP%]{position:relative;display:inline-block}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #dddddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label.selected[_ngcontent-%COMP%]{background:#dcdcdc;border:1px solid #dcdcdc}.btn-link[_ngcontent-%COMP%]{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.selected[_ngcontent-%COMP%]{color:#3b3b3b;border-bottom:4px solid #07a519}a.btn.btn-link[_ngcontent-%COMP%]{color:inherit}"]})};var un=class i{constructor(t){this.matDialog=t}supplierPOTypes;predefinedNotes;defaultCurrencyID;currencies;note;disabled=!1;onChange=t=>{};onTouched=()=>{};writeValue(t){this.note=t}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}openModalNote(){this.matDialog.open(dn,{data:{note:this.note.Note,tagID:this.note.TagID,exchangeRate:this.note.Currency.ExchangeRate,currencyID:this.note.Currency.ID,supplierPOTypes:this.supplierPOTypes,predefinedNotes:this.predefinedNotes,currencies:this.currencies,defaultCurrencyID:this.defaultCurrencyID,invoiceNumber:this.note.InvoiceNumber}}).afterClosed().pipe(V(t=>!!t)).subscribe(t=>{this.note=t,this.onChange(t)})}static \u0275fac=function(e){return new(e||i)(f(ne))};static \u0275cmp=N({type:i,selectors:[["POS-note-form"]],inputs:{supplierPOTypes:"supplierPOTypes",predefinedNotes:"predefinedNotes",defaultCurrencyID:"defaultCurrencyID",currencies:"currencies"},features:[ke([{provide:Ge,multi:!0,useExisting:i}])],decls:2,vars:0,consts:[["type","button",1,"btn","btn-gray","w-100","h-100","fs-3","px-0","py-6","headings-font-family",3,"click"],[1,"fa-regular","fa-note-sticky","fa-xl"]],template:function(e,n){e&1&&(a(0,"button",0),_("click",function(){return n.openModalNote()}),I(1,"i",1),r())},dependencies:[F],styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}"]})};function ia(i,t){if(i&1){let e=B();Q(0),a(1,"div",12)(2,"div",13)(3,"h5"),m(4,"Add inventory to outlet"),r()(),a(5,"div",14)(6,"ng-select",15),J("ngModelChange",function(o){x(e);let s=d();return L(s.deliveryEntityID,o)||(s.deliveryEntityID=o),S(o)}),r()()(),U()}if(i&2){let e=d();l(6),c("clearable",!1),H("ngModel",e.deliveryEntityID),c("items",e.outlets)("disabled",e.isEdit)}}function oa(i,t){i&1&&(a(0,"div",16)(1,"div",17)(2,"h5",18),m(3," Unfulfilled order, product inventory is awaiting "),r()()())}var fn=class i{constructor(t,e,n){this.dialogRef=t;this.datePipe=e;this.data=n;this.config=new we,this.config.title="Purchase Order Fulfillment",this.config.customWidth="650px",this.isEdit=n.isEdit,this.deliveryEntityID=P.IsNotEmpty(n.deliveryEntityID)?n.deliveryEntityID:n.outletID,this.outlets=n.outlets,this.fulfillmentDate=n.fulfillmentDate,this.appConfigJSON=n.appConfigJSON,P.IsNotEmpty(n.deliveryEntityID)?this.tabState="Now":this.tabState="Later"}isEdit=!1;outlets;deliveryEntityID;tabState="Now";config;fulfillmentDate;fulfillmentTime;fulfillmentDateTime;shippingDateLabel="Fulfillment Date";appConfigJSON;ok(){this.tabState=="Later"&&this.setCustomDateField(),this.dialogRef.close(this.deliveryEntityID)}close(){this.dialogRef.close()}setCustomDateField(){this.fulfillmentDate=this.fulfillmentDate?this.fulfillmentDate:new Date;let t=this.fulfillmentTime?this.datePipe.transform(this.fulfillmentTime,"HH:mm"):"00:00",e=this.datePipe.transform(this.fulfillmentDate,"d MMM y");this.fulfillmentDateTime=`${e} ${t}`}onChangeTab(t){t=="Now"?(this.fulfillmentDate=null,this.deliveryEntityID=P.IsNotEmpty(this.data.deliveryEntityID)?this.data.deliveryEntityID:this.data.outletID):(this.deliveryEntityID=P.GuidEmpty,this.fulfillmentDate=new Date)}static \u0275fac=function(e){return new(e||i)(f(Te),f(Jn),f(Re))};static \u0275cmp=N({type:i,selectors:[["POS-modal-fulfillment"]],decls:21,vars:4,consts:[["LATER",""],[3,"onOk","onCancel","onClose","config"],[1,"container"],[1,"row","align-items-start","py-2","my-2"],[1,"col"],["name","fontStyle","aria-label","Font Style",1,"fulfillment-tab",3,"ngModelChange","change","ngModel"],["data-cy","Now","value","Now"],[1,"p-7","me-2"],[1,"text-body-secondary","tabDesc"],["data-cy","Later","value","Later"],[1,"p-7"],[4,"ngIf","ngIfElse"],[1,"row","align-items-center","mt-5"],[1,"col-auto"],[1,"col","d-flex","justify-content-end"],["appendTo","body","bindLabel","Name","bindValue","ID","placeholder","Outlet","data-cy","DeductInventory",1,"tall","auto-grow",2,"width","250px",3,"ngModelChange","clearable","ngModel","items","disabled"],[1,"row","mt-8"],[1,"col-12","pe-0"],[1,"bg-gradient-warning","text-center","py-7","rounded-3","border","mb-7"]],template:function(e,n){if(e&1){let o=B();a(0,"modal-material",1),_("onOk",function(){return x(o),S(n.ok())})("onCancel",function(){return x(o),S(n.close())})("onClose",function(){return x(o),S(n.close())}),a(1,"content")(2,"div",2)(3,"div",3)(4,"div",4)(5,"mat-button-toggle-group",5),J("ngModelChange",function(O){return x(o),L(n.tabState,O)||(n.tabState=O),S(O)}),_("change",function(O){return x(o),S(n.onChangeTab(O.value))}),a(6,"mat-button-toggle",6)(7,"h3",7),m(8," Now "),a(9,"small",8)(10,"em"),m(11,"(in store purchase)"),r()()()(),a(12,"mat-button-toggle",9)(13,"h3",10),m(14," Later "),a(15,"small",8)(16,"em"),m(17,"(shipped to customer address)"),r()()()()()()(),D(18,ia,7,4,"ng-container",11)(19,oa,4,0,"ng-template",null,0,be),r()()()}if(e&2){let o=ue(20);c("config",n.config),l(5),H("ngModel",n.tabState),l(13),c("ngIf",n.tabState=="Now")("ngIfElse",o)}},dependencies:[F,pe,Ne,Ee,_t,si,ri,li,Oe,le,Pe,Ut,_i],styles:[".container[_ngcontent-%COMP%]{min-height:150px} .p-datepicker.p-component.p-datepicker-timeonly{z-index:99999!important}.tabDesc[_ngcontent-%COMP%]{font-size:80%;font-weight:400} mat-button-toggle-group.fulfillment-tab mat-pseudo-checkbox{display:none}"]})};var gn=class i{constructor(t){this.matDialog=t}outlets;outletID;appConfigJSON;isEdit;deliveryEntityID;disabled=!1;onChange=t=>{};onTouched=()=>{};writeValue(t){this.deliveryEntityID=t}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}openModalFulfillment(){this.matDialog.open(fn,{data:{deliveryEntityID:this.deliveryEntityID,outlets:this.outlets,outletID:this.outletID,appConfigJSON:this.appConfigJSON,isEdit:this.isEdit}}).afterClosed().pipe(V(t=>!!t)).subscribe(t=>{this.deliveryEntityID=t,this.onChange(t)})}isDeliveryEntityIDEmpty(){return P.IsEmpty(this.deliveryEntityID)&&P.IsNotEmpty(this.outletID)}static \u0275fac=function(e){return new(e||i)(f(ne))};static \u0275cmp=N({type:i,selectors:[["POS-fulfillment-form"]],inputs:{outlets:"outlets",outletID:"outletID",appConfigJSON:"appConfigJSON",isEdit:"isEdit"},features:[ke([{provide:Ge,multi:!0,useExisting:i}])],decls:4,vars:2,consts:[["type","button",1,"btn","btn-gray","w-100","h-100","fs-3","px-0","py-6","headings-font-family",3,"click"],[1,"fa-solid","fa-dolly","me-3"]],template:function(e,n){e&1&&(a(0,"button",0),_("click",function(){return n.openModalFulfillment()}),I(1,"i",1),a(2,"span"),m(3,"Fulfillment"),r()()),e&2&&yt("bg-gradient-warning",n.isDeliveryEntityIDEmpty())},dependencies:[F],styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}"]})};var Gi=i=>({selected:i}),aa=i=>({active:i});function ra(i,t){if(i&1){let e=B();a(0,"a",5),_("click",function(){x(e);let o=d();return S(o.isPayNow=!1)}),m(1," Later "),a(2,"span",9),m(3,"Take Credit"),r()()}if(i&2){let e=d();c("ngClass",ae(1,Gi,!e.isPayNow))}}function la(i,t){if(i&1){let e=B();a(0,"div",22)(1,"a",23),_("click",function(){let o=x(e).$implicit,s=d(4);return S(s.inputAmount=o)}),m(2),g(3,"number"),r()()}if(i&2){let e=t.$implicit,n=d(4);l(),c("ngClass",ae(5,aa,n.paymentMethodID==n.cashPaymentID&&n.inputAmount==e)),l(),We("",n.currencySymbol," ",y(3,3,e),"")}}function sa(i,t){if(i&1&&(a(0,"div",20),D(1,la,4,7,"div",21),r()),i&2){let e=d(3);l(),c("ngForOf",e.suggestedCash)}}function ca(i,t){if(i&1&&(a(0,"div",26),m(1),g(2,"number"),r()),i&2){let e=d(4);c("ngClass",e.inputAmount>e.amountToPay?"success":"danger"),l(),We(" ",e.currencySymbol," ",y(2,3,e.inputAmount-e.amountToPay)," ")}}function pa(i,t){if(i&1){let e=B();Q(0),a(1,"input",24),J("ngModelChange",function(o){x(e);let s=d(3);return L(s.inputAmount,o)||(s.inputAmount=o),S(o)}),_("click",function(){x(e);let o=d(3);return o.paymentMethodID=o.cashPaymentID,o.paymentMethodState="Cash",S(o.paymentMethodName="Cash")}),r(),D(2,ca,3,5,"div",25),U()}if(i&2){let e=d(3);l(),H("ngModel",e.inputAmount),l(),c("ngIf",e.inputAmount!=e.amountToPay)}}function ma(i,t){if(i&1){let e=B();a(0,"div",27),_("click",function(){x(e);let o=d(3);return o.paymentMethodID=o.cashPaymentID,S(o.paymentMethodState="Cash")}),I(1,"input",28),r()}if(i&2){let e=d(3);l(),c("value",e.currencySymbol+" -")}}function da(i,t){if(i&1&&(a(0,"div",12)(1,"div",13),I(2,"i",14),m(3," Cash "),r(),a(4,"div",15)(5,"div",16),D(6,sa,2,1,"div",17),a(7,"div",18),D(8,pa,3,2,"ng-container",19)(9,ma,2,1,"ng-template",null,0,be),r()()()()),i&2){let e=ue(10),n=d(2);l(6),c("ngIf",n.role.product.Cost),l(2),c("ngIf",n.role.product.Cost)("ngIfElse",e)}}function ua(i,t){if(i&1){let e=B();a(0,"div",32)(1,"a",33),_("click",function(){let o=x(e).$implicit,s=d(3);return S(s.onSelectPaymentMethod(o.ID,"Card",o.Name))}),a(2,"span",34),I(3,"img",35),r(),a(4,"span",34),m(5),g(6,"limitText"),r()()()}if(i&2){let e=t.$implicit,n=d(3);l(),c("ngClass",n.paymentMethodID===e.ID?"active":""),l(),c("hidden",e.ImageUrl==null),l(),c("src",e.ImageUrl,nt),l(),c("hidden",e.ImageUrl!=null),l(),j(" ",Sn(6,5,e.Name,20)," ")}}function fa(i,t){if(i&1){let e=B();a(0,"div",36)(1,"div",37)(2,"input",38),J("ngModelChange",function(o){x(e);let s=d(3);return L(s.paymentNote,o)||(s.paymentNote=o),S(o)}),r(),a(3,"input",39),J("ngModelChange",function(o){x(e);let s=d(3);return L(s.paymentCode,o)||(s.paymentCode=o),S(o)}),r()()()}if(i&2){let e=d(3);l(2),H("ngModel",e.paymentNote),l(),H("ngModel",e.paymentCode)}}function ga(i,t){if(i&1&&(a(0,"div",12)(1,"div",13),I(2,"i",29),m(3," Card "),r(),a(4,"div",15)(5,"div",16),D(6,ua,7,8,"div",30),r(),D(7,fa,4,2,"div",31),r()()),i&2){let e=d(2);l(6),c("ngForOf",e.cardPayments),l(),c("ngIf",e.paymentMethodState=="Card")}}function ya(i,t){if(i&1){let e=B();a(0,"div",32)(1,"a",33),_("click",function(){let o=x(e).$implicit,s=d(3);return S(s.onSelectPaymentMethod(o.ID,"Other",o.Name))}),m(2),g(3,"limitText"),r()()}if(i&2){let e=t.$implicit,n=d(3);l(),c("ngClass",n.paymentMethodID===e.ID?"active":""),l(),j(" ",Sn(3,2,e.Name,20)," ")}}function ba(i,t){if(i&1){let e=B();a(0,"div",36)(1,"div",37)(2,"input",38),J("ngModelChange",function(o){x(e);let s=d(3);return L(s.paymentNote,o)||(s.paymentNote=o),S(o)}),r(),a(3,"input",39),J("ngModelChange",function(o){x(e);let s=d(3);return L(s.paymentCode,o)||(s.paymentCode=o),S(o)}),r()()()}if(i&2){let e=d(3);l(2),H("ngModel",e.paymentNote),l(),H("ngModel",e.paymentCode)}}function Ca(i,t){if(i&1&&(a(0,"div",40)(1,"div",13),m(2,"Others"),r(),a(3,"div",15)(4,"div",16),D(5,ya,4,5,"div",30),r(),D(6,ba,4,2,"div",31),r()()),i&2){let e=d(2);l(5),c("ngForOf",e.otherPayments),l(),c("ngIf",e.paymentMethodState=="Other")}}function va(i,t){if(i&1&&(a(0,"div"),D(1,da,11,3,"div",10)(2,ga,8,2,"div",10)(3,Ca,7,2,"div",11),r()),i&2){let e=d();l(),c("ngIf",e.isCashSuspended),l(),c("ngIf",e.cardPayments.length>0),l(),c("ngIf",e.otherPayments.length>0)}}function _a(i,t){if(i&1){let e=B();a(0,"div",41)(1,"div",42)(2,"h5",43),m(3,"Due"),r(),a(4,"datepicker",44),J("dateChange",function(o){x(e);let s=d();return L(s.dueDate,o)||(s.dueDate=o),S(o)}),_("dateChange",function(){x(e);let o=d();return S(o.onChangeDueDate())}),r()(),a(5,"div",45)(6,"h5",43),m(7,"Days Due"),r(),a(8,"div",15)(9,"input",46),J("ngModelChange",function(o){x(e);let s=d();return L(s.dueDays,o)||(s.dueDays=o),S(o)}),_("ngModelChange",function(){x(e);let o=d();return S(o.onChangeDueDay())}),r()()()()}if(i&2){let e=d();l(4),c("displayToggle",!1),H("date",e.dueDate),l(5),H("ngModel",e.dueDays)}}var yn=class i{constructor(t,e,n){this.dialogRef=t;this.role=n;this.isDefaultTabPayLater=e.payDefaultState==!1,this.config=new we,this.config.title="Amount to Pay:",this.config.customWidth="650px",this.amountToPay=e.displayedAmountToPay,this.inputAmount=this.amountToPay,this.currencySymbol=e.currencySymbol,this.dueDate=e.dueDate,this.invoiceDate=e.invoiceDate,this.cashPaymentID=e.cashPaymentMethodID,this.cardPayments=e.cardPayments,this.otherPayments=e.otherPayments,this.paymentMethodID=e.paymentMethodID;let o=this.cardPayments.find(O=>O.ID==this.paymentMethodID);P.IsNotEmpty(o)&&(this.paymentMethodState="Card",this.paymentMethodName=o.Name);let s=this.otherPayments.find(O=>O.ID==this.paymentMethodID);P.IsNotEmpty(s)&&(this.paymentMethodState="Other",this.paymentMethodName=s.Name),this.paymentNote=e.paymentNote,this.paymentCode=e.paymentCode,this.isPayNow=e.payDefaultState,e.isEdit&&(this.isPayNow=!e.isUnpaidOnEdit),this.onChangeDueDate(),this.dueDays=e.dueDays,this.isCashSuspended=e.isCashSuspended,this.denomination=e.denomination,this.suggestedCash[0]=this.inputAmount,this.denomination.filter(O=>O>this.inputAmount).forEach(O=>{this.suggestedCash.length<3&&this.suggestedCash.push(O)}),console.log(this.suggestedCash)}config;isPayNow=!0;paymentMethodName="Cash";amountToPay=0;inputAmount=0;currencySymbol="";dueDate;dueDays;invoiceDate;cardPayments;otherPayments;cashPaymentID;paymentMethodID;paymentMethodState="Cash";paymentNote;paymentCode;displayedAmountToPay;denomination;suggestedCash=[];isCashSuspended;isDefaultTabPayLater=!1;ok(){let t={paymentMethodName:this.paymentMethodName};this.isPayNow?(t.amount=this.inputAmount,t.paymentMethodID=this.paymentMethodID,t.paymentNote=this.paymentNote,t.paymentCode=this.paymentCode,t.payState="Now"):(t.dueDate=this.dueDate,t.payState="Later"),this.dialogRef.close(t)}close(){this.dialogRef.close()}onSelectPaymentMethod(t,e,n){this.paymentMethodName=n,this.paymentMethodID==t?(this.paymentMethodID=this.cashPaymentID,this.paymentMethodState="Cash"):(this.paymentMethodID=t,this.paymentMethodState=e)}onChangeDueDay(){let t=new Date(P.cloneObject(this.invoiceDate));t.setDate(t.getDate()+this.dueDays),t.setHours(0,0,0,0),this.dueDate=t}onChangeDueDate(){this.dueDays=P.differentInDays(typeof this.invoiceDate=="string"?new Date(this.invoiceDate):this.invoiceDate,typeof this.dueDate=="string"?new Date(this.dueDate):this.dueDate)+1}static \u0275fac=function(e){return new(e||i)(f(Te),f(Re),f(De))};static \u0275cmp=N({type:i,selectors:[["POS-modal-pay"]],decls:14,vars:10,consts:[["HIDDENCOST",""],[3,"onOk","onCancel","onClose","config"],[1,"mt-1","ms-2"],[1,"container","w-100","h-100"],[1,"row","border-bottom"],[1,"btn","btn-link",3,"click","ngClass"],[1,"btn","btn-link",3,"ngClass"],[4,"ngIf"],["class","py-4",4,"ngIf"],[1,"fst-italic",2,"font-size","10px"],["class","row border-bottom py-5",4,"ngIf"],["class","row py-5",4,"ngIf"],[1,"row","border-bottom","py-5"],[1,"col-3","h5","pt-5"],[1,"fa-solid","fa-money-bill-wave"],[1,"col-9"],[1,"row"],["class","row mb-5",4,"ngIf"],[1,"col","pe-0","me-10","position-relative"],[4,"ngIf","ngIfElse"],[1,"row","mb-5"],["class","col-4 pe-0 ps-4",4,"ngFor","ngForOf"],[1,"col-4","pe-0","ps-4"],[1,"btn","btn-outline-info","px-1","py-6","w-100",3,"click","ngClass"],["id","cashInput","type","text","placeholder","Custom Cash Amount","autoNum","",1,"form-control","form-control-lg","py-3","mb-3","px-6",3,"ngModelChange","click","ngModel"],["class","change",3,"ngClass",4,"ngIf"],[1,"change",3,"ngClass"],[3,"click"],["id","cashInput","type","text","placeholder","Custom Cash Amount","disabled","",1,"form-control","form-control-lg","py-3","mb-3","px-6",3,"value"],[1,"fa-regular","fa-credit-card"],["class","col-auto pe-0",4,"ngFor","ngForOf"],["class","position-relative row",4,"ngIf"],[1,"col-auto","pe-0"],[1,"btn","btn-outline-info","mb-3","px-6",3,"click","ngClass"],[3,"hidden"],[2,"width","40px",3,"src"],[1,"position-relative","row"],[1,"paymentNote","col","row","g-0","pt-2","ms-6"],["type","text","placeholder","Payment Note",1,"form-control","w-50","border-end-0","py-6","col-6",3,"ngModelChange","ngModel"],["type","text","placeholder","Payment Code",1,"form-control","w-50","border-start-0","py-6","paymentCode","col-6",3,"ngModelChange","ngModel"],[1,"row","py-5"],[1,"py-4"],[1,"row","d-flex","align-items-center","g-0","later-payment"],[1,"col-3","fw-normal"],["appearance","fill","readOnly","true","name","orderDate",1,"col-9",3,"dateChange","displayToggle","date"],[1,"row","d-flex","align-items-center","g-0","later-payment","mt-10"],["type","text","autofocus","","autoNum","",1,"py-8","ps-8","form-control",3,"ngModelChange","ngModel"]],template:function(e,n){e&1&&(a(0,"modal-material",1),_("onOk",function(){return n.ok()})("onCancel",function(){return n.close()})("onClose",function(){return n.close()}),a(1,"header")(2,"div",2),m(3),g(4,"number"),r()(),a(5,"content")(6,"div",3)(7,"div",4)(8,"div")(9,"a",5),_("click",function(){return n.isPayNow=!0}),m(10," Now "),r(),D(11,ra,4,3,"a",6),r()()(),D(12,va,4,3,"div",7)(13,_a,10,3,"div",8),r()()),e&2&&(c("config",n.config),l(3),j(" ",n.currencySymbol+" "+y(4,6,n.amountToPay)," "),l(6),c("ngClass",ae(8,Gi,n.isPayNow)),l(2),mt(n.amountToPay!=0||n.isDefaultTabPayLater?11:-1),l(),c("ngIf",n.isPayNow),l(),c("ngIf",!n.isPayNow))},dependencies:[F,it,He,pe,Me,Oe,he,le,Pe,Ut,vi,Ne,Ee,oi,ot,at],styles:['.text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.change[_ngcontent-%COMP%]{position:absolute;top:0;height:40px;background:#89b03e;color:#fff;right:0;padding:0 10px;line-height:40px;font-size:16px}.change[_ngcontent-%COMP%]:before{content:"\\a";border-style:solid;border-width:40px 24px 0 0;border-color:transparent #89b03e transparent transparent;position:absolute;left:-24px}.change.danger[_ngcontent-%COMP%]{background:#c9302c}.change.danger[_ngcontent-%COMP%]:before{border-color:transparent #c9302c transparent transparent}.paymentNote[_ngcontent-%COMP%]:before{z-index:10;content:"";position:absolute;top:4px;left:calc(50% - 10px);height:90%;width:10px;background-color:inherit;border-right:1px solid lightgray;-webkit-transform:skewX(-10deg);-moz-transform:skewX(-10deg);-ms-transform:skewX(-10deg);transform:skew(-10deg)}.btn-link[_ngcontent-%COMP%]{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.selected[_ngcontent-%COMP%]{color:#3b3b3b;border-bottom:4px solid #07a519} .later-payment.date-picker .mat-mdc-form-field{font-size:4px}.ng-select.ng-select-width[_ngcontent-%COMP%] .ng-select-container{width:160px;max-width:160px}input[type=text][_ngcontent-%COMP%]:disabled{background:#dadada}.later-payment[_ngcontent-%COMP%] strong{font-size:20px}.later-payment[_ngcontent-%COMP%] input{font-size:20px}.later-payment[_ngcontent-%COMP%] .mat-mdc-form-field{width:100%;font-size:20px;border:1px solid #c8d3df}.later-payment[_ngcontent-%COMP%] .mat-mdc-form-field .mat-mdc-icon-button, .later-payment[_ngcontent-%COMP%] .mat-mdc-form-field .mat-mdc-button-persistent-ripple, .later-payment[_ngcontent-%COMP%] .mat-mdc-form-field .mat-mdc-form-field-icon-suffix{outline:none!important}']})};var Ye=class i{constructor(t,e,n){this.form=e;this.decimalPipe=n;let o=e.discountAndTaxForm.valueChanges;this.currency$=e.noteForm.valueChanges.pipe(u(v=>v.Currency),te(1),ee()),this.currencySymbol$=this.currency$.pipe(u(v=>v.Symbol),ee());let s=t.cart$.pipe(E(console.log),u(v=>v.map($=>$.Total)),u(v=>v.reduce(($,K)=>$+K,0)),u(v=>this.setDecimalDigit(v)),te(1),ee()),O=t.cart$.pipe(u(v=>v.filter($=>$.Taxable).map($=>$.Total)),u(v=>v.reduce(($,K)=>$+K,0)),u(v=>this.setDecimalDigit(v)),te(1),ee());this.displayedAmount$=s,this.displayedDiscountPercentage$=Ie(this.displayedAmount$,o.pipe(u(v=>v.Discount.Percentage))).pipe(u(([v,$])=>({label:`Discount ${$}%`,value:v*($/100)})),ct({label:"",value:0}),te(1),ee()),this.displayedDiscountAmount$=Ie(this.currencySymbol$,o.pipe(u(v=>v.Discount.Amount))).pipe(u(([v,$])=>({label:`Discount ${v}`,value:$})),ct({label:"",value:0}),te(1),ee()),this.displayedTax$=Ie(O,this.displayedDiscountPercentage$.pipe(u(v=>v.value)),this.displayedDiscountAmount$.pipe(u(v=>v.value)),o.pipe(u(v=>v.Tax))).pipe(V(([,,,v])=>!!v.Label),u(([v,$,K,h])=>({amountAfterDiscount:v-$-K,tax:h})),u(v=>{let $=v.amountAfterDiscount,K=v.tax;return{label:K.Label,tax:{id:K.ID,value:K.CalculationTypeName=="Add"?$*(K.Rate/100):K.Rate/(100+K.Rate)*$,type:K.CalculationTypeName,rate:K.Rate}}}),E(v=>e.setTaxAmount(v.tax.value)),ct({label:"",tax:{id:"",value:0,type:"",rate:0}}),te(1),ee()),this.amountAfterDiscountAndTax$=Ie(this.displayedAmount$,this.displayedDiscountPercentage$.pipe(u(v=>v.value)),this.displayedDiscountAmount$.pipe(u(v=>v.value)),this.displayedTax$.pipe(u(v=>v.tax)),t.cart$.pipe(u(v=>v.length))).pipe(u(([v,$,K,h,A])=>A?v-$-K+(h.type=="Add"?h.value:0):0),ee()).pipe(te(1)),this.amountAfterDiscountAndTax$.subscribe()}paymentMethodName=pt("Cash");displayedAmount$;displayedDiscountPercentage$;displayedDiscountAmount$;displayedTax$;currency$;currencySymbol$;amountAfterDiscountAndTax$;get amountToPay(){return this.form.buyForm.controls.Payment.controls.Amount.value}get methodID(){return this.form.buyForm.controls.Payment.controls.MethodID.value}get code(){return this.form.buyForm.controls.Payment.controls.Code.value}get note(){return this.form.buyForm.controls.Payment.controls.Note.value}setDecimalDigit(t){let e=this.decimalPipe.transform(t,"1.0-4");return t=parseFloat(e.split(",").join("")),t}static \u0275fac=function(e){return new(e||i)(W(ie),W(q),W(Me))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};function ha(i,t){if(i&1&&(a(0,"div"),m(1),g(2,"number"),r()),i&2){let e=d();l(),j(" ",y(2,1,e.amountToPayRounded)," ")}}function Da(i,t){i&1&&m(0," - ")}var bn=class i{constructor(t,e,n,o,s,O,v,$,K,h,A){this.matDialog=t;this.toastr=e;this.form=n;this.cart=o;this.http=s;this.complete=O;this.role=v;this.load=$;this.posMath=K;this.math=h;this.paymentService=A}cartLength;amountToPay;currencySymbol;dueDate;cashPayments;cardPayments;otherPayments;paymentMethodID;paymentNote;paymentCode;defaultDueDays;invoiceDate;dueDays;appConfigJSON;isUnpaidOnEdit;isEditBuyForm;totalVariantOrdered;isCashSuspended;denomination;pay(){if(this.cartLength==0){this.toastr.info("You must have at least one item",xe.Info);return}if(this.form.discountAndTaxForm.value.Tax.Discontinue){this.toastr.info(`Cannot find the ${this.form.discountAndTaxForm.value.Tax.Label}, Set the tax discontinue status to \u201CNo\u201D to use tax or choose another tax type`,xe.Info);return}let t=P.IsEmpty(this.form.buyForm.controls.Order.controls.SupplierID.value);if(this.appConfigJSON.ModuleBuy.Header.SupplierRequired&&t){this.toastr.info("Supplier is required",xe.Info);return}this.matDialog.open(yn,{data:{displayedAmountToPay:this.posMath.Round(this.amountToPay,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.RoundAlgorithm),amountToPay:this.posMath.Round(this.form.buyForm.controls.Payment.controls.Amount.value,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.RoundAlgorithm),currencySymbol:this.currencySymbol,dueDate:P.cloneObject(this.dueDate),dueDays:P.cloneObject(this.dueDays),cardPayments:this.cardPayments,otherPayments:this.otherPayments,cashPaymentMethodID:this.cashPayments[0]?.ID,paymentMethodID:this.paymentMethodID,paymentNote:this.paymentNote,paymentCode:this.paymentCode,invoiceDate:this.invoiceDate,payDefaultState:this.appConfigJSON.ModuleBuy.PaymentDialog.DefaultOption!=1,isUnpaidOnEdit:this.isUnpaidOnEdit,isEdit:this.isEditBuyForm,isCashSuspended:this.isCashSuspended,denomination:this.denomination}}).afterClosed().pipe(V(s=>!!s),u(s=>s)).pipe(E(s=>this.paymentService.paymentMethodName.set(s.paymentMethodName)),de(this.cart.cart$),u(([s,O])=>R(T({},s),{cart:O})),de(this.load.entities$),u(([s,O])=>R(T({},s),{entities:O})),de(this.load.supplierPOTypes$),u(([s,O])=>R(T({},s),{supplierPOTypes:O})),Z(s=>{P.IsEmpty(this.form.noteForm.value.TagID)&&this.form.setBulkNoteForm(R(T({},this.form.noteForm.value),{TagID:s.supplierPOTypes[0]?.ID}));let O=this.form.buyForm.controls,v=O.Invoice.controls,$=O.Payment.controls,K=this.form.outlet.value,h=O.Order.controls,A=this.form.noteForm.value,p=this.form.discountAndTaxForm.value,M=$.Amount.value,G=this.form.deliveryEntityID.value,Y={ID:v.ID.value,Due:s.payState=="Now"?void 0:v.Due.value,Tax:v.Tax.value,Sales:M??0,PaymentStateID:s.payState=="Now"?3:1,Number:A.InvoiceNumber?A.InvoiceNumber:h.Number.value},b=s.cart.map(w=>R(T({},w),{VariantID:P.IsEmpty(w.VariantID)?w.ID:w.VariantID}));this.isEditBuyForm&&(b=b.map(w=>R(T({},w),{QtyRequested:w.Quantity})));let C={EntityID:K.ID,SupplierID:h.SupplierID.value,Date:h.Date.value,CurrencyID:A.Currency.ID,CurrencyRate:A.Currency.ExchangeRate,Discount:p.Discount.Percentage,DiscountAmount:p.Discount.Amount,Note:A.Note,Att:h.Att.value,TaxTypeID:p.Tax.ID,TypeID:A.TagID,Number:h.Number.value,ID:h.ID.value};if(s.payState=="Now"){let w={ID:$.ID?.value??P.GuidEmpty,MethodID:s.paymentMethodID,Code:s.paymentCode??"",Note:s.paymentNote??"",Amount:this.posMath.Round(s.amount,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.RoundAlgorithm),Date:C.Date,ImageUrl:$.ImageUrl?.value};s.amount<M?Y.PaymentStateID=2:s.amount>M&&(Y.PaymentStateID=5);let k={DeliveryEntityID:G,NewOrderID:this.isEditBuyForm?null:P.Guid_NewGuid(),Invoice:Y,Order:C,Items:b,Payment:w};return this.http.post("/API/Buy/SubmitOrder2",k,1e4,!0).pipe(u(Ce=>R(T({},Ce),{differentNumber:Ce.InvoiceNumber!=C.Number})),_e(Ce=>{throw Ce.error&&this.toastr.error(Ce.error.Message,"Order Submission Failed"),new Error(Ce)}))}else{let w={DeliveryEntityID:G,NewOrderID:this.isEditBuyForm?null:P.Guid_NewGuid(),Invoice:R(T({},Y),{Due:s.dueDate}),Order:C,Items:b};return this.http.post("/API/Buy/SubmitOrder2",w,1e4,!0).pipe(u(k=>R(T({},k),{differentNumber:k.InvoiceNumber!=C.Number})),_e(k=>{throw k.error&&this.toastr.error(k.error.Message,"Order Submission Failed"),new Error(k)}))}})).subscribe(s=>{this.complete.paymentComplete(s),s.differentNumber&&this.toastr.info(`Bill number has been changed to ${s.InvoiceNumber}`,"Bill Number Changed!")})}get amountToPayRounded(){return this.posMath.Round(this.amountToPay,this.appConfigJSON?.ApplicationMath?.RoundingPurchaseDigit?.DecimalPlaceValue,this.appConfigJSON?.ApplicationMath?.RoundingPurchaseDigit.RoundAlgorithm)}static \u0275fac=function(e){return new(e||i)(f(ne),f(Je),f(q),f(ie),f(se),f(Le),f(De),f(ge),f(In),f(In),f(Ye))};static \u0275cmp=N({type:i,selectors:[["POS-pay-button"]],inputs:{cartLength:"cartLength",amountToPay:"amountToPay",currencySymbol:"currencySymbol",dueDate:"dueDate",cashPayments:"cashPayments",cardPayments:"cardPayments",otherPayments:"otherPayments",paymentMethodID:"paymentMethodID",paymentNote:"paymentNote",paymentCode:"paymentCode",defaultDueDays:"defaultDueDays",invoiceDate:"invoiceDate",dueDays:"dueDays",appConfigJSON:"appConfigJSON",isUnpaidOnEdit:"isUnpaidOnEdit",isEditBuyForm:"isEditBuyForm",totalVariantOrdered:"totalVariantOrdered",isCashSuspended:"isCashSuspended",denomination:"denomination"},decls:12,vars:8,consts:[["HIDDENCOST",""],["type","button",1,"btn","btn-success","fs-1","py-4",2,"border-left","0.1px solid #fff",3,"click"],[1,"d-flex","align-items-center","justify-content-between"],[1,"fs-6"],[4,"ngIf","ngIfElse"]],template:function(e,n){if(e&1){let o=B();a(0,"button",1),_("click",function(){return x(o),S(n.pay())}),a(1,"div",2)(2,"div")(3,"span"),m(4,"Pay"),r(),a(5,"small",3),m(6),g(7,"number"),g(8,"quantityFraction"),r()(),D(9,ha,3,3,"div",4)(10,Da,1,0,"ng-template",null,0,be),r()()}if(e&2){let o=ue(11);l(6),We(" (",y(7,4,n.cartLength)," Items & ",y(8,6,n.totalVariantOrdered)," Qty) "),l(3),c("ngIf",n.role.product.Cost)("ngIfElse",o)}},dependencies:[F,pe,Me,Qt],styles:["button[_ngcontent-%COMP%]{border-right:.1px solid #fff;margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0;position:relative;flex:1 1 auto}"]})};var xt=class i{noteForm;constructor(t){this.noteForm=t.noteForm}static \u0275fac=function(e){return new(e||i)(W(q))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};var St=class i{deliveryEntityID;constructor(t){this.deliveryEntityID=t.deliveryEntityID}static \u0275fac=function(e){return new(e||i)(W(q))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};var It=class i{dueDate$;dueDays$;constructor(t){let e=t.buyForm.controls.Invoice.controls.Due.valueChanges;this.dueDays$=t.dueDays.valueChanges,t.buyForm.controls.Order.controls.Date.valueChanges.pipe(E(console.log),de(this.dueDays$),E(([s,O])=>t.setDueDateBasedOnDaysDue(O)),E(console.log)).subscribe(),this.dueDate$=e,this.dueDate$.subscribe(s=>console.log(s,"dueDate$"))}static \u0275fac=function(e){return new(e||i)(W(q))};static \u0275prov=oe({token:i,factory:i.\u0275fac,providedIn:"root"})};function Ma(i,t){if(i&1&&(a(0,"tr")(1,"th",13),m(2,"Amount"),r(),a(3,"td",14),m(4),g(5,"number"),r()()),i&2){let e=d().ngIf;l(4),X(y(5,1,e.displayedAmount))}}function Pa(i,t){if(i&1&&(a(0,"td",16),m(1),g(2,"number"),r()),i&2){let e=d(3).ngIf;l(),j(" ",y(2,1,e.displayedDiscountPercentage.value*-1),"")}}function Oa(i,t){if(i&1&&(a(0,"tr")(1,"th",13),m(2),r(),D(3,Pa,3,3,"td",15),r()),i&2){let e=d(2).ngIf,n=d();l(2),X(e.displayedDiscountPercentage.label),l(),c("ngIf",n.role.product.Cost)}}function Ta(i,t){if(i&1&&(a(0,"td",16),m(1),g(2,"number"),r()),i&2){let e=d(3).ngIf;l(),X(y(2,1,e.displayedDiscountAmount.value*-1))}}function wa(i,t){if(i&1&&(a(0,"tr")(1,"th",13),m(2),r(),D(3,Ta,3,3,"td",15),r()),i&2){let e=d(2).ngIf,n=d();l(2),X(e.displayedDiscountAmount.label),l(),c("ngIf",n.role.product.Cost)}}function Ea(i,t){if(i&1&&(a(0,"td",14),m(1),g(2,"number"),r()),i&2){let e=d(3).ngIf;l(),X(y(2,1,e.displayedTax.tax.value))}}function Na(i,t){if(i&1&&(a(0,"tr")(1,"th",13),m(2),r(),D(3,Ea,3,3,"td",17),r()),i&2){let e=d(2).ngIf,n=d();l(2),X(e.displayedTax.label),l(),c("ngIf",n.role.product.Cost)}}function Fa(i,t){if(i&1&&(Q(0),D(1,Oa,4,2,"tr",12)(2,wa,4,2,"tr",12)(3,Na,4,2,"tr",12),U()),i&2){let e=d().ngIf;l(),c("ngIf",e.displayedDiscountPercentage.value!=0),l(),c("ngIf",e.displayedDiscountAmount.value!=0),l(),c("ngIf",e.displayedTax.tax.value!=0)}}function Aa(i,t){if(i&1&&(a(0,"div",9)(1,"div",10)(2,"table",11),D(3,Ma,6,3,"tr",12)(4,Fa,4,3,"ng-container",12),g(5,"async"),r()()()),i&2){let e=t.ngIf,n=d();l(3),c("ngIf",n.showAmountWhenDiscountOrTaxIsApplied(e)&&e.displayedAmount&&n.role.product.Cost),l(),c("ngIf",y(5,2,n.cartLength$))}}var Cn=class i{constructor(t,e,n,o,s,O,v,$,K,h){this.payment=t;this.form=o;this.role=$;this.taxes$=n.taxes$,this.defaultCurrencyID$=n.appConfigJSON$.pipe(u(Y=>Y.CoreDefaults.CurrencyID)),this.totalVariantOrdered$=e.totalVariantOrdered$,this.cartLength$=e.cart$.pipe(u(Y=>Y.length)),this.amountAfterDiscountAndTax$=t.amountAfterDiscountAndTax$,this.discountAndTaxForm=o.discountAndTaxForm;let A=t.displayedAmount$,p=t.displayedDiscountPercentage$,M=t.displayedDiscountAmount$,G=t.displayedTax$;this.displayedDiscountAndTax$=Ie({displayedAmount:A,displayedDiscountPercentage:p,displayedDiscountAmount:M,displayedTax:G}),this.deliveryEntityID=O.deliveryEntityID,this.noteForm=s.noteForm,this.currencies$=n.currencies$,this.currencySymbol$=t.currencySymbol$,this.supplierPOTypes$=n.supplierPOTypes$,this.predefinedNotes$=n.predefinedNotes$,this.outlets$=n.entities$,this.cashPayments$=h.cashPayments$,this.cardPayments$=h.cardPayments$,this.otherPayments$=h.otherPayments$,this.defaultDueDays$=n.defaultDueDays$,this.dueDate$=v.dueDate$,this.dueDays$=v.dueDays$,this.appConfigJSON$=n.appConfigJSON$,this.isUnpaidOnEdit$=Ie(K.isEdit$,K.isUnpaid$).pipe(u(([Y,b])=>Y&&b)),this.isEdit$=K.isEdit$,this.outlet=o.outlet,this.isCashSuspended$=h.isCashSuspended$,this.denomination$=n.denomination$}taxes$;totalVariantOrdered$;displayedDiscountAndTax$;discountAndTaxForm;deliveryEntityID;noteForm;amountAfterDiscountAndTax$;currencies$;currencySymbol$;supplierPOTypes$;predefinedNotes$;defaultCurrencyID$;outlets$;cashPayments$;cardPayments$;otherPayments$;defaultDueDays$;dueDate$;dueDays$;appConfigJSON$;isUnpaidOnEdit$;isEdit$;isCashSuspended$;outlet;cartLength$;denomination$;get amountToPay(){return this.payment.amountToPay}get invoiceDate(){return this.form.invoiceDate}get paymentMethodID(){return this.payment.methodID}get paymentNote(){return this.payment.note}get paymentCode(){return this.payment.code}showAmountWhenDiscountOrTaxIsApplied(t){return t.displayedDiscountPercentage.value!=0||t.displayedDiscountAmount.value!=0||t.displayedTax.tax.value!=0}static \u0275fac=function(e){return new(e||i)(f(Ye),f(ie),f(ge),f(q),f(xt),f(St),f(It),f(De),f(je),f(ze))};static \u0275cmp=N({type:i,selectors:[["POS-cart-footer"]],decls:34,vars:83,consts:[["class","row g-0 px-5 justify-content-end",4,"ngIf"],[1,"row","g-0","pb-6","px-5"],[1,"col-5","d-flex","justify-content-between","pe-5",2,"column-gap","12px"],[2,"flex-grow","1",3,"supplierPOTypes","predefinedNotes","defaultCurrencyID","currencies","formControl"],[2,"flex-grow","3",3,"outlets","formControl","appConfigJSON","outletID","isEdit"],[1,"col-7"],[1,"btn-group","w-100"],[2,"display","inline-flex",3,"taxes","currencySymbol","formControl"],[1,"w-100",2,"display","inline-flex",3,"amountToPay","currencySymbol","dueDate","dueDays","cardPayments","otherPayments","paymentMethodID","paymentCode","paymentNote","defaultDueDays","invoiceDate","appConfigJSON","cashPayments","isUnpaidOnEdit","isEditBuyForm","cartLength","totalVariantOrdered","isCashSuspended","denomination"],[1,"row","g-0","px-5","justify-content-end"],[1,"col-6",2,"padding-right","15px"],[1,"table","table-borderless"],[4,"ngIf"],[1,"text-start"],[1,"text-end","fs-5"],["class","text-end fs-5 text-danger",4,"ngIf"],[1,"text-end","fs-5","text-danger"],["class","text-end fs-5",4,"ngIf"]],template:function(e,n){e&1&&(D(0,Aa,6,4,"div",0),g(1,"async"),a(2,"div",1)(3,"div",2),I(4,"POS-note-form",3),g(5,"async"),g(6,"async"),g(7,"async"),g(8,"async"),I(9,"POS-fulfillment-form",4),g(10,"async"),g(11,"async"),g(12,"async"),r(),a(13,"div",5)(14,"div",6),I(15,"POS-discount-and-tax-form",7),g(16,"async"),g(17,"async"),I(18,"POS-pay-button",8),g(19,"async"),g(20,"async"),g(21,"async"),g(22,"async"),g(23,"async"),g(24,"async"),g(25,"async"),g(26,"async"),g(27,"async"),g(28,"async"),g(29,"async"),g(30,"async"),g(31,"async"),g(32,"async"),g(33,"async"),r()()()),e&2&&(c("ngIf",y(1,33,n.displayedDiscountAndTax$)),l(4),c("supplierPOTypes",y(5,35,n.supplierPOTypes$))("predefinedNotes",y(6,37,n.predefinedNotes$))("defaultCurrencyID",y(7,39,n.defaultCurrencyID$))("currencies",y(8,41,n.currencies$))("formControl",n.noteForm),l(5),c("outlets",y(10,43,n.outlets$))("formControl",n.deliveryEntityID)("appConfigJSON",y(11,45,n.appConfigJSON$))("outletID",n.outlet.value.ID)("isEdit",y(12,47,n.isEdit$)),l(6),c("taxes",y(16,49,n.taxes$))("currencySymbol",y(17,51,n.currencySymbol$))("formControl",n.discountAndTaxForm),l(3),c("amountToPay",y(19,53,n.amountAfterDiscountAndTax$))("currencySymbol",y(20,55,n.currencySymbol$))("dueDate",y(21,57,n.dueDate$))("dueDays",y(22,59,n.dueDays$))("cardPayments",y(23,61,n.cardPayments$))("otherPayments",y(24,63,n.otherPayments$))("paymentMethodID",n.paymentMethodID)("paymentCode",n.paymentCode)("paymentNote",n.paymentNote)("defaultDueDays",y(25,65,n.defaultDueDays$))("invoiceDate",n.invoiceDate)("appConfigJSON",y(26,67,n.appConfigJSON$))("cashPayments",y(27,69,n.cashPayments$))("isUnpaidOnEdit",y(28,71,n.isUnpaidOnEdit$))("isEditBuyForm",y(29,73,n.isEdit$))("cartLength",y(30,75,n.cartLength$))("totalVariantOrdered",y(31,77,n.totalVariantOrdered$))("isCashSuspended",y(32,79,n.isCashSuspended$))("denomination",y(33,81,n.denomination$)))},dependencies:[F,pe,Ve,Me,mn,Ke,le,qe,un,gn,bn],encapsulation:2})};var ka=i=>({"date-warning":i}),Va=()=>["/menu/Orders/Orders/Supplier_Bill/Info"],Ra=i=>({ID:i});function $a(i,t){if(i&1&&(Q(0),m(1),g(2,"async"),g(3,"number"),U()),i&2){let e=d().$implicit,n=d();l(),We(" ",y(2,2,n.currencySymbol$)," ",y(3,4,e.Total)," ")}}function Ba(i,t){i&1&&m(0," - ")}function ja(i,t){if(i&1&&(a(0,"div",28)(1,"div",29),m(2),r(),a(3,"div",30),D(4,$a,4,6,"ng-container",31)(5,Ba,1,0,"ng-template",null,0,be),r()()),i&2){let e=t.$implicit,n=ue(6),o=d();l(2),X(e.Name),l(2),c("ngIf",o.role.product.Cost)("ngIfElse",n)}}function La(i,t){if(i&1&&(Q(0),a(1,"td",36),m(2),r(),a(3,"td",37),m(4),g(5,"async"),r(),a(6,"td",36),m(7),g(8,"number"),r(),U()),i&2){let e=d().ngIf,n=d(2);l(2),X(e.label),l(2),j(" ",y(5,3,n.currencySymbol$)," "),l(3),X(y(8,5,e.value))}}function Qa(i,t){if(i&1&&(a(0,"tr"),D(1,La,9,7,"ng-container",38),r()),i&2){let e=t.ngIf;l(),c("ngIf",e.value>0)}}function Ua(i,t){if(i&1&&(Q(0),a(1,"td",36),m(2,"Discount:"),r(),a(3,"td",37),m(4),g(5,"async"),r(),a(6,"td",36),m(7),g(8,"number"),r(),U()),i&2){let e=d().ngIf,n=d(2);l(4),j(" ",y(5,2,n.currencySymbol$)," "),l(3),X(y(8,4,e.value))}}function Wa(i,t){if(i&1&&(a(0,"tr"),D(1,Ua,9,6,"ng-container",38),r()),i&2){let e=t.ngIf;l(),c("ngIf",e.value>0)}}function Ha(i,t){if(i&1&&(Q(0),a(1,"td",36),m(2),r(),a(3,"td",37),m(4),g(5,"async"),r(),a(6,"td",36),m(7),g(8,"number"),r(),U()),i&2){let e=d().ngIf,n=d(2);l(2),X(e.label),l(2),j(" ",y(5,3,n.currencySymbol$)," "),l(3),X(y(8,5,e.tax.value))}}function Ja(i,t){if(i&1&&(a(0,"tr"),D(1,Ha,9,7,"ng-container",38),r()),i&2){let e=t.ngIf;l(),c("ngIf",e.tax.value>0)}}function Ga(i,t){if(i&1&&(a(0,"div",32)(1,"div",33)(2,"table",34)(3,"tbody")(4,"tr",35)(5,"td",36),m(6,"Amount:"),r(),a(7,"td",37),m(8),g(9,"async"),r(),a(10,"td",36),m(11),g(12,"async"),g(13,"number"),r()(),D(14,Qa,2,1,"tr",38),g(15,"async"),D(16,Wa,2,1,"tr",38),g(17,"async"),D(18,Ja,2,1,"tr",38),g(19,"async"),a(20,"tr")(21,"td",36),m(22),r(),a(23,"td",37),m(24),g(25,"async"),r(),a(26,"td",36),m(27),g(28,"async"),g(29,"number"),r()()()()()()),i&2){let e=d();l(8),X(y(9,8,e.currencySymbol$)),l(3),j(" ",y(13,12,y(12,10,e.displayedAmount$))," "),l(3),c("ngIf",y(15,14,e.displayedDiscountPercentage$)),l(2),c("ngIf",y(17,16,e.displayedDiscountAmount$)),l(2),c("ngIf",y(19,18,e.displayedTax$)),l(4),j(" ",e.payment.paymentMethodName(),": "),l(2),X(y(25,20,e.currencySymbol$)),l(3),j(" ",y(29,24,y(28,22,e.displayedAmount$))," ")}}var vn=class i{constructor(t,e,n,o,s,O,v,$){this.payment=t;this.form=e;this.cart=n;this.complete=o;this.load=s;this.router=O;this.outletInfo=v;this.role=$;this.displayedAmount$=t.displayedAmount$,this.displayedDiscountPercentage$=t.displayedDiscountPercentage$,this.displayedDiscountAmount$=t.displayedDiscountAmount$,this.displayedTax$=t.displayedTax$}data;displayedAmount$;displayedDiscountPercentage$;displayedDiscountAmount$;displayedTax$;currencySymbol$;createNewTransaction(){this.clearCart(),this.resetBuyForm(),this.updateDueDays(),this.updateTax(),this.updatePaymentMethodID(),this.complete.paymentComplete(null),this.complete.createNewTransaction(),this.router.navigate([],{queryParams:{ID:null}})}get amountToPay(){return this.payment.amountToPay}resetBuyForm(){this.form.resetNoteForm(),this.form.resetDiscountAndTaxForm(),this.form.resetDueDaysForm(),this.form.resetBuyForm()}clearCart(){this.cart.clearCart()}updateDueDays(){this.load.updateDueDays()}updateTax(){this.outletInfo.updateTax()}updatePaymentMethodID(){this.outletInfo.updatePaymentMethodID()}static \u0275fac=function(e){return new(e||i)(f(Ye),f(q),f(ie),f(Le),f(ge),f(Kn),f(ze),f(De))};static \u0275cmp=N({type:i,selectors:[["POS-complete"]],inputs:{data:[0,"paymentComplete","data"]},decls:37,vars:16,consts:[["PRICE_HIDE",""],[1,"pt-7",2,"border-bottom","1px solid rgba(0, 0, 0, 0.1)"],[1,"ps-7","fw-normal","pb-7"],[1,"buy-complete"],[1,"container-fluid","pt-8"],[1,"row"],[1,"col-md-8"],[1,"card"],[1,"card-header"],[1,"d-flex","justify-content-between"],[1,"fa-solid","fa-check","me-1"],[1,"fst-italic"],[1,"card-body"],[1,"container"],[1,"row","mt-9","justify-content-center","g-0","mb-9"],[1,"col-9","text-center"],["type","button",1,"btn","btn-success","btn-lg","w-100","fs-2",3,"click"],[1,"card-footer","bg-light-gray"],[1,"row","justify-content-between","py-5"],[1,"col-auto"],["target","_blank",1,"btn","btn-light-gray",3,"href"],[1,"fa-solid","fa-print","me-2"],[1,"col-md-4"],[1,"card-header","bg-light-gray"],[1,"text-dark"],["target","_blank",1,"text-dark","fst-italic",3,"routerLink","queryParams"],["class","row my-1 p-5",4,"ngFor","ngForOf"],["class","card-footer pe-0 bg-white",4,"ngIf"],[1,"row","my-1","p-5"],[1,"col-8"],[1,"col-4","text-end"],[4,"ngIf","ngIfElse"],[1,"card-footer","pe-0","bg-white"],[1,"ms-auto"],[1,"table","table-borderless","mb-0","table-sm"],[2,"border-bottom","1px solid rgba(0, 0, 0, 0.1)"],[1,"text-end"],[1,"text-start"],[4,"ngIf"]],template:function(e,n){e&1&&(a(0,"div",1)(1,"h1",2),m(2,"New Purchase Order"),r()(),a(3,"section",3)(4,"div")(5,"div",4)(6,"div",5)(7,"div",6)(8,"div",7)(9,"div",8)(10,"div",9)(11,"h2"),I(12,"i",10),m(13," Purchase Complete "),a(14,"small",11),m(15),r()()()(),a(16,"div",12)(17,"div",13)(18,"div",14)(19,"div",15)(20,"button",16),_("click",function(){return n.createNewTransaction()}),m(21," New Purchase (F8) "),r()()()()(),a(22,"div",17)(23,"div",18)(24,"div",19)(25,"a",20),I(26,"i",21),m(27,"Print Receipt "),r()()()()()(),a(28,"div",22)(29,"div",7)(30,"div",23)(31,"h3",24)(32,"a",25),m(33),r()()(),D(34,ja,7,3,"div",26),g(35,"async"),D(36,Ga,30,26,"div",27),r()()()()()()),e&2&&(l(9),Wn(ae(11,ka,n.data.PaymentStateID<3)),l(6),j(" (",n.data.PaymentStateLabel,") "),l(10),c("href",n.data.Message,nt),l(7),c("routerLink",Rt(13,Va))("queryParams",ae(14,Ra,n.data.InvoiceID)),l(),j(" Supplier Bill #",n.data.InvoiceNumber," "),l(),c("ngForOf",y(35,9,n.cart.cart$)),l(2),c("ngIf",n.role.product.Cost))},dependencies:[F,He,pe,Ve,Me,jt,Bt],styles:[".print_containers[_ngcontent-%COMP%]{display:none}@media print{.print_containers[_ngcontent-%COMP%]{display:block;text-align:left}.buy-complete[_ngcontent-%COMP%]{display:none}}.table-sm[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .table-sm[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:10px!important}.buy-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-header[_ngcontent-%COMP%]{border-bottom:1px solid rgba(0,0,0,.125);padding-bottom:.9375rem}.buy-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-header[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:2rem}.buy-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-body[_ngcontent-%COMP%] .container[_ngcontent-%COMP%]{max-width:500px;margin-top:30px;margin-bottom:30px}.table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{vertical-align:middle;line-height:15px!important}"]})};var qa=["cartDisplayRef"];function Ka(i,t){if(i&1&&(Q(0),I(1,"POS-complete",3),U()),i&2){let e=t.ngIf;l(),c("paymentComplete",e)}}function za(i,t){if(i&1){let e=B();a(0,"div",4)(1,"div",5)(2,"div",6)(3,"div",7),I(4,"POS-select-outlet-form",8),g(5,"async"),g(6,"async"),g(7,"async"),I(8,"POS-invoice-number-form",9),g(9,"async"),I(10,"POS-invoice-date",10),r()(),a(11,"div",11)(12,"div",12)(13,"div",13),I(14,"POS-more-actions",14),g(15,"async"),g(16,"async"),r(),a(17,"div",15)(18,"div",16),I(19,"i",17)(20,"input",18),r()(),a(21,"div",19)(22,"div",20)(23,"button",21),g(24,"async"),_("click",function(){x(e);let o=d();return S(o.collapseSidebar())}),I(25,"span",22)(26,"span",22)(27,"span",22),r()()()()()(),a(28,"div",23)(29,"div",6),I(30,"POS-quick-key",24),g(31,"async"),r(),a(32,"div",25)(33,"div",26)(34,"div",27),I(35,"POS-variant-autocomplete",28),r(),a(36,"div",15),I(37,"POS-supplier-autocomplete",29),g(38,"async"),g(39,"async"),r()(),I(40,"POS-cart-display",30,1),g(42,"async"),g(43,"async"),g(44,"async"),I(45,"POS-cart-footer"),r()()()}if(i&2){let e=d();l(4),c("outlets",y(5,30,e.outlets$))("isOpenAfterLoad",y(6,32,e.isOpenDialogOutlet$))("formControl",e.outlet)("disabled",y(7,34,e.isEdit$)),l(4),c("formControl",e.poNumber)("isEdit",y(9,36,e.isEdit$)),l(2),c("formControl",e.date)("tooltip",e.role.global!=null&&e.role.global.Date?"":"Date role is required"),l(4),c("returnInvoiceNumber",e.returnInvoiceNumber)("appConfigJSON",y(15,38,e.appConfigJSON$))("isEditBuyForm",y(16,40,e.isEdit$))("outletID",e.outlet.value.ID)("outletName",e.outlet.value.Name),l(6),c("formControl",e.attention),l(3),yt("change",y(24,42,e.toggleState$)),l(7),c("quickKey",y(31,44,e.quickKeyPack$))("outletID",e.outlet.value.ID)("formControl",e.variantQuickKey),l(5),c("formControl",e.variantAutocomplete)("autocompleteEndpoint",e.variantAutocompleteEndpoint)("outletID",e.outlet.value.ID),l(2),c("formControl",e.supplierID)("supplierPOTypes",y(38,46,e.supplierPOTypes$))("appConfigJSON",y(39,48,e.appConfigJSON$)),l(3),c("cart",y(42,50,e.cart$))("appConfigJSON",y(43,52,e.appConfigJSON$))("isEdit",y(44,54,e.isEdit$))("outletID",e.outlet.value.ID)("outletName",e.outlet.value.Name)}}var qi=class i extends ui{constructor(e,n,o,s,O,v,$,K,h,A,p,M,G){Hn(()=>{this.cartDisplayRef()&&(s.cartDisplayRef=this.cartDisplayRef())});super(M);this.intercom=v;this.role=h;this.toggle=A;this.lowOnStock=p;this.menuData$.subscribe();let Y=n.buyForm.controls.Order.controls;this.outlets$=e.entities$,this.outlet=n.outlet,this.isEdit$=$.isEdit$.pipe(E(b=>b?this.outlet.disable():this.outlet.enable())),this.date=Y.Date,h.global.Date==!1&&this.date.disable(),this.supplierID=Y.SupplierID,this.attention=Y.Att,this.poNumber=n.buyForm.controls.Order.controls.Number,this.role?.sell?.Number||this.poNumber.disable(),this.quickKeyPack$=o.quickKeyPack$,this.variantAutocomplete=s.variantAutocomplete,this.variantQuickKey=s.variantQuickKey,this.returnInvoiceNumber=O.returnInvoiceNumber,this.cart$=s.cart$,this.appConfigJSON$=e.appConfigJSON$,this.isOpenDialogOutlet$=p.selectedLowOnStockData.length==0?this.isEdit$.pipe(Z(b=>K.createNewTransaction$.pipe(u(C=>C||b))),u(b=>!b)):Ze(!1),p.selectedLowOnStockData.length&&(n.setOutletForm({ID:p.selectedLowOnStockData[0].EntityID,Name:p.selectedLowOnStockData[0].Outlet}),G.post("/API/catalog/variant/GetVariantByListID",{ListID:p.selectedLowOnStockData.map(b=>b.ID),EntityID:p.selectedLowOnStockData[0].EntityID}).pipe(u(b=>b.map(C=>this.setUnitPrice(C)).map(C=>({VariantID:C.ID,UnitPrice:C.UnitPrice})))).subscribe(b=>{n.setDeliveryEntityID(p.selectedLowOnStockData[0].EntityID);let C=p.selectedLowOnStockData.map(w=>({Quantity:w.Quantity,UnitQuantity:w.UnitQuantity,UnitPrice:b.find(k=>k.VariantID==w.VariantID).UnitPrice,Code:w.Code,Name:w.Product,DiscountAmount:w.DiscountAmount,Discount:w.Discount,Total:w.Total*b.find(k=>k.VariantID==w.VariantID).UnitPrice,VariantID:w.VariantID}));s.editForm(C)})),this.paymentComplete$=K.paymentComplete$,this.supplierPOTypes$=e.supplierPOTypes$,this.toggleState$=A.toggleState$}cartDisplayRef=Et("cartDisplayRef",{read:Dn});variantAutocompleteEndpoint=$e.GetVariantSuggestionsByEntityID;sf=ce(Pt);outlets$;quickKeyPack$;outlet;poNumber;date;supplierID;variantAutocomplete=new me;variantQuickKey=new me;returnInvoiceNumber;cart$;appConfigJSON$;attention;isEdit$;paymentComplete$;supplierPOTypes$;isOpenDialogOutlet$;toggleState$;renderer=ce(Ln);ngAfterViewInit(){let e=document.querySelector("#full-container");this.renderer.addClass(e,"full-container"),this.intercom.hideLauncher()}setUnitPrice(e){let n=T({},e);return P.IsNotEmpty(e.OrderPrice)?n.UnitPrice=e.OrderPrice:n.UnitPrice=e.UnitCost,n}ngOnDestroy(){this.lowOnStock.selectedLowOnStockData=[],this.intercom.showLauncher();let e=document.querySelector("#full-container");this.renderer.removeClass(e,"full-container")}collapseSidebar(){this.toggle.toggleSidebar()}static \u0275fac=function(n){return new(n||i)(f(ge),f(q),f(ze),f(ie),f(rt),f(ni),f(je),f(Le),f(De),f(ii),f(Wt),f(fi),f(se))};static \u0275cmp=N({type:i,selectors:[["POS-buy-v2"]],viewQuery:function(n,o){n&1&&kt(o.cartDisplayRef,qa,5,Dn),n&2&&Vt()},features:[ke([ie,Le,It,je,q,St,ge,xt,ze,Ye,rt,Pt]),Un],decls:4,vars:4,consts:[["ISNOTCOMPLETE",""],["cartDisplayRef",""],[4,"ngIf","ngIfElse"],[3,"paymentComplete"],[1,"container-fluid"],[1,"row","header","border-bottom"],[1,"col-5","border-end"],[1,"left-toolbar-container","h-100","d-flex","align-items-center","justify-content-between"],[3,"outlets","isOpenAfterLoad","formControl","disabled"],["transactionType","Purchase Order",3,"formControl","isEdit"],[3,"formControl","tooltip"],[1,"col-7","d-flex","align-items-center"],[1,"row","flex-grow-1"],[1,"col-lg-7","col-5","d-flex","align-items-center"],[3,"returnInvoiceNumber","appConfigJSON","isEditBuyForm","outletID","outletName"],[1,"col-5","ps-0"],[1,"d-flex","align-items-center","position-relative"],[1,"fa-light","fa-id-badge","position-absolute"],["type","text","placeholder","Assign Attention",1,"border-bottom-0",3,"formControl"],[1,"col-2"],[1,"navbar","mobile-button","border-bottom-0"],["type","button","aria-controls","navigation-index","aria-expanded","false","aria-label","Toggle navigation",1,"navbar-toggler","navbar-toggler-right","float-end","toggle-menu","ps-2","pe-0","border-0",2,"width","max-content","height","max-content",3,"click"],[1,"navbar-toggler-bar","burger-lines"],[1,"row","content"],[3,"quickKey","outletID","formControl"],[1,"col-7","pt-5","px-0","d-flex","flex-column"],[1,"row","w-100","ms-0"],[1,"col-7","px-0"],["amountProperty","VariantCost",3,"formControl","autocompleteEndpoint","outletID"],[3,"formControl","supplierPOTypes","appConfigJSON"],[1,"cart-display",3,"cart","appConfigJSON","isEdit","outletID","outletName"]],template:function(n,o){if(n&1&&(D(0,Ka,2,1,"ng-container",2),g(1,"async"),D(2,za,46,56,"ng-template",null,0,be)),n&2){let s=ue(3);c("ngIf",y(1,2,o.paymentComplete$))("ngIfElse",s)}},dependencies:[F,pe,Ve,Ke,he,le,qe,Fi,Ai,Di,Yt,Kt,ki,Xt,cn,Cn,vn],styles:[".left-toolbar-container[_ngcontent-%COMP%]{position:relative}.left-toolbar-container[_ngcontent-%COMP%] POS-invoice-number-form[_ngcontent-%COMP%]{position:absolute;top:34px;left:28px}.header[_ngcontent-%COMP%]{min-height:60px}.content[_ngcontent-%COMP%]{min-height:calc(100vh - 60px)}.supplier-more-menu[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.cart-display[_ngcontent-%COMP%]{flex-grow:1;height:0px;overflow-y:auto}input[_ngcontent-%COMP%]{width:100%;height:38px!important;border:0;border-bottom:1px solid #ced4da;padding-left:32px}input[_ngcontent-%COMP%]::placeholder{color:#ced4da}i[_ngcontent-%COMP%]{font-size:16px;top:10.6px;left:13px}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]{transition:.4s}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(1){-webkit-transform:rotate(-45deg) translate(-8px,4px);transform:rotate(-45deg) translate(-8px,4px)}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(2){opacity:0}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(3){-webkit-transform:rotate(45deg) translate(-5px,0px);transform:rotate(45deg) translate(-5px)}.mobile-button[_ngcontent-%COMP%]{display:none}@media (max-width: 990px){.mobile-button[_ngcontent-%COMP%]{display:block}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}.more-actions[_ngcontent-%COMP%] div.d-flex[_ngcontent-%COMP%]{width:30rem}"]})};export{qi as BuyV2Component};
|