dealpos 26.40.0 → 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.
- package/browser/{chunk-DVNQDX4V.js → chunk-2IHALSUS.js} +2 -2
- package/browser/{chunk-6N5SENIC.js → chunk-2V2VITNP.js} +1 -1
- package/browser/{chunk-KZZWRHQJ.js → chunk-3C5VCQ5H.js} +1 -1
- package/browser/{chunk-FMAT5A7C.js → chunk-3ICQ544R.js} +1 -1
- package/browser/{chunk-4ZTJJ2NL.js → chunk-3LD5XCOS.js} +1 -1
- package/browser/{chunk-HRNRA625.js → chunk-3RLLDQHA.js} +2 -2
- package/browser/{chunk-CMKQDYFS.js → chunk-4J43S3OM.js} +1 -1
- package/browser/{chunk-M6CFQRJS.js → chunk-4LO4PLF7.js} +1 -1
- package/browser/{chunk-BAFHP4FC.js → chunk-5XFB6R2C.js} +1 -1
- package/browser/{chunk-L6QE7CYH.js → chunk-6ALTFE5Y.js} +1 -1
- package/browser/{chunk-4ZOQINHF.js → chunk-6AZCVLLD.js} +1 -1
- package/browser/{chunk-CQHJWC5R.js → chunk-6TK3X2FW.js} +2 -2
- package/browser/{chunk-HGK6JOBH.js → chunk-7M2LXZJQ.js} +1 -1
- package/browser/{chunk-OBE2RRYX.js → chunk-7XXLEXHL.js} +1 -1
- package/browser/{chunk-MG2BLYLJ.js → chunk-ABCHSRRW.js} +1 -1
- package/browser/{chunk-7PKL4TVI.js → chunk-AXO5A6P7.js} +1 -1
- package/browser/{chunk-PVXX5YGI.js → chunk-B6Y2K43X.js} +1 -1
- package/browser/{chunk-OLAQM2QJ.js → chunk-BBQ4LFRM.js} +1 -1
- package/browser/{chunk-ANGQTVXY.js → chunk-BN2HZJFW.js} +1 -1
- package/browser/{chunk-55Y633DD.js → chunk-C5WHZL4L.js} +1 -1
- package/browser/{chunk-24XCALJO.js → chunk-CCUCKXVM.js} +1 -1
- package/browser/{chunk-TTFKC5J6.js → chunk-CDWFSH6N.js} +1 -1
- package/browser/{chunk-OJRT6BRQ.js → chunk-CTSKPXAS.js} +1 -1
- package/browser/{chunk-PNC4EWNA.js → chunk-D5JWFWAF.js} +1 -1
- package/browser/chunk-D7OXTPXC.js +2 -0
- package/browser/{chunk-GKHQUDSQ.js → chunk-DEFDZ5BC.js} +1 -1
- package/browser/{chunk-GSY5ZQLK.js → chunk-DRQCFHWX.js} +1 -1
- package/browser/{chunk-RFZAFNYC.js → chunk-EI7F3WRB.js} +1 -1
- package/browser/{chunk-QW4ZJ7FM.js → chunk-EJZKAITO.js} +2 -2
- package/browser/{chunk-KSQGWU7G.js → chunk-EWJVO53T.js} +1 -1
- package/browser/{chunk-WWBG7LDW.js → chunk-F7UC5PBH.js} +1 -1
- package/browser/{chunk-6KM74YFM.js → chunk-FXBKR7JT.js} +2 -2
- package/browser/{chunk-B7ATMZX4.js → chunk-GCPETJGR.js} +1 -1
- package/browser/{chunk-YTIA7C2U.js → chunk-GFPX37HG.js} +1 -1
- package/browser/chunk-GIZNO34O.js +18 -0
- package/browser/{chunk-6SGFLZ3W.js → chunk-GPBACVIL.js} +1 -1
- package/browser/{chunk-2L7DIIZF.js → chunk-GY2TQPCY.js} +1 -1
- package/browser/{chunk-MLL46FJ6.js → chunk-H72O63WE.js} +1 -1
- package/browser/{chunk-N45LU6GH.js → chunk-HDB32EBB.js} +1 -1
- package/browser/{chunk-I5LBEY36.js → chunk-HJOKFG46.js} +1 -1
- package/browser/chunk-HUM2TD2V.js +1 -0
- package/browser/chunk-HVUY67KH.js +1 -0
- package/browser/{chunk-2MV4HPG5.js → chunk-IIKRLNGB.js} +1 -1
- package/browser/{chunk-L4DLXUUG.js → chunk-IIZGMJMS.js} +1 -1
- package/browser/{chunk-BWRPVXL6.js → chunk-IKNZLWT2.js} +3 -3
- package/browser/{chunk-ZVDZORVH.js → chunk-J3XM7F6P.js} +3 -3
- package/browser/{chunk-4SQ6LUEU.js → chunk-K2Z4KW6U.js} +1 -1
- package/browser/{chunk-F44XC2YC.js → chunk-K5JKE77B.js} +1 -1
- package/browser/{chunk-MZGFJKNY.js → chunk-K66NYUJC.js} +1 -1
- package/browser/{chunk-EL6OOFJM.js → chunk-K6M7ZOJ4.js} +1 -1
- package/browser/{chunk-D5UQ4UYY.js → chunk-K7KMORPW.js} +1 -1
- package/browser/{chunk-KI56T4GE.js → chunk-KFCZNOAQ.js} +2 -2
- package/browser/{chunk-BH32FCUT.js → chunk-KG753P2Y.js} +1 -1
- package/browser/{chunk-UBM2Z6GS.js → chunk-KJTYRUB5.js} +1 -1
- package/browser/{chunk-ALP3IUCF.js → chunk-KY4M3XTT.js} +1 -1
- package/browser/{chunk-L7JHEFKL.js → chunk-KYCDVSPQ.js} +1 -1
- package/browser/{chunk-5DZANVCY.js → chunk-LCJTW6YV.js} +2 -2
- package/browser/{chunk-IGRYDBI5.js → chunk-LVWH4ACL.js} +1 -1
- package/browser/{chunk-QIW3RSVG.js → chunk-LXJJWLEE.js} +1 -1
- package/browser/{chunk-3D3C37OA.js → chunk-M2NV66LO.js} +1 -1
- package/browser/{chunk-EYABN7DL.js → chunk-MJCSURDY.js} +1 -1
- package/browser/{chunk-PSZGZXLN.js → chunk-MJFFCDBL.js} +1 -1
- package/browser/{chunk-CPVG7KZ5.js → chunk-NG7UIQDC.js} +1 -1
- package/browser/{chunk-POG26ZBZ.js → chunk-NRM3DNNY.js} +1 -1
- package/browser/{chunk-SKF4EKCM.js → chunk-ONUPUFIL.js} +1 -1
- package/browser/{chunk-JU6525A5.js → chunk-OSCPLN5H.js} +1 -1
- package/browser/{chunk-3TUZQD5M.js → chunk-OWBVIG45.js} +1 -1
- package/browser/{chunk-CCLKDTVT.js → chunk-OWYJ6KDX.js} +1 -1
- package/browser/{chunk-UANPAKRN.js → chunk-P5IXCUXY.js} +1 -1
- package/browser/{chunk-TPHN7HMX.js → chunk-PBXTRWTJ.js} +1 -1
- package/browser/chunk-PGMA3SJI.js +1 -0
- package/browser/{chunk-HT6HS5AQ.js → chunk-Q5WO3DUZ.js} +1 -1
- package/browser/{chunk-Q5XQUUXN.js → chunk-Q6R6B3YW.js} +1 -1
- package/browser/{chunk-I6X5ES65.js → chunk-QLGAF3TI.js} +1 -1
- package/browser/{chunk-MOWZIIGK.js → chunk-QRFXEF6G.js} +1 -1
- package/browser/{chunk-PADRO377.js → chunk-QSLYV565.js} +1 -1
- package/browser/{chunk-SLPIZEJM.js → chunk-R5BORYUY.js} +1 -1
- package/browser/{chunk-NJ2EUHZX.js → chunk-R6UJO3DG.js} +1 -1
- package/browser/chunk-RLY7D3ZT.js +1 -0
- package/browser/chunk-RREGFM6B.js +1 -0
- package/browser/{chunk-6C3MBT7M.js → chunk-SKH6WQNA.js} +1 -1
- package/browser/{chunk-IJQX2UFC.js → chunk-TDNQIIMR.js} +1 -1
- package/browser/chunk-TPZ4EFZG.js +1 -0
- package/browser/{chunk-SX7YMU4W.js → chunk-TVBNCCEZ.js} +2 -2
- package/browser/{chunk-JXMEW5I6.js → chunk-TYSXYSJ2.js} +1 -1
- package/browser/{chunk-YPDZJMOD.js → chunk-TZANH7BC.js} +1 -1
- package/browser/{chunk-UBA34S5E.js → chunk-U3PESBD4.js} +1 -1
- package/browser/{chunk-DO3OBAKR.js → chunk-UEIHPHRX.js} +1 -1
- package/browser/{chunk-LEJFSZG2.js → chunk-UNMRX6O5.js} +1 -1
- package/browser/{chunk-DDCS5XX3.js → chunk-UYWOWA5F.js} +1 -1
- package/browser/{chunk-GJZNFDPT.js → chunk-V44R3JLR.js} +1 -1
- package/browser/{chunk-F62ZIA5P.js → chunk-V7PEO27W.js} +1 -1
- package/browser/{chunk-X46LJ3FL.js → chunk-VDCQ723D.js} +1 -1
- package/browser/{chunk-554BVVRP.js → chunk-VYKYX4HS.js} +1 -1
- package/browser/{chunk-OO3K4J57.js → chunk-W5XX7JGG.js} +1 -1
- package/browser/chunk-W6GVQP2V.js +22 -0
- package/browser/{chunk-ZZBC73CA.js → chunk-WB2WJBBF.js} +1 -1
- package/browser/{chunk-WB6GMZSY.js → chunk-WCOPCSGA.js} +1 -1
- package/browser/{chunk-HBPJPUIB.js → chunk-XNXWJL33.js} +1 -1
- package/browser/{chunk-FV4JN2HL.js → chunk-XPPMFOKI.js} +1 -1
- package/browser/{chunk-WLIMT2I7.js → chunk-XYZ76APC.js} +1 -1
- package/browser/{chunk-Q2RZY22N.js → chunk-YUZBPKYR.js} +1 -1
- package/browser/{chunk-APNKOCJW.js → chunk-ZECZXNZU.js} +1 -1
- package/browser/{chunk-OCZNAK54.js → chunk-ZQEJAMZJ.js} +1 -1
- package/browser/{chunk-4JQQ2MNB.js → chunk-ZVP3S5VD.js} +1 -1
- package/browser/index.html +2 -2
- package/browser/main-APXWKYLA.js +289 -0
- package/browser/ngsw-config.json +1 -1
- package/browser/ngsw.json +503 -501
- package/package.json +1 -1
- package/browser/chunk-4CLTEZJK.js +0 -2
- package/browser/chunk-5J2ZGOHJ.js +0 -18
- package/browser/chunk-CNRDT5NT.js +0 -1
- package/browser/chunk-FFG7KBRF.js +0 -1
- package/browser/chunk-HEVH55TF.js +0 -1
- package/browser/chunk-JMCAXZKZ.js +0 -1
- package/browser/chunk-PHOMVYJP.js +0 -22
- package/browser/chunk-UO7Y2YRV.js +0 -1
- package/browser/main-L3IBDEIC.js +0 -289
|
@@ -1,5 +1,5 @@
|
|
|
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-OCZNAK54.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-EYABN7DL.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-BH32FCUT.js";import{a as Kr}from"./chunk-7PKL4TVI.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-KSQGWU7G.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
|
-
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 - 70px);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.
|
|
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
|
+
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
|
|
5
5
|
quantity of the product. The nominal will be calculated automatically and filled in the discount amount box.`,1,"pointer"],[1,"fa-solid","fa-info-circle","ms-2"],[1,"col-6","py-8"],[1,"w-100","text-center"],[1,"text-start","mt-12"],[1,"row","mt-12"],[1,"w-100","d-flex","align-items-center","justify-content-end"],[1,"mx-1","fw-bold"],[1,"d-flex","align-items-center","justify-content-end","mt-2"],[1,"d-flex","align-items-center","justify-content-end","mt-2","text-danger"],[1,"w-100","d-flex","justify-content-end"],[1,"w-100","d-flex","justify-content-end","mt-2"],[1,"text-danger"],[1,"row","border-top","mx-0","px-0","mt-4"],["id","inputDiscount","keyboardType","number","type","text","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","cart-input",3,"ngModelChange","simpleKeyboard","ngModel","preventNegative"],["id","inputDiscAmount","keyboardType","number","type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input",3,"ngModelChange","max","simpleKeyboard","ngModel","preventNegative","readonly"],[1,"border","ps-6",2,"height","38px","padding-top","10px","width","112px","background-color","#e9ecef"],["bindLabel","Name","bindValue","ID","placeholder","Pricebook","appendTo","body",2,"width","140px",3,"ngModelChange","clear","items","ngModel","disabled"],[1,"fw-bold","text-danger"],[1,"col-6","d-flex","justify-content-end","mt-4"]],template:function(t,i){if(t&1&&(a(0,"div",2)(1,"div",3)(2,"div",4)(3,"div",5)(4,"strong"),d(5,"Discount %"),l()(),a(6,"div",6)(7,"div",7),g(8,Ds,2,3,"input",8)(9,Ms,2,3,"input",9),l()()(),a(10,"div",10)(11,"div",5)(12,"strong"),d(13,"Discount Amount"),l()(),a(14,"div",6)(15,"div",7),g(16,Is,2,3,"input",8)(17,Os,2,5,"input",11),l()()(),a(18,"div",12)(19,"div",13)(20,"input",14),U("ngModelChange",function(r){return B(i.dialogService.isDiscMultipliciedQty,r)||(i.dialogService.isDiscMultipliciedQty=r),r}),C("ngModelChange",function(){return i.dialogService.onSwitchToggleDiscount()}),l()(),a(21,"div",15)(22,"strong"),d(23,"*Quantity"),l(),a(24,"span",16),S(25,"i",17),l()()(),g(26,ws,9,3,"div",10),g(27,Ts,6,3,"div",10),l(),a(28,"div",18)(29,"div",19)(30,"h4"),d(31,"Discount Simulation"),l(),a(32,"h4",20),d(33),l()(),a(34,"div",21)(35,"div",5)(36,"div",22)(37,"h5"),d(38),I(39,"number"),l(),a(40,"span",23),d(41,"x"),l(),a(42,"h5"),d(43),I(44,"number"),l()(),g(45,ks,4,3,"div",24),g(46,Es,9,6,"div",25),l(),a(47,"div",5)(48,"div",26)(49,"h5"),d(50),I(51,"number"),l()(),a(52,"div",27),g(53,Ns,3,3,"h5",28),l(),g(54,Rs,4,3,"div",27),l(),g(55,As,8,3,"div",29),l()()()),t&2){let o,r,m,h,D,F,j,Ae,Ee,Ne;s(8),f(i.isDisabledDiscInput()?8:9),s(8),f(i.isDisabledDiscInput()?16:17),s(4),L("ngModel",i.dialogService.isDiscMultipliciedQty),s(6),f(i.dialogService.isDiscMultipliciedQty()?-1:26),s(),f(((o=i.cartItem())==null||o.Variant==null||o.Variant.PriceBook==null?null:o.Variant.PriceBook.length)>0?27:-1),s(6),O(" ",(r=i.cartItem())==null||r.Variant==null?null:r.Variant.Name," "),s(5),R(V(39,14,(m=i.cartItem())==null?null:m.Quantity)),s(5),R(V(44,16,(h=i.cartItem())==null?null:h.Price)),s(2),f((D=i.cartItem())!=null&&D.Discount?45:-1),s(),f(((F=i.cartItem())==null?null:F.DiscountAmount)>0?46:-1),s(4),R(V(51,18,(j=i.cartItem())==null?null:j.GrossTotal)),s(3),f((Ae=i.cartItem())!=null&&Ae.Discount?53:-1),s(),f(((Ee=i.cartItem())==null?null:Ee.DiscountAmount)>0?54:-1),s(),f(((Ne=i.cartItem())==null?null:Ne.DiscountAmount)>0||((Ne=i.cartItem())==null?null:Ne.Discount)>0?55:-1)}},dependencies:[W,$,ee,In,J,ne,Be,Un,Ke,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}"]})};var Vs=()=>["/menu/Products/Catalog/Variants/Info"],Fs=n=>({ID:n}),Ls=n=>({"col-12":n}),Bs=n=>({"editable-box":n});function Us(n,e){n&1&&(a(0,"div",3),S(1,"i",19),a(2,"h6"),d(3,"No Image"),l()())}function Qs(n,e){if(n&1&&S(0,"img",4),n&2){let t=p();b("src",t.cartItem().Variant.ThumbnailUrl,Qe)}}function qs(n,e){if(n&1){let t=M();a(0,"button",24),C("click",function(){y(t);let o=p(3);return _(o.toggleEditCost())}),S(1,"i",25),l()}}function Ws(n,e){if(n&1&&(a(0,"div",21)(1,"div",18),d(2),I(3,"number"),l(),g(4,qs,2,0,"button",23),l()),n&2){let t=p(2);s(2),Oe(" ",t.currencySymbol()," ",he(3,3,t.cartItem().Cost,"1.0-4")," "),s(2),f(t.costEnabled()?4:-1)}}function js(n,e){if(n&1){let t=M();a(0,"button",29),C("click",function(){y(t);let o=p(3);return _(o.toggleEditCost())}),S(1,"i",30),l()}}function Gs(n,e){if(n&1){let t=M();a(0,"div",22)(1,"div",26)(2,"input",27),C("ngModelChange",function(o){y(t);let r=p(2);return _(r.dialogService.updateCost(o))}),l(),g(3,js,2,0,"button",28),l()()}if(n&2){let t=p(2);s(2),b("ngModel",t.cartItem().Cost),s(),f(t.costEnabled()?3:-1)}}function Hs(n,e){if(n&1&&(a(0,"div",13)(1,"div",20)(2,"div",9),d(3,"Cost"),l(),g(4,Ws,5,6,"div",21),g(5,Gs,4,2,"div",22),l()()),n&2){let t=p();b("ngClass",t.priceCol()),s(),b("ngClass",re(4,Bs,t.enableEditCost())),s(3),f(t.enableEditCost()?-1:4),s(),f(t.enableEditCost()?5:-1)}}function zs(n,e){if(n&1&&(a(0,"div",17)(1,"div",8)(2,"div",9),d(3,"Storage Location"),l(),a(4,"div",18),d(5),l()()()),n&2){let t,i=p();s(5),O(" ",(t=i.cartItem())==null||t.Variant==null?null:t.Variant.Storage," ")}}function $s(n,e){if(n&1&&(a(0,"tr")(1,"td",34),d(2),l(),a(3,"td",35),d(4),I(5,"number"),l(),a(6,"td",35),d(7),I(8,"number"),l()()),n&2){let t=e.$implicit,i=p(2);s(2),O(" ",t.Name," "),s(2),O(" ",V(5,4,t.MinimumQuantity)," "),s(3),Oe(" ",i.currencySymbol()," ",V(8,6,t.UnitPrice)," ")}}function Ks(n,e){if(n&1&&(a(0,"div",12)(1,"h5",6),d(2,"Pricebook"),l(),a(3,"div",16)(4,"table",31)(5,"thead")(6,"tr")(7,"th",32),d(8,"Name"),l(),a(9,"th",33),d(10,"Min Qty"),l(),a(11,"th",33),d(12,"Price"),l()()(),a(13,"tbody"),X(14,$s,9,8,"tr",null,Ie),I(16,"sortBy"),l()()()()),n&2){let t,i=p();s(14),Z(He(16,0,(t=i.cartItem())==null||t.Variant==null?null:t.Variant.PriceBook,"asc","MinimumQuantity"))}}var ro=class n{storeService=c(x);dialogService=c(Ze);cartItem=this.dialogService.getCartItem;inventory$=this.dialogService.getInventoryById();costVisible=this.dialogService.costVisible;costEnabled=this.dialogService.costEnabled;storageVisible=this.dialogService.storageVisible;role=c(ce);enableEditCost=v(!1);priceCol=v("col-12");currencySymbol=u(()=>this.storeService.order()?.CurrencySymbol||"");constructor(){this.generatePriceCol()}toggleEditCost(){this.enableEditCost.update(e=>!e)}generatePriceCol(){this.priceCol.set(this.role.commission&&this.cartItem()?.SalesCommission&&this.costVisible()&&this.role.costVisible()?"col-4":this.role.commission&&this.cartItem()?.SalesCommission||this.costVisible()&&this.role.costVisible()?"col-6":"col-12")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["product-dialog-detail"]],decls:57,vars:34,consts:[[1,"row"],[1,"col-12","mt-4",2,"padding","10px"],["target","_blank",1,"d-flex","justify-content-center","align-items-center",2,"color","inherit",3,"routerLink","queryParams"],[1,"text-center"],[1,"border","rounded",3,"src"],[1,"col-12",2,"padding","10px"],[1,"border-bottom","section-header"],[1,"col-4","m-0","p-3"],[1,"info-box"],[1,"info-label","mb-2"],[1,"info-value","info-value-md"],[1,"info-box","available"],[1,"row","mt-6"],[1,"m-0","p-3",3,"ngClass"],[1,"info-box","price-highlight"],[1,"info-value","info-value-sm","mt-3"],[1,"col-12","m-0","p-3"],[1,"col-6","m-0","p-3"],[1,"info-value","info-value-sm"],["aria-hidden","true",1,"fa-solid","fa-image","fa-5x"],[1,"info-box",3,"ngClass"],[1,"info-value-wrapper"],[1,"info-input"],["aria-label","Toggle edit mode",1,"lock-toggle-btn"],["aria-label","Toggle edit mode",1,"lock-toggle-btn",3,"click"],[1,"fa","fa-lock"],[1,"info-input-wrapper"],["type","text","autoNum","",1,"info-value-input","form-control",3,"ngModelChange","ngModel"],["aria-label","Save and lock",1,"lock-toggle-btn","unlocked"],["aria-label","Save and lock",1,"lock-toggle-btn","unlocked",3,"click"],[1,"fa","fa-unlock"],[1,"table","table-bordered","inventory-table"],[1,"py-6","border-end"],[1,"py-6","border-end","text-end"],[1,"py-6"],[1,"py-6","text-end"]],template:function(t,i){if(t&1&&(bi(0),I(1,"async"),a(2,"div",0)(3,"div",1)(4,"a",2),g(5,Us,4,0,"div",3)(6,Qs,1,1,"img",4),l()(),a(7,"div",5)(8,"div",0)(9,"h5",6),d(10,"Inventory"),l(),a(11,"div",7)(12,"div",8)(13,"div",9),d(14,"On Hand"),l(),a(15,"div",10),d(16),I(17,"quantityFraction"),l()()(),a(18,"div",7)(19,"div",8)(20,"div",9),d(21,"Allocated"),l(),a(22,"div",10),d(23),I(24,"quantityFraction"),l()()(),a(25,"div",7)(26,"div",11)(27,"div",9),d(28,"Available"),l(),a(29,"div",10),d(30),I(31,"quantityFraction"),l()()()(),a(32,"div",12)(33,"h5",6),d(34,"General Price"),l(),g(35,Hs,6,6,"div",13),a(36,"div",13)(37,"div",14)(38,"div",9),d(39,"Price"),l(),a(40,"div",15),d(41),I(42,"number"),l()()()(),a(43,"div",12)(44,"div",16)(45,"div",0)(46,"h5",6),d(47,"Advanced"),l(),a(48,"div",17)(49,"div",8)(50,"div",9),d(51,"Content"),l(),a(52,"div",18),d(53),I(54,"number"),l()()(),g(55,zs,6,1,"div",17),l()()(),g(56,Ks,17,4,"div",12),l()()),t&2){let o,r,m,h,D,F,j=V(1,17,i.inventory$),Ae=(j==null?null:j.OnHand)??0,Ee=(j==null?null:j.Allocated)??0;s(4),b("routerLink",yt(29,Vs))("queryParams",re(30,Fs,(o=i.cartItem())==null||o.Variant==null?null:o.Variant.ID)),s(),f(((r=i.cartItem())==null||r.Variant==null?null:r.Variant.ThumbnailUrl)==null?5:6),s(11),O(" ",V(17,19,Ae)," "),s(7),O(" ",V(24,21,Ee)," "),s(7),O(" ",V(31,23,Ae-Ee)," "),s(5),f(i.costVisible()&&i.role.costVisible()?35:-1),s(),b("ngClass",i.priceCol()),s(5),Oe(" ",i.currencySymbol()," ",V(42,25,i.cartItem().Variant.UnitPrice)," "),s(7),be(re(32,Ls,!i.storageVisible()||!(!((m=i.cartItem())==null||m.Variant==null)&&m.Variant.Storage))),s(5),Rr(" ",(h=i.cartItem())==null?null:h.VariantUnitQuantity," (@",i.currencySymbol()," ",V(54,27,((h=i.cartItem())==null?null:h.Price)/((h=i.cartItem())==null?null:h.VariantUnitQuantity))," ) "),s(2),f(i.storageVisible()&&(!((D=i.cartItem())==null||D.Variant==null)&&D.Variant.Storage)?55:-1),s(),f(((F=i.cartItem())==null||F.Variant==null||F.Variant.PriceBook==null?null:F.Variant.PriceBook.length)>0?56:-1)}},dependencies:[W,ue,vi,Pn,$,ee,J,ne,Ut,Ci,K,ta,aa],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}"]})};var ao=class n{dialogService=c(Ze);cartItem=this.dialogService.getCartItem;deliveryEntityId=this.dialogService.deliveryEntityId;state=this.dialogService.currentSellState;static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["product-dialog-serial"]],decls:1,vars:5,consts:[[3,"cartItemChange","serialsChange","entityId","cartItem","disabled","serials","isBatchNumber"]],template:function(t,i){t&1&&(a(0,"app-item-serial",0),C("cartItemChange",function(r){return i.dialogService.onSerialChange(r)})("serialsChange",function(r){return i.dialogService.serials.set(r)}),l()),t&2&&b("entityId",i.deliveryEntityId())("cartItem",i.cartItem())("disabled",i.state()==2&&i.cartItem().ID)("serials",i.dialogService.serials())("isBatchNumber",i.dialogService.isBatchNumber())},dependencies:[Xa,Ya],encapsulation:2})};var lo=class n{dialogService=c(Ze);cartItem=this.dialogService.getCartItem;editingItemPromotionVisible=this.dialogService.editingItemPromotionVisible;enabledCalculatorNote=this.dialogService.enabledCalculatorNote;static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["product-dialog-calculator"]],decls:1,vars:7,consts:[[3,"discountTotal","priceTotal","qtyTotal","noteChanges","notes","price","discount","quantity","variantName","disabledQty","unitPriceEditorOverride"]],template:function(t,i){if(t&1&&(a(0,"item-calculator-tab",0),C("discountTotal",function(r){return i.dialogService.updateDiscountPercentage(r)})("priceTotal",function(r){return i.dialogService.updatePrice(r)})("qtyTotal",function(r){return i.dialogService.updateQuantity(r)})("noteChanges",function(r){return i.enabledCalculatorNote()?i.dialogService.onUpdateNote(r):null}),l()),t&2){let o,r;b("notes",i.cartItem().Note)("price",i.cartItem().Price)("discount",i.cartItem().Discount)("quantity",i.cartItem().Quantity)("variantName",(o=i.cartItem())==null||o.Variant==null?null:o.Variant.Name)("disabledQty",((r=i.cartItem())==null?null:r.PromotionGift)&&!i.editingItemPromotionVisible())("unitPriceEditorOverride",i.dialogService.isUnitPriceEditor())}},dependencies:[el],encapsulation:2})};function Js(n,e){n&1&&vn(0)}function Ys(n,e){n&1&&vn(0)}function Xs(n,e){n&1&&S(0,"product-dialog-detail")}function Zs(n,e){if(n&1&&(gi(0),a(1,"tab",11),S(2,"product-dialog-serial"),l(),fi()),n&2){let t=p(2);s(),b("matTooltip",t.isBatchNumber()?"Batch Number":"Serial")("tabTitle",t.isBatchNumber()?"Batch Number":"Serial")}}function ec(n,e){n&1&&vn(0)}function tc(n,e){if(n&1&&(gi(0),a(1,"tab",8),Re(2,Ys,1,0,"ng-container",7),S(3,"product-dialog-discount"),l(),fi(),gi(4),a(5,"tab",9),g(6,Xs,1,0,"product-dialog-detail"),l(),fi(),g(7,Zs,3,2,"ng-container"),gi(8),a(9,"tab",10),Re(10,ec,1,0,"ng-container",7),S(11,"product-dialog-calculator"),l(),fi()),n&2){let t=p(),i=ge(12);s(2),b("ngTemplateOutlet",i),s(4),f(t.activeTab()==="Product"?6:-1),s(),f(t.isSerialized()||t.isBatchNumber()?7:-1),s(3),b("ngTemplateOutlet",i)}}function ic(n,e){if(n&1&&(a(0,"div",13),S(1,"div",14),l()),n&2){let t=p().extraClass,i=p();be(Ar("bg-gradient-warning p-4 justify-content-center align-items-center d-flex gap-2 ",t)),s(),b("innerHTML",i.priceMinimumWarning(),ui)}}function nc(n,e){if(n&1&&g(0,ic,2,4,"div",12),n&2){let t=p();f(t.isValidPriceMinimum()?-1:0)}}var $t=class n{dialogRef=c(G);storeService=c(x);dialogService=c(Ze);dialogData=c(Le);cartItem=v(this.storeService.cartItems()[this.dialogData.index]);modalConfig=new te;isSerialized=this.dialogService.isSerialized;isBatchNumber=this.dialogService.isBatchNumber;isValidPriceMinimum=this.dialogService.isValidPriceMinimum;priceMinimumWarning=this.dialogService.priceMinimumRestrictionWarning;activeTab=v("Cart");selectedCartItem=this.dialogService.getCartItem;constructor(){this.initModalConfig(),this.dialogService.initCartItem(this.cartItem(),this.dialogData.index),this.setModalTitle()}initModalConfig(){this.modalConfig.bodyScrollable=!0,this.modalConfig.customWidth="700px",this.modalConfig.noPadding=!0}setModalTitle(){this.modalConfig.title=this.dialogService.isEdit()?`Editing Cart Item - ${this.cartItem()?.Variant?.Name}`:"Adding new items to order"}onTabChange(e){this.activeTab.set(e)}onOk(e){this.dialogService.updateCartItem(e)&&this.dialogRef.close()}onCancel(){this.dialogRef.close()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["app-product-dialog"]],features:[Ge([Ze])],decls:13,vars:3,consts:[["priceMinWarning",""],[3,"onOk","onCancel","onClose","config"],[1,"container","w-100","h-100"],[1,"row","mt-6","mx-1"],[1,"col-12"],[3,"onTabChange"],["matTooltipPosition","above","matTooltip","Cart","tabTitle","Cart"],[4,"ngTemplateOutlet"],["matTooltipPosition","above","matTooltip","Discount","tabTitle","Discount"],["matTooltipPosition","above","matTooltip","Product","tabTitle","Product"],["matTooltipPosition","above","matTooltip","Calculator","tabTitle","Calculator"],["matTooltipPosition","above",3,"matTooltip","tabTitle"],[2,"margin-bottom","12px","border-radius","8px",3,"class"],[2,"margin-bottom","12px","border-radius","8px"],[3,"innerHTML"]],template:function(t,i){if(t&1&&(a(0,"modal-material",1),C("onOk",function(r){return i.onOk(r)})("onCancel",function(){return i.onCancel()})("onClose",function(){return i.onCancel()}),a(1,"content")(2,"div",2)(3,"div",3)(4,"div",4)(5,"custom-tabs",5),C("onTabChange",function(r){return i.onTabChange(r)}),gi(6),a(7,"tab",6),Re(8,Js,1,0,"ng-container",7),S(9,"product-dialog-cart"),l(),fi(),g(10,tc,12,4),l()()()()()(),Re(11,nc,1,1,"ng-template",null,0,At)),t&2){let o,r=ge(12);b("config",i.modalConfig),s(8),b("ngTemplateOutlet",r),s(2),f(!((o=i.selectedCartItem())==null||o.Variant==null)&&o.Variant.Name?10:-1)}},dependencies:[W,Lr,$,Y,Wt,wi,Oi,Qt,kn,no,oo,ro,ao,lo,Pe,De],encapsulation:2})};var on=class n{storeService=c(x);httpService=c(se);factoryService=c(ke);eventService=c(A);shoppingCartService=c(qe);toastr=c(Q);config=u(()=>this.storeService.loadForm().AppConfigJSON);entityID=u(()=>this.storeService.register()?.EntityID);constructor(){this.initEventHandlers()}initEventHandlers(){this.eventService.on("[Cart] Add Item By Code").pipe(q()).subscribe(e=>{this.AddItemByCode(e.payload.code)})}AddItemByCode(e){let t=this.config()?.ModuleSell?.DigitalScale;t.Digit>0&&P.IsNotEmpty(t.Regex)&&e.length==t.Digit?this.findByDigitalScale(e):this.findVariantByCode(e)}findByDigitalScale(e){let t=this.readDigitalScale(e);P.IsNotEmpty(t.code)?this.findVariantByCode(t.code,t.quantity):(this.toastr.info("Matching Regex Rule to Barcode","Digital Scale"),this.findVariantByCode(e))}readDigitalScale(e){let t={code:null,quantity:1},i=this.config()?.ModuleSell?.DigitalScale,o=new RegExp(i.Regex),r=e.match(o);if(r[1]){let m=r[1],h=parseFloat(r[2]);h=h/i.QuantityDivider,t.code=m,t.quantity=h}return t}findVariantByCode(e,t=1){this.httpService.get(oe.GetVariantByCode,[{key:"Code",value:e},{key:"EntityID",value:this.entityID()}]).pipe(fe(i=>{let o=this.factoryService.createCartItemByVariant(i);return o.Quantity=t,o})).subscribe(i=>{if(this.shoppingCartService.onAddItem(i)){let r={type:"[Cart] Item Added",payload:{variantId:i.VariantID}};this.eventService.emit(r)}})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac})};var rn=class n{httpService=c(se);storeService=c(x);factoryService=c(ke);shoppingCartService=c(qe);eventBusService=c(A);entityID=u(()=>this.storeService.register()?.EntityID);constructor(){this.eventBusService.on("[Cart] Add Item By Serial").pipe(q()).subscribe(e=>this.addItemBySerial(e.payload.serial))}addItemBySerial(e){this.httpService.get(oe.GetVariantBySerial,[{key:"Serial",value:e},{key:"EntityID",value:this.entityID()}]).subscribe(t=>{let i=!1,o=this.storeService.cartItems();if(o.length>0){let r=o.findIndex(m=>m.VariantID===t.ID);if(r!==-1){let m=o[r].Serial?[...o[r].Serial]:[],h=m.findIndex(F=>F.Number===e);h===-1?m.push({Number:e,Quantity:1,ExpiryDate:""}):m[h].Quantity+=1;let D=Object.assign(new ye,o[r]);D.Serial=[...m],D.Quantity=m.reduce((F,j)=>F+j.Quantity,0),i=this.shoppingCartService.onUpdateItem(r,D)}else i=this.addNewSerials(t,e)}else i=this.addNewSerials(t,e);if(i){let r={type:"[Cart] Item Added",payload:{variantId:t.ID}};this.eventBusService.emit(r)}})}addNewSerials(e,t){let i=this.factoryService.createCartItemByVariant(e);return i.Serial=[{Number:t,Quantity:1,ExpiryDate:""}],i.Quantity=1,this.shoppingCartService.onAddItem(i)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=w({token:n,factory:n.\u0275fac})};var oc=n=>({"ps-0":n});function rc(n,e){if(n&1&&(a(0,"td",8)(1,"small"),d(2),l()()),n&2){let t=p().$index;s(2),O("",t+1,".")}}function ac(n,e){if(n&1&&(a(0,"div",37),S(1,"img",39),l()),n&2){let t=p(2).$implicit;s(),b("src",t.Variant==null?null:t.Variant.ThumbnailUrl,Qe)}}function lc(n,e){n&1&&(a(0,"div",38),S(1,"i",40),l())}function sc(n,e){if(n&1&&(a(0,"span",11),g(1,ac,2,1,"div",37)(2,lc,2,0,"div",38),l()),n&2){let t=p().$implicit;s(),f(t.Variant!=null&&t.Variant.ThumbnailUrl?1:2)}}function cc(n,e){n&1&&S(0,"i",41)}function dc(n,e){n&1&&S(0,"i",42)}function pc(n,e){if(n&1&&(a(0,"span",15),g(1,cc,1,0,"i",41)(2,dc,1,0,"i",42),l()),n&2){let t=p().$implicit;s(),f(t.Taxable?1:2)}}function mc(n,e){n&1&&S(0,"i",16)}function uc(n,e){if(n&1&&(a(0,"small",18),d(1),l()),n&2){let t=p().$implicit;s(),O(" ",t.Variant==null?null:t.Variant.CategoryName," ")}}function gc(n,e){if(n&1&&(a(0,"small",19),d(1),l()),n&2){let t=p().$implicit;s(),O(" ",t.Variant==null?null:t.Variant.BrandName," ")}}function fc(n,e){if(n&1&&(a(0,"small",20),d(1),l()),n&2){let t=p().$implicit;s(),O(" ",t.Variant.Storage," ")}}function bc(n,e){if(n&1&&S(0,"small",22),n&2){let t=p().$implicit;b("innerHtml",t.Note,ui)}}function hc(n,e){if(n&1&&(a(0,"small",23),d(1," Sold by "),a(2,"i"),d(3),l()()),n&2){let t=p().$implicit;s(3),R(t.SalesName)}}function Cc(n,e){if(n&1&&(a(0,"small")(1,"i",43),d(2),l()()),n&2){let t=p().$implicit;s(2),O("Fulfillment from: ",t.EntityName)}}function vc(n,e){if(n&1&&(a(0,"div",26),S(1,"i",44),l()),n&2){let t=p().$implicit;b("matTooltip",t.AvailableInventory<t.Quantity?t.AvailableInventory+" Available Stock":"")}}function yc(n,e){if(n&1){let t=M();a(0,"span",45),C("click",function(){y(t);let o=p().$index,r=p(2);return _(r.onEditItem(o,"quantity"))}),d(1),I(2,"number"),l()}if(n&2){let t=p().$implicit;s(),O(" ",he(2,1,t.Quantity,"1.0-4"))}}function _c(n,e){if(n&1){let t=M();a(0,"span",46),d(1,"x"),l(),a(2,"div",47),C("click",function(){y(t);let o=p().$index,r=p(2);return _(r.onEditItem(o,"quantity"))}),a(3,"span",48),d(4),I(5,"number"),l()()}if(n&2){let t=p().$implicit;s(4),R(V(5,1,t.UnitQuantity))}}function Sc(n,e){if(n&1&&(a(0,"span",29),d(1),I(2,"number"),l()),n&2){let t=p().$implicit;s(),O("@",V(2,1,t.VariantUnitQuantity))}}function Pc(n,e){if(n&1&&(a(0,"small",30),d(1),l()),n&2){let t=p().$implicit;s(),R(t.Variant!=null&&t.Variant.UOM?t.Variant==null?null:t.Variant.UOMName:"")}}function xc(n,e){if(n&1&&(a(0,"div",51),d(1),I(2,"number"),l()),n&2){let t=p(4).$implicit;s(),O(" ",he(2,1,t.UnitPriceOriginal,"1.0-4")," ")}}function Dc(n,e){if(n&1){let t=M();a(0,"div",50),C("click",function(){y(t);let o=p(3).$index,r=p(2);return _(r.onEditItem(o,"price"))}),g(1,xc,3,4,"div",51),a(2,"div",28),d(3),I(4,"number"),l()()}if(n&2){let t=p(3).$implicit;s(),f(t.UnitPriceOriginal>t.Price?1:-1),s(2),O(" ",he(4,2,t.Price,"1.0-4")," ")}}function Mc(n,e){if(n&1){let t=M();a(0,"div",45),C("click",function(){y(t);let o=p(3).$index,r=p(2);return _(r.onEditItem(o,"price"))}),d(1),I(2,"number"),l()}if(n&2){let t=p(3).$implicit;s(),O(" ",he(2,1,t.Price,"1.0-4")," ")}}function Ic(n,e){if(n&1&&g(0,Dc,5,5,"div",49)(1,Mc,3,4,"div",28),n&2){let t=p(4);f(t.strikethroughOriginalPrice()?0:1)}}function Oc(n,e){if(n&1&&(a(0,"div",25),g(1,Ic,2,1),l()),n&2){let t=p().$implicit;s(),f(t.Price!==t.Total?1:-1)}}function wc(n,e){if(n&1&&(a(0,"div"),d(1),I(2,"number"),l()),n&2){let t=p().$implicit;s(),O(" ",t.Discount==0?"":V(2,1,t.Discount*-1)+"%"," ")}}function Tc(n,e){if(n&1&&(a(0,"div"),d(1),I(2,"number"),l()),n&2){let t=p().$implicit;s(),O(" ",t.DiscountAmount==0?"":V(2,1,t.DiscountAmount*-1)," ")}}function kc(n,e){if(n&1&&(a(0,"div",52),d(1),I(2,"number"),l()),n&2){let t=p(2).$implicit;s(),O(" ",he(2,1,t.UnitPriceOriginal,"1.0-4")," ")}}function Ec(n,e){if(n&1&&(a(0,"div",28),g(1,kc,3,4,"div",52),a(2,"div",25),d(3),I(4,"number"),l()()),n&2){let t=p().$implicit;s(),f(t.UnitPriceOriginal>t.Price?1:-1),s(2),O(" ",V(4,2,t.Total)," ")}}function Nc(n,e){if(n&1&&(a(0,"div",25)(1,"div",28),d(2),I(3,"number"),l()()),n&2){let t=p().$implicit,i=p(2);s(2),O(" ",i.priceVisible?V(3,1,t.Total):" - "," ")}}function Rc(n,e){if(n&1){let t=M();a(0,"span",53),C("click",function(){y(t);let o=p().$index,r=p(2);return _(r.onRemoveItem(o))}),S(1,"i",54),l()}}function Ac(n,e){if(n&1){let t=M();a(0,"tr",7),I(1,"async"),C("contextmenu",function(o){let r=y(t),m=r.$implicit,h=r.$index;p();let D=ge(5);return p().onContextMenu(o,m,h),_(D.openMenu())}),g(2,rc,3,1,"td",8),a(3,"td",9),C("click",function(){let o=y(t).$index,r=p(2);return _(r.onEditItem(o,"quantity"))}),a(4,"div",10),g(5,sc,3,1,"span",11),a(6,"div",12)(7,"div",13)(8,"span",14),d(9),l(),g(10,pc,3,1,"span",15),g(11,mc,1,0,"i",16),l(),a(12,"div",17),d(13),l(),g(14,uc,2,1,"small",18),g(15,gc,2,1,"small",19),g(16,fc,2,1,"small",20),a(17,"div"),S(18,"app-serial-note",21),l(),g(19,bc,1,1,"small",22),g(20,hc,4,1,"small",23),g(21,Cc,3,1,"small"),l()()(),a(22,"td",24)(23,"div",25),g(24,vc,2,1,"div",26),a(25,"div",27),g(26,yc,3,4,"span",28),g(27,_c,6,3),g(28,Sc,3,3,"span",29),g(29,Pc,2,1,"small",30),l()()(),a(30,"td"),g(31,Oc,2,1,"div",25),l(),a(32,"td",31),C("click",function(){let o=y(t).$index,r=p(2);return _(r.onEditItem(o,"discount"))}),a(33,"div",32),g(34,wc,3,3,"div"),g(35,Tc,3,3,"div"),l()(),a(36,"td",33),C("click",function(){let o=y(t).$index,r=p(2);return _(r.onEditItem(o,"price"))}),g(37,Ec,5,4,"div",28)(38,Nc,4,3,"div",25),l(),a(39,"td",34)(40,"div",35),g(41,Rc,2,0,"span",36),l()()()}if(n&2){let t=e.$implicit,i=p(2);b("cdkDragDisabled",!V(1,25,i.enableDragDrop$)),s(2),f(i.rowNumberVisible()?2:-1),s(),b("ngClass",re(27,oc,i.rowNumberVisible())),s(2),f(i.productImageVisible()?5:-1),s(4),O(" ",t.Variant.Name," "),s(),f(i.taxVisible()?10:-1),s(),f(t.PromotionGift?11:-1),s(2),O(" ",t==null||t.Variant==null?null:t.Variant.Code," "),s(),f(i.categoryVisible()?14:-1),s(),f(i.brandVisible()?15:-1),s(),f(i.storageVisible()?16:-1),s(2),b("serials",t.Serial),s(),f(t.Note?19:-1),s(),f(t.SalesName?20:-1),s(),f(t.EntityName?21:-1),s(3),f(t.AvailableInventory<t.Quantity&&((t==null||t.Variant==null?null:t.Variant.TypeID)<9||(t==null||t.Variant==null?null:t.Variant.TypeID)==i.inventoryType.Composite)?24:-1),s(2),f(t.Quantity!==1&&t.Quantity!==0||t.UnitQuantity>1||t.VariantUnitQuantity>1?26:-1),s(),f(t.UnitQuantity>1?27:-1),s(),f(t.VariantUnitQuantity>1?28:-1),s(),f(t.Variant.UOM&&i.uomVisible()?29:-1),s(2),f((t.Price!==t.Total||t.DiscountAmount>0||t.Discount>0||t.UnitPriceOriginal>t.Price)&&i.priceVisible?31:-1),s(3),f(t.Discount>0?34:-1),s(),f(t.DiscountAmount>0?35:-1),s(2),f(i.strikethroughOriginalPrice()&&t.Quantity==1&&i.priceVisible?37:38),s(4),f(i.hasItemDeletion()?41:-1)}}function Vc(n,e){if(n&1){let t=M();a(0,"button",55),C("click",function(){y(t);let o=p(2);return _(o.onReverseItem(o.contextMenuItem.index,!0))}),a(1,"div",56),S(2,"i",57),a(3,"span"),d(4,"Return"),l()()(),a(5,"button",58),C("click",function(){y(t);let o=p(2);return _(o.onReverseItem(o.contextMenuItem.index,!1))}),a(6,"div",56),S(7,"i",59),a(8,"span"),d(9,"Sales"),l()()()}if(n&2){let t=p(2);b("disabled",!t.sellRoleService.return()||t.contextMenuItem.item.Quantity<0),s(5),b("disabled",t.contextMenuItem.item.Quantity>0)}}function Fc(n,e){if(n&1){let t=M();a(0,"table",3)(1,"tbody",4),C("cdkDropListDropped",function(o){y(t);let r=p();return _(r.drop(o))}),X(2,Ac,42,29,"tr",5,Xe),l()(),S(4,"div",6,0),a(6,"mat-menu",null,1),g(8,Vc,10,2),l()}if(n&2){let t=ge(7),i=p();s(2),Z(i.cartItems()),s(2),Nr("left",i.contextMenuPosition.x)("top",i.contextMenuPosition.y),b("matMenuTriggerFor",t),s(4),f(i.contextMenuItem?8:-1)}}function Lc(n,e){n&1&&(a(0,"div",2)(1,"div",60)(2,"div",61)(3,"div",62)(4,"div",63),S(5,"i",64),l(),a(6,"div",65)(7,"span"),d(8,"Empty Cart"),l(),S(9,"br"),a(10,"span"),d(11,"Add products to the cart"),l(),S(12,"br"),a(13,"span"),d(14,"or scan barcode"),l()()()()()())}var so=class n{storeService=c(x);shoppingCartService=c(qe);eventService=c(A);roleService=c($e);sellRoleService=c(ce);dialog=c(Te);viewContainerRef=c(je);contextMenuPosition={x:"0px",y:"0px"};contextMenuItem=null;cartItems=u(()=>this.storeService.cartItems());appConfig=u(()=>this.storeService.loadForm().AppConfigJSON);inventoryType=qt;priceVisible=this.roleService?.product?.Price;rowNumberVisible=u(()=>this.appConfig().ModuleSell?.Grid.RowNumberVisible);productImageVisible=u(()=>this.appConfig().ModuleSell?.Grid.ProductImageVisible);taxVisible=u(()=>this.appConfig().ModuleSell?.Grid.TaxVisible);categoryVisible=u(()=>this.appConfig().ModuleSell?.Grid.CategoryVisible);brandVisible=u(()=>this.appConfig().ModuleSell?.Grid.ShowBrandItemCart);storageVisible=u(()=>this.appConfig().ModuleSell?.Grid.StorageVisible);uomVisible=u(()=>this.appConfig().ModuleSell?.Grid.UOMVisible);strikethroughOriginalPrice=u(()=>this.appConfig().ModuleSell?.Promotion.StrikethroughOriginalPrice);hasItemDeletion=this.shoppingCartService.hasItemDeletion;enableDragDrop$=this.eventService.on("[Cart] Enable Drag Drop").pipe(wr({payload:!0}),fe(e=>e?.payload));drop(e){let t=[...this.cartItems()];Yr(t,e.previousIndex,e.currentIndex),this.storeService.updateCartItems([...t])}onEditItem(e,t){this.dialog.open($t,{data:{index:e,fieldFocus:t},viewContainerRef:this.viewContainerRef})}onRemoveItem(e){this.eventService.emit({type:"[Cart] Remove Item",payload:{index:e}})}onContextMenu(e,t,i){e.preventDefault(),this.contextMenuPosition.x=e.clientX+"px",this.contextMenuPosition.y=e.clientY+"px",this.contextMenuItem={item:t,index:i}}onReverseItem(e,t){this.eventService.emit({type:"[Cart] Reverse Item",payload:{index:e,isReturn:t}})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["cart-body"]],decls:2,vars:1,consts:[["contextMenuTrigger","matMenuTrigger"],["rowContextMenu","matMenu"],[1,"row","g-0","h-100"],[1,"table","table-borderless"],["cdkDropList","",3,"cdkDropListDropped"],["cdkDrag","",2,"border-bottom","0.5px solid #dee2e6",3,"cdkDragDisabled"],[2,"visibility","hidden","position","fixed",3,"matMenuTriggerFor"],["cdkDrag","",2,"border-bottom","0.5px solid #dee2e6",3,"contextmenu","cdkDragDisabled"],[2,"width","10px"],[1,"pe-0",2,"width","50%",3,"click","ngClass"],[1,"d-flex","align-items-center"],[1,"me-4"],[1,"d-block",2,"line-height","18px"],[1,"fs-5","d-flex","align-items-center"],[1,"me-1"],[1,"fst-italic","m-0","me-3"],["title","Product Promotion",1,"fa-solid","fa-gift"],["title","Product Code",1,"fw-normal","fs-6","text-muted"],["title","Product Category",1,"fst-italic","text-muted","d-block"],["title","Brand Name",1,"text-muted","d-block"],["title","Storage",1,"text-muted","d-block"],[3,"serials"],["title","Note",1,"special-TinyMCE","m-0","fst-italic","d-block",3,"innerHtml"],["title","Sales Name",1,"text-success","fst-italic","d-block"],[1,"px-0","text-end",2,"width","15%"],[1,"d-flex","align-items-center","justify-content-end"],["matTooltipPosition","above",1,"me-2",3,"matTooltip"],[1,"d-flex","text-end","fw-normal","align-items-center",2,"line-height","20px"],[1,"fs-5"],["title","Variant Unit Quantity",1,"fs-5"],["title","UOM",1,"ps-1","fs-5"],[3,"click"],[1,"d-block","fw-normal","fs-5","text-danger","ps-3"],[1,"pe-0",3,"click"],[1,"mt-6","ps-0"],[1,"d-flex","justify-content-end","align-items-center"],["title","Delete Item",1,"fs-3","cursor-pointer"],[1,"ratio","ratio-1x1",2,"width","55px"],[1,"item-image","d-flex","justify-content-center","align-items-center","text-center","fs-1"],[1,"item-image",3,"src"],[1,"fa-solid","fa-image",2,"color","#b4b4b4c2"],["title","Taxable",1,"fa-regular","fa-droplet-percent","fs-4","text-success"],["title","Non Taxable",1,"fa-regular","fa-droplet-percent","fs-4","text-danger"],[1,"text-warning","d-block"],[1,"fa-solid","fa-triangle-exclamation","not-enough-inventory"],[1,"fs-5",3,"click"],[1,"fs-6","me-1","ms-1"],[1,"d-flex","algin-items-center",3,"click"],["title","Unit Quantity",1,"fs-5","me-1"],[1,"d-inline-block","fs-5"],[1,"d-inline-block","fs-5",3,"click"],[1,"text-decoration-line-through","text-danger","fs-5"],[1,"text-decoration-line-through","text-danger","d-flex","align-items-center","justify-content-end"],["title","Delete Item",1,"fs-3","cursor-pointer",3,"click"],[1,"fa","fa-trash","text-danger","fs-4"],["mat-menu-item","","matTooltip","Set item quantity to negative (return transaction)","matTooltipPosition","right",3,"click","disabled"],[1,"d-flex","gap-2"],[1,"fa-solid","fa-minus"],["mat-menu-item","","matTooltip","Revert quantity to positive (remove return status)","matTooltipPosition","right",3,"click","disabled"],[1,"fa-solid","fa-plus"],[1,"col-12"],[1,"d-flex","justify-content-center","align-items-center","h-100"],[1,"row"],[1,"col-12","d-flex","justify-content-center"],[1,"fa-regular","fa-cart-arrow-up","text-secondary",2,"font-size","110px"],[1,"col-12","justify-content-center","text-center","mt-5","empty-cart-description","text-secondary","headings-font-family"]],template:function(t,i){t&1&&g(0,Fc,9,6)(1,Lc,15,0,"div",2),t&2&&f(i.cartItems().length>0?0:1)},dependencies:[W,ue,ea,Zr,Xr,$,Va,Pe,De,Aa,Na,Ea,Ra,Ci,K],styles:["span[_ngcontent-%COMP%] > .item-image[_ngcontent-%COMP%]{height:50px;width:56px;display:block;margin:0 auto;border:solid 1px #dddddd;border-radius:5px}img.item-image[_ngcontent-%COMP%]{object-fit:contain}.empty-cart-description[_ngcontent-%COMP%]{font-size:14px;font-weight:500;color:#c7c7c7}.not-enough-inventory[_ngcontent-%COMP%]{font-size:.875rem;opacity:60%;color:red}"]})};function Bc(n,e){if(n&1){let t=M();a(0,"div",5)(1,"h6",6),d(2,"Verify Via"),l(),a(3,"div",7)(4,"button",8),C("click",function(){y(t);let o=p();return _(o.onChooseVerifyType("phone"))}),a(5,"div",9)(6,"div"),S(7,"i",10),l(),a(8,"div",11),d(9),l()()()(),a(10,"div",12)(11,"button",8),C("click",function(){y(t);let o=p();return _(o.onChooseVerifyType("email"))}),a(12,"div",9),S(13,"i",13),a(14,"div",11),d(15),l()()()(),a(16,"div",12)(17,"button",14),C("click",function(o){return y(t),p().onChooseVerifyType("pin"),_(o.preventDefault())}),a(18,"div",9),S(19,"i",15),a(20,"div",11),d(21,"Use PIN"),l()()()()()}if(n&2){let t=p();s(4),b("disabled",!t.hasPhone),s(4),de("opacity-50",!t.hasPhone),s(),O(" ",t.hasPhone?t.phone():"Mobile Phone is not registered"," "),s(2),b("disabled",!t.hasEmail),s(3),de("opacity-50",!t.hasEmail),s(),O(" ",t.hasEmail?t.email():"Email is not registered"," ")}}function Uc(n,e){if(n&1){let t=M();a(0,"div",16)(1,"div",17)(2,"div"),d(3," OTP Verification is turned "),a(4,"span",18),d(5,"OFF"),l(),d(6,", "),l(),a(7,"div"),d(8," Please read this "),a(9,"a",19),d(10,"article"),l(),d(11," to turn on "),l()()(),a(12,"div")(13,"div",20)(14,"button",21),C("click",function(){y(t);let o=p();return _(o.onRedeemClick())}),d(15,"Redeem"),l()()()}}var co=class n{toastrService=c(Q);isVerifyEnabled=pe(!1);phone=pe(null);email=pe(null);pointUsed=Vr(0);pointBalance=pe(0);onVerify=rt();onRedeem=rt();get hasPhone(){return!!this.phone()&&(this.phone()?.length??0)>=6}get hasEmail(){return!!this.email()}ngAfterViewInit(){this.setFocusInput()}setFocusInput(){setTimeout(()=>{document.getElementById("pointInput")?.focus()},300)}onChooseVerifyType(e){this.checkPointUsed()&&this.onVerify.emit(e)}onRedeemClick(){this.checkPointUsed()&&this.onRedeem.emit()}checkPointUsed(){return P.IsEmpty(this.pointUsed())||this.pointUsed()<=0?(this.toastrService.warning("Please enter the points before redeeming!","Field Input Required!"),this.setFocusInput(),!1):!0}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["point-step"]],inputs:{isVerifyEnabled:[1,"isVerifyEnabled"],phone:[1,"phone"],email:[1,"email"],pointUsed:[1,"pointUsed"],pointBalance:[1,"pointBalance"]},outputs:{pointUsed:"pointUsedChange",onVerify:"onVerify",onRedeem:"onRedeem"},decls:13,vars:6,consts:[[1,"d-flex","align-items-center","justify-content-center"],[1,"me-3"],["type","text","autoNum","","id","pointInput",1,"form-control","input-point",3,"ngModelChange","ngModel","max"],[1,"me-3","d-flex","align-items-center","justify-content-center"],[1,"fs-1"],[1,"mt-8"],[1,"mb-6","text-center"],[1,"text-center"],["type","button",1,"btn","btn-light","btn-sm","p-3","w-75",3,"click","disabled"],[1,"d-flex","align-items-center"],[1,"fa-brands","fa-whatsapp","fs-2","ps-2",2,"color","#25d366"],[1,"fs-5","w-100"],[1,"mt-4","text-center"],[1,"ps-2","fa-solid","fa-envelope","fs-3",2,"color","#c71610"],["type","button","matTooltip","Inform the customer to download the Brand Loyalty App and setup PIN in Profile Menu to authorize Point Redemption","matTooltipPosition","right","matTooltipClass","primary-tooltip",1,"btn","btn-light","btn-sm","p-3","w-75",3,"click"],[1,"ps-2","fa-solid","fa-key","fs-3"],[1,"mt-8","d-flex","justify-content-center"],[1,"text-center","alert","alert-warning","py-4","px-8","mb-0"],[1,"fw-bold","text-danger",2,"font-size","13px"],["href","https://support.dealpos.com/en/articles/9158486-redeem-loyalty-point-authorization-using-otp","target","_blank"],[1,"d-flex","justify-content-center","mt-12"],[1,"btn","btn-success",3,"click"]],template:function(t,i){t&1&&(a(0,"div",0)(1,"div",1)(2,"input",2),U("ngModelChange",function(r){return B(i.pointUsed,r)||(i.pointUsed=r),r}),l()(),a(3,"div",3)(4,"span",1),d(5,"Of"),l(),a(6,"span",4),d(7),I(8,"number"),l()(),a(9,"div"),d(10,"Points"),l()(),g(11,Bc,22,8,"div",5)(12,Uc,16,0)),t&2&&(s(2),L("ngModel",i.pointUsed),b("max",i.pointBalance().toString()),s(5),R(V(8,4,i.pointBalance())),s(4),f(i.isVerifyEnabled()?11:12))},dependencies:[W,Be,$,ee,J,ne,Pe,De,K],styles:[".input-point[_ngcontent-%COMP%]{width:120px;height:44px;font-size:1.375rem;text-align:center}"]})};function Qc(n,e){if(n&1&&(a(0,"div"),d(1," OTP has been sent to "),a(2,"span",5),d(3),l()()),n&2){let t=p();s(3),R(t.contact())}}function qc(n,e){if(n&1&&S(0,"ng-otp-input",3),n&2){let t=p(2);b("formCtrl",t.otpCtrl)("config",t.otpConfig)}}function Wc(n,e){if(n&1&&g(0,qc,1,2,"ng-otp-input",3),n&2){let t=p();f(t.showPinInput()?0:-1)}}function jc(n,e){if(n&1&&S(0,"ng-otp-input",3),n&2){let t=p();b("formCtrl",t.otpCtrl)("config",t.otpConfig)}}function Gc(n,e){if(n&1){let t=M();a(0,"div",4)(1,"span"),d(2,"Didn`t get a code? "),l(),a(3,"a",6),C("click",function(){y(t);let o=p();return _(o.onResendCode())}),d(4,"Click to resend"),l()()}}var po=class n{type=pe(null);contact=pe();clearPin=pe(!1);onVerify=rt();resendCode=rt();showPinInput=v(!0);otpCtrl=new ze;otpConfig={length:6,inputStyles:{width:"3rem",height:"3rem"},isPasswordInput:!1,placeholder:"-"};constructor(){this.listenOtpChange()}ngOnChanges(e){let{clearPin:t}=e;t?.currentValue&&(this.showPinInput.set(!1),setTimeout(()=>{this.showPinInput.set(!0)},0)),this.type()&&(this.otpConfig.isPasswordInput=this.type()==="pin")}onResendCode(){this.resendCode.emit()}listenOtpChange(){this.otpCtrl.valueChanges.pipe(Ki(300),_e(e=>e.length===6)).subscribe(e=>{this.onVerify.emit(e)})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["verify-step"]],inputs:{type:[1,"type"],contact:[1,"contact"],clearPin:[1,"clearPin"]},outputs:{onVerify:"onVerify",resendCode:"resendCode"},features:[kr],decls:8,vars:4,consts:[[1,"text-center","mb-10"],[1,"mb-3","fw-normal"],[1,"d-flex","justify-content-center"],[3,"formCtrl","config"],[1,"mt-4","text-start"],[1,"fw-bold"],[1,"link-primary","cursor-pointer",3,"click"]],template:function(t,i){t&1&&(a(0,"div",0)(1,"h4",1),d(2),l(),g(3,Qc,4,1,"div"),l(),a(4,"div",2),g(5,Wc,1,1)(6,jc,1,2,"ng-otp-input",3),l(),g(7,Gc,5,0,"div",4)),t&2&&(s(2),O(" Confirm Your ",i.type()=="pin"?"PIN":"OTP"," "),s(),f(i.type()!="pin"?3:-1),s(2),f(i.type()=="pin"?5:6),s(2),f(i.type()!="pin"?7:-1))},dependencies:[Ka,$a,ut],encapsulation:2})};function Hc(n,e){if(n&1){let t=M();ae(0,"button",7),gt("click",function(){y(t);let o=p();return _(o.cancel())}),d(1,"Cancel"),le()}}function zc(n,e){if(n&1){let t=M();ae(0,"button",8),gt("click",function(){y(t);let o=p();return _(o.confirm())}),d(1,"Confirm"),le()}}var mo=class n{pointUsed=pe(0);redeemPointValue=pe(0);showCancelBtn=pe(!1);onConfirm=rt();onCancel=rt();confirm(){this.onConfirm.emit()}cancel(){this.onCancel.emit()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["confirm-step"]],inputs:{pointUsed:[1,"pointUsed"],redeemPointValue:[1,"redeemPointValue"],showCancelBtn:[1,"showCancelBtn"]},outputs:{onConfirm:"onConfirm",onCancel:"onCancel"},decls:19,vars:7,consts:[[1,"text-center"],[1,"fs-5"],[1,"d-flex","justify-content-center","text-success","align-items-center"],[1,"me-3",2,"font-size","1.5rem"],[1,"d-flex","justify-content-center","text-danger","align-items-center"],[1,"btn","btn-danger","mt-12"],[1,"btn","btn-success","mt-12"],[1,"btn","btn-danger","mt-12",3,"click"],[1,"btn","btn-success","mt-12",3,"click"]],template:function(t,i){t&1&&(ae(0,"div",0)(1,"div",1),d(2,"Redeem"),le(),ae(3,"div",2)(4,"span",3),d(5),I(6,"number"),le(),ae(7,"small"),d(8,"Point"),le()(),ae(9,"div",1),d(10,"~"),le(),ae(11,"div",4)(12,"span",3),d(13),I(14,"number"),le(),ae(15,"small"),d(16,"Discount"),le()(),g(17,Hc,2,0,"button",5)(18,zc,2,0,"button",6),le()),t&2&&(s(5),R(V(6,3,i.pointUsed())),s(8),R(V(14,5,i.pointUsed()*i.redeemPointValue())),s(4),f(i.showCancelBtn()?17:18))},dependencies:[W,K],encapsulation:2})};var $c=["stepper"];function Kc(n,e){n&1&&d(0,"Points")}function Jc(n,e){n&1&&d(0,"Verify")}function Yc(n,e){n&1&&d(0,"Confirm")}var uo=class n{dialogRef=c(G);storeService=c(x);eventService=c(A);customerService=c(ht);toastr=c(Q);config=new te;enabledLoyaltyPoint=v(!1);stepper;pointUsed=0;pointBalance=v(0);redeemPointValue=v(0);email=v(null);phone=v(null);contactToResend=v(null);verifyType=v(null);clearPin=v(!1);selectedTab=v(0);constructor(){this.initModalConfig();let e=this.storeService.loadForm().AppConfigJSON;this.redeemPointValue.set(e?.ApplicationLoyalty?.LoyaltyPoint?.RedeemPointValue),this.email.set(this.storeService.customer()?.Email??null),this.phone.set(this.storeService.customer()?.Mobile??null),this.initAvailablePoint(),this.initConfigEnabledVerify(),this.initPointUsed()}initModalConfig(){this.config.title="Redeem Point",this.config.customWidth="500px",this.config.hideFooter=!0}initConfigEnabledVerify(){let e=this.storeService.loadForm().AppConfigJSON,t=e?.ApplicationLoyalty?.VerifyRedemption,i=e?.ApplicationLoyalty?.Enabled,o=this.storeService.register()?.MemberPoint;this.enabledLoyaltyPoint.set(t&&i&&o)}initPointUsed(){let e=this.storeService.order().PointUsed;this.pointUsed=e||0,this.pointUsed>0&&this.selectedTab.set(2)}initAvailablePoint(){let e=this.storeService.customer(),t=e?.Point,i=e?.PointUsed,o=(t||0)-(i||0);this.pointBalance.set(o)}onClose(){this.dialogRef.close()}onCancelRedeem(){this.eventService.emit({type:"[Order] Redeem Point",payload:{pointUsed:0}}),this.toastr.info("Redeem point has been canceled","Canceled"),this.onClose()}onRedeem(){this.stepper.next(),this.stepper.next()}onVerify(e){switch(e){case"phone":this.contactToResend.set(this.phone()),this.handlingSentOtpViaPhone();break;case"email":this.contactToResend.set(this.email()),this.handlingSentOtpViaEmail();break;case"pin":this.stepper.next();break}this.verifyType.set(e)}handlingSentOtpViaPhone(){this.customerService.sendOtpViaWhatsApp(this.phone()??"").subscribe(e=>{this.stepper.selectedIndex==0&&this.stepper.next(),this.toastr.success(`OTP has been sent to ${this.phone()}`,"OTP Sent")})}handlingSentOtpViaEmail(){this.customerService.sendOtpViaEmail(this.email()??"").subscribe(e=>{this.stepper.selectedIndex==0&&this.stepper.next(),this.toastr.success(`OTP has been sent to ${this.email()}`,"Email Sent")})}onVerifyCode(e){switch(this.verifyType()){case"phone":this.verifyPhoneOtp(e);break;case"email":this.verifyEmailOtp(e);break;case"pin":this.verifyCustomerPin(e);break}}verifyEmailOtp(e){this.customerService.verifyEmailOtp(this.email()??"",e).subscribe(t=>{this.toastr.success(t.Message,"Successfully verified"),this.stepper.next()})}verifyPhoneOtp(e){this.customerService.verifyWhatsAppOtp(this.phone()??"",e).subscribe(t=>{this.toastr.success(t.Message,"Successfully verified"),this.stepper.next()})}verifyCustomerPin(e){let t=this.storeService.order().CustomerID??"";this.clearPin.set(!1),this.customerService.verifyPin(e,t).subscribe({next:i=>{this.toastr.success(i.Message,"Successfully verified"),this.stepper.next()},error:i=>{this.clearPin.set(!0)}})}onResendCode(){let e=this.verifyType();e&&this.onVerify(e)}onConfirm(){this.eventService.emit({type:"[Order] Redeem Point",payload:{pointUsed:this.pointUsed}}),this.dialogRef.close()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["dialog-redeem-point"]],viewQuery:function(t,i){if(t&1&&et($c,5),t&2){let o;tt(o=it())&&(i.stepper=o.first)}},decls:18,vars:18,consts:[["stepper",""],[3,"onClose","preventEnterEvent","config"],[1,"container"],[1,"d-flex","justify-content-center"],[1,"sell-stepper-redeem",3,"linear","selectedIndex"],[3,"editable"],["matStepLabel",""],[1,"mt-10"],[3,"onVerify","pointUsedChange","onRedeem","isVerifyEnabled","pointUsed","pointBalance","email","phone"],["aria-labelledby","stepDisabled",3,"editable"],[3,"resendCode","onVerify","type","contact","clearPin"],["aria-labelledby","stepDisabled"],[3,"onConfirm","onCancel","pointUsed","redeemPointValue","showCancelBtn"]],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,"mat-stepper",4,0)(6,"mat-step",5),Re(7,Kc,1,0,"ng-template",6),a(8,"div",7)(9,"point-step",8),C("onVerify",function(m){return i.onVerify(m)}),U("pointUsedChange",function(m){return y(o),B(i.pointUsed,m)||(i.pointUsed=m),_(m)}),C("onRedeem",function(){return i.onRedeem()}),l()()(),a(10,"mat-step",9),Re(11,Jc,1,0,"ng-template",6),a(12,"div",7)(13,"verify-step",10),C("resendCode",function(){return i.onResendCode()})("onVerify",function(m){return i.onVerifyCode(m)}),l()()(),a(14,"mat-step",11),Re(15,Yc,1,0,"ng-template",6),a(16,"div",7)(17,"confirm-step",12),C("onConfirm",function(){return i.onConfirm()})("onCancel",function(){return i.onCancelRedeem()}),l()()()()()()()()}t&2&&(b("preventEnterEvent",!0)("config",i.config),s(4),b("linear",!0)("selectedIndex",i.selectedTab()),s(2),b("editable",!0),Ji("aria-labelledby",i.selectedTab()==2?"stepDisabled":""),s(3),b("isVerifyEnabled",i.enabledLoyaltyPoint()),L("pointUsed",i.pointUsed),b("pointBalance",i.pointBalance())("email",i.email())("phone",i.phone()),s(),b("editable",!1),s(3),b("type",i.verifyType())("contact",i.contactToResend())("clearPin",i.clearPin()),s(4),b("pointUsed",i.pointUsed)("redeemPointValue",i.redeemPointValue())("showCancelBtn",i.selectedTab()==2))},dependencies:[W,$,Y,za,Ga,ja,Ha,co,po,mo],styles:['@import"https://fonts.googleapis.com/icon?family=Material+Icons"; mat-stepper.sell-stepper-redeem .mat-horizontal-stepper-header{height:50px!important} mat-stepper.sell-stepper-redeem .mat-horizontal-stepper-header .mat-step-label{min-width:0px!important} mat-stepper.sell-stepper-redeem .mat-horizontal-stepper-header[aria-labelledby=stepDisabled]{pointer-events:none!important}']})};var go=class{Title;FirstName;LastName;Name;Gender;Mobile;Email;TaxIDNumber;TaxID;Group;Code;City;Address;Birthdate;MemberIdentification;NationalIDNumber;NationalityID;RaceID;CreatorEntityID;DebtLimit};var Xc=["firstNameAutoFocus"];function Zc(n,e){if(n&1&&S(0,"option",10),n&2){let t=e.$implicit;b("value",t.Name)}}function ed(n,e){n&1&&(a(0,"div",13),d(1,"Name is mandatory"),l())}function td(n,e){n&1&&(a(0,"div",13),d(1,"Mobile Phone is mandatory"),l())}function id(n,e){if(n&1&&(a(0,"div",13),d(1),l()),n&2){p(2);let t=ge(25);s(),O(" ",t.errors==null||t.errors.minLength==null?null:t.errors.minLength.message," ")}}function nd(n,e){if(n&1&&(g(0,td,2,0,"div",13),g(1,id,2,1,"div",13)),n&2){p();let t=ge(25);f(t.getError("required")&&!t.getError("minLength")?0:-1),s(),f(t.getError("minLength")?1:-1)}}function od(n,e){n&1&&(a(0,"div",13),d(1," Email must be a valid email address "),l())}function rd(n,e){n&1&&(a(0,"div",13),d(1,"Email is mandatory"),l())}function ad(n,e){if(n&1&&(g(0,od,2,0,"div",13),g(1,rd,2,0,"div",13)),n&2){p();let t=ge(32);f(t.errors!=null&&t.errors.email?0:-1),s(),f(t.errors!=null&&t.errors.required?1:-1)}}function ld(n,e){n&1&&(a(0,"div",13),d(1,"Birthdate is mandatory"),l())}function sd(n,e){if(n&1&&g(0,ld,2,0,"div",13),n&2){p();let t=ge(39);f(t.errors!=null&&t.errors.required?0:-1)}}var fo=class n{customer=pe.required();options=pe();fieldRequiredConfig=pe.required();firstNameKeyup=rt();firstNameRef;ngAfterViewInit(){this.firstNameRef?.nativeElement?.focus()}onKeyUpFirstName(){this.firstNameKeyup.emit()}isNotEmpty(e){return P.IsNotEmpty(e)||e==0}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["app-general-tab"]],viewQuery:function(t,i){if(t&1&&et(Xc,5),t&2){let o;tt(o=it())&&(i.firstNameRef=o.first)}},inputs:{customer:[1,"customer"],options:[1,"options"],fieldRequiredConfig:[1,"fieldRequiredConfig"]},outputs:{firstNameKeyup:"firstNameKeyup"},features:[Ge([],[{provide:yi,useExisting:Lt}])],decls:46,vars:26,consts:[["firstNameAutoFocus","","FirstName","ngModel"],["phoneNumber","ngModel"],["Email","ngModel"],["birthdateCtrl","ngModel"],["ngModelGroup","generalForm",1,"row"],[1,"col-2","mt-3"],[1,"form-floating-outline"],["list","cust-title","id","Title","name","Title","placeholder","Title",1,"form-control",3,"ngModelChange","ngModel"],["for","Title"],["id","cust-title"],[3,"value"],[1,"col-5","mt-3"],["type","text","data-cy","FirstName","id","FirstName","name","FirstName","placeholder","First Name",1,"form-control",3,"keyup","ngModelChange","ngModel","required"],[1,"invalid-feedback"],["for","FirstName"],["type","text","data-cy","LastName","id","LastName","name","LastName","placeholder","Last Name",1,"form-control",3,"ngModelChange","ngModel"],["for","LastName"],[1,"col-6","mt-4"],["type","text","numericInputOnly","phone","id","Phone","name","Phone","placeholder","Mobile Phone",1,"form-control",3,"ngModelChange","ngModel","required"],["for","Phone"],["type","email","id","email","name","Email","placeholder","Email","email","",1,"form-control",3,"ngModelChange","ngModel","required"],["for","email"],["placeholder","Birthdate","appearance","outline","name","orderDate",3,"ngModelChange","ngModel","required"],[1,"col-md-6","mt-4"],[1,"form-floating-outline","flexRow"],["id","customerGender","bindLabel","Value","bindValue","Key","name","customerGender","appendTo","body",1,"productform","tall",3,"ngModelChange","ngModel","items"],["for","customerGender",1,"ng-select"]],template:function(t,i){if(t&1){let o=M();a(0,"div",4)(1,"div",5)(2,"div",6)(3,"input",7),U("ngModelChange",function(m){return y(o),B(i.customer().Title,m)||(i.customer().Title=m),_(m)}),l(),a(4,"label",8),d(5,"Title"),l(),a(6,"datalist",9),X(7,Zc,1,1,"option",10,Ie),l()()(),a(9,"div",11)(10,"div",6)(11,"input",12,0),C("keyup",function(){return i.onKeyUpFirstName()}),U("ngModelChange",function(m){return y(o),B(i.customer().FirstName,m)||(i.customer().FirstName=m),_(m)}),l(),g(14,ed,2,0,"div",13),a(15,"label",14),d(16,"First Name"),l()()(),a(17,"div",11)(18,"div",6)(19,"input",15),U("ngModelChange",function(m){return y(o),B(i.customer().LastName,m)||(i.customer().LastName=m),_(m)}),l(),a(20,"label",16),d(21,"Last Name"),l()()(),a(22,"div",17)(23,"div",6)(24,"input",18,1),U("ngModelChange",function(m){return y(o),B(i.customer().Mobile,m)||(i.customer().Mobile=m),_(m)}),l(),g(26,nd,2,2),a(27,"label",19),d(28,"Mobile"),l()()(),a(29,"div",17)(30,"div",6)(31,"input",20,2),U("ngModelChange",function(m){return y(o),B(i.customer().Email,m)||(i.customer().Email=m),_(m)}),l(),a(33,"label",21),d(34,"Email"),l(),g(35,ad,2,2),l()(),a(36,"div",17)(37,"div",6)(38,"datepicker",22,3),U("ngModelChange",function(m){return y(o),B(i.customer().Birthdate,m)||(i.customer().Birthdate=m),_(m)}),l(),g(40,sd,1,1),l()(),a(41,"div",23)(42,"div",24)(43,"ng-select",25),U("ngModelChange",function(m){return y(o),B(i.customer().Gender,m)||(i.customer().Gender=m),_(m)}),l(),a(44,"label",26),d(45,"Gender"),l()()()()}if(t&2){let o,r,m=ge(13),h=ge(25),D=ge(32),F=ge(39);s(3),L("ngModel",i.customer().Title),s(4),Z((o=i.options())==null?null:o.Titles),s(4),de("is-invalid",m.touched&&m.invalid),L("ngModel",i.customer().FirstName),b("required",!0),s(3),f(m.touched&&m.invalid?14:-1),s(5),L("ngModel",i.customer().LastName),s(5),de("is-invalid",h.invalid&&(h.dirty||h.touched)),L("ngModel",i.customer().Mobile),b("required",i.fieldRequiredConfig().Mobile),s(2),f(h.invalid&&(h.dirty||h.touched)?26:-1),s(5),de("is-invalid",D.invalid&&(D.dirty||D.touched)),L("ngModel",i.customer().Email),b("required",i.fieldRequiredConfig().Email),s(4),f(D.invalid&&(D.dirty||D.touched)?35:-1),s(3),de("is-invalid",F.invalid&&(F.dirty||F.touched)),L("ngModel",i.customer().Birthdate),b("required",i.fieldRequiredConfig().Birthdate),s(2),f(F.invalid&&(F.dirty||F.touched)?40:-1),s(2),de("selected",i.isNotEmpty(i.customer().Gender)),s(),L("ngModel",i.customer().Gender),b("items",(r=i.options())==null?null:r.Genders)}},dependencies:[W,$,Hr,zr,ee,J,Ft,St,$r,ne,_i,Ke,Qn,Ca],styles:[".form-floating-outline[_ngcontent-%COMP%]{margin-bottom:.2rem!important}"]})};function cd(n,e){if(n&1&&S(0,"i",6),n&2){let t=p();b("matTooltip",t.estimatedCodeMessage())}}function dd(n,e){n&1&&(a(0,"div",7),d(1,"Customer code is mandatory."),l())}function pd(n,e){n&1&&(a(0,"div",7),d(1,"Address is mandatory."),l())}var bo=class n{customer=pe.required();options=pe();fieldRequiredConfig=pe.required();estimatedCodeMessage=pe("");isNotEmpty(e){return P.IsNotEmpty(e)||e==0}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["app-detail-tab"]],inputs:{customer:[1,"customer"],options:[1,"options"],fieldRequiredConfig:[1,"fieldRequiredConfig"],estimatedCodeMessage:[1,"estimatedCodeMessage"]},features:[Ge([],[{provide:yi,useExisting:Lt}])],decls:26,vars:20,consts:[["customerCode","ngModel"],["address","ngModel"],["ngModelGroup","detailForm",1,"row","mt-2"],[1,"col-md-4","mt-4"],[1,"form-floating-outline","position-relative"],["type","text","name","code","id","code","placeholder","Customer Code",1,"form-control",2,"padding-right","30px !important",3,"ngModelChange","ngModel","required"],["matTooltipPosition","above",1,"fa-solid","fa-circle-info","text-secondary","position-absolute",2,"top","21px","right","9px","font-size","16px",3,"matTooltip"],[1,"invalid-feedback"],["for","code"],[1,"col-4","mt-4"],[1,"form-floating-outline","flexRow"],["id","customerGroup","bindLabel","Name","bindValue","ID","name","customerGroup","appendTo","body",1,"productform","tall",3,"ngModelChange","ngModel","items"],["for","customerGroup",1,"ng-select"],["id","city","bindLabel","Name","bindValue","ID","name","city","appendTo","body",1,"productform","tall",3,"ngModelChange","ngModel","items"],["for","city",1,"ng-select"],[1,"col-md-12","mt-4"],[1,"form-floating-outline"],["id","address","name","address","placeholder","Address",1,"form-control",3,"ngModelChange","rows","ngModel","required"],["for","address"]],template:function(t,i){if(t&1){let o=M();a(0,"div",2)(1,"div",3)(2,"div",4)(3,"input",5,0),U("ngModelChange",function(m){return y(o),B(i.customer().Code,m)||(i.customer().Code=m),_(m)}),l(),g(5,cd,1,1,"i",6),g(6,dd,2,0,"div",7),a(7,"label",8),d(8,"Customer Code"),l()()(),a(9,"div",9)(10,"div",10)(11,"ng-select",11),U("ngModelChange",function(m){return y(o),B(i.customer().Group,m)||(i.customer().Group=m),_(m)}),l(),a(12,"label",12),d(13,"Group"),l()()(),a(14,"div",3)(15,"div",10)(16,"ng-select",13),U("ngModelChange",function(m){return y(o),B(i.customer().City,m)||(i.customer().City=m),_(m)}),l(),a(17,"label",14),d(18,"City"),l()()(),a(19,"div",15)(20,"div",16)(21,"textarea",17,1),U("ngModelChange",function(m){return y(o),B(i.customer().Address,m)||(i.customer().Address=m),_(m)}),l(),a(23,"label",18),d(24,"Address"),l(),g(25,pd,2,0,"div",7),l()()()}if(t&2){let o,r,m=ge(4),h=ge(22);s(3),de("is-invalid",m.invalid&&(m.dirty||m.touched)),L("ngModel",i.customer().Code),b("required",i.fieldRequiredConfig().Code),s(2),f(i.estimatedCodeMessage()?5:-1),s(),f(m.invalid&&(m.dirty||m.touched)?6:-1),s(4),de("selected",i.isNotEmpty(i.customer().Group)),s(),L("ngModel",i.customer().Group),b("items",(o=i.options())==null?null:o.Groups),s(4),de("selected",i.isNotEmpty(i.customer().City)),s(),L("ngModel",i.customer().City),b("items",(r=i.options())==null?null:r.Cities),s(5),de("is-invalid",h.invalid&&(h.dirty||h.touched)),b("rows",6),L("ngModel",i.customer().Address),b("required",i.fieldRequiredConfig().Address),s(4),f(h.invalid&&(h.dirty||h.touched)?25:-1)}},dependencies:[W,$,ee,J,Ft,St,ne,_i,Ke,Pe,De],styles:[".form-floating-outline[_ngcontent-%COMP%]{margin-bottom:.2rem!important}"]})};function md(n,e){if(n&1&&(a(0,"div",6),d(1),l()),n&2){p();let t=ge(4);s(),O(" ",t.errors==null||t.errors.minLength==null?null:t.errors.minLength.message," ")}}function ud(n,e){n&1&&(a(0,"div",19),d(1," Sign Up Outlet is mandatory. "),l())}var ho=class n{customer=pe.required();options=pe();fieldRequiredConfig=pe.required();outlets=pe([]);isNotEmpty(e){return P.IsNotEmpty(e)||e==0}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["app-id-tab"]],inputs:{customer:[1,"customer"],options:[1,"options"],fieldRequiredConfig:[1,"fieldRequiredConfig"],outlets:[1,"outlets"]},features:[Ge([],[{provide:yi,useExisting:Lt}])],decls:30,vars:21,consts:[["nationalId","ngModel"],["signUpOutletCtrl","ngModel"],["ngModelGroup","idForm",1,"row","mt-2"],[1,"col-md-6","mt-3"],[1,"form-floating-outline"],["type","text","id","Identification","name","Identification","placeholder","NationalID","numericInputOnly","nationalId",1,"form-control",3,"ngModelChange","ngModel"],[1,"invalid-feedback"],["for","Identification"],["type","text","id","TaxId","name","TaxId","placeholder","TaxID",1,"form-control",3,"ngModelChange","ngModel"],["for","TaxId"],[1,"col-md-6","mt-4"],[1,"form-floating-outline","flexRow"],["id","nationality","bindLabel","Name","bindValue","ID","name","nationality","appendTo","body",1,"productform","tall",3,"ngModelChange","ngModel","items"],["for","nationality",1,"ng-select"],[1,"col-6","mt-4"],["id","customerRace","bindLabel","Name","bindValue","ID","name","customerRace","appendTo","body",1,"productform","tall",3,"ngModelChange","ngModel","items"],["for","customerRace",1,"ng-select"],["id","signUpOutlet","bindLabel","Name","bindValue","ID","name","signUpOutlet","appendTo","body",1,"productform","tall",3,"ngModelChange","ngModel","items","required"],["for","signUpOutlet",1,"ng-select"],[1,"invalid-feedback","fst-italic"]],template:function(t,i){if(t&1){let o=M();a(0,"div",2)(1,"div",3)(2,"div",4)(3,"input",5,0),U("ngModelChange",function(m){return y(o),B(i.customer().NationalIDNumber,m)||(i.customer().NationalIDNumber=m),_(m)}),l(),g(5,md,2,1,"div",6),a(6,"label",7),d(7,"National ID"),l()()(),a(8,"div",3)(9,"div",4)(10,"input",8),U("ngModelChange",function(m){return y(o),B(i.customer().TaxIDNumber,m)||(i.customer().TaxIDNumber=m),_(m)}),l(),a(11,"label",9),d(12,"Tax ID"),l()()(),a(13,"div",10)(14,"div",11)(15,"ng-select",12),U("ngModelChange",function(m){return y(o),B(i.customer().NationalityID,m)||(i.customer().NationalityID=m),_(m)}),l(),a(16,"label",13),d(17,"Nationality"),l()()(),a(18,"div",14)(19,"div",11)(20,"ng-select",15),U("ngModelChange",function(m){return y(o),B(i.customer().RaceID,m)||(i.customer().RaceID=m),_(m)}),l(),a(21,"label",16),d(22,"Customer Racesas"),l()()(),a(23,"div",10)(24,"div",11)(25,"ng-select",17,1),U("ngModelChange",function(m){return y(o),B(i.customer().CreatorEntityID,m)||(i.customer().CreatorEntityID=m),_(m)}),l(),a(27,"label",18),d(28,"Sign Up Outlet"),l(),g(29,ud,2,0,"div",19),l()()()}if(t&2){let o,r,m=ge(4),h=ge(26);s(3),de("is-invalid",m.invalid&&(m.dirty||m.touched)),L("ngModel",i.customer().NationalIDNumber),s(2),f(m.getError("minLength")?5:-1),s(5),L("ngModel",i.customer().TaxIDNumber),s(4),de("selected",i.isNotEmpty(i.customer().NationalityID)),s(),L("ngModel",i.customer().NationalityID),b("items",(o=i.options())==null?null:o.Nationalities),s(4),de("selected",i.isNotEmpty(i.customer().RaceID)),s(),L("ngModel",i.customer().RaceID),b("items",(r=i.options())==null?null:r.Races),s(4),de("selected",i.isNotEmpty(i.customer().CreatorEntityID)),s(),de("is-invalid",h.invalid&&(h.dirty||h.touched)),L("ngModel",i.customer().CreatorEntityID),b("items",i.outlets())("required",i.fieldRequiredConfig().SignUpOutlet),s(4),f(h.invalid&&(h.dirty||h.touched)?29:-1)}},dependencies:[W,$,ee,J,Ft,St,ne,_i,Ke,Qn],styles:[".form-floating-outline[_ngcontent-%COMP%]{margin-bottom:.2rem!important}"]})};var gd=["customerForm"];function fd(n,e){n&1&&S(0,"i",6)}function bd(n,e){n&1&&S(0,"i",6)}function hd(n,e){n&1&&S(0,"i",6)}var Co=class n{dialogRef=c(G);data=c(Le,{optional:!0});storeService=c(x);eventService=c(A);customerHttpService=c(Nn);modalConfig=new te;customer=new go;fieldRequiredConfig={Mobile:!1,Email:!1,Birthdate:!1,Code:!1,Address:!1,SignUpOutlet:!1};estimatedCodeMessage="Customer code below is just an estimation, it could change in the final result";tabState=v("general");outlets=v([]);isSaved=v(!1);customerForm;constructor(){let e=this.storeService.loadForm()?.AppConfigJSON;this.outlets.set(this.storeService.loadForm()?.Entities??[]),P.IsNotEmpty(this.data)&&(this.customer.FirstName=this.data.name);let t=e?.ModuleContact?.DefaultContactGroup?.ContactGroup;P.IsNotEmpty(t)&&(this.customer.Group=t),this.customer.CreatorEntityID=this.storeService.register()?.EntityID??"",this.initRequiredConfig(e),this.initCustomerCode(e?.ModuleContact?.CodeGenerator?.AutoGenerateEnabled)}ngOnInit(){this.modalConfig.customWidth="650px",this.modalConfig.title="New Customer",this.modalConfig.bodyScrollable=!0,this.modalConfig.hideScrollbar=!0,this.customer.Gender=this.storeService.loadForm()?.AppConfigJSON?.ModuleContact?.DefaultValue?.Gender}get options(){return this.storeService.loadForm()?.CustomerOptions}get isGeneralFormInvalid(){let e=this.customerForm?.controls?.generalForm;return this.checkDirtyForm(e)}get isDetailFormInvalid(){let e=this.customerForm?.controls?.detailForm;return this.checkDirtyForm(e)}get isIdFormInvalid(){let e=this.customerForm?.controls?.idForm;return this.checkDirtyForm(e)}checkDirtyForm(e){return e?Object.keys(e.controls).every(i=>e?.controls?.[i].touched||e?.controls?.[i].dirty)&&e.invalid:!1}initRequiredConfig(e){e?.ModuleContact?.Advance?.RequiredFields?.forEach(i=>{this.fieldRequiredConfig[i]===!1&&(this.fieldRequiredConfig[i]=!0)})}initCustomerCode(e=!1){e?this.customerHttpService.getCustomerSuggestionCode().pipe(q()).subscribe(t=>{this.customer.Code=t}):this.estimatedCodeMessage=""}onKeyUpFirstName(){this.modalConfig.validated=!!this.customer.FirstName}chooiceDetail(e){this.tabState.set(e)}onOk(e){e.form.markAllAsTouched(),!e.form.invalid&&(this.isSaved()||(this.isSaved.set(!0),this.customer.Name=this.getCustomerName(),this.eventService.emit({type:"[Customer] Create",payload:{customer:this.customer}}),this.dialogRef.close()))}getCustomerName(){let e="";return e+=" "+(this.customer.FirstName?this.customer.FirstName:""),e+=" "+(this.customer.LastName?this.customer.LastName:""),e=e.trim(),e}close(e){this.dialogRef.close(null)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["dialog-customer"]],viewQuery:function(t,i){if(t&1&&et(gd,5),t&2){let o;tt(o=it())&&(i.customerForm=o.first)}},decls:20,vars:30,consts:[["customerForm","ngForm"],[3,"onOk","onCancel","onClose","config"],[1,"container",2,"height","270px"],["name","form"],[1,"row","align-items-center","border-bottom"],[1,"btn","btn-link",3,"click"],[1,"fa-regular","fa-circle-exclamation","text-danger"],[1,"mt-6"],[3,"firstNameKeyup","hidden","customer","options","fieldRequiredConfig"],[3,"hidden","customer","options","fieldRequiredConfig","estimatedCodeMessage"],[3,"hidden","customer","options","fieldRequiredConfig","outlets"]],template:function(t,i){if(t&1){let o=M();a(0,"modal-material",1),C("onOk",function(){y(o);let m=ge(4);return _(i.onOk(m))})("onCancel",function(){return i.close("cancel")})("onClose",function(){return i.close("close")}),a(1,"content")(2,"div",2)(3,"form",3,0)(5,"div",4)(6,"div")(7,"a",5),C("click",function(){return i.chooiceDetail("general")}),d(8," General "),g(9,fd,1,0,"i",6),l(),a(10,"a",5),C("click",function(){return i.chooiceDetail("detail")}),d(11," Detail "),g(12,bd,1,0,"i",6),l(),a(13,"a",5),C("click",function(){return i.chooiceDetail("id")}),d(14," ID "),g(15,hd,1,0,"i",6),l()()(),a(16,"div",7)(17,"app-general-tab",8),C("firstNameKeyup",function(){return i.onKeyUpFirstName()}),l(),S(18,"app-detail-tab",9)(19,"app-id-tab",10),l()()()()()}t&2&&(b("config",i.modalConfig),s(7),de("selected",i.tabState()=="general")("danger",i.tabState()!="general"&&i.isGeneralFormInvalid),s(2),f(i.tabState()!="general"&&i.isGeneralFormInvalid?9:-1),s(),de("selected",i.tabState()=="detail")("danger",i.tabState()!="detail"&&i.isDetailFormInvalid),s(2),f(i.tabState()!="detail"&&i.isDetailFormInvalid?12:-1),s(),de("selected",i.tabState()=="id")("danger",i.tabState()!="id"&&i.isIdFormInvalid),s(2),f(i.tabState()!="id"&&i.isIdFormInvalid?15:-1),s(2),b("hidden",i.tabState()!="general")("customer",i.customer)("options",i.options)("fieldRequiredConfig",i.fieldRequiredConfig),s(),b("hidden",i.tabState()!="detail")("customer",i.customer)("options",i.options)("fieldRequiredConfig",i.fieldRequiredConfig)("estimatedCodeMessage",i.estimatedCodeMessage),s(),b("hidden",i.tabState()!="id")("customer",i.customer)("options",i.options)("fieldRequiredConfig",i.fieldRequiredConfig)("outlets",i.outlets()))},dependencies:[W,$,Gr,Ft,Lt,Pe,Y,fo,bo,ho],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}.btn-link[_ngcontent-%COMP%]{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.selected[_ngcontent-%COMP%]{color:#3b3b3b;border-bottom:2px solid #07a519}.btn-link.danger[_ngcontent-%COMP%]{color:#c9302c}.form-floating-outline[_ngcontent-%COMP%]{margin-bottom:.2rem!important}"]})};var Cd=["customerAutocomplete"],vd=(n,e)=>({"text-danger":n,"text-custom-warning":e});function yd(n,e){if(n&1&&(a(0,"div",5)(1,"div",6)(2,"div"),d(3),l()()()),n&2){let t=e.data,i=p();s(),b("ngClass",pt(3,vd,t.StateID==i.customerState.Suspended,t.StateID==i.customerState.WaitingForApproval))("title",t.StateID==i.customerState.Suspended?"Suspended":t.StateID==i.customerState.WaitingForApproval?"Waiting for Approval":""),s(2),R(t==null?null:t.Value)}}function _d(n,e){if(n&1&&(a(0,"span",9),S(1,"i",12),a(2,"span",13),d(3),I(4,"number"),l()()),n&2){let t,i=p(2);s(3),R((t=i.currentCustomer())!=null&&t.Point?V(4,1,(t=i.currentCustomer())==null?null:t.Point):0)}}function Sd(n,e){if(n&1&&(a(0,"span"),d(1,"/"),l(),a(2,"span"),d(3),I(4,"number"),l()),n&2){let t,i=p(3);s(3),R(V(4,1,(t=i.currentCustomer())==null?null:t.DebtLimit))}}function Pd(n,e){if(n&1&&(a(0,"span",14)(1,"span",15),d(2),l(),a(3,"span"),d(4),I(5,"number"),l(),g(6,Sd,5,3),l()),n&2){let t,i,o=p(2);de("ms-3",o.isEnabledLoyaltyPoint()),s(2),O(" ",o.currencySymbol()," "),s(2),O(" ",V(5,5,(t=o.currentCustomer())==null?null:t.Debt)," "),s(2),f((((i=o.currentCustomer())==null?null:i.DebtLimit)??0)>0?6:-1)}}function xd(n,e){if(n&1&&(a(0,"span",11),S(1,"i",16),a(2,"span",13),d(3),l()()),n&2){let t,i=p(2);s(3),O(" ",(((t=i.currentCustomer())==null||t.Groups==null?null:t.Groups.length)??0)>1?`${(t=i.currentCustomer())==null||t.Groups==null?null:t.Groups.length} Groups`:(t=i.currentCustomer())==null||t.Groups==null||t.Groups[0]==null?null:t.Groups[0].Name," ")}}function Dd(n,e){if(n&1){let t=M();a(0,"div",4)(1,"div",7)(2,"div",8),C("click",function(){y(t);let o=p();return _(o.showPointModal())}),g(3,_d,5,3,"span",9),g(4,Pd,7,7,"span",10),g(5,xd,4,1,"span",11),l()()()}if(n&2){let t,i,o,r=p();s(3),f(r.isEnabledLoyaltyPoint()&&(((t=r.currentCustomer())==null?null:t.Point)??0)>0?3:-1),s(),f(r.isShowDebt()&&(((i=r.currentCustomer())==null?null:i.Debt)??0)>0?4:-1),s(),f((((o=r.currentCustomer())==null||o.Groups==null?null:o.Groups.length)??0)>0?5:-1)}}var vo=class n{role=c($e);storeService=c(x);eventService=c(A);customerService=c(ht);calculationService=c(ie);toastr=c(Q);dialog=c(Te);viewContainerRef=c(je);currentCustomer=u(()=>this.storeService.customer());customerName=u(()=>this.currentCustomer()?.Name||"");isGetCustomerById=v(!1);isEnabledLoyaltyPoint=u(()=>this.customerService.isEnabledLoyaltyPoint());isShowDebt=u(()=>this.customerService.isShowDebt());currencySymbol=u(()=>this.storeService.order().CurrencySymbol||"Rp");customerState=ol;customerAutocomplete;constructor(){this.eventService.on("[Customer] Removed").pipe(q()).subscribe(()=>{this.customerAutocomplete?.clearInput()})}onOptionSelected(e){if(this.isGetCustomerById()){let t=e?JSON.parse(e):null;this.eventService.emit({type:"[Customer] Add By Id",payload:{id:t?.Key,name:t?.Value}})}this.isGetCustomerById.set(!1)}onSearchByCode(e){this.eventService.emit({type:"[Customer] Add By Code",payload:{code:e}})}onSelectCustomer(){this.isGetCustomerById.set(!0)}onDeleteCustomer(){this.currentCustomer().Name&&this.dialog.open(Zi,{data:{title:"Re-assign customer",message:"Are you sure to re-assign the customer?"}}).afterClosed().pipe(_e(e=>e)).subscribe(()=>{this.eventService.emit({type:"[Customer] Remove",payload:{id:this.currentCustomer()?.ID}})})}openCustomerModal(){this.dialog.open(Co,{viewContainerRef:this.viewContainerRef,data:{name:this.currentCustomer()?.Name}})}showPointModal(){let e=(this.currentCustomer()?.Point??0)-(this.currentCustomer()?.PointUsed??0),t=this.calculationService.grandTotal();t>0?e>0&&this.isEnabledLoyaltyPoint()&&this.dialog.open(uo,{viewContainerRef:this.viewContainerRef}):t<0&&this.toastr.error("You cannot redeem point when amount is negative","Redeem Restricted")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=T({type:n,selectors:[["customer-autocomplete"]],viewQuery:function(t,i){if(t&1&&et(Cd,5),t&2){let o;tt(o=it())&&(i.customerAutocomplete=o.first)}},decls:6,vars:9,consts:[["customerAutocomplete",""],["itemTemplate",""],[1,"px-4","py-4","position-relative"],["requestUrl","/API/AC/GetCustomerSuggestion","placeholder","Assign Customer","inputID","ContactID","notFoundMessageFor","customer","prefixIcon","fa-light fa-user-plus","prefixIconTitle","New Customer Form","suffixIconTitle","Customer Input by typing is locked","data_cy","txt-customer","icon_data_cy","dialog-add-customer",1,"form-control","autocomplete-customer",3,"optionSelected","onInputEnter","onSelect","clickInputValue","clickPrefixIcon","useTooltip","inputTextValue","readonly","inputLock","suffixIcon","clearOnSelect","useCustomTemplate","itemTemplate"],[1,"customerPoint-tooltip","arrow-top"],[1,"d-flex","align-items-center","justify-content-between","w-100"],[1,"ms-3","text-wrap","text-break",3,"ngClass","title"],[1,"d-block"],[1,"ms-1","cursor-pointer",2,"font-size","10px",3,"click"],["matTooltip","Point"],["matTooltip","Debt",3,"ms-3"],["matTooltip","Group",1,"ms-3"],["aria-hidden","true",1,"fa","fa-star","text-primary"],[1,"ms-1"],["matTooltip","Debt"],[1,"ms-1","text-primary","fw-bold",2,"font-size","1.1em"],["aria-hidden","true",1,"fa","fa-user-group","text-primary"]],template:function(t,i){if(t&1&&(a(0,"div",2)(1,"autocompleteV2",3,0),C("optionSelected",function(r){return i.onOptionSelected(r)})("onInputEnter",function(r){return i.onSearchByCode(r)})("onSelect",function(){return i.onSelectCustomer()})("clickInputValue",function(){return i.onDeleteCustomer()})("clickPrefixIcon",function(){return i.openCustomerModal()}),l(),Re(3,yd,4,6,"ng-template",null,1,At),l(),g(5,Dd,6,3,"div",4)),t&2){let o,r=ge(4);s(),b("useTooltip",!0)("inputTextValue",i.customerName())("readonly",i.customerName())("inputLock",i.role==null||i.role.sell==null?null:i.role.sell.CustomerInputLock)("suffixIcon",!(i.role==null||i.role.sell==null)&&i.role.sell.CustomerInputLock?"fa-solid fa-text-slash":"")("clearOnSelect",!1)("useCustomTemplate",!0)("itemTemplate",r),s(4),f(i.currentCustomer()&&((((o=i.currentCustomer())==null?null:o.Point)??0)>0||(((o=i.currentCustomer())==null?null:o.Debt)??0)>0&&i.isEnabledLoyaltyPoint()||(((o=i.currentCustomer())==null||o.Groups==null?null:o.Groups.length)??0)>0)?5:-1)}},dependencies:[W,ue,la,Pe,De,Qt,Mi,K],styles:[`autocompleteV2.autocomplete-customer>mat-form-field>input{height:38px!important;border-radius:.375rem}autocompleteV2.autocomplete-customer>mat-form-field>div.position-relative>span.prefix-icon{top:10px}.customerPoint-tooltip{height:23px;background-color:#dededea8;color:#787c7c;float:left;border-radius:3px;padding:3px 8px;position:absolute;top:114px}.customerPoint-tooltip.arrow-top:after{content:" ";position:absolute;left:14px;top:-6px;border-top:none;border-right:6px solid transparent;border-left:6px solid transparent;border-bottom:7px solid rgba(222,222,222,.66)}
|