dealpos 26.40.1 → 26.40.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 (108) hide show
  1. package/browser/{chunk-RIM4BYT6.js → chunk-2IHALSUS.js} +1 -1
  2. package/browser/{chunk-ZMXLVZRG.js → chunk-2V2VITNP.js} +1 -1
  3. package/browser/{chunk-OHSJRNHY.js → chunk-3C5VCQ5H.js} +1 -1
  4. package/browser/{chunk-ECHR2BRT.js → chunk-3ICQ544R.js} +1 -1
  5. package/browser/{chunk-SI4ZQRQX.js → chunk-3LD5XCOS.js} +1 -1
  6. package/browser/{chunk-C6AYX4IM.js → chunk-3RLLDQHA.js} +2 -2
  7. package/browser/{chunk-G77LVU7W.js → chunk-4J43S3OM.js} +1 -1
  8. package/browser/{chunk-C3PGHCWB.js → chunk-4LO4PLF7.js} +1 -1
  9. package/browser/{chunk-KKLVVYTR.js → chunk-5XFB6R2C.js} +1 -1
  10. package/browser/{chunk-7UQ5FU2W.js → chunk-6ALTFE5Y.js} +1 -1
  11. package/browser/{chunk-P3HVD6OS.js → chunk-6AZCVLLD.js} +1 -1
  12. package/browser/{chunk-PRUUVFBN.js → chunk-6TK3X2FW.js} +2 -2
  13. package/browser/{chunk-YBHT455P.js → chunk-7M2LXZJQ.js} +1 -1
  14. package/browser/{chunk-IXOQJS6A.js → chunk-7XXLEXHL.js} +1 -1
  15. package/browser/{chunk-TCIM4YUE.js → chunk-ABCHSRRW.js} +1 -1
  16. package/browser/{chunk-TB4WHJBK.js → chunk-AXO5A6P7.js} +1 -1
  17. package/browser/{chunk-7I65WMIZ.js → chunk-B6Y2K43X.js} +1 -1
  18. package/browser/{chunk-MVS4VFVA.js → chunk-BBQ4LFRM.js} +1 -1
  19. package/browser/{chunk-DL562OE3.js → chunk-C5WHZL4L.js} +1 -1
  20. package/browser/{chunk-7OMUFQ4G.js → chunk-CCUCKXVM.js} +1 -1
  21. package/browser/{chunk-MNK37ZBS.js → chunk-CDWFSH6N.js} +1 -1
  22. package/browser/{chunk-C4L3K7AQ.js → chunk-CTSKPXAS.js} +1 -1
  23. package/browser/{chunk-ESWN2MF7.js → chunk-D5JWFWAF.js} +1 -1
  24. package/browser/{chunk-AYQETPXU.js → chunk-D7OXTPXC.js} +1 -1
  25. package/browser/{chunk-JBPPNUD7.js → chunk-DEFDZ5BC.js} +1 -1
  26. package/browser/{chunk-55EQ26EF.js → chunk-DRQCFHWX.js} +1 -1
  27. package/browser/{chunk-RFZAFNYC.js → chunk-EI7F3WRB.js} +1 -1
  28. package/browser/{chunk-VWFXEK33.js → chunk-EJZKAITO.js} +2 -2
  29. package/browser/{chunk-5EHSENXI.js → chunk-EWJVO53T.js} +1 -1
  30. package/browser/{chunk-3EEVOB43.js → chunk-F7UC5PBH.js} +1 -1
  31. package/browser/{chunk-6RT5GV4C.js → chunk-FXBKR7JT.js} +2 -2
  32. package/browser/{chunk-LB6K4H22.js → chunk-GCPETJGR.js} +1 -1
  33. package/browser/{chunk-3DZU4JJF.js → chunk-GFPX37HG.js} +1 -1
  34. package/browser/chunk-GIZNO34O.js +18 -0
  35. package/browser/{chunk-FUI76MH3.js → chunk-GPBACVIL.js} +1 -1
  36. package/browser/{chunk-MW5WQQG2.js → chunk-GY2TQPCY.js} +1 -1
  37. package/browser/{chunk-HTUO74Q6.js → chunk-H72O63WE.js} +1 -1
  38. package/browser/{chunk-YKQEOZX7.js → chunk-HDB32EBB.js} +1 -1
  39. package/browser/{chunk-APWKKDJC.js → chunk-HJOKFG46.js} +1 -1
  40. package/browser/{chunk-IG5F5226.js → chunk-IIKRLNGB.js} +1 -1
  41. package/browser/{chunk-FQ76FP5V.js → chunk-IIZGMJMS.js} +1 -1
  42. package/browser/{chunk-XDCMOEZQ.js → chunk-IKNZLWT2.js} +2 -2
  43. package/browser/{chunk-7ADOYNDN.js → chunk-J3XM7F6P.js} +2 -2
  44. package/browser/{chunk-DQARMORC.js → chunk-K2Z4KW6U.js} +1 -1
  45. package/browser/{chunk-B5W3OAVJ.js → chunk-K5JKE77B.js} +1 -1
  46. package/browser/{chunk-VAIMBXQD.js → chunk-K66NYUJC.js} +1 -1
  47. package/browser/{chunk-DINW64BN.js → chunk-K6M7ZOJ4.js} +1 -1
  48. package/browser/{chunk-7DDCO6YM.js → chunk-K7KMORPW.js} +1 -1
  49. package/browser/{chunk-KNFVAPC6.js → chunk-KFCZNOAQ.js} +1 -1
  50. package/browser/{chunk-E4ECYJTH.js → chunk-KG753P2Y.js} +1 -1
  51. package/browser/{chunk-GEK7P3AM.js → chunk-KJTYRUB5.js} +1 -1
  52. package/browser/{chunk-PEQD53LS.js → chunk-KY4M3XTT.js} +1 -1
  53. package/browser/{chunk-AW3RXQAI.js → chunk-KYCDVSPQ.js} +1 -1
  54. package/browser/{chunk-G2PSO6YX.js → chunk-LCJTW6YV.js} +2 -2
  55. package/browser/{chunk-X25QN776.js → chunk-LVWH4ACL.js} +1 -1
  56. package/browser/{chunk-RQOS4AQP.js → chunk-LXJJWLEE.js} +1 -1
  57. package/browser/{chunk-TB232GVR.js → chunk-M2NV66LO.js} +1 -1
  58. package/browser/{chunk-PSFX7WNC.js → chunk-MJCSURDY.js} +1 -1
  59. package/browser/{chunk-JTSQDKSX.js → chunk-MJFFCDBL.js} +1 -1
  60. package/browser/{chunk-FXT2LS67.js → chunk-NG7UIQDC.js} +1 -1
  61. package/browser/{chunk-7XPLXGSZ.js → chunk-NRM3DNNY.js} +1 -1
  62. package/browser/{chunk-GW5YF6AP.js → chunk-ONUPUFIL.js} +1 -1
  63. package/browser/{chunk-FQMCZRDU.js → chunk-OSCPLN5H.js} +1 -1
  64. package/browser/{chunk-4JGED4BT.js → chunk-OWBVIG45.js} +1 -1
  65. package/browser/{chunk-FGMHAWVZ.js → chunk-OWYJ6KDX.js} +1 -1
  66. package/browser/{chunk-MMUEFPYM.js → chunk-P5IXCUXY.js} +1 -1
  67. package/browser/{chunk-KZIPVYY2.js → chunk-PBXTRWTJ.js} +1 -1
  68. package/browser/{chunk-JOKF2YI2.js → chunk-PGMA3SJI.js} +1 -1
  69. package/browser/{chunk-7IAMFAZU.js → chunk-Q5WO3DUZ.js} +1 -1
  70. package/browser/{chunk-SSNTKDS5.js → chunk-Q6R6B3YW.js} +1 -1
  71. package/browser/{chunk-JSQJA6DW.js → chunk-QLGAF3TI.js} +1 -1
  72. package/browser/{chunk-ZVXFUQIV.js → chunk-QRFXEF6G.js} +1 -1
  73. package/browser/{chunk-BDXA3YAT.js → chunk-R5BORYUY.js} +1 -1
  74. package/browser/{chunk-X7PSBMGG.js → chunk-R6UJO3DG.js} +1 -1
  75. package/browser/chunk-RLY7D3ZT.js +1 -0
  76. package/browser/chunk-RREGFM6B.js +1 -0
  77. package/browser/{chunk-XRJCHFJG.js → chunk-SKH6WQNA.js} +1 -1
  78. package/browser/{chunk-P6T6L7FM.js → chunk-TDNQIIMR.js} +1 -1
  79. package/browser/{chunk-RCQ6HA2C.js → chunk-TVBNCCEZ.js} +2 -2
  80. package/browser/{chunk-BTFYQUY2.js → chunk-TYSXYSJ2.js} +1 -1
  81. package/browser/{chunk-IVSUDHD7.js → chunk-TZANH7BC.js} +1 -1
  82. package/browser/{chunk-YYYJ7A6W.js → chunk-U3PESBD4.js} +1 -1
  83. package/browser/{chunk-Z5APXVTP.js → chunk-UEIHPHRX.js} +1 -1
  84. package/browser/{chunk-FMP4JKFU.js → chunk-UNMRX6O5.js} +1 -1
  85. package/browser/{chunk-K2AMYUGI.js → chunk-UYWOWA5F.js} +1 -1
  86. package/browser/{chunk-VOMFXH25.js → chunk-V44R3JLR.js} +1 -1
  87. package/browser/{chunk-OOJUGHWJ.js → chunk-V7PEO27W.js} +1 -1
  88. package/browser/{chunk-2PSC3G4V.js → chunk-VDCQ723D.js} +1 -1
  89. package/browser/{chunk-EEV3C75C.js → chunk-VYKYX4HS.js} +1 -1
  90. package/browser/{chunk-2466FQDN.js → chunk-W5XX7JGG.js} +1 -1
  91. package/browser/{chunk-WBGKPO2E.js → chunk-W6GVQP2V.js} +1 -1
  92. package/browser/{chunk-GIO6WMJY.js → chunk-WB2WJBBF.js} +1 -1
  93. package/browser/{chunk-DJIEUEEZ.js → chunk-WCOPCSGA.js} +1 -1
  94. package/browser/{chunk-LMRIY3UG.js → chunk-XNXWJL33.js} +1 -1
  95. package/browser/{chunk-EX4RMVHU.js → chunk-XPPMFOKI.js} +1 -1
  96. package/browser/{chunk-RQZFBGXM.js → chunk-XYZ76APC.js} +1 -1
  97. package/browser/{chunk-KQGDQFWL.js → chunk-YUZBPKYR.js} +1 -1
  98. package/browser/{chunk-EDN2YR5C.js → chunk-ZECZXNZU.js} +1 -1
  99. package/browser/{chunk-JFR7BQXR.js → chunk-ZQEJAMZJ.js} +1 -1
  100. package/browser/{chunk-UR66DKKU.js → chunk-ZVP3S5VD.js} +1 -1
  101. package/browser/index.html +2 -2
  102. package/browser/{main-JGIBKV5M.js → main-APXWKYLA.js} +1 -1
  103. package/browser/ngsw-config.json +1 -1
  104. package/browser/ngsw.json +498 -498
  105. package/package.json +1 -1
  106. package/browser/chunk-4F7IOEEU.js +0 -18
  107. package/browser/chunk-AYAULIEL.js +0 -1
  108. package/browser/chunk-UO7Y2YRV.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as Gn}from"./chunk-IKOW7NIR.js";import{b as Ia,c as Ta,d as $a,e as Ka,f as il,g as Wn}from"./chunk-YPNAKALE.js";import{a as nl}from"./chunk-PNIEKDO7.js";import{a as Zi}from"./chunk-VJMKJ76S.js";import{a as ol}from"./chunk-HBAQBI6Z.js";import{a as at,b as An,c as wa,d as Vn,e as Fa,f as La,h as Qa,i as qa,j as Wa}from"./chunk-JFR7BQXR.js";import{b as Oa}from"./chunk-LDJX34VR.js";import"./chunk-IG5QFXLW.js";import{a as Qn}from"./chunk-PFTNYBDL.js";import"./chunk-BYXBJQAS.js";import{a as Ya,b as Xa}from"./chunk-FEOMEXPN.js";import{a as Ea,c as Na,d as Ra,e as Aa}from"./chunk-XNTQF53Y.js";import{b as ja,e as Ga,f as Ha,g as za}from"./chunk-FYCVHWE5.js";import{a as tl,b as qn}from"./chunk-VDHK3F4F.js";import{c as Fn,d as Ln,e as Ba,f as Ua}from"./chunk-3VIRUKYH.js";import"./chunk-Q2W7NEUH.js";import{a as Rl}from"./chunk-QITV5CIL.js";import"./chunk-DUBSPAA2.js";import"./chunk-2E5HYZMR.js";import{a as rl,b as al}from"./chunk-V5XJGH2W.js";import{a as jn}from"./chunk-Q3ZNI7UU.js";import{a as el}from"./chunk-N2LG2IO5.js";import{a as Za}from"./chunk-TFMDC7ZG.js";import{a as Oi,b as wi,c as Ja}from"./chunk-I3OTL6ZL.js";import{a as Cr,b as Bn,c as Un}from"./chunk-X55I2643.js";import{b as Wt}from"./chunk-3ZS7KYVP.js";import{b as ka}from"./chunk-H7JNNBL2.js";import"./chunk-VLKLGJDL.js";import{a as Si}from"./chunk-AO63R3DI.js";import"./chunk-P3KIIKY4.js";import"./chunk-ZPIILEA6.js";import"./chunk-7HMU6MXA.js";import{a as Pt}from"./chunk-GWNGKIUL.js";import{a as Va}from"./chunk-2LD4VKHV.js";import"./chunk-BYXBJQAS.js";import{a as fr}from"./chunk-I3WLM5Y4.js";import{e as _a,i as Ii,j as Sa,k as Pa,l as xa}from"./chunk-PSFX7WNC.js";import{a as hr}from"./chunk-S77FVPQM.js";import"./chunk-B53CZMGZ.js";import"./chunk-5UDUWK67.js";import{c as br}from"./chunk-I3WUTJXX.js";import"./chunk-BYXBJQAS.js";import"./chunk-RQCACWGY.js";import{a as En,b as Nn}from"./chunk-ZBZBPMZZ.js";import{a as qt}from"./chunk-DDLXGCOB.js";import{a as Rn}from"./chunk-3JPAA6YB.js";import"./chunk-53CYOKMD.js";import{a as va}from"./chunk-2KWWTRZP.js";import{a as Ma}from"./chunk-QIUN3PYQ.js";import{b as wn,c as Pi,d as xi,e as Di}from"./chunk-MBSYHKPE.js";import{a as Da}from"./chunk-QQUWUBWQ.js";import{a as ya}from"./chunk-PT6PCXOU.js";import"./chunk-52U2QQ43.js";import"./chunk-3XYL5JLY.js";import{p as Ca}from"./chunk-SCH7M36Q.js";import"./chunk-7TQOVQ3O.js";import"./chunk-G53IMHKY.js";import"./chunk-3EAA4CUP.js";import"./chunk-5U2B2SGN.js";import"./chunk-YJV74F2X.js";import"./chunk-WPCHBRKW.js";import{b as ta}from"./chunk-A7VRBYLB.js";import{c as ma,d as ua}from"./chunk-J5EM5XXB.js";import"./chunk-UPH5FSV4.js";import{d as pa}from"./chunk-M43FFEY2.js";import"./chunk-5VC2XYC5.js";import{a as Be}from"./chunk-G56UPMKR.js";import"./chunk-XBINTEVI.js";import"./chunk-BAIS4TWD.js";import{b as ba,c as ha}from"./chunk-O2F7SUYY.js";import{a as ga,b as fa}from"./chunk-XHLEWVPO.js";import"./chunk-ONKLHHM3.js";import"./chunk-4YPA4HZ3.js";import"./chunk-XTOFMSDQ.js";import"./chunk-ZM456L6A.js";import"./chunk-644K7HEV.js";import{a as Yr,d as Xr,f as Zr,h as ea}from"./chunk-LN7LGRLI.js";import"./chunk-EP7SKSJT.js";import"./chunk-LAQZXTBX.js";import{a as ca,b as da}from"./chunk-B35X77UQ.js";import{c as Mi,d as Qt,e as sa}from"./chunk-QMJNI3X6.js";import{r as la}from"./chunk-4BITXMRY.js";import"./chunk-2AOZZW2I.js";import"./chunk-TM2I5PAG.js";import{a as De,b as Pe}from"./chunk-JXEPD3CF.js";import"./chunk-PPMQE2JW.js";import{G as aa,P as Ut,a as ia,b as na,v as oa,y as ra}from"./chunk-FGU4QONB.js";import{a as Vt}from"./chunk-FXLZBN66.js";import{a as Dn,b as Wr,c as Mn}from"./chunk-OKQYRKDJ.js";import{d as Ke,e as kn}from"./chunk-BUIP3UCE.js";import"./chunk-SIAVPMSP.js";import{b as we,g as jr}from"./chunk-EOP7LLRQ.js";import{a as G,b as Le,c as Te,h as Tn}from"./chunk-3V6FZIJD.js";import"./chunk-DEJ5V3PF.js";import"./chunk-T45W4CQR.js";import"./chunk-OK7LFGGQ.js";import"./chunk-VGLTFO5N.js";import"./chunk-UTSVZMZD.js";import{a as q,b as ft,c as Qr}from"./chunk-BP6PECKT.js";import{a as oe}from"./chunk-GNDUQZGK.js";import"./chunk-SKJSLBZP.js";import"./chunk-ZS4XLRDB.js";import"./chunk-NNQW72HA.js";import{a as xe,b as te,c as Y}from"./chunk-BKOMMH62.js";import"./chunk-TNXMA723.js";import"./chunk-TYFAIMTW.js";import"./chunk-SXVOKLC4.js";import{A as St,B as $r,F as $,G as ut,b as In,c as ee,e as _t,f as yi,h as J,i as Ft,l as Lt,m as ze,o as _i,p as ne,q as Gr,s as On,t as Bt,y as Hr,z as zr}from"./chunk-AJDQZ346.js";import{a as qr,c as Jr}from"./chunk-E4ECYJTH.js";import{a as Kr}from"./chunk-TB4WHJBK.js";import"./chunk-YY6WVNU4.js";import{b as $e}from"./chunk-KLHHVIRS.js";import{a as P}from"./chunk-PPTZHIIZ.js";import{a as xn}from"./chunk-5EHSENXI.js";import{n as Q,q as se}from"./chunk-QGYXJUX3.js";import{$ as wr,$a as Cn,Ab as Ie,Ac as Xi,Ad as Br,B as Ir,Ba as v,Bb as X,C as Fe,Cb as Z,Da as Nt,Db as b,E as _e,Ea as kr,Eb as a,Fb as l,Fc as I,Gb as S,Gc as V,Hb as ae,Hc as he,I as We,Ib as le,Ic as He,Jb as dt,Kb as gi,L as Ki,Lb as fi,Lc as At,M as Ue,Mb as vn,Na as ui,Oc as u,Pa as Qe,Pb as M,Pd as Ur,Qb as Er,R as gr,Rd as Sn,Sa as hn,Sb as C,Sc as rt,Sd as Pn,Tb as gt,Tc as pe,Ua as s,Ub as p,Ud as vi,Y as Or,Yb as et,Yc as Vr,Zb as tt,_b as it,aa as vt,bb as je,cc as ge,da as Tr,db as T,dc as Nr,e as ti,ea as N,ec as de,gc as be,hc as d,ic as R,id as yn,j as st,jb as Re,jc as O,ka as w,kc as Oe,kd as ue,l as mi,lc as Rr,m as $i,mc as L,nc as B,oa as c,oc as U,od as Fr,pc as bi,pd as Lr,qc as hi,qd as Ci,ra as y,rc as Rt,s as fe,sa as _,sb as Ji,sc as Yi,sd as mt,t as bn,tc as Ar,ud as K,wb as g,wc as Ge,wd as _n,xa as ct,xc as yt,xd as W,y as Mr,ya as Et,yb as f,yc as re,zb as Xe,zc as pt}from"./chunk-7D344CRC.js";import{a as E,b as z,g as Nl,j as zi}from"./chunk-NF7PG5F2.js";var Hn=class{UserName;UserID;SalesID;CustomerOptions;ServerTime;AppConfigJSON;Denomination;Entities;Registers;Payments;PaymentTypes;Currencies;PoTypes;Taxes;BINS;ServerDateString;ServicesLogistics;WhatsAppConfigJSON;StylesSheet;UserGroupConfig};var xt=class{ID;EntityID;RegisterID;TypeID;Date;Number;CustomerID;SalesID;Discount=0;Discount2=0;DiscountAmount=0;CustomerDiscountRate=0;Note="";DeliveryOutletID;TaxTypeID;CurrencyID;CurrencyRate;PointUsed;InvoicedStateID;ReferenceNumber="";LogisticsServiceID;ParkLabel="";NumberOfPerson;ClientTimestamp;Created;PromotionCoupon="";CouponType=1;PromotionNote="";DeliveryStateID;CouponProvider="Internal";CurrencySymbol;constructor(){this.ID=P.GuidEmpty,this.EntityID=P.GuidEmpty,this.RegisterID=P.GuidEmpty,this.Number="",this.CustomerID=null,this.SalesID=null,this.Discount=0,this.Discount2=0,this.DiscountAmount=0,this.Note="",this.TaxTypeID=P.GuidEmpty,this.CurrencyID=1,this.CurrencyRate=1,this.DeliveryStateID=3,this.PointUsed=0,this.NumberOfPerson=1,this.Date=new Date}removeEnterNote(){this.Note&&(this.Note=this.Note.replace(/\n/g,""))}};var lt=class{ID;Number;Due;Date;CustomDateField;TimeCustom;SurchargePcg;TempSurchargePcg;ToP;Note;ReferenceInvoiceID;PaymentStateID;Sales;DateCustom;constructor(){this.ID=P.GuidEmpty,this.SurchargePcg=0,this.TempSurchargePcg=0,this.Due=null}};var ii=class{Prefix;Seed;Digit;constructor(){this.Prefix=null,this.Seed=null,this.Digit=null}static Generate(e){let t="";if(e.Seed){let i=e.Seed+"";for(;i.length<e.Digit;)i="0"+i;t=P.StringFormat(e.Prefix,i)}return t}};var $n=class{RegisterID;RegisterCode;EntityID;EntityName;NumberElement;InvoiceNumberElement;ListSales;QuickKeyPack;PrintTemplate;DefaultSalesOrderTag;DefaultTaxType;DefaultWarehouse;MemberPoint;ParkLayoutPack;Promotion;DefaultPrintTemplate;NewOrderID;Payments;SplitPaymentEnabled;constructor(){this.RegisterID=null,this.RegisterCode=null,this.EntityID=null,this.EntityName=null,this.NumberElement=new ii,this.InvoiceNumberElement=new ii,this.Promotion=[],this.SplitPaymentEnabled=!0}};var Dt=class{Name;Phone;Address;City;constructor(){this.Name="",this.Phone="",this.Address="",this.City=""}};var Ti=class{DeliveryEntityID;NewOrderID;Type};var x=class n{store=Gn({cartItems:[],parkTemporaryItem:[],loadForm:new Hn,order:new xt,invoice:new lt,payments:[],register:new $n,shipping:new Dt,promotions:[],state:0,customer:new En,action:new Ti,completeOrder:null});loadForm=this.store.select(e=>Object.freeze(e.loadForm()));register=this.store.select(e=>Object.freeze(e.register()));order=this.store.select(e=>Object.freeze(e.order()));cartItems=this.store.select(e=>Object.freeze(e.cartItems()));parkTemporaryItem=this.store.select(e=>Object.freeze(e.parkTemporaryItem()));payments=this.store.select(e=>Object.freeze(e.payments()));shipping=this.store.select(e=>Object.freeze(e.shipping()));invoice=this.store.select(e=>Object.freeze(e.invoice()));promotions=this.store.select(e=>Object.freeze(e.promotions()));state=this.store.select(e=>Object.freeze(e.state()));customer=this.store.select(e=>Object.freeze(e.customer()));completeOrder=this.store.select(e=>Object.freeze(e.completeOrder()));currency=u(()=>{let e=this.loadForm()?.Currencies,t=this.order()?.CurrencyID,i=e?.find(o=>o.ID===t);return i||e[0]});tax=u(()=>{let e=this.loadForm()?.Taxes,t=this.order()?.TaxTypeID,i=e?.find(o=>o.ID===t);return i||(e&&e.length>0?e[0]:void 0)});SalesOrderTag=u(()=>{let e=this.loadForm()?.PoTypes,t=this.order()?.TypeID,i=e?.find(o=>o.ID===t);return i||(e&&e.length>0?e[0]:void 0)});prepaidPackageItems=u(()=>this.cartItems().filter(t=>t.Variant.TypeID===10));action=this.store.select(e=>Object.freeze(e.action()));updateLoadForm(e){this.store.update("loadForm",e)}updateRegister(e){this.store.update("register",e)}updateOrder(e){this.store.update("order",e)}updateCustomer(e){this.store.update("customer",e)}updateCartItems(e){this.store.update("cartItems",e)}updateParkTemporaryItem(e){this.store.update("parkTemporaryItem",e)}updateInvoice(e){this.store.update("invoice",e)}updatePayments(e){this.store.update("payments",e)}updateShipping(e){this.store.update("shipping",e)}updatePromotions(e){this.store.update("promotions",e)}updateState(e){this.store.update("state",e)}updateAction(e){this.store.update("action",e)}updateCompleteOrder(e){this.store.update("completeOrder",e)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var Ce=class{static GetCustomerPrivilegeByID="/API/Contact/GetPrivilegeByCustomerID";static GetPOSStorage="/API/POS/LoadPOS";static GetRegisterInfo="/API/POS/GetRegisterInfoByID";static GetCustomerByCode="/API/Contact/GetByCode";static GetSalesOrderPrint="/API/POS/GetSalesOrderPrint";static CheckExistingInvoiceNumber="/API/POS/CheckExistingNumber";static CreateCustomer="/API/Contact/Customer/Create";static GenerateGopayQrCode="/API/Gopay/GenerateQR";static GopayVerifyPayment="/API/Gopay/VerifyQR";static GenerateBcaQrCode="/API/BCA/GenerateQR";static BcaVerifyPayment="/API/BCA/VerifyQR";static GenerateXenditQrCode="/API/Xendit/GenerateQR";static XenditVerifyPayment="/API/Xendit/VerifyQR";static SubmitOrder="/API/POS/SubmitInvoice";static SendOtpEmail="/API/otp/email";static SendOtpWhatsApp="/API/otp/WhatsApp";static VerifyEmailOtp="/API/otp/verifyemail";static VerifyWhatsAppOtp="/API/otp/verifywhatsapp";static VerifyPin="/API/pos/VerifyPin"};var A=class n{eventBus=new ti;emit(e){this.eventBus.next(e)}on(e){return this.eventBus.pipe(_e(t=>t.type===e))}ngOnDestroy(){this.eventBus.complete()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var jt=class n{STORAGE_KEY="ecrConfig";_state=v(this.initState());isEnabled=u(()=>this._state().enabled);ecrUrl=u(()=>this._state().url);url=u(()=>{let e=this._state().url;if(!e)return null;let t=e.split("/");return t.pop(),t.join("/")});connect(e){let t={enabled:!0,url:e,timestamp:new Date().toDateString()};localStorage.setItem(this.STORAGE_KEY,JSON.stringify(t)),this._state.set(t)}disconnect(){let e={enabled:!1,url:null,timestamp:new Date().toDateString()};localStorage.setItem(this.STORAGE_KEY,JSON.stringify(e)),this._state.set(e)}initState(){let e=localStorage.getItem(this.STORAGE_KEY),t={enabled:!1,url:null,timestamp:""};return P.IsNotEmpty(e)?JSON.parse(e):t}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var nt=class n{ecrStorage=c(jt);toastr=c(Q);socketConnection;_ecrEvent=new ti;ecrEvent$=this._ecrEvent.asObservable();_isSignalRConnected=v(!1);isConnected=u(()=>this.ecrStorage.isEnabled()&&this._isSignalRConnected());initEcrOnStartup(){if(this.isConnected()){let t=this.ecrStorage.ecrUrl();t&&this.initConnection(t)}}initConnection(e){this.socketConnection=new Mn().withUrl(e).withAutomaticReconnect().configureLogging(Dn.Information).build(),this.ecrStorage.connect(e),this.listenToConnectionEvents(),this.listenToEvents(),this.startConnection()}stopConnection(){this.socketConnection.stop().then(()=>{console.info("SignalR for ECR is Disconnected")})}startConnection(){this.socketConnection.start().then(()=>{this._isSignalRConnected.set(!0),this.toastr.success("Successfully connected to ECR","Success")}).catch(e=>{this.toastr.error(e,"Failed connecting to ECR"),console.log(e)})}listenToEvents(){this.socketConnection.on("EcrEvent",e=>{this._ecrEvent.next(e)})}listenToConnectionEvents(){this.socketConnection.onreconnecting(()=>{console.info("SignalR for ECR is Reconnecting")}),this.socketConnection.onreconnected(()=>{console.info("SignalR for ECR is Reconnected"),this._isSignalRConnected.set(!0)}),this.socketConnection.onclose(()=>{console.info("SignalR for ECR is Closed"),this._isSignalRConnected.set(!1)})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var ki=class n{STORAGE_KEY="cashMachineConfig";_state=v(this.initState());isEnabled=u(()=>this._state().enabled);ecrUrl=u(()=>this._state().url);url=u(()=>this._state().url);connect(e){let t={enabled:!0,url:e,timestamp:new Date().toDateString()};localStorage.setItem(this.STORAGE_KEY,JSON.stringify(t)),this._state.set(t)}disconnect(){let e={enabled:!1,url:null,timestamp:new Date().toDateString()};localStorage.setItem(this.STORAGE_KEY,JSON.stringify(e)),this._state.set(e)}initState(){let e=localStorage.getItem(this.STORAGE_KEY),t={enabled:!1,url:null,timestamp:""};return P.IsNotEmpty(e)?JSON.parse(e):t}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var Mt=class n{CashMachineSocketUrl="CashMachineHUB";httpService=c(ya);cashMachineConfig=c(ki);posHttpResponseService=c(Pa);salesOrderDataModelService=c(Sa);socketConnection;_cashMachineEvent=new ti;_withdrawMoneyStatus=new ti;cashMachineEvent$=this._cashMachineEvent.asObservable();withdrawMoneyStatus$=this._withdrawMoneyStatus.asObservable();_isSignalRConnected=v(!1);isConnected=u(()=>this.cashMachineConfig.isEnabled()&&this._isSignalRConnected()&&this.isConnectedState());toastr=c(Q);dialog=c(Te);totalAmountBeforePayment=v(0);initCashMachineOnStartup(){if(this.cashMachineConfig.isEnabled()){let t=this.cashMachineConfig.url();t&&this.initConnection(t)}}url=v("");checkPaymentStatus(e){return this.getCashMachineTotalAmount().pipe(fe(t=>{let i=this.totalAmountBeforePayment()+e;return t>=i}),N(t=>{t||this.toastr.error("Payment has not been settled.","Payment Failed")}))}initConnection(e){this.url.set(e),this.socketConnection=new Mn().withUrl(`${e}/${this.CashMachineSocketUrl}`).withAutomaticReconnect().configureLogging(Dn.Information).build(),this.listenToConnectionEvents(),this.listenToEvents(),this.startConnection(e)}startConnection(e){this.socketConnection.start().then(()=>{this._isSignalRConnected.set(!0),this.toastr.success("Successfully connected to Cash Machine","Success"),this.cashMachineConfig.connect(e)}).catch(t=>{this.cashMachineConfig.disconnect(),this.toastr.error(t,"Failed connecting to Cash Machine"),console.log(t)})}listenToEvents(){this.socketConnection.on("OnReceiveMoney",e=>{if(e){let t=JSON.parse(e);this._cashMachineEvent.next(t)}}),this.socketConnection.on("WithdrawMoneyStatus",e=>{e&&this._withdrawMoneyStatus.next(e?.status)})}stopConnection(){this.socketConnection.stop().then(()=>{console.info("SignalR for Cash Machine is Disconnected"),this.cashMachineConfig.disconnect()})}isConnectedState(){return this.socketConnection&&P.IsNotEmpty(this.socketConnection.connectionId)&&this.socketConnection.state===Wr.Connected}listenToConnectionEvents(){this.socketConnection.onreconnecting(()=>{console.info("SignalR for Cash Machine is Reconnecting")}),this.socketConnection.onreconnected(()=>{console.info("SignalR for Cash Machine is Reconnected"),this._isSignalRConnected.set(!0)}),this.socketConnection.onclose(e=>{console.log(e),console.info("SignalR for Cash Machine is Closed"),this.dialog.closeAll(),this._isSignalRConnected.set(!1)})}chargeCashMachineAmount(e,t){return this.httpService.post(`${this.url()}${oe.ChargeMoneyAmount}`,{Amount:e,Number:t})}getCashMachineTotalAmount(){return this.httpService.get(`${this.url()}${oe.GetCashMachineTotal}`).pipe(fe(e=>e.total))}getCashMachineDenominations(){return this.httpService.get(`${this.url()}${oe.GetCashMachineBreakdown}`)}sendWithdrawMoney(e){let t=this.findCurrencyById();return this.httpService.post(`${this.url()}${oe.CashMachineWithdraw}`,{value:e,countryCode:t?.Name||""})}findCurrencyById(){let e=this.salesOrderDataModelService.Data?.Order?.CurrencyID;return(this.posHttpResponseService.Data?.Currencies).find(o=>o.ID==e)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var en=class n{eventBusService=c(A);storeService=c(x);httpService=c(se);ecrSignalRService=c(nt);cashMachineService=c(Mt);constructor(){this.initLoadForm()}initLoadForm(){this.httpService.post(Ce.GetPOSStorage,{}).pipe(q()).subscribe(e=>{this.storeService.updateLoadForm(e),this.eventBusService.emit({type:"[Order] Load Form",payload:{form:e}}),this.initCurrency(e),this.ecrSignalRService.initEcrOnStartup(),this.cashMachineService.initCashMachineOnStartup()})}initCurrency(e){let t=e?.AppConfigJSON?.CoreDefaults?.CurrencyID,i=e.Currencies.find(o=>o.ID===t);this.eventBusService.emit({type:"[Order] Update Currency",payload:{currency:i}})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac})};var Gt=class n{odsConfigType=v(0);setODSConfig(e){this.odsConfigType.set(e)}isEnabled(){return this.odsConfigType()>0}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var ce=class n{role=c($e);_return=v(this.role.sell?.Return);_priceMinimum=v(this.role.sell?.PriceMinimum);_unitPriceEditor=v(this.role.sell?.UnitPriceEditor);_salesPerson=v(this.role.sell?.SalesPerson);_discount=v(this.role.sell?.Discount);_costVisible=v(this.role.product?.Cost);_commission=v(this.role.sell?.Commission);_sellEditor=v(this.role.sell?.Edit);_sellCreate=v(this.role.sell?.Create);_pricebookSelector=v(this.role.sell?.PricebookSelector);_priceVisible=v(this.role.sell?.PriceVisible);_shipping=v(this.role.sell?.Shipping);_retrieve=v(this.role.sell?.RetrieveR);_creditSalesLock=v(this.role.sell?.CreditSalesLock);_print=v(this.role.global?.Print);_date=v(this.role.global?.Date);_numberEditor=v(this.role.sell?.Number);_payment=v(this.role.sell?.Payment);_customerInputLock=v(this.role.sell?.CustomerInputLock);_paymentCodeLock=v(this.role.sell?.PaymentCodeLock);_tax=v(this.role.sell?.Tax);_deleteItem=v(this.role.sell?.DeleteItem);_bundlingPrice=v(this.role.sell?.BundlingPrice);_email=v(this.role.sell?.Email);_parkedDeletion=v(!1);_park=v(this.role.sell?.Park);_couponInputLock=v(this.role.sell?.CouponInputLock);_orderView=v(this.role.order?.View);_reprint=v(this.role.order?.Print);_contactCreate=v(this.role.contact?.Create);_contacts=v(this.role.contact?.View);_inventoryView=v(this.role.inventory?.View);_debtView=v(this.role.debt?.View);_sellDelete=v(this.role.sell?.Delete);_deliveryEditor=v(this.role.logistic?.Edit);_prepaidPackageCreate=v(this.role.prepaidPackage?.Create);return=u(()=>this._return());priceVisible=u(()=>this._priceVisible());unitPriceEditor=u(()=>this._unitPriceEditor());salesPerson=u(()=>this._salesPerson());discount=u(()=>this._discount());costVisible=u(()=>this._costVisible());commission=u(()=>this._commission());sellEditor=u(()=>this._sellEditor());sellCreate=u(()=>this._sellCreate());pricebookSelector=u(()=>this._pricebookSelector());priceMinimum=u(()=>this._priceMinimum());shipping=u(()=>this._shipping());retrieve=u(()=>this._retrieve());creditSalesLock=u(()=>this._creditSalesLock());print=u(()=>this._print());date=u(()=>this._date());numberEditor=u(()=>this._numberEditor());payment=u(()=>this._payment());customerInputLock=u(()=>this._customerInputLock());paymentCodeLock=u(()=>this._paymentCodeLock());tax=u(()=>this._tax());deleteItem=u(()=>this._deleteItem());bundlingPrice=u(()=>this._bundlingPrice());email=u(()=>this._email());parkedDeletion=u(()=>this._parkedDeletion());park=u(()=>this._park());couponInputLock=u(()=>this._couponInputLock());orderView=u(()=>this._orderView());reprint=u(()=>this._reprint());contactCreate=u(()=>this._contactCreate());contacts=u(()=>this._contacts());inventoryView=u(()=>this._inventoryView());debtView=u(()=>this._debtView());sellDelete=u(()=>this._sellDelete());deliveryEditor=u(()=>this._deliveryEditor());prepaidPackageCreate=u(()=>this._prepaidPackageCreate());updateReturn(e){this._return.set(e)}updatePriceVisible(e){this._priceVisible.set(e)}updateUnitPriceEditor(e){this._unitPriceEditor.set(e)}updateSalesPerson(e){this._salesPerson.set(e)}updateDiscount(e){this._discount.set(e)}updateCostVisible(e){this._costVisible.set(e)}updateCommission(e){this._commission.set(e)}updateSellEditor(e){this._sellEditor.set(e)}updateSellCreate(e){this._sellCreate.set(e)}updatePricebookSelector(e){this._pricebookSelector.set(e)}updatePriceMinimum(e){this._priceMinimum.set(e)}updateShipping(e){this._shipping.set(e)}updateRetrieve(e){this._retrieve.set(e)}updateCreditSalesLock(e){this._creditSalesLock.set(e)}updatePrint(e){this._print.set(e)}updateDate(e){this._date.set(e)}updateNumberEditor(e){this._numberEditor.set(e)}updatePayment(e){this._payment.set(e)}updateCustomerInputLock(e){this._customerInputLock.set(e)}updatePaymentCodeLock(e){this._paymentCodeLock.set(e)}updateTax(e){this._tax.set(e)}updateDeleteItem(e){this._deleteItem.set(e)}updateBundlingPrice(e){this._bundlingPrice.set(e)}updateEmail(e){this._email.set(e)}updateParkedDeletion(e){this._parkedDeletion.set(e)}updatePark(e){this._park.set(e)}updateCouponInputLock(e){this._couponInputLock.set(e)}updateOrderView(e){this._orderView.set(e)}updateReprint(e){this._reprint.set(e)}updateContactCreate(e){this._contactCreate.set(e)}updateContacts(e){this._contacts.set(e)}updateInventoryView(e){this._inventoryView.set(e)}updateDebtView(e){this._debtView.set(e)}updateSellDelete(e){this._sellDelete.set(e)}updateDeliveryEditor(e){this._deliveryEditor.set(e)}updatePrepaidPackageCreate(e){this._prepaidPackageCreate.set(e)}updateFullAccess(e){this._return.set(e),this._priceMinimum.set(e),this._unitPriceEditor.set(e),this._salesPerson.set(e),this._discount.set(e),this._costVisible.set(e),this._commission.set(e),this._sellEditor.set(e),this._sellCreate.set(e),this._pricebookSelector.set(e),this._priceVisible.set(e),this._shipping.set(e),this._retrieve.set(e),this._creditSalesLock.set(e),this._print.set(e),this._date.set(e),this._numberEditor.set(e),this._payment.set(e),this._customerInputLock.set(e),this._paymentCodeLock.set(e),this._tax.set(e),this._deleteItem.set(e),this._bundlingPrice.set(e),this._email.set(e),this._parkedDeletion.set(e),this._park.set(e),this._couponInputLock.set(e),this._orderView.set(e),this._reprint.set(e),this._contactCreate.set(e),this._contacts.set(e),this._inventoryView.set(e),this._debtView.set(e),this._sellDelete.set(e),this._deliveryEditor.set(e),this._prepaidPackageCreate.set(e)}resetToOriginal(){this._return.set(this.role.sell?.Return),this._priceVisible.set(this.role.sell?.PriceVisible),this._unitPriceEditor.set(this.role.sell?.UnitPriceEditor),this._salesPerson.set(this.role.sell?.SalesPerson),this._discount.set(this.role.sell?.Discount),this._costVisible.set(this.role.product?.Cost),this._commission.set(this.role.sell?.Commission),this._sellEditor.set(this.role.sell?.Edit),this._sellCreate.set(this.role.sell?.Create),this._pricebookSelector.set(this.role.sell?.PricebookSelector),this._priceMinimum.set(this.role.sell?.PriceMinimum),this._shipping.set(this.role.sell?.Shipping),this._retrieve.set(this.role.sell?.RetrieveR),this._creditSalesLock.set(this.role.sell?.CreditSalesLock),this._print.set(this.role.global?.Print),this._date.set(this.role.global?.Date),this._numberEditor.set(this.role.sell?.Number),this._payment.set(this.role.sell?.Payment),this._customerInputLock.set(this.role.sell?.CustomerInputLock),this._paymentCodeLock.set(this.role.sell?.PaymentCodeLock),this._tax.set(this.role.sell?.Tax),this._deleteItem.set(this.role.sell?.DeleteItem),this._bundlingPrice.set(this.role.sell?.BundlingPrice),this._email.set(this.role.sell?.Email),this._parkedDeletion.set(!1),this._park.set(this.role.sell?.Park),this._couponInputLock.set(this.role.sell?.CouponInputLock),this._orderView.set(this.role.order?.View),this._reprint.set(this.role.order?.Print),this._contactCreate.set(this.role.contact?.Create),this._contacts.set(this.role.contact?.View),this._inventoryView.set(this.role.inventory?.View),this._debtView.set(this.role.debt?.View),this._sellDelete.set(this.role.sell?.Delete),this._deliveryEditor.set(this.role.logistic?.Edit),this._prepaidPackageCreate.set(this.role.prepaidPackage?.Create)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var Kn=class n{STORAGE_KEY="outlet_register";save(e,t){t||e&&localStorage.setItem(this.STORAGE_KEY,JSON.stringify(e))}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var tn=class n{storeService=c(x);toastrService=c(Q);httpService=c(se);eventService=c(A);signalRClient=c(Vt);orderDisplayService=c(Gt);sellRoleService=c(ce);outletRegisterStorage=c(Kn);selectedRegister=u(()=>this.storeService.register());isOpenDialog$=this.eventService.on("[Order] Load Form").pipe(fe(()=>this.checkOpenDialogRegisters()));constructor(){let e;Fe(this.eventService.on("[Register] Updated").pipe(_e(t=>!!t.payload?.register),N(t=>{let o=t?.payload?.register?.RegisterID;this.signalRClient.SubscribeGroup(o,e),e=o})),this.eventService.on("[Register] Update Register By ID").pipe(N(t=>{let i=t.payload?.id;this.updateRegisterById(i)})),this.eventService.on("[Order] Update Customer PO Type").pipe(N(t=>{let i=t.payload?.poType;this.updatePrintTemplateByPoType(i)})),this.eventService.on("[Register] Update Register Number").pipe(N(t=>{let i=t.payload?.numberElement;this.updateRegisterStore({NewOrderID:i?.NewOrderID,NumberElement:i?.OrderNumberElement,InvoiceNumberElement:i?.InvoiceNumberElement})})),this.eventService.on("[Register] Update Print Template").pipe(N(t=>{let i=t.payload?.printTemplate;this.updateRegisterStore({PrintTemplate:i})})),this.eventService.on("[Register] Record Opening Cash").pipe(N(t=>{this.recordOpeningCash(t.payload?.registerId,t.payload?.amount)}))).pipe(q()).subscribe()}updatePrintTemplateByPoType(e){let t=this.storeService.register();e.PrintTemplateID==0?this.updateRegisterStore({PrintTemplate:t.DefaultPrintTemplate}):this.getSalesOrderPrint(e.PrintTemplateID).subscribe(i=>{this.updateRegisterStore({PrintTemplate:i.Template})})}updateRegisterById(e){this.getRegisterById(e).subscribe(t=>{let i=this.storeService.register().RegisterID,o=this.findOutletRegisterById(e),r=this.applyRegisterSideEffects(t,o);this.loadOdsConfig(r.EntityID),this.persistSelectedOutletRegister(o),this.updateRegisterStore(r),this.initNewOrder(r.RegisterID,i),this.openStartingCashIfRequired(r.RegisterID,i)})}applyRegisterSideEffects(e,t){return z(E({},e),{RegisterCode:t?.Code??e.RegisterCode,DefaultPrintTemplate:e.PrintTemplate,SplitPaymentEnabled:this.findSplitPaymentConfig(e.EntityID)})}findOutletRegisterById(e){return this.storeService.loadForm()?.Registers?.find(t=>t.ID===e)}findSplitPaymentConfig(e){let i=this.storeService.loadForm()?.Entities?.find(o=>o.ID===e);return i?i.SplitPaymentEnabled:!1}persistSelectedOutletRegister(e){this.outletRegisterStorage.save(e,this.sellRoleService.deleteItem())}openStartingCashIfRequired(e,t){let i=this.storeService.loadForm();if(!i?.AppConfigJSON?.ModuleShift?.Closure?.Enabled||e===t)return;let r=i?.Registers?.find(h=>h.ID===e);if(!r||!P.IsEmpty(r.LoginID)||!P.IsEmpty(r.CashierID))return;let m={type:"[Register] Open Starting Cash",payload:{registerId:e}};this.eventService.emit(m)}recordOpeningCash(e,t){this.httpService.post(oe.RecordOpeningCash,{RegisterID:e,OpAmount:t}).subscribe(()=>this.markRegisterAsOpened(e,t))}markRegisterAsOpened(e,t){let i=this.storeService.loadForm(),o=yn(new Date,"dd MM yyyy HH:mm","en-US"),r=(i?.Registers??[]).map(m=>m.ID===e?z(E({},m),{LoginID:i?.UserName,OpeningCash:t,Open:!0,State:"Open",StartDisplay:o}):m);this.storeService.updateLoadForm(z(E({},i),{Registers:r}))}initNewOrder(e,t){e!==t&&this.storeService.state()!==2&&this.eventService.emit({type:"[Order] New Order",payload:{generateNewNumber:!1}})}updateRegisterStore(e){let t=this.storeService.register();this.storeService.updateRegister(E(E({},t),e)),this.eventService.emit({type:"[Register] Updated",payload:{register:this.storeService.register()}})}getRegisterById(e){return this.httpService.get(Ce.GetRegisterInfo,[{key:"RegisterID",value:e}])}getSalesOrderPrint(e){return this.httpService.post(Ce.GetSalesOrderPrint,{TemplateID:e})}checkOpenDialogRegisters(){if(this.storeService.state()===2)return!1;let e=this.storeService.loadForm(),t=e.Registers,i=e.AppConfigJSON?.ModuleShift?.Closure?.Enabled,o=e.UserName;if(t.length>1){let r=t.find(m=>m.LoginID==o);if(r)return this.updateRegisterById(r.ID),!1;{let m=this.selectedRegister()?this.selectedRegister().RegisterID:null;if(P.IsEmpty(m))return!0;if(i)return!0}}else{if(t.length==1)return this.updateRegisterById(t[0].ID),!1;this.toastrService.warning("You do not have access to any OUTLET","Warning")}return!1}loadOdsConfig(e){this.httpService.get(`/api/outlet/GetOrderDisplayBroadcastMode?EntityID=${e}`).pipe(N(t=>{this.orderDisplayService.setODSConfig(t.form?.OrderDisplayBroadcastMode??0)})).subscribe()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac})};var Vl=n=>({active:n}),Fl=n=>({gray:n});function Ll(n,e){if(n&1){let t=M();a(0,"span",16),C("click",function(o){y(t);let r=p().$implicit;return p().onCloseRegister(r),_(o.stopPropagation())}),l()}}function Bl(n,e){n&1&&(a(0,"div")(1,"span",17),d(2,"VACANT"),l()())}function Ul(n,e){if(n&1&&(a(0,"div")(1,"span",18),S(2,"i",19),a(3,"font"),d(4),l()(),a(5,"span",20),S(6,"i",21),a(7,"font"),d(8),l()()()),n&2){let t=p().$implicit;s(4),R(t.LoginID),s(4),O("",t.StartDisplay.split(" ")[3]," - Now")}}function Ql(n,e){if(n&1){let t=M();a(0,"div",9)(1,"div",10)(2,"div",11)(3,"h5",12),C("click",function(){let o=y(t).$implicit,r=p();return _(r.onSelectRegister(o))}),a(4,"span"),S(5,"i",13),d(6),I(7,"limitText"),l(),g(8,Ll,1,0,"span",14),l(),a(9,"div",15),C("click",function(){let o=y(t).$implicit,r=p();return _(r.onSelectRegister(o))}),g(10,Bl,3,0,"div")(11,Ul,9,2,"div"),l()()()()}if(n&2){let t,i,o=e.$implicit,r=p();s(),b("ngClass",o.Active?"active":""),s(),b("ngClass",re(9,Vl,(o==null?null:o.ID)==((t=r.selectedRegister())==null?null:t.ID))),s(),b("ngClass",re(11,Fl,o!=r.selectedRegister())),s(3),R(he(7,6,o.Name,15)),s(2),f(o.State!="Close"?8:-1),s(2),f((i=o.State)==="Close"?10:i==="Open"?11:-1)}}var Jn=class n{dialogRef=c(G);storeService=c(x);router=c(Sn);roleService=c($e);eventService=c(A);toastr=c(Q);modalConfig=new te;registers=u(()=>this.storeService.loadForm().Registers);appConfig=u(()=>this.storeService.loadForm().AppConfigJSON);selectedRegister=v(null);searchInput="";constructor(){this.initModalConfig(),this.initSelectedRegister()}initModalConfig(){this.modalConfig.hideClose=!1,this.modalConfig.hideCancel=!1,this.modalConfig.hideFooter=!0,this.modalConfig.bodyScrollable=!0,this.modalConfig.title="Choose an outlet"}initSelectedRegister(){let e=this.storeService.register(),t=this.registers().find(i=>i.ID==e.RegisterID);this.selectedRegister.set(t)}onSelectRegister(e){if(this.appConfig().ModuleShift?.Closure?.Enabled)if(this.selectedRegister()?.ID!=null&&this.selectedRegister()?.Open)this.changeCurrentShift(e);else if(!e.Open||this.selectedRegister()?.ID==e.ID)this.selectedRegister.set(e),this.submitSelectedRegister();else{if(this.roleService.sell.Edit==!1){this.toastr.warning("You cannot end shift for Register "+e.Name+" - Unauthorized Access",xe.Warning);return}this.toastr.warning("This Register has already active register, Are you sure you want to end this register?",xe.Warning),this.onClose(),this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}})}else this.selectedRegister.set(e),this.submitSelectedRegister()}changeCurrentShift(e){confirm("You already have an active register with "+this.selectedRegister()?.Name+`!
1
+ import{a as Gn}from"./chunk-IKOW7NIR.js";import{b as Ia,c as Ta,d as $a,e as Ka,f as il,g as Wn}from"./chunk-YPNAKALE.js";import{a as nl}from"./chunk-PNIEKDO7.js";import{a as Zi}from"./chunk-VJMKJ76S.js";import{a as ol}from"./chunk-HBAQBI6Z.js";import{a as at,b as An,c as wa,d as Vn,e as Fa,f as La,h as Qa,i as qa,j as Wa}from"./chunk-ZQEJAMZJ.js";import{b as Oa}from"./chunk-LDJX34VR.js";import"./chunk-IG5QFXLW.js";import{a as Qn}from"./chunk-PFTNYBDL.js";import"./chunk-BYXBJQAS.js";import{a as Ya,b as Xa}from"./chunk-FEOMEXPN.js";import{a as Ea,c as Na,d as Ra,e as Aa}from"./chunk-XNTQF53Y.js";import{b as ja,e as Ga,f as Ha,g as za}from"./chunk-FYCVHWE5.js";import{a as tl,b as qn}from"./chunk-VDHK3F4F.js";import{c as Fn,d as Ln,e as Ba,f as Ua}from"./chunk-3VIRUKYH.js";import"./chunk-Q2W7NEUH.js";import{a as Rl}from"./chunk-QITV5CIL.js";import"./chunk-DUBSPAA2.js";import"./chunk-2E5HYZMR.js";import{a as rl,b as al}from"./chunk-V5XJGH2W.js";import{a as jn}from"./chunk-Q3ZNI7UU.js";import{a as el}from"./chunk-N2LG2IO5.js";import{a as Za}from"./chunk-TFMDC7ZG.js";import{a as Oi,b as wi,c as Ja}from"./chunk-I3OTL6ZL.js";import{a as Cr,b as Bn,c as Un}from"./chunk-X55I2643.js";import{b as Wt}from"./chunk-3ZS7KYVP.js";import{b as ka}from"./chunk-H7JNNBL2.js";import"./chunk-VLKLGJDL.js";import{a as Si}from"./chunk-AO63R3DI.js";import"./chunk-P3KIIKY4.js";import"./chunk-ZPIILEA6.js";import"./chunk-7HMU6MXA.js";import{a as Pt}from"./chunk-GWNGKIUL.js";import{a as Va}from"./chunk-2LD4VKHV.js";import"./chunk-BYXBJQAS.js";import{a as fr}from"./chunk-I3WLM5Y4.js";import{e as _a,i as Ii,j as Sa,k as Pa,l as xa}from"./chunk-MJCSURDY.js";import{a as hr}from"./chunk-S77FVPQM.js";import"./chunk-B53CZMGZ.js";import"./chunk-5UDUWK67.js";import{c as br}from"./chunk-I3WUTJXX.js";import"./chunk-BYXBJQAS.js";import"./chunk-RQCACWGY.js";import{a as En,b as Nn}from"./chunk-ZBZBPMZZ.js";import{a as qt}from"./chunk-DDLXGCOB.js";import{a as Rn}from"./chunk-3JPAA6YB.js";import"./chunk-53CYOKMD.js";import{a as va}from"./chunk-2KWWTRZP.js";import{a as Ma}from"./chunk-QIUN3PYQ.js";import{b as wn,c as Pi,d as xi,e as Di}from"./chunk-MBSYHKPE.js";import{a as Da}from"./chunk-QQUWUBWQ.js";import{a as ya}from"./chunk-PT6PCXOU.js";import"./chunk-52U2QQ43.js";import"./chunk-3XYL5JLY.js";import{p as Ca}from"./chunk-SCH7M36Q.js";import"./chunk-7TQOVQ3O.js";import"./chunk-G53IMHKY.js";import"./chunk-3EAA4CUP.js";import"./chunk-5U2B2SGN.js";import"./chunk-YJV74F2X.js";import"./chunk-WPCHBRKW.js";import{b as ta}from"./chunk-A7VRBYLB.js";import{c as ma,d as ua}from"./chunk-J5EM5XXB.js";import"./chunk-UPH5FSV4.js";import{d as pa}from"./chunk-M43FFEY2.js";import"./chunk-5VC2XYC5.js";import{a as Be}from"./chunk-G56UPMKR.js";import"./chunk-XBINTEVI.js";import"./chunk-BAIS4TWD.js";import{b as ba,c as ha}from"./chunk-O2F7SUYY.js";import{a as ga,b as fa}from"./chunk-XHLEWVPO.js";import"./chunk-ONKLHHM3.js";import"./chunk-4YPA4HZ3.js";import"./chunk-XTOFMSDQ.js";import"./chunk-ZM456L6A.js";import"./chunk-644K7HEV.js";import{a as Yr,d as Xr,f as Zr,h as ea}from"./chunk-LN7LGRLI.js";import"./chunk-EP7SKSJT.js";import"./chunk-LAQZXTBX.js";import{a as ca,b as da}from"./chunk-B35X77UQ.js";import{c as Mi,d as Qt,e as sa}from"./chunk-QMJNI3X6.js";import{r as la}from"./chunk-4BITXMRY.js";import"./chunk-2AOZZW2I.js";import"./chunk-TM2I5PAG.js";import{a as De,b as Pe}from"./chunk-JXEPD3CF.js";import"./chunk-PPMQE2JW.js";import{G as aa,P as Ut,a as ia,b as na,v as oa,y as ra}from"./chunk-FGU4QONB.js";import{a as Vt}from"./chunk-FXLZBN66.js";import{a as Dn,b as Wr,c as Mn}from"./chunk-OKQYRKDJ.js";import{d as Ke,e as kn}from"./chunk-BUIP3UCE.js";import"./chunk-SIAVPMSP.js";import{b as we,g as jr}from"./chunk-EOP7LLRQ.js";import{a as G,b as Le,c as Te,h as Tn}from"./chunk-3V6FZIJD.js";import"./chunk-DEJ5V3PF.js";import"./chunk-T45W4CQR.js";import"./chunk-OK7LFGGQ.js";import"./chunk-VGLTFO5N.js";import"./chunk-UTSVZMZD.js";import{a as q,b as ft,c as Qr}from"./chunk-BP6PECKT.js";import{a as oe}from"./chunk-GNDUQZGK.js";import"./chunk-SKJSLBZP.js";import"./chunk-ZS4XLRDB.js";import"./chunk-NNQW72HA.js";import{a as xe,b as te,c as Y}from"./chunk-BKOMMH62.js";import"./chunk-TNXMA723.js";import"./chunk-TYFAIMTW.js";import"./chunk-SXVOKLC4.js";import{A as St,B as $r,F as $,G as ut,b as In,c as ee,e as _t,f as yi,h as J,i as Ft,l as Lt,m as ze,o as _i,p as ne,q as Gr,s as On,t as Bt,y as Hr,z as zr}from"./chunk-AJDQZ346.js";import{a as qr,c as Jr}from"./chunk-KG753P2Y.js";import{a as Kr}from"./chunk-AXO5A6P7.js";import"./chunk-YY6WVNU4.js";import{b as $e}from"./chunk-KLHHVIRS.js";import{a as P}from"./chunk-PPTZHIIZ.js";import{a as xn}from"./chunk-EWJVO53T.js";import{n as Q,q as se}from"./chunk-QGYXJUX3.js";import{$ as wr,$a as Cn,Ab as Ie,Ac as Xi,Ad as Br,B as Ir,Ba as v,Bb as X,C as Fe,Cb as Z,Da as Nt,Db as b,E as _e,Ea as kr,Eb as a,Fb as l,Fc as I,Gb as S,Gc as V,Hb as ae,Hc as he,I as We,Ib as le,Ic as He,Jb as dt,Kb as gi,L as Ki,Lb as fi,Lc as At,M as Ue,Mb as vn,Na as ui,Oc as u,Pa as Qe,Pb as M,Pd as Ur,Qb as Er,R as gr,Rd as Sn,Sa as hn,Sb as C,Sc as rt,Sd as Pn,Tb as gt,Tc as pe,Ua as s,Ub as p,Ud as vi,Y as Or,Yb as et,Yc as Vr,Zb as tt,_b as it,aa as vt,bb as je,cc as ge,da as Tr,db as T,dc as Nr,e as ti,ea as N,ec as de,gc as be,hc as d,ic as R,id as yn,j as st,jb as Re,jc as O,ka as w,kc as Oe,kd as ue,l as mi,lc as Rr,m as $i,mc as L,nc as B,oa as c,oc as U,od as Fr,pc as bi,pd as Lr,qc as hi,qd as Ci,ra as y,rc as Rt,s as fe,sa as _,sb as Ji,sc as Yi,sd as mt,t as bn,tc as Ar,ud as K,wb as g,wc as Ge,wd as _n,xa as ct,xc as yt,xd as W,y as Mr,ya as Et,yb as f,yc as re,zb as Xe,zc as pt}from"./chunk-7D344CRC.js";import{a as E,b as z,g as Nl,j as zi}from"./chunk-NF7PG5F2.js";var Hn=class{UserName;UserID;SalesID;CustomerOptions;ServerTime;AppConfigJSON;Denomination;Entities;Registers;Payments;PaymentTypes;Currencies;PoTypes;Taxes;BINS;ServerDateString;ServicesLogistics;WhatsAppConfigJSON;StylesSheet;UserGroupConfig};var xt=class{ID;EntityID;RegisterID;TypeID;Date;Number;CustomerID;SalesID;Discount=0;Discount2=0;DiscountAmount=0;CustomerDiscountRate=0;Note="";DeliveryOutletID;TaxTypeID;CurrencyID;CurrencyRate;PointUsed;InvoicedStateID;ReferenceNumber="";LogisticsServiceID;ParkLabel="";NumberOfPerson;ClientTimestamp;Created;PromotionCoupon="";CouponType=1;PromotionNote="";DeliveryStateID;CouponProvider="Internal";CurrencySymbol;constructor(){this.ID=P.GuidEmpty,this.EntityID=P.GuidEmpty,this.RegisterID=P.GuidEmpty,this.Number="",this.CustomerID=null,this.SalesID=null,this.Discount=0,this.Discount2=0,this.DiscountAmount=0,this.Note="",this.TaxTypeID=P.GuidEmpty,this.CurrencyID=1,this.CurrencyRate=1,this.DeliveryStateID=3,this.PointUsed=0,this.NumberOfPerson=1,this.Date=new Date}removeEnterNote(){this.Note&&(this.Note=this.Note.replace(/\n/g,""))}};var lt=class{ID;Number;Due;Date;CustomDateField;TimeCustom;SurchargePcg;TempSurchargePcg;ToP;Note;ReferenceInvoiceID;PaymentStateID;Sales;DateCustom;constructor(){this.ID=P.GuidEmpty,this.SurchargePcg=0,this.TempSurchargePcg=0,this.Due=null}};var ii=class{Prefix;Seed;Digit;constructor(){this.Prefix=null,this.Seed=null,this.Digit=null}static Generate(e){let t="";if(e.Seed){let i=e.Seed+"";for(;i.length<e.Digit;)i="0"+i;t=P.StringFormat(e.Prefix,i)}return t}};var $n=class{RegisterID;RegisterCode;EntityID;EntityName;NumberElement;InvoiceNumberElement;ListSales;QuickKeyPack;PrintTemplate;DefaultSalesOrderTag;DefaultTaxType;DefaultWarehouse;MemberPoint;ParkLayoutPack;Promotion;DefaultPrintTemplate;NewOrderID;Payments;SplitPaymentEnabled;constructor(){this.RegisterID=null,this.RegisterCode=null,this.EntityID=null,this.EntityName=null,this.NumberElement=new ii,this.InvoiceNumberElement=new ii,this.Promotion=[],this.SplitPaymentEnabled=!0}};var Dt=class{Name;Phone;Address;City;constructor(){this.Name="",this.Phone="",this.Address="",this.City=""}};var Ti=class{DeliveryEntityID;NewOrderID;Type};var x=class n{store=Gn({cartItems:[],parkTemporaryItem:[],loadForm:new Hn,order:new xt,invoice:new lt,payments:[],register:new $n,shipping:new Dt,promotions:[],state:0,customer:new En,action:new Ti,completeOrder:null});loadForm=this.store.select(e=>Object.freeze(e.loadForm()));register=this.store.select(e=>Object.freeze(e.register()));order=this.store.select(e=>Object.freeze(e.order()));cartItems=this.store.select(e=>Object.freeze(e.cartItems()));parkTemporaryItem=this.store.select(e=>Object.freeze(e.parkTemporaryItem()));payments=this.store.select(e=>Object.freeze(e.payments()));shipping=this.store.select(e=>Object.freeze(e.shipping()));invoice=this.store.select(e=>Object.freeze(e.invoice()));promotions=this.store.select(e=>Object.freeze(e.promotions()));state=this.store.select(e=>Object.freeze(e.state()));customer=this.store.select(e=>Object.freeze(e.customer()));completeOrder=this.store.select(e=>Object.freeze(e.completeOrder()));currency=u(()=>{let e=this.loadForm()?.Currencies,t=this.order()?.CurrencyID,i=e?.find(o=>o.ID===t);return i||e[0]});tax=u(()=>{let e=this.loadForm()?.Taxes,t=this.order()?.TaxTypeID,i=e?.find(o=>o.ID===t);return i||(e&&e.length>0?e[0]:void 0)});SalesOrderTag=u(()=>{let e=this.loadForm()?.PoTypes,t=this.order()?.TypeID,i=e?.find(o=>o.ID===t);return i||(e&&e.length>0?e[0]:void 0)});prepaidPackageItems=u(()=>this.cartItems().filter(t=>t.Variant.TypeID===10));action=this.store.select(e=>Object.freeze(e.action()));updateLoadForm(e){this.store.update("loadForm",e)}updateRegister(e){this.store.update("register",e)}updateOrder(e){this.store.update("order",e)}updateCustomer(e){this.store.update("customer",e)}updateCartItems(e){this.store.update("cartItems",e)}updateParkTemporaryItem(e){this.store.update("parkTemporaryItem",e)}updateInvoice(e){this.store.update("invoice",e)}updatePayments(e){this.store.update("payments",e)}updateShipping(e){this.store.update("shipping",e)}updatePromotions(e){this.store.update("promotions",e)}updateState(e){this.store.update("state",e)}updateAction(e){this.store.update("action",e)}updateCompleteOrder(e){this.store.update("completeOrder",e)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var Ce=class{static GetCustomerPrivilegeByID="/API/Contact/GetPrivilegeByCustomerID";static GetPOSStorage="/API/POS/LoadPOS";static GetRegisterInfo="/API/POS/GetRegisterInfoByID";static GetCustomerByCode="/API/Contact/GetByCode";static GetSalesOrderPrint="/API/POS/GetSalesOrderPrint";static CheckExistingInvoiceNumber="/API/POS/CheckExistingNumber";static CreateCustomer="/API/Contact/Customer/Create";static GenerateGopayQrCode="/API/Gopay/GenerateQR";static GopayVerifyPayment="/API/Gopay/VerifyQR";static GenerateBcaQrCode="/API/BCA/GenerateQR";static BcaVerifyPayment="/API/BCA/VerifyQR";static GenerateXenditQrCode="/API/Xendit/GenerateQR";static XenditVerifyPayment="/API/Xendit/VerifyQR";static SubmitOrder="/API/POS/SubmitInvoice";static SendOtpEmail="/API/otp/email";static SendOtpWhatsApp="/API/otp/WhatsApp";static VerifyEmailOtp="/API/otp/verifyemail";static VerifyWhatsAppOtp="/API/otp/verifywhatsapp";static VerifyPin="/API/pos/VerifyPin"};var A=class n{eventBus=new ti;emit(e){this.eventBus.next(e)}on(e){return this.eventBus.pipe(_e(t=>t.type===e))}ngOnDestroy(){this.eventBus.complete()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var jt=class n{STORAGE_KEY="ecrConfig";_state=v(this.initState());isEnabled=u(()=>this._state().enabled);ecrUrl=u(()=>this._state().url);url=u(()=>{let e=this._state().url;if(!e)return null;let t=e.split("/");return t.pop(),t.join("/")});connect(e){let t={enabled:!0,url:e,timestamp:new Date().toDateString()};localStorage.setItem(this.STORAGE_KEY,JSON.stringify(t)),this._state.set(t)}disconnect(){let e={enabled:!1,url:null,timestamp:new Date().toDateString()};localStorage.setItem(this.STORAGE_KEY,JSON.stringify(e)),this._state.set(e)}initState(){let e=localStorage.getItem(this.STORAGE_KEY),t={enabled:!1,url:null,timestamp:""};return P.IsNotEmpty(e)?JSON.parse(e):t}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var nt=class n{ecrStorage=c(jt);toastr=c(Q);socketConnection;_ecrEvent=new ti;ecrEvent$=this._ecrEvent.asObservable();_isSignalRConnected=v(!1);isConnected=u(()=>this.ecrStorage.isEnabled()&&this._isSignalRConnected());initEcrOnStartup(){if(this.isConnected()){let t=this.ecrStorage.ecrUrl();t&&this.initConnection(t)}}initConnection(e){this.socketConnection=new Mn().withUrl(e).withAutomaticReconnect().configureLogging(Dn.Information).build(),this.ecrStorage.connect(e),this.listenToConnectionEvents(),this.listenToEvents(),this.startConnection()}stopConnection(){this.socketConnection.stop().then(()=>{console.info("SignalR for ECR is Disconnected")})}startConnection(){this.socketConnection.start().then(()=>{this._isSignalRConnected.set(!0),this.toastr.success("Successfully connected to ECR","Success")}).catch(e=>{this.toastr.error(e,"Failed connecting to ECR"),console.log(e)})}listenToEvents(){this.socketConnection.on("EcrEvent",e=>{this._ecrEvent.next(e)})}listenToConnectionEvents(){this.socketConnection.onreconnecting(()=>{console.info("SignalR for ECR is Reconnecting")}),this.socketConnection.onreconnected(()=>{console.info("SignalR for ECR is Reconnected"),this._isSignalRConnected.set(!0)}),this.socketConnection.onclose(()=>{console.info("SignalR for ECR is Closed"),this._isSignalRConnected.set(!1)})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var ki=class n{STORAGE_KEY="cashMachineConfig";_state=v(this.initState());isEnabled=u(()=>this._state().enabled);ecrUrl=u(()=>this._state().url);url=u(()=>this._state().url);connect(e){let t={enabled:!0,url:e,timestamp:new Date().toDateString()};localStorage.setItem(this.STORAGE_KEY,JSON.stringify(t)),this._state.set(t)}disconnect(){let e={enabled:!1,url:null,timestamp:new Date().toDateString()};localStorage.setItem(this.STORAGE_KEY,JSON.stringify(e)),this._state.set(e)}initState(){let e=localStorage.getItem(this.STORAGE_KEY),t={enabled:!1,url:null,timestamp:""};return P.IsNotEmpty(e)?JSON.parse(e):t}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var Mt=class n{CashMachineSocketUrl="CashMachineHUB";httpService=c(ya);cashMachineConfig=c(ki);posHttpResponseService=c(Pa);salesOrderDataModelService=c(Sa);socketConnection;_cashMachineEvent=new ti;_withdrawMoneyStatus=new ti;cashMachineEvent$=this._cashMachineEvent.asObservable();withdrawMoneyStatus$=this._withdrawMoneyStatus.asObservable();_isSignalRConnected=v(!1);isConnected=u(()=>this.cashMachineConfig.isEnabled()&&this._isSignalRConnected()&&this.isConnectedState());toastr=c(Q);dialog=c(Te);totalAmountBeforePayment=v(0);initCashMachineOnStartup(){if(this.cashMachineConfig.isEnabled()){let t=this.cashMachineConfig.url();t&&this.initConnection(t)}}url=v("");checkPaymentStatus(e){return this.getCashMachineTotalAmount().pipe(fe(t=>{let i=this.totalAmountBeforePayment()+e;return t>=i}),N(t=>{t||this.toastr.error("Payment has not been settled.","Payment Failed")}))}initConnection(e){this.url.set(e),this.socketConnection=new Mn().withUrl(`${e}/${this.CashMachineSocketUrl}`).withAutomaticReconnect().configureLogging(Dn.Information).build(),this.listenToConnectionEvents(),this.listenToEvents(),this.startConnection(e)}startConnection(e){this.socketConnection.start().then(()=>{this._isSignalRConnected.set(!0),this.toastr.success("Successfully connected to Cash Machine","Success"),this.cashMachineConfig.connect(e)}).catch(t=>{this.cashMachineConfig.disconnect(),this.toastr.error(t,"Failed connecting to Cash Machine"),console.log(t)})}listenToEvents(){this.socketConnection.on("OnReceiveMoney",e=>{if(e){let t=JSON.parse(e);this._cashMachineEvent.next(t)}}),this.socketConnection.on("WithdrawMoneyStatus",e=>{e&&this._withdrawMoneyStatus.next(e?.status)})}stopConnection(){this.socketConnection.stop().then(()=>{console.info("SignalR for Cash Machine is Disconnected"),this.cashMachineConfig.disconnect()})}isConnectedState(){return this.socketConnection&&P.IsNotEmpty(this.socketConnection.connectionId)&&this.socketConnection.state===Wr.Connected}listenToConnectionEvents(){this.socketConnection.onreconnecting(()=>{console.info("SignalR for Cash Machine is Reconnecting")}),this.socketConnection.onreconnected(()=>{console.info("SignalR for Cash Machine is Reconnected"),this._isSignalRConnected.set(!0)}),this.socketConnection.onclose(e=>{console.log(e),console.info("SignalR for Cash Machine is Closed"),this.dialog.closeAll(),this._isSignalRConnected.set(!1)})}chargeCashMachineAmount(e,t){return this.httpService.post(`${this.url()}${oe.ChargeMoneyAmount}`,{Amount:e,Number:t})}getCashMachineTotalAmount(){return this.httpService.get(`${this.url()}${oe.GetCashMachineTotal}`).pipe(fe(e=>e.total))}getCashMachineDenominations(){return this.httpService.get(`${this.url()}${oe.GetCashMachineBreakdown}`)}sendWithdrawMoney(e){let t=this.findCurrencyById();return this.httpService.post(`${this.url()}${oe.CashMachineWithdraw}`,{value:e,countryCode:t?.Name||""})}findCurrencyById(){let e=this.salesOrderDataModelService.Data?.Order?.CurrencyID;return(this.posHttpResponseService.Data?.Currencies).find(o=>o.ID==e)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var en=class n{eventBusService=c(A);storeService=c(x);httpService=c(se);ecrSignalRService=c(nt);cashMachineService=c(Mt);constructor(){this.initLoadForm()}initLoadForm(){this.httpService.post(Ce.GetPOSStorage,{}).pipe(q()).subscribe(e=>{this.storeService.updateLoadForm(e),this.eventBusService.emit({type:"[Order] Load Form",payload:{form:e}}),this.initCurrency(e),this.ecrSignalRService.initEcrOnStartup(),this.cashMachineService.initCashMachineOnStartup()})}initCurrency(e){let t=e?.AppConfigJSON?.CoreDefaults?.CurrencyID,i=e.Currencies.find(o=>o.ID===t);this.eventBusService.emit({type:"[Order] Update Currency",payload:{currency:i}})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac})};var Gt=class n{odsConfigType=v(0);setODSConfig(e){this.odsConfigType.set(e)}isEnabled(){return this.odsConfigType()>0}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var ce=class n{role=c($e);_return=v(this.role.sell?.Return);_priceMinimum=v(this.role.sell?.PriceMinimum);_unitPriceEditor=v(this.role.sell?.UnitPriceEditor);_salesPerson=v(this.role.sell?.SalesPerson);_discount=v(this.role.sell?.Discount);_costVisible=v(this.role.product?.Cost);_commission=v(this.role.sell?.Commission);_sellEditor=v(this.role.sell?.Edit);_sellCreate=v(this.role.sell?.Create);_pricebookSelector=v(this.role.sell?.PricebookSelector);_priceVisible=v(this.role.sell?.PriceVisible);_shipping=v(this.role.sell?.Shipping);_retrieve=v(this.role.sell?.RetrieveR);_creditSalesLock=v(this.role.sell?.CreditSalesLock);_print=v(this.role.global?.Print);_date=v(this.role.global?.Date);_numberEditor=v(this.role.sell?.Number);_payment=v(this.role.sell?.Payment);_customerInputLock=v(this.role.sell?.CustomerInputLock);_paymentCodeLock=v(this.role.sell?.PaymentCodeLock);_tax=v(this.role.sell?.Tax);_deleteItem=v(this.role.sell?.DeleteItem);_bundlingPrice=v(this.role.sell?.BundlingPrice);_email=v(this.role.sell?.Email);_parkedDeletion=v(!1);_park=v(this.role.sell?.Park);_couponInputLock=v(this.role.sell?.CouponInputLock);_orderView=v(this.role.order?.View);_reprint=v(this.role.order?.Print);_contactCreate=v(this.role.contact?.Create);_contacts=v(this.role.contact?.View);_inventoryView=v(this.role.inventory?.View);_debtView=v(this.role.debt?.View);_sellDelete=v(this.role.sell?.Delete);_deliveryEditor=v(this.role.logistic?.Edit);_prepaidPackageCreate=v(this.role.prepaidPackage?.Create);return=u(()=>this._return());priceVisible=u(()=>this._priceVisible());unitPriceEditor=u(()=>this._unitPriceEditor());salesPerson=u(()=>this._salesPerson());discount=u(()=>this._discount());costVisible=u(()=>this._costVisible());commission=u(()=>this._commission());sellEditor=u(()=>this._sellEditor());sellCreate=u(()=>this._sellCreate());pricebookSelector=u(()=>this._pricebookSelector());priceMinimum=u(()=>this._priceMinimum());shipping=u(()=>this._shipping());retrieve=u(()=>this._retrieve());creditSalesLock=u(()=>this._creditSalesLock());print=u(()=>this._print());date=u(()=>this._date());numberEditor=u(()=>this._numberEditor());payment=u(()=>this._payment());customerInputLock=u(()=>this._customerInputLock());paymentCodeLock=u(()=>this._paymentCodeLock());tax=u(()=>this._tax());deleteItem=u(()=>this._deleteItem());bundlingPrice=u(()=>this._bundlingPrice());email=u(()=>this._email());parkedDeletion=u(()=>this._parkedDeletion());park=u(()=>this._park());couponInputLock=u(()=>this._couponInputLock());orderView=u(()=>this._orderView());reprint=u(()=>this._reprint());contactCreate=u(()=>this._contactCreate());contacts=u(()=>this._contacts());inventoryView=u(()=>this._inventoryView());debtView=u(()=>this._debtView());sellDelete=u(()=>this._sellDelete());deliveryEditor=u(()=>this._deliveryEditor());prepaidPackageCreate=u(()=>this._prepaidPackageCreate());updateReturn(e){this._return.set(e)}updatePriceVisible(e){this._priceVisible.set(e)}updateUnitPriceEditor(e){this._unitPriceEditor.set(e)}updateSalesPerson(e){this._salesPerson.set(e)}updateDiscount(e){this._discount.set(e)}updateCostVisible(e){this._costVisible.set(e)}updateCommission(e){this._commission.set(e)}updateSellEditor(e){this._sellEditor.set(e)}updateSellCreate(e){this._sellCreate.set(e)}updatePricebookSelector(e){this._pricebookSelector.set(e)}updatePriceMinimum(e){this._priceMinimum.set(e)}updateShipping(e){this._shipping.set(e)}updateRetrieve(e){this._retrieve.set(e)}updateCreditSalesLock(e){this._creditSalesLock.set(e)}updatePrint(e){this._print.set(e)}updateDate(e){this._date.set(e)}updateNumberEditor(e){this._numberEditor.set(e)}updatePayment(e){this._payment.set(e)}updateCustomerInputLock(e){this._customerInputLock.set(e)}updatePaymentCodeLock(e){this._paymentCodeLock.set(e)}updateTax(e){this._tax.set(e)}updateDeleteItem(e){this._deleteItem.set(e)}updateBundlingPrice(e){this._bundlingPrice.set(e)}updateEmail(e){this._email.set(e)}updateParkedDeletion(e){this._parkedDeletion.set(e)}updatePark(e){this._park.set(e)}updateCouponInputLock(e){this._couponInputLock.set(e)}updateOrderView(e){this._orderView.set(e)}updateReprint(e){this._reprint.set(e)}updateContactCreate(e){this._contactCreate.set(e)}updateContacts(e){this._contacts.set(e)}updateInventoryView(e){this._inventoryView.set(e)}updateDebtView(e){this._debtView.set(e)}updateSellDelete(e){this._sellDelete.set(e)}updateDeliveryEditor(e){this._deliveryEditor.set(e)}updatePrepaidPackageCreate(e){this._prepaidPackageCreate.set(e)}updateFullAccess(e){this._return.set(e),this._priceMinimum.set(e),this._unitPriceEditor.set(e),this._salesPerson.set(e),this._discount.set(e),this._costVisible.set(e),this._commission.set(e),this._sellEditor.set(e),this._sellCreate.set(e),this._pricebookSelector.set(e),this._priceVisible.set(e),this._shipping.set(e),this._retrieve.set(e),this._creditSalesLock.set(e),this._print.set(e),this._date.set(e),this._numberEditor.set(e),this._payment.set(e),this._customerInputLock.set(e),this._paymentCodeLock.set(e),this._tax.set(e),this._deleteItem.set(e),this._bundlingPrice.set(e),this._email.set(e),this._parkedDeletion.set(e),this._park.set(e),this._couponInputLock.set(e),this._orderView.set(e),this._reprint.set(e),this._contactCreate.set(e),this._contacts.set(e),this._inventoryView.set(e),this._debtView.set(e),this._sellDelete.set(e),this._deliveryEditor.set(e),this._prepaidPackageCreate.set(e)}resetToOriginal(){this._return.set(this.role.sell?.Return),this._priceVisible.set(this.role.sell?.PriceVisible),this._unitPriceEditor.set(this.role.sell?.UnitPriceEditor),this._salesPerson.set(this.role.sell?.SalesPerson),this._discount.set(this.role.sell?.Discount),this._costVisible.set(this.role.product?.Cost),this._commission.set(this.role.sell?.Commission),this._sellEditor.set(this.role.sell?.Edit),this._sellCreate.set(this.role.sell?.Create),this._pricebookSelector.set(this.role.sell?.PricebookSelector),this._priceMinimum.set(this.role.sell?.PriceMinimum),this._shipping.set(this.role.sell?.Shipping),this._retrieve.set(this.role.sell?.RetrieveR),this._creditSalesLock.set(this.role.sell?.CreditSalesLock),this._print.set(this.role.global?.Print),this._date.set(this.role.global?.Date),this._numberEditor.set(this.role.sell?.Number),this._payment.set(this.role.sell?.Payment),this._customerInputLock.set(this.role.sell?.CustomerInputLock),this._paymentCodeLock.set(this.role.sell?.PaymentCodeLock),this._tax.set(this.role.sell?.Tax),this._deleteItem.set(this.role.sell?.DeleteItem),this._bundlingPrice.set(this.role.sell?.BundlingPrice),this._email.set(this.role.sell?.Email),this._parkedDeletion.set(!1),this._park.set(this.role.sell?.Park),this._couponInputLock.set(this.role.sell?.CouponInputLock),this._orderView.set(this.role.order?.View),this._reprint.set(this.role.order?.Print),this._contactCreate.set(this.role.contact?.Create),this._contacts.set(this.role.contact?.View),this._inventoryView.set(this.role.inventory?.View),this._debtView.set(this.role.debt?.View),this._sellDelete.set(this.role.sell?.Delete),this._deliveryEditor.set(this.role.logistic?.Edit),this._prepaidPackageCreate.set(this.role.prepaidPackage?.Create)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var Kn=class n{STORAGE_KEY="outlet_register";save(e,t){t||e&&localStorage.setItem(this.STORAGE_KEY,JSON.stringify(e))}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var tn=class n{storeService=c(x);toastrService=c(Q);httpService=c(se);eventService=c(A);signalRClient=c(Vt);orderDisplayService=c(Gt);sellRoleService=c(ce);outletRegisterStorage=c(Kn);selectedRegister=u(()=>this.storeService.register());isOpenDialog$=this.eventService.on("[Order] Load Form").pipe(fe(()=>this.checkOpenDialogRegisters()));constructor(){let e;Fe(this.eventService.on("[Register] Updated").pipe(_e(t=>!!t.payload?.register),N(t=>{let o=t?.payload?.register?.RegisterID;this.signalRClient.SubscribeGroup(o,e),e=o})),this.eventService.on("[Register] Update Register By ID").pipe(N(t=>{let i=t.payload?.id;this.updateRegisterById(i)})),this.eventService.on("[Order] Update Customer PO Type").pipe(N(t=>{let i=t.payload?.poType;this.updatePrintTemplateByPoType(i)})),this.eventService.on("[Register] Update Register Number").pipe(N(t=>{let i=t.payload?.numberElement;this.updateRegisterStore({NewOrderID:i?.NewOrderID,NumberElement:i?.OrderNumberElement,InvoiceNumberElement:i?.InvoiceNumberElement})})),this.eventService.on("[Register] Update Print Template").pipe(N(t=>{let i=t.payload?.printTemplate;this.updateRegisterStore({PrintTemplate:i})})),this.eventService.on("[Register] Record Opening Cash").pipe(N(t=>{this.recordOpeningCash(t.payload?.registerId,t.payload?.amount)}))).pipe(q()).subscribe()}updatePrintTemplateByPoType(e){let t=this.storeService.register();e.PrintTemplateID==0?this.updateRegisterStore({PrintTemplate:t.DefaultPrintTemplate}):this.getSalesOrderPrint(e.PrintTemplateID).subscribe(i=>{this.updateRegisterStore({PrintTemplate:i.Template})})}updateRegisterById(e){this.getRegisterById(e).subscribe(t=>{let i=this.storeService.register().RegisterID,o=this.findOutletRegisterById(e),r=this.applyRegisterSideEffects(t,o);this.loadOdsConfig(r.EntityID),this.persistSelectedOutletRegister(o),this.updateRegisterStore(r),this.initNewOrder(r.RegisterID,i),this.openStartingCashIfRequired(r.RegisterID,i)})}applyRegisterSideEffects(e,t){return z(E({},e),{RegisterCode:t?.Code??e.RegisterCode,DefaultPrintTemplate:e.PrintTemplate,SplitPaymentEnabled:this.findSplitPaymentConfig(e.EntityID)})}findOutletRegisterById(e){return this.storeService.loadForm()?.Registers?.find(t=>t.ID===e)}findSplitPaymentConfig(e){let i=this.storeService.loadForm()?.Entities?.find(o=>o.ID===e);return i?i.SplitPaymentEnabled:!1}persistSelectedOutletRegister(e){this.outletRegisterStorage.save(e,this.sellRoleService.deleteItem())}openStartingCashIfRequired(e,t){let i=this.storeService.loadForm();if(!i?.AppConfigJSON?.ModuleShift?.Closure?.Enabled||e===t)return;let r=i?.Registers?.find(h=>h.ID===e);if(!r||!P.IsEmpty(r.LoginID)||!P.IsEmpty(r.CashierID))return;let m={type:"[Register] Open Starting Cash",payload:{registerId:e}};this.eventService.emit(m)}recordOpeningCash(e,t){this.httpService.post(oe.RecordOpeningCash,{RegisterID:e,OpAmount:t}).subscribe(()=>this.markRegisterAsOpened(e,t))}markRegisterAsOpened(e,t){let i=this.storeService.loadForm(),o=yn(new Date,"dd MM yyyy HH:mm","en-US"),r=(i?.Registers??[]).map(m=>m.ID===e?z(E({},m),{LoginID:i?.UserName,OpeningCash:t,Open:!0,State:"Open",StartDisplay:o}):m);this.storeService.updateLoadForm(z(E({},i),{Registers:r}))}initNewOrder(e,t){e!==t&&this.storeService.state()!==2&&this.eventService.emit({type:"[Order] New Order",payload:{generateNewNumber:!1}})}updateRegisterStore(e){let t=this.storeService.register();this.storeService.updateRegister(E(E({},t),e)),this.eventService.emit({type:"[Register] Updated",payload:{register:this.storeService.register()}})}getRegisterById(e){return this.httpService.get(Ce.GetRegisterInfo,[{key:"RegisterID",value:e}])}getSalesOrderPrint(e){return this.httpService.post(Ce.GetSalesOrderPrint,{TemplateID:e})}checkOpenDialogRegisters(){if(this.storeService.state()===2)return!1;let e=this.storeService.loadForm(),t=e.Registers,i=e.AppConfigJSON?.ModuleShift?.Closure?.Enabled,o=e.UserName;if(t.length>1){let r=t.find(m=>m.LoginID==o);if(r)return this.updateRegisterById(r.ID),!1;{let m=this.selectedRegister()?this.selectedRegister().RegisterID:null;if(P.IsEmpty(m))return!0;if(i)return!0}}else{if(t.length==1)return this.updateRegisterById(t[0].ID),!1;this.toastrService.warning("You do not have access to any OUTLET","Warning")}return!1}loadOdsConfig(e){this.httpService.get(`/api/outlet/GetOrderDisplayBroadcastMode?EntityID=${e}`).pipe(N(t=>{this.orderDisplayService.setODSConfig(t.form?.OrderDisplayBroadcastMode??0)})).subscribe()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac})};var Vl=n=>({active:n}),Fl=n=>({gray:n});function Ll(n,e){if(n&1){let t=M();a(0,"span",16),C("click",function(o){y(t);let r=p().$implicit;return p().onCloseRegister(r),_(o.stopPropagation())}),l()}}function Bl(n,e){n&1&&(a(0,"div")(1,"span",17),d(2,"VACANT"),l()())}function Ul(n,e){if(n&1&&(a(0,"div")(1,"span",18),S(2,"i",19),a(3,"font"),d(4),l()(),a(5,"span",20),S(6,"i",21),a(7,"font"),d(8),l()()()),n&2){let t=p().$implicit;s(4),R(t.LoginID),s(4),O("",t.StartDisplay.split(" ")[3]," - Now")}}function Ql(n,e){if(n&1){let t=M();a(0,"div",9)(1,"div",10)(2,"div",11)(3,"h5",12),C("click",function(){let o=y(t).$implicit,r=p();return _(r.onSelectRegister(o))}),a(4,"span"),S(5,"i",13),d(6),I(7,"limitText"),l(),g(8,Ll,1,0,"span",14),l(),a(9,"div",15),C("click",function(){let o=y(t).$implicit,r=p();return _(r.onSelectRegister(o))}),g(10,Bl,3,0,"div")(11,Ul,9,2,"div"),l()()()()}if(n&2){let t,i,o=e.$implicit,r=p();s(),b("ngClass",o.Active?"active":""),s(),b("ngClass",re(9,Vl,(o==null?null:o.ID)==((t=r.selectedRegister())==null?null:t.ID))),s(),b("ngClass",re(11,Fl,o!=r.selectedRegister())),s(3),R(he(7,6,o.Name,15)),s(2),f(o.State!="Close"?8:-1),s(2),f((i=o.State)==="Close"?10:i==="Open"?11:-1)}}var Jn=class n{dialogRef=c(G);storeService=c(x);router=c(Sn);roleService=c($e);eventService=c(A);toastr=c(Q);modalConfig=new te;registers=u(()=>this.storeService.loadForm().Registers);appConfig=u(()=>this.storeService.loadForm().AppConfigJSON);selectedRegister=v(null);searchInput="";constructor(){this.initModalConfig(),this.initSelectedRegister()}initModalConfig(){this.modalConfig.hideClose=!1,this.modalConfig.hideCancel=!1,this.modalConfig.hideFooter=!0,this.modalConfig.bodyScrollable=!0,this.modalConfig.title="Choose an outlet"}initSelectedRegister(){let e=this.storeService.register(),t=this.registers().find(i=>i.ID==e.RegisterID);this.selectedRegister.set(t)}onSelectRegister(e){if(this.appConfig().ModuleShift?.Closure?.Enabled)if(this.selectedRegister()?.ID!=null&&this.selectedRegister()?.Open)this.changeCurrentShift(e);else if(!e.Open||this.selectedRegister()?.ID==e.ID)this.selectedRegister.set(e),this.submitSelectedRegister();else{if(this.roleService.sell.Edit==!1){this.toastr.warning("You cannot end shift for Register "+e.Name+" - Unauthorized Access",xe.Warning);return}this.toastr.warning("This Register has already active register, Are you sure you want to end this register?",xe.Warning),this.onClose(),this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}})}else this.selectedRegister.set(e),this.submitSelectedRegister()}changeCurrentShift(e){confirm("You already have an active register with "+this.selectedRegister()?.Name+`!
2
2
  Do you want to end your session?`)&&(this.onClose(),this.router.navigate(["menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e?.ID}}))}onCloseRegister(e){let t=this.selectedRegister()?.ID;if(this.roleService?.sell?.Edit==!1){this.toastr.warning("You cannot end shift for Register "+e.Name+" - Unauthorized Access",xe.Warning);return}t==e.ID?this.router.navigate(["/menu/Shift/Main/My_Shift"]):this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}}),this.onClose()}submitSelectedRegister(){if(this.selectedRegister()?.ID==null){this.toastr.warning("Please select a register first!",xe.Warning);return}this.eventService.emit({type:"[Register] Update Register By ID",payload:{id:this.selectedRegister()?.ID}}),this.dialogRef.close(!0)}onClose(){this.dialogRef.close(!1)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["app-dialog-select-register"]],decls:13,vars:6,consts:[["searchInputRef",""],[3,"onClose","config"],[1,"ms-0","mb-8","search-container",3,"hidden"],[1,"input-group","mb-3","rounded-start-1"],[1,"input-group-text","txtFilter","rounded-end-0"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["data-cy","SearchOutlet","type","text","placeholder","Filter by Name","aria-label","Search",1,"txtFilter","form-control","border-start-0","rounded-1","rounded-start-0",3,"ngModelChange","ngModel"],[1,"container","custom-scroll"],[1,"row",2,"width","600px"],["data-cy","registers",1,"col-4"],[1,"card","border-0",3,"ngClass"],[1,"card-body","p-0",3,"ngClass"],[1,"card-title","mb-0",3,"click","ngClass"],[1,"fa-solid","fa-house","pe-1","fs-6"],[1,"fa","fa-xmark-circle","fa-lg","position-absolute",2,"text-shadow","0 1px 0 #afafaf","right","5px","top","16px"],[1,"card-text","px-0","py-2",3,"click"],[1,"fa","fa-xmark-circle","fa-lg","position-absolute",2,"text-shadow","0 1px 0 #afafaf","right","5px","top","16px",3,"click"],[1,"idle"],[1,"cashier"],["aria-hidden","true",1,"fa","fa-user","pe-2"],[1,"open"],["aria-hidden","true",1,"fa-regular","fa-clock","pe-2"]],template:function(t,i){if(t&1){let o=M();a(0,"modal-material",1),C("onClose",function(){return i.onClose()}),a(1,"content")(2,"div",2)(3,"div",3)(4,"span",4),S(5,"i",5),l(),a(6,"input",6,0),U("ngModelChange",function(m){return y(o),B(i.searchInput,m)||(i.searchInput=m),_(m)}),l()()(),a(8,"div",7)(9,"div",8),X(10,Ql,12,13,"div",9,Ie),I(12,"filterByName"),l()()()()}if(t&2){let o;b("config",i.modalConfig),s(2),b("hidden",((o=i.registers())==null?null:o.length)<=6),s(4),L("ngModel",i.searchInput),s(4),Z(he(12,3,i.registers(),i.searchInput))}},dependencies:[W,ue,Y,$,ee,J,ne,jn,Si],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}.search-container[_ngcontent-%COMP%]{transition:all .3s ease;width:97%}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]{position:relative;transition:all .3s ease;height:2.3rem}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover, .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e4d,0 0 8px 4px #89b03e33;border-radius:4px}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]{transition:all .3s ease;border-left:none!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]:focus{box-shadow:none!important;border-color:#ced4da!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .input-group-text[_ngcontent-%COMP%]{transition:all .3s ease;background-color:#fff;border-right:none!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .input-group-text[_ngcontent-%COMP%], .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .input-group-text[_ngcontent-%COMP%]{background-color:#89b03e1a;border-color:#84cc16!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .fa-magnifying-glass[_ngcontent-%COMP%]{transition:all .3s ease}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .fa-magnifying-glass[_ngcontent-%COMP%], .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .fa-magnifying-glass[_ngcontent-%COMP%]{color:#84cc16!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e66,0 0 12px 6px #89b03e40!important}.custom-scroll[_ngcontent-%COMP%]::-webkit-scrollbar{width:6px}.custom-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:#f1f1f1;border-radius:3px}.custom-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#89b03e;border-radius:3px}.custom-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:#7a9e37}.container[_ngcontent-%COMP%]{overflow-y:auto;overflow-x:hidden;max-height:260px;min-height:150px}.col-4[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]{width:180px;min-height:95px;margin-right:17px;margin-bottom:17px;position:relative}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]{display:block;outline:0;border:1px solid #b1aaaa;border-radius:5px;cursor:pointer}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{height:30px;border-radius:4px;padding:5px 10px;color:#fff;background:#b1aaaa;overflow:hidden}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{margin-right:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover, .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%]{background:#ffffe1;border:1px solid #89b03e}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover > h5[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%]{background:#89b03e}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover{border:1px solid #c9302c}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover > h6[_ngcontent-%COMP%]{background:#c9302c!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#c9302c}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover{background:#fff}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]{border:1px solid #f6a828}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%]{background:#f6a828!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover{border:1px solid #f6a828;background:#fff}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover > strong[_ngcontent-%COMP%]{background:#f6a828!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#f6a828}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] div[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.75rem!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{height:80px;padding:15px 10px;position:relative}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;font-weight:400;font-size:.875rem;width:100%;margin-bottom:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:first-child{margin-top:-10px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:last-child{margin-bottom:0}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{text-align:center;position:absolute;bottom:0;right:0;width:auto;background-color:#b1aaaa;border-radius:3px;padding:2px 5px;color:#fff;display:none!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.idle[_ngcontent-%COMP%]{display:block;font-size:1.25rem;text-align:center}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{position:absolute;width:27px;height:28px;cursor:pointer;top:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#000}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:last-of-type{right:-5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:nth-last-of-type(2){right:15px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{bottom:20px;right:5px;position:absolute}.col-4[_ngcontent-%COMP%] .duration[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{border:1px solid!important;position:absolute;bottom:-3px;left:58px;background:#fff;border-radius:5px}"]})};var ql=["openingCashInput"],Yn=class n{dialogRef=c(G);storeService=c(x);eventService=c(A);data=c(Le);config=new te;amount=v(0);today=new Date;currentRegisterName;username;openingCashInputEl;constructor(){this.config.title="Open Shift",this.config.customWidth="350px",this.config.hideCancel=!0;let e=this.storeService.loadForm();this.username=e?.UserName;let t=e?.Registers?.find(i=>i.ID===this.data?.registerId)?.Name;this.currentRegisterName=t?.length>18?`${t.substring(0,18)}...`:t}ngAfterViewInit(){this.focusCashInput()}focusCashInput(){setTimeout(()=>{this.openingCashInputEl?.nativeElement?.focus()},300)}onOk(){this.eventService.emit({type:"[Register] Record Opening Cash",payload:{registerId:this.data.registerId,amount:this.amount()}}),this.dialogRef.close(!0)}onClose(){this.dialogRef.close()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["app-dialog-opening-cash"]],viewQuery:function(t,i){if(t&1&&et(ql,5),t&2){let o;tt(o=it())&&(i.openingCashInputEl=o.first)}},decls:25,vars:8,consts:[["openingCashInput",""],[3,"onOk","onClose","config"],[1,"table","fs-5","text"],[1,"py-3"],[1,"text-end","pe-3"],[1,"py-4"],[1,"text-end"],["data-cy","InputCash","autoNum","",1,"border","form-control-lg","text-end","w-100",3,"ngModelChange","ngModel"]],template:function(t,i){if(t&1){let o=M();a(0,"modal-material",1),C("onOk",function(){return i.onOk()})("onClose",function(){return i.onClose()}),a(1,"content")(2,"table",2)(3,"tr")(4,"td",3),d(5,"Outlet Register"),l(),a(6,"td",4),d(7),l()(),a(8,"tr")(9,"td",5),d(10,"Current User"),l(),a(11,"td",4),d(12),l()(),a(13,"tr")(14,"td",5),d(15,"Starting Time"),l(),a(16,"td",4),d(17),I(18,"date"),l()(),a(19,"tr")(20,"td",3),d(21,"Starting Cash"),l(),a(22,"td",6)(23,"input",7,0),U("ngModelChange",function(m){return y(o),B(i.amount,m)||(i.amount=m),_(m)}),l()()()()()()}t&2&&(b("config",i.config),s(7),R(i.currentRegisterName),s(5),R(i.username),s(5),R(he(18,5,i.today,"EEEE, HH:mm")),s(6),L("ngModel",i.amount))},dependencies:[W,$,ee,J,ne,Y,Be,mt],encapsulation:2,changeDetection:0})};var Xn=class n{constructor(e){this.viewContainerRef=e;Nt(()=>{this.isOpenModalSelectRegister()&&this.openModalSelectRegister()}),this.eventService.on("[Register] Open Starting Cash").pipe(N(t=>this.openOpeningCashDialog(t.payload?.registerId)),q()).subscribe()}viewContainerRef;register=pe();isOpenModalSelectRegister=pe();dialog=c(Te);eventService=c(A);openModalSelectRegister(){this.dialog.open(Jn,{id:"registerModal",disableClose:!0,viewContainerRef:this.viewContainerRef})}openOpeningCashDialog(e){this.dialog.open(Yn,{id:"openingCashModal",viewContainerRef:this.viewContainerRef,disableClose:!0,data:{registerId:e}}).afterClosed().pipe(_e(t=>!!t),Ue(1)).subscribe(()=>this.focusProductInput())}focusProductInput(){document.getElementById("product")?.focus()}static \u0275fac=function(t){return new(t||n)(Cn(je))};static \u0275cmp=T({type:n,selectors:[["pos-select-register"]],inputs:{register:[1,"register"],isOpenModalSelectRegister:[1,"isOpenModalSelectRegister"]},decls:5,vars:5,consts:[["matTooltipPosition","above",1,"outlet-container","d-flex","pointer",3,"click","matTooltip"],[1,"fa-solid","fa-location-dot"],[1,"mb-0"]],template:function(t,i){if(t&1&&(a(0,"div",0),C("click",function(){return i.openModalSelectRegister()}),S(1,"i",1),a(2,"h3",2),d(3),I(4,"limitText"),l()()),t&2){let o,r;b("matTooltip",(o=i.register())==null?null:o.EntityName),s(3),O(" ",(r=i.register())!=null&&r.EntityName?he(4,2,(r=i.register())==null?null:r.EntityName,25):"Choose an Outlet"," ")}},dependencies:[Pe,De,Si],styles:[".outlet-container[_ngcontent-%COMP%] .fa-location-dot[_ngcontent-%COMP%]{color:#fb404b!important;font-size:32px}"]})};var Zn=class n{Round(e,t,i){let o=e,r=this.ChooiceDecimalPlaceValue(t);return t==4||(i==0?o=this.RoundToDecimalPlaceValue(e,r):i==2?o=this.CeilingWithDecimalPlaceValue(e,r):o=this.FloorWithDecimalPlaceValue(e,r)),o}CeilingWithDecimalPlaceValue(e,t){if(t<0){let i=t*-1;return Math.ceil(e*i)/i}else{let i=Math.ceil(e)/t;return Math.ceil(i)*t}}FloorWithDecimalPlaceValue(e,t){if(t<0){let i=t*-1;return Math.floor(e*i)/i}else{let i=Math.floor(e)/t;return Math.floor(i)*t}}RoundToDecimalPlaceValue(e,t){if(t<0){let i=t*-1;return Math.round(e*i)/i}else{let i=Math.round(e)/t;return Math.round(i)*t}}ChooiceDecimalPlaceValue(e){let t=0;return e==0?t=1e3:e==1?t=100:e==2?t=10:e==3?t=1:e==4?t=0:e==5?t=-10:e==6&&(t=-100),t}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var Me=class{Amount;CurrencySymbol;Label;Type;constructor(e,t,i,o){this.Amount=e,this.CurrencySymbol=t,this.Label=i,this.Type=o}};var ie=class n{storeService=c(x);roundingService=c(Zn);decimalPipe=c(K);get appConfig(){return this.storeService.loadForm().AppConfigJSON}get currencySymbol(){return this.storeService.order().CurrencySymbol}totalItems=u(()=>this.storeService.cartItems().length);totalQuantity=u(()=>this.storeService.cartItems().reduce((t,i)=>t+i.Quantity,0));grossTotal=u(()=>{let e=this.storeService.cartItems();return this.sum(e,"Total")});surchargeAmount=u(()=>{let e=this.storeService.invoice().SurchargePcg;return this.totalAfterTax()*e/100});discount1Amount=u(()=>{let e=this.storeService.order().Discount;return this.grossTotal()*e/100});afterDiscount1Amount=u(()=>this.grossTotal()-this.discount1Amount());discount2Amount=u(()=>{let e=this.storeService.order().Discount2;return this.afterDiscount1Amount()*e/100});afterDiscount2Amount=u(()=>this.afterDiscount1Amount()-this.discount2Amount());totalOrderDiscount=u(()=>{let e=this.storeService.order().DiscountAmount;return this.afterDiscount2Amount()-e});grandTotal=u(()=>this.totalAfterSurcharge());totalAfterSurcharge=u(()=>{let e=this.totalAfterTax(),t=this.surchargeAmount(),i=this.storeService.loadForm().AppConfigJSON,o=e+t,r=i?.ApplicationMath?.RoundingDigit?.DecimalPlaceValue,m=i?.ApplicationMath?.RoundingDigit?.RoundAlgorithm;return o=this.roundingService.Round(o,r,m),o});totalAfterTax=u(()=>{let e=this.taxAmount(),t=this.storeService.loadForm().AppConfigJSON,i=this.totalBeforeTax()+e,o=t?.ApplicationMath?.RoundingDigit?.DecimalPlaceValue,r=t?.ApplicationMath?.RoundingDigit?.RoundAlgorithm;return i=this.roundingService.Round(i,o,r),i});totalBeforeTax=u(()=>{let t=this.storeService.tax()?.CalculationTypeID===1,i=0;return t?i=this.totalOrderDiscount()-this.taxAmount():i=this.totalOrderDiscount(),i});totalAfterDiscTaxable=u(()=>this.grossTotalTaxable()-this.totalOrderDiscount());taxAmount=u(()=>{let e=this.storeService.tax();if(e){let t=this.storeService.loadForm().AppConfigJSON,i=0,o=t?.ApplicationMath?.RoundingTaxDigit?.DecimalPlaceValue,r=t?.ApplicationMath?.RoundingTaxDigit?.RoundAlgorithm,m=this.grossTotalTaxable();return e?.CalculationTypeID==1?i=e.Rate/(100+e.Rate)*m:i=e.Rate/100*m,i=this.roundingService.Round(i,o,r),i}else return 0});grossTotalTaxable=u(()=>{let t=this.storeService.cartItems().filter(o=>o.Taxable),i=this.sum(t,"Total");if(t.length!==0){let o=this.calculateDiscTaxableItem();i=i*(100-this.storeService.order().Discount)/100,i=i*(100-this.storeService.order().Discount2)/100,i=i-o}return i});grossTotalNonTaxable=u(()=>{let t=this.storeService.cartItems().filter(o=>!o.Taxable),i=this.sum(t,"Total");return i=i*(100-this.storeService.order().Discount)/100,i=i*(100-this.storeService.order().Discount2)/100,i=i-this.storeService.order().DiscountAmount,i});getAmountByCart(e){let t=0;return e.forEach(i=>{t+=i.Total}),t=t*(100-this.storeService.order().Discount)/100,t=t*(100-this.storeService.order().Discount2)/100,t}calculateDiscTaxableItem=u(()=>{let e=this.grossTotal(),t=this.storeService.order().DiscountAmount,i=this.storeService.cartItems(),o=0,r=0,m=0,h=0,D=i.filter(F=>F.Taxable);for(let F of D)o=F.getItemAfterDiscount/e,r=o*t,h=r*F.Quantity,m+=h;return m});sum=(e,t)=>e.reduce((i,o)=>i+o[t],0);calculateDiscount(e){let t=100,i=0;return e.forEach(o=>{t=t*(100-o)/100}),i=100-t,i}getPointOnlyAmount=u(()=>{let t=this.storeService.cartItems().filter(i=>i.Variant.PaymentTypeID==2);return this.getAmountByCart(t)});getCashOnlyAmount=u(()=>{let t=this.storeService.cartItems().filter(i=>i.Variant.PaymentTypeID==1);return this.getAmountByCart(t)});getCashAndPointAmount=u(()=>{let t=this.storeService.cartItems().filter(i=>i.Variant.PaymentTypeID==0);return this.getAmountByCart(t)});discountAfterTax(e=0){let t=e,i=this.storeService.order(),o=this.storeService.loadForm().Taxes,m=this.totalBeforeTax()-e,h=i.TaxTypeID,D=P.FilterByID(o,h);if(P.IsNotEmpty(D)&&D.CalculationTypeID==0){let F=1+D.Rate/100,j=m*F;t=(j-(j-e))/F}return t}amountSummary=u(()=>{let e=this.isUseTax()?this.generateSummaryTax():this.generateSummaryNonTax(),t=this.generateSurchargeSummary();return t?[...e,...t]:e});isUseTax(){let e=this.storeService.tax();return!!(e?.PrintVisible&&e?.Rate!=0)}isDiscounted(){return this.discount1Amount()!=0||this.discount2Amount()!=0||this.storeService.order().DiscountAmount!=0}isTaxDetailVisible(){return this.appConfig?.PrintConfigInvoice?.Footer?.TaxDetailVisible}isTaxReserveSequence(){let e=this.storeService.tax();return!!(e&&e.CalculationTypeID===1&&this.appConfig?.PrintConfigInvoice?.ItemsFooter?.TaxIncludeBeforeTotalAmount)}shouldHideDiscountPercent(e){return this.appConfig?.PrintConfigInvoice?.Footer?.DiscountIgnoredDecimal&&parseFloat(e)%1!==0}generateCartItemAmount(e=!1){let t=this.isDiscounted()||e?this.grossTotal():this.totalAfterTax();return new Me(t,this.currencySymbol,"Amount",1)}generateDiscountSummary(){let e=[],t=this.storeService.order();if(this.discount1Amount()!=0){let o=this.decimalPipe.transform(t.Discount)??"",m=this.shouldHideDiscountPercent(o)?"{0}":"{0} ({1}%)";e.push(new Me(this.discount1Amount()*-1,this.currencySymbol,P.StringFormat(m,this.appConfig?.CorePrint?.Alias?.Discount1,o),1))}if(this.discount2Amount()!=0){let o=this.decimalPipe.transform(t.Discount2)??"",m=this.shouldHideDiscountPercent(o)?"{0}":"{0} ({1}%)";e.push(new Me(this.discount2Amount()*-1,this.currencySymbol,P.StringFormat(m,this.appConfig?.CorePrint?.Alias?.Discount2,o),1))}return t.DiscountAmount!=0&&this.appConfig?.PrintConfigInvoice?.ItemsFooter?.DiscountAmountVisible&&e.push(new Me(t.DiscountAmount*-1,this.currencySymbol,`Discount (${this.currencySymbol})`,1)),e}generateSummarySubTotal(){return new Me(this.totalAfterTax(),this.currencySymbol,"SubTotal",1)}generateBeforeTaxSummary(){return new Me(this.totalBeforeTax(),this.currencySymbol,"Before Tax",2)}generateAmountTotal(e="Total Amount"){return new Me(this.grandTotal(),this.currencySymbol,e,1)}calculateTaxableSales(){let e=this.storeService.tax(),t=this.grossTotalTaxable();return!e||e.Rate==0?0:e.CalculationTypeID==1?t-this.taxAmount():t}calculateTotalRate(e){return e?.length?e.reduce((t,i)=>t+i.Rate,0):0}generateSingleTaxSummary(e,t,i){return new Me(t,this.currencySymbol,e,i)}generateTaxTypeMultiple(){let e=this.storeService.tax();if(!e)return[];let t=this.isTaxDetailVisible()?2:1,i=[];if(e.TypeID==2){let o=e.Components??[],r=this.grossTotalTaxable(),m=this.calculateTotalRate(o);for(let h of o)if(e.CalculationTypeID==0){let D=h.Rate/100*r;i.push(this.generateSingleTaxSummary(h.Label,D,t)),e.MultipleTaxTypeID==1&&(r+=D)}else{let D=h.Rate/m*this.taxAmount();i.push(this.generateSingleTaxSummary(h.Label,D,t))}}else i.push(this.generateSingleTaxSummary(e.Label,this.taxAmount(),t));return i}generateTax(){if(!this.storeService.tax())return[];let t=this.isTaxDetailVisible(),i=t?2:1,o=[];if(t&&o.push(new Me(this.calculateTaxableSales(),this.currencySymbol,this.appConfig?.PrintConfigInvoice?.Footer?.TaxableSales,i)),o.push(...this.generateTaxTypeMultiple()),t){o.push(new Me(this.grossTotalNonTaxable(),this.currencySymbol,this.appConfig?.PrintConfigInvoice?.Footer?.TaxExemptSales,i));let r=this.appConfig?.PrintConfigInvoice?.Footer?.LabelWithZeroAmount;r&&o.push(new Me(0,this.currencySymbol,r,i))}return o}generateSurchargeSummary(){if(this.surchargeAmount()==0)return;let e=this.decimalPipe.transform(this.storeService.invoice().SurchargePcg)??"",t=this.appConfig?.CorePrint?.Alias?.SurchargePcg||"Surcharge";return[new Me(this.surchargeAmount(),this.currencySymbol,P.StringFormat("{0} ({1}%)",t,e),1),this.generateAmountTotal()]}generateSummaryNonTax(){let e=[this.generateCartItemAmount()];return this.isDiscounted()&&e.push(...this.generateDiscountSummary(),this.generateAmountTotal("Total")),e}generateTaxIncludeReserveSequence(){let e=[];if(!this.isTaxDetailVisible()){let i=this.isDiscounted()?"Amount":"Before Tax",o=this.isDiscounted()?this.grossTotal():this.totalBeforeTax();e.push(new Me(o,this.currencySymbol,i,2))}return this.isDiscounted()&&e.push(...this.generateDiscountSummary(),this.generateBeforeTaxSummary()),e.push(...this.generateTax(),this.generateAmountTotal()),e}generateTaxIncludeNormalSequence(){let e=[this.generateCartItemAmount()];return this.isDiscounted()&&e.push(...this.generateDiscountSummary(),this.generateSummarySubTotal()),e.push(...this.generateTax()),this.isTaxDetailVisible()||e.push(this.generateBeforeTaxSummary()),e}generateSummaryTaxInclude(){return this.isTaxReserveSequence()?this.generateTaxIncludeReserveSequence():this.generateTaxIncludeNormalSequence()}generateSummaryTaxExclude(){let e=[this.generateCartItemAmount(!0)];return this.isDiscounted()&&e.push(...this.generateDiscountSummary(),this.generateSummarySubTotal()),e.push(...this.generateTax()),e.push(new Me(this.totalAfterTax(),this.currencySymbol,"Total",1)),e}generateSummaryTax(){return this.storeService.tax()?.CalculationTypeID==1?this.generateSummaryTaxInclude():this.generateSummaryTaxExclude()}redeemableAmount=u(()=>{let t=this.storeService.cartItems().filter(i=>i.Variant.PaymentTypeID!=1);return this.getAmountByCart(t)});static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var bt=(j=>(j[j.IsNew=0]="IsNew",j[j.IsComplete=1]="IsComplete",j[j.IsEdit=2]="IsEdit",j[j.isPark=3]="isPark",j[j.IsRetrieve=4]="IsRetrieve",j[j.IsSplit=5]="IsSplit",j[j.IsBill=6]="IsBill",j[j.IsReturn=7]="IsReturn",j[j.IsUndo=8]="IsUndo",j[j.UploadOrderFail=9]="UploadOrderFail",j))(bt||{});var nn=class n{httpService=c(se);eventService=c(A);storeService=c(x);calculationService=c(ie);toastr=c(Q);constructor(){this.initializeEventHandlers()}initializeEventHandlers(){Fe(this.eventService.on("[Customer] Added").pipe(N(e=>{let t=e.payload?.customer.ID;this.updateOrder({CustomerID:t})})),this.eventService.on("[Customer] Removed").pipe(N(e=>{this.updateOrder({CustomerID:null})})),this.eventService.on("[Order] Update Date").pipe(N(e=>{let t=e.payload?.date;this.updateOrder({Date:t})})),this.eventService.on("[Order] Update Number").pipe(N(e=>{let t=e.payload?.number;this.updateOrder({Number:t})})),this.eventService.on("[Order] Update Sales Person").pipe(N(e=>{let t=e.payload?.id;this.updateOrder({SalesID:t})})),this.eventService.on("[Order] Update Note").pipe(N(e=>{let t=e.payload?.note;this.updateOrder({Note:t})})),this.eventService.on("[Order] Update Reference Number").pipe(N(e=>{let t=e.payload?.number;this.updateOrder({ReferenceNumber:t})})),this.eventService.on("[Order] Update Currency").pipe(N(e=>{let t=e.payload?.currency;this.updateOrder({CurrencyID:t?.ID,CurrencySymbol:t?.Symbol,CurrencyRate:t?.ExchangeRate})})),this.eventService.on("[Order] Update Customer PO Type").pipe(N(e=>{let t=e.payload?.poType;this.updateOrder({TypeID:t?.ID})})),this.eventService.on("[Order] Update Logistic Service").pipe(N(e=>{let t=e.payload?.id;this.updateOrder({LogisticsServiceID:t})})),this.eventService.on("[Order] Update Number Person").pipe(N(e=>{let t=e.payload?.total;this.updateOrder({NumberOfPerson:t})})),this.eventService.on("[Order] Update Discount Percentage 1").pipe(N(e=>{let t=e.payload?.discount;this.updateOrder({Discount:t})})),this.eventService.on("[Order] Update Discount Percentage 2").pipe(N(e=>{let t=e.payload?.discount;this.updateOrder({Discount2:t})})),this.eventService.on("[Order] Update Discount Amount").pipe(N(e=>{let t=e.payload?.discountAmount;this.updateOrder({DiscountAmount:t})})),this.eventService.on("[Order] Redeem Point").pipe(N(e=>{this.calculatePointToDiscount(e.payload?.pointUsed??0)})),this.eventService.on("[Order] Update Tax").pipe(N(e=>{let t=e.payload?.tax;this.updateOrder({TaxTypeID:t?.ID})})),this.eventService.on("[Order] Update Delivery State ID").pipe(N(e=>{let t=e.payload?.deliveryOutletId,i=e.payload?.deliveryState;this.updateOrder({DeliveryOutletID:t,DeliveryStateID:i});let o=this.storeService.action();this.storeService.updateAction(z(E({},o),{DeliveryEntityID:t}))})),this.eventService.on("[Register] Updated").pipe(_e(e=>!!e.payload?.register),N(e=>{let t=e.payload?.register;this.initOrderRegister(t),this.initOrderTax(t)})),this.eventService.on("[Order] Complete Order").pipe(N(e=>{this.storeService.updateState(1),this.storeService.updateCompleteOrder(e.payload?.submitOrderHttpResponse||null)}))).pipe(q()).subscribe()}initOrderRegister(e){this.updateOrder({RegisterID:e?.RegisterID,EntityID:e?.EntityID})}initOrderTax(e){let t=e?.DefaultTaxType,i=this.storeService.loadForm().Taxes;if(P.IsNotEmpty(t)){let o=this.getTaxById(t);P.IsNotEmpty(o)?this.updateOrder({TaxTypeID:o?.ID}):(o=i[0],this.updateOrder({TaxTypeID:o.ID}))}else{let o=i[0];this.updateOrder({TaxTypeID:o.ID})}}getTaxById(e){return(this.storeService.loadForm()?.Taxes).find(o=>o.ID===e)}updateOrder(e){let t=this.storeService.order();this.storeService.updateOrder(E(E({},t),e))}calculatePointToDiscount(e){let t=this.storeService.loadForm().AppConfigJSON,i=this.calculationService.redeemableAmount(),o=t.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,r=e*o;r>i&&(e=Math.ceil(i/o),r=i),(this.storeService.order().PointUsed??0)!=e&&(this.updateOrder({PointUsed:e||0,DiscountAmount:r}),e>0&&this.toastr.success("Point has been redeemed","Success"))}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var ht=class n{eventService=c(A);httpService=c(se);storeService=c(x);role=c($e);toastr=c(Q);customerId=null;isEnabledLoyaltyPoint=u(()=>{let t=this.storeService.loadForm().AppConfigJSON?.ApplicationLoyalty?.Enabled,i=this.storeService.register()?.MemberPoint,o=this.storeService.customer();return!!(t&&i&&o?.Point>0&&o?.LoyaltyEnabled)});isShowDebt=u(()=>{let e=this.storeService.customer(),t=this.role?.contact?.Debt;return e?.Debt>0&&t});constructor(){this.initEventHandlers()}initEventHandlers(){Fe(this.eventService.on("[Customer] Add By Id").pipe(vt(e=>this.addCustomerById$(e.payload))),this.eventService.on("[Customer] Add By Code").pipe(vt(e=>this.addCustomerByCode$(e.payload.code))),this.eventService.on("[Customer] Create").pipe(vt(e=>this.createCustomer$(e.payload.customer))),this.eventService.on("[Customer] Remove").pipe(N(()=>{this.deleteCustomer()}))).pipe(q()).subscribe()}addCustomerById$(e){this.resetCartOnChangeCustomer(e.id);let t=this.storeService.register()?.EntityID;return this.httpService.get(Ce.GetCustomerPrivilegeByID,[{key:"ID",value:e.id},{key:"EntityID",value:t}]).pipe(N(i=>{if(i.ID=e.id,i.Name=e.name,this.rejectExclusiveCustomer(i))return;let o=this.storeService.loadForm()?.AppConfigJSON;i.Label=o?.ApplicationLoyalty?.Label,i.DebtCalculated=i.Debt,this.storeService.updateCustomer(i),this.eventService.emit({type:"[Customer] Added",payload:{customer:i}})}),We(i=>(this.deleteCustomer(),st)))}rejectExclusiveCustomer(e){let t=this.storeService.loadForm()?.AppConfigJSON?.ModuleSell?.Customer?.ExclusiveforOutlet,i=this.storeService.order()?.EntityID;return!t||e.EntityID===P.GuidEmpty||e.EntityID===i?!1:(this.deleteCustomer(),this.toastr.warning(`${e.Name} is exclusive to ${e.EntityName} Outlet and cannot be used in other outlets!`,"Exclusive Customer"),!0)}addCustomerByCode$(e){return this.httpService.post(Ce.GetCustomerByCode,{Code:e}).pipe(vt(t=>this.addCustomerById$({id:t.ID,name:t.Name})),We(t=>st))}deleteCustomer(){this.customerId=null;let e=new En;this.storeService.updateCustomer(e),this.eventService.emit({type:"[Customer] Removed",payload:null})}resetCartOnChangeCustomer(e){let t=this.storeService.loadForm()?.AppConfigJSON;this.customerId!=e&&t?.ModuleSell?.Customer?.ClearCartOnChange&&this.storeService.updateCartItems([]),this.customerId=e}sendOtpViaEmail(e){return this.httpService.post(Ce.SendOtpEmail,{Email:e})}sendOtpViaWhatsApp(e){return this.httpService.post(Ce.SendOtpWhatsApp,{Number:e})}verifyEmailOtp(e,t){return this.httpService.post(Ce.VerifyEmailOtp,{Email:e,OTP:t})}verifyWhatsAppOtp(e,t){return this.httpService.post(Ce.VerifyWhatsAppOtp,{Number:e,OTP:t})}verifyPin(e,t){return this.httpService.post(Ce.VerifyPin,{PIN:e,CustomerID:t})}createCustomer$(e){let t=this.storeService.loadForm()?.CustomerOptions?.DebtLimit;t&&(e.DebtLimit=t);let i=[];return e.Group&&i.push(e.Group),this.httpService.post(Ce.CreateCustomer,{contact:e,groups:i}).pipe(vt(o=>this.addCustomerById$({id:o.ID,name:e.Name})),We(o=>st))}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac})};var dl=n=>({"quickkey-subscription-overdue":n}),pl=()=>["/menu/Outlets/Master/Quick_Key_Templates/Form"],jl=n=>({ID:n}),Gl=n=>({OutletID:n});function Hl(n,e){if(n&1&&S(0,"img",16),n&2){let t=p(2).$implicit;b("ngSrc",t.ImageURLClient)("redirectOnClickBrokenImage",!1)}}function zl(n,e){if(n&1&&(a(0,"div",14)(1,"div",15),g(2,Hl,1,2,"img",16),l()()),n&2){let t=p().$implicit;s(2),f(t.ImageURLClient?2:-1)}}function $l(n,e){if(n&1&&(a(0,"div",15)(1,"p",17)(2,"span"),d(3),I(4,"slice"),l()()()),n&2){let t=p().$implicit;s(3),R(He(4,1,t.Display,0,3))}}function Kl(n,e){if(n&1&&(a(0,"small",18),d(1),I(2,"number"),l()),n&2){let t=p(2).$implicit;s(),R(V(2,1,t.Children[0]==null?null:t.Children[0].UnitPrice))}}function Jl(n,e){if(n&1&&(a(0,"small",19),d(1),I(2,"lowestPrice"),I(3,"number"),I(4,"highestPrice"),I(5,"number"),l()),n&2){let t=p(2).$implicit;s(),Oe("",V(3,4,V(2,2,t==null?null:t.Children))," - ",V(5,8,V(4,6,t==null?null:t.Children)))}}function Yl(n,e){if(n&1&&g(0,Kl,3,3,"small",18)(1,Jl,6,10,"small",19),n&2){let t=p().$implicit;f(t.Children.length==1?0:1)}}function Xl(n,e){if(n&1){let t=M();a(0,"div",12)(1,"a",13),C("click",function(){let o=y(t).$implicit,r=p(4);return _(r.onSelectProduct(o))}),g(2,zl,3,1,"div",14)(3,$l,5,5,"div",15),a(4,"small"),d(5),I(6,"slice"),l(),g(7,Yl,2,1),l()()}if(n&2){let t=e.$implicit,i=p(4);be(i.column()),s(2),f(t.ImageURLClient?2:3),s(3),R(He(6,5,t.Display,0,36)),s(2),f(i.priceVisible()?7:-1)}}function Zl(n,e){if(n&1&&(a(0,"mat-tab",5)(1,"div",6)(2,"div",7),X(3,Xl,8,9,"div",8,Xe),a(5,"div",9)(6,"a",10),S(7,"i",11),l()()()()()),n&2){let t,i=e.$implicit,o=p(3);b("label",i.Name),s(3),Z(i.Items),s(2),be(o.column()),s(),b("routerLink",yt(5,pl))("queryParams",re(6,jl,(t=o.quickKey())==null?null:t.ID))}}function es(n,e){if(n&1&&(a(0,"mat-tab-group",4),X(1,Zl,8,8,"mat-tab",5,Xe),l()),n&2){let t,i=p(2);b("disableRipple",!0),s(),Z((t=i.quickKey())==null?null:t.Groups)}}function ts(n,e){if(n&1&&S(0,"img",25),n&2){let t=p(2).$implicit;b("src",t.ImageURLClient,Qe)("redirectOnClickBrokenImage",!1)}}function is(n,e){if(n&1&&(a(0,"div",14)(1,"div",15),g(2,ts,1,2,"img",25),l()()),n&2){let t=p().$implicit;s(2),f(t.ImageURLClient?2:-1)}}function ns(n,e){if(n&1&&(a(0,"div",15)(1,"p",17)(2,"span"),d(3),I(4,"slice"),l()()()),n&2){let t=p().$implicit;s(3),R(He(4,1,t.Model,0,3))}}function os(n,e){if(n&1&&(a(0,"small",18),d(1),I(2,"number"),l()),n&2){let t=p().$implicit;s(),R(V(2,1,t.UnitPrice))}}function rs(n,e){if(n&1){let t=M();a(0,"div",12)(1,"a",13),C("click",function(){let o=y(t).$implicit,r=p(3);return _(r.emitSelectedVariant(o.ID))}),g(2,is,3,1,"div",14)(3,ns,5,5,"div",15),a(4,"small"),d(5),I(6,"slice"),l(),g(7,os,3,3,"small",18),l()()}if(n&2){let t=e.$implicit,i=p(3);be(i.column()),s(2),f(t.ImageURLClient?2:3),s(3),R(He(6,5,t.Model,0,30)),s(2),f(i.priceVisible()?7:-1)}}function as(n,e){if(n&1){let t=M();a(0,"div",20)(1,"div",21),C("click",function(){y(t);let o=p(2);return _(o.onChangeQuickeyState("QUICKEY"))}),S(2,"i",22),l(),a(3,"div",23)(4,"b"),d(5),l()()(),a(6,"div",6)(7,"div",24),X(8,rs,8,9,"div",8,Ie),l()()}if(n&2){let t,i=p(2);s(5),O(" ",i.subQuickKey().Display),s(3),Z((t=i.subQuickKey())==null?null:t.Children)}}function ls(n,e){if(n&1&&g(0,es,3,1,"mat-tab-group",4)(1,as,10,1),n&2){let t=p();f(t.quickeyState()=="QUICKEY"?0:1)}}function ss(n,e){if(n&1&&(a(0,"div",3)(1,"a",26)(2,"strong"),d(3,"QUICK KEYS UNCONFIGURED"),l(),S(4,"i",27),a(5,"span"),d(6,"Click here to setup your Quick keys"),l()()()),n&2){let t=p();b("ngClass",re(3,dl,t.currentSubsStatus()==t.subscriptionStatus.OVERDUE||t.currentSubsStatus()==t.subscriptionStatus.SELL_ONLY)),s(),b("routerLink",yt(5,pl))("queryParams",re(6,Gl,t.outletId()))}}var eo=class n{authService=c(Jr);quickKey=pe();quickKeyTotalRow=pe();priceVisible=pe();outletId=pe();quickeyState=v("QUICKEY");column=v("col-3");subQuickKey=v({Display:null,Children:[]});subscriptionStatus=qr;currentSubsStatus=v(0);onSelectVariant=new Et;constructor(){Nt(()=>{let e=`col-${12/(this.quickKeyTotalRow()?this.quickKeyTotalRow():3)}`;this.column.set(e)},{allowSignalWrites:!0}),this.currentSubsStatus.set(this.authService.getSubscriptionStatus())}onSelectProduct(e){e.Children?e.Children.length==0?this.emitSelectedVariant(e.ItemID):e.Children.length==1?this.emitSelectedVariant(e.Children[0]?.ID):(this.onChangeQuickeyState("SUBQUICKEY"),this.subQuickKey.update(()=>({Display:e.Display,Children:e.Children}))):(this.onChangeQuickeyState("SUBQUICKEY"),this.subQuickKey.update(()=>({Display:e.Display,Children:e.Children})))}emitSelectedVariant(e){this.onSelectVariant.emit(e)}onChangeQuickeyState(e){this.quickeyState.set(e)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["quick-keys"]],inputs:{quickKey:[1,"quickKey"],quickKeyTotalRow:[1,"quickKeyTotalRow"],priceVisible:[1,"priceVisible"],outletId:[1,"outletId"]},outputs:{onSelectVariant:"onSelectVariant"},decls:5,vars:4,consts:[[1,"row","mt-5"],[1,"col-12"],[1,"quick-key-tab",3,"ngClass"],[1,"no-quick-key","d-flex","align-items-center","justify-content-center",3,"ngClass"],[1,"h-100","bgQuickkeyIllustration","landscape",3,"disableRipple"],[3,"label"],[1,"container","tabItems"],[1,"row","g-0"],[1,"column","px-6",3,"class"],[1,"column","d-flex","align-items-center","pb-6"],[1,"w-100",3,"routerLink","queryParams"],["aria-hidden","true",1,"fa","fa-plus-circle","fa-5x","d-flex","align-items-center","justify-content-center","bg-white","h-100","text-primary"],[1,"column","px-6"],[3,"click"],[1,"img-box","d-flex","align-items-center"],[1,"ratio","ratio-1x1"],["priority","","fill","","brokenImageIconFailSafe","",1,"full-screen-image",3,"ngSrc","redirectOnClickBrokenImage"],[1,"fw-normal","fs-1","d-flex","align-items-center","justify-content-center"],[1,"text-muted"],[1,"text-muted",2,"word-break","auto-phrase"],[1,"row","g-0","border","align-items-center","subquicKey"],[1,"col-auto","border-end","py-5","px-7","cursor-pointer",3,"click"],["aria-hidden","true",1,"fa","fa-arrow-left"],[1,"col","text-center","fw-bold","text-uppercase","fs-5"],[1,"row","g-0","rowSubQuickey"],["brokenImageIconFailSafe","",1,"full-screen-image",3,"src","redirectOnClickBrokenImage"],["id","LinkConfigureQuickkey","target","_blank",3,"routerLink","queryParams"],["aria-hidden","true",1,"fa-regular","fa-hand-pointer"]],template:function(t,i){if(t&1&&(a(0,"div",0)(1,"div",1)(2,"section",2),g(3,ls,2,1)(4,ss,7,8,"div",3),l()()()),t&2){let o;s(2),b("ngClass",re(2,dl,i.currentSubsStatus()==i.subscriptionStatus.OVERDUE||i.currentSubsStatus()==i.subscriptionStatus.SELL_ONLY)),s(),f((o=i.quickKey())!=null&&o.Groups&&((o=i.quickKey())==null||o.Groups==null?null:o.Groups.length)>0?3:4)}},dependencies:[W,ue,vi,Pn,Di,Pi,xi,Br,Ut,Ma,_n,K,ia,na],styles:[".quick-key-tab{width:100%;position:relative;height:100%;max-height:calc(100vh - 72px)} .quick-key-tab .mat-mdc-tab-header-pagination{display:none!important} .quick-key-tab .mat-mdc-tab-header{border:none} .quick-key-tab .mdc-tab-indicator{display:none!important} .quick-key-tab .mat-mdc-tab-body-wrapper{width:102%} .quick-key-tab .mat-mdc-tab-body-content{overflow-x:hidden} .quick-key-tab .mat-mdc-tab-labels{border-bottom:0px;display:flex;flex-wrap:wrap;border-radius:6px} .quick-key-tab .mat-mdc-tab-labels .mat-mdc-tab{color:#151515;opacity:1;height:38px;max-height:40px;white-space:normal!important;overflow:hidden;padding:0!important;min-width:25%!important;flex-basis:0;font-size:12px;font-weight:700;outline:none;text-transform:uppercase;background:#fff;display:flex} .quick-key-tab .mat-mdc-tab-labels .mat-mdc-tab .mdc-tab__content{white-space:normal!important;align-self:center;font-size:.875rem!important} .quick-key-tab .mat-mdc-tab-labels .mdc-tab--active{background:linear-gradient(to bottom,#fff,#eee);border-radius:6px;border:.5px solid #dadada} .quick-key-tab .mat-mdc-tab-labels .mdc-tab--active .mdc-tab__text-label{color:gray!important;font-weight:700} .quick-key-tab .mat-mdc-tab-labels .mat-mdc-tab:nth-child(n+5){flex-grow:0!important} .quick-key-tab .tabItems{padding:0} .quick-key-tab .tabItems .column{margin-top:15px;margin-bottom:10px;word-break:break-all} .quick-key-tab .tabItems .column>div{border:solid 1px #cfcfcf} .quick-key-tab .tabItems .column>a{text-align:center;display:block;cursor:pointer} .quick-key-tab .tabItems .column>a div.img-box{display:block;margin:0 auto;border-top-left-radius:5px;border-bottom-right-radius:5px;border:solid 1px #dddddd} .quick-key-tab .tabItems .column>a .full-screen-image{position:absolute;object-fit:scale-down} .quick-key-tab .tabItems .column>a p{display:block;margin:0 auto;background-color:#a6a6a6;border:solid 1px #999999;border-top-left-radius:5px;border-bottom-right-radius:5px;color:#fff} .quick-key-tab .tabItems .column>a small{font-size:11px;display:block;margin:5px 0 0} .quick-key-tab .tabItems .column .ion-icon{font-size:75px;margin:10px} .quick-key-tab .col-md-3.column.add{cursor:pointer} .quick-key-tab .col-md-3.column.add i{margin-top:10px} .quick-key-tab ::-webkit-scrollbar{width:3px} .quick-key-tab ::-webkit-scrollbar-track{box-shadow:inset 0 0 5px #bfd2da} .quick-key-tab ::-webkit-scrollbar-thumb{background:#c4c4c4;border-radius:10px} .quick-key-tab .subquicKey{background:linear-gradient(to bottom,#fff,#eee);color:gray;border-radius:6px} .quick-key-tab .no-quick-key{background-image:url(https://cdn.dealpos.xyz/web-image/no-quick-key.png)!important;background-repeat:no-repeat;height:calc(100vh - 100px);background-size:contain}a#LinkConfigureQuickkey[_ngcontent-%COMP%]{background-color:#479ccf;padding:15px 25px;color:#fff;text-decoration:none;width:240px;display:block;opacity:.85;border-radius:6px}a#LinkConfigureQuickkey[_ngcontent-%COMP%]{position:absolute;top:200px;left:calc(50% - 120px)}a#LinkConfigureQuickkey[_ngcontent-%COMP%]:hover{opacity:.95}a#LinkConfigureQuickkey[_ngcontent-%COMP%] Strong[_ngcontent-%COMP%]{border-bottom:1px solid white;font-size:14px;margin:0 0 10px;padding:0 0 3px;display:block}a#LinkConfigureQuickkey[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{display:inline-block;height:35px;margin:0 10px 0 0;font-size:28px}a#LinkConfigureQuickkey[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:inline-block;font-size:14px;width:135px;vertical-align:top}[_nghost-%COMP%] .broken-image-placeholder{width:100%!important;height:100%!important;border:0!important;border-top-left-radius:5px;border-bottom-right-radius:5px}"]})};var ye=class{ID;VariantID;Quantity;Cost;Price;Expense;UnitPriceOriginal;Discount;DiscountAmount;Index;CouponDiscount;Note;Taxable;LoyaltyPoint;EntityID;UnitQuantity;VariantUnitQuantity;UnitQuantityPrice;PriceTypeID;PriceNote;Splited;InventoryTypeID;TypeID;Variant=new fr;EntityName;SalesID;SalesName;PriceBookID;Serial;UnitExpense;UnitCost;UnitPrice;Checked;SplitQuantity;PurchaseOrderID;isMaxInventory;SerialSource;AvailableInventory;PromotionGift;PromotionID;CopyPromotionName;SalesCommission;constructor(e){e&&(this.ID=e.ID||"",this.VariantID=e.VariantID||"",this.AvailableInventory=e.AvailableInventory,this.Cost=e.Cost||0,this.Price=e.Price||0,this.Expense=e.Expense||0,this.UnitPriceOriginal=e.UnitPriceOriginal||0,this.Discount=e.Discount||0,this.DiscountAmount=e.DiscountAmount||0,this.Quantity=e.Quantity||0,this.UnitQuantity=e.UnitQuantity||0,this.VariantUnitQuantity=e.VariantUnitQuantity||0,this.UnitQuantityPrice=e.UnitQuantityPrice||0,this.PriceTypeID=e.PriceTypeID||0,this.Note=e.Note||"",this.PriceNote=e.PriceNote||"",this.Taxable=e.Taxable||!1,this.LoyaltyPoint=e.LoyaltyPoint||!1,this.InventoryTypeID=e.InventoryTypeID||1,this.TypeID=e.TypeID||0,this.Variant=e.Variant||new fr,this.EntityID=e.EntityID||"",this.EntityName=e.EntityName||"",this.SalesID=e.SalesID||"",this.SalesName=e.SalesName||"",this.PriceBookID=e.PriceBookID||"",this.Serial=e.Serial||[],this.UnitExpense=e.UnitExpense||0,this.UnitCost=e.Variant?.UnitCost||0,this.UnitPrice=e.Variant?.UnitPrice||0,this.PurchaseOrderID=e.PurchaseOrderID||"",this.SerialSource=e.SerialSource||[],this.PromotionGift=e.PromotionGift||!1,this.PromotionID=e.PromotionID||"",this.CopyPromotionName=e.CopyPromotionName||!1,this.SalesCommission=e.SalesCommission||0)}removeEnterNote(){this.Note&&(this.Note=this.Note.replace(/\n/g,""))}get Total(){let e=this.GrossTotal-this.DiscountPercentAmount;this.validateDiscountAmount(e);let t=this.DiscountAmount*this.Quantity;return e-t}validateDiscountAmount(e){let t=this.Quantity%1===0;e>0&&this.DiscountAmount>e&&t&&(this.DiscountAmount=e)}get GrossTotal(){let e=this.Price*(this.Quantity*this.UnitQuantity);return e||0}get DiscountPercentAmount(){return this.Discount?this.GrossTotal*this.Discount/100:0}get getItemAfterDiscount(){let e=this.getDiscPercentagePerItem();return this.DiscountAmount<e?e-this.DiscountAmount:0}getDiscPercentagePerItem(){let e=this.Price;return this.Discount>0&&(e=(100-this.Discount)/100*this.Price),e}getSelectedPricebook(e){if(this.Variant.PriceBook){let t=this.Variant.PriceBook.filter(i=>i.ID==e);if(t.length)return t[0]}return null}get TotalAfterDiscountPerQuantity(){let e=this.DiscountPercentAmount/(this.Quantity*this.UnitQuantity),t=this.DiscountAmount,i=this.Price-e-t;return i||0}};var to=class{Order;Invoice;Shipping;Action;Payments=[];Items=[]};var ke=class n{storeService=c(x);createCartItemByVariant(e){let t=new ye;return t.VariantID=e.ID,t.PriceTypeID=e.PriceTypeID,t.Variant=e,t.UnitQuantity=e.UnitQuantity,t.Quantity=1,e.UnitQuantity>1&&(t.UnitQuantityPrice=e.UnitPrice/e.UnitQuantity),t.Price=e.UnitPrice,t.UnitPrice=e.UnitPrice,t.Cost=e.UnitCost,t.UnitCost=e.UnitCost,t.Expense=e.UnitCost,t.Discount=e.PriceDiscount,t.UnitPriceOriginal=e.UnitPriceOriginal,t.DiscountAmount=0,t.CouponDiscount=0,t.Taxable=e.Taxable,t.InventoryTypeID=e.TypeID,t.LoyaltyPoint=e.LoyaltyPoint,t.VariantUnitQuantity=e.VariantUnitQuantity,this.copyProductNotesToItem(t,e),t}copyProductNotesToItem(e,t){if(t.TypeID===9)return;let i=this.storeService.loadForm()?.AppConfigJSON?.ModuleSell?.ProductNotes;i?.CopyProductDescription&&(e.Note=t.Description??""),i?.CopyPromotionName&&P.IsNotEmpty(t.PriceNote)&&(e.Note=P.IsNotEmpty(e.Note)?`${e.Note} ${t.PriceNote}`:t.PriceNote,e.PriceNote=t.PriceNote)}createSalesOrderSubmission(){let e=new to;return e.Items=[...this.generateItemsForSubmission()],e.Payments=[...this.storeService.payments()],e.Order=E({},this.storeService.order()),e.Shipping=E({},this.storeService.shipping()),e.Action=E({},this.storeService.action()),e.Invoice=E({},this.storeService.invoice()),e.Order.CustomerID==null&&(e.Order.CustomerID=P.GuidEmpty),e.Order.SalesID==null&&(e.Order.SalesID=P.GuidEmpty),e}generateItemsForSubmission(){let e=JSON.parse(JSON.stringify(this.storeService.cartItems()));return e=e.map(t=>(t.Taxable=t.Variant.Taxable,t.Splited=t.SplitQuantity>0,t.InventoryTypeID=t.Variant.TypeID,t.Variant&&delete t?.Variant,t)),e}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac,providedIn:"root"})};var Ht=(r=>(r[r.Amount=1]="Amount",r[r.Quantity=2]="Quantity",r[r.Discount=3]="Discount",r[r.Product=4]="Product",r[r.PromotionTiered=5]="PromotionTiered",r))(Ht||{});var Ei=(m=>(m.Amount="Amount",m.Percentage="Percentage",m.Return="Return",m.ParkedDeletion="ParkedDeletion",m.DeleteItem="DeleteItem",m.FullAccess="FullAccess",m))(Ei||{});var io=class{Code="";Provider="";OutletID;Customer;ShoppingCart={Amount:0,Items:[]}};var zt=class n{storeService=c(x);calculationService=c(ie);generateRedeemCouponDto(e,t="Internal"){let i=new io,o=this.storeService.register(),r=this.storeService.order(),m=this.storeService.customer();return i.Code=e,i.Provider=t,i.OutletID=o?.EntityID,i.ShoppingCart={Amount:this.calculationService.grandTotal(),Items:this.generateItems()},i.Customer=this.generateCustomer(t,r,m),i}generateItems(){return this.storeService.cartItems().map(e=>({VariantID:e.VariantID,Price:e.Price,Quantity:e.Quantity,Code:e.Variant?.Code??"",Discount:e.Discount,DiscountAmount:e.DiscountAmount,PriceBookID:e.PriceBookID,UnitPriceOriginal:e.UnitPriceOriginal,UnitPrice:e.UnitPrice,CategoryID:e.Variant?.CategoryID}))}generateCustomer(e,t,i){let o=t?.CustomerID;if(!o)return null;let r={Phone:i?.Mobile,Email:i?.Email};return e==="Internal"&&(r.ID=o),r}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac})};var ni=class n{httpService=c(se);eventBusService=c(A);storeService=c(x);promotionCouponFactoryService=c(zt);calculationService=c(ie);roleService=c(ce);toastr=c(Q);_appliedCoupon=v(null);appliedCoupon=u(()=>this._appliedCoupon());_originalOrder=v(null);separateQuantityToNewRow=u(()=>this.storeService.loadForm()?.AppConfigJSON?.ModuleSell?.PromotionCouponSeparateQuantityToNewRow??!1);constructor(){this.initEventHandlers()}initEventHandlers(){Fe(this.eventBusService.on("[Coupon] Apply").pipe(N(e=>{let{code:t,couponNote:i}=e.payload;this.redeemCoupon(t,i)})),this.eventBusService.on("[Coupon] Remove").pipe(N(()=>this.removeAppliedCoupon())),this.eventBusService.on("[Coupon] Set On Edit").pipe(N(e=>{let{coupon:t}=e.payload;this.setCouponOnEdit(t)})),this.eventBusService.on("[Coupon] Reset On New Transaction").pipe(N(()=>this.resetCouponOnNewTransaction())),this.eventBusService.on("[Coupon] Item Selected").pipe(N(({payload:e})=>this.applyDiscountToSelectedItem(e.coupon,e.selectedItem)))).pipe(q()).subscribe()}redeemCoupon(e,t){if(e=this.trimInputCoupon(e),!e)return;let i=this.promotionCouponFactoryService.generateRedeemCouponDto(e,"Internal");this.httpService.post(oe.ValidateInternalCouponV2,i).pipe(N(o=>{o.Note=t||"",o.Code=e,this.saveOriginalOrder(),this.applyCoupon(o)})).subscribe()}removeAppliedCoupon(){let e=this._originalOrder();if(e){this.storeService.updateOrder(e);let i=e;i.CartItems&&this.storeService.updateCartItems(i.CartItems)}let t=this._appliedCoupon();t&&this.isRoleBasedCoupon(t.Type)&&this.roleService.resetToOriginal(),this._appliedCoupon.set(null),this._originalOrder.set(null)}setCouponOnEdit(e){!e||!P.IsNotEmpty(e?.Type)||(this._appliedCoupon.set(e),this.buildOriginalOrderOnEdit())}resetCouponOnNewTransaction(){this.roleService.resetToOriginal(),this._appliedCoupon.set(null),this._originalOrder.set(null)}applyCoupon(e){switch(e.Type){case"Percentage":this.applyDiscountPercentage(e);break;case"Amount":this.applyDiscountAmount(e);break;case"Return":this.handleCouponReturnAccess(e);break;case"DeleteItem":this.handleDeleteItemAccess(e);break;case"ParkedDeletion":this.handleCouponParkedDeletionAccess(e);break;case"FullAccess":this.handleFullAccess(e);break}this._appliedCoupon.set(e)}applyDiscountPercentage(e){let t=e.ApplyToProduct??[];if(t.some(o=>P.IsNotEmpty(o.UserOption))){this.requestItemSelection(e);return}t.length>0?this.applyDiscountToProduct(e,t):this.applyDiscountToOrder(e)}applyDiscountAmount(e){let t=e.ApplyToProduct??[];if(t.some(o=>P.IsNotEmpty(o.UserOption))){this.requestItemSelection(e);return}t.length>0?this.applyDiscountToProduct(e,t):this.applyDiscountToOrder(e)}requestItemSelection(e){this._appliedCoupon.set(e),this.eventBusService.emit({type:"[Coupon] Select Item",payload:{coupon:e}})}applyDiscountToSelectedItem(e,t){let i=E({},e);i.ApplyToProduct=i.ApplyToProduct.map(o=>(t.ID===o.ID&&(o.SelectedItem=!0),o)),this._appliedCoupon.set(i),this.applyDiscountToProduct(i,[t])}applyDiscountToOrder(e){let t=this.storeService.order(),i=E({},t);switch(e.Type){case"Amount":i.DiscountAmount=e.Amount;break;case"Percentage":{let o=this.calculateMaxDiscountInvoice(e);o.type==="amount"?i.DiscountAmount=o.discount:i.Discount=o.discount;break}}i.PromotionCoupon=e.Code,i.PromotionNote=e.Note||"",i.CouponType=1,this.storeService.updateOrder(i),this.showCouponAppliedToast(e)}applyDiscountToProduct(e,t){let i=this.storeService.cartItems(),o=[],r=[];for(let F of i){let j=this.findPromotionItemByVariantID(F,t);if(j.isMatch){let Ae=t[j.index];if(this.separateQuantityToNewRow()&&F.Quantity>1&&Ae.OneFirstOption){let Ee=this.separateItemQuantityToNewRow(Ae,F,e);o.push(Ee.originalItem),Ee.separatedItem&&r.push(Ee.separatedItem)}else{let Ee=this.calculateOneOfFirstDisc(Ae,F.Quantity);Ae.Amount=Ee;let Ne=this.applyDiscountToItem(F,Ae,e);o.push(Ne)}}else o.push(F)}let m=[...o,...r],h=this.storeService.order(),D=E({},h);D.PromotionCoupon=e.Code,D.PromotionNote=e.Note||"",D.CouponType=1,this.storeService.updateCartItems(m),this.storeService.updateOrder(D),this.showCouponAppliedToast(e)}separateItemQuantityToNewRow(e,t,i){let o=t.Quantity;if(o<=1)return{originalItem:this.applyDiscountToItem(t,e,i),separatedItem:null};let r=new ye(E({},t));r.Quantity=o-1;let m=this.applyDiscountToItem(t,e,i);return m.Quantity=1,{originalItem:r,separatedItem:m}}calculateOneOfFirstDisc(e,t){let i=e.Amount;return e.OneFirstOption&&(i=e.Amount/t),i}applyDiscountToItem(e,t,i){switch(i.Type){case"Amount":e.DiscountAmount=t.Amount,e.CouponDiscount=0;break;case"Percentage":{if(e.CouponDiscount=t.Amount,i.MaxDiscount>0)if(this.calculateDiscountItem(e,t.Amount)>i.MaxDiscount){let r=i.MaxDiscount/e.Quantity;e.DiscountAmount=r,e.Discount=0}else e.Discount=t.Amount,e.DiscountAmount=0;else e.Discount=t.Amount,e.DiscountAmount=0;break}}return e}calculateDiscountItem(e,t){return e.Price*e.Quantity*t/100}findPromotionItemByVariantID(e,t){let i=t.findIndex(o=>o.ID===e.VariantID);return{isMatch:i>-1,index:i}}calculateMaxDiscountInvoice(e){return e.MaxDiscount>0&&this.calculationService.grandTotal()*e.Amount/100>e.MaxDiscount?{discount:e.MaxDiscount,type:"amount"}:{discount:e.Amount,type:"percentage"}}handleCouponReturnAccess(e){this.roleService.updateReturn(!0),this.applyCouponToSalesOrderOnly(e)}handleDeleteItemAccess(e){this.roleService.updateDeleteItem(!0),this.applyCouponToSalesOrderOnly(e)}handleCouponParkedDeletionAccess(e){this.roleService.updateParkedDeletion(!0),this.applyCouponToSalesOrderOnly(e)}handleFullAccess(e){this.roleService.updateFullAccess(!0),this.applyCouponToSalesOrderOnly(e)}applyCouponToSalesOrderOnly(e){let t=this.storeService.order(),i=E({},t);i.PromotionCoupon=e.Code,i.PromotionNote=e.Note||"",i.CouponType=1,this.storeService.updateOrder(i),this.showCouponAppliedToast(e)}isRoleBasedCoupon(e){return e==="Return"||e==="DeleteItem"||e==="ParkedDeletion"||e==="FullAccess"}saveOriginalOrder(){let e=this.storeService.order(),t=E({},e);t.CartItems=[...this.storeService.cartItems()],this._originalOrder.set(t)}buildOriginalOrderOnEdit(){let e=this.storeService.order(),t=E({},e);t.CartItems=[...this.storeService.cartItems()],t.PromotionCoupon="",t.PromotionNote="",t.Discount=0,t.DiscountAmount=0,this._originalOrder.set(t)}trimInputCoupon(e){return P.IsNotEmpty(e)?e.trim():e}showCouponAppliedToast(e){P.IsNotEmpty(e.Notification)?this.toastr.success(e.Notification,"Coupon Applied"):this.toastr.success("Coupon applied successfully!","Coupon Applied")}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac})};var oi=class n{httpService=c(se);eventBusService=c(A);storeService=c(x);promotionCouponFactoryService=c(zt);calculationService=c(ie);toastr=c(Q);decimalPipe=c(K);_appliedCoupon=v(null);appliedCoupon=u(()=>this._appliedCoupon());couponCode=null;couponNote="";_couponProvider=null;get couponProvider(){return this._couponProvider}countToastrNotification=0;constructor(){this.initEventHandlers()}initEventHandlers(){Fe(this.eventBusService.on("[Coupon External] Apply").pipe(N(e=>{let{code:t,provider:i,couponNote:o}=e.payload;this.redeemCoupon(t,i,o)})),this.eventBusService.on("[Coupon External] Remove").pipe(N(()=>this.removeAppliedCoupon())),this.eventBusService.on("[Coupon] Reset On New Transaction").pipe(N(()=>this.resetOnNewTransaction()))).pipe(q()).subscribe()}redeemCoupon(e,t,i){if(e=this.trimInputCoupon(e),!e)return;let o=this.promotionCouponFactoryService.generateRedeemCouponDto(e,t);this.httpService.post(oe.validateExternalCoupon,o).pipe(N({next:r=>{this.couponCode=e,this.couponNote=i||"",this._couponProvider=t,this._appliedCoupon.set(r),this.applyCoupon(r)},error:()=>{this.removeAppliedCoupon()}})).subscribe()}applyCoupon(e){let t=e.ApplyToProduct,i=e.Amount;t?.length>0&&i>0?(this.applyCouponToCartItems(e),this.applyCouponToOrder(e)):t?.length>0?this.applyCouponToCartItems(e):this.applyCouponToOrder(e)}applyCouponToOrder(e){let t=this.storeService.order(),i=E({},t);e.Type==="Percentage"?i.Discount=e.Amount:i.DiscountAmount=e.Amount,i.PromotionCoupon=this.couponCode??"",i.PromotionNote=this.couponNote,i.CouponProvider=this._couponProvider??"External",i.CouponType=2,this.storeService.updateOrder(i),this.showCouponAppliedToast(e,"Order")}applyCouponToCartItems(e){if(!this.validateItemsForCoupon(e)){this.clearOrderCouponMetadata();return}let t=this.storeService.cartItems(),i=e.ApplyToProduct??[],o=t.map(h=>{let D=i.find(j=>j.Code===h.Variant?.Code);if(!D)return h;let F=new ye(E({},h));return e.Type==="Percentage"?(F.Discount=D.Amount,F.CouponDiscount=D.Amount):(F.DiscountAmount=D.Amount,F.CouponDiscount=D.Amount),F});this.storeService.updateCartItems(o);let r=this.storeService.order(),m=E({},r);m.PromotionCoupon=this.couponCode??"",m.PromotionNote=this.couponNote,m.CouponProvider=this._couponProvider??"External",m.CouponType=2,this.storeService.updateOrder(m),this.showCouponAppliedToast(e,"Product")}validateItemsForCoupon(e){let t=this.storeService.cartItems(),i=e.ApplyToProduct??[];return t.filter(r=>i.some(m=>m.Code===r.Variant?.Code)).length===0?(this.toastr.error("No products in the cart qualify for this coupon.","Coupon Not Applicable"),!1):!0}removeAppliedCoupon(){let e=this._appliedCoupon();if(!e)return;let t=e.ApplyToProduct??[],i=e.Amount;this._couponProvider=null,t.length>0&&i>0?(this.removeCouponFromCartItems(e),this.removeCouponFromOrder(e)):t.length>0?(this.removeCouponFromCartItems(e),this.clearOrderCouponMetadata()):this.removeCouponFromOrder(e),this._appliedCoupon.set(null),this.couponCode=null,this.couponNote="",this.countToastrNotification=0}removeCouponFromOrder(e){let t=this.storeService.order(),i=E({},t);e.Type==="Percentage"?i.Discount=0:i.DiscountAmount=0,i.PromotionCoupon="",i.PromotionNote="",i.CouponProvider="Internal",i.CouponType=1,this.storeService.updateOrder(i)}removeCouponFromCartItems(e){let t=this.storeService.cartItems(),i=e.ApplyToProduct??[],o=t.map(r=>{if(!i.find(D=>D.Code===r.Variant?.Code))return r;let h=new ye(E({},r));return h.Discount=0,h.CouponDiscount=0,h.DiscountAmount=0,h});this.storeService.updateCartItems(o)}clearOrderCouponMetadata(){let e=this.storeService.order(),t=E({},e);t.PromotionCoupon="",t.PromotionNote="",t.CouponProvider="Internal",t.CouponType=1,this.storeService.updateOrder(t)}resetOnNewTransaction(){this._appliedCoupon.set(null),this.couponCode=null,this.couponNote="",this._couponProvider=null,this.countToastrNotification=0}trimInputCoupon(e){return P.IsNotEmpty(e)?e.trim():e}showCouponAppliedToast(e,t){if(P.IsNotEmpty(e.Notification))this.countToastrNotification===0&&this.toastr.success(e.Notification,"Coupon Applied"),this.countToastrNotification++;else if(t==="Product")this.toastr.success("Coupon applied to qualifying products.","Coupon Applied");else if(e.Type==="Percentage")this.toastr.success(`${e.Amount}% Discount`,"Coupon Applied");else{let i=this.decimalPipe.transform(e.Amount,"1.0-2");this.toastr.success(`${i} Discount`,"Coupon Applied")}}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac})};var cs=["Amount","Percentage"],qe=class n{eventBusService=c(A);httpService=c(se);storeService=c(x);factoryService=c(ke);entityID=u(()=>this.storeService.register()?.EntityID);toastrService=c(Q);internalCouponService=c(ni);externalCouponService=c(oi);role=c(ce);appConfig=u(()=>this.storeService.loadForm().AppConfigJSON);appliedCoupon=u(()=>this.externalCouponService.appliedCoupon()??this.internalCouponService.appliedCoupon());isNonAuthorizedCouponType=u(()=>{let e=this.appliedCoupon();return e?cs.some(t=>t===e.Type):!1});hasItemDeletion=u(()=>{let e=this.storeService.state();return!(e===5||e===6)&&this.role.deleteItem()&&!this.isParkedOrderDeletionLocked()});constructor(){this.initializeEventHandlers()}initializeEventHandlers(){Fe(this.eventBusService.on("[Cart] Add Item By Id").pipe(N(e=>{this.addItemById(e.payload.variantId)})),this.eventBusService.on("[Cart] Remove Item").pipe(N(e=>{this.removeItem(e.payload.index)})),this.eventBusService.on("[Cart] Update Item").pipe(N(e=>{this.onUpdateItem(e.payload.index,e.payload.item)})),this.eventBusService.on("[Cart] Reverse Item").pipe(N(e=>{this.reverseItem(e.payload.index,e.payload.isReturn)})),this.eventBusService.on("[Cart] Clear Items").pipe(N(()=>{this.clearCartItems()})),this.eventBusService.on("[Cart] Check Items Inventory").pipe(N(()=>{this.checkItemsInventory()}))).pipe(q()).subscribe()}checkItemsInventory(){let e=this.storeService.cartItems(),t=this.storeService.register()?.EntityID,i=e.map(r=>r.VariantID),o={Outlet:t,Cart:i,SalesOrderID:this.storeService.order()?.ID};this.httpService.post(oe.ValidateInventory,o).subscribe(r=>{this.setAvailableInventory(r)})}setAvailableInventory(e){let t=[...this.storeService.cartItems()],i=0;t=t.map(o=>{let r=e.findIndex(m=>m.VariantID==o.VariantID);return r!==-1&&(o.AvailableInventory=e[r].OnHand,(o.Variant?.TypeID<9||o.Variant?.TypeID==12)&&(i+=o.Quantity>o.AvailableInventory?1:0)),o}),this.showToastrValidateInventory(i),this.storeService.updateCartItems([...t])}showToastrValidateInventory(e){e>0?this.toastrService.error(`There are ${e} products in the cart dont have sufficient stock available`,"Validate Inventory"):this.toastrService.info("All products in the cart have sufficient stock available","Validate Inventory")}clearCartItems(){this.isShoppingCartLockedByPromotionCoupon()||this.storeService.updateCartItems([])}addItemById(e){this.httpService.get(oe.GetVariantByID,[{key:"ID",value:e},{key:"EntityID",value:this.entityID()}]).pipe(fe(t=>this.factoryService.createCartItemByVariant(t))).subscribe(t=>{this.onAddItem(t)&&this.emitItemAdded(t.VariantID)})}emitItemAdded(e){let t={type:"[Cart] Item Added",payload:{variantId:e}};this.eventBusService.emit(t)}removeItem(e){if(this.isShoppingCartLockedByPromotionCoupon())return;let i=this.storeService.cartItems().filter((o,r)=>r!==e);this.storeService.updateCartItems(i)}reverseItem(e,t){if(this.isShoppingCartLockedByPromotionCoupon()||t&&!this.role.return())return;let i=[...this.storeService.cartItems()],o=i[e];o&&((t&&o.Quantity>0||!t&&o.Quantity<0)&&(o.Quantity=o.Quantity*-1),this.storeService.updateCartItems(i))}validateCartItem(e){return e.Variant?.CategoryTypeID===-1?(this.toastrService.info(e.Variant.Name+" cannot be sold, check Category "+e.Variant.CategoryName+" settings","info"),!1):!0}validatePrepaidPackage(e,t){let o=this.storeService.cartItems()[t];if(!o)return!0;let r=this.storeService.state(),m=e.Variant?.TypeID===10,h=P.IsNotEmpty(o.ID);return!(r===2&&m&&h)}onAddItem(e,t=!1){if(this.isShoppingCartLockedByPromotionCoupon()||!this.validateCartItem(e))return!1;let i=this.storeService.cartItems();if(!i.find(m=>m.VariantID===e.VariantID)||t||i.length===0)return e.PromotionGift||(e=this.applyPromotionProduct(e),e=this.applyPriceBook(e)),this.storeService.updateCartItems([...i,e]),this.addAvailableComponents(e),!0;let r=this.storeService.loadForm().AppConfigJSON?.ModuleSell?.QuickKey?.NewRowBehaviour;if(r===2)e.PromotionGift||(e=this.applyPromotionProduct(e),e=this.applyPriceBook(e)),this.storeService.updateCartItems([...i,e]),this.addAvailableComponents(e);else if(r===1)this.storeService.state()===4?(e.PromotionGift||(e=this.applyPromotionProduct(e),e=this.applyPriceBook(e)),this.storeService.updateCartItems([...i,e]),this.addAvailableComponents(e)):(this.addQuantityToExistingItem(i,e),this.addAvailableComponents(e));else{let m=i.findIndex(h=>h.VariantID===e.VariantID);if(!this.validatePrepaidPackage(e,m))return this.toastrService.error("This prepaid package is already in the cart while editing. Please remove it first before adding again.","Cannot Add Item"),!1;this.addQuantityToExistingItem(i,e),this.addAvailableComponents(e)}return!0}addAvailableComponents(e){let t=e?.Variant?.Component;if(!t||t.length===0||this.isShoppingCartLockedByPromotionCoupon())return;let i=e.Price!==0,o=this.storeService.loadForm()?.AppConfigJSON?.ModuleSell?.SellProductComponentDefaultPrice??!1;for(let r of t){if(!r)continue;let m=r,h=this.factoryService.createCartItemByVariant(m),D=r.Quantity??1;if(h.Quantity=e.Quantity*D,i&&!o?(h.Price=0,h.UnitPrice=0):(h.Price=m.UnitPrice??h.Price,h.UnitPrice=m.UnitPrice??h.UnitPrice),!h.PromotionGift){let F=this.applyPromotionProduct(h);Object.assign(h,F);let j=this.applyPriceBook(h);Object.assign(h,j)}this.pushComponentToCart(h)}}pushComponentToCart(e){let t=this.storeService.cartItems(),i=t.findIndex(D=>D.VariantID===e.VariantID);if(i===-1){this.storeService.updateCartItems([...t,e]);return}let o=this.storeService.loadForm()?.AppConfigJSON?.ModuleSell?.QuickKey?.NewRowBehaviour;if(o===2){this.storeService.updateCartItems([...t,e]);return}if(o===1&&this.storeService.state()===4){this.storeService.updateCartItems([...t,e]);return}let r=[...t],m=r[i],h=m.PromotionGift;if(m.Quantity+=e.Quantity,!h){let D=this.applyPromotionProduct(m);Object.assign(m,D);let F=this.applyPriceBook(m);Object.assign(m,F)}this.storeService.updateCartItems(r)}addQuantityToExistingItem(e,t){let i=e.map(o=>{if(o.VariantID==t.VariantID){let r=o.PromotionGift;o.Quantity+=t.Quantity,r||(o=this.applyPromotionProduct(o),o=this.applyPriceBook(o))}return o});this.storeService.updateCartItems(i)}onUpdateItem(e,t){if(this.isShoppingCartLockedByPromotionCoupon()||!this.role.return()&&Number(t?.Quantity)<0)return!1;let i=[...this.storeService.cartItems()];return i[e]=t,this.storeService.updateCartItems([...i]),!0}addPromotionGiftItem(e,t){this.httpService.get(oe.GetVariantByID,[{key:"ID",value:e},{key:"EntityID",value:this.entityID()}]).pipe(fe(i=>this.applyRewardToCartItem(this.factoryService.createCartItemByVariant(i),t))).subscribe(i=>{this.pushOrMergeGiftItem(i,t)})}applyRewardToCartItem(e,t){let o=this.storeService.loadForm().AppConfigJSON?.ModuleSell?.ProductNotes?.CopyPromotionName;e.Discount=t.Discount;let r=t.OriginalPrice-t.UnitPrice;return e.Price=e.UnitPriceOriginal-r,e.UnitPrice=e.UnitPriceOriginal-r,e.PromotionGift=!0,e.PromotionID=t.PromotionID,e.Quantity=t.Quantity?t.Quantity:1,e.PriceTypeID=3,e.Cost+=t.ExtraCost,e.UnitCost+=t.ExtraCost,e.PriceNote=t.PromotionName,o&&(e.Note=`${e.Note?e.Note:""} ${t.PromotionName} `),e}pushOrMergeGiftItem(e,t){if(this.isShoppingCartLockedByPromotionCoupon())return;let i=[...this.storeService.cartItems()];if(t.PromotionType===2){let o=i.findIndex(r=>r.VariantID===e.VariantID&&r.PromotionGift);if(o!==-1){let r=i[o];i[o]=new ye(z(E({},r),{Quantity:r.Quantity+e.Quantity}))}else i.push(e)}else i.push(e);this.storeService.updateCartItems(i)}applyPriceBook(e){let t=e.Variant.PriceBook!=null?e.Variant.PriceBook:[],i=this.findCustomerPricebook(t);if(t&&t.length!==0){let o=t.sort(function(r,m){return m.MinimumQuantity-r.MinimumQuantity}).filter(r=>e.Quantity>=r.MinimumQuantity&&r.MinimumQuantity!=0);o.length>0||P.IsNotEmpty(i)?P.IsNotEmpty(i)?e=this.applyPricebookToItem(e,i):e=this.applyPricebookToItem(e,o[0]):e=this.resetAppliedPricebook(e)}return e}resetAppliedPricebook(e){let i=(e?.Variant?.PriceBook).find(o=>o.ID==e.PriceBookID);return P.IsNotEmpty(i)&&(e.Discount=e.Variant.PriceDiscount,e.PriceBookID=P.GuidEmpty,e.Price=e.Variant.UnitPrice,e.UnitPrice=e.Variant.UnitPrice,e.PriceTypeID=0,e=this.applyPromotionProduct(e),e=this.removePromotionNote(e)),e}applyPromotionProduct(e){let t=e.Variant.DiscountAmount;return t&&(e.Price=e.UnitPriceOriginal-t),e}removePromotionNote(e){let t=this.storeService.loadForm().AppConfigJSON;if(t?.ModuleSell?.Pricebook?.PricebookVisible&&(e.Note=e.Note?.replace(e.PriceNote,""),e.PriceNote=""),t?.ModuleSell?.ProductNotes?.CopyPromotionName){let o=e.Variant?.PriceNote;e.Note=`${o||""} ${e.Note?e.Note:""}`,e.PriceNote=o}return e}applyPricebookToItem(e,t){return e.Discount=t.PriceDiscount,e.UnitPrice=t.UnitPrice,e.PriceBookID=t.ID,e.Price=t.UnitPrice,e.PriceTypeID=2,e=this.assignItemNote(e,t),e}assignItemNote(e,t){return this.storeService.loadForm().AppConfigJSON?.ModuleSell?.Pricebook?.PricebookVisible?(e.Note?.includes(e.PriceNote)?e.Note=e.Note?.replace(e.PriceNote,t.Name):e.Note=`${t.Name} ${e.Note?e.Note:""}`,e.PriceNote=t.Name):(e.Note="",e.PriceNote=""),e}findCustomerPricebook(e=[]){let t=this.storeService.customer(),i=null;return t&&(i=e.find(o=>o.ID==t.PricebookID)??null),i}isParkedOrderDeletionLocked(){return this.appConfig()?.ApplicationParkAndRetrieve?.AccessControl?.AuthorizeParkedOrdersItemDeletion?this.storeService.state()===4&&!this.role.parkedDeletion():!1}isShoppingCartLockedByPromotionCoupon(){if(!this.appliedCoupon()||!this.isNonAuthorizedCouponType())return!1;let t={type:"[Cart] Shopping Cart Locked",payload:{couponCode:this.getAppliedCouponCode()}};return this.eventBusService.emit(t),!0}getAppliedCouponCode(){return this.storeService.order()?.PromotionCoupon||this.appliedCoupon()?.Code||""}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac})};var ds=(n,e)=>({"btn-secondary":n,"btn-outline-secondary":e}),ps=(n,e)=>({"btn-outline-secondary":n,"btn-secondary":e});function ms(n,e){if(n&1){let t=M();a(0,"div")(1,"label",12),S(2,"i",13),a(3,"span"),d(4,"Deduct Inventory from Outlet :"),l()(),a(5,"p-select",14),C("ngModelChange",function(o){y(t);let r=p();return _(r.deliveryEntityID.set(o))}),l()()}if(n&2){let t=p();s(5),b("options",t.entities())("ngModel",t.deliveryEntityID())("filter",!0)("showClear",!1)("disabled",t.isDisabledNgSelectOutlet())}}function us(n,e){if(n&1){let t=M();a(0,"div",10)(1,"div",29)(2,"label",30),S(3,"i",31),a(4,"span"),d(5,"Recipient"),l()(),a(6,"input",32),U("ngModelChange",function(o){y(t);let r=p(2);return B(r.shipping.Name,o)||(r.shipping.Name=o),_(o)}),l()(),a(7,"div",29)(8,"label",33),S(9,"i",34),a(10,"span"),d(11,"Phone"),l()(),a(12,"input",35),U("ngModelChange",function(o){y(t);let r=p(2);return B(r.shipping.Phone,o)||(r.shipping.Phone=o),_(o)}),l()(),a(13,"div",36)(14,"label",37),S(15,"i",38),a(16,"span"),d(17,"City"),l()(),a(18,"input",39),U("ngModelChange",function(o){y(t);let r=p(2);return B(r.shipping.City,o)||(r.shipping.City=o),_(o)}),l()(),a(19,"div",40)(20,"label",41),S(21,"i",42),a(22,"span"),d(23,"Delivery Address"),l()(),a(24,"POS-tinymce-editor",43),U("ngModelChange",function(o){y(t);let r=p(2);return B(r.shipping.Address,o)||(r.shipping.Address=o),_(o)}),l()()()}if(n&2){let t=p(2);s(6),L("ngModel",t.shipping.Name),s(6),L("ngModel",t.shipping.Phone),s(6),L("ngModel",t.shipping.City),s(6),L("ngModel",t.shipping.Address)}}function gs(n,e){if(n&1){let t=M();a(0,"div",15)(1,"div",16)(2,"label",12),S(3,"i",17),a(4,"span"),d(5),l()(),a(6,"div",16)(7,"p-datepicker",18),C("ngModelChange",function(o){y(t);let r=p();return _(r.dateCustom.set(o))}),l()()(),a(8,"div",16)(9,"label",19),S(10,"i",20),a(11,"span"),d(12,"Time"),l()(),a(13,"div",16)(14,"app-timepicker",21),C("timeChange",function(o){y(t);let r=p();return _(r.timeCustom.set(o))}),l()()()(),a(15,"div",22)(16,"div",23)(17,"div")(18,"p-checkbox",24),C("ngModelChange",function(o){y(t);let r=p();return _(r.recipientNotBuyer.set(o))}),l()(),a(19,"div",25)(20,"span"),S(21,"i",26),l(),a(22,"h6",23)(23,"span"),d(24,"Recipient \u2260 Buyer"),l(),a(25,"span",27),S(26,"i",28),l()()()()(),g(27,us,25,4,"div",10)}if(n&2){let t=p();s(5),R(t.dateLabel),s(2),b("ngModel",t.dateCustom())("baseZIndex",1e4)("showClear",!0),s(7),b("time",t.timeCustom())("showIcon",!0)("showCloseBtn",!1)("fullWidth",!0)("showClear",!0),s(4),b("ngModel",t.recipientNotBuyer())("binary",!0),s(9),f(t.recipientNotBuyer()?27:-1)}}var Ni=class n{dialogRef=c(G);store=c(x);eventService=c(A);config=new te;entities=u(()=>this.store.loadForm()?.Entities??[]);isDelivery=v(!1);disableShippingNow=v(!1);disableShippingLater=v(!1);isDisabledNgSelectOutlet=v(!1);shippingFormVisible=v(!1);recipientNotBuyer=v(!1);deliveryEntityID=v("");dateCustom=v(null);timeCustom=v(null);shipping=new Dt;dateLabel="Fulfillment Date";ngOnInit(){this.config.title="Order Fullfillment",this.config.customWidth="650px";let e=this.store.action(),t=this.store.invoice(),i=this.store.shipping();this.deliveryEntityID.set(e.DeliveryEntityID??""),this.shipping=E({},i),this.dateCustom.set(t.DateCustom??null),this.timeCustom.set(t.TimeCustom??null),this.initDateLabel(),this.initShippingFormVisible(),this.initDefaultOrderDelivery(),this.checkRecipientIsBuyer(),this.initDisabledOutletOption()}initDateLabel(){let e=this.store.loadForm()?.AppConfigJSON;e?.ModuleSell?.Shipping?.DateLabel&&(this.dateLabel=e.ModuleSell.Shipping.DateLabel)}initShippingFormVisible(){let e=this.store.loadForm()?.AppConfigJSON;this.shippingFormVisible.set(e?.ModuleSell?.Shipping?.DeliveryAddressAlwaysVisible??!1)}initDefaultOrderDelivery(){this.deliveryEntityID()===P.GuidEmpty?this.isDelivery.set(!0):this.isDelivery.set(!1);let e=this.store.register(),i=(this.store.loadForm()?.Entities??[]).find(o=>o.ID===e?.EntityID);if(i&&P.IsNotEmpty(i.ID)){let o=i.FulfillmentOption;o===1?(this.isDelivery.set(!1),this.disableShippingLater.set(!0)):o===2&&(this.isDelivery.set(!0),this.disableShippingNow.set(!0)),this.changeDelivery()}}checkRecipientIsBuyer(){this.recipientNotBuyer.set(P.IsNotEmpty(this.shipping.Name))}initDisabledOutletOption(){this.store.state()===2&&this.isDisabledNgSelectOutlet.set(!0)}changeDelivery(){if(this.isDelivery())this.deliveryEntityID.set(P.GuidEmpty);else{let e=this.store.register(),t=this.store.action().DeliveryEntityID;P.IsNotEmpty(t)?this.deliveryEntityID.set(t):P.IsNotEmpty(e?.DefaultWarehouse)?this.deliveryEntityID.set(e.DefaultWarehouse):this.deliveryEntityID.set(e?.EntityID??"")}}clearShippingData(){if(!this.recipientNotBuyer())for(let e of Object.getOwnPropertyNames(this.shipping))this.shipping[e]=""}buildCustomDateField(){let e=this.dateCustom(),t=this.timeCustom();return(this.isDelivery()||this.shippingFormVisible())&&e?`${yn(e,"d MMM y","en-US")} ${t||"00:00"}`:null}onOk(){this.clearShippingData();let e=this.buildCustomDateField(),t=this.deliveryEntityID(),i=P.IsEmpty(t)?0:3;this.eventService.emit({type:"[Fulfillment] Update Fulfillment",payload:{shipping:E({},this.shipping)}}),this.eventService.emit({type:"[Invoice] Update Fulfillment Date",payload:{dateCustom:this.dateCustom(),timeCustom:this.timeCustom(),customDateField:e}}),this.eventService.emit({type:"[Order] Update Delivery State ID",payload:{deliveryState:i,deliveryOutletId:t}}),this.dialogRef.close()}onClose(){this.dialogRef.close(null)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["app-dialog-fulfillment"]],decls:23,vars:14,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container"],[1,"row"],[1,"btn-group","col-12"],["type","button",1,"btn","btn-secondary","position-relative","btn-custom-size","col-5",3,"click","disabled"],[1,"fa-solid","fa-bolt"],[1,"ms-2"],[1,"ms-1"],["type","button",1,"btn","position-relative","btn-custom-size","col-7",3,"click","disabled"],[1,"fa-solid","fa-clock"],[1,"row","mt-12"],[1,"col-12"],["for","shippingDate",1,"mb-2"],[1,"fa","fa-store","me-1"],["optionLabel","Name","optionValue","ID","filterBy","Name","placeholder","Select a Outlet","appendTo","body",1,"w-100",2,"--p-select-padding-y","0.8rem",3,"ngModelChange","options","ngModel","filter","showClear","disabled"],[1,"d-flex","align-items-center","gap-3"],[1,"w-100"],[1,"fa-solid","fa-calendar","me-1"],["placeholder","Select Date","showIcon","","iconDisplay","input","appendTo","body","dateFormat","dd M yy",1,"w-100","date-custom",3,"ngModelChange","ngModel","baseZIndex","showClear"],["for","shippingTime",1,"mb-2"],[1,"fa","fa-clock","me-1"],["placeholder","Select Time",1,"date-custom",3,"timeChange","time","showIcon","showCloseBtn","fullWidth","showClear"],[1,"mt-12"],[1,"d-flex","align-items-center","gap-2"],[1,"custom-checkbox-style",3,"ngModelChange","ngModel","binary"],[1,"d-flex","align-items-center","gap-1"],[1,"fa-solid","fa-user","fs-5"],["pTooltip",`Enable this option when the person receiving the order is different from customer who made the purchase.
3
3
  This is commonly used for gift deliveries, corporate orders, or when someone is buying on behalf of another person. When enabled, you'll need to provide the recipient's contact details and delivery address.`,"tooltipPosition","top","tooltipZIndex","10000"],[1,"fa","fa-info-circle"],[1,"col-4","pe-0"],["for","recipient"],[1,"fa-solid","fa-user","me-1","mb-2"],["id","recipient","placeholder","Enter recipient name","type","text",1,"w-100","form-control","rounded-1","custom-input-size",3,"ngModelChange","ngModel"],["for","phone"],[1,"fa-solid","fa-phone","me-1","mb-2"],["id","phone","placeholder","Enter recipent phone number","type","text",1,"w-100","form-control","rounded-1","custom-input-size",3,"ngModelChange","ngModel"],[1,"col-4"],["for","city"],[1,"fa-solid","fa-location-dot","me-1","mb-2"],["id","city","placeholder","Enter the recipient city","type","text",1,"w-100","form-control","rounded-1","custom-input-size",3,"ngModelChange","ngModel"],[1,"col-12","mt-8"],["for","address",1,"mb-3"],[1,"fa-solid","fa-address-book","me-1"],["id","address","placeholder","Enter the recipient address here ...",3,"ngModelChange","ngModel"]],template:function(t,i){t&1&&(a(0,"modal-material",0),C("onOk",function(){return i.onOk()})("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()}),a(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"button",4),C("click",function(){return i.isDelivery.set(!1),i.changeDelivery()}),S(6,"i",5),a(7,"span",6),d(8," Now "),a(9,"small",7)(10,"em"),d(11,"(in store purchase)"),l()()()(),a(12,"button",8),C("click",function(){return i.isDelivery.set(!0),i.changeDelivery()}),S(13,"i",9),a(14,"span",6),d(15," Later "),a(16,"small",7)(17,"em"),d(18,"(shipped to customer address)"),l()()()()()(),a(19,"div",10)(20,"div",11),g(21,ms,6,5,"div")(22,gs,28,12),l()()()()()),t&2&&(b("config",i.config),s(5),be(pt(8,ds,!i.isDelivery(),i.isDelivery())),b("disabled",i.disableShippingNow()),s(7),be(pt(11,ps,!i.isDelivery(),i.isDelivery())),b("disabled",i.disableShippingLater()),s(9),f(i.isDelivery()?22:21))},dependencies:[W,$,ee,J,ne,Y,ha,ba,ua,ma,va,da,ca,Pt,fa,ga],styles:[".container[_ngcontent-%COMP%]{min-height:185px} p-datepicker.date-custom>span>input{padding-top:10px;padding-bottom:10px} app-timepicker.date-custom p-datepicker>span>input{padding-top:10px;padding-bottom:10px}.btn-custom-size[_ngcontent-%COMP%]{--bs-btn-padding-y: 1rem;--bs-btn-padding-x: 1rem;--bs-btn-font-size: 3.5rem;font-family:Roboto Slab,serif}.btn-custom-size[_ngcontent-%COMP%]:hover{background-color:var(--bs-light)!important;border-color:var(--bs-light)!important;color:#000!important}.custom-checkbox-style[_ngcontent-%COMP%]{--p-checkbox-checked-background: #89b03e;--p-checkbox-hover-border-color: #89b03e;--p-checkbox-checked-border-color: #89b03e;--p-checkbox-checked-hover-border-color: #89b03e;--p-checkbox-hover-border-color-background: #7c9b44;--p-checkbox-checked-hover-background: #89b03e}.custom-input-size[_ngcontent-%COMP%]{height:2.625rem;padding:.75rem!important;color:#343434;font-size:.75rem;border-radius:.25rem!important}"],changeDetection:0})};var Ze=class n{eventService=c(A);role=c(ce);storeService=c(x);shoppingCartService=c(qe);decimalPipe=c(K);cartItem=v(null);itemIndex=v(null);toastr=c(Q);factoryService=c(ke);isEdit=v(!1);initCartItem(e,t){if(e){let i=br(ye,e);this.itemIndex.set(t),this.cartItem.set(i),this.inputedDiscountAmount.set(this.cartItem().DiscountAmount||0),this.initSelectedPricebook(),this.isEdit.set(!0)}else this.cartItem.set(new ye),this.itemIndex.set(null),this.inputedDiscountAmount.set(0),this.isEdit.set(!1);this.serials.set([])}getCartItem=u(()=>this.cartItem());httpService=c(se);salesList=u(()=>this.storeService.register()?.ListSales||[]);selectedPricebook=v(null);pricebookDisabled=u(()=>{let e=this.cartItem()?.Variant;return e?.TypeID==11&&e?.SellPriceType!=0?!1:!this.role.pricebookSelector()});outletList=u(()=>this.storeService.loadForm()?.Entities||[]);isEmptySalesID=u(()=>!this.cartItem()?.SalesID);isSerialized=u(()=>this.cartItem().InventoryTypeID==9);isBatchNumber=u(()=>this.cartItem().InventoryTypeID==4);serials=v([]);salesPersonName=u(()=>this.cartItem()?.SalesName||"");deliveryEntityId=u(()=>this.storeService.order().DeliveryOutletID||null);outletID=u(()=>this.storeService.register()?.EntityID);currentSellState=u(()=>this.storeService.state());isValidPriceMinimum=v(!0);deliveryStateID=_a;appConfig=u(()=>this.storeService.loadForm().AppConfigJSON);disableAddQuantity=u(()=>this.cartItem()?.PromotionGift&&!this.editingItemPromotionVisible()||this.checkQtyInputDisabled());decimalPlace=u(()=>0);unitQtyLabel=u(()=>this.appConfig().ModuleSell.ProductDialog.UnitQtyLabel||null);editingItemPromotionVisible=u(()=>this.appConfig().ModuleSell.Promotion?.EditingItemPromotionVisible||!1);deliveryEnabled=u(()=>this.appConfig().ModuleSell?.ProductDialog?.SplitDeliveryOutletEnabled||!1);costVisible=u(()=>this.appConfig().ModuleSell?.Cost?.Visible||!1);costEnabled=u(()=>this.appConfig().ModuleSell?.Cost?.Enabled||!1);storageVisible=u(()=>this.appConfig().ModuleSell?.Grid?.StorageVisible||!1);enabledCalculatorNote=u(()=>this.appConfig().ModuleSell?.ProductDialog?.CalculatorNote||!1);qtyToOneDialog=u(()=>this.appConfig().ModuleSell.ProductDialog?.QuantityToOneInDialog);isSentDelivery=u(()=>!1);isSellEdit=u(()=>!1);isDisabledDiscInput=u(()=>!this.role.discount()||this.cartItem()?.PromotionGift&&!this.editingItemPromotionVisible());isUnitPriceEditor=u(()=>{let e=this.cartItem()?.Variant?.SellPriceType;return e===1||e===2?!0:this.role.unitPriceEditor()});inputedDiscountAmount=v(this.cartItem()?.DiscountAmount||0);isDiscMultipliciedQty=v(!0);updateSales(e){this.cartItem.update(t=>{let i=this.salesList().find(o=>o.ID==e)?.Name;return t.SalesName=i,t.SalesID=e,t})}onDeliveryEntityChange(e){this.cartItem.update(t=>{let i=this.outletList().find(o=>o.ID==e);return i?(t.EntityName=i?.Name,t.EntityID=e):(t.EntityName="",t.EntityID=null),t})}updateQuantity(e){!this.role.return()&&Number(e)<0||(this.cartItem.update(t=>{t.Quantity=e,t=this.shoppingCartService.applyPriceBook(t);let i=t.PriceBookID;if(P.IsNotEmpty(i)){let o=t.getSelectedPricebook(i);this.selectedPricebook.set(o)}else this.selectedPricebook.set(null);return t}),this.isValidPriceMinimum.set(this.validatePriceMinimum()))}updateUnitQuantity(e){this.cartItem.update(t=>(t.UnitQuantity=e,t)),this.isValidPriceMinimum.set(this.validatePriceMinimum())}updatePrice(e){this.cartItem.update(t=>(t.Price=e,t)),this.isValidPriceMinimum.set(this.validatePriceMinimum())}updateCost(e){this.cartItem.update(t=>(t.Cost=e,t))}onUpdateNote(e){this.cartItem.update(t=>(t.Note=e,t))}updateDiscountPercentage(e){this.cartItem.update(t=>(t.Discount=e,t)),this.isValidPriceMinimum.set(this.validatePriceMinimum())}onDiscountAmountChange(e){this.inputedDiscountAmount.set(e),this.cartItem.update(t=>{let i=t.Quantity||1;return t.DiscountAmount=this.isDiscMultipliciedQty()?e:e/i,t}),this.isValidPriceMinimum.set(this.validatePriceMinimum())}onPricebookChange(e){P.IsNotEmpty(e)&&this.cartItem.update(t=>{let i=t.getSelectedPricebook(e);return t=this.shoppingCartService.applyPricebookToItem(this.cartItem(),i),this.selectedPricebook.set(i),t}),this.isValidPriceMinimum.set(this.validatePriceMinimum())}onClearPricebook(){this.cartItem.update(e=>(e=this.shoppingCartService.resetAppliedPricebook(this.cartItem()),this.selectedPricebook.set(null),e)),this.isValidPriceMinimum.set(this.validatePriceMinimum())}onSerialChange(e){this.cartItem.update(t=>(t.Serial=e.Serial,t.Quantity=e.Quantity,t))}onSwitchToggleDiscount(){this.isDiscMultipliciedQty()?this.cartItem.update(e=>(e.DiscountAmount=e.DiscountAmount*e.Quantity,e)):this.cartItem.update(e=>(e.DiscountAmount=e.DiscountAmount/e.Quantity,e))}getInventoryById(){let e=this.storeService.register()?.EntityID,t=this.cartItem()?.VariantID;return this.httpService.get(oe.GetVariantStockByID,[{key:"ID",value:t},{key:"EntityID",value:e}])}initSelectedPricebook(){let e=this.cartItem()?.PriceBookID;if(P.IsNotEmpty(e)){let t=this.cartItem()?.getSelectedPricebook(e);this.selectedPricebook.set(t)}else this.selectedPricebook.set(null)}checkQtyInputDisabled(){let e=this.appConfig()?.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion,t=P.IsNotEmpty(this.cartItem()?.ID);return!!(e&&!this.role.sellEditor()&&this.storeService.state()==4&&t||t&&this.cartItem()?.Serial?.length>0)}updateCartItem(e){return this.cartItem()?.removeEnterNote(),!this.validateItemQuantity()||!this.validateConfigDefaultQuantity(e)||!this.isValidPriceMinimum()?!1:(this.handleConfigDoNotRequireAuthorizationNSyncCost(),this.itemIndex()!=null&&this.itemIndex()>=0?this.eventService.emit({type:"[Cart] Update Item",payload:{index:this.itemIndex(),item:this.cartItem()}}):this.shoppingCartService.onAddItem(this.cartItem(),!0),!0)}handleConfigDoNotRequireAuthorizationNSyncCost(){this.cartItem()?.Variant?.SellPriceType==2&&this.cartItem.update(t=>(t.Cost=t.Price,t))}validateConfigDefaultQuantity(e){let t=this.cartItem()?.Quantity;if(e=="Enter"){if(this.isSerialized())return!1;if(!this.qtyToOneDialog())return t>0}return!0}validateItemQuantity(){return P.IsEmpty(this.cartItem()?.VariantID)?(this.toastr.error("Enter item data before clicking OK!","No item is entered!"),!1):(P.IsEmpty(this.cartItem()?.Quantity)&&this.updateQuantity(1),this.generateSerialItem(),!!this.validateSerialItem())}generateSerialItem(){if((this.isSerialized()||this.isBatchNumber())&&this.serials().length>0&&(!this.cartItem()?.Serial||this.cartItem()?.Serial?.length==0)){let e=this.serials();this.cartItem.update(t=>(t.Serial=e.map(i=>{let o=new Ja;return o.Number=i,o.Quantity=-1,o.ExpiryDate=null,o}),t.Quantity=e.length*-1,t))}}validateSerialItem(){let e=!0;if(this.isSerialized()&&this.cartItem()?.Serial?.length>0&&this.cartItem()?.Variant?.TypeID==4&&this.cartItem()?.Quantity>0){let t=0;this.cartItem()?.Serial?.forEach(i=>{t+=i.Quantity}),t!=this.cartItem()?.Quantity&&(this.toastr.error("Serial must be equal with the quantity","Error"),e=!1)}return e}priceMinimumRestrictionWarning=v("");validatePriceMinimum(){let e=this.checkPriceMinimumRestriction(this.cartItem());if(e)this.priceMinimumRestrictionWarning.set("");else{let t=this.appConfig().ModuleSell?.ProductDialog?.MinimumPriceIncludeDiscount,i=this.getPriceMinimum(this.cartItem()),o=this.generateMinimumPriceWarningMessage(t,i,this.cartItem());this.priceMinimumRestrictionWarning.set(o)}return e}checkPriceMinimumRestriction(e){let t=!0,i=this.role.priceMinimum,r=this.appConfig().ModuleSell?.ProductDialog?.MinimumPriceIncludeDiscount?e.TotalAfterDiscountPerQuantity:e.Price;if(i){let m=this.getPriceMinimum(e);r<m?t=!1:t=!0}return t}getPriceMinimum(e){let t=this.appConfig().ModuleSell.ProductDialog?.PriceMinimumTypeID,i=0;switch(t){case 1:i=e.Variant?.UnitPrice;break;case 2:i=e.Variant?.UnitCost;break;case 3:i=e.Variant?.UnitPriceMinimum;break}return i}generateMinimumPriceWarningMessage(e,t,i){let o="",r=i.Discount,m=i.DiscountAmount;return e&&(r>0||m>0)?o=P.StringFormat(`<span><i class='fa-solid fa-triangle-exclamation me-2 d-inline'></i>Item net price is <h5 class='d-inline m-0'>{0}</h5></span>
4
4
  after item discount, you cannot sell lower than <h5 class='d-inline m-0'>{1}</h5></span>`,this.decimalPipe.transform(i.TotalAfterDiscountPerQuantity),this.decimalPipe.transform(t)):o=P.StringFormat("<span><i class='fa-solid fa-triangle-exclamation me-2 d-inline'></i>Cannot sell lower than <h5 class='d-inline m-0'>{0}</h5></span>",this.decimalPipe.transform(t)),o}onScanBarcode(e){}onAddNewItemById(e){this.httpService.get(oe.GetVariantByID,[{key:"ID",value:e},{key:"EntityID",value:this.outletID()}]).pipe(fe(t=>this.factoryService.createCartItemByVariant(t))).subscribe(t=>{let i=br(ye,t);this.cartItem.set(i)})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac})};var fs=n=>({"mt-8":n}),ul=n=>({"qtyBtn-disabled":n});function bs(n,e){if(n&1&&(a(0,"div",23)(1,"div",24)(2,"div"),d(3),l(),a(4,"small",25),d(5),l()()()),n&2){let t=e.data;s(3),R(t==null?null:t.Value),s(2),R(t==null?null:t.Code)}}function hs(n,e){if(n&1){let t=M();a(0,"div",4)(1,"div",21)(2,"autocompleteV2",22,1),C("onSelect",function(o){y(t);let r=p();return _(r.dialogService.onAddNewItemById(o))})("onInputEnter",function(o){y(t);let r=p();return _(r.dialogService.onScanBarcode(o))}),l(),Re(4,bs,6,2,"ng-template",null,2,At),l()()}if(n&2){let t,i=ge(5),o=p();s(2),b("localStorage","products")("renderThumbnail",!0)("inputTextValue",(t=o.cartItem())==null||t.Variant==null?null:t.Variant.Name)("clearOnSelect",!1)("useCustomTemplate",!0)("itemTemplate",i)("outletId",o.outletID())}}function Cs(n,e){if(n&1&&(a(0,"span"),d(1),l()),n&2){let t,i=p();s(),O("(",(t=i.cartItem())==null||t.Variant==null?null:t.Variant.UOMName,")")}}function vs(n,e){if(n&1){let t=M();a(0,"div",11)(1,"strong")(2,"span"),d(3),l()(),a(4,"input",26),C("ngModelChange",function(o){y(t);let r=p();return _(r.dialogService.updateUnitQuantity(o))}),l()()}if(n&2){let t,i=p();s(3),R(i.unitQtyLabel()),s(),b("preventNegative",!0)("readOnly",((t=i.cartItem())==null?null:t.PromotionGift)&&!i.editingItemPromotionVisible())("decimalPlaces",i.decimalPlace())("ngModel",i.cartItem().UnitQuantity)}}function ys(n,e){if(n&1&&(S(0,"input",13,3),I(2,"number")),n&2){let t=p();b("value",V(2,1,t.cartItem().Price))}}function _s(n,e){if(n&1){let t=M();a(0,"input",27,3),C("ngModelChange",function(o){y(t);let r=p();return r.dialogService.updatePrice(o),_(r.dialogService.validatePriceMinimum())}),l()}if(n&2){let t,i=p();b("simpleKeyboard",i.keyboard)("readonly",!i.isUnitPriceEditor()||((t=i.cartItem())==null?null:t.PromotionGift)&&!i.editingItemPromotionVisible())("ngModel",i.cartItem().Price)}}function Ss(n,e){if(n&1&&(a(0,"div",15)(1,"span",28),d(2),l()()),n&2){let t,i=p();s(2),O("Pricebook ",(t=i.selectedPriceBook())==null?null:t.Name," is applied")}}function Ps(n,e){if(n&1){let t=M();a(0,"div",17)(1,"strong"),d(2,"Sales Person"),l(),a(3,"ng-select-infinite",29),C("selectedChange",function(o){y(t);let r=p();return _(r.dialogService.updateSales(o))}),l()()}if(n&2){let t,i=p();s(3),b("items",i.salesList())("selected",(t=i.cartItem())==null?null:t.SalesID)}}function xs(n,e){if(n&1){let t=M();a(0,"div",17)(1,"strong"),d(2,"Fulfillment From"),l(),a(3,"ng-select",30),C("ngModelChange",function(o){y(t);let r=p();return _(r.dialogService.onDeliveryEntityChange(o))}),l()()}if(n&2){let t=p();s(3),b("disabled",t.isSellEdit())("items",t.outletList())("ngModel",t.cartItem().EntityID)}}var no=class n{dialogService=c(Ze);cartItem=this.dialogService.getCartItem;role=c(ce);numpadService=c(Bn);disableAddQuantity=this.dialogService.disableAddQuantity;decimalPlace=this.dialogService.decimalPlace;isUnitPriceEditor=this.dialogService.isUnitPriceEditor;unitQtyLabel=this.dialogService.unitQtyLabel;isDeliveryEnabled=this.dialogService.deliveryEnabled;isSentDelivery=this.dialogService.isSentDelivery;isDisabledDiscInput=this.dialogService.isDisabledDiscInput;editingItemPromotionVisible=this.dialogService.editingItemPromotionVisible;selectedPriceBook=this.dialogService.selectedPricebook;isEmptySalesID=this.dialogService.isEmptySalesID;salesList=this.dialogService.salesList;outletList=this.dialogService.outletList;salesPersonName=this.dialogService.salesPersonName;isSellEdit=this.dialogService.isSellEdit;keyboard=this.numpadService.keyboard;isEdit=this.dialogService.isEdit;outletID=this.dialogService.outletID;static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["product-dialog-cart"]],decls:26,vars:24,consts:[["quantity",""],["variant",""],["itemTemplate",""],["price",""],[1,"row"],[1,"row",3,"ngClass"],[1,"col-auto","mb-4","pe-0",2,"width","145px"],[1,"input-group"],["type","button","id","button-addon1",1,"btn","btn-outline-secondary","fw-bold","rounded-0","fs-2","border-end-0","py-4","cart-input","d-flex","align-items-center","qty_btn","justify-content-center",3,"click","ngClass","disabled"],["id","txtCartQuantity","keyboardType","number","type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","input-numpad","cart-input","text-center",3,"ngModelChange","preventNegative","decimalPlaces","ngModel","disabled"],["type","button","id","button-addon2",1,"btn","btn-outline-secondary","fw-bold","rounded-0","fs-5","border-start-0","py-4","cart-input","d-flex","align-items-center","qty_btn","justify-content-center",3,"click","ngClass","disabled"],[1,"col-auto","pe-0",2,"width","82px"],[1,"col-auto","pe-0",2,"width","112px",3,"hidden"],["disabled","",1,"form-control","cart-input",3,"value"],["id","inputPrice","keyboardType","number","type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input",3,"simpleKeyboard","readonly","ngModel"],[1,"col-auto","d-flex","align-items-center","pt-5"],[1,"row","mt-6"],[1,"col-auto","pe-0"],[1,"row","mt-6","mb-5"],[1,"col","tinymce"],["height","210px",3,"ngModelChange","ngModel"],[1,"col"],["inputID","product","requestUrl","/API/AC/GetVariantSuggestionByCodeNName","placeholder","Input product name / code",1,"form-control",3,"onSelect","onInputEnter","localStorage","renderThumbnail","inputTextValue","clearOnSelect","useCustomTemplate","itemTemplate","outletId"],[1,"d-flex","align-items-center","justify-content-between","w-100"],[1,"ms-3","text-wrap","text-break"],[1,"opacity-75"],["type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input","input-numpad",3,"ngModelChange","preventNegative","readOnly","decimalPlaces","ngModel"],["id","inputPrice","keyboardType","number","type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input",3,"ngModelChange","simpleKeyboard","readonly","ngModel"],[1,"bg-gradient-warning","py-4","px-2"],["position","top","parent","body","bindValue","ID","bindLabel","Name","placeholder","Sales Person",3,"selectedChange","items","selected"],["bindLabel","Name","bindValue","ID","placeholder","Delivery Outlet","appendTo","body",2,"width","200px",3,"ngModelChange","disabled","items","ngModel"]],template:function(t,i){if(t&1&&(g(0,hs,6,7,"div",4),a(1,"div",5)(2,"div",6)(3,"strong"),d(4," Qty "),g(5,Cs,2,1,"span"),l(),a(6,"div",7)(7,"button",8),C("click",function(){return i.dialogService.updateQuantity(i.cartItem().Quantity-1)}),d(8," - "),l(),a(9,"input",9,0),C("ngModelChange",function(r){return i.dialogService.updateQuantity(r)}),l(),a(11,"button",10),C("click",function(){return i.dialogService.updateQuantity(i.cartItem().Quantity+1)}),d(12," + "),l()()(),g(13,vs,5,5,"div",11),a(14,"div",12)(15,"strong"),d(16,"Price"),l(),g(17,ys,3,3,"input",13)(18,_s,2,3,"input",14),l(),g(19,Ss,3,1,"div",15),l(),a(20,"div",16),g(21,Ps,4,2,"div",17),g(22,xs,4,3,"div",17),l(),a(23,"div",18)(24,"div",19)(25,"POS-tinymce-editor",20),C("ngModelChange",function(r){return i.dialogService.onUpdateNote(r)}),l()()()),t&2){let o,r,m;f(i.isEdit()===!1?0:-1),s(),b("ngClass",re(18,fs,!i.isEdit())),s(4),f(!((o=i.cartItem())==null||o.Variant==null)&&o.Variant.UOM&&(!((o=i.cartItem())==null||o.Variant==null)&&o.Variant.UOMName)?5:-1),s(2),b("ngClass",re(20,ul,i.disableAddQuantity()))("disabled",i.disableAddQuantity()),s(2),b("preventNegative",!i.role.return())("decimalPlaces",i.decimalPlace())("ngModel",i.cartItem().Quantity)("disabled",i.disableAddQuantity()),s(2),b("ngClass",re(22,ul,i.disableAddQuantity()))("disabled",i.disableAddQuantity()),s(2),f(i.unitQtyLabel()?13:-1),s(),b("hidden",!i.role.priceVisible()),s(3),f(!i.isUnitPriceEditor()||(r=i.cartItem())!=null&&r.PromotionGift&&!i.editingItemPromotionVisible()?17:18),s(2),f(i.selectedPriceBook()?19:-1),s(2),f(i.isEmptySalesID()&&((m=i.salesList())==null?null:m.length)>0&&i.role.salesPerson()?21:-1),s(),f(i.isDeliveryEnabled()&&i.isSentDelivery()?22:-1),s(3),b("ngModel",i.cartItem().Note)}},dependencies:[Ke,Be,W,ue,$,ee,J,ne,Un,Rn,Pt,Qt,Mi,K],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}.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}.more[_ngcontent-%COMP%]{position:absolute;top:0;left:30px}.unit-qty[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100px}p-chips[_ngcontent-%COMP%]{width:100%}p-chips[_ngcontent-%COMP%] ul.ui-inputtext{width:100%}p-chips[_ngcontent-%COMP%] ul.ui-inputtext li input.undefined{border:none}.inventory-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .inventory-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{line-height:6px!important}.cart-input[_ngcontent-%COMP%]{height:36px!important}.table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{vertical-align:middle;line-height:15px}ng-select-infinite[_ngcontent-%COMP%] div.ng-select-container{width:200px!important}.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}.qtyBtn-disabled[_ngcontent-%COMP%]{background-color:#e9ecef;color:#000!important}button.qty_btn[_ngcontent-%COMP%]{background:#eee;border:1px solid #ddd;width:36px}.section-header[_ngcontent-%COMP%]{padding-bottom:6px;margin-bottom:6px;padding-left:0}.info-box[_ngcontent-%COMP%]{background:#f8f9fa;border:1px solid #e5e5e5;border-radius:6px;padding:16px;text-align:center;position:relative;transition:all .3s ease;height:100%}.info-label[_ngcontent-%COMP%]{font-size:12px;color:#666;text-transform:uppercase;letter-spacing:.5px}.info-value[_ngcontent-%COMP%]{font-weight:600;color:#333}.info-value-sm[_ngcontent-%COMP%]{font-size:16px}.info-value-md[_ngcontent-%COMP%]{font-size:20px}.info-box.available[_ngcontent-%COMP%]{background:#f0f8f0;border-color:#d0e8d0}.info-box.available[_ngcontent-%COMP%] .info-value[_ngcontent-%COMP%]{color:#2d5f2d}.info-box.price-highlight[_ngcontent-%COMP%] .info-value[_ngcontent-%COMP%]{color:#0b5ed7}.info-box.editable-box.editing[_ngcontent-%COMP%]{background:#fffef0;border-color:#ffc107;box-shadow:0 0 0 3px #ffc1071a}.info-value-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:10px}.lock-toggle-btn[_ngcontent-%COMP%]{background:#0000000d;border:none;padding:6px;cursor:pointer;color:#666;transition:all .2s ease;display:flex;align-items:center;justify-content:center;border-radius:6px;width:32px;height:32px;flex-shrink:0}.lock-toggle-btn[_ngcontent-%COMP%]:hover{color:#0b5ed7;background:#0b5ed726;transform:scale(1.05)}.lock-toggle-btn.unlocked[_ngcontent-%COMP%]{color:#ff6b00;background:#ff6b0026}.lock-toggle-btn.unlocked[_ngcontent-%COMP%]:hover{color:#c50;background:#ff6b0040;transform:scale(1.05)}.info-input-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:10px;width:100%}.info-value-input[_ngcontent-%COMP%]{font-size:16px;font-weight:600;color:#333;border:2px solid #0b5ed7;border-radius:6px;text-align:center;background:#fff;width:100%;outline:none;transition:border-color .2s}.info-value-input[_ngcontent-%COMP%]:focus{border-color:#0056b3;box-shadow:0 0 0 3px #0b5ed71a}.editable-box[_ngcontent-%COMP%]{background:#fffef0;border-color:#ffc107;box-shadow:0 0 0 3px #ffc1071a}.section[_ngcontent-%COMP%]{margin-bottom:32px}.section-title[_ngcontent-%COMP%]{font-size:16px;font-weight:600;color:#333;margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #e5e5e5}.info-list[_ngcontent-%COMP%]{display:flex;flex-direction:column}.list-item[_ngcontent-%COMP%]{background:#fafafa;border:1px solid #e5e5e5;border-radius:6px;padding:14px 16px;font-size:14px;color:#333}table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{text-transform:none;background:#f8f9fa}"]})};function Ds(n,e){if(n&1&&(S(0,"input",8),I(1,"number")),n&2){let t=p();b("value",V(1,1,t.cartItem().Discount))}}function Ms(n,e){if(n&1){let t=M();a(0,"input",30,0),C("ngModelChange",function(o){y(t);let r=p();return r.dialogService.updateDiscountPercentage(o),_(r.dialogService.validatePriceMinimum())}),l()}if(n&2){let t=p();b("simpleKeyboard",t.keyboard)("ngModel",t.cartItem().Discount)("preventNegative",!0)}}function Is(n,e){if(n&1&&(S(0,"input",8),I(1,"number")),n&2){let t=p();b("value",V(1,1,t.inputedDiscountAmount()))}}function Os(n,e){if(n&1){let t=M();a(0,"input",31,1),C("ngModelChange",function(o){y(t);let r=p();return r.dialogService.onDiscountAmountChange(o),_(r.dialogService.validatePriceMinimum())}),l()}if(n&2){let t,i=p();b("max",(t=i.cartItem())==null?null:t.GrossTotal)("simpleKeyboard",i.keyboard)("ngModel",i.dialogService.inputedDiscountAmount())("preventNegative",!0)("readonly",i.isDisabledDiscInput())}}function ws(n,e){if(n&1&&(a(0,"div",10)(1,"div",5)(2,"strong"),d(3,"Discount Amount / Qty"),l()(),a(4,"div",6)(5,"div",32)(6,"p"),d(7),I(8,"number"),l()()()()),n&2){let t=p();s(7),R(V(8,1,t.cartItem().DiscountAmount))}}function Ts(n,e){if(n&1){let t=M();a(0,"div",10)(1,"div",5)(2,"strong"),d(3,"Pricebook"),l()(),a(4,"div",6)(5,"ng-select",33),C("ngModelChange",function(o){y(t);let r=p();return r.dialogService.onPricebookChange(o),_(r.dialogService.validatePriceMinimum())})("clear",function(){y(t);let o=p();return _(o.dialogService.onClearPricebook())}),l()()()}if(n&2){let t,i,o=p();s(5),b("items",(t=o.cartItem())==null||t.Variant==null?null:t.Variant.PriceBook)("ngModel",(i=o.dialogService.selectedPricebook())==null?null:i.ID)("disabled",o.dialogService.pricebookDisabled())}}function ks(n,e){if(n&1&&(a(0,"div",24)(1,"h5",34),d(2),I(3,"number"),l()()),n&2){let t,i=p();s(2),O(" ",V(3,1,(t=i.cartItem())==null?null:t.Discount),"% ")}}function Es(n,e){if(n&1&&(a(0,"div",25)(1,"h5"),d(2),I(3,"number"),l(),a(4,"span",23),d(5,"x"),l(),a(6,"h5"),d(7),I(8,"number"),l()()),n&2){let t,i,o=p();s(2),R(V(3,2,(t=o.cartItem())==null?null:t.Quantity)),s(5),R(V(8,4,(i=o.cartItem())==null?null:i.DiscountAmount))}}function Ns(n,e){if(n&1&&(a(0,"h5",28),d(1),I(2,"number"),l()),n&2){let t,i=p();s(),O(" -",V(2,1,((t=i.cartItem())==null?null:t.GrossTotal)*(((t=i.cartItem())==null?null:t.Discount)/100))," ")}}function Rs(n,e){if(n&1&&(a(0,"div",27)(1,"h5",28),d(2),I(3,"number"),l()()),n&2){let t,i=p();s(2),O(" -",V(3,1,((t=i.cartItem())==null?null:t.Quantity)*((t=i.cartItem())==null?null:t.DiscountAmount))," ")}}function As(n,e){if(n&1&&(a(0,"div",29)(1,"div",35)(2,"h5"),d(3,"Grand Total"),l()(),a(4,"div",35)(5,"h5"),d(6),I(7,"number"),l()()()),n&2){let t,i=p();s(6),R(V(7,1,(t=i.cartItem())==null?null:t.Total))}}var oo=class n{dialogService=c(Ze);cartItem=this.dialogService.getCartItem;numpadService=c(Bn);isDisabledDiscInput=this.dialogService.isDisabledDiscInput;editingItemPromotionVisible=this.dialogService.editingItemPromotionVisible;keyboard=this.numpadService.keyboard;inputedDiscountAmount=this.dialogService.inputedDiscountAmount;static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["product-dialog-discount"]],decls:56,vars:20,consts:[["discount",""],["AMOUNT",""],[1,"row"],[1,"col-6","border-end","py-8"],[1,"row","d-flex","align-items-center","justify-content-start"],[1,"col-6"],[1,"col-5"],[2,"width","112px"],["disabled","",1,"form-control","cart-input",3,"value"],["id","inputDiscount","keyboardType","number","type","text","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","cart-input",3,"simpleKeyboard","ngModel","preventNegative"],[1,"row","d-flex","align-items-center","justify-content-start","mt-4"],["id","inputDiscAmount","keyboardType","number","type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input",3,"max","simpleKeyboard","ngModel","preventNegative","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
@@ -1 +1 @@
1
- import{a as J}from"./chunk-TCIM4YUE.js";import{a as pe}from"./chunk-RHK6WMN4.js";import{a as me}from"./chunk-QQUWUBWQ.js";import{b as Y}from"./chunk-P2NWTCME.js";import"./chunk-AW3RXQAI.js";import"./chunk-F76MWCWQ.js";import"./chunk-XX7AIWP2.js";import{p as le}from"./chunk-SCH7M36Q.js";import"./chunk-7TQOVQ3O.js";import"./chunk-G53IMHKY.js";import"./chunk-3EAA4CUP.js";import"./chunk-5U2B2SGN.js";import"./chunk-YJV74F2X.js";import"./chunk-WPCHBRKW.js";import"./chunk-BYCXUF5T.js";import{b as re}from"./chunk-UO7Y2YRV.js";import"./chunk-Y3UOCZQB.js";import"./chunk-5VC2XYC5.js";import{a as K}from"./chunk-JTSQDKSX.js";import"./chunk-ROZU3QVN.js";import"./chunk-DQARMORC.js";import"./chunk-ONECCHQ5.js";import"./chunk-GKGUNK27.js";import"./chunk-G56UPMKR.js";import"./chunk-O2F7SUYY.js";import"./chunk-XHLEWVPO.js";import"./chunk-ONKLHHM3.js";import"./chunk-4YPA4HZ3.js";import"./chunk-XTOFMSDQ.js";import"./chunk-ZM456L6A.js";import"./chunk-644K7HEV.js";import"./chunk-LN7LGRLI.js";import"./chunk-EP7SKSJT.js";import"./chunk-LAQZXTBX.js";import{a as $}from"./chunk-XISCWQFV.js";import{f as ne,g as oe}from"./chunk-YKQEOZX7.js";import"./chunk-JSQJA6DW.js";import{a as Z}from"./chunk-7OMUFQ4G.js";import"./chunk-3DC26I3D.js";import"./chunk-B35X77UQ.js";import{c as ie,d as ae}from"./chunk-QMJNI3X6.js";import"./chunk-4BITXMRY.js";import"./chunk-2AOZZW2I.js";import"./chunk-TM2I5PAG.js";import"./chunk-JXEPD3CF.js";import"./chunk-PPMQE2JW.js";import{P as te,g as ee}from"./chunk-FGU4QONB.js";import"./chunk-OVCNCVGF.js";import"./chunk-FXLZBN66.js";import"./chunk-OKQYRKDJ.js";import{d as X}from"./chunk-BUIP3UCE.js";import"./chunk-SIAVPMSP.js";import"./chunk-EOP7LLRQ.js";import{c as Q}from"./chunk-3V6FZIJD.js";import"./chunk-DEJ5V3PF.js";import"./chunk-T45W4CQR.js";import"./chunk-OK7LFGGQ.js";import"./chunk-VGLTFO5N.js";import"./chunk-UTSVZMZD.js";import"./chunk-BP6PECKT.js";import"./chunk-GNDUQZGK.js";import"./chunk-SKJSLBZP.js";import"./chunk-ZS4XLRDB.js";import"./chunk-NNQW72HA.js";import"./chunk-BKOMMH62.js";import"./chunk-TNXMA723.js";import"./chunk-TYFAIMTW.js";import"./chunk-SXVOKLC4.js";import{F as U,h as q,p as G}from"./chunk-AJDQZ346.js";import"./chunk-E4ECYJTH.js";import"./chunk-TB4WHJBK.js";import"./chunk-YY6WVNU4.js";import{b as z}from"./chunk-KLHHVIRS.js";import"./chunk-PPTZHIIZ.js";import"./chunk-5EHSENXI.js";import{q as H}from"./chunk-QGYXJUX3.js";import{$a as D,Ba as h,Bb as B,Cb as L,Db as s,Dc as O,Eb as i,Fb as n,Fc as C,Gb as M,Gc as x,Hc as S,Lc as R,Pb as F,Sb as y,Sd as j,Ua as p,Ub as l,db as P,hc as m,ib as T,ic as w,jb as V,jc as W,mc as _,nc as g,oc as f,ra as d,sa as c,sd as N,ud as A,wb as I,xc as k,yb as v,zb as E}from"./chunk-7D344CRC.js";import"./chunk-NF7PG5F2.js";var ce=()=>["/menu/Payment/Default/Write_Off_Item/Details"],se=(r,u,t,o,e,a)=>({LabelID:r,OutletIds:u,SalesOrderTagID:t,CustomerID:o,From:e,To:a});function _e(r,u){if(r&1){let t=F();i(0,"a",13),y("click",function(){d(t);let e=l(2);return c(e.openExportModal())}),M(1,"i",14),m(2," Export"),n()}}function ge(r,u){if(r&1){let t=F();i(0,"div",15)(1,"div",16)(2,"h6"),m(3,"Outlet"),n(),i(4,"outlet-selector",17),f("ngModelChange",function(e){d(t);let a=l(2);return g(a.pageData().Filter.ListOutletID,e)||(a.pageData().Filter.ListOutletID=e),c(e)}),n()(),i(5,"div",16)(6,"h6"),m(7,"Tag"),n(),i(8,"ng-select",18),f("ngModelChange",function(e){d(t);let a=l(2);return g(a.pageData().Filter.SalesTagID,e)||(a.pageData().Filter.SalesTagID=e),c(e)}),n()(),i(9,"div",16)(10,"h6"),m(11,"From Date"),n(),i(12,"datepicker",19),f("dateChange",function(e){d(t);let a=l(2);return g(a.pageData().Filter.From,e)||(a.pageData().Filter.From=e),c(e)}),y("dateChange",function(){d(t);let e=l(2);return c(e.changeDatepickerValidation())}),n()(),i(13,"div",16)(14,"h6"),m(15,"To Date"),n(),i(16,"datepicker",20),f("dateChange",function(e){d(t);let a=l(2);return g(a.pageData().Filter.To,e)||(a.pageData().Filter.To=e),c(e)}),n()(),i(17,"div",16)(18,"h6"),m(19,"Invoice From Date"),n(),i(20,"datepicker",21),f("dateChange",function(e){d(t);let a=l(2);return g(a.pageData().Filter.InvoiceFrom,e)||(a.pageData().Filter.InvoiceFrom=e),c(e)}),y("dateChange",function(){d(t);let e=l(2);return c(e.changeDatepickerValidation())}),n()(),i(21,"div",16)(22,"h6"),m(23,"Invoice To Date"),n(),i(24,"datepicker",22),f("dateChange",function(e){d(t);let a=l(2);return g(a.pageData().Filter.InvoiceTo,e)||(a.pageData().Filter.InvoiceTo=e),c(e)}),y("dateChange",function(){d(t);let e=l(2);return c(e.changeDatepickerValidation())}),n()(),i(25,"div",16)(26,"h6"),m(27,"Customer"),n(),i(28,"autocompleteV2",23),f("ngModelChange",function(e){d(t);let a=l(2);return g(a.pageData().Filter.CustomerID,e)||(a.pageData().Filter.CustomerID=e),c(e)}),n()(),i(29,"div",16)(30,"h6"),m(31,"Reason"),n(),i(32,"ng-select",24),f("ngModelChange",function(e){d(t);let a=l(2);return g(a.pageData().Filter.ReasonID,e)||(a.pageData().Filter.ReasonID=e),c(e)}),n()()()}if(r&2){let t=l(2);p(4),s("accessType",2),_("ngModel",t.pageData().Filter.ListOutletID),s("multiple",!0),p(4),_("ngModel",t.pageData().Filter.SalesTagID),s("items",t.pageData().Options.Types),p(4),s("hidelClearBtn",t.hideDateClearButton())("isFloatingLabel",!1),_("date",t.pageData().Filter.From),p(4),s("hidelClearBtn",t.hideDateClearButton())("isFloatingLabel",!1),_("date",t.pageData().Filter.To),s("minDateValidation",t.toMinDate()),p(4),s("hidelClearBtn",t.hideDateClearButton())("isFloatingLabel",!1),_("date",t.pageData().Filter.InvoiceFrom),p(4),s("hidelClearBtn",t.hideDateClearButton())("isFloatingLabel",!1),_("date",t.pageData().Filter.InvoiceTo),s("minDateValidation",t.invoiceToMinDate()),p(4),_("ngModel",t.pageData().Filter.CustomerID),p(4),s("items",t.pageData().Options.ReasonOption),_("ngModel",t.pageData().Filter.ReasonID)}}function fe(r,u){r&1&&(i(0,"tr")(1,"td",25),M(2,"app-empty-state"),n()())}function ue(r,u){if(r&1&&(i(0,"tr")(1,"th",26),m(2),n(),i(3,"td",12)(4,"a",27),C(5,"date"),C(6,"date"),m(7),C(8,"number"),n()(),i(9,"td",12),m(10),C(11,"number"),n()()),r&2){let t,o=u.$implicit,e=l(3);p(2),w(o.Name),p(2),s("routerLink",k(15,ce))("queryParams",O(16,se,o.ID,((t=e.pageData().Filter.ListOutletID)==null?null:t.join(","))??"",e.pageData().Filter.SalesTagID??"",e.pageData().Filter.CustomerID??"",S(5,5,e.pageData().Filter.From,"ddMMyyyy"),S(6,8,e.pageData().Filter.To,"ddMMyyyy"))),p(3),w(x(8,11,o.Count)),p(3),w(x(11,13,o.Amount))}}function Ce(r,u){if(r&1&&B(0,ue,12,23,"tr",null,E),r&2){let t=l(2);L(t.data().Data)}}function De(r,u){if(r&1){let t=F();i(0,"mainpanel-cmp",2),y("onSubmit",function(){d(t);let e=l();return c(e.searchFromPageOne())}),f("filterChange",function(e){d(t);let a=l();return g(a.pageData().Filter,e)||(a.pageData().Filter=e),c(e)}),i(1,"actions"),I(2,_e,3,0,"a",3),n(),i(3,"filters"),V(4,ge,33,22,"ng-template",null,0,R),n(),i(6,"content")(7,"div",4)(8,"div",5)(9,"table",6)(10,"thead",7)(11,"tr")(12,"th",8),m(13,"Name"),n(),i(14,"th",9),m(15,"Count"),n(),i(16,"th",9),m(17," Amount "),n()()(),i(18,"tbody"),I(19,fe,3,0,"tr")(20,Ce,2,0),n(),i(21,"tfoot",10)(22,"tr",11)(23,"td"),m(24,"Total"),n(),i(25,"td",12),m(26),C(27,"sum"),C(28,"number"),n(),i(29,"td",12),m(30),C(31,"sum"),C(32,"number"),n()()()()()()()()}if(r&2){let t=l();s("pageData",t.menuData())("hideSearchBox",!0)("isFilterOnDropdown",!1),_("filter",t.pageData().Filter),p(2),v(t.roleService.global.Export?2:-1),p(17),v(t.data().Data.length?20:19),p(7),W(" ",x(28,11,S(27,8,t.data().Data,"Count"))," "),p(4),W(" ",x(32,16,S(31,13,t.data().Data,"Amount"))," ")}}var de=class r extends K{constructor(t,o,e,a,b,ye,he){super(t,o,"Payment/InvoiceWriteOffItemReport","PaymentLoader/InvoiceWriteOffItemReport");this.csvConverter=e;this.dataDaysRangeService=a;this.roleService=b;this.matDialog=ye;this.paymentDateService=he}csvConverter;dataDaysRangeService;roleService;matDialog;paymentDateService;toMinDate=h(null);invoiceToMinDate=h(null);fromMinDate=h(new Date);hideDateClearButton=h(!1);changeDatepickerValidation(t=!1){this.hideDateClearButton.update(()=>this.dataDaysRangeService.isHideClearDateBtn);let o=this.pageData().Filter.From,e=this.dataDaysRangeService.getDateValidation(o);this.toMinDate.update(()=>e.toMinDate),this.fromMinDate.update(()=>e.fromMinDate);let a=this.pageData().Filter.InvoiceFrom,b=this.dataDaysRangeService.getDateValidation(a);this.invoiceToMinDate.update(()=>b.toMinDate)}openExportModal(){this.matDialog.open(Y,{data:{title:"Write Off Item Report",exportTypes:[{ID:"PaymentExport/InvoiceWriteOffItemReport",Value:"Default",FileName:"Write Off Item Report"}],filterExport:this.pageData().Filter,getAllDataLengthAPI:"",pagination:!1}})}static \u0275fac=function(o){return new(o||r)(D(Z),D(H),D($),D(pe),D(z),D(Q),D(J))};static \u0275cmp=P({type:r,selectors:[["POS-payment-writeoff-item"]],features:[T],decls:1,vars:1,consts:[["pageFilterTemplate",""],["filterDialogWidth","600px",3,"pageData","hideSearchBox","isFilterOnDropdown","filter"],["filterDialogWidth","600px",3,"onSubmit","filterChange","pageData","hideSearchBox","isFilterOnDropdown","filter"],[1,"btn","btn-outline-secondary"],[1,"container-fluid","mt-5"],[1,"table-responsive"],[1,"table"],[1,"thead-light","sticky-top-thead"],["scope","col"],["scope","col",1,"text-end",2,"width","150px"],[1,"table-footer"],[1,"fw-semibold"],[1,"text-end"],[1,"btn","btn-outline-secondary",3,"click"],["aria-hidden","true",1,"fa-solid","fa-upload"],[1,"dialog-filter","grid-filter"],[1,"filter-item"],["placeholder","Choose an Outlet",1,"w-100",3,"ngModelChange","accessType","ngModel","multiple"],["appendTo","body","bindLabel","Name","bindValue","ID","placeholder","Choose Sales Tag",3,"ngModelChange","ngModel","items"],["placeholder","From","appearance","outline","name","From",3,"dateChange","hidelClearBtn","isFloatingLabel","date"],["placeholder","To","appearance","outline","name","To",3,"dateChange","hidelClearBtn","isFloatingLabel","date","minDateValidation"],["placeholder","From","appearance","outline","name","InvoiceFrom",3,"dateChange","hidelClearBtn","isFloatingLabel","date"],["placeholder","To","appearance","outline","name","InvoiceTo",3,"dateChange","hidelClearBtn","isFloatingLabel","date","minDateValidation"],["requestUrl","/API/AC/GetCustomerSuggestion","notFoundMessageFor","customer",1,"w-100","ac-filter",3,"ngModelChange","ngModel"],["appendTo","body","placeholder","Choose a reason","bindLabel","Name","bindValue","ID",3,"ngModelChange","items","ngModel"],["colspan","3",1,""],[1,"fw-normal"],[1,"link-primary","cursor-pointer",3,"routerLink","queryParams"]],template:function(o,e){o&1&&I(0,De,33,18,"mainpanel-cmp",1),o&2&&v(e.data()?0:-1)},dependencies:[le,U,q,G,oe,ne,X,re,te,ae,ie,me,j,N,A,ee],encapsulation:2,changeDetection:0})};export{de as PaymentWriteoffItemComponent};
1
+ import{a as J}from"./chunk-ABCHSRRW.js";import{a as pe}from"./chunk-RHK6WMN4.js";import{a as me}from"./chunk-QQUWUBWQ.js";import{b as Y}from"./chunk-P2NWTCME.js";import"./chunk-KYCDVSPQ.js";import"./chunk-F76MWCWQ.js";import"./chunk-XX7AIWP2.js";import{p as le}from"./chunk-SCH7M36Q.js";import"./chunk-7TQOVQ3O.js";import"./chunk-G53IMHKY.js";import"./chunk-3EAA4CUP.js";import"./chunk-5U2B2SGN.js";import"./chunk-YJV74F2X.js";import"./chunk-WPCHBRKW.js";import"./chunk-BYCXUF5T.js";import{a as re}from"./chunk-RLY7D3ZT.js";import"./chunk-Y3UOCZQB.js";import"./chunk-5VC2XYC5.js";import{a as K}from"./chunk-MJFFCDBL.js";import"./chunk-ROZU3QVN.js";import"./chunk-K2Z4KW6U.js";import"./chunk-ONECCHQ5.js";import"./chunk-GKGUNK27.js";import"./chunk-G56UPMKR.js";import"./chunk-O2F7SUYY.js";import"./chunk-XHLEWVPO.js";import"./chunk-ONKLHHM3.js";import"./chunk-4YPA4HZ3.js";import"./chunk-XTOFMSDQ.js";import"./chunk-ZM456L6A.js";import"./chunk-644K7HEV.js";import"./chunk-LN7LGRLI.js";import"./chunk-EP7SKSJT.js";import"./chunk-LAQZXTBX.js";import{a as $}from"./chunk-XISCWQFV.js";import{f as ne,g as oe}from"./chunk-HDB32EBB.js";import"./chunk-QLGAF3TI.js";import{a as Z}from"./chunk-CCUCKXVM.js";import"./chunk-3DC26I3D.js";import"./chunk-B35X77UQ.js";import{c as ie,d as ae}from"./chunk-QMJNI3X6.js";import"./chunk-4BITXMRY.js";import"./chunk-2AOZZW2I.js";import"./chunk-TM2I5PAG.js";import"./chunk-JXEPD3CF.js";import"./chunk-PPMQE2JW.js";import{P as te,g as ee}from"./chunk-FGU4QONB.js";import"./chunk-OVCNCVGF.js";import"./chunk-FXLZBN66.js";import"./chunk-OKQYRKDJ.js";import{d as X}from"./chunk-BUIP3UCE.js";import"./chunk-SIAVPMSP.js";import"./chunk-EOP7LLRQ.js";import{c as Q}from"./chunk-3V6FZIJD.js";import"./chunk-DEJ5V3PF.js";import"./chunk-T45W4CQR.js";import"./chunk-OK7LFGGQ.js";import"./chunk-VGLTFO5N.js";import"./chunk-UTSVZMZD.js";import"./chunk-BP6PECKT.js";import"./chunk-GNDUQZGK.js";import"./chunk-SKJSLBZP.js";import"./chunk-ZS4XLRDB.js";import"./chunk-NNQW72HA.js";import"./chunk-BKOMMH62.js";import"./chunk-TNXMA723.js";import"./chunk-TYFAIMTW.js";import"./chunk-SXVOKLC4.js";import{F as U,h as q,p as G}from"./chunk-AJDQZ346.js";import"./chunk-KG753P2Y.js";import"./chunk-AXO5A6P7.js";import"./chunk-YY6WVNU4.js";import{b as z}from"./chunk-KLHHVIRS.js";import"./chunk-PPTZHIIZ.js";import"./chunk-EWJVO53T.js";import{q as H}from"./chunk-QGYXJUX3.js";import{$a as D,Ba as h,Bb as B,Cb as L,Db as s,Dc as O,Eb as i,Fb as n,Fc as C,Gb as M,Gc as x,Hc as S,Lc as R,Pb as F,Sb as y,Sd as j,Ua as p,Ub as l,db as P,hc as m,ib as T,ic as w,jb as V,jc as W,mc as _,nc as g,oc as f,ra as d,sa as c,sd as N,ud as A,wb as I,xc as k,yb as v,zb as E}from"./chunk-7D344CRC.js";import"./chunk-NF7PG5F2.js";var ce=()=>["/menu/Payment/Default/Write_Off_Item/Details"],se=(r,u,t,o,e,a)=>({LabelID:r,OutletIds:u,SalesOrderTagID:t,CustomerID:o,From:e,To:a});function _e(r,u){if(r&1){let t=F();i(0,"a",13),y("click",function(){d(t);let e=l(2);return c(e.openExportModal())}),M(1,"i",14),m(2," Export"),n()}}function ge(r,u){if(r&1){let t=F();i(0,"div",15)(1,"div",16)(2,"h6"),m(3,"Outlet"),n(),i(4,"outlet-selector",17),f("ngModelChange",function(e){d(t);let a=l(2);return g(a.pageData().Filter.ListOutletID,e)||(a.pageData().Filter.ListOutletID=e),c(e)}),n()(),i(5,"div",16)(6,"h6"),m(7,"Tag"),n(),i(8,"ng-select",18),f("ngModelChange",function(e){d(t);let a=l(2);return g(a.pageData().Filter.SalesTagID,e)||(a.pageData().Filter.SalesTagID=e),c(e)}),n()(),i(9,"div",16)(10,"h6"),m(11,"From Date"),n(),i(12,"datepicker",19),f("dateChange",function(e){d(t);let a=l(2);return g(a.pageData().Filter.From,e)||(a.pageData().Filter.From=e),c(e)}),y("dateChange",function(){d(t);let e=l(2);return c(e.changeDatepickerValidation())}),n()(),i(13,"div",16)(14,"h6"),m(15,"To Date"),n(),i(16,"datepicker",20),f("dateChange",function(e){d(t);let a=l(2);return g(a.pageData().Filter.To,e)||(a.pageData().Filter.To=e),c(e)}),n()(),i(17,"div",16)(18,"h6"),m(19,"Invoice From Date"),n(),i(20,"datepicker",21),f("dateChange",function(e){d(t);let a=l(2);return g(a.pageData().Filter.InvoiceFrom,e)||(a.pageData().Filter.InvoiceFrom=e),c(e)}),y("dateChange",function(){d(t);let e=l(2);return c(e.changeDatepickerValidation())}),n()(),i(21,"div",16)(22,"h6"),m(23,"Invoice To Date"),n(),i(24,"datepicker",22),f("dateChange",function(e){d(t);let a=l(2);return g(a.pageData().Filter.InvoiceTo,e)||(a.pageData().Filter.InvoiceTo=e),c(e)}),y("dateChange",function(){d(t);let e=l(2);return c(e.changeDatepickerValidation())}),n()(),i(25,"div",16)(26,"h6"),m(27,"Customer"),n(),i(28,"autocompleteV2",23),f("ngModelChange",function(e){d(t);let a=l(2);return g(a.pageData().Filter.CustomerID,e)||(a.pageData().Filter.CustomerID=e),c(e)}),n()(),i(29,"div",16)(30,"h6"),m(31,"Reason"),n(),i(32,"ng-select",24),f("ngModelChange",function(e){d(t);let a=l(2);return g(a.pageData().Filter.ReasonID,e)||(a.pageData().Filter.ReasonID=e),c(e)}),n()()()}if(r&2){let t=l(2);p(4),s("accessType",2),_("ngModel",t.pageData().Filter.ListOutletID),s("multiple",!0),p(4),_("ngModel",t.pageData().Filter.SalesTagID),s("items",t.pageData().Options.Types),p(4),s("hidelClearBtn",t.hideDateClearButton())("isFloatingLabel",!1),_("date",t.pageData().Filter.From),p(4),s("hidelClearBtn",t.hideDateClearButton())("isFloatingLabel",!1),_("date",t.pageData().Filter.To),s("minDateValidation",t.toMinDate()),p(4),s("hidelClearBtn",t.hideDateClearButton())("isFloatingLabel",!1),_("date",t.pageData().Filter.InvoiceFrom),p(4),s("hidelClearBtn",t.hideDateClearButton())("isFloatingLabel",!1),_("date",t.pageData().Filter.InvoiceTo),s("minDateValidation",t.invoiceToMinDate()),p(4),_("ngModel",t.pageData().Filter.CustomerID),p(4),s("items",t.pageData().Options.ReasonOption),_("ngModel",t.pageData().Filter.ReasonID)}}function fe(r,u){r&1&&(i(0,"tr")(1,"td",25),M(2,"app-empty-state"),n()())}function ue(r,u){if(r&1&&(i(0,"tr")(1,"th",26),m(2),n(),i(3,"td",12)(4,"a",27),C(5,"date"),C(6,"date"),m(7),C(8,"number"),n()(),i(9,"td",12),m(10),C(11,"number"),n()()),r&2){let t,o=u.$implicit,e=l(3);p(2),w(o.Name),p(2),s("routerLink",k(15,ce))("queryParams",O(16,se,o.ID,((t=e.pageData().Filter.ListOutletID)==null?null:t.join(","))??"",e.pageData().Filter.SalesTagID??"",e.pageData().Filter.CustomerID??"",S(5,5,e.pageData().Filter.From,"ddMMyyyy"),S(6,8,e.pageData().Filter.To,"ddMMyyyy"))),p(3),w(x(8,11,o.Count)),p(3),w(x(11,13,o.Amount))}}function Ce(r,u){if(r&1&&B(0,ue,12,23,"tr",null,E),r&2){let t=l(2);L(t.data().Data)}}function De(r,u){if(r&1){let t=F();i(0,"mainpanel-cmp",2),y("onSubmit",function(){d(t);let e=l();return c(e.searchFromPageOne())}),f("filterChange",function(e){d(t);let a=l();return g(a.pageData().Filter,e)||(a.pageData().Filter=e),c(e)}),i(1,"actions"),I(2,_e,3,0,"a",3),n(),i(3,"filters"),V(4,ge,33,22,"ng-template",null,0,R),n(),i(6,"content")(7,"div",4)(8,"div",5)(9,"table",6)(10,"thead",7)(11,"tr")(12,"th",8),m(13,"Name"),n(),i(14,"th",9),m(15,"Count"),n(),i(16,"th",9),m(17," Amount "),n()()(),i(18,"tbody"),I(19,fe,3,0,"tr")(20,Ce,2,0),n(),i(21,"tfoot",10)(22,"tr",11)(23,"td"),m(24,"Total"),n(),i(25,"td",12),m(26),C(27,"sum"),C(28,"number"),n(),i(29,"td",12),m(30),C(31,"sum"),C(32,"number"),n()()()()()()()()}if(r&2){let t=l();s("pageData",t.menuData())("hideSearchBox",!0)("isFilterOnDropdown",!1),_("filter",t.pageData().Filter),p(2),v(t.roleService.global.Export?2:-1),p(17),v(t.data().Data.length?20:19),p(7),W(" ",x(28,11,S(27,8,t.data().Data,"Count"))," "),p(4),W(" ",x(32,16,S(31,13,t.data().Data,"Amount"))," ")}}var de=class r extends K{constructor(t,o,e,a,b,ye,he){super(t,o,"Payment/InvoiceWriteOffItemReport","PaymentLoader/InvoiceWriteOffItemReport");this.csvConverter=e;this.dataDaysRangeService=a;this.roleService=b;this.matDialog=ye;this.paymentDateService=he}csvConverter;dataDaysRangeService;roleService;matDialog;paymentDateService;toMinDate=h(null);invoiceToMinDate=h(null);fromMinDate=h(new Date);hideDateClearButton=h(!1);changeDatepickerValidation(t=!1){this.hideDateClearButton.update(()=>this.dataDaysRangeService.isHideClearDateBtn);let o=this.pageData().Filter.From,e=this.dataDaysRangeService.getDateValidation(o);this.toMinDate.update(()=>e.toMinDate),this.fromMinDate.update(()=>e.fromMinDate);let a=this.pageData().Filter.InvoiceFrom,b=this.dataDaysRangeService.getDateValidation(a);this.invoiceToMinDate.update(()=>b.toMinDate)}openExportModal(){this.matDialog.open(Y,{data:{title:"Write Off Item Report",exportTypes:[{ID:"PaymentExport/InvoiceWriteOffItemReport",Value:"Default",FileName:"Write Off Item Report"}],filterExport:this.pageData().Filter,getAllDataLengthAPI:"",pagination:!1}})}static \u0275fac=function(o){return new(o||r)(D(Z),D(H),D($),D(pe),D(z),D(Q),D(J))};static \u0275cmp=P({type:r,selectors:[["POS-payment-writeoff-item"]],features:[T],decls:1,vars:1,consts:[["pageFilterTemplate",""],["filterDialogWidth","600px",3,"pageData","hideSearchBox","isFilterOnDropdown","filter"],["filterDialogWidth","600px",3,"onSubmit","filterChange","pageData","hideSearchBox","isFilterOnDropdown","filter"],[1,"btn","btn-outline-secondary"],[1,"container-fluid","mt-5"],[1,"table-responsive"],[1,"table"],[1,"thead-light","sticky-top-thead"],["scope","col"],["scope","col",1,"text-end",2,"width","150px"],[1,"table-footer"],[1,"fw-semibold"],[1,"text-end"],[1,"btn","btn-outline-secondary",3,"click"],["aria-hidden","true",1,"fa-solid","fa-upload"],[1,"dialog-filter","grid-filter"],[1,"filter-item"],["placeholder","Choose an Outlet",1,"w-100",3,"ngModelChange","accessType","ngModel","multiple"],["appendTo","body","bindLabel","Name","bindValue","ID","placeholder","Choose Sales Tag",3,"ngModelChange","ngModel","items"],["placeholder","From","appearance","outline","name","From",3,"dateChange","hidelClearBtn","isFloatingLabel","date"],["placeholder","To","appearance","outline","name","To",3,"dateChange","hidelClearBtn","isFloatingLabel","date","minDateValidation"],["placeholder","From","appearance","outline","name","InvoiceFrom",3,"dateChange","hidelClearBtn","isFloatingLabel","date"],["placeholder","To","appearance","outline","name","InvoiceTo",3,"dateChange","hidelClearBtn","isFloatingLabel","date","minDateValidation"],["requestUrl","/API/AC/GetCustomerSuggestion","notFoundMessageFor","customer",1,"w-100","ac-filter",3,"ngModelChange","ngModel"],["appendTo","body","placeholder","Choose a reason","bindLabel","Name","bindValue","ID",3,"ngModelChange","items","ngModel"],["colspan","3",1,""],[1,"fw-normal"],[1,"link-primary","cursor-pointer",3,"routerLink","queryParams"]],template:function(o,e){o&1&&I(0,De,33,18,"mainpanel-cmp",1),o&2&&v(e.data()?0:-1)},dependencies:[le,U,q,G,oe,ne,X,re,te,ae,ie,me,j,N,A,ee],encapsulation:2,changeDetection:0})};export{de as PaymentWriteoffItemComponent};