dealpos 25.48.0 → 25.48.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.
Files changed (90) hide show
  1. package/browser/{chunk-HYURPMUC.js → chunk-2RYEXHZV.js} +1 -1
  2. package/browser/{chunk-4KMRZ2TB.js → chunk-356KM5DR.js} +1 -1
  3. package/browser/chunk-36NP63VM.js +3 -0
  4. package/browser/{chunk-A4H6IBC3.js → chunk-3DAJFE6H.js} +1 -1
  5. package/browser/{chunk-KVE6HTDK.js → chunk-3ESMPFFS.js} +1 -1
  6. package/browser/{chunk-7TWRUF3H.js → chunk-3G264AW4.js} +1 -1
  7. package/browser/{chunk-S5HK3JOC.js → chunk-3VQBBLWE.js} +1 -1
  8. package/browser/{chunk-722XQJ5H.js → chunk-3YHMSAWW.js} +1 -1
  9. package/browser/{chunk-NS7V266J.js → chunk-4ISL77CE.js} +1 -1
  10. package/browser/{chunk-2IIAMAC2.js → chunk-4NNOZ2BP.js} +1 -1
  11. package/browser/{chunk-BTJPSMLV.js → chunk-4VSJH5SL.js} +1 -1
  12. package/browser/{chunk-P43N5BDV.js → chunk-5K7KFVM3.js} +1 -1
  13. package/browser/{chunk-YOIV5LCG.js → chunk-6EJSHQWL.js} +1 -1
  14. package/browser/{chunk-55K6ABR7.js → chunk-6ONTAEOO.js} +1 -1
  15. package/browser/{chunk-FUS5ABYT.js → chunk-6PR53KNR.js} +1 -1
  16. package/browser/{chunk-RFCZ4NNF.js → chunk-6YHYVBRQ.js} +1 -1
  17. package/browser/{chunk-HEPRCWZT.js → chunk-7HRIPBOK.js} +1 -1
  18. package/browser/{chunk-NFAOMT2P.js → chunk-7MD5PKPB.js} +2 -2
  19. package/browser/{chunk-DFUQ53YY.js → chunk-7NEKXENA.js} +1 -1
  20. package/browser/{chunk-HQMGZB3H.js → chunk-7V3SLYOQ.js} +1 -1
  21. package/browser/chunk-7ZUYXNKP.js +5 -0
  22. package/browser/{chunk-CWFUNJQI.js → chunk-ANPUR4EP.js} +1 -1
  23. package/browser/{chunk-YYGLCUQ6.js → chunk-BJF3WGIP.js} +1 -1
  24. package/browser/{chunk-ZNIIYEEO.js → chunk-BOLUBS5R.js} +2 -2
  25. package/browser/{chunk-OK5EBIMF.js → chunk-BYFPLENU.js} +2 -2
  26. package/browser/{chunk-LB7NU42O.js → chunk-CFU6YCXT.js} +1 -1
  27. package/browser/{chunk-YJFCUHVH.js → chunk-CLX7PIH6.js} +1 -1
  28. package/browser/{chunk-4AKG7BSF.js → chunk-DHY5NYN2.js} +1 -1
  29. package/browser/{chunk-5S5ZFAPJ.js → chunk-DV63TLIP.js} +1 -1
  30. package/browser/{chunk-NCLOGMP4.js → chunk-DWNXML7N.js} +1 -1
  31. package/browser/{chunk-Z2CO5BFP.js → chunk-E55DAXRW.js} +1 -1
  32. package/browser/{chunk-YWDEOTPR.js → chunk-E5IXDLDT.js} +1 -1
  33. package/browser/{chunk-54W52P5V.js → chunk-E7AQSX2U.js} +1 -1
  34. package/browser/{chunk-R3BLOGD6.js → chunk-EIHC54J5.js} +1 -1
  35. package/browser/{chunk-56J3O2YI.js → chunk-F7KTXCW4.js} +3 -3
  36. package/browser/{chunk-ECEHKAWW.js → chunk-FO5ZTXDH.js} +1 -1
  37. package/browser/{chunk-CJII6RPH.js → chunk-G4G5P6ZQ.js} +1 -1
  38. package/browser/{chunk-KWKY5NGW.js → chunk-GCP2MGQL.js} +1 -1
  39. package/browser/{chunk-BNYVOYYX.js → chunk-HCCADOVL.js} +1 -1
  40. package/browser/{chunk-K5L5HMWR.js → chunk-I7FZGSZZ.js} +1 -1
  41. package/browser/{chunk-OBXCVFDY.js → chunk-IVJVUXLS.js} +1 -1
  42. package/browser/{chunk-3KNGE65M.js → chunk-IVVSNJJ3.js} +1 -1
  43. package/browser/chunk-J76F72FK.js +24 -0
  44. package/browser/{chunk-63AFDUIT.js → chunk-K6CUAFH7.js} +12 -12
  45. package/browser/{chunk-6BKNXERF.js → chunk-KD24MXAU.js} +1 -1
  46. package/browser/{chunk-QPMF6WP7.js → chunk-KPHOGUDM.js} +1 -1
  47. package/browser/{chunk-KY577SRX.js → chunk-KRPYY55C.js} +1 -1
  48. package/browser/{chunk-IMVZUGYH.js → chunk-KZBNUY2K.js} +1 -1
  49. package/browser/{chunk-MNVLPMSI.js → chunk-LELZTT7A.js} +1 -1
  50. package/browser/{chunk-4IQRI3GN.js → chunk-LLHBXZ6B.js} +1 -1
  51. package/browser/{chunk-QHNGMJWX.js → chunk-MFLQHYOR.js} +1 -1
  52. package/browser/{chunk-WWQSFAIE.js → chunk-N3L2CE6S.js} +1 -1
  53. package/browser/{chunk-32RSQ3UU.js → chunk-NJD4GKTM.js} +1 -1
  54. package/browser/{chunk-MNZTXNPB.js → chunk-NZ4SK6LY.js} +1 -1
  55. package/browser/{chunk-H44MWYXB.js → chunk-OTUYSGSK.js} +4 -4
  56. package/browser/{chunk-YFRQWQ66.js → chunk-OWGJVIYJ.js} +1 -1
  57. package/browser/{chunk-3L267ZNV.js → chunk-P7BRWWWC.js} +1 -1
  58. package/browser/{chunk-MZIYTJ6Z.js → chunk-R36QPCUA.js} +1 -1
  59. package/browser/{chunk-DSF34FWR.js → chunk-RJMVCGIG.js} +1 -1
  60. package/browser/{chunk-4RKRHCPA.js → chunk-S7X7547X.js} +1 -1
  61. package/browser/{chunk-ND6K5DYL.js → chunk-SLDKONZE.js} +1 -1
  62. package/browser/{chunk-QQDH2U6C.js → chunk-TARA6KGA.js} +1 -1
  63. package/browser/{chunk-3THWKHRL.js → chunk-TON7E347.js} +1 -1
  64. package/browser/{chunk-VXHN6MWB.js → chunk-TT2F5I7H.js} +1 -1
  65. package/browser/{chunk-2LYXOQ5N.js → chunk-U4N5AZIO.js} +1 -1
  66. package/browser/{chunk-MYKOQWDM.js → chunk-U5LNORQV.js} +1 -1
  67. package/browser/{chunk-5WZX5UDC.js → chunk-UAQU4IQS.js} +1 -1
  68. package/browser/{chunk-VC7J7CSQ.js → chunk-UCOXEQFM.js} +1 -1
  69. package/browser/{chunk-WCCWWFYE.js → chunk-UQ5F3YKZ.js} +1 -1
  70. package/browser/{chunk-7XC4XIHR.js → chunk-USMW7JHL.js} +1 -1
  71. package/browser/{chunk-V4KJNBS7.js → chunk-UZKEO2IO.js} +1 -1
  72. package/browser/{chunk-RKBLZASG.js → chunk-VNBCF2XF.js} +1 -1
  73. package/browser/{chunk-SDRB6Y54.js → chunk-VVYOMXKJ.js} +1 -1
  74. package/browser/chunk-WBFJWUUR.js +1 -0
  75. package/browser/{chunk-UJTEC3AC.js → chunk-WKXWWL55.js} +1 -1
  76. package/browser/{chunk-L7CBHHVQ.js → chunk-WQMNK3UX.js} +1 -1
  77. package/browser/{chunk-4XGRIAZ2.js → chunk-WXH4A4T7.js} +1 -1
  78. package/browser/{chunk-AE6CDP2N.js → chunk-X3UFVTIQ.js} +1 -1
  79. package/browser/{chunk-BMSRWGKX.js → chunk-XSHCTIUH.js} +1 -1
  80. package/browser/{chunk-Q6KWA7ML.js → chunk-YBIA6E5J.js} +1 -1
  81. package/browser/{chunk-LPWVUN75.js → chunk-YBVDBTTE.js} +1 -1
  82. package/browser/{chunk-ZEIM63JO.js → chunk-YQOU4WGG.js} +1 -1
  83. package/browser/{chunk-QQXPISMR.js → chunk-YV4LSCS5.js} +1 -1
  84. package/browser/index.html +2 -2
  85. package/browser/{main-7GOIEWD6.js → main-BTMX7TBF.js} +2 -2
  86. package/package.json +1 -1
  87. package/browser/chunk-47T7IWRR.js +0 -5
  88. package/browser/chunk-AKFNDMFE.js +0 -3
  89. package/browser/chunk-NVYVELCF.js +0 -24
  90. package/browser/chunk-YUTT2QKH.js +0 -1
@@ -1,24 +0,0 @@
1
- import{a as Zn}from"./chunk-EQR3RN5K.js";import{a as eo,c as to}from"./chunk-G2VAG4V3.js";import{a as oi}from"./chunk-IDOZYC3I.js";import{a as qn,b as Kn,c as zn,d as Yn,e as Xn,f as ke}from"./chunk-C6YPXBIP.js";import{a as Hn}from"./chunk-3OHHXDTW.js";import{a as Gn}from"./chunk-AMONIKLC.js";import"./chunk-5I5IONRY.js";import{a as Zt}from"./chunk-JCTDWAYQ.js";import{a as An}from"./chunk-5TKXFIDJ.js";import{a as ni}from"./chunk-MEG3XVPI.js";import{a as Wn}from"./chunk-C5AIOCPM.js";import{a as Jn}from"./chunk-YRDGEYIV.js";import"./chunk-2KPICU7I.js";import"./chunk-NQX7EX5A.js";import"./chunk-DJTAYVZN.js";import"./chunk-P3KIIKY4.js";import{a as Ei}from"./chunk-GODXDKX5.js";import{c as Bn,d as jn}from"./chunk-PSJRHKCL.js";import{a as ei,b as $n,c as Rn}from"./chunk-NVCUDJUL.js";import"./chunk-2MCEIRJY.js";import{a as Nt}from"./chunk-23PKMU5D.js";import{a as Kt}from"./chunk-AFBBEIKR.js";import"./chunk-IFOBYW26.js";import{b as kn}from"./chunk-SVUUS5JD.js";import{a as Ln,b as Qn,c as Un}from"./chunk-76RLGANX.js";import"./chunk-KYAKLZR7.js";import"./chunk-CA6YBQT3.js";import{a as ti,b as ii}from"./chunk-J7YNB6YX.js";import{a as Vn}from"./chunk-VP2ZEIJA.js";import"./chunk-BYXBJQAS.js";import"./chunk-5DQ4MJJT.js";import"./chunk-BYXBJQAS.js";import{b as Fn}from"./chunk-QIJEAKQK.js";import"./chunk-QEOGHVXA.js";import"./chunk-4HCSE44G.js";import{e as Dt}from"./chunk-AUBQH6JY.js";import{a as Yt}from"./chunk-HL3ONSX6.js";import"./chunk-Q2A4MYK3.js";import{d as En,e as Xt}from"./chunk-QPOOLLKY.js";import"./chunk-CSFFF2YO.js";import"./chunk-3RK6DDJD.js";import"./chunk-WNZKCNMC.js";import"./chunk-LOD3JYZW.js";import"./chunk-3KSZCJ6T.js";import"./chunk-6GLKD66N.js";import"./chunk-CBSYYTXQ.js";import"./chunk-G4IW5GPY.js";import"./chunk-FIUZN6JU.js";import"./chunk-JEL3OND6.js";import"./chunk-IDQUQBKL.js";import{a as hn,b as vn,c as _n}from"./chunk-VX5HH3BW.js";import"./chunk-VYQEM4T2.js";import"./chunk-UTAQ3FRE.js";import{a as Dn,c as xn,e as Sn,g as Mn}from"./chunk-M43HNBJQ.js";import{a as st,c as ct}from"./chunk-KKLNFVVN.js";import"./chunk-5SFUSWFY.js";import"./chunk-534MIVWD.js";import"./chunk-TGEQUV6Z.js";import{a as In,b as Pn}from"./chunk-WCCWWFYE.js";import"./chunk-CS6HBROS.js";import{a as yn}from"./chunk-JUS6LLVX.js";import{A as wn,G as Nn,q as bn,u as Ie,v as Pe,w as Oe,x as On,z as Tn}from"./chunk-BA3BDB5Y.js";import{b as rt,c as lt}from"./chunk-C4WJKF7R.js";import{O as Ae}from"./chunk-T25N3EEG.js";import{d as xt}from"./chunk-7TBS7SPQ.js";import{a as mn,b as pn,c as dn}from"./chunk-EQLHPWVB.js";import{a as Y,e as Me,f as Fe,g as ee,l as zt}from"./chunk-A45GTZVV.js";import"./chunk-NWSIPELM.js";import"./chunk-6SGN7MNX.js";import"./chunk-L76WVZW6.js";import{a as ve}from"./chunk-2FWFPV5I.js";import"./chunk-O5SLP4JK.js";import{E as gn,F as Se,G as Ye,a as Ke,b as un,c as be,h as ae,l as ce,o as xe,r as fn,s as ze}from"./chunk-RNLSEEMX.js";import{a as Cn}from"./chunk-ECEHKAWW.js";import{a as S,d as he}from"./chunk-USJ6ILEE.js";import{a as cn}from"./chunk-YYGLCUQ6.js";import{$ as je,$d as qt,Ab as Ue,Ad as ln,Bb as We,Bc as f,Ca as Le,Cb as b,Cc as g,D as ot,Db as r,Dc as wt,E as V,Eb as a,Fb as M,Gb as Je,H as Ui,Hb as it,Hc as Wt,I as ye,Ib as kt,Ja as wi,Jb as Vt,Kb as $t,Lb as en,Lc as nn,M as Wi,Mb as B,N as Ti,Ob as D,Pb as bt,Q as Ji,Qa as qi,Qb as p,Qc as Jt,Sa as at,T as Hi,Ub as Rt,Vb as Bt,W as Tt,Wa as Ki,Wb as jt,Wd as sn,Xa as l,Y as Z,Yb as Lt,Yd as Ht,Zb as Qt,Zd as Gt,_b as ht,aa as X,ac as vt,be as qe,ca as Gi,cb as zi,cc as tn,cd as Ge,d as ge,db as u,dc as m,e as et,ec as z,ed as on,ee as re,f as ji,fa as E,fb as Yi,fc as j,ga as me,gc as He,hb as F,ic as U,jc as L,jd as an,k as we,kc as W,kd as Ee,la as ne,lb as Xi,md as rn,n as Li,nb as ut,o as tt,oa as Q,oc as Ni,od as De,p as Qi,pa as le,rd as se,sc as Ne,t as d,ta as P,tc as Ut,u as Ce,ua as O,uc as ie,v as Oi,vb as h,vc as _t,wb as Zi,xb as v,y as dt,zb as Qe}from"./chunk-JYZTRN6N.js";import"./chunk-WFMAM73Y.js";import{a as w,b as R,e as Bi,k as yt}from"./chunk-SNAKHGZS.js";var H=class n{constructor(t,e){this.http=e;this.buyForm=t.group({NewOrderID:[""],Order:t.group({Att:[""],SupplierID:[""],Number:[""],Date:[new Date],ID:[S.GuidEmpty]}),Invoice:t.group({ID:[S.GuidEmpty],Due:[new Date],Tax:[0]}),Payment:t.group({ID:[S.GuidEmpty],Amount:[0],MethodID:[0],Code:[""],Note:[""],ImageUrl:[""]})})}outlet=new ce({ID:"",Name:"Choose an Outlet"});dueDays=new ce(0);deliveryEntityID=new ce(S.GuidEmpty);noteForm=new ce({Note:"",TagID:"",Currency:{ID:"",ExchangeRate:0,Symbol:""},InvoiceNumber:""});discountAndTaxForm=new ce({Discount:{Amount:0,Percentage:0},Tax:{ID:"",CalculationTypeName:"",Rate:0,Label:"",Discontinue:!1}});buyForm;setPONumber(t){let e="";if(t.Seed){let i=t.Seed+"";for(;i.length<t.Digit;)i="0"+i;e=S.StringFormat(t.Prefix,i)}this.buyForm.controls.Order.controls.Number.setValue(e)}setDueDateBasedOnDaysDue(t){console.log(t);let e=this.invoiceDate,i=new Date(S.cloneObject(e));i.setDate(i.getDate()+t),this.buyForm.controls.Invoice.controls.Due.setValue(i)}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=w({},this.discountAndTaxForm.value.Discount);this.discountAndTaxForm.setValue({Discount:e,Tax:t})}setCurrency(t){let e=this.noteForm.value;this.noteForm.setValue(R(w({},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(w(w({},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(S.GuidEmpty)}resetNoteForm(){this.noteForm.setValue(R(w({},this.noteForm.value),{Note:"",TagID:"",InvoiceNumber:""}))}resetDiscountAndTaxForm(){let t=this.discountAndTaxForm.value;this.discountAndTaxForm.setValue(R(w({},t),{Discount:{Amount:0,Percentage:0}}))}resetBuyForm(){this.buyForm.reset(),this.buyForm.controls.Invoice.controls.ID.setValue(S.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(S.GuidEmpty),this.generateNumberOnNewTransaction()}generateNumberOnNewTransaction(){this.http.post("/API/Buy/GenerateNumber",{ID:this.outlet.value.ID}).subscribe(t=>{this.setNewOrderID(S.Guid_NewGuid()),this.buyForm.controls.Order.controls.Number.setValue(t.Number)})}static \u0275fac=function(e){return new(e||n)(Q(gn),Q(re))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};var de=class n{entities$;appConfigJSON$;taxes$;currencies$;supplierPOTypes$;predefinedNotes$;denomination$;defaultDueDays$;constructor(t,e){let i=t.get("/API/Buy2/Load").pipe(E(o=>e.setCurrency(o.Currencies.find(s=>s.ID==o.AppConfigJSON.CoreDefaults.CurrencyID))),Z(1));this.denomination$=i.pipe(d(o=>o.Denomination)),this.entities$=i.pipe(d(o=>o.Entities)),this.appConfigJSON$=i.pipe(d(o=>o.AppConfigJSON)),this.taxes$=i.pipe(d(o=>o.Taxes),Z(1)),this.currencies$=i.pipe(d(o=>o.Currencies),Z(1)),this.supplierPOTypes$=i.pipe(d(o=>o.SupplierPOTypes)),this.predefinedNotes$=i.pipe(d(o=>o.PredefinedNotes)),this.defaultDueDays$=i.pipe(d(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||n)(Q(re),Q(H))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};var mt=class n{returnInvoiceNumber=new ce("");invoiceInfo$;constructor(t,e,i){let o=e.outlet.valueChanges.pipe(d(c=>c.ID),Y());this.invoiceInfo$=this.returnInvoiceNumber.valueChanges.pipe(V(c=>!!c),me(o),X(([c,I])=>t.post("/API/Buy/GetSupplierInvoiceRetur2",{EntityID:I,Number:c}).pipe(ye(()=>we))),Z(1),Y());let s=this.invoiceInfo$.pipe(d(c=>w({},c.Order)),E(c=>{let I={Att:c.Att,SupplierID:{Key:c.SupplierID,Value:c.SupplierName,OnSet:!0},Date:new Date,Number:e.buyForm.controls.Order.controls.Number.value,ID:S.GuidEmpty};e.setBulkOrderForm(I)}),Y()),T=this.invoiceInfo$.pipe(d(c=>c.Order),E(c=>{let I={Note:`Return #${c.Number}`,TagID:c.TypeID,Currency:{ID:c.CurrencyID,ExchangeRate:c.CurrencyRate,Symbol:c.CurrencySymbol??"$"},InvoiceNumber:c.Number};e.setBulkNoteForm(I)}),Y()),_=this.invoiceInfo$.pipe(d(c=>c.Order),me(i.taxes$),d(([c,I])=>R(w({},c),{Tax:I.find(J=>J.ID===c.TaxTypeID)})),E(c=>{let I={Discount:{Amount:c.DiscountAmount,Percentage:c.Discount},Tax:{ID:c.TaxTypeID,Rate:c.Tax?.Rate,CalculationTypeName:c.Tax?.CalculationTypeName,Label:c.Tax?.Label,Discontinue:!c.Tax?.Label}};e.setBulkDiscountAndTaxForm(I)}),Y()),$=this.invoiceInfo$.pipe(d(c=>c.DeliveryEntityID),E(c=>e.setDeliveryEntityID(c)),Y()),G=this.invoiceInfo$.pipe(d(c=>c.Invoice),E(c=>{let I={ID:c.ID,Tax:c.Tax};e.setBulkInvoice(I)}),Y()),x=this.invoiceInfo$.pipe(d(c=>c.Payment),E(c=>{let I={ID:S.GuidEmpty,Amount:c.Amount,MethodID:c.MethodID,Note:c.Note,Code:c.Code,ImageUrl:c.ImageUrl};e.setBulkPayment(I)}),Y());Ce(s,T,_,$,G,x).pipe(Y()).subscribe()}static \u0275fac=function(e){return new(e||n)(Q(re),Q(H),Q(de))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};var te=class n{constructor(t,e,i,o){this.matDialog=o;let s=e.outlet.valueChanges.pipe(d(c=>c.ID));this.addVariantThroughSerial$=this._addVariantThroughSerial.asObservable().pipe(me(s),X(([c,I])=>t.get(Ae.GetVariantBySerial,[{key:"Serial",value:c},{key:"EntityID",value:I}]).pipe(ye(()=>we))),d(c=>this.setUnitPrice(c)),d(c=>R(w({},c),{Quantity:1,Total:c.UnitPrice,VariantID:c.ID})),d(c=>({action:"addAsSerial",variant:c})));let T=this.variantAutocomplete.valueChanges.pipe(V(c=>S.IsNotEmpty(c)&&c.type=="Code"),d(c=>c.str),me(s),X(([c,I])=>t.get(Ae.GetVariantByCode,[{key:"Code",value:c},{key:"EntityID",value:I},{key:"Promotion",value:!0}]).pipe(ye(()=>we))),d(c=>this.setUnitPrice(c)),d(c=>R(w({},c),{Quantity:1,Total:c.UnitPrice*((100-c.PriceDiscount)/100),Discount:c.PriceDiscount,VariantID:c.ID}))),_=this.variantAutocomplete.valueChanges.pipe(V(c=>S.IsNotEmpty(c)&&c.type=="ID"),d(c=>c.str)),$=this.variantQuickKey.valueChanges,G=ot(_,$).pipe(me(s),X(([c,I])=>t.get(Ae.GetVariantByID,[{key:"ID",value:c},{key:"EntityID",value:I}]).pipe(ye(()=>we))),d(c=>this.setUnitPrice(c)),d(c=>R(w({},c),{Quantity:1,Total:c.UnitPrice*((100-c.OrderPriceDiscount)/100),Discount:c.OrderPriceDiscount,VariantID:c.ID}))),x=ot(G,T).pipe(E(c=>{c.CategoryTypeID===1&&this.toastr.info(`${c.Name} is sellable only.`,ve.Info)}),V(c=>c.CategoryTypeID!==1),d(c=>({action:"add",variant:c})),E(()=>{this.cartDisplayRef&&setTimeout(()=>{let c=this.cartDisplayRef.nativeElement.scrollHeight;this.cartDisplayRef.nativeElement.scrollTop=c},1)})),A=i.invoiceInfo$.pipe(d(c=>({action:"returnInvoice",variants:c.Items.map(I=>R(w({},I.Variant),{Quantity:I.Quantity,Total:I.Total,UnitPrice:I.UnitPrice,Discount:I.Discount,Serial:I.Serial,ID:I.ID,DiscountAmount:I.DiscountAmount,VariantID:I.VariantID,UnitQuantity:I.UnitQuantity}))})));this.cart$=ot(x,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(Tt((c,I)=>{let J=[...c],K=[],C=I.action;if(C=="add"){let y=I.variant;K=!!J.find(k=>k.VariantID==y.ID)?J.map(k=>k.VariantID==y.ID?R(w({},k),{Quantity:k.Quantity+1,Total:k.Total+k.UnitPrice}):k):[...J,y]}else if(C=="returnInvoice"||C=="onEditForm")K=I.variants;else if(C=="delete"){let y=I.index;K=J.filter((N,k)=>k!=y)}else if(C=="sort"){let y=I.ev;K=J,Dn(K,y.previousIndex,y.currentIndex)}else if(C=="returnCart")K=J.map(y=>R(w({},y),{Quantity:-Math.abs(y.Quantity),Total:-Math.abs(y.Total)}));else if(C=="update"){let y=I.index;K=J.map((N,k)=>k==y?I.variant:N)}else if(C=="returnVariant"){let y=I.index;K=J.map((N,k)=>k==y?R(w({},N),{Quantity:-Math.abs(N.Quantity),Total:-Math.abs(N.Total)}):N)}else if(C=="purchaseVariant"){let y=I.index;K=J.map((N,k)=>k==y?R(w({},N),{Quantity:Math.abs(N.Quantity),Total:Math.abs(N.Total)}):N)}else if(C=="clearCart")K=[];else if(C=="addAsSerial"){let y=R(w({},I.variant),{Serial:[{Number:I.variant.Serial.Number,Quantity:1,ExpiryDate:I.variant.Serial.ExpiryDate}]});if(!!J.find(k=>k.ID==y.ID)){let k=y.Serial[0],fe=J.find(pe=>pe.ID==y.ID),At=!!fe.Serial.find(pe=>pe.Number==k.Number)?[...fe.Serial].map(pe=>pe.Number==k.Number?R(w({},pe),{Quantity:pe.Quantity+1}):pe):[...fe.Serial,k];K=J.map(pe=>pe.ID==y.ID?R(w({},pe),{Quantity:pe.Quantity+1,Total:pe.Total+pe.UnitPrice,Serial:At}):pe)}else K=[...J,R(w({},y),{Quantity:1,Total:y.UnitPrice})]}else if(C=="uploadCart")K=[...J,...I.variants];else if(C=="addNewRow"){let y=I.variant;K=[...J,y]}else if(C=="rfid"){let y=I.variants;Object.keys(y).forEach(N=>{if(y.hasOwnProperty(N)){let k=y[N];if(k&&Object.keys(k.variant).length>0){let fe=J.findIndex(Ct=>Ct.Code.toLowerCase()===N.toLowerCase());if(fe!==-1){let Ct=Number(k.count);J[fe].Quantity+=Ct,J[fe].Total=+J[fe].UnitPrice*+J[fe].Quantity,delete y[N],K=[...J]}else{let Ct=k.variant,At=Number(k.count),pe=this.setUnitPrice(Ct),ro=this.formatItemObject(R(w({},pe),{Quantity:At,Total:+pe.UnitPrice*+At}));delete y[N],K=[...J,ro]}}}})}return K},[]),je([]),Z(1)),this.totalVariantOrdered$=this.cart$.pipe(d(c=>c.map(I=>I.Quantity)),d(c=>c.reduce((I,J)=>I+J,0)),je(0))}toastr=le(qe);cartDisplayRef;variantAutocomplete=new ce;variantQuickKey=new ce;_listenRFID=new ge;listenRFID$=this._listenRFID.asObservable().pipe(d(t=>({action:"rfid",variants:t})));_deleteVariant=new ge;deleteVariant$=this._deleteVariant.asObservable().pipe(d(t=>({action:"delete",index:t})));_dragDropCart=new ge;dragDropCart$=this._dragDropCart.asObservable().pipe(d(t=>({action:"sort",ev:t})));_returnCart=new ge;returnCart$=this._returnCart.asObservable().pipe(d(()=>({action:"returnCart"})));_onEditForm=new et(null);onEditForm$=this._onEditForm.asObservable().pipe(V(t=>!!t),d(t=>({action:"onEditForm",variants:t})));_clearCart=new ge;clearCart$=this._clearCart.asObservable().pipe(d(()=>({action:"clearCart"})));_updateVariant=new ge;updateVariant$=this._updateVariant.asObservable().pipe(d(t=>({action:"update",variant:t.variant,index:t.index})));_returnVariant=new ge;returnVariant$=this._returnVariant.asObservable().pipe(d(t=>({action:"returnVariant",index:t})));_purchaseVariant=new ge;purchaseVariant$=this._purchaseVariant.asObservable().pipe(d(t=>({action:"purchaseVariant",index:t})));_addVariant=new ge;addVariant$=this._addVariant.asObservable().pipe(d(t=>({action:"addNewRow",variant:t})));_onUploadCart=new ge;onUploadCart$=this._onUploadCart.asObservable().pipe(d(t=>({action:"uploadCart",variants:t})));cart$;totalVariantOrdered$;_addVariantThroughSerial=new ge;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=w({},t);return S.IsNotEmpty(t.OrderPrice)?e.UnitPrice=t.OrderPrice:e.UnitPrice=t.UnitCost,e}formatItemObject=t=>{let o=t,{ID:e}=o,i=Bi(o,["ID"]);return R(w({},i),{Quantity:i.Quantity??1,Total:i.Total??i.UnitPrice,VariantID:e})};addCartRFID(t){this._listenRFID.next(t)}static \u0275fac=function(e){return new(e||n)(Q(re),Q(H),Q(mt),Q(ee))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};var Ve=class n{_isEdit=new ge;isEdit$;id$;isUnpaid$;dialog=le(ee);constructor(t,e,i,o,s){let T=tt(t.snapshot.queryParams);this.isEdit$=ot(T.pipe(d(C=>!!C.ID)),this._isEdit.asObservable()).pipe(Z(1)),this.id$=T.pipe(V(C=>C.ID),d(C=>C.ID));let _=this.id$.pipe(X(C=>e.post("/api/Buy2/GetDataByID2",{ID:C})),Z(1)),$=dt(()=>o.entities$).pipe(X(C=>_.pipe(d(y=>[y.Order,C]))),E(([C,y])=>{let N={Att:C.Att,SupplierID:{Key:C.SupplierID,Value:C.SupplierName,OnSet:!0},Date:C.Date,Number:C.Number,ID:C.ID};i.setBulkOrderForm(N)}),E(([C,y])=>{let N=y.find(k=>k.ID==C.EntityID);i.setOutletForm(N)})),G=_.pipe(d(C=>C.Items),d(C=>C.map(y=>R(w({},y.Variant),{Quantity:y.Quantity,Total:y.Total,Note:y.Note,UnitPrice:y.UnitPrice,Discount:y.Discount,Serial:y.Serial,ID:y.ID,VariantID:y.VariantID,UnitQuantity:y.UnitQuantity,QtyRequested:y.QtyRequested,DiscountAmount:y.DiscountAmount}))),E(C=>s.editForm(C))),x=dt(()=>o.currencies$).pipe(X(C=>_.pipe(d(y=>[y.Order,C,y.Invoice]))),d(([C,y,N])=>R(w({},C),{Number:C.Number!=N.Number?N.Number:C.Number,Currency:y.find(k=>k.ID===C.CurrencyID)})),E(C=>{let y={Note:C.Note,TagID:C.TypeID,Currency:w({},C.Currency),InvoiceNumber:C.Number};i.setBulkNoteForm(y)})),A=_.pipe(d(C=>C.DeliveryEntityID),E(C=>i.setDeliveryEntityID(C))),c=dt(()=>o.taxes$).pipe(X(C=>_.pipe(d(y=>[y.Order,C]))),d(([C,y])=>R(w({},C),{Taxes:y})),E(C=>{let y=C.Taxes.find(k=>k.ID===C.TaxTypeID);y?.Bin&&this.dialog.open(ei,{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://cdn.dealpos.xyz/web-image/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:ve.Error},width:"31rem"}),(S.IsEmpty(y)||y?.Bin)&&(y=C.Taxes[0],C.TaxTypeID=y.ID);let N={Discount:{Amount:C.DiscountAmount,Percentage:C.Discount},Tax:{ID:C.TaxTypeID,Rate:y?.Rate,CalculationTypeName:y?.CalculationTypeName,Label:y?.Label??y?.Name,Discontinue:y?.Bin}};i.setBulkDiscountAndTaxForm(N)})),I=_.pipe(d(C=>C.Invoice),E(C=>{let y={ID:C.ID,Due:C.Due,Tax:C.Tax};i.setBulkInvoice(y)})),J=this.isEdit$.pipe(X(C=>_.pipe(d(y=>y.Payment),E(y=>{let N={ID:C?y?.ID:S.GuidEmpty,Amount:C?y?.Amount:0,MethodID:y?.MethodID,Note:C?y?.Note:null,Code:y?.Code,ImageUrl:C?y?.ImageUrl:null};N.Amount!==void 0&&i.setBulkPayment(N)}))));this.isUnpaid$=J.pipe(d(C=>S.IsEmpty(C))),Ce($,G,x,A,c,I,J).subscribe()}onNewPurchase(){this._isEdit.next(!1)}static \u0275fac=function(e){return new(e||n)(Q(sn),Q(re),Q(H),Q(de),Q(te))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};var $e=class n{edit=le(Ve);_paymentComplete=new ge;paymentComplete$=this._paymentComplete.asObservable().pipe(Z(1));_createNewTransaction=new et(!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||n)};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};var Xe=class n{quickKeyPack$;cardPayments$;cashPayments$;otherPayments$;updateDefaultTax$;isCashSuspended$;updatePaymentMethodID$;dialog=le(ee);constructor(t,e,i,o,s){let T=e.outlet.valueChanges.pipe(d(x=>x?.ID),Y()),_=T.pipe(Ji(),V(x=>!!x),me(i.isEdit$),X(([x,A])=>t.get("/API/Buy2/GetOutletInfo",[{key:"EntityID",value:x},{key:"IsEdit",value:A}])),Z(1),Y()),$=_.pipe(me(i.isEdit$),V(([x,A])=>!A),d(([x,A])=>x),E(x=>e.setPONumber(x.NumberElement)),Y());this.quickKeyPack$=_.pipe(d(x=>x.QuickKeyPack),Y()),this.updateDefaultTax$=dt(()=>o.taxes$).pipe(X(x=>_.pipe(d(A=>[x,A]))),me(i.isEdit$),V(([[x,A],c])=>!c),d(([[x,A],c])=>[x,A]),E(([x,A])=>{let c=x.find(I=>I.ID==A.DefaultTaxType);c?.Bin&&this.showTaxDiscontinuedDialog(),(S.IsEmpty(c)||c.Bin)&&(c=x.find(I=>!I.Bin)),e.setTax(c)}),Y()),this.updatePaymentMethodID$=_.pipe(me(i.isEdit$),V(([x,A])=>!A),d(([x,A])=>x.Payments),d(x=>{let A=x.filter(c=>c.TypeID==1);return A.length?A:x.filter(c=>c.TypeID==2)}),E(x=>e.setPaymentMethodID(x[0].ID)),Y()),this.cashPayments$=_.pipe(d(x=>x.Payments),d(x=>x.filter(A=>A.TypeID==1)),Y()),this.cardPayments$=_.pipe(d(x=>x.Payments),d(x=>x.filter(A=>A.TypeID==2)),Y()),this.otherPayments$=_.pipe(d(x=>x.Payments),d(x=>x.filter(A=>A.TypeID==4)),Y()),this.isCashSuspended$=_.pipe(d(x=>x.Payments),d(x=>!!x.filter(c=>c.TypeID==1).length),Y()),dt(()=>o.appConfigJSON$).pipe(me(i.isEdit$),V(([x,A])=>!A&&x.ModuleBuy.Shipping.BuyShippingDefault==0),X(()=>Ce(T,s.createNewTransaction$)),E(([x,A])=>e.setDeliveryEntityID(x)),Y()).subscribe(),$.subscribe(),this.updateDefaultTax$.subscribe(),this.updatePaymentMethodID$.subscribe()}showTaxDiscontinuedDialog(){this.dialog.open(ei,{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://cdn.dealpos.xyz/web-image/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:ve.Error},width:"31rem"})}updateTax(){this.updateDefaultTax$.pipe(Ti(1)).subscribe()}updatePaymentMethodID(){this.updatePaymentMethodID$.pipe(Ti(1)).subscribe()}static \u0275fac=function(e){return new(e||n)(Q(re),Q(H),Q(Ve),Q(de),Q($e))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};function so(n,t){if(n&1&&(r(0,"mat-option",7),m(1),a()),n&2){let e=t.$implicit;b("value",e),l(),j(" ",e.Value," ")}}function co(n,t){if(n&1){let e=B();r(0,"i",8),D("click",function(){P(e);let o=p();return O(o.openSupplierDetail())}),a()}}var ri=class n{constructor(t,e,i,o){this.http=t;this.form=e;this.matDialog=i;this.router=o}supplierPOTypes;appConfigJSON;filteredSuppliers$;supplier=new ce("");disabled=!1;onChange=t=>{};onTouched=()=>{};ngOnInit(){this.filteredSuppliers$=this.supplier.valueChanges.pipe(V(i=>typeof i=="string"&&i.length>=3),Wi(300),X(i=>this.http.get("/API/AC/GetSupplierSuggestion",[{key:"count",value:100},{key:"prefix",value:i}]))),this.supplier.valueChanges.pipe(V(i=>typeof i!="string"),d(i=>i),E(i=>i?.Key!=S.GuidEmpty&&S.IsNotEmpty(i)?this.onChange(i.Key):this.onChange(null))).pipe(V(i=>S.IsNotEmpty(i)&&!i.OnSet),X(i=>this.http.post("/API/Contact/GetSupplierDTO",{id:i.Key}).pipe(ye(()=>we))),d(i=>i.DaysDue),V(i=>i!=0),E(i=>this.form.setdueDays(i)),E(i=>this.form.setDueDateBasedOnDaysDue(i))).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(Bn,{data:{options:this.supplierPOTypes,config:this.appConfigJSON.ModuleContact,type:"supplier",title:"New Supplier Form"}}).afterClosed().pipe(V(t=>S.IsNotEmpty(t.supplier.Name)),X(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(d(i=>({Key:i.ID,Value:t.supplier.Name})))})).subscribe(t=>{this.writeValue(t),this.onChange(t.Key)})}openSupplierDetail(){let t=this.supplier.value.Key;if(S.IsNotEmpty(t)){let e=this.router.serializeUrl(this.router.createUrlTree(["/menu/Contacts/Contact/Suppliers/Info"],{queryParams:{ID:t}}));window.open(e,"_blank")}}static \u0275fac=function(e){return new(e||n)(u(re),u(H),u(ee),u(Ht))};static \u0275cmp=F({type:n,selectors:[["POS-supplier-autocomplete"]],inputs:{supplierPOTypes:"supplierPOTypes",appConfigJSON:"appConfigJSON"},features:[Ne([{provide:Ke,multi:!0,useExisting:n}])],decls:8,vars:7,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"],["matTooltipPosition","left","matTooltip","Open Supplier Details",1,"fa-regular","fa-arrow-up-right-from-square","position-absolute",2,"font-size","12px","right","0","cursor","pointer"],[3,"value"],["matTooltipPosition","left","matTooltip","Open Supplier Details",1,"fa-regular","fa-arrow-up-right-from-square","position-absolute",2,"font-size","12px","right","0","cursor","pointer",3,"click"]],template:function(e,i){if(e&1){let o=B();r(0,"div",1)(1,"i",2),D("click",function(){return P(o),O(i.openNewSupplierModal())}),a(),M(2,"input",3),r(3,"mat-autocomplete",4,0),ut(5,so,2,2,"mat-option",5),f(6,"async"),a(),h(7,co,1,0,"i",6),a()}if(e&2){let o=ht(4);l(2),b("formControl",i.supplier)("matAutocomplete",o),l(),b("displayWith",i.displaySupplierNameFn),l(2),b("ngForOf",g(6,5,i.filteredSuppliers$)),l(2),v(i.supplier&&(i.supplier!=null&&i.supplier.value)&&(!(i.supplier==null||i.supplier.value==null)&&i.supplier.value.Key)?7:-1)}},dependencies:[se,on,wn,On,bn,Tn,Ye,be,ae,ze,lt,rt,jn,Ee],styles:["input[_ngcontent-%COMP%]{width:100%;height:38px!important;border-radius:.375rem;border:1px solid #ced4da;padding-left:32px;padding-right:32px}input[_ngcontent-%COMP%]::placeholder{color:#ced4da}i.fa-user-plus[_ngcontent-%COMP%]{font-size:16px;top:10.6px;left:13px}i.fa-arrow-up-right-from-square[_ngcontent-%COMP%]{transform:none;position:absolute;margin-right:13px;top:10.6px;font-size:12px}"]})};var po=["quantity"],Et=n=>({selected:n}),uo=()=>["/menu/Products/Catalog/Variants/Info"],fo=n=>({ID:n}),go=n=>({"table-light":n});function Co(n,t){if(n&1){let e=B();r(0,"a",18),D("click",function(){P(e);let o=p();return O(o.onTabChange("Discount"))}),m(1," Discount "),a()}if(n&2){let e=p();b("ngClass",ie(1,Et,e.tabState=="Discount"))}}function yo(n,t){if(n&1){let e=B();r(0,"a",19),D("click",function(){P(e);let o=p();return O(o.onTabChange("Product"))}),m(1," Product "),a()}if(n&2){let e=p();b("ngClass",ie(1,Et,e.tabState=="Product"))}}function bo(n,t){if(n&1){let e=B();r(0,"a",20),D("click",function(){P(e);let o=p();return O(o.onTabChange("Serial"))}),m(1," Serial "),a()}if(n&2){let e=p();b("ngClass",ie(1,Et,e.tabState=="Serial"))}}function ho(n,t){if(n&1&&(r(0,"div",13)(1,"div",27),M(2,"POS-variant-autocomplete",28),a()()),n&2){let e=p(2);l(2),b("formControl",e.variantAutocomplete)("isOnModalVariant",!0)}}function vo(n,t){if(n&1&&(r(0,"span"),m(1),a()),n&2){let e=p(2);l(),j("(",e.variant.UOMName,")")}}function _o(n,t){if(n&1){let e=B();r(0,"div",23)(1,"strong")(2,"span"),m(3),a()(),r(4,"input",29),W("ngModelChange",function(o){P(e);let s=p(2);return L(s.variant.UnitQuantity,o)||(s.variant.UnitQuantity=o),O(o)}),D("ngModelChange",function(){P(e);let o=p(2);return O(o.onUnitQtyChange())}),a()()}if(n&2){let e=p(2);l(3),z(e.unitQtyLabel),l(),b("preventNegative",!0)("decimalPlaces",e.isSerialItem?0:4),U("ngModel",e.variant.UnitQuantity)}}function Do(n,t){if(n&1){let e=B();r(0,"div",24)(1,"strong"),m(2,"Cost"),a(),r(3,"input",30,1),W("ngModelChange",function(o){P(e);let s=p(2);return L(s.variant.UnitPrice,o)||(s.variant.UnitPrice=o),O(o)}),D("ngModelChange",function(){P(e);let o=p(2);return O(o.onPriceChange())}),a()()}if(n&2){let e=p(2);l(3),b("simpleKeyboard",e.keyboard),U("ngModel",e.variant.UnitPrice)}}function xo(n,t){if(n&1){let e=B();r(0,"div",12),h(1,ho,3,2,"div",13),r(2,"div",13)(3,"div",21)(4,"strong"),m(5," Qty "),h(6,vo,2,1,"span"),a(),r(7,"input",22,0),W("ngModelChange",function(o){P(e);let s=p();return L(s.variant.Quantity,o)||(s.variant.Quantity=o),O(o)}),D("ngModelChange",function(){P(e);let o=p();return O(o.onQtyChange())}),a()(),h(9,_o,5,4,"div",23),h(10,Do,5,2,"div",24),a(),r(11,"div",13)(12,"div",25)(13,"POS-tinymce-editor",26),W("ngModelChange",function(o){P(e);let s=p();return L(s.variant.Note,o)||(s.variant.Note=o),O(o)}),a()()()()}if(n&2){let e=p();l(),v(e.isCreate?1:-1),l(5),v(e.variant.UOMName?6:-1),l(),b("simpleKeyboard",e.keyboard)("decimalPlaces",e.isSerialItem?0:4),U("ngModel",e.variant.Quantity),b("disabled",e.isEditBuyForm&&e.isSerialItem),l(2),v(e.unitQtyLabel?9:-1),l(),v(e.role.product.Cost?10:-1),l(3),U("ngModel",e.variant.Note)}}function So(n,t){if(n&1&&(r(0,"div",44)(1,"div",33)(2,"strong"),m(3,"Discount Amount / Qty"),a()(),r(4,"div",34)(5,"div",46)(6,"p"),m(7),f(8,"number"),a()()()()),n&2){let e=p(2);l(7),z(g(8,1,e.variant.DiscountAmount))}}function Mo(n,t){if(n&1&&(r(0,"div",52)(1,"h5",58),m(2),f(3,"number"),a()()),n&2){let e=p(3);l(2),j(" ",g(3,1,e.variant.Discount),"% ")}}function Io(n,t){if(n&1&&(r(0,"div",53)(1,"h5"),m(2),f(3,"number"),a(),r(4,"span",51),m(5,"x"),a(),r(6,"h5"),m(7),f(8,"number"),a()()),n&2){let e=p(3);l(2),z(g(3,2,e.variant.Quantity)),l(5),z(g(8,4,e.variant.DiscountAmount))}}function Po(n,t){if(n&1&&(r(0,"h5",56),m(1),f(2,"number"),a()),n&2){let e=p(3);l(),j(" -",g(2,1,e.totalBeforeDiscount()*(e.variant.Discount/100))," ")}}function Oo(n,t){if(n&1&&(r(0,"div",55)(1,"h5",56),m(2),f(3,"number"),a()()),n&2){let e=p(3);l(2),j(" -",g(3,1,e.variant.Quantity*e.variant.DiscountAmount)," ")}}function To(n,t){if(n&1&&(r(0,"div",57)(1,"div",59)(2,"h5"),m(3,"Grand Total"),a()(),r(4,"div",59)(5,"h5"),m(6),f(7,"number"),a()()()),n&2){let e=p(3);l(6),z(g(7,1,e.totalAfterDiscount()))}}function wo(n,t){if(n&1&&(r(0,"div",45)(1,"div",47)(2,"h4"),m(3,"Discount Simulation"),a(),r(4,"h4",48),m(5),a()(),r(6,"div",49)(7,"div",33)(8,"div",50)(9,"h5"),m(10),f(11,"number"),a(),r(12,"span",51),m(13,"x"),a(),r(14,"h5"),m(15),f(16,"number"),a()(),h(17,Mo,4,3,"div",52),h(18,Io,9,6,"div",53),a(),r(19,"div",33)(20,"div",54)(21,"h5"),m(22),f(23,"number"),a()(),r(24,"div",55),h(25,Po,3,3,"h5",56),a(),h(26,Oo,4,3,"div",55),a(),h(27,To,8,3,"div",57),a()()),n&2){let e=p(2);l(5),j(" ",e.variant==null?null:e.variant.Name," "),l(5),z(g(11,9,e.variant.Quantity)),l(5),z(g(16,11,e.variant.UnitPrice)),l(2),v(e.variant.Discount?17:-1),l(),v(e.variant.DiscountAmount>0?18:-1),l(4),z(g(23,13,e.totalBeforeDiscount())),l(3),v(e.variant.Discount?25:-1),l(),v(e.variant.DiscountAmount>0?26:-1),l(),v(e.variant.DiscountAmount>0||e.variant.Discount>0?27:-1)}}function No(n,t){if(n&1){let e=B();r(0,"div",13)(1,"div",31)(2,"div",32)(3,"div",33)(4,"strong"),m(5,"Discount %"),a()(),r(6,"div",34)(7,"input",35,2),W("ngModelChange",function(o){P(e);let s=p();return L(s.variant.Discount,o)||(s.variant.Discount=o),O(o)}),D("ngModelChange",function(){P(e);let o=p();return O(o.onDiscountChange())}),a()()(),r(9,"div",36)(10,"div",33)(11,"strong"),m(12,"Discount Amount"),a()(),r(13,"div",34)(14,"input",37,2),W("ngModelChange",function(o){P(e);let s=p();return L(s.inputedDiscountAmount,o)||(s.inputedDiscountAmount=o),O(o)}),D("ngModelChange",function(o){P(e);let s=p();return O(s.onDiscountAmountChange(o))}),a()()(),r(16,"div",38)(17,"div",39)(18,"input",40),W("ngModelChange",function(o){P(e);let s=p();return L(s.isDiscMultipliciedQty,o)||(s.isDiscMultipliciedQty=o),O(o)}),D("ngModelChange",function(){P(e);let o=p();return O(o.onSwitchDiscountTypeChange())}),a()(),r(19,"div",41)(20,"strong"),m(21,"*Quantity"),a(),r(22,"span",42),M(23,"i",43),a()()(),h(24,So,9,3,"div",44),a(),h(25,wo,28,15,"div",45),a()}if(n&2){let e=p();l(7),b("simpleKeyboard",e.keyboard),U("ngModel",e.variant.Discount),b("min",0)("readonly",!e.role.sell.Discount),l(7),b("simpleKeyboard",e.keyboard),U("ngModel",e.inputedDiscountAmount),b("max",e.variant.UnitPrice*e.variant.Quantity)("min",0)("readonly",!e.role.sell.Discount),l(4),U("ngModel",e.isDiscMultipliciedQty),l(6),v(e.isDiscMultipliciedQty()?-1:24),l(),v(e.role.product.Cost?25:-1)}}function Eo(n,t){n&1&&(M(0,"i",65),r(1,"h6"),m(2,"No Image"),a())}function Fo(n,t){if(n&1&&M(0,"img",62),n&2){let e=p(2);b("src",e.variant.ThumbnailUrl,at)}}function Ao(n,t){if(n&1){let e=B();r(0,"button",78),D("click",function(){P(e);let o=p(),s=p(2);return O(s.setQuantityToMax(o))}),m(1," Place Order "),a()}}function ko(n,t){if(n&1&&(r(0,"tbody")(1,"tr")(2,"th",66),M(3,"i",67),m(4,"Inventory "),a(),r(5,"th",66),M(6,"i",68),m(7),a(),r(8,"th",66),M(9,"i",69),m(10," Diff "),a(),r(11,"th",66),M(12,"i",70),m(13," Action "),a()(),r(14,"tr")(15,"th",71),m(16,"On Hand"),a(),r(17,"td",72),m(18),f(19,"number"),a(),M(20,"td",73)(21,"td",74),a(),r(22,"tr")(23,"th",71),m(24,"Allocated"),a(),r(25,"td",72),m(26),f(27,"number"),a()(),r(28,"tr")(29,"th",71),m(30,"Available"),a(),r(31,"td",72),m(32),f(33,"number"),a()(),r(34,"tr")(35,"th",71),m(36,"ROP"),a(),r(37,"td",72),m(38),f(39,"number"),a(),r(40,"td",56),m(41),f(42,"number"),a()(),r(43,"tr")(44,"th",71),m(45,"Max"),a(),r(46,"td",72),m(47),f(48,"number"),a(),r(49,"td",75),m(50),f(51,"number"),a(),r(52,"td",76),h(53,Ao,2,0,"button",77),a()()()),n&2){let e=t,i=p(2);l(7),j("",i.outletName," "),l(11),j(" ",g(19,12,e.onHand)," "),l(8),j(" ",g(27,14,e.allocated)," "),l(6),j(" ",g(33,16,e.onHand-e.allocated)," "),l(6),j(" ",g(39,18,e.rop)," "),l(3),He(" ",e.ropDiff>=0?"+":"","",g(42,20,e.ropDiff)," "),l(6),j(" ",g(48,22,e.max)," "),l(3),He(" ",e.maxDiff>=0?"+":"","",g(51,24,e.maxDiff)," "),l(2),b("ngClass",ie(26,go,i.variant.Quantity==e.max-e.onHand-e.allocated)),l(),v(i.variant.Quantity!=e.max-e.onHand-e.allocated?53:-1)}}function Vo(n,t){if(n&1&&(r(0,"div",14)(1,"div",60)(2,"a",61),h(3,Eo,3,0)(4,Fo,1,1,"img",62),a()(),r(5,"div",63)(6,"table",64),h(7,ko,54,28,"tbody"),f(8,"async"),a()()()),n&2){let e,i=p();l(2),b("routerLink",Ut(6,uo))("queryParams",ie(7,fo,i.variant==null?null:i.variant.ID)),l(),v((i.variant==null?null:i.variant.ThumbnailUrl)==null?3:4),l(4),v((e=g(8,4,i.variantStock$))?7:-1,e)}}function $o(n,t){if(n&1){let e=B();r(0,"POS-tab-serial",79),W("variantChange",function(o){P(e);let s=p();return L(s.variant,o)||(s.variant=o),O(o)})("isFocusOnSerialInputChange",function(o){P(e);let s=p();return L(s.isFocusOnSerialInput,o)||(s.isFocusOnSerialInput=o),O(o)})("serialsChange",function(o){P(e);let s=p();return L(s.serials,o)||(s.serials=o),O(o)}),a()}if(n&2){let e=p();b("disabledEditQty",e.isEditBuyForm)("outletID",e.outletID),U("variant",e.variant)("isFocusOnSerialInput",e.isFocusOnSerialInput)("serials",e.serials)}}var pt=class n{constructor(t,e,i,o,s,T){this.dialogRef=t;this.http=i;this.role=o;this.toastr=T;this.config=new Ie,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.isEdit,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 G=this.variantAutocomplete.valueChanges.pipe(V(c=>c.type=="Code"),d(c=>c.str),X(c=>i.get(Ae.GetVariantByCode,[{key:"Code",value:c},{key:"EntityID",value:this.outletID},{key:"Promotion",value:!0}]).pipe(ye(()=>we))),d(c=>this.setUnitPrice(c)),d(c=>R(w({},c),{Quantity:$,Total:c.UnitPrice,Discount:c.PriceDiscount}))),x=this.variantAutocomplete.valueChanges.pipe(V(c=>c.type=="ID"),d(c=>c.str),X(c=>i.get(Ae.GetVariantByID,[{key:"ID",value:c},{key:"EntityID",value:this.outletID},{key:"Promotion",value:!1}]).pipe(ye(()=>we))),d(c=>this.setUnitPrice(c)),d(c=>R(w({},c),{Quantity:$,Total:c.UnitPrice,Discount:c.PriceDiscount})));ot(G,x).pipe(E(c=>this.setFocusField("quantity")),Z(1)).subscribe(c=>{this.variant=c,this.isSerialItem=this.variant.TypeID==4,this.showInventory=!0,this.variantStock$=this.getOnInventory(),this.inputedDiscountAmount.set(this.variant.DiscountAmount),this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount()})}}calculatorTab=Jt(ni);variantAutocomplete=new ce;_quantityElement;variant;variantStock$=we;isSerialItem=!1;outletID;outletName;appConfigJSON;numpadVisible;keyboard;isEditBuyForm=!1;unitQtyLabel;config;tabState="Cart";isCreate=!1;showInventory=!1;serials=[];isFocusOnSerialInput=!1;_onGetInventory=new et(void 0);onGetInventory$=this._onGetInventory.asObservable();isDiscMultipliciedQty=Le(!0);totalBeforeDiscount=Le(0);totalAfterDiscount=Le(0);inputedDiscountAmount=Le(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(),i=t-e;this.totalAfterDiscount.set(i)}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 i=this.serials.map(o=>({Quantity:1,Number:o}));this.variant.Serial=[...this.variant.Serial,...i]}let t=this.variant.Serial?.map(i=>i.Quantity).reduce((i,o)=>i+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(w({},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(Gi((t,e)=>t?tt(t):this.http.get(Ae.GetVariantStockByID,[{key:"ID",value:this.variant.ID},{key:"EntityID",value:this.outletID}]).pipe(d(i=>{let o=i.OnHand-i.Allocated;return{onHand:i.OnHand,allocated:i.Allocated,rop:i.ROP,max:i.Max,maxDiff:i.Max-i.OnHand-o,ropDiff:i.ROP-i.OnHand-o}})),null),d(t=>t),Z(1))}setUnitPrice(t){let e=w({},t);return S.IsNotEmpty(t.OrderPrice)?e.UnitPrice=t.OrderPrice:e.UnitPrice=t.UnitCost,e}static \u0275fac=function(e){return new(e||n)(u(Me),u(Fe),u(re),u(he),u($n),u(qe))};static \u0275cmp=F({type:n,selectors:[["POS-modal-variant"]],viewQuery:function(e,i){if(e&1&&(Lt(i.calculatorTab,ni,5),Rt(po,5)),e&2){Qt();let o;Bt(o=jt())&&(i._quantityElement=o.first)}},decls:19,vars:20,consts:[["quantity",""],["price",""],["discount",""],[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"],["data-cy","discount",1,"btn","btn-link",3,"ngClass"],["data-cy","product",1,"btn","btn-link",3,"ngClass"],["data-cy","serial",1,"btn","btn-link",3,"ngClass"],["data-cy","calculator",1,"btn","btn-link",3,"click","ngClass"],[1,"mx-8"],[1,"py-8"],[1,"row"],[1,"row","py-8"],[3,"disabledEditQty","outletID","variant","isFocusOnSerialInput","serials"],[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,"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"],[1,"col-auto","pe-0",2,"width","82px"],[1,"col-auto","pe-0",2,"width","112px"],[1,"col","tinymce"],["height","210px",3,"ngModelChange","ngModel"],[1,"col"],[3,"formControl","isOnModalVariant"],["type","text","autoNum","",1,"form-control","input-numpad",2,"height","38px",3,"ngModelChange","preventNegative","decimalPlaces","ngModel"],["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"],[1,"col-6","py-8"],[1,"border","ps-6",2,"height","38px","padding-top","10px","width","112px","background-color","#e9ecef"],[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,"d-flex","align-items-center","justify-content-end","mt-2"],[1,"d-flex","align-items-center","justify-content-end","mt-2","text-danger"],[1,"w-100","d-flex","justify-content-end"],[1,"w-100","d-flex","justify-content-end","mt-2"],[1,"text-danger"],[1,"row","border-top","mx-0","px-0","mt-4"],[1,"fw-bold","text-danger"],[1,"col-6","d-flex","justify-content-end","mt-4"],[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"],[1,"border","rounded",3,"src"],[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,"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"],["type","button","matTooltipPosition","above","matTooltip","Adjust Bought Qty to max Inventory",1,"btn","btn-success","btn-sm","me-2",2,"font-size","12px"],["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","disabledEditQty","outletID","variant","isFocusOnSerialInput","serials"]],template:function(e,i){e&1&&(r(0,"modal-material",3),D("onOk",function(){return i.ok()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"div",4)(3,"div",5)(4,"div")(5,"a",6),D("click",function(){return i.onTabChange("Cart")}),m(6," Cart "),a(),h(7,Co,2,3,"a",7),h(8,yo,2,3,"a",8),h(9,bo,2,3,"a",9),r(10,"a",10),D("click",function(){return i.onTabChange("Calculator")}),m(11," Calculator "),a()()(),r(12,"div",11),h(13,xo,14,9,"div",12),h(14,No,26,12,"div",13),h(15,Vo,9,9,"div",14),h(16,$o,1,5,"POS-tab-serial",15),r(17,"div",16)(18,"item-calculator-tab",17),D("discountTotal",function(s){return i.variant.Discount=s,i.onDiscountChange()})("priceTotal",function(s){return i.variant.UnitPrice=s,i.onPriceChange()})("qtyTotal",function(s){return i.variant.Quantity=s,i.onQtyChange()})("noteChanges",function(s){return i.variant.Note=s}),a()()()()()()),e&2&&(b("config",i.config),l(5),b("ngClass",ie(16,Et,i.tabState=="Cart")),l(2),v(!i.isCreate||i.showInventory?7:-1),l(),v(!i.isCreate||i.showInventory?8:-1),l(),v(i.isSerialItem?9:-1),l(),b("ngClass",ie(18,Et,i.tabState=="Calculator")),l(3),v(i.tabState=="Cart"?13:-1),l(),v(i.tabState=="Discount"?14:-1),l(),v(i.tabState=="Product"?15:-1),l(),v(i.tabState=="Serial"?16:-1),l(),b("hidden",i.tabState!="Calculator"),l(),b("price",i.variant.UnitPrice)("discount",i.variant.Discount)("quantity",i.variant.Quantity)("notes",i.variant.Note)("variantName",i.variant==null?null:i.variant.Name))},dependencies:[se,Ge,ii,ti,Se,be,un,ae,xe,Dt,Oe,Pe,st,ct,Nn,qt,Gt,Wn,Rn,oi,Ye,ze,Zn,ni,Ee,De],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 Mt=class n extends eo{connection;_Data=new ji(1);Data=this._Data.asObservable();httpService=le(re);toastService=le(qe);_cache=new Map;previousCountByEpc={};_isConnected=new et(!1);isConnected=this._isConnected.asObservable();_bufferTime=new et(100);set bufferTime(t){this._bufferTime.next(t)}get bufferTime(){return this._bufferTime.getValue()}intializeWebSocket(t="/"){return yt(this,null,function*(){if(t.length<=0){this.toastService.error("RFID URL cannot be empty",ve.Error);return}if(!(this.connection&&this.connection.state===pn.Connected)){this.connection=new dn().withUrl(t).configureLogging(mn.Information).withAutomaticReconnect().build();try{yield this.connection.start(),yield this.initiateGroupSubscription(),this.onWebSocketMessageReceived(),this._isConnected.next(!0),this.toastService.success("RFID Connected",ve.Success)}catch(e){throw this._isConnected.next(!1),this.toastService.error(JSON.stringify(e),ve.Error),new Error(JSON.stringify(e))}}})}initiateGroupSubscription(){return yt(this,null,function*(){try{yield this.connection.invoke("SubscribeGroup",{CurrentID:"Buy"})}catch(t){throw this.toastService.error(JSON.stringify(t),ve.Error),new Error(JSON.stringify(t))}})}onWebSocketMessageReceived(){this.connection.on("ReceiveSignal",t=>{this._Data.next(t)})}getVariantByCode(t,e=S.GuidEmpty){let i=[{key:"Code",value:t},{key:"EntityID",value:e}];return this.httpService.get(Ae.GetVariantByCode,i).pipe(ye(o=>o instanceof ln?tt(null):Qi(()=>new Error(o.message))))}processGroupedData(t=S.GuidEmpty){return this._Data.pipe(V(e=>e!==null&&e&&Object.keys(e).length>0),Ui(this._bufferTime.getValue()),Oi(e=>Li(e)),Hi(e=>e.epc),Oi(e=>e.pipe(Tt((i,o)=>[...i,o],[]),X(i=>{let o=e.key;if(this._cache.has(o))return this._cache.get(o).pipe(d(s=>({epc:o,items:i,response:s})));{let s=this.getVariantByCode(o,t).pipe(V(T=>T),E(T=>this._cache.set(o,tt(T))));return this._cache.set(o,s),s.pipe(d(T=>({epc:o,items:i,response:T})))}}))),Tt((e,i)=>{let o=this.previousCountByEpc&&this.previousCountByEpc[i.epc]||0,s=i.items.length,T=s-o;return e[i.epc]={data:i.items,count:T,variant:i.response},this.previousCountByEpc[i.epc]=s,e},{}),Z({bufferSize:1,refCount:!0}))}constructor(){super(),this.connection&&(this.connection.onclose=t=>yt(this,null,function*(){console.error("SignalR connection closed:",t)}),this.connection.onreconnecting=t=>yt(this,null,function*(){console.warn("SignalR reconnecting:",t)}),this.connection.onreconnected=t=>yt(this,null,function*(){console.log("SignalR reconnected:",t)}))}static \u0275fac=function(e){return new(e||n)};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};function Bo(n,t){if(n&1&&(r(0,"td",7),m(1),a()),n&2){let e=p().$index;l(),j(" ",e+1,". ")}}function jo(n,t){if(n&1&&(r(0,"div",10),M(1,"img",21),a()),n&2){let e=p().$implicit;l(),b("src",e.ThumbnailUrl,at)}}function Lo(n,t){n&1&&(r(0,"div",11),M(1,"i",22),a())}function Qo(n,t){if(n&1&&(r(0,"span"),m(1),f(2,"quantityFraction"),a()),n&2){let e=p().$implicit;l(),z(g(2,1,e.Quantity))}}function Uo(n,t){n&1&&(r(0,"span",17),m(1," x "),a())}function Wo(n,t){if(n&1&&(r(0,"span"),m(1),f(2,"number"),a()),n&2){let e=p().$implicit;l(),z(g(2,1,e.UnitQuantity))}}function Jo(n,t){n&1&&(r(0,"span",17),m(1," x "),a())}function Ho(n,t){if(n&1&&(r(0,"span"),m(1),f(2,"number"),a()),n&2){let e=p().$implicit;l(),z(g(2,1,e.UnitPrice))}}function Go(n,t){if(n&1&&(r(0,"div"),m(1),f(2,"number"),a()),n&2){let e=p().$implicit;l(),j("-",g(2,1,e.Discount),"%")}}function qo(n,t){if(n&1&&(r(0,"div"),m(1),f(2,"number"),a()),n&2){let e=p().$implicit;l(),j("-",g(2,1,e.DiscountAmount))}}function Ko(n,t){if(n&1&&(m(0),f(1,"number")),n&2){let e=p().$implicit;j(" ",g(1,1,e.Total)," ")}}function zo(n,t){n&1&&m(0," - ")}function Yo(n,t){if(n&1){let e=B();r(0,"tr",6),D("contextmenu",function(){let o=P(e).$index,s=p(2);return O(s.onContextMenu(o))})("click",function(){let o=P(e),s=o.$implicit,T=o.$index,_=p(2);return O(_.update(s,T))}),h(1,Bo,2,1,"td",7),r(2,"td",8)(3,"div",9),h(4,jo,2,1,"div",10)(5,Lo,2,0,"div",11),r(6,"div",12)(7,"div"),m(8),a(),r(9,"span",13),m(10),a(),M(11,"app-serial-note",14)(12,"small",15),a()()(),r(13,"td",16)(14,"span"),h(15,Qo,3,3,"span"),h(16,Uo,2,0,"span",17),h(17,Wo,3,3,"span"),h(18,Jo,2,0,"span",17),h(19,Ho,3,3,"span"),a()(),r(20,"td",18),h(21,Go,3,3,"div"),h(22,qo,3,3,"div"),a(),r(23,"td",16),h(24,Ko,2,3)(25,zo,1,0),a(),r(26,"td",19)(27,"i",20),D("click",function(){let o=P(e).$index,s=p(2);return O(s.deleteVariant(o))}),a()()()}if(n&2){let e=t.$implicit,i=p(2);b("cdkDragDisabled",!i.enabledDragDrop),l(),v(i.appConfigJSON!=null&&i.appConfigJSON.ModuleBuy.Grid.RowNumberVisible?1:-1),l(),vt("ps-0",i.appConfigJSON==null?null:i.appConfigJSON.ModuleBuy.Grid.RowNumberVisible),l(2),v(e.ThumbnailUrl?4:5),l(4),z(e.Name),l(2),z(e.Code),l(),b("serials",e.Serial),l(),b("innerHtml",e.Note,qi),l(3),v(e.Quantity!=1||e.UnitQuantity>1?15:-1),l(),v(e.UnitQuantity>1||e.UnitQuantity<=-1?16:-1),l(),v(e.UnitQuantity>1||e.UnitQuantity<=-1?17:-1),l(),v((e.Quantity>1||e.Quantity<=-1)&&i.role.product.Cost?18:-1),l(),v((e.Quantity>1||e.Quantity<=-1||e.Discount>0||e.DiscountAmount>0)&&i.role.product.Cost?19:-1),l(2),v(e.Discount?21:-1),l(),v(e.DiscountAmount?22:-1),l(2),v(i.role.product.Cost?24:25)}}function Xo(n,t){if(n&1){let e=B();r(0,"div",1)(1,"table",3)(2,"tbody",4),D("cdkDropListDropped",function(o){P(e);let s=p();return O(s.drop(o))}),Ue(3,Yo,28,17,"tr",5,Qe),a()()()}if(n&2){let e=p(),i=ht(3);b("cdkContextMenuTriggerFor",i),l(3),We(e.cart)}}function Zo(n,t){n&1&&(r(0,"div",2)(1,"div",23)(2,"div",24)(3,"div",25)(4,"div",26),M(5,"i",27),a(),r(6,"div",28)(7,"span"),m(8,"Empty Cart"),a(),M(9,"br"),r(10,"span"),m(11,"Add products to the cart"),a(),M(12,"br"),r(13,"span"),m(14,"or scan barcode"),a()()()()()())}function ea(n,t){if(n&1){let e=B();r(0,"button",31),D("click",function(){P(e);let o=p(2);return O(o.onReturn())}),m(1," Return "),a()}}function ta(n,t){if(n&1){let e=B();r(0,"div",29),h(1,ea,2,0,"button",30),r(2,"button",31),D("click",function(){P(e);let o=p();return O(o.onPurchase())}),m(3," Purchase "),a()()}if(n&2){let e=p();l(),v(e.role.sell.Return?1:-1)}}var li=class n{constructor(t,e,i,o,s,T){this.cartService=t;this.matDialog=e;this.role=i;this.form=o;this.sf=T}cart=[];appConfigJSON;isEdit;outletID;outletName;RFIDService=le(Mt);outletService=le(H);enabledDragDrop=!0;onOpenContextMenuIndex=-1;ngOnInit(){this.initDragDropEnabled(),this.outletService.outlet.valueChanges.pipe(X(t=>this.RFIDService.processGroupedData(t.ID)),E(t=>this.cartService.addCartRFID(t))).subscribe()}initDragDropEnabled(){S.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 i=w({},t);this.matDialog.open(pt,{data:{variant:i,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||n)(u(te),u(ee),u(he),u(H),u(Zt),u(Nt))};static \u0275cmp=F({type:n,selectors:[["POS-cart-display"]],inputs:{cart:"cart",appConfigJSON:"appConfigJSON",isEdit:"isEdit",outletID:"outletID",outletName:"outletName"},decls:4,vars:1,consts:[["context_menu",""],[3,"cdkContextMenuTriggerFor"],[1,"row","g-0","h-100"],[1,"table","table-borderless"],["cdkDropList","",3,"cdkDropListDropped"],["cdkDrag","",1,"border-bottom",3,"cdkDragDisabled"],["cdkDrag","",1,"border-bottom",3,"contextmenu","click","cdkDragDisabled"],[2,"width","10px"],[2,"width","50%"],[1,"d-flex"],[1,"ratio","ratio-1x1",2,"width","55px"],[1,"item-image","d-flex","justify-content-center","align-items-center","text-center","fs-1"],[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"],[1,"fs-6"],[1,"text-end","text-danger"],[1,"text-end",2,"width","75px"],[1,"fa-solid","fa-trash","fs-4","text-danger","pointer",3,"click"],[1,"item-image",3,"src"],[1,"fa-solid","fa-image",2,"color","#b4b4b4c2"],[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"],["cdkMenuItem","",1,"example-menu-item"],["cdkMenuItem","",1,"example-menu-item",3,"click"]],template:function(e,i){e&1&&(h(0,Xo,5,1,"div",1)(1,Zo,15,0,"div",2),ut(2,ta,4,1,"ng-template",null,0,Wt)),e&2&&v(i.cart.length?0:1)},dependencies:[se,Mn,Sn,xn,Xn,zn,Kn,Yn,Vn,De,Yt],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 si=class n{constructor(t,e){this.dialogRef=t;this.data=e;this.config.title="Return",this.invoiceNumber=e.invoiceNumber}config=new Ie;invoiceNumber;ok(){this.dialogRef.close(this.invoiceNumber)}static \u0275fac=function(e){return new(e||n)(u(Me),u(Fe))};static \u0275cmp=F({type:n,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,i){e&1&&(r(0,"modal-material",0),D("onOk",function(){return i.ok()})("onCancel",function(){return i.dialogRef.close()})("onClose",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1)(3,"input",2),W("ngModelChange",function(s){return L(i.invoiceNumber,s)||(i.invoiceNumber=s),s}),a(),r(4,"label",3),m(5,"Supplier Bill"),a()()()()),e&2&&(b("config",i.config),l(3),U("ngModel",i.invoiceNumber))},dependencies:[Se,be,ae,xe,Oe,Pe],encapsulation:2})};var ci=class n{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(si,{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||n)(u(ee))};static \u0275cmp=F({type:n,selectors:[["POS-return-invoice"]],features:[Ne([{provide:Ke,multi:!0,useExisting:n}])],decls:1,vars:0,consts:[["icon","fa-solid fa-file-invoice","label","Return Bill",3,"click"]],template:function(e,i){e&1&&(r(0,"POS-dropdown-item-more-action",0),D("click",function(){return i.openModalReturnInvoice()}),a())},dependencies:[zt,ke],encapsulation:2})};var mi=class n{constructor(t){this.cart=t}returnCart(){this.cart.returnCart()}static \u0275fac=function(e){return new(e||n)(u(te))};static \u0275cmp=F({type:n,selectors:[["POS-return-cart"]],decls:1,vars:0,consts:[["icon","fa-cart-shopping fa-solid","label","Return Cart",3,"click"]],template:function(e,i){e&1&&(r(0,"POS-dropdown-item-more-action",0),D("click",function(){return i.returnCart()}),a())},dependencies:[ke],encapsulation:2})};var pi=class n{constructor(t){this.cart=t}clearCart(){this.cart.clearCart()}static \u0275fac=function(e){return new(e||n)(u(te))};static \u0275cmp=F({type:n,selectors:[["POS-clear-cart"]],decls:1,vars:0,consts:[["icon","fa-trash fa-solid","label","Clear",3,"click"]],template:function(e,i){e&1&&(r(0,"POS-dropdown-item-more-action",0),D("click",function(){return i.clearCart()}),a())},dependencies:[ke],encapsulation:2})};var di=class n{constructor(t,e){this.matDialog=t;this.cart=e}appConfigJSON;isEditBuyForm;outletID;outletName;addVariant(){this.matDialog.open(pt,{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||n)(u(ee),u(te))};static \u0275cmp=F({type:n,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,i){e&1&&(r(0,"POS-dropdown-item-more-action",0),D("click",function(){return i.addVariant()}),a())},dependencies:[ke],encapsulation:2})};var ui=class n{constructor(t,e){this.matDialog=t;this.cart=e}outletID;uploadCart(){this.matDialog.open(Jn,{data:{sampleUrl:cn.files.csv.buy_import,outletID:this.outletID,fileEndpoint:"/API/Buy/UploadCsvV2",useUppy:!0}}).afterClosed().pipe(V(t=>!!t),d(t=>t.map(e=>R(w({},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||n)(u(ee),u(te))};static \u0275cmp=F({type:n,selectors:[["POS-upload-cart"]],inputs:{outletID:"outletID"},decls:1,vars:0,consts:[["icon","fa-upload fa-solid","label","Upload",3,"click"]],template:function(e,i){e&1&&(r(0,"POS-dropdown-item-more-action",0),D("click",function(){return i.uploadCart()}),a())},dependencies:[ke],encapsulation:2})};var ia=["serialInput"],fi=class n{constructor(t,e,i){this.dialogRef=t;this.toastr=e;this.cart=i;this.modalConfig.title="Scan Serial",this.modalConfig.customWidth="350px",this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0}serialInputEl;modalConfig=new Ie;serial;ngOnInit(){}onKeyDown(t){t.key=="Enter"&&(S.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||n)(u(Me),u(qe),u(te))};static \u0275cmp=F({type:n,selectors:[["POS-modal-scan-serial"]],viewQuery:function(e,i){if(e&1&&Rt(ia,5),e&2){let o;Bt(o=jt())&&(i.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,i){if(e&1){let o=B();r(0,"modal-material",1),D("onClose",function(){return P(o),O(i.dialogRef.close())}),r(1,"content")(2,"div",2)(3,"input",3,0),W("ngModelChange",function(T){return P(o),L(i.serial,T)||(i.serial=T),O(T)}),D("keydown",function(T){return P(o),O(i.onKeyDown(T))}),a(),r(5,"span",4),M(6,"i",5),a()()()()}e&2&&(b("config",i.modalConfig),l(3),U("ngModel",i.serial))},dependencies:[Se,be,ae,xe,Oe,Pe],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 gi=class n{constructor(t,e){this.matDialog=t;this.viewContainerRef=e}scanSerial(){this.matDialog.open(fi,{viewContainerRef:this.viewContainerRef})}static \u0275fac=function(e){return new(e||n)(u(ee),u(Yi))};static \u0275cmp=F({type:n,selectors:[["POS-scan-serial"]],decls:1,vars:0,consts:[["icon","fa-barcode-read fa-solid","label","Serial",3,"click"]],template:function(e,i){e&1&&(r(0,"POS-dropdown-item-more-action",0),D("click",function(){return i.scanSerial()}),a())},dependencies:[ke],encapsulation:2})};var na=n=>({disabled:n}),oa=(n,t)=>({red:n,green:t}),Ci=class n{RFIDService=le(Mt);matDialog=le(ee);constructor(){}onOpenModal(){this.matDialog.open(to).componentInstance.onOK.pipe(An("onPayload"),E(({hostURL:e,bufferTime:i})=>{this.RFIDService.bufferTime=i,this.RFIDService.intializeWebSocket(e)}),Z(1)).subscribe()}ngOnInit(){}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=F({type:n,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,i){e&1&&(r(0,"div",0),f(1,"async"),D("click",function(){return i.onOpenModal()}),M(2,"i",1),r(3,"label",2),m(4,"Connect RFID"),a(),M(5,"div",3),f(6,"async"),f(7,"async"),a()),e&2&&(b("ngClass",ie(8,na,g(1,2,i.RFIDService.isConnected))),l(5),b("ngClass",_t(10,oa,!g(6,4,i.RFIDService.isConnected),g(7,6,i.RFIDService.isConnected))))},dependencies:[se,Ge,Ee],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 aa(n,t){n&1&&(r(0,"li",10),M(1,"POS-return-cart"),a())}function ra(n,t){if(n&1&&(r(0,"li",10),M(1,"POS-return-invoice",14),a()),n&2){let e=p(2);l(),b("formControl",e.returnInvoiceNumber)}}function la(n,t){if(n&1&&(r(0,"div",7)(1,"div",8),m(2,"Order"),a(),M(3,"div",9),h(4,aa,2,0,"li",10),h(5,ra,2,1,"li",10),a()),n&2){let e=p();l(4),v(e.role.sell.Return?4:-1),l(),v(e.role.sell.Return?5:-1)}}var yi=class n{constructor(t,e,i){this.role=t;this.matDialog=e;this.cart=i}returnInvoiceNumber=new ce("");appConfigJSON;isEditBuyForm;outletID;outletName;handleKeyboardEvent(t){t.key==="F4"&&this.matDialog.openDialogs.length===0&&this.addVariant()}addVariant(){this.matDialog.open(pt,{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||n)(u(he),u(ee),u(te))};static \u0275cmp=F({type:n,selectors:[["POS-more-actions"]],hostBindings:function(e,i){e&1&&D("keydown",function(s){return i.handleKeyboardEvent(s)},Ki)},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"],[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"],[3,"formControl"]],template:function(e,i){e&1&&(r(0,"span",0)(1,"span",1),M(2,"i",2),a(),r(3,"span",3),m(4,"More Actions"),a()(),r(5,"div",4)(6,"div",5)(7,"div",6),h(8,la,6,2,"div",7),r(9,"div",7)(10,"div",8),m(11,"Item"),a(),M(12,"div",9),r(13,"li",10),M(14,"POS-add-variant",11),a(),r(15,"li",10),M(16,"POS-scan-serial"),a(),r(17,"li",10),M(18,"POS-upload-cart",12),a(),r(19,"li",10),M(20,"POS-clear-cart"),a()(),r(21,"div",7)(22,"div",8),m(23,"Advanced"),a(),M(24,"div",9),r(25,"li",13),M(26,"pos-rfid-buy-action"),a()()()()()),e&2&&(l(8),v(i.role.sell.Return?8:-1),l(6),b("appConfigJSON",i.appConfigJSON)("isEditBuyForm",i.isEditBuyForm)("outletID",i.outletID)("outletName",i.outletName),l(4),b("outletID",i.outletID))},dependencies:[Ye,ae,ze,ci,mi,pi,di,ui,gi,Ci],encapsulation:2})};var bi=class n{constructor(t,e){this.dialogRef=t;this.config.title="Discount and Tax",this.config.customWidth="400px";let i=e.discount;this.discountAmount=i.Amount,this.discountPercentage=i.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 Ie;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||n)(u(Me),u(Fe))};static \u0275cmp=F({type:n,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,i){e&1&&(r(0,"modal-material",0),D("keydown.F2",function(){return i.ok()})("onOk",function(){return i.ok()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"div",1)(3,"custom-tabs"),Vt(4),r(5,"tab",2)(6,"div",3)(7,"div",4)(8,"label",5),m(9,"Discount %"),a()(),r(10,"div",6)(11,"input",7),W("ngModelChange",function(s){return L(i.discountPercentage,s)||(i.discountPercentage=s),s}),a(),r(12,"span",8),m(13,"%"),a()()(),r(14,"div",9)(15,"div",4)(16,"label",5),m(17),a()(),r(18,"div",6)(19,"input",10),W("ngModelChange",function(s){return L(i.discountAmount,s)||(i.discountAmount=s),s}),a()()()(),$t(),Vt(20),r(21,"tab",11)(22,"div",3)(23,"div",4)(24,"label",5),m(25,"Tax"),a()(),r(26,"div",6)(27,"ng-select",12),D("change",function(s){return i.updateTax(s)}),a()()()(),$t(),Vt(28),r(29,"tab",13)(30,"div",14)(31,"div",15)(32,"label",5),m(33,"Discount Calculator"),a()(),r(34,"div",16)(35,"input",17),W("ngModelChange",function(s){return L(i.discounts[0],s)||(i.discounts[0]=s),s}),D("ngModelChange",function(){return i.calculateDiscountCalculator()}),a(),r(36,"span"),m(37," %"),a(),r(38,"span",18),m(39,"+"),a(),r(40,"input",19),W("ngModelChange",function(s){return L(i.discounts[1],s)||(i.discounts[1]=s),s}),D("ngModelChange",function(){return i.calculateDiscountCalculator()}),a(),r(41,"span"),m(42," %"),a(),r(43,"span",18),m(44,"+"),a(),r(45,"input",20),W("ngModelChange",function(s){return L(i.discounts[2],s)||(i.discounts[2]=s),s}),D("ngModelChange",function(){return i.calculateDiscountCalculator()}),a(),r(46,"span"),m(47," %"),a()()()(),$t(),a()()()()),e&2&&(b("config",i.config),l(11),U("ngModel",i.discountPercentage),l(6),j("Discount ",i.currencySymbol),l(2),U("ngModel",i.discountAmount),l(8),b("clearable",!1)("ngModel",i.taxID)("items",i.taxes),l(8),U("ngModel",i.discounts[0]),l(5),U("ngModel",i.discounts[1]),l(5),U("ngModel",i.discounts[2]))},dependencies:[Se,be,ae,xe,Dt,Oe,Pe,Ln,Un,Qn,st,ct,lt,rt,xt],encapsulation:2})};var hi=class n{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(bi,{data:{discount:w({},this.discTax.Discount),tax:w({},this.discTax.Tax),taxes:this.taxes,currencySymbol:this.currencySymbol}}).afterClosed().pipe(V(t=>!!t)).subscribe(t=>{this.discTax.Discount=w({},t.Discount),this.discTax.Tax=w({},t.Tax),this.onChange(this.discTax)})}static \u0275fac=function(e){return new(e||n)(u(ee))};static \u0275cmp=F({type:n,selectors:[["POS-discount-and-tax-form"]],inputs:{taxes:"taxes",currencySymbol:"currencySymbol"},features:[Ne([{provide:Ke,multi:!0,useExisting:n}])],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,i){e&1&&(r(0,"button",0),D("click",function(){return i.openModalDiscountAndTax()}),M(1,"i",1),a())},dependencies:[lt,rt,zt],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 Ft=n=>({selected:n}),sa=(n,t)=>({"col-sm-3":n,"col-sm-7":t});function ca(n,t){if(n&1){let e=B();r(0,"div",10)(1,"label",11)(2,"input",12),W("ngModelChange",function(o){P(e);let s=p(2);return L(s.tagID,o)||(s.tagID=o),O(o)}),a(),m(3),a()()}if(n&2){let e=t.$implicit,i=t.$index,o=p(2);l(),b("for",Ni("potype-"+i))("ngClass",ie(8,Ft,o.tagID==e.ID)),l(),b("id",Ni("potype-"+i)),U("ngModel",o.tagID),b("value",e.ID),l(),j(" ",e.Name," ")}}function ma(n,t){if(n&1&&(r(0,"div",8),Ue(1,ca,4,10,"div",10,Qe),a()),n&2){let e=p();l(),We(e.supplierPOTypes)}}function pa(n,t){if(n&1){let e=B();r(0,"strong",13),m(1,"Supplier Bill Number"),a(),r(2,"input",14),W("ngModelChange",function(o){P(e);let s=p();return L(s.invoiceNumber,o)||(s.invoiceNumber=o),O(o)}),a()}if(n&2){let e=p();l(2),U("ngModel",e.invoiceNumber)}}function da(n,t){if(n&1){let e=B();r(0,"div",9)(1,"POS-tinymce-editor",15),W("ngModelChange",function(o){P(e);let s=p();return L(s.note,o)||(s.note=o),O(o)}),a()()}if(n&2){let e=p();l(),U("ngModel",e.note)}}function ua(n,t){if(n&1){let e=B();r(0,"div",21)(1,"span",26),m(2,"@"),a(),r(3,"input",27),W("ngModelChange",function(o){P(e);let s=p(2);return L(s.exchangeRate,o)||(s.exchangeRate=o),O(o)}),a()()}if(n&2){let e=p(2);l(3),U("ngModel",e.exchangeRate)}}function fa(n,t){if(n&1){let e=B();r(0,"div",16)(1,"div",17)(2,"div",18),m(3,"Currency :"),a(),r(4,"div",19)(5,"ng-select",20),W("ngModelChange",function(o){P(e);let s=p();return L(s.currencyID,o)||(s.currencyID=o),O(o)}),a()(),h(6,ua,4,1,"div",21),a()(),r(7,"div",22)(8,"div",23),m(9,"Term :"),a(),r(10,"div",24)(11,"ng-select",25),W("ngModelChange",function(o){P(e);let s=p();return L(s.note,o)||(s.note=o),O(o)}),a()()()}if(n&2){let e=p();l(4),b("ngClass",_t(8,sa,e.currencyID!=e.defaultCurrencyID,e.currencyID==e.defaultCurrencyID)),l(),b("items",e.currencies),U("ngModel",e.currencyID),b("clearable",!1),l(),v(e.currencyID!=e.defaultCurrencyID?6:-1),l(5),b("items",e.predefinedNotes),U("ngModel",e.note),b("clearable",!1)}}var vi=class n{constructor(t,e){this.dialogRef=t;this.config=new Ie,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(i=>i.ID==this.currencyID).ExchangeRate,this.supplierPOTypes=e.supplierPOTypes,this.predefinedNotes=e.predefinedNotes,this.currencies=e.currencies,this.defaultCurrencyID=e.defaultCurrencyID,this.invoiceNumber=e.invoiceNumber,S.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(w({},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||n)(u(Me),u(Fe))};static \u0275cmp=F({type:n,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"],[1,"col-12"],[1,"col-12","tinymce"],[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"],[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"],[1,"col-sm-4","d-flex"],[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,"pt-4"],["type","text","autoNum","",1,"border","border-light",2,"width","100px",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(r(0,"modal-material",0),D("onCancel",function(){return i.close()})("onClose",function(){return i.close()})("onOk",function(){return i.ok()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div")(5,"a",3),D("click",function(){return i.onTabChange("Note")}),m(6," Note "),a(),r(7,"a",4),D("click",function(){return i.onTabChange("Tag")}),m(8," Tag "),a(),r(9,"a",5),D("click",function(){return i.onTabChange("Number")}),m(10," Number "),a(),r(11,"a",6),D("click",function(){return i.onTabChange("Other")}),m(12," Other "),a()()(),r(13,"div",7),h(14,ma,3,0,"div",8),h(15,pa,3,1),h(16,da,2,1,"div",9),h(17,fa,12,11),a()()()()),e&2&&(b("config",i.config),l(5),b("ngClass",ie(9,Ft,i.tabState=="Note")),l(2),b("ngClass",ie(11,Ft,i.tabState=="Tag")),l(2),b("ngClass",ie(13,Ft,i.tabState=="Number")),l(2),b("ngClass",ie(15,Ft,i.tabState=="Other")),l(3),v(i.tabState=="Tag"?14:-1),l(),v(i.tabState=="Number"?15:-1),l(),v(i.tabState=="Note"?16:-1),l(),v(i.tabState=="Other"?17:-1))},dependencies:[se,Ge,Se,be,fn,ae,xe,Dt,xt,ii,ti,st,ct,Oe,Pe],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 _i=class n{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(vi,{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||n)(u(ee))};static \u0275cmp=F({type:n,selectors:[["POS-note-form"]],inputs:{supplierPOTypes:"supplierPOTypes",predefinedNotes:"predefinedNotes",defaultCurrencyID:"defaultCurrencyID",currencies:"currencies"},features:[Ne([{provide:Ke,multi:!0,useExisting:n}])],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,i){e&1&&(Je(0,"button",0),bt("click",function(){return i.openModalNote()}),kt(1,"i",1),it())},styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}"]})};function ga(n,t){if(n&1){let e=B();r(0,"div",10)(1,"div",12)(2,"h5"),m(3,"Add inventory to outlet"),a()(),r(4,"div",13)(5,"ng-select",14),W("ngModelChange",function(o){P(e);let s=p();return L(s.deliveryEntityID,o)||(s.deliveryEntityID=o),O(o)}),a()()()}if(n&2){let e=p();l(5),b("clearable",!1),U("ngModel",e.deliveryEntityID),b("items",e.outlets)("disabled",e.isEdit)}}function Ca(n,t){n&1&&(r(0,"div",11)(1,"div",15)(2,"h5",16),m(3," Unfulfilled order, product inventory is awaiting "),a()()())}var Di=class n{constructor(t,e,i){this.dialogRef=t;this.datePipe=e;this.data=i;this.config=new Ie,this.config.title="Purchase Order Fulfillment",this.config.customWidth="650px",this.isEdit=i.isEdit,this.deliveryEntityID=S.IsNotEmpty(i.deliveryEntityID)?i.deliveryEntityID:i.outletID,this.outlets=i.outlets,this.fulfillmentDate=i.fulfillmentDate,this.appConfigJSON=i.appConfigJSON,S.IsNotEmpty(i.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=S.IsNotEmpty(this.data.deliveryEntityID)?this.data.deliveryEntityID:this.data.outletID):(this.deliveryEntityID=S.GuidEmpty,this.fulfillmentDate=new Date)}static \u0275fac=function(e){return new(e||n)(u(Me),u(rn),u(Fe))};static \u0275cmp=F({type:n,selectors:[["POS-modal-fulfillment"]],decls:20,vars:3,consts:[[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"],[1,"row","align-items-center","mt-5"],[1,"row","mt-8"],[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,"col-12","pe-0"],[1,"bg-gradient-warning","text-center","py-7","rounded-3","border","mb-7"]],template:function(e,i){e&1&&(r(0,"modal-material",0),D("onOk",function(){return i.ok()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"mat-button-toggle-group",4),W("ngModelChange",function(s){return L(i.tabState,s)||(i.tabState=s),s}),D("change",function(s){return i.onChangeTab(s.value)}),r(6,"mat-button-toggle",5)(7,"h3",6),m(8," Now "),r(9,"small",7)(10,"em"),m(11,"(in store purchase)"),a()()()(),r(12,"mat-button-toggle",8)(13,"h3",9),m(14," Later "),r(15,"small",7)(16,"em"),m(17,"(shipped to customer address)"),a()()()()()()(),h(18,ga,6,4,"div",10)(19,Ca,4,0,"div",11),a()()()),e&2&&(b("config",i.config),l(5),U("ngModel",i.tabState),l(13),v(i.tabState=="Now"?18:19))},dependencies:[Oe,Pe,xt,_n,hn,vn,Se,ae,xe,Xt,Fn],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 xi=class n{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(Di,{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 S.IsEmpty(this.deliveryEntityID)&&S.IsNotEmpty(this.outletID)}static \u0275fac=function(e){return new(e||n)(u(ee))};static \u0275cmp=F({type:n,selectors:[["POS-fulfillment-form"]],inputs:{outlets:"outlets",outletID:"outletID",appConfigJSON:"appConfigJSON",isEdit:"isEdit"},features:[Ne([{provide:Ke,multi:!0,useExisting:n}])],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,i){e&1&&(Je(0,"button",0),bt("click",function(){return i.openModalFulfillment()}),kt(1,"i",1),Je(2,"span"),m(3,"Fulfillment"),it()()),e&2&&vt("bg-gradient-warning",i.isDeliveryEntityIDEmpty())},styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}"]})};var oo=n=>({selected:n}),ya=n=>({active:n});function ba(n,t){if(n&1){let e=B();r(0,"a",4),D("click",function(){P(e);let o=p();return O(o.isPayNow=!1)}),m(1," Later "),r(2,"span",7),m(3,"Take Credit"),a()()}if(n&2){let e=p();b("ngClass",ie(1,oo,!e.isPayNow))}}function ha(n,t){if(n&1){let e=B();r(0,"div",16)(1,"a",17),D("click",function(){let o=P(e).$implicit,s=p(4);return O(s.inputAmount=o)}),m(2),f(3,"number"),a()()}if(n&2){let e=t.$implicit,i=p(4);l(),b("ngClass",ie(5,ya,i.paymentMethodID==i.cashPaymentID&&i.inputAmount==e)),l(),He("",i.currencySymbol," ",g(3,3,e))}}function va(n,t){if(n&1&&(r(0,"div",14),Ue(1,ha,4,7,"div",16,Qe),a()),n&2){let e=p(3);l(),We(e.suggestedCash)}}function _a(n,t){if(n&1&&(r(0,"div",19),m(1),f(2,"number"),a()),n&2){let e=p(4);b("ngClass",e.inputAmount>e.amountToPay?"success":"danger"),l(),He(" ",e.currencySymbol," ",g(2,3,e.inputAmount-e.amountToPay)," ")}}function Da(n,t){if(n&1){let e=B();r(0,"input",18),W("ngModelChange",function(o){P(e);let s=p(3);return L(s.inputAmount,o)||(s.inputAmount=o),O(o)}),D("click",function(){P(e);let o=p(3);return o.paymentMethodID=o.cashPaymentID,o.paymentMethodState="Cash",O(o.paymentMethodName="Cash")}),a(),h(1,_a,3,5,"div",19)}if(n&2){let e=p(3);U("ngModel",e.inputAmount),l(),v(e.inputAmount!=e.amountToPay?1:-1)}}function xa(n,t){if(n&1){let e=B();r(0,"div",20),D("click",function(){P(e);let o=p(3);return o.paymentMethodID=o.cashPaymentID,O(o.paymentMethodState="Cash")}),M(1,"input",21),a()}if(n&2){let e=p(3);l(),b("value",e.currencySymbol+" -")}}function Sa(n,t){if(n&1&&(r(0,"div",8)(1,"div",10),M(2,"i",11),m(3," Cash "),a(),r(4,"div",12)(5,"div",13),h(6,va,3,0,"div",14),r(7,"div",15),h(8,Da,2,2)(9,xa,2,1,"div"),a()()()()),n&2){let e=p(2);l(6),v(e.role.product.Cost?6:-1),l(2),v(e.role.product.Cost?8:9)}}function Ma(n,t){if(n&1){let e=B();r(0,"div",23)(1,"a",25),D("click",function(){let o=P(e).$implicit,s=p(3);return O(s.onSelectPaymentMethod(o.ID,"Card",o.Name))}),r(2,"span",26),M(3,"img",27),a(),r(4,"span",26),m(5),f(6,"limitText"),a()()()}if(n&2){let e=t.$implicit,i=p(3);l(),b("ngClass",i.paymentMethodID===e.ID?"active":""),l(),b("hidden",e.ImageUrl==null),l(),b("src",e.ImageUrl,at),l(),b("hidden",e.ImageUrl!=null),l(),j(" ",wt(6,5,e.Name,20)," ")}}function Ia(n,t){if(n&1){let e=B();r(0,"div",24)(1,"div",28)(2,"input",29),W("ngModelChange",function(o){P(e);let s=p(3);return L(s.paymentNote,o)||(s.paymentNote=o),O(o)}),a(),r(3,"input",30),W("ngModelChange",function(o){P(e);let s=p(3);return L(s.paymentCode,o)||(s.paymentCode=o),O(o)}),a()()()}if(n&2){let e=p(3);l(2),U("ngModel",e.paymentNote),l(),U("ngModel",e.paymentCode)}}function Pa(n,t){if(n&1&&(r(0,"div",8)(1,"div",10),M(2,"i",22),m(3," Card "),a(),r(4,"div",12)(5,"div",13),Ue(6,Ma,7,8,"div",23,Qe),a(),h(8,Ia,4,2,"div",24),a()()),n&2){let e=p(2);l(6),We(e.cardPayments),l(2),v(e.paymentMethodState=="Card"?8:-1)}}function Oa(n,t){if(n&1){let e=B();r(0,"div",23)(1,"a",25),D("click",function(){let o=P(e).$implicit,s=p(3);return O(s.onSelectPaymentMethod(o.ID,"Other",o.Name))}),m(2),f(3,"limitText"),a()()}if(n&2){let e=t.$implicit,i=p(3);l(),b("ngClass",i.paymentMethodID===e.ID?"active":""),l(),j(" ",wt(3,2,e.Name,20)," ")}}function Ta(n,t){if(n&1){let e=B();r(0,"div",24)(1,"div",28)(2,"input",29),W("ngModelChange",function(o){P(e);let s=p(3);return L(s.paymentNote,o)||(s.paymentNote=o),O(o)}),a(),r(3,"input",30),W("ngModelChange",function(o){P(e);let s=p(3);return L(s.paymentCode,o)||(s.paymentCode=o),O(o)}),a()()()}if(n&2){let e=p(3);l(2),U("ngModel",e.paymentNote),l(),U("ngModel",e.paymentCode)}}function wa(n,t){if(n&1&&(r(0,"div",9)(1,"div",10),m(2,"Others"),a(),r(3,"div",12)(4,"div",13),Ue(5,Oa,4,5,"div",23,Qe),a(),h(7,Ta,4,2,"div",24),a()()),n&2){let e=p(2);l(5),We(e.otherPayments),l(2),v(e.paymentMethodState=="Other"?7:-1)}}function Na(n,t){if(n&1&&(r(0,"div"),h(1,Sa,10,2,"div",8),h(2,Pa,9,1,"div",8),h(3,wa,8,1,"div",9),a()),n&2){let e=p();l(),v(e.isCashSuspended?1:-1),l(),v(e.cardPayments.length>0?2:-1),l(),v(e.otherPayments.length>0?3:-1)}}function Ea(n,t){if(n&1){let e=B();r(0,"div",6)(1,"div",31)(2,"h5",32),m(3,"Due"),a(),r(4,"datepicker",33),W("dateChange",function(o){P(e);let s=p();return L(s.dueDate,o)||(s.dueDate=o),O(o)}),D("dateChange",function(){P(e);let o=p();return O(o.onChangeDueDate())}),a()(),r(5,"div",34)(6,"h5",32),m(7,"Days Due"),a(),r(8,"div",12)(9,"input",35),W("ngModelChange",function(o){P(e);let s=p();return L(s.dueDays,o)||(s.dueDays=o),O(o)}),D("ngModelChange",function(){P(e);let o=p();return O(o.onChangeDueDay())}),a()()()()}if(n&2){let e=p();l(4),b("displayToggle",!1),U("date",e.dueDate),l(5),U("ngModel",e.dueDays)}}var Si=class n{constructor(t,e,i){this.dialogRef=t;this.role=i;this.isDefaultTabPayLater=e.payDefaultState==!1,this.config=new Ie,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(T=>T.ID==this.paymentMethodID);S.IsNotEmpty(o)&&(this.paymentMethodState="Card",this.paymentMethodName=o.Name);let s=this.otherPayments.find(T=>T.ID==this.paymentMethodID);S.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(T=>T>this.inputAmount).forEach(T=>{this.suggestedCash.length<3&&this.suggestedCash.push(T)}),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,i){this.paymentMethodName=i,this.paymentMethodID==t?(this.paymentMethodID=this.cashPaymentID,this.paymentMethodState="Cash"):(this.paymentMethodID=t,this.paymentMethodState=e)}onChangeDueDay(){let t=new Date(S.cloneObject(this.invoiceDate));t.setDate(t.getDate()+this.dueDays),t.setHours(0,0,0,0),this.dueDate=t}onChangeDueDate(){this.dueDays=S.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||n)(u(Me),u(Fe),u(he))};static \u0275cmp=F({type:n,selectors:[["POS-modal-pay"]],decls:14,vars:10,consts:[[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"],[1,"py-4"],[1,"fst-italic",2,"font-size","10px"],[1,"row","border-bottom","py-5"],[1,"row","py-5"],[1,"col-3","h5","pt-5"],[1,"fa-solid","fa-money-bill-wave"],[1,"col-9"],[1,"row"],[1,"row","mb-5"],[1,"col","pe-0","me-10","position-relative"],[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"],[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"],[1,"col-auto","pe-0"],[1,"position-relative","row"],[1,"btn","btn-outline-info","mb-3","px-6",3,"click","ngClass"],[3,"hidden"],[2,"width","40px",3,"src"],[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","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,i){e&1&&(r(0,"modal-material",0),D("onOk",function(){return i.ok()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"header")(2,"div",1),m(3),f(4,"number"),a()(),r(5,"content")(6,"div",2)(7,"div",3)(8,"div")(9,"a",4),D("click",function(){return i.isPayNow=!0}),m(10," Now "),a(),h(11,ba,4,3,"a",5),a()()(),h(12,Na,4,3,"div"),h(13,Ea,10,3,"div",6),a()()),e&2&&(b("config",i.config),l(3),j(" ",i.currencySymbol+" "+g(4,6,i.amountToPay)," "),l(6),b("ngClass",ie(8,oo,i.isPayNow)),l(2),v(i.amountToPay!=0||i.isDefaultTabPayLater?11:-1),l(),v(i.isPayNow?12:-1),l(),v(i.isPayNow?-1:13))},dependencies:[se,Ge,Se,be,ae,xe,Xt,En,Oe,Pe,st,ct,De,Kt],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 Ze=class n{constructor(t,e,i){this.form=e;this.decimalPipe=i;let o=e.discountAndTaxForm.valueChanges;this.currency$=e.noteForm.valueChanges.pipe(d(_=>_.Currency),Z(1),Y()),this.currencySymbol$=this.currency$.pipe(d(_=>_.Symbol),Y());let s=t.cart$.pipe(E(console.log),d(_=>_.map($=>$.Total)),d(_=>_.reduce(($,G)=>$+G,0)),d(_=>this.setDecimalDigit(_)),Z(1),Y()),T=t.cart$.pipe(d(_=>_.filter($=>$.Taxable).map($=>$.Total)),d(_=>_.reduce(($,G)=>$+G,0)),d(_=>this.setDecimalDigit(_)),Z(1),Y());this.displayedAmount$=s,this.displayedDiscountPercentage$=Ce(this.displayedAmount$,o.pipe(d(_=>_.Discount.Percentage))).pipe(d(([_,$])=>({label:`Discount ${$}%`,value:_*($/100)})),je({label:"",value:0}),Z(1),Y()),this.displayedDiscountAmount$=Ce(this.currencySymbol$,o.pipe(d(_=>_.Discount.Amount))).pipe(d(([_,$])=>({label:`Discount ${_}`,value:$})),je({label:"",value:0}),Z(1),Y()),this.displayedTax$=Ce(T,this.displayedDiscountPercentage$.pipe(d(_=>_.value)),this.displayedDiscountAmount$.pipe(d(_=>_.value)),o.pipe(d(_=>_.Tax))).pipe(V(([,,,_])=>!!_.Label),d(([_,$,G,x])=>({amountAfterDiscount:_-$-G,tax:x})),d(_=>{let $=_.amountAfterDiscount,G=_.tax;return{label:G.Label,tax:{id:G.ID,value:G.CalculationTypeName=="Add"?$*(G.Rate/100):G.Rate/(100+G.Rate)*$,type:G.CalculationTypeName,rate:G.Rate}}}),E(_=>e.setTaxAmount(_.tax.value)),je({label:"",tax:{id:"",value:0,type:"",rate:0}}),Z(1),Y()),this.amountAfterDiscountAndTax$=Ce(this.displayedAmount$,this.displayedDiscountPercentage$.pipe(d(_=>_.value)),this.displayedDiscountAmount$.pipe(d(_=>_.value)),this.displayedTax$.pipe(d(_=>_.tax)),t.cart$.pipe(d(_=>_.length))).pipe(d(([_,$,G,x,A])=>A?_-$-G+(x.type=="Add"?x.value:0):0),Y()).pipe(Z(1)),this.amountAfterDiscountAndTax$.subscribe()}paymentMethodName=Le("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||n)(Q(te),Q(H),Q(De))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};function Fa(n,t){if(n&1&&(Je(0,"div"),m(1),f(2,"number"),it()),n&2){let e=p();l(),j(" ",g(2,1,e.amountToPayRounded)," ")}}function Aa(n,t){n&1&&m(0," - ")}var Mi=class n{constructor(t,e,i,o,s,T,_,$,G,x,A){this.matDialog=t;this.toastr=e;this.form=i;this.cart=o;this.http=s;this.complete=T;this.role=_;this.load=$;this.posMath=G;this.math=x;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",ve.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`,ve.Info);return}let t=S.IsEmpty(this.form.buyForm.controls.Order.controls.SupplierID.value);if(this.appConfigJSON.ModuleBuy.Header.SupplierRequired&&t){this.toastr.info("Supplier is required",ve.Info);return}this.matDialog.open(Si,{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:S.cloneObject(this.dueDate),dueDays:S.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),d(s=>s)).pipe(E(s=>this.paymentService.paymentMethodName.set(s.paymentMethodName)),me(this.cart.cart$),d(([s,T])=>R(w({},s),{cart:T})),me(this.load.entities$),d(([s,T])=>R(w({},s),{entities:T})),me(this.load.supplierPOTypes$),d(([s,T])=>R(w({},s),{supplierPOTypes:T})),X(s=>{S.IsEmpty(this.form.noteForm.value.TagID)&&this.form.setBulkNoteForm(R(w({},this.form.noteForm.value),{TagID:s.supplierPOTypes[0]?.ID}));let T=this.form.buyForm.controls,_=T.Invoice.controls,$=T.Payment.controls,G=this.form.outlet.value,x=T.Order.controls,A=this.form.noteForm.value,c=this.form.discountAndTaxForm.value,I=$.Amount.value,J=this.form.deliveryEntityID.value,K={ID:_.ID.value,Due:s.payState=="Now"?void 0:_.Due.value,Tax:_.Tax.value,Sales:I??0,PaymentStateID:s.payState=="Now"?3:1,Number:A.InvoiceNumber?A.InvoiceNumber:x.Number.value},C=s.cart.map(N=>R(w({},N),{VariantID:S.IsEmpty(N.VariantID)?N.ID:N.VariantID}));this.isEditBuyForm&&(C=C.map(N=>R(w({},N),{QtyRequested:N.Quantity})));let y={EntityID:G.ID,SupplierID:x.SupplierID.value,Date:x.Date.value,CurrencyID:A.Currency.ID,CurrencyRate:A.Currency.ExchangeRate,Discount:c.Discount.Percentage,DiscountAmount:c.Discount.Amount,Note:A.Note,Att:x.Att.value,TaxTypeID:c.Tax.ID,TypeID:A.TagID,Number:x.Number.value,ID:x.ID.value};if(s.payState=="Now"){let N={ID:$.ID?.value??S.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:y.Date,ImageUrl:$.ImageUrl?.value};s.amount<I?K.PaymentStateID=2:s.amount>I&&(K.PaymentStateID=5);let k={DeliveryEntityID:J,NewOrderID:this.isEditBuyForm?null:S.Guid_NewGuid(),Invoice:K,Order:y,Items:C,Payment:N};return this.http.post("/API/Buy/SubmitOrder2",k,1e4,!0).pipe(d(fe=>R(w({},fe),{differentNumber:fe.InvoiceNumber!=y.Number})),ye(fe=>{throw fe.error&&this.toastr.error(fe.error.Message,"Order Submission Failed"),new Error(fe)}))}else{let N={DeliveryEntityID:J,NewOrderID:this.isEditBuyForm?null:S.Guid_NewGuid(),Invoice:R(w({},K),{Due:s.dueDate}),Order:y,Items:C};return this.http.post("/API/Buy/SubmitOrder2",N,1e4,!0).pipe(d(k=>R(w({},k),{differentNumber:k.InvoiceNumber!=y.Number})),ye(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||n)(u(ee),u(qe),u(H),u(te),u(re),u($e),u(he),u(de),u(Ei),u(Ei),u(Ze))};static \u0275cmp=F({type:n,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:11,vars:7,consts:[["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"]],template:function(e,i){e&1&&(Je(0,"button",0),bt("click",function(){return i.pay()}),Je(1,"div",1)(2,"div")(3,"span"),m(4,"Pay"),it(),Je(5,"small",2),m(6),f(7,"number"),f(8,"quantityFraction"),it()(),h(9,Fa,3,3,"div")(10,Aa,1,0),it()()),e&2&&(l(6),He(" (",g(7,3,i.cartLength)," Items & ",g(8,5,i.totalVariantOrdered)," Qty) "),l(3),v(i.role.product.Cost?9:10))},dependencies:[se,De,Yt],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 It=class n{noteForm;constructor(t){this.noteForm=t.noteForm}static \u0275fac=function(e){return new(e||n)(Q(H))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};var Pt=class n{deliveryEntityID;constructor(t){this.deliveryEntityID=t.deliveryEntityID}static \u0275fac=function(e){return new(e||n)(Q(H))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};var Ot=class n{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),me(this.dueDays$),E(([s,T])=>t.setDueDateBasedOnDaysDue(T)),E(console.log)).subscribe(),this.dueDate$=e,this.dueDate$.subscribe(s=>console.log(s,"dueDate$"))}static \u0275fac=function(e){return new(e||n)(Q(H))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};function Ra(n,t){if(n&1&&(r(0,"tr")(1,"th",11),m(2,"Amount"),a(),r(3,"td",12),m(4),f(5,"number"),a()()),n&2){let e=p();l(4),z(g(5,1,e.displayedAmount))}}function Ba(n,t){if(n&1&&(r(0,"td",13),m(1),f(2,"number"),a()),n&2){let e=p(3);l(),j(" ",g(2,1,e.displayedDiscountPercentage.value*-1))}}function ja(n,t){if(n&1&&(r(0,"tr")(1,"th",11),m(2),a(),h(3,Ba,3,3,"td",13),a()),n&2){let e=p(2),i=p();l(2),z(e.displayedDiscountPercentage.label),l(),v(i.role.product.Cost?3:-1)}}function La(n,t){if(n&1&&(r(0,"td",13),m(1),f(2,"number"),a()),n&2){let e=p(3);l(),z(g(2,1,e.displayedDiscountAmount.value*-1))}}function Qa(n,t){if(n&1&&(r(0,"tr")(1,"th",11),m(2),a(),h(3,La,3,3,"td",13),a()),n&2){let e=p(2),i=p();l(2),z(e.displayedDiscountAmount.label),l(),v(i.role.product.Cost?3:-1)}}function Ua(n,t){if(n&1&&(r(0,"td",12),m(1),f(2,"number"),a()),n&2){let e=p(3);l(),z(g(2,1,e.displayedTax.tax.value))}}function Wa(n,t){if(n&1&&(r(0,"tr")(1,"th",11),m(2),a(),h(3,Ua,3,3,"td",12),a()),n&2){let e=p(2),i=p();l(2),z(e.displayedTax.label),l(),v(i.role.product.Cost?3:-1)}}function Ja(n,t){if(n&1&&(h(0,ja,4,2,"tr"),h(1,Qa,4,2,"tr"),h(2,Wa,4,2,"tr")),n&2){let e=p();v(e.displayedDiscountPercentage.value!=0?0:-1),l(),v(e.displayedDiscountAmount.value!=0?1:-1),l(),v(e.displayedTax.tax.value!=0?2:-1)}}function Ha(n,t){if(n&1&&(r(0,"div",0)(1,"div",9)(2,"table",10),h(3,Ra,6,3,"tr"),h(4,Ja,3,3),f(5,"async"),a()()()),n&2){let e=t,i=p();l(3),v(i.showAmountWhenDiscountOrTaxIsApplied(e)&&e.displayedAmount&&i.role.product.Cost?3:-1),l(),v(g(5,2,i.cartLength$)?4:-1)}}var Ii=class n{constructor(t,e,i,o,s,T,_,$,G,x){this.payment=t;this.form=o;this.role=$;this.taxes$=i.taxes$,this.defaultCurrencyID$=i.appConfigJSON$.pipe(d(K=>K.CoreDefaults.CurrencyID)),this.totalVariantOrdered$=e.totalVariantOrdered$,this.cartLength$=e.cart$.pipe(d(K=>K.length)),this.amountAfterDiscountAndTax$=t.amountAfterDiscountAndTax$,this.discountAndTaxForm=o.discountAndTaxForm;let A=t.displayedAmount$,c=t.displayedDiscountPercentage$,I=t.displayedDiscountAmount$,J=t.displayedTax$;this.displayedDiscountAndTax$=Ce({displayedAmount:A,displayedDiscountPercentage:c,displayedDiscountAmount:I,displayedTax:J}),this.deliveryEntityID=T.deliveryEntityID,this.noteForm=s.noteForm,this.currencies$=i.currencies$,this.currencySymbol$=t.currencySymbol$,this.supplierPOTypes$=i.supplierPOTypes$,this.predefinedNotes$=i.predefinedNotes$,this.outlets$=i.entities$,this.cashPayments$=x.cashPayments$,this.cardPayments$=x.cardPayments$,this.otherPayments$=x.otherPayments$,this.defaultDueDays$=i.defaultDueDays$,this.dueDate$=_.dueDate$,this.dueDays$=_.dueDays$,this.appConfigJSON$=i.appConfigJSON$,this.isUnpaidOnEdit$=Ce(G.isEdit$,G.isUnpaid$).pipe(d(([K,C])=>K&&C)),this.isEdit$=G.isEdit$,this.outlet=o.outlet,this.isCashSuspended$=x.isCashSuspended$,this.denomination$=i.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||n)(u(Ze),u(te),u(de),u(H),u(It),u(Pt),u(Ot),u(he),u(Ve),u(Xe))};static \u0275cmp=F({type:n,selectors:[["POS-cart-footer"]],decls:34,vars:83,consts:[[1,"row","g-0","px-5","justify-content-end"],[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,"col-6",2,"padding-right","15px"],[1,"table","table-borderless"],[1,"text-start"],[1,"text-end","fs-5"],[1,"text-end","fs-5","text-danger"]],template:function(e,i){if(e&1&&(h(0,Ha,6,4,"div",0),f(1,"async"),r(2,"div",1)(3,"div",2),M(4,"POS-note-form",3),f(5,"async"),f(6,"async"),f(7,"async"),f(8,"async"),M(9,"POS-fulfillment-form",4),f(10,"async"),f(11,"async"),f(12,"async"),a(),r(13,"div",5)(14,"div",6),M(15,"POS-discount-and-tax-form",7),f(16,"async"),f(17,"async"),M(18,"POS-pay-button",8),f(19,"async"),f(20,"async"),f(21,"async"),f(22,"async"),f(23,"async"),f(24,"async"),f(25,"async"),f(26,"async"),f(27,"async"),f(28,"async"),f(29,"async"),f(30,"async"),f(31,"async"),f(32,"async"),f(33,"async"),a()()()),e&2){let o;v((o=g(1,33,i.displayedDiscountAndTax$))?0:-1,o),l(4),b("supplierPOTypes",g(5,35,i.supplierPOTypes$))("predefinedNotes",g(6,37,i.predefinedNotes$))("defaultCurrencyID",g(7,39,i.defaultCurrencyID$))("currencies",g(8,41,i.currencies$))("formControl",i.noteForm),l(5),b("outlets",g(10,43,i.outlets$))("formControl",i.deliveryEntityID)("appConfigJSON",g(11,45,i.appConfigJSON$))("outletID",i.outlet.value.ID)("isEdit",g(12,47,i.isEdit$)),l(6),b("taxes",g(16,49,i.taxes$))("currencySymbol",g(17,51,i.currencySymbol$))("formControl",i.discountAndTaxForm),l(3),b("amountToPay",g(19,53,i.amountAfterDiscountAndTax$))("currencySymbol",g(20,55,i.currencySymbol$))("dueDate",g(21,57,i.dueDate$))("dueDays",g(22,59,i.dueDays$))("cardPayments",g(23,61,i.cardPayments$))("otherPayments",g(24,63,i.otherPayments$))("paymentMethodID",i.paymentMethodID)("paymentCode",i.paymentCode)("paymentNote",i.paymentNote)("defaultDueDays",g(25,65,i.defaultDueDays$))("invoiceDate",i.invoiceDate)("appConfigJSON",g(26,67,i.appConfigJSON$))("cashPayments",g(27,69,i.cashPayments$))("isUnpaidOnEdit",g(28,71,i.isUnpaidOnEdit$))("isEditBuyForm",g(29,73,i.isEdit$))("cartLength",g(30,75,i.cartLength$))("totalVariantOrdered",g(31,77,i.totalVariantOrdered$))("isCashSuspended",g(32,79,i.isCashSuspended$))("denomination",g(33,81,i.denomination$))}},dependencies:[se,hi,Ye,ae,ze,_i,xi,Mi,Ee,De],encapsulation:2})};var Ga=n=>({"date-warning":n}),qa=()=>["/menu/Orders/Orders/Supplier_Bill/Info"],Ka=n=>({ID:n});function za(n,t){if(n&1&&(m(0),f(1,"async"),f(2,"number")),n&2){let e=p().$implicit,i=p();He(" ",g(1,2,i.currencySymbol$)," ",g(2,4,e.Total)," ")}}function Ya(n,t){n&1&&m(0," - ")}function Xa(n,t){if(n&1&&(r(0,"div",25)(1,"div",27),m(2),a(),r(3,"div",28),h(4,za,3,6)(5,Ya,1,0),a()()),n&2){let e=t.$implicit,i=p();l(2),z(e.Name),l(2),v(i.role.product.Cost?4:5)}}function Za(n,t){if(n&1&&(r(0,"td",32),m(1),a(),r(2,"td",33),m(3),f(4,"async"),a(),r(5,"td",32),m(6),f(7,"number"),a()),n&2){let e=p(),i=p(2);l(),z(e.label),l(2),j(" ",g(4,3,i.currencySymbol$)," "),l(3),z(g(7,5,e.value))}}function er(n,t){n&1&&(r(0,"tr"),h(1,Za,8,7),a()),n&2&&(l(),v(t.value>0?1:-1))}function tr(n,t){if(n&1&&(r(0,"td",32),m(1,"Discount:"),a(),r(2,"td",33),m(3),f(4,"async"),a(),r(5,"td",32),m(6),f(7,"number"),a()),n&2){let e=p(),i=p(2);l(3),j(" ",g(4,2,i.currencySymbol$)," "),l(3),z(g(7,4,e.value))}}function ir(n,t){n&1&&(r(0,"tr"),h(1,tr,8,6),a()),n&2&&(l(),v(t.value>0?1:-1))}function nr(n,t){if(n&1&&(r(0,"td",32),m(1),a(),r(2,"td",33),m(3),f(4,"async"),a(),r(5,"td",32),m(6),f(7,"number"),a()),n&2){let e=p(),i=p(2);l(),z(e.label),l(2),j(" ",g(4,3,i.currencySymbol$)," "),l(3),z(g(7,5,e.tax.value))}}function or(n,t){n&1&&(r(0,"tr"),h(1,nr,8,7),a()),n&2&&(l(),v(t.tax.value>0?1:-1))}function ar(n,t){if(n&1&&(r(0,"div",26)(1,"div",29)(2,"table",30)(3,"tbody")(4,"tr",31)(5,"td",32),m(6,"Amount:"),a(),r(7,"td",33),m(8),f(9,"async"),a(),r(10,"td",32),m(11),f(12,"async"),f(13,"number"),a()(),h(14,er,2,1,"tr"),f(15,"async"),h(16,ir,2,1,"tr"),f(17,"async"),h(18,or,2,1,"tr"),f(19,"async"),r(20,"tr")(21,"td",32),m(22),a(),r(23,"td",33),m(24),f(25,"async"),a(),r(26,"td",32),m(27),f(28,"async"),f(29,"number"),a()()()()()()),n&2){let e,i,o,s=p();l(8),z(g(9,8,s.currencySymbol$)),l(3),j(" ",g(13,12,g(12,10,s.displayedAmount$))," "),l(3),v((e=g(15,14,s.displayedDiscountPercentage$))?14:-1,e),l(2),v((i=g(17,16,s.displayedDiscountAmount$))?16:-1,i),l(2),v((o=g(19,18,s.displayedTax$))?18:-1,o),l(4),j(" ",s.payment.paymentMethodName(),": "),l(2),z(g(25,20,s.currencySymbol$)),l(3),j(" ",g(29,24,g(28,22,s.displayedAmount$))," ")}}var Pi=class n{constructor(t,e,i,o,s,T,_,$){this.payment=t;this.form=e;this.cart=i;this.complete=o;this.load=s;this.router=T;this.outletInfo=_;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||n)(u(Ze),u(H),u(te),u($e),u(de),u(Ht),u(Xe),u(he))};static \u0275cmp=F({type:n,selectors:[["POS-complete"]],inputs:{data:[0,"paymentComplete","data"]},decls:38,vars:15,consts:[[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"],[1,"row","my-1","p-5"],[1,"card-footer","pe-0","bg-white"],[1,"col-8"],[1,"col-4","text-end"],[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"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"h1",1),m(2,"New Purchase Order"),a()(),r(3,"section",2)(4,"div")(5,"div",3)(6,"div",4)(7,"div",5)(8,"div",6)(9,"div",7)(10,"div",8)(11,"h2"),M(12,"i",9),m(13," Purchase Complete "),r(14,"small",10),m(15),a()()()(),r(16,"div",11)(17,"div",12)(18,"div",13)(19,"div",14)(20,"button",15),D("click",function(){return i.createNewTransaction()}),m(21," New Purchase (F8) "),a()()()()(),r(22,"div",16)(23,"div",17)(24,"div",18)(25,"a",19),M(26,"i",20),m(27,"Print Receipt "),a()()()()()(),r(28,"div",21)(29,"div",6)(30,"div",22)(31,"h3",23)(32,"a",24),m(33),a()()(),Ue(34,Xa,6,2,"div",25,Qe),f(36,"async"),h(37,ar,30,26,"div",26),a()()()()()()),e&2&&(l(9),tn(ie(10,Ga,i.data.PaymentStateID<3)),l(6),j(" (",i.data.PaymentStateLabel,") "),l(10),b("href",i.data.Message,at),l(7),b("routerLink",Ut(12,qa))("queryParams",ie(13,Ka,i.data.InvoiceID)),l(),j(" Supplier Bill #",i.data.InvoiceNumber," "),l(),We(g(36,8,i.cart.cart$)),l(3),v(i.role.product.Cost?37:-1))},dependencies:[se,qt,Gt,Ee,De],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 rr=["cartDisplayRef"],lr=(n,t)=>({label:n,tooltip:t}),sr=n=>({data:n}),cr=n=>({"bg-gradient-warning px-2":n}),mr=n=>({"me-3":n});function pr(n,t){n&1&&M(0,"POS-complete",2),n&2&&b("paymentComplete",t)}function dr(n,t){n&1&&en(0)}function ur(n,t){if(n&1&&(r(0,"div",9),ut(1,dr,1,0,"ng-container",31),a()),n&2){let e=p(2),i=ht(4);l(),b("ngTemplateOutlet",i)("ngTemplateOutletContext",ie(5,sr,_t(2,lr,e.fulfillmentOutletName(),e.fulfillmentOutletName())))}}function fr(n,t){if(n&1){let e=B();r(0,"div",3)(1,"div",4)(2,"div",5)(3,"div",6),M(4,"POS-select-outlet-form",7),f(5,"async"),f(6,"async"),f(7,"async"),M(8,"POS-invoice-number-form",8),f(9,"async"),r(10,"div"),h(11,ur,2,7,"div",9),M(12,"POS-invoice-date",10),a()()(),r(13,"div",11)(14,"div",12)(15,"div",13),M(16,"POS-more-actions",14),f(17,"async"),f(18,"async"),a(),r(19,"div",15)(20,"div",16),M(21,"i",17)(22,"input",18),a()(),r(23,"div",19)(24,"div",20)(25,"button",21),f(26,"async"),D("click",function(){P(e);let o=p();return O(o.collapseSidebar())}),M(27,"span",22)(28,"span",22)(29,"span",22),a()()()()()(),r(30,"div",23)(31,"div",5),M(32,"POS-quick-key",24),f(33,"async"),a(),r(34,"div",25)(35,"div",26)(36,"div",27),M(37,"POS-variant-autocomplete",28),a(),r(38,"div",15),M(39,"POS-supplier-autocomplete",29),f(40,"async"),f(41,"async"),a()(),M(42,"POS-cart-display",30,1),f(44,"async"),f(45,"async"),f(46,"async"),M(47,"POS-cart-footer"),a()()()}if(n&2){let e=p();l(4),b("outlets",g(5,31,e.outlets$))("isOpenAfterLoad",g(6,33,e.isOpenDialogOutlet$))("formControl",e.outlet)("disabled",g(7,35,e.isEdit$)),l(4),b("formControl",e.poNumber)("isEdit",g(9,37,e.isEdit$)),l(3),v(e.isFulfillmentDifferentOutlet()?11:-1),l(),b("formControl",e.date)("tooltip",e.role.global!=null&&e.role.global.Date?"":"Date role is required"),l(4),b("returnInvoiceNumber",e.returnInvoiceNumber)("appConfigJSON",g(17,39,e.appConfigJSON$))("isEditBuyForm",g(18,41,e.isEdit$))("outletID",e.outlet.value.ID)("outletName",e.outlet.value.Name),l(6),b("formControl",e.attention),l(3),vt("change",g(26,43,e.toggleState$)),l(7),b("quickKey",g(33,45,e.quickKeyPack$))("outletID",e.outlet.value.ID)("formControl",e.variantQuickKey),l(5),b("formControl",e.variantAutocomplete)("autocompleteEndpoint",e.variantAutocompleteEndpoint)("outletID",e.outlet.value.ID),l(2),b("formControl",e.supplierID)("supplierPOTypes",g(40,47,e.supplierPOTypes$))("appConfigJSON",g(41,49,e.appConfigJSON$)),l(3),b("cart",g(44,51,e.cart$))("appConfigJSON",g(45,53,e.appConfigJSON$))("isEdit",g(46,55,e.isEdit$))("outletID",e.outlet.value.ID)("outletName",e.outlet.value.Name)}}function gr(n,t){if(n&1&&(r(0,"h5",36),m(1),f(2,"limitText"),a()),n&2){let e=p().data;l(),z(wt(2,1,e==null?null:e.label,14))}}function Cr(n,t){if(n&1&&(r(0,"div",32)(1,"div",33)(2,"div",34),M(3,"i",35),a(),h(4,gr,3,4,"h5",36),a()()),n&2){let e=t.data;b("ngClass",ie(4,cr,e.label))("matTooltip",e==null?null:e.tooltip),l(2),b("ngClass",ie(6,mr,e.label)),l(2),v(e!=null&&e.label?4:-1)}}var ao=class n extends In{constructor(e,i,o,s,T,_,$,G,x,A,c,I,J){nn(()=>{this.cartDisplayRef()&&(s.cartDisplayRef=this.cartDisplayRef())});super(I);this.form=i;this.intercom=_;this.role=x;this.toggle=A;this.lowOnStock=c;this.menuData$.subscribe();let K=i.buyForm.controls.Order.controls;this.outlets$=e.entities$,this.outlet=i.outlet,this.isEdit$=$.isEdit$.pipe(E(C=>C?this.outlet.disable():this.outlet.enable())),this.date=K.Date,x.global.Date==!1&&this.date.disable(),this.supplierID=K.SupplierID,this.attention=K.Att,this.poNumber=i.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=T.returnInvoiceNumber,this.cart$=s.cart$,this.appConfigJSON$=e.appConfigJSON$,this.isOpenDialogOutlet$=c.selectedLowOnStockData.length==0?this.isEdit$.pipe(X(C=>G.createNewTransaction$.pipe(d(y=>y||C))),d(C=>!C)):tt(!1),c.selectedLowOnStockData.length&&(i.setOutletForm({ID:c.selectedLowOnStockData[0].EntityID,Name:c.selectedLowOnStockData[0].Outlet}),J.post("/API/catalog/variant/GetVariantByListID",{ListID:c.selectedLowOnStockData.map(C=>C.ID),EntityID:c.selectedLowOnStockData[0].EntityID}).pipe(d(C=>C.map(y=>this.setUnitPrice(y)).map(y=>({VariantID:y.ID,UnitPrice:y.UnitPrice})))).subscribe(C=>{i.setDeliveryEntityID(c.selectedLowOnStockData[0].EntityID);let y=c.selectedLowOnStockData.map(N=>({Quantity:N.Quantity,UnitQuantity:N.UnitQuantity,UnitPrice:C.find(k=>k.VariantID==N.VariantID).UnitPrice,Code:N.Code,Name:N.Product,DiscountAmount:N.DiscountAmount,Discount:N.Discount,Total:N.Total*C.find(k=>k.VariantID==N.VariantID).UnitPrice,VariantID:N.VariantID}));s.editForm(y)})),this.paymentComplete$=G.paymentComplete$,this.supplierPOTypes$=e.supplierPOTypes$,this.toggleState$=A.toggleState$,this.initFulfillmentDifferentOutlet()}cartDisplayRef=Jt("cartDisplayRef",{read:wi});variantAutocompleteEndpoint=Ae.GetVariantSuggestionsByEntityID;sf=le(Nt);outlets$;quickKeyPack$;outlet;poNumber;date;supplierID;variantAutocomplete=new ce;variantQuickKey=new ce;returnInvoiceNumber;cart$;appConfigJSON$;attention;isEdit$;paymentComplete$;supplierPOTypes$;isOpenDialogOutlet$;toggleState$;renderer=le(zi);isFulfillmentDifferentOutlet=Le(!1);fulfillmentOutletName=Le("");ngAfterViewInit(){let e=document.querySelector("#full-container");this.renderer.addClass(e,"full-container"),this.intercom.hideLauncher()}initFulfillmentDifferentOutlet(){Ce([this.form.outlet.valueChanges.pipe(je(this.form.outlet.value)),this.form.deliveryEntityID.valueChanges.pipe(je(this.form.deliveryEntityID.value)),this.outlets$]).pipe(Y()).subscribe(([e,i,o])=>{let s=e??this.form.outlet.value,T=i??this.form.deliveryEntityID.value;if(S.IsNotEmpty(T)&&T!=S.GuidEmpty&&s?.ID!=T){let _=o.find($=>$.ID==T);this.fulfillmentOutletName.set(_?.Name??""),this.isFulfillmentDifferentOutlet.set(!0)}else this.isFulfillmentDifferentOutlet.set(!1)})}setUnitPrice(e){let i=w({},e);return S.IsNotEmpty(e.OrderPrice)?i.UnitPrice=e.OrderPrice:i.UnitPrice=e.UnitCost,i}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(i){return new(i||n)(u(de),u(H),u(Xe),u(te),u(mt),u(Cn),u(Ve),u($e),u(he),u(yn),u(Zt),u(Pn),u(re))};static \u0275cmp=F({type:n,selectors:[["POS-buy-v2"]],viewQuery:function(i,o){i&1&&Lt(o.cartDisplayRef,rr,5,wi),i&2&&Qt()},features:[Ne([te,$e,Ot,Ve,H,Pt,de,It,Xe,Ze,mt,Nt]),Xi],decls:5,vars:3,consts:[["fulfillmentIndicator",""],["cartDisplayRef",""],[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"],[1,"d-inline-block","pt-1","px-2","w-100"],[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"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"ngClass","matTooltip"],["role","button",1,"d-flex","align-items-center","cursor-pointer","w-100"],[3,"ngClass"],[1,"fa-duotone","fa-light","fa-truck"],[1,"text--truncated"]],template:function(i,o){if(i&1&&(h(0,pr,1,1,"POS-complete",2),f(1,"async"),Zi(2,fr,48,57,"div",3),ut(3,Cr,5,8,"ng-template",null,0,Wt)),i&2){let s;v((s=g(1,1,o.paymentComplete$))?0:2,s)}},dependencies:[se,Ge,an,Ye,be,ae,ze,Hn,Gn,kn,ri,oi,qn,li,yi,Ii,Pi,lt,rt,Ee,Kt],styles:[".left-toolbar-container[_ngcontent-%COMP%]{position:relative}.left-toolbar-container[_ngcontent-%COMP%] POS-invoice-number-form[_ngcontent-%COMP%]{position:absolute;top:34px;left:32px}.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.fa-id-badge[_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}.d-flex[_ngcontent-%COMP%] .text--truncated[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}"]})};export{ao as BuyV2Component};