dealpos 25.37.0 → 25.37.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/{chunk-SNJEJYG2.js → chunk-2CJDU4L3.js} +1 -1
- package/browser/{chunk-FQVW7CGL.js → chunk-2LHNA5AI.js} +1 -1
- package/browser/chunk-2URCBLJ7.js +1 -0
- package/browser/{chunk-PKQIL6XI.js → chunk-2Z5J6Q7M.js} +1 -1
- package/browser/chunk-4ASACD3Q.js +1 -0
- package/browser/{chunk-ZCDMIPJU.js → chunk-4PBQC5P6.js} +1 -1
- package/browser/{chunk-AD6WDFXK.js → chunk-5432OTF7.js} +12 -12
- package/browser/{chunk-QZ3Q6NRS.js → chunk-5A5MC6CY.js} +1 -1
- package/browser/{chunk-QC47T2D6.js → chunk-5G6GUMV7.js} +1 -1
- package/browser/{chunk-RFWWJGW4.js → chunk-5MV4W4N6.js} +1 -1
- package/browser/{chunk-4WQSHRH2.js → chunk-5WG74DJT.js} +1 -1
- package/browser/{chunk-KH2UDF7R.js → chunk-5WHPKSFW.js} +1 -1
- package/browser/{chunk-OZURIMA5.js → chunk-5XLUITBY.js} +1 -1
- package/browser/{chunk-CHGBO35F.js → chunk-624G6F5C.js} +2 -2
- package/browser/{chunk-PNIMYMZP.js → chunk-6FKZY7NZ.js} +1 -1
- package/browser/chunk-6G2IT6WP.js +125 -0
- package/browser/{chunk-4DVZDOPA.js → chunk-6HQRARSZ.js} +1 -1
- package/browser/{chunk-O7KNQINR.js → chunk-6JCU4GNE.js} +1 -1
- package/browser/{chunk-BPRFPZEB.js → chunk-6WHOPHRH.js} +1 -1
- package/browser/{chunk-POVSBSKX.js → chunk-72KIMU7G.js} +1 -1
- package/browser/{chunk-UCICCJTH.js → chunk-76T3TRG4.js} +1 -1
- package/browser/{chunk-BVGEZF5R.js → chunk-7IFXHB4V.js} +1 -1
- package/browser/{chunk-XPQVQT3S.js → chunk-7ZD2267X.js} +1 -1
- package/browser/{chunk-TB75D3IU.js → chunk-A4RN7PGI.js} +1 -1
- package/browser/{chunk-UTZWX547.js → chunk-AASLGLOM.js} +1 -1
- package/browser/{chunk-TAJ6RGE7.js → chunk-ACGNZNFL.js} +1 -1
- package/browser/{chunk-RNTEPBDE.js → chunk-AHC27CIW.js} +1 -1
- package/browser/{chunk-EDWPAQ6M.js → chunk-AKPQZTEV.js} +1 -1
- package/browser/{chunk-2ROJZVYG.js → chunk-AQH2TWJK.js} +1 -1
- package/browser/{chunk-6VZV7MGQ.js → chunk-AUWH2QWX.js} +1 -1
- package/browser/{chunk-QHX47K74.js → chunk-AXEM33OC.js} +1 -1
- package/browser/{chunk-ODQBAQBJ.js → chunk-BO2Z4RGZ.js} +1 -1
- package/browser/{chunk-EWXIFMSD.js → chunk-BQJ7JR25.js} +1 -1
- package/browser/{chunk-V2XQVY7J.js → chunk-C2LSF7S2.js} +1 -1
- package/browser/{chunk-KRYHSAUY.js → chunk-CEOPBVEH.js} +1 -1
- package/browser/chunk-CFWQ2KY4.js +1 -0
- package/browser/{chunk-ZCFM5BQX.js → chunk-CJJZFHED.js} +1 -1
- package/browser/{chunk-7JQTRIEY.js → chunk-CZ2RXLZJ.js} +3 -3
- package/browser/{chunk-GTGAF77W.js → chunk-D5JRP2GG.js} +1 -1
- package/browser/{chunk-73LN2NNG.js → chunk-DGPCJB6P.js} +1 -1
- package/browser/{chunk-DJX5T4HW.js → chunk-DSIUUK4N.js} +1 -1
- package/browser/chunk-DSLMCH3G.js +1 -0
- package/browser/{chunk-5Y6LNGZI.js → chunk-DTFL44UO.js} +1 -1
- package/browser/{chunk-BJRHO7B6.js → chunk-DZ35QZ6L.js} +1 -1
- package/browser/{chunk-QZIRZTPY.js → chunk-E3GQ2VEU.js} +1 -1
- package/browser/{chunk-NZBTAJVH.js → chunk-E52CQ3NY.js} +1 -1
- package/browser/{chunk-SRND2A73.js → chunk-EANTJIRK.js} +1 -1
- package/browser/{chunk-AFOWQSNS.js → chunk-ELFCO6CE.js} +1 -1
- package/browser/{chunk-XZYKB3CY.js → chunk-EMYSF46P.js} +1 -1
- package/browser/{chunk-ZDC75EES.js → chunk-EQT4SGSU.js} +1 -1
- package/browser/{chunk-R2SCZAYC.js → chunk-FJULFWMX.js} +1 -1
- package/browser/{chunk-T3GW7VTG.js → chunk-FLEDIXNB.js} +1 -1
- package/browser/{chunk-ONUC6T7C.js → chunk-FY5VLGQC.js} +11 -11
- package/browser/chunk-G7B75J34.js +24 -0
- package/browser/{chunk-EBVXAICN.js → chunk-GAPY6IUE.js} +1 -1
- package/browser/{chunk-OYBCYKI3.js → chunk-GTRQV3VX.js} +1 -1
- package/browser/{chunk-O3BPVSF4.js → chunk-H4SCBKWD.js} +1 -1
- package/browser/{chunk-GW74DTO5.js → chunk-HHIBVND5.js} +1 -1
- package/browser/{chunk-JI5ZYBTO.js → chunk-HNX747EE.js} +1 -1
- package/browser/{chunk-LP34YRUB.js → chunk-HPGHC3LU.js} +1 -1
- package/browser/{chunk-UGMPRPX4.js → chunk-HUAA5QUE.js} +1 -1
- package/browser/{chunk-O2ZVYLBU.js → chunk-I3EBD4BM.js} +1 -1
- package/browser/{chunk-M7KCDBAN.js → chunk-IWIKKZRE.js} +1 -1
- package/browser/{chunk-YKOMJJTD.js → chunk-IWJJRPWB.js} +1 -1
- package/browser/{chunk-OQD6YPIV.js → chunk-J7WZSDR6.js} +1 -1
- package/browser/chunk-JDDFGHZC.js +1 -0
- package/browser/{chunk-USIHDJYD.js → chunk-JIYAVK6J.js} +1 -1
- package/browser/chunk-JZ7HH3AD.js +1 -0
- package/browser/{chunk-GRQCNGGD.js → chunk-K463QEUH.js} +1 -1
- package/browser/{chunk-M6LI6JL5.js → chunk-KEU6GUET.js} +1 -1
- package/browser/{chunk-TE4BS674.js → chunk-KOWDWAD2.js} +1 -1
- package/browser/{chunk-NF6DNR4C.js → chunk-KZU22HGO.js} +1 -1
- package/browser/{chunk-TKFYO4Z7.js → chunk-L4VLBO5X.js} +1 -1
- package/browser/{chunk-HN5FVXT3.js → chunk-L6G7INVR.js} +2 -2
- package/browser/{chunk-E5YR3WZZ.js → chunk-LD5LH2YH.js} +1 -1
- package/browser/{chunk-ZSHFCUED.js → chunk-LK3EGJFT.js} +1 -1
- package/browser/{chunk-NPQSMHJ5.js → chunk-LPFP4NOL.js} +1 -1
- package/browser/{chunk-D3PKJLSL.js → chunk-LUMOPVCB.js} +1 -1
- package/browser/{chunk-OJGFPN3S.js → chunk-M5R3Y6BD.js} +1 -1
- package/browser/{chunk-OPIK5VF5.js → chunk-MH3LXNOS.js} +2 -2
- package/browser/{chunk-46N7UCK4.js → chunk-N276B6EI.js} +1 -1
- package/browser/{chunk-L2BZNKXK.js → chunk-N2FNF62O.js} +1 -1
- package/browser/{chunk-CAB2DX2Y.js → chunk-N3XWBPCL.js} +1 -1
- package/browser/chunk-NDQYXKAN.js +1 -0
- package/browser/{chunk-CDHS2KPQ.js → chunk-ORFYFJKS.js} +1 -1
- package/browser/{chunk-BMXD4XFY.js → chunk-OXLXIWTF.js} +1 -1
- package/browser/{chunk-KC3ILZPL.js → chunk-PT4Y2VNN.js} +1 -1
- package/browser/{chunk-4PAT6OG2.js → chunk-PXNAXAQB.js} +1 -1
- package/browser/{chunk-UB3H2XOK.js → chunk-QRI23WCG.js} +1 -1
- package/browser/{chunk-5UVEMM3K.js → chunk-R5MMHEH6.js} +1 -1
- package/browser/{chunk-YFVKU4AG.js → chunk-RCW46J3Z.js} +1 -1
- package/browser/{chunk-2A2FK5LQ.js → chunk-SF3RHVSN.js} +1 -1
- package/browser/{chunk-N5LL2GVO.js → chunk-SOE2QU22.js} +1 -1
- package/browser/{chunk-KGEZPUKQ.js → chunk-SZDICN4P.js} +1 -1
- package/browser/{chunk-BWWLIKSO.js → chunk-TDMU55LA.js} +1 -1
- package/browser/{chunk-AIRALBLX.js → chunk-TOOIVKU3.js} +1 -1
- package/browser/{chunk-NCV64WUQ.js → chunk-TPDNCYEZ.js} +1 -1
- package/browser/{chunk-YTXPIPA3.js → chunk-UQKMHV26.js} +1 -1
- package/browser/{chunk-DTGBADKW.js → chunk-UR37FTL2.js} +1 -1
- package/browser/{chunk-VPYNMPI2.js → chunk-UTHVS7YI.js} +4 -4
- package/browser/{chunk-WNGIPTOJ.js → chunk-V55A6VFC.js} +1 -1
- package/browser/{chunk-4MQM5WKF.js → chunk-VGHP2OV6.js} +1 -1
- package/browser/{chunk-FSTU67H4.js → chunk-VWRUQ7XW.js} +1 -1
- package/browser/{chunk-YVLMNAFQ.js → chunk-VZLT2MGB.js} +1 -1
- package/browser/{chunk-6EYQ2WU4.js → chunk-WF6K2YER.js} +1 -1
- package/browser/{chunk-RQ6BETUF.js → chunk-WUZXIQKO.js} +1 -1
- package/browser/{chunk-5HPGSO2H.js → chunk-X3P7SVC6.js} +1 -1
- package/browser/{chunk-4SQ7LDSX.js → chunk-XNE22IC6.js} +2 -2
- package/browser/{chunk-BBBJXAJC.js → chunk-XOMO7AVU.js} +1 -1
- package/browser/{chunk-2N32YZ7F.js → chunk-XQCKNZ75.js} +2 -2
- package/browser/{chunk-R6DWCBDE.js → chunk-YFWHKWUO.js} +1 -1
- package/browser/{chunk-A6EXQHD5.js → chunk-YUSWA5RC.js} +1 -1
- package/browser/chunk-Z6TVE7B7.js +1 -0
- package/browser/{chunk-42GZELPL.js → chunk-ZAJBQGZU.js} +2 -2
- package/browser/{chunk-ZXBQDGF2.js → chunk-ZDJDS43F.js} +1 -1
- package/browser/{chunk-46YKB6FF.js → chunk-ZLGNHROO.js} +1 -1
- package/browser/{chunk-VTPT2NPM.js → chunk-ZWXGSLUJ.js} +1 -1
- package/browser/{chunk-D35OBUDE.js → chunk-ZZ7LHETD.js} +4 -4
- package/browser/index.html +2 -2
- package/browser/{main-ODGVJKPE.js → main-T6SFWIAO.js} +2 -2
- package/package.json +1 -1
- package/browser/chunk-24PZBJDX.js +0 -1
- package/browser/chunk-6GD3RYJT.js +0 -24
- package/browser/chunk-6KVSC3SY.js +0 -1
- package/browser/chunk-BAHRLYTL.js +0 -1
- package/browser/chunk-E7OGKKDF.js +0 -1
- package/browser/chunk-I7QI76VZ.js +0 -125
- package/browser/chunk-NKVJFEGS.js +0 -1
- package/browser/chunk-NMFTKX47.js +0 -1
- package/browser/chunk-X35FSHRI.js +0 -1
- package/browser/chunk-XQDOEZXX.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{a as ro}from"./chunk-EWXIFMSD.js";import{b as ta,c as ia}from"./chunk-HRXM4W6Y.js";import{a as Jr}from"./chunk-HZNLV6RA.js";import{b as Gr,e as zr,f as Kr,g as Yr}from"./chunk-QZIRZTPY.js";import{A as Vr,B as Gi,C as Jt,D as zi,E as jr,F as Hr,G as Yi,H as qr,I as $r,a as Sr,b as mt,c as xr,d as Oe,e as V,f as B,g as Ir,h as me,i as Or,j as Pr,k as Y,l as Mr,m as Dr,n as Pe,o as Xe,p as It,q as Me,r as $t,s as Bi,t as Fi,u as ji,v as Hi,w as oo,x as Ui,y as j,z as Nr}from"./chunk-4SQ7LDSX.js";import"./chunk-NPJ272AZ.js";import"./chunk-3TVSUUBD.js";import{a as la}from"./chunk-GSLPZSSX.js";import"./chunk-TK5H65DN.js";import"./chunk-6L6CIH5M.js";import"./chunk-IVP3GL2V.js";import{a as ra,b as aa}from"./chunk-AFOWQSNS.js";import{a as Zr,b as ea}from"./chunk-XZYKB3CY.js";import{a as kr,b as Tr,c as Er,d as qi}from"./chunk-PNIMYMZP.js";import{b as oa}from"./chunk-NILHRRUO.js";import{a as br}from"./chunk-HBNFET4C.js";import"./chunk-3PXI2XBC.js";import{b as Ri,c as ot}from"./chunk-HT35KHLT.js";import{b as Be}from"./chunk-THRGCK26.js";import"./chunk-2IT6TVBI.js";import{a as vr}from"./chunk-DYCGOJEI.js";import{a as Ti}from"./chunk-X3HEHRBU.js";import{a as na,b as Zi}from"./chunk-JTWFMMM2.js";import{a as Ar,b as Lr}from"./chunk-4F7XKKDX.js";import{c as $i,d as Ji}from"./chunk-CKB6AES2.js";import"./chunk-W2UCLTBY.js";import"./chunk-NJSJDYUI.js";import{a as Rt}from"./chunk-W4E3XWPN.js";import"./chunk-UU5RJKWG.js";import{a as qe,b as dt}from"./chunk-E5YR3WZZ.js";import"./chunk-7BU64MD2.js";import{a as Xi}from"./chunk-T3GW7VTG.js";import"./chunk-5JZJ4OL3.js";import{a as Xr}from"./chunk-P5PNY2PR.js";import"./chunk-SE7OFLAL.js";import"./chunk-NOLQHNIQ.js";import"./chunk-WLRXTHLM.js";import{a as yr,b as Br,c as Fr}from"./chunk-5HPGSO2H.js";import{a as Li}from"./chunk-ZCDMIPJU.js";import{a as Qr}from"./chunk-5VAXIJEW.js";import"./chunk-YOKPVEGO.js";import"./chunk-BYXBJQAS.js";import"./chunk-BYXBJQAS.js";import"./chunk-UCICCJTH.js";import"./chunk-I5K3C5EY.js";import"./chunk-OLALZT3L.js";import"./chunk-DWWBB3GE.js";import"./chunk-6N4AU5UX.js";import"./chunk-BYXBJQAS.js";import{a as gi}from"./chunk-6VZV7MGQ.js";import{a as xe,c as Ai}from"./chunk-TBQI2P7D.js";import{a as no}from"./chunk-B5FODXLM.js";import"./chunk-6365PJN3.js";import{c as fi}from"./chunk-VOU4625O.js";import{a as Ei}from"./chunk-I4MJUIXL.js";import{a as Ni,b as Vi}from"./chunk-BWOG3YI3.js";import"./chunk-O7MCO2N7.js";import{a as io}from"./chunk-UZKYLAUE.js";import{a as wr,b as Qi}from"./chunk-EBVXAICN.js";import{a as Ki,b as Ur,c as Wr}from"./chunk-47MDCKEY.js";import{a as Ot,b as Wi}from"./chunk-YVLMNAFQ.js";import{b as Mi,c as St,d as yt,e as Wt}from"./chunk-M6LI6JL5.js";import{a as Rr}from"./chunk-TGAOY65D.js";import{d as wi,e as ki}from"./chunk-O3BPVSF4.js";import{a as lr}from"./chunk-UBUC3CPO.js";import{d as Cr,e as hr}from"./chunk-WNGIPTOJ.js";import"./chunk-POVSBSKX.js";import"./chunk-3RK6DDJD.js";import"./chunk-L2EDFSBR.js";import{a as sr}from"./chunk-XX6Z7QPA.js";import"./chunk-5Y6LNGZI.js";import"./chunk-TEFNN3TY.js";import"./chunk-CAB2DX2Y.js";import"./chunk-JKYTSC2D.js";import"./chunk-VQ7WKMGF.js";import{a as _r}from"./chunk-O7KNQINR.js";import{a as er,b as tr,c as ir}from"./chunk-DJX5T4HW.js";import"./chunk-RBCKIP6D.js";import"./chunk-FD5YMPRL.js";import"./chunk-MV3QRRW6.js";import"./chunk-3LBZWLLT.js";import"./chunk-LZNTSIJX.js";import"./chunk-C6ARCDXZ.js";import{a as ar,b as cr}from"./chunk-6EYQ2WU4.js";import"./chunk-52EOLV7I.js";import{a as Ko}from"./chunk-5UL73W4S.js";import{a as ut,c as pt}from"./chunk-LNVTHMH7.js";import{a as nr,d as or,f as rr}from"./chunk-6ZOGADBZ.js";import{C as gr,D as Ye,F as qt,G as xt,u as U,v as W,w as Ae}from"./chunk-ONUC6T7C.js";import{b as se,c as Ke}from"./chunk-CIBQBSM6.js";import{G as fr,O as Qt,P as fe,a as pr,b as mr,n as Di,v as dr,y as ur}from"./chunk-IX5URHI7.js";import{a as Ho}from"./chunk-ZT4RBJMM.js";import"./chunk-GIKR6Y2K.js";import{d as nt}from"./chunk-LPGMI3V2.js";import{e as F,f as Ve,g as ne}from"./chunk-D35OBUDE.js";import{M as Yo,Z as Xo,_ as Zo}from"./chunk-567HXZXC.js";import"./chunk-I7VBCYOO.js";import"./chunk-CGESXTHC.js";import{a as Le}from"./chunk-2FWFPV5I.js";import"./chunk-TLOTIYIE.js";import{A as jt,D as Go,F as Ce,G as ze,a as Uo,b as ht,c as te,d as Wo,e as ui,g as Qo,h as K,j as qo,l as bt,m as $o,o as ie,r as Jo,s as vt}from"./chunk-2RSBMS36.js";import{a as Ft,c as Ut}from"./chunk-5UVEMM3K.js";import{a as zo}from"./chunk-OQD6YPIV.js";import{a as S,d as Ht}from"./chunk-AHCRE4GP.js";import"./chunk-FSTU67H4.js";import{$a as s,$b as ye,Ab as to,Ac as O,Ba as Io,Bc as pe,Cc as Ge,Db as R,E as ce,Eb as si,Fa as He,Fc as G,Gb as ci,Hb as pi,I as li,Ia as Oo,Ib as r,Ja as lt,Jb as a,Ka as Po,Kb as h,Kc as No,Lb as x,M as So,Ma as q,Mb as I,Md as Fo,N as Vt,Nb as mi,Ob as v,Od as jo,Qb as _,Qd as Ct,Rb as c,Rd as Lt,Sc as Vo,Td as Bt,Ub as di,Va as xi,Vb as To,Vd as ee,Wa as tt,Wc as H,Y as At,Yc as _e,Yd as Qe,Za as it,Zb as ve,Zc as $,_b as Se,aa as Ee,ad as Ao,bc as Eo,bd as Pi,c as ho,cb as Mo,cc as Ro,cd as Ne,d as z,da as k,db as d,dc as Q,e as Xn,ec as m,ed as We,fa as Re,fc as T,gb as Do,gc as y,gd as X,hc as Ue,ia as yo,id as Lo,ja as at,jc as M,jd as Z,k as bo,ka as gt,kb as P,kc as D,lb as _t,lc as w,ma as A,mb as Ii,md as Bo,na as oe,o as Zn,ob as Oi,pc as st,qb as g,qc as ct,rc as E,sc as ge,t as et,tc as Et,u as yi,ua as xo,ub as wo,va as u,vb as p,wa as f,wb as eo,xb as ko,z as vo,zb as be,zc as b}from"./chunk-DZT5XHBQ.js";import{j as Co}from"./chunk-7DCB7DB2.js";var en=class{ID;Code;Name;Title;Field;Address;ContactInfo;Logo;FooterLeft;FooterRight;FooterNote;PrintMode;PrintLX300;DeliveryNote;AppendQR;ItemRenderMode;CssClass;RemoveImage;DisplayName;DisplayNameCode};var Gt=class{ParkLabel;Note;NumberOfPerson;ID;Alias;Created;CustomerDisplay;Number;Duration};var tn=class n{constructor(t,e,i,o,l,C){this.dialogRef=t;this._orderProcessorService=e;this._posService=i;this.salesOrderService=o;this.parkService=l;this.data=C;this.initModalDialog(),this.initConfig(),this.parkLabel=C.ParkLabel,this.form.ParkLabel=C.ParkLabel,this.form.Note=o.Data.Order.Note}modalConfig=new U;labelPlaceholder;form=new Gt;parkLabel;initConfig(){let t=this._posService.Data.AppConfigJSON;this.labelPlaceholder=t.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkLabelPlaceholder}initModalDialog(){this.modalConfig.title=this.data.title,this.modalConfig.customWidth="600px"}onOk(){this.setParkTitle(),this.parkService.park(this.form).subscribe(t=>{this.dialogRef.close(!0)})}setParkTitle(){let t=this._orderProcessorService.Data.posState,e=this.salesOrderService.Data.Order.Number;t==5?this.salesOrderService.Data.SplitParkLabel=S.IsEmpty(this.parkLabel)?e:this.parkLabel:S.IsEmpty(this.parkLabel)?this.form.ParkLabel=e:this.form.ParkLabel=this.parkLabel}static \u0275fac=function(e){return new(e||n)(d(F),d(j),d(B),d(V),d(we),d(Ve))};static \u0275cmp=P({type:n,selectors:[["POS-modal-park-input"]],standalone:!1,decls:17,vars:3,consts:[[3,"onCancel","onOk","onClose","config"],[1,"ods-info-box"],[1,"fas","fa-info-circle",2,"font-size","1.2rem","margin-top","2px"],["href","https://ods.dealpos.app","target","_blank",2,"color","#0d6efd","font-weight","600","text-decoration","underline"],[1,"w-100","mt-4"],[1,"mb-3"],["type","text","required","","placeholder","E.g. Mr. John Doe","matTooltip","Same as Order Number when blank",1,"form-control","w-100","height-input",3,"ngModelChange","ngModel"],["placeholder","ex: Customer will return tommorow",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onCancel",function(){return i.dialogRef.close()})("onOk",function(){return i.onOk()})("onClose",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1),h(3,"i",2),r(4,"div"),m(5," Use our "),r(6,"a",3),m(7," Order Display Fulfillment System "),a(),m(8," to view the Parked Orders from your warehouse area. "),a()(),r(9,"div",4)(10,"strong",5),m(11,"Label"),a(),r(12,"input",6),w("ngModelChange",function(l){return D(i.parkLabel,l)||(i.parkLabel=l),l}),a()(),r(13,"div",4)(14,"strong",5),m(15,"Note"),a(),r(16,"POS-tinymce-editor",7),w("ngModelChange",function(l){return D(i.form.Note,l)||(i.form.Note=l),l}),a()()()()),e&2&&(p("config",i.modalConfig),s(12),M("ngModel",i.parkLabel),s(4),M("ngModel",i.form.Note))},dependencies:[te,K,jt,ie,W,se,Ot],styles:[".height-input[_ngcontent-%COMP%]{height:36px} ng-select.park-detail>div.ng-select-container{border-radius:0!important}.deposit[_ngcontent-%COMP%] .ng-select{width:auto!important}.ods-info-box[_ngcontent-%COMP%]{background-color:#e8f4fd;border-left:4px solid #0dcaf0;padding:16px 20px;border-radius:8px;font-family:Roboto Slab,sans-serif;color:#055160;display:flex;align-items:flex-start;gap:10px;font-size:14px;max-width:600px;margin:0 auto}"]})};var nn=class n{constructor(t){this._dialogRef=t;this.modalConfig=new U,this.modalConfig.title="Select Print Type",this.modalConfig.hideFooter=!0}modalConfig;onPrintOrder(){this._dialogRef.close("ORDER")}onPrintBill(){this._dialogRef.close("BILL")}static \u0275fac=function(e){return new(e||n)(d(F))};static \u0275cmp=P({type:n,selectors:[["POS-modal-print"]],standalone:!1,decls:17,vars:1,consts:[[3,"onCancel","onClose","config"],[1,"d-flex"],[1,"btn","btn-gray","btn-lg","me-1",3,"click"],["src","//res.cloudinary.com/pos/image/upload/v1650423915/icons/order.png"],[1,"mt-1"],[1,"mt-0"],[1,"btn","btn-gray","btn-lg","ms-1",3,"click"],["src","//res.cloudinary.com/pos/image/upload/v1650423915/icons/bill.png",2,"width","23px"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onCancel",function(){return i._dialogRef.close()})("onClose",function(){return i._dialogRef.close()}),r(1,"content")(2,"div",1)(3,"a",2),_("click",function(){return i.onPrintOrder()}),h(4,"img",3),r(5,"h4",4),m(6,"Order"),a(),r(7,"div",5),m(8,"For order for the kitchen"),a()(),r(9,"a",6),_("click",function(){return i.onPrintBill()}),h(10,"img",7),r(11,"h4",4),m(12,"Bill"),a(),r(13,"div",5),m(14,"To see amount of the bill"),a(),r(15,"div",5),m(16,"(Pre-settlement bill)"),a()()()()()),e&2&&p("config",i.modalConfig)},dependencies:[W],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-gray[_ngcontent-%COMP%]{background-color:#f4f4f4;border:1px solid #D6D6D6;font-weight:700;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}.btn[_ngcontent-%COMP%]{padding:8px 0;width:190px;margin-right:10px}.btn[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{font-weight:700;text-transform:uppercase}.btn[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{font-size:.75rem;font-style:italic;color:#868686;margin-top:10px}"]})};var Ea=(n,t,e)=>({"unselect-card":n,"card-select":t,"card-available":e}),Ra=n=>({"text-secondary":n}),Na=(n,t)=>({"bg-danger-subtle text-inactive":n,"bg-success text-white":t}),Va=(n,t)=>({"text-secondary":n,"text-success":t});function Aa(n,t){if(n&1&&h(0,"i",7),n&2){let e=c();be(e.icon()),p("ngClass",ge(3,Va,e.isOccupied(),!e.isOccupied()))}}var on=class n{title=lt("Park Order");isOccupied=lt(!0);alias=lt("A1");icon=lt("fa-solid fa-star");selected=lt(!1);onEventSelect=Oo({alias:"onSelect"});onSelect(){this.isOccupied()==!1&&this.onEventSelect.emit(this.title())}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["park-card"]],inputs:{title:[1,"title"],isOccupied:[1,"isOccupied"],alias:[1,"alias"],icon:[1,"icon"],selected:[1,"selected"]},outputs:{onEventSelect:"onSelect"},decls:9,vars:15,consts:[[1,"card","m-0","bg-light","border","border-2","bg-opacity-25","rounded",3,"click","ngClass"],[1,"card-body"],[1,"d-flex","align-items-center","justify-content-between","flex-column"],[1,"d-flex","align-items-center","gap-3"],[1,"fa-xl","text-success",3,"ngClass","class"],[3,"ngClass"],[1,"py-2","px-5","rounded-pill","mt-7","fw-normal","border",3,"ngClass"],[1,"fa-xl","text-success",3,"ngClass"]],template:function(e,i){e&1&&(r(0,"div",0),_("click",function(){return i.onSelect()}),r(1,"div",1)(2,"div",2)(3,"div",3),g(4,Aa,1,6,"i",4),r(5,"h4",5),m(6),a()(),r(7,"div",6),m(8),a()()()()),e&2&&(p("ngClass",Et(6,Ea,!i.selected(),i.selected()&&!i.isOccupied(),!i.isOccupied())),s(4),R(i.icon()?4:-1),s(),p("ngClass",E(10,Ra,i.isOccupied())),s(),y(" ",i.title()," "),s(),p("ngClass",ge(12,Na,i.isOccupied(),!i.isOccupied())),s(),y(" ",i.isOccupied()?"Occupied":"Available"," "))},dependencies:[Z,H],styles:[".text-inactive[_ngcontent-%COMP%]{color:#b98181}.card-available[_ngcontent-%COMP%]{cursor:pointer;transition:all .3s ease;transform:translateY(0)}.card-available[_ngcontent-%COMP%]:hover{transform:translateY(-6px);box-shadow:0 2px 4px #00000026,0 0 2px 1px #c0f4cb;border-color:#81c784!important;background-color:#fff!important}.card-select[_ngcontent-%COMP%]{background-color:#ffffe1!important;border-color:#89b03e!important}.unselect-card[_ngcontent-%COMP%]{border-color:transparent!important}"]})};var La=n=>({"mat-tab-group-height":n});function Ba(n,t){if(n&1){let e=v();r(0,"div",2)(1,"div",6)(2,"span",7),h(3,"i",8),a(),r(4,"input",9),w("ngModelChange",function(o){u(e);let l=c();return D(l.filter,o)||(l.filter=o),f(o)}),a()()()}if(n&2){let e=c();s(4),M("ngModel",e.filter)}}function Fa(n,t){if(n&1&&(r(0,"h5",14),h(1,"i"),r(2,"span"),m(3),a()()),n&2){let e=c().$implicit;s(),be(e.Icon),s(2),T(e.Name)}}function ja(n,t){if(n&1){let e=v();r(0,"div",13)(1,"park-card",15),_("onSelect",function(){let o=u(e).$implicit,l=c(2);return f(l.onSelect(o))}),a()()}if(n&2){let e,i=t.$implicit,o=c().$implicit,l=c();s(),p("title",l.replaceWithAlias()&&i.Alias?i.Alias:i.Name)("alias",i.Alias)("isOccupied",i.IsOccupied)("icon",o.Icon)("selected",((e=l.parkOptionSelected())==null?null:e.Name)===i.Name)}}function Ha(n,t){if(n&1&&(r(0,"mat-tab",4),g(1,Fa,4,3,"ng-template",10),r(2,"div",11)(3,"div",12),ci(4,ja,2,5,"div",13,si),b(6,"Filter"),a()()()),n&2){let e=t.$implicit,i=c();p("label",e.Name),s(4),pi(Ge(6,1,e.Options,i.filter(),"Name"))}}function Ua(n,t){if(n&1){let e=v();r(0,"div",5)(1,"POS-tinymce-editor",16),w("ngModelChange",function(o){u(e);let l=c();return D(l.parkNote,o)||(l.parkNote=o),f(o)}),a()()}if(n&2){let e=c();s(),M("ngModel",e.parkNote)}}var Kt=class n{constructor(t){this.data=t;this.parkLayout.set(t.parkLayoutPack),this.replaceWithAlias.set(t.replaceWithAlias),this.initModalConfig(),this.showInputNote.set(this.posService.Data?.AppConfigJSON?.ApplicationParkAndRetrieve?.NumberOfPerson)}dialog=oe(ne);dialogRef=oe(F);orderProcessorService=oe(j);salesOrderService=oe(V);posService=oe(B);modalConfig=new U;filter=q("");parkLayout=q(null);parkOptionSelected=q(null);replaceWithAlias=q(!1);showInputNote=q(!1);parkNote=q("");initModalConfig(){this.modalConfig.title=this.data.title||"Park Order",this.modalConfig.customWidth="700px",this.modalConfig.bodyScrollable=!0,this.modalConfig.okText=" Park "}onSelect(t){this.parkOptionSelected.set(t)}onOk(){this.showInputNote()&&(this.parkOptionSelected().Note=this.parkNote()),this.dialogRef.close(this.parkOptionSelected())}onCancel(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(Ve))};static \u0275cmp=P({type:n,selectors:[["app-modal-park"]],decls:8,vars:6,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container",2,"max-height","395px","min-height","395px"],[1,"search-container"],["mat-stretch-tabs","false",1,"mt-2",3,"ngClass"],[3,"label"],[1,"mt-4"],[1,"input-group","w-100"],[1,"input-group-text","txtFilter","rounded-start-1"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["type","text","placeholder","Search by number or note","aria-label","Search",1,"txtFilter","form-control","border-start-0","rounded","rounded-start-0",3,"ngModelChange","ngModel"],["mat-tab-label",""],[1,"container","mt-5"],[1,"row"],[1,"col-3","mb-4","px-2"],[1,"d-flex","align-items-center","gap-3"],[3,"onSelect","title","alias","isOccupied","icon","selected"],["height","180px","placeholder","Input the park note (E.g. this is for Mr. John)",3,"ngModelChange","ngModel"]],template:function(e,i){if(e&1&&(r(0,"modal-material",0),_("keydown.F2",function(){return i.onOk()})("onOk",function(){return i.onOk()})("onCancel",function(){return i.onCancel()})("onClose",function(){return i.onCancel()}),r(1,"content")(2,"div",1),g(3,Ba,5,1,"div",2),r(4,"mat-tab-group",3),ci(5,Ha,7,5,"mat-tab",4,si),a(),g(7,Ua,2,1,"div",5),a()()()),e&2){let o,l,C;p("config",i.modalConfig),s(3),R(((o=i.parkLayout().Layout)==null?null:o.length)>0?3:-1),s(),p("ngClass",E(4,La,i.showInputNote()&&((l=i.parkOptionSelected())==null?null:l.Name))),s(),pi(i.parkLayout().Layout),s(2),R(i.showInputNote()&&((C=i.parkOptionSelected())!=null&&C.Name)?7:-1)}},dependencies:[Z,H,Ae,W,on,Qt,dr,Ce,te,K,ie,Wt,Mi,St,yt,Wi,Ot],styles:["[_nghost-%COMP%] .mat-mdc-tab-group[_ngcontent-%COMP%]{--mdc-tab-indicator-active-indicator-color: #89b03e;--mat-tab-header-focus-indicator-color: #89b03e;--mat-tab-header-focus-label-text-color: var(--bs-body-color);--mat-tab-header-active-label-text-color: var(--bs-body-color);--mat-tab-header-active-focus-label-text-color: var(--bs-body-color);--mat-tab-header-active-hover-label-text-color: var(--bs-body-color);--mat-tab-header-active-focus-indicator-color: #89b03e;--mat-tab-header-active-hover-indicator-color: #89b03e}[_nghost-%COMP%] .mat-mdc-tab-header{border-bottom:1px solid var(--bs-border-color)}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%]{transition:all .3s ease}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]{position:relative;transition:all .3s ease;height:2.3rem}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover, [_nghost-%COMP%] .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}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]{transition:all .3s ease;border-left:none!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]:focus{box-shadow:none!important;border-color:#ced4da!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .input-group-text[_ngcontent-%COMP%]{transition:all .3s ease;background-color:#fff;border-right:none!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .input-group-text[_ngcontent-%COMP%], [_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .input-group-text[_ngcontent-%COMP%]{background-color:#89b03e1a;border-color:#84cc16!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .fa-magnifying-glass[_ngcontent-%COMP%]{transition:all .3s ease}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .fa-magnifying-glass[_ngcontent-%COMP%], [_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .fa-magnifying-glass[_ngcontent-%COMP%]{color:#84cc16!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e66,0 0 12px 6px #89b03e40!important}[_nghost-%COMP%] .mat-tab-group-height[_ngcontent-%COMP%]{height:165px}"]})};var an=class n{constructor(t,e,i,o,l,C,N,ae,ke){this.dialogRef=t;this.parkOrderRetrieve=e;this._orderDataService=i;this._posHttpResponseService=o;this._orderProcessorService=l;this._orderHttpService=C;this._dialog=N;this._outletRegisterService=ae;this.parkService=ke;this.salesOrderData=this._orderDataService.Data,this.appConfig=this._posHttpResponseService.Data.AppConfigJSON,this.parkLayoutPack=this._outletRegisterService.Data.ParkLayoutPack}modalConfig=new U;salesOrderData;appConfig;parkLayoutPack;ngOnInit(){this.modalConfig.title="Re-Park Order?",this.modalConfig.hideFooter=!0}onRepark(){this.parkService.park(this.parkOrderRetrieve).subscribe(t=>{this.dialogRef.close()})}onMove(){this.dialogRef.close(),this.showParkSelectModal()}showParkSelectModal(){this._orderHttpService.getVacant(this.salesOrderData.Order.EntityID).subscribe(t=>{this._dialog.open(Kt,{data:{title:this.title,parkLayoutPack:this.parkLayoutPack,replaceWithAlias:this.appConfig.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias}})})}get title(){return this._orderProcessorService.Data.posState==5?"Split Order":this.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkDialogTitle}static \u0275fac=function(e){return new(e||n)(d(F),d(Ve),d(V),d(B),d(j),d(Oe),d(ne),d(Y),d(we))};static \u0275cmp=P({type:n,selectors:[["POS-modal-repark"]],standalone:!1,decls:13,vars:2,consts:[[3,"onClose","onCancel","title","config"],[1,"d-flex"],[1,"btn","btn-gray","btn-lg",3,"click"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onClose",function(){return i.dialogRef.close()})("onCancel",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1)(3,"a",2),_("click",function(){return i.onRepark()}),r(4,"h4"),m(5,"Re-Park"),a(),r(6,"span"),m(7,"Store order to same location"),a()(),r(8,"a",2),_("click",function(){return i.onMove()}),r(9,"h4"),m(10,"Move"),a(),r(11,"span"),m(12,"Shift order to Different location"),a()()()()()),e&2&&p("title","Re-Park Order?")("config",i.modalConfig)},dependencies:[W],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-gray[_ngcontent-%COMP%]{background-color:#f4f4f4;border:1px solid #D6D6D6;font-weight:700;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}.btn[_ngcontent-%COMP%]{padding:25px 0;width:190px;margin-right:10px}.btn[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{font-weight:700;text-transform:uppercase}.btn[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:.75rem;font-style:italic;color:#868686;margin-top:10px}"]})};var Yt=class{Name;Alias;IsOccupied;Note};var ln=class{_point;get point(){return this._point}set point(t){this._point=t}_pricebookID;get pricebookID(){return this._pricebookID}set pricebookID(t){this._pricebookID=t}_discountRate;get discountRate(){return this._discountRate}set discountRate(t){this._discountRate=t}_groups;get groups(){return this._groups}set groups(t){this._groups=t}_salesID;get salesID(){return this._salesID}set salesID(t){this._salesID=t}_dueDays;get dueDays(){return this._dueDays}set dueDays(t){this._dueDays=t}_expiryDate;get expiryDate(){return this._expiryDate}set expiryDate(t){this._expiryDate=t}_debt;get debt(){return this._debt}set debt(t){this._debt=t}_expirtedString;get expirtedString(){return this._expirtedString}set expirtedString(t){this._expirtedString=t}_loyaltyDisabled;get loyaltyDisabled(){return this._loyaltyDisabled}set loyaltyDisabled(t){this._loyaltyDisabled=t}_taxTypeID;get taxTypeID(){return this._taxTypeID}set taxTypeID(t){this._taxTypeID=t}_entityID;get entityID(){return this._entityID}set entityID(t){this._entityID=t}_mobile;get mobile(){return this._mobile}set mobile(t){this._mobile=t}_email;get email(){return this._email}set email(t){this._email=t}_dueMonths;get dueMonths(){return this._dueMonths}set dueMonths(t){this._dueMonths=t}_memberIdentification;get memberIdentification(){return this._memberIdentification}set memberIdentification(t){this._memberIdentification=t}};var _i=class{OutletName;Status;AmountSummary;Coupon;Creator;CurrencySymbol;Customer;Date;Delivery;ExtraNote;FinalAmount;InvoiceNote;Items;LoyaltyPoint;Payments;PrintDate;RegisterCode;SalesOrderItemCommission;Shipping;Title;TypeName;PaymentState;ToP;Due;InvoiceID;Gopay;Number;Created;SalesName;ParkLabel;HeaderTitle;QRContent;Retur;AfterSell;constructor(){this.OutletName="",this.Status=1,this.AmountSummary=[],this.Coupon="",this.Creator="",this.CurrencySymbol="",this.Customer=new ln,this.Date="",this.Delivery={Number:""},this.ExtraNote="",this.FinalAmount=0,this.InvoiceNote="",this.Items=[],this.LoyaltyPoint="",this.Payments=[],this.PrintDate="",this.RegisterCode="",this.SalesOrderItemCommission={SalesName:""},this.Shipping=new fi,this.Title="",this.TypeName="",this.PaymentState=0,this.InvoiceID="",this.Number="",this.Created="",this.AfterSell=!0}};var Xt=class{LayoutPack;constructor(t){this.LayoutPack=t,this.GenerateLayoutOption()}GenerateLayoutOption(){this.LayoutPack!=null&&this.LayoutPack.Layout&&this.LayoutPack.Layout.forEach(t=>{t.Options=[];for(let e=1;e<=t.Size;e++){let i=new Yt;i.Name=t.Name+e,i.Alias=this.GetAlias(i.Name),t.Options.push(i)}})}GetAlias(t){if(this.LayoutPack!=null&&this.LayoutPack.Alias){let e=this.LayoutPack.Alias.filter(i=>i.Name==t);return e.length>0?e[0].Alias:t}return""}};var sn=class{ExtraNote;Title;Customer;SalesName;InvoiceNote;Date;Items;AmountSummary;Creator;NumberOfPerson;CurrencySymbol;constructor(){this.ExtraNote="",this.Title="",this.Customer="",this.SalesName="",this.InvoiceNote="",this.Date="",this.Items=[],this.AmountSummary=[],this.Creator="",this.NumberOfPerson=0,this.CurrencySymbol="Rp"}};var cn=class{AmountSummary;Contact;ContactDisplay;CurrencySymbol;FinalAmount;HeaderTitle;Invoice;IsPrice;Items;LoyaltyPoint;Order;Payments;PriceVisible;PrintPerson;PrintTime;SalesName;Shipping;TotalInWord};var Mt=class n{constructor(t,e,i,o,l,C,N,ae){this._posService=t;this._orderDataService=e;this._cashierCalculatorService=i;this._outletService=o;this._OrderHttpService=l;this._receiptCalculatorService=C;this._orderProcessorService=N;this._customerHttpService=ae;this.subscribeToObservableChanges()}posData;completeData;park=new Xt(null);outletInfo=new Ai;datePipe=new We("en-US");ParkTemp=Array();CartItems=[];get posStorage(){return this._posService.Data}get AppConfigJSON(){return this._posService.Data.AppConfigJSON}subscribeToObservableChanges(){this._orderDataService.Data$.subscribe(t=>{this.posData=t}),this._OrderHttpService.Data$.subscribe(t=>{this.completeData=t}),this._outletService.Data$.subscribe(t=>{this.outletInfo=t}),this._orderProcessorService.Data$.subscribe(t=>{this.ParkTemp=t.parkTemporaryItem})}generateReceiptMini(){let t=new _i;t.HeaderTitle=this.AppConfigJSON.PrintConfigInvoice.HeaderTitle,t.OutletName=this.outletInfo.EntityName,t.ExtraNote=this.getParkLabel(),t.Customer=this.getSubmitedCustomer(),t.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),t.SalesOrderItemCommission={SalesName:this._outletService.getSalesname(this.posData.Order.SalesID)},t.Number=this.completeData?.InvoiceNumber,t.FinalAmount=this.completeData?.Final,t.InvoiceNote=this.posData.Order.Note,t.RegisterCode=this.outletInfo.RegisterCode==null?"":this.outletInfo.RegisterCode,t.QRContent=this.generateQrContent(),t.InvoiceID=this.completeData?.ObjectID,t.Retur=S.IsNotEmpty(this.posData?.Invoice?.ReferenceInvoiceID),t.Date=this.getSubmitedOrderDate(),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.InvoiceCreatedTimeVisible&&(t.Created=this.datePipe.transform(new Date,"dd MMM yyyy")),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.OrderTimeVisible&&(t.Created=this.datePipe.transform(new Date,"dd MMM yyyy HH:mm:ss")),this.posData.CartItems.forEach(i=>{i.SalesID&&(i.SalesName=this._outletService.getSalesname(i.SalesID))}),t.Items=this.posData.CartItems,t.Customer!=null&&t.Customer.Display!=null&&t.Customer.Display!=null&&t.Customer.Display!=null&&(t.Customer={ID:this.posData.Order.CustomerID,Display:this.posData.ContactName,Email:t.Customer.Email,CityName:null,Address:t.Customer.Address,Code:t.Customer.Code,Name:t.Customer.Name,Phone:t.Customer.Phone,Mobile:t.Customer.Mobile,NationalIDNumber:t.Customer.NationalIDNumber,Title:t.Customer.Title}),t.Delivery={Number:this.posData.Order.Number};let e=S.FilterByID(this.posStorage.PoTypes,this.posData.Order.TypeID);if(e!==null&&(t.TypeName=e.Name),t.Shipping=this.generateShippingData(),this.AppConfigJSON.PrintConfigInvoice.ItemsTable.ItemWithoutPriceVisible||(t.Items=t.Items.filter(i=>i.Price!=0)),t.Coupon=this.posData.Order.PromotionCoupon,t.LoyaltyPoint=this.completeData?this.completeData.LoyaltyPoint:"",t.FinalAmount=this._cashierCalculatorService.Data,t.CurrencySymbol=this._cashierCalculatorService.currencySymbol,t.PaymentState=this.getPaymentState(),t.Payments=this.posData.Payments,t.Payments.forEach(i=>{i.MethodName=this.findPaymentName(i.MethodID)}),t.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),t.Creator=this.completeData?.Creator?this.completeData?.Creator:this.posStorage?.UserName,this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.InvoicePaymentTermsVisible&&this.posData.Payments.length==0){let i=this.posData.Invoice.Due?new Date(this.posData.Invoice.Due):null,o=new Date(this.posData.Order.Date);o.setHours(0,0,0,0),t.ToP=this.generateTop(o,i),this.posData.Invoice.Due!==void 0&&(t.Due=this.datePipe.transform(new Date(this.posData.Invoice.Due),"dd MMMM yyyy"))}return t}generateQrContent(){let t="";if(this.AppConfigJSON?.PrintConfigInvoice?.InvoiceQR?.TransformTo==3){let i=this.AppConfigJSON?.PrintConfigInvoice?.InvoiceQR?.Content,o=this.posData?.Order?.Number,l=this.completeData.ObjectID,C=window?.location?.host;switch(i){case 2:t=l;break;case 1:t=o;break;case 3:t=`receipt.dealpos.app?Data=${btoa(`${l}_${C}`)}`;break}}return t}generateShippingData(){return{City:this.posData.Shipping!==null?this.posData.Shipping.City:null,Description:this.posData.Shipping!==null?this.posData.Shipping.Address:null,ID:null,Phone:this.posData.Shipping!==null?this.posData.Shipping.Phone:null,Recipient:this.posData.Shipping!==null?this.posData.Shipping.Name:null,SalesOrderID:null,Sender:null,SenderAddress:null,SenderCity:null,SenderPhone:null,Street:null}}generateParkReceipt(t=!0,e=!1){let i=new sn;if(i.ExtraNote=S.StringFormat("{0} #{1}",this.AppConfigJSON.ApplicationParkAndRetrieve.PrintOutput.NumberPrefix,this.GetSubmittedNumber()),i.Title=this.getParkLabel(),i.Customer=this.getSubmitedCustomer(),i.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),i.InvoiceNote=this.posData.Order.Note,i.Date=this.getSubmitedOrderDate(),i.CurrencySymbol=this._cashierCalculatorService.currencySymbol,this.getItemsParkReceipt(t,e),i.Items=this.CartItems,i.Creator=this.posStorage.UserName,i.NumberOfPerson=this.posData.Order.NumberOfPerson,this.AppConfigJSON.ApplicationParkAndRetrieve.PrintOutput.AmountVisible){let o=JSON.parse(JSON.stringify(this._receiptCalculatorService.generateAmountSummary()));i.AmountSummary=o}return i}getItemsParkReceipt(t,e){let i=ot(Be,this.posData.CartItems);if(e){let o=this.posData.CartItems.filter(l=>S.IsNotEmpty(l.SplitQuantity)&&l.SplitQuantity>0);this.CartItems=o.map(l=>(l.Quantity=l.SplitQuantity,l))}else if(t&&this.AppConfigJSON.ApplicationParkAndRetrieve.PrintBehaviour.PrintAdditionalItemsOnlyOnRePark)if(this.CartItems=Array(),this.ParkTemp.length>0)for(let o of i){let l=this.ParkTemp.find(C=>C.ID==o.ID);l==null?this.CartItems.push(o):o.Quantity!=l.Quantity&&(o.Quantity=o.Quantity-l.Quantity,this.CartItems.push(o))}else this.CartItems=i;else this.CartItems=i}generateBillInvoice(){let t=new cn;return t.ContactDisplay=this.posData.ContactName,t.Invoice=this.posData.Invoice,t.Order=this.posData.Order,t.Payments=this.posData.Payments,t.Shipping=this.posData.Shipping,t.CurrencySymbol=this._cashierCalculatorService.currencySymbol,t.FinalAmount=this._cashierCalculatorService.Data,t.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),t.Contact=this.getSubmitedCustomer(),t.Items=this.getItemsBillInvoice(),t.PrintTime=this.datePipe.transform(new Date,"dd MMM yyyy HH:mm"),t.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),t.HeaderTitle=this.AppConfigJSON.PrintConfigInvoice.HeaderTitle,t.Invoice.Number=`#${this.posData.Order.Number}`,t.Invoice.Date=new Date,t.Invoice.PaymentStateID=1,t.Invoice.Note=this.posData.Order.Note,t.PrintPerson="",t.IsPrice=!0,t.PriceVisible=!0,t}getItemsBillInvoice(){return this.posData.CartItems.map(e=>({Name:e.Variant.Name,Quantity:e.Quantity,Code:e.Variant.Code,UnitPrice:e.Price,Discount:e.Discount,UOMName:e.Variant.UOMName,Total:e.Total,Note:e.Note}))}generateBillReceipt(){let t=new _i;t.HeaderTitle=this.AppConfigJSON.PrintConfigInvoice.HeaderTitle,t.ParkLabel=this.posData.Order.ParkLabel,t.OutletName=this.outletInfo.EntityName,t.ExtraNote=this.getParkLabel(),t.Customer=this._customerHttpService.Data,t.SalesOrderItemCommission.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),t.Number=this.posData.Order.Number,t.FinalAmount=this._cashierCalculatorService.Data,t.InvoiceNote=this.posData.Order.Note,t.Date=this.datePipe.transform(this.posData.Order.Date,"dd MMM yyyy"),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.InvoiceCreatedTimeVisible&&(t.Created=this.datePipe.transform(new Date,"dd MMM yyyy")),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.OrderTimeVisible&&(t.Created=this.datePipe.transform(new Date,"dd MMM yyyy HH:mm:ss")),t.Items=this.posData.CartItems,t.Customer.ID=this.posData.Order.CustomerID,t.Customer.Name=this.posData.ContactName,t.Customer.Display=this.posData.ContactName,t.Customer.Mobile&&t.Customer.Mobile.length==1&&(t.Customer.Mobile=null),t.Delivery={Number:this.posData.Order.Number};let e=S.FilterByID(this.posStorage.PoTypes,this.posData.Order.TypeID);return e!==null&&(t.TypeName=e.Name),t.Shipping=this.generateShippingData(),this.AppConfigJSON.PrintConfigInvoice.ItemsTable.ItemWithoutPriceVisible||(t.Items=t.Items.filter(i=>i.Price!=0)),t.Coupon=this.posData.Order.PromotionCoupon,t.PaymentState=this.getPaymentState(),t.Payments=this.posData.Payments,t.Payments=t.Payments.map(i=>(i.MethodName=this.findPaymentName(i.MethodID),i)),t.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),t}getPaymentState(){let t=this.AppConfigJSON?.ModuleSell?.ToleranceAmount,e=this.posData.Payments,i=this.posData.TotalPaidAmount,o=this._cashierCalculatorService.Data,l=1;e?.length>0&&i<o&&(l=2);let C=i-o;return(Math.abs(C)<=t||C>=0)&&(l=3),l}generateTop(t,e){let i=new Date(e),o=new Date(t),l=i.getTime()-o.getTime();return Math.floor(l/(1e3*3600*24))}getSubmitedOrderDate(){let t=this.posData.Order?.Date,e=this.AppConfigJSON.PrintConfigInvoice?.DocumentVisibility?.OrderTimeVisible,i="",o=new Date;if(e){let l=new Date(t);l.setHours(o.getHours()),l.setMinutes(o.getMinutes()),i=this.datePipe.transform(l,"dd MMM yyyy HH:mm")}else i=this.datePipe.transform(t,"dd MMM yyyy");return i}getSubmitedCustomer(){return S.IsEmpty(this.completeData)?{}:this.completeData.Contact}getParkLabel(){let t=this.AppConfigJSON.ApplicationParkAndRetrieve.PrintOutput.LabelPrefix,e=this.AppConfigJSON.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,i=this.posData.Order.ParkLabel;if(S.IsNotEmpty(this.posData.SplitParkLabel)&&(i=this.posData.SplitParkLabel),e&&S.IsNotEmpty(i)){let o=this.park.GetAlias(i);i=o||i}return i?S.IsEmpty(t)?i:S.StringFormat("{0} # {1}",t,i):""}GetSubmittedNumber(){return S.IsNotEmpty(this.completeData)?this.completeData.InvoiceNumber:this.posData.Invoice.Number?this.posData.Invoice.Number:this.posData.Order.Number}generateCartItemSummary(){let t=[];for(let e of this.posData.CartItems)t.push(new Fi(e.Total,this._cashierCalculatorService.currencySymbol,e.Variant.Name,1));return t}generatePaymentSummary(){let t=[],e;for(let o=0;o<this.posData.Payments.length;o++){let l="Payment"+(o+1);this.AppConfigJSON.PrintConfigInvoice.Footer.PaymentMethodVisible&&(l=this.findPaymentName(Number(this.posData.Payments[o].MethodID))),e=new Fi(this.posData.Payments[o].PaidAmount,this._cashierCalculatorService.currencySymbol,l,1),t.push(e)}let i=this.generateChangeSummary();return i!==null&&t.push(i),t}generateChangeSummary(){let t=this._cashierCalculatorService.currencySymbol,e=this._cashierCalculatorService.Data,i=this.posData.TotalPaidAmount,o=0,l=null;return o=i-e,o>0&&(l=new Fi(o,t,"Change",1)),l}findPaymentName(t){return this._outletService.Data.Payments.find(e=>e.ID==t).Name}printWindow(){return Co(this,null,function*(){return new Promise(t=>{setTimeout(()=>{window.print(),t()},500)})})}static \u0275fac=function(e){return new(e||n)(A(B),A(V),A(Pe),A(Y),A(Oe),A(ji),A(j),A(dt))};static \u0275prov=at({token:n,factory:n.\u0275fac,providedIn:"root"})};var we=class n{constructor(t,e,i,o,l,C,N,ae,ke,Fe){this.httpService=t;this.receiptService=e;this.orderProcessorService=i;this.pageInitialService=o;this.salesOrderService=l;this.toastrService=C;this.promotionEventService=N;this.outletService=ae;this.orderHttpService=ke;this.dialog=Fe;this._onPrint=new z,this.onPrint$=this._onPrint.asObservable(),this.subscribeToObservable()}_onPrint;onPrint$;parkOrderRetrieve;subscribeToObservable(){this.orderProcessorService.Data$.subscribe(t=>{(t.posState==3||t.posState==5)&&this.emitParkReceipt(!0,t.posState==5)})}getParkedOrder(t,e){return this.httpService.get(fe.GetPark,[{key:"EntityID",value:t},{key:"RegisterID",value:e}])}removeOrder(t,e){let i={OrderID:t};return e?this.httpService.post(fe.VoidPark,i):this.httpService.post(fe.RemovePark,i)}mergePark(t){return this.httpService.post(fe.MergePark,t)}getOutstanding(t){let e={EntityID:t};return this.httpService.post(fe.GetOutStanding,e)}splitOrder(t){return this.httpService.post(fe.SplitOrder,t)}park(t){let e=ot(mt,this.salesOrderService.Data);if(this.promotionEventService.selectedPromotion){this.clearPromotionAppliedInPark();return}e.Action.DeliveryEntityID=S.GuidEmpty,e.Action.Type=1,t.ParkLabel!=null&&(e.Order.ParkLabel=t.ParkLabel),e.Order.Note=t.Note,e.Order.InvoicedStateID=1,S.IsNotEmpty(t.ID)&&(e.Order.ID=t.ID),this.salesOrderService.pushNewValue(e);let i=this.orderHttpService.generatePOSDataForSubmission(e);return this.httpService.post(fe.ParkOrder,i).pipe(Re(o=>{this.orderProcessorService.updatePosState(3,o),this.orderProcessorService.createNewTransactionInSameOutletRegister()}))}clearPromotionAppliedInPark(){this.dialog.open(Mr,{id:"modal-promotion-confirm",data:{message:`
|
|
1
|
+
import{a as ro}from"./chunk-BQJ7JR25.js";import{b as ea,c as ta}from"./chunk-HRXM4W6Y.js";import{a as $r}from"./chunk-HZNLV6RA.js";import{b as Jr,e as Gr,f as zr,g as Kr}from"./chunk-E3GQ2VEU.js";import{A as Nr,B as Gi,C as Jt,D as zi,E as Fr,F as jr,G as Yi,H as Qr,I as qr,a as vr,b as mt,c as yr,d as Oe,e as V,f as B,g as xr,h as me,i as Ir,j as Or,k as Y,l as Pr,m as Mr,n as Pe,o as Xe,p as It,q as Me,r as $t,s as Bi,t as Fi,u as ji,v as Hi,w as oo,x as Ui,y as j,z as Rr}from"./chunk-XNE22IC6.js";import"./chunk-NPJ272AZ.js";import"./chunk-3TVSUUBD.js";import{a as aa}from"./chunk-GSLPZSSX.js";import"./chunk-TK5H65DN.js";import"./chunk-6L6CIH5M.js";import"./chunk-IVP3GL2V.js";import{a as oa,b as ra}from"./chunk-ELFCO6CE.js";import{a as Xr,b as Zr}from"./chunk-EMYSF46P.js";import{a as wr,b as kr,c as Tr,d as qi}from"./chunk-6FKZY7NZ.js";import{b as na}from"./chunk-NILHRRUO.js";import{a as hr}from"./chunk-HBNFET4C.js";import"./chunk-3PXI2XBC.js";import{b as Ri,c as ot}from"./chunk-HT35KHLT.js";import{b as Be}from"./chunk-THRGCK26.js";import"./chunk-2IT6TVBI.js";import{a as br}from"./chunk-DYCGOJEI.js";import{a as Ti}from"./chunk-X3HEHRBU.js";import{a as ia,b as Zi}from"./chunk-JTWFMMM2.js";import{a as Vr,b as Ar}from"./chunk-4F7XKKDX.js";import{c as $i,d as Ji}from"./chunk-CKB6AES2.js";import"./chunk-W2UCLTBY.js";import"./chunk-NJSJDYUI.js";import{a as Rt}from"./chunk-W4E3XWPN.js";import"./chunk-UU5RJKWG.js";import{a as qe,b as dt}from"./chunk-LD5LH2YH.js";import"./chunk-7BU64MD2.js";import{a as Xi}from"./chunk-FLEDIXNB.js";import"./chunk-5JZJ4OL3.js";import{a as Yr}from"./chunk-P5PNY2PR.js";import"./chunk-SE7OFLAL.js";import"./chunk-NOLQHNIQ.js";import"./chunk-WLRXTHLM.js";import{a as Sr,b as Lr,c as Br}from"./chunk-X3P7SVC6.js";import{a as Li}from"./chunk-4PBQC5P6.js";import{a as Wr}from"./chunk-5VAXIJEW.js";import"./chunk-YOKPVEGO.js";import"./chunk-BYXBJQAS.js";import"./chunk-BYXBJQAS.js";import"./chunk-76T3TRG4.js";import"./chunk-I5K3C5EY.js";import"./chunk-OLALZT3L.js";import"./chunk-DWWBB3GE.js";import"./chunk-6N4AU5UX.js";import"./chunk-BYXBJQAS.js";import{a as gi}from"./chunk-AUWH2QWX.js";import{a as xe,c as Ai}from"./chunk-TBQI2P7D.js";import{a as no}from"./chunk-B5FODXLM.js";import"./chunk-6365PJN3.js";import{c as fi}from"./chunk-VOU4625O.js";import{a as Ei}from"./chunk-I4MJUIXL.js";import{a as Ni,b as Vi}from"./chunk-BWOG3YI3.js";import"./chunk-O7MCO2N7.js";import{a as io}from"./chunk-UZKYLAUE.js";import{a as Dr,b as Qi}from"./chunk-GAPY6IUE.js";import{a as Ki,b as Hr,c as Ur}from"./chunk-47MDCKEY.js";import{a as Ot,b as Wi}from"./chunk-VZLT2MGB.js";import{b as Mi,c as St,d as yt,e as Wt}from"./chunk-KEU6GUET.js";import{a as Er}from"./chunk-TGAOY65D.js";import{d as wi,e as ki}from"./chunk-H4SCBKWD.js";import{a as lr}from"./chunk-UBUC3CPO.js";import{d as _r,e as Cr}from"./chunk-V55A6VFC.js";import"./chunk-72KIMU7G.js";import"./chunk-3RK6DDJD.js";import"./chunk-L2EDFSBR.js";import"./chunk-DTFL44UO.js";import"./chunk-TEFNN3TY.js";import"./chunk-N3XWBPCL.js";import"./chunk-JKYTSC2D.js";import"./chunk-VQ7WKMGF.js";import{a as gr}from"./chunk-6JCU4GNE.js";import{a as er,b as tr,c as ir}from"./chunk-DSIUUK4N.js";import"./chunk-RBCKIP6D.js";import"./chunk-FD5YMPRL.js";import"./chunk-MV3QRRW6.js";import"./chunk-3LBZWLLT.js";import"./chunk-LZNTSIJX.js";import"./chunk-C6ARCDXZ.js";import{a as ar,b as sr}from"./chunk-WF6K2YER.js";import"./chunk-52EOLV7I.js";import{a as Ko}from"./chunk-5UL73W4S.js";import{a as ut,c as pt}from"./chunk-LNVTHMH7.js";import{a as nr,d as or,f as rr}from"./chunk-6ZOGADBZ.js";import{C as fr,D as Ye,F as qt,G as xt,u as W,v as Q,w as Ae}from"./chunk-FY5VLGQC.js";import{b as ce,c as Ke}from"./chunk-CIBQBSM6.js";import{G as ur,O as Qt,P as fe,a as cr,b as pr,n as Di,v as mr,y as dr}from"./chunk-IX5URHI7.js";import{a as Ho}from"./chunk-ZT4RBJMM.js";import"./chunk-GIKR6Y2K.js";import{d as nt}from"./chunk-LPGMI3V2.js";import{e as F,f as Ve,g as ne}from"./chunk-ZZ7LHETD.js";import{M as Yo,Z as Xo,_ as Zo}from"./chunk-567HXZXC.js";import"./chunk-I7VBCYOO.js";import"./chunk-CGESXTHC.js";import{a as Le}from"./chunk-2FWFPV5I.js";import"./chunk-TLOTIYIE.js";import{A as jt,D as Go,F as Ce,G as ze,a as Uo,b as ht,c as te,d as Wo,e as ui,g as Qo,h as K,j as qo,l as bt,m as $o,o as ie,r as Jo,s as vt}from"./chunk-2RSBMS36.js";import{a as Ft,c as Ut}from"./chunk-R5MMHEH6.js";import{a as zo}from"./chunk-J7WZSDR6.js";import{a as S,d as Ht}from"./chunk-AHCRE4GP.js";import"./chunk-VWRUQ7XW.js";import{$a as s,$b as ye,Ab as to,Ac as O,Ba as Io,Bc as le,Cc as Ge,Db as R,E as pe,Eb as si,Fa as He,Fc as G,Gb as ci,Hb as pi,I as li,Ia as Oo,Ib as r,Ja as lt,Jb as a,Ka as Po,Kb as h,Kc as No,Lb as x,M as So,Ma as H,Mb as I,Md as Fo,N as Vt,Nb as mi,Ob as v,Od as jo,Qb as _,Qd as Ct,Rb as c,Rd as Lt,Sc as Vo,Td as Bt,Ub as di,Va as xi,Vb as To,Vd as ee,Wa as tt,Wc as U,Y as At,Yc as _e,Yd as Qe,Za as it,Zb as ve,Zc as $,_b as Se,aa as Ee,ad as Ao,bc as Eo,bd as Pi,c as ho,cb as Mo,cc as Ro,cd as Ne,d as z,da as k,db as d,dc as q,e as Xn,ec as m,ed as We,fa as Re,fc as T,gb as Do,gc as y,gd as X,hc as Ue,ia as yo,id as Lo,ja as at,jc as M,jd as Z,k as bo,ka as gt,kb as P,kc as D,lb as _t,lc as w,ma as A,mb as Ii,md as Bo,na as oe,o as Zn,ob as Oi,pc as st,qb as g,qc as ct,rc as E,sc as ge,t as et,tc as Et,u as yi,ua as xo,ub as wo,va as u,vb as p,wa as f,wb as eo,xb as ko,z as vo,zb as be,zc as b}from"./chunk-DZT5XHBQ.js";import{j as Co}from"./chunk-7DCB7DB2.js";var en=class{ID;Code;Name;Title;Field;Address;ContactInfo;Logo;FooterLeft;FooterRight;FooterNote;PrintMode;PrintLX300;DeliveryNote;AppendQR;ItemRenderMode;CssClass;RemoveImage;DisplayName;DisplayNameCode};var Gt=class{ParkLabel;Note;NumberOfPerson;ID;Alias;Created;CustomerDisplay;Number;Duration};var tn=class n{constructor(t,e,i,o,l,C){this.dialogRef=t;this._orderProcessorService=e;this._posService=i;this.salesOrderService=o;this.parkService=l;this.data=C;this.initModalDialog(),this.initConfig(),this.parkLabel=C.ParkLabel,this.form.ParkLabel=C.ParkLabel,this.form.Note=o.Data.Order.Note}modalConfig=new W;labelPlaceholder;form=new Gt;parkLabel;initConfig(){let t=this._posService.Data.AppConfigJSON;this.labelPlaceholder=t.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkLabelPlaceholder}initModalDialog(){this.modalConfig.title=this.data.title,this.modalConfig.customWidth="600px"}onOk(){this.setParkTitle(),this.parkService.park(this.form).subscribe(t=>{this.dialogRef.close(!0)})}setParkTitle(){let t=this._orderProcessorService.Data.posState,e=this.salesOrderService.Data.Order.Number;t==5?this.salesOrderService.Data.SplitParkLabel=S.IsEmpty(this.parkLabel)?e:this.parkLabel:S.IsEmpty(this.parkLabel)?this.form.ParkLabel=e:this.form.ParkLabel=this.parkLabel}static \u0275fac=function(e){return new(e||n)(d(F),d(j),d(B),d(V),d(we),d(Ve))};static \u0275cmp=P({type:n,selectors:[["POS-modal-park-input"]],standalone:!1,decls:17,vars:3,consts:[[3,"onCancel","onOk","onClose","config"],[1,"ods-info-box"],[1,"fas","fa-info-circle",2,"font-size","1.2rem","margin-top","2px"],["href","https://ods.dealpos.app","target","_blank",2,"color","#0d6efd","font-weight","600","text-decoration","underline"],[1,"w-100","mt-4"],[1,"mb-3"],["type","text","required","","placeholder","E.g. Mr. John Doe","matTooltip","Same as Order Number when blank",1,"form-control","w-100","height-input",3,"ngModelChange","ngModel"],["placeholder","ex: Customer will return tommorow",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onCancel",function(){return i.dialogRef.close()})("onOk",function(){return i.onOk()})("onClose",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1),h(3,"i",2),r(4,"div"),m(5," Use our "),r(6,"a",3),m(7," Order Display Fulfillment System "),a(),m(8," to view the Parked Orders from your warehouse area. "),a()(),r(9,"div",4)(10,"strong",5),m(11,"Label"),a(),r(12,"input",6),w("ngModelChange",function(l){return D(i.parkLabel,l)||(i.parkLabel=l),l}),a()(),r(13,"div",4)(14,"strong",5),m(15,"Note"),a(),r(16,"POS-tinymce-editor",7),w("ngModelChange",function(l){return D(i.form.Note,l)||(i.form.Note=l),l}),a()()()()),e&2&&(p("config",i.modalConfig),s(12),M("ngModel",i.parkLabel),s(4),M("ngModel",i.form.Note))},dependencies:[te,K,jt,ie,Q,ce,Ot],styles:[".height-input[_ngcontent-%COMP%]{height:36px} ng-select.park-detail>div.ng-select-container{border-radius:0!important}.deposit[_ngcontent-%COMP%] .ng-select{width:auto!important}.ods-info-box[_ngcontent-%COMP%]{background-color:#e8f4fd;border-left:4px solid #0dcaf0;padding:16px 20px;border-radius:8px;font-family:Roboto Slab,sans-serif;color:#055160;display:flex;align-items:flex-start;gap:10px;font-size:14px;max-width:600px;margin:0 auto}"]})};var nn=class n{constructor(t){this._dialogRef=t;this.modalConfig=new W,this.modalConfig.title="Select Print Type",this.modalConfig.hideFooter=!0}modalConfig;onPrintOrder(){this._dialogRef.close("ORDER")}onPrintBill(){this._dialogRef.close("BILL")}static \u0275fac=function(e){return new(e||n)(d(F))};static \u0275cmp=P({type:n,selectors:[["POS-modal-print"]],standalone:!1,decls:17,vars:1,consts:[[3,"onCancel","onClose","config"],[1,"d-flex"],[1,"btn","btn-gray","btn-lg","me-1",3,"click"],["src","//res.cloudinary.com/pos/image/upload/v1650423915/icons/order.png"],[1,"mt-1"],[1,"mt-0"],[1,"btn","btn-gray","btn-lg","ms-1",3,"click"],["src","//res.cloudinary.com/pos/image/upload/v1650423915/icons/bill.png",2,"width","23px"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onCancel",function(){return i._dialogRef.close()})("onClose",function(){return i._dialogRef.close()}),r(1,"content")(2,"div",1)(3,"a",2),_("click",function(){return i.onPrintOrder()}),h(4,"img",3),r(5,"h4",4),m(6,"Order"),a(),r(7,"div",5),m(8,"For order for the kitchen"),a()(),r(9,"a",6),_("click",function(){return i.onPrintBill()}),h(10,"img",7),r(11,"h4",4),m(12,"Bill"),a(),r(13,"div",5),m(14,"To see amount of the bill"),a(),r(15,"div",5),m(16,"(Pre-settlement bill)"),a()()()()()),e&2&&p("config",i.modalConfig)},dependencies:[Q],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-gray[_ngcontent-%COMP%]{background-color:#f4f4f4;border:1px solid #D6D6D6;font-weight:700;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}.btn[_ngcontent-%COMP%]{padding:8px 0;width:190px;margin-right:10px}.btn[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{font-weight:700;text-transform:uppercase}.btn[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{font-size:.75rem;font-style:italic;color:#868686;margin-top:10px}"]})};var Ta=(n,t,e)=>({"unselect-card":n,"card-select":t,"card-available":e}),Ea=n=>({"text-secondary":n}),Ra=(n,t)=>({"bg-danger-subtle text-inactive":n,"bg-success text-white":t}),Na=(n,t)=>({"text-secondary":n,"text-success":t});function Va(n,t){if(n&1&&h(0,"i",7),n&2){let e=c();be(e.icon()),p("ngClass",ge(3,Na,e.isOccupied(),!e.isOccupied()))}}var on=class n{title=lt("Park Order");isOccupied=lt(!0);alias=lt("A1");icon=lt("fa-solid fa-star");selected=lt(!1);onEventSelect=Oo({alias:"onSelect"});onSelect(){this.isOccupied()==!1&&this.onEventSelect.emit(this.title())}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["park-card"]],inputs:{title:[1,"title"],isOccupied:[1,"isOccupied"],alias:[1,"alias"],icon:[1,"icon"],selected:[1,"selected"]},outputs:{onEventSelect:"onSelect"},decls:9,vars:15,consts:[[1,"card","m-0","bg-light","border","border-2","bg-opacity-25","rounded",3,"click","ngClass"],[1,"card-body"],[1,"d-flex","align-items-center","justify-content-between","flex-column"],[1,"d-flex","align-items-center","gap-3"],[1,"fa-xl","text-success",3,"ngClass","class"],[3,"ngClass"],[1,"py-2","px-5","rounded-pill","mt-7","fw-normal","border",3,"ngClass"],[1,"fa-xl","text-success",3,"ngClass"]],template:function(e,i){e&1&&(r(0,"div",0),_("click",function(){return i.onSelect()}),r(1,"div",1)(2,"div",2)(3,"div",3),g(4,Va,1,6,"i",4),r(5,"h4",5),m(6),a()(),r(7,"div",6),m(8),a()()()()),e&2&&(p("ngClass",Et(6,Ta,!i.selected(),i.selected()&&!i.isOccupied(),!i.isOccupied())),s(4),R(i.icon()?4:-1),s(),p("ngClass",E(10,Ea,i.isOccupied())),s(),y(" ",i.title()," "),s(),p("ngClass",ge(12,Ra,i.isOccupied(),!i.isOccupied())),s(),y(" ",i.isOccupied()?"Occupied":"Available"," "))},dependencies:[Z,U],styles:[".text-inactive[_ngcontent-%COMP%]{color:#b98181}.card-available[_ngcontent-%COMP%]{cursor:pointer;transition:all .3s ease;transform:translateY(0)}.card-available[_ngcontent-%COMP%]:hover{transform:translateY(-6px);box-shadow:0 2px 4px #00000026,0 0 2px 1px #c0f4cb;border-color:#81c784!important;background-color:#fff!important}.card-select[_ngcontent-%COMP%]{background-color:#ffffe1!important;border-color:#89b03e!important}.unselect-card[_ngcontent-%COMP%]{border-color:transparent!important}"]})};var Aa=n=>({"mat-tab-group-height":n});function La(n,t){if(n&1){let e=v();r(0,"div",2)(1,"div",6)(2,"span",7),h(3,"i",8),a(),r(4,"input",9),w("ngModelChange",function(o){u(e);let l=c();return D(l.filter,o)||(l.filter=o),f(o)}),a()()()}if(n&2){let e=c();s(4),M("ngModel",e.filter)}}function Ba(n,t){if(n&1&&(r(0,"h5",14),h(1,"i"),r(2,"span"),m(3),a()()),n&2){let e=c().$implicit;s(),be(e.Icon),s(2),T(e.Name)}}function Fa(n,t){if(n&1){let e=v();r(0,"div",13)(1,"park-card",15),_("onSelect",function(){let o=u(e).$implicit,l=c(2);return f(l.onSelect(o))}),a()()}if(n&2){let e,i=t.$implicit,o=c().$implicit,l=c();s(),p("title",l.replaceWithAlias()&&i.Alias?i.Alias:i.Name)("alias",i.Alias)("isOccupied",i.IsOccupied)("icon",o.Icon)("selected",((e=l.parkOptionSelected())==null?null:e.Name)===i.Name)}}function ja(n,t){if(n&1&&(r(0,"mat-tab",4),g(1,Ba,4,3,"ng-template",10),r(2,"div",11)(3,"div",12),ci(4,Fa,2,5,"div",13,si),b(6,"Filter"),a()()()),n&2){let e=t.$implicit,i=c();p("label",e.Name),s(4),pi(Ge(6,1,e.Options,i.filter(),"Name"))}}function Ha(n,t){if(n&1){let e=v();r(0,"div",5)(1,"POS-tinymce-editor",16),w("ngModelChange",function(o){u(e);let l=c();return D(l.parkNote,o)||(l.parkNote=o),f(o)}),a()()}if(n&2){let e=c();s(),M("ngModel",e.parkNote)}}var Kt=class n{constructor(t){this.data=t;this.parkLayout.set(t.parkLayoutPack),this.replaceWithAlias.set(t.replaceWithAlias),this.initModalConfig(),this.showInputNote.set(this.posService.Data?.AppConfigJSON?.ApplicationParkAndRetrieve?.NumberOfPerson)}dialog=oe(ne);dialogRef=oe(F);orderProcessorService=oe(j);salesOrderService=oe(V);posService=oe(B);modalConfig=new W;filter=H("");parkLayout=H(null);parkOptionSelected=H(null);replaceWithAlias=H(!1);showInputNote=H(!1);parkNote=H("");initModalConfig(){this.modalConfig.title=this.data.title||"Park Order",this.modalConfig.customWidth="700px",this.modalConfig.bodyScrollable=!0,this.modalConfig.okText=" Park "}onSelect(t){this.parkOptionSelected.set(t)}onOk(){this.showInputNote()&&(this.parkOptionSelected().Note=this.parkNote()),this.dialogRef.close(this.parkOptionSelected())}onCancel(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(Ve))};static \u0275cmp=P({type:n,selectors:[["app-modal-park"]],decls:8,vars:6,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container",2,"max-height","395px","min-height","395px"],[1,"search-container"],["mat-stretch-tabs","false",1,"mt-2",3,"ngClass"],[3,"label"],[1,"mt-4"],[1,"input-group","w-100"],[1,"input-group-text","txtFilter","rounded-start-1"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["type","text","placeholder","Search by number or note","aria-label","Search",1,"txtFilter","form-control","border-start-0","rounded","rounded-start-0",3,"ngModelChange","ngModel"],["mat-tab-label",""],[1,"container","mt-5"],[1,"row"],[1,"col-3","mb-4","px-2"],[1,"d-flex","align-items-center","gap-3"],[3,"onSelect","title","alias","isOccupied","icon","selected"],["height","180px","placeholder","Input the park note (E.g. this is for Mr. John)",3,"ngModelChange","ngModel"]],template:function(e,i){if(e&1&&(r(0,"modal-material",0),_("keydown.F2",function(){return i.onOk()})("onOk",function(){return i.onOk()})("onCancel",function(){return i.onCancel()})("onClose",function(){return i.onCancel()}),r(1,"content")(2,"div",1),g(3,La,5,1,"div",2),r(4,"mat-tab-group",3),ci(5,ja,7,5,"mat-tab",4,si),a(),g(7,Ha,2,1,"div",5),a()()()),e&2){let o,l,C;p("config",i.modalConfig),s(3),R(((o=i.parkLayout().Layout)==null?null:o.length)>0?3:-1),s(),p("ngClass",E(4,Aa,i.showInputNote()&&((l=i.parkOptionSelected())==null?null:l.Name))),s(),pi(i.parkLayout().Layout),s(2),R(i.showInputNote()&&((C=i.parkOptionSelected())!=null&&C.Name)?7:-1)}},dependencies:[Z,U,Ae,Q,on,Qt,mr,Ce,te,K,ie,Wt,Mi,St,yt,Wi,Ot],styles:["[_nghost-%COMP%] .mat-mdc-tab-group[_ngcontent-%COMP%]{--mdc-tab-indicator-active-indicator-color: #89b03e;--mat-tab-header-focus-indicator-color: #89b03e;--mat-tab-header-focus-label-text-color: var(--bs-body-color);--mat-tab-header-active-label-text-color: var(--bs-body-color);--mat-tab-header-active-focus-label-text-color: var(--bs-body-color);--mat-tab-header-active-hover-label-text-color: var(--bs-body-color);--mat-tab-header-active-focus-indicator-color: #89b03e;--mat-tab-header-active-hover-indicator-color: #89b03e}[_nghost-%COMP%] .mat-mdc-tab-header{border-bottom:1px solid var(--bs-border-color)}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%]{transition:all .3s ease}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]{position:relative;transition:all .3s ease;height:2.3rem}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover, [_nghost-%COMP%] .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}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]{transition:all .3s ease;border-left:none!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]:focus{box-shadow:none!important;border-color:#ced4da!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .input-group-text[_ngcontent-%COMP%]{transition:all .3s ease;background-color:#fff;border-right:none!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .input-group-text[_ngcontent-%COMP%], [_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .input-group-text[_ngcontent-%COMP%]{background-color:#89b03e1a;border-color:#84cc16!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .fa-magnifying-glass[_ngcontent-%COMP%]{transition:all .3s ease}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .fa-magnifying-glass[_ngcontent-%COMP%], [_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .fa-magnifying-glass[_ngcontent-%COMP%]{color:#84cc16!important}[_nghost-%COMP%] .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e66,0 0 12px 6px #89b03e40!important}[_nghost-%COMP%] .mat-tab-group-height[_ngcontent-%COMP%]{height:165px}"]})};var an=class n{constructor(t,e,i,o,l,C,N,ae,ke){this.dialogRef=t;this.parkOrderRetrieve=e;this._orderDataService=i;this._posHttpResponseService=o;this._orderProcessorService=l;this._orderHttpService=C;this._dialog=N;this._outletRegisterService=ae;this.parkService=ke;this.salesOrderData=this._orderDataService.Data,this.appConfig=this._posHttpResponseService.Data.AppConfigJSON,this.parkLayoutPack=this._outletRegisterService.Data.ParkLayoutPack}modalConfig=new W;salesOrderData;appConfig;parkLayoutPack;ngOnInit(){this.modalConfig.title="Re-Park Order?",this.modalConfig.hideFooter=!0}onRepark(){this.parkService.park(this.parkOrderRetrieve).subscribe(t=>{this.dialogRef.close()})}onMove(){this.dialogRef.close(),this.showParkSelectModal()}showParkSelectModal(){this._orderHttpService.getVacant(this.salesOrderData.Order.EntityID).subscribe(t=>{this._dialog.open(Kt,{data:{title:this.title,parkLayoutPack:this.parkLayoutPack,replaceWithAlias:this.appConfig.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias}})})}get title(){return this._orderProcessorService.Data.posState==5?"Split Order":this.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkDialogTitle}static \u0275fac=function(e){return new(e||n)(d(F),d(Ve),d(V),d(B),d(j),d(Oe),d(ne),d(Y),d(we))};static \u0275cmp=P({type:n,selectors:[["POS-modal-repark"]],standalone:!1,decls:13,vars:2,consts:[[3,"onClose","onCancel","title","config"],[1,"d-flex"],[1,"btn","btn-gray","btn-lg",3,"click"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onClose",function(){return i.dialogRef.close()})("onCancel",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1)(3,"a",2),_("click",function(){return i.onRepark()}),r(4,"h4"),m(5,"Re-Park"),a(),r(6,"span"),m(7,"Store order to same location"),a()(),r(8,"a",2),_("click",function(){return i.onMove()}),r(9,"h4"),m(10,"Move"),a(),r(11,"span"),m(12,"Shift order to Different location"),a()()()()()),e&2&&p("title","Re-Park Order?")("config",i.modalConfig)},dependencies:[Q],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-gray[_ngcontent-%COMP%]{background-color:#f4f4f4;border:1px solid #D6D6D6;font-weight:700;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}.btn[_ngcontent-%COMP%]{padding:25px 0;width:190px;margin-right:10px}.btn[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{font-weight:700;text-transform:uppercase}.btn[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:.75rem;font-style:italic;color:#868686;margin-top:10px}"]})};var Yt=class{Name;Alias;IsOccupied;Note};var ln=class{_point;get point(){return this._point}set point(t){this._point=t}_pricebookID;get pricebookID(){return this._pricebookID}set pricebookID(t){this._pricebookID=t}_discountRate;get discountRate(){return this._discountRate}set discountRate(t){this._discountRate=t}_groups;get groups(){return this._groups}set groups(t){this._groups=t}_salesID;get salesID(){return this._salesID}set salesID(t){this._salesID=t}_dueDays;get dueDays(){return this._dueDays}set dueDays(t){this._dueDays=t}_expiryDate;get expiryDate(){return this._expiryDate}set expiryDate(t){this._expiryDate=t}_debt;get debt(){return this._debt}set debt(t){this._debt=t}_expirtedString;get expirtedString(){return this._expirtedString}set expirtedString(t){this._expirtedString=t}_loyaltyDisabled;get loyaltyDisabled(){return this._loyaltyDisabled}set loyaltyDisabled(t){this._loyaltyDisabled=t}_taxTypeID;get taxTypeID(){return this._taxTypeID}set taxTypeID(t){this._taxTypeID=t}_entityID;get entityID(){return this._entityID}set entityID(t){this._entityID=t}_mobile;get mobile(){return this._mobile}set mobile(t){this._mobile=t}_email;get email(){return this._email}set email(t){this._email=t}_dueMonths;get dueMonths(){return this._dueMonths}set dueMonths(t){this._dueMonths=t}_memberIdentification;get memberIdentification(){return this._memberIdentification}set memberIdentification(t){this._memberIdentification=t}};var _i=class{OutletName;Status;AmountSummary;Coupon;Creator;CurrencySymbol;Customer;Date;Delivery;ExtraNote;FinalAmount;InvoiceNote;Items;LoyaltyPoint;Payments;PrintDate;RegisterCode;SalesOrderItemCommission;Shipping;Title;TypeName;PaymentState;ToP;Due;InvoiceID;Gopay;Number;Created;SalesName;ParkLabel;HeaderTitle;QRContent;Retur;AfterSell;constructor(){this.OutletName="",this.Status=1,this.AmountSummary=[],this.Coupon="",this.Creator="",this.CurrencySymbol="",this.Customer=new ln,this.Date="",this.Delivery={Number:""},this.ExtraNote="",this.FinalAmount=0,this.InvoiceNote="",this.Items=[],this.LoyaltyPoint="",this.Payments=[],this.PrintDate="",this.RegisterCode="",this.SalesOrderItemCommission={SalesName:""},this.Shipping=new fi,this.Title="",this.TypeName="",this.PaymentState=0,this.InvoiceID="",this.Number="",this.Created="",this.AfterSell=!0}};var Xt=class{LayoutPack;constructor(t){this.LayoutPack=t,this.GenerateLayoutOption()}GenerateLayoutOption(){this.LayoutPack!=null&&this.LayoutPack.Layout&&this.LayoutPack.Layout.forEach(t=>{t.Options=[];for(let e=1;e<=t.Size;e++){let i=new Yt;i.Name=t.Name+e,i.Alias=this.GetAlias(i.Name),t.Options.push(i)}})}GetAlias(t){if(this.LayoutPack!=null&&this.LayoutPack.Alias){let e=this.LayoutPack.Alias.filter(i=>i.Name==t);return e.length>0?e[0].Alias:t}return""}};var sn=class{ExtraNote;Title;Customer;SalesName;InvoiceNote;Date;Items;AmountSummary;Creator;NumberOfPerson;CurrencySymbol;constructor(){this.ExtraNote="",this.Title="",this.Customer="",this.SalesName="",this.InvoiceNote="",this.Date="",this.Items=[],this.AmountSummary=[],this.Creator="",this.NumberOfPerson=0,this.CurrencySymbol="Rp"}};var cn=class{AmountSummary;Contact;ContactDisplay;CurrencySymbol;FinalAmount;HeaderTitle;Invoice;IsPrice;Items;LoyaltyPoint;Order;Payments;PriceVisible;PrintPerson;PrintTime;SalesName;Shipping;TotalInWord};var Mt=class n{constructor(t,e,i,o,l,C,N,ae){this._posService=t;this._orderDataService=e;this._cashierCalculatorService=i;this._outletService=o;this._OrderHttpService=l;this._receiptCalculatorService=C;this._orderProcessorService=N;this._customerHttpService=ae;this.subscribeToObservableChanges()}posData;completeData;park=new Xt(null);outletInfo=new Ai;datePipe=new We("en-US");ParkTemp=Array();CartItems=[];get posStorage(){return this._posService.Data}get AppConfigJSON(){return this._posService.Data.AppConfigJSON}subscribeToObservableChanges(){this._orderDataService.Data$.subscribe(t=>{this.posData=t}),this._OrderHttpService.Data$.subscribe(t=>{this.completeData=t}),this._outletService.Data$.subscribe(t=>{this.outletInfo=t}),this._orderProcessorService.Data$.subscribe(t=>{this.ParkTemp=t.parkTemporaryItem})}generateReceiptMini(){let t=new _i;t.HeaderTitle=this.AppConfigJSON.PrintConfigInvoice.HeaderTitle,t.OutletName=this.outletInfo.EntityName,t.ExtraNote=this.getParkLabel(),t.Customer=this.getSubmitedCustomer(),t.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),t.SalesOrderItemCommission={SalesName:this._outletService.getSalesname(this.posData.Order.SalesID)},t.Number=this.completeData?.InvoiceNumber,t.FinalAmount=this.completeData?.Final,t.InvoiceNote=this.posData.Order.Note,t.RegisterCode=this.outletInfo.RegisterCode==null?"":this.outletInfo.RegisterCode,t.QRContent=this.generateQrContent(),t.InvoiceID=this.completeData?.ObjectID,t.Retur=S.IsNotEmpty(this.posData?.Invoice?.ReferenceInvoiceID),t.Date=this.getSubmitedOrderDate(),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.InvoiceCreatedTimeVisible&&(t.Created=this.datePipe.transform(new Date,"dd MMM yyyy")),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.OrderTimeVisible&&(t.Created=this.datePipe.transform(new Date,"dd MMM yyyy HH:mm:ss")),this.posData.CartItems.forEach(i=>{i.SalesID&&(i.SalesName=this._outletService.getSalesname(i.SalesID))}),t.Items=this.posData.CartItems,t.Customer!=null&&t.Customer.Display!=null&&t.Customer.Display!=null&&t.Customer.Display!=null&&(t.Customer={ID:this.posData.Order.CustomerID,Display:this.posData.ContactName,Email:t.Customer.Email,CityName:null,Address:t.Customer.Address,Code:t.Customer.Code,Name:t.Customer.Name,Phone:t.Customer.Phone,Mobile:t.Customer.Mobile,NationalIDNumber:t.Customer.NationalIDNumber,Title:t.Customer.Title}),t.Delivery={Number:this.posData.Order.Number};let e=S.FilterByID(this.posStorage.PoTypes,this.posData.Order.TypeID);if(e!==null&&(t.TypeName=e.Name),t.Shipping=this.generateShippingData(),this.AppConfigJSON.PrintConfigInvoice.ItemsTable.ItemWithoutPriceVisible||(t.Items=t.Items.filter(i=>i.Price!=0)),t.Coupon=this.posData.Order.PromotionCoupon,t.LoyaltyPoint=this.completeData?this.completeData.LoyaltyPoint:"",t.FinalAmount=this._cashierCalculatorService.Data,t.CurrencySymbol=this._cashierCalculatorService.currencySymbol,t.PaymentState=this.getPaymentState(),t.Payments=this.posData.Payments,t.Payments.forEach(i=>{i.MethodName=this.findPaymentName(i.MethodID)}),t.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),t.Creator=this.completeData?.Creator?this.completeData?.Creator:this.posStorage?.UserName,this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.InvoicePaymentTermsVisible&&this.posData.Payments.length==0){let i=this.posData.Invoice.Due?new Date(this.posData.Invoice.Due):null,o=new Date(this.posData.Order.Date);o.setHours(0,0,0,0),t.ToP=this.generateTop(o,i),this.posData.Invoice.Due!==void 0&&(t.Due=this.datePipe.transform(new Date(this.posData.Invoice.Due),"dd MMMM yyyy"))}return t}generateQrContent(){let t="";if(this.AppConfigJSON?.PrintConfigInvoice?.InvoiceQR?.TransformTo==3){let i=this.AppConfigJSON?.PrintConfigInvoice?.InvoiceQR?.Content,o=this.posData?.Order?.Number,l=this.completeData.ObjectID,C=window?.location?.host;switch(i){case 2:t=l;break;case 1:t=o;break;case 3:t=`receipt.dealpos.app?Data=${btoa(`${l}_${C}`)}`;break}}return t}generateShippingData(){return{City:this.posData.Shipping!==null?this.posData.Shipping.City:null,Description:this.posData.Shipping!==null?this.posData.Shipping.Address:null,ID:null,Phone:this.posData.Shipping!==null?this.posData.Shipping.Phone:null,Recipient:this.posData.Shipping!==null?this.posData.Shipping.Name:null,SalesOrderID:null,Sender:null,SenderAddress:null,SenderCity:null,SenderPhone:null,Street:null}}generateParkReceipt(t=!0,e=!1){let i=new sn;if(i.ExtraNote=S.StringFormat("{0} #{1}",this.AppConfigJSON.ApplicationParkAndRetrieve.PrintOutput.NumberPrefix,this.GetSubmittedNumber()),i.Title=this.getParkLabel(),i.Customer=this.getSubmitedCustomer(),i.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),i.InvoiceNote=this.posData.Order.Note,i.Date=this.getSubmitedOrderDate(),i.CurrencySymbol=this._cashierCalculatorService.currencySymbol,this.getItemsParkReceipt(t,e),i.Items=this.CartItems,i.Creator=this.posStorage.UserName,i.NumberOfPerson=this.posData.Order.NumberOfPerson,this.AppConfigJSON.ApplicationParkAndRetrieve.PrintOutput.AmountVisible){let o=JSON.parse(JSON.stringify(this._receiptCalculatorService.generateAmountSummary()));i.AmountSummary=o}return i}getItemsParkReceipt(t,e){let i=ot(Be,this.posData.CartItems);if(e){let o=this.posData.CartItems.filter(l=>S.IsNotEmpty(l.SplitQuantity)&&l.SplitQuantity>0);this.CartItems=o.map(l=>(l.Quantity=l.SplitQuantity,l))}else if(t&&this.AppConfigJSON.ApplicationParkAndRetrieve.PrintBehaviour.PrintAdditionalItemsOnlyOnRePark)if(this.CartItems=Array(),this.ParkTemp.length>0)for(let o of i){let l=this.ParkTemp.find(C=>C.ID==o.ID);l==null?this.CartItems.push(o):o.Quantity!=l.Quantity&&(o.Quantity=o.Quantity-l.Quantity,this.CartItems.push(o))}else this.CartItems=i;else this.CartItems=i}generateBillInvoice(){let t=new cn;return t.ContactDisplay=this.posData.ContactName,t.Invoice=this.posData.Invoice,t.Order=this.posData.Order,t.Payments=this.posData.Payments,t.Shipping=this.posData.Shipping,t.CurrencySymbol=this._cashierCalculatorService.currencySymbol,t.FinalAmount=this._cashierCalculatorService.Data,t.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),t.Contact=this.getSubmitedCustomer(),t.Items=this.getItemsBillInvoice(),t.PrintTime=this.datePipe.transform(new Date,"dd MMM yyyy HH:mm"),t.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),t.HeaderTitle=this.AppConfigJSON.PrintConfigInvoice.HeaderTitle,t.Invoice.Number=`#${this.posData.Order.Number}`,t.Invoice.Date=new Date,t.Invoice.PaymentStateID=1,t.Invoice.Note=this.posData.Order.Note,t.PrintPerson="",t.IsPrice=!0,t.PriceVisible=!0,t}getItemsBillInvoice(){return this.posData.CartItems.map(e=>({Name:e.Variant.Name,Quantity:e.Quantity,Code:e.Variant.Code,UnitPrice:e.Price,Discount:e.Discount,UOMName:e.Variant.UOMName,Total:e.Total,Note:e.Note}))}generateBillReceipt(){let t=new _i;t.HeaderTitle=this.AppConfigJSON.PrintConfigInvoice.HeaderTitle,t.ParkLabel=this.posData.Order.ParkLabel,t.OutletName=this.outletInfo.EntityName,t.ExtraNote=this.getParkLabel(),t.Customer=this._customerHttpService.Data,t.SalesOrderItemCommission.SalesName=this._outletService.getSalesname(this.posData.Order.SalesID),t.Number=this.posData.Order.Number,t.FinalAmount=this._cashierCalculatorService.Data,t.InvoiceNote=this.posData.Order.Note,t.Date=this.datePipe.transform(this.posData.Order.Date,"dd MMM yyyy"),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.InvoiceCreatedTimeVisible&&(t.Created=this.datePipe.transform(new Date,"dd MMM yyyy")),this.AppConfigJSON.PrintConfigInvoice.DocumentVisibility.OrderTimeVisible&&(t.Created=this.datePipe.transform(new Date,"dd MMM yyyy HH:mm:ss")),t.Items=this.posData.CartItems,t.Customer.ID=this.posData.Order.CustomerID,t.Customer.Name=this.posData.ContactName,t.Customer.Display=this.posData.ContactName,t.Customer.Mobile&&t.Customer.Mobile.length==1&&(t.Customer.Mobile=null),t.Delivery={Number:this.posData.Order.Number};let e=S.FilterByID(this.posStorage.PoTypes,this.posData.Order.TypeID);return e!==null&&(t.TypeName=e.Name),t.Shipping=this.generateShippingData(),this.AppConfigJSON.PrintConfigInvoice.ItemsTable.ItemWithoutPriceVisible||(t.Items=t.Items.filter(i=>i.Price!=0)),t.Coupon=this.posData.Order.PromotionCoupon,t.PaymentState=this.getPaymentState(),t.Payments=this.posData.Payments,t.Payments=t.Payments.map(i=>(i.MethodName=this.findPaymentName(i.MethodID),i)),t.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),t}getPaymentState(){let t=this.AppConfigJSON?.ModuleSell?.ToleranceAmount,e=this.posData.Payments,i=this.posData.TotalPaidAmount,o=this._cashierCalculatorService.Data,l=1;e?.length>0&&i<o&&(l=2);let C=i-o;return(Math.abs(C)<=t||C>=0)&&(l=3),l}generateTop(t,e){let i=new Date(e),o=new Date(t),l=i.getTime()-o.getTime();return Math.floor(l/(1e3*3600*24))}getSubmitedOrderDate(){let t=this.posData.Order?.Date,e=this.AppConfigJSON.PrintConfigInvoice?.DocumentVisibility?.OrderTimeVisible,i="",o=new Date;if(e){let l=new Date(t);l.setHours(o.getHours()),l.setMinutes(o.getMinutes()),i=this.datePipe.transform(l,"dd MMM yyyy HH:mm")}else i=this.datePipe.transform(t,"dd MMM yyyy");return i}getSubmitedCustomer(){return S.IsEmpty(this.completeData)?{}:this.completeData.Contact}getParkLabel(){let t=this.AppConfigJSON.ApplicationParkAndRetrieve.PrintOutput.LabelPrefix,e=this.AppConfigJSON.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,i=this.posData.Order.ParkLabel;if(S.IsNotEmpty(this.posData.SplitParkLabel)&&(i=this.posData.SplitParkLabel),e&&S.IsNotEmpty(i)){let o=this.park.GetAlias(i);i=o||i}return i?S.IsEmpty(t)?i:S.StringFormat("{0} # {1}",t,i):""}GetSubmittedNumber(){return S.IsNotEmpty(this.completeData)?this.completeData.InvoiceNumber:this.posData.Invoice.Number?this.posData.Invoice.Number:this.posData.Order.Number}generateCartItemSummary(){let t=[];for(let e of this.posData.CartItems)t.push(new Fi(e.Total,this._cashierCalculatorService.currencySymbol,e.Variant.Name,1));return t}generatePaymentSummary(){let t=[],e;for(let o=0;o<this.posData.Payments.length;o++){let l="Payment"+(o+1);this.AppConfigJSON.PrintConfigInvoice.Footer.PaymentMethodVisible&&(l=this.findPaymentName(Number(this.posData.Payments[o].MethodID))),e=new Fi(this.posData.Payments[o].PaidAmount,this._cashierCalculatorService.currencySymbol,l,1),t.push(e)}let i=this.generateChangeSummary();return i!==null&&t.push(i),t}generateChangeSummary(){let t=this._cashierCalculatorService.currencySymbol,e=this._cashierCalculatorService.Data,i=this.posData.TotalPaidAmount,o=0,l=null;return o=i-e,o>0&&(l=new Fi(o,t,"Change",1)),l}findPaymentName(t){return this._outletService.Data.Payments.find(e=>e.ID==t).Name}printWindow(){return Co(this,null,function*(){return new Promise(t=>{setTimeout(()=>{window.print(),t()},500)})})}static \u0275fac=function(e){return new(e||n)(A(B),A(V),A(Pe),A(Y),A(Oe),A(ji),A(j),A(dt))};static \u0275prov=at({token:n,factory:n.\u0275fac,providedIn:"root"})};var we=class n{constructor(t,e,i,o,l,C,N,ae,ke,Fe){this.httpService=t;this.receiptService=e;this.orderProcessorService=i;this.pageInitialService=o;this.salesOrderService=l;this.toastrService=C;this.promotionEventService=N;this.outletService=ae;this.orderHttpService=ke;this.dialog=Fe;this._onPrint=new z,this.onPrint$=this._onPrint.asObservable(),this.subscribeToObservable()}_onPrint;onPrint$;parkOrderRetrieve;subscribeToObservable(){this.orderProcessorService.Data$.subscribe(t=>{(t.posState==3||t.posState==5)&&this.emitParkReceipt(!0,t.posState==5)})}getParkedOrder(t,e){return this.httpService.get(fe.GetPark,[{key:"EntityID",value:t},{key:"RegisterID",value:e}])}removeOrder(t,e){let i={OrderID:t};return e?this.httpService.post(fe.VoidPark,i):this.httpService.post(fe.RemovePark,i)}mergePark(t){return this.httpService.post(fe.MergePark,t)}getOutstanding(t){let e={EntityID:t};return this.httpService.post(fe.GetOutStanding,e)}splitOrder(t){return this.httpService.post(fe.SplitOrder,t)}park(t){let e=ot(mt,this.salesOrderService.Data);if(this.promotionEventService.selectedPromotion){this.clearPromotionAppliedInPark();return}e.Action.DeliveryEntityID=S.GuidEmpty,e.Action.Type=1,t.ParkLabel!=null&&(e.Order.ParkLabel=t.ParkLabel),e.Order.Note=t.Note,e.Order.InvoicedStateID=1,S.IsNotEmpty(t.ID)&&(e.Order.ID=t.ID),this.salesOrderService.pushNewValue(e);let i=this.orderHttpService.generatePOSDataForSubmission(e);return this.httpService.post(fe.ParkOrder,i).pipe(Re(o=>{this.orderProcessorService.updatePosState(3,o),this.orderProcessorService.createNewTransactionInSameOutletRegister()}))}clearPromotionAppliedInPark(){this.dialog.open(Pr,{id:"modal-promotion-confirm",data:{message:`
|
|
2
2
|
Promotion cannot be applied when Park,
|
|
3
3
|
Order will be restored to before the promotion is applied
|
|
4
|
-
`},disableClose:!0})}parkOrder(){let t=this.salesOrderService.Data,e=this.pageInitialService.Data.AppConfigJSON;if(t.CartItems.length==0){this.toastrService.warning("You must have at least one item","No Item in Cart!");return}if(!(!this.validateCustomerRequired(e,t)||!this.validateUsedPromotion(t))){if(S.IsEmpty(t.Order.RegisterID)){this.toastrService.warning(gr.emptyEntity,Le.Warning);return}this.validateShowParkModal()}}validateCustomerRequired(t,e){return t.ModuleSell.Header.CustomerRequired&&e.Order.CustomerID==null?(this.toastrService.warning("Customer is needed before parking orders!","Missing customer!"),!1):!0}validateUsedPromotion(t){let e=this.promotionEventService.selectedPromotion;return S.IsNotEmpty(e)||S.IsNotEmpty(t.Order.PromotionCoupon)?(this.toastrService.warning("Orders with applied promotions or coupons cannot be parked!","Park Not Allowed!"),!1):!0}validateShowParkModal(){let t=this.outletService.Data.ParkLayoutPack,e=this.pageInitialService.Data.AppConfigJSON,i=this.salesOrderService.Data;if(t&&S.IsNotEmpty(t.ID))this.orderProcessorService.Data.posState==4?this.showReparkModal():this.showParkSelectModal(e,i);else{if(!this.validateRetrieveMode(e))return;this.setDefaultParkNote(e),this.showParkInputModal()}}showParkSelectModal(t,e){let i=this.orderProcessorService.Data,o=this.outletService.Data.ParkLayoutPack;this.orderHttpService.getVacant(e.Order.EntityID).subscribe(l=>{let C=t.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkDialogTitle,N=i.posState==5,ae=t.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,ke=N?"Split Order":C;this.dialog.open(Kt,{data:{title:ke,parkLayoutPack:this.generateParkLayoutOptions(o,l.Orders),replaceWithAlias:ae}}).afterClosed().pipe(ce(Fe=>S.IsNotEmpty(Fe)),Ee(Fe=>{let je=new Gt;return je.ParkLabel=Fe.Name,je.Note=Fe.Note,this.park(je)})).subscribe()})}showReparkModal(){this.dialog.open(an,{data:this.parkOrderRetrieve})}validateRetrieveMode(t){return t.ApplicationParkAndRetrieve.Advance.retreiveMode==1?(this.toastrService.error("Your retrieve config is in Group mode, to enable park please setting your Park layout at Outlet page","Error!"),!1):!0}setDefaultParkNote(t){let e=t.ApplicationParkAndRetrieve.UserInterfaceLabel.DefaultParkNoteValue,i=this.orderProcessorService.Data.posState==2,o=this.salesOrderService.Data;!i&&S.IsNotEmpty(e)&&S.IsEmpty(o.Order.Note)&&(this.salesOrderService.Data.Order.Note=e)}showParkInputModal(){let t="Park this order?",e=this.orderProcessorService.Data.posState==5,i=this.outletService.Data?.ParkLayoutPack;e&&(t="Split Detail"),this.dialog.open(tn,{id:"park-form-modal",data:{title:t,labelDisable:i&&S.IsNotEmpty(i?.ID)||this.orderProcessorService.Data.posState==5,ParkLabel:this.salesOrderService.Data.Order.ParkLabel}})}onPrintRetrieve(){this.dialog.open(nn).afterClosed().pipe(ce(t=>S.IsNotEmpty(t))).subscribe(t=>{t=="ORDER"?this.emitParkReceipt(!1,!1,!0):this.emitBillReceipt()})}emitParkReceipt(t,e=!1,i=!1){let o=this.receiptService.generateParkReceipt(t,e);(this.pageInitialService.Data.AppConfigJSON.ApplicationParkAndRetrieve?.PrintBehaviour?.PrintAfterPark||i)&&this._onPrint.next({type:"PARK",template:o})}emitBillReceipt(){let t=this.outletService.Data,e;1==t.PrintTemplate.PrintMode?(e=this.receiptService.generateBillInvoice(),this._onPrint.next({type:"BILL_A4",template:e})):(e=this.receiptService.generateBillReceipt(),this._onPrint.next({type:"BILL_MINI",template:e}))}generateParkLayoutOptions(t,e=[]){return t.Layout=t.Layout.map(i=>{i.Options=[];for(let o=1;o<=i.Size;o++){let l=new Yt;l.Name=i.Name+o,l.Alias=this.generateAlias(t,l.Name),l.IsOccupied=this.IsOccupied(l.Name,e),i.Options.push(l)}return i}),t}generateAlias(t,e){let i="";if(t.Alias){let o=t.Alias.filter(l=>l.Name==e);o.length>0&&(i=`${o[0]?.Alias}`)}return i}IsOccupied(t,e){let i=e.filter(l=>l.ParkLabel==t),o=!1;return i.length>0&&(o=!0),o}static \u0275fac=function(e){return new(e||n)(A(Qe),A(Mt),A(j),A(B),A(V),A(ee),A($t),A(Y),A(Oe),A(ne))};static \u0275prov=at({token:n,factory:n.\u0275fac,providedIn:"root"})};var pn=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=_t({type:n});static \u0275inj=gt({imports:[Z,Ce,Vi,xt,wr,Wt,Bt,Qt,Ke,Qi]})};var ca=n=>({"opacity-50":n});function qa(n,t){if(n&1){let e=v();r(0,"div",5)(1,"h6",6),m(2,"Verify Via"),a(),r(3,"div",7)(4,"button",8),_("click",function(){u(e);let o=c();return f(o.onChooseVerifyType("phone"))}),r(5,"div",9)(6,"div"),h(7,"i",10),a(),r(8,"div",11),m(9),a()()()(),r(10,"div",12)(11,"button",8),_("click",function(){u(e);let o=c();return f(o.onChooseVerifyType("email"))}),r(12,"div",9),h(13,"i",13),r(14,"div",11),m(15),a()()()(),r(16,"div",12)(17,"button",14),_("click",function(o){return u(e),c().onChooseVerifyType("pin"),f(o.preventDefault())}),r(18,"div",9),h(19,"i",15),r(20,"div",16),m(21,"Use PIN"),a()()()()()}if(n&2){let e=c();s(4),p("disabled",!e.phone||(e.phone==null?null:e.phone.length)<6),s(4),p("ngClass",E(6,ca,!e.phone||(e.phone==null?null:e.phone.length)<6)),s(),y(" ",e.phone&&(e.phone==null?null:e.phone.length)>6?e.phone:"Mobile Phone is not registered"," "),s(2),p("disabled",!e.email),s(3),p("ngClass",E(8,ca,!e.email)),s(),y(" ",e.email?e.email:"Email is not registered"," ")}}function $a(n,t){if(n&1){let e=v();r(0,"div",17)(1,"div",18)(2,"div"),m(3,"OTP Verification is turned "),r(4,"span",19),m(5,"OFF"),a(),m(6,","),a(),r(7,"div"),m(8," Please read this "),r(9,"a",20),m(10,"article"),a(),m(11," to turn on "),a()()(),r(12,"div")(13,"div",21)(14,"button",22),_("click",function(){u(e);let o=c();return f(o.onRedeem())}),m(15,"Redeem"),a()()()}}var mn=class n{toastrService=oe(ee);onVerify=new He;pointUsedChange=new He;redeemEvent=new He;isVerifyEnabled=!1;phone;email;pointUsed;pointBalance;onPointUsedChange(){this.pointUsedChange.emit(this.pointUsed)}ngAfterViewInit(){this.setFocusInput()}setFocusInput(){setTimeout(()=>{document.getElementById("pointInput")?.focus()},300)}onChooseVerifyType(t){this.checkPointUsed()&&this.onVerify.emit(t)}onRedeem(){this.checkPointUsed()&&this.redeemEvent.emit()}checkPointUsed(){return S.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(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["point-step"]],inputs:{isVerifyEnabled:"isVerifyEnabled",phone:"phone",email:"email",pointUsed:"pointUsed",pointBalance:"pointBalance"},outputs:{onVerify:"onVerify",pointUsedChange:"pointUsedChange",redeemEvent:"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",3,"ngClass"],[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,"fs-5","w-100"],[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(e,i){e&1&&(r(0,"div",0)(1,"div",1)(2,"input",2),w("ngModelChange",function(l){return D(i.pointUsed,l)||(i.pointUsed=l),l}),_("ngModelChange",function(){return i.onPointUsedChange()}),a()(),r(3,"div",3)(4,"span",1),m(5,"Of"),a(),r(6,"span",4),m(7),b(8,"number"),a()(),r(9,"div"),m(10,"Points"),a()(),g(11,qa,22,10,"div",5)(12,$a,16,0)),e&2&&(s(2),M("ngModel",i.pointUsed),p("max",i.pointBalance),s(5),T(O(8,4,i.pointBalance)),s(4),R(i.isVerifyEnabled?11:12))},dependencies:[Z,H,X,ut,pt,Ce,te,K,ie,Ke,se],styles:[".input-point[_ngcontent-%COMP%]{width:120px;height:44px;font-size:1.375rem;text-align:center}"]})};var Ja=n=>({"error-input":n});function Ga(n,t){if(n&1&&(r(0,"span"),m(1),a()),n&2){let e=c(3);s(),y(" ",e.config.separator," ")}}function za(n,t){if(n&1){let e=v();x(0),r(1,"input",5,0),_("paste",function(o){u(e);let l=c(2);return f(l.handlePaste(o))})("keyup",function(o){let l=u(e).index,C=c(2);return f(C.onKeyUp(o,l))})("input",function(o){let l=u(e).index,C=c(2);return f(C.onInput(o,l))})("keydown",function(o){let l=u(e).index,C=c(2);return f(C.onKeyDown(o,l))}),a(),g(3,Ga,2,1,"span",6),I()}if(n&2){let e=t.$implicit,i=t.index,o=t.last,l=c(2);s(),to("otp-input ",l.config.inputClass,""),p("pattern",l.config.allowNumbersOnly?"\\d*":"")("type",l.inputType)("placeholder",(l.config==null?null:l.config.placeholder)||"")("ngStyle",l.config.inputStyles)("formControl",l.otpForm.controls[e])("id",l.getBoxId(i))("ngClass",E(11,Ja,(l.config==null?null:l.config.showError)&&(l.formControl==null?null:l.formControl.invalid)&&((l.formControl==null?null:l.formControl.dirty)||(l.formControl==null?null:l.formControl.touched)))),s(2),p("ngIf",l.config.separator&&!o)}}function Ka(n,t){if(n&1){let e=v();r(0,"div",2),_("focusin",function(){u(e);let o=c();return f(o.onFocusIn())})("focusout",function(){u(e);let o=c();return f(o.onFocusOut())}),r(1,"div",3),g(2,za,4,13,"ng-container",4),a()()}if(n&2){let e=c();to("ng-otp-input-wrapper wrapper ",e.config.containerClass,""),To("id","c_",e.componentKey,""),p("ngStyle",e.config.containerStyles),s(2),p("ngForOf",e.controlKeys)}}var ft=class{static ifTab(t){return this.ifKey(t,"Tab")}static ifDelete(t){return this.ifKey(t,"Delete;Del")}static ifBackspace(t){return this.ifKey(t,"Backspace")}static ifRightArrow(t){return this.ifKey(t,"ArrowRight;Right")}static ifLeftArrow(t){return this.ifKey(t,"ArrowLeft;Left")}static ifSpacebar(t){return this.ifKey(t,"Spacebar; ")}static ifKey(t,e){return e.split(";").some(o=>o===t.key)}},Ci=class{static keys(t){return t?Object.keys(t):[]}},po=(()=>{class n{set disabled(e){this.setDisabledState(e)}get inputType(){return this.config?.isPasswordInput?"password":this.config?.allowNumbersOnly?"tel":"text"}get controlKeys(){return Ci.keys(this.otpForm?.controls)}get formControl(){return this.formCtrl??this.inj?.get(Qo)}constructor(e,i){this.document=e,this.inj=i,this.config={length:4},this.onBlur=new z,this.onInputChange=new z,this.inputControls=new Array(this.config.length),this.componentKey=Math.random().toString(36).substring(2)+new Date().getTime().toString(36),this.destroy$=new z,this.activeFocusCount=0,this.onChange=()=>{},this.onTouched=()=>{},this._isDisabled=!1}ngOnInit(){this.otpForm=new qo({});for(let e=0;e<this.config.length;e++)this.otpForm.addControl(this.getControlName(e),new bt);this.otpForm.valueChanges.pipe(k(this.destroy$)).subscribe(e=>{Ci.keys(this.otpForm.controls).forEach(i=>{var o=this.otpForm.controls[i].value;o&&o.length>1&&(o.length>=this.config.length?this.setValue(o):this.rebuildValue())})})}setDisabledState(e){this._isDisabled=e,this.otpForm&&(e?this.otpForm.disable({emitEvent:!1}):this.otpForm.enable({emitEvent:!1}))}writeValue(e){this.currentVal=this.hasVal(e)?e:null,this.setValue(this.currentVal)}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}onFocusIn(){this.onTouched(),this.activeFocusCount++}onFocusOut(){setTimeout(()=>{this.activeFocusCount--,this.activeFocusCount===0&&(this.onTouched(),this.onBlur.next())},0)}ngAfterViewInit(){if(!this.config.disableAutoFocus){let e=this.document.getElementById(`c_${this.componentKey}`);if(e){let i=e.getElementsByClassName("otp-input")[0];i&&i.focus&&i.focus()}}}getControlName(e){return`ctrl_${e}`}onKeyDown(e,i){let o=this.getBoxId(i-1),l=this.getBoxId(i);if(ft.ifKey(e,"Enter")){let N=this.document.getElementById(l)?.closest("form");if(N){e.preventDefault(),N.dispatchEvent(new Event("submit"));return}}if(ft.ifSpacebar(e))return e.preventDefault(),!1;if(ft.ifBackspace(e)){e.target.value?this.clearInput(l,i):(this.clearInput(o,i-1),this.setSelected(o)),this.rebuildValue();return}if(ft.ifDelete(e)){e.target.value?this.clearInput(l,i):(this.clearInput(o,i-1),this.setSelected(o)),this.rebuildValue();return}}hasVal(e){return e!=null&&e!=null&&(!e?.trim||e.trim()!="")}onInput(e,i){let o=this.hasVal(this.currentVal)?`${this.currentVal}${e.target.value}`:e.target.value;if(this.config.allowNumbersOnly&&!this.validateNumber(o)){e.target.value=null,e.stopPropagation(),e.preventDefault(),this.clearInput(null,i);return}if(this.ifValidKeyCode(null,e.target.value)){let l=this.getBoxId(i+1);this.setSelected(l),this.rebuildValue()}else{e.target.value=null;let l=this.getControlName(i);this.otpForm.controls[l]?.setValue(null),this.rebuildValue()}}onKeyUp(e,i){ft.ifTab(e)&&(i-=1);let o=this.getBoxId(i+1),l=this.getBoxId(i-1);if(ft.ifRightArrow(e)){e.preventDefault(),this.setSelected(o);return}if(ft.ifLeftArrow(e)){e.preventDefault(),this.setSelected(l);return}}validateNumber(e){return e&&/^[0-9]+$/.test(e)}getBoxId(e){return`otp_${e}_${this.componentKey}`}clearInput(e,i){let o=this.getControlName(i);if(this.otpForm.controls[o]?.setValue(null),e){let l=this.document.getElementById(e);l&&l instanceof HTMLInputElement&&(l.value=null)}}setSelected(e){this.focusTo(e);let i=this.document.getElementById(e);i&&i.setSelectionRange&&setTimeout(()=>{i.setSelectionRange(0,1)},0)}ifValidKeyCode(e,i){let o=i??e.key;return this.config?.allowNumbersOnly?this.validateNumber(o):/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)||/^[a-zA-Z0-9%*_\-@#$!]$/.test(o)&&o.length==1}focusTo(e){let i=this.document.getElementById(e);i&&i.focus()}setValue(e){if(!(this.config.allowNumbersOnly&&isNaN(e))){if(this.otpForm?.reset(),!this.hasVal(e)){this.rebuildValue();return}e=e.toString().replace(/\s/g,""),Array.from(e).forEach((i,o)=>{this.otpForm.get(this.getControlName(o))&&this.otpForm.get(this.getControlName(o)).setValue(i)}),this.config.disableAutoFocus||setTimeout(()=>{let i=this.document.getElementById(`c_${this.componentKey}`);var o=e.length<this.config.length?e.length:this.config.length-1;let l=i.getElementsByClassName("otp-input")[o];l&&l.focus&&setTimeout(()=>{l.focus()},1)},0),this.rebuildValue()}}rebuildValue(){let e=null;Ci.keys(this.otpForm.controls).forEach(i=>{let o=this.otpForm.controls[i].value;if(o){let l=o.length>1,C=!this.config.allowNumbersOnly&&this.config.letterCase&&(this.config.letterCase.toLocaleLowerCase()=="upper"||this.config.letterCase.toLocaleLowerCase()=="lower");o=o[0];let N=C?this.config.letterCase.toLocaleLowerCase()=="upper"?o.toUpperCase():o.toLowerCase():o;C&&N==o?C=!1:o=N,e==null?e=o:e+=o,(l||C)&&this.otpForm.controls[i].setValue(o)}}),this.currentVal!=e&&(this.currentVal=e,this.onChange(e),this.formCtrl?.setValue&&this.formCtrl.setValue(e),this.onInputChange.next(e))}handlePaste(e){let i=e.clipboardData||window.clipboardData;if(i)var o=i.getData("Text");e.stopPropagation(),e.preventDefault(),!(!o||this.config.allowNumbersOnly&&!this.validateNumber(o))&&this.setValue(o)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}static{this.\u0275fac=function(i){return new(i||n)(d(Vo),d(Io))}}static{this.\u0275cmp=P({type:n,selectors:[["ng-otp-input"],["ngx-otp-input"]],inputs:{config:"config",formCtrl:"formCtrl",disabled:"disabled"},outputs:{onBlur:"onBlur",onInputChange:"onInputChange"},features:[st([{provide:Uo,useExisting:yo(()=>n),multi:!0}])],decls:1,vars:1,consts:[["inp",""],["tabindex","0",3,"class","id","ngStyle","focusin","focusout",4,"ngIf"],["tabindex","0",3,"focusin","focusout","id","ngStyle"],[1,"n-o-c"],[4,"ngFor","ngForOf"],["autocomplete","one-time-code",3,"paste","keyup","input","keydown","pattern","type","placeholder","ngStyle","formControl","id","ngClass"],[4,"ngIf"]],template:function(i,o){i&1&&g(0,Ka,3,7,"div",1),i&2&&p("ngIf",o.otpForm==null?null:o.otpForm.controls)},dependencies:[ze,te,K,Go,vt,$,_e,Ao,H],styles:[".otp-input[_ngcontent-%COMP%]{width:50px;height:50px;border-radius:4px;border:solid 1px #c5c5c5;text-align:center;font-size:32px}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]{margin:0 .51rem}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]:first-child{margin-left:0}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]:last-child{margin-right:0}.n-o-c[_ngcontent-%COMP%]{display:flex;align-items:center}.error-input[_ngcontent-%COMP%]{border-color:red}@media screen and (max-width: 767px){.otp-input[_ngcontent-%COMP%]{width:40px;font-size:24px;height:40px}}@media screen and (max-width: 420px){.otp-input[_ngcontent-%COMP%]{width:30px;font-size:18px;height:30px}}"]})}}return n})(),un=(()=>{class n{static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275mod=_t({type:n})}static{this.\u0275inj=gt({imports:[po]})}}return n})();function Xa(n,t){if(n&1&&(r(0,"div"),m(1," OTP has been sent to "),r(2,"span",5),m(3),a()()),n&2){let e=c();s(3),T(e.contact)}}function Za(n,t){if(n&1&&h(0,"ng-otp-input",3),n&2){let e=c(2);p("formCtrl",e.otpCtrl)("config",e.otpConfig)}}function el(n,t){if(n&1&&g(0,Za,1,2,"ng-otp-input",3),n&2){let e=c();R(e.showPinInput()?0:-1)}}function tl(n,t){if(n&1&&h(0,"ng-otp-input",3),n&2){let e=c();p("formCtrl",e.otpCtrl)("config",e.otpConfig)}}function il(n,t){if(n&1){let e=v();r(0,"div",4)(1,"span"),m(2,"Didn`t get a code? "),a(),r(3,"a",6),_("click",function(){u(e);let o=c();return f(o.onResendCode())}),m(4,"Click to resend"),a()()}}var fn=class n{type;contact;clearPin=!1;onVerify=new He;resendCode=new He;showPinInput=q(!0);otpCtrl=new bt;otpConfig={length:6,inputStyles:{width:"3rem",height:"3rem"},isPasswordInput:!1,placeholder:"-"};constructor(){this.listenOtpChange()}ngOnChanges(t){let{clearPin:e}=t;e?.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(So(300),ce(t=>t.length===6)).subscribe(t=>{this.onVerify.emit(t)})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["verify-step"]],inputs:{type:"type",contact:"contact",clearPin:"clearPin"},outputs:{onVerify:"onVerify",resendCode:"resendCode"},features:[xo],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(e,i){e&1&&(r(0,"div",0)(1,"h4",1),m(2),a(),g(3,Xa,4,1,"div"),a(),r(4,"div",2),g(5,el,1,1)(6,tl,1,2,"ng-otp-input",3),a(),g(7,il,5,0,"div",4)),e&2&&(s(2),y(" Confirm Your ",i.type=="pin"?"PIN":"OTP"," "),s(),R(i.type!="pin"?3:-1),s(2),R(i.type=="pin"?5:6),s(2),R(i.type!="pin"?7:-1))},dependencies:[Z,un,po,ze],encapsulation:2})};function nl(n,t){if(n&1){let e=v();r(0,"button",7),_("click",function(){u(e);let o=c();return f(o.onCancel())}),m(1,"Cancel"),a()}}function ol(n,t){if(n&1){let e=v();r(0,"button",8),_("click",function(){u(e);let o=c();return f(o.onConfirm())}),m(1,"Confirm"),a()}}var gn=class n{pointUsed=lt(0);redeemPointValue=lt(0);showCancelBtn=lt(!1);confirmEvent=new He;cancelEvent=new He;onConfirm(){this.confirmEvent.emit()}onCancel(){this.cancelEvent.emit()}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["confirm-step"]],inputs:{pointUsed:[1,"pointUsed"],redeemPointValue:[1,"redeemPointValue"],showCancelBtn:[1,"showCancelBtn"]},outputs:{confirmEvent:"onConfirm",cancelEvent:"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(e,i){e&1&&(r(0,"div",0)(1,"div",1),m(2,"Redeem"),a(),r(3,"div",2)(4,"span",3),m(5),b(6,"number"),a(),r(7,"small"),m(8,"Point"),a()(),r(9,"div",1),m(10,"~"),a(),r(11,"div",4)(12,"span",3),m(13),b(14,"number"),a(),r(15,"small"),m(16,"Discount"),a()(),g(17,nl,2,0,"button",5)(18,ol,2,0,"button",6),a()),e&2&&(s(5),T(O(6,3,i.pointUsed())),s(8),T(O(14,5,i.pointUsed()*i.redeemPointValue())),s(4),R(i.showCancelBtn()?17:18))},dependencies:[Z,X],encapsulation:2})};var ei=class n{constructor(t,e,i,o,l,C,N,ae,ke,Fe){this.customerHttpService=t;this.salesOrderService=e;this.pageInitialService=i;this.shoppingCartService=o;this.invoiceCalculatorService=l;this.orderProcessorService=C;this.toastr=N;this.promotionCouponService=ae;this.httpService=ke;this.registerService=Fe}customerId;customerData;_isCustomerVerfiedOtp=!1;get isCustomerVerfiedOtp(){return this._isCustomerVerfiedOtp}addCustomerById(t){return new ho(e=>{this.customerId=JSON.parse(JSON.stringify(this.salesOrderService.Data.Order.CustomerID)),this.resetCartOnChangeCustomer(t),S.IsNotEmpty(t)&&this.salesOrderService.updateCustomerID(t).then(i=>{this.applyCustomerPricebook(i),this.updateTaxCustomer(i.TaxTypeId),this.setSalesOrderCustomerId(i),this.setCustomerData(i),this.customerData.DiscountRate==null&&(this.customerData.DiscountRate=0),this._isCustomerVerfiedOtp=!1,this.applyConfigFullPriceOnly(),this.salesOrderService.pushNewValue();let o=this.checkResetRedeemPoint();this.orderProcessorService.reedemPointToDiscount(o),e.next(i)})})}addCustomerByCode(t){return this.salesOrderService.Data.ContactName=null,this.customerHttpService.findCustomerByCode(t).pipe(Ee(e=>(this.salesOrderService.Data.ContactName=e.Display,this.addCustomerById(e.ID))))}setSalesOrderCustomerId(t){let e=this.salesOrderService.Data,i=this.registerService.Data.ListSales,o=t.SalesID,l=i.find(C=>C.ID===o);S.IsNotEmpty(t.SalesID)&&l&&(e.Order.SalesID=t.SalesID)}setCustomerData(t){let e=this.salesOrderService.Data;if(t.EntityID==S.GuidEmpty)this.customerData=t;else if(t.EntityID!=e.Order.EntityID){e.Order.CustomerID=null,e.ContactName=null;let i=`${t?.Name} is exclusive to ${t?.EntityName} Outlet and cannot be used in other outlets!`;alert(i)}else this.customerData=t}checkResetRedeemPoint(){let t=!1;return S.IsNotEmpty(this.customerId)&&(t=!0),t}applyCustomerPricebook(t){let e=this.salesOrderService.Data;if(S.IsNotEmpty(t.PricebookID)){let i=e.CartItems.map(o=>(o.Variant.PriceBook&&o.Variant.PriceBook.length!==0&&o.Variant.PriceBook.forEach(l=>{l.ID===t.PricebookID&&o.Quantity>=l.MinimumQuantity&&(o=this.shoppingCartService.applyPricebookToItem(o,l))}),o));e.CartItems=i}}updateTaxCustomer(t){let i=this.pageInitialService.Data.Taxes.find(o=>o.ID==t);i&&(this.salesOrderService.Data.Order.TaxTypeID=i.ID,this.invoiceCalculatorService.tax=i)}resetCartOnChangeCustomer(t){let e=this.pageInitialService.Data.AppConfigJSON;this.customerId!=t&&e.ModuleSell.Customer.ClearCartOnChange&&(this.salesOrderService.Data.CartItems=[]),this.customerId=t}updateDiscountRate(t=0){if(t>0){let e=this.promotionCouponService.coupon,i=this.salesOrderService.Data.Order.Discount;e&&e.Requirement?.Type==1?i==e.Amount?t>e.Amount&&(this.toastr.warning("Member discount is applied because member discount is greater than Coupon Discount","Warning"),this.promotionCouponService.removeAppliedDiscountOnCustomerChange(),this.salesOrderService.Data.Order.Discount=t):(this.salesOrderService.Data.Order.Discount=t,this.salesOrderService.Data.Order.CustomerDiscountRate=t):(this.salesOrderService.Data.Order.Discount=t,this.salesOrderService.Data.Order.CustomerDiscountRate=t)}}applyConfigFullPriceOnly(){let t=this.filterGroupByDiscountRate(),e=this.salesOrderService.Data.CartItems;t?.OrderDiscountFullPriceProductOnly?this.filterItemWithDisc(e).length>0?e=this.applyItemsDisc(e,this.customerData.DiscountRate):this.updateDiscountRate(this.customerData.DiscountRate):this.updateDiscountRate(this.customerData.DiscountRate)}filterGroupByDiscountRate(){let e=(this.customerData?.Groups?this.customerData?.Groups:[]).filter(o=>o.OrderDiscountPercentage==this.customerData.DiscountRate),i;return e.length>1?(i=e.find(o=>o.OrderDiscountFullPriceProductOnly==!0),i||(i=e[0])):i=e[0],i}applyItemsDisc(t,e){return t=t.map(i=>(i.Discount==0&&i.DiscountAmount==0&&i.PriceTypeID!=3&&i.Price==i.UnitPrice&&S.IsEmpty(i.PriceBookID)&&(i.Discount=e,i.HasCustomerDiscount=!0),i)),t}filterItemWithDisc(t){return t.filter(i=>i.Discount>0||i.DiscountAmount>0||i.PriceTypeID==3||i.Price!=i.UnitPrice||S.IsNotEmpty(i.PriceBookID))}onEmptyInputCustomer(){S.IsNotEmpty(this.customerId)&&(this.promotionCouponService.removeAppliedDiscountOnCustomerChange(),this.resetAppliedPoint(),this.resetCustomerPricebook(),this.removeCustomerDiscountRate()),this.orderProcessorService.Data.InputTextValue="",this.customerId=JSON.parse(JSON.stringify(this.salesOrderService.Data.Order.CustomerID)),this._isCustomerVerfiedOtp=!1,this.customerData=null,this.salesOrderService.Data.ContactName=null,this.salesOrderService.Data.Order.CustomerID=null,this.customerHttpService.Data=new io,this.customerData=new io,this.salesOrderService.pushNewValue()}removeCustomerDiscountRate(){let t=this.filterGroupByDiscountRate(),e=this.salesOrderService.Data.CartItems;t?.OrderDiscountFullPriceProductOnly?this.filterItemWithDisc(e).length>0?this.salesOrderService.Data.CartItems=e.map(o=>(o.HasCustomerDiscount&&(o.Discount=0,o.HasCustomerDiscount=!1),o)):(this.salesOrderService.Data.Order.Discount=0,this.salesOrderService.Data.Order.CustomerDiscountRate=0):(this.salesOrderService.Data.Order.Discount=0,this.salesOrderService.Data.Order.CustomerDiscountRate=0)}resetCustomerPricebook(){if(this.customerData){let t=this.customerData.PricebookID;if(S.IsNotEmpty(t)){let e=this.salesOrderService.Data.CartItems;this.salesOrderService.Data.CartItems=e.map(i=>(i.PriceBookID==t&&(i.Discount=i.Variant.PriceDiscount,i.Note=i.Variant.PriceNote,i.PriceNote=i.Variant.PriceNote,i.PriceBookID=S.GuidEmpty,i.Price=i.Variant.UnitPrice,i.UnitPrice=i.Variant.UnitPrice),i))}}}resetAppliedPoint(){let t=this.salesOrderService.Data;t.Order.PointUsed>0&&(t.Order.PointUsed=0,t.Order.DiscountAmount=0)}redeemPoint(t){let e=this.pageInitialService.Data.AppConfigJSON,i=this.salesOrderService.Data,o=e.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,l=t*o,C=i.RedeemableAmount;l>C&&(o>0?(t=Math.ceil(C/o),l=C):(t=0,l=0),this.toastr.warning("You enter the number of points more than the total amount","Points Adjusted")),i.Order.PointUsed=t||0,i.Order.DiscountAmount=l,this.salesOrderService.pushNewValue(i)}sendOtpViaEmail(t){return this.httpService.post("/API/otp/email",{Email:t})}sendOtpViaWhatsApp(t){return this.httpService.post("/API/otp/WhatsApp",{Number:t})}verifyEmailOtp(t,e){return this.httpService.post("/API/otp/verifyemail",{Email:t,OTP:e}).pipe(Re(()=>this._isCustomerVerfiedOtp=!0))}verifyPin(t,e){return this.httpService.post("/API/pos/VerifyPin",{PIN:t,CustomerID:e}).pipe(Re(()=>this._isCustomerVerfiedOtp=!0))}verifyWhatsAppOtp(t,e){return this.httpService.post("/API/otp/verifywhatsapp",{Number:t,OTP:e}).pipe(Re(()=>this._isCustomerVerfiedOtp=!0))}get pointBalanced(){let t=this.customerHttpService.Data.Point,e=this.customerHttpService.Data.PointUsed;return(t||0)-(e||0)}static \u0275fac=function(e){return new(e||n)(A(dt),A(V),A(B),A(Me),A(Pe),A(j),A(ee),A(Xe),A(Qe),A(Y))};static \u0275prov=at({token:n,factory:n.\u0275fac,providedIn:"root"})};var ll=["stepper"];function sl(n,t){n&1&&m(0,"Points")}function cl(n,t){n&1&&m(0,"Verify")}function pl(n,t){n&1&&m(0,"Confirm")}var ti=class n{dialogRef=oe(F);outletRegisterService=oe(Y);pageInitialService=oe(B);customerHttpService=oe(dt);customerService=oe(ei);orderService=oe(V);toastr=oe(ee);modalConfig;enabledLoyaltyPoint=q(!1);stepper;pointUsed=0;pointBalance=q(0);redeemPointValue=q(0);email=q(null);phone=q(null);contactToResend=q(null);verifyType=q(null);clearPin=q(!1);selectedTab=q(0);constructor(){this.initModalConfig();let t=this.pageInitialService.Data.AppConfigJSON;this.redeemPointValue.set(t?.ApplicationLoyalty?.LoyaltyPoint?.RedeemPointValue),this.email.set(this.customerHttpService.Data?.Email),this.phone.set(this.customerHttpService.Data?.Mobile),this.initAvailablePoint(),this.initConfigEnabledVerify(),this.initPointUsed()}initModalConfig(){this.modalConfig=new U,this.modalConfig.title="Redeem Point",this.modalConfig.customWidth="500px",this.modalConfig.hideFooter=!0}initConfigEnabledVerify(){let t=this.pageInitialService.Data.AppConfigJSON,e=t?.ApplicationLoyalty?.VerifyRedemption,i=t?.ApplicationLoyalty?.Enabled,o=this.outletRegisterService.Data?.MemberPoint;this.enabledLoyaltyPoint.set(e&&i&&o)}initPointUsed(){let t=this.orderService.Data?.Order?.PointUsed;this.pointUsed=t||0,this.pointUsed>0&&this.selectedTab.set(2)}initAvailablePoint(){let t=this.customerHttpService.Data.Point,e=this.customerHttpService.Data.PointUsed,i=(t||0)-(e||0);this.pointBalance.set(i)}onClose(){this.dialogRef.close()}onCancelRedeem(){let t=this.orderService.Data;t.Order.PointUsed=0,t.Order.DiscountAmount=0,this.orderService.pushNewValue(t),this.toastr.info("Redeem point has been canceled","Canceled"),this.onClose()}onRedeem(){this.stepper.next(),this.stepper.next()}onVerify(t){switch(t){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(t)}handlingSentOtpViaPhone(){this.customerService.sendOtpViaWhatsApp(this.phone()).subscribe(t=>{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(t=>{this.stepper.selectedIndex==0&&this.stepper.next(),this.toastr.success(`OTP has been sent to ${this.email()}`,"Email Sent")})}onVerifyCode(t){switch(this.verifyType()){case"phone":this.verifyPhoneOtp(t);break;case"email":this.verifyEmailOtp(t);break;case"pin":this.verifyCustomerPin(t);break}}verifyEmailOtp(t){this.customerService.verifyEmailOtp(this.email(),t).subscribe(e=>{this.toastr.success(e.Message,"Successfully verified"),this.stepper.next()})}verifyPhoneOtp(t){this.customerService.verifyWhatsAppOtp(this.phone(),t).subscribe(e=>{this.toastr.success(e.Message,"Successfully verified"),this.stepper.next()})}verifyCustomerPin(t){let e=this.orderService.Data?.Order?.CustomerID;this.clearPin.set(!1),this.customerService.verifyPin(t,e).subscribe({next:i=>{this.toastr.success(i.Message,"Successfully verified"),this.stepper.next()},error:i=>{this.clearPin.set(!0)}})}onResendCode(){this.onVerify(this.verifyType())}onConfirm(){this.calculatePointToDiscount()}calculatePointToDiscount(){let t=this.pageInitialService.Data.AppConfigJSON,e=this.orderService.Data,i=e.RedeemableAmount,o=this.pointUsed,l=t.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,C=this.pointUsed*l;C>i&&(o=Math.ceil(i/l),C=i),(S.IsNotEmpty(e.Order.PointUsed)?e.Order.PointUsed:0)!=o&&(e.Order.PointUsed=o||0,e.Order.DiscountAmount=C,this.orderService.pushNewValue(e),this.toastr.success("Point has been redeemed","Success")),this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["modal-redeem-point"]],viewQuery:function(e,i){if(e&1&&ve(ll,5),e&2){let o;Se(o=ye())&&(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","aria-labelledby"],["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(e,i){if(e&1){let o=v();r(0,"modal-material",1),_("onClose",function(){return u(o),f(i.onClose())}),r(1,"content")(2,"div",2)(3,"div",3)(4,"mat-stepper",4,0)(6,"mat-step",5),g(7,sl,1,0,"ng-template",6),r(8,"div",7)(9,"point-step",8),_("onVerify",function(C){return u(o),f(i.onVerify(C))}),w("pointUsedChange",function(C){return u(o),D(i.pointUsed,C)||(i.pointUsed=C),f(C)}),_("onRedeem",function(){return u(o),f(i.onRedeem())}),a()()(),r(10,"mat-step",9),g(11,cl,1,0,"ng-template",6),r(12,"div",7)(13,"verify-step",10),_("resendCode",function(){return u(o),f(i.onResendCode())})("onVerify",function(C){return u(o),f(i.onVerifyCode(C))}),a()()(),r(14,"mat-step",11),g(15,pl,1,0,"ng-template",6),r(16,"div",7)(17,"confirm-step",12),_("onConfirm",function(){return u(o),f(i.onConfirm())})("onCancel",function(){return u(o),f(i.onCancelRedeem())}),a()()()()()()()()}e&2&&(p("preventEnterEvent",!0)("config",i.modalConfig),s(4),p("linear",!0)("selectedIndex",i.selectedTab()),s(2),p("editable",!0)("aria-labelledby",i.selectedTab()==2?"stepDisabled":""),s(3),p("isVerifyEnabled",i.enabledLoyaltyPoint()),M("pointUsed",i.pointUsed),p("pointBalance",i.pointBalance())("email",i.email())("phone",i.phone()),s(),p("editable",!1),s(3),p("type",i.verifyType())("contact",i.contactToResend())("clearPin",i.clearPin()),s(4),p("pointUsed",i.pointUsed)("redeemPointValue",i.redeemPointValue())("showCancelBtn",i.selectedTab()==2))},dependencies:[Z,Ae,W,Ce,Yr,zr,Gr,Kr,mn,fn,gn],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}']})};function ml(n,t){if(n&1){let e=v();x(0),r(1,"div",16),_("click",function(){u(e);let o=c(2);return f(o.onShowModalRedeem())}),r(2,"span"),h(3,"i",17),a(),r(4,"span"),m(5),b(6,"number"),a()(),I()}if(n&2){let e=c(2);s(5),y(" ",O(6,1,e.pointUsed)," Points redeemed ")}}function dl(n,t){if(n&1){let e=v();x(0),r(1,"tab",4)(2,"div",5)(3,"div",6)(4,"label",7),m(5,"Discount %"),a()(),r(6,"div",8)(7,"input",9),w("ngModelChange",function(o){u(e);let l=c();return D(l.discount1,o)||(l.discount1=o),f(o)}),a(),r(8,"span",10),m(9,"%"),a(),r(10,"span",11),m(11,"+"),a(),r(12,"input",12),w("ngModelChange",function(o){u(e);let l=c();return D(l.discount2,o)||(l.discount2=o),f(o)}),a(),r(13,"span",10),m(14,"%"),a()()(),r(15,"div",13)(16,"div",6)(17,"label",7),m(18),a()(),r(19,"div",14)(20,"input",15),w("ngModelChange",function(o){u(e);let l=c();return D(l.discountAmount,o)||(l.discountAmount=o),f(o)}),a(),g(21,ml,7,3,"ng-container",3),a()()(),I()}if(n&2){let e=c();s(),p("active",e.tabActive=="Discount"),s(6),M("ngModel",e.discount1),s(5),M("ngModel",e.discount2),s(6),y("Discount ",e.currencySymbol,""),s(2),p("disabled",e.pointUsed&&e.pointUsed>0),M("ngModel",e.discountAmount),s(),p("ngIf",e.pointUsed&&e.pointUsed>0)}}function ul(n,t){if(n&1){let e=v();x(0),r(1,"tab",18)(2,"div",5)(3,"div",6)(4,"label",7),m(5,"Tax"),a()(),r(6,"div",8)(7,"ng-select",19),_("change",function(o){u(e);let l=c();return f(l.updateTax(o))}),a()()(),r(8,"div",13)(9,"div",6)(10,"label",7),m(11,"Surcharge"),a()(),r(12,"div",8)(13,"input",20),w("ngModelChange",function(o){u(e);let l=c();return D(l.surcharge,o)||(l.surcharge=o),f(o)}),a(),r(14,"span",10),m(15,"%"),a()()()(),I()}if(n&2){let e=c();s(7),p("clearable",!1)("ngModel",e.salesOrder.Order.TaxTypeID)("items",e.taxes),s(6),M("ngModel",e.surcharge),p("max",100)("min",-100)}}function fl(n,t){if(n&1){let e=v();x(0),r(1,"tab",21)(2,"div",5)(3,"div",22)(4,"strong"),m(5,"Discount After Tax"),a()(),r(6,"div",23)(7,"input",24),w("ngModelChange",function(o){u(e);let l=c();return D(l.discountAfterTax,o)||(l.discountAfterTax=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onDiscountAfterTaxChange())}),a()()(),r(8,"div",25)(9,"div",22)(10,"label",7),m(11,"Discount Calculator"),a()(),r(12,"div",26)(13,"input",27),w("ngModelChange",function(o){u(e);let l=c();return D(l.discounts[0],o)||(l.discounts[0]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),a(),r(14,"span"),m(15," %"),a(),r(16,"span",11),m(17,"+"),a(),r(18,"input",28),w("ngModelChange",function(o){u(e);let l=c();return D(l.discounts[1],o)||(l.discounts[1]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),a(),r(19,"span"),m(20," %"),a(),r(21,"span",11),m(22,"+"),a(),r(23,"input",29),w("ngModelChange",function(o){u(e);let l=c();return D(l.discounts[2],o)||(l.discounts[2]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),a(),r(24,"span"),m(25," %"),a()()()(),I()}if(n&2){let e=c();s(7),M("ngModel",e.discountAfterTax),s(6),M("ngModel",e.discounts[0]),s(5),M("ngModel",e.discounts[1]),s(5),M("ngModel",e.discounts[2])}}var ii=class n{constructor(t,e,i,o,l,C,N,ae,ke,Fe){this.dialogRef=t;this.orderService=e;this.invoiceCalculatorService=i;this.pageInitialService=o;this.roleService=l;this.customerHttpService=C;this.orderProcessorService=N;this.promotionCouponService=ae;this.dialog=ke;this.data=Fe;let je=this.pageInitialService?.Data?.AppConfigJSON;this.modalConfig.title="Discount and Tax",this.modalConfig.customWidth="480px",this.salesOrder=this.orderService.Data,this.userRole=this.roleService.Data,this.isPreferedPayment=je?.ApplicationLoyalty?.PreferedPayment,this.tabActive=this.data?.tabIndexActive,this.isEditOrder=this.orderProcessorService.Data.posState==2,this.customer=C.Data,this.initDiscountAndTax(),this.initAvailablePoint(),this.initTabLoyaltyTitle()}modalConfig=new U;discount1;discount2;discountAmount;surcharge;discountAfterTax;currencySymbol;salesOrder;discounts=[];taxes;selectedTax;userRole;tabActive;isEditOrder;isPreferedPayment;customerPoint;customer;tabLoyaltyTitle;pointUsed;availablePoint;initAvailablePoint(){let t=this.customerHttpService.Data.Point,e=this.customerHttpService.Data.PointUsed;this.customerPoint=t,this.availablePoint=(t||0)-(e||0)}initTabLoyaltyTitle(){let e=this.pageInitialService?.Data?.AppConfigJSON?.ApplicationLoyalty?.Label;this.tabLoyaltyTitle=S.IsNotEmpty(e)?e:"Loyalty"}initDiscountAndTax(){this.discount1=this.salesOrder.Order.Discount,this.discount2=this.salesOrder.Order.Discount2,this.discountAmount=this.salesOrder.Order.DiscountAmount,this.surcharge=this.salesOrder.Invoice.SurchargePcg,this.discountAfterTax=this.invoiceCalculatorService.discountAfterTax,this.currencySymbol=this.invoiceCalculatorService.currencySymbol,this.taxes=this.pageInitialService.Data.Taxes,this.selectedTax=this.invoiceCalculatorService.tax,this.pointUsed=this.salesOrder.Order.PointUsed}updateTax(t){this.selectedTax=t}onOk(){this.resetAppliedCoupon(),this.applyChangesDiscountAmount(),this.salesOrder.Order.Discount=this.discount1,this.salesOrder.Order.Discount2=this.discount2,this.salesOrder.Invoice.SurchargePcg=this.surcharge,this.salesOrder.Invoice.TempSurchargePcg=this.surcharge,this.invoiceCalculatorService.discountAfterTax=this.discountAfterTax,this.salesOrder.Order.TaxTypeID=this.selectedTax.ID,this.invoiceCalculatorService.tax=this.selectedTax,this.orderService.pushNewValue(this.salesOrder),this.onClose()}onClose(){this.dialogRef.close()}calculateDiscountCalculator(){var t=100;this.discounts.forEach(e=>{t=t*(100-e)/100}),this.discount1=100-t}onDiscountAfterTaxChange(){this.discountAmount=this.discountAfterTax;let e=this.invoiceCalculatorService.TotalBeforeTax-this.discountAmount,i=this.orderService.Data.Order.TaxTypeID,o=this.pageInitialService.Data.Taxes,l=S.FilterByID(o,i);if(S.IsNotEmpty(l)&&l.CalculationTypeID==0){let C=1+l.Rate/100,N=e*C;this.discountAmount=(N-(N-this.discountAfterTax))/C}}applyChangesDiscountAmount(){let t=this.salesOrder.Order.DiscountAmount;this.discountAmount!=t&&(this.salesOrder.Order.DiscountAmount=this.discountAmount)}onTabChange(t){this.tabActive=t}resetAppliedCoupon(){let t=this.promotionCouponService.coupon,e=this.salesOrder.Order.DiscountAmount;t&&t.Requirement?.Type==2&&e!=this.discountAmount&&(this.salesOrder.Order.PromotionCoupon=null,this.salesOrder.Order.PromotionNote=null)}onShowModalRedeem(){this.onClose(),this.dialog.open(ti)}static \u0275fac=function(e){return new(e||n)(d(F),d(V),d(Pe),d(B),d(me),d(dt),d(j),d(Xe),d(ne),d(Ve))};static \u0275cmp=P({type:n,selectors:[["POS-modal-discount"]],decls:7,vars:4,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],[3,"onTabChange"],[4,"ngIf"],["tabTitle","Discount",3,"active"],[1,"row","d-flex","align-items-center","justify-content-start"],[1,"col-3"],[1,"fw-bold","d-block"],[1,"col-9"],["type","text","data-cy","discount1","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],[1,"ms-1"],[1,"mx-2"],["type","text","data-cy","discount2","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],[1,"row","d-flex","align-items-center","justify-content-start","mt-6"],[1,"col-9","d-flex","align-items-center"],["type","text","data-cy","discountamount","autoNum","","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","disabled","ngModel"],["role","button",3,"click"],[1,"fa-solid","fa-info-circle","ms-2"],["matTooltipPosition","above","tabTitle","Tax"],["bindLabel","Label","appendTo","body","bindValue","ID","placeholder","Tax","data-cy","select-tax",2,"width","150px",3,"change","clearable","ngModel","items"],["type","text","data-cy","surcharge","autoNum","","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","85px",3,"ngModelChange","ngModel","max","min"],["tabTitle","Calculator"],[1,"col-4"],[1,"col-8","ps-6"],["type","text","num-neg","false","autoNum","","emptyInputBehavior","zero",1,"txtPrice","form-control",2,"width","100px",3,"ngModelChange","ngModel"],[1,"row","mt-6","g-0","d-flex","align-items-center","justify-content-start"],[1,"col-8","ps-4"],["type","text","data-cy","discountCal1","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],["type","text","data-cy","discountCal2","autoNum","","decimalPlaces","2","percentage","","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],["type","text","data-cy","discountCal3","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("keydown.F2",function(){return i.onOk()})("onOk",function(){return i.onOk()})("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()}),r(1,"content")(2,"div",1)(3,"custom-tabs",2),_("onTabChange",function(l){return i.onTabChange(l)}),g(4,dl,22,7,"ng-container",3)(5,ul,16,6,"ng-container",3)(6,fl,26,4,"ng-container",3),a()()()()),e&2&&(p("config",i.modalConfig),s(4),p("ngIf",i.userRole.Discount),s(),p("ngIf",i.userRole.Tax),s(),p("ngIf",i.userRole.Discount))},dependencies:[Z,$,X,Ce,te,K,ie,Ki,Wr,Ur,Ae,W,nt,ut,pt,Ke],encapsulation:2})};var Cn=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=_t({type:n});static \u0275inj=gt({imports:[Z,Ce]})};var hn=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=_t({type:n});static \u0275inj=gt({imports:[Z,Ce,ze,Ae,Qt,nt,Jr,ut,Ki,Ke,un,Wi,hr,Wt,ut,Bt,Xr,ir,Ti,Cn,ea,xt,Vi,ia,Xi,nt,ii,Rt,ki]})};var bn=class n{constructor(t,e,i,o,l,C,N){this.orderProcessorService=t;this.posDataService=e;this.signalBroadCast=i;this.calculatorService=o;this.OrderHttpService=l;this.localDataService=C;this.posService=N;this.newSale=new He}newSale;retrySubmit(){let t=this.posService.Data.AppConfigJSON,e=this.posDataService.Data;this.posDataService.submitOrder(t).then(i=>{i.Success?(this.broadcastToCustomerDisplay(i),this.posDataService.pushNewValue(e),this.orderProcessorService.updatePosState(1,i)):(this.posDataService.pushNewValue(e),this.orderProcessorService.updatePosState(1,i))}).catch(i=>{console.log(i)})}broadcastToCustomerDisplay(t){let i=this.posDataService.Data.TotalPaidAmount-this.calculatorService.Data;this.signalBroadCast.BroadcastStateToCustomerDisplay(1,t.ObjectID,t.LoyaltyPoint,i).subscribe()}saveOffline(){let t=this.posDataService.Data,e=this.OrderHttpService.generatePOSDataForSubmission(t,!1);this.localDataService.syncOrder(e).subscribe(()=>{this.newSale.next()})}static \u0275fac=function(e){return new(e||n)(d(j),d(V),d(Hi),d(Pe),d(Oe),d(Ye),d(B))};static \u0275cmp=P({type:n,selectors:[["app-retry"]],outputs:{newSale:"newSale"},decls:21,vars:0,consts:[[1,"card"],[1,"card-header","bg-gradient-danger"],[1,"d-flex","justify-content-between"],[1,"fa-solid","fa-times-circle","me-1","text-danger"],[1,"card-body"],[1,"row","justify-content-center","g-0","mt-8"],[1,"col-8","text-center"],[1,"text-danger","fs-5"],[1,"row","mt-4","justify-content-center","g-0","mb-9"],[1,"col-5","text-center"],["type","button","matTooltipPosition","above","matTooltip","Upload your local / offline order to the cloud",1,"btn","btn-success","btn-lg","fs-3",3,"click"],[1,"card-footer","bg-light-gray"],[1,"row","justify-content-between","py-6"],[1,"col-auto"],["type","button","matTooltipPosition","above","matTooltip","Temporarily save data locally until connection to the server is restored",1,"btn","btn-light-gray",3,"click"],[1,"fa-solid","fa-save","me-2",2,"font-size","14px"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1)(2,"div",2)(3,"h2"),h(4,"i",3),m(5," Order Upload Fail! "),a()()(),r(6,"div",4)(7,"div",5)(8,"div",6)(9,"p",7),m(10," Slow Connection Detected, Check the customer invoice list first. If the transaction isn't there, click the 'Retry' button. "),a()()(),r(11,"div",8)(12,"div",9)(13,"button",10),_("click",function(){return i.retrySubmit()}),m(14," Retry Upload "),a()()()(),r(15,"div",11)(16,"div",12)(17,"div",13)(18,"button",14),_("click",function(){return i.saveOffline()}),h(19,"i",15),m(20,"Save Offline "),a()()()()())},dependencies:[Z,Ke,se],encapsulation:2})};var ma=(()=>{class n{constructor(){this.emailRegex=S.emailRegex,this.phoneNumberRegex=S.phoneNumberRegex}validate(e){let i=this.emailRegex,o=this.phoneNumberRegex,l=i.test(e.value),C=o.test(e.value);if(l||C||e.value=="")return null;{let N="Please input a valid email or phone number";return C?N="Please input a valid email":l&&(N="Please input a valid phone number"),{invalidEmailOrPhoneNumber:{value:e.value,errMessage:N}}}}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275dir=Ii({type:n,selectors:[["","pOSIsInvalidEmailOrPhoneNumber",""]],features:[st([{provide:Wo,useExisting:n,multi:!0}])]})}}return n})();function _l(n,t){n&1&&(x(0),r(1,"div",3)(2,"h4",4),m(3," For use this feature you must register first!"),h(4,"br"),m(5," Click the link below "),a()(),r(6,"a",5),m(7,"more information"),a(),m(8," > "),I())}function Cl(n,t){if(n&1){let e=v();r(0,"div",6)(1,"div",7)(2,"span",8),h(3,"i",9),a(),h(4,"input",10),r(5,"button",11),m(6,"Copy to Clipboard"),a()()(),r(7,"div",12)(8,"div",13)(9,"span",14),h(10,"i",15),a(),h(11,"input",16),r(12,"button",17),_("click",function(){u(e);let o=c();return f(o.onSendViaWhatsApp())}),m(13,"Send via WhatsApp"),a()()()}if(n&2){let e=c();s(4),p("value",e.data.link),s(),p("cdkCopyToClipboard",e.data.link),s(6),p("formControl",e.whatsAppNumberCtrl),s(),p("disabled",e.whatsAppNumberCtrl.invalid)}}var bi=class n{constructor(t,e,i){this._dialogRef=t;this._toast=e;this.data=i}modalConfig=new U;whatsAppNumberCtrl;ngOnInit(){this.modalConfig.title="Midtrans Payment Link",this.modalConfig.hideFooter=!0,this.modalConfig.customWidth="500px",this.initWaNumberCtrl()}initWaNumberCtrl(){this.whatsAppNumberCtrl=new $o(null,[ui.pattern("^[0-9]*$"),ui.required])}close(){this._dialogRef.close()}onSendViaWhatsApp(){let t=this.whatsAppNumberCtrl.value;if(t){let e="https://wa.me/"+t+"?text="+this.data.link;window.open(e,"_blank")}else this._toast.error("Phone Number must be insert")}static \u0275fac=function(e){return new(e||n)(d(F),d(ee),d(Ve))};static \u0275cmp=P({type:n,selectors:[["POS-modal-generate-link"]],standalone:!1,decls:5,vars:3,consts:[["hasLink",""],[3,"onOk","onCancel","onClose","config"],[4,"ngIf","ngIfElse"],[1,"input-group","mb-2",2,"width","350px"],[1,"fw-normal","d-block"],["href","https://midtrans.com/id/product/payment-link","target","_blank"],[1,"col-sm-12"],[1,"input-group"],["id","inputGroup-sizing-lg p-6",1,"input-group-text"],[1,"fa-solid","fa-link","fs-5"],["readonly","","type","text","aria-label","Link href",1,"form-control",3,"value"],["id","btnCopyLink","type","button",1,"btn","btn-outline-secondary",2,"width","150px",3,"cdkCopyToClipboard"],[1,"col-sm-12","mt-6"],[1,"input-group",2,"width","29.4rem"],["id","inputGroup-sizing-lg",1,"input-group-text","p-7"],[1,"fa-solid","fa-mobile-screen-button","fs-3"],["type","text","placeholder","Mobile Number (e.g. 6281500000000)","aria-label","Mobile Number (e.g. 6281500000000)",1,"form-control",3,"formControl"],["id","btnSend","type","button",1,"btn","btn-outline-secondary",3,"click","disabled"]],template:function(e,i){if(e&1){let o=v();r(0,"modal-material",1),_("onOk",function(){return u(o),f(i.close())})("onCancel",function(){return u(o),f(i.close())})("onClose",function(){return u(o),f(i.close())}),r(1,"content"),g(2,_l,9,0,"ng-container",2)(3,Cl,14,4,"ng-template",null,0,G),a()()}if(e&2){let o=Q(4);p("config",i.modalConfig),s(2),p("ngIf",i.data.link==null||i.data.link=="")("ngIfElse",o)}},dependencies:[$,te,K,vt,W,ta],encapsulation:2})};var vl=n=>({"rounded-0 rounded-start-2":n}),Sl=(n,t)=>({"bg-gradient-warning":n,"bg-gradient-danger":t}),yl=n=>({offline:n}),xl=n=>({"ms-2":n}),Il=(n,t)=>({ID:n,Template:t}),Ol=(n,t,e)=>({InvoiceID:n,OutID:t,Template:e}),Pl=n=>({ID:n,Print:1,Printer:"Normal"}),Ml=n=>({ID:n});function Dl(n,t){if(n&1&&(r(0,"a",47),m(1,"Delivery Order"),a()),n&2){let e=c(3);p("queryParams",ge(1,Il,e.completeData.OutDeliveryID,e.outletRegister.PrintTemplate.ID))}}function wl(n,t){if(n&1&&(r(0,"a",48),m(1,"Invoice & Delivery Order"),a()),n&2){let e=c(3);p("queryParams",Et(1,Ol,e.completeData.ObjectID,e.completeData.OutDeliveryID,e.outletRegister.PrintTemplate.ID))}}function kl(n,t){if(n&1&&(r(0,"a",49),m(1,"Invoice (No Price)"),a()),n&2){let e=c(3);p("href",e.getInvoicePrintURL(!0),tt)}}function Tl(n,t){if(n&1&&(r(0,"a",50),m(1,"Packing Slip"),a()),n&2){let e=c(3);p("queryParams",E(1,Pl,e.completeData.OutDeliveryID))}}function El(n,t){if(n&1&&(r(0,"div",30),h(1,"button",41),r(2,"div",42),g(3,Dl,2,4,"a",43)(4,wl,2,5,"a",44)(5,kl,2,1,"a",45)(6,Tl,2,3,"a",46),a()()),n&2){let e=c(2);s(3),p("ngIf",e.completeData.OutDeliveryID),s(),p("ngIf",e.completeData.OutDeliveryID),s(),p("ngIf",e.completeData),s(),p("ngIf",e.completeData.OutDeliveryID)}}function Rl(n,t){n&1&&(r(0,"div",32)(1,"div",36)(2,"p",51),m(3," Transaction saved to your browser's local storage. Please upload when connection is restored! "),a()()())}function Nl(n,t){if(n&1){let e=v();r(0,"div",33)(1,"div",52)(2,"div",53),_("click",function(){u(e);let o=c(2);return f(o.changeReceiptContact())}),h(3,"i"),a(),r(4,"input",54),_("ngModelChange",function(o){u(e);let l=c(2);return f(l.isPhoneOrEmail(o))}),a()(),r(5,"div",55)(6,"button",56),_("click",function(){u(e);let o=c(2);return f(o.sendReceiptToContact())}),m(7," Send Receipt "),a()()()}if(n&2){let e=c(2);s(3),be(e.receiptIcon+" fs-4"),s(),p("formControl",e.customerContact),s(2),p("disabled",e.customerContact.invalid)}}function Vl(n,t){if(n&1&&(r(0,"small",34),m(1),a()),n&2){let e=c(2);s(),y(" ",e.customerContact.errors==null||e.customerContact.errors.invalidEmailOrPhoneNumber==null?null:e.customerContact.errors.invalidEmailOrPhoneNumber.errMessage," ")}}function Al(n,t){if(n&1){let e=v();r(0,"button",57),_("click",function(){u(e);let o=c(2);return f(o.onRetry())}),m(1," Retry Upload "),a()}}function Ll(n,t){if(n&1){let e=v();r(0,"div",60)(1,"button",61),_("click",function(){u(e);let o=c(3);return f(o.generateLink())}),h(2,"i",62),m(3,"Generate Payment Link "),a()()}}function Bl(n,t){if(n&1){let e=v();r(0,"div",60)(1,"button",63),_("click",function(){u(e);let o=c(3);return f(o.verifyPaymentSettlement())}),h(2,"i",64),m(3,"Verify Payment Settlement "),a()()}}function Fl(n,t){if(n&1&&(r(0,"div",40)(1,"div",58),g(2,Ll,4,0,"div",59)(3,Bl,4,0,"div",59),a()()),n&2){let e=c(2);s(2),p("ngIf",e.completeData.PaymentStateID==1),s(),p("ngIf",e.isNotEmpty(e.paymentGatewayService.getTransactionId()))}}function jl(n,t){if(n&1){let e=v();r(0,"div",9)(1,"div",26)(2,"div",27)(3,"h2"),h(4,"i",28),m(5," Sell Complete "),r(6,"small",29),m(7),a()(),r(8,"div"),g(9,El,7,4,"div",30),a()()(),r(10,"div",14)(11,"div",31),g(12,Rl,4,0,"div",32)(13,Nl,8,5,"div",33)(14,Vl,2,1,"small",34),r(15,"div",35)(16,"div",36)(17,"div",37),g(18,Al,2,0,"button",38),r(19,"button",39),_("click",function(){u(e);let o=c();return f(o.newSale())}),m(20," New Sale (F8) "),a()()()()()(),g(21,Fl,4,2,"div",40),a()}if(n&2){let e=c();s(),p("ngClass",ge(9,Sl,(!e.isOrderDateNow||e.completeData.PaymentStateID<3)&&e.completeData.PaymentStateLabel!="Offline",e.completeData.PaymentStateLabel=="Offline")),s(6),y(" (",e.completeData.PaymentStateLabel,")"),s(2),R(e.completeData.PaymentStateLabel=="Offline"?9:-1),s(2),p("ngClass",E(12,yl,e.completeData.PaymentStateLabel=="Offline")),s(),R(e.completeData.PaymentStateLabel=="Offline"?12:13),s(2),R(e.customerContact!=null&&e.customerContact.invalid&&(e.customerContact!=null&&e.customerContact.dirty||e.customerContact!=null&&e.customerContact.touched)?14:-1),s(4),R(e.completeData.PaymentStateLabel=="Offline"&&!e.isSuccessRetrySubmit()?18:-1),s(),p("ngClass",E(14,xl,e.completeData.PaymentStateLabel=="Offline")),s(2),R(e.isOnline&&(e.completeData==null?null:e.completeData.PaymentStateID)==1||e.isNotEmpty(e.paymentGatewayService.getTransactionId())?21:-1)}}function Hl(n,t){if(n&1){let e=v();r(0,"app-retry",65),_("newSale",function(){u(e);let o=c();return f(o.newSale())}),a()}}function Ul(n,t){if(n&1&&(x(0),r(1,"a",66),m(2),a(),I()),n&2){let e=c();s(),p("queryParams",E(2,Ml,e.completeData.ObjectID)),s(),y(" Invoice #",e.completeData==null?null:e.completeData.InvoiceNumber," ")}}function Wl(n,t){if(n&1&&(r(0,"span",67),m(1),a()),n&2){let e=c();s(),y(" Invoice #",e.completeData==null?null:e.completeData.InvoiceNumber," ")}}function Ql(n,t){if(n&1&&(x(0),m(1),b(2,"number"),I()),n&2){let e=c().$implicit;s(),Ue(" ",e.CurrencySymbol," ",O(2,2,e.Amount)," ")}}function ql(n,t){n&1&&m(0," - ")}function $l(n,t){if(n&1&&(r(0,"div",69)(1,"div",70),m(2),a(),r(3,"div",71),g(4,Ql,3,4,"ng-container",13)(5,ql,1,0,"ng-template",null,1,G),a()()),n&2){let e=t.$implicit,i=Q(6),o=c(2);s(2),T(e.Label),s(2),p("ngIf",o.role.PriceVisible)("ngIfElse",i)}}function Jl(n,t){if(n&1&&(r(0,"div",14),g(1,$l,7,3,"div",68),a()),n&2){let e=c();s(),p("ngForOf",e.itemSummary)}}function Gl(n,t){if(n&1&&(r(0,"div",75)(1,"div",76),m(2),a(),r(3,"div",77),m(4),b(5,"number"),a()()),n&2){let e=t.$implicit,i=t.index,o=c(2);s(),p("hidden",!o.role.PriceVisible),s(),Ue(" ",e.Label,": ",e.CurrencySymbol," "),s(),p("hidden",!o.role.PriceVisible)("ngClass",i+1===o.amountSummary.length?"amount":""),s(),y(" ",O(5,6,e.Amount)," ")}}function zl(n,t){if(n&1&&(r(0,"div",75)(1,"div",76),m(2),a(),r(3,"div",79),m(4),b(5,"number"),a()()),n&2){let e=t.$implicit,i=c(3);s(),p("hidden",!i.role.PriceVisible),s(),Ue(" ",e.Label,": ",e.CurrencySymbol," "),s(),p("hidden",!i.role.PriceVisible),s(),y(" ",O(5,5,e.Amount)," ")}}function Kl(n,t){if(n&1&&(x(0),r(1,"div",78),g(2,zl,6,7,"div",73),a(),I()),n&2){let e=c(2);s(2),p("ngForOf",e.paymentSummary)}}function Yl(n,t){if(n&1&&(r(0,"div",72),g(1,Gl,6,8,"div",73)(2,Kl,3,1,"ng-container",74),a()),n&2){let e=c();s(),p("ngForOf",e.amountSummary),s(),p("ngIf",(e.paymentSummary==null?null:e.paymentSummary.length)>0)}}function Xl(n,t){if(n&1&&(r(0,"div",16)(1,"div",80)(2,"p",81),m(3,"INVALID AMOUNT CHARGE, CORRECT AMOUNT"),a(),r(4,"P",82),m(5),b(6,"number"),a()()()),n&2){let e=c();s(5),y("",O(6,1,e.completeData==null?null:e.completeData.Final)," ")}}function Zl(n,t){if(n&1&&(r(0,"a",22),h(1,"i",83),a()),n&2){let e=c();p("href",e.getInvoicePrintURL(!1),tt)}}function es(n,t){if(n&1&&(r(0,"div",9)(1,"div",11)(2,"h3",12),m(3,"Point Balance"),a()(),h(4,"div",84),a()),n&2){let e=c();s(4),p("innerHtml",e.completeData.LoyaltyPoint,xi)}}function ts(n,t){if(n&1&&h(0,"pos-receipt",85),n&2){let e=c(2);p("data",e.receiptTemplate)("printTemplate",e.outletRegister.PrintTemplate)("config",e.posStorage.AppConfigJSON)("priceVisibleRestriction",!e.role.PriceVisible)("outletInfo",e.outletRegister)("isUnknownError",e.currentSellState==e.sellState.UploadOrderFail)("isOffline",e.isOnline==!1)("stylesheet",e.posStorage.StylesSheet)}}function is(n,t){if(n&1&&h(0,"pos-receipt-a4",86),n&2){let e=c(3);p("data",t)("printTemplate",e.outletRegister.PrintTemplate)("config",e.posStorage.AppConfigJSON)("workOrderMode",!1)("stylesheet",e.posStorage.StylesSheet)}}function ns(n,t){if(n&1&&(g(0,is,1,5,"pos-receipt-a4",86),b(1,"async")),n&2){let e,i=c(2);R((e=O(1,1,i.receiptTemplateA4$))?0:-1,e)}}function os(n,t){if(n&1&&g(0,ts,1,8,"pos-receipt",85)(1,ns,2,3),n&2){let e=c();R(e.receiptTemplate&&e.printMode==2?0:-1),s(),R(e.printMode==1?1:-1)}}function rs(n,t){n&1&&(r(0,"div",25)(1,"h1"),m(2," Cannot generate print preview because of client-server amount Mismatch "),a()())}var vn=class n{constructor(t,e,i,o,l,C,N,ae,ke,Fe,je,ri,Tt,Kn,Yn,ai,ka,go,_o,Ta){this._posDataService=t;this._posService=e;this._orderProcessorService=i;this._OrderHttpService=o;this._PaymentHttpService=l;this._receiptService=C;this._outletService=N;this._toastr=ae;this._onlineStatusService=ke;this._matDialog=Fe;this._signalBroadCast=je;this._calculatorService=ri;this._userRoleService=Tt;this._router=Kn;this._receiptCalculatorService=Yn;this.datePipe=ai;this.decimalPipe=ka;this.paymentGatewayService=go;this.paymentHttpService=_o;this.shoppingCartService=Ta}whatsappSendReceiptService=oe(ro);handleF8(){this.newSale()}salesOrder=new mt;receiptTemplate=null;receiptTemplateA4$;completeData=new xr;printMode=2;outletRegister=new Ai;role;finalAmountDifferent=!1;amountSummary=[];itemSummary=[];paymentSummary=[];isOnline=!1;destroy$=new z;get posStorage(){return this._posService.Data}currentSellState;isOrderDateNow;sellState=xe;receiptIcon="fa-brands fa-whatsapp";customerContact=new bt;printOnPayment=q(!0);isSuccessRetrySubmit=q(!1);ngOnInit(){this.resetUrlAfterRedirect(),this.subscribeToObservableChanges()}subscribeToObservableChanges(){this._onlineStatusService.getOnlineStatus$().pipe(k(this.destroy$)).subscribe(t=>{this.isOnline=t}),this._userRoleService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.role=t}),this._posDataService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.salesOrder=t}),this._outletService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.outletRegister=t;let e=this.outletRegister?.PrintTemplate?.PrintMode;this.initPrintMode(e)}),this._orderProcessorService.Data$.pipe(ce(t=>t.posState===1||t.posState===9),k(this.destroy$)).subscribe(t=>{if(this.currentSellState=t.posState,this.generateCompleteSummary(),this._OrderHttpService.Data){let e=this.posStorage?.AppConfigJSON?.ModuleSell?.OrderComplete?.PrintOnPayment;this.printOnPayment.set(e),this.completeData=this._OrderHttpService.Data,this.checkFinalAmountDifferent(),this.setLoyaltyLabelConfig(),this.InitPrintInvoice(),this.initCustomerContact(),this.sendEmailOnComplete(),this.checkOrderDateIsNow(),this.clearShoppingCartInLocalStorage()}})}clearShoppingCartInLocalStorage(){this.shoppingCartService.clearCartItemsInLocalStorage()}generateCompleteSummary(){this.itemSummary=this._receiptService.generateCartItemSummary(),this.amountSummary=this._receiptCalculatorService.generateAmountSummary(),this.paymentSummary=this._receiptService.generatePaymentSummary()}initPrintMode(t){this.isOnline?this.printMode=t:this.printMode=2}sendEmailOnComplete(){let t=this.posStorage?.AppConfigJSON?.ModuleSell?.OrderComplete?.EmailReceipt,e=this.completeData?.Contact?.Email;t&&S.IsNotEmpty(e)&&this.sendEmail()}resetUrlAfterRedirect(){this._router.events.pipe(k(this.destroy$)).subscribe(t=>{t instanceof Fo&&(t?.url?.includes("Sell")||(this._orderProcessorService.createNewTransactionInSameOutletRegister(),this._signalBroadCast.BroadcastStateToCustomerDisplay(0).subscribe()))})}InitPrintInvoice(){this.currentSellState==1&&(this.checkOrderNumber(),this.print())}initCustomerContact(){if(this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.DefaultReceiptChannel==0){this.receiptIcon="fa-solid fa-envelope";let t=this.completeData?.Contact?.Email;this.customerContact.setValue(t)}else if(this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.DefaultReceiptChannel==1){this.receiptIcon="fa-brands fa-whatsapp";let t=this.completeData?.Contact?.Mobile;this.customerContact.setValue(t)}}isPhoneOrEmail(t){let e=S.emailRegex,i=S.phoneNumberRegex,o=e,l=i,C=o.test(t),N=l.test(t);if(C)return this.receiptIcon="fa-solid fa-envelope","Email";if(N)return this.receiptIcon="fa-brands fa-whatsapp","Mobile"}changeReceiptContact(){this.receiptIcon=="fa-solid fa-envelope"?(this.receiptIcon="fa-brands fa-whatsapp",this.customerContact.setValue(this.completeData?.Contact?.Mobile)):(this.receiptIcon="fa-solid fa-envelope",this.customerContact.setValue(this.completeData?.Contact?.Email))}checkOrderDateIsNow(){let t=this.completeData.OrderTimeString,e=this.datePipe.transform(this.salesOrder.Order.Date,"dd MMM yyyy");this.isOrderDateNow=t.includes(e)}checkFinalAmountDifferent(){if(this.currentSellState==1){let t=this.posStorage.AppConfigJSON,e=this.completeData.Final,i=this._calculatorService.Data,o=t.ModuleSell.ToleranceAmount,l=e-i;if(l!=o&&l!=0){this.finalAmountDifferent=!0;let C=this.decimalPipe.transform(e);setTimeout(()=>{this._toastr.warning(`Final Amount should be ${C}! Use Print Receipt to print the correct Receipt!`,"Invalid Amount charged",{timeOut:1e4})},500)}else this.finalAmountDifferent=!1}}checkOrderNumber(){this.completeData.InvoiceNumber!=this.salesOrder.Order.Number&&(this._toastr.warning("Your transaction number is changed to "+this.completeData.InvoiceNumber,"Transaction Number Changed!"),this.salesOrder.Order.Number=this.completeData.InvoiceNumber)}generateLink(){this.posStorage.AppConfigJSON.PaymentConfigLink==!0&&this._matDialog.open(bi);let t={InvoiceID:this.completeData.ObjectID};this._PaymentHttpService.generateLink(t).subscribe({next:e=>{this._matDialog.open(bi,{data:{link:e.token.redirect_url}})},error:e=>{this._toastr.error(e.Message,"Couldn't generate link!")}})}newSale(){try{this._orderProcessorService.createNewTransactionInSameOutletRegister(),this._signalBroadCast.BroadcastStateToCustomerDisplay(0).subscribe(),this.paymentGatewayService.resetPaymentMethod(),this._router.navigate([],{queryParams:{ID:null}})}catch(t){console.error(t),this._toastr.error(t,"Error redirecting to NEW mode")}}onRetry(){this._onlineStatusService.isOnline?this._posDataService.uploadOfflineOrder().subscribe(e=>{e.Success?(this.isSuccessRetrySubmit.set(!0),this.broadcastToCustomerDisplay(e),this._orderProcessorService.updatePosState(1,e)):this._orderProcessorService.updatePosState(1,e)}):this._toastr.error("Please check your internet connection and try again.","Connection Required")}broadcastToCustomerDisplay(t){let i=this._posDataService.Data.TotalPaidAmount-this._calculatorService.Data;this._signalBroadCast.BroadcastStateToCustomerDisplay(1,t.ObjectID,t.LoyaltyPoint,i).subscribe()}getInvoicePrintURL(t){let e="/print/Invoice"+(this.outletRegister.PrintTemplate.PrintMode===2?"Mini":""),i="";return t&&(i="&Print=1&Price=0"),S.StringFormat("{0}?ID={1}&Template={2}{3}",e,this.completeData.ObjectID,this.outletRegister?.PrintTemplate?.ID?.toString(),i)}sendEmail(){if(!this.role.Email){this._toastr.info("You do not have required Role",Le.Info);return}this._OrderHttpService.sendEmail(this.customerContact.value,this.completeData.ObjectID).then(t=>{this._toastr.success(t.Message,"Email sent!")})}sendReceiptByWhatsaap(){let t=this.customerContact.value;this.whatsappSendReceiptService.createCustomerFromNewNumberAndSendReceipt(t,this._calculatorService.currencySymbol,this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.WhatsappReceipt,{Final:this.completeData.Final,InvoiceNumber:this.completeData.InvoiceNumber,ObjectID:this.completeData.ObjectID},this._posService.Data?.WhatsAppConfigJSON?.TextReceipt)}print(){this.printMode==2?(this.printReceiptMini(),this.printOnPayment()&&this.printWindow()):this.printMode==1&&this.printReceiptA4()}printReceiptMini(){this.receiptTemplate=this._receiptService.generateReceiptMini()}setLoyaltyLabelConfig(){let t=this.posStorage?.AppConfigJSON;t.LoyaltyLabel=t.ApplicationLoyalty.Label,this.posStorage.AppConfigJSON=t}printReceiptA4(){this.receiptTemplateA4$==null?this.receiptTemplateA4$=this._OrderHttpService.generateReceiptA4(this.completeData.ObjectID).pipe(k(this.destroy$),et(t=>(t.Data.AfterSell=!0,t.Data)),li(t=>{throw this._toastr.error(`Could not print in A4 format!
|
|
5
|
-
Printing in 8mm format instead!`,"Error!"),this.printReceiptMini(),t}),Re(()=>{this.printOnPayment()&&this.printWindow()}),At(1)):this.printWindow()}printWindow(){let t=document.title;document.title=this.getCustomPrintFileName(),setTimeout(()=>{window.print(),document.title=t},500)}getCustomPrintFileName(){return`Invoice_${this.completeData?.InvoiceNumber}`}isNotEmpty(t){return S.IsNotEmpty(t)}verifyPaymentSettlement(){let t=this._calculatorService.Data,e=this.paymentGatewayService.paymentMethod,i=this.paymentGatewayService.generatePaymentVerificationData(t,e.EMoneyTypeID);this.paymentHttpService.VerifyPayment(i,e.EMoneyTypeID).pipe(k(this.destroy$)).subscribe({next:o=>{this._toastr.success(o.Message,"QR Settlement")}})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}sendReceiptToContact(){let t=S.emailRegex,e=S.phoneNumberRegex,i=this.customerContact.value,o=t.test(i),l=e.test(i);o?this.sendEmail():l&&this.sendReceiptByWhatsaap()}static \u0275fac=function(e){return new(e||n)(d(V),d(B),d(j),d(Oe),d(oo),d(Mt),d(Y),d(ee),d(qe),d(ne),d(Hi),d(Pe),d(me),d(Ct),d(ji),d(We),d(X),d(Ui),d(oo),d(Me))};static \u0275cmp=P({type:n,selectors:[["sell-complete"]],hostBindings:function(e,i){e&1&&_("keydown.F8",function(l){return i.handleF8(l)},!1,it)},features:[st([ro])],decls:31,vars:14,consts:[["OFFLINE",""],["PRICE_HIDE",""],[1,"sell-complete"],[1,"container-fluid","pt-8"],[1,"row","pb-8","border-bottom"],[1,"col-auto","pe-0","order-0","ps-7"],[1,"me-5","float-start","fw-normal"],[1,"row","mt-8","px-6"],[1,"col-md-8"],[1,"card"],[1,"col-md-4"],[1,"card-header","bg-light-gray"],[1,"text-dark"],[4,"ngIf","ngIfElse"],[1,"card-body"],["class","card-footer bg-white",4,"ngIf"],[1,"card-footer","bg-gradient-warning"],[1,"card-footer","py-8","d-flex","justify-content-center"],[1,"btn-group","d-flex","justify-content-center",2,"width","26rem"],["matTooltipPosition","above",1,"w-100",3,"matTooltip"],["role","button",1,"btn","btn-outline-secondary","w-100",3,"click","ngClass","disabled"],[1,"fa-solid","fa-print","me-2"],["target","_blank","matTooltipPosition","above","matTooltip","Print in New Tab",1,"btn","btn-outline-secondary","d-flex","align-items-center","justify-content-center","fs-5","border-start-0",2,"width","3rem",3,"href"],["class","card",4,"ngIf"],[1,"print_containers"],[1,"print-error-message"],[1,"card-header",3,"ngClass"],[1,"d-flex","justify-content-between"],[1,"fa-solid","fa-check","me-1"],[1,"fst-italic"],[1,"dropdown"],[1,"container",3,"ngClass"],[1,"row"],[1,"d-flex","align-items-center","g-0","mt-5","w-100"],[1,"text-danger"],[1,"row","mt-12","justify-content-center","g-0","mb-9"],[1,"col-12","text-center"],[1,"d-flex","justify-content-between","w-100"],["type","button","matTooltip","Upload your local / offline order to the cloud","matTooltipPosition","above",1,"btn","btn-success","btn-lg","w-100","text-white","me-2"],["type","button",1,"btn","btn-success","btn-lg","w-100",3,"click","ngClass"],[1,"card-footer","bg-light-gray"],["type","button","id","dropdownMenuButton","data-bs-toggle","dropdown","aria-haspopup","true","aria-expanded","false",1,"btn","dropdown-toggle"],["aria-labelledby","dropdownMenuButton",1,"dropdown-menu","dropdown-menu-end"],["class","dropdown-item","routerLink","/print/OutDelivery","target","_blank",3,"queryParams",4,"ngIf"],["class","dropdown-item","routerLink","/print/InvoiceNOutD","target","_blank",3,"queryParams",4,"ngIf"],["class","dropdown-item","target","_blank",3,"href",4,"ngIf"],["class","dropdown-item","routerLink","/print/PackingSlip","target","_blank",3,"queryParams",4,"ngIf"],["routerLink","/print/OutDelivery","target","_blank",1,"dropdown-item",3,"queryParams"],["routerLink","/print/InvoiceNOutD","target","_blank",1,"dropdown-item",3,"queryParams"],["target","_blank",1,"dropdown-item",3,"href"],["routerLink","/print/PackingSlip","target","_blank",1,"dropdown-item",3,"queryParams"],[1,"text-danger","fs-5"],[1,"d-flex","align-items-center","border-bottom","me-2",2,"width","65%"],[1,"px-2","cursor","hover-color",3,"click"],["type","text","placeholder","Email / Whatsapp","id","customerContact","required","","pOSIsInvalidEmailOrPhoneNumber","",1,"form-control","border-0","fs-4",3,"ngModelChange","formControl"],[1,"pb-2",2,"width","35%"],["type","button",1,"btn","btn-light-gray","border","w-100",3,"click","disabled"],["type","button","matTooltip","Upload your local / offline order to the cloud","matTooltipPosition","above",1,"btn","btn-success","btn-lg","w-100","text-white","me-2",3,"click"],[1,"row","justify-content-between"],["class","col-auto my-6",4,"ngIf"],[1,"col-auto","my-6"],["type","button","data-cy","payment-link",1,"btn","btn-light-gray",3,"click"],[1,"fa-solid","fa-money-bill-wave","me-2"],["type","button","data-cy","verify-payment-settelment",1,"btn","btn-light-gray",3,"click"],[1,"fa-solid","fa-circle-check","me-2"],[3,"newSale"],["target","_blank","routerLink","/menu/Orders/Orders/Customer_Invoice/Info",1,"text-dark","fst-italic",3,"queryParams"],[1,"text-dark","fst-italic"],["class","row my-1",4,"ngFor","ngForOf"],[1,"row","my-1"],[1,"col-8"],[1,"col-4","text-end"],[1,"card-footer","bg-white"],["class","d-flex justify-content-end","style","line-height: 30px",4,"ngFor","ngForOf"],[4,"ngIf"],[1,"d-flex","justify-content-end",2,"line-height","30px"],[1,"text-end",3,"hidden"],[1,"text-end","w-50",3,"hidden","ngClass"],[1,"border-top"],[1,"text-end","w-50",3,"hidden"],[1,"text-end"],[1,"fw-bold"],[1,"text-danger",2,"font-size","38px"],[1,"fa-regular","fa-arrow-up-right-from-square"],[1,"card-body","pb-0","text-center",3,"innerHtml"],[3,"data","printTemplate","config","priceVisibleRestriction","outletInfo","isUnknownError","isOffline","stylesheet"],[3,"data","printTemplate","config","workOrderMode","stylesheet"]],template:function(e,i){if(e&1){let o=v();r(0,"section",2)(1,"div",3)(2,"div",4)(3,"div",5)(4,"h1",6),m(5,"Order Complete"),a()()(),r(6,"div",7)(7,"div",8),g(8,jl,22,16,"div",9)(9,Hl,1,0,"app-retry"),a(),r(10,"div",10)(11,"div",9)(12,"div",11)(13,"h3",12),g(14,Ul,3,4,"ng-container",13)(15,Wl,2,1,"ng-template",null,0,G),a()(),g(17,Jl,2,1,"div",14)(18,Yl,3,2,"div",15)(19,Xl,7,3,"div",16),r(20,"div",17)(21,"div",18)(22,"div",19)(23,"button",20),_("click",function(){return u(o),f(i.print())}),h(24,"i",21),m(25,"Print Receipt "),a()(),g(26,Zl,2,1,"a",22),a()()(),g(27,es,5,1,"div",23),a()()()(),r(28,"div",24),g(29,os,2,2)(30,rs,3,0,"div",25),a()}if(e&2){let o=Q(16);s(8),R(i.currentSellState==i.sellState.IsComplete?8:9),s(6),p("ngIf",i.isOnline&&i.completeData.ObjectID)("ngIfElse",o),s(3),R(i.itemSummary?17:-1),s(),p("ngIf",!i.finalAmountDifferent&&i.role.PriceVisible),s(),R(i.finalAmountDifferent?19:-1),s(3),p("matTooltip",i.printOnPayment()?"Print in Current Window":"You must enable print on payment config to use this button"),s(),p("ngClass",E(12,vl,i.completeData.PaymentStateLabel!="Offline"))("disabled",i.printOnPayment()==!1),s(3),R(i.completeData.PaymentStateLabel!="Offline"?26:-1),s(),p("ngIf",i.completeData==null?null:i.completeData.LoyaltyPoint),s(2),R(i.finalAmountDifferent==!1?29:30)}},dependencies:[Z,H,_e,$,Ne,X,Ce,te,K,jt,xt,Zi,na,Ji,$i,Bt,Lt,bn,ze,vt,Ke,se,ma],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}.print_containers[_ngcontent-%COMP%]{display:none}@media print{.print_containers[_ngcontent-%COMP%]{display:block;text-align:left}.sell-complete[_ngcontent-%COMP%]{display:none}}.sell-complete[_ngcontent-%COMP%] .card .card-header{border-bottom:1px solid rgba(0,0,0,.125);padding-bottom:.9375rem}.sell-complete[_ngcontent-%COMP%] .card .card-header h2{font-size:2rem}.sell-complete[_ngcontent-%COMP%] .card .card-body .container{max-width:390px;margin-top:30px;margin-bottom:30px}.sell-complete[_ngcontent-%COMP%] .card .card-body .container.offline{margin-top:12px}.sell-complete[_ngcontent-%COMP%] .card .card-body mat-form-field input.form-control{border:none;font-size:16px;padding-left:2px}.sell-complete[_ngcontent-%COMP%] .card .card-body mat-form-field input.form-control:focus{border:none}.sell-complete[_ngcontent-%COMP%] .card .card-body [type=button]{-webkit-appearance:initial}.sell-complete[_ngcontent-%COMP%] .card .card-body input{font-size:1rem}.sell-complete[_ngcontent-%COMP%] .card .card-body .btn-success{padding:.5rem 1rem;font-size:1.25rem}.sell-complete[_ngcontent-%COMP%] .amount[_ngcontent-%COMP%]{font-size:16px}.hover-color[_ngcontent-%COMP%]:hover{color:#d1d1d1}.print-error-message[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;min-height:100vh;text-align:center}.print-error-message[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{color:#dc3545;font-weight:500}"]})};var Sn=class n{constructor(t,e){this._dialogRef=t;this._orderProcessorService=e;this.modalConfig.title="Clear Order?",this.modalConfig.headerType=Le.Success}modalConfig=new U;ngOnInit(){}onOk(){this._orderProcessorService.createNewTransactionInSameOutletRegister(!1),this._orderProcessorService.emitClearOrder(),this.close()}close(){this._dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(F),d(j))};static \u0275cmp=P({type:n,selectors:[["POS-modal-clear"]],standalone:!1,decls:4,vars:2,consts:[[3,"onOk","onCancel","onClose","config"],[1,"fw-normal"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.onOk()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"h4",1),m(3),a()()()),e&2&&(p("config",i.modalConfig),s(3),T("This will replace current order's item(s) with blank order."))},dependencies:[W],encapsulation:2})};var mo=(i=>(i[i.INTERNAL=1]="INTERNAL",i[i.EKSTERNAL=2]="EKSTERNAL",i[i.EKSTERNALINTERNAL=3]="EKSTERNALINTERNAL",i))(mo||{});function ls(n,t){if(n&1){let e=v();r(0,"div",1)(1,"radio-options",12),w("modelChange",function(o){u(e);let l=c();return D(l.selectedProvider,o)||(l.selectedProvider=o),f(o)}),a(),r(2,"label",13),m(3,"Choose Provider"),a()()}if(n&2){let e=c();s(),p("options",e.couponProviders()),M("model",e.selectedProvider),p("disabled",e.hasSelectedCoupon)}}function ss(n,t){if(n&1){let e=v();r(0,"button",14),_("click",function(){u(e);let o=c();return f(o.onRemoveCoupon())}),m(1," Remove "),a()}}function cs(n,t){if(n&1){let e=v();r(0,"button",15),_("click",function(o){u(e);let l=c();return f(l.onOk(o))})("keyup.F2",function(o){u(e);let l=c();return f(l.onOk(o))}),m(1," Ok (F2) "),a()}}var yn=class n{constructor(t,e,i,o,l,C,N){this.promotionService=t;this._orderDataService=e;this._posService=i;this.dialogRef=o;this.roleService=l;this.toastr=C;this.promotionCouponProvider=N;this.destroy$=new z,this.modeType=!1,this.typeText="password",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye-slash",this.couponInputLock=l.Data.CouponInputLock,this.initProviders(),this.subscribeToObservable(),this.initModalConfig(),this.initSelectedProvider()}modalConfig=new U;modeType;typeText;typeIcon;PromotionCoupon;PromotionNote;couponType;destroy$;onInputCouponCode=!1;selectedProvider="Internal";couponInputLock=!1;startInput;couponredemptionType=mo;couponProviders=q([]);initModalConfig(){this.modalConfig.title="Redeem Coupon",this.modalConfig.customWidth="400px",this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0}subscribeToObservable(){this._orderDataService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.PromotionCoupon=t.Order.PromotionCoupon,this.PromotionNote=t.Order.PromotionNote})}initProviders(){this.couponProviders.update(t=>{let e=this._posService.Data.AppConfigJSON.ProviderOption,i=e.map(o=>({Key:o,Value:o}));return e?.length>0?[{Key:"Internal",Value:"DealPOS"},...i]:[]})}initSelectedProvider(){let t=this.promotionCouponProvider.coupon,e=this.promotionCouponProvider.couponProvider;S.IsNotEmpty(t)?this.selectedProvider=e:this.selectedProvider="Internal"}get hasSelectedCoupon(){let t=this._orderDataService.Data.Order;return S.IsNotEmpty(t.PromotionCoupon)}onOk(t){(t!="Enter"||t=="Enter"&&this.onInputCouponCode)&&this.onSubmitCoupon()}onSubmitCoupon(){S.IsNotEmpty(this.PromotionCoupon)?(this.applyCouponCode(),this.dialogRef.close()):this.toastr.warning("Coupon can't be empty","Warning")}onRemoveCoupon(){let t=this.promotionCouponProvider.coupon;S.IsNotEmpty(t)?this.promotionCouponProvider.removeCoupon():this.promotionService.removeAppliedCoupon(),this.dialogRef.close()}applyCouponCode(){if(this.selectedProvider==="Internal")this.promotionService.RedeemCoupon(this.PromotionCoupon,this.PromotionNote);else{let t=`(${this.selectedProvider}) ${this.PromotionNote?this.PromotionNote:""}`;this.promotionCouponProvider.redeemCoupon(this.PromotionCoupon,this.selectedProvider,t)}}onClose(){this.dialogRef.close()}showPassword(){this.modeType?(this.typeText="text",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye"):(this.typeText="password",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye-slash")}onKeyDown(t){let e=t.target.value;this.couponInputLock&&(t.key=="Enter"?this.PromotionCoupon=e:this.validateInputLock())}validateInputLock(){if(typeof this.PromotionCoupon=="string")if(this.PromotionCoupon==""||this.PromotionCoupon.length==0)this.startInput=new Date;else{let t=new Date;this.startInput=this.startInput?this.startInput:new Date,t.getTime()-this.startInput.getTime()>500&&(this.PromotionCoupon=null)}else this.startInput=new Date}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(Xe),d(V),d(B),d(F),d(me),d(ee),d(It))};static \u0275cmp=P({type:n,selectors:[["pos-modal-coupon-code"]],standalone:!1,decls:17,vars:11,consts:[[3,"onClose","config"],[1,"form-floating-outline","radio","border","rounded","pt-7",2,"height","auto !important"],[1,"form-floating-outline","mb-0"],["data-cy","CouponInput","id","cpn","name","PromotionCoupon","autocomplete","new-password","placeholder","Coupon",1,"form-control",3,"ngModelChange","paste","keydown","focus","blur","type","ngModel","disabled"],[3,"click"],["for","cpn"],[1,"form-floating-outline"],["name","note","id","note","data-cy","CouponNote","name","PromotionNote","placeholder","Note","rows","5",1,"form-control",3,"ngModelChange","ngModel","disabled"],["for","note"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","mx-3","p-8",3,"click"],[1,"btn","btn-light-danger","text-danger","btn-lg","fw-bold","mx-3","p-8","me-6"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","mx-3","p-8","me-6"],["id","providerOptions",3,"modelChange","options","model","disabled"],["for","providerOptions"],[1,"btn","btn-light-danger","text-danger","btn-lg","fw-bold","mx-3","p-8","me-6",3,"click"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","mx-3","p-8","me-6",3,"click","keyup.F2"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onClose",function(){return i.dialogRef.close()}),r(1,"content"),g(2,ls,4,3,"div",1),r(3,"div",2)(4,"input",3),w("ngModelChange",function(l){return D(i.PromotionCoupon,l)||(i.PromotionCoupon=l),l}),_("paste",function(l){return i.couponInputLock?l.preventDefault():""})("keydown",function(l){return i.onKeyDown(l)})("focus",function(){return i.onInputCouponCode=!0})("blur",function(){return i.onInputCouponCode=!1}),a(),r(5,"i",4),_("click",function(){return i.modeType=!i.modeType,i.showPassword()}),a(),r(6,"label",5),m(7,"Coupon"),a()(),r(8,"div",6)(9,"textarea",7),w("ngModelChange",function(l){return D(i.PromotionNote,l)||(i.PromotionNote=l),l}),a(),r(10,"label",8),m(11,"Note"),a()()(),r(12,"footer")(13,"button",9),_("click",function(){return i.onClose()}),m(14," Cancel "),a(),g(15,ss,2,0,"button",10)(16,cs,2,0,"button",11),a()()),e&2&&(p("config",i.modalConfig),s(2),R(i.couponProviders().length>0?2:-1),s(2),p("type",i.typeText),M("ngModel",i.PromotionCoupon),p("disabled",i.hasSelectedCoupon),s(),be(i.typeIcon),s(4),M("ngModel",i.PromotionNote),p("disabled",i.hasSelectedCoupon),s(6),R(i.hasSelectedCoupon?15:16))},dependencies:[te,K,ie,W,wi],styles:[".passwordIcon[_ngcontent-%COMP%]{position:relative;margin:0 auto!important;cursor:pointer;left:20.5rem;top:-2.3rem;z-index:999}"]})};var xn=class n{constructor(t,e,i,o){this.dialogRef=t;this._orderDataService=e;this._orderProcessorService=i;this._OrderHttpService=o;this.modalConfig.title="Return",this.modalConfig.customWidth="284px",this.destroy$=new z}modalConfig=new U;ReturNumber;destroy$;ngOnInit(){this.initInvoiceRetur()}initInvoiceRetur(){this.ReturNumber=null,this._orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(t=>{t.posState===7&&(this.ReturNumber=t.ReturNumber)})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}onOk(){let t=this._orderDataService.Data.Order.EntityID;this._OrderHttpService.GetReturnInvoice(this.ReturNumber,t).pipe(k(this.destroy$)).subscribe(e=>{let i=this._orderProcessorService.Data;i.ReturNumber=this.ReturNumber,this._orderProcessorService.ReturnOrder(e),this._orderProcessorService.updatePosState(7),this.dialogRef.close()})}static \u0275fac=function(e){return new(e||n)(d(F),d(V),d(j),d(Oe))};static \u0275cmp=P({type:n,selectors:[["pos-modal-return"]],standalone:!1,decls:6,vars:2,consts:[[3,"onOk","onCancel","onClose","config"],[1,"form-floating-outline"],["type","text","data-cy","ReturnNumber","id","ReturNumber","name","ReturNumber",1,"form-control",3,"ngModelChange","ngModel"],["for","ReturNumber"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.onOk()})("onCancel",function(){return i.dialogRef.close()})("onClose",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1)(3,"input",2),w("ngModelChange",function(l){return D(i.ReturNumber,l)||(i.ReturNumber=l),l}),a(),r(4,"label",3),m(5,"Number Invoice"),a()()()()),e&2&&(p("config",i.modalConfig),s(3),M("ngModel",i.ReturNumber))},dependencies:[te,K,ie,W],encapsulation:2})};var ps=["serialInput"],In=class n{constructor(t,e,i){this.dialogRef=t;this.shoppingCartService=e;this.toastr=i;this.modalConfig.title="Scan Serial",this.modalConfig.customWidth="350px",this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0}serialInputEl;modalConfig=new U;serial;onKeyDown(t){t.key=="Enter"&&(S.IsNotEmpty(this.serial)?(this.shoppingCartService.addItemBySerial(this.serial),this.serial=null):this.toastr.warning("Serial Can`t be empty","Warning!"),this.setFocusInput())}setFocusInput(){this.serialInputEl&&setTimeout(()=>{this.serialInputEl?.nativeElement?.focus()},500)}static \u0275fac=function(e){return new(e||n)(d(F),d(Me),d(ee))};static \u0275cmp=P({type:n,selectors:[["POS-modal-serial"]],viewQuery:function(e,i){if(e&1&&ve(ps,5),e&2){let o;Se(o=ye())&&(i.serialInputEl=o.first)}},standalone:!1,decls:7,vars:2,consts:[["serialInput",""],[3,"onClose","config"],[1,"input-group","mt-3"],["type","text","placeholder","Input Product By Serial","aria-label","Serial",1,"form-control",3,"ngModelChange","keydown","ngModel"],[1,"input-group-text"],[1,"fa-solid","fa-barcode","fs-4"]],template:function(e,i){if(e&1){let o=v();r(0,"modal-material",1),_("onClose",function(){return u(o),f(i.dialogRef.close())}),r(1,"content")(2,"div",2)(3,"input",3,0),w("ngModelChange",function(C){return u(o),D(i.serial,C)||(i.serial=C),f(C)}),_("keydown",function(C){return u(o),f(i.onKeyDown(C))}),a(),r(5,"span",4),h(6,"i",5),a()()()()}e&2&&(p("config",i.modalConfig),s(3),M("ngModel",i.serial))},dependencies:[te,K,ie,W],styles:["input[_ngcontent-%COMP%]{height:55px;border-bottom-left-radius:4px;border-top-left-radius:4px}span.input-group-text[_ngcontent-%COMP%]{border-bottom-right-radius:4px;border-top-right-radius:4px}"]})};function ms(n,t){if(n&1&&(r(0,"tr")(1,"td"),m(2),a(),r(3,"td"),m(4),b(5,"date"),a(),r(6,"td"),m(7),b(8,"date"),a(),r(9,"td",5),m(10),a(),r(11,"td",5),m(12),b(13,"number"),a()()),n&2){let e=t.$implicit;s(2),T(e.Order.Number),s(2),T(pe(5,5,e.Order.ClientTimestamp,"dd MMM yyyy")),s(3),T(pe(8,8,e.Order.ClientTimestamp,"HH:mm")),s(3),T(e.Items.length),s(2),T(O(13,11,e.TotalPaidAmount))}}function ds(n,t){if(n&1&&(x(0),r(1,"div",2)(2,"table",3)(3,"thead",4)(4,"tr")(5,"th"),m(6,"Number"),a(),r(7,"th"),m(8,"Date"),a(),r(9,"th"),m(10,"Time"),a(),r(11,"th",5),m(12,"Qty"),a(),r(13,"th",5),m(14,"Total"),a()()(),r(15,"tbody"),g(16,ms,14,13,"tr",6),a()()(),I()),n&2){let e=c();s(16),p("ngForOf",e.offlineOrders)}}function us(n,t){n&1&&(r(0,"h1",7),m(1,"There is no offline orders!"),a())}var On=class n{constructor(t){this._localDataService=t;this.destroy$=new z}offlineOrders=[];destroy$;ngOnInit(){this.getOfflineOrders()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}getOfflineOrders(){this._localDataService.findAllOrders().pipe(k(this.destroy$)).subscribe(t=>{this.offlineOrders=t.map(e=>ot(mt,e))})}static \u0275fac=function(e){return new(e||n)(d(Ye))};static \u0275cmp=P({type:n,selectors:[["sync-orders"]],standalone:!1,decls:3,vars:2,consts:[["noOrders",""],[4,"ngIf","ngIfElse"],[1,"table-responsive","p-8"],[1,"table"],[1,"thead-light"],[1,"text-end"],[4,"ngFor","ngForOf"],[1,"text-center","p-8"]],template:function(e,i){if(e&1&&g(0,ds,17,1,"ng-container",1)(1,us,2,0,"ng-template",null,0,G),e&2){let o=Q(2);p("ngIf",i.offlineOrders!=null&&i.offlineOrders.length>0)("ngIfElse",o)}},dependencies:[_e,$,X,We],encapsulation:2})};var gs=n=>({"bg-gradient-danger":n});function _s(n,t){if(n&1&&(x(0),m(1),b(2,"number"),I()),n&2){let e=c();s(),y(" ",O(2,1,e.onlineProducts)," ")}}function Cs(n,t){n&1&&(r(0,"small",13),m(1," Failed to get Online Products "),a())}function hs(n,t){if(n&1&&(x(0),m(1),b(2,"date"),I()),n&2){let e=c();s(),y(" ",pe(2,1,e.syncDate,"dd MMM yyyy HH:mm")," ")}}function bs(n,t){n&1&&m(0," Never been synced ")}function vs(n,t){if(n&1&&(r(0,"p"),m(1),a()),n&2){let e=c();s(),y("You last synced ",e.dayDiff," days ago!")}}var Pn=class n{constructor(t,e,i,o){this.indexDbService=t;this.toastr=e;this.httpService=i;this.dialogRef=o;this.destroy$=new z}dayDiff;syncDate;offlineProduct=0;onlineProducts=0;destroy$;ngOnInit(){this.initOfflineProducts()}initOfflineProducts(){this.indexDbService.findAllVariant().pipe(ce(t=>t.length>0),Ee(t=>{let e=Array.from(new Set(t.map(i=>i.ProductID))).map(i=>t.find(o=>o.ProductID===i));return this.offlineProduct=e.length,this.httpService.POSText("/api/catalog/product/ProductRowsCount",'{"ProductDiscontinued":false,"VariantDiscontinued":false,"CategoryDiscontinued":false,"From":"0001-01-01T00:00:00","To":"0001-01-01T00:00:00"}')}),et(t=>JSON.parse(t))).subscribe({next:t=>{this.onlineProducts=t.Count,this.getSyncTime()},error:t=>{console.error(t)}})}syncToLocalDatabase(){yi([this.syncOutlets(),this.syncProducts(),this.syncOutletPrices()]).pipe(k(this.destroy$),Ee(()=>this.indexDbService.updateSyncTime())).subscribe({next:()=>{this.initOfflineProducts(),this.toastr.success("Sync Product Offline Successfully","Success!"),this.dialogRef.close()},error:t=>{console.error(t)}})}getSyncTime(){this.indexDbService.getSyncTime().pipe(k(this.destroy$),ce(t=>t!=null)).subscribe({next:t=>{this.syncDate=new Date(t.time),this.calculateSyncDiff()},error:t=>{console.error(t)}})}calculateSyncDiff(){this.syncDate?this.dayDiff=Math.floor((new Date().getTime()-this.syncDate.getTime())/1e3/60/60/24):this.dayDiff=0}syncOutlets(){return this.httpService.get(fe.SynOutlet).pipe(k(this.destroy$),Ee(t=>this.indexDbService.syncRegisters(t)))}syncProducts(){return this.httpService.get(fe.SyncProducts).pipe(k(this.destroy$),Ee(t=>this.indexDbService.syncVariants(t)))}syncOutletPrices(){return this.httpService.get(fe.SynOutletPrice).pipe(k(this.destroy$),Ee(t=>this.indexDbService.syncOutletPrice(t)))}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(Ye),d(ee),d(Qe),d(F))};static \u0275cmp=P({type:n,selectors:[["sync-products"]],standalone:!1,decls:30,vars:11,consts:[["EMPTY_PRODUCTS",""],["neverSync",""],[1,"table-responsive","p-8"],[1,"table","table-bordered","table-sm","fs-5"],[1,"fw-bold",2,"width","125px"],[2,"width","175px",3,"ngClass"],[4,"ngIf","ngIfElse"],["rowspan","3"],[1,"d-flex","align-items-center","justify-content-center"],[1,"btn","btn-success","fs-4",3,"click"],[1,"fa-solid","fa-sync-alt","me-2","pe-2"],[1,"fw-bold"],[4,"ngIf"],[1,"fst-italic"]],template:function(e,i){if(e&1){let o=v();r(0,"div",2)(1,"table",3)(2,"tbody")(3,"tr")(4,"td",4),m(5,"Online Products"),a(),r(6,"td",5),g(7,_s,3,3,"ng-container",6)(8,Cs,2,0,"ng-template",null,0,G),a(),r(10,"td",7)(11,"div",8)(12,"button",9),_("click",function(){return u(o),f(i.syncToLocalDatabase())}),h(13,"i",10),r(14,"span"),m(15,"Sync"),a()()()()(),r(16,"tr")(17,"td",11),m(18,"Offline Products"),a(),r(19,"td"),m(20),b(21,"number"),a()(),r(22,"tr")(23,"td",11),m(24,"Last Sync"),a(),r(25,"td"),g(26,hs,3,4,"ng-container",6)(27,bs,1,0,"ng-template",null,1,G)(29,vs,2,1,"p",12),a()()()()()}if(e&2){let o=Q(9),l=Q(28);s(6),p("ngClass",E(9,gs,!i.onlineProducts)),s(),p("ngIf",i.onlineProducts)("ngIfElse",o),s(13),y(" ",O(21,7,i.offlineProduct)," "),s(6),p("ngIf",i.syncDate)("ngIfElse",l),s(3),p("ngIf",i.dayDiff>14)}},dependencies:[H,$,X,We],encapsulation:2})};var ys=["navTabs"],Mn=class n{constructor(t,e){this._router=t;this.dialogRef=e}tabs;modalConfig=new U;ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig.headerType=Le.Success,this.modalConfig.title="Add all offline products",this.modalConfig.hideFooter=!0,this.modalConfig.customWidth="550px",this.modalConfig.noPadding=!0}goToOfflinePage(){this.tabs.selectedIndex==0?this._router.navigate(["/menu","Sell","Offline","Products"]):this.tabs.selectedIndex==1&&this._router.navigate(["/menu","Sell","Offline","Orders"]),this.close()}close(){this.dialogRef.close()}onChangeTab(t){t.index==0?this.modalConfig.title="Add all offline product":this.modalConfig.title="Add all offline order"}static \u0275fac=function(e){return new(e||n)(d(Ct),d(F))};static \u0275cmp=P({type:n,selectors:[["pos-modal-sync"]],viewQuery:function(e,i){if(e&1&&ve(ys,5),e&2){let o;Se(o=ye())&&(i.tabs=o.first)}},standalone:!1,decls:12,vars:2,consts:[["navTabs",""],[3,"onOk","onCancel","onClose","config"],["mat-align-tabs","start",1,"sync",3,"selectedTabChange","dynamicHeight"],["label","Products"],["label","Orders"],[1,"d-flex","justify-content-center","mb-8"],[1,"btn","btn-primary","btn-lg",3,"click"],[1,"fa-solid","fa-paper-plane"]],template:function(e,i){if(e&1){let o=v();r(0,"modal-material",1),_("onOk",function(){return u(o),f(i.close())})("onCancel",function(){return u(o),f(i.close())})("onClose",function(){return u(o),f(i.close())}),r(1,"content")(2,"mat-tab-group",2,0),_("selectedTabChange",function(C){return u(o),f(i.onChangeTab(C))}),r(4,"mat-tab",3),h(5,"sync-products"),a(),r(6,"mat-tab",4),h(7,"sync-orders"),a()(),r(8,"div",5)(9,"button",6),_("click",function(){return u(o),f(i.goToOfflinePage())}),h(10,"i",7),m(11," Go to Details "),a()()()()}e&2&&(p("config",i.modalConfig),s(2),p("dynamicHeight",!1))},dependencies:[W,St,yt,On,Pn],styles:[".mat-ink-bar{background-color:#93bd45!important} .sync mat-mdc-tab-body{height:200px} .mat-mdc-tab-body-content{overflow-x:hidden!important}"]})};function Is(n,t){if(n&1){let e=v();r(0,"div",12)(1,"div",13)(2,"h5"),m(3,"Deduct inventory from outlet"),a()(),r(4,"div",13)(5,"ng-select",14),w("ngModelChange",function(o){u(e);let l=c();return D(l.deliveryEntityID,o)||(l.deliveryEntityID=o),f(o)}),a()()()}if(n&2){let e=c();s(5),p("disabled",e.isDisabledNgSelectOutlet),M("ngModel",e.deliveryEntityID),p("items",e.entities)("clearable",!1)}}function Os(n,t){n&1&&(x(0),r(1,"h5",15),m(2,"Unfulfilled order, product inventory is allocated "),a(),I())}function Ps(n,t){if(n&1){let e=v();x(0),r(1,"div",16)(2,"div",28)(3,"div",29)(4,"input",30),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.shipping.Name,o)||(l.shipping.Name=o),f(o)}),a(),r(5,"label",31),m(6,"Recipient"),a()()(),r(7,"div",28)(8,"div",29)(9,"input",32),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.shipping.Phone,o)||(l.shipping.Phone=o),f(o)}),a(),r(10,"label",33),m(11,"Phone"),a()()()(),r(12,"div",34)(13,"div",28)(14,"div",29)(15,"textarea",35),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.shipping.Address,o)||(l.shipping.Address=o),f(o)}),a(),r(16,"label",36),m(17,"Address"),a()()(),r(18,"div",28)(19,"div",29)(20,"input",37),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.shipping.City,o)||(l.shipping.City=o),f(o)}),a(),r(21,"label",38),m(22,"City"),a()()()(),I()}if(n&2){let e=c(2);s(4),M("ngModel",e.shipping.Name),s(5),M("ngModel",e.shipping.Phone),s(6),M("ngModel",e.shipping.Address),s(5),M("ngModel",e.shipping.City)}}function Ms(n,t){if(n&1){let e=v();x(0),r(1,"div",16)(2,"div",17)(3,"div",18)(4,"h5",19),m(5," Recipient != Buyer"),a()(),r(6,"div",20)(7,"input",21),w("ngModelChange",function(o){u(e);let l=c();return D(l.recipientNotBuyer,o)||(l.recipientNotBuyer=o),f(o)}),a(),h(8,"label",22),a()(),r(9,"div",17)(10,"div",23)(11,"label",24),m(12),a(),r(13,"div")(14,"datepicker",25),w("dateChange",function(o){u(e);let l=c();return D(l.posData.Invoice.DateCustom,o)||(l.posData.Invoice.DateCustom=o),f(o)}),a()()(),r(15,"div")(16,"label",26),m(17,"Time"),a(),r(18,"div")(19,"app-timepicker",27),w("timeChange",function(o){u(e);let l=c();return D(l.posData.Invoice.TimeCustom,o)||(l.posData.Invoice.TimeCustom=o),f(o)}),a()()()()(),g(20,Ps,23,4,"ng-container",11),I()}if(n&2){let e=c();s(7),M("ngModel",e.recipientNotBuyer),s(5),T(e.dateLabel),s(2),M("date",e.posData.Invoice.DateCustom),s(5),M("time",e.posData.Invoice.TimeCustom),s(),p("ngIf",e.recipientNotBuyer)}}var oi=class n{constructor(t,e,i,o,l,C,N){this._dialogRef=t;this._orderDataService=e;this._posService=i;this._orderProcessorService=o;this._productHttpService=l;this._outletService=C;this.datePipe=N;this.destroy$=new z,this.initStartTime(),this.subscribePosData(),this.initModal()}modalConfig=new U;isDisabledNgSelectOutlet=!1;isDelivery=!1;customDate=null;shipping=new fi;deliveryEntityID="";posData=new mt;startTime;get entities(){return this._posService.Data.Entities}shippingFormVisible;destroy$;disableShippingNow=!1;disableShippingLater=!1;recipientNotBuyer;dateLabel="Fulfillment Date";ngOnInit(){this.initShipingFormVisible(),this.initDefaultOrderDelivery(),this.checkRecepientIsBuyer(),this.initDateLabel(),this.initDisabledOutletOption()}initDisabledOutletOption(){this._orderProcessorService.Data.posState==2&&(this.isDisabledNgSelectOutlet=!0)}checkRecepientIsBuyer(){S.IsNotEmpty(this.shipping.Name)?this.recipientNotBuyer=!0:this.recipientNotBuyer=!1}initDateLabel(){let t=this._posService.Data.AppConfigJSON;t.ModuleSell.Shipping.DateLabel&&(this.dateLabel=t.ModuleSell.Shipping.DateLabel)}initStartTime(){var t=new Date;this.startTime=t.getHours()+":"+t.getMinutes()}subscribePosData(){this._orderDataService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.posData=t,this.posData.Invoice.DateCustom=this.posData.Invoice.DateCustom?this.posData.Invoice.DateCustom:null,this.deliveryEntityID=t.Action.DeliveryEntityID,this.shipping=t.Shipping?t.Shipping:new fi})}initModal(){this.modalConfig.title="Order Fullfillment",this.modalConfig.customWidth="650px"}initShipingFormVisible(){let t=this._posService.Data.AppConfigJSON;this.shippingFormVisible=t.ModuleSell.Shipping.DeliveryAddressAlwaysVisible}initDefaultOrderDelivery(){this.deliveryEntityID==S.GuidEmpty?this.isDelivery=!0:this.isDelivery=!1;let t=this.entities.find(e=>e.ID==this._outletService?.getOutletRegister()?.EntityID);if(S.IsNotEmpty(t.ID)){let e=t.FulfillmentOption;e==1?(this.isDelivery=!1,this.disableShippingLater=!0):e==2&&(this.isDelivery=!0,this.disableShippingNow=!0),this.changeDelivery()}}changeDelivery(){if(this.isDelivery)this.deliveryEntityID=S.GuidEmpty;else{let t=this._outletService.Data,e=this.posData.Action.DeliveryEntityID;S.IsNotEmpty(e)?this.deliveryEntityID=e:S.IsNotEmpty(t.DefaultWarehouse)?this.deliveryEntityID=t.DefaultWarehouse:this.deliveryEntityID=t.EntityID}}onOk(){this.getSerialByVariantIds(),this.setCustomDateField(),this.clearShippingData(),this.posData.Shipping=this.shipping,this.posData.Action.DeliveryEntityID=this.deliveryEntityID,this._orderDataService.pushNewValue(this.posData),this.close()}clearShippingData(){if(!this.recipientNotBuyer)for(let t of Object.getOwnPropertyNames(this.shipping))this.shipping[t]=""}setCustomDateField(){let t=this.posData.Invoice.DateCustom?this.posData.Invoice.DateCustom:null,e=this.posData.Invoice.TimeCustom?this.posData.Invoice.TimeCustom:"00:00";if((this.isDelivery||this.shippingFormVisible)&&t){let i=this.datePipe.transform(this.posData.Invoice.DateCustom,"d MMM y");this.posData.Invoice.CustomDateField=`${i} ${e}`}}getSerialByVariantIds(){let t=this.posData.CartItems;if(S.IsNotEmpty(this.deliveryEntityID)&&t.length>0){let e=t.map(i=>i.VariantID);this._productHttpService.getSerialByVarianIds(this.deliveryEntityID,e).subscribe(i=>{this.updateCartItemSerial(i)})}}updateCartItemSerial(t){let e=ot(Be,this.posData.CartItems),i;this.posData.CartItems=e.map(o=>(o.isSerialType()&&(i=t.findIndex(l=>l.VariantID==o.VariantID),i!==-1&&(o.Serial=this.filterSerialBySelectedSerial(o.Serial,t[i].Serial))),o)),this._orderDataService.pushNewValue(this.posData)}filterSerialBySelectedSerial(t=[],e){let i;return e.filter(l=>(i=t.findIndex(C=>C.Number==l.Number),i!==-1))}close(){this._dialogRef.close()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(F),d(V),d(B),d(j),d(Li),d(Y),d(We))};static \u0275cmp=P({type:n,selectors:[["POS-modal-shipping"]],standalone:!1,decls:21,vars:9,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container"],[1,"row","align-items-start","py-2","my-2"],[1,"col"],["name","fontStyle","aria-label","Font Style",1,"fulfillment-tab",3,"ngModelChange","change","ngModel"],["data-cy","tab-now",3,"value","disabled"],[1,"p-7","me-2"],[1,"text-body-secondary","tabDesc"],["data-cy","tab-later",3,"value","disabled"],[1,"p-7"],["class","row align-items-center mt-5",4,"ngIf"],[4,"ngIf"],[1,"row","align-items-center","mt-5"],[1,"col-6"],["bindLabel","Name","bindValue","ID","appendTo","body","placeholder","Outlet","data-cy","DeductInventory","data-cy","select-deduct-outlet-inventory",1,"tall","auto-grow",2,"width","250px",3,"ngModelChange","disabled","ngModel","items","clearable"],[1,"bg-gradient-warning","text-center","py-7","rounded-3","border","mb-7"],[1,"row","mt-8"],[1,"col-md-6","mb-5","d-flex","align-items-center"],[1,"me-3","pb-5"],["matTooltipPosition","above","matTooltip","Recipient is not the same as Buyer (ex: when someone buys an item as GIFT for another person)"],[1,"form-check","form-switch","form-switch-lg","ms-1"],["type","checkbox","id","flexSwitchCheckDefault",1,"form-check-input",3,"ngModelChange","ngModel"],["for","flexSwitchCheckDefault",1,"form-check-label"],[1,"w-75"],["for","shippingDate",1,"text-body-secondary","mb-0"],["appearance","outline","width","85","id","shippingDate",3,"dateChange","date"],["for","shippingTime",1,"text-body-secondary","mb-0"],[3,"timeChange","time"],[1,"col-md-6"],[1,"form-floating-outline"],["id","recipient","placeholder","Recipient","type","text",1,"w-100","form-control",3,"ngModelChange","ngModel"],["for","recipient"],["id","phone","placeholder","Phone","type","text",1,"w-100","form-control",3,"ngModelChange","ngModel"],["for","phone"],[1,"row"],["id","address","placeholder","Address","type","text",1,"w-100","form-control",3,"ngModelChange","ngModel"],["for","address"],["id","city","placeholder","City","type","text",1,"w-100","form-control",3,"ngModelChange","ngModel"],["for","city"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.onOk()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"mat-button-toggle-group",4),w("ngModelChange",function(l){return D(i.isDelivery,l)||(i.isDelivery=l),l}),_("change",function(){return i.changeDelivery()}),r(6,"mat-button-toggle",5)(7,"h3",6),m(8," Now "),r(9,"small",7)(10,"em"),m(11,"(in store purchase)"),a()()()(),r(12,"mat-button-toggle",8)(13,"h3",9),m(14," Later "),r(15,"small",7)(16,"em"),m(17,"(shipped to customer address)"),a()()()()()()(),g(18,Is,6,4,"div",10)(19,Os,3,0,"ng-container",11)(20,Ms,21,5,"ng-container",11),a()()()),e&2&&(p("config",i.modalConfig),s(5),M("ngModel",i.isDelivery),s(),p("value",!1)("disabled",i.disableShippingNow),s(6),p("value",!0)("disabled",i.disableShippingLater),s(6),p("ngIf",!i.isDelivery),s(),p("ngIf",i.isDelivery),s(),p("ngIf",i.isDelivery||i.shippingFormVisible))},dependencies:[$,te,ht,K,ie,W,nt,se,Cr,er,tr,Ti],styles:[".container[_ngcontent-%COMP%]{min-height:220px}input[type=radio][_ngcontent-%COMP%]{margin-top:-.2rem;vertical-align:middle}.mat-button-toggle-checked[_ngcontent-%COMP%]{background-color:#dfeffc;color:#0976b4}.form-check-input[_ngcontent-%COMP%]{clear:left}.form-switch.form-switch-lg[_ngcontent-%COMP%]{margin-bottom:.8rem}.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}.tabDesc[_ngcontent-%COMP%]{font-size:80%;font-weight:400} mat-button-toggle-group.fulfillment-tab mat-pseudo-checkbox{display:none}"]})};var Dn=class n{constructor(t){this.httpService=t}getParkedOrder(t,e){return this.httpService.get(fe.GetPark,[{key:"EntityID",value:t},{key:"RegisterID",value:e}])}removeOrder(t,e){let i={OrderID:t};return e?this.httpService.post(fe.VoidPark,i):this.httpService.post(fe.RemovePark,i)}mergePark(t){return this.httpService.post(fe.MergePark,t)}getOutstanding(t){let e={EntityID:t};return this.httpService.post(fe.GetOutStanding,e)}static \u0275fac=function(e){return new(e||n)(A(Qe))};static \u0275prov=at({token:n,factory:n.\u0275fac,providedIn:"root"})};var fa=()=>["ParkLabel","Number"],ga=(n,t,e)=>({"duration-green":n,"duration-yellow":t,"duration-red":e});function ws(n,t){if(n&1&&(r(0,"span",17),m(1),a()),n&2){let e=t.$implicit,i=t.index;p("hidden",i==0),s(),y(" ",e.ParkLabel," ")}}function ks(n,t){if(n&1&&(r(0,"div",14),g(1,ws,2,2,"span",15),m(2," will be merged to"),r(3,"span",16),m(4),a()()),n&2){let e=c(2);s(),p("ngForOf",e.listMerge),s(3),T(e.listMerge[0].ParkLabel)}}function Ts(n,t){if(n&1){let e=v();r(0,"div",8),g(1,ks,5,2,"div",9),r(2,"div",10)(3,"span",11),h(4,"i",12),a(),r(5,"input",13),w("ngModelChange",function(o){u(e);let l=c();return D(l.filter,o)||(l.filter=o),f(o)}),a()()()}if(n&2){let e=c();s(),p("ngIf",e.listMerge.length>1),s(4),M("ngModel",e.filter)}}function Es(n,t){if(n&1&&h(0,"i"),n&2){let e=c(2).$implicit;be(e.Icon)}}function Rs(n,t){if(n&1&&(r(0,"h5",26),g(1,Es,1,2,"i",27),r(2,"span"),m(3),b(4,"limitTo"),a()()),n&2){let e=c().$implicit,i=c(3);s(),R(e.Icon?1:-1),s(2),y(" ",i.parkedOrders.length<5?e.Name:pe(4,2,e.Name,5)," ")}}function Ns(n,t){if(n&1){let e=v();r(0,"span",46),_("click",function(o){u(e);let l=c().$implicit;return c(5).remove(l),f(o.stopPropagation())}),h(1,"i",47),a()}}function Vs(n,t){if(n&1&&(r(0,"div",39),h(1,"i",48),m(2),a()),n&2){let e=c().$implicit;s(2),y(" ",e.CustomerDisplay," ")}}function As(n,t){if(n&1&&(r(0,"div",49),m(1),a()),n&2){let e=c().$implicit;s(),y(" ",e.alias," ")}}function Ls(n,t){if(n&1){let e=v();r(0,"input",50),w("ngModelChange",function(o){u(e);let l=c().$implicit;return D(l.selected,o)||(l.selected=o),f(o)}),_("change",function(){u(e);let o=c().$implicit,l=c(5);return f(l.chooseMerge(o))})("click",function(o){return u(e),f(o.stopPropagation())}),a()}if(n&2){let e=c().$implicit;M("ngModel",e.selected)}}function Bs(n,t){if(n&1){let e=v();r(0,"div",29)(1,"div",30)(2,"div",31),_("click",function(o){let l=u(e).$implicit;return c(5).onOrderClicked(l),f(o.preventDefault())}),r(3,"h5",32)(4,"div",33),m(5),a(),g(6,Ns,2,0,"span",34),a(),r(7,"div",35)(8,"div",36)(9,"div",37),h(10,"i",38),m(11),a(),r(12,"div",39),h(13,"i",40),m(14),b(15,"date"),a(),g(16,Vs,3,1,"div",41)(17,As,2,1,"div",42),a(),r(18,"div",43)(19,"div",44),m(20),a(),g(21,Ls,1,1,"input",45),a()()()()()}if(n&2){let e=t.$implicit,i=c(5);s(5),y(" ",i.replaceAlias&&e.Alias?e.Alias:e.ParkLabel," "),s(),p("ngIf",!i.AuthorizeParkOrderDeletion),s(5),y(" ",e.Number," "),s(3),y(" ",pe(15,9,e.Created,"dd-MMM HH:mm")," "),s(2),p("ngIf",e.CustomerDisplay),s(),p("ngIf",!i.replaceAlias),s(2),p("ngClass",Et(12,ga,e.Duration<=60,e.Duration>60&&e.Duration<=120,e.Duration>120)),s(),y(" ",e.Duration," minutes ago "),s(),p("ngIf",i.parkEnableMerge)}}function Fs(n,t){if(n&1&&(r(0,"div",24),g(1,Bs,22,16,"div",28),b(2,"FilterByArray"),a()),n&2){let e=c().$implicit,i=c(3);s(),p("ngForOf",Ge(2,1,e.List,ct(5,fa),i.filter))}}function js(n,t){n&1&&(r(0,"div",25),h(1,"app-empty-state"),a())}function Hs(n,t){if(n&1&&(r(0,"mat-tab"),g(1,Rs,5,5,"ng-template",22),r(2,"div",23),g(3,Fs,3,6,"div",24)(4,js,2,0,"div",25),a()()),n&2){let e=t.$implicit;s(3),R(e.List.length>0?3:4)}}function Us(n,t){if(n&1&&(r(0,"mat-tab-group",20),g(1,Hs,5,1,"mat-tab",21),a()),n&2){let e=c(2);s(),p("ngForOf",e.Layout)}}function Ws(n,t){if(n&1&&(r(0,"div",18),g(1,Us,2,1,"mat-tab-group",19),a()),n&2){let e=c();s(),p("ngIf",e.parkedOrders.length!=0)}}function Qs(n,t){if(n&1){let e=v();r(0,"span",46),_("click",function(o){u(e);let l=c().$implicit;return c(2).remove(l),f(o.stopPropagation())}),h(1,"i",54),a()}}function qs(n,t){if(n&1&&(r(0,"div",39),h(1,"i",48),m(2),a()),n&2){let e=c().$implicit;s(2),y(" ",e.CustomerDisplay," ")}}function $s(n,t){if(n&1&&(r(0,"div",49),m(1),a()),n&2){let e=c().$implicit;s(),y(" ",e.alias," ")}}function Js(n,t){if(n&1){let e=v();r(0,"input",50),w("ngModelChange",function(o){u(e);let l=c().$implicit;return D(l.selected,o)||(l.selected=o),f(o)}),_("change",function(){u(e);let o=c().$implicit,l=c(2);return f(l.chooseMerge(o))})("click",function(o){return u(e),f(o.stopPropagation())}),a()}if(n&2){let e=c().$implicit;M("ngModel",e.selected)}}function Gs(n,t){if(n&1){let e=v();r(0,"div",29)(1,"div",53)(2,"div",31),_("click",function(o){let l=u(e).$implicit;return c(2).onOrderClicked(l),f(o.preventDefault())}),r(3,"h5",32)(4,"div",33),m(5),a(),g(6,Qs,2,0,"span",34),a(),r(7,"div",35)(8,"div",36)(9,"div",37),h(10,"i",38),m(11),a(),r(12,"div",39),h(13,"i",40),m(14),b(15,"date"),a(),g(16,qs,3,1,"div",41)(17,$s,2,1,"div",42),a(),r(18,"div",43)(19,"div",44),m(20),a(),g(21,Js,1,1,"input",45),a()()()()()}if(n&2){let e=t.$implicit,i=c(2);s(5),y(" ",e.Alias?e.Alias:e.ParkLabel," "),s(),p("ngIf",!i.AuthorizeParkOrderDeletion),s(5),y(" ",e.Number," "),s(3),y(" ",pe(15,9,e.Created,"dd-MMM HH:mm")," "),s(2),p("ngIf",e.CustomerDisplay),s(),p("ngIf",!i.replaceAlias),s(2),p("ngClass",Et(12,ga,e.Duration<=60,e.Duration>60&&e.Duration<=120,e.Duration>120)),s(),y(" ",e.Duration," minutes ago "),s(),p("ngIf",i.parkEnableMerge)}}function zs(n,t){if(n&1&&(r(0,"div",51)(1,"div",52),g(2,Gs,22,16,"div",28),b(3,"FilterByArray"),a()()),n&2){let e=c();s(2),p("ngForOf",Ge(3,1,e.parkedOrders,ct(5,fa),e.filter))}}function Ks(n,t){if(n&1){let e=v();r(0,"a",55),_("click",function(){u(e);let o=c();return f(o.clearSelection())}),m(1,"Clear All"),a()}}function Ys(n,t){if(n&1){let e=v();r(0,"a",55),_("click",function(){u(e);let o=c();return f(o.merge())}),m(1,"Merge"),a()}}var wn=class n{constructor(t,e,i,o,l,C,N,ae,ke,Fe){this._dialogRef=t;this._parkedOrderService=e;this._localData=i;this._OrderHttpService=o;this._orderProcessorService=l;this._posHttpResponseService=C;this._salesOrderDataService=N;this.outletService=ae;this._toastr=ke;this.roleService=Fe;let je=this._salesOrderDataService.Data;this.entityId=je.Order.EntityID,this.templateID=ae.Data.PrintTemplate.ID,this.RegisterID=je.Order.RegisterID,this.park=new Xt(this.outletService.Data.ParkLayoutPack),this.Layout=ae.Data?.ParkLayoutPack?.Layout,this.initModalDialog(),this.initConfig(),this.getData()}modalConfig=new U;filter;entityId;parkedOrders=[];filterAlwaysVisible;replaceAlias;parkDeletionRestriction;parkEnableMerge;AuthorizeParkOrderDeletion;listMerge=[];park;templateID;RegisterID;voidEnabled;retreiveMode;Layout;initConfig(){let t=this._posHttpResponseService.Data.AppConfigJSON;this.filterAlwaysVisible=t.ApplicationParkAndRetrieve.Advance.RetreiveFilterBoxAlwaysVisible,this.replaceAlias=t.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,this.voidEnabled=t.ModuleOrders.VoidEnabled,this.retreiveMode=t.ApplicationParkAndRetrieve.Advance.retreiveMode,this.parkEnableMerge=t.ApplicationParkAndRetrieve.Basic.EnableMergeServeralTables,this.AuthorizeParkOrderDeletion=t.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkOrderDeletion,this.roleService.Data.ParkedDeletionAuthorized&&(this.AuthorizeParkOrderDeletion=!1)}initModalDialog(){let e=this._posHttpResponseService.Data.AppConfigJSON.ApplicationParkAndRetrieve.UserInterfaceLabel.RetreiveDialogTitle;this.modalConfig.title=e,this.modalConfig.customWidth="850px",this.modalConfig.bodyScrollable=!0,this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0}getData(){this._localData.isConfigFromServer().subscribe(t=>{t&&this._parkedOrderService.getParkedOrder(this.entityId,this.RegisterID).subscribe({next:e=>{this.parkedOrders=e,this.parkedOrders.length>0&&this.parkedOrders.forEach(i=>{if(this.retreiveMode==1)i.Orders.forEach(o=>{o.Alias=this.park.GetAlias(o.ParkLabel),o.MemberIdentification=o.MemberIdentification?o.MemberIdentification:"";let l=new Date(o.Created),N=Math.abs(new Date().getTime()-l.getTime()),ae=Math.floor(N%864e5/36e5),ke=Math.round(N%864e5%36e5/6e4);o.Duration=ae>0?ke+ae*60:ke});else{i.Alias=this.park.GetAlias(i.ParkLabel),i.MemberIdentification=i.MemberIdentification?i.MemberIdentification:"";let o=new Date(i.Created),C=Math.abs(new Date().getTime()-o.getTime()),N=Math.floor(C%864e5/36e5),ae=Math.round(C%864e5%36e5/6e4);i.Duration=N>0?ae+N*60:ae}}),this.groupingLayout()},error:()=>{this._dialogRef.close()}})})}groupingLayout(){this.retreiveMode==1&&(this.Layout=this.Layout.map(t=>{t.List=[];let e=this.parkedOrders.find(i=>i.Group==t.Name);return S.IsNotEmpty(e)?t.List=e.Orders:t.List=[],t}))}remove(t){confirm(`Are you sure you want to ${this.voidEnabled?"void":"delete"} park ${t?.ParkLabel?t?.ParkLabel:""}?`)&&this.delete(t)}delete(t){this._parkedOrderService.removeOrder(t.ID,this.voidEnabled).subscribe({next:e=>{this._toastr.info(this.voidEnabled?"Order "+t.Number+" has been voided":"Order "+t.Number+" has been deleted","Park "+t.ParkLabel+" removed!"),this.getData()},error:e=>{this._toastr.error(e,"Failed to remove "+t.ParkLabel+" !"),this._dialogRef.close({Error:e})}})}clearSelection(){this.retreiveMode==1?this.Layout=this.Layout.map(t=>(t.List=t.List.map(e=>(e.selected=!1,e)),t)):this.parkedOrders=this.parkedOrders.map(t=>(t.selected=!1,t)),this.listMerge=[]}merge(){let t=[];this.listMerge.forEach(e=>{t.push(e.ID)}),this._parkedOrderService.mergePark(t).subscribe({next:e=>{let i=this.listMerge.find(o=>o.ID==e.ID);this.onOrderClicked(i)},error:e=>{this._dialogRef.close({Error:e})}})}onOrderClicked(t){this._OrderHttpService.GetInvoiceBySoID(t.ID).subscribe(e=>{this._orderProcessorService.updatePosState(4),this._orderProcessorService.plainToClass(e,4),this._dialogRef.close(t)})}chooseMerge(t){if(this.listMerge.find(i=>i.Number==t.Number)===void 0)this.listMerge.push(t);else{let i=[];this.listMerge.forEach(o=>{o.Number!=t.Number&&i.push(o)}),this.listMerge=i,this.listMerge[0]===void 0&&(this.listMerge=[])}}static \u0275fac=function(e){return new(e||n)(d(F),d(Dn),d(Ye),d(Oe),d(j),d(B),d(V),d(Y),d(ee),d(me))};static \u0275cmp=P({type:n,selectors:[["POS-modal-retrieve"]],standalone:!1,decls:10,vars:6,consts:[[3,"onCancel","onClose","config"],[1,"container","px-4",2,"max-height","390px","min-height","390px"],["class","search-container mb-6 px-0",4,"ngIf"],["class","mt-6","mat-stretch-tabs","false",4,"ngIf"],["class","container mt-6",4,"ngIf"],[1,"d-flex","justify-content-between","mt-3"],[1,"d-flex","justify-content-end"],["class","btn btn-light-blue text-primary fw-bold me-3",3,"click",4,"ngIf"],[1,"search-container","mb-6","px-0"],["class","merge-indicator",4,"ngIf"],[1,"input-group","mb-3","w-100"],[1,"input-group-text","txtFilter","rounded-start-1"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["type","text","placeholder","Search by number or note","aria-label","Search",1,"txtFilter","form-control","border-start-0","rounded","rounded-start-0",3,"ngModelChange","ngModel"],[1,"merge-indicator"],["class","merge-label",3,"hidden",4,"ngFor","ngForOf"],[1,"merge-label","merge-target"],[1,"merge-label",3,"hidden"],["mat-stretch-tabs","false",1,"mt-6"],["mat-stretch-tabs","false",4,"ngIf"],["mat-stretch-tabs","false"],[4,"ngFor","ngForOf"],["mat-tab-label",""],[1,"container","px-0","mt-5"],[1,"row","dialogPicker","mx-0","mt-2"],[1,"d-flex","flex-column","justify-content-center",2,"height","230px"],[1,"d-flex","align-items-center","gap-3"],[3,"class"],["class","col-3",4,"ngFor","ngForOf"],[1,"col-3"],[1,"card","border-1","position-relative"],[1,"card-body","p-0",3,"click"],[1,"card-title","d-flex","justify-content-between","align-items-center","px-3","pt-3"],[1,"label-title","text-truncate","px-2"],[3,"click",4,"ngIf"],[1,"card-text","card-details","px-4","py-3","d-flex","flex-column"],[1,"flex-grow-1"],[1,"mb-1"],[1,"fa","fa-hashtag","pe-2"],[1,"mb-1","text-muted","small"],[1,"fa-regular","fa-calendar-check","pe-2"],["class","mb-1 text-muted small",4,"ngIf"],["class","text-muted small",4,"ngIf"],[1,"duration-wrapper","d-flex","align-items-center"],[1,"badge","duration-badge",3,"ngClass"],["class","retrieve_checkbox mb-1","type","checkbox",3,"ngModel","ngModelChange","change","click",4,"ngIf"],[3,"click"],[1,"fa","fa-xmark-circle","text-danger-soft"],[1,"fa","fa-user","pe-2"],[1,"text-muted","small"],["type","checkbox",1,"retrieve_checkbox","mb-1",3,"ngModelChange","change","click","ngModel"],[1,"container","mt-6"],[1,"row"],[1,"card","border-0","position-relative"],[1,"fa","fa-xmark-circle","text-dark"],[1,"btn","btn-light-blue","text-primary","fw-bold","me-3",3,"click"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onCancel",function(){return i._dialogRef.close()})("onClose",function(){return i._dialogRef.close()}),r(1,"content")(2,"div",1),g(3,Ts,6,2,"div",2)(4,Ws,2,1,"div",3)(5,zs,4,6,"div",4),a()(),r(6,"footer",5)(7,"div",6),g(8,Ks,2,0,"a",7)(9,Ys,2,0,"a",7),a()()()),e&2&&(p("config",i.modalConfig),s(3),p("ngIf",i.parkedOrders.length>0||i.retreiveMode==1||i.filterAlwaysVisible),s(),p("ngIf",i.retreiveMode==1),s(),p("ngIf",i.retreiveMode==0),s(3),p("ngIf",i.listMerge.length>1),s(),p("ngIf",i.listMerge.length>1))},dependencies:[H,_e,$,te,ht,K,ie,W,Mi,St,yt,vr,We,Di,ur],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}.nofocus[_ngcontent-%COMP%]:focus{outline:none!important}@media (min-width: 576px){.merge-indicator[_ngcontent-%COMP%]{display:flex;align-items:center;flex-wrap:wrap;gap:.5rem;font-weight:600;padding:.5rem 1rem;border-radius:.5rem;background-color:#f0f4e4;color:#55600b;border:1px solid #d1e3b0;margin-bottom:1rem;font-size:.75rem;box-shadow:0 2px 6px #0000000a}}.merge-indicator[_ngcontent-%COMP%] .merge-label[_ngcontent-%COMP%]{background-color:#d6e9c6;color:#3c763d;padding:.35rem .75rem;border-radius:999px;font-size:.75rem;font-weight:500}.merge-indicator[_ngcontent-%COMP%] .merge-target[_ngcontent-%COMP%]{font-weight:700;color:#4a4f00;font-size:.75rem}.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}.col-3[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap!important}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]{width:180px;height:160px;margin-right:17px;margin-bottom:17px;position:relative;cursor:pointer;transition:all .3s cubic-bezier(.25,.8,.25,1);border-radius:8px;overflow:hidden;background:#fff;box-shadow:0 2px 10px #0000001a;border-left:4px solid #f0f0f0;display:flex;flex-direction:column}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]{display:flex;outline:1px solid transparent;border-radius:5px;flex:1 1 auto;flex-direction:column;justify-content:space-between}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{height:30px;border-radius:4px 4px 0 0;padding:5px 10px;color:#000;background:#e0e4dc;overflow:hidden;transition:all .3s ease;border-bottom:1px solid #e9ecef}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{margin-right:5px;transition:color .3s ease}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] .card-details[_ngcontent-%COMP%]{font-size:.875rem;line-height:2;color:#333;padding:8px 12px;flex-grow:1;display:flex;flex-direction:column}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover{transform:translateY(-3px);box-shadow:0 5px 15px #00000026;border-left:6px solid #84cc16}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover h5.card-title[_ngcontent-%COMP%]{background:#84cc16}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover .label-title[_ngcontent-%COMP%]{color:#fff!important}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover .fa-xmark-circle[_ngcontent-%COMP%]{color:#c0392b!important}.col-3[_ngcontent-%COMP%] .card.selected[_ngcontent-%COMP%]{background-color:#f8fff0;box-shadow:0 0 0 1px #89b03e4d;border-left:6px solid #84cc16;border-right:1px solid #e0f0d0;border-top:1px solid #e0f0d0;border-bottom:1px solid #e0f0d0}.col-3[_ngcontent-%COMP%] .card.selected[_ngcontent-%COMP%] h5.card-title[_ngcontent-%COMP%]{background:#84cc16}.col-3[_ngcontent-%COMP%] .card.selected[_ngcontent-%COMP%] .label-title[_ngcontent-%COMP%]{color:#fff!important;font-weight:500}.col-3[_ngcontent-%COMP%] .card.selected[_ngcontent-%COMP%] .fa-xmark-circle[_ngcontent-%COMP%]{color:#e74c3c!important;border-radius:50%}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .fa-xmark-circle[_ngcontent-%COMP%]{color:#e74c3c!important;transition:all .3s ease;font-size:1.2em;padding:2px}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .fa-xmark-circle[_ngcontent-%COMP%]:hover{color:#c0392b!important;background:#e74c3c1a;border-radius:50%;transform:scale(1.1)}.duration-badge[_ngcontent-%COMP%]{padding:.35rem .75rem;border-radius:1rem;font-weight:500;font-size:.65rem;display:inline-block;border-left:5px solid transparent}.duration-green[_ngcontent-%COMP%]{border-left-color:#4caf50;background-color:#d4edda;color:#155724}.duration-yellow[_ngcontent-%COMP%]{border-left-color:#ffc107;background-color:#fff3cd;color:#856404}.duration-red[_ngcontent-%COMP%]{border-left-color:#c82333;background-color:#f8d7da;color:#721c24}.duration-wrapper[_ngcontent-%COMP%]{margin-top:auto;margin-bottom:.25rem}.label-title[_ngcontent-%COMP%]{color:#000;transition:color .3s ease;font-weight:650!important;font-size:.75rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.card[_ngcontent-%COMP%]:hover .label-title[_ngcontent-%COMP%], .card.selected[_ngcontent-%COMP%] .label-title[_ngcontent-%COMP%]{color:#fff!important} .mat-tab-group .mat-tab-label-active{background-color:#84cc16!important;color:#fff!important;border-radius:.25rem .25rem 0 0;font-weight:700}.modal-footer-custom[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:1rem;padding-top:1rem}.modal-footer-custom[_ngcontent-%COMP%] .btn-retrieve[_ngcontent-%COMP%], .modal-footer-custom[_ngcontent-%COMP%] .btn-cancel[_ngcontent-%COMP%]{background-color:#c5dcff;color:#0b5ed7;font-weight:600;border:none;border-radius:.3rem;padding:.5rem 1.25rem;transition:background-color .2s ease-in-out}.modal-footer-custom[_ngcontent-%COMP%] .btn-retrieve[_ngcontent-%COMP%]:hover, .modal-footer-custom[_ngcontent-%COMP%] .btn-cancel[_ngcontent-%COMP%]:hover{background-color:#b5cfee}[_nghost-%COMP%] .mat-mdc-tab-group[_ngcontent-%COMP%]{--mdc-tab-indicator-active-indicator-color: #89b03e;--mat-tab-header-focus-indicator-color: #89b03e;--mat-tab-header-focus-label-text-color: var(--bs-body-color);--mat-tab-header-active-label-text-color: var(--bs-body-color);--mat-tab-header-active-focus-label-text-color: var(--bs-body-color);--mat-tab-header-active-hover-label-text-color: var(--bs-body-color);--mat-tab-header-active-focus-indicator-color: #89b03e;--mat-tab-header-active-hover-indicator-color: #89b03e}[_nghost-%COMP%] .mat-mdc-tab-header{border-bottom:1px solid var(--bs-border-color)}.retrieve_checkbox[_ngcontent-%COMP%]{position:absolute;bottom:8px;right:8px;z-index:10;width:20px;height:20px;cursor:pointer;accent-color:#84cc16}.retrieve_checkbox[_ngcontent-%COMP%]:checked{animation:pulse .3s ease}"]})};var _a=[{name:"Order",menus:[{label:"Retrieve",class:"fa-solid fa-box fs-2",action:"RETRIEVE",cy:"retrieve-act",description:"You need \u2018Retrieve\u2019 role to access this function"},{label:"Return",class:"fa-regular fa-cart-arrow-up fs-3",action:"RETURN",cy:"return-act",description:"You need \u2018Return\u2019 role to access this function"},{label:"Fulfillment",class:"fa-solid fa-truck fs-2",action:"FULFILLMENT",cy:"fulfillment-act",description:"You need \u2018Fulfillment\u2019 role to access this function"}],children:[{name:"Promotion",menus:[{label:"Event",class:"fa-solid fa-gift fs-2",action:"PROMOTION"},{label:"Coupon",class:"fa-regular fa-ticket fs-2",action:"COUPON",cy:"coupon-act"}]}]},{name:"Item",menus:[{label:"Add",class:"fa-circle-plus fa-solid fs-2",action:"ADD_ITEM"},{label:"Serial",class:"fa-barcode-read fa-solid fs-2",action:"SERIAL"},{label:"Upload",class:"fa-solid fa-upload fs-2",action:"UPLOAD"},{label:"Clear",class:"fa-solid fa-trash fs-3",action:"CLEAR"}]},{name:"Bill",menus:[{label:"Print",class:"fa-print fa-solid fs-2",action:"PRINT"},{label:"Split",class:"fa-solid fa-split fs-2",action:"SPLIT"},{label:"Cancel Split",class:"fa-solid fa-xmark fs-2",action:"CANCEL"}]},{name:"Advanced",menus:[{label:"Customer Display",class:"fa-display fa-regular fs-3",action:"CUSTOMER_DISPLAY"},{label:"Order Display",class:"fa-solid fa-clipboard-list fs-3",action:"ODS_CONFIG"},{label:"Validate Inventory",class:"fa-archive fa-solid fs-3",action:"INVENTORY"},{label:"Disable Sort",class:"fa-sort fa-solid fs-3",action:"SORT"},{label:"ECR",class:"fa-solid fa-mobile-signal-out fs-3",action:"ECR"}]}];var kn=class{OrderID;ParkLabel;Items};var Xs=n=>({"no-border":n});function Zs(n,t){if(n&1){let e=v();r(0,"tr",14)(1,"td"),m(2),a(),r(3,"td"),m(4),b(5,"number"),a(),r(6,"td")(7,"div",15)(8,"button",16),_("click",function(){let o=u(e).index,l=c();return f(l.onRemoveQuantity(o))}),m(9,"-"),a(),r(10,"input",17),w("ngModelChange",function(o){let l=u(e).$implicit;return D(l.SplitQuantity,o)||(l.SplitQuantity=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onSplitedQuantityChange())}),a(),r(11,"button",18),_("click",function(){let o=u(e).index,l=c();return f(l.onAddQuantity(o))}),m(12,"+"),a()()(),r(13,"td",19),m(14),b(15,"number"),a()()}if(n&2){let e=t.$implicit,i=t.index,o=c();p("ngClass",E(11,Xs,i==(o.cartItems==null?null:o.cartItems.length)-1)),s(2),T(e==null||e.Variant==null?null:e.Variant.Name),s(2),T(O(5,7,e==null?null:e.Price)),s(6),M("ngModel",e.SplitQuantity),p("max",e.Quantity)("min",0),s(4),T(O(15,9,e==null?null:e.Quantity))}}var Tn=class n{constructor(t,e,i,o,l,C){this.dialogRef=t;this.salesOrderDataService=e;this.parkService=i;this.orderProcessorService=o;this.toastr=l;this.calculatorService=C;let N=this.salesOrderDataService?.Data?.CartItems;this.cartItems=ot(Be,N),this.salesOrderData=ot(mt,this.salesOrderDataService.Data),this.currencySymbol=this.calculatorService.currencySymbol}modalConfig=new U;splitData;cartItems;parkLabel;splitPriceTotal;currencySymbol;salesOrderData;ngOnInit(){this.initModalConfig(),this.initItemsSplitQty()}initModalConfig(){this.modalConfig.title="Split Order",this.modalConfig.okText="Split",this.modalConfig.cancelText="Cancel",this.modalConfig.customWidth="725px"}initItemsSplitQty(){this.cartItems=this.cartItems.map(t=>(t.SplitQuantity=0,t))}onOk(){this.generateSplitData(),this.parkService.splitOrder(this.splitData).subscribe(t=>{this.salesOrderData.CartItems=this.cartItems,this.salesOrderData.Order.ParkLabel=this.parkLabel,this.salesOrderDataService.pushNewValue(this.salesOrderData),this.toastr.success("Split order successfully","Success"),this.orderProcessorService.updatePosState(5),this.orderProcessorService.createNewTransactionInSameOutletRegister(),this.onClose()})}generateSplitData(){this.splitData=new kn,this.splitData.OrderID=this.salesOrderDataService?.Data?.Order?.ID,this.splitData.ParkLabel=this.parkLabel,this.splitData.Items=this.cartItems.map(t=>({ID:t.ID,Quantity:t.SplitQuantity}))}onSplitedQuantityChange(){this.splitPriceTotal=this.cartItems.map(t=>t.SplitQuantity?t.SplitQuantity:0).reduce((t,e,i)=>t+e*this.cartItems[i]?.Price,0)}onAddQuantity(t){this.cartItems=this.cartItems.map((e,i)=>(i==t&&e.SplitQuantity<e.Quantity&&(e.SplitQuantity+=1),e)),this.onSplitedQuantityChange()}onRemoveQuantity(t){this.cartItems=this.cartItems.map((e,i)=>(i==t&&e.SplitQuantity>0&&(e.SplitQuantity-=1),e)),this.onSplitedQuantityChange()}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(F),d(V),d(we),d(j),d(ee),d(Pe))};static \u0275cmp=P({type:n,selectors:[["app-modal-split"]],features:[st([we])],decls:26,vars:7,consts:[[3,"onOk","onClose","onCancel","config"],[1,"container","py-4"],[1,"row"],[1,"col-12"],[1,"mb-8"],["type","text","placeholder","Type park label (Optional)",1,"form-control","rounded-1","p-4","fs-5",3,"ngModelChange","ngModel"],[1,"d-flex","align-items-center","justify-content-between","border","p-4","rounded-1",2,"background","whitesmoke"],[1,"fs-5","fw-bold"],[1,"fs-5"],[1,"table","table-secondary","mt-10"],[1,"table-light"],[1,"text-center",2,"width","116px"],[1,"text-end",2,"width","65px"],[3,"ngClass",4,"ngFor","ngForOf"],[3,"ngClass"],[1,"input-group","mb-3"],["type","button",1,"btn","btn-danger","btn-sm","border-end-0",3,"click"],["type","text","autoNum","",1,"form-control","text-center",3,"ngModelChange","ngModel","max","min"],["type","button",1,"btn","btn-success","btn-sm","border-start-0",3,"click"],[1,"text-end"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.onOk()})("onClose",function(){return i.onClose()})("onCancel",function(){return i.onClose()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"div",4)(6,"input",5),w("ngModelChange",function(l){return D(i.parkLabel,l)||(i.parkLabel=l),l}),a()(),r(7,"div",6)(8,"div",7),m(9,"Splitted Amount"),a(),r(10,"div",8),m(11),b(12,"number"),a()(),r(13,"table",9)(14,"thead",10)(15,"tr")(16,"th"),m(17,"Name"),a(),r(18,"th"),m(19,"Price"),a(),r(20,"th",11),m(21,"Qty Split"),a(),r(22,"th",12),m(23,"Qty"),a()()(),r(24,"tbody"),g(25,Zs,16,13,"tr",13),a()()()()()()()),e&2&&(p("config",i.modalConfig),s(6),M("ngModel",i.parkLabel),s(5),Ue("",i.currencySymbol," ",i.splitPriceTotal?O(12,5,i.splitPriceTotal):0,""),s(14),p("ngForOf",i.cartItems))},dependencies:[Z,H,_e,X,Ae,W,ut,pt,Ce,te,K,ie,oa],styles:["table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{line-height:10px}td[_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}table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr.no-border[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-bottom:0px!important}"]})};var En=class n{constructor(t,e){this.data=t;this._dialogRef=e;this.message=t.message,this.initModal()}modalConfig=new U;message;initModal(){this.modalConfig.title=this.data.title,this.modalConfig.headerType=Le.Success,this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0,this.modalConfig.hideFooter=!0}close(){this._dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(Ve),d(F))};static \u0275cmp=P({type:n,selectors:[["POS-modal-info"]],standalone:!1,decls:4,vars:2,consts:[[3,"onCancel","onClose","config"],[1,"fw-normal","d-flex","justify-content-center"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"h4",1),m(3),a()()()),e&2&&(p("config",i.modalConfig),s(3),T(i.message))},dependencies:[W],encapsulation:2})};var Rn=class{constructor(){this.modalConfig.title="Adding new items to order",this.modalConfig.bodyScrollable=!0,this.modalConfig.customWidth="700px",this.modalConfig.noPadding=!0,this.onHand=0,this.allocated=0,this.pricebookDisabled=!0}modalConfig=new U;cartItem=new Be;role;isSerialItem=!1;priceVisible;unitPriceEditor;pricebookSelector;pricebookCopyDesc;calculatorQtyDisabled;calculatorPriceDisabled;productCalculator=q(!0);serials=[];numpadVisible;editingItemPromotionVisible;keyboard;statusModal;isEmptySalesID;pricebookDisabled;queryInventoryOnOpen;pricebookId;oriUnitPrice;oriDiscount;entities;onHand;allocated;costVisible=!1;unitQtyLabel="Unit Quantity";sales;initialSerial;quantityToOneInDialog;splitDeliveryOutletEnabled;hasInventoryView;enabledEditCost=q(!1);mapAppConfigJson(t){this.numpadVisible=t.ModuleSell.NumPadVisible,this.pricebookCopyDesc=t.ModuleSell.Pricebook?.PricebookVisible,this.queryInventoryOnOpen=!1,this.quantityToOneInDialog=t.ModuleSell.ProductDialog?.QuantityToOneInDialog,this.unitQtyLabel=t.ModuleSell.ProductDialog?.UnitQtyLabel,this.splitDeliveryOutletEnabled=t.ModuleSell.ProductDialog?.SplitDeliveryOutletEnabled,this.editingItemPromotionVisible=t.ModuleSell.Promotion?.EditingItemPromotionVisible,this.productCalculator.set(t.ModuleSell?.ProductDialog?.ProductCalculator)}isSerial(){return this.cartItem.Variant!=null?this.cartItem.Variant.TypeID==4:!1}setUserRole(t){this.role=t,this.unitPriceEditor=this.role.UnitPriceEditor,this.priceVisible=this.role.PriceVisible,this.pricebookSelector=this.role.PricebookSelector,this.hasInventoryView=this.role.InventoryView}};var uo=(l=>(l[l.SELL_INPUT=0]="SELL_INPUT",l[l.DISCOUNT=1]="DISCOUNT",l[l.PRODUCT=2]="PRODUCT",l[l.SERIAL=3]="SERIAL",l[l.CALCULATOR=4]="CALCULATOR",l))(uo||{});var ec=(n,t)=>({"tooltip-container-bottom":n,"tooltip-container-top":t});function tc(n,t){n&1&&mi(0)}var Nn=class n{text;position;content;static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["POS-tooltip"]],inputs:{text:"text",position:"position",content:"content"},standalone:!1,decls:3,vars:6,consts:[[3,"ngClass"],[4,"ngTemplateOutlet"]],template:function(e,i){e&1&&(r(0,"div",0),m(1),g(2,tc,1,0,"ng-container",1),a()),e&2&&(p("ngClass",ge(3,ec,i.position=="top"||!i.position,i.position=="bottom")),s(),y(" ",i.text," "),s(),p("ngTemplateOutlet",i.content))},dependencies:[H,Pi],styles:['.tooltip-container-top[_ngcontent-%COMP%]{box-shadow:0 0 5px #0003;margin:.7rem 1rem 1rem;min-width:50px;max-width:400px;background:#fff;border:1px solid #ccc;pointer-events:none;position:relative;min-height:1rem;padding:.5rem;border-radius:4px}.tooltip-container-top[_ngcontent-%COMP%]:after, .tooltip-container-top[_ngcontent-%COMP%]:before{content:"";display:block;position:absolute;bottom:100%;width:0;height:0;border-style:solid}.tooltip-container-top[_ngcontent-%COMP%]:after{left:calc(49% + 2px);border-color:transparent transparent #fff transparent;border-width:6px}.tooltip-container-top[_ngcontent-%COMP%]:before{left:49%;border-color:transparent transparent #ccc transparent;border-width:8px}.tooltip-container-bottom[_ngcontent-%COMP%]{box-shadow:0 0 5px #0003;margin:.7rem 1rem 1rem;min-width:50px;max-width:400px;background:#fff;border:1px solid #ccc;pointer-events:none;position:relative;min-height:1rem;padding:.5rem;border-radius:4px}.tooltip-container-bottom[_ngcontent-%COMP%]:after, .tooltip-container-bottom[_ngcontent-%COMP%]:before{content:"";display:block;position:absolute;bottom:100%;width:0;height:0;border-style:solid}.tooltip-container-bottom[_ngcontent-%COMP%]:after{left:calc(40% + 2px);border-color:#fff transparent transparent transparent;border-width:6px;top:100%}.tooltip-container-bottom[_ngcontent-%COMP%]:before{left:40%;border-color:#ccc transparent transparent transparent;border-width:8px;top:100%}']})};var Vn=class n{constructor(t,e,i){this.overlayPositionBuilder=t;this.elementRef=e;this.overlay=i}content;position;overlayRef;ngOnInit(){let t=this.initPosition(),e=this.overlayPositionBuilder.flexibleConnectedTo(this.elementRef).withPositions([t]);this.overlayRef=this.overlay.create({positionStrategy:e})}initPosition(){let t={originX:"center",originY:"bottom",overlayX:"center",overlayY:"top"};switch(this.position){case"top":t={originX:"center",originY:"top",overlayX:"center",overlayY:"bottom"};break}return t}show(){if(this.content){this.overlayRef.detach();let t=new Yo(Nn),e=this.overlayRef.attach(t);typeof this.content=="string"?e.instance.text=this.content:e.instance.content=this.content,e.instance.position=this.position}}hide(){this.overlayRef.detach()}static \u0275fac=function(e){return new(e||n)(d(Xo),d(Po),d(Zo))};static \u0275dir=Ii({type:n,selectors:[["","customTooltip",""]],hostBindings:function(e,i){e&1&&_("mouseenter",function(){return i.show()})("mouseleave",function(){return i.hide()})},inputs:{content:[0,"customTooltip","content"],position:"position"},standalone:!1})};var oc=["quantity"],rc=["price"],ac=["discount"],lc=["unitCost"],Si=n=>({selected:n}),va=n=>({"mt-8":n}),Ca=n=>({"qtyBtn-disabled":n}),sc=()=>["/menu/Products/Catalog/Variants/Info"],cc=n=>({ID:n}),ha=(n,t)=>({"d-none":n,"d-block":t});function pc(n,t){if(n&1){let e=v();r(0,"a",15),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalItemState.PRODUCT))}),m(1," Product "),a()}if(n&2){let e=c();p("ngClass",E(1,Si,e.modalItemState.PRODUCT==e.currentState))}}function mc(n,t){if(n&1){let e=v();r(0,"a",22),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalItemState.SERIAL))}),m(1," Serial "),a()}if(n&2){let e=c();p("ngClass",E(1,Si,e.modalItemState.SERIAL==e.currentState))}}function dc(n,t){if(n&1){let e=v();r(0,"a",22),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalItemState.CALCULATOR))}),m(1," Calculator "),a()}if(n&2){let e=c();p("ngClass",E(1,Si,e.modalItemState.CALCULATOR==e.currentState))}}function uc(n,t){if(n&1&&(r(0,"div",34)(1,"div",35)(2,"div"),m(3),a(),r(4,"small",36),m(5),a()()()),n&2){let e=t.data;s(3),T(e==null?null:e.Value),s(2),T(e==null?null:e.Code)}}function fc(n,t){if(n&1){let e=v();x(0),r(1,"div",31)(2,"div",32)(3,"autocompleteV2",33,0),_("onSelect",function(o){u(e);let l=c(2);return f(l.onAddItem(o))})("onInputEnter",function(o){u(e);let l=c(2);return f(l.onEnterProductCode(o))}),a(),g(5,uc,6,2,"ng-template",null,1,G),a()(),I()}if(n&2){let e=Q(6),i=c(2);s(3),p("localStorage","products")("renderThumbnail",!0)("inputTextValue",i.cartItem==null||i.cartItem.Variant==null?null:i.cartItem.Variant.Name)("clearOnSelect",!1)("useCustomTemplate",!0)("itemTemplate",e)}}function gc(n,t){n&1&&(r(0,"div",24)(1,"div",37),m(2," Edit Prepaid Package Quantity is disabled during EDIT MODE "),a(),r(3,"div"),m(4," If you make a mistake, please delete the item and then add again "),a()())}function _c(n,t){if(n&1&&(r(0,"span"),m(1),a()),n&2){let e=c(3);s(),y("(",e.cartItem.Variant==null?null:e.cartItem.Variant.UOMName,")")}}function Cc(n,t){if(n&1){let e=v();r(0,"div",48)(1,"strong")(2,"span"),m(3),a()(),r(4,"input",49),w("ngModelChange",function(o){u(e);let l=c(3);return D(l.cartItem.UnitQuantity,o)||(l.cartItem.UnitQuantity=o),f(o)}),a()()}if(n&2){let e=c(3);s(3),T(e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.ProductDialog==null?null:e.AppConfigJSON.ModuleSell.ProductDialog.UnitQtyLabel),s(),p("preventNegative",!0)("readOnly",(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)("decimalPlaces",e.isSerialItem?0:e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.ProductDialog==null?null:e.AppConfigJSON.ModuleSell.ProductDialog.DecimalPlaceDigit),M("ngModel",e.cartItem.UnitQuantity)}}function hc(n,t){if(n&1&&(h(0,"input",50,4),b(2,"number")),n&2){let e=c(3);p("value",O(2,1,e.cartItem.Price))}}function bc(n,t){if(n&1){let e=v();r(0,"input",51,4),w("ngModelChange",function(o){u(e);let l=c(3);return D(l.cartItem.Price,o)||(l.cartItem.Price=o),f(o)}),a()}if(n&2){let e=c(3);p("simpleKeyboard",e.keyboard)("readonly",!e.unitPriceEditor||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible),M("ngModel",e.cartItem.Price)}}function vc(n,t){if(n&1&&(r(0,"div",47)(1,"span",52),m(2),a()()),n&2){let e,i=c(3);s(2),y("Pricebook ",(e=i.selectedPriceBook())==null?null:e.Name," is applied")}}function Sc(n,t){if(n&1){let e=v();r(0,"div",38)(1,"div",39)(2,"strong"),m(3," Qty "),g(4,_c,2,1,"span",20),a(),r(5,"div",40)(6,"button",41),_("click",function(){u(e);let o=c(2);return f(o.updateItemQuantity(o.cartItem.Quantity!=null?o.cartItem.Quantity-1:0))}),m(7," - "),a(),r(8,"input",42,2),_("ngModelChange",function(o){u(e);let l=c(2);return f(l.updateItemQuantity(o))}),a(),r(10,"button",43),_("click",function(){u(e);let o=c(2);return f(o.updateItemQuantity(o.cartItem.Quantity!=null?o.cartItem.Quantity+1:1))}),m(11," + "),a()()(),g(12,Cc,5,5,"div",44),r(13,"div",45)(14,"strong"),m(15,"Price"),a(),g(16,hc,3,3,"input",46)(17,bc,2,3,"ng-template",null,3,G),a(),g(19,vc,3,1,"div",47),a()}if(n&2){let e=Q(18),i=c(2);p("ngClass",E(16,va,i.statusModal=="create")),s(4),p("ngIf",(i.cartItem.Variant==null?null:i.cartItem.Variant.UOM)&&(i.cartItem.Variant==null?null:i.cartItem.Variant.UOMName)),s(2),p("ngClass",E(18,Ca,(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible||i.checkQtyInputDisabled()))("disabled",(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible||i.checkQtyInputDisabled()||i.isSellEdit()&&i.isPrepaidPackage()),s(2),p("simpleKeyboard",i.keyboard)("preventNegative",!i.role.Return)("decimalPlaces",i.isSerialItem?0:i.AppConfigJSON==null||i.AppConfigJSON.ModuleSell==null||i.AppConfigJSON.ModuleSell.ProductDialog==null?null:i.AppConfigJSON.ModuleSell.ProductDialog.DecimalPlaceDigit)("ngModel",i.cartItem.Quantity)("disabled",(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible||i.checkQtyInputDisabled()||i.isSellEdit()&&i.isPrepaidPackage()),s(2),p("ngClass",E(20,Ca,(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible||i.checkQtyInputDisabled()))("disabled",(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible||i.checkQtyInputDisabled()||i.isSellEdit()&&i.isPrepaidPackage()),s(2),p("ngIf",i.AppConfigJSON.ModuleSell==null||i.AppConfigJSON.ModuleSell.ProductDialog==null?null:i.AppConfigJSON.ModuleSell.ProductDialog.UnitQtyLabel),s(),p("hidden",!i.priceVisible),s(3),p("ngIf",!i.unitPriceEditor||(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible)("ngIfElse",e),s(3),R(i.selectedPriceBook()?19:-1)}}function yc(n,t){if(n&1){let e=v();x(0),r(1,"div",53)(2,"strong"),m(3,"Sales Person"),a(),r(4,"ng-select-infinite",54),_("selectedChange",function(o){u(e);let l=c(2);return f(l.updateSales(o))}),w("selectedChange",function(o){u(e);let l=c(2);return D(l.cartItem.SalesID,o)||(l.cartItem.SalesID=o),f(o)}),a()(),I()}if(n&2){let e=c(2);s(4),p("customTooltip",e.salesPersonName)("items",e.sales),M("selected",e.cartItem.SalesID)}}function xc(n,t){if(n&1){let e=v();r(0,"div",53)(1,"strong"),m(2,"Fulfillment From"),a(),r(3,"ng-select",55),_("ngModelChange",function(){u(e);let o=c(2);return f(o.onDeliveryEntityChange())}),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.cartItem.EntityID,o)||(l.cartItem.EntityID=o),f(o)}),a()()}if(n&2){let e=c(2);s(3),p("items",e.entities),M("ngModel",e.cartItem.EntityID)}}function Ic(n,t){if(n&1){let e=v();x(0),r(1,"div",23),g(2,fc,7,6,"ng-container",20)(3,gc,5,0,"div",24)(4,Sc,20,22,"div",25),r(5,"div",26),g(6,yc,5,3,"ng-container",20)(7,xc,4,2,"div",27),a(),r(8,"div",28)(9,"div",29)(10,"POS-tinymce-editor",30),w("ngModelChange",function(o){u(e);let l=c();return D(l.cartItem.Note,o)||(l.cartItem.Note=o),f(o)}),a()()()(),I()}if(n&2){let e=c();s(2),p("ngIf",e.statusModal==="create"),s(),R(e.isSellEdit()&&e.isPrepaidPackage()?3:-1),s(),p("ngIf",e.cartItem),s(2),p("ngIf",e.isEmptySalesID&&(e.sales==null?null:e.sales.length)>0&&e.role.SalesPerson),s(),p("ngIf",(e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.ProductDialog==null?null:e.AppConfigJSON.ModuleSell.ProductDialog.SplitDeliveryOutletEnabled)&&e.salesOrderData.Order.DeliveryStateID==1),s(3),M("ngModel",e.cartItem.Note)}}function Oc(n,t){if(n&1&&(h(0,"input",50),b(1,"number")),n&2){let e=c(2);p("value",O(1,1,e.cartItem.Discount))}}function Pc(n,t){if(n&1){let e=v();r(0,"input",76,7),_("ngModelChange",function(o){u(e);let l=c(2);return f(l.updateDiscountPercentage(o))}),a()}if(n&2){let e=c(2);p("simpleKeyboard",e.keyboard)("ngModel",e.cartItem.Discount)("preventNegative",!0)("readonly",!e.role.Discount||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)}}function Mc(n,t){if(n&1&&(h(0,"input",50),b(1,"number")),n&2){let e=c(2);p("value",O(1,1,e.inputedDiscountAmount))}}function Dc(n,t){if(n&1){let e=v();r(0,"input",77,6),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.inputedDiscountAmount,o)||(l.inputedDiscountAmount=o),f(o)}),_("ngModelChange",function(o){u(e);let l=c(2);return f(l.onDiscountAmountChange(o))}),a()}if(n&2){let e=c(2);p("max",e.cartItem==null?null:e.cartItem.GrossTotal)("simpleKeyboard",e.keyboard),M("ngModel",e.inputedDiscountAmount),p("preventNegative",!0)("readonly",!e.role.Discount||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)}}function wc(n,t){if(n&1&&(x(0),r(1,"div",61)(2,"div",58)(3,"strong"),m(4,"Discount Amount / Qty"),a()(),r(5,"div",59)(6,"div",78)(7,"p"),m(8),b(9,"number"),a()()()(),I()),n&2){let e=c(2);s(8),T(O(9,1,e.cartItem.DiscountAmount))}}function kc(n,t){if(n&1){let e=v();x(0),r(1,"div",61)(2,"div",58)(3,"strong"),m(4,"Pricebook"),a()(),r(5,"div",59)(6,"ng-select",79),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.pricebookId,o)||(l.pricebookId=o),f(o)}),_("ngModelChange",function(){u(e);let o=c(2);return f(o.pricebookChange())})("clear",function(){u(e);let o=c(2);return f(o.onClearPricebook())}),a()()(),I()}if(n&2){let e=c(2);s(6),p("items",e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.PriceBook),M("ngModel",e.pricebookId),p("disabled",e.pricebookDisabled)}}function Tc(n,t){if(n&1&&(x(0),r(1,"div",80)(2,"h5",81),m(3),b(4,"number"),a()(),I()),n&2){let e=c(2);s(3),y(" ",O(4,1,e.cartItem.Discount),"% ")}}function Ec(n,t){if(n&1&&(x(0),r(1,"div",82)(2,"h5"),m(3),b(4,"number"),a(),r(5,"span",73),m(6,"x"),a(),r(7,"h5"),m(8),b(9,"number"),a()(),I()),n&2){let e=c(2);s(3),T(O(4,2,e.cartItem.Quantity)),s(5),T(O(9,4,e.cartItem.DiscountAmount))}}function Rc(n,t){if(n&1&&(x(0),r(1,"h5",83),m(2),b(3,"number"),a(),I()),n&2){let e=c(2);s(2),y(" -",O(3,1,(e.cartItem==null?null:e.cartItem.GrossTotal)*(e.cartItem.Discount/100))," ")}}function Nc(n,t){if(n&1&&(x(0),r(1,"div",75)(2,"h5",83),m(3),b(4,"number"),a()(),I()),n&2){let e=c(2);s(3),y(" -",O(4,1,e.cartItem.Quantity*e.cartItem.DiscountAmount)," ")}}function Vc(n,t){if(n&1&&(x(0),r(1,"div",84)(2,"div",85)(3,"h5"),m(4,"Grand Total"),a()(),r(5,"div",85)(6,"h5"),m(7),b(8,"number"),a()()(),I()),n&2){let e=c(2);s(7),T(O(8,1,e.cartItem.Total))}}function Ac(n,t){if(n&1){let e=v();x(0),r(1,"div",31)(2,"div",56)(3,"div",57)(4,"div",58)(5,"strong"),m(6,"Discount %"),a()(),r(7,"div",59)(8,"div",60),g(9,Oc,2,3,"input",46)(10,Pc,2,4,"ng-template",null,5,G),a()()(),r(12,"div",61)(13,"div",58)(14,"strong"),m(15,"Discount Amount"),a()(),r(16,"div",59)(17,"div",60),g(18,Mc,2,3,"input",46)(19,Dc,2,5,"ng-template",null,6,G),a()()(),r(21,"div",62)(22,"div",63)(23,"input",64),w("ngModelChange",function(o){u(e);let l=c();return D(l.isDiscMultipliciedQty,o)||(l.isDiscMultipliciedQty=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onSwitchToggleDiscount())}),a()(),r(24,"div",65)(25,"strong"),m(26,"*Quantity"),a(),r(27,"span",66),h(28,"i",67),a()()(),g(29,wc,10,3,"ng-container",20)(30,kc,7,3,"ng-container",20),a(),r(31,"div",68)(32,"div",69)(33,"h4"),m(34,"Discount Simulation"),a(),r(35,"h4",70),m(36),a()(),r(37,"div",71)(38,"div",58)(39,"div",72)(40,"h5"),m(41),b(42,"number"),a(),r(43,"span",73),m(44,"x"),a(),r(45,"h5"),m(46),b(47,"number"),a()(),g(48,Tc,5,3,"ng-container",20)(49,Ec,10,6,"ng-container",20),a(),r(50,"div",58)(51,"div",74)(52,"h5"),m(53),b(54,"number"),a()(),r(55,"div",75),g(56,Rc,4,3,"ng-container",20),a(),g(57,Nc,5,3,"ng-container",20),a(),g(58,Vc,9,3,"ng-container",20),a()()(),I()}if(n&2){let e=Q(11),i=Q(20),o=c();s(9),p("ngIf",!o.role.Discount||(o.cartItem==null?null:o.cartItem.PromotionGift)&&!o.editingItemPromotionVisible)("ngIfElse",e),s(9),p("ngIf",!o.role.Discount||(o.cartItem==null?null:o.cartItem.PromotionGift)&&!o.editingItemPromotionVisible)("ngIfElse",i),s(5),M("ngModel",o.isDiscMultipliciedQty),s(6),p("ngIf",!o.isDiscMultipliciedQty),s(),p("ngIf",o.cartItem.Variant!=null&&(o.cartItem==null||o.cartItem.Variant==null?null:o.cartItem.Variant.PriceBook)&&(o.cartItem==null||o.cartItem.Variant==null?null:o.cartItem.Variant.PriceBook.length)>0),s(6),y(" ",o.cartItem==null||o.cartItem.Variant==null?null:o.cartItem.Variant.Name," "),s(5),T(O(42,16,o.cartItem.Quantity)),s(5),T(O(47,18,o.cartItem.Price)),s(2),p("ngIf",o.cartItem.Discount),s(),p("ngIf",o.cartItem.DiscountAmount>0),s(4),T(O(54,20,o.cartItem==null?null:o.cartItem.GrossTotal)),s(3),p("ngIf",o.cartItem.Discount),s(),p("ngIf",o.cartItem.DiscountAmount>0),s(),p("ngIf",o.cartItem.DiscountAmount>0||o.cartItem.Discount>0)}}function Lc(n,t){n&1&&(x(0),r(1,"div",100),h(2,"i",101),r(3,"h6"),m(4,"No Image"),a()(),I())}function Bc(n,t){if(n&1&&h(0,"img",102),n&2){let e=c(2);p("src",e.cartItem.Variant.ThumbnailUrl,tt)}}function Fc(n,t){if(n&1){let e=v();r(0,"div")(1,"a",109),_("click",function(){u(e);let o=c(3);return f(o.onEditCost())}),h(2,"i",110),a()()}}function jc(n,t){if(n&1){let e=v();r(0,"tr")(1,"th",103),m(2," Cost "),a(),r(3,"td",104)(4,"div",105)(5,"div",106)(6,"input",107,9),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.cartItem.Cost,o)||(l.cartItem.Cost=o),f(o)}),a()(),r(8,"div",108),m(9),b(10,"number"),a(),g(11,Fc,3,0,"div"),a()()()}if(n&2){let e=c(2);s(5),p("ngClass",ge(8,ha,!e.enabledEditCost(),e.enabledEditCost())),s(),M("ngModel",e.cartItem.Cost),s(2),p("ngClass",ge(11,ha,e.enabledEditCost(),!e.enabledEditCost())),s(),y(" ",pe(10,5,e.cartItem.Cost,"1.0-4")," "),s(2),R(!(e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.Cost==null)&&e.AppConfigJSON.ModuleSell.Cost.Enabled?11:-1)}}function Hc(n,t){if(n&1&&(r(0,"tr")(1,"th",111),m(2," Price "),a(),r(3,"td",112),m(4),b(5,"number"),a()()),n&2){let e=c(2);s(4),y(" ",O(5,1,e.cartItem.Variant.UnitPrice)," ")}}function Uc(n,t){if(n&1&&(r(0,"tr")(1,"th",111),m(2," Content "),a(),r(3,"td",113)(4,"div",114),m(5),b(6,"number"),a()()()),n&2){let e=c(2);s(5),Ue(" ",e.cartItem==null?null:e.cartItem.VariantUnitQuantity," (@",O(6,2,e.cartItem.Price/(e.cartItem==null?null:e.cartItem.VariantUnitQuantity)),") ")}}function Wc(n,t){if(n&1&&(r(0,"tr")(1,"th",111),m(2," Commision "),a(),r(3,"td",113)(4,"div",114),m(5),b(6,"number"),a()()()),n&2){let e=c(2);s(5),y(" ",O(6,1,e.cartItem==null?null:e.cartItem.SalesCommission)," ")}}function Qc(n,t){if(n&1&&(r(0,"div",58)(1,"table",115)(2,"thead")(3,"tr")(4,"th",116),m(5,"Storage Location"),a()()(),r(6,"tbody")(7,"tr")(8,"td"),m(9),a()()()()()),n&2){let e=c(2);s(9),y(" ",e.cartItem.Variant.Storage," ")}}function qc(n,t){if(n&1&&(r(0,"tr")(1,"td",97),m(2),a(),r(3,"td",97),m(4),b(5,"number"),a(),r(6,"td",97),m(7),b(8,"number"),a()()),n&2){let e=t.$implicit;s(2),y(" ",e.Name," "),s(2),y(" ",O(5,3,e.MinimumQuantity)," "),s(3),y(" ",O(8,5,e.UnitPrice)," ")}}function $c(n,t){if(n&1&&(x(0),r(1,"div",117)(2,"div",90)(3,"div",91),h(4,"i",118),r(5,"div",93),m(6," Pricebook "),a()(),r(7,"table",94)(8,"thead")(9,"tr")(10,"th",95),m(11," Name "),a(),r(12,"th",119),m(13," Min Qty "),a(),r(14,"th",95),m(15," Price "),a()()(),r(16,"tbody"),g(17,qc,9,7,"tr",120),b(18,"sortBy"),a()()()(),I()),n&2){let e=c(2);s(17),p("ngForOf",Ge(18,1,e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.PriceBook,"asc","MinimumQuantity"))}}function Jc(n,t){if(n&1&&(x(0),r(1,"div",31)(2,"div",86)(3,"a",87),g(4,Lc,5,0,"ng-container",88)(5,Bc,1,1,"ng-template",null,8,G),a()(),r(7,"div",89)(8,"div",31)(9,"div",90)(10,"div",91),h(11,"i",92),r(12,"div",93),m(13," Inventory "),a()(),r(14,"table",94)(15,"thead")(16,"tr")(17,"th",95),m(18," On Hand "),a(),r(19,"th",95),m(20," Allocated "),a(),r(21,"th",96),m(22," Available "),a()()(),r(23,"tbody")(24,"tr")(25,"td",97),m(26),a(),r(27,"td",97),m(28),a(),r(29,"td",97),m(30),a()()()()()(),r(31,"div",38)(32,"div",58)(33,"table",98)(34,"thead"),g(35,jc,12,14,"tr")(36,Hc,6,3,"tr")(37,Uc,7,4,"tr")(38,Wc,7,3,"tr"),a()()(),g(39,Qc,10,1,"div",99),a(),g(40,$c,19,5,"ng-container",20),a()(),I()),n&2){let e=Q(6),i=c();s(3),p("routerLink",ct(14,sc))("queryParams",E(15,cc,i.cartItem==null||i.cartItem.Variant==null?null:i.cartItem.Variant.ID)),s(),p("ngIf",(i.cartItem==null||i.cartItem.Variant==null?null:i.cartItem.Variant.ThumbnailUrl)==null)("ngIfElse",e),s(22),y(" ",i.onHand," "),s(2),y(" ",i.allocated," "),s(2),y(" ",i.onHand-i.allocated," "),s(),p("ngClass",E(17,va,(i.AppConfigJSON.ModuleSell==null||i.AppConfigJSON.ModuleSell.Cost==null?null:i.AppConfigJSON.ModuleSell.Cost.Visible)&&i.role.Cost||i.role.PriceVisible||i.role.Commission&&(i.cartItem==null?null:i.cartItem.SalesCommission))),s(4),R(!(i.AppConfigJSON.ModuleSell==null||i.AppConfigJSON.ModuleSell.Cost==null)&&i.AppConfigJSON.ModuleSell.Cost.Visible&&i.role.Cost?35:-1),s(),R(i.role.PriceVisible?36:-1),s(),R((i.cartItem==null?null:i.cartItem.VariantUnitQuantity)>1?37:-1),s(),R(i.role.Commission&&(i.cartItem!=null&&i.cartItem.SalesCommission)?38:-1),s(),p("ngIf",(i.AppConfigJSON==null||i.AppConfigJSON.ModuleSell==null||i.AppConfigJSON.ModuleSell.Grid==null?null:i.AppConfigJSON.ModuleSell.Grid.StorageVisible)&&i.cartItem.Variant.Storage),s(),p("ngIf",(i.cartItem==null||i.cartItem.Variant==null||i.cartItem.Variant.PriceBook==null?null:i.cartItem.Variant.PriceBook.length)>0)}}function Gc(n,t){if(n&1){let e=v();x(0),r(1,"app-item-serial",121),w("cartItemChange",function(o){u(e);let l=c();return D(l.cartItem,o)||(l.cartItem=o),f(o)})("serialsChange",function(o){u(e);let l=c();return D(l.serials,o)||(l.serials=o),f(o)}),a(),I()}if(n&2){let e=c();s(),p("entityId",e.deliveryEntityId),M("cartItem",e.cartItem),p("disabled",e.orderManager.posState==2&&e.constants.IsNotEmpty(e.cartItem.ID)),M("serials",e.serials)}}function zc(n,t){if(n&1){let e=v();r(0,"div",21)(1,"item-calculator-tab",122),_("discountTotal",function(o){u(e);let l=c();return f(l.cartItem.Discount=o)})("priceTotal",function(o){u(e);let l=c();return f(l.cartItem.Price=o)})("qtyTotal",function(o){u(e);let l=c();return f(l.cartItem.Quantity=o)})("noteChanges",function(o){u(e);let l=c();return f(l.cartItem.Note=o)}),a()()}if(n&2){let e=c();p("hidden",e.modalItemState.CALCULATOR!=e.currentState),s(),p("notes",e.cartItem.Note)("price",e.cartItem.Price)("discount",e.cartItem.Discount)("quantity",e.cartItem.Quantity)("variantName",e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.Name)("disabledQty",(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)}}var $e=class n extends Rn{constructor(e,i,o,l,C,N,ae,ke,Fe,je,ri,Tt,Kn,Yn,ai){super();this._dialogRef=e;this.data=i;this._shoppingCartService=o;this._outletService=l;this._posService=C;this._orderProcessorService=N;this._orderDataService=ae;this._variantService=ke;this._toastr=Fe;this.decimalPipe=je;this._matDialog=ri;this._numpadService=Tt;this._userRoleService=Kn;this._onlineStatusService=Yn;this.cdRef=ai;this.destroy$=new z,this.entities=this._posService.Data.Entities,this.AppConfigJSON=this._posService.Data.AppConfigJSON,this.mapAppConfigJson(this.AppConfigJSON),this.subscribeToObservableChanges()}calculatorTab=Do(Rt);_quantityElement;_priceElement;_discountElement;_costElement;salesPersonName;destroy$;AppConfigJSON=new Dr;orderManager;salesOrderData;isOnline=!0;currentState;modalItemState=uo;isDiscMultipliciedQty=!0;inputedDiscountAmount=0;serials=[];constants=S;deliveryEntityId;selectedPriceBook=q(null);isPrepaidPackage=q(!1);isSellEdit=q(!1);ngOnInit(){this.initTabState(),this.isSerialItem=this.isSerial(),this.isPrepaidPackage.update(()=>this.cartItem?.Variant?.TypeID==10&&S.IsNotEmpty(this.cartItem.ID)),this.initStatusModal(),this.numpadVisible&&(this.keyboard=this._numpadService.keyboard),this.initIsUnitPriceEditor()}updateSales(e){this.salesPersonName=this.sales.find(i=>i.ID==e)?.Name,this.cartItem.SalesName=this.salesPersonName}initTabState(){this.currentState=0,this.data?.focus=="Discount"&&(this.currentState=this.modalItemState.DISCOUNT)}onTabChange(e){switch(this.currentState=e,e){case 2:this.queryInventoryOnOpen||this.getStockItem();break;case 1:this.onDiscountAmountChange(this.inputedDiscountAmount);break;case 4:{setTimeout(()=>this.calculatorTab()?.priceInputNativeElement?.focus(),100);break}}}ngAfterViewInit(){setTimeout(()=>{this.initFieldFocus()},200)}initFieldFocus(){switch(this.data&&this.data.focus){case"price":this._priceElement.nativeElement.focus();break;case"discount":this.currentState=1,this._discountElement.nativeElement.focus();break;case"quantity":this._quantityElement.nativeElement.focus()}}initIsUnitPriceEditor(){let e=this.cartItem.Variant?this.cartItem.Variant.SellPriceType:null;(e==1||e==2)&&(this.unitPriceEditor=!0)}initStatusModal(){if(this.data){let i=`Editing Cart Item - ${this.cartItem.Variant?this.cartItem.Variant.Name:""}`;this.updateHeaderTitle(i),this.statusModal="update"}else this.statusModal="create",this.cartItem=this.checkItemQuantityDefault(this.cartItem)}checkItemQuantityDefault(e){return this.quantityToOneInDialog||(e.Quantity=null),e}subscribeToObservableChanges(){this._userRoleService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.setUserRole(e)}),this._orderDataService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.salesOrderData=e,this.initCartItem(e.CartItems),this.checkPriceBookDisabled(),this.checkCalculatorPriceDisabled(),this.checkEmptySalesID(),this.initDeliveryEntityId()}),this._orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.isSellEdit.update(()=>e.posState==2),this.orderManager=e,this.checkCalculatorQtyDisabled()}),this._outletService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.sales=e.ListSales}),this._onlineStatusService.getOnlineStatus$().pipe(k(this.destroy$)).subscribe(e=>{this.isOnline=e})}initDeliveryEntityId(){let e=this.salesOrderData.Action.DeliveryEntityID;S.IsNotEmpty(e)?this.deliveryEntityId=e:this.deliveryEntityId=this.salesOrderData.Order.EntityID}initCartItem(e){if(this.data!=null){let i=e[this.data.index];this.cartItem=Ri(Be,i),this.cartItem.EntityID==S.GuidEmpty&&(this.cartItem.EntityID=null),S.IsEmpty(this.cartItem.SalesID)&&(this.cartItem.SalesID=null),this.oriDiscount=this.cartItem.Discount,this.initialSerial=this.cartItem.Serial,this.initSelectedPriceBook(),this.cartItem.PriceTypeID==2?this.oriUnitPrice=this.cartItem.Price:this.oriUnitPrice=this.cartItem.UnitPriceOriginal,this.inputedDiscountAmount=this.cartItem.DiscountAmount}else this.cartItem=new Be}initSelectedPriceBook(){if(this.cartItem.PriceTypeID==2){let e=this.cartItem.Variant&&this.cartItem.Variant.PriceBook?this.cartItem.Variant.PriceBook:[];if(e.length==1)this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=e[0].ID;else{let i=e.find(o=>o.ID==this.cartItem.PriceBookID);this.pricebookId=i?.ID}this.setSelectedPricebook()}}checkPriceBookDisabled(){if(this.cartItem.Variant){let e=this.cartItem.Variant.TypeID!=11&&!this.pricebookSelector,i=this.cartItem.Variant.TypeID==11&&this.cartItem.Variant.SellPriceType==0&&!this.pricebookSelector;this.pricebookDisabled=e||i}}checkCalculatorPriceDisabled(){if(this.cartItem.Variant){let e=this.cartItem.Variant.TypeID!=11&&!this.unitPriceEditor,i=this.cartItem.Variant.TypeID==11&&this.cartItem.Variant.SellPriceType==0&&!this.unitPriceEditor;this.calculatorPriceDisabled=e||i}}checkQtyInputDisabled(){let e=this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion,i=S.IsNotEmpty(this.cartItem.ID);return!!(e&&!this.role.SellEditor&&this.orderManager.posState==4&&i||i&&this.cartItem?.Serial?.length>0)}checkCalculatorQtyDisabled(){let e=this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkOrderDeletion,i=this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion;this.calculatorQtyDisabled=!e&&this.orderManager.posState===4&&!this.role.Order&&i}checkEmptySalesID(){if(this.salesOrderData.Order!=null){let e=this.salesOrderData.Order.SalesID;this.isEmptySalesID=S.IsEmpty(e)}}pricebookChange(){S.IsNotEmpty(this.pricebookId)&&(this.cartItem.pricebookUpdate(this.pricebookId,!this.pricebookDisabled,this.pricebookCopyDesc),this.setSelectedPricebook())}setSelectedPricebook(){let e=this.cartItem.getSelectedPricebook(this.pricebookId);this.selectedPriceBook.set(e)}onClearPricebook(){this.cartItem=this._shoppingCartService.resetAppliedPricebook(this.cartItem)}updateHeaderTitle(e){this.modalConfig.title=e}onDeliveryEntityChange(){let e=this.entities.find(i=>i.ID==this.cartItem.EntityID);e?this.cartItem.EntityName=e.Name:delete this.cartItem.EntityName}onOk(e){this.cartItem.removeEnterNote(),!(!this.validateConfigDefaultQuantity(e)||(this.cartItem.Variant.SellPriceType==2&&(this.cartItem.Cost=this.cartItem.Price),!this._shoppingCartService.validatePriceMinimum(this.cartItem)))&&(this.validateOnSubmit(),document.getElementById("product").focus())}validateConfigDefaultQuantity(e){let i=this.cartItem.Quantity;if(e=="Enter"){if(this.isSerial())return!1;if(!this.quantityToOneInDialog)return i>0}return!0}validateOnSubmit(){if(S.IsEmpty(this.cartItem.VariantID)){this._toastr.error("Enter item data before clicking OK!","No item is entered!");return}S.IsEmpty(this.cartItem.Quantity)&&this.updateItemQuantity(1),this.generateSerialItem(),this.checkValidateSerialItem(this.cartItem)&&this.onSubmitCartItem()}onSubmitCartItem(){if(this.data==null){let e=this.cartItem;this._shoppingCartService.pushNewItemToArray(e,!0),this._shoppingCartService.addAvailableComponent(e)}else this._shoppingCartService.updateCartItem(this.cartItem,this.data.index);this._orderProcessorService.reedemPointToDiscount(),this._dialogRef.close()}generateSerialItem(){this.cartItem.isSerialType()&&this.serials.length>0&&(!this.cartItem.Serial||this.cartItem?.Serial?.length==0)&&(this.cartItem.Serial=this.serials.map(e=>({Number:e,Quantity:-1,ExpiryDate:null})),this.cartItem.Quantity=this.serials.length*-1)}onCancel(){this._dialogRef.close()}checkValidateSerialItem(e){return this._shoppingCartService.validateSerialItem(e)}updateItemQuantity(e){!this.role.Return&&e<0||(this.cartItem.Quantity=e,this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=this.cartItem.PriceBookID,this.setSelectedPricebook())}updateDiscountPercentage(e){this.cartItem.Discount=Number(e)}updateOrUnitPrice(e){this.oriUnitPrice=e}quantityEditDisabled(){return this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion&&!this.role.Order&&S.IsNotEmpty(this.cartItem.ID)}onAddItem(e){let i=this.salesOrderData.Order.EntityID;this._variantService.findVariantByID(e,i).then(o=>{let l=o,C=new Be;C.patchByVariant(l),this.addItem(C)})}onEnterProductCode(e){let i=this.salesOrderData.Order.EntityID;this._variantService.findVariantByCode(e,i).then(o=>{if(o){let l=Object.assign(new br,o),C=new Be;C.patchByVariant(l),this.addItem(C)}else this.onProductNotFound(e)}).catch(o=>{window.alert(`Barcode "${e}" is not registered in the product`)})}onProductNotFound(e){this._matDialog.open(En,{data:{message:`Barcode "${e}" is not registered in the product`,title:"Product not found"},width:"30%"}),this.playAudio()}playAudio(){let e=new Audio;e.src="/Sounds/bell_ring.mp3",e.load(),e.play()}addItem(e){this.onHand=0,this.AppConfigJSON.ModuleSell.ProductDialog.QuantityToOneInDialog?e.Quantity=1:this._quantityElement.nativeElement.focus(),this.cartItem=this.checkItemQuantityDefault(e),this.isSerialItem=this.isSerial();let l=`Editing Cart item - ${e.Variant?e.Variant.Name:null}`;this.updateOrUnitPrice(e.UnitPriceOriginal),this.updateHeaderTitle(l),this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=this.cartItem.PriceBookID,this.checkPriceBookDisabled(),this.checkCalculatorPriceDisabled(),this.checkCalculatorQtyDisabled(),this.initIsUnitPriceEditor()}getStockItem(){this._variantService.getStockByID(this.cartItem.VariantID,this.salesOrderData.Order.EntityID).then(e=>{e&&(this.queryInventoryOnOpen=!0,this.allocated=e.Allocated,this.onHand=e.OnHand)})}onCalculatorQty(e){this.updateItemQuantity(e)}onCalculatorPrice(e){this.cartItem.Price=parseFloat(e)}onCalculatorUnitQty(e){this.cartItem.UnitQuantity=parseFloat(e)}resizeCloudinaryImage(e){return e&&(e=e.replace("w_80","w_150")),e}onDiscountAmountChange(e){this.isDiscMultipliciedQty?this.cartItem.DiscountAmount=e:this.cartItem.DiscountAmount=e/this.cartItem.Quantity}onSwitchToggleDiscount(){this.isDiscMultipliciedQty?this.cartItem.DiscountAmount=this.cartItem.DiscountAmount*this.cartItem.Quantity:this.cartItem.DiscountAmount=this.cartItem.DiscountAmount/this.cartItem.Quantity}onEditCost(){let e=!this.enabledEditCost();this.enabledEditCost.set(e),this.cdRef.detectChanges(),this.enabledEditCost()&&this._costElement.nativeElement?.focus()}onCalculatorValueChange(e){this.cartItem.Discount=e.discount,this.cartItem.Price=e.price,this.cartItem.Quantity=e.qty}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(i){return new(i||n)(d(F),d(Ve),d(Me),d(Y),d(B),d(j),d(V),d(Li),d(ee),d(X),d(ne),d(Br),d(me),d(qe),d(No))};static \u0275cmp=P({type:n,selectors:[["POS-modal-item"]],viewQuery:function(i,o){if(i&1&&(Eo(o.calculatorTab,Rt,5),ve(oc,5),ve(rc,5),ve(ac,5),ve(lc,5)),i&2){Ro();let l;Se(l=ye())&&(o._quantityElement=l.first),Se(l=ye())&&(o._priceElement=l.first),Se(l=ye())&&(o._discountElement=l.first),Se(l=ye())&&(o._costElement=l.first)}},standalone:!1,features:[Oi],decls:18,vars:15,consts:[["variant",""],["itemTemplate",""],["quantity",""],["PRICE",""],["price",""],["DISCOUNT",""],["AMOUNT",""],["discount",""],["SHOW_IMAGE",""],["unitCost",""],[3,"onOk","onCancel","onClose","config"],[1,"mb-5"],[1,"container","w-100","h-100"],[1,"row","border-bottom","mt-8","mx-5"],["data-cy","input_sell",1,"btn","btn-link-tab",3,"click","ngClass"],["data-cy","product",1,"btn","btn-link-tab",3,"click","ngClass"],["class","btn btn-link-tab","data-cy","product",3,"ngClass","click",4,"ngIf"],["class","btn btn-link-tab","data-cy","serial",3,"ngClass","click",4,"ngIf"],["data-cy","serial",1,"btn","btn-link-tab",3,"ngClass"],[1,"mx-8"],[4,"ngIf"],[3,"hidden"],["data-cy","serial",1,"btn","btn-link-tab",3,"click","ngClass"],[1,"py-8"],[1,"alert","alert-warning","text-center","my-5","py-3"],["class","row",3,"ngClass",4,"ngIf"],[1,"row","mt-6"],["class","col-auto pe-0",4,"ngIf"],[1,"row","mt-6","mb-5"],[1,"col","tinymce"],["height","210px",3,"ngModelChange","ngModel"],[1,"row"],[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"],[1,"d-flex","align-items-center","justify-content-between","w-100"],[1,"ms-3","text-wrap","text-break"],[1,"opacity-75"],[1,"fw-bold"],[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","simpleKeyboard","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"],["class","col-auto pe-0","style","width: 82px",4,"ngIf"],[1,"col-auto","pe-0",2,"width","112px",3,"hidden"],["class","form-control cart-input","disabled","",3,"value",4,"ngIf","ngIfElse"],[1,"col-auto","d-flex","align-items-center","pt-5"],[1,"col-auto","pe-0",2,"width","82px"],["type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input","input-numpad",3,"ngModelChange","preventNegative","readOnly","decimalPlaces","ngModel"],["disabled","",1,"form-control","cart-input",3,"value"],["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"],[1,"col-auto","pe-0"],["position","top","parent","body","bindValue","ID","bindLabel","Name","placeholder","Sales Person",3,"selectedChange","customTooltip","items","selected"],["bindLabel","Name","bindValue","ID","placeholder","Delivery Outlet","appendTo","body",2,"width","200px",3,"ngModelChange","items","ngModel"],[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"],[1,"row","d-flex","align-items-center","justify-content-start","mt-4"],[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
|
|
6
|
-
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,"w-100","d-flex","justify-content-end"],[1,"w-100","d-flex","justify-content-end","mt-2"],["id","inputDiscount","keyboardType","number","type","text","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","cart-input",3,"ngModelChange","simpleKeyboard","ngModel","preventNegative","readonly"],["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,"d-flex","align-items-center","justify-content-end","mt-2"],[1,"fw-bold","text-danger"],[1,"d-flex","align-items-center","justify-content-end","mt-2","text-danger"],[1,"text-danger"],[1,"row","border-top","mx-0","px-0","mt-4"],[1,"col-6","d-flex","justify-content-end","mt-4"],[1,"col-sm-4","d-flex","justify-content-center","flex-column","align-items-center","text-body-secondary","py-8"],["target","_blank",2,"color","inherit",3,"routerLink","queryParams"],[4,"ngIf","ngIfElse"],[1,"col-sm-8","py-8"],[1,"col-12"],[1,"d-flex"],["aria-hidden","true",1,"fa-archive","fa-solid","fa-1x","pt-3","pe-2"],[2,"font-size","15px","font-family",'"Roboto Slab"'],[1,"table","table-bordered","text-center","inventory-table"],[1,"table-light","py-6","border-end",2,"text-transform","none"],[1,"table-light","py-6",2,"text-transform","none"],[1,"py-6"],[1,"table","table-bordered",2,"width","171px"],["class","col-6",4,"ngIf"],[1,"text-center"],["aria-hidden","true",1,"fa-solid","fa-image","fa-5x"],[1,"border","rounded",3,"src"],[1,"table-light",2,"text-transform","none","width","20px"],[1,"p-0"],[1,"d-flex","align-items-center"],[3,"ngClass"],["matTooltip","This field is editable","matTooltipPosition","above","type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","border-0","bg-white","text-end","pe-2",3,"ngModelChange","ngModel"],[1,"w-100","text-end","ps-8","pe-2",3,"ngClass"],["type","button","matTooltip","This field is editable","matTooltipPosition","above",1,"text-d",3,"click"],[1,"fa-solid","fa-pen-to-square","fa-lg","cursor","mx-2"],[1,"table-light",2,"text-transform","none"],[1,"pe-4","text-end"],[1,"p-3","text-end"],["ngClass","ms-3"],[1,"table","table-bordered","text-center"],[1,"table-light"],[1,"row","mt-8"],[1,"fa-solid","fa-book","fa-1x","pt-3","pe-2"],[1,"table-light","py-6","border-end",2,"text-transform","none","width","70px"],[4,"ngFor","ngForOf"],[3,"cartItemChange","serialsChange","entityId","cartItem","disabled","serials"],[3,"discountTotal","priceTotal","qtyTotal","noteChanges","notes","price","discount","quantity","variantName","disabledQty"]],template:function(i,o){i&1&&(r(0,"modal-material",10),_("onOk",function(C){return o.onOk(C)})("onCancel",function(){return o.onCancel()})("onClose",function(){return o.onCancel()}),r(1,"content",11)(2,"div",12)(3,"div",13)(4,"div")(5,"a",14),_("click",function(){return o.onTabChange(o.modalItemState.SELL_INPUT)}),m(6," Cart "),a(),r(7,"a",15),_("click",function(){return o.onTabChange(o.modalItemState.DISCOUNT)}),m(8," Discount "),a(),g(9,pc,2,3,"a",16)(10,mc,2,3,"a",17)(11,dc,2,3,"a",18),a()(),r(12,"div",19),g(13,Ic,11,6,"ng-container",20)(14,Ac,59,22,"ng-container",20)(15,Jc,41,19,"ng-container",20)(16,Gc,2,4,"ng-container",20)(17,zc,2,7,"div",21),a()()()()),i&2&&(p("config",o.modalConfig),s(5),p("ngClass",E(11,Si,o.modalItemState.SELL_INPUT==o.currentState)),s(2),p("ngClass",E(13,Si,o.modalItemState.DISCOUNT==o.currentState)),s(2),p("ngIf",(o.cartItem==null||o.cartItem.Variant==null?null:o.cartItem.Variant.Name)&&o.hasInventoryView),s(),p("ngIf",o.isSerialItem),s(),R(o.productCalculator()?11:-1),s(2),p("ngIf",o.modalItemState.SELL_INPUT==o.currentState),s(),p("ngIf",o.modalItemState.DISCOUNT==o.currentState),s(),p("ngIf",o.modalItemState.PRODUCT==o.currentState),s(),p("ngIf",o.modalItemState.SERIAL==o.currentState),s(),R(o.productCalculator()?17:-1))},dependencies:[H,_e,$,te,ht,K,ie,W,nt,Vn,pt,se,Ot,Lt,Fr,Zr,qt,Ni,Rt,X,fr],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}"]})};var Kc=n=>({"is-invalid":n});function Yc(n,t){n&1&&(r(0,"div",6)(1,"span"),m(2,"Host URL is required."),a()())}var An=class n{constructor(t){this.dialogRef=t;this.config.title="Connect ECR",this.config.customWidth="400px"}config=new U;urlCtrl=new bt("https://localhost:5001/EcrHub",[ui.required]);onClose(){this.dialogRef.close()}onConnect(){this.urlCtrl.valid&&this.dialogRef.close(this.urlCtrl.value)}static \u0275fac=function(e){return new(e||n)(d(F))};static \u0275cmp=P({type:n,selectors:[["app-modal-connect-ecr"]],decls:10,vars:7,consts:[[3,"onCancel","onClose","onOk","config","dynamicValidated"],[1,"d-flex","flex-column",2,"row-gap","1.5rem"],[1,"fw-normal"],[1,"form-floating-outline"],["id","floatingInput","placeholder","https://localhost:4001/EcrHub","type","text",1,"form-control",3,"ngClass","formControl"],["for","floatingInput"],[1,"invalid-feedback"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()})("onOk",function(){return i.onConnect()}),r(1,"content")(2,"div",1)(3,"h4",2),m(4,"Please input the ECR Host URL:"),a(),r(5,"div",3),h(6,"input",4),r(7,"label",5),m(8,"Host URL"),a(),g(9,Yc,3,0,"div",6),a()()()()),e&2&&(p("config",i.config)("dynamicValidated",i.urlCtrl.valid),s(6),p("ngClass",E(5,Kc,i.urlCtrl.invalid&&(i.urlCtrl.touched||i.urlCtrl.dirty)))("formControl",i.urlCtrl),s(3),R(i.urlCtrl.invalid&&(i.urlCtrl.touched||i.urlCtrl.dirty)?9:-1))},dependencies:[Z,H,Ae,W,ze,te,K,vt],encapsulation:2})};function Xc(n,t){if(n&1){let e=v();x(0),r(1,"div",14)(2,"radio-options",15),w("modelChange",function(o){u(e);let l=c(2);return D(l.odsConfigType,o)||(l.odsConfigType=o),f(o)}),a(),r(3,"label",16),m(4,"Choose Configuration"),a()(),I()}if(n&2){let e=t.ngIf,i=c(2);s(2),M("model",i.odsConfigType),p("options",e.options.OrderDisplayBroadcastModeType)}}function Zc(n,t){if(n&1&&(x(0),g(1,Xc,5,2,"ng-container",13),b(2,"async"),I()),n&2){let e=c();s(),p("ngIf",O(2,1,e.odsConfig$))}}function ep(n,t){n&1&&(r(0,"div",17)(1,"div",18),h(2,"i",19),a(),r(3,"div",20)(4,"div"),m(5," Choose outlet first before configuring Order Display! "),a()()())}var Ln=class n{constructor(t,e,i,o){this.dialogRef=t;this.httpService=e;this.outletRegisterService=i;this.data=o;this.modalConfig=new U,this.modalConfig.title="Order Display Broadcast Configuration",this.modalConfig.okText="Save (F2)",this.modalConfig.customWidth="460px"}modalConfig;odsConfigType=1;odsLink="https://ods.dealpos.app";odsConfig$;hasOutlet=!1;ngOnInit(){let t=this.outletRegisterService.Data?.EntityID;this.hasOutlet=!!t,this.hasOutlet&&this.loadOdsConfig()}loadOdsConfig(){let t=this.outletRegisterService.Data.EntityID;this.odsConfig$=this.httpService.get(`/api/outlet/GetOrderDisplayBroadcastMode?EntityID=${t}`).pipe(Re(e=>{this.odsConfigType=e.form?.OrderDisplayBroadcastMode}),li(e=>(console.error("Error loading ODS configuration:",e),Zn({form:{EntityID:null,OrderDisplayBroadcastMode:0},options:{OrderDisplayBroadcastModeType:[{Key:0,Value:"Off"},{Key:1,Value:"Park"},{Key:2,Value:"Pay"},{Key:3,Value:"Park and Pay"}]}}))),At(1))}onSave(){let e={EntityID:this.outletRegisterService.Data.EntityID,OrderDisplayBroadcastMode:this.odsConfigType};this.httpService.post("/api/outlet/UpdateOrderDisplayBroadcastMode",e).pipe(Re(()=>{this.dialogRef.close(e)}),li(i=>(console.error("Error saving ODS configuration:",i),Zn(null)))).subscribe()}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(F),d(Qe),d(Y),d(Ve))};static \u0275cmp=P({type:n,selectors:[["modal-ods-config"]],decls:18,vars:4,consts:[["outletWarning",""],[3,"onOk","onClose","onCancel","config"],[1,"container"],[1,"row"],[1,"col-12","text-center"],[4,"ngIf","ngIfElse"],[1,"text-center","mt-4"],[1,"m-0"],[1,"col-12","mt-2"],[1,"text-center"],["src","https://res.cloudinary.com/dealpos-m/image/upload/w_180/v1746771410/dealpos%20app/dealpos_order_fulfillment_u7xzqe.png","alt","Order Display System",1,"img-fluid","mb-4"],[1,"mb-0"],["target","_blank",1,"fw-bold",3,"href"],[4,"ngIf"],[1,"form-floating-outline","radio","border","rounded","mt-4",2,"height","auto !important"],["id","odsConfigType",3,"modelChange","model","options"],["for","odsConfigType"],[1,"warning-banner","mt-4","d-flex","align-items-center","p-3","border","rounded","bg-light"],[1,"ms-2","me-3"],[1,"fas","fa-exclamation-triangle","text-warning","fa-lg"],[1,"warning-text"]],template:function(e,i){if(e&1){let o=v();r(0,"modal-material",1),_("onOk",function(){return u(o),f(i.onSave())})("onClose",function(){return u(o),f(i.onClose())})("onCancel",function(){return u(o),f(i.onClose())}),r(1,"content")(2,"div",2)(3,"div",3)(4,"div",4),g(5,Zc,3,3,"ng-container",5)(6,ep,6,0,"ng-template",null,0,G),r(8,"div",6)(9,"p",7),m(10," This feature is used for monitoring incoming orders on a secondary screen, commonly used in the warehouse area. You can choose when the orders should appear on the display. "),a()()(),r(11,"div",8)(12,"div",9),h(13,"img",10),r(14,"p",11),m(15," You can access this feature through "),r(16,"a",12),m(17,"ods.dealpos.app"),a()()()()()()()()}if(e&2){let o=Q(7);p("config",i.modalConfig),s(5),p("ngIf",i.hasOutlet)("ngIfElse",o),s(11),p("href",i.odsLink,tt)}},dependencies:[Z,$,Ne,Ce,ki,wi,Ae,W],styles:[".warning-banner[_ngcontent-%COMP%]{box-shadow:-3px 0 #ffc107;background-color:#fff9e8!important;padding:5px;border-radius:12px;margin-bottom:15px;display:flex;align-items:center}.warning-text[_ngcontent-%COMP%]{padding:5px}"]})};function tp(n,t){if(n&1&&(r(0,"span",12),m(1),a()),n&2){let e=c().$implicit;s(),y(": ",e.value,"")}}function ip(n,t){if(n&1&&(r(0,"p",6),m(1),g(2,tp,2,1,"span",12),a()),n&2){let e=t.$implicit;s(),y(" ",e.label," "),s(),R(e.value?2:-1)}}function np(n,t){if(n&1&&(r(0,"div",7)(1,"p",14)(2,"span",15),m(3," Valid until "),r(4,"span",16),m(5),b(6,"date"),a()()()()),n&2){let e=c(2);s(5),T(pe(6,1,e.coupon==null||e.coupon.Requirement==null?null:e.coupon.Requirement.ExpiryDate,"longDate"))}}function op(n,t){if(n&1&&g(0,np,7,4,"div",13),n&2){let e=c();p("ngIf",(e.coupon==null||e.coupon.Requirement==null?null:e.coupon.Requirement.ExpiryDate)!=="0001-01-01T00:00:00")}}function rp(n,t){n&1&&(r(0,"p",10),h(1,"i",17),r(2,"span",16),m(3,"Edit Mode: "),a(),m(4,"Coupon information is displayed for reference only. Coupon removal is not available in edit mode. "),a())}function ap(n,t){n&1&&(r(0,"p",11),h(1,"i",18),r(2,"span",16),m(3,"Important: "),a(),m(4,"Removing this coupon will reset your cart to its original state. All discounts and price changes from this coupon will be removed. "),a())}var Bn=class n{dialogRef=oe(F);decimalPipe=oe(X);couponService=oe(Xe);couponProviderService=oe(It);salesOrder=oe(V);orderProcessorService=oe(j);modalConfig;couponLabel=q(null);couponRequirements=q([]);coupon=this.couponService.coupon;couponProvider=this.couponProviderService.coupon;isEdit=q(!1);constructor(){this.initModalConfig(),this.initCouponLabel(),this.generateCouponRequirement()}initModalConfig(){let t=this.orderProcessorService.Data.posState;this.modalConfig=new U,this.modalConfig.title=this.generateDialogTitle(),this.modalConfig.customWidth="400px",this.isEdit.set(t===2),t===2?(this.modalConfig.hideOk=!0,this.modalConfig.cancelText="Close",this.isEdit.set(!0)):(this.modalConfig.okText="Remove",this.modalConfig.hideCancel=!0)}generateDialogTitle(){let t=this.salesOrder?.Data?.Order?.PromotionCoupon;return`Coupon ${this.maskCouponCode(t)} Applied`}maskCouponCode(t){return t?`***${t.slice(-2)}`:""}generateCouponRequirement(){let t=[];if(this.coupon?.ApplyToProduct?.length>0&&t.push({label:"Required Specific Product",value:null}),this.coupon?.Requirement?.MaximumDiscount&&t.push({label:"Maximum Discount",value:`Rp. ${this.decimalPipe.transform(this.coupon?.Requirement?.MaximumDiscount)}`}),this.coupon?.Requirement?.MinimumSpendingAmount&&t.push({label:"Minimum Spending",value:`Rp. ${this.decimalPipe.transform(this.coupon?.Requirement?.MinimumSpendingAmount)}`}),this.coupon?.Requirement?.FullPriceProductOnly&&t.push({label:"Full Price Product Only",value:null}),S.IsNotEmpty(this.coupon?.Requirement?.CustomerName)){let i=this.coupon?.Requirement?.CustomerName,o=this.coupon?.Requirement?.CustomerCode;t.push({label:"Exclusive for "+i+(o?` - ${o}`:""),value:null})}this.coupon?.Requirement?.CouponDeductedAmount&&t.push({label:"Point Deduction",value:`${this.decimalPipe.transform(this.coupon?.Requirement?.CouponDeductedAmount)}`}),this.couponRequirements.set(t)}initCouponLabel(){let t=this.couponProviderService.coupon||this.couponService.coupon,e=this.couponProviderService.coupon,i="";if(!t){this.couponLabel.set("");return}if(e)e.Type==="Percentage"?i=`${this.decimalPipe.transform(e.Amount)}% Discount`:i=`Rp. ${this.decimalPipe.transform(e.Amount)} Discount`;else switch(t?.Requirement?.Type){case 2:i=`Rp. ${this.decimalPipe.transform(t?.Amount)} Discount`;break;case 1:i=`${this.decimalPipe.transform(t?.Amount)}% Discount`;break;case 5:i="Authorize Full Access";break;case 4:i="Authorize Parked Deletion";break;case 3:i="Authorize Return";break;case 6:i="Authorize Delete Item";break;default:i="Coupon Applied";break}this.couponLabel.set(i)}onClose(){this.dialogRef.close(!1)}onRemove(){this.dialogRef.close(!0)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["app-modal-confirm-remove-coupon"]],decls:15,vars:4,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container-fluid"],[1,"card","coupon-card","mb-8"],[1,"card-body","text-center",2,"padding","0.2rem"],[1,"mb-6","badge","text-bg-success","fs-3","text-white"],[1,"d-flex","flex-column","gap-4"],[1,"mb-0"],[1,"valid-date","d-flex","justify-content-center"],[1,"card","warning-card","mb-0"],[1,"card-body","d-flex","justify-content-center","align-items-center"],[1,"warning-msg","mb-0","text-info-emphasis"],[1,"warning-msg","mb-0","text-warning-emphasis"],[1,"text-success","fw-semibold"],["class","valid-date d-flex justify-content-center",4,"ngIf"],[1,"mb-0","p-4"],[1,"opacity-75"],[1,"fw-bold"],[1,"fa-solid","fa-info-circle","text-info","me-2","fw-bold"],[1,"fa-solid","fa-triangle-exclamation","text-warning","me-2","fw-bold"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.onRemove()})("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"span",4),m(6),a(),r(7,"div",5),ci(8,ip,3,2,"p",6,si),g(10,op,1,1,"div",7),a()()(),r(11,"div",8)(12,"div",9),g(13,rp,5,0,"p",10)(14,ap,5,0,"p",11),a()()()()()),e&2&&(p("config",i.modalConfig),s(6),T(i.couponLabel()),s(2),pi(i.couponRequirements()),s(2),R(!(i.coupon==null||i.coupon.Requirement==null)&&i.coupon.Requirement.ExpiryDate?10:-1),s(3),R(i.isEdit()?13:14))},dependencies:[Z,$,We,Ae,W],styles:['body[_ngcontent-%COMP%]{font-family:Roboto Slab,serif;background:linear-gradient(135deg,#f5f7fa,#c3cfe2);min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px}.coupon-card[_ngcontent-%COMP%]{background:linear-gradient(135deg,#f8f9fa,#e9ecef);border-radius:12px;padding:24px;border:2px solid #89b03e;position:relative;overflow:hidden}.coupon-card[_ngcontent-%COMP%]:before{content:"";position:absolute;top:0;left:0;right:0;height:4px;background:linear-gradient(90deg,#89b03e,#a4c449)}.valid-date[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{border:1px solid #e0e0e0;border-radius:4px;box-shadow:-3px 0 #c5e1a5;width:300px;background-color:#f7fbf0!important}.warning-card[_ngcontent-%COMP%]{border-radius:4px;box-shadow:-3px 0 #ffc107;background-color:#fff9e8!important}.badge[_ngcontent-%COMP%]{display:inline-block;background:linear-gradient(135deg,#89b03e,#a4c449);color:#fff;padding:12px 24px;border-radius:50px;font-size:1.4rem;font-weight:700;margin-bottom:20px;box-shadow:0 4px 15px #89b03e4d}']})};var kt=class n{constructor(t,e,i,o,l,C,N,ae,ke,Fe,je,ri,Tt,Kn,Yn,ai){this.roleService=t;this.orderProcessorService=e;this.promotionService=i;this.promotionCouponService=o;this.promotionCouponProvider=l;this.dialog=C;this.parkOrderService=N;this.salesOrderService=ae;this.outletRegisterService=ke;this.pageInitialService=Fe;this.toastrService=je;this.httpService=ri;this.shoppingCartService=Tt;this.customerDisplay=Kn;this.ecrService=Yn;this.ecrSignalR=ai;this.destroy$=new z,this.sourceMenu=[..._a],this._moreMenu=new Xn(this.sourceMenu),this.moreMenu$=this._moreMenu.asObservable(),this.initElgiblePromotion(),this.subscribeObservable()}_moreMenu;moreMenu$;eligiblePromotions$;destroy$;sourceMenu;_enabledDragDrop=new Xn(!0);enabledDragDrop$=this._enabledDragDrop.asObservable();subscribeObservable(){yi([this.orderProcessorService.Data$,this.salesOrderService.Data$]).pipe(k(this.destroy$)).subscribe(([t,e])=>{this.filterMoreMenu(t.posState)}),this.roleService.Data$.pipe(k(this.destroy$)).subscribe({next:()=>{this.filterMoreMenu(0)}})}initElgiblePromotion(){this.eligiblePromotions$=this.promotionService.Data$.pipe(et(()=>this.promotionService.getTotalEligiblePromotion()))}moreMenuAction(t){switch(t){case"ADD_ITEM":this.dialog.open($e);break;case"COUPON":let e=this.salesOrderService.Data?.Order?.PromotionCoupon;S.IsNotEmpty(e)?this.dialog.open(Bn).afterClosed().pipe(ce(o=>o)).subscribe(()=>this.removePromotionCoupon()):this.dialog.open(yn);break;case"PROMOTION":this.dialog.open(zi,{id:"promotion-event"});break;case"UPLOAD":this.onImportItems();break;case"RETURN":this.dialog.open(xn);break;case"CLEAR":this.dialog.open(Sn);break;case"SERIAL":this.dialog.open(In);break;case"SPLIT":this.onSplitItem();break;case"PRINT":this.parkOrderService.onPrintRetrieve();break;case"CANCEL":this.onCancel();break;case"SYNC":this.dialog.open(Mn);break;case"FULFILLMENT":this.onFulfillment();break;case"RETRIEVE":this.onRetrieve();break;case"INVENTORY":this.checkAvailableInventory();break;case"SORT":let i=!this._enabledDragDrop.value;this.enableDragDrop(i);break;case"CUSTOMER_DISPLAY":this.confirmEnabledCustomerDisplay();break;case"ECR":this.openModalInputEcrUrl();break;case"ODS_CONFIG":this.openOdsConfigDialog();break}}removePromotionCoupon(){let t=this.promotionCouponProvider.coupon;S.IsNotEmpty(t)?this.promotionCouponProvider.removeCoupon():this.promotionCouponService.removeAppliedCoupon()}openOdsConfigDialog(){this.dialog.open(Ln).afterClosed().pipe(ce(t=>!!t)).subscribe(()=>{this.toastrService.success("Order Display Configuration applied successfully","Success")})}openModalInputEcrUrl(){this.ecrSignalR.isConnected()?this.confirmDisableEcr():this.dialog.open(An).afterClosed().pipe(ce(e=>!!e)).subscribe(e=>{this.ecrSignalR.initConnection(e)})}confirmDisableEcr(){this.dialog.open(gi,{data:{title:"Disconnect ECR",message:"Are you sure you want to disconnect ECR?",okText:"OK",headerType:Le.Warning},width:"500px"}).afterClosed().pipe(ce(t=>t),Re(()=>{this.ecrService.disconnect(),this.ecrSignalR.stopConnection()})).subscribe(()=>{this.toastrService.success("ECR is disconnected","Success")})}confirmEnabledCustomerDisplay(){let t=this.customerDisplay.isEnabled(),e;t?e={title:"Disconnect from Customer Display",message:`
|
|
4
|
+
`},disableClose:!0})}parkOrder(){let t=this.salesOrderService.Data,e=this.pageInitialService.Data.AppConfigJSON;if(t.CartItems.length==0){this.toastrService.warning("You must have at least one item","No Item in Cart!");return}if(!(!this.validateCustomerRequired(e,t)||!this.validateUsedPromotion(t))){if(S.IsEmpty(t.Order.RegisterID)){this.toastrService.warning(fr.emptyEntity,Le.Warning);return}this.validateShowParkModal()}}validateCustomerRequired(t,e){return t.ModuleSell.Header.CustomerRequired&&e.Order.CustomerID==null?(this.toastrService.warning("Customer is needed before parking orders!","Missing customer!"),!1):!0}validateUsedPromotion(t){let e=this.promotionEventService.selectedPromotion;return S.IsNotEmpty(e)||S.IsNotEmpty(t.Order.PromotionCoupon)?(this.toastrService.warning("Orders with applied promotions or coupons cannot be parked!","Park Not Allowed!"),!1):!0}validateShowParkModal(){let t=this.outletService.Data.ParkLayoutPack,e=this.pageInitialService.Data.AppConfigJSON,i=this.salesOrderService.Data;if(t&&S.IsNotEmpty(t.ID))this.orderProcessorService.Data.posState==4?this.showReparkModal():this.showParkSelectModal(e,i);else{if(!this.validateRetrieveMode(e))return;this.setDefaultParkNote(e),this.showParkInputModal()}}showParkSelectModal(t,e){let i=this.orderProcessorService.Data,o=this.outletService.Data.ParkLayoutPack;this.orderHttpService.getVacant(e.Order.EntityID).subscribe(l=>{let C=t.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkDialogTitle,N=i.posState==5,ae=t.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,ke=N?"Split Order":C;this.dialog.open(Kt,{data:{title:ke,parkLayoutPack:this.generateParkLayoutOptions(o,l.Orders),replaceWithAlias:ae}}).afterClosed().pipe(pe(Fe=>S.IsNotEmpty(Fe)),Ee(Fe=>{let je=new Gt;return je.ParkLabel=Fe.Name,je.Note=Fe.Note,this.park(je)})).subscribe()})}showReparkModal(){this.dialog.open(an,{data:this.parkOrderRetrieve})}validateRetrieveMode(t){return t.ApplicationParkAndRetrieve.Advance.retreiveMode==1?(this.toastrService.error("Your retrieve config is in Group mode, to enable park please setting your Park layout at Outlet page","Error!"),!1):!0}setDefaultParkNote(t){let e=t.ApplicationParkAndRetrieve.UserInterfaceLabel.DefaultParkNoteValue,i=this.orderProcessorService.Data.posState==2,o=this.salesOrderService.Data;!i&&S.IsNotEmpty(e)&&S.IsEmpty(o.Order.Note)&&(this.salesOrderService.Data.Order.Note=e)}showParkInputModal(){let t="Park this order?",e=this.orderProcessorService.Data.posState==5,i=this.outletService.Data?.ParkLayoutPack;e&&(t="Split Detail"),this.dialog.open(tn,{id:"park-form-modal",data:{title:t,labelDisable:i&&S.IsNotEmpty(i?.ID)||this.orderProcessorService.Data.posState==5,ParkLabel:this.salesOrderService.Data.Order.ParkLabel}})}onPrintRetrieve(){this.dialog.open(nn).afterClosed().pipe(pe(t=>S.IsNotEmpty(t))).subscribe(t=>{t=="ORDER"?this.emitParkReceipt(!1,!1,!0):this.emitBillReceipt()})}emitParkReceipt(t,e=!1,i=!1){let o=this.receiptService.generateParkReceipt(t,e);(this.pageInitialService.Data.AppConfigJSON.ApplicationParkAndRetrieve?.PrintBehaviour?.PrintAfterPark||i)&&this._onPrint.next({type:"PARK",template:o})}emitBillReceipt(){let t=this.outletService.Data,e;1==t.PrintTemplate.PrintMode?(e=this.receiptService.generateBillInvoice(),this._onPrint.next({type:"BILL_A4",template:e})):(e=this.receiptService.generateBillReceipt(),this._onPrint.next({type:"BILL_MINI",template:e}))}generateParkLayoutOptions(t,e=[]){return t.Layout=t.Layout.map(i=>{i.Options=[];for(let o=1;o<=i.Size;o++){let l=new Yt;l.Name=i.Name+o,l.Alias=this.generateAlias(t,l.Name),l.IsOccupied=this.IsOccupied(l.Name,e),i.Options.push(l)}return i}),t}generateAlias(t,e){let i="";if(t.Alias){let o=t.Alias.filter(l=>l.Name==e);o.length>0&&(i=`${o[0]?.Alias}`)}return i}IsOccupied(t,e){let i=e.filter(l=>l.ParkLabel==t),o=!1;return i.length>0&&(o=!0),o}static \u0275fac=function(e){return new(e||n)(A(Qe),A(Mt),A(j),A(B),A(V),A(ee),A($t),A(Y),A(Oe),A(ne))};static \u0275prov=at({token:n,factory:n.\u0275fac,providedIn:"root"})};var pn=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=_t({type:n});static \u0275inj=gt({imports:[Z,Ce,Vi,xt,Dr,Wt,Bt,Qt,Ke,Qi]})};var sa=n=>({"opacity-50":n});function Qa(n,t){if(n&1){let e=v();r(0,"div",5)(1,"h6",6),m(2,"Verify Via"),a(),r(3,"div",7)(4,"button",8),_("click",function(){u(e);let o=c();return f(o.onChooseVerifyType("phone"))}),r(5,"div",9)(6,"div"),h(7,"i",10),a(),r(8,"div",11),m(9),a()()()(),r(10,"div",12)(11,"button",8),_("click",function(){u(e);let o=c();return f(o.onChooseVerifyType("email"))}),r(12,"div",9),h(13,"i",13),r(14,"div",11),m(15),a()()()(),r(16,"div",12)(17,"button",14),_("click",function(o){return u(e),c().onChooseVerifyType("pin"),f(o.preventDefault())}),r(18,"div",9),h(19,"i",15),r(20,"div",16),m(21,"Use PIN"),a()()()()()}if(n&2){let e=c();s(4),p("disabled",!e.phone||(e.phone==null?null:e.phone.length)<6),s(4),p("ngClass",E(6,sa,!e.phone||(e.phone==null?null:e.phone.length)<6)),s(),y(" ",e.phone&&(e.phone==null?null:e.phone.length)>6?e.phone:"Mobile Phone is not registered"," "),s(2),p("disabled",!e.email),s(3),p("ngClass",E(8,sa,!e.email)),s(),y(" ",e.email?e.email:"Email is not registered"," ")}}function qa(n,t){if(n&1){let e=v();r(0,"div",17)(1,"div",18)(2,"div"),m(3,"OTP Verification is turned "),r(4,"span",19),m(5,"OFF"),a(),m(6,","),a(),r(7,"div"),m(8," Please read this "),r(9,"a",20),m(10,"article"),a(),m(11," to turn on "),a()()(),r(12,"div")(13,"div",21)(14,"button",22),_("click",function(){u(e);let o=c();return f(o.onRedeem())}),m(15,"Redeem"),a()()()}}var mn=class n{toastrService=oe(ee);onVerify=new He;pointUsedChange=new He;redeemEvent=new He;isVerifyEnabled=!1;phone;email;pointUsed;pointBalance;onPointUsedChange(){this.pointUsedChange.emit(this.pointUsed)}ngAfterViewInit(){this.setFocusInput()}setFocusInput(){setTimeout(()=>{document.getElementById("pointInput")?.focus()},300)}onChooseVerifyType(t){this.checkPointUsed()&&this.onVerify.emit(t)}onRedeem(){this.checkPointUsed()&&this.redeemEvent.emit()}checkPointUsed(){return S.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(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["point-step"]],inputs:{isVerifyEnabled:"isVerifyEnabled",phone:"phone",email:"email",pointUsed:"pointUsed",pointBalance:"pointBalance"},outputs:{onVerify:"onVerify",pointUsedChange:"pointUsedChange",redeemEvent:"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",3,"ngClass"],[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,"fs-5","w-100"],[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(e,i){e&1&&(r(0,"div",0)(1,"div",1)(2,"input",2),w("ngModelChange",function(l){return D(i.pointUsed,l)||(i.pointUsed=l),l}),_("ngModelChange",function(){return i.onPointUsedChange()}),a()(),r(3,"div",3)(4,"span",1),m(5,"Of"),a(),r(6,"span",4),m(7),b(8,"number"),a()(),r(9,"div"),m(10,"Points"),a()(),g(11,Qa,22,10,"div",5)(12,qa,16,0)),e&2&&(s(2),M("ngModel",i.pointUsed),p("max",i.pointBalance),s(5),T(O(8,4,i.pointBalance)),s(4),R(i.isVerifyEnabled?11:12))},dependencies:[Z,U,X,ut,pt,Ce,te,K,ie,Ke,ce],styles:[".input-point[_ngcontent-%COMP%]{width:120px;height:44px;font-size:1.375rem;text-align:center}"]})};var $a=n=>({"error-input":n});function Ja(n,t){if(n&1&&(r(0,"span"),m(1),a()),n&2){let e=c(3);s(),y(" ",e.config.separator," ")}}function Ga(n,t){if(n&1){let e=v();x(0),r(1,"input",5,0),_("paste",function(o){u(e);let l=c(2);return f(l.handlePaste(o))})("keyup",function(o){let l=u(e).index,C=c(2);return f(C.onKeyUp(o,l))})("input",function(o){let l=u(e).index,C=c(2);return f(C.onInput(o,l))})("keydown",function(o){let l=u(e).index,C=c(2);return f(C.onKeyDown(o,l))}),a(),g(3,Ja,2,1,"span",6),I()}if(n&2){let e=t.$implicit,i=t.index,o=t.last,l=c(2);s(),to("otp-input ",l.config.inputClass,""),p("pattern",l.config.allowNumbersOnly?"\\d*":"")("type",l.inputType)("placeholder",(l.config==null?null:l.config.placeholder)||"")("ngStyle",l.config.inputStyles)("formControl",l.otpForm.controls[e])("id",l.getBoxId(i))("ngClass",E(11,$a,(l.config==null?null:l.config.showError)&&(l.formControl==null?null:l.formControl.invalid)&&((l.formControl==null?null:l.formControl.dirty)||(l.formControl==null?null:l.formControl.touched)))),s(2),p("ngIf",l.config.separator&&!o)}}function za(n,t){if(n&1){let e=v();r(0,"div",2),_("focusin",function(){u(e);let o=c();return f(o.onFocusIn())})("focusout",function(){u(e);let o=c();return f(o.onFocusOut())}),r(1,"div",3),g(2,Ga,4,13,"ng-container",4),a()()}if(n&2){let e=c();to("ng-otp-input-wrapper wrapper ",e.config.containerClass,""),To("id","c_",e.componentKey,""),p("ngStyle",e.config.containerStyles),s(2),p("ngForOf",e.controlKeys)}}var ft=class{static ifTab(t){return this.ifKey(t,"Tab")}static ifDelete(t){return this.ifKey(t,"Delete;Del")}static ifBackspace(t){return this.ifKey(t,"Backspace")}static ifRightArrow(t){return this.ifKey(t,"ArrowRight;Right")}static ifLeftArrow(t){return this.ifKey(t,"ArrowLeft;Left")}static ifSpacebar(t){return this.ifKey(t,"Spacebar; ")}static ifKey(t,e){return e.split(";").some(o=>o===t.key)}},Ci=class{static keys(t){return t?Object.keys(t):[]}},po=(()=>{class n{set disabled(e){this.setDisabledState(e)}get inputType(){return this.config?.isPasswordInput?"password":this.config?.allowNumbersOnly?"tel":"text"}get controlKeys(){return Ci.keys(this.otpForm?.controls)}get formControl(){return this.formCtrl??this.inj?.get(Qo)}constructor(e,i){this.document=e,this.inj=i,this.config={length:4},this.onBlur=new z,this.onInputChange=new z,this.inputControls=new Array(this.config.length),this.componentKey=Math.random().toString(36).substring(2)+new Date().getTime().toString(36),this.destroy$=new z,this.activeFocusCount=0,this.onChange=()=>{},this.onTouched=()=>{},this._isDisabled=!1}ngOnInit(){this.otpForm=new qo({});for(let e=0;e<this.config.length;e++)this.otpForm.addControl(this.getControlName(e),new bt);this.otpForm.valueChanges.pipe(k(this.destroy$)).subscribe(e=>{Ci.keys(this.otpForm.controls).forEach(i=>{var o=this.otpForm.controls[i].value;o&&o.length>1&&(o.length>=this.config.length?this.setValue(o):this.rebuildValue())})})}setDisabledState(e){this._isDisabled=e,this.otpForm&&(e?this.otpForm.disable({emitEvent:!1}):this.otpForm.enable({emitEvent:!1}))}writeValue(e){this.currentVal=this.hasVal(e)?e:null,this.setValue(this.currentVal)}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}onFocusIn(){this.onTouched(),this.activeFocusCount++}onFocusOut(){setTimeout(()=>{this.activeFocusCount--,this.activeFocusCount===0&&(this.onTouched(),this.onBlur.next())},0)}ngAfterViewInit(){if(!this.config.disableAutoFocus){let e=this.document.getElementById(`c_${this.componentKey}`);if(e){let i=e.getElementsByClassName("otp-input")[0];i&&i.focus&&i.focus()}}}getControlName(e){return`ctrl_${e}`}onKeyDown(e,i){let o=this.getBoxId(i-1),l=this.getBoxId(i);if(ft.ifKey(e,"Enter")){let N=this.document.getElementById(l)?.closest("form");if(N){e.preventDefault(),N.dispatchEvent(new Event("submit"));return}}if(ft.ifSpacebar(e))return e.preventDefault(),!1;if(ft.ifBackspace(e)){e.target.value?this.clearInput(l,i):(this.clearInput(o,i-1),this.setSelected(o)),this.rebuildValue();return}if(ft.ifDelete(e)){e.target.value?this.clearInput(l,i):(this.clearInput(o,i-1),this.setSelected(o)),this.rebuildValue();return}}hasVal(e){return e!=null&&e!=null&&(!e?.trim||e.trim()!="")}onInput(e,i){let o=this.hasVal(this.currentVal)?`${this.currentVal}${e.target.value}`:e.target.value;if(this.config.allowNumbersOnly&&!this.validateNumber(o)){e.target.value=null,e.stopPropagation(),e.preventDefault(),this.clearInput(null,i);return}if(this.ifValidKeyCode(null,e.target.value)){let l=this.getBoxId(i+1);this.setSelected(l),this.rebuildValue()}else{e.target.value=null;let l=this.getControlName(i);this.otpForm.controls[l]?.setValue(null),this.rebuildValue()}}onKeyUp(e,i){ft.ifTab(e)&&(i-=1);let o=this.getBoxId(i+1),l=this.getBoxId(i-1);if(ft.ifRightArrow(e)){e.preventDefault(),this.setSelected(o);return}if(ft.ifLeftArrow(e)){e.preventDefault(),this.setSelected(l);return}}validateNumber(e){return e&&/^[0-9]+$/.test(e)}getBoxId(e){return`otp_${e}_${this.componentKey}`}clearInput(e,i){let o=this.getControlName(i);if(this.otpForm.controls[o]?.setValue(null),e){let l=this.document.getElementById(e);l&&l instanceof HTMLInputElement&&(l.value=null)}}setSelected(e){this.focusTo(e);let i=this.document.getElementById(e);i&&i.setSelectionRange&&setTimeout(()=>{i.setSelectionRange(0,1)},0)}ifValidKeyCode(e,i){let o=i??e.key;return this.config?.allowNumbersOnly?this.validateNumber(o):/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)||/^[a-zA-Z0-9%*_\-@#$!]$/.test(o)&&o.length==1}focusTo(e){let i=this.document.getElementById(e);i&&i.focus()}setValue(e){if(!(this.config.allowNumbersOnly&&isNaN(e))){if(this.otpForm?.reset(),!this.hasVal(e)){this.rebuildValue();return}e=e.toString().replace(/\s/g,""),Array.from(e).forEach((i,o)=>{this.otpForm.get(this.getControlName(o))&&this.otpForm.get(this.getControlName(o)).setValue(i)}),this.config.disableAutoFocus||setTimeout(()=>{let i=this.document.getElementById(`c_${this.componentKey}`);var o=e.length<this.config.length?e.length:this.config.length-1;let l=i.getElementsByClassName("otp-input")[o];l&&l.focus&&setTimeout(()=>{l.focus()},1)},0),this.rebuildValue()}}rebuildValue(){let e=null;Ci.keys(this.otpForm.controls).forEach(i=>{let o=this.otpForm.controls[i].value;if(o){let l=o.length>1,C=!this.config.allowNumbersOnly&&this.config.letterCase&&(this.config.letterCase.toLocaleLowerCase()=="upper"||this.config.letterCase.toLocaleLowerCase()=="lower");o=o[0];let N=C?this.config.letterCase.toLocaleLowerCase()=="upper"?o.toUpperCase():o.toLowerCase():o;C&&N==o?C=!1:o=N,e==null?e=o:e+=o,(l||C)&&this.otpForm.controls[i].setValue(o)}}),this.currentVal!=e&&(this.currentVal=e,this.onChange(e),this.formCtrl?.setValue&&this.formCtrl.setValue(e),this.onInputChange.next(e))}handlePaste(e){let i=e.clipboardData||window.clipboardData;if(i)var o=i.getData("Text");e.stopPropagation(),e.preventDefault(),!(!o||this.config.allowNumbersOnly&&!this.validateNumber(o))&&this.setValue(o)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}static{this.\u0275fac=function(i){return new(i||n)(d(Vo),d(Io))}}static{this.\u0275cmp=P({type:n,selectors:[["ng-otp-input"],["ngx-otp-input"]],inputs:{config:"config",formCtrl:"formCtrl",disabled:"disabled"},outputs:{onBlur:"onBlur",onInputChange:"onInputChange"},features:[st([{provide:Uo,useExisting:yo(()=>n),multi:!0}])],decls:1,vars:1,consts:[["inp",""],["tabindex","0",3,"class","id","ngStyle","focusin","focusout",4,"ngIf"],["tabindex","0",3,"focusin","focusout","id","ngStyle"],[1,"n-o-c"],[4,"ngFor","ngForOf"],["autocomplete","one-time-code",3,"paste","keyup","input","keydown","pattern","type","placeholder","ngStyle","formControl","id","ngClass"],[4,"ngIf"]],template:function(i,o){i&1&&g(0,za,3,7,"div",1),i&2&&p("ngIf",o.otpForm==null?null:o.otpForm.controls)},dependencies:[ze,te,K,Go,vt,$,_e,Ao,U],styles:[".otp-input[_ngcontent-%COMP%]{width:50px;height:50px;border-radius:4px;border:solid 1px #c5c5c5;text-align:center;font-size:32px}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]{margin:0 .51rem}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]:first-child{margin-left:0}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]:last-child{margin-right:0}.n-o-c[_ngcontent-%COMP%]{display:flex;align-items:center}.error-input[_ngcontent-%COMP%]{border-color:red}@media screen and (max-width: 767px){.otp-input[_ngcontent-%COMP%]{width:40px;font-size:24px;height:40px}}@media screen and (max-width: 420px){.otp-input[_ngcontent-%COMP%]{width:30px;font-size:18px;height:30px}}"]})}}return n})(),un=(()=>{class n{static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275mod=_t({type:n})}static{this.\u0275inj=gt({imports:[po]})}}return n})();function Ya(n,t){if(n&1&&(r(0,"div"),m(1," OTP has been sent to "),r(2,"span",5),m(3),a()()),n&2){let e=c();s(3),T(e.contact)}}function Xa(n,t){if(n&1&&h(0,"ng-otp-input",3),n&2){let e=c(2);p("formCtrl",e.otpCtrl)("config",e.otpConfig)}}function Za(n,t){if(n&1&&g(0,Xa,1,2,"ng-otp-input",3),n&2){let e=c();R(e.showPinInput()?0:-1)}}function el(n,t){if(n&1&&h(0,"ng-otp-input",3),n&2){let e=c();p("formCtrl",e.otpCtrl)("config",e.otpConfig)}}function tl(n,t){if(n&1){let e=v();r(0,"div",4)(1,"span"),m(2,"Didn`t get a code? "),a(),r(3,"a",6),_("click",function(){u(e);let o=c();return f(o.onResendCode())}),m(4,"Click to resend"),a()()}}var fn=class n{type;contact;clearPin=!1;onVerify=new He;resendCode=new He;showPinInput=H(!0);otpCtrl=new bt;otpConfig={length:6,inputStyles:{width:"3rem",height:"3rem"},isPasswordInput:!1,placeholder:"-"};constructor(){this.listenOtpChange()}ngOnChanges(t){let{clearPin:e}=t;e?.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(So(300),pe(t=>t.length===6)).subscribe(t=>{this.onVerify.emit(t)})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["verify-step"]],inputs:{type:"type",contact:"contact",clearPin:"clearPin"},outputs:{onVerify:"onVerify",resendCode:"resendCode"},features:[xo],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(e,i){e&1&&(r(0,"div",0)(1,"h4",1),m(2),a(),g(3,Ya,4,1,"div"),a(),r(4,"div",2),g(5,Za,1,1)(6,el,1,2,"ng-otp-input",3),a(),g(7,tl,5,0,"div",4)),e&2&&(s(2),y(" Confirm Your ",i.type=="pin"?"PIN":"OTP"," "),s(),R(i.type!="pin"?3:-1),s(2),R(i.type=="pin"?5:6),s(2),R(i.type!="pin"?7:-1))},dependencies:[Z,un,po,ze],encapsulation:2})};function il(n,t){if(n&1){let e=v();r(0,"button",7),_("click",function(){u(e);let o=c();return f(o.onCancel())}),m(1,"Cancel"),a()}}function nl(n,t){if(n&1){let e=v();r(0,"button",8),_("click",function(){u(e);let o=c();return f(o.onConfirm())}),m(1,"Confirm"),a()}}var gn=class n{pointUsed=lt(0);redeemPointValue=lt(0);showCancelBtn=lt(!1);confirmEvent=new He;cancelEvent=new He;onConfirm(){this.confirmEvent.emit()}onCancel(){this.cancelEvent.emit()}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["confirm-step"]],inputs:{pointUsed:[1,"pointUsed"],redeemPointValue:[1,"redeemPointValue"],showCancelBtn:[1,"showCancelBtn"]},outputs:{confirmEvent:"onConfirm",cancelEvent:"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(e,i){e&1&&(r(0,"div",0)(1,"div",1),m(2,"Redeem"),a(),r(3,"div",2)(4,"span",3),m(5),b(6,"number"),a(),r(7,"small"),m(8,"Point"),a()(),r(9,"div",1),m(10,"~"),a(),r(11,"div",4)(12,"span",3),m(13),b(14,"number"),a(),r(15,"small"),m(16,"Discount"),a()(),g(17,il,2,0,"button",5)(18,nl,2,0,"button",6),a()),e&2&&(s(5),T(O(6,3,i.pointUsed())),s(8),T(O(14,5,i.pointUsed()*i.redeemPointValue())),s(4),R(i.showCancelBtn()?17:18))},dependencies:[Z,X],encapsulation:2})};var ei=class n{constructor(t,e,i,o,l,C,N,ae,ke,Fe){this.customerHttpService=t;this.salesOrderService=e;this.pageInitialService=i;this.shoppingCartService=o;this.invoiceCalculatorService=l;this.orderProcessorService=C;this.toastr=N;this.promotionCouponService=ae;this.httpService=ke;this.registerService=Fe}customerId;customerData;_isCustomerVerfiedOtp=!1;get isCustomerVerfiedOtp(){return this._isCustomerVerfiedOtp}addCustomerById(t){return new ho(e=>{this.customerId=JSON.parse(JSON.stringify(this.salesOrderService.Data.Order.CustomerID)),this.resetCartOnChangeCustomer(t),S.IsNotEmpty(t)&&this.salesOrderService.updateCustomerID(t).then(i=>{this.applyCustomerPricebook(i),this.updateTaxCustomer(i.TaxTypeId),this.setSalesOrderCustomerId(i),this.setCustomerData(i),this.customerData.DiscountRate==null&&(this.customerData.DiscountRate=0),this._isCustomerVerfiedOtp=!1,this.applyConfigFullPriceOnly(),this.salesOrderService.pushNewValue();let o=this.checkResetRedeemPoint();this.orderProcessorService.reedemPointToDiscount(o),e.next(i)})})}addCustomerByCode(t){return this.salesOrderService.Data.ContactName=null,this.customerHttpService.findCustomerByCode(t).pipe(Ee(e=>(this.salesOrderService.Data.ContactName=e.Display,this.addCustomerById(e.ID))))}setSalesOrderCustomerId(t){let e=this.salesOrderService.Data,i=this.registerService.Data.ListSales,o=t.SalesID,l=i.find(C=>C.ID===o);S.IsNotEmpty(t.SalesID)&&l&&(e.Order.SalesID=t.SalesID)}setCustomerData(t){let e=this.salesOrderService.Data;if(t.EntityID==S.GuidEmpty)this.customerData=t;else if(t.EntityID!=e.Order.EntityID){e.Order.CustomerID=null,e.ContactName=null;let i=`${t?.Name} is exclusive to ${t?.EntityName} Outlet and cannot be used in other outlets!`;alert(i)}else this.customerData=t}checkResetRedeemPoint(){let t=!1;return S.IsNotEmpty(this.customerId)&&(t=!0),t}applyCustomerPricebook(t){let e=this.salesOrderService.Data;if(S.IsNotEmpty(t.PricebookID)){let i=e.CartItems.map(o=>(o.Variant.PriceBook&&o.Variant.PriceBook.length!==0&&o.Variant.PriceBook.forEach(l=>{l.ID===t.PricebookID&&o.Quantity>=l.MinimumQuantity&&(o=this.shoppingCartService.applyPricebookToItem(o,l))}),o));e.CartItems=i}}updateTaxCustomer(t){let i=this.pageInitialService.Data.Taxes.find(o=>o.ID==t);i&&(this.salesOrderService.Data.Order.TaxTypeID=i.ID,this.invoiceCalculatorService.tax=i)}resetCartOnChangeCustomer(t){let e=this.pageInitialService.Data.AppConfigJSON;this.customerId!=t&&e.ModuleSell.Customer.ClearCartOnChange&&(this.salesOrderService.Data.CartItems=[]),this.customerId=t}updateDiscountRate(t=0){if(t>0){let e=this.promotionCouponService.coupon,i=this.salesOrderService.Data.Order.Discount;e&&e.Requirement?.Type==1?i==e.Amount?t>e.Amount&&(this.toastr.warning("Member discount is applied because member discount is greater than Coupon Discount","Warning"),this.promotionCouponService.removeAppliedDiscountOnCustomerChange(),this.salesOrderService.Data.Order.Discount=t):(this.salesOrderService.Data.Order.Discount=t,this.salesOrderService.Data.Order.CustomerDiscountRate=t):(this.salesOrderService.Data.Order.Discount=t,this.salesOrderService.Data.Order.CustomerDiscountRate=t)}}applyConfigFullPriceOnly(){let t=this.filterGroupByDiscountRate(),e=this.salesOrderService.Data.CartItems;t?.OrderDiscountFullPriceProductOnly?this.filterItemWithDisc(e).length>0?e=this.applyItemsDisc(e,this.customerData.DiscountRate):this.updateDiscountRate(this.customerData.DiscountRate):this.updateDiscountRate(this.customerData.DiscountRate)}filterGroupByDiscountRate(){let e=(this.customerData?.Groups?this.customerData?.Groups:[]).filter(o=>o.OrderDiscountPercentage==this.customerData.DiscountRate),i;return e.length>1?(i=e.find(o=>o.OrderDiscountFullPriceProductOnly==!0),i||(i=e[0])):i=e[0],i}applyItemsDisc(t,e){return t=t.map(i=>(i.Discount==0&&i.DiscountAmount==0&&i.PriceTypeID!=3&&i.Price==i.UnitPrice&&S.IsEmpty(i.PriceBookID)&&(i.Discount=e,i.HasCustomerDiscount=!0),i)),t}filterItemWithDisc(t){return t.filter(i=>i.Discount>0||i.DiscountAmount>0||i.PriceTypeID==3||i.Price!=i.UnitPrice||S.IsNotEmpty(i.PriceBookID))}onEmptyInputCustomer(){S.IsNotEmpty(this.customerId)&&(this.promotionCouponService.removeAppliedDiscountOnCustomerChange(),this.resetAppliedPoint(),this.resetCustomerPricebook(),this.removeCustomerDiscountRate()),this.orderProcessorService.Data.InputTextValue="",this.customerId=JSON.parse(JSON.stringify(this.salesOrderService.Data.Order.CustomerID)),this._isCustomerVerfiedOtp=!1,this.customerData=null,this.salesOrderService.Data.ContactName=null,this.salesOrderService.Data.Order.CustomerID=null,this.customerHttpService.Data=new io,this.customerData=new io,this.salesOrderService.pushNewValue()}removeCustomerDiscountRate(){let t=this.filterGroupByDiscountRate(),e=this.salesOrderService.Data.CartItems;t?.OrderDiscountFullPriceProductOnly?this.filterItemWithDisc(e).length>0?this.salesOrderService.Data.CartItems=e.map(o=>(o.HasCustomerDiscount&&(o.Discount=0,o.HasCustomerDiscount=!1),o)):(this.salesOrderService.Data.Order.Discount=0,this.salesOrderService.Data.Order.CustomerDiscountRate=0):(this.salesOrderService.Data.Order.Discount=0,this.salesOrderService.Data.Order.CustomerDiscountRate=0)}resetCustomerPricebook(){if(this.customerData){let t=this.customerData.PricebookID;if(S.IsNotEmpty(t)){let e=this.salesOrderService.Data.CartItems;this.salesOrderService.Data.CartItems=e.map(i=>(i.PriceBookID==t&&(i.Discount=i.Variant.PriceDiscount,i.Note=i.Variant.PriceNote,i.PriceNote=i.Variant.PriceNote,i.PriceBookID=S.GuidEmpty,i.Price=i.Variant.UnitPrice,i.UnitPrice=i.Variant.UnitPrice),i))}}}resetAppliedPoint(){let t=this.salesOrderService.Data;t.Order.PointUsed>0&&(t.Order.PointUsed=0,t.Order.DiscountAmount=0)}redeemPoint(t){let e=this.pageInitialService.Data.AppConfigJSON,i=this.salesOrderService.Data,o=e.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,l=t*o,C=i.RedeemableAmount;l>C&&(o>0?(t=Math.ceil(C/o),l=C):(t=0,l=0),this.toastr.warning("You enter the number of points more than the total amount","Points Adjusted")),i.Order.PointUsed=t||0,i.Order.DiscountAmount=l,this.salesOrderService.pushNewValue(i)}sendOtpViaEmail(t){return this.httpService.post("/API/otp/email",{Email:t})}sendOtpViaWhatsApp(t){return this.httpService.post("/API/otp/WhatsApp",{Number:t})}verifyEmailOtp(t,e){return this.httpService.post("/API/otp/verifyemail",{Email:t,OTP:e}).pipe(Re(()=>this._isCustomerVerfiedOtp=!0))}verifyPin(t,e){return this.httpService.post("/API/pos/VerifyPin",{PIN:t,CustomerID:e}).pipe(Re(()=>this._isCustomerVerfiedOtp=!0))}verifyWhatsAppOtp(t,e){return this.httpService.post("/API/otp/verifywhatsapp",{Number:t,OTP:e}).pipe(Re(()=>this._isCustomerVerfiedOtp=!0))}get pointBalanced(){let t=this.customerHttpService.Data.Point,e=this.customerHttpService.Data.PointUsed;return(t||0)-(e||0)}static \u0275fac=function(e){return new(e||n)(A(dt),A(V),A(B),A(Me),A(Pe),A(j),A(ee),A(Xe),A(Qe),A(Y))};static \u0275prov=at({token:n,factory:n.\u0275fac,providedIn:"root"})};var al=["stepper"];function ll(n,t){n&1&&m(0,"Points")}function sl(n,t){n&1&&m(0,"Verify")}function cl(n,t){n&1&&m(0,"Confirm")}var ti=class n{dialogRef=oe(F);outletRegisterService=oe(Y);pageInitialService=oe(B);customerHttpService=oe(dt);customerService=oe(ei);orderService=oe(V);toastr=oe(ee);modalConfig;enabledLoyaltyPoint=H(!1);stepper;pointUsed=0;pointBalance=H(0);redeemPointValue=H(0);email=H(null);phone=H(null);contactToResend=H(null);verifyType=H(null);clearPin=H(!1);selectedTab=H(0);constructor(){this.initModalConfig();let t=this.pageInitialService.Data.AppConfigJSON;this.redeemPointValue.set(t?.ApplicationLoyalty?.LoyaltyPoint?.RedeemPointValue),this.email.set(this.customerHttpService.Data?.Email),this.phone.set(this.customerHttpService.Data?.Mobile),this.initAvailablePoint(),this.initConfigEnabledVerify(),this.initPointUsed()}initModalConfig(){this.modalConfig=new W,this.modalConfig.title="Redeem Point",this.modalConfig.customWidth="500px",this.modalConfig.hideFooter=!0}initConfigEnabledVerify(){let t=this.pageInitialService.Data.AppConfigJSON,e=t?.ApplicationLoyalty?.VerifyRedemption,i=t?.ApplicationLoyalty?.Enabled,o=this.outletRegisterService.Data?.MemberPoint;this.enabledLoyaltyPoint.set(e&&i&&o)}initPointUsed(){let t=this.orderService.Data?.Order?.PointUsed;this.pointUsed=t||0,this.pointUsed>0&&this.selectedTab.set(2)}initAvailablePoint(){let t=this.customerHttpService.Data.Point,e=this.customerHttpService.Data.PointUsed,i=(t||0)-(e||0);this.pointBalance.set(i)}onClose(){this.dialogRef.close()}onCancelRedeem(){let t=this.orderService.Data;t.Order.PointUsed=0,t.Order.DiscountAmount=0,this.orderService.pushNewValue(t),this.toastr.info("Redeem point has been canceled","Canceled"),this.onClose()}onRedeem(){this.stepper.next(),this.stepper.next()}onVerify(t){switch(t){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(t)}handlingSentOtpViaPhone(){this.customerService.sendOtpViaWhatsApp(this.phone()).subscribe(t=>{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(t=>{this.stepper.selectedIndex==0&&this.stepper.next(),this.toastr.success(`OTP has been sent to ${this.email()}`,"Email Sent")})}onVerifyCode(t){switch(this.verifyType()){case"phone":this.verifyPhoneOtp(t);break;case"email":this.verifyEmailOtp(t);break;case"pin":this.verifyCustomerPin(t);break}}verifyEmailOtp(t){this.customerService.verifyEmailOtp(this.email(),t).subscribe(e=>{this.toastr.success(e.Message,"Successfully verified"),this.stepper.next()})}verifyPhoneOtp(t){this.customerService.verifyWhatsAppOtp(this.phone(),t).subscribe(e=>{this.toastr.success(e.Message,"Successfully verified"),this.stepper.next()})}verifyCustomerPin(t){let e=this.orderService.Data?.Order?.CustomerID;this.clearPin.set(!1),this.customerService.verifyPin(t,e).subscribe({next:i=>{this.toastr.success(i.Message,"Successfully verified"),this.stepper.next()},error:i=>{this.clearPin.set(!0)}})}onResendCode(){this.onVerify(this.verifyType())}onConfirm(){this.calculatePointToDiscount()}calculatePointToDiscount(){let t=this.pageInitialService.Data.AppConfigJSON,e=this.orderService.Data,i=e.RedeemableAmount,o=this.pointUsed,l=t.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,C=this.pointUsed*l;C>i&&(o=Math.ceil(i/l),C=i),(S.IsNotEmpty(e.Order.PointUsed)?e.Order.PointUsed:0)!=o&&(e.Order.PointUsed=o||0,e.Order.DiscountAmount=C,this.orderService.pushNewValue(e),this.toastr.success("Point has been redeemed","Success")),this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["modal-redeem-point"]],viewQuery:function(e,i){if(e&1&&ve(al,5),e&2){let o;Se(o=ye())&&(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","aria-labelledby"],["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(e,i){if(e&1){let o=v();r(0,"modal-material",1),_("onClose",function(){return u(o),f(i.onClose())}),r(1,"content")(2,"div",2)(3,"div",3)(4,"mat-stepper",4,0)(6,"mat-step",5),g(7,ll,1,0,"ng-template",6),r(8,"div",7)(9,"point-step",8),_("onVerify",function(C){return u(o),f(i.onVerify(C))}),w("pointUsedChange",function(C){return u(o),D(i.pointUsed,C)||(i.pointUsed=C),f(C)}),_("onRedeem",function(){return u(o),f(i.onRedeem())}),a()()(),r(10,"mat-step",9),g(11,sl,1,0,"ng-template",6),r(12,"div",7)(13,"verify-step",10),_("resendCode",function(){return u(o),f(i.onResendCode())})("onVerify",function(C){return u(o),f(i.onVerifyCode(C))}),a()()(),r(14,"mat-step",11),g(15,cl,1,0,"ng-template",6),r(16,"div",7)(17,"confirm-step",12),_("onConfirm",function(){return u(o),f(i.onConfirm())})("onCancel",function(){return u(o),f(i.onCancelRedeem())}),a()()()()()()()()}e&2&&(p("preventEnterEvent",!0)("config",i.modalConfig),s(4),p("linear",!0)("selectedIndex",i.selectedTab()),s(2),p("editable",!0)("aria-labelledby",i.selectedTab()==2?"stepDisabled":""),s(3),p("isVerifyEnabled",i.enabledLoyaltyPoint()),M("pointUsed",i.pointUsed),p("pointBalance",i.pointBalance())("email",i.email())("phone",i.phone()),s(),p("editable",!1),s(3),p("type",i.verifyType())("contact",i.contactToResend())("clearPin",i.clearPin()),s(4),p("pointUsed",i.pointUsed)("redeemPointValue",i.redeemPointValue())("showCancelBtn",i.selectedTab()==2))},dependencies:[Z,Ae,Q,Ce,Kr,Gr,Jr,zr,mn,fn,gn],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}']})};function pl(n,t){if(n&1){let e=v();x(0),r(1,"div",16),_("click",function(){u(e);let o=c(2);return f(o.onShowModalRedeem())}),r(2,"span"),h(3,"i",17),a(),r(4,"span"),m(5),b(6,"number"),a()(),I()}if(n&2){let e=c(2);s(5),y(" ",O(6,1,e.pointUsed)," Points redeemed ")}}function ml(n,t){if(n&1){let e=v();x(0),r(1,"tab",4)(2,"div",5)(3,"div",6)(4,"label",7),m(5,"Discount %"),a()(),r(6,"div",8)(7,"input",9),w("ngModelChange",function(o){u(e);let l=c();return D(l.discount1,o)||(l.discount1=o),f(o)}),a(),r(8,"span",10),m(9,"%"),a(),r(10,"span",11),m(11,"+"),a(),r(12,"input",12),w("ngModelChange",function(o){u(e);let l=c();return D(l.discount2,o)||(l.discount2=o),f(o)}),a(),r(13,"span",10),m(14,"%"),a()()(),r(15,"div",13)(16,"div",6)(17,"label",7),m(18),a()(),r(19,"div",14)(20,"input",15),w("ngModelChange",function(o){u(e);let l=c();return D(l.discountAmount,o)||(l.discountAmount=o),f(o)}),a(),g(21,pl,7,3,"ng-container",3),a()()(),I()}if(n&2){let e=c();s(),p("active",e.tabActive=="Discount"),s(6),M("ngModel",e.discount1),s(5),M("ngModel",e.discount2),s(6),y("Discount ",e.currencySymbol,""),s(2),p("disabled",e.pointUsed&&e.pointUsed>0),M("ngModel",e.discountAmount),s(),p("ngIf",e.pointUsed&&e.pointUsed>0)}}function dl(n,t){if(n&1){let e=v();x(0),r(1,"tab",18)(2,"div",5)(3,"div",6)(4,"label",7),m(5,"Tax"),a()(),r(6,"div",8)(7,"ng-select",19),_("change",function(o){u(e);let l=c();return f(l.updateTax(o))}),a()()(),r(8,"div",13)(9,"div",6)(10,"label",7),m(11,"Surcharge"),a()(),r(12,"div",8)(13,"input",20),w("ngModelChange",function(o){u(e);let l=c();return D(l.surcharge,o)||(l.surcharge=o),f(o)}),a(),r(14,"span",10),m(15,"%"),a()()()(),I()}if(n&2){let e=c();s(7),p("clearable",!1)("ngModel",e.salesOrder.Order.TaxTypeID)("items",e.taxes),s(6),M("ngModel",e.surcharge),p("max",100)("min",-100)}}function ul(n,t){if(n&1){let e=v();x(0),r(1,"tab",21)(2,"div",5)(3,"div",22)(4,"strong"),m(5,"Discount After Tax"),a()(),r(6,"div",23)(7,"input",24),w("ngModelChange",function(o){u(e);let l=c();return D(l.discountAfterTax,o)||(l.discountAfterTax=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onDiscountAfterTaxChange())}),a()()(),r(8,"div",25)(9,"div",22)(10,"label",7),m(11,"Discount Calculator"),a()(),r(12,"div",26)(13,"input",27),w("ngModelChange",function(o){u(e);let l=c();return D(l.discounts[0],o)||(l.discounts[0]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),a(),r(14,"span"),m(15," %"),a(),r(16,"span",11),m(17,"+"),a(),r(18,"input",28),w("ngModelChange",function(o){u(e);let l=c();return D(l.discounts[1],o)||(l.discounts[1]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),a(),r(19,"span"),m(20," %"),a(),r(21,"span",11),m(22,"+"),a(),r(23,"input",29),w("ngModelChange",function(o){u(e);let l=c();return D(l.discounts[2],o)||(l.discounts[2]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),a(),r(24,"span"),m(25," %"),a()()()(),I()}if(n&2){let e=c();s(7),M("ngModel",e.discountAfterTax),s(6),M("ngModel",e.discounts[0]),s(5),M("ngModel",e.discounts[1]),s(5),M("ngModel",e.discounts[2])}}var ii=class n{constructor(t,e,i,o,l,C,N,ae,ke,Fe){this.dialogRef=t;this.orderService=e;this.invoiceCalculatorService=i;this.pageInitialService=o;this.roleService=l;this.customerHttpService=C;this.orderProcessorService=N;this.promotionCouponService=ae;this.dialog=ke;this.data=Fe;let je=this.pageInitialService?.Data?.AppConfigJSON;this.modalConfig.title="Discount and Tax",this.modalConfig.customWidth="480px",this.salesOrder=this.orderService.Data,this.userRole=this.roleService.Data,this.isPreferedPayment=je?.ApplicationLoyalty?.PreferedPayment,this.tabActive=this.data?.tabIndexActive,this.isEditOrder=this.orderProcessorService.Data.posState==2,this.customer=C.Data,this.initDiscountAndTax(),this.initAvailablePoint(),this.initTabLoyaltyTitle()}modalConfig=new W;discount1;discount2;discountAmount;surcharge;discountAfterTax;currencySymbol;salesOrder;discounts=[];taxes;selectedTax;userRole;tabActive;isEditOrder;isPreferedPayment;customerPoint;customer;tabLoyaltyTitle;pointUsed;availablePoint;initAvailablePoint(){let t=this.customerHttpService.Data.Point,e=this.customerHttpService.Data.PointUsed;this.customerPoint=t,this.availablePoint=(t||0)-(e||0)}initTabLoyaltyTitle(){let e=this.pageInitialService?.Data?.AppConfigJSON?.ApplicationLoyalty?.Label;this.tabLoyaltyTitle=S.IsNotEmpty(e)?e:"Loyalty"}initDiscountAndTax(){this.discount1=this.salesOrder.Order.Discount,this.discount2=this.salesOrder.Order.Discount2,this.discountAmount=this.salesOrder.Order.DiscountAmount,this.surcharge=this.salesOrder.Invoice.SurchargePcg,this.discountAfterTax=this.invoiceCalculatorService.discountAfterTax,this.currencySymbol=this.invoiceCalculatorService.currencySymbol,this.taxes=this.pageInitialService.Data.Taxes,this.selectedTax=this.invoiceCalculatorService.tax,this.pointUsed=this.salesOrder.Order.PointUsed}updateTax(t){this.selectedTax=t}onOk(){this.resetAppliedCoupon(),this.applyChangesDiscountAmount(),this.salesOrder.Order.Discount=this.discount1,this.salesOrder.Order.Discount2=this.discount2,this.salesOrder.Invoice.SurchargePcg=this.surcharge,this.salesOrder.Invoice.TempSurchargePcg=this.surcharge,this.invoiceCalculatorService.discountAfterTax=this.discountAfterTax,this.salesOrder.Order.TaxTypeID=this.selectedTax.ID,this.invoiceCalculatorService.tax=this.selectedTax,this.orderService.pushNewValue(this.salesOrder),this.onClose()}onClose(){this.dialogRef.close()}calculateDiscountCalculator(){var t=100;this.discounts.forEach(e=>{t=t*(100-e)/100}),this.discount1=100-t}onDiscountAfterTaxChange(){this.discountAmount=this.discountAfterTax;let e=this.invoiceCalculatorService.TotalBeforeTax-this.discountAmount,i=this.orderService.Data.Order.TaxTypeID,o=this.pageInitialService.Data.Taxes,l=S.FilterByID(o,i);if(S.IsNotEmpty(l)&&l.CalculationTypeID==0){let C=1+l.Rate/100,N=e*C;this.discountAmount=(N-(N-this.discountAfterTax))/C}}applyChangesDiscountAmount(){let t=this.salesOrder.Order.DiscountAmount;this.discountAmount!=t&&(this.salesOrder.Order.DiscountAmount=this.discountAmount)}onTabChange(t){this.tabActive=t}resetAppliedCoupon(){let t=this.promotionCouponService.coupon,e=this.salesOrder.Order.DiscountAmount;t&&t.Requirement?.Type==2&&e!=this.discountAmount&&(this.salesOrder.Order.PromotionCoupon=null,this.salesOrder.Order.PromotionNote=null)}onShowModalRedeem(){this.onClose(),this.dialog.open(ti)}static \u0275fac=function(e){return new(e||n)(d(F),d(V),d(Pe),d(B),d(me),d(dt),d(j),d(Xe),d(ne),d(Ve))};static \u0275cmp=P({type:n,selectors:[["POS-modal-discount"]],decls:7,vars:4,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],[3,"onTabChange"],[4,"ngIf"],["tabTitle","Discount",3,"active"],[1,"row","d-flex","align-items-center","justify-content-start"],[1,"col-3"],[1,"fw-bold","d-block"],[1,"col-9"],["type","text","data-cy","discount1","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],[1,"ms-1"],[1,"mx-2"],["type","text","data-cy","discount2","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],[1,"row","d-flex","align-items-center","justify-content-start","mt-6"],[1,"col-9","d-flex","align-items-center"],["type","text","data-cy","discountamount","autoNum","","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","disabled","ngModel"],["role","button",3,"click"],[1,"fa-solid","fa-info-circle","ms-2"],["matTooltipPosition","above","tabTitle","Tax"],["bindLabel","Label","appendTo","body","bindValue","ID","placeholder","Tax","data-cy","select-tax",2,"width","150px",3,"change","clearable","ngModel","items"],["type","text","data-cy","surcharge","autoNum","","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","85px",3,"ngModelChange","ngModel","max","min"],["tabTitle","Calculator"],[1,"col-4"],[1,"col-8","ps-6"],["type","text","num-neg","false","autoNum","","emptyInputBehavior","zero",1,"txtPrice","form-control",2,"width","100px",3,"ngModelChange","ngModel"],[1,"row","mt-6","g-0","d-flex","align-items-center","justify-content-start"],[1,"col-8","ps-4"],["type","text","data-cy","discountCal1","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],["type","text","data-cy","discountCal2","autoNum","","decimalPlaces","2","percentage","","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],["type","text","data-cy","discountCal3","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("keydown.F2",function(){return i.onOk()})("onOk",function(){return i.onOk()})("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()}),r(1,"content")(2,"div",1)(3,"custom-tabs",2),_("onTabChange",function(l){return i.onTabChange(l)}),g(4,ml,22,7,"ng-container",3)(5,dl,16,6,"ng-container",3)(6,ul,26,4,"ng-container",3),a()()()()),e&2&&(p("config",i.modalConfig),s(4),p("ngIf",i.userRole.Discount),s(),p("ngIf",i.userRole.Tax),s(),p("ngIf",i.userRole.Discount))},dependencies:[Z,$,X,Ce,te,K,ie,Ki,Ur,Hr,Ae,Q,nt,ut,pt,Ke],encapsulation:2})};var Cn=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=_t({type:n});static \u0275inj=gt({imports:[Z,Ce]})};var hn=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=_t({type:n});static \u0275inj=gt({imports:[Z,Ce,ze,Ae,Qt,nt,$r,ut,Ki,Ke,un,Wi,Cr,Wt,ut,Bt,Yr,ir,Ti,Cn,Zr,xt,Vi,ta,Xi,nt,ii,Rt,ki]})};var bn=class n{constructor(t,e,i,o,l,C,N){this.orderProcessorService=t;this.posDataService=e;this.signalBroadCast=i;this.calculatorService=o;this.OrderHttpService=l;this.localDataService=C;this.posService=N;this.newSale=new He}newSale;retrySubmit(){let t=this.posService.Data.AppConfigJSON,e=this.posDataService.Data;this.posDataService.submitOrder(t).then(i=>{i.Success?(this.broadcastToCustomerDisplay(i),this.posDataService.pushNewValue(e),this.orderProcessorService.updatePosState(1,i)):(this.posDataService.pushNewValue(e),this.orderProcessorService.updatePosState(1,i))}).catch(i=>{console.log(i)})}broadcastToCustomerDisplay(t){let i=this.posDataService.Data.TotalPaidAmount-this.calculatorService.Data;this.signalBroadCast.BroadcastStateToCustomerDisplay(1,t.ObjectID,t.LoyaltyPoint,i).subscribe()}saveOffline(){let t=this.posDataService.Data,e=this.OrderHttpService.generatePOSDataForSubmission(t,!1);this.localDataService.syncOrder(e).subscribe(()=>{this.newSale.next()})}static \u0275fac=function(e){return new(e||n)(d(j),d(V),d(Hi),d(Pe),d(Oe),d(Ye),d(B))};static \u0275cmp=P({type:n,selectors:[["app-retry"]],outputs:{newSale:"newSale"},decls:21,vars:0,consts:[[1,"card"],[1,"card-header","bg-gradient-danger"],[1,"d-flex","justify-content-between"],[1,"fa-solid","fa-times-circle","me-1","text-danger"],[1,"card-body"],[1,"row","justify-content-center","g-0","mt-8"],[1,"col-8","text-center"],[1,"text-danger","fs-5"],[1,"row","mt-4","justify-content-center","g-0","mb-9"],[1,"col-5","text-center"],["type","button","matTooltipPosition","above","matTooltip","Upload your local / offline order to the cloud",1,"btn","btn-success","btn-lg","fs-3",3,"click"],[1,"card-footer","bg-light-gray"],[1,"row","justify-content-between","py-6"],[1,"col-auto"],["type","button","matTooltipPosition","above","matTooltip","Temporarily save data locally until connection to the server is restored",1,"btn","btn-light-gray",3,"click"],[1,"fa-solid","fa-save","me-2",2,"font-size","14px"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1)(2,"div",2)(3,"h2"),h(4,"i",3),m(5," Order Upload Fail! "),a()()(),r(6,"div",4)(7,"div",5)(8,"div",6)(9,"p",7),m(10," Slow Connection Detected, Check the customer invoice list first. If the transaction isn't there, click the 'Retry' button. "),a()()(),r(11,"div",8)(12,"div",9)(13,"button",10),_("click",function(){return i.retrySubmit()}),m(14," Retry Upload "),a()()()(),r(15,"div",11)(16,"div",12)(17,"div",13)(18,"button",14),_("click",function(){return i.saveOffline()}),h(19,"i",15),m(20,"Save Offline "),a()()()()())},dependencies:[Z,Ke,ce],encapsulation:2})};var pa=(()=>{class n{constructor(){this.emailRegex=S.emailRegex,this.phoneNumberRegex=S.phoneNumberRegex}validate(e){let i=this.emailRegex,o=this.phoneNumberRegex,l=i.test(e.value),C=o.test(e.value);if(l||C||e.value=="")return null;{let N="Please input a valid email or phone number";return C?N="Please input a valid email":l&&(N="Please input a valid phone number"),{invalidEmailOrPhoneNumber:{value:e.value,errMessage:N}}}}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275dir=Ii({type:n,selectors:[["","pOSIsInvalidEmailOrPhoneNumber",""]],features:[st([{provide:Wo,useExisting:n,multi:!0}])]})}}return n})();function gl(n,t){n&1&&(x(0),r(1,"div",3)(2,"h4",4),m(3," For use this feature you must register first!"),h(4,"br"),m(5," Click the link below "),a()(),r(6,"a",5),m(7,"more information"),a(),m(8," > "),I())}function _l(n,t){if(n&1){let e=v();r(0,"div",6)(1,"div",7)(2,"span",8),h(3,"i",9),a(),h(4,"input",10),r(5,"button",11),m(6,"Copy to Clipboard"),a()()(),r(7,"div",12)(8,"div",13)(9,"span",14),h(10,"i",15),a(),h(11,"input",16),r(12,"button",17),_("click",function(){u(e);let o=c();return f(o.onSendViaWhatsApp())}),m(13,"Send via WhatsApp"),a()()()}if(n&2){let e=c();s(4),p("value",e.data.link),s(),p("cdkCopyToClipboard",e.data.link),s(6),p("formControl",e.whatsAppNumberCtrl),s(),p("disabled",e.whatsAppNumberCtrl.invalid)}}var bi=class n{constructor(t,e,i){this._dialogRef=t;this._toast=e;this.data=i}modalConfig=new W;whatsAppNumberCtrl;ngOnInit(){this.modalConfig.title="Midtrans Payment Link",this.modalConfig.hideFooter=!0,this.modalConfig.customWidth="500px",this.initWaNumberCtrl()}initWaNumberCtrl(){this.whatsAppNumberCtrl=new $o(null,[ui.pattern("^[0-9]*$"),ui.required])}close(){this._dialogRef.close()}onSendViaWhatsApp(){let t=this.whatsAppNumberCtrl.value;if(t){let e="https://wa.me/"+t+"?text="+this.data.link;window.open(e,"_blank")}else this._toast.error("Phone Number must be insert")}static \u0275fac=function(e){return new(e||n)(d(F),d(ee),d(Ve))};static \u0275cmp=P({type:n,selectors:[["POS-modal-generate-link"]],standalone:!1,decls:5,vars:3,consts:[["hasLink",""],[3,"onOk","onCancel","onClose","config"],[4,"ngIf","ngIfElse"],[1,"input-group","mb-2",2,"width","350px"],[1,"fw-normal","d-block"],["href","https://midtrans.com/id/product/payment-link","target","_blank"],[1,"col-sm-12"],[1,"input-group"],["id","inputGroup-sizing-lg p-6",1,"input-group-text"],[1,"fa-solid","fa-link","fs-5"],["readonly","","type","text","aria-label","Link href",1,"form-control",3,"value"],["id","btnCopyLink","type","button",1,"btn","btn-outline-secondary",2,"width","150px",3,"cdkCopyToClipboard"],[1,"col-sm-12","mt-6"],[1,"input-group",2,"width","29.4rem"],["id","inputGroup-sizing-lg",1,"input-group-text","p-7"],[1,"fa-solid","fa-mobile-screen-button","fs-3"],["type","text","placeholder","Mobile Number (e.g. 6281500000000)","aria-label","Mobile Number (e.g. 6281500000000)",1,"form-control",3,"formControl"],["id","btnSend","type","button",1,"btn","btn-outline-secondary",3,"click","disabled"]],template:function(e,i){if(e&1){let o=v();r(0,"modal-material",1),_("onOk",function(){return u(o),f(i.close())})("onCancel",function(){return u(o),f(i.close())})("onClose",function(){return u(o),f(i.close())}),r(1,"content"),g(2,gl,9,0,"ng-container",2)(3,_l,14,4,"ng-template",null,0,G),a()()}if(e&2){let o=q(4);p("config",i.modalConfig),s(2),p("ngIf",i.data.link==null||i.data.link=="")("ngIfElse",o)}},dependencies:[$,te,K,vt,Q,ea],encapsulation:2})};var bl=n=>({"rounded-0 rounded-start-2":n}),vl=(n,t)=>({"bg-gradient-warning":n,"bg-gradient-danger":t}),Sl=n=>({offline:n}),yl=n=>({"ms-2":n}),xl=(n,t)=>({ID:n,Template:t}),Il=(n,t,e)=>({InvoiceID:n,OutID:t,Template:e}),Ol=n=>({ID:n,Print:1,Printer:"Normal"}),Pl=n=>({ID:n});function Ml(n,t){if(n&1&&(r(0,"a",47),m(1,"Delivery Order"),a()),n&2){let e=c(3);p("queryParams",ge(1,xl,e.completeData.OutDeliveryID,e.outletRegister.PrintTemplate.ID))}}function Dl(n,t){if(n&1&&(r(0,"a",48),m(1,"Invoice & Delivery Order"),a()),n&2){let e=c(3);p("queryParams",Et(1,Il,e.completeData.ObjectID,e.completeData.OutDeliveryID,e.outletRegister.PrintTemplate.ID))}}function wl(n,t){if(n&1&&(r(0,"a",49),m(1,"Invoice (No Price)"),a()),n&2){let e=c(3);p("href",e.getInvoicePrintURL(!0),tt)}}function kl(n,t){if(n&1&&(r(0,"a",50),m(1,"Packing Slip"),a()),n&2){let e=c(3);p("queryParams",E(1,Ol,e.completeData.OutDeliveryID))}}function Tl(n,t){if(n&1&&(r(0,"div",30),h(1,"button",41),r(2,"div",42),g(3,Ml,2,4,"a",43)(4,Dl,2,5,"a",44)(5,wl,2,1,"a",45)(6,kl,2,3,"a",46),a()()),n&2){let e=c(2);s(3),p("ngIf",e.completeData.OutDeliveryID),s(),p("ngIf",e.completeData.OutDeliveryID),s(),p("ngIf",e.completeData),s(),p("ngIf",e.completeData.OutDeliveryID)}}function El(n,t){n&1&&(r(0,"div",32)(1,"div",36)(2,"p",51),m(3," Transaction saved to your browser's local storage. Please upload when connection is restored! "),a()()())}function Rl(n,t){if(n&1){let e=v();r(0,"div",33)(1,"div",52)(2,"div",53),_("click",function(){u(e);let o=c(2);return f(o.changeReceiptContact())}),h(3,"i"),a(),r(4,"input",54),_("ngModelChange",function(o){u(e);let l=c(2);return f(l.isPhoneOrEmail(o))}),a()(),r(5,"div",55)(6,"button",56),_("click",function(){u(e);let o=c(2);return f(o.sendReceiptToContact())}),m(7," Send Receipt "),a()()()}if(n&2){let e=c(2);s(3),be(e.receiptIcon+" fs-4"),s(),p("formControl",e.customerContact),s(2),p("disabled",e.customerContact.invalid)}}function Nl(n,t){if(n&1&&(r(0,"small",34),m(1),a()),n&2){let e=c(2);s(),y(" ",e.customerContact.errors==null||e.customerContact.errors.invalidEmailOrPhoneNumber==null?null:e.customerContact.errors.invalidEmailOrPhoneNumber.errMessage," ")}}function Vl(n,t){if(n&1){let e=v();r(0,"button",57),_("click",function(){u(e);let o=c(2);return f(o.onRetry())}),m(1," Retry Upload "),a()}}function Al(n,t){if(n&1){let e=v();r(0,"div",60)(1,"button",61),_("click",function(){u(e);let o=c(3);return f(o.generateLink())}),h(2,"i",62),m(3,"Generate Payment Link "),a()()}}function Ll(n,t){if(n&1){let e=v();r(0,"div",60)(1,"button",63),_("click",function(){u(e);let o=c(3);return f(o.verifyPaymentSettlement())}),h(2,"i",64),m(3,"Verify Payment Settlement "),a()()}}function Bl(n,t){if(n&1&&(r(0,"div",40)(1,"div",58),g(2,Al,4,0,"div",59)(3,Ll,4,0,"div",59),a()()),n&2){let e=c(2);s(2),p("ngIf",e.completeData.PaymentStateID==1),s(),p("ngIf",e.isNotEmpty(e.paymentGatewayService.getTransactionId()))}}function Fl(n,t){if(n&1){let e=v();r(0,"div",9)(1,"div",26)(2,"div",27)(3,"h2"),h(4,"i",28),m(5," Sell Complete "),r(6,"small",29),m(7),a()(),r(8,"div"),g(9,Tl,7,4,"div",30),a()()(),r(10,"div",14)(11,"div",31),g(12,El,4,0,"div",32)(13,Rl,8,5,"div",33)(14,Nl,2,1,"small",34),r(15,"div",35)(16,"div",36)(17,"div",37),g(18,Vl,2,0,"button",38),r(19,"button",39),_("click",function(){u(e);let o=c();return f(o.newSale())}),m(20," New Sale (F8) "),a()()()()()(),g(21,Bl,4,2,"div",40),a()}if(n&2){let e=c();s(),p("ngClass",ge(9,vl,(!e.isOrderDateNow||e.completeData.PaymentStateID<3)&&e.completeData.PaymentStateLabel!="Offline",e.completeData.PaymentStateLabel=="Offline")),s(6),y(" (",e.completeData.PaymentStateLabel,")"),s(2),R(e.completeData.PaymentStateLabel=="Offline"?9:-1),s(2),p("ngClass",E(12,Sl,e.completeData.PaymentStateLabel=="Offline")),s(),R(e.completeData.PaymentStateLabel=="Offline"?12:13),s(2),R(e.customerContact!=null&&e.customerContact.invalid&&(e.customerContact!=null&&e.customerContact.dirty||e.customerContact!=null&&e.customerContact.touched)?14:-1),s(4),R(e.completeData.PaymentStateLabel=="Offline"&&!e.isSuccessRetrySubmit()?18:-1),s(),p("ngClass",E(14,yl,e.completeData.PaymentStateLabel=="Offline")),s(2),R(e.isOnline&&(e.completeData==null?null:e.completeData.PaymentStateID)==1||e.isNotEmpty(e.paymentGatewayService.getTransactionId())?21:-1)}}function jl(n,t){if(n&1){let e=v();r(0,"app-retry",65),_("newSale",function(){u(e);let o=c();return f(o.newSale())}),a()}}function Hl(n,t){if(n&1&&(x(0),r(1,"a",66),m(2),a(),I()),n&2){let e=c();s(),p("queryParams",E(2,Pl,e.completeData.ObjectID)),s(),y(" Invoice #",e.completeData==null?null:e.completeData.InvoiceNumber," ")}}function Ul(n,t){if(n&1&&(r(0,"span",67),m(1),a()),n&2){let e=c();s(),y(" Invoice #",e.completeData==null?null:e.completeData.InvoiceNumber," ")}}function Wl(n,t){if(n&1&&(x(0),m(1),b(2,"number"),I()),n&2){let e=c().$implicit;s(),Ue(" ",e.CurrencySymbol," ",O(2,2,e.Amount)," ")}}function Ql(n,t){n&1&&m(0," - ")}function ql(n,t){if(n&1&&(r(0,"div",69)(1,"div",70),m(2),a(),r(3,"div",71),g(4,Wl,3,4,"ng-container",13)(5,Ql,1,0,"ng-template",null,1,G),a()()),n&2){let e=t.$implicit,i=q(6),o=c(2);s(2),T(e.Label),s(2),p("ngIf",o.role.PriceVisible)("ngIfElse",i)}}function $l(n,t){if(n&1&&(r(0,"div",14),g(1,ql,7,3,"div",68),a()),n&2){let e=c();s(),p("ngForOf",e.itemSummary)}}function Jl(n,t){if(n&1&&(r(0,"div",75)(1,"div",76),m(2),a(),r(3,"div",77),m(4),b(5,"number"),a()()),n&2){let e=t.$implicit,i=t.index,o=c(2);s(),p("hidden",!o.role.PriceVisible),s(),Ue(" ",e.Label,": ",e.CurrencySymbol," "),s(),p("hidden",!o.role.PriceVisible)("ngClass",i+1===o.amountSummary.length?"amount":""),s(),y(" ",O(5,6,e.Amount)," ")}}function Gl(n,t){if(n&1&&(r(0,"div",75)(1,"div",76),m(2),a(),r(3,"div",79),m(4),b(5,"number"),a()()),n&2){let e=t.$implicit,i=c(3);s(),p("hidden",!i.role.PriceVisible),s(),Ue(" ",e.Label,": ",e.CurrencySymbol," "),s(),p("hidden",!i.role.PriceVisible),s(),y(" ",O(5,5,e.Amount)," ")}}function zl(n,t){if(n&1&&(x(0),r(1,"div",78),g(2,Gl,6,7,"div",73),a(),I()),n&2){let e=c(2);s(2),p("ngForOf",e.paymentSummary)}}function Kl(n,t){if(n&1&&(r(0,"div",72),g(1,Jl,6,8,"div",73)(2,zl,3,1,"ng-container",74),a()),n&2){let e=c();s(),p("ngForOf",e.amountSummary),s(),p("ngIf",(e.paymentSummary==null?null:e.paymentSummary.length)>0)}}function Yl(n,t){if(n&1&&(r(0,"div",16)(1,"div",80)(2,"p",81),m(3,"INVALID AMOUNT CHARGE, CORRECT AMOUNT"),a(),r(4,"P",82),m(5),b(6,"number"),a()()()),n&2){let e=c();s(5),y("",O(6,1,e.completeData==null?null:e.completeData.Final)," ")}}function Xl(n,t){if(n&1&&(r(0,"a",22),h(1,"i",83),a()),n&2){let e=c();p("href",e.getInvoicePrintURL(!1),tt)}}function Zl(n,t){if(n&1&&(r(0,"div",9)(1,"div",11)(2,"h3",12),m(3,"Point Balance"),a()(),h(4,"div",84),a()),n&2){let e=c();s(4),p("innerHtml",e.completeData.LoyaltyPoint,xi)}}function es(n,t){if(n&1&&h(0,"pos-receipt",85),n&2){let e=c(2);p("data",e.receiptTemplate)("printTemplate",e.outletRegister.PrintTemplate)("config",e.posStorage.AppConfigJSON)("priceVisibleRestriction",!e.role.PriceVisible)("outletInfo",e.outletRegister)("isUnknownError",e.currentSellState==e.sellState.UploadOrderFail)("isOffline",e.isOnline==!1)("stylesheet",e.posStorage.StylesSheet)}}function ts(n,t){if(n&1&&h(0,"pos-receipt-a4",86),n&2){let e=c(3);p("data",t)("printTemplate",e.outletRegister.PrintTemplate)("config",e.posStorage.AppConfigJSON)("workOrderMode",!1)("stylesheet",e.posStorage.StylesSheet)}}function is(n,t){if(n&1&&(g(0,ts,1,5,"pos-receipt-a4",86),b(1,"async")),n&2){let e,i=c(2);R((e=O(1,1,i.receiptTemplateA4$))?0:-1,e)}}function ns(n,t){if(n&1&&g(0,es,1,8,"pos-receipt",85)(1,is,2,3),n&2){let e=c();R(e.receiptTemplate&&e.printMode==2?0:-1),s(),R(e.printMode==1?1:-1)}}function os(n,t){n&1&&(r(0,"div",25)(1,"h1"),m(2," Cannot generate print preview because of client-server amount Mismatch "),a()())}var vn=class n{constructor(t,e,i,o,l,C,N,ae,ke,Fe,je,ri,Tt,Kn,Yn,ai,wa,go,_o,ka){this._posDataService=t;this._posService=e;this._orderProcessorService=i;this._OrderHttpService=o;this._PaymentHttpService=l;this._receiptService=C;this._outletService=N;this._toastr=ae;this._onlineStatusService=ke;this._matDialog=Fe;this._signalBroadCast=je;this._calculatorService=ri;this._userRoleService=Tt;this._router=Kn;this._receiptCalculatorService=Yn;this.datePipe=ai;this.decimalPipe=wa;this.paymentGatewayService=go;this.paymentHttpService=_o;this.shoppingCartService=ka}whatsappSendReceiptService=oe(ro);handleF8(){this.newSale()}salesOrder=new mt;receiptTemplate=null;receiptTemplateA4$;completeData=new yr;printMode=2;outletRegister=new Ai;role;finalAmountDifferent=!1;amountSummary=[];itemSummary=[];paymentSummary=[];isOnline=!1;destroy$=new z;get posStorage(){return this._posService.Data}currentSellState;isOrderDateNow;sellState=xe;receiptIcon="fa-brands fa-whatsapp";customerContact=new bt;printOnPayment=H(!0);isSuccessRetrySubmit=H(!1);ngOnInit(){this.resetUrlAfterRedirect(),this.subscribeToObservableChanges()}subscribeToObservableChanges(){this._onlineStatusService.getOnlineStatus$().pipe(k(this.destroy$)).subscribe(t=>{this.isOnline=t}),this._userRoleService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.role=t}),this._posDataService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.salesOrder=t}),this._outletService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.outletRegister=t;let e=this.outletRegister?.PrintTemplate?.PrintMode;this.initPrintMode(e)}),this._orderProcessorService.Data$.pipe(pe(t=>t.posState===1||t.posState===9),k(this.destroy$)).subscribe(t=>{if(this.currentSellState=t.posState,this.generateCompleteSummary(),this._OrderHttpService.Data){let e=this.posStorage?.AppConfigJSON?.ModuleSell?.OrderComplete?.PrintOnPayment;this.printOnPayment.set(e),this.completeData=this._OrderHttpService.Data,this.checkFinalAmountDifferent(),this.setLoyaltyLabelConfig(),this.InitPrintInvoice(),this.initCustomerContact(),this.sendEmailOnComplete(),this.checkOrderDateIsNow(),this.clearShoppingCartInLocalStorage()}})}clearShoppingCartInLocalStorage(){this.shoppingCartService.clearCartItemsInLocalStorage()}generateCompleteSummary(){this.itemSummary=this._receiptService.generateCartItemSummary(),this.amountSummary=this._receiptCalculatorService.generateAmountSummary(),this.paymentSummary=this._receiptService.generatePaymentSummary()}initPrintMode(t){this.isOnline?this.printMode=t:this.printMode=2}sendEmailOnComplete(){let t=this.posStorage?.AppConfigJSON?.ModuleSell?.OrderComplete?.EmailReceipt,e=this.completeData?.Contact?.Email;t&&S.IsNotEmpty(e)&&this.sendEmail()}resetUrlAfterRedirect(){this._router.events.pipe(k(this.destroy$)).subscribe(t=>{t instanceof Fo&&(t?.url?.includes("Sell")||(this._orderProcessorService.createNewTransactionInSameOutletRegister(),this._signalBroadCast.BroadcastStateToCustomerDisplay(0).subscribe()))})}InitPrintInvoice(){this.currentSellState==1&&(this.checkOrderNumber(),this.print())}initCustomerContact(){if(this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.DefaultReceiptChannel==0){this.receiptIcon="fa-solid fa-envelope";let t=this.completeData?.Contact?.Email;this.customerContact.setValue(t)}else if(this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.DefaultReceiptChannel==1){this.receiptIcon="fa-brands fa-whatsapp";let t=this.completeData?.Contact?.Mobile;this.customerContact.setValue(t)}}isPhoneOrEmail(t){let e=S.emailRegex,i=S.phoneNumberRegex,o=e,l=i,C=o.test(t),N=l.test(t);if(C)return this.receiptIcon="fa-solid fa-envelope","Email";if(N)return this.receiptIcon="fa-brands fa-whatsapp","Mobile"}changeReceiptContact(){this.receiptIcon=="fa-solid fa-envelope"?(this.receiptIcon="fa-brands fa-whatsapp",this.customerContact.setValue(this.completeData?.Contact?.Mobile)):(this.receiptIcon="fa-solid fa-envelope",this.customerContact.setValue(this.completeData?.Contact?.Email))}checkOrderDateIsNow(){let t=this.completeData.OrderTimeString,e=this.datePipe.transform(this.salesOrder.Order.Date,"dd MMM yyyy");this.isOrderDateNow=t.includes(e)}checkFinalAmountDifferent(){if(this.currentSellState==1){let t=this.posStorage.AppConfigJSON,e=this.completeData.Final,i=this._calculatorService.Data,o=t.ModuleSell.ToleranceAmount,l=e-i;if(l!=o&&l!=0){this.finalAmountDifferent=!0;let C=this.decimalPipe.transform(e);setTimeout(()=>{this._toastr.warning(`Final Amount should be ${C}! Use Print Receipt to print the correct Receipt!`,"Invalid Amount charged",{timeOut:1e4})},500)}else this.finalAmountDifferent=!1}}checkOrderNumber(){this.completeData.InvoiceNumber!=this.salesOrder.Order.Number&&(this._toastr.warning("Your transaction number is changed to "+this.completeData.InvoiceNumber,"Transaction Number Changed!"),this.salesOrder.Order.Number=this.completeData.InvoiceNumber)}generateLink(){this.posStorage.AppConfigJSON.PaymentConfigLink==!0&&this._matDialog.open(bi);let t={InvoiceID:this.completeData.ObjectID};this._PaymentHttpService.generateLink(t).subscribe({next:e=>{this._matDialog.open(bi,{data:{link:e.token.redirect_url}})},error:e=>{this._toastr.error(e.Message,"Couldn't generate link!")}})}newSale(){try{this._orderProcessorService.createNewTransactionInSameOutletRegister(),this._signalBroadCast.BroadcastStateToCustomerDisplay(0).subscribe(),this.paymentGatewayService.resetPaymentMethod(),this._router.navigate([],{queryParams:{ID:null}})}catch(t){console.error(t),this._toastr.error(t,"Error redirecting to NEW mode")}}onRetry(){this._onlineStatusService.isOnline?this._posDataService.uploadOfflineOrder().subscribe(e=>{e.Success?(this.isSuccessRetrySubmit.set(!0),this.broadcastToCustomerDisplay(e),this._orderProcessorService.updatePosState(1,e)):this._orderProcessorService.updatePosState(1,e)}):this._toastr.error("Please check your internet connection and try again.","Connection Required")}broadcastToCustomerDisplay(t){let i=this._posDataService.Data.TotalPaidAmount-this._calculatorService.Data;this._signalBroadCast.BroadcastStateToCustomerDisplay(1,t.ObjectID,t.LoyaltyPoint,i).subscribe()}getInvoicePrintURL(t){let e="/print/Invoice"+(this.outletRegister.PrintTemplate.PrintMode===2?"Mini":""),i="";return t&&(i="&Print=1&Price=0"),S.StringFormat("{0}?ID={1}&Template={2}{3}",e,this.completeData.ObjectID,this.outletRegister?.PrintTemplate?.ID?.toString(),i)}sendEmail(){if(!this.role.Email){this._toastr.info("You do not have required Role",Le.Info);return}this._OrderHttpService.sendEmail(this.customerContact.value,this.completeData.ObjectID).then(t=>{this._toastr.success(t.Message,"Email sent!")})}sendReceiptByWhatsaap(){let t=this.customerContact.value;this.whatsappSendReceiptService.createCustomerFromNewNumberAndSendReceipt(t,this._calculatorService.currencySymbol,this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.WhatsappReceipt,{Final:this.completeData.Final,InvoiceNumber:this.completeData.InvoiceNumber,ObjectID:this.completeData.ObjectID},this._posService.Data?.WhatsAppConfigJSON?.TextReceipt)}print(){this.printMode==2?(this.printReceiptMini(),this.printOnPayment()&&this.printWindow()):this.printMode==1&&this.printReceiptA4()}printReceiptMini(){this.receiptTemplate=this._receiptService.generateReceiptMini()}setLoyaltyLabelConfig(){let t=this.posStorage?.AppConfigJSON;t.LoyaltyLabel=t.ApplicationLoyalty.Label,this.posStorage.AppConfigJSON=t}printReceiptA4(){this.receiptTemplateA4$==null?this.receiptTemplateA4$=this._OrderHttpService.generateReceiptA4(this.completeData.ObjectID).pipe(k(this.destroy$),et(t=>(t.Data.AfterSell=!0,t.Data)),li(t=>{throw this._toastr.error(`Could not print in A4 format!
|
|
5
|
+
Printing in 8mm format instead!`,"Error!"),this.printReceiptMini(),t}),Re(()=>{this.printOnPayment()&&this.printWindow()}),At(1)):this.printWindow()}printWindow(){let t=document.title;document.title=this.getCustomPrintFileName(),setTimeout(()=>{window.print(),document.title=t},500)}getCustomPrintFileName(){return`Invoice_${this.completeData?.InvoiceNumber}`}isNotEmpty(t){return S.IsNotEmpty(t)}verifyPaymentSettlement(){let t=this._calculatorService.Data,e=this.paymentGatewayService.paymentMethod,i=this.paymentGatewayService.generatePaymentVerificationData(t,e.EMoneyTypeID);this.paymentHttpService.VerifyPayment(i,e.EMoneyTypeID).pipe(k(this.destroy$)).subscribe({next:o=>{this._toastr.success(o.Message,"QR Settlement")}})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}sendReceiptToContact(){let t=S.emailRegex,e=S.phoneNumberRegex,i=this.customerContact.value,o=t.test(i),l=e.test(i);o?this.sendEmail():l&&this.sendReceiptByWhatsaap()}static \u0275fac=function(e){return new(e||n)(d(V),d(B),d(j),d(Oe),d(oo),d(Mt),d(Y),d(ee),d(qe),d(ne),d(Hi),d(Pe),d(me),d(Ct),d(ji),d(We),d(X),d(Ui),d(oo),d(Me))};static \u0275cmp=P({type:n,selectors:[["sell-complete"]],hostBindings:function(e,i){e&1&&_("keydown.F8",function(l){return i.handleF8(l)},!1,it)},features:[st([ro])],decls:31,vars:14,consts:[["OFFLINE",""],["PRICE_HIDE",""],[1,"sell-complete"],[1,"container-fluid","pt-8"],[1,"row","pb-8","border-bottom"],[1,"col-auto","pe-0","order-0","ps-7"],[1,"me-5","float-start","fw-normal"],[1,"row","mt-8","px-6"],[1,"col-md-8"],[1,"card"],[1,"col-md-4"],[1,"card-header","bg-light-gray"],[1,"text-dark"],[4,"ngIf","ngIfElse"],[1,"card-body"],["class","card-footer bg-white",4,"ngIf"],[1,"card-footer","bg-gradient-warning"],[1,"card-footer","py-8","d-flex","justify-content-center"],[1,"btn-group","d-flex","justify-content-center",2,"width","26rem"],["matTooltipPosition","above",1,"w-100",3,"matTooltip"],["role","button",1,"btn","btn-outline-secondary","w-100",3,"click","ngClass","disabled"],[1,"fa-solid","fa-print","me-2"],["target","_blank","matTooltipPosition","above","matTooltip","Print in New Tab",1,"btn","btn-outline-secondary","d-flex","align-items-center","justify-content-center","fs-5","border-start-0",2,"width","3rem",3,"href"],["class","card",4,"ngIf"],[1,"print_containers"],[1,"print-error-message"],[1,"card-header",3,"ngClass"],[1,"d-flex","justify-content-between"],[1,"fa-solid","fa-check","me-1"],[1,"fst-italic"],[1,"dropdown"],[1,"container",3,"ngClass"],[1,"row"],[1,"d-flex","align-items-center","g-0","mt-5","w-100"],[1,"text-danger"],[1,"row","mt-12","justify-content-center","g-0","mb-9"],[1,"col-12","text-center"],[1,"d-flex","justify-content-between","w-100"],["type","button","matTooltip","Upload your local / offline order to the cloud","matTooltipPosition","above",1,"btn","btn-success","btn-lg","w-100","text-white","me-2"],["type","button",1,"btn","btn-success","btn-lg","w-100",3,"click","ngClass"],[1,"card-footer","bg-light-gray"],["type","button","id","dropdownMenuButton","data-bs-toggle","dropdown","aria-haspopup","true","aria-expanded","false",1,"btn","dropdown-toggle"],["aria-labelledby","dropdownMenuButton",1,"dropdown-menu","dropdown-menu-end"],["class","dropdown-item","routerLink","/print/OutDelivery","target","_blank",3,"queryParams",4,"ngIf"],["class","dropdown-item","routerLink","/print/InvoiceNOutD","target","_blank",3,"queryParams",4,"ngIf"],["class","dropdown-item","target","_blank",3,"href",4,"ngIf"],["class","dropdown-item","routerLink","/print/PackingSlip","target","_blank",3,"queryParams",4,"ngIf"],["routerLink","/print/OutDelivery","target","_blank",1,"dropdown-item",3,"queryParams"],["routerLink","/print/InvoiceNOutD","target","_blank",1,"dropdown-item",3,"queryParams"],["target","_blank",1,"dropdown-item",3,"href"],["routerLink","/print/PackingSlip","target","_blank",1,"dropdown-item",3,"queryParams"],[1,"text-danger","fs-5"],[1,"d-flex","align-items-center","border-bottom","me-2",2,"width","65%"],[1,"px-2","cursor","hover-color",3,"click"],["type","text","placeholder","Email / Whatsapp","id","customerContact","required","","pOSIsInvalidEmailOrPhoneNumber","",1,"form-control","border-0","fs-4",3,"ngModelChange","formControl"],[1,"pb-2",2,"width","35%"],["type","button",1,"btn","btn-light-gray","border","w-100",3,"click","disabled"],["type","button","matTooltip","Upload your local / offline order to the cloud","matTooltipPosition","above",1,"btn","btn-success","btn-lg","w-100","text-white","me-2",3,"click"],[1,"row","justify-content-between"],["class","col-auto my-6",4,"ngIf"],[1,"col-auto","my-6"],["type","button","data-cy","payment-link",1,"btn","btn-light-gray",3,"click"],[1,"fa-solid","fa-money-bill-wave","me-2"],["type","button","data-cy","verify-payment-settelment",1,"btn","btn-light-gray",3,"click"],[1,"fa-solid","fa-circle-check","me-2"],[3,"newSale"],["target","_blank","routerLink","/menu/Orders/Orders/Customer_Invoice/Info",1,"text-dark","fst-italic",3,"queryParams"],[1,"text-dark","fst-italic"],["class","row my-1",4,"ngFor","ngForOf"],[1,"row","my-1"],[1,"col-8"],[1,"col-4","text-end"],[1,"card-footer","bg-white"],["class","d-flex justify-content-end","style","line-height: 30px",4,"ngFor","ngForOf"],[4,"ngIf"],[1,"d-flex","justify-content-end",2,"line-height","30px"],[1,"text-end",3,"hidden"],[1,"text-end","w-50",3,"hidden","ngClass"],[1,"border-top"],[1,"text-end","w-50",3,"hidden"],[1,"text-end"],[1,"fw-bold"],[1,"text-danger",2,"font-size","38px"],[1,"fa-regular","fa-arrow-up-right-from-square"],[1,"card-body","pb-0","text-center",3,"innerHtml"],[3,"data","printTemplate","config","priceVisibleRestriction","outletInfo","isUnknownError","isOffline","stylesheet"],[3,"data","printTemplate","config","workOrderMode","stylesheet"]],template:function(e,i){if(e&1){let o=v();r(0,"section",2)(1,"div",3)(2,"div",4)(3,"div",5)(4,"h1",6),m(5,"Order Complete"),a()()(),r(6,"div",7)(7,"div",8),g(8,Fl,22,16,"div",9)(9,jl,1,0,"app-retry"),a(),r(10,"div",10)(11,"div",9)(12,"div",11)(13,"h3",12),g(14,Hl,3,4,"ng-container",13)(15,Ul,2,1,"ng-template",null,0,G),a()(),g(17,$l,2,1,"div",14)(18,Kl,3,2,"div",15)(19,Yl,7,3,"div",16),r(20,"div",17)(21,"div",18)(22,"div",19)(23,"button",20),_("click",function(){return u(o),f(i.print())}),h(24,"i",21),m(25,"Print Receipt "),a()(),g(26,Xl,2,1,"a",22),a()()(),g(27,Zl,5,1,"div",23),a()()()(),r(28,"div",24),g(29,ns,2,2)(30,os,3,0,"div",25),a()}if(e&2){let o=q(16);s(8),R(i.currentSellState==i.sellState.IsComplete?8:9),s(6),p("ngIf",i.isOnline&&i.completeData.ObjectID)("ngIfElse",o),s(3),R(i.itemSummary?17:-1),s(),p("ngIf",!i.finalAmountDifferent&&i.role.PriceVisible),s(),R(i.finalAmountDifferent?19:-1),s(3),p("matTooltip",i.printOnPayment()?"Print in Current Window":"You must enable print on payment config to use this button"),s(),p("ngClass",E(12,bl,i.completeData.PaymentStateLabel!="Offline"))("disabled",i.printOnPayment()==!1),s(3),R(i.completeData.PaymentStateLabel!="Offline"?26:-1),s(),p("ngIf",i.completeData==null?null:i.completeData.LoyaltyPoint),s(2),R(i.finalAmountDifferent==!1?29:30)}},dependencies:[Z,U,_e,$,Ne,X,Ce,te,K,jt,xt,Zi,ia,Ji,$i,Bt,Lt,bn,ze,vt,Ke,ce,pa],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}.print_containers[_ngcontent-%COMP%]{display:none}@media print{.print_containers[_ngcontent-%COMP%]{display:block;text-align:left}.sell-complete[_ngcontent-%COMP%]{display:none}}.sell-complete[_ngcontent-%COMP%] .card .card-header{border-bottom:1px solid rgba(0,0,0,.125);padding-bottom:.9375rem}.sell-complete[_ngcontent-%COMP%] .card .card-header h2{font-size:2rem}.sell-complete[_ngcontent-%COMP%] .card .card-body .container{max-width:390px;margin-top:30px;margin-bottom:30px}.sell-complete[_ngcontent-%COMP%] .card .card-body .container.offline{margin-top:12px}.sell-complete[_ngcontent-%COMP%] .card .card-body mat-form-field input.form-control{border:none;font-size:16px;padding-left:2px}.sell-complete[_ngcontent-%COMP%] .card .card-body mat-form-field input.form-control:focus{border:none}.sell-complete[_ngcontent-%COMP%] .card .card-body [type=button]{-webkit-appearance:initial}.sell-complete[_ngcontent-%COMP%] .card .card-body input{font-size:1rem}.sell-complete[_ngcontent-%COMP%] .card .card-body .btn-success{padding:.5rem 1rem;font-size:1.25rem}.sell-complete[_ngcontent-%COMP%] .amount[_ngcontent-%COMP%]{font-size:16px}.hover-color[_ngcontent-%COMP%]:hover{color:#d1d1d1}.print-error-message[_ngcontent-%COMP%]{display:flex;justify-content:center;align-items:center;min-height:100vh;text-align:center}.print-error-message[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{color:#dc3545;font-weight:500}"]})};var Sn=class n{constructor(t,e){this._dialogRef=t;this._orderProcessorService=e;this.modalConfig.title="Clear Order?",this.modalConfig.headerType=Le.Success}modalConfig=new W;ngOnInit(){}onOk(){this._orderProcessorService.createNewTransactionInSameOutletRegister(!1),this._orderProcessorService.emitClearOrder(),this.close()}close(){this._dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(F),d(j))};static \u0275cmp=P({type:n,selectors:[["POS-modal-clear"]],standalone:!1,decls:4,vars:2,consts:[[3,"onOk","onCancel","onClose","config"],[1,"fw-normal"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.onOk()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"h4",1),m(3),a()()()),e&2&&(p("config",i.modalConfig),s(3),T("This will replace current order's item(s) with blank order."))},dependencies:[Q],encapsulation:2})};var mo=(i=>(i[i.INTERNAL=1]="INTERNAL",i[i.EKSTERNAL=2]="EKSTERNAL",i[i.EKSTERNALINTERNAL=3]="EKSTERNALINTERNAL",i))(mo||{});function as(n,t){if(n&1){let e=v();r(0,"div",1)(1,"radio-options",12),w("modelChange",function(o){u(e);let l=c();return D(l.selectedProvider,o)||(l.selectedProvider=o),f(o)}),a(),r(2,"label",13),m(3,"Choose Provider"),a()()}if(n&2){let e=c();s(),p("options",e.couponProviders()),M("model",e.selectedProvider),p("disabled",e.hasSelectedCoupon)}}function ls(n,t){if(n&1){let e=v();r(0,"button",14),_("click",function(){u(e);let o=c();return f(o.onRemoveCoupon())}),m(1," Remove "),a()}}function ss(n,t){if(n&1){let e=v();r(0,"button",15),_("click",function(o){u(e);let l=c();return f(l.onOk(o))})("keyup.F2",function(o){u(e);let l=c();return f(l.onOk(o))}),m(1," Ok (F2) "),a()}}var yn=class n{constructor(t,e,i,o,l,C,N){this.promotionService=t;this._orderDataService=e;this._posService=i;this.dialogRef=o;this.roleService=l;this.toastr=C;this.promotionCouponProvider=N;this.destroy$=new z,this.modeType=!1,this.typeText="password",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye-slash",this.couponInputLock=l.Data.CouponInputLock,this.initProviders(),this.subscribeToObservable(),this.initModalConfig(),this.initSelectedProvider()}modalConfig=new W;modeType;typeText;typeIcon;PromotionCoupon;PromotionNote;couponType;destroy$;onInputCouponCode=!1;selectedProvider="Internal";couponInputLock=!1;startInput;couponredemptionType=mo;couponProviders=H([]);initModalConfig(){this.modalConfig.title="Redeem Coupon",this.modalConfig.customWidth="400px",this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0}subscribeToObservable(){this._orderDataService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.PromotionCoupon=t.Order.PromotionCoupon,this.PromotionNote=t.Order.PromotionNote})}initProviders(){this.couponProviders.update(t=>{let e=this._posService.Data.AppConfigJSON.ProviderOption,i=e.map(o=>({Key:o,Value:o}));return e?.length>0?[{Key:"Internal",Value:"DealPOS"},...i]:[]})}initSelectedProvider(){let t=this.promotionCouponProvider.coupon,e=this.promotionCouponProvider.couponProvider;S.IsNotEmpty(t)?this.selectedProvider=e:this.selectedProvider="Internal"}get hasSelectedCoupon(){let t=this._orderDataService.Data.Order;return S.IsNotEmpty(t.PromotionCoupon)}onOk(t){(t!="Enter"||t=="Enter"&&this.onInputCouponCode)&&this.onSubmitCoupon()}onSubmitCoupon(){S.IsNotEmpty(this.PromotionCoupon)?(this.applyCouponCode(),this.dialogRef.close()):this.toastr.warning("Coupon can't be empty","Warning")}onRemoveCoupon(){let t=this.promotionCouponProvider.coupon;S.IsNotEmpty(t)?this.promotionCouponProvider.removeCoupon():this.promotionService.removeAppliedCoupon(),this.dialogRef.close()}applyCouponCode(){if(this.selectedProvider==="Internal")this.promotionService.RedeemCoupon(this.PromotionCoupon,this.PromotionNote);else{let t=`(${this.selectedProvider}) ${this.PromotionNote?this.PromotionNote:""}`;this.promotionCouponProvider.redeemCoupon(this.PromotionCoupon,this.selectedProvider,t)}}onClose(){this.dialogRef.close()}showPassword(){this.modeType?(this.typeText="text",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye"):(this.typeText="password",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye-slash")}onKeyDown(t){let e=t.target.value;this.couponInputLock&&(t.key=="Enter"?this.PromotionCoupon=e:this.validateInputLock())}validateInputLock(){if(typeof this.PromotionCoupon=="string")if(this.PromotionCoupon==""||this.PromotionCoupon.length==0)this.startInput=new Date;else{let t=new Date;this.startInput=this.startInput?this.startInput:new Date,t.getTime()-this.startInput.getTime()>500&&(this.PromotionCoupon=null)}else this.startInput=new Date}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(Xe),d(V),d(B),d(F),d(me),d(ee),d(It))};static \u0275cmp=P({type:n,selectors:[["pos-modal-coupon-code"]],standalone:!1,decls:17,vars:11,consts:[[3,"onClose","config"],[1,"form-floating-outline","radio","border","rounded","pt-7",2,"height","auto !important"],[1,"form-floating-outline","mb-0"],["data-cy","CouponInput","id","cpn","name","PromotionCoupon","autocomplete","new-password","placeholder","Coupon",1,"form-control",3,"ngModelChange","paste","keydown","focus","blur","type","ngModel","disabled"],[3,"click"],["for","cpn"],[1,"form-floating-outline"],["name","note","id","note","data-cy","CouponNote","name","PromotionNote","placeholder","Note","rows","5",1,"form-control",3,"ngModelChange","ngModel","disabled"],["for","note"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","mx-3","p-8",3,"click"],[1,"btn","btn-light-danger","text-danger","btn-lg","fw-bold","mx-3","p-8","me-6"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","mx-3","p-8","me-6"],["id","providerOptions",3,"modelChange","options","model","disabled"],["for","providerOptions"],[1,"btn","btn-light-danger","text-danger","btn-lg","fw-bold","mx-3","p-8","me-6",3,"click"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","mx-3","p-8","me-6",3,"click","keyup.F2"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onClose",function(){return i.dialogRef.close()}),r(1,"content"),g(2,as,4,3,"div",1),r(3,"div",2)(4,"input",3),w("ngModelChange",function(l){return D(i.PromotionCoupon,l)||(i.PromotionCoupon=l),l}),_("paste",function(l){return i.couponInputLock?l.preventDefault():""})("keydown",function(l){return i.onKeyDown(l)})("focus",function(){return i.onInputCouponCode=!0})("blur",function(){return i.onInputCouponCode=!1}),a(),r(5,"i",4),_("click",function(){return i.modeType=!i.modeType,i.showPassword()}),a(),r(6,"label",5),m(7,"Coupon"),a()(),r(8,"div",6)(9,"textarea",7),w("ngModelChange",function(l){return D(i.PromotionNote,l)||(i.PromotionNote=l),l}),a(),r(10,"label",8),m(11,"Note"),a()()(),r(12,"footer")(13,"button",9),_("click",function(){return i.onClose()}),m(14," Cancel "),a(),g(15,ls,2,0,"button",10)(16,ss,2,0,"button",11),a()()),e&2&&(p("config",i.modalConfig),s(2),R(i.couponProviders().length>0?2:-1),s(2),p("type",i.typeText),M("ngModel",i.PromotionCoupon),p("disabled",i.hasSelectedCoupon),s(),be(i.typeIcon),s(4),M("ngModel",i.PromotionNote),p("disabled",i.hasSelectedCoupon),s(6),R(i.hasSelectedCoupon?15:16))},dependencies:[te,K,ie,Q,wi],styles:[".passwordIcon[_ngcontent-%COMP%]{position:relative;margin:0 auto!important;cursor:pointer;left:20.5rem;top:-2.3rem;z-index:999}"]})};var xn=class n{constructor(t,e,i,o){this.dialogRef=t;this._orderDataService=e;this._orderProcessorService=i;this._OrderHttpService=o;this.modalConfig.title="Return",this.modalConfig.customWidth="284px",this.destroy$=new z}modalConfig=new W;ReturNumber;destroy$;ngOnInit(){this.initInvoiceRetur()}initInvoiceRetur(){this.ReturNumber=null,this._orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(t=>{t.posState===7&&(this.ReturNumber=t.ReturNumber)})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}onOk(){let t=this._orderDataService.Data.Order.EntityID;this._OrderHttpService.GetReturnInvoice(this.ReturNumber,t).pipe(k(this.destroy$)).subscribe(e=>{let i=this._orderProcessorService.Data;i.ReturNumber=this.ReturNumber,this._orderProcessorService.ReturnOrder(e),this._orderProcessorService.updatePosState(7),this.dialogRef.close()})}static \u0275fac=function(e){return new(e||n)(d(F),d(V),d(j),d(Oe))};static \u0275cmp=P({type:n,selectors:[["pos-modal-return"]],standalone:!1,decls:6,vars:2,consts:[[3,"onOk","onCancel","onClose","config"],[1,"form-floating-outline"],["type","text","data-cy","ReturnNumber","id","ReturNumber","name","ReturNumber",1,"form-control",3,"ngModelChange","ngModel"],["for","ReturNumber"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.onOk()})("onCancel",function(){return i.dialogRef.close()})("onClose",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1)(3,"input",2),w("ngModelChange",function(l){return D(i.ReturNumber,l)||(i.ReturNumber=l),l}),a(),r(4,"label",3),m(5,"Number Invoice"),a()()()()),e&2&&(p("config",i.modalConfig),s(3),M("ngModel",i.ReturNumber))},dependencies:[te,K,ie,Q],encapsulation:2})};var cs=["serialInput"],In=class n{constructor(t,e,i){this.dialogRef=t;this.shoppingCartService=e;this.toastr=i;this.modalConfig.title="Scan Serial",this.modalConfig.customWidth="350px",this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0}serialInputEl;modalConfig=new W;serial;onKeyDown(t){t.key=="Enter"&&(S.IsNotEmpty(this.serial)?(this.shoppingCartService.addItemBySerial(this.serial),this.serial=null):this.toastr.warning("Serial Can`t be empty","Warning!"),this.setFocusInput())}setFocusInput(){this.serialInputEl&&setTimeout(()=>{this.serialInputEl?.nativeElement?.focus()},500)}static \u0275fac=function(e){return new(e||n)(d(F),d(Me),d(ee))};static \u0275cmp=P({type:n,selectors:[["POS-modal-serial"]],viewQuery:function(e,i){if(e&1&&ve(cs,5),e&2){let o;Se(o=ye())&&(i.serialInputEl=o.first)}},standalone:!1,decls:7,vars:2,consts:[["serialInput",""],[3,"onClose","config"],[1,"input-group","mt-3"],["type","text","placeholder","Input Product By Serial","aria-label","Serial",1,"form-control",3,"ngModelChange","keydown","ngModel"],[1,"input-group-text"],[1,"fa-solid","fa-barcode","fs-4"]],template:function(e,i){if(e&1){let o=v();r(0,"modal-material",1),_("onClose",function(){return u(o),f(i.dialogRef.close())}),r(1,"content")(2,"div",2)(3,"input",3,0),w("ngModelChange",function(C){return u(o),D(i.serial,C)||(i.serial=C),f(C)}),_("keydown",function(C){return u(o),f(i.onKeyDown(C))}),a(),r(5,"span",4),h(6,"i",5),a()()()()}e&2&&(p("config",i.modalConfig),s(3),M("ngModel",i.serial))},dependencies:[te,K,ie,Q],styles:["input[_ngcontent-%COMP%]{height:55px;border-bottom-left-radius:4px;border-top-left-radius:4px}span.input-group-text[_ngcontent-%COMP%]{border-bottom-right-radius:4px;border-top-right-radius:4px}"]})};function ps(n,t){if(n&1&&(r(0,"tr")(1,"td"),m(2),a(),r(3,"td"),m(4),b(5,"date"),a(),r(6,"td"),m(7),b(8,"date"),a(),r(9,"td",5),m(10),a(),r(11,"td",5),m(12),b(13,"number"),a()()),n&2){let e=t.$implicit;s(2),T(e.Order.Number),s(2),T(le(5,5,e.Order.ClientTimestamp,"dd MMM yyyy")),s(3),T(le(8,8,e.Order.ClientTimestamp,"HH:mm")),s(3),T(e.Items.length),s(2),T(O(13,11,e.TotalPaidAmount))}}function ms(n,t){if(n&1&&(x(0),r(1,"div",2)(2,"table",3)(3,"thead",4)(4,"tr")(5,"th"),m(6,"Number"),a(),r(7,"th"),m(8,"Date"),a(),r(9,"th"),m(10,"Time"),a(),r(11,"th",5),m(12,"Qty"),a(),r(13,"th",5),m(14,"Total"),a()()(),r(15,"tbody"),g(16,ps,14,13,"tr",6),a()()(),I()),n&2){let e=c();s(16),p("ngForOf",e.offlineOrders)}}function ds(n,t){n&1&&(r(0,"h1",7),m(1,"There is no offline orders!"),a())}var On=class n{constructor(t){this._localDataService=t;this.destroy$=new z}offlineOrders=[];destroy$;ngOnInit(){this.getOfflineOrders()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}getOfflineOrders(){this._localDataService.findAllOrders().pipe(k(this.destroy$)).subscribe(t=>{this.offlineOrders=t.map(e=>ot(mt,e))})}static \u0275fac=function(e){return new(e||n)(d(Ye))};static \u0275cmp=P({type:n,selectors:[["sync-orders"]],standalone:!1,decls:3,vars:2,consts:[["noOrders",""],[4,"ngIf","ngIfElse"],[1,"table-responsive","p-8"],[1,"table"],[1,"thead-light"],[1,"text-end"],[4,"ngFor","ngForOf"],[1,"text-center","p-8"]],template:function(e,i){if(e&1&&g(0,ms,17,1,"ng-container",1)(1,ds,2,0,"ng-template",null,0,G),e&2){let o=q(2);p("ngIf",i.offlineOrders!=null&&i.offlineOrders.length>0)("ngIfElse",o)}},dependencies:[_e,$,X,We],encapsulation:2})};var fs=n=>({"bg-gradient-danger":n});function gs(n,t){if(n&1&&(x(0),m(1),b(2,"number"),I()),n&2){let e=c();s(),y(" ",O(2,1,e.onlineProducts)," ")}}function _s(n,t){n&1&&(r(0,"small",13),m(1," Failed to get Online Products "),a())}function Cs(n,t){if(n&1&&(x(0),m(1),b(2,"date"),I()),n&2){let e=c();s(),y(" ",le(2,1,e.syncDate,"dd MMM yyyy HH:mm")," ")}}function hs(n,t){n&1&&m(0," Never been synced ")}function bs(n,t){if(n&1&&(r(0,"p"),m(1),a()),n&2){let e=c();s(),y("You last synced ",e.dayDiff," days ago!")}}var Pn=class n{constructor(t,e,i,o){this.indexDbService=t;this.toastr=e;this.httpService=i;this.dialogRef=o;this.destroy$=new z}dayDiff;syncDate;offlineProduct=0;onlineProducts=0;destroy$;ngOnInit(){this.initOfflineProducts()}initOfflineProducts(){this.indexDbService.findAllVariant().pipe(pe(t=>t.length>0),Ee(t=>{let e=Array.from(new Set(t.map(i=>i.ProductID))).map(i=>t.find(o=>o.ProductID===i));return this.offlineProduct=e.length,this.httpService.POSText("/api/catalog/product/ProductRowsCount",'{"ProductDiscontinued":false,"VariantDiscontinued":false,"CategoryDiscontinued":false,"From":"0001-01-01T00:00:00","To":"0001-01-01T00:00:00"}')}),et(t=>JSON.parse(t))).subscribe({next:t=>{this.onlineProducts=t.Count,this.getSyncTime()},error:t=>{console.error(t)}})}syncToLocalDatabase(){yi([this.syncOutlets(),this.syncProducts(),this.syncOutletPrices()]).pipe(k(this.destroy$),Ee(()=>this.indexDbService.updateSyncTime())).subscribe({next:()=>{this.initOfflineProducts(),this.toastr.success("Sync Product Offline Successfully","Success!"),this.dialogRef.close()},error:t=>{console.error(t)}})}getSyncTime(){this.indexDbService.getSyncTime().pipe(k(this.destroy$),pe(t=>t!=null)).subscribe({next:t=>{this.syncDate=new Date(t.time),this.calculateSyncDiff()},error:t=>{console.error(t)}})}calculateSyncDiff(){this.syncDate?this.dayDiff=Math.floor((new Date().getTime()-this.syncDate.getTime())/1e3/60/60/24):this.dayDiff=0}syncOutlets(){return this.httpService.get(fe.SynOutlet).pipe(k(this.destroy$),Ee(t=>this.indexDbService.syncRegisters(t)))}syncProducts(){return this.httpService.get(fe.SyncProducts).pipe(k(this.destroy$),Ee(t=>this.indexDbService.syncVariants(t)))}syncOutletPrices(){return this.httpService.get(fe.SynOutletPrice).pipe(k(this.destroy$),Ee(t=>this.indexDbService.syncOutletPrice(t)))}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(Ye),d(ee),d(Qe),d(F))};static \u0275cmp=P({type:n,selectors:[["sync-products"]],standalone:!1,decls:30,vars:11,consts:[["EMPTY_PRODUCTS",""],["neverSync",""],[1,"table-responsive","p-8"],[1,"table","table-bordered","table-sm","fs-5"],[1,"fw-bold",2,"width","125px"],[2,"width","175px",3,"ngClass"],[4,"ngIf","ngIfElse"],["rowspan","3"],[1,"d-flex","align-items-center","justify-content-center"],[1,"btn","btn-success","fs-4",3,"click"],[1,"fa-solid","fa-sync-alt","me-2","pe-2"],[1,"fw-bold"],[4,"ngIf"],[1,"fst-italic"]],template:function(e,i){if(e&1){let o=v();r(0,"div",2)(1,"table",3)(2,"tbody")(3,"tr")(4,"td",4),m(5,"Online Products"),a(),r(6,"td",5),g(7,gs,3,3,"ng-container",6)(8,_s,2,0,"ng-template",null,0,G),a(),r(10,"td",7)(11,"div",8)(12,"button",9),_("click",function(){return u(o),f(i.syncToLocalDatabase())}),h(13,"i",10),r(14,"span"),m(15,"Sync"),a()()()()(),r(16,"tr")(17,"td",11),m(18,"Offline Products"),a(),r(19,"td"),m(20),b(21,"number"),a()(),r(22,"tr")(23,"td",11),m(24,"Last Sync"),a(),r(25,"td"),g(26,Cs,3,4,"ng-container",6)(27,hs,1,0,"ng-template",null,1,G)(29,bs,2,1,"p",12),a()()()()()}if(e&2){let o=q(9),l=q(28);s(6),p("ngClass",E(9,fs,!i.onlineProducts)),s(),p("ngIf",i.onlineProducts)("ngIfElse",o),s(13),y(" ",O(21,7,i.offlineProduct)," "),s(6),p("ngIf",i.syncDate)("ngIfElse",l),s(3),p("ngIf",i.dayDiff>14)}},dependencies:[U,$,X,We],encapsulation:2})};var Ss=["navTabs"],Mn=class n{constructor(t,e){this._router=t;this.dialogRef=e}tabs;modalConfig=new W;ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig.headerType=Le.Success,this.modalConfig.title="Add all offline products",this.modalConfig.hideFooter=!0,this.modalConfig.customWidth="550px",this.modalConfig.noPadding=!0}goToOfflinePage(){this.tabs.selectedIndex==0?this._router.navigate(["/menu","Sell","Offline","Products"]):this.tabs.selectedIndex==1&&this._router.navigate(["/menu","Sell","Offline","Orders"]),this.close()}close(){this.dialogRef.close()}onChangeTab(t){t.index==0?this.modalConfig.title="Add all offline product":this.modalConfig.title="Add all offline order"}static \u0275fac=function(e){return new(e||n)(d(Ct),d(F))};static \u0275cmp=P({type:n,selectors:[["pos-modal-sync"]],viewQuery:function(e,i){if(e&1&&ve(Ss,5),e&2){let o;Se(o=ye())&&(i.tabs=o.first)}},standalone:!1,decls:12,vars:2,consts:[["navTabs",""],[3,"onOk","onCancel","onClose","config"],["mat-align-tabs","start",1,"sync",3,"selectedTabChange","dynamicHeight"],["label","Products"],["label","Orders"],[1,"d-flex","justify-content-center","mb-8"],[1,"btn","btn-primary","btn-lg",3,"click"],[1,"fa-solid","fa-paper-plane"]],template:function(e,i){if(e&1){let o=v();r(0,"modal-material",1),_("onOk",function(){return u(o),f(i.close())})("onCancel",function(){return u(o),f(i.close())})("onClose",function(){return u(o),f(i.close())}),r(1,"content")(2,"mat-tab-group",2,0),_("selectedTabChange",function(C){return u(o),f(i.onChangeTab(C))}),r(4,"mat-tab",3),h(5,"sync-products"),a(),r(6,"mat-tab",4),h(7,"sync-orders"),a()(),r(8,"div",5)(9,"button",6),_("click",function(){return u(o),f(i.goToOfflinePage())}),h(10,"i",7),m(11," Go to Details "),a()()()()}e&2&&(p("config",i.modalConfig),s(2),p("dynamicHeight",!1))},dependencies:[Q,St,yt,On,Pn],styles:[".mat-ink-bar{background-color:#93bd45!important} .sync mat-mdc-tab-body{height:200px} .mat-mdc-tab-body-content{overflow-x:hidden!important}"]})};function xs(n,t){if(n&1){let e=v();r(0,"div",12)(1,"div",13)(2,"h5"),m(3,"Deduct inventory from outlet"),a()(),r(4,"div",13)(5,"ng-select",14),w("ngModelChange",function(o){u(e);let l=c();return D(l.deliveryEntityID,o)||(l.deliveryEntityID=o),f(o)}),a()()()}if(n&2){let e=c();s(5),p("disabled",e.isDisabledNgSelectOutlet),M("ngModel",e.deliveryEntityID),p("items",e.entities)("clearable",!1)}}function Is(n,t){n&1&&(x(0),r(1,"h5",15),m(2,"Unfulfilled order, product inventory is allocated "),a(),I())}function Os(n,t){if(n&1){let e=v();x(0),r(1,"div",16)(2,"div",28)(3,"div",29)(4,"input",30),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.shipping.Name,o)||(l.shipping.Name=o),f(o)}),a(),r(5,"label",31),m(6,"Recipient"),a()()(),r(7,"div",28)(8,"div",29)(9,"input",32),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.shipping.Phone,o)||(l.shipping.Phone=o),f(o)}),a(),r(10,"label",33),m(11,"Phone"),a()()()(),r(12,"div",34)(13,"div",28)(14,"div",29)(15,"textarea",35),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.shipping.Address,o)||(l.shipping.Address=o),f(o)}),a(),r(16,"label",36),m(17,"Address"),a()()(),r(18,"div",28)(19,"div",29)(20,"input",37),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.shipping.City,o)||(l.shipping.City=o),f(o)}),a(),r(21,"label",38),m(22,"City"),a()()()(),I()}if(n&2){let e=c(2);s(4),M("ngModel",e.shipping.Name),s(5),M("ngModel",e.shipping.Phone),s(6),M("ngModel",e.shipping.Address),s(5),M("ngModel",e.shipping.City)}}function Ps(n,t){if(n&1){let e=v();x(0),r(1,"div",16)(2,"div",17)(3,"div",18)(4,"h5",19),m(5," Recipient != Buyer"),a()(),r(6,"div",20)(7,"input",21),w("ngModelChange",function(o){u(e);let l=c();return D(l.recipientNotBuyer,o)||(l.recipientNotBuyer=o),f(o)}),a(),h(8,"label",22),a()(),r(9,"div",17)(10,"div",23)(11,"label",24),m(12),a(),r(13,"div")(14,"datepicker",25),w("dateChange",function(o){u(e);let l=c();return D(l.posData.Invoice.DateCustom,o)||(l.posData.Invoice.DateCustom=o),f(o)}),a()()(),r(15,"div")(16,"label",26),m(17,"Time"),a(),r(18,"div")(19,"app-timepicker",27),w("timeChange",function(o){u(e);let l=c();return D(l.posData.Invoice.TimeCustom,o)||(l.posData.Invoice.TimeCustom=o),f(o)}),a()()()()(),g(20,Os,23,4,"ng-container",11),I()}if(n&2){let e=c();s(7),M("ngModel",e.recipientNotBuyer),s(5),T(e.dateLabel),s(2),M("date",e.posData.Invoice.DateCustom),s(5),M("time",e.posData.Invoice.TimeCustom),s(),p("ngIf",e.recipientNotBuyer)}}var oi=class n{constructor(t,e,i,o,l,C,N){this._dialogRef=t;this._orderDataService=e;this._posService=i;this._orderProcessorService=o;this._productHttpService=l;this._outletService=C;this.datePipe=N;this.destroy$=new z,this.initStartTime(),this.subscribePosData(),this.initModal()}modalConfig=new W;isDisabledNgSelectOutlet=!1;isDelivery=!1;customDate=null;shipping=new fi;deliveryEntityID="";posData=new mt;startTime;get entities(){return this._posService.Data.Entities}shippingFormVisible;destroy$;disableShippingNow=!1;disableShippingLater=!1;recipientNotBuyer;dateLabel="Fulfillment Date";ngOnInit(){this.initShipingFormVisible(),this.initDefaultOrderDelivery(),this.checkRecepientIsBuyer(),this.initDateLabel(),this.initDisabledOutletOption()}initDisabledOutletOption(){this._orderProcessorService.Data.posState==2&&(this.isDisabledNgSelectOutlet=!0)}checkRecepientIsBuyer(){S.IsNotEmpty(this.shipping.Name)?this.recipientNotBuyer=!0:this.recipientNotBuyer=!1}initDateLabel(){let t=this._posService.Data.AppConfigJSON;t.ModuleSell.Shipping.DateLabel&&(this.dateLabel=t.ModuleSell.Shipping.DateLabel)}initStartTime(){var t=new Date;this.startTime=t.getHours()+":"+t.getMinutes()}subscribePosData(){this._orderDataService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.posData=t,this.posData.Invoice.DateCustom=this.posData.Invoice.DateCustom?this.posData.Invoice.DateCustom:null,this.deliveryEntityID=t.Action.DeliveryEntityID,this.shipping=t.Shipping?t.Shipping:new fi})}initModal(){this.modalConfig.title="Order Fullfillment",this.modalConfig.customWidth="650px"}initShipingFormVisible(){let t=this._posService.Data.AppConfigJSON;this.shippingFormVisible=t.ModuleSell.Shipping.DeliveryAddressAlwaysVisible}initDefaultOrderDelivery(){this.deliveryEntityID==S.GuidEmpty?this.isDelivery=!0:this.isDelivery=!1;let t=this.entities.find(e=>e.ID==this._outletService?.getOutletRegister()?.EntityID);if(S.IsNotEmpty(t.ID)){let e=t.FulfillmentOption;e==1?(this.isDelivery=!1,this.disableShippingLater=!0):e==2&&(this.isDelivery=!0,this.disableShippingNow=!0),this.changeDelivery()}}changeDelivery(){if(this.isDelivery)this.deliveryEntityID=S.GuidEmpty;else{let t=this._outletService.Data,e=this.posData.Action.DeliveryEntityID;S.IsNotEmpty(e)?this.deliveryEntityID=e:S.IsNotEmpty(t.DefaultWarehouse)?this.deliveryEntityID=t.DefaultWarehouse:this.deliveryEntityID=t.EntityID}}onOk(){this.getSerialByVariantIds(),this.setCustomDateField(),this.clearShippingData(),this.posData.Shipping=this.shipping,this.posData.Action.DeliveryEntityID=this.deliveryEntityID,this._orderDataService.pushNewValue(this.posData),this.close()}clearShippingData(){if(!this.recipientNotBuyer)for(let t of Object.getOwnPropertyNames(this.shipping))this.shipping[t]=""}setCustomDateField(){let t=this.posData.Invoice.DateCustom?this.posData.Invoice.DateCustom:null,e=this.posData.Invoice.TimeCustom?this.posData.Invoice.TimeCustom:"00:00";if((this.isDelivery||this.shippingFormVisible)&&t){let i=this.datePipe.transform(this.posData.Invoice.DateCustom,"d MMM y");this.posData.Invoice.CustomDateField=`${i} ${e}`}}getSerialByVariantIds(){let t=this.posData.CartItems;if(S.IsNotEmpty(this.deliveryEntityID)&&t.length>0){let e=t.map(i=>i.VariantID);this._productHttpService.getSerialByVarianIds(this.deliveryEntityID,e).subscribe(i=>{this.updateCartItemSerial(i)})}}updateCartItemSerial(t){let e=ot(Be,this.posData.CartItems),i;this.posData.CartItems=e.map(o=>(o.isSerialType()&&(i=t.findIndex(l=>l.VariantID==o.VariantID),i!==-1&&(o.Serial=this.filterSerialBySelectedSerial(o.Serial,t[i].Serial))),o)),this._orderDataService.pushNewValue(this.posData)}filterSerialBySelectedSerial(t=[],e){let i;return e.filter(l=>(i=t.findIndex(C=>C.Number==l.Number),i!==-1))}close(){this._dialogRef.close()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(F),d(V),d(B),d(j),d(Li),d(Y),d(We))};static \u0275cmp=P({type:n,selectors:[["POS-modal-shipping"]],standalone:!1,decls:21,vars:9,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container"],[1,"row","align-items-start","py-2","my-2"],[1,"col"],["name","fontStyle","aria-label","Font Style",1,"fulfillment-tab",3,"ngModelChange","change","ngModel"],["data-cy","tab-now",3,"value","disabled"],[1,"p-7","me-2"],[1,"text-body-secondary","tabDesc"],["data-cy","tab-later",3,"value","disabled"],[1,"p-7"],["class","row align-items-center mt-5",4,"ngIf"],[4,"ngIf"],[1,"row","align-items-center","mt-5"],[1,"col-6"],["bindLabel","Name","bindValue","ID","appendTo","body","placeholder","Outlet","data-cy","DeductInventory","data-cy","select-deduct-outlet-inventory",1,"tall","auto-grow",2,"width","250px",3,"ngModelChange","disabled","ngModel","items","clearable"],[1,"bg-gradient-warning","text-center","py-7","rounded-3","border","mb-7"],[1,"row","mt-8"],[1,"col-md-6","mb-5","d-flex","align-items-center"],[1,"me-3","pb-5"],["matTooltipPosition","above","matTooltip","Recipient is not the same as Buyer (ex: when someone buys an item as GIFT for another person)"],[1,"form-check","form-switch","form-switch-lg","ms-1"],["type","checkbox","id","flexSwitchCheckDefault",1,"form-check-input",3,"ngModelChange","ngModel"],["for","flexSwitchCheckDefault",1,"form-check-label"],[1,"w-75"],["for","shippingDate",1,"text-body-secondary","mb-0"],["appearance","outline","width","85","id","shippingDate",3,"dateChange","date"],["for","shippingTime",1,"text-body-secondary","mb-0"],[3,"timeChange","time"],[1,"col-md-6"],[1,"form-floating-outline"],["id","recipient","placeholder","Recipient","type","text",1,"w-100","form-control",3,"ngModelChange","ngModel"],["for","recipient"],["id","phone","placeholder","Phone","type","text",1,"w-100","form-control",3,"ngModelChange","ngModel"],["for","phone"],[1,"row"],["id","address","placeholder","Address","type","text",1,"w-100","form-control",3,"ngModelChange","ngModel"],["for","address"],["id","city","placeholder","City","type","text",1,"w-100","form-control",3,"ngModelChange","ngModel"],["for","city"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.onOk()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"mat-button-toggle-group",4),w("ngModelChange",function(l){return D(i.isDelivery,l)||(i.isDelivery=l),l}),_("change",function(){return i.changeDelivery()}),r(6,"mat-button-toggle",5)(7,"h3",6),m(8," Now "),r(9,"small",7)(10,"em"),m(11,"(in store purchase)"),a()()()(),r(12,"mat-button-toggle",8)(13,"h3",9),m(14," Later "),r(15,"small",7)(16,"em"),m(17,"(shipped to customer address)"),a()()()()()()(),g(18,xs,6,4,"div",10)(19,Is,3,0,"ng-container",11)(20,Ps,21,5,"ng-container",11),a()()()),e&2&&(p("config",i.modalConfig),s(5),M("ngModel",i.isDelivery),s(),p("value",!1)("disabled",i.disableShippingNow),s(6),p("value",!0)("disabled",i.disableShippingLater),s(6),p("ngIf",!i.isDelivery),s(),p("ngIf",i.isDelivery),s(),p("ngIf",i.isDelivery||i.shippingFormVisible))},dependencies:[$,te,ht,K,ie,Q,nt,ce,_r,er,tr,Ti],styles:[".container[_ngcontent-%COMP%]{min-height:220px}input[type=radio][_ngcontent-%COMP%]{margin-top:-.2rem;vertical-align:middle}.mat-button-toggle-checked[_ngcontent-%COMP%]{background-color:#dfeffc;color:#0976b4}.form-check-input[_ngcontent-%COMP%]{clear:left}.form-switch.form-switch-lg[_ngcontent-%COMP%]{margin-bottom:.8rem}.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}.tabDesc[_ngcontent-%COMP%]{font-size:80%;font-weight:400} mat-button-toggle-group.fulfillment-tab mat-pseudo-checkbox{display:none}"]})};var Dn=class n{constructor(t){this.httpService=t}getParkedOrder(t,e){return this.httpService.get(fe.GetPark,[{key:"EntityID",value:t},{key:"RegisterID",value:e}])}removeOrder(t,e){let i={OrderID:t};return e?this.httpService.post(fe.VoidPark,i):this.httpService.post(fe.RemovePark,i)}mergePark(t){return this.httpService.post(fe.MergePark,t)}getOutstanding(t){let e={EntityID:t};return this.httpService.post(fe.GetOutStanding,e)}static \u0275fac=function(e){return new(e||n)(A(Qe))};static \u0275prov=at({token:n,factory:n.\u0275fac,providedIn:"root"})};var ua=()=>["ParkLabel","Number"],fa=(n,t,e)=>({"duration-green":n,"duration-yellow":t,"duration-red":e});function Ds(n,t){if(n&1&&(r(0,"span",17),m(1),a()),n&2){let e=t.$implicit,i=t.index;p("hidden",i==0),s(),y(" ",e.ParkLabel," ")}}function ws(n,t){if(n&1&&(r(0,"div",14),g(1,Ds,2,2,"span",15),m(2," will be merged to"),r(3,"span",16),m(4),a()()),n&2){let e=c(2);s(),p("ngForOf",e.listMerge),s(3),T(e.listMerge[0].ParkLabel)}}function ks(n,t){if(n&1){let e=v();r(0,"div",8),g(1,ws,5,2,"div",9),r(2,"div",10)(3,"span",11),h(4,"i",12),a(),r(5,"input",13),w("ngModelChange",function(o){u(e);let l=c();return D(l.filter,o)||(l.filter=o),f(o)}),a()()()}if(n&2){let e=c();s(),p("ngIf",e.listMerge.length>1),s(4),M("ngModel",e.filter)}}function Ts(n,t){if(n&1&&h(0,"i"),n&2){let e=c(2).$implicit;be(e.Icon)}}function Es(n,t){if(n&1&&(r(0,"h5",26),g(1,Ts,1,2,"i",27),r(2,"span"),m(3),b(4,"limitTo"),a()()),n&2){let e=c().$implicit,i=c(3);s(),R(e.Icon?1:-1),s(2),y(" ",i.parkedOrders.length<5?e.Name:le(4,2,e.Name,5)," ")}}function Rs(n,t){if(n&1){let e=v();r(0,"span",46),_("click",function(o){u(e);let l=c().$implicit;return c(5).remove(l),f(o.stopPropagation())}),h(1,"i",47),a()}}function Ns(n,t){if(n&1&&(r(0,"div",39),h(1,"i",48),m(2),a()),n&2){let e=c().$implicit;s(2),y(" ",e.CustomerDisplay," ")}}function Vs(n,t){if(n&1&&(r(0,"div",49),m(1),a()),n&2){let e=c().$implicit;s(),y(" ",e.alias," ")}}function As(n,t){if(n&1){let e=v();r(0,"input",50),w("ngModelChange",function(o){u(e);let l=c().$implicit;return D(l.selected,o)||(l.selected=o),f(o)}),_("change",function(){u(e);let o=c().$implicit,l=c(5);return f(l.chooseMerge(o))})("click",function(o){return u(e),f(o.stopPropagation())}),a()}if(n&2){let e=c().$implicit;M("ngModel",e.selected)}}function Ls(n,t){if(n&1){let e=v();r(0,"div",29)(1,"div",30)(2,"div",31),_("click",function(o){let l=u(e).$implicit;return c(5).onOrderClicked(l),f(o.preventDefault())}),r(3,"h5",32)(4,"div",33),m(5),a(),g(6,Rs,2,0,"span",34),a(),r(7,"div",35)(8,"div",36)(9,"div",37),h(10,"i",38),m(11),a(),r(12,"div",39),h(13,"i",40),m(14),b(15,"date"),a(),g(16,Ns,3,1,"div",41)(17,Vs,2,1,"div",42),a(),r(18,"div",43)(19,"div",44),m(20),a(),g(21,As,1,1,"input",45),a()()()()()}if(n&2){let e=t.$implicit,i=c(5);s(5),y(" ",i.replaceAlias&&e.Alias?e.Alias:e.ParkLabel," "),s(),p("ngIf",!i.AuthorizeParkOrderDeletion),s(5),y(" ",e.Number," "),s(3),y(" ",le(15,9,e.Created,"dd-MMM HH:mm")," "),s(2),p("ngIf",e.CustomerDisplay),s(),p("ngIf",!i.replaceAlias),s(2),p("ngClass",Et(12,fa,e.Duration<=60,e.Duration>60&&e.Duration<=120,e.Duration>120)),s(),y(" ",e.Duration," minutes ago "),s(),p("ngIf",i.parkEnableMerge)}}function Bs(n,t){if(n&1&&(r(0,"div",24),g(1,Ls,22,16,"div",28),b(2,"FilterByArray"),a()),n&2){let e=c().$implicit,i=c(3);s(),p("ngForOf",Ge(2,1,e.List,ct(5,ua),i.filter))}}function Fs(n,t){n&1&&(r(0,"div",25),h(1,"app-empty-state"),a())}function js(n,t){if(n&1&&(r(0,"mat-tab"),g(1,Es,5,5,"ng-template",22),r(2,"div",23),g(3,Bs,3,6,"div",24)(4,Fs,2,0,"div",25),a()()),n&2){let e=t.$implicit;s(3),R(e.List.length>0?3:4)}}function Hs(n,t){if(n&1&&(r(0,"mat-tab-group",20),g(1,js,5,1,"mat-tab",21),a()),n&2){let e=c(2);s(),p("ngForOf",e.Layout)}}function Us(n,t){if(n&1&&(r(0,"div",18),g(1,Hs,2,1,"mat-tab-group",19),a()),n&2){let e=c();s(),p("ngIf",e.parkedOrders.length!=0)}}function Ws(n,t){if(n&1){let e=v();r(0,"span",46),_("click",function(o){u(e);let l=c().$implicit;return c(2).remove(l),f(o.stopPropagation())}),h(1,"i",54),a()}}function Qs(n,t){if(n&1&&(r(0,"div",39),h(1,"i",48),m(2),a()),n&2){let e=c().$implicit;s(2),y(" ",e.CustomerDisplay," ")}}function qs(n,t){if(n&1&&(r(0,"div",49),m(1),a()),n&2){let e=c().$implicit;s(),y(" ",e.alias," ")}}function $s(n,t){if(n&1){let e=v();r(0,"input",50),w("ngModelChange",function(o){u(e);let l=c().$implicit;return D(l.selected,o)||(l.selected=o),f(o)}),_("change",function(){u(e);let o=c().$implicit,l=c(2);return f(l.chooseMerge(o))})("click",function(o){return u(e),f(o.stopPropagation())}),a()}if(n&2){let e=c().$implicit;M("ngModel",e.selected)}}function Js(n,t){if(n&1){let e=v();r(0,"div",29)(1,"div",53)(2,"div",31),_("click",function(o){let l=u(e).$implicit;return c(2).onOrderClicked(l),f(o.preventDefault())}),r(3,"h5",32)(4,"div",33),m(5),a(),g(6,Ws,2,0,"span",34),a(),r(7,"div",35)(8,"div",36)(9,"div",37),h(10,"i",38),m(11),a(),r(12,"div",39),h(13,"i",40),m(14),b(15,"date"),a(),g(16,Qs,3,1,"div",41)(17,qs,2,1,"div",42),a(),r(18,"div",43)(19,"div",44),m(20),a(),g(21,$s,1,1,"input",45),a()()()()()}if(n&2){let e=t.$implicit,i=c(2);s(5),y(" ",e.Alias?e.Alias:e.ParkLabel," "),s(),p("ngIf",!i.AuthorizeParkOrderDeletion),s(5),y(" ",e.Number," "),s(3),y(" ",le(15,9,e.Created,"dd-MMM HH:mm")," "),s(2),p("ngIf",e.CustomerDisplay),s(),p("ngIf",!i.replaceAlias),s(2),p("ngClass",Et(12,fa,e.Duration<=60,e.Duration>60&&e.Duration<=120,e.Duration>120)),s(),y(" ",e.Duration," minutes ago "),s(),p("ngIf",i.parkEnableMerge)}}function Gs(n,t){if(n&1&&(r(0,"div",51)(1,"div",52),g(2,Js,22,16,"div",28),b(3,"FilterByArray"),a()()),n&2){let e=c();s(2),p("ngForOf",Ge(3,1,e.parkedOrders,ct(5,ua),e.filter))}}function zs(n,t){if(n&1){let e=v();r(0,"a",55),_("click",function(){u(e);let o=c();return f(o.clearSelection())}),m(1,"Clear All"),a()}}function Ks(n,t){if(n&1){let e=v();r(0,"a",55),_("click",function(){u(e);let o=c();return f(o.merge())}),m(1,"Merge"),a()}}var wn=class n{constructor(t,e,i,o,l,C,N,ae,ke,Fe){this._dialogRef=t;this._parkedOrderService=e;this._localData=i;this._OrderHttpService=o;this._orderProcessorService=l;this._posHttpResponseService=C;this._salesOrderDataService=N;this.outletService=ae;this._toastr=ke;this.roleService=Fe;let je=this._salesOrderDataService.Data;this.entityId=je.Order.EntityID,this.templateID=ae.Data.PrintTemplate.ID,this.RegisterID=je.Order.RegisterID,this.park=new Xt(this.outletService.Data.ParkLayoutPack),this.Layout=ae.Data?.ParkLayoutPack?.Layout,this.initModalDialog(),this.initConfig(),this.getData()}modalConfig=new W;filter;entityId;parkedOrders=[];filterAlwaysVisible;replaceAlias;parkDeletionRestriction;parkEnableMerge;AuthorizeParkOrderDeletion;listMerge=[];park;templateID;RegisterID;voidEnabled;retreiveMode;Layout;initConfig(){let t=this._posHttpResponseService.Data.AppConfigJSON;this.filterAlwaysVisible=t.ApplicationParkAndRetrieve.Advance.RetreiveFilterBoxAlwaysVisible,this.replaceAlias=t.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,this.voidEnabled=t.ModuleOrders.VoidEnabled,this.retreiveMode=t.ApplicationParkAndRetrieve.Advance.retreiveMode,this.parkEnableMerge=t.ApplicationParkAndRetrieve.Basic.EnableMergeServeralTables,this.AuthorizeParkOrderDeletion=t.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkOrderDeletion,this.roleService.Data.ParkedDeletionAuthorized&&(this.AuthorizeParkOrderDeletion=!1)}initModalDialog(){let e=this._posHttpResponseService.Data.AppConfigJSON.ApplicationParkAndRetrieve.UserInterfaceLabel.RetreiveDialogTitle;this.modalConfig.title=e,this.modalConfig.customWidth="850px",this.modalConfig.bodyScrollable=!0,this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0}getData(){this._localData.isConfigFromServer().subscribe(t=>{t&&this._parkedOrderService.getParkedOrder(this.entityId,this.RegisterID).subscribe({next:e=>{this.parkedOrders=e,this.parkedOrders.length>0&&this.parkedOrders.forEach(i=>{if(this.retreiveMode==1)i.Orders.forEach(o=>{o.Alias=this.park.GetAlias(o.ParkLabel),o.MemberIdentification=o.MemberIdentification?o.MemberIdentification:"";let l=new Date(o.Created),N=Math.abs(new Date().getTime()-l.getTime()),ae=Math.floor(N%864e5/36e5),ke=Math.round(N%864e5%36e5/6e4);o.Duration=ae>0?ke+ae*60:ke});else{i.Alias=this.park.GetAlias(i.ParkLabel),i.MemberIdentification=i.MemberIdentification?i.MemberIdentification:"";let o=new Date(i.Created),C=Math.abs(new Date().getTime()-o.getTime()),N=Math.floor(C%864e5/36e5),ae=Math.round(C%864e5%36e5/6e4);i.Duration=N>0?ae+N*60:ae}}),this.groupingLayout()},error:()=>{this._dialogRef.close()}})})}groupingLayout(){this.retreiveMode==1&&(this.Layout=this.Layout.map(t=>{t.List=[];let e=this.parkedOrders.find(i=>i.Group==t.Name);return S.IsNotEmpty(e)?t.List=e.Orders:t.List=[],t}))}remove(t){confirm(`Are you sure you want to ${this.voidEnabled?"void":"delete"} park ${t?.ParkLabel?t?.ParkLabel:""}?`)&&this.delete(t)}delete(t){this._parkedOrderService.removeOrder(t.ID,this.voidEnabled).subscribe({next:e=>{this._toastr.info(this.voidEnabled?"Order "+t.Number+" has been voided":"Order "+t.Number+" has been deleted","Park "+t.ParkLabel+" removed!"),this.getData()},error:e=>{this._toastr.error(e,"Failed to remove "+t.ParkLabel+" !"),this._dialogRef.close({Error:e})}})}clearSelection(){this.retreiveMode==1?this.Layout=this.Layout.map(t=>(t.List=t.List.map(e=>(e.selected=!1,e)),t)):this.parkedOrders=this.parkedOrders.map(t=>(t.selected=!1,t)),this.listMerge=[]}merge(){let t=[];this.listMerge.forEach(e=>{t.push(e.ID)}),this._parkedOrderService.mergePark(t).subscribe({next:e=>{let i=this.listMerge.find(o=>o.ID==e.ID);this.onOrderClicked(i)},error:e=>{this._dialogRef.close({Error:e})}})}onOrderClicked(t){this._OrderHttpService.GetInvoiceBySoID(t.ID).subscribe(e=>{this._orderProcessorService.updatePosState(4),this._orderProcessorService.plainToClass(e,4),this._dialogRef.close(t)})}chooseMerge(t){if(this.listMerge.find(i=>i.Number==t.Number)===void 0)this.listMerge.push(t);else{let i=[];this.listMerge.forEach(o=>{o.Number!=t.Number&&i.push(o)}),this.listMerge=i,this.listMerge[0]===void 0&&(this.listMerge=[])}}static \u0275fac=function(e){return new(e||n)(d(F),d(Dn),d(Ye),d(Oe),d(j),d(B),d(V),d(Y),d(ee),d(me))};static \u0275cmp=P({type:n,selectors:[["POS-modal-retrieve"]],standalone:!1,decls:10,vars:6,consts:[[3,"onCancel","onClose","config"],[1,"container","px-4",2,"max-height","390px","min-height","390px"],["class","search-container mb-6 px-0",4,"ngIf"],["class","mt-6","mat-stretch-tabs","false",4,"ngIf"],["class","container mt-6",4,"ngIf"],[1,"d-flex","justify-content-between","mt-3"],[1,"d-flex","justify-content-end"],["class","btn btn-light-blue text-primary fw-bold me-3",3,"click",4,"ngIf"],[1,"search-container","mb-6","px-0"],["class","merge-indicator",4,"ngIf"],[1,"input-group","mb-3","w-100"],[1,"input-group-text","txtFilter","rounded-start-1"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["type","text","placeholder","Search by number or note","aria-label","Search",1,"txtFilter","form-control","border-start-0","rounded","rounded-start-0",3,"ngModelChange","ngModel"],[1,"merge-indicator"],["class","merge-label",3,"hidden",4,"ngFor","ngForOf"],[1,"merge-label","merge-target"],[1,"merge-label",3,"hidden"],["mat-stretch-tabs","false",1,"mt-6"],["mat-stretch-tabs","false",4,"ngIf"],["mat-stretch-tabs","false"],[4,"ngFor","ngForOf"],["mat-tab-label",""],[1,"container","px-0","mt-5"],[1,"row","dialogPicker","mx-0","mt-2"],[1,"d-flex","flex-column","justify-content-center",2,"height","230px"],[1,"d-flex","align-items-center","gap-3"],[3,"class"],["class","col-3",4,"ngFor","ngForOf"],[1,"col-3"],[1,"card","border-1","position-relative"],[1,"card-body","p-0",3,"click"],[1,"card-title","d-flex","justify-content-between","align-items-center","px-3","pt-3"],[1,"label-title","text-truncate","px-2"],[3,"click",4,"ngIf"],[1,"card-text","card-details","px-4","py-3","d-flex","flex-column"],[1,"flex-grow-1"],[1,"mb-1"],[1,"fa","fa-hashtag","pe-2"],[1,"mb-1","text-muted","small"],[1,"fa-regular","fa-calendar-check","pe-2"],["class","mb-1 text-muted small",4,"ngIf"],["class","text-muted small",4,"ngIf"],[1,"duration-wrapper","d-flex","align-items-center"],[1,"badge","duration-badge",3,"ngClass"],["class","retrieve_checkbox mb-1","type","checkbox",3,"ngModel","ngModelChange","change","click",4,"ngIf"],[3,"click"],[1,"fa","fa-xmark-circle","text-danger-soft"],[1,"fa","fa-user","pe-2"],[1,"text-muted","small"],["type","checkbox",1,"retrieve_checkbox","mb-1",3,"ngModelChange","change","click","ngModel"],[1,"container","mt-6"],[1,"row"],[1,"card","border-0","position-relative"],[1,"fa","fa-xmark-circle","text-dark"],[1,"btn","btn-light-blue","text-primary","fw-bold","me-3",3,"click"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onCancel",function(){return i._dialogRef.close()})("onClose",function(){return i._dialogRef.close()}),r(1,"content")(2,"div",1),g(3,ks,6,2,"div",2)(4,Us,2,1,"div",3)(5,Gs,4,6,"div",4),a()(),r(6,"footer",5)(7,"div",6),g(8,zs,2,0,"a",7)(9,Ks,2,0,"a",7),a()()()),e&2&&(p("config",i.modalConfig),s(3),p("ngIf",i.parkedOrders.length>0||i.retreiveMode==1||i.filterAlwaysVisible),s(),p("ngIf",i.retreiveMode==1),s(),p("ngIf",i.retreiveMode==0),s(3),p("ngIf",i.listMerge.length>1),s(),p("ngIf",i.listMerge.length>1))},dependencies:[U,_e,$,te,ht,K,ie,Q,Mi,St,yt,br,We,Di,dr],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}.nofocus[_ngcontent-%COMP%]:focus{outline:none!important}@media (min-width: 576px){.merge-indicator[_ngcontent-%COMP%]{display:flex;align-items:center;flex-wrap:wrap;gap:.5rem;font-weight:600;padding:.5rem 1rem;border-radius:.5rem;background-color:#f0f4e4;color:#55600b;border:1px solid #d1e3b0;margin-bottom:1rem;font-size:.75rem;box-shadow:0 2px 6px #0000000a}}.merge-indicator[_ngcontent-%COMP%] .merge-label[_ngcontent-%COMP%]{background-color:#d6e9c6;color:#3c763d;padding:.35rem .75rem;border-radius:999px;font-size:.75rem;font-weight:500}.merge-indicator[_ngcontent-%COMP%] .merge-target[_ngcontent-%COMP%]{font-weight:700;color:#4a4f00;font-size:.75rem}.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}.col-3[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap!important}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]{width:180px;height:160px;margin-right:17px;margin-bottom:17px;position:relative;cursor:pointer;transition:all .3s cubic-bezier(.25,.8,.25,1);border-radius:8px;overflow:hidden;background:#fff;box-shadow:0 2px 10px #0000001a;border-left:4px solid #f0f0f0;display:flex;flex-direction:column}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]{display:flex;outline:1px solid transparent;border-radius:5px;flex:1 1 auto;flex-direction:column;justify-content:space-between}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{height:30px;border-radius:4px 4px 0 0;padding:5px 10px;color:#000;background:#e0e4dc;overflow:hidden;transition:all .3s ease;border-bottom:1px solid #e9ecef}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{margin-right:5px;transition:color .3s ease}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] .card-details[_ngcontent-%COMP%]{font-size:.875rem;line-height:2;color:#333;padding:8px 12px;flex-grow:1;display:flex;flex-direction:column}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover{transform:translateY(-3px);box-shadow:0 5px 15px #00000026;border-left:6px solid #84cc16}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover h5.card-title[_ngcontent-%COMP%]{background:#84cc16}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover .label-title[_ngcontent-%COMP%]{color:#fff!important}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover .fa-xmark-circle[_ngcontent-%COMP%]{color:#c0392b!important}.col-3[_ngcontent-%COMP%] .card.selected[_ngcontent-%COMP%]{background-color:#f8fff0;box-shadow:0 0 0 1px #89b03e4d;border-left:6px solid #84cc16;border-right:1px solid #e0f0d0;border-top:1px solid #e0f0d0;border-bottom:1px solid #e0f0d0}.col-3[_ngcontent-%COMP%] .card.selected[_ngcontent-%COMP%] h5.card-title[_ngcontent-%COMP%]{background:#84cc16}.col-3[_ngcontent-%COMP%] .card.selected[_ngcontent-%COMP%] .label-title[_ngcontent-%COMP%]{color:#fff!important;font-weight:500}.col-3[_ngcontent-%COMP%] .card.selected[_ngcontent-%COMP%] .fa-xmark-circle[_ngcontent-%COMP%]{color:#e74c3c!important;border-radius:50%}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .fa-xmark-circle[_ngcontent-%COMP%]{color:#e74c3c!important;transition:all .3s ease;font-size:1.2em;padding:2px}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .fa-xmark-circle[_ngcontent-%COMP%]:hover{color:#c0392b!important;background:#e74c3c1a;border-radius:50%;transform:scale(1.1)}.duration-badge[_ngcontent-%COMP%]{padding:.35rem .75rem;border-radius:1rem;font-weight:500;font-size:.65rem;display:inline-block;border-left:5px solid transparent}.duration-green[_ngcontent-%COMP%]{border-left-color:#4caf50;background-color:#d4edda;color:#155724}.duration-yellow[_ngcontent-%COMP%]{border-left-color:#ffc107;background-color:#fff3cd;color:#856404}.duration-red[_ngcontent-%COMP%]{border-left-color:#c82333;background-color:#f8d7da;color:#721c24}.duration-wrapper[_ngcontent-%COMP%]{margin-top:auto;margin-bottom:.25rem}.label-title[_ngcontent-%COMP%]{color:#000;transition:color .3s ease;font-weight:650!important;font-size:.75rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.card[_ngcontent-%COMP%]:hover .label-title[_ngcontent-%COMP%], .card.selected[_ngcontent-%COMP%] .label-title[_ngcontent-%COMP%]{color:#fff!important} .mat-tab-group .mat-tab-label-active{background-color:#84cc16!important;color:#fff!important;border-radius:.25rem .25rem 0 0;font-weight:700}.modal-footer-custom[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:1rem;padding-top:1rem}.modal-footer-custom[_ngcontent-%COMP%] .btn-retrieve[_ngcontent-%COMP%], .modal-footer-custom[_ngcontent-%COMP%] .btn-cancel[_ngcontent-%COMP%]{background-color:#c5dcff;color:#0b5ed7;font-weight:600;border:none;border-radius:.3rem;padding:.5rem 1.25rem;transition:background-color .2s ease-in-out}.modal-footer-custom[_ngcontent-%COMP%] .btn-retrieve[_ngcontent-%COMP%]:hover, .modal-footer-custom[_ngcontent-%COMP%] .btn-cancel[_ngcontent-%COMP%]:hover{background-color:#b5cfee}[_nghost-%COMP%] .mat-mdc-tab-group[_ngcontent-%COMP%]{--mdc-tab-indicator-active-indicator-color: #89b03e;--mat-tab-header-focus-indicator-color: #89b03e;--mat-tab-header-focus-label-text-color: var(--bs-body-color);--mat-tab-header-active-label-text-color: var(--bs-body-color);--mat-tab-header-active-focus-label-text-color: var(--bs-body-color);--mat-tab-header-active-hover-label-text-color: var(--bs-body-color);--mat-tab-header-active-focus-indicator-color: #89b03e;--mat-tab-header-active-hover-indicator-color: #89b03e}[_nghost-%COMP%] .mat-mdc-tab-header{border-bottom:1px solid var(--bs-border-color)}.retrieve_checkbox[_ngcontent-%COMP%]{position:absolute;bottom:8px;right:8px;z-index:10;width:20px;height:20px;cursor:pointer;accent-color:#84cc16}.retrieve_checkbox[_ngcontent-%COMP%]:checked{animation:pulse .3s ease}"]})};var ga=[{name:"Order",menus:[{label:"Retrieve",class:"fa-solid fa-box fs-2",action:"RETRIEVE",cy:"retrieve-act",description:"You need \u2018Retrieve\u2019 role to access this function"},{label:"Return",class:"fa-regular fa-cart-arrow-up fs-3",action:"RETURN",cy:"return-act",description:"You need \u2018Return\u2019 role to access this function"},{label:"Fulfillment",class:"fa-solid fa-truck fs-2",action:"FULFILLMENT",cy:"fulfillment-act",description:"You need \u2018Fulfillment\u2019 role to access this function"}],children:[{name:"Promotion",menus:[{label:"Event",class:"fa-solid fa-gift fs-2",action:"PROMOTION"},{label:"Coupon",class:"fa-regular fa-ticket fs-2",action:"COUPON",cy:"coupon-act"}]}]},{name:"Item",menus:[{label:"Add",class:"fa-circle-plus fa-solid fs-2",action:"ADD_ITEM"},{label:"Serial",class:"fa-barcode-read fa-solid fs-2",action:"SERIAL"},{label:"Upload",class:"fa-solid fa-upload fs-2",action:"UPLOAD"},{label:"Clear",class:"fa-solid fa-trash fs-3",action:"CLEAR"}]},{name:"Bill",menus:[{label:"Print",class:"fa-print fa-solid fs-2",action:"PRINT"},{label:"Split",class:"fa-solid fa-split fs-2",action:"SPLIT"},{label:"Cancel Split",class:"fa-solid fa-xmark fs-2",action:"CANCEL"}]},{name:"Advanced",menus:[{label:"Customer Display",class:"fa-display fa-regular fs-3",action:"CUSTOMER_DISPLAY"},{label:"Order Display",class:"fa-solid fa-clipboard-list fs-3",action:"ODS_CONFIG"},{label:"Validate Inventory",class:"fa-archive fa-solid fs-3",action:"INVENTORY"},{label:"Disable Sort",class:"fa-sort fa-solid fs-3",action:"SORT"},{label:"ECR",class:"fa-solid fa-mobile-signal-out fs-3",action:"ECR"}]}];var kn=class{OrderID;ParkLabel;Items};var Ys=n=>({"no-border":n});function Xs(n,t){if(n&1){let e=v();r(0,"tr",14)(1,"td"),m(2),a(),r(3,"td"),m(4),b(5,"number"),a(),r(6,"td")(7,"div",15)(8,"button",16),_("click",function(){let o=u(e).index,l=c();return f(l.onRemoveQuantity(o))}),m(9,"-"),a(),r(10,"input",17),w("ngModelChange",function(o){let l=u(e).$implicit;return D(l.SplitQuantity,o)||(l.SplitQuantity=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onSplitedQuantityChange())}),a(),r(11,"button",18),_("click",function(){let o=u(e).index,l=c();return f(l.onAddQuantity(o))}),m(12,"+"),a()()(),r(13,"td",19),m(14),b(15,"number"),a()()}if(n&2){let e=t.$implicit,i=t.index,o=c();p("ngClass",E(11,Ys,i==(o.cartItems==null?null:o.cartItems.length)-1)),s(2),T(e==null||e.Variant==null?null:e.Variant.Name),s(2),T(O(5,7,e==null?null:e.Price)),s(6),M("ngModel",e.SplitQuantity),p("max",e.Quantity)("min",0),s(4),T(O(15,9,e==null?null:e.Quantity))}}var Tn=class n{constructor(t,e,i,o,l,C){this.dialogRef=t;this.salesOrderDataService=e;this.parkService=i;this.orderProcessorService=o;this.toastr=l;this.calculatorService=C;let N=this.salesOrderDataService?.Data?.CartItems;this.cartItems=ot(Be,N),this.salesOrderData=ot(mt,this.salesOrderDataService.Data),this.currencySymbol=this.calculatorService.currencySymbol}modalConfig=new W;splitData;cartItems;parkLabel;splitPriceTotal;currencySymbol;salesOrderData;ngOnInit(){this.initModalConfig(),this.initItemsSplitQty()}initModalConfig(){this.modalConfig.title="Split Order",this.modalConfig.okText="Split",this.modalConfig.cancelText="Cancel",this.modalConfig.customWidth="725px"}initItemsSplitQty(){this.cartItems=this.cartItems.map(t=>(t.SplitQuantity=0,t))}onOk(){this.generateSplitData(),this.parkService.splitOrder(this.splitData).subscribe(t=>{this.salesOrderData.CartItems=this.cartItems,this.salesOrderData.Order.ParkLabel=this.parkLabel,this.salesOrderDataService.pushNewValue(this.salesOrderData),this.toastr.success("Split order successfully","Success"),this.orderProcessorService.updatePosState(5),this.orderProcessorService.createNewTransactionInSameOutletRegister(),this.onClose()})}generateSplitData(){this.splitData=new kn,this.splitData.OrderID=this.salesOrderDataService?.Data?.Order?.ID,this.splitData.ParkLabel=this.parkLabel,this.splitData.Items=this.cartItems.map(t=>({ID:t.ID,Quantity:t.SplitQuantity}))}onSplitedQuantityChange(){this.splitPriceTotal=this.cartItems.map(t=>t.SplitQuantity?t.SplitQuantity:0).reduce((t,e,i)=>t+e*this.cartItems[i]?.Price,0)}onAddQuantity(t){this.cartItems=this.cartItems.map((e,i)=>(i==t&&e.SplitQuantity<e.Quantity&&(e.SplitQuantity+=1),e)),this.onSplitedQuantityChange()}onRemoveQuantity(t){this.cartItems=this.cartItems.map((e,i)=>(i==t&&e.SplitQuantity>0&&(e.SplitQuantity-=1),e)),this.onSplitedQuantityChange()}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(F),d(V),d(we),d(j),d(ee),d(Pe))};static \u0275cmp=P({type:n,selectors:[["app-modal-split"]],features:[st([we])],decls:26,vars:7,consts:[[3,"onOk","onClose","onCancel","config"],[1,"container","py-4"],[1,"row"],[1,"col-12"],[1,"mb-8"],["type","text","placeholder","Type park label (Optional)",1,"form-control","rounded-1","p-4","fs-5",3,"ngModelChange","ngModel"],[1,"d-flex","align-items-center","justify-content-between","border","p-4","rounded-1",2,"background","whitesmoke"],[1,"fs-5","fw-bold"],[1,"fs-5"],[1,"table","table-secondary","mt-10"],[1,"table-light"],[1,"text-center",2,"width","116px"],[1,"text-end",2,"width","65px"],[3,"ngClass",4,"ngFor","ngForOf"],[3,"ngClass"],[1,"input-group","mb-3"],["type","button",1,"btn","btn-danger","btn-sm","border-end-0",3,"click"],["type","text","autoNum","",1,"form-control","text-center",3,"ngModelChange","ngModel","max","min"],["type","button",1,"btn","btn-success","btn-sm","border-start-0",3,"click"],[1,"text-end"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.onOk()})("onClose",function(){return i.onClose()})("onCancel",function(){return i.onClose()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"div",4)(6,"input",5),w("ngModelChange",function(l){return D(i.parkLabel,l)||(i.parkLabel=l),l}),a()(),r(7,"div",6)(8,"div",7),m(9,"Splitted Amount"),a(),r(10,"div",8),m(11),b(12,"number"),a()(),r(13,"table",9)(14,"thead",10)(15,"tr")(16,"th"),m(17,"Name"),a(),r(18,"th"),m(19,"Price"),a(),r(20,"th",11),m(21,"Qty Split"),a(),r(22,"th",12),m(23,"Qty"),a()()(),r(24,"tbody"),g(25,Xs,16,13,"tr",13),a()()()()()()()),e&2&&(p("config",i.modalConfig),s(6),M("ngModel",i.parkLabel),s(5),Ue("",i.currencySymbol," ",i.splitPriceTotal?O(12,5,i.splitPriceTotal):0,""),s(14),p("ngForOf",i.cartItems))},dependencies:[Z,U,_e,X,Ae,Q,ut,pt,Ce,te,K,ie,na],styles:["table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{line-height:10px}td[_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}table[_ngcontent-%COMP%] tbody[_ngcontent-%COMP%] tr.no-border[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-bottom:0px!important}"]})};var En=class n{constructor(t,e){this.data=t;this._dialogRef=e;this.message=t.message,this.initModal()}modalConfig=new W;message;initModal(){this.modalConfig.title=this.data.title,this.modalConfig.headerType=Le.Success,this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0,this.modalConfig.hideFooter=!0}close(){this._dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(Ve),d(F))};static \u0275cmp=P({type:n,selectors:[["POS-modal-info"]],standalone:!1,decls:4,vars:2,consts:[[3,"onCancel","onClose","config"],[1,"fw-normal","d-flex","justify-content-center"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"h4",1),m(3),a()()()),e&2&&(p("config",i.modalConfig),s(3),T(i.message))},dependencies:[Q],encapsulation:2})};var Rn=class{constructor(){this.modalConfig.title="Adding new items to order",this.modalConfig.bodyScrollable=!0,this.modalConfig.customWidth="700px",this.modalConfig.noPadding=!0,this.onHand=0,this.allocated=0,this.pricebookDisabled=!0}modalConfig=new W;cartItem=new Be;role;isSerialItem=!1;priceVisible;unitPriceEditor;pricebookSelector;pricebookCopyDesc;calculatorQtyDisabled;calculatorPriceDisabled;productCalculator=H(!0);serials=[];numpadVisible;editingItemPromotionVisible;keyboard;statusModal;isEmptySalesID;pricebookDisabled;queryInventoryOnOpen;pricebookId;oriUnitPrice;oriDiscount;entities;onHand;allocated;costVisible=!1;unitQtyLabel="Unit Quantity";sales;initialSerial;quantityToOneInDialog;splitDeliveryOutletEnabled;hasInventoryView;enabledEditCost=H(!1);mapAppConfigJson(t){this.numpadVisible=t.ModuleSell.NumPadVisible,this.pricebookCopyDesc=t.ModuleSell.Pricebook?.PricebookVisible,this.queryInventoryOnOpen=!1,this.quantityToOneInDialog=t.ModuleSell.ProductDialog?.QuantityToOneInDialog,this.unitQtyLabel=t.ModuleSell.ProductDialog?.UnitQtyLabel,this.splitDeliveryOutletEnabled=t.ModuleSell.ProductDialog?.SplitDeliveryOutletEnabled,this.editingItemPromotionVisible=t.ModuleSell.Promotion?.EditingItemPromotionVisible,this.productCalculator.set(t.ModuleSell?.ProductDialog?.ProductCalculator)}isSerial(){return this.cartItem.Variant!=null?this.cartItem.Variant.TypeID==4:!1}setUserRole(t){this.role=t,this.unitPriceEditor=this.role.UnitPriceEditor,this.priceVisible=this.role.PriceVisible,this.pricebookSelector=this.role.PricebookSelector,this.hasInventoryView=this.role.InventoryView}};var uo=(l=>(l[l.SELL_INPUT=0]="SELL_INPUT",l[l.DISCOUNT=1]="DISCOUNT",l[l.PRODUCT=2]="PRODUCT",l[l.SERIAL=3]="SERIAL",l[l.CALCULATOR=4]="CALCULATOR",l))(uo||{});var Zs=(n,t)=>({"tooltip-container-bottom":n,"tooltip-container-top":t});function ec(n,t){n&1&&mi(0)}var Nn=class n{text;position;content;static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["POS-tooltip"]],inputs:{text:"text",position:"position",content:"content"},standalone:!1,decls:3,vars:6,consts:[[3,"ngClass"],[4,"ngTemplateOutlet"]],template:function(e,i){e&1&&(r(0,"div",0),m(1),g(2,ec,1,0,"ng-container",1),a()),e&2&&(p("ngClass",ge(3,Zs,i.position=="top"||!i.position,i.position=="bottom")),s(),y(" ",i.text," "),s(),p("ngTemplateOutlet",i.content))},dependencies:[U,Pi],styles:['.tooltip-container-top[_ngcontent-%COMP%]{box-shadow:0 0 5px #0003;margin:.7rem 1rem 1rem;min-width:50px;max-width:400px;background:#fff;border:1px solid #ccc;pointer-events:none;position:relative;min-height:1rem;padding:.5rem;border-radius:4px}.tooltip-container-top[_ngcontent-%COMP%]:after, .tooltip-container-top[_ngcontent-%COMP%]:before{content:"";display:block;position:absolute;bottom:100%;width:0;height:0;border-style:solid}.tooltip-container-top[_ngcontent-%COMP%]:after{left:calc(49% + 2px);border-color:transparent transparent #fff transparent;border-width:6px}.tooltip-container-top[_ngcontent-%COMP%]:before{left:49%;border-color:transparent transparent #ccc transparent;border-width:8px}.tooltip-container-bottom[_ngcontent-%COMP%]{box-shadow:0 0 5px #0003;margin:.7rem 1rem 1rem;min-width:50px;max-width:400px;background:#fff;border:1px solid #ccc;pointer-events:none;position:relative;min-height:1rem;padding:.5rem;border-radius:4px}.tooltip-container-bottom[_ngcontent-%COMP%]:after, .tooltip-container-bottom[_ngcontent-%COMP%]:before{content:"";display:block;position:absolute;bottom:100%;width:0;height:0;border-style:solid}.tooltip-container-bottom[_ngcontent-%COMP%]:after{left:calc(40% + 2px);border-color:#fff transparent transparent transparent;border-width:6px;top:100%}.tooltip-container-bottom[_ngcontent-%COMP%]:before{left:40%;border-color:#ccc transparent transparent transparent;border-width:8px;top:100%}']})};var Vn=class n{constructor(t,e,i){this.overlayPositionBuilder=t;this.elementRef=e;this.overlay=i}content;position;overlayRef;ngOnInit(){let t=this.initPosition(),e=this.overlayPositionBuilder.flexibleConnectedTo(this.elementRef).withPositions([t]);this.overlayRef=this.overlay.create({positionStrategy:e})}initPosition(){let t={originX:"center",originY:"bottom",overlayX:"center",overlayY:"top"};switch(this.position){case"top":t={originX:"center",originY:"top",overlayX:"center",overlayY:"bottom"};break}return t}show(){if(this.content){this.overlayRef.detach();let t=new Yo(Nn),e=this.overlayRef.attach(t);typeof this.content=="string"?e.instance.text=this.content:e.instance.content=this.content,e.instance.position=this.position}}hide(){this.overlayRef.detach()}static \u0275fac=function(e){return new(e||n)(d(Xo),d(Po),d(Zo))};static \u0275dir=Ii({type:n,selectors:[["","customTooltip",""]],hostBindings:function(e,i){e&1&&_("mouseenter",function(){return i.show()})("mouseleave",function(){return i.hide()})},inputs:{content:[0,"customTooltip","content"],position:"position"},standalone:!1})};var nc=["quantity"],oc=["price"],rc=["discount"],ac=["unitCost"],Si=n=>({selected:n}),ba=n=>({"mt-8":n}),_a=n=>({"qtyBtn-disabled":n}),lc=()=>["/menu/Products/Catalog/Variants/Info"],sc=n=>({ID:n}),Ca=(n,t)=>({"d-none":n,"d-block":t});function cc(n,t){if(n&1){let e=v();r(0,"a",15),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalItemState.PRODUCT))}),m(1," Product "),a()}if(n&2){let e=c();p("ngClass",E(1,Si,e.modalItemState.PRODUCT==e.currentState))}}function pc(n,t){if(n&1){let e=v();r(0,"a",22),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalItemState.SERIAL))}),m(1," Serial "),a()}if(n&2){let e=c();p("ngClass",E(1,Si,e.modalItemState.SERIAL==e.currentState))}}function mc(n,t){if(n&1){let e=v();r(0,"a",22),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalItemState.CALCULATOR))}),m(1," Calculator "),a()}if(n&2){let e=c();p("ngClass",E(1,Si,e.modalItemState.CALCULATOR==e.currentState))}}function dc(n,t){if(n&1&&(r(0,"div",34)(1,"div",35)(2,"div"),m(3),a(),r(4,"small",36),m(5),a()()()),n&2){let e=t.data;s(3),T(e==null?null:e.Value),s(2),T(e==null?null:e.Code)}}function uc(n,t){if(n&1){let e=v();x(0),r(1,"div",31)(2,"div",32)(3,"autocompleteV2",33,0),_("onSelect",function(o){u(e);let l=c(2);return f(l.onAddItem(o))})("onInputEnter",function(o){u(e);let l=c(2);return f(l.onEnterProductCode(o))}),a(),g(5,dc,6,2,"ng-template",null,1,G),a()(),I()}if(n&2){let e=q(6),i=c(2);s(3),p("localStorage","products")("renderThumbnail",!0)("inputTextValue",i.cartItem==null||i.cartItem.Variant==null?null:i.cartItem.Variant.Name)("clearOnSelect",!1)("useCustomTemplate",!0)("itemTemplate",e)}}function fc(n,t){n&1&&(r(0,"div",24)(1,"div",37),m(2," Edit Prepaid Package Quantity is disabled during EDIT MODE "),a(),r(3,"div"),m(4," If you make a mistake, please delete the item and then add again "),a()())}function gc(n,t){if(n&1&&(r(0,"span"),m(1),a()),n&2){let e=c(3);s(),y("(",e.cartItem.Variant==null?null:e.cartItem.Variant.UOMName,")")}}function _c(n,t){if(n&1){let e=v();r(0,"div",48)(1,"strong")(2,"span"),m(3),a()(),r(4,"input",49),w("ngModelChange",function(o){u(e);let l=c(3);return D(l.cartItem.UnitQuantity,o)||(l.cartItem.UnitQuantity=o),f(o)}),a()()}if(n&2){let e=c(3);s(3),T(e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.ProductDialog==null?null:e.AppConfigJSON.ModuleSell.ProductDialog.UnitQtyLabel),s(),p("preventNegative",!0)("readOnly",(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)("decimalPlaces",e.isSerialItem?0:e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.ProductDialog==null?null:e.AppConfigJSON.ModuleSell.ProductDialog.DecimalPlaceDigit),M("ngModel",e.cartItem.UnitQuantity)}}function Cc(n,t){if(n&1&&(h(0,"input",50,4),b(2,"number")),n&2){let e=c(3);p("value",O(2,1,e.cartItem.Price))}}function hc(n,t){if(n&1){let e=v();r(0,"input",51,4),w("ngModelChange",function(o){u(e);let l=c(3);return D(l.cartItem.Price,o)||(l.cartItem.Price=o),f(o)}),a()}if(n&2){let e=c(3);p("simpleKeyboard",e.keyboard)("readonly",!e.unitPriceEditor||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible),M("ngModel",e.cartItem.Price)}}function bc(n,t){if(n&1&&(r(0,"div",47)(1,"span",52),m(2),a()()),n&2){let e,i=c(3);s(2),y("Pricebook ",(e=i.selectedPriceBook())==null?null:e.Name," is applied")}}function vc(n,t){if(n&1){let e=v();r(0,"div",38)(1,"div",39)(2,"strong"),m(3," Qty "),g(4,gc,2,1,"span",20),a(),r(5,"div",40)(6,"button",41),_("click",function(){u(e);let o=c(2);return f(o.updateItemQuantity(o.cartItem.Quantity!=null?o.cartItem.Quantity-1:0))}),m(7," - "),a(),r(8,"input",42,2),_("ngModelChange",function(o){u(e);let l=c(2);return f(l.updateItemQuantity(o))}),a(),r(10,"button",43),_("click",function(){u(e);let o=c(2);return f(o.updateItemQuantity(o.cartItem.Quantity!=null?o.cartItem.Quantity+1:1))}),m(11," + "),a()()(),g(12,_c,5,5,"div",44),r(13,"div",45)(14,"strong"),m(15,"Price"),a(),g(16,Cc,3,3,"input",46)(17,hc,2,3,"ng-template",null,3,G),a(),g(19,bc,3,1,"div",47),a()}if(n&2){let e=q(18),i=c(2);p("ngClass",E(16,ba,i.statusModal=="create")),s(4),p("ngIf",(i.cartItem.Variant==null?null:i.cartItem.Variant.UOM)&&(i.cartItem.Variant==null?null:i.cartItem.Variant.UOMName)),s(2),p("ngClass",E(18,_a,(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible||i.checkQtyInputDisabled()))("disabled",(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible||i.checkQtyInputDisabled()||i.isSellEdit()&&i.isPrepaidPackage()),s(2),p("simpleKeyboard",i.keyboard)("preventNegative",!i.role.Return)("decimalPlaces",i.isSerialItem?0:i.AppConfigJSON==null||i.AppConfigJSON.ModuleSell==null||i.AppConfigJSON.ModuleSell.ProductDialog==null?null:i.AppConfigJSON.ModuleSell.ProductDialog.DecimalPlaceDigit)("ngModel",i.cartItem.Quantity)("disabled",(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible||i.checkQtyInputDisabled()||i.isSellEdit()&&i.isPrepaidPackage()),s(2),p("ngClass",E(20,_a,(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible||i.checkQtyInputDisabled()))("disabled",(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible||i.checkQtyInputDisabled()||i.isSellEdit()&&i.isPrepaidPackage()),s(2),p("ngIf",i.AppConfigJSON.ModuleSell==null||i.AppConfigJSON.ModuleSell.ProductDialog==null?null:i.AppConfigJSON.ModuleSell.ProductDialog.UnitQtyLabel),s(),p("hidden",!i.priceVisible),s(3),p("ngIf",!i.unitPriceEditor||(i.cartItem==null?null:i.cartItem.PromotionGift)&&!i.editingItemPromotionVisible)("ngIfElse",e),s(3),R(i.selectedPriceBook()?19:-1)}}function Sc(n,t){if(n&1){let e=v();x(0),r(1,"div",53)(2,"strong"),m(3,"Sales Person"),a(),r(4,"ng-select-infinite",54),_("selectedChange",function(o){u(e);let l=c(2);return f(l.updateSales(o))}),w("selectedChange",function(o){u(e);let l=c(2);return D(l.cartItem.SalesID,o)||(l.cartItem.SalesID=o),f(o)}),a()(),I()}if(n&2){let e=c(2);s(4),p("customTooltip",e.salesPersonName)("items",e.sales),M("selected",e.cartItem.SalesID)}}function yc(n,t){if(n&1){let e=v();r(0,"div",53)(1,"strong"),m(2,"Fulfillment From"),a(),r(3,"ng-select",55),_("ngModelChange",function(){u(e);let o=c(2);return f(o.onDeliveryEntityChange())}),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.cartItem.EntityID,o)||(l.cartItem.EntityID=o),f(o)}),a()()}if(n&2){let e=c(2);s(3),p("items",e.entities),M("ngModel",e.cartItem.EntityID)}}function xc(n,t){if(n&1){let e=v();x(0),r(1,"div",23),g(2,uc,7,6,"ng-container",20)(3,fc,5,0,"div",24)(4,vc,20,22,"div",25),r(5,"div",26),g(6,Sc,5,3,"ng-container",20)(7,yc,4,2,"div",27),a(),r(8,"div",28)(9,"div",29)(10,"POS-tinymce-editor",30),w("ngModelChange",function(o){u(e);let l=c();return D(l.cartItem.Note,o)||(l.cartItem.Note=o),f(o)}),a()()()(),I()}if(n&2){let e=c();s(2),p("ngIf",e.statusModal==="create"),s(),R(e.isSellEdit()&&e.isPrepaidPackage()?3:-1),s(),p("ngIf",e.cartItem),s(2),p("ngIf",e.isEmptySalesID&&(e.sales==null?null:e.sales.length)>0&&e.role.SalesPerson),s(),p("ngIf",(e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.ProductDialog==null?null:e.AppConfigJSON.ModuleSell.ProductDialog.SplitDeliveryOutletEnabled)&&e.salesOrderData.Order.DeliveryStateID==1),s(3),M("ngModel",e.cartItem.Note)}}function Ic(n,t){if(n&1&&(h(0,"input",50),b(1,"number")),n&2){let e=c(2);p("value",O(1,1,e.cartItem.Discount))}}function Oc(n,t){if(n&1){let e=v();r(0,"input",76,7),_("ngModelChange",function(o){u(e);let l=c(2);return f(l.updateDiscountPercentage(o))}),a()}if(n&2){let e=c(2);p("simpleKeyboard",e.keyboard)("ngModel",e.cartItem.Discount)("preventNegative",!0)("readonly",!e.role.Discount||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)}}function Pc(n,t){if(n&1&&(h(0,"input",50),b(1,"number")),n&2){let e=c(2);p("value",O(1,1,e.inputedDiscountAmount))}}function Mc(n,t){if(n&1){let e=v();r(0,"input",77,6),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.inputedDiscountAmount,o)||(l.inputedDiscountAmount=o),f(o)}),_("ngModelChange",function(o){u(e);let l=c(2);return f(l.onDiscountAmountChange(o))}),a()}if(n&2){let e=c(2);p("max",e.cartItem==null?null:e.cartItem.GrossTotal)("simpleKeyboard",e.keyboard),M("ngModel",e.inputedDiscountAmount),p("preventNegative",!0)("readonly",!e.role.Discount||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)}}function Dc(n,t){if(n&1&&(x(0),r(1,"div",61)(2,"div",58)(3,"strong"),m(4,"Discount Amount / Qty"),a()(),r(5,"div",59)(6,"div",78)(7,"p"),m(8),b(9,"number"),a()()()(),I()),n&2){let e=c(2);s(8),T(O(9,1,e.cartItem.DiscountAmount))}}function wc(n,t){if(n&1){let e=v();x(0),r(1,"div",61)(2,"div",58)(3,"strong"),m(4,"Pricebook"),a()(),r(5,"div",59)(6,"ng-select",79),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.pricebookId,o)||(l.pricebookId=o),f(o)}),_("ngModelChange",function(){u(e);let o=c(2);return f(o.pricebookChange())})("clear",function(){u(e);let o=c(2);return f(o.onClearPricebook())}),a()()(),I()}if(n&2){let e=c(2);s(6),p("items",e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.PriceBook),M("ngModel",e.pricebookId),p("disabled",e.pricebookDisabled)}}function kc(n,t){if(n&1&&(x(0),r(1,"div",80)(2,"h5",81),m(3),b(4,"number"),a()(),I()),n&2){let e=c(2);s(3),y(" ",O(4,1,e.cartItem.Discount),"% ")}}function Tc(n,t){if(n&1&&(x(0),r(1,"div",82)(2,"h5"),m(3),b(4,"number"),a(),r(5,"span",73),m(6,"x"),a(),r(7,"h5"),m(8),b(9,"number"),a()(),I()),n&2){let e=c(2);s(3),T(O(4,2,e.cartItem.Quantity)),s(5),T(O(9,4,e.cartItem.DiscountAmount))}}function Ec(n,t){if(n&1&&(x(0),r(1,"h5",83),m(2),b(3,"number"),a(),I()),n&2){let e=c(2);s(2),y(" -",O(3,1,(e.cartItem==null?null:e.cartItem.GrossTotal)*(e.cartItem.Discount/100))," ")}}function Rc(n,t){if(n&1&&(x(0),r(1,"div",75)(2,"h5",83),m(3),b(4,"number"),a()(),I()),n&2){let e=c(2);s(3),y(" -",O(4,1,e.cartItem.Quantity*e.cartItem.DiscountAmount)," ")}}function Nc(n,t){if(n&1&&(x(0),r(1,"div",84)(2,"div",85)(3,"h5"),m(4,"Grand Total"),a()(),r(5,"div",85)(6,"h5"),m(7),b(8,"number"),a()()(),I()),n&2){let e=c(2);s(7),T(O(8,1,e.cartItem.Total))}}function Vc(n,t){if(n&1){let e=v();x(0),r(1,"div",31)(2,"div",56)(3,"div",57)(4,"div",58)(5,"strong"),m(6,"Discount %"),a()(),r(7,"div",59)(8,"div",60),g(9,Ic,2,3,"input",46)(10,Oc,2,4,"ng-template",null,5,G),a()()(),r(12,"div",61)(13,"div",58)(14,"strong"),m(15,"Discount Amount"),a()(),r(16,"div",59)(17,"div",60),g(18,Pc,2,3,"input",46)(19,Mc,2,5,"ng-template",null,6,G),a()()(),r(21,"div",62)(22,"div",63)(23,"input",64),w("ngModelChange",function(o){u(e);let l=c();return D(l.isDiscMultipliciedQty,o)||(l.isDiscMultipliciedQty=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onSwitchToggleDiscount())}),a()(),r(24,"div",65)(25,"strong"),m(26,"*Quantity"),a(),r(27,"span",66),h(28,"i",67),a()()(),g(29,Dc,10,3,"ng-container",20)(30,wc,7,3,"ng-container",20),a(),r(31,"div",68)(32,"div",69)(33,"h4"),m(34,"Discount Simulation"),a(),r(35,"h4",70),m(36),a()(),r(37,"div",71)(38,"div",58)(39,"div",72)(40,"h5"),m(41),b(42,"number"),a(),r(43,"span",73),m(44,"x"),a(),r(45,"h5"),m(46),b(47,"number"),a()(),g(48,kc,5,3,"ng-container",20)(49,Tc,10,6,"ng-container",20),a(),r(50,"div",58)(51,"div",74)(52,"h5"),m(53),b(54,"number"),a()(),r(55,"div",75),g(56,Ec,4,3,"ng-container",20),a(),g(57,Rc,5,3,"ng-container",20),a(),g(58,Nc,9,3,"ng-container",20),a()()(),I()}if(n&2){let e=q(11),i=q(20),o=c();s(9),p("ngIf",!o.role.Discount||(o.cartItem==null?null:o.cartItem.PromotionGift)&&!o.editingItemPromotionVisible)("ngIfElse",e),s(9),p("ngIf",!o.role.Discount||(o.cartItem==null?null:o.cartItem.PromotionGift)&&!o.editingItemPromotionVisible)("ngIfElse",i),s(5),M("ngModel",o.isDiscMultipliciedQty),s(6),p("ngIf",!o.isDiscMultipliciedQty),s(),p("ngIf",o.cartItem.Variant!=null&&(o.cartItem==null||o.cartItem.Variant==null?null:o.cartItem.Variant.PriceBook)&&(o.cartItem==null||o.cartItem.Variant==null?null:o.cartItem.Variant.PriceBook.length)>0),s(6),y(" ",o.cartItem==null||o.cartItem.Variant==null?null:o.cartItem.Variant.Name," "),s(5),T(O(42,16,o.cartItem.Quantity)),s(5),T(O(47,18,o.cartItem.Price)),s(2),p("ngIf",o.cartItem.Discount),s(),p("ngIf",o.cartItem.DiscountAmount>0),s(4),T(O(54,20,o.cartItem==null?null:o.cartItem.GrossTotal)),s(3),p("ngIf",o.cartItem.Discount),s(),p("ngIf",o.cartItem.DiscountAmount>0),s(),p("ngIf",o.cartItem.DiscountAmount>0||o.cartItem.Discount>0)}}function Ac(n,t){n&1&&(x(0),r(1,"div",100),h(2,"i",101),r(3,"h6"),m(4,"No Image"),a()(),I())}function Lc(n,t){if(n&1&&h(0,"img",102),n&2){let e=c(2);p("src",e.cartItem.Variant.ThumbnailUrl,tt)}}function Bc(n,t){if(n&1){let e=v();r(0,"div")(1,"a",109),_("click",function(){u(e);let o=c(3);return f(o.onEditCost())}),h(2,"i",110),a()()}}function Fc(n,t){if(n&1){let e=v();r(0,"tr")(1,"th",103),m(2," Cost "),a(),r(3,"td",104)(4,"div",105)(5,"div",106)(6,"input",107,9),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.cartItem.Cost,o)||(l.cartItem.Cost=o),f(o)}),a()(),r(8,"div",108),m(9),b(10,"number"),a(),g(11,Bc,3,0,"div"),a()()()}if(n&2){let e=c(2);s(5),p("ngClass",ge(8,Ca,!e.enabledEditCost(),e.enabledEditCost())),s(),M("ngModel",e.cartItem.Cost),s(2),p("ngClass",ge(11,Ca,e.enabledEditCost(),!e.enabledEditCost())),s(),y(" ",le(10,5,e.cartItem.Cost,"1.0-4")," "),s(2),R(!(e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.Cost==null)&&e.AppConfigJSON.ModuleSell.Cost.Enabled?11:-1)}}function jc(n,t){if(n&1&&(r(0,"tr")(1,"th",111),m(2," Price "),a(),r(3,"td",112),m(4),b(5,"number"),a()()),n&2){let e=c(2);s(4),y(" ",O(5,1,e.cartItem.Variant.UnitPrice)," ")}}function Hc(n,t){if(n&1&&(r(0,"tr")(1,"th",111),m(2," Content "),a(),r(3,"td",113)(4,"div",114),m(5),b(6,"number"),a()()()),n&2){let e=c(2);s(5),Ue(" ",e.cartItem==null?null:e.cartItem.VariantUnitQuantity," (@",O(6,2,e.cartItem.Price/(e.cartItem==null?null:e.cartItem.VariantUnitQuantity)),") ")}}function Uc(n,t){if(n&1&&(r(0,"tr")(1,"th",111),m(2," Commision "),a(),r(3,"td",113)(4,"div",114),m(5),b(6,"number"),a()()()),n&2){let e=c(2);s(5),y(" ",O(6,1,e.cartItem==null?null:e.cartItem.SalesCommission)," ")}}function Wc(n,t){if(n&1&&(r(0,"div",58)(1,"table",115)(2,"thead")(3,"tr")(4,"th",116),m(5,"Storage Location"),a()()(),r(6,"tbody")(7,"tr")(8,"td"),m(9),a()()()()()),n&2){let e=c(2);s(9),y(" ",e.cartItem.Variant.Storage," ")}}function Qc(n,t){if(n&1&&(r(0,"tr")(1,"td",97),m(2),a(),r(3,"td",97),m(4),b(5,"number"),a(),r(6,"td",97),m(7),b(8,"number"),a()()),n&2){let e=t.$implicit;s(2),y(" ",e.Name," "),s(2),y(" ",O(5,3,e.MinimumQuantity)," "),s(3),y(" ",O(8,5,e.UnitPrice)," ")}}function qc(n,t){if(n&1&&(x(0),r(1,"div",117)(2,"div",90)(3,"div",91),h(4,"i",118),r(5,"div",93),m(6," Pricebook "),a()(),r(7,"table",94)(8,"thead")(9,"tr")(10,"th",95),m(11," Name "),a(),r(12,"th",119),m(13," Min Qty "),a(),r(14,"th",95),m(15," Price "),a()()(),r(16,"tbody"),g(17,Qc,9,7,"tr",120),b(18,"sortBy"),a()()()(),I()),n&2){let e=c(2);s(17),p("ngForOf",Ge(18,1,e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.PriceBook,"asc","MinimumQuantity"))}}function $c(n,t){if(n&1&&(x(0),r(1,"div",31)(2,"div",86)(3,"a",87),g(4,Ac,5,0,"ng-container",88)(5,Lc,1,1,"ng-template",null,8,G),a()(),r(7,"div",89)(8,"div",31)(9,"div",90)(10,"div",91),h(11,"i",92),r(12,"div",93),m(13," Inventory "),a()(),r(14,"table",94)(15,"thead")(16,"tr")(17,"th",95),m(18," On Hand "),a(),r(19,"th",95),m(20," Allocated "),a(),r(21,"th",96),m(22," Available "),a()()(),r(23,"tbody")(24,"tr")(25,"td",97),m(26),a(),r(27,"td",97),m(28),a(),r(29,"td",97),m(30),a()()()()()(),r(31,"div",38)(32,"div",58)(33,"table",98)(34,"thead"),g(35,Fc,12,14,"tr")(36,jc,6,3,"tr")(37,Hc,7,4,"tr")(38,Uc,7,3,"tr"),a()()(),g(39,Wc,10,1,"div",99),a(),g(40,qc,19,5,"ng-container",20),a()(),I()),n&2){let e=q(6),i=c();s(3),p("routerLink",ct(14,lc))("queryParams",E(15,sc,i.cartItem==null||i.cartItem.Variant==null?null:i.cartItem.Variant.ID)),s(),p("ngIf",(i.cartItem==null||i.cartItem.Variant==null?null:i.cartItem.Variant.ThumbnailUrl)==null)("ngIfElse",e),s(22),y(" ",i.onHand," "),s(2),y(" ",i.allocated," "),s(2),y(" ",i.onHand-i.allocated," "),s(),p("ngClass",E(17,ba,(i.AppConfigJSON.ModuleSell==null||i.AppConfigJSON.ModuleSell.Cost==null?null:i.AppConfigJSON.ModuleSell.Cost.Visible)&&i.role.Cost||i.role.PriceVisible||i.role.Commission&&(i.cartItem==null?null:i.cartItem.SalesCommission))),s(4),R(!(i.AppConfigJSON.ModuleSell==null||i.AppConfigJSON.ModuleSell.Cost==null)&&i.AppConfigJSON.ModuleSell.Cost.Visible&&i.role.Cost?35:-1),s(),R(i.role.PriceVisible?36:-1),s(),R((i.cartItem==null?null:i.cartItem.VariantUnitQuantity)>1?37:-1),s(),R(i.role.Commission&&(i.cartItem!=null&&i.cartItem.SalesCommission)?38:-1),s(),p("ngIf",(i.AppConfigJSON==null||i.AppConfigJSON.ModuleSell==null||i.AppConfigJSON.ModuleSell.Grid==null?null:i.AppConfigJSON.ModuleSell.Grid.StorageVisible)&&i.cartItem.Variant.Storage),s(),p("ngIf",(i.cartItem==null||i.cartItem.Variant==null||i.cartItem.Variant.PriceBook==null?null:i.cartItem.Variant.PriceBook.length)>0)}}function Jc(n,t){if(n&1){let e=v();x(0),r(1,"app-item-serial",121),w("cartItemChange",function(o){u(e);let l=c();return D(l.cartItem,o)||(l.cartItem=o),f(o)})("serialsChange",function(o){u(e);let l=c();return D(l.serials,o)||(l.serials=o),f(o)}),a(),I()}if(n&2){let e=c();s(),p("entityId",e.deliveryEntityId),M("cartItem",e.cartItem),p("disabled",e.orderManager.posState==2&&e.constants.IsNotEmpty(e.cartItem.ID)),M("serials",e.serials)}}function Gc(n,t){if(n&1){let e=v();r(0,"div",21)(1,"item-calculator-tab",122),_("discountTotal",function(o){u(e);let l=c();return f(l.cartItem.Discount=o)})("priceTotal",function(o){u(e);let l=c();return f(l.cartItem.Price=o)})("qtyTotal",function(o){u(e);let l=c();return f(l.cartItem.Quantity=o)})("noteChanges",function(o){u(e);let l=c();return f(l.cartItem.Note=o)}),a()()}if(n&2){let e=c();p("hidden",e.modalItemState.CALCULATOR!=e.currentState),s(),p("notes",e.cartItem.Note)("price",e.cartItem.Price)("discount",e.cartItem.Discount)("quantity",e.cartItem.Quantity)("variantName",e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.Name)("disabledQty",(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)}}var $e=class n extends Rn{constructor(e,i,o,l,C,N,ae,ke,Fe,je,ri,Tt,Kn,Yn,ai){super();this._dialogRef=e;this.data=i;this._shoppingCartService=o;this._outletService=l;this._posService=C;this._orderProcessorService=N;this._orderDataService=ae;this._variantService=ke;this._toastr=Fe;this.decimalPipe=je;this._matDialog=ri;this._numpadService=Tt;this._userRoleService=Kn;this._onlineStatusService=Yn;this.cdRef=ai;this.destroy$=new z,this.entities=this._posService.Data.Entities,this.AppConfigJSON=this._posService.Data.AppConfigJSON,this.mapAppConfigJson(this.AppConfigJSON),this.subscribeToObservableChanges()}calculatorTab=Do(Rt);_quantityElement;_priceElement;_discountElement;_costElement;salesPersonName;destroy$;AppConfigJSON=new Mr;orderManager;salesOrderData;isOnline=!0;currentState;modalItemState=uo;isDiscMultipliciedQty=!0;inputedDiscountAmount=0;serials=[];constants=S;deliveryEntityId;selectedPriceBook=H(null);isPrepaidPackage=H(!1);isSellEdit=H(!1);ngOnInit(){this.initTabState(),this.isSerialItem=this.isSerial(),this.isPrepaidPackage.update(()=>this.cartItem?.Variant?.TypeID==10&&S.IsNotEmpty(this.cartItem.ID)),this.initStatusModal(),this.numpadVisible&&(this.keyboard=this._numpadService.keyboard),this.initIsUnitPriceEditor()}updateSales(e){this.salesPersonName=this.sales.find(i=>i.ID==e)?.Name,this.cartItem.SalesName=this.salesPersonName}initTabState(){this.currentState=0,this.data?.focus=="Discount"&&(this.currentState=this.modalItemState.DISCOUNT)}onTabChange(e){switch(this.currentState=e,e){case 2:this.queryInventoryOnOpen||this.getStockItem();break;case 1:this.onDiscountAmountChange(this.inputedDiscountAmount);break;case 4:{setTimeout(()=>this.calculatorTab()?.priceInputNativeElement?.focus(),100);break}}}ngAfterViewInit(){setTimeout(()=>{this.initFieldFocus()},200)}initFieldFocus(){switch(this.data&&this.data.focus){case"price":this._priceElement.nativeElement.focus();break;case"discount":this.currentState=1,this._discountElement.nativeElement.focus();break;case"quantity":this._quantityElement.nativeElement.focus()}}initIsUnitPriceEditor(){let e=this.cartItem.Variant?this.cartItem.Variant.SellPriceType:null;(e==1||e==2)&&(this.unitPriceEditor=!0)}initStatusModal(){if(this.data){let i=`Editing Cart Item - ${this.cartItem.Variant?this.cartItem.Variant.Name:""}`;this.updateHeaderTitle(i),this.statusModal="update"}else this.statusModal="create",this.cartItem=this.checkItemQuantityDefault(this.cartItem)}checkItemQuantityDefault(e){return this.quantityToOneInDialog||(e.Quantity=null),e}subscribeToObservableChanges(){this._userRoleService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.setUserRole(e)}),this._orderDataService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.salesOrderData=e,this.initCartItem(e.CartItems),this.checkPriceBookDisabled(),this.checkCalculatorPriceDisabled(),this.checkEmptySalesID(),this.initDeliveryEntityId()}),this._orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.isSellEdit.update(()=>e.posState==2),this.orderManager=e,this.checkCalculatorQtyDisabled()}),this._outletService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.sales=e.ListSales}),this._onlineStatusService.getOnlineStatus$().pipe(k(this.destroy$)).subscribe(e=>{this.isOnline=e})}initDeliveryEntityId(){let e=this.salesOrderData.Action.DeliveryEntityID;S.IsNotEmpty(e)?this.deliveryEntityId=e:this.deliveryEntityId=this.salesOrderData.Order.EntityID}initCartItem(e){if(this.data!=null){let i=e[this.data.index];this.cartItem=Ri(Be,i),this.cartItem.EntityID==S.GuidEmpty&&(this.cartItem.EntityID=null),S.IsEmpty(this.cartItem.SalesID)&&(this.cartItem.SalesID=null),this.oriDiscount=this.cartItem.Discount,this.initialSerial=this.cartItem.Serial,this.initSelectedPriceBook(),this.cartItem.PriceTypeID==2?this.oriUnitPrice=this.cartItem.Price:this.oriUnitPrice=this.cartItem.UnitPriceOriginal,this.inputedDiscountAmount=this.cartItem.DiscountAmount}else this.cartItem=new Be}initSelectedPriceBook(){if(this.cartItem.PriceTypeID==2){let e=this.cartItem.Variant&&this.cartItem.Variant.PriceBook?this.cartItem.Variant.PriceBook:[];if(e.length==1)this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=e[0].ID;else{let i=e.find(o=>o.ID==this.cartItem.PriceBookID);this.pricebookId=i?.ID}this.setSelectedPricebook()}}checkPriceBookDisabled(){if(this.cartItem.Variant){let e=this.cartItem.Variant.TypeID!=11&&!this.pricebookSelector,i=this.cartItem.Variant.TypeID==11&&this.cartItem.Variant.SellPriceType==0&&!this.pricebookSelector;this.pricebookDisabled=e||i}}checkCalculatorPriceDisabled(){if(this.cartItem.Variant){let e=this.cartItem.Variant.TypeID!=11&&!this.unitPriceEditor,i=this.cartItem.Variant.TypeID==11&&this.cartItem.Variant.SellPriceType==0&&!this.unitPriceEditor;this.calculatorPriceDisabled=e||i}}checkQtyInputDisabled(){let e=this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion,i=S.IsNotEmpty(this.cartItem.ID);return!!(e&&!this.role.SellEditor&&this.orderManager.posState==4&&i||i&&this.cartItem?.Serial?.length>0)}checkCalculatorQtyDisabled(){let e=this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkOrderDeletion,i=this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion;this.calculatorQtyDisabled=!e&&this.orderManager.posState===4&&!this.role.Order&&i}checkEmptySalesID(){if(this.salesOrderData.Order!=null){let e=this.salesOrderData.Order.SalesID;this.isEmptySalesID=S.IsEmpty(e)}}pricebookChange(){S.IsNotEmpty(this.pricebookId)&&(this.cartItem.pricebookUpdate(this.pricebookId,!this.pricebookDisabled,this.pricebookCopyDesc),this.setSelectedPricebook())}setSelectedPricebook(){let e=this.cartItem.getSelectedPricebook(this.pricebookId);this.selectedPriceBook.set(e)}onClearPricebook(){this.cartItem=this._shoppingCartService.resetAppliedPricebook(this.cartItem)}updateHeaderTitle(e){this.modalConfig.title=e}onDeliveryEntityChange(){let e=this.entities.find(i=>i.ID==this.cartItem.EntityID);e?this.cartItem.EntityName=e.Name:delete this.cartItem.EntityName}onOk(e){this.cartItem.removeEnterNote(),!(!this.validateConfigDefaultQuantity(e)||(this.cartItem.Variant.SellPriceType==2&&(this.cartItem.Cost=this.cartItem.Price),!this._shoppingCartService.validatePriceMinimum(this.cartItem)))&&(this.validateOnSubmit(),document.getElementById("product").focus())}validateConfigDefaultQuantity(e){let i=this.cartItem.Quantity;if(e=="Enter"){if(this.isSerial())return!1;if(!this.quantityToOneInDialog)return i>0}return!0}validateOnSubmit(){if(S.IsEmpty(this.cartItem.VariantID)){this._toastr.error("Enter item data before clicking OK!","No item is entered!");return}S.IsEmpty(this.cartItem.Quantity)&&this.updateItemQuantity(1),this.generateSerialItem(),this.checkValidateSerialItem(this.cartItem)&&this.onSubmitCartItem()}onSubmitCartItem(){if(this.data==null){let e=this.cartItem;this._shoppingCartService.pushNewItemToArray(e,!0),this._shoppingCartService.addAvailableComponent(e)}else this._shoppingCartService.updateCartItem(this.cartItem,this.data.index);this._orderProcessorService.reedemPointToDiscount(),this._dialogRef.close()}generateSerialItem(){this.cartItem.isSerialType()&&this.serials.length>0&&(!this.cartItem.Serial||this.cartItem?.Serial?.length==0)&&(this.cartItem.Serial=this.serials.map(e=>({Number:e,Quantity:-1,ExpiryDate:null})),this.cartItem.Quantity=this.serials.length*-1)}onCancel(){this._dialogRef.close()}checkValidateSerialItem(e){return this._shoppingCartService.validateSerialItem(e)}updateItemQuantity(e){!this.role.Return&&e<0||(this.cartItem.Quantity=e,this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=this.cartItem.PriceBookID,this.setSelectedPricebook())}updateDiscountPercentage(e){this.cartItem.Discount=Number(e)}updateOrUnitPrice(e){this.oriUnitPrice=e}quantityEditDisabled(){return this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion&&!this.role.Order&&S.IsNotEmpty(this.cartItem.ID)}onAddItem(e){let i=this.salesOrderData.Order.EntityID;this._variantService.findVariantByID(e,i).then(o=>{let l=o,C=new Be;C.patchByVariant(l),this.addItem(C)})}onEnterProductCode(e){let i=this.salesOrderData.Order.EntityID;this._variantService.findVariantByCode(e,i).then(o=>{if(o){let l=Object.assign(new hr,o),C=new Be;C.patchByVariant(l),this.addItem(C)}else this.onProductNotFound(e)}).catch(o=>{window.alert(`Barcode "${e}" is not registered in the product`)})}onProductNotFound(e){this._matDialog.open(En,{data:{message:`Barcode "${e}" is not registered in the product`,title:"Product not found"},width:"30%"}),this.playAudio()}playAudio(){let e=new Audio;e.src="/Sounds/bell_ring.mp3",e.load(),e.play()}addItem(e){this.onHand=0,this.AppConfigJSON.ModuleSell.ProductDialog.QuantityToOneInDialog?e.Quantity=1:this._quantityElement.nativeElement.focus(),this.cartItem=this.checkItemQuantityDefault(e),this.isSerialItem=this.isSerial();let l=`Editing Cart item - ${e.Variant?e.Variant.Name:null}`;this.updateOrUnitPrice(e.UnitPriceOriginal),this.updateHeaderTitle(l),this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=this.cartItem.PriceBookID,this.checkPriceBookDisabled(),this.checkCalculatorPriceDisabled(),this.checkCalculatorQtyDisabled(),this.initIsUnitPriceEditor()}getStockItem(){this._variantService.getStockByID(this.cartItem.VariantID,this.salesOrderData.Order.EntityID).then(e=>{e&&(this.queryInventoryOnOpen=!0,this.allocated=e.Allocated,this.onHand=e.OnHand)})}onCalculatorQty(e){this.updateItemQuantity(e)}onCalculatorPrice(e){this.cartItem.Price=parseFloat(e)}onCalculatorUnitQty(e){this.cartItem.UnitQuantity=parseFloat(e)}resizeCloudinaryImage(e){return e&&(e=e.replace("w_80","w_150")),e}onDiscountAmountChange(e){this.isDiscMultipliciedQty?this.cartItem.DiscountAmount=e:this.cartItem.DiscountAmount=e/this.cartItem.Quantity}onSwitchToggleDiscount(){this.isDiscMultipliciedQty?this.cartItem.DiscountAmount=this.cartItem.DiscountAmount*this.cartItem.Quantity:this.cartItem.DiscountAmount=this.cartItem.DiscountAmount/this.cartItem.Quantity}onEditCost(){let e=!this.enabledEditCost();this.enabledEditCost.set(e),this.cdRef.detectChanges(),this.enabledEditCost()&&this._costElement.nativeElement?.focus()}onCalculatorValueChange(e){this.cartItem.Discount=e.discount,this.cartItem.Price=e.price,this.cartItem.Quantity=e.qty}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(i){return new(i||n)(d(F),d(Ve),d(Me),d(Y),d(B),d(j),d(V),d(Li),d(ee),d(X),d(ne),d(Lr),d(me),d(qe),d(No))};static \u0275cmp=P({type:n,selectors:[["POS-modal-item"]],viewQuery:function(i,o){if(i&1&&(Eo(o.calculatorTab,Rt,5),ve(nc,5),ve(oc,5),ve(rc,5),ve(ac,5)),i&2){Ro();let l;Se(l=ye())&&(o._quantityElement=l.first),Se(l=ye())&&(o._priceElement=l.first),Se(l=ye())&&(o._discountElement=l.first),Se(l=ye())&&(o._costElement=l.first)}},standalone:!1,features:[Oi],decls:18,vars:15,consts:[["variant",""],["itemTemplate",""],["quantity",""],["PRICE",""],["price",""],["DISCOUNT",""],["AMOUNT",""],["discount",""],["SHOW_IMAGE",""],["unitCost",""],[3,"onOk","onCancel","onClose","config"],[1,"mb-5"],[1,"container","w-100","h-100"],[1,"row","border-bottom","mt-8","mx-5"],["data-cy","input_sell",1,"btn","btn-link-tab",3,"click","ngClass"],["data-cy","product",1,"btn","btn-link-tab",3,"click","ngClass"],["class","btn btn-link-tab","data-cy","product",3,"ngClass","click",4,"ngIf"],["class","btn btn-link-tab","data-cy","serial",3,"ngClass","click",4,"ngIf"],["data-cy","serial",1,"btn","btn-link-tab",3,"ngClass"],[1,"mx-8"],[4,"ngIf"],[3,"hidden"],["data-cy","serial",1,"btn","btn-link-tab",3,"click","ngClass"],[1,"py-8"],[1,"alert","alert-warning","text-center","my-5","py-3"],["class","row",3,"ngClass",4,"ngIf"],[1,"row","mt-6"],["class","col-auto pe-0",4,"ngIf"],[1,"row","mt-6","mb-5"],[1,"col","tinymce"],["height","210px",3,"ngModelChange","ngModel"],[1,"row"],[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"],[1,"d-flex","align-items-center","justify-content-between","w-100"],[1,"ms-3","text-wrap","text-break"],[1,"opacity-75"],[1,"fw-bold"],[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","simpleKeyboard","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"],["class","col-auto pe-0","style","width: 82px",4,"ngIf"],[1,"col-auto","pe-0",2,"width","112px",3,"hidden"],["class","form-control cart-input","disabled","",3,"value",4,"ngIf","ngIfElse"],[1,"col-auto","d-flex","align-items-center","pt-5"],[1,"col-auto","pe-0",2,"width","82px"],["type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input","input-numpad",3,"ngModelChange","preventNegative","readOnly","decimalPlaces","ngModel"],["disabled","",1,"form-control","cart-input",3,"value"],["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"],[1,"col-auto","pe-0"],["position","top","parent","body","bindValue","ID","bindLabel","Name","placeholder","Sales Person",3,"selectedChange","customTooltip","items","selected"],["bindLabel","Name","bindValue","ID","placeholder","Delivery Outlet","appendTo","body",2,"width","200px",3,"ngModelChange","items","ngModel"],[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"],[1,"row","d-flex","align-items-center","justify-content-start","mt-4"],[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
|
|
6
|
+
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,"w-100","d-flex","justify-content-end"],[1,"w-100","d-flex","justify-content-end","mt-2"],["id","inputDiscount","keyboardType","number","type","text","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","cart-input",3,"ngModelChange","simpleKeyboard","ngModel","preventNegative","readonly"],["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,"d-flex","align-items-center","justify-content-end","mt-2"],[1,"fw-bold","text-danger"],[1,"d-flex","align-items-center","justify-content-end","mt-2","text-danger"],[1,"text-danger"],[1,"row","border-top","mx-0","px-0","mt-4"],[1,"col-6","d-flex","justify-content-end","mt-4"],[1,"col-sm-4","d-flex","justify-content-center","flex-column","align-items-center","text-body-secondary","py-8"],["target","_blank",2,"color","inherit",3,"routerLink","queryParams"],[4,"ngIf","ngIfElse"],[1,"col-sm-8","py-8"],[1,"col-12"],[1,"d-flex"],["aria-hidden","true",1,"fa-archive","fa-solid","fa-1x","pt-3","pe-2"],[2,"font-size","15px","font-family",'"Roboto Slab"'],[1,"table","table-bordered","text-center","inventory-table"],[1,"table-light","py-6","border-end",2,"text-transform","none"],[1,"table-light","py-6",2,"text-transform","none"],[1,"py-6"],[1,"table","table-bordered",2,"width","171px"],["class","col-6",4,"ngIf"],[1,"text-center"],["aria-hidden","true",1,"fa-solid","fa-image","fa-5x"],[1,"border","rounded",3,"src"],[1,"table-light",2,"text-transform","none","width","20px"],[1,"p-0"],[1,"d-flex","align-items-center"],[3,"ngClass"],["matTooltip","This field is editable","matTooltipPosition","above","type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","border-0","bg-white","text-end","pe-2",3,"ngModelChange","ngModel"],[1,"w-100","text-end","ps-8","pe-2",3,"ngClass"],["type","button","matTooltip","This field is editable","matTooltipPosition","above",1,"text-d",3,"click"],[1,"fa-solid","fa-pen-to-square","fa-lg","cursor","mx-2"],[1,"table-light",2,"text-transform","none"],[1,"pe-4","text-end"],[1,"p-3","text-end"],["ngClass","ms-3"],[1,"table","table-bordered","text-center"],[1,"table-light"],[1,"row","mt-8"],[1,"fa-solid","fa-book","fa-1x","pt-3","pe-2"],[1,"table-light","py-6","border-end",2,"text-transform","none","width","70px"],[4,"ngFor","ngForOf"],[3,"cartItemChange","serialsChange","entityId","cartItem","disabled","serials"],[3,"discountTotal","priceTotal","qtyTotal","noteChanges","notes","price","discount","quantity","variantName","disabledQty"]],template:function(i,o){i&1&&(r(0,"modal-material",10),_("onOk",function(C){return o.onOk(C)})("onCancel",function(){return o.onCancel()})("onClose",function(){return o.onCancel()}),r(1,"content",11)(2,"div",12)(3,"div",13)(4,"div")(5,"a",14),_("click",function(){return o.onTabChange(o.modalItemState.SELL_INPUT)}),m(6," Cart "),a(),r(7,"a",15),_("click",function(){return o.onTabChange(o.modalItemState.DISCOUNT)}),m(8," Discount "),a(),g(9,cc,2,3,"a",16)(10,pc,2,3,"a",17)(11,mc,2,3,"a",18),a()(),r(12,"div",19),g(13,xc,11,6,"ng-container",20)(14,Vc,59,22,"ng-container",20)(15,$c,41,19,"ng-container",20)(16,Jc,2,4,"ng-container",20)(17,Gc,2,7,"div",21),a()()()()),i&2&&(p("config",o.modalConfig),s(5),p("ngClass",E(11,Si,o.modalItemState.SELL_INPUT==o.currentState)),s(2),p("ngClass",E(13,Si,o.modalItemState.DISCOUNT==o.currentState)),s(2),p("ngIf",(o.cartItem==null||o.cartItem.Variant==null?null:o.cartItem.Variant.Name)&&o.hasInventoryView),s(),p("ngIf",o.isSerialItem),s(),R(o.productCalculator()?11:-1),s(2),p("ngIf",o.modalItemState.SELL_INPUT==o.currentState),s(),p("ngIf",o.modalItemState.DISCOUNT==o.currentState),s(),p("ngIf",o.modalItemState.PRODUCT==o.currentState),s(),p("ngIf",o.modalItemState.SERIAL==o.currentState),s(),R(o.productCalculator()?17:-1))},dependencies:[U,_e,$,te,ht,K,ie,Q,nt,Vn,pt,ce,Ot,Lt,Br,Xr,qt,Ni,Rt,X,ur],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}"]})};var zc=n=>({"is-invalid":n});function Kc(n,t){n&1&&(r(0,"div",6)(1,"span"),m(2,"Host URL is required."),a()())}var An=class n{constructor(t){this.dialogRef=t;this.config.title="Connect ECR",this.config.customWidth="400px"}config=new W;urlCtrl=new bt("https://localhost:5001/EcrHub",[ui.required]);onClose(){this.dialogRef.close()}onConnect(){this.urlCtrl.valid&&this.dialogRef.close(this.urlCtrl.value)}static \u0275fac=function(e){return new(e||n)(d(F))};static \u0275cmp=P({type:n,selectors:[["app-modal-connect-ecr"]],decls:10,vars:7,consts:[[3,"onCancel","onClose","onOk","config","dynamicValidated"],[1,"d-flex","flex-column",2,"row-gap","1.5rem"],[1,"fw-normal"],[1,"form-floating-outline"],["id","floatingInput","placeholder","https://localhost:4001/EcrHub","type","text",1,"form-control",3,"ngClass","formControl"],["for","floatingInput"],[1,"invalid-feedback"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()})("onOk",function(){return i.onConnect()}),r(1,"content")(2,"div",1)(3,"h4",2),m(4,"Please input the ECR Host URL:"),a(),r(5,"div",3),h(6,"input",4),r(7,"label",5),m(8,"Host URL"),a(),g(9,Kc,3,0,"div",6),a()()()()),e&2&&(p("config",i.config)("dynamicValidated",i.urlCtrl.valid),s(6),p("ngClass",E(5,zc,i.urlCtrl.invalid&&(i.urlCtrl.touched||i.urlCtrl.dirty)))("formControl",i.urlCtrl),s(3),R(i.urlCtrl.invalid&&(i.urlCtrl.touched||i.urlCtrl.dirty)?9:-1))},dependencies:[Z,U,Ae,Q,ze,te,K,vt],encapsulation:2})};function Yc(n,t){if(n&1){let e=v();x(0),r(1,"div",14)(2,"radio-options",15),w("modelChange",function(o){u(e);let l=c(2);return D(l.odsConfigType,o)||(l.odsConfigType=o),f(o)}),a(),r(3,"label",16),m(4,"Choose Configuration"),a()(),I()}if(n&2){let e=t.ngIf,i=c(2);s(2),M("model",i.odsConfigType),p("options",e.options.OrderDisplayBroadcastModeType)}}function Xc(n,t){if(n&1&&(x(0),g(1,Yc,5,2,"ng-container",13),b(2,"async"),I()),n&2){let e=c();s(),p("ngIf",O(2,1,e.odsConfig$))}}function Zc(n,t){n&1&&(r(0,"div",17)(1,"div",18),h(2,"i",19),a(),r(3,"div",20)(4,"div"),m(5," Choose outlet first before configuring Order Display! "),a()()())}var Ln=class n{constructor(t,e,i,o){this.dialogRef=t;this.httpService=e;this.outletRegisterService=i;this.data=o;this.modalConfig=new W,this.modalConfig.title="Order Display Broadcast Configuration",this.modalConfig.okText="Save (F2)",this.modalConfig.customWidth="460px"}modalConfig;odsConfigType=1;odsLink="https://ods.dealpos.app";odsConfig$;hasOutlet=!1;ngOnInit(){let t=this.outletRegisterService.Data?.EntityID;this.hasOutlet=!!t,this.hasOutlet&&this.loadOdsConfig()}loadOdsConfig(){let t=this.outletRegisterService.Data.EntityID;this.odsConfig$=this.httpService.get(`/api/outlet/GetOrderDisplayBroadcastMode?EntityID=${t}`).pipe(Re(e=>{this.odsConfigType=e.form?.OrderDisplayBroadcastMode}),li(e=>(console.error("Error loading ODS configuration:",e),Zn({form:{EntityID:null,OrderDisplayBroadcastMode:0},options:{OrderDisplayBroadcastModeType:[{Key:0,Value:"Off"},{Key:1,Value:"Park"},{Key:2,Value:"Pay"},{Key:3,Value:"Park and Pay"}]}}))),At(1))}onSave(){let e={EntityID:this.outletRegisterService.Data.EntityID,OrderDisplayBroadcastMode:this.odsConfigType};this.httpService.post("/api/outlet/UpdateOrderDisplayBroadcastMode",e).pipe(Re(()=>{this.dialogRef.close(e)}),li(i=>(console.error("Error saving ODS configuration:",i),Zn(null)))).subscribe()}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(F),d(Qe),d(Y),d(Ve))};static \u0275cmp=P({type:n,selectors:[["modal-ods-config"]],decls:18,vars:4,consts:[["outletWarning",""],[3,"onOk","onClose","onCancel","config"],[1,"container"],[1,"row"],[1,"col-12","text-center"],[4,"ngIf","ngIfElse"],[1,"text-center","mt-4"],[1,"m-0"],[1,"col-12","mt-2"],[1,"text-center"],["src","https://res.cloudinary.com/dealpos-m/image/upload/w_180/v1746771410/dealpos%20app/dealpos_order_fulfillment_u7xzqe.png","alt","Order Display System",1,"img-fluid","mb-4"],[1,"mb-0"],["target","_blank",1,"fw-bold",3,"href"],[4,"ngIf"],[1,"form-floating-outline","radio","border","rounded","mt-4",2,"height","auto !important"],["id","odsConfigType",3,"modelChange","model","options"],["for","odsConfigType"],[1,"warning-banner","mt-4","d-flex","align-items-center","p-3","border","rounded","bg-light"],[1,"ms-2","me-3"],[1,"fas","fa-exclamation-triangle","text-warning","fa-lg"],[1,"warning-text"]],template:function(e,i){if(e&1){let o=v();r(0,"modal-material",1),_("onOk",function(){return u(o),f(i.onSave())})("onClose",function(){return u(o),f(i.onClose())})("onCancel",function(){return u(o),f(i.onClose())}),r(1,"content")(2,"div",2)(3,"div",3)(4,"div",4),g(5,Xc,3,3,"ng-container",5)(6,Zc,6,0,"ng-template",null,0,G),r(8,"div",6)(9,"p",7),m(10," This feature is used for monitoring incoming orders on a secondary screen, commonly used in the warehouse area. You can choose when the orders should appear on the display. "),a()()(),r(11,"div",8)(12,"div",9),h(13,"img",10),r(14,"p",11),m(15," You can access this feature through "),r(16,"a",12),m(17,"ods.dealpos.app"),a()()()()()()()()}if(e&2){let o=q(7);p("config",i.modalConfig),s(5),p("ngIf",i.hasOutlet)("ngIfElse",o),s(11),p("href",i.odsLink,tt)}},dependencies:[Z,$,Ne,Ce,ki,wi,Ae,Q],styles:[".warning-banner[_ngcontent-%COMP%]{box-shadow:-3px 0 #ffc107;background-color:#fff9e8!important;padding:5px;border-radius:12px;margin-bottom:15px;display:flex;align-items:center}.warning-text[_ngcontent-%COMP%]{padding:5px}"]})};function ep(n,t){if(n&1&&(r(0,"span",12),m(1),a()),n&2){let e=c().$implicit;s(),y(": ",e.value,"")}}function tp(n,t){if(n&1&&(r(0,"p",6),m(1),g(2,ep,2,1,"span",12),a()),n&2){let e=t.$implicit;s(),y(" ",e.label," "),s(),R(e.value?2:-1)}}function ip(n,t){if(n&1&&(r(0,"div",7)(1,"p",14)(2,"span",15),m(3," Valid until "),r(4,"span",16),m(5),b(6,"date"),a()()()()),n&2){let e=c(2);s(5),T(le(6,1,e.coupon==null||e.coupon.Requirement==null?null:e.coupon.Requirement.ExpiryDate,"longDate"))}}function np(n,t){if(n&1&&g(0,ip,7,4,"div",13),n&2){let e=c();p("ngIf",(e.coupon==null||e.coupon.Requirement==null?null:e.coupon.Requirement.ExpiryDate)!=="0001-01-01T00:00:00")}}function op(n,t){n&1&&(r(0,"p",10),h(1,"i",17),r(2,"span",16),m(3,"Edit Mode: "),a(),m(4,"Coupon information is displayed for reference only. Coupon removal is not available in edit mode. "),a())}function rp(n,t){n&1&&(r(0,"p",11),h(1,"i",18),r(2,"span",16),m(3,"Important: "),a(),m(4,"Removing this coupon will reset your cart to its original state. All discounts and price changes from this coupon will be removed. "),a())}var Bn=class n{dialogRef=oe(F);decimalPipe=oe(X);couponService=oe(Xe);couponProviderService=oe(It);salesOrder=oe(V);orderProcessorService=oe(j);modalConfig;couponLabel=H(null);couponRequirements=H([]);coupon=this.couponService.coupon;couponProvider=this.couponProviderService.coupon;isEdit=H(!1);constructor(){this.initModalConfig(),this.initCouponLabel(),this.generateCouponRequirement()}initModalConfig(){let t=this.orderProcessorService.Data.posState;this.modalConfig=new W,this.modalConfig.title=this.generateDialogTitle(),this.modalConfig.customWidth="400px",this.isEdit.set(t===2),t===2?(this.modalConfig.hideOk=!0,this.modalConfig.cancelText="Close",this.isEdit.set(!0)):(this.modalConfig.okText="Remove",this.modalConfig.hideCancel=!0)}generateDialogTitle(){let t=this.salesOrder?.Data?.Order?.PromotionCoupon;return`Coupon ${this.maskCouponCode(t)} Applied`}maskCouponCode(t){return t?`***${t.slice(-2)}`:""}generateCouponRequirement(){let t=[];if(this.coupon?.ApplyToProduct?.length>0&&t.push({label:"Required Specific Product",value:null}),this.coupon?.Requirement?.MaximumDiscount&&t.push({label:"Maximum Discount",value:`Rp. ${this.decimalPipe.transform(this.coupon?.Requirement?.MaximumDiscount)}`}),this.coupon?.Requirement?.MinimumSpendingAmount&&t.push({label:"Minimum Spending",value:`Rp. ${this.decimalPipe.transform(this.coupon?.Requirement?.MinimumSpendingAmount)}`}),this.coupon?.Requirement?.FullPriceProductOnly&&t.push({label:"Full Price Product Only",value:null}),S.IsNotEmpty(this.coupon?.Requirement?.CustomerName)){let i=this.coupon?.Requirement?.CustomerName,o=this.coupon?.Requirement?.CustomerCode;t.push({label:"Exclusive for "+i+(o?` - ${o}`:""),value:null})}this.coupon?.Requirement?.CouponDeductedAmount&&t.push({label:"Point Deduction",value:`${this.decimalPipe.transform(this.coupon?.Requirement?.CouponDeductedAmount)}`}),this.couponRequirements.set(t)}initCouponLabel(){let t=this.couponProviderService.coupon||this.couponService.coupon,e=this.couponProviderService.coupon,i="";if(!t){this.couponLabel.set("");return}if(e)e.Type==="Percentage"?i=`${this.decimalPipe.transform(e.Amount)}% Discount`:i=`Rp. ${this.decimalPipe.transform(e.Amount)} Discount`;else switch(t?.Requirement?.Type){case 2:i=`Rp. ${this.decimalPipe.transform(t?.Amount)} Discount`;break;case 1:i=`${this.decimalPipe.transform(t?.Amount)}% Discount`;break;case 5:i="Authorize Full Access";break;case 4:i="Authorize Parked Deletion";break;case 3:i="Authorize Return";break;case 6:i="Authorize Delete Item";break;default:i="Coupon Applied";break}this.couponLabel.set(i)}onClose(){this.dialogRef.close(!1)}onRemove(){this.dialogRef.close(!0)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["app-modal-confirm-remove-coupon"]],decls:15,vars:4,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container-fluid"],[1,"card","coupon-card","mb-8"],[1,"card-body","text-center",2,"padding","0.2rem"],[1,"mb-6","badge","text-bg-success","fs-3","text-white"],[1,"d-flex","flex-column","gap-4"],[1,"mb-0"],[1,"valid-date","d-flex","justify-content-center"],[1,"card","warning-card","mb-0"],[1,"card-body","d-flex","justify-content-center","align-items-center"],[1,"warning-msg","mb-0","text-info-emphasis"],[1,"warning-msg","mb-0","text-warning-emphasis"],[1,"text-success","fw-semibold"],["class","valid-date d-flex justify-content-center",4,"ngIf"],[1,"mb-0","p-4"],[1,"opacity-75"],[1,"fw-bold"],[1,"fa-solid","fa-info-circle","text-info","me-2","fw-bold"],[1,"fa-solid","fa-triangle-exclamation","text-warning","me-2","fw-bold"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.onRemove()})("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"span",4),m(6),a(),r(7,"div",5),ci(8,tp,3,2,"p",6,si),g(10,np,1,1,"div",7),a()()(),r(11,"div",8)(12,"div",9),g(13,op,5,0,"p",10)(14,rp,5,0,"p",11),a()()()()()),e&2&&(p("config",i.modalConfig),s(6),T(i.couponLabel()),s(2),pi(i.couponRequirements()),s(2),R(!(i.coupon==null||i.coupon.Requirement==null)&&i.coupon.Requirement.ExpiryDate?10:-1),s(3),R(i.isEdit()?13:14))},dependencies:[Z,$,We,Ae,Q],styles:['body[_ngcontent-%COMP%]{font-family:Roboto Slab,serif;background:linear-gradient(135deg,#f5f7fa,#c3cfe2);min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px}.coupon-card[_ngcontent-%COMP%]{background:linear-gradient(135deg,#f8f9fa,#e9ecef);border-radius:12px;padding:24px;border:2px solid #89b03e;position:relative;overflow:hidden}.coupon-card[_ngcontent-%COMP%]:before{content:"";position:absolute;top:0;left:0;right:0;height:4px;background:linear-gradient(90deg,#89b03e,#a4c449)}.valid-date[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{border:1px solid #e0e0e0;border-radius:4px;box-shadow:-3px 0 #c5e1a5;width:300px;background-color:#f7fbf0!important}.warning-card[_ngcontent-%COMP%]{border-radius:4px;box-shadow:-3px 0 #ffc107;background-color:#fff9e8!important}.badge[_ngcontent-%COMP%]{display:inline-block;background:linear-gradient(135deg,#89b03e,#a4c449);color:#fff;padding:12px 24px;border-radius:50px;font-size:1.4rem;font-weight:700;margin-bottom:20px;box-shadow:0 4px 15px #89b03e4d}']})};var kt=class n{constructor(t,e,i,o,l,C,N,ae,ke,Fe,je,ri,Tt,Kn,Yn,ai){this.roleService=t;this.orderProcessorService=e;this.promotionService=i;this.promotionCouponService=o;this.promotionCouponProvider=l;this.dialog=C;this.parkOrderService=N;this.salesOrderService=ae;this.outletRegisterService=ke;this.pageInitialService=Fe;this.toastrService=je;this.httpService=ri;this.shoppingCartService=Tt;this.customerDisplay=Kn;this.ecrService=Yn;this.ecrSignalR=ai;this.destroy$=new z,this.sourceMenu=[...ga],this._moreMenu=new Xn(this.sourceMenu),this.moreMenu$=this._moreMenu.asObservable(),this.initElgiblePromotion(),this.subscribeObservable()}_moreMenu;moreMenu$;eligiblePromotions$;destroy$;sourceMenu;_enabledDragDrop=new Xn(!0);enabledDragDrop$=this._enabledDragDrop.asObservable();subscribeObservable(){yi([this.orderProcessorService.Data$,this.salesOrderService.Data$]).pipe(k(this.destroy$)).subscribe(([t,e])=>{this.filterMoreMenu(t.posState)}),this.roleService.Data$.pipe(k(this.destroy$)).subscribe({next:()=>{this.filterMoreMenu(0)}})}initElgiblePromotion(){this.eligiblePromotions$=this.promotionService.Data$.pipe(et(()=>this.promotionService.getTotalEligiblePromotion()))}moreMenuAction(t){switch(t){case"ADD_ITEM":this.dialog.open($e);break;case"COUPON":let e=this.salesOrderService.Data?.Order?.PromotionCoupon;S.IsNotEmpty(e)?this.dialog.open(Bn).afterClosed().pipe(pe(o=>o)).subscribe(()=>this.removePromotionCoupon()):this.dialog.open(yn);break;case"PROMOTION":this.dialog.open(zi,{id:"promotion-event"});break;case"UPLOAD":this.onImportItems();break;case"RETURN":this.dialog.open(xn);break;case"CLEAR":this.dialog.open(Sn);break;case"SERIAL":this.dialog.open(In);break;case"SPLIT":this.onSplitItem();break;case"PRINT":this.parkOrderService.onPrintRetrieve();break;case"CANCEL":this.onCancel();break;case"SYNC":this.dialog.open(Mn);break;case"FULFILLMENT":this.onFulfillment();break;case"RETRIEVE":this.onRetrieve();break;case"INVENTORY":this.checkAvailableInventory();break;case"SORT":let i=!this._enabledDragDrop.value;this.enableDragDrop(i);break;case"CUSTOMER_DISPLAY":this.confirmEnabledCustomerDisplay();break;case"ECR":this.openModalInputEcrUrl();break;case"ODS_CONFIG":this.openOdsConfigDialog();break}}removePromotionCoupon(){let t=this.promotionCouponProvider.coupon;S.IsNotEmpty(t)?this.promotionCouponProvider.removeCoupon():this.promotionCouponService.removeAppliedCoupon()}openOdsConfigDialog(){this.dialog.open(Ln).afterClosed().pipe(pe(t=>!!t)).subscribe(()=>{this.toastrService.success("Order Display Configuration applied successfully","Success")})}openModalInputEcrUrl(){this.ecrSignalR.isConnected()?this.confirmDisableEcr():this.dialog.open(An).afterClosed().pipe(pe(e=>!!e)).subscribe(e=>{this.ecrSignalR.initConnection(e)})}confirmDisableEcr(){this.dialog.open(gi,{data:{title:"Disconnect ECR",message:"Are you sure you want to disconnect ECR?",okText:"OK",headerType:Le.Warning},width:"500px"}).afterClosed().pipe(pe(t=>t),Re(()=>{this.ecrService.disconnect(),this.ecrSignalR.stopConnection()})).subscribe(()=>{this.toastrService.success("ECR is disconnected","Success")})}confirmEnabledCustomerDisplay(){let t=this.customerDisplay.isEnabled(),e;t?e={title:"Disconnect from Customer Display",message:`
|
|
7
7
|
<div class="text-center">
|
|
8
8
|
<div class="fs-5 mb-3 fw-bold">
|
|
9
9
|
You are currently connected to the Customer Display App from this terminal. All display output is being mirrored to the customer screen.
|
|
@@ -36,12 +36,12 @@ Printing in 8mm format instead!`,"Error!"),this.printReceiptMini(),t}),Re(()=>{t
|
|
|
36
36
|
</a>.
|
|
37
37
|
</div>
|
|
38
38
|
</div>
|
|
39
|
-
`,okText:"Connect"},this.dialog.open(gi,{data:e,width:"500px"}).afterClosed().pipe(ce(i=>i),Re(()=>{t?this.customerDisplay.disconnect():this.customerDisplay.connect()})).subscribe(()=>{this.toastrService.success(`Customer Display is ${t?"disconnected":"connected"}`,"Success")})}enableDragDrop(t){let e=S.cloneObject(this._moreMenu.value);e=e.map(i=>(i.name=="Advanced"&&(i.menus=i.menus.map(o=>(o.action=="SORT"&&(o.label=t?"Disable Sort":"Enable Sort"),o))),i)),this._moreMenu.next(e),this._enabledDragDrop.next(t)}checkAvailableInventory(){let i=this.salesOrderService.Data.CartItems.map(l=>l.VariantID),o={Outlet:this.outletRegisterService.Data.EntityID,Cart:i};this.httpService.post(fe.ValidateInventory,o).subscribe(l=>{this.setAvailableInventory(l)})}setAvailableInventory(t){let e=this.salesOrderService.Data,i=e.CartItems,o=0;e.CartItems=i.map(l=>{let C=t.findIndex(N=>N.VariantID==l.VariantID);return C!==-1&&(l.AvailableInventory=t[C].OnHand,(l.Variant?.TypeID<9||l.Variant?.TypeID==12)&&(o+=l.Quantity>l.AvailableInventory?1:0)),l}),this.showToastrValidateInventory(o),this.salesOrderService.pushNewValue(e)}showToastrValidateInventory(t){t>0?this.toastrService.error(`There are ${t} 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")}filterMoreMenu(t){let e=[];t==4?e=this.filterMenuByRole().map(l=>(l.menus=l.menus.filter(C=>C.action!=="CANCEL"),l)):t==5?e=this.filterMenuByRole().map(l=>(l.menus=l.menus.filter(C=>C.action!=="SPLIT"),l)):e=this.filterMenuByRole().filter(l=>l.name!=="Bill");let o=this.salesOrderService.Data?.getRewards()?.length>0;t==2&&o&&(e=e.map(l=>(l.children=l.children?.map(C=>(C.menus=C.menus.map(N=>(N.action=="PROMOTION"&&(N.disabled=!0,N.description="Promotion event selection is disabled as this transaction already applies a reward from a promotion event"),N)),C)),l))),this._moreMenu.next(e)}filterMenuByRole(){let t=this.roleService?.Data,e=S.cloneObject(this.sourceMenu);return e=this.filterMenuByRoles([{action:"RETRIEVE",role:t.Retrieve},{action:"FULFILLMENT",role:t.Shipping},{action:"RETURN",role:t.Return},{action:"CLEAR",role:t.DeleteItem}],e),e}filterMenuByRoles(t,e=[]){let i;return e.map(o=>(o.menus=o.menus.map(l=>(i=t.findIndex(C=>C.action==l.action),i!==-1?l.disabled=t[i].role==!1:l.disabled=!1,l)),o))}onRetrieve(){let t=this.outletRegisterService.Data.ParkLayoutPack,e=this.pageInitialService.Data.AppConfigJSON;if(t?.Layout==null&&e.ApplicationParkAndRetrieve.Advance.retreiveMode==1){this.toastrService.error("Your retrieve config is in Group mode, to enable park please setting your Park layout at Outlet page","Error!");return}this.dialog.open(wn).afterClosed().pipe(k(this.destroy$),ce(i=>S.IsNotEmpty(i))).subscribe(i=>{this.parkOrderService.parkOrderRetrieve=i,this.orderProcessorService.Data.posState=4})}onCancel(){this.orderProcessorService.Data.posState==4?this.orderProcessorService.updatePosState(5):(this.orderProcessorService.updatePosState(4),this.resetSplitedItem())}resetSplitedItem(){let t=this.salesOrderService.Data;t.CartItems=t.CartItems.map(e=>(e.SplitQuantity=0,e.Splited=!1,e)),this.salesOrderService.pushNewValue(t)}onFulfillment(){this.dialog.open(oi)}onImportItems(){let t=this.salesOrderService?.Data?.Order?.EntityID;this.dialog.open(Xi,{data:{sampleUrl:"https://res.cloudinary.com/pos/raw/upload/v1699867624/POS/CSV/ImportSell_DealPOS_New.csv",API:fe.UploadCsv,outletID:t,useUppy:!0,fileEndpoint:"/API/POS/UploadCsvV3"}}).afterClosed().pipe(ce(e=>!!e)).subscribe(e=>{let i;for(let o of e)i=new Be,o.Variant.UnitPrice=o.Price,o.Variant.UnitCost=o.Cost,o.Variant.PriceDiscount=o.Discount,i.Quantity=o.Quantity,i.patchByVariant(o.Variant,!0),i.Note=o.Note?o.Note:i.Note,i.DiscountAmount=o.DiscountAmount,i.Serial=o.Serial,this.shoppingCartService.pushNewItemToArray(i,!0)})}onSplitItem(){this.dialog.open(Tn)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(A(me),A(j),A($t),A(Xe),A(It),A(ne),A(we),A(V),A(Y),A(B),A(ee),A(Qe),A(Me),A(Bi),A(Gi),A(Jt))};static \u0275prov=at({token:n,factory:n.\u0275fac})};var Ia=n=>({"quickkey-subscription-overdue":n}),Oa=()=>["/menu/Outlets/Master/Quick_Key_Templates/Form"],cp=n=>({ID:n}),pp=n=>({OutletID:n});function mp(n,t){if(n&1&&h(0,"img",25),n&2){let e=c(2).$implicit;p("ngSrc",e.ImageURLClient)}}function dp(n,t){if(n&1&&(x(0),r(1,"div",22)(2,"div",23),g(3,mp,1,1,"img",24),a()(),I()),n&2){let e=c().$implicit;s(3),p("ngIf",e.ImageURLClient)}}function up(n,t){if(n&1&&(r(0,"div",23)(1,"p",26)(2,"span"),m(3),b(4,"slice"),a()()()),n&2){let e=c().$implicit;s(3),T(Ge(4,1,e.Display,0,3))}}function fp(n,t){if(n&1&&(r(0,"small",28),m(1),b(2,"number"),a()),n&2){let e=c(2).$implicit;s(),T(O(2,1,e.Children[0].UnitPrice))}}function gp(n,t){if(n&1&&(r(0,"small",29),m(1),b(2,"lowestPrice"),b(3,"number"),b(4,"highestPrice"),b(5,"number"),a()),n&2){let e=c(2).$implicit;s(),Ue("",O(3,4,O(2,2,e==null?null:e.Children))," - ",O(5,8,O(4,6,e==null?null:e.Children)),"")}}function _p(n,t){if(n&1&&(x(0),g(1,fp,3,3,"small",27)(2,gp,6,10,"ng-template",null,3,G),I()),n&2){let e=Q(3),i=c().$implicit;s(),p("ngIf",i.Children.length==1)("ngIfElse",e)}}function Cp(n,t){if(n&1){let e=v();r(0,"div",19)(1,"a",20),_("click",function(){let o=u(e).$implicit,l=c(4);return f(l.onSelectProduct(o))}),g(2,dp,4,1,"ng-container",8)(3,up,5,5,"ng-template",null,2,G),r(5,"small"),m(6),b(7,"slice"),a(),g(8,_p,4,2,"ng-container",21),a()()}if(n&2){let e=t.$implicit,i=Q(4),o=c(4);be(o.colConfigCSSClass),s(2),p("ngIf",e.ImageURLClient)("ngIfElse",i),s(4),T(Ge(7,6,e.Display,0,36)),s(2),p("ngIf",o.quickKeyPriceVisible)}}function hp(n,t){if(n&1&&(r(0,"mat-tab",12)(1,"div",13)(2,"div",14),g(3,Cp,9,10,"div",15),r(4,"div",16)(5,"a",17),h(6,"i",18),a()()()()()),n&2){let e=t.$implicit,i=c(3);p("label",e.Name),s(3),p("ngForOf",e==null?null:e.Items),s(),be(i.colConfigCSSClass),s(),p("routerLink",ct(6,Oa))("queryParams",E(7,cp,i.quickKey.ID))}}function bp(n,t){if(n&1){let e=v();r(0,"mat-tab-group",10),w("selectedIndexChange",function(o){u(e);let l=c(2);return D(l.quickeyTabActive,o)||(l.quickeyTabActive=o),f(o)}),g(1,hp,7,9,"mat-tab",11),a()}if(n&2){let e=c(2);p("disableRipple",!0),M("selectedIndex",e.quickeyTabActive),s(),p("ngForOf",e.quickKey==null?null:e.quickKey.Groups)}}function vp(n,t){if(n&1&&h(0,"img",37),n&2){let e=c(2).$implicit;p("src",e.ImageURLClient,tt)}}function Sp(n,t){if(n&1&&(x(0),r(1,"div",22)(2,"div",23),g(3,vp,1,1,"img",36),a()(),I()),n&2){let e=c().$implicit;s(3),p("ngIf",e.ImageURLClient)}}function yp(n,t){if(n&1&&(r(0,"div",23)(1,"p",26)(2,"span"),m(3),b(4,"slice"),a()()()),n&2){let e=c().$implicit;s(3),T(Ge(4,1,e.Model,0,3))}}function xp(n,t){if(n&1&&(r(0,"small",28),m(1),b(2,"number"),a()),n&2){let e=c().$implicit;s(),T(O(2,1,e.UnitPrice))}}function Ip(n,t){if(n&1){let e=v();r(0,"div",19)(1,"a",20),_("click",function(){let o=u(e).$implicit,l=c(3);return f(l.onSelectVariant(o.ID))}),g(2,Sp,4,1,"ng-container",8)(3,yp,5,5,"ng-template",null,4,G),r(5,"small"),m(6),b(7,"slice"),a(),g(8,xp,3,3,"small",35),a()()}if(n&2){let e=t.$implicit,i=Q(4),o=c(3);be(o.colConfigCSSClass),s(2),p("ngIf",e.ImageURLClient)("ngIfElse",i),s(4),T(Ge(7,6,e.Model,0,30)),s(2),p("ngIf",o.quickKeyPriceVisible)}}function Op(n,t){if(n&1){let e=v();r(0,"div",30)(1,"div",31),_("click",function(){u(e);let o=c(2);return f(o.quickeyState="QUICKEY")}),h(2,"i",32),a(),r(3,"div",33)(4,"b"),m(5),a()()(),r(6,"div",13)(7,"div",34),g(8,Ip,9,10,"div",15),a()()}if(n&2){let e=c(2);s(5),y(" ",e.subQuickeyPack.Display,""),s(3),p("ngForOf",e.subQuickeyPack==null?null:e.subQuickeyPack.Children)}}function Pp(n,t){if(n&1&&(x(0),g(1,bp,2,3,"mat-tab-group",9)(2,Op,9,2,"ng-template",null,1,G),I()),n&2){let e=Q(3),i=c();s(),p("ngIf",i.quickeyState=="QUICKEY")("ngIfElse",e)}}function Mp(n,t){if(n&1&&(r(0,"div",38)(1,"a",39)(2,"strong"),m(3,"QUICK KEYS UNCONFIGURED"),a(),h(4,"i",40),r(5,"span"),m(6,"Click here to setup your Quick keys"),a()()()),n&2){let e=c();p("ngClass",E(3,Ia,e.currentSubsStatus==e.subscriptionStatus.OVERDUE||e.currentSubsStatus==e.subscriptionStatus.SELL_ONLY)),s(),p("routerLink",ct(5,Oa))("queryParams",E(6,pp,e.entityId))}}var Fn=class n{constructor(t,e,i,o,l,C){this.outletRegisterService=t;this.shoppingCartService=e;this.dialog=i;this.pageInitialService=o;this.salesOrderService=l;this.authService=C;this.destroy$=new z,this.quickeyState="QUICKEY",this.currentSubsStatus=this.authService.getSubscriptionStatus()}destroy$;quickKey;subQuickeyPack;entityId;quickeyState;quickeyTabActive=0;colConfigCSSClass;subscriptionStatus=Ft;currentSubsStatus;nextProductID;quickKeyPriceVisible=!1;ngOnInit(){this.getOutletRegister(),this.colConfigCSSClass=`col-${12/this.pageInitialService.Data.AppConfigJSON.ModuleSell.QuickKey.QuickkeyTotalRow}`,this.quickKeyPriceVisible=this.pageInitialService.Data.AppConfigJSON.ModuleSell.QuickKey.QuickKeyPriceVisible}getOutletRegister(){this.outletRegisterService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.entityId=t.EntityID,this.quickKey=t.QuickKeyPack,this.quickKey.ID})}onSelectProduct(t){this.nextProductID=t.NextProductID,!t.Children||t.Children.length<1?this.onSelectVariant(t.ItemID):t.Children.length==1?this.onSelectVariant(t.Children[0].ID):(this.quickeyState="SUBQUICKEY",this.subQuickeyPack={Children:t.Children,Display:t.Display})}onSelectVariant(t){this.shoppingCartService.addCartItemById(t).then(()=>{this.quickeyState="QUICKEY";let e=this.pageInitialService.Data.AppConfigJSON,i=this.salesOrderService.Data.CartItems;if(e.ModuleSell.ProductDialog.OpenOnNewItemAdded){let o=i.length-1;this.dialog.open($e,{data:{index:o,focus:"quantity"}})}this.openNextProduct()})}openNextProduct(){S.IsNotEmpty(this.nextProductID)&&this.quickKey.Groups.forEach(t=>{let e=t?.Items?.find(i=>i.ProductID==this.nextProductID);e!=null&&e.Children.length>1&&(this.quickeyState="SUBQUICKEY",this.subQuickeyPack={Children:e.Children,Display:e.Display})})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(Y),d(Me),d(ne),d(B),d(V),d(Ut))};static \u0275cmp=P({type:n,selectors:[["sell-quick-key"]],standalone:!1,decls:6,vars:5,consts:[["noQuickKey",""],["SUBQUICKEY",""],["BLANK_IMG",""],["MULTIPLE_VARIANT",""],["BLANK_IMG_SUB",""],[1,"row"],[1,"col-12"],[1,"quick-key-tab",3,"ngClass"],[4,"ngIf","ngIfElse"],["class","h-100 bgQuickkeyIllustration landscape",3,"disableRipple","selectedIndex","selectedIndexChange",4,"ngIf","ngIfElse"],[1,"h-100","bgQuickkeyIllustration","landscape",3,"selectedIndexChange","disableRipple","selectedIndex"],[3,"label",4,"ngFor","ngForOf"],[3,"label"],[1,"container","tabItems"],[1,"row","g-0"],["class","column px-6",3,"class",4,"ngFor","ngForOf"],[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"],[4,"ngIf"],[1,"img-box","d-flex","align-items-center"],[1,"ratio","ratio-1x1"],["class","full-screen-image","priority","","fill","",3,"ngSrc",4,"ngIf"],["priority","","fill","",1,"full-screen-image",3,"ngSrc"],[1,"fw-normal","fs-1","d-flex","align-items-center","justify-content-center"],["class","text-muted",4,"ngIf","ngIfElse"],[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"],["class","text-muted",4,"ngIf"],["class","full-screen-image",3,"src",4,"ngIf"],[1,"full-screen-image",3,"src"],[1,"no-quick-key","d-flex","align-items-center","justify-content-center",3,"ngClass"],["id","LinkConfigureQuickkey","target","_blank",3,"routerLink","queryParams"],["aria-hidden","true",1,"fa-regular","fa-hand-pointer"]],template:function(e,i){if(e&1&&(r(0,"div",5)(1,"div",6)(2,"section",7),g(3,Pp,4,2,"ng-container",8)(4,Mp,7,8,"ng-template",null,0,G),a()()()),e&2){let o=Q(5);s(2),p("ngClass",E(3,Ia,i.currentSubsStatus==i.subscriptionStatus.OVERDUE||i.currentSubsStatus==i.subscriptionStatus.SELL_ONLY)),s(),p("ngIf",(i.quickKey==null?null:i.quickKey.Groups)&&(i.quickKey==null||i.quickKey.Groups==null?null:i.quickKey.Groups.length)>0)("ngIfElse",o)}},dependencies:[H,_e,$,St,yt,Lt,Bo,Lo,X,pr,mr],styles:[".quick-key-tab{width:100%;position:relative;height:100%;max-height:calc(100vh - 70px)} .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-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(//res.cloudinary.com/pos/image/upload/w_500/POS/Images/Cashier/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}"]})};var wp=n=>({"cursor-pointer":n}),kp=n=>({"px-2 py-2 number-disabled":n}),Tp=(n,t)=>({"d-flex justify-content-end align-items-center":n,"mt-1":t}),Ep=(n,t)=>({label:n,tooltip:t}),Pa=n=>({data:n}),Rp=()=>({label:"Later",tooltip:"Fulfillment Later"}),Np=n=>({"bg-gradient-warning px-2":n}),Vp=n=>({"me-3":n});function Ap(n,t){if(n&1&&(x(0),r(1,"span"),m(2),a(),I()),n&2){let e=c();s(2),Ue("",e.isSalesOrderEdit?"Editing Order ":"Sales Order ","#",e.salesOrder==null||e.salesOrder.Order==null?null:e.salesOrder.Order.Number,"")}}function Lp(n,t){n&1&&(r(0,"div",14),m(1,"Order Number"),a())}function Bp(n,t){n&1&&mi(0)}function Fp(n,t){if(n&1&&(r(0,"div",11),g(1,Bp,1,0,"ng-container",15),a()),n&2){let e=c(),i=Q(18);s(),p("ngTemplateOutlet",i)("ngTemplateOutletContext",E(5,Pa,ge(2,Ep,e.isDifferentFullfillmentOutlet().outletName,e.isDifferentFullfillmentOutlet().outletName)))}}function jp(n,t){n&1&&mi(0)}function Hp(n,t){if(n&1&&(r(0,"div",11),g(1,jp,1,0,"ng-container",15),a()),n&2){c();let e=Q(18);s(),p("ngTemplateOutlet",e)("ngTemplateOutletContext",E(3,Pa,ct(2,Rp)))}}function Up(n,t){if(n&1&&(r(0,"h5",20),m(1),b(2,"limitTo"),a()),n&2){let e=c().data;s(),T(pe(2,1,e==null?null:e.label,14))}}function Wp(n,t){if(n&1){let e=v();r(0,"div",16)(1,"div",17),_("click",function(){u(e);let o=c();return f(o.openFulfillmentModal())}),r(2,"div",18),h(3,"i",19),a(),g(4,Up,3,4,"h5",20),a()()}if(n&2){let e=t.data;p("ngClass",E(4,Np,e.label))("matTooltip",e==null?null:e.tooltip),s(2),p("ngClass",E(6,Vp,e.label)),s(2),R(e!=null&&e.label?4:-1)}}var jn=class n{constructor(t,e,i,o,l,C,N,ae){this.registerService=t;this.salesOrderService=e;this.pageInitialService=i;this.coreService=o;this.dialog=l;this.shoppingCartService=C;this.userRoleService=N;this.orderProcessorService=ae;this.destroy$=new z}selectedOutlet;destroy$;salesOrder;register;userRole;isSalesOrderEdit=!1;selectedDate=new Date;isDifferentFullfillmentOutlet=q({isDifferent:!1,outletName:""});isFulfillmentLater=q(!1);ngOnInit(){this.subscribeToObservable()}ngAfterViewInit(){this.initCursorFocus()}onSelectDate(){this.salesOrder.Order.Date=this.selectedDate,this.salesOrderService.pushNewValue(this.salesOrder)}subscribeToObservable(){this.salesOrderService.Data$.pipe(k(this.destroy$)).subscribe(t=>{let e=t.Order.Date;this.selectedDate=e?new Date(e):new Date,this.salesOrder=t,this.checkIsDifferentFullfillmentOutlet(),this.initCursorFocus()}),this.registerService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.register=this.registerService.findOutletRegisterById(t.RegisterID),this.selectedOutlet=t,this.initCursorFocus(),this.checkIsDifferentFullfillmentOutlet()}),this.userRoleService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.userRole=t}),this.orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.isSalesOrderEdit=t.posState==2})}checkIsDifferentFullfillmentOutlet(){let t=this.salesOrder.Action?.DeliveryEntityID;if(S.IsNotEmpty(t))if(this.selectedOutlet?.EntityID!=t){let i=(this.pageInitialService.Data?.Entities).find(o=>o.ID==t);this.isDifferentFullfillmentOutlet.set({isDifferent:!0,outletName:i?.Name}),this.isFulfillmentLater.set(!1)}else this.isDifferentFullfillmentOutlet.update(e=>(e.isDifferent=!1,e)),this.isFulfillmentLater.set(!1);else t==S.GuidEmpty&&(this.isDifferentFullfillmentOutlet.update(e=>(e.isDifferent=!1,e)),this.isFulfillmentLater.set(!0))}openRegisterModal(){this.isSalesOrderEdit||this.dialog.open(Or,{id:"registerModal",disableClose:!0}).afterClosed().pipe(k(this.destroy$),ce(t=>S.IsNotEmpty(t?.selectedRegister))).subscribe(t=>{t?.openStartingCashDialog&&this.openOpeningCashModal()})}openOpeningCashModal(){this.pageInitialService.Data.AppConfigJSON.ModuleShift.Closure.Enabled&&this.dialog.open(Pr,{disableClose:!0}).afterClosed().pipe(ce(e=>S.IsNotEmpty(e))).subscribe(e=>{let i={RegisterID:this.salesOrder.Order.RegisterID,OpAmount:e.amount};console.log(i),this.coreService.recordOpeningCash(i),document.getElementById("product").focus()})}onAddItem(t){this.shoppingCartService.addCartItemById(t).then(()=>{this.openModalItemOnNew(t)})}onBarcodeScan(t){S.IsNotEmpty(t)&&this.shoppingCartService.addCartItemByCode(t).then(e=>{this.openModalItemOnNew(e.ID)})}openModalItemOnNew(t){if(this.pageInitialService.Data.AppConfigJSON.ModuleSell.ProductDialog.OpenOnNewItemAdded){let i=this.salesOrder.CartItems.find(l=>l.VariantID==t),o=this.salesOrder.Items.lastIndexOf(i);this.dialog.open($e,{data:{index:o,focus:"quantity"}})}}onEditNumber(){this.userRole.NumberEditor&&this.dialog.open(Hr,{width:"20%"})}openFulfillmentModal(){this.dialog.open(oi)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}initCursorFocus(){let t=document.getElementById("product");t&&t.focus()}static \u0275fac=function(e){return new(e||n)(d(Y),d(V),d(B),d(Ir),d(ne),d(Me),d(me),d(j))};static \u0275cmp=P({type:n,selectors:[["sell-header"]],standalone:!1,decls:19,vars:23,consts:[["EMPTY_NUMBER",""],["fulfillmentIndicator",""],[1,"row"],[1,"col-8","d-flex","align-items-center","ps-8","pe-0"],["data-cy","dialog-select-register",1,"text-danger","cursor-pointer",2,"font-size","30px",3,"click"],[1,"fa-solid","fa-location-dot"],[1,"ms-2",3,"ngClass"],["data-cy","dialog-select-register","matTooltipPosition","above",3,"click","matTooltip"],["data-cy","dialog-edit-number",1,"fw-normal",3,"click","ngClass","matTooltip"],[4,"ngIf","ngIfElse"],[1,"col-4","text-end",3,"ngClass"],[1,"d-inline-block","pt-1","px-2"],[1,"d-flex","align-items-center","justify-content-end"],[3,"ngModelChange","ngModel","disabled","tooltip"],[1,"text-body-secondary","fst-italic"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"ngClass","matTooltip"],["role","button",1,"d-flex","align-items-center","cursor-pointer",3,"click"],[3,"ngClass"],[1,"fa-duotone","fa-light","fa-truck"],[1,"text--truncated"]],template:function(e,i){if(e&1){let o=v();r(0,"div",2)(1,"div",3)(2,"div",4),_("click",function(){return u(o),f(i.openRegisterModal())}),h(3,"i",5),a(),r(4,"div",6)(5,"h3",7),_("click",function(){return u(o),f(i.openRegisterModal())}),m(6),b(7,"limitTo"),a(),r(8,"h6",8),_("click",function(){return u(o),f(i.onEditNumber())}),g(9,Ap,3,2,"ng-container",9)(10,Lp,2,0,"ng-template",null,0,G),a()()(),r(12,"div",10),g(13,Fp,2,7,"div",11)(14,Hp,2,5,"div",11),r(15,"div",12)(16,"POS-invoice-date",13),w("ngModelChange",function(C){return u(o),D(i.selectedDate,C)||(i.selectedDate=C),f(C)}),_("ngModelChange",function(){return u(o),f(i.onSelectDate())}),a()()()(),g(17,Wp,5,8,"ng-template",null,1,G)}if(e&2){let o,l,C=Q(11);s(4),p("ngClass",E(16,wp,i.userRole.NumberEditor)),s(),p("matTooltip",i.register==null?null:i.register.Name),s(),y(" ",pe(7,13,i.register!=null&&i.register.Name?i.register==null?null:i.register.Name:"Choose an Outlet",25)," "),s(2),p("ngClass",E(18,kp,!i.userRole.NumberEditor))("matTooltip",i.userRole.NumberEditor?"Sales order number":"Number Edit role is required"),s(),p("ngIf",i.salesOrder==null||i.salesOrder.Order==null?null:i.salesOrder.Order.Number)("ngIfElse",C),s(3),p("ngClass",ge(20,Tp,!((o=i.isDifferentFullfillmentOutlet())!=null&&o.isDifferent)&&!i.isFulfillmentLater(),(o=i.isDifferentFullfillmentOutlet())==null?null:o.isDifferent)),s(),R((l=i.isDifferentFullfillmentOutlet())!=null&&l.isDifferent?13:-1),s(),R(i.isFulfillmentLater()?14:-1),s(2),M("ngModel",i.selectedDate),p("disabled",!(i.userRole!=null&&i.userRole.DateEditor))("tooltip",i.userRole!=null&&i.userRole.DateEditor?"":"Date role is required")}},dependencies:[H,$,Pi,K,ie,se,Qi,Di],styles:[`div.custom-datepicker-sell>datepicker mat-form-field{padding-right:0!important;background:#fff}div.custom-datepicker-sell>datepicker mat-form-field .mat-mdc-text-field-wrapper{padding-bottom:0}div.custom-datepicker-sell>datepicker .mat-mdc-form-field-flex{width:130px;height:40px;border:1px solid rgb(221,221,221);border-radius:4px}div.custom-datepicker-sell>datepicker .mat-mdc-form-field-infix{border:none!important;top:7px}div.custom-datepicker-sell>datepicker .mat-mdc-form-field-infix input{font-size:14px;color:#000;padding-left:40px}div.custom-datepicker-sell>datepicker .mat-mdc-form-field-icon-suffix{left:-102px;top:5px}div.custom-datepicker-sell>datepicker .mat-mdc-form-field-icon-suffix .mat-mdc-button-persistent-ripple{color:#000}div.custom-datepicker-sell>datepicker .mat-form-field-underline{display:none}.calendar-ui{position:absolute!important;width:280px;top:42px;z-index:2;right:0}.number-disabled{background-color:#ebebe4}.d-flex .text--truncated{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
40
|
-
`],encapsulation:2})};var qp=n=>({"bg-gradient-danger":n}),Hn=class n{constructor(t){this.onlineStatusService=t;this.isOnline$=t.getOnlineStatus$()}isOnline$;static \u0275fac=function(e){return new(e||n)(d(qe))};static \u0275cmp=P({type:n,selectors:[["sell-left-content"]],standalone:!1,decls:8,vars:5,consts:[[1,"d-flex","flex-column"],[1,"row","border-bottom","pt-2",2,"min-height","60px",3,"ngClass"],[1,"col-12"],[1,"row","mt-5"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1),b(2,"async"),r(3,"div",2),h(4,"sell-header"),a()(),r(5,"div",3)(6,"div",2),h(7,"sell-quick-key"),a()()()),e&2&&(s(),p("ngClass",E(3,qp,!O(2,1,i.isOnline$))))},dependencies:[H,Fn,jn,Ne],encapsulation:2})};var Nt=n=>({selected:n});function Jp(n,t){if(n&1){let e=v();r(0,"a",10),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalTabState.TYPE))}),m(1," Tag "),a()}if(n&2){let e=c();p("ngClass",E(1,Nt,e.modalTabState.TYPE==e.currentTabState))}}function Gp(n,t){if(n&1){let e=v();r(0,"a",11),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalTabState.LOGISTICS))}),m(1," Logistics Service "),a()}if(n&2){let e=c();p("ngClass",E(1,Nt,e.modalTabState.LOGISTICS==e.currentTabState))}}function zp(n,t){if(n&1){let e=v();r(0,"a",12),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalTabState.NUMBER))}),m(1," Number "),a()}if(n&2){let e=c();p("ngClass",E(1,Nt,e.modalTabState.NUMBER==e.currentTabState))}}function Kp(n,t){if(n&1){let e=v();r(0,"div",15)(1,"label",16)(2,"input",17),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.posData.Order.TypeID,o)||(l.posData.Order.TypeID=o),f(o)}),_("click",function(){let o=u(e).$implicit,l=c(2);return f(l.onSelectCustomerPoType(o))}),a(),m(3),a()()}if(n&2){let e=t.$implicit,i=t.index,o=c(2);s(),di("for","potype-"+i),p("ngClass",E(6,Nt,o.posData.Order.TypeID==e.ID)),s(),di("id","potype-"+i),M("ngModel",o.posData.Order.TypeID),p("value",e.ID),s(),y(" ",e.Name," ")}}function Yp(n,t){if(n&1&&(x(0),r(1,"div",13),g(2,Kp,4,8,"div",14),a(),I()),n&2){let e=c();s(2),p("ngForOf",e.poTypes)}}function Xp(n,t){if(n&1){let e=v();r(0,"POS-tinymce-editor",21),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.posData.Order.Note,o)||(l.posData.Order.Note=o),f(o)}),a()}if(n&2){let e=c(2);M("ngModel",e.posData.Order.Note)}}function Zp(n,t){if(n&1){let e=v();r(0,"textarea",22),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.posData.Order.Note,o)||(l.posData.Order.Note=o),f(o)}),a()}if(n&2){let e=c(2);M("ngModel",e.posData.Order.Note)}}function em(n,t){if(n&1&&(x(0),r(1,"div",18),g(2,Xp,1,1,"POS-tinymce-editor",19)(3,Zp,1,1,"textarea",20),a(),I()),n&2){let e=c();s(2),p("ngIf",e.isOnline),s(),p("ngIf",!e.isOnline)}}function tm(n,t){if(n&1){let e=v();r(0,"div",15)(1,"label",16)(2,"input",17),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.posData.Order.LogisticsServiceID,o)||(l.posData.Order.LogisticsServiceID=o),f(o)}),_("click",function(){let o=u(e).$implicit,l=c(2);return f(l.onSelectLogisticsService(o.ID))}),a(),m(3),a()()}if(n&2){let e=t.$implicit,i=t.index,o=c(2);s(),di("for","potype-"+i),p("ngClass",E(6,Nt,o.posData.Order.LogisticsServiceID==e.ID)),s(),di("id","potype-"+i),M("ngModel",o.posData.Order.LogisticsServiceID),p("value",e.ID),s(),y(" ",e.Name," ")}}function im(n,t){if(n&1&&(x(0),r(1,"div",23)(2,"div",13),g(3,tm,4,8,"div",14),a()(),I()),n&2){let e=c();s(3),p("ngForOf",e.serviceLogistics)}}function nm(n,t){if(n&1){let e=v();x(0),r(1,"div",23)(2,"div",24)(3,"strong",25),m(4,"Reference Number"),a(),r(5,"input",26),w("ngModelChange",function(o){u(e);let l=c();return D(l.posData.Order.ReferenceNumber,o)||(l.posData.Order.ReferenceNumber=o),f(o)}),a()()(),r(6,"div",27)(7,"div",24)(8,"strong",25),m(9,"Invoice Number"),a(),r(10,"input",28),w("ngModelChange",function(o){u(e);let l=c();return D(l.posData==null?null:l.posData.Invoice.Number,o)||((l.posData==null?null:l.posData.Invoice).Number=o),f(o)}),a()()(),I()}if(n&2){let e=c();s(5),M("ngModel",e.posData.Order.ReferenceNumber),s(5),M("ngModel",e.posData==null?null:e.posData.Invoice.Number),p("disabled",!e.roleService.sell.Number)}}function om(n,t){if(n&1){let e=v();r(0,"div",33)(1,"span",34),m(2,"@"),a(),r(3,"input",35),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.exchangeRate,o)||(l.exchangeRate=o),f(o)}),a()()}if(n&2){let e=c(2);s(3),M("ngModel",e.exchangeRate)}}function rm(n,t){if(n&1){let e=v();x(0),r(1,"div",23)(2,"div",24)(3,"strong",25),m(4,"Number of Person"),a(),r(5,"input",29),w("ngModelChange",function(o){u(e);let l=c();return D(l.posData.Order.NumberOfPerson,o)||(l.posData.Order.NumberOfPerson=o),f(o)}),a()()(),r(6,"div",27)(7,"div",13)(8,"strong",25),m(9,"Currency"),a(),r(10,"div",30)(11,"ng-select",31),w("ngModelChange",function(o){u(e);let l=c();return D(l.posData.Order.CurrencyID,o)||(l.posData.Order.CurrencyID=o),f(o)}),_("change",function(o){u(e);let l=c();return f(l.updateCurrencySymbol(o))}),a(),g(12,om,4,1,"div",32),a()()(),I()}if(n&2){let e=c();s(5),M("ngModel",e.posData.Order.NumberOfPerson),s(6),p("items",e.currencies),M("ngModel",e.posData.Order.CurrencyID),p("clearable",!1),s(),p("ngIf",e.posData.Order.CurrencyID!=e.defaultCurrencyID)}}var Un=class n{constructor(t,e,i,o,l,C,N,ae,ke){this._dialogRef=t;this._orderDataService=e;this._posService=i;this._cashierCalculatorService=o;this._outletRegisterService=l;this._orderHttpService=C;this._toastrService=N;this._onlineService=ae;this.roleService=ke;this.destroy$=new z,this.currentTabState=1}serviceLogistics;posData;config=new U;defaultCurrencyID;get currencies(){return this._posService.Data.Currencies}get poTypes(){return this._posService.Data.PoTypes}currentTabState;modalTabState=aa;isOnline;exchangeRate=1;destroy$;appConfigJson;ngOnInit(){this.config.title="Invoice Notes",this.subscribeToObservable(),this.copyInvoiceNumberToNote()}subscribeToObservable(){this._orderDataService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.posData=t,this.exchangeRate=this.posData.Order.CurrencyRate}),this._posService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.appConfigJson=t.AppConfigJSON,this.defaultCurrencyID=this.appConfigJson.CoreDefaults.CurrencyID,this.serviceLogistics=t.ServicesLogistics}),this._onlineService.getOnlineStatus$().pipe(k(this.destroy$)).subscribe(t=>{this.isOnline=t,this.currentTabState=1,t||(this.currentTabState=0)})}copyInvoiceNumberToNote(){if(this.appConfigJson.ModuleSell.Numbering.FillNoteWithInvoiceNumber&&this.posData.Order.Note==""){let e=this.posData.Order.Number,i=e.slice(e.length-4);this.posData.Order.Note=i}}onOk(t){if(t=="Enter")return;let e=this.posData.Order.Note;if(e&&e.length>500){this._toastrService.warning("Maximum 500 characters allowed","Warning");return}this.posData.Order.removeEnterNote(),this.posData.Order.CurrencyRate=this.exchangeRate,this._orderDataService.pushNewValue(this.posData),this._dialogRef.close()}close(){this._dialogRef.close()}updateCurrencySymbol(t){this._cashierCalculatorService.currencySymbol=t.Symbol,this.exchangeRate=t.ExchangeRate}onSelectCustomerPoType(t){let e=this._outletRegisterService.Data;t.PrintTemplateID==0?(e.PrintTemplate=e.DefaultPrintTemplate,this._outletRegisterService.pushNewValue(e)):this._orderHttpService.getSalesOrderPrint(t.PrintTemplateID).pipe(k(this.destroy$)).subscribe(i=>{let o=Ri(en,i.Template);e.PrintTemplate=o,this._outletRegisterService.pushNewValue(e)})}onSelectLogisticsService(t){t===this.posData.Order.LogisticsServiceID?this.posData.Order.LogisticsServiceID=null:this.posData.Order.LogisticsServiceID=t}onTabChange(t){this.currentTabState=t}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(F),d(V),d(B),d(Pe),d(Y),d(Oe),d(ee),d(qe),d(Ht))};static \u0275cmp=P({type:n,selectors:[["POS-modal-note"]],standalone:!1,decls:18,vars:15,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container-fluid"],[1,"row","border-bottom"],["data-cy","tab-note",1,"btn","btn-link","note-tab",3,"click","ngClass"],["class","btn btn-link note-tab","data-cy","tab-type",3,"ngClass","click",4,"ngIf"],["class","btn btn-link note-tab","data-cy","tab-logistic",3,"ngClass","click",4,"ngIf"],["class","btn btn-link note-tab","data-cy","tab-number",3,"ngClass","click",4,"ngIf"],["data-cy","tab-other",1,"btn","btn-link","note-tab",3,"click","ngClass"],[1,"row","mt-8"],[4,"ngIf"],["data-cy","tab-type",1,"btn","btn-link","note-tab",3,"click","ngClass"],["data-cy","tab-logistic",1,"btn","btn-link","note-tab",3,"click","ngClass"],["data-cy","tab-number",1,"btn","btn-link","note-tab",3,"click","ngClass"],[1,"col-12"],["class","rad-btn",4,"ngFor","ngForOf"],[1,"rad-btn"],[3,"for","ngClass"],["type","radio",3,"ngModelChange","click","ngModel","value","id"],[1,"col-12","tinymce"],[3,"ngModel","ngModelChange",4,"ngIf"],["name","note","cols","80","class","form-control","rows","10",3,"ngModel","ngModelChange",4,"ngIf"],[3,"ngModelChange","ngModel"],["name","note","cols","80","rows","10",1,"form-control",3,"ngModelChange","ngModel"],[1,"row"],[1,"col-6"],[1,"mb-2"],["placeholder","Preorder Number","matTooltip","PO number if the product must be pre-ordered",1,"form-control","w-75","height-input",3,"ngModelChange","ngModel"],[1,"row","mt-3"],["type","text","required","","placeholder","Same as Order Number when blank","matTooltip","Same as Order Number when blank",1,"form-control","w-75","height-input",3,"ngModelChange","ngModel","disabled"],["autoNum","",1,"form-control","w-75","height-input",3,"ngModelChange","ngModel"],[1,"ps-0","d-flex","align-items-center"],["bindLabel","Name","bindValue","ID","placeholder","Outlet","appendTo","body",1,"currency-option",3,"ngModelChange","change","items","ngModel","clearable"],["class","ms-6 d-flex",4,"ngIf"],[1,"ms-6","d-flex"],[1,"pt-4"],["type","text","autoNum","",1,"border","border-light","ms-2","form-control",2,"width","100px",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(l){return i.onOk(l)})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div")(5,"a",3),_("click",function(){return i.onTabChange(i.modalTabState.NOTE)}),m(6," Note "),a(),g(7,Jp,2,3,"a",4)(8,Gp,2,3,"a",5)(9,zp,2,3,"a",6),r(10,"a",7),_("click",function(){return i.onTabChange(i.modalTabState.OTHER)}),m(11," Other "),a()()(),r(12,"div",8),g(13,Yp,3,1,"ng-container",9)(14,em,4,2,"ng-container",9)(15,im,4,1,"ng-container",9)(16,nm,11,3,"ng-container",9)(17,rm,13,5,"ng-container",9),a()()()()),e&2&&(p("config",i.config),s(5),p("ngClass",E(11,Nt,i.modalTabState.NOTE==i.currentTabState)),s(2),p("ngIf",i.isOnline),s(),p("ngIf",i.isOnline&&i.serviceLogistics.length),s(),p("ngIf",i.isOnline),s(),p("ngClass",E(13,Nt,i.modalTabState.OTHER==i.currentTabState)),s(3),p("ngIf",i.modalTabState.TYPE==i.currentTabState),s(),p("ngIf",i.modalTabState.NOTE==i.currentTabState),s(),p("ngIf",i.modalTabState.LOGISTICS==i.currentTabState),s(),p("ngIf",i.modalTabState.NUMBER==i.currentTabState),s(),p("ngIf",i.modalTabState.OTHER==i.currentTabState))},dependencies:[H,_e,$,te,Jo,K,jt,ie,W,nt,pt,se,Ot],styles:[`.text-warning{color:var(--bs-warning)!important}.bg-light-gray{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger{color:#fb404b!important}.text-dark{color:#5e5e5e!important}.text-success{color:#87cb16!important}.text-black{color:#000!important}.text-white{color:var(--bs-white)!important}.btn-light-blue{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue:focus,.btn-light-blue.focus{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled,.btn-light-blue:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue:not(:disabled):not(.disabled):active,.btn-light-blue:not(:disabled):not(.disabled).active,.show>.btn-light-blue.dropdown-toggle{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue:not(:disabled):not(.disabled):active:focus,.btn-light-blue:not(:disabled):not(.disabled).active:focus,.show>.btn-light-blue.dropdown-toggle:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger:focus,.btn-light-danger.focus{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled,.btn-light-danger:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger:not(:disabled):not(.disabled):active,.btn-light-danger:not(:disabled):not(.disabled).active,.show>.btn-light-danger.dropdown-toggle{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger:not(:disabled):not(.disabled):active:focus,.btn-light-danger:not(:disabled):not(.disabled).active:focus,.show>.btn-light-danger.dropdown-toggle:focus{box-shadow:0 0 0 .2rem #dc354540}content>div.container-fluid{min-height:200px}.tinymce a img{z-index:2;position:absolute;right:15px;bottom:19px}.tinymce editor{height:max-content;z-index:1}.rad-btn{position:relative;display:inline-block}.rad-btn label{border:1px solid #dddddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000}.rad-btn input[type=radio]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn label.selected{background:#dcdcdc;border:1px solid #dcdcdc}.btn-link.note-tab{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.note-tab.selected{color:#3b3b3b;border-bottom:4px solid #07a519}a.btn.btn-link.note-tab{color:inherit}.ng-select.currency-option{width:36%!important}
|
|
41
|
-
`],encapsulation:2})};function am(n,t){if(n&1&&(x(0),r(1,"tr")(2,"th",18),m(3," Amount "),a(),r(4,"td",19),m(5),b(6,"number"),a()(),I()),n&2){let e=c(2);s(5),y(" ",O(6,1,e.calculatorService.GrossTotal)," ")}}function lm(n,t){if(n&1&&(r(0,"span"),m(1),b(2,"number"),a()),n&2){let e=c(3);s(),y("",O(2,1,e.salesOrder.Order.Discount),"%")}}function sm(n,t){if(n&1&&(r(0,"span"),m(1),b(2,"number"),a()),n&2){let e=c(3);s(),y("",pe(2,1,e.salesOrder.Order.Discount,"1.0-4"),"%")}}function cm(n,t){if(n&1&&(r(0,"tr")(1,"th",18),m(2),g(3,lm,3,3,"span",0)(4,sm,3,4,"span",0),a(),r(5,"td",20),m(6),b(7,"number"),a()()),n&2){let e=c(2);s(2),y(" ",e.appConfig==null||e.appConfig.CorePrint==null?null:e.appConfig.CorePrint.Alias.Discount1," "),s(),p("ngIf",e.isIgnoreDecimalDisc1),s(),p("ngIf",!(e.appConfig!=null&&e.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal)),s(2),T(O(7,4,e.calculatorService.Discount1Amount*-1))}}function pm(n,t){if(n&1&&(r(0,"span"),m(1),b(2,"number"),a()),n&2){let e=c(3);s(),y("",O(2,1,e.salesOrder.Order.Discount2),"%")}}function mm(n,t){if(n&1&&(r(0,"span"),m(1),b(2,"number"),a()),n&2){let e=c(3);s(),y("",pe(2,1,e.salesOrder.Order.Discount2,"1.0-4"),"%")}}function dm(n,t){if(n&1&&(r(0,"tr")(1,"th",18),m(2),g(3,pm,3,3,"span",0)(4,mm,3,4,"span",0),a(),r(5,"td",20),m(6),b(7,"number"),a()()),n&2){let e=c(2);s(2),y(" ",e.appConfig==null||e.appConfig.CorePrint==null?null:e.appConfig.CorePrint.Alias.Discount2," "),s(),p("ngIf",e.isIgnoreDecimalDisc2),s(),p("ngIf",!(e.appConfig!=null&&e.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal)),s(2),T(O(7,4,e.calculatorService.Discount2Amount*-1))}}function um(n,t){if(n&1&&(r(0,"tr")(1,"th",18),m(2),a(),r(3,"td",20),m(4),b(5,"number"),a()()),n&2){let e=c(2);s(2),Ue(" ",e.appConfig==null||e.appConfig.CorePrint==null?null:e.appConfig.CorePrint.Alias.DiscountAmount," ",e.calculatorService.currencySymbol," "),s(2),T(O(5,3,e.salesOrder.Order.DiscountAmount*-1))}}function fm(n,t){if(n&1&&(r(0,"tr")(1,"th",18),m(2),a(),r(3,"td",19),m(4),b(5,"number"),a()()),n&2){let e=c(2);s(2),y(" ",e.calculatorService==null||e.calculatorService.tax==null?null:e.calculatorService.tax.Label," "),s(2),T(O(5,2,e.calculatorService==null?null:e.calculatorService.TaxAmount))}}function gm(n,t){if(n&1&&(r(0,"tr")(1,"th",18),m(2),b(3,"number"),a(),r(4,"td",21),m(5),b(6,"number"),a()()),n&2){let e=c(2);s(2),y(" SURCHARGE ",O(3,3,e.salesOrder==null?null:e.salesOrder.Invoice.SurchargePcg),"% "),s(2),p("ngClass",(e.salesOrder==null?null:e.salesOrder.Invoice.SurchargePcg)<0?"text-danger":""),s(),y(" ",O(6,5,e.calculatorService==null?null:e.calculatorService.SurchargeAmount),"")}}function _m(n,t){if(n&1&&(x(0),r(1,"div",13),h(2,"div",14)(3,"div",15),r(4,"div",16)(5,"table",17),g(6,am,7,3,"ng-container",0)(7,cm,8,6,"tr",0)(8,dm,8,6,"tr",0)(9,um,6,5,"tr",0)(10,fm,6,4,"tr",0)(11,gm,7,7,"tr",0),a()()(),I()),n&2){let e=c();s(6),p("ngIf",(e.calculatorService==null||e.calculatorService.tax==null?null:e.calculatorService.tax.CalculationTypeID)==e.taxCalculationType.Add&&(e.calculatorService==null||e.calculatorService.tax==null?null:e.calculatorService.tax.Rate)||(e.salesOrder==null||e.salesOrder.Order==null?null:e.salesOrder.Order.Discount)!=0||(e.salesOrder==null||e.salesOrder.Order==null?null:e.salesOrder.Order.Discount2)!=0||(e.salesOrder==null||e.salesOrder.Order==null?null:e.salesOrder.Order.DiscountAmount)!=0||(e.salesOrder==null||e.salesOrder.Invoice==null?null:e.salesOrder.Invoice.SurchargePcg)!=0),s(),p("ngIf",(e.salesOrder==null?null:e.salesOrder.Order.Discount)!=0),s(),p("ngIf",(e.salesOrder==null?null:e.salesOrder.Order.Discount2)!=0),s(),p("ngIf",(e.salesOrder==null?null:e.salesOrder.Order.DiscountAmount)!=0),s(),p("ngIf",e.calculatorService==null||e.calculatorService.tax==null?null:e.calculatorService.tax.Rate),s(),p("ngIf",(e.salesOrder==null?null:e.salesOrder.Invoice.SurchargePcg)!=0)}}function Cm(n,t){if(n&1){let e=v();x(0),r(1,"button",22),_("click",function(){u(e);let o=c();return f(o.onOpenModalDiscount())}),h(2,"i",23),a(),I()}}var Wn=class n{constructor(t,e,i,o,l,C,N,ae,ke){this.calculatorService=t;this.salesOrderService=e;this.userRoleService=i;this.outletService=o;this.pageInitialService=l;this.dialog=C;this.orderProcessorService=N;this.payService=ae;this.parkOrderService=ke;this.destroy$=new z}handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.payService.payOrder()}taxCalculationType=no;destroy$;salesOrder;userRole;appConfig;parkLayoutPack;orderProcessor;isIgnoreDecimalDisc1;isIgnoreDecimalDisc2;outletRegister;parkOrderRetrieve;ngOnInit(){this.subscribeToObservable()}subscribeToObservable(){this.appConfig=this.pageInitialService.Data.AppConfigJSON,this.salesOrderService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.salesOrder=t,t.TotalQuantity,this.initIgnoreDecimal()}),this.userRoleService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.userRole=t}),this.outletService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.outletRegister=t,this.parkLayoutPack=t.ParkLayoutPack}),this.orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.orderProcessor=t})}initIgnoreDecimal(){this.isIgnoreDecimalDisc1=this.checkIgnoreDecimalDisc(this.salesOrder.Order.Discount),this.isIgnoreDecimalDisc2=this.checkIgnoreDecimalDisc(this.salesOrder.Order.Discount2)}onPark(){this.parkOrderService.parkOrder()}onPayOrder(){this.payService.payOrder()}onOpenModalDiscount(){this.dialog.open(ii,{data:{tabIndexActive:"Discount"}})}checkIgnoreDecimalDisc(t){let e=this.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal,i=t%1===0;return e&&i}onOpenNotesModal(){this.dialog.open(Un,{width:"45%"})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(Pe),d(V),d(me),d(Y),d(B),d(ne),d(j),d(qr),d(we))};static \u0275cmp=P({type:n,selectors:[["sell-cart-footer"]],hostBindings:function(e,i){e&1&&_("keydown.F8",function(l){return i.handleF8(l)},!1,it)},inputs:{parkOrderRetrieve:"parkOrderRetrieve"},standalone:!1,decls:25,vars:15,consts:[[4,"ngIf"],[1,"row","mt-2","d-flex","align-items-center"],[1,"col-1","pe-0"],["type","button","matTooltip","Note","matTooltipPosition","above","data-cy","dialog-note",1,"btn","btn-gray","w-100","fs-3","px-0","py-6","headings-font-family",3,"click"],[1,"fa-regular","fa-note-sticky","fa-xl"],["matTooltipPosition","above",1,"pe-0","d-flex","align-items-center","col-4","ps-0",3,"matTooltip"],["type","button","data-cy","dialog-park",1,"btn","btn-gray","w-100","fs-3","px-0","py-6","headings-font-family","ms-6",3,"click","disabled"],[1,"fa-solid","fa-floppy-disk","me-3"],["matTooltipPosition","above",1,"pe-0","col-7",3,"matTooltip"],[1,"btn-group","w-100"],["type","button","data-cy","btn-pay",1,"btn","btn-success","w-100","fs-1","py-4",2,"border-left","0.1px solid #fff",3,"click","disabled"],[1,"d-flex","align-items-center","justify-content-between"],[1,"fs-3"],[1,"row"],[1,"col-1"],[1,"col-4"],[1,"pt-3","col-7",2,"padding-right","16px","padding-left","68px"],[1,"table","table-borderless"],[1,"text-start"],[1,"text-end","fs-5"],[1,"text-end","text-danger","fs-5"],[1,"text-end","fs-5",3,"ngClass"],["type","button","data-cy","dialog-discount-tax","matTooltip","Discount / Tax","matTooltipPosition","above",1,"btn","btn-success","fs-5",2,"border-right","0.1px solid #fff",3,"click"],[1,"fa-light","fa-percent"]],template:function(e,i){e&1&&(g(0,_m,12,6,"ng-container",0),r(1,"div",1)(2,"div",2)(3,"button",3),_("click",function(){return i.onOpenNotesModal()}),h(4,"i",4),a()(),r(5,"div",5)(6,"button",6),_("click",function(){return i.onPark()}),h(7,"i",7),r(8,"span"),m(9),a()()(),r(10,"div",8)(11,"div",9),g(12,Cm,3,0,"ng-container",0),r(13,"button",10),_("click",function(){return i.onPayOrder()}),r(14,"div",11)(15,"div")(16,"span"),m(17,"Pay"),a(),r(18,"small",12),m(19),b(20,"number"),a()(),r(21,"div"),m(22),b(23,"async"),b(24,"number"),a()()()()()()),e&2&&(p("ngIf",i.userRole.PriceVisible),s(5),p("matTooltip",i.userRole.Park?"":"You need `Park` role to access this button"),s(),p("disabled",!i.userRole.Park),s(3),T((i.appConfig==null||i.appConfig.ApplicationParkAndRetrieve==null||i.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel==null?null:i.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkButtonLabel)||"Park"),s(),p("matTooltip",i.userRole.Payment?"":"You need `Pay` role to access this button"),s(2),p("ngIf",i.userRole.Tax||i.userRole.Discount),s(),p("disabled",!i.userRole.Payment),s(6),y(" (",O(20,9,i.salesOrder.cartQuantity)," Items) "),s(3),y(" ",i.userRole!=null&&i.userRole.PriceVisible?O(24,13,O(23,11,i.calculatorService.Data$)):"-"," "))},dependencies:[H,$,se,Ne,X],styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}.table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] > th[_ngcontent-%COMP%] span[_ngcontent-%COMP%], .table[_ngcontent-%COMP%] td[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{padding:0}"]})};var bm=n=>({"ps-0":n});function vm(n,t){if(n&1){let e=v();x(0),r(1,"input",33),w("ngModelChange",function(o){u(e);let l=c(2).$implicit;return D(l.Splited,o)||(l.Splited=o),f(o)}),a(),I()}if(n&2){let e=c(2).$implicit;s(),M("ngModel",e.Splited)}}function Sm(n,t){if(n&1&&(x(0),r(1,"small"),m(2),a(),I()),n&2){let e=c(2).index;s(2),y("",e+1,".")}}function ym(n,t){if(n&1&&(x(0),r(1,"td",32)(2,"div",17),g(3,vm,2,1,"ng-container",15)(4,Sm,3,1,"ng-container",15),a()(),I()),n&2){let e=c().$implicit,i=c(2);s(3),p("ngIf",i.currentSellState==i.sellState.IsSplit&&e.Quantity>1),s(),p("ngIf",i.appConfig==null||i.appConfig.ModuleSell==null?null:i.appConfig.ModuleSell.Grid.RowNumberVisible)}}function xm(n,t){if(n&1&&(x(0),r(1,"div",35),h(2,"img",36),a(),I()),n&2){let e=c(2).$implicit;s(2),p("src",e.Variant==null?null:e.Variant.ThumbnailUrl,tt)}}function Im(n,t){n&1&&(r(0,"div",37),h(1,"i",38),a())}function Om(n,t){if(n&1&&(x(0),r(1,"span",34),g(2,xm,3,1,"ng-container",6)(3,Im,2,0,"ng-template",null,3,G),a(),I()),n&2){let e=Q(4),i=c().$implicit;s(2),p("ngIf",i.Variant==null?null:i.Variant.ThumbnailUrl)("ngIfElse",e)}}function Pm(n,t){n&1&&(x(0),h(1,"i",40),I())}function Mm(n,t){n&1&&h(0,"i",41)}function Dm(n,t){if(n&1&&(x(0),r(1,"span",39),g(2,Pm,2,0,"ng-container",6)(3,Mm,1,0,"ng-template",null,4,G),a(),I()),n&2){let e=Q(4),i=c().$implicit;s(2),p("ngIf",i.Taxable)("ngIfElse",e)}}function wm(n,t){n&1&&(x(0),h(1,"i",42),I())}function km(n,t){if(n&1&&(x(0),r(1,"small",43),m(2),a(),I()),n&2){let e=c().$implicit;s(2),y(" ",e.Variant.CategoryName," ")}}function Tm(n,t){if(n&1&&(x(0),r(1,"small",44),m(2),a(),I()),n&2){let e=c().$implicit;s(2),y(" ",e.Variant.BrandName," ")}}function Em(n,t){if(n&1&&(x(0),r(1,"small",45),m(2),a(),I()),n&2){let e=c().$implicit;s(2),y(" ",e.Variant.Storage," ")}}function Rm(n,t){if(n&1&&(x(0),h(1,"small",46),I()),n&2){let e=c().$implicit;s(),p("innerHtml",e.Note?e.Note:e.PriceNote,xi)}}function Nm(n,t){if(n&1&&(x(0),r(1,"small",47),m(2," Sold by "),r(3,"i"),m(4),a()(),I()),n&2){let e=c().$implicit;s(4),T(e.SalesName)}}function Vm(n,t){if(n&1&&(x(0),r(1,"small")(2,"i",48),m(3),a()(),I()),n&2){let e=c().$implicit;s(3),y("Fulfillment from: ",e.EntityName,"")}}function Am(n,t){if(n&1&&(r(0,"div",25),h(1,"i",49),a()),n&2){let e=c().$implicit;p("matTooltip",e.AvailableInventory<e.Quantity?e.AvailableInventory+" Available Stock":"")}}function Lm(n,t){if(n&1){let e=v();x(0),r(1,"span",50),_("click",function(){u(e);let o=c().index,l=c(2);return f(l.onEditItem(o,"quantity"))}),m(2),b(3,"quantityFraction"),a(),I()}if(n&2){let e=c().$implicit;s(2),y(" ",O(3,1,e.Quantity),"")}}function Bm(n,t){if(n&1){let e=v();x(0),r(1,"span",51),m(2,"x"),a(),r(3,"div",52),_("click",function(){u(e);let o=c().index,l=c(2);return f(l.onEditItem(o,"quantity"))}),r(4,"span",53),m(5),b(6,"quantityFraction"),a()(),I()}if(n&2){let e=c().$implicit;s(5),T(O(6,1,e.UnitQuantity))}}function Fm(n,t){if(n&1&&(x(0),r(1,"span",54),m(2),b(3,"quantityFraction"),a(),I()),n&2){let e=c().$implicit;s(2),y("@",O(3,1,e.VariantUnitQuantity),"")}}function jm(n,t){if(n&1&&(x(0),r(1,"small",55),m(2),a(),I()),n&2){let e=c().$implicit,i=c(2);s(2),T(i.isNotEmpty(e.Variant.UOM)?e.Variant.UOMName:"")}}function Hm(n,t){if(n&1&&(r(0,"div",59),m(1),b(2,"number"),a()),n&2){let e=c(4).$implicit;s(),y(" ",pe(2,1,e.UnitPriceOriginal,"1.0-4")," ")}}function Um(n,t){if(n&1){let e=v();x(0),r(1,"div",56),_("click",function(){u(e);let o=c(3).index,l=c(2);return f(l.onEditItem(o,"price"))}),g(2,Hm,3,4,"div",57),r(3,"div",58),m(4),b(5,"number"),a()(),I()}if(n&2){let e=c(3).$implicit;s(2),p("ngIf",e.UnitPriceOriginal>e.Price),s(2),y(" ",pe(5,2,e.Price,"1.0-4")," ")}}function Wm(n,t){if(n&1){let e=v();r(0,"div",50),_("click",function(){u(e);let o=c(3).index,l=c(2);return f(l.onEditItem(o,"price"))}),m(1),b(2,"number"),a()}if(n&2){let e=c(3).$implicit;s(),y(" ",pe(2,1,e.Price,"1.0-4")," ")}}function Qm(n,t){if(n&1&&(x(0),g(1,Um,6,5,"ng-container",6)(2,Wm,3,4,"ng-template",null,5,G),I()),n&2){let e=Q(3),i=c(4);s(),p("ngIf",i.appConfig==null||i.appConfig.ModuleSell==null||i.appConfig.ModuleSell.Promotion==null?null:i.appConfig.ModuleSell.Promotion.StrikethroughOriginalPrice)("ngIfElse",e)}}function qm(n,t){if(n&1&&(x(0),r(1,"div",24),g(2,Qm,4,2,"ng-container",15),a(),I()),n&2){let e=c().$implicit;s(2),p("ngIf",e.Price!==e.Total)}}function $m(n,t){if(n&1&&(x(0),r(1,"div"),m(2),b(3,"number"),a(),I()),n&2){let e=c().$implicit;s(2),y(" ",e.Discount==0?"":O(3,1,e.Discount*-1)+"%"," ")}}function Jm(n,t){if(n&1&&(x(0),r(1,"div"),m(2),b(3,"number"),a(),I()),n&2){let e=c().$implicit;s(2),y(" ",e.DiscountAmount==0?"":O(3,1,e.DiscountAmount*-1)," ")}}function Gm(n,t){if(n&1&&(r(0,"div",61),m(1),b(2,"number"),a()),n&2){let e=c(2).$implicit;s(),y(" ",pe(2,1,e.UnitPriceOriginal,"1.0-4")," ")}}function zm(n,t){if(n&1&&(x(0),r(1,"div",58),g(2,Gm,3,4,"div",60),r(3,"div",24),m(4),b(5,"amountFraction"),a()(),I()),n&2){let e=c().$implicit;s(2),p("ngIf",e.UnitPriceOriginal>e.Price),s(2),y(" ",O(5,2,e.Total)," ")}}function Km(n,t){if(n&1&&(r(0,"div",24)(1,"div",58),m(2),b(3,"amountFraction"),a()()),n&2){let e=c().$implicit,i=c(2);s(2),y(" ",i.userRole.PriceVisible?O(3,1,e.Total):" - "," ")}}function Ym(n,t){if(n&1){let e=v();x(0),r(1,"span",62),_("click",function(){u(e);let o=c().$implicit,l=c(2);return f(l.removeItem(o))}),h(2,"i",63),a(),I()}}function Xm(n,t){if(n&1){let e=v();r(0,"tr",14),b(1,"async"),_("contextmenu",function(o){let l=u(e),C=l.$implicit,N=l.index,ae=c(2);return f(ae.onContextMenu(o,C,N))}),g(2,ym,5,2,"ng-container",15),r(3,"td",16),_("click",function(){let o=u(e).index,l=c(2);return f(l.onEditItem(o,"quantity"))}),r(4,"div",17),g(5,Om,5,2,"ng-container",15),r(6,"div",18)(7,"div",19)(8,"span",20),m(9),a(),g(10,Dm,5,2,"ng-container",15)(11,wm,2,0,"ng-container",15),a(),r(12,"div",21),m(13),a(),g(14,km,3,1,"ng-container",15)(15,Tm,3,1,"ng-container",15)(16,Em,3,1,"ng-container",15),r(17,"div"),h(18,"app-serial-note",22),a(),g(19,Rm,2,1,"ng-container",15)(20,Nm,5,1,"ng-container",15)(21,Vm,4,1,"ng-container",15),a()()(),r(22,"td",23)(23,"div",24),g(24,Am,2,1,"div",25),r(25,"div",26),g(26,Lm,4,3,"ng-container",15)(27,Bm,7,3,"ng-container",15)(28,Fm,4,3,"ng-container",15)(29,jm,3,1,"ng-container",15),a()()(),r(30,"td"),g(31,qm,3,1,"ng-container",15),a(),r(32,"td",27),_("click",function(){let o=u(e).index,l=c(2);return f(l.onEditItem(o,"discount"))}),r(33,"div",28),g(34,$m,4,3,"ng-container",15)(35,Jm,4,3,"ng-container",15),a()(),r(36,"td",29),_("click",function(){let o=u(e).index,l=c(2);return f(l.onEditItem(o,"price"))}),g(37,zm,6,4,"ng-container",6)(38,Km,4,3,"ng-template",null,2,G),a(),r(40,"td",30)(41,"div",31),g(42,Ym,3,0,"ng-container",15),a()()()}if(n&2){let e=t.$implicit,i=Q(39),o=c(2);p("cdkDragDisabled",!O(1,26,o.enabledDragDrop$)),s(2),p("ngIf",(o.appConfig==null||o.appConfig.ModuleSell==null?null:o.appConfig.ModuleSell.Grid.RowNumberVisible)||o.currentSellState==o.sellState.IsSplit&&e.Quantity>1),s(),p("ngClass",E(28,bm,o.appConfig==null||o.appConfig.ModuleSell==null?null:o.appConfig.ModuleSell.Grid.RowNumberVisible)),s(2),p("ngIf",o.showThumbnail),s(4),y(" ",e.Variant.Name," "),s(),p("ngIf",o.appConfig==null||o.appConfig.ModuleSell==null?null:o.appConfig.ModuleSell.Grid.TaxVisible),s(),p("ngIf",e.PromotionGift),s(2),y(" ",e==null||e.Variant==null?null:e.Variant.Code," "),s(),p("ngIf",o.appConfig==null||o.appConfig.ModuleSell==null?null:o.appConfig.ModuleSell.Grid.CategoryVisible),s(),p("ngIf",o.appConfig==null||o.appConfig.ModuleSell==null?null:o.appConfig.ModuleSell.Grid.ShowBrandItemCart),s(),p("ngIf",o.appConfig==null||o.appConfig.ModuleSell==null||o.appConfig.ModuleSell.Grid==null?null:o.appConfig.ModuleSell.Grid.StorageVisible),s(2),p("serials",e.Serial),s(),p("ngIf",e.Note||e.PriceNote),s(),p("ngIf",e.SalesName),s(),p("ngIf",e.EntityName),s(3),R(e.AvailableInventory<e.Quantity&&((e==null||e.Variant==null?null:e.Variant.TypeID)<9||(e==null||e.Variant==null?null:e.Variant.TypeID)==o.inventoryType.Composite)?24:-1),s(2),p("ngIf",e.Quantity!==1&&e.Quantity!==0||e.UnitQuantity>1||e.VariantUnitQuantity>1),s(),p("ngIf",e.UnitQuantity>1),s(),p("ngIf",e.VariantUnitQuantity>1),s(),p("ngIf",o.isNotEmpty(e.Variant.UOM)&&(o.appConfig==null||o.appConfig.ModuleSell==null?null:o.appConfig.ModuleSell.Grid.UOMVisible)),s(2),p("ngIf",(e.Price!==e.Total||e.DiscountAmount>0||e.Discount>0||e.UnitPriceOriginal>e.Price)&&o.userRole.PriceVisible),s(3),p("ngIf",e.Discount>0),s(),p("ngIf",e.DiscountAmount>0),s(2),p("ngIf",(o.appConfig==null||o.appConfig.ModuleSell==null||o.appConfig.ModuleSell.Promotion==null?null:o.appConfig.ModuleSell.Promotion.StrikethroughOriginalPrice)&&e.Quantity==1&&o.userRole.PriceVisible)("ngIfElse",i),s(5),p("ngIf",o.hasItemDeletion)}}function Zm(n,t){if(n&1){let e=v();x(0),r(1,"div",9)(2,"div",10)(3,"table",11)(4,"tbody",12),_("cdkDropListDropped",function(o){u(e);let l=c();return f(l.drop(o))}),g(5,Xm,43,30,"tr",13),a()()()(),I()}if(n&2){let e=c();s(5),p("ngForOf",e.cartItems)}}function ed(n,t){n&1&&(r(0,"div",64)(1,"div",10)(2,"div",65)(3,"div",66)(4,"div",67),h(5,"i",68),a(),r(6,"div",69)(7,"span"),m(8,"Empty Cart"),a(),h(9,"br"),r(10,"span"),m(11,"Add products to the cart"),a(),h(12,"br"),r(13,"span"),m(14,"or scan barcode"),a()()()()()())}function td(n,t){if(n&1){let e=v();r(0,"button",70),_("click",function(){let o=u(e).item,l=c();return f(l.onReverse(o,!0))}),m(1," Return "),a(),r(2,"button",71),_("click",function(){let o=u(e).item,l=c();return f(l.onReverse(o,!1))}),m(3,"Sales"),a(),r(4,"button",70),_("click",function(){let o=u(e).item,l=c();return f(l.onSumPrice(o))}),m(5," Merge / SUM Price "),a(),r(6,"button",70),_("click",function(){let o=u(e).item,l=c();return f(l.onBundlePrice(o))}),m(7," Bundle Price "),a()}if(n&2){let e=c();p("disabled",!e.userRole.Return),s(4),p("disabled",!e.userRole.BundlingPrice),s(2),p("disabled",!e.userRole.BundlingPrice)}}var Qn=class n{constructor(t,e,i,o,l,C,N){this.salesOrderService=t;this.roleService=e;this.shoppingCartService=i;this.pageInitialService=o;this.dialog=l;this.orderProcessorService=C;this.moreMenuService=N;this.destroy$=new z,this.eventAddItem=new He,this.enabledDragDrop$=this.moreMenuService.enabledDragDrop$}destroy$;cartItems=[];userRole;appConfig;currentSellState;hasItemDeletion;eventAddItem;isAddItem=!0;sellState=xe;showThumbnail;enabledDragDrop$;inventoryType=Ei;ngOnInit(){this.subscribeToObservable(),this.initDragDropEnabled()}initDragDropEnabled(){S.isMobileDevice&&this.moreMenuService.enableDragDrop(!1)}contextMenu;contextMenuPosition={x:"0px",y:"0px"};onContextMenu(t,e,i){t.preventDefault(),this.contextMenuPosition.x=t.clientX+"px",this.contextMenuPosition.y=t.clientY+"px",e.Index=i,this.contextMenu.menuData={item:e},this.contextMenu.openMenu()}subscribeToObservable(){this.appConfig=this.pageInitialService.Data.AppConfigJSON,this.showThumbnail=this.appConfig?.ModuleSell?.Grid?.ProductImageVisible,this.salesOrderService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.emitEventAddItem(t.CartItems),this.cartItems=t.CartItems,this.setItemFulfillmentName()}),this.roleService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.userRole=t,this.initConfigItemDeletion()}),this.orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.currentSellState=t.posState,this.initConfigItemDeletion()})}emitEventAddItem(t=[]){t.length!==this.cartItems.length&&this.isAddItem&&this.eventAddItem.emit(),this.isAddItem=!0}initConfigItemDeletion(){this.hasItemDeletion=!0,(this.currentSellState==5||!this.userRole.DeleteItem||this.authorizeParkedOrdersItemDeletion()||this.currentSellState==6)&&(this.hasItemDeletion=!1)}authorizeParkedOrdersItemDeletion(){let t=!1,e=this.appConfig?.ApplicationParkAndRetrieve?.AccessControl?.AuthorizeParkedOrdersItemDeletion,i=this.userRole.ParkedDeletionAuthorized;return this.currentSellState==4&&(t=e&&!i),t}setItemFulfillmentName(){this.cartItems=this.cartItems.map(t=>(t.EntityName=this.pageInitialService.getOutletName(t.EntityID),t))}isNotEmpty(t){return S.IsNotEmpty(t)}drop(t){nr(this.cartItems,t.previousIndex,t.currentIndex),this.salesOrderService.Data.CartItems=this.cartItems}removeItem(t){this.isAddItem=!1,this.shoppingCartService.deleteCartItem(t)}onReverse(t,e){e?t.Quantity>0&&(t.Quantity=t.Quantity*-1):t.Quantity<0&&(t.Quantity=t.Quantity*-1),this.shoppingCartService.updateCartItem(t,t.Index)}onSumPrice(t){let e=0;this.cartItems.forEach((i,o)=>{e+=i.Quantity*i.Price*(100-i.Discount)/100-i.DiscountAmount,i.Price=0}),t.Price=e/t.Quantity,this.shoppingCartService.updateCartItem(t,t.Index)}onBundlePrice(t){let e=0;this.cartItems.forEach((i,o)=>{o!=t.Index&&(e+=i.Quantity*i.Price*(100-i.Discount)/100-i.DiscountAmount,i.Price=0)}),t.Price==0&&(t.Price=e/t.Quantity),this.shoppingCartService.updateCartItem(t,t.Index)}onEditItem(t,e){this.isAddItem=!1,this.dialog.open($e,{data:{index:t,focus:e}})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(V),d(me),d(Me),d(B),d(ne),d(j),d(kt))};static \u0275cmp=P({type:n,selectors:[["sell-cart-body"]],viewQuery:function(e,i){if(e&1&&ve(qi,7),e&2){let o;Se(o=ye())&&(i.contextMenu=o.first)}},outputs:{eventAddItem:"eventAddItem"},standalone:!1,decls:7,vars:7,consts:[["EMPTY_CART",""],["contextMenu","matMenu"],["ONLY_TOTAL",""],["NO_IMAGE",""],["NotTaxable",""],["NOT_STRIKETHROUGHT",""],[4,"ngIf","ngIfElse"],[2,"visibility","hidden","position","fixed",3,"matMenuTriggerFor"],["matMenuContent",""],[1,"row","g-0"],[1,"col-12"],[1,"table","table-borderless"],["cdkDropList","",3,"cdkDropListDropped"],["cdkDrag","","style","border-bottom: 0.5px solid #dee2e6",3,"cdkDragDisabled","contextmenu",4,"ngFor","ngForOf"],["cdkDrag","",2,"border-bottom","0.5px solid #dee2e6",3,"contextmenu","cdkDragDisabled"],[4,"ngIf"],[1,"pe-0",2,"width","50%",3,"click","ngClass"],[1,"d-flex","align-items-center"],[1,"d-block",2,"line-height","18px"],[1,"fs-5","d-flex","align-items-center"],[1,"me-1"],["title","Product Code",1,"fw-normal","fs-6","text-muted"],[3,"serials"],[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"],[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"],[2,"width","10px"],["type","checkbox",1,"me-2",3,"ngModelChange","ngModel"],[1,"me-4"],[1,"ratio","ratio-1x1",2,"width","55px"],[1,"item-image",3,"src"],[1,"item-image","d-flex","justify-content-center","align-items-center","text-center","fs-1"],[1,"fa-solid","fa-image",2,"color","#b4b4b4c2"],[1,"fst-italic","m-0","me-3"],["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"],["title","Product Promotion",1,"fa-solid","fa-gift"],["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"],["title","Note",1,"special-TinyMCE","m-0","fst-italic","d-block",3,"innerHtml"],["title","Sales Name",1,"text-success","fst-italic","d-block"],[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"],["title","Variant Unit Quantity",1,"fs-5"],["title","UOM",1,"ps-1","fs-5"],[1,"d-inline-block","fs-5",3,"click"],["class","text-decoration-line-through text-danger fs-5",4,"ngIf"],[1,"fs-5"],[1,"text-decoration-line-through","text-danger","fs-5"],["class","text-decoration-line-through text-danger d-flex align-items-center justify-content-end",4,"ngIf"],[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"],[1,"row","g-0","h-100"],[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"],["mat-menu-item","",3,"click","disabled"],["mat-menu-item","",3,"click"]],template:function(e,i){if(e&1&&(g(0,Zm,6,1,"ng-container",6)(1,ed,15,0,"ng-template",null,0,G),h(3,"div",7),r(4,"mat-menu",null,1),g(6,td,8,3,"ng-template",8),a()),e&2){let o=Q(2),l=Q(5);p("ngIf",i.cartItems.length>0)("ngIfElse",o),s(3),eo("left",i.contextMenuPosition.x)("top",i.contextMenuPosition.y),p("matMenuTriggerFor",l)}},dependencies:[H,_e,$,ht,K,ie,rr,or,Er,kr,Tr,qi,se,Rr,Ne,X,sr,lr],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}"]})};var qn=class{ID;Name;Code;Address;Phone;Email;SalesTarget;SalesPersonGroupID;Bin};var nd=["ngSelectInfinite"],od=(n,t)=>({"text-success":n,"text-danger":t}),rd=n=>({offline:n}),Da=n=>({"opacity-50":n}),wa=(n,t)=>({red:n,green:t});function ad(n,t){if(n&1&&(r(0,"span",8),m(1),b(2,"async"),b(3,"number"),a()),n&2){let e=c();s(),y(" ",O(3,3,O(2,1,e.totalOfflineOrders$))," ")}}function ld(n,t){if(n&1&&(r(0,"sup",13)(1,"div",26),m(2),b(3,"async"),b(4,"number"),a()()),n&2){let e=c();s(2),y(" ",O(4,3,O(3,1,e.moreMenuService.eligiblePromotions$))," ")}}function sd(n,t){if(n&1&&h(0,"span",37),n&2){let e=c(4);p("ngClass",ge(1,wa,!e.displayService.isEnabled(),e.displayService.isEnabled()))}}function cd(n,t){if(n&1&&h(0,"span",37),n&2){let e=c(4);p("ngClass",ge(1,wa,!e.ecrSignalService.isConnected(),e.ecrSignalService.isConnected()))}}function pd(n,t){if(n&1){let e=v();x(0),r(1,"li",33),_("click",function(){let o=u(e).$implicit,l=c(3);return f(o.disabled?null:l.moreMenuService.moreMenuAction(o.action))}),r(2,"div",34),h(3,"i",35),r(4,"span",36),m(5),a(),g(6,sd,1,4,"span",37)(7,cd,1,4,"span",37),a()(),I()}if(n&2){let e=t.$implicit;s(),p("matTooltip",e.disabled?e.description:"")("ngClass",E(8,Da,e.disabled)),wo("data-cy",e.cy),s(2),be(e.class),s(2),y(" ",e.label," "),s(),R(e.action=="CUSTOMER_DISPLAY"?6:-1),s(),R(e.action=="ECR"?7:-1)}}function md(n,t){if(n&1&&(x(0),r(1,"div",30),m(2),a(),h(3,"div",31),g(4,pd,8,10,"ng-container",32),I()),n&2){let e=c().$implicit;s(2),T(e.name),s(2),p("ngForOf",e.menus)}}function dd(n,t){if(n&1&&(r(0,"sup",13)(1,"div",26),m(2),b(3,"async"),b(4,"number"),a()()),n&2){let e=c(6);s(2),y(" ",O(4,3,O(3,1,e.moreMenuService.eligiblePromotions$))," ")}}function ud(n,t){if(n&1&&(x(0),r(1,"div",34),h(2,"i",35),r(3,"span",36),m(4),a(),g(5,dd,5,5,"sup",13),b(6,"async"),a(),I()),n&2){let e=c().$implicit,i=c(4);s(2),be(e.class),s(2),T(e.label),s(),R(e.label=="Event"&&O(6,4,i.moreMenuService.eligiblePromotions$)>0?5:-1)}}function fd(n,t){if(n&1){let e=v();r(0,"li",33),_("click",function(){let o=u(e).$implicit,l=c(4);return f(o.disabled?null:l.moreMenuService.moreMenuAction(o.action))}),g(1,ud,7,6,"ng-container",28),a()}if(n&2){let e=t.$implicit;p("matTooltip",e.disabled?e.description:"")("ngClass",E(3,Da,e.disabled)),s(),p("ngIf",e.isShow!==!1)}}function gd(n,t){if(n&1&&(x(0),r(1,"div",30),m(2),a(),h(3,"div",31),g(4,fd,2,5,"li",39),I()),n&2){let e=c().$implicit;s(2),T(e.name),s(2),p("ngForOf",e.menus)}}function _d(n,t){if(n&1&&(r(0,"div",38),g(1,gd,5,2,"ng-container",28),a()),n&2){let e=t.$implicit;s(),p("ngIf",(e.menus==null?null:e.menus.length)>0)}}function Cd(n,t){if(n&1&&(r(0,"div",27),g(1,md,5,2,"ng-container",28)(2,_d,2,1,"div",29),a()),n&2){let e=t.$implicit;s(),p("ngIf",(e.menus==null?null:e.menus.length)>0),s(),p("ngForOf",e.children)}}var $n=class n{constructor(t,e,i,o,l,C,N,ae,ke,Fe,je,ri){this.pageInitialService=t;this.salesOrderService=e;this.userRoleService=i;this.outletService=o;this.dialog=l;this.promotionEventService=C;this.moreMenuService=N;this._onlineStatusService=ae;this.toggleSidebar=ke;this.displayService=Fe;this.ecrSignalService=je;this.localDataService=ri;this.appConfig=this.pageInitialService.Data.AppConfigJSON,this.destroy$=new z,this.isOnline$=ae.getOnlineStatus$(),this.totalOfflineOrders$=this.localDataService.unsentOrders$.pipe(et(Tt=>Tt.length),At(1)),this.toggleSidebar.toggleState$.subscribe(Tt=>this.isChange=Tt)}salesOrder;appConfig;selectedCustomerId;userRole;salesPersonList=[];destroy$;outletRegister;salesPersonName;ngSelectInfinite;handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.dialog.open($e)}handleF2(){this.ngSelectInfinite&&this.ngSelectInfinite.ngSelectElement.focus()}disabledSalesOption=!1;salesPersonOptionTooltip=q("");isEnabledLoyaltyPoint;isOnline$;isChange=!0;totalOfflineOrders$;ngOnInit(){this.subscribeToObservable()}collapseSidebar(){this.toggleSidebar.toggleSidebar()}subscribeToObservable(){this.userRoleService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.userRole=t,this.checkDisabledSalesOption()}),this.salesOrderService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.salesOrder=t,this.checkDisabledSalesOption(t.CartItems),S.IsEmpty(this.salesOrder.Order.SalesID)&&(this.salesOrder.Order.SalesID=null)}),this.outletService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.initSalesPerson(t.ListSales),this.outletRegister=t}),this.promotionEventService.onClickToastPromo.pipe(k(this.destroy$)).subscribe(t=>{if(t){let e=this.dialog.getDialogById("promotion-event");S.IsEmpty(e)&&this.dialog.open(zi,{id:"promotion-event"})}})}checkDisabledSalesOption(t=[]){this.disabledSalesOption=!1,(t.filter(i=>S.IsNotEmpty(i.SalesID)).length>0||!this.userRole.SalesPerson)&&(this.disabledSalesOption=!0,this.salesPersonOptionTooltip.set("Sales person has been assigned to item")),this.userRole.SalesPerson||this.salesPersonOptionTooltip.set("You do not have permission to assign a sales person")}initSalesPerson(t){let e=new qn;e.ID=S.GuidEmpty,this.salesPersonList=[...t]}openOnlineStatusModal(){this.localDataService.unsentOrders$.pipe(Vt(1),Ee(t=>{let e=t.length>0?"ORDER":"SETUP";return this.dialog.open(Yi,{id:"ModalOfflineOrder",data:{activeTab:e}}).afterClosed()})).subscribe()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(B),d(V),d(me),d(Y),d(ne),d($t),d(kt),d(qe),d(Ko),d(Bi),d(Jt),d(Ye))};static \u0275cmp=P({type:n,selectors:[["sell-cart-header"]],viewQuery:function(e,i){if(e&1&&ve(nd,7),e&2){let o;Se(o=ye())&&(i.ngSelectInfinite=o.first)}},hostBindings:function(e,i){e&1&&_("keydown.F4",function(l){return i.handleF8(l)},!1,it)("keydown.control.F2",function(l){return i.handleF2(l)},!1,it)},standalone:!1,decls:38,vars:34,consts:[["ngSelectInfinite",""],[1,"row","g-0","d-print-none","pt-2"],[1,"col-7","d-flex","align-items-center"],[1,"d-flex","align-items-center","justify-content-between","ms-8"],[1,"d-flex","align-items-center","pe-8","cursor-pointer",3,"click"],[1,"me-2"],[1,"fa","fa-circle",3,"ngClass"],[1,"fs-6","headings-font-family","pb-1","position-relative"],[1,"position-absolute","top-0","translate-middle","badge","rounded-pill","bg-danger","ms-3"],[1,"border-start",2,"height","30px"],["id","moreMenu","data-bs-toggle","dropdown",1,"d-flex","align-items-center","ps-8","cursor-pointer"],[1,"fa-solid","fa-caret-down","fa-lg"],[1,"fs-6","headings-font-family","pb-1"],[1,"badge","rounded-pill","bg-danger","ms-1","customize-badge"],["aria-labelledby","moreMenu",1,"dropdown-menu","more-actions"],["aria-labelledby","moreMenu",1,"d-flex"],["class","dropdown-header text-dark col pe-8",4,"ngFor","ngForOf"],[1,"col-5"],[1,"d-flex","align-items-center","justify-content-end"],[1,"mt-1"],[1,"fa-light","fa-id-badge",2,"font-size","17px"],[1,"fs-5",2,"width","calc(100% - 32px)",3,"matTooltip"],["bindValue","ID","bindLabel","Name","placeholder","Assign Sales Person","matTooltipPosition","above",1,"sales-person","select-max-width",3,"selectedChange","selectedLabel","clearable","ngClass","items","selected","disabled","optionTitle","matTooltip"],[1,"navbar","mobile-button"],["type","button","aria-controls","navigation-index","aria-expanded","false","aria-label","Toggle navigation",1,"navbar-toggler","navbar-toggler-right","float-end","toggle-menu","ps-2","pe-0","border-0",2,"width","max-content","height","max-content",3,"click"],[1,"navbar-toggler-bar","burger-lines"],[1,"d-flex","align-items-center","w-100","justify-content-center"],[1,"dropdown-header","text-dark","col","pe-8"],[4,"ngIf"],["class","mt-5",4,"ngFor","ngForOf"],[1,"h5","mb-4"],[1,"dropdown-divider","m-0"],[4,"ngFor","ngForOf"],["matTooltipPosition","above",1,"cursor-pointer",3,"click","matTooltip","ngClass"],[1,"dropdown-item","px-1"],["aria-hidden","true"],[1,"fw-normal","fs-5","ps-4"],[1,"blob","ms-2",2,"position","absolute",3,"ngClass"],[1,"mt-5"],["matTooltipPosition","above","class","cursor-pointer",3,"matTooltip","ngClass","click",4,"ngFor","ngForOf"]],template:function(e,i){if(e&1){let o=v();r(0,"div",1)(1,"div",2)(2,"div",3)(3,"span",4),_("click",function(){return u(o),f(i.openOnlineStatusModal())}),r(4,"span",5),h(5,"i",6),b(6,"async"),b(7,"async"),a(),r(8,"span",7),m(9),b(10,"async"),g(11,ad,4,5,"span",8),b(12,"async"),a()(),h(13,"span",9),r(14,"span",10)(15,"span",5),h(16,"i",11),a(),r(17,"span",12),m(18,"More Actions"),a(),g(19,ld,5,5,"sup",13),b(20,"async"),a(),r(21,"div",14)(22,"div",15),g(23,Cd,3,2,"div",16),b(24,"async"),a()()()(),r(25,"div",17)(26,"div",18)(27,"div",19),h(28,"i",20),a(),r(29,"div",21)(30,"ng-select-infinite",22,0),b(32,"async"),w("selectedChange",function(C){return u(o),D(i.salesOrder.Order.SalesID,C)||(i.salesOrder.Order.SalesID=C),f(C)}),_("selectedLabel",function(C){return u(o),f(i.salesPersonName=C)}),a()(),r(33,"div",23)(34,"button",24),_("click",function(){return u(o),f(i.collapseSidebar())}),h(35,"span",25)(36,"span",25)(37,"span",25),a()()()()()}e&2&&(s(5),p("ngClass",ge(29,od,O(6,15,i.isOnline$),!O(7,17,i.isOnline$))),s(4),y("",O(10,19,i.isOnline$)?"Online":"Offline"," "),s(2),R(O(12,21,i.totalOfflineOrders$)>0?11:-1),s(8),R(O(20,23,i.moreMenuService.eligiblePromotions$)>0?19:-1),s(4),p("ngForOf",O(24,25,i.moreMenuService.moreMenu$)),s(6),p("matTooltip",i.salesPersonName),s(),p("clearable",!0)("ngClass",E(32,rd,!O(32,27,i.isOnline$)))("items",i.salesPersonList),M("selected",i.salesOrder.Order.SalesID),p("disabled",i.disabledSalesOption)("optionTitle",!0)("matTooltip",i.salesPersonOptionTooltip()),s(4),ko("change",i.isChange))},dependencies:[H,_e,$,Ni,se,Ne,X],styles:[`.disabled{color:gray;pointer-events:none;cursor:not-allowed}.blob{background:#000;border-radius:50%;box-shadow:0 0 #000;height:15px;width:15px;transform:scale(1);animation:pulse-black 2s infinite}@keyframes pulse-black{0%{transform:scale(.95);box-shadow:0 0 #000000b3}70%{transform:scale(1);box-shadow:0 0 0 10px #0000}to{transform:scale(.95);box-shadow:0 0 #0000}}.blob.white{background:#fff;box-shadow:0 0 #fff;animation:pulse-white 2s infinite}@keyframes pulse-white{0%{transform:scale(.95);box-shadow:0 0 #ffffffb3}70%{transform:scale(1);box-shadow:0 0 0 10px #fff0}to{transform:scale(.95);box-shadow:0 0 #fff0}}.blob.red{background:#ff5252;box-shadow:0 0 #ff5252;animation:pulse-red 2s infinite}@keyframes pulse-red{0%{transform:scale(.95);box-shadow:0 0 #ff5252b3}70%{transform:scale(1);box-shadow:0 0 0 10px #ff525200}to{transform:scale(.95);box-shadow:0 0 #ff525200}}.blob.orange{background:#ff793f;box-shadow:0 0 #ff793f;animation:pulse-orange 2s infinite}@keyframes pulse-orange{0%{transform:scale(.95);box-shadow:0 0 #ff793fb3}70%{transform:scale(1);box-shadow:0 0 0 10px #ff793f00}to{transform:scale(.95);box-shadow:0 0 #ff793f00}}.blob.yellow{background:#ffb142;box-shadow:0 0 #ffb142;animation:pulse-yellow 2s infinite}@keyframes pulse-yellow{0%{transform:scale(.95);box-shadow:0 0 #ffb142b3}70%{transform:scale(1);box-shadow:0 0 0 10px #ffb14200}to{transform:scale(.95);box-shadow:0 0 #ffb14200}}.blob.blue{background:#34ace0;box-shadow:0 0 #34ace0;animation:pulse-blue 2s infinite}@keyframes pulse-blue{0%{transform:scale(.95);box-shadow:0 0 #34ace0b3}70%{transform:scale(1);box-shadow:0 0 0 10px #34ace000}to{transform:scale(.95);box-shadow:0 0 #34ace000}}.blob.green{background:#77d933;box-shadow:0 0 #77d933;animation:pulse-green 2s infinite}@keyframes pulse-green{0%{transform:scale(.95);box-shadow:0 0 #33d938b3}70%{transform:scale(1);box-shadow:0 0 0 10px #33d9b200}to{transform:scale(.95);box-shadow:0 0 #33d9b200}}.blob.purple{background:#8e44ad;box-shadow:0 0 #8e44ad;animation:pulse-purple 2s infinite}@keyframes pulse-purple{0%{transform:scale(.95);box-shadow:0 0 #8e44adb3}70%{transform:scale(1);box-shadow:0 0 0 10px #8e44ad00}to{transform:scale(.95);box-shadow:0 0 #8e44ad00}}ng-select-infinite.sales-person.select-max-width>ng-select{padding-right:10px;height:38px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{font-size:.75rem;border:.5px solid #d7d7d7;padding-right:6px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container>.ng-arrow-wrapper{width:12px;padding-bottom:2px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container>.ng-value-container{padding-left:6px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{min-height:38px!important;height:38px!important;border:none}ng-select-infinite.sales-person.select-max-width.offline>.ng-select.ng-select-single .ng-select-container{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container .ng-input{padding-left:5px!important}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container .ng-input>input{padding-top:5px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single>ng-dropdown-panel.ng-dropdown-panel{font-size:.75rem;width:95%!important}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-focused .ng-select-container{box-shadow:none!important;border-color:transparent!important}.change .burger-lines{transition:.4s}.change .burger-lines:nth-child(1){-webkit-transform:rotate(-45deg) translate(-8px,4px);transform:rotate(-45deg) translate(-8px,4px)}.change .burger-lines:nth-child(2){opacity:0}.change .burger-lines:nth-child(3){-webkit-transform:rotate(45deg) translate(-5px,0px);transform:rotate(45deg) translate(-5px)}.mobile-button{display:none}@media (max-width: 990px){.mobile-button{display:block}}.navbar-toggler:focus{box-shadow:none!important}.customize-badge{height:16px;width:16px;font-size:9px}
|
|
42
|
-
`],encapsulation:2})};var
|
|
43
|
-
`],encapsulation:2})};var
|
|
44
|
-
`],encapsulation:2})};var
|
|
39
|
+
`,okText:"Connect"},this.dialog.open(gi,{data:e,width:"500px"}).afterClosed().pipe(pe(i=>i),Re(()=>{t?this.customerDisplay.disconnect():this.customerDisplay.connect()})).subscribe(()=>{this.toastrService.success(`Customer Display is ${t?"disconnected":"connected"}`,"Success")})}enableDragDrop(t){let e=S.cloneObject(this._moreMenu.value);e=e.map(i=>(i.name=="Advanced"&&(i.menus=i.menus.map(o=>(o.action=="SORT"&&(o.label=t?"Disable Sort":"Enable Sort"),o))),i)),this._moreMenu.next(e),this._enabledDragDrop.next(t)}checkAvailableInventory(){let i=this.salesOrderService.Data.CartItems.map(l=>l.VariantID),o={Outlet:this.outletRegisterService.Data.EntityID,Cart:i};this.httpService.post(fe.ValidateInventory,o).subscribe(l=>{this.setAvailableInventory(l)})}setAvailableInventory(t){let e=this.salesOrderService.Data,i=e.CartItems,o=0;e.CartItems=i.map(l=>{let C=t.findIndex(N=>N.VariantID==l.VariantID);return C!==-1&&(l.AvailableInventory=t[C].OnHand,(l.Variant?.TypeID<9||l.Variant?.TypeID==12)&&(o+=l.Quantity>l.AvailableInventory?1:0)),l}),this.showToastrValidateInventory(o),this.salesOrderService.pushNewValue(e)}showToastrValidateInventory(t){t>0?this.toastrService.error(`There are ${t} 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")}filterMoreMenu(t){let e=[];t==4?e=this.filterMenuByRole().map(i=>(i.menus=i.menus.filter(o=>o.action!=="CANCEL"),i)):t==5?e=this.filterMenuByRole().map(i=>(i.menus=i.menus.filter(o=>o.action!=="SPLIT"),i)):e=this.filterMenuByRole().filter(i=>i.name!=="Bill"),e=this.disabledMenuOnEdit(e,t),this._moreMenu.next(e)}disabledMenuOnEdit(t,e){let i=this.salesOrderService.Data;return e==2&&(t=t.map(o=>(o.children=o.children?.map(l=>(l.menus=l.menus.map(C=>{switch(C.action){case"PROMOTION":i?.getRewards()?.length>0&&(C.disabled=!0,C.description="Promotion event selection is disabled as this transaction already applies a reward from a promotion event");break}return C}),l)),o.menus=o.menus.map(l=>{switch(l.action){case"RETURN":l.disabled=!0,l.description="Return is disabled in edit mode";break}return l}),o))),t}filterMenuByRole(){let t=this.roleService?.Data,e=S.cloneObject(this.sourceMenu);return e=this.filterMenuByRoles([{action:"RETRIEVE",role:t.Retrieve},{action:"FULFILLMENT",role:t.Shipping},{action:"RETURN",role:t.Return},{action:"CLEAR",role:t.DeleteItem}],e),e}filterMenuByRoles(t,e=[]){let i;return e.map(o=>(o.menus=o.menus.map(l=>(i=t.findIndex(C=>C.action==l.action),i!==-1?l.disabled=t[i].role==!1:l.disabled=!1,l)),o))}onRetrieve(){let t=this.outletRegisterService.Data.ParkLayoutPack,e=this.pageInitialService.Data.AppConfigJSON;if(t?.Layout==null&&e.ApplicationParkAndRetrieve.Advance.retreiveMode==1){this.toastrService.error("Your retrieve config is in Group mode, to enable park please setting your Park layout at Outlet page","Error!");return}this.dialog.open(wn).afterClosed().pipe(k(this.destroy$),pe(i=>S.IsNotEmpty(i))).subscribe(i=>{this.parkOrderService.parkOrderRetrieve=i,this.orderProcessorService.Data.posState=4})}onCancel(){this.orderProcessorService.Data.posState==4?this.orderProcessorService.updatePosState(5):(this.orderProcessorService.updatePosState(4),this.resetSplitedItem())}resetSplitedItem(){let t=this.salesOrderService.Data;t.CartItems=t.CartItems.map(e=>(e.SplitQuantity=0,e.Splited=!1,e)),this.salesOrderService.pushNewValue(t)}onFulfillment(){this.dialog.open(oi)}onImportItems(){let t=this.salesOrderService?.Data?.Order?.EntityID;this.dialog.open(Xi,{data:{sampleUrl:"https://res.cloudinary.com/pos/raw/upload/v1699867624/POS/CSV/ImportSell_DealPOS_New.csv",API:fe.UploadCsv,outletID:t,useUppy:!0,fileEndpoint:"/API/POS/UploadCsvV3"}}).afterClosed().pipe(pe(e=>!!e)).subscribe(e=>{let i;for(let o of e)i=new Be,o.Variant.UnitPrice=o.Price,o.Variant.UnitCost=o.Cost,o.Variant.PriceDiscount=o.Discount,i.Quantity=o.Quantity,i.patchByVariant(o.Variant,!0),i.Note=o.Note?o.Note:i.Note,i.DiscountAmount=o.DiscountAmount,i.Serial=o.Serial,this.shoppingCartService.pushNewItemToArray(i,!0)})}onSplitItem(){this.dialog.open(Tn)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(A(me),A(j),A($t),A(Xe),A(It),A(ne),A(we),A(V),A(Y),A(B),A(ee),A(Qe),A(Me),A(Bi),A(Gi),A(Jt))};static \u0275prov=at({token:n,factory:n.\u0275fac})};var xa=n=>({"quickkey-subscription-overdue":n}),Ia=()=>["/menu/Outlets/Master/Quick_Key_Templates/Form"],sp=n=>({ID:n}),cp=n=>({OutletID:n});function pp(n,t){if(n&1&&h(0,"img",25),n&2){let e=c(2).$implicit;p("ngSrc",e.ImageURLClient)}}function mp(n,t){if(n&1&&(x(0),r(1,"div",22)(2,"div",23),g(3,pp,1,1,"img",24),a()(),I()),n&2){let e=c().$implicit;s(3),p("ngIf",e.ImageURLClient)}}function dp(n,t){if(n&1&&(r(0,"div",23)(1,"p",26)(2,"span"),m(3),b(4,"slice"),a()()()),n&2){let e=c().$implicit;s(3),T(Ge(4,1,e.Display,0,3))}}function up(n,t){if(n&1&&(r(0,"small",28),m(1),b(2,"number"),a()),n&2){let e=c(2).$implicit;s(),T(O(2,1,e.Children[0].UnitPrice))}}function fp(n,t){if(n&1&&(r(0,"small",29),m(1),b(2,"lowestPrice"),b(3,"number"),b(4,"highestPrice"),b(5,"number"),a()),n&2){let e=c(2).$implicit;s(),Ue("",O(3,4,O(2,2,e==null?null:e.Children))," - ",O(5,8,O(4,6,e==null?null:e.Children)),"")}}function gp(n,t){if(n&1&&(x(0),g(1,up,3,3,"small",27)(2,fp,6,10,"ng-template",null,3,G),I()),n&2){let e=q(3),i=c().$implicit;s(),p("ngIf",i.Children.length==1)("ngIfElse",e)}}function _p(n,t){if(n&1){let e=v();r(0,"div",19)(1,"a",20),_("click",function(){let o=u(e).$implicit,l=c(4);return f(l.onSelectProduct(o))}),g(2,mp,4,1,"ng-container",8)(3,dp,5,5,"ng-template",null,2,G),r(5,"small"),m(6),b(7,"slice"),a(),g(8,gp,4,2,"ng-container",21),a()()}if(n&2){let e=t.$implicit,i=q(4),o=c(4);be(o.colConfigCSSClass),s(2),p("ngIf",e.ImageURLClient)("ngIfElse",i),s(4),T(Ge(7,6,e.Display,0,36)),s(2),p("ngIf",o.quickKeyPriceVisible)}}function Cp(n,t){if(n&1&&(r(0,"mat-tab",12)(1,"div",13)(2,"div",14),g(3,_p,9,10,"div",15),r(4,"div",16)(5,"a",17),h(6,"i",18),a()()()()()),n&2){let e=t.$implicit,i=c(3);p("label",e.Name),s(3),p("ngForOf",e==null?null:e.Items),s(),be(i.colConfigCSSClass),s(),p("routerLink",ct(6,Ia))("queryParams",E(7,sp,i.quickKey.ID))}}function hp(n,t){if(n&1){let e=v();r(0,"mat-tab-group",10),w("selectedIndexChange",function(o){u(e);let l=c(2);return D(l.quickeyTabActive,o)||(l.quickeyTabActive=o),f(o)}),g(1,Cp,7,9,"mat-tab",11),a()}if(n&2){let e=c(2);p("disableRipple",!0),M("selectedIndex",e.quickeyTabActive),s(),p("ngForOf",e.quickKey==null?null:e.quickKey.Groups)}}function bp(n,t){if(n&1&&h(0,"img",37),n&2){let e=c(2).$implicit;p("src",e.ImageURLClient,tt)}}function vp(n,t){if(n&1&&(x(0),r(1,"div",22)(2,"div",23),g(3,bp,1,1,"img",36),a()(),I()),n&2){let e=c().$implicit;s(3),p("ngIf",e.ImageURLClient)}}function Sp(n,t){if(n&1&&(r(0,"div",23)(1,"p",26)(2,"span"),m(3),b(4,"slice"),a()()()),n&2){let e=c().$implicit;s(3),T(Ge(4,1,e.Model,0,3))}}function yp(n,t){if(n&1&&(r(0,"small",28),m(1),b(2,"number"),a()),n&2){let e=c().$implicit;s(),T(O(2,1,e.UnitPrice))}}function xp(n,t){if(n&1){let e=v();r(0,"div",19)(1,"a",20),_("click",function(){let o=u(e).$implicit,l=c(3);return f(l.onSelectVariant(o.ID))}),g(2,vp,4,1,"ng-container",8)(3,Sp,5,5,"ng-template",null,4,G),r(5,"small"),m(6),b(7,"slice"),a(),g(8,yp,3,3,"small",35),a()()}if(n&2){let e=t.$implicit,i=q(4),o=c(3);be(o.colConfigCSSClass),s(2),p("ngIf",e.ImageURLClient)("ngIfElse",i),s(4),T(Ge(7,6,e.Model,0,30)),s(2),p("ngIf",o.quickKeyPriceVisible)}}function Ip(n,t){if(n&1){let e=v();r(0,"div",30)(1,"div",31),_("click",function(){u(e);let o=c(2);return f(o.quickeyState="QUICKEY")}),h(2,"i",32),a(),r(3,"div",33)(4,"b"),m(5),a()()(),r(6,"div",13)(7,"div",34),g(8,xp,9,10,"div",15),a()()}if(n&2){let e=c(2);s(5),y(" ",e.subQuickeyPack.Display,""),s(3),p("ngForOf",e.subQuickeyPack==null?null:e.subQuickeyPack.Children)}}function Op(n,t){if(n&1&&(x(0),g(1,hp,2,3,"mat-tab-group",9)(2,Ip,9,2,"ng-template",null,1,G),I()),n&2){let e=q(3),i=c();s(),p("ngIf",i.quickeyState=="QUICKEY")("ngIfElse",e)}}function Pp(n,t){if(n&1&&(r(0,"div",38)(1,"a",39)(2,"strong"),m(3,"QUICK KEYS UNCONFIGURED"),a(),h(4,"i",40),r(5,"span"),m(6,"Click here to setup your Quick keys"),a()()()),n&2){let e=c();p("ngClass",E(3,xa,e.currentSubsStatus==e.subscriptionStatus.OVERDUE||e.currentSubsStatus==e.subscriptionStatus.SELL_ONLY)),s(),p("routerLink",ct(5,Ia))("queryParams",E(6,cp,e.entityId))}}var Fn=class n{constructor(t,e,i,o,l,C){this.outletRegisterService=t;this.shoppingCartService=e;this.dialog=i;this.pageInitialService=o;this.salesOrderService=l;this.authService=C;this.destroy$=new z,this.quickeyState="QUICKEY",this.currentSubsStatus=this.authService.getSubscriptionStatus()}destroy$;quickKey;subQuickeyPack;entityId;quickeyState;quickeyTabActive=0;colConfigCSSClass;subscriptionStatus=Ft;currentSubsStatus;nextProductID;quickKeyPriceVisible=!1;ngOnInit(){this.getOutletRegister(),this.colConfigCSSClass=`col-${12/this.pageInitialService.Data.AppConfigJSON.ModuleSell.QuickKey.QuickkeyTotalRow}`,this.quickKeyPriceVisible=this.pageInitialService.Data.AppConfigJSON.ModuleSell.QuickKey.QuickKeyPriceVisible}getOutletRegister(){this.outletRegisterService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.entityId=t.EntityID,this.quickKey=t.QuickKeyPack,this.quickKey.ID})}onSelectProduct(t){this.nextProductID=t.NextProductID,!t.Children||t.Children.length<1?this.onSelectVariant(t.ItemID):t.Children.length==1?this.onSelectVariant(t.Children[0].ID):(this.quickeyState="SUBQUICKEY",this.subQuickeyPack={Children:t.Children,Display:t.Display})}onSelectVariant(t){this.shoppingCartService.addCartItemById(t).then(()=>{this.quickeyState="QUICKEY";let e=this.pageInitialService.Data.AppConfigJSON,i=this.salesOrderService.Data.CartItems;if(e.ModuleSell.ProductDialog.OpenOnNewItemAdded){let o=i.length-1;this.dialog.open($e,{data:{index:o,focus:"quantity"}})}this.openNextProduct()})}openNextProduct(){S.IsNotEmpty(this.nextProductID)&&this.quickKey.Groups.forEach(t=>{let e=t?.Items?.find(i=>i.ProductID==this.nextProductID);e!=null&&e.Children.length>1&&(this.quickeyState="SUBQUICKEY",this.subQuickeyPack={Children:e.Children,Display:e.Display})})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(Y),d(Me),d(ne),d(B),d(V),d(Ut))};static \u0275cmp=P({type:n,selectors:[["sell-quick-key"]],standalone:!1,decls:6,vars:5,consts:[["noQuickKey",""],["SUBQUICKEY",""],["BLANK_IMG",""],["MULTIPLE_VARIANT",""],["BLANK_IMG_SUB",""],[1,"row"],[1,"col-12"],[1,"quick-key-tab",3,"ngClass"],[4,"ngIf","ngIfElse"],["class","h-100 bgQuickkeyIllustration landscape",3,"disableRipple","selectedIndex","selectedIndexChange",4,"ngIf","ngIfElse"],[1,"h-100","bgQuickkeyIllustration","landscape",3,"selectedIndexChange","disableRipple","selectedIndex"],[3,"label",4,"ngFor","ngForOf"],[3,"label"],[1,"container","tabItems"],[1,"row","g-0"],["class","column px-6",3,"class",4,"ngFor","ngForOf"],[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"],[4,"ngIf"],[1,"img-box","d-flex","align-items-center"],[1,"ratio","ratio-1x1"],["class","full-screen-image","priority","","fill","",3,"ngSrc",4,"ngIf"],["priority","","fill","",1,"full-screen-image",3,"ngSrc"],[1,"fw-normal","fs-1","d-flex","align-items-center","justify-content-center"],["class","text-muted",4,"ngIf","ngIfElse"],[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"],["class","text-muted",4,"ngIf"],["class","full-screen-image",3,"src",4,"ngIf"],[1,"full-screen-image",3,"src"],[1,"no-quick-key","d-flex","align-items-center","justify-content-center",3,"ngClass"],["id","LinkConfigureQuickkey","target","_blank",3,"routerLink","queryParams"],["aria-hidden","true",1,"fa-regular","fa-hand-pointer"]],template:function(e,i){if(e&1&&(r(0,"div",5)(1,"div",6)(2,"section",7),g(3,Op,4,2,"ng-container",8)(4,Pp,7,8,"ng-template",null,0,G),a()()()),e&2){let o=q(5);s(2),p("ngClass",E(3,xa,i.currentSubsStatus==i.subscriptionStatus.OVERDUE||i.currentSubsStatus==i.subscriptionStatus.SELL_ONLY)),s(),p("ngIf",(i.quickKey==null?null:i.quickKey.Groups)&&(i.quickKey==null||i.quickKey.Groups==null?null:i.quickKey.Groups.length)>0)("ngIfElse",o)}},dependencies:[U,_e,$,St,yt,Lt,Bo,Lo,X,cr,pr],styles:[".quick-key-tab{width:100%;position:relative;height:100%;max-height:calc(100vh - 70px)} .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-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(//res.cloudinary.com/pos/image/upload/w_500/POS/Images/Cashier/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}"]})};var Dp=n=>({"cursor-pointer":n}),wp=n=>({"px-2 py-2 number-disabled":n}),kp=(n,t)=>({"d-flex justify-content-end align-items-center":n,"mt-1":t}),Tp=(n,t)=>({label:n,tooltip:t}),Oa=n=>({data:n}),Ep=()=>({label:"Later",tooltip:"Fulfillment Later"}),Rp=n=>({"bg-gradient-warning px-2":n}),Np=n=>({"me-3":n});function Vp(n,t){if(n&1&&(x(0),r(1,"span"),m(2),a(),I()),n&2){let e=c();s(2),Ue("",e.isSalesOrderEdit?"Editing Order ":"Sales Order ","#",e.salesOrder==null||e.salesOrder.Order==null?null:e.salesOrder.Order.Number,"")}}function Ap(n,t){n&1&&(r(0,"div",14),m(1,"Order Number"),a())}function Lp(n,t){n&1&&mi(0)}function Bp(n,t){if(n&1&&(r(0,"div",11),g(1,Lp,1,0,"ng-container",15),a()),n&2){let e=c(),i=q(18);s(),p("ngTemplateOutlet",i)("ngTemplateOutletContext",E(5,Oa,ge(2,Tp,e.isDifferentFullfillmentOutlet().outletName,e.isDifferentFullfillmentOutlet().outletName)))}}function Fp(n,t){n&1&&mi(0)}function jp(n,t){if(n&1&&(r(0,"div",11),g(1,Fp,1,0,"ng-container",15),a()),n&2){c();let e=q(18);s(),p("ngTemplateOutlet",e)("ngTemplateOutletContext",E(3,Oa,ct(2,Ep)))}}function Hp(n,t){if(n&1&&(r(0,"h5",20),m(1),b(2,"limitTo"),a()),n&2){let e=c().data;s(),T(le(2,1,e==null?null:e.label,14))}}function Up(n,t){if(n&1){let e=v();r(0,"div",16)(1,"div",17),_("click",function(){u(e);let o=c();return f(o.openFulfillmentModal())}),r(2,"div",18),h(3,"i",19),a(),g(4,Hp,3,4,"h5",20),a()()}if(n&2){let e=t.data;p("ngClass",E(4,Rp,e.label))("matTooltip",e==null?null:e.tooltip),s(2),p("ngClass",E(6,Np,e.label)),s(2),R(e!=null&&e.label?4:-1)}}var jn=class n{constructor(t,e,i,o,l,C,N,ae){this.registerService=t;this.salesOrderService=e;this.pageInitialService=i;this.coreService=o;this.dialog=l;this.shoppingCartService=C;this.userRoleService=N;this.orderProcessorService=ae;this.destroy$=new z}selectedOutlet;destroy$;salesOrder;register;userRole;isSalesOrderEdit=!1;selectedDate=new Date;isDifferentFullfillmentOutlet=H({isDifferent:!1,outletName:""});isFulfillmentLater=H(!1);ngOnInit(){this.subscribeToObservable()}ngAfterViewInit(){this.initCursorFocus()}onSelectDate(){this.salesOrder.Order.Date=this.selectedDate,this.salesOrderService.pushNewValue(this.salesOrder)}subscribeToObservable(){this.salesOrderService.Data$.pipe(k(this.destroy$)).subscribe(t=>{let e=t.Order.Date;this.selectedDate=e?new Date(e):new Date,this.salesOrder=t,this.checkIsDifferentFullfillmentOutlet(),this.initCursorFocus()}),this.registerService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.register=this.registerService.findOutletRegisterById(t.RegisterID),this.selectedOutlet=t,this.initCursorFocus(),this.checkIsDifferentFullfillmentOutlet()}),this.userRoleService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.userRole=t}),this.orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.isSalesOrderEdit=t.posState==2})}checkIsDifferentFullfillmentOutlet(){let t=this.salesOrder.Action?.DeliveryEntityID;if(S.IsNotEmpty(t))if(this.selectedOutlet?.EntityID!=t){let i=(this.pageInitialService.Data?.Entities).find(o=>o.ID==t);this.isDifferentFullfillmentOutlet.set({isDifferent:!0,outletName:i?.Name}),this.isFulfillmentLater.set(!1)}else this.isDifferentFullfillmentOutlet.update(e=>(e.isDifferent=!1,e)),this.isFulfillmentLater.set(!1);else t==S.GuidEmpty&&(this.isDifferentFullfillmentOutlet.update(e=>(e.isDifferent=!1,e)),this.isFulfillmentLater.set(!0))}openRegisterModal(){this.isSalesOrderEdit||this.dialog.open(Ir,{id:"registerModal",disableClose:!0}).afterClosed().pipe(k(this.destroy$),pe(t=>S.IsNotEmpty(t?.selectedRegister))).subscribe(t=>{t?.openStartingCashDialog&&this.openOpeningCashModal()})}openOpeningCashModal(){this.pageInitialService.Data.AppConfigJSON.ModuleShift.Closure.Enabled&&this.dialog.open(Or,{disableClose:!0}).afterClosed().pipe(pe(e=>S.IsNotEmpty(e))).subscribe(e=>{let i={RegisterID:this.salesOrder.Order.RegisterID,OpAmount:e.amount};console.log(i),this.coreService.recordOpeningCash(i),document.getElementById("product").focus()})}onAddItem(t){this.shoppingCartService.addCartItemById(t).then(()=>{this.openModalItemOnNew(t)})}onBarcodeScan(t){S.IsNotEmpty(t)&&this.shoppingCartService.addCartItemByCode(t).then(e=>{this.openModalItemOnNew(e.ID)})}openModalItemOnNew(t){if(this.pageInitialService.Data.AppConfigJSON.ModuleSell.ProductDialog.OpenOnNewItemAdded){let i=this.salesOrder.CartItems.find(l=>l.VariantID==t),o=this.salesOrder.Items.lastIndexOf(i);this.dialog.open($e,{data:{index:o,focus:"quantity"}})}}onEditNumber(){this.userRole.NumberEditor&&this.dialog.open(jr,{width:"20%"})}openFulfillmentModal(){this.dialog.open(oi)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}initCursorFocus(){let t=document.getElementById("product");t&&t.focus()}static \u0275fac=function(e){return new(e||n)(d(Y),d(V),d(B),d(xr),d(ne),d(Me),d(me),d(j))};static \u0275cmp=P({type:n,selectors:[["sell-header"]],standalone:!1,decls:19,vars:23,consts:[["EMPTY_NUMBER",""],["fulfillmentIndicator",""],[1,"row"],[1,"col-8","d-flex","align-items-center","ps-8","pe-0"],["data-cy","dialog-select-register",1,"text-danger","cursor-pointer",2,"font-size","30px",3,"click"],[1,"fa-solid","fa-location-dot"],[1,"ms-2",3,"ngClass"],["data-cy","dialog-select-register","matTooltipPosition","above",3,"click","matTooltip"],["data-cy","dialog-edit-number",1,"fw-normal",3,"click","ngClass","matTooltip"],[4,"ngIf","ngIfElse"],[1,"col-4","text-end",3,"ngClass"],[1,"d-inline-block","pt-1","px-2"],[1,"d-flex","align-items-center","justify-content-end"],[3,"ngModelChange","ngModel","disabled","tooltip"],[1,"text-body-secondary","fst-italic"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"ngClass","matTooltip"],["role","button",1,"d-flex","align-items-center","cursor-pointer",3,"click"],[3,"ngClass"],[1,"fa-duotone","fa-light","fa-truck"],[1,"text--truncated"]],template:function(e,i){if(e&1){let o=v();r(0,"div",2)(1,"div",3)(2,"div",4),_("click",function(){return u(o),f(i.openRegisterModal())}),h(3,"i",5),a(),r(4,"div",6)(5,"h3",7),_("click",function(){return u(o),f(i.openRegisterModal())}),m(6),b(7,"limitTo"),a(),r(8,"h6",8),_("click",function(){return u(o),f(i.onEditNumber())}),g(9,Vp,3,2,"ng-container",9)(10,Ap,2,0,"ng-template",null,0,G),a()()(),r(12,"div",10),g(13,Bp,2,7,"div",11)(14,jp,2,5,"div",11),r(15,"div",12)(16,"POS-invoice-date",13),w("ngModelChange",function(C){return u(o),D(i.selectedDate,C)||(i.selectedDate=C),f(C)}),_("ngModelChange",function(){return u(o),f(i.onSelectDate())}),a()()()(),g(17,Up,5,8,"ng-template",null,1,G)}if(e&2){let o,l,C=q(11);s(4),p("ngClass",E(16,Dp,i.userRole.NumberEditor)),s(),p("matTooltip",i.register==null?null:i.register.Name),s(),y(" ",le(7,13,i.register!=null&&i.register.Name?i.register==null?null:i.register.Name:"Choose an Outlet",25)," "),s(2),p("ngClass",E(18,wp,!i.userRole.NumberEditor))("matTooltip",i.userRole.NumberEditor?"Sales order number":"Number Edit role is required"),s(),p("ngIf",i.salesOrder==null||i.salesOrder.Order==null?null:i.salesOrder.Order.Number)("ngIfElse",C),s(3),p("ngClass",ge(20,kp,!((o=i.isDifferentFullfillmentOutlet())!=null&&o.isDifferent)&&!i.isFulfillmentLater(),(o=i.isDifferentFullfillmentOutlet())==null?null:o.isDifferent)),s(),R((l=i.isDifferentFullfillmentOutlet())!=null&&l.isDifferent?13:-1),s(),R(i.isFulfillmentLater()?14:-1),s(2),M("ngModel",i.selectedDate),p("disabled",!(i.userRole!=null&&i.userRole.DateEditor))("tooltip",i.userRole!=null&&i.userRole.DateEditor?"":"Date role is required")}},dependencies:[U,$,Pi,K,ie,ce,Qi,Di],styles:[`div.custom-datepicker-sell>datepicker mat-form-field{padding-right:0!important;background:#fff}div.custom-datepicker-sell>datepicker mat-form-field .mat-mdc-text-field-wrapper{padding-bottom:0}div.custom-datepicker-sell>datepicker .mat-mdc-form-field-flex{width:130px;height:40px;border:1px solid rgb(221,221,221);border-radius:4px}div.custom-datepicker-sell>datepicker .mat-mdc-form-field-infix{border:none!important;top:7px}div.custom-datepicker-sell>datepicker .mat-mdc-form-field-infix input{font-size:14px;color:#000;padding-left:40px}div.custom-datepicker-sell>datepicker .mat-mdc-form-field-icon-suffix{left:-102px;top:5px}div.custom-datepicker-sell>datepicker .mat-mdc-form-field-icon-suffix .mat-mdc-button-persistent-ripple{color:#000}div.custom-datepicker-sell>datepicker .mat-form-field-underline{display:none}.calendar-ui{position:absolute!important;width:280px;top:42px;z-index:2;right:0}.number-disabled{background-color:#ebebe4}.d-flex .text--truncated{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
40
|
+
`],encapsulation:2})};var Qp=n=>({"bg-gradient-danger":n}),Hn=class n{constructor(t){this.onlineStatusService=t;this.isOnline$=t.getOnlineStatus$()}isOnline$;static \u0275fac=function(e){return new(e||n)(d(qe))};static \u0275cmp=P({type:n,selectors:[["sell-left-content"]],standalone:!1,decls:8,vars:5,consts:[[1,"d-flex","flex-column"],[1,"row","border-bottom","pt-2",2,"min-height","60px",3,"ngClass"],[1,"col-12"],[1,"row","mt-5"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1),b(2,"async"),r(3,"div",2),h(4,"sell-header"),a()(),r(5,"div",3)(6,"div",2),h(7,"sell-quick-key"),a()()()),e&2&&(s(),p("ngClass",E(3,Qp,!O(2,1,i.isOnline$))))},dependencies:[U,Fn,jn,Ne],encapsulation:2})};var Nt=n=>({selected:n});function $p(n,t){if(n&1){let e=v();r(0,"a",10),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalTabState.TYPE))}),m(1," Tag "),a()}if(n&2){let e=c();p("ngClass",E(1,Nt,e.modalTabState.TYPE==e.currentTabState))}}function Jp(n,t){if(n&1){let e=v();r(0,"a",11),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalTabState.LOGISTICS))}),m(1," Logistics Service "),a()}if(n&2){let e=c();p("ngClass",E(1,Nt,e.modalTabState.LOGISTICS==e.currentTabState))}}function Gp(n,t){if(n&1){let e=v();r(0,"a",12),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalTabState.NUMBER))}),m(1," Number "),a()}if(n&2){let e=c();p("ngClass",E(1,Nt,e.modalTabState.NUMBER==e.currentTabState))}}function zp(n,t){if(n&1){let e=v();r(0,"div",15)(1,"label",16)(2,"input",17),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.posData.Order.TypeID,o)||(l.posData.Order.TypeID=o),f(o)}),_("click",function(){let o=u(e).$implicit,l=c(2);return f(l.onSelectCustomerPoType(o))}),a(),m(3),a()()}if(n&2){let e=t.$implicit,i=t.index,o=c(2);s(),di("for","potype-"+i),p("ngClass",E(6,Nt,o.posData.Order.TypeID==e.ID)),s(),di("id","potype-"+i),M("ngModel",o.posData.Order.TypeID),p("value",e.ID),s(),y(" ",e.Name," ")}}function Kp(n,t){if(n&1&&(x(0),r(1,"div",13),g(2,zp,4,8,"div",14),a(),I()),n&2){let e=c();s(2),p("ngForOf",e.poTypes)}}function Yp(n,t){if(n&1){let e=v();r(0,"POS-tinymce-editor",21),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.posData.Order.Note,o)||(l.posData.Order.Note=o),f(o)}),a()}if(n&2){let e=c(2);M("ngModel",e.posData.Order.Note)}}function Xp(n,t){if(n&1){let e=v();r(0,"textarea",22),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.posData.Order.Note,o)||(l.posData.Order.Note=o),f(o)}),a()}if(n&2){let e=c(2);M("ngModel",e.posData.Order.Note)}}function Zp(n,t){if(n&1&&(x(0),r(1,"div",18),g(2,Yp,1,1,"POS-tinymce-editor",19)(3,Xp,1,1,"textarea",20),a(),I()),n&2){let e=c();s(2),p("ngIf",e.isOnline),s(),p("ngIf",!e.isOnline)}}function em(n,t){if(n&1){let e=v();r(0,"div",15)(1,"label",16)(2,"input",17),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.posData.Order.LogisticsServiceID,o)||(l.posData.Order.LogisticsServiceID=o),f(o)}),_("click",function(){let o=u(e).$implicit,l=c(2);return f(l.onSelectLogisticsService(o.ID))}),a(),m(3),a()()}if(n&2){let e=t.$implicit,i=t.index,o=c(2);s(),di("for","potype-"+i),p("ngClass",E(6,Nt,o.posData.Order.LogisticsServiceID==e.ID)),s(),di("id","potype-"+i),M("ngModel",o.posData.Order.LogisticsServiceID),p("value",e.ID),s(),y(" ",e.Name," ")}}function tm(n,t){if(n&1&&(x(0),r(1,"div",23)(2,"div",13),g(3,em,4,8,"div",14),a()(),I()),n&2){let e=c();s(3),p("ngForOf",e.serviceLogistics)}}function im(n,t){if(n&1){let e=v();x(0),r(1,"div",23)(2,"div",24)(3,"strong",25),m(4,"Reference Number"),a(),r(5,"input",26),w("ngModelChange",function(o){u(e);let l=c();return D(l.posData.Order.ReferenceNumber,o)||(l.posData.Order.ReferenceNumber=o),f(o)}),a()()(),r(6,"div",27)(7,"div",24)(8,"strong",25),m(9,"Invoice Number"),a(),r(10,"input",28),w("ngModelChange",function(o){u(e);let l=c();return D(l.posData==null?null:l.posData.Invoice.Number,o)||((l.posData==null?null:l.posData.Invoice).Number=o),f(o)}),a()()(),I()}if(n&2){let e=c();s(5),M("ngModel",e.posData.Order.ReferenceNumber),s(5),M("ngModel",e.posData==null?null:e.posData.Invoice.Number),p("disabled",!e.roleService.sell.Number)}}function nm(n,t){if(n&1){let e=v();r(0,"div",33)(1,"span",34),m(2,"@"),a(),r(3,"input",35),w("ngModelChange",function(o){u(e);let l=c(2);return D(l.exchangeRate,o)||(l.exchangeRate=o),f(o)}),a()()}if(n&2){let e=c(2);s(3),M("ngModel",e.exchangeRate)}}function om(n,t){if(n&1){let e=v();x(0),r(1,"div",23)(2,"div",24)(3,"strong",25),m(4,"Number of Person"),a(),r(5,"input",29),w("ngModelChange",function(o){u(e);let l=c();return D(l.posData.Order.NumberOfPerson,o)||(l.posData.Order.NumberOfPerson=o),f(o)}),a()()(),r(6,"div",27)(7,"div",13)(8,"strong",25),m(9,"Currency"),a(),r(10,"div",30)(11,"ng-select",31),w("ngModelChange",function(o){u(e);let l=c();return D(l.posData.Order.CurrencyID,o)||(l.posData.Order.CurrencyID=o),f(o)}),_("change",function(o){u(e);let l=c();return f(l.updateCurrencySymbol(o))}),a(),g(12,nm,4,1,"div",32),a()()(),I()}if(n&2){let e=c();s(5),M("ngModel",e.posData.Order.NumberOfPerson),s(6),p("items",e.currencies),M("ngModel",e.posData.Order.CurrencyID),p("clearable",!1),s(),p("ngIf",e.posData.Order.CurrencyID!=e.defaultCurrencyID)}}var Un=class n{constructor(t,e,i,o,l,C,N,ae,ke){this._dialogRef=t;this._orderDataService=e;this._posService=i;this._cashierCalculatorService=o;this._outletRegisterService=l;this._orderHttpService=C;this._toastrService=N;this._onlineService=ae;this.roleService=ke;this.destroy$=new z,this.currentTabState=1}serviceLogistics;posData;config=new W;defaultCurrencyID;get currencies(){return this._posService.Data.Currencies}get poTypes(){return this._posService.Data.PoTypes}currentTabState;modalTabState=ra;isOnline;exchangeRate=1;destroy$;appConfigJson;ngOnInit(){this.config.title="Invoice Notes",this.subscribeToObservable(),this.copyInvoiceNumberToNote()}subscribeToObservable(){this._orderDataService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.posData=t,this.exchangeRate=this.posData.Order.CurrencyRate}),this._posService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.appConfigJson=t.AppConfigJSON,this.defaultCurrencyID=this.appConfigJson.CoreDefaults.CurrencyID,this.serviceLogistics=t.ServicesLogistics}),this._onlineService.getOnlineStatus$().pipe(k(this.destroy$)).subscribe(t=>{this.isOnline=t,this.currentTabState=1,t||(this.currentTabState=0)})}copyInvoiceNumberToNote(){if(this.appConfigJson.ModuleSell.Numbering.FillNoteWithInvoiceNumber&&this.posData.Order.Note==""){let e=this.posData.Order.Number,i=e.slice(e.length-4);this.posData.Order.Note=i}}onOk(t){if(t=="Enter")return;let e=this.posData.Order.Note;if(e&&e.length>500){this._toastrService.warning("Maximum 500 characters allowed","Warning");return}this.posData.Order.removeEnterNote(),this.posData.Order.CurrencyRate=this.exchangeRate,this._orderDataService.pushNewValue(this.posData),this._dialogRef.close()}close(){this._dialogRef.close()}updateCurrencySymbol(t){this._cashierCalculatorService.currencySymbol=t.Symbol,this.exchangeRate=t.ExchangeRate}onSelectCustomerPoType(t){let e=this._outletRegisterService.Data;t.PrintTemplateID==0?(e.PrintTemplate=e.DefaultPrintTemplate,this._outletRegisterService.pushNewValue(e)):this._orderHttpService.getSalesOrderPrint(t.PrintTemplateID).pipe(k(this.destroy$)).subscribe(i=>{let o=Ri(en,i.Template);e.PrintTemplate=o,this._outletRegisterService.pushNewValue(e)})}onSelectLogisticsService(t){t===this.posData.Order.LogisticsServiceID?this.posData.Order.LogisticsServiceID=null:this.posData.Order.LogisticsServiceID=t}onTabChange(t){this.currentTabState=t}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(F),d(V),d(B),d(Pe),d(Y),d(Oe),d(ee),d(qe),d(Ht))};static \u0275cmp=P({type:n,selectors:[["POS-modal-note"]],standalone:!1,decls:18,vars:15,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container-fluid"],[1,"row","border-bottom"],["data-cy","tab-note",1,"btn","btn-link","note-tab",3,"click","ngClass"],["class","btn btn-link note-tab","data-cy","tab-type",3,"ngClass","click",4,"ngIf"],["class","btn btn-link note-tab","data-cy","tab-logistic",3,"ngClass","click",4,"ngIf"],["class","btn btn-link note-tab","data-cy","tab-number",3,"ngClass","click",4,"ngIf"],["data-cy","tab-other",1,"btn","btn-link","note-tab",3,"click","ngClass"],[1,"row","mt-8"],[4,"ngIf"],["data-cy","tab-type",1,"btn","btn-link","note-tab",3,"click","ngClass"],["data-cy","tab-logistic",1,"btn","btn-link","note-tab",3,"click","ngClass"],["data-cy","tab-number",1,"btn","btn-link","note-tab",3,"click","ngClass"],[1,"col-12"],["class","rad-btn",4,"ngFor","ngForOf"],[1,"rad-btn"],[3,"for","ngClass"],["type","radio",3,"ngModelChange","click","ngModel","value","id"],[1,"col-12","tinymce"],[3,"ngModel","ngModelChange",4,"ngIf"],["name","note","cols","80","class","form-control","rows","10",3,"ngModel","ngModelChange",4,"ngIf"],[3,"ngModelChange","ngModel"],["name","note","cols","80","rows","10",1,"form-control",3,"ngModelChange","ngModel"],[1,"row"],[1,"col-6"],[1,"mb-2"],["placeholder","Preorder Number","matTooltip","PO number if the product must be pre-ordered",1,"form-control","w-75","height-input",3,"ngModelChange","ngModel"],[1,"row","mt-3"],["type","text","required","","placeholder","Same as Order Number when blank","matTooltip","Same as Order Number when blank",1,"form-control","w-75","height-input",3,"ngModelChange","ngModel","disabled"],["autoNum","",1,"form-control","w-75","height-input",3,"ngModelChange","ngModel"],[1,"ps-0","d-flex","align-items-center"],["bindLabel","Name","bindValue","ID","placeholder","Outlet","appendTo","body",1,"currency-option",3,"ngModelChange","change","items","ngModel","clearable"],["class","ms-6 d-flex",4,"ngIf"],[1,"ms-6","d-flex"],[1,"pt-4"],["type","text","autoNum","",1,"border","border-light","ms-2","form-control",2,"width","100px",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(l){return i.onOk(l)})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div")(5,"a",3),_("click",function(){return i.onTabChange(i.modalTabState.NOTE)}),m(6," Note "),a(),g(7,$p,2,3,"a",4)(8,Jp,2,3,"a",5)(9,Gp,2,3,"a",6),r(10,"a",7),_("click",function(){return i.onTabChange(i.modalTabState.OTHER)}),m(11," Other "),a()()(),r(12,"div",8),g(13,Kp,3,1,"ng-container",9)(14,Zp,4,2,"ng-container",9)(15,tm,4,1,"ng-container",9)(16,im,11,3,"ng-container",9)(17,om,13,5,"ng-container",9),a()()()()),e&2&&(p("config",i.config),s(5),p("ngClass",E(11,Nt,i.modalTabState.NOTE==i.currentTabState)),s(2),p("ngIf",i.isOnline),s(),p("ngIf",i.isOnline&&i.serviceLogistics.length),s(),p("ngIf",i.isOnline),s(),p("ngClass",E(13,Nt,i.modalTabState.OTHER==i.currentTabState)),s(3),p("ngIf",i.modalTabState.TYPE==i.currentTabState),s(),p("ngIf",i.modalTabState.NOTE==i.currentTabState),s(),p("ngIf",i.modalTabState.LOGISTICS==i.currentTabState),s(),p("ngIf",i.modalTabState.NUMBER==i.currentTabState),s(),p("ngIf",i.modalTabState.OTHER==i.currentTabState))},dependencies:[U,_e,$,te,Jo,K,jt,ie,Q,nt,pt,ce,Ot],styles:[`.text-warning{color:var(--bs-warning)!important}.bg-light-gray{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger{color:#fb404b!important}.text-dark{color:#5e5e5e!important}.text-success{color:#87cb16!important}.text-black{color:#000!important}.text-white{color:var(--bs-white)!important}.btn-light-blue{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue:focus,.btn-light-blue.focus{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled,.btn-light-blue:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue:not(:disabled):not(.disabled):active,.btn-light-blue:not(:disabled):not(.disabled).active,.show>.btn-light-blue.dropdown-toggle{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue:not(:disabled):not(.disabled):active:focus,.btn-light-blue:not(:disabled):not(.disabled).active:focus,.show>.btn-light-blue.dropdown-toggle:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger:focus,.btn-light-danger.focus{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled,.btn-light-danger:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger:not(:disabled):not(.disabled):active,.btn-light-danger:not(:disabled):not(.disabled).active,.show>.btn-light-danger.dropdown-toggle{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger:not(:disabled):not(.disabled):active:focus,.btn-light-danger:not(:disabled):not(.disabled).active:focus,.show>.btn-light-danger.dropdown-toggle:focus{box-shadow:0 0 0 .2rem #dc354540}content>div.container-fluid{min-height:200px}.tinymce a img{z-index:2;position:absolute;right:15px;bottom:19px}.tinymce editor{height:max-content;z-index:1}.rad-btn{position:relative;display:inline-block}.rad-btn label{border:1px solid #dddddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000}.rad-btn input[type=radio]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn label.selected{background:#dcdcdc;border:1px solid #dcdcdc}.btn-link.note-tab{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.note-tab.selected{color:#3b3b3b;border-bottom:4px solid #07a519}a.btn.btn-link.note-tab{color:inherit}.ng-select.currency-option{width:36%!important}
|
|
41
|
+
`],encapsulation:2})};function rm(n,t){if(n&1&&(x(0),r(1,"tr")(2,"th",18),m(3," Amount "),a(),r(4,"td",19),m(5),b(6,"number"),a()(),I()),n&2){let e=c(2);s(5),y(" ",O(6,1,e.calculatorService.GrossTotal)," ")}}function am(n,t){if(n&1&&(r(0,"span"),m(1),b(2,"number"),a()),n&2){let e=c(3);s(),y("",O(2,1,e.salesOrder.Order.Discount),"%")}}function lm(n,t){if(n&1&&(r(0,"span"),m(1),b(2,"number"),a()),n&2){let e=c(3);s(),y("",le(2,1,e.salesOrder.Order.Discount,"1.0-4"),"%")}}function sm(n,t){if(n&1&&(r(0,"tr")(1,"th",18),m(2),g(3,am,3,3,"span",0)(4,lm,3,4,"span",0),a(),r(5,"td",20),m(6),b(7,"number"),a()()),n&2){let e=c(2);s(2),y(" ",e.appConfig==null||e.appConfig.CorePrint==null?null:e.appConfig.CorePrint.Alias.Discount1," "),s(),p("ngIf",e.isIgnoreDecimalDisc1),s(),p("ngIf",!(e.appConfig!=null&&e.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal)),s(2),T(O(7,4,e.calculatorService.Discount1Amount*-1))}}function cm(n,t){if(n&1&&(r(0,"span"),m(1),b(2,"number"),a()),n&2){let e=c(3);s(),y("",O(2,1,e.salesOrder.Order.Discount2),"%")}}function pm(n,t){if(n&1&&(r(0,"span"),m(1),b(2,"number"),a()),n&2){let e=c(3);s(),y("",le(2,1,e.salesOrder.Order.Discount2,"1.0-4"),"%")}}function mm(n,t){if(n&1&&(r(0,"tr")(1,"th",18),m(2),g(3,cm,3,3,"span",0)(4,pm,3,4,"span",0),a(),r(5,"td",20),m(6),b(7,"number"),a()()),n&2){let e=c(2);s(2),y(" ",e.appConfig==null||e.appConfig.CorePrint==null?null:e.appConfig.CorePrint.Alias.Discount2," "),s(),p("ngIf",e.isIgnoreDecimalDisc2),s(),p("ngIf",!(e.appConfig!=null&&e.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal)),s(2),T(O(7,4,e.calculatorService.Discount2Amount*-1))}}function dm(n,t){if(n&1&&(r(0,"tr")(1,"th",18),m(2),a(),r(3,"td",20),m(4),b(5,"number"),a()()),n&2){let e=c(2);s(2),Ue(" ",e.appConfig==null||e.appConfig.CorePrint==null?null:e.appConfig.CorePrint.Alias.DiscountAmount," ",e.calculatorService.currencySymbol," "),s(2),T(O(5,3,e.salesOrder.Order.DiscountAmount*-1))}}function um(n,t){if(n&1&&(r(0,"tr")(1,"th",18),m(2),a(),r(3,"td",19),m(4),b(5,"number"),a()()),n&2){let e=c(2);s(2),y(" ",e.calculatorService==null||e.calculatorService.tax==null?null:e.calculatorService.tax.Label," "),s(2),T(O(5,2,e.calculatorService==null?null:e.calculatorService.TaxAmount))}}function fm(n,t){if(n&1&&(r(0,"tr")(1,"th",18),m(2),b(3,"number"),a(),r(4,"td",21),m(5),b(6,"number"),a()()),n&2){let e=c(2);s(2),y(" SURCHARGE ",O(3,3,e.salesOrder==null?null:e.salesOrder.Invoice.SurchargePcg),"% "),s(2),p("ngClass",(e.salesOrder==null?null:e.salesOrder.Invoice.SurchargePcg)<0?"text-danger":""),s(),y(" ",O(6,5,e.calculatorService==null?null:e.calculatorService.SurchargeAmount),"")}}function gm(n,t){if(n&1&&(x(0),r(1,"div",13),h(2,"div",14)(3,"div",15),r(4,"div",16)(5,"table",17),g(6,rm,7,3,"ng-container",0)(7,sm,8,6,"tr",0)(8,mm,8,6,"tr",0)(9,dm,6,5,"tr",0)(10,um,6,4,"tr",0)(11,fm,7,7,"tr",0),a()()(),I()),n&2){let e=c();s(6),p("ngIf",(e.calculatorService==null||e.calculatorService.tax==null?null:e.calculatorService.tax.CalculationTypeID)==e.taxCalculationType.Add&&(e.calculatorService==null||e.calculatorService.tax==null?null:e.calculatorService.tax.Rate)||(e.salesOrder==null||e.salesOrder.Order==null?null:e.salesOrder.Order.Discount)!=0||(e.salesOrder==null||e.salesOrder.Order==null?null:e.salesOrder.Order.Discount2)!=0||(e.salesOrder==null||e.salesOrder.Order==null?null:e.salesOrder.Order.DiscountAmount)!=0||(e.salesOrder==null||e.salesOrder.Invoice==null?null:e.salesOrder.Invoice.SurchargePcg)!=0),s(),p("ngIf",(e.salesOrder==null?null:e.salesOrder.Order.Discount)!=0),s(),p("ngIf",(e.salesOrder==null?null:e.salesOrder.Order.Discount2)!=0),s(),p("ngIf",(e.salesOrder==null?null:e.salesOrder.Order.DiscountAmount)!=0),s(),p("ngIf",e.calculatorService==null||e.calculatorService.tax==null?null:e.calculatorService.tax.Rate),s(),p("ngIf",(e.salesOrder==null?null:e.salesOrder.Invoice.SurchargePcg)!=0)}}function _m(n,t){if(n&1){let e=v();x(0),r(1,"button",22),_("click",function(){u(e);let o=c();return f(o.onOpenModalDiscount())}),h(2,"i",23),a(),I()}}var Wn=class n{constructor(t,e,i,o,l,C,N,ae,ke){this.calculatorService=t;this.salesOrderService=e;this.userRoleService=i;this.outletService=o;this.pageInitialService=l;this.dialog=C;this.orderProcessorService=N;this.payService=ae;this.parkOrderService=ke;this.destroy$=new z}handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.payService.payOrder()}taxCalculationType=no;destroy$;salesOrder;userRole;appConfig;parkLayoutPack;orderProcessor;isIgnoreDecimalDisc1;isIgnoreDecimalDisc2;outletRegister;parkOrderRetrieve;ngOnInit(){this.subscribeToObservable()}subscribeToObservable(){this.appConfig=this.pageInitialService.Data.AppConfigJSON,this.salesOrderService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.salesOrder=t,t.TotalQuantity,this.initIgnoreDecimal()}),this.userRoleService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.userRole=t}),this.outletService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.outletRegister=t,this.parkLayoutPack=t.ParkLayoutPack}),this.orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.orderProcessor=t})}initIgnoreDecimal(){this.isIgnoreDecimalDisc1=this.checkIgnoreDecimalDisc(this.salesOrder.Order.Discount),this.isIgnoreDecimalDisc2=this.checkIgnoreDecimalDisc(this.salesOrder.Order.Discount2)}onPark(){this.parkOrderService.parkOrder()}onPayOrder(){this.payService.payOrder()}onOpenModalDiscount(){this.dialog.open(ii,{data:{tabIndexActive:"Discount"}})}checkIgnoreDecimalDisc(t){let e=this.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal,i=t%1===0;return e&&i}onOpenNotesModal(){this.dialog.open(Un,{width:"45%"})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(Pe),d(V),d(me),d(Y),d(B),d(ne),d(j),d(Qr),d(we))};static \u0275cmp=P({type:n,selectors:[["sell-cart-footer"]],hostBindings:function(e,i){e&1&&_("keydown.F8",function(l){return i.handleF8(l)},!1,it)},inputs:{parkOrderRetrieve:"parkOrderRetrieve"},standalone:!1,decls:25,vars:15,consts:[[4,"ngIf"],[1,"row","mt-2","d-flex","align-items-center"],[1,"col-1","pe-0"],["type","button","matTooltip","Note","matTooltipPosition","above","data-cy","dialog-note",1,"btn","btn-gray","w-100","fs-3","px-0","py-6","headings-font-family",3,"click"],[1,"fa-regular","fa-note-sticky","fa-xl"],["matTooltipPosition","above",1,"pe-0","d-flex","align-items-center","col-4","ps-0",3,"matTooltip"],["type","button","data-cy","dialog-park",1,"btn","btn-gray","w-100","fs-3","px-0","py-6","headings-font-family","ms-6",3,"click","disabled"],[1,"fa-solid","fa-floppy-disk","me-3"],["matTooltipPosition","above",1,"pe-0","col-7",3,"matTooltip"],[1,"btn-group","w-100"],["type","button","data-cy","btn-pay",1,"btn","btn-success","w-100","fs-1","py-4",2,"border-left","0.1px solid #fff",3,"click","disabled"],[1,"d-flex","align-items-center","justify-content-between"],[1,"fs-3"],[1,"row"],[1,"col-1"],[1,"col-4"],[1,"pt-3","col-7",2,"padding-right","16px","padding-left","68px"],[1,"table","table-borderless"],[1,"text-start"],[1,"text-end","fs-5"],[1,"text-end","text-danger","fs-5"],[1,"text-end","fs-5",3,"ngClass"],["type","button","data-cy","dialog-discount-tax","matTooltip","Discount / Tax","matTooltipPosition","above",1,"btn","btn-success","fs-5",2,"border-right","0.1px solid #fff",3,"click"],[1,"fa-light","fa-percent"]],template:function(e,i){e&1&&(g(0,gm,12,6,"ng-container",0),r(1,"div",1)(2,"div",2)(3,"button",3),_("click",function(){return i.onOpenNotesModal()}),h(4,"i",4),a()(),r(5,"div",5)(6,"button",6),_("click",function(){return i.onPark()}),h(7,"i",7),r(8,"span"),m(9),a()()(),r(10,"div",8)(11,"div",9),g(12,_m,3,0,"ng-container",0),r(13,"button",10),_("click",function(){return i.onPayOrder()}),r(14,"div",11)(15,"div")(16,"span"),m(17,"Pay"),a(),r(18,"small",12),m(19),b(20,"number"),a()(),r(21,"div"),m(22),b(23,"async"),b(24,"number"),a()()()()()()),e&2&&(p("ngIf",i.userRole.PriceVisible),s(5),p("matTooltip",i.userRole.Park?"":"You need `Park` role to access this button"),s(),p("disabled",!i.userRole.Park),s(3),T((i.appConfig==null||i.appConfig.ApplicationParkAndRetrieve==null||i.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel==null?null:i.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkButtonLabel)||"Park"),s(),p("matTooltip",i.userRole.Payment?"":"You need `Pay` role to access this button"),s(2),p("ngIf",i.userRole.Tax||i.userRole.Discount),s(),p("disabled",!i.userRole.Payment),s(6),y(" (",O(20,9,i.salesOrder.cartQuantity)," Items) "),s(3),y(" ",i.userRole!=null&&i.userRole.PriceVisible?O(24,13,O(23,11,i.calculatorService.Data$)):"-"," "))},dependencies:[U,$,ce,Ne,X],styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}.table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] > th[_ngcontent-%COMP%] span[_ngcontent-%COMP%], .table[_ngcontent-%COMP%] td[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{padding:0}"]})};var hm=n=>({"ps-0":n});function bm(n,t){if(n&1){let e=v();x(0),r(1,"input",33),w("ngModelChange",function(o){u(e);let l=c(2).$implicit;return D(l.Splited,o)||(l.Splited=o),f(o)}),a(),I()}if(n&2){let e=c(2).$implicit;s(),M("ngModel",e.Splited)}}function vm(n,t){if(n&1&&(x(0),r(1,"small"),m(2),a(),I()),n&2){let e=c(2).index;s(2),y("",e+1,".")}}function Sm(n,t){if(n&1&&(x(0),r(1,"td",32)(2,"div",17),g(3,bm,2,1,"ng-container",15)(4,vm,3,1,"ng-container",15),a()(),I()),n&2){let e=c().$implicit,i=c(2);s(3),p("ngIf",i.currentSellState==i.sellState.IsSplit&&e.Quantity>1),s(),p("ngIf",i.appConfig==null||i.appConfig.ModuleSell==null?null:i.appConfig.ModuleSell.Grid.RowNumberVisible)}}function ym(n,t){if(n&1&&(x(0),r(1,"div",35),h(2,"img",36),a(),I()),n&2){let e=c(2).$implicit;s(2),p("src",e.Variant==null?null:e.Variant.ThumbnailUrl,tt)}}function xm(n,t){n&1&&(r(0,"div",37),h(1,"i",38),a())}function Im(n,t){if(n&1&&(x(0),r(1,"span",34),g(2,ym,3,1,"ng-container",6)(3,xm,2,0,"ng-template",null,3,G),a(),I()),n&2){let e=q(4),i=c().$implicit;s(2),p("ngIf",i.Variant==null?null:i.Variant.ThumbnailUrl)("ngIfElse",e)}}function Om(n,t){n&1&&(x(0),h(1,"i",40),I())}function Pm(n,t){n&1&&h(0,"i",41)}function Mm(n,t){if(n&1&&(x(0),r(1,"span",39),g(2,Om,2,0,"ng-container",6)(3,Pm,1,0,"ng-template",null,4,G),a(),I()),n&2){let e=q(4),i=c().$implicit;s(2),p("ngIf",i.Taxable)("ngIfElse",e)}}function Dm(n,t){n&1&&(x(0),h(1,"i",42),I())}function wm(n,t){if(n&1&&(x(0),r(1,"small",43),m(2),a(),I()),n&2){let e=c().$implicit;s(2),y(" ",e.Variant.CategoryName," ")}}function km(n,t){if(n&1&&(x(0),r(1,"small",44),m(2),a(),I()),n&2){let e=c().$implicit;s(2),y(" ",e.Variant.BrandName," ")}}function Tm(n,t){if(n&1&&(x(0),r(1,"small",45),m(2),a(),I()),n&2){let e=c().$implicit;s(2),y(" ",e.Variant.Storage," ")}}function Em(n,t){if(n&1&&(x(0),h(1,"small",46),I()),n&2){let e=c().$implicit;s(),p("innerHtml",e.Note?e.Note:e.PriceNote,xi)}}function Rm(n,t){if(n&1&&(x(0),r(1,"small",47),m(2," Sold by "),r(3,"i"),m(4),a()(),I()),n&2){let e=c().$implicit;s(4),T(e.SalesName)}}function Nm(n,t){if(n&1&&(x(0),r(1,"small")(2,"i",48),m(3),a()(),I()),n&2){let e=c().$implicit;s(3),y("Fulfillment from: ",e.EntityName,"")}}function Vm(n,t){if(n&1&&(r(0,"div",25),h(1,"i",49),a()),n&2){let e=c().$implicit;p("matTooltip",e.AvailableInventory<e.Quantity?e.AvailableInventory+" Available Stock":"")}}function Am(n,t){if(n&1){let e=v();x(0),r(1,"span",50),_("click",function(){u(e);let o=c().index,l=c(2);return f(l.onEditItem(o,"quantity"))}),m(2),b(3,"number"),a(),I()}if(n&2){let e=c().$implicit,i=c(2);s(2),y(" ",le(3,1,e.Quantity,"1.0-"+i.qtyDecimalPlace()),"")}}function Lm(n,t){if(n&1){let e=v();x(0),r(1,"span",51),m(2,"x"),a(),r(3,"div",52),_("click",function(){u(e);let o=c().index,l=c(2);return f(l.onEditItem(o,"quantity"))}),r(4,"span",53),m(5),b(6,"number"),a()(),I()}if(n&2){let e=c().$implicit,i=c(2);s(5),T(le(6,1,e.UnitQuantity,"1.0-"+i.qtyDecimalPlace()))}}function Bm(n,t){if(n&1&&(x(0),r(1,"span",54),m(2),b(3,"number"),a(),I()),n&2){let e=c().$implicit,i=c(2);s(2),y("@",le(3,1,e.VariantUnitQuantity,"1.0-"+i.qtyDecimalPlace()),"")}}function Fm(n,t){if(n&1&&(x(0),r(1,"small",55),m(2),a(),I()),n&2){let e=c().$implicit,i=c(2);s(2),T(i.isNotEmpty(e.Variant.UOM)?e.Variant.UOMName:"")}}function jm(n,t){if(n&1&&(r(0,"div",59),m(1),b(2,"number"),a()),n&2){let e=c(4).$implicit;s(),y(" ",le(2,1,e.UnitPriceOriginal,"1.0-4")," ")}}function Hm(n,t){if(n&1){let e=v();x(0),r(1,"div",56),_("click",function(){u(e);let o=c(3).index,l=c(2);return f(l.onEditItem(o,"price"))}),g(2,jm,3,4,"div",57),r(3,"div",58),m(4),b(5,"number"),a()(),I()}if(n&2){let e=c(3).$implicit;s(2),p("ngIf",e.UnitPriceOriginal>e.Price),s(2),y(" ",le(5,2,e.Price,"1.0-4")," ")}}function Um(n,t){if(n&1){let e=v();r(0,"div",50),_("click",function(){u(e);let o=c(3).index,l=c(2);return f(l.onEditItem(o,"price"))}),m(1),b(2,"number"),a()}if(n&2){let e=c(3).$implicit;s(),y(" ",le(2,1,e.Price,"1.0-4")," ")}}function Wm(n,t){if(n&1&&(x(0),g(1,Hm,6,5,"ng-container",6)(2,Um,3,4,"ng-template",null,5,G),I()),n&2){let e=q(3),i=c(4);s(),p("ngIf",i.appConfig==null||i.appConfig.ModuleSell==null||i.appConfig.ModuleSell.Promotion==null?null:i.appConfig.ModuleSell.Promotion.StrikethroughOriginalPrice)("ngIfElse",e)}}function Qm(n,t){if(n&1&&(x(0),r(1,"div",24),g(2,Wm,4,2,"ng-container",15),a(),I()),n&2){let e=c().$implicit;s(2),p("ngIf",e.Price!==e.Total)}}function qm(n,t){if(n&1&&(x(0),r(1,"div"),m(2),b(3,"number"),a(),I()),n&2){let e=c().$implicit;s(2),y(" ",e.Discount==0?"":O(3,1,e.Discount*-1)+"%"," ")}}function $m(n,t){if(n&1&&(x(0),r(1,"div"),m(2),b(3,"number"),a(),I()),n&2){let e=c().$implicit;s(2),y(" ",e.DiscountAmount==0?"":O(3,1,e.DiscountAmount*-1)," ")}}function Jm(n,t){if(n&1&&(r(0,"div",61),m(1),b(2,"number"),a()),n&2){let e=c(2).$implicit;s(),y(" ",le(2,1,e.UnitPriceOriginal,"1.0-4")," ")}}function Gm(n,t){if(n&1&&(x(0),r(1,"div",58),g(2,Jm,3,4,"div",60),r(3,"div",24),m(4),b(5,"amountFraction"),a()(),I()),n&2){let e=c().$implicit;s(2),p("ngIf",e.UnitPriceOriginal>e.Price),s(2),y(" ",O(5,2,e.Total)," ")}}function zm(n,t){if(n&1&&(r(0,"div",24)(1,"div",58),m(2),b(3,"amountFraction"),a()()),n&2){let e=c().$implicit,i=c(2);s(2),y(" ",i.userRole.PriceVisible?O(3,1,e.Total):" - "," ")}}function Km(n,t){if(n&1){let e=v();x(0),r(1,"span",62),_("click",function(){u(e);let o=c().$implicit,l=c(2);return f(l.removeItem(o))}),h(2,"i",63),a(),I()}}function Ym(n,t){if(n&1){let e=v();r(0,"tr",14),b(1,"async"),_("contextmenu",function(o){let l=u(e),C=l.$implicit,N=l.index,ae=c(2);return f(ae.onContextMenu(o,C,N))}),g(2,Sm,5,2,"ng-container",15),r(3,"td",16),_("click",function(){let o=u(e).index,l=c(2);return f(l.onEditItem(o,"quantity"))}),r(4,"div",17),g(5,Im,5,2,"ng-container",15),r(6,"div",18)(7,"div",19)(8,"span",20),m(9),a(),g(10,Mm,5,2,"ng-container",15)(11,Dm,2,0,"ng-container",15),a(),r(12,"div",21),m(13),a(),g(14,wm,3,1,"ng-container",15)(15,km,3,1,"ng-container",15)(16,Tm,3,1,"ng-container",15),r(17,"div"),h(18,"app-serial-note",22),a(),g(19,Em,2,1,"ng-container",15)(20,Rm,5,1,"ng-container",15)(21,Nm,4,1,"ng-container",15),a()()(),r(22,"td",23)(23,"div",24),g(24,Vm,2,1,"div",25),r(25,"div",26),g(26,Am,4,4,"ng-container",15)(27,Lm,7,4,"ng-container",15)(28,Bm,4,4,"ng-container",15)(29,Fm,3,1,"ng-container",15),a()()(),r(30,"td"),g(31,Qm,3,1,"ng-container",15),a(),r(32,"td",27),_("click",function(){let o=u(e).index,l=c(2);return f(l.onEditItem(o,"discount"))}),r(33,"div",28),g(34,qm,4,3,"ng-container",15)(35,$m,4,3,"ng-container",15),a()(),r(36,"td",29),_("click",function(){let o=u(e).index,l=c(2);return f(l.onEditItem(o,"price"))}),g(37,Gm,6,4,"ng-container",6)(38,zm,4,3,"ng-template",null,2,G),a(),r(40,"td",30)(41,"div",31),g(42,Km,3,0,"ng-container",15),a()()()}if(n&2){let e=t.$implicit,i=q(39),o=c(2);p("cdkDragDisabled",!O(1,26,o.enabledDragDrop$)),s(2),p("ngIf",(o.appConfig==null||o.appConfig.ModuleSell==null?null:o.appConfig.ModuleSell.Grid.RowNumberVisible)||o.currentSellState==o.sellState.IsSplit&&e.Quantity>1),s(),p("ngClass",E(28,hm,o.appConfig==null||o.appConfig.ModuleSell==null?null:o.appConfig.ModuleSell.Grid.RowNumberVisible)),s(2),p("ngIf",o.showThumbnail),s(4),y(" ",e.Variant.Name," "),s(),p("ngIf",o.appConfig==null||o.appConfig.ModuleSell==null?null:o.appConfig.ModuleSell.Grid.TaxVisible),s(),p("ngIf",e.PromotionGift),s(2),y(" ",e==null||e.Variant==null?null:e.Variant.Code," "),s(),p("ngIf",o.appConfig==null||o.appConfig.ModuleSell==null?null:o.appConfig.ModuleSell.Grid.CategoryVisible),s(),p("ngIf",o.appConfig==null||o.appConfig.ModuleSell==null?null:o.appConfig.ModuleSell.Grid.ShowBrandItemCart),s(),p("ngIf",o.appConfig==null||o.appConfig.ModuleSell==null||o.appConfig.ModuleSell.Grid==null?null:o.appConfig.ModuleSell.Grid.StorageVisible),s(2),p("serials",e.Serial),s(),p("ngIf",e.Note||e.PriceNote),s(),p("ngIf",e.SalesName),s(),p("ngIf",e.EntityName),s(3),R(e.AvailableInventory<e.Quantity&&((e==null||e.Variant==null?null:e.Variant.TypeID)<9||(e==null||e.Variant==null?null:e.Variant.TypeID)==o.inventoryType.Composite)?24:-1),s(2),p("ngIf",e.Quantity!==1&&e.Quantity!==0||e.UnitQuantity>1||e.VariantUnitQuantity>1),s(),p("ngIf",e.UnitQuantity>1),s(),p("ngIf",e.VariantUnitQuantity>1),s(),p("ngIf",o.isNotEmpty(e.Variant.UOM)&&(o.appConfig==null||o.appConfig.ModuleSell==null?null:o.appConfig.ModuleSell.Grid.UOMVisible)),s(2),p("ngIf",(e.Price!==e.Total||e.DiscountAmount>0||e.Discount>0||e.UnitPriceOriginal>e.Price)&&o.userRole.PriceVisible),s(3),p("ngIf",e.Discount>0),s(),p("ngIf",e.DiscountAmount>0),s(2),p("ngIf",(o.appConfig==null||o.appConfig.ModuleSell==null||o.appConfig.ModuleSell.Promotion==null?null:o.appConfig.ModuleSell.Promotion.StrikethroughOriginalPrice)&&e.Quantity==1&&o.userRole.PriceVisible)("ngIfElse",i),s(5),p("ngIf",o.hasItemDeletion)}}function Xm(n,t){if(n&1){let e=v();x(0),r(1,"div",9)(2,"div",10)(3,"table",11)(4,"tbody",12),_("cdkDropListDropped",function(o){u(e);let l=c();return f(l.drop(o))}),g(5,Ym,43,30,"tr",13),a()()()(),I()}if(n&2){let e=c();s(5),p("ngForOf",e.cartItems)}}function Zm(n,t){n&1&&(r(0,"div",64)(1,"div",10)(2,"div",65)(3,"div",66)(4,"div",67),h(5,"i",68),a(),r(6,"div",69)(7,"span"),m(8,"Empty Cart"),a(),h(9,"br"),r(10,"span"),m(11,"Add products to the cart"),a(),h(12,"br"),r(13,"span"),m(14,"or scan barcode"),a()()()()()())}function ed(n,t){if(n&1){let e=v();r(0,"button",70),_("click",function(){let o=u(e).item,l=c();return f(l.onReverse(o,!0))}),m(1," Return "),a(),r(2,"button",71),_("click",function(){let o=u(e).item,l=c();return f(l.onReverse(o,!1))}),m(3,"Sales"),a(),r(4,"button",70),_("click",function(){let o=u(e).item,l=c();return f(l.onSumPrice(o))}),m(5," Merge / SUM Price "),a(),r(6,"button",70),_("click",function(){let o=u(e).item,l=c();return f(l.onBundlePrice(o))}),m(7," Bundle Price "),a()}if(n&2){let e=c();p("disabled",!e.userRole.Return),s(4),p("disabled",!e.userRole.BundlingPrice),s(2),p("disabled",!e.userRole.BundlingPrice)}}var Qn=class n{constructor(t,e,i,o,l,C,N){this.salesOrderService=t;this.roleService=e;this.shoppingCartService=i;this.pageInitialService=o;this.dialog=l;this.orderProcessorService=C;this.moreMenuService=N;this.destroy$=new z,this.eventAddItem=new He,this.enabledDragDrop$=this.moreMenuService.enabledDragDrop$}destroy$;cartItems=[];userRole;appConfig;currentSellState;hasItemDeletion;eventAddItem;isAddItem=!0;sellState=xe;showThumbnail;enabledDragDrop$;inventoryType=Ei;qtyDecimalPlace=H(4);ngOnInit(){this.subscribeToObservable(),this.initDragDropEnabled(),this.initDecimalPlaceDigit()}initDecimalPlaceDigit(){this.qtyDecimalPlace.update(t=>{let e=this.pageInitialService.Data.AppConfigJSON?.ModuleSell?.ProductDialog?.DecimalPlaceDigit;return S.IsNotEmpty(e)?e:4})}initDragDropEnabled(){S.isMobileDevice&&this.moreMenuService.enableDragDrop(!1)}contextMenu;contextMenuPosition={x:"0px",y:"0px"};onContextMenu(t,e,i){t.preventDefault(),this.contextMenuPosition.x=t.clientX+"px",this.contextMenuPosition.y=t.clientY+"px",e.Index=i,this.contextMenu.menuData={item:e},this.contextMenu.openMenu()}subscribeToObservable(){this.appConfig=this.pageInitialService.Data.AppConfigJSON,this.showThumbnail=this.appConfig?.ModuleSell?.Grid?.ProductImageVisible,this.salesOrderService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.emitEventAddItem(t.CartItems),this.cartItems=t.CartItems,this.setItemFulfillmentName()}),this.roleService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.userRole=t,this.initConfigItemDeletion()}),this.orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.currentSellState=t.posState,this.initConfigItemDeletion()})}emitEventAddItem(t=[]){t.length!==this.cartItems.length&&this.isAddItem&&this.eventAddItem.emit(),this.isAddItem=!0}initConfigItemDeletion(){this.hasItemDeletion=!0,(this.currentSellState==5||!this.userRole.DeleteItem||this.authorizeParkedOrdersItemDeletion()||this.currentSellState==6)&&(this.hasItemDeletion=!1)}authorizeParkedOrdersItemDeletion(){let t=!1,e=this.appConfig?.ApplicationParkAndRetrieve?.AccessControl?.AuthorizeParkedOrdersItemDeletion,i=this.userRole.ParkedDeletionAuthorized;return this.currentSellState==4&&(t=e&&!i),t}setItemFulfillmentName(){this.cartItems=this.cartItems.map(t=>(t.EntityName=this.pageInitialService.getOutletName(t.EntityID),t))}isNotEmpty(t){return S.IsNotEmpty(t)}drop(t){nr(this.cartItems,t.previousIndex,t.currentIndex),this.salesOrderService.Data.CartItems=this.cartItems}removeItem(t){this.isAddItem=!1,this.shoppingCartService.deleteCartItem(t)}onReverse(t,e){e?t.Quantity>0&&(t.Quantity=t.Quantity*-1):t.Quantity<0&&(t.Quantity=t.Quantity*-1),this.shoppingCartService.updateCartItem(t,t.Index)}onSumPrice(t){let e=0;this.cartItems.forEach((i,o)=>{e+=i.Quantity*i.Price*(100-i.Discount)/100-i.DiscountAmount,i.Price=0}),t.Price=e/t.Quantity,this.shoppingCartService.updateCartItem(t,t.Index)}onBundlePrice(t){let e=0;this.cartItems.forEach((i,o)=>{o!=t.Index&&(e+=i.Quantity*i.Price*(100-i.Discount)/100-i.DiscountAmount,i.Price=0)}),t.Price==0&&(t.Price=e/t.Quantity),this.shoppingCartService.updateCartItem(t,t.Index)}onEditItem(t,e){this.isAddItem=!1,this.dialog.open($e,{data:{index:t,focus:e}})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(V),d(me),d(Me),d(B),d(ne),d(j),d(kt))};static \u0275cmp=P({type:n,selectors:[["sell-cart-body"]],viewQuery:function(e,i){if(e&1&&ve(qi,7),e&2){let o;Se(o=ye())&&(i.contextMenu=o.first)}},outputs:{eventAddItem:"eventAddItem"},standalone:!1,decls:7,vars:7,consts:[["EMPTY_CART",""],["contextMenu","matMenu"],["ONLY_TOTAL",""],["NO_IMAGE",""],["NotTaxable",""],["NOT_STRIKETHROUGHT",""],[4,"ngIf","ngIfElse"],[2,"visibility","hidden","position","fixed",3,"matMenuTriggerFor"],["matMenuContent",""],[1,"row","g-0"],[1,"col-12"],[1,"table","table-borderless"],["cdkDropList","",3,"cdkDropListDropped"],["cdkDrag","","style","border-bottom: 0.5px solid #dee2e6",3,"cdkDragDisabled","contextmenu",4,"ngFor","ngForOf"],["cdkDrag","",2,"border-bottom","0.5px solid #dee2e6",3,"contextmenu","cdkDragDisabled"],[4,"ngIf"],[1,"pe-0",2,"width","50%",3,"click","ngClass"],[1,"d-flex","align-items-center"],[1,"d-block",2,"line-height","18px"],[1,"fs-5","d-flex","align-items-center"],[1,"me-1"],["title","Product Code",1,"fw-normal","fs-6","text-muted"],[3,"serials"],[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"],[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"],[2,"width","10px"],["type","checkbox",1,"me-2",3,"ngModelChange","ngModel"],[1,"me-4"],[1,"ratio","ratio-1x1",2,"width","55px"],[1,"item-image",3,"src"],[1,"item-image","d-flex","justify-content-center","align-items-center","text-center","fs-1"],[1,"fa-solid","fa-image",2,"color","#b4b4b4c2"],[1,"fst-italic","m-0","me-3"],["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"],["title","Product Promotion",1,"fa-solid","fa-gift"],["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"],["title","Note",1,"special-TinyMCE","m-0","fst-italic","d-block",3,"innerHtml"],["title","Sales Name",1,"text-success","fst-italic","d-block"],[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"],["title","Variant Unit Quantity",1,"fs-5"],["title","UOM",1,"ps-1","fs-5"],[1,"d-inline-block","fs-5",3,"click"],["class","text-decoration-line-through text-danger fs-5",4,"ngIf"],[1,"fs-5"],[1,"text-decoration-line-through","text-danger","fs-5"],["class","text-decoration-line-through text-danger d-flex align-items-center justify-content-end",4,"ngIf"],[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"],[1,"row","g-0","h-100"],[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"],["mat-menu-item","",3,"click","disabled"],["mat-menu-item","",3,"click"]],template:function(e,i){if(e&1&&(g(0,Xm,6,1,"ng-container",6)(1,Zm,15,0,"ng-template",null,0,G),h(3,"div",7),r(4,"mat-menu",null,1),g(6,ed,8,3,"ng-template",8),a()),e&2){let o=q(2),l=q(5);p("ngIf",i.cartItems.length>0)("ngIfElse",o),s(3),eo("left",i.contextMenuPosition.x)("top",i.contextMenuPosition.y),p("matMenuTriggerFor",l)}},dependencies:[U,_e,$,ht,K,ie,rr,or,Tr,wr,kr,qi,ce,Er,Ne,X,lr],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}"]})};var qn=class{ID;Name;Code;Address;Phone;Email;SalesTarget;SalesPersonGroupID;Bin};var id=["ngSelectInfinite"],nd=(n,t)=>({"text-success":n,"text-danger":t}),od=n=>({offline:n}),Ma=n=>({"opacity-50":n}),Da=(n,t)=>({red:n,green:t});function rd(n,t){if(n&1&&(r(0,"span",8),m(1),b(2,"async"),b(3,"number"),a()),n&2){let e=c();s(),y(" ",O(3,3,O(2,1,e.totalOfflineOrders$))," ")}}function ad(n,t){if(n&1&&(r(0,"sup",13)(1,"div",26),m(2),b(3,"async"),b(4,"number"),a()()),n&2){let e=c();s(2),y(" ",O(4,3,O(3,1,e.moreMenuService.eligiblePromotions$))," ")}}function ld(n,t){if(n&1&&h(0,"span",37),n&2){let e=c(4);p("ngClass",ge(1,Da,!e.displayService.isEnabled(),e.displayService.isEnabled()))}}function sd(n,t){if(n&1&&h(0,"span",37),n&2){let e=c(4);p("ngClass",ge(1,Da,!e.ecrSignalService.isConnected(),e.ecrSignalService.isConnected()))}}function cd(n,t){if(n&1){let e=v();x(0),r(1,"li",33),_("click",function(){let o=u(e).$implicit,l=c(3);return f(o.disabled?null:l.moreMenuService.moreMenuAction(o.action))}),r(2,"div",34),h(3,"i",35),r(4,"span",36),m(5),a(),g(6,ld,1,4,"span",37)(7,sd,1,4,"span",37),a()(),I()}if(n&2){let e=t.$implicit;s(),p("matTooltip",e.disabled?e.description:"")("ngClass",E(8,Ma,e.disabled)),wo("data-cy",e.cy),s(2),be(e.class),s(2),y(" ",e.label," "),s(),R(e.action=="CUSTOMER_DISPLAY"?6:-1),s(),R(e.action=="ECR"?7:-1)}}function pd(n,t){if(n&1&&(x(0),r(1,"div",30),m(2),a(),h(3,"div",31),g(4,cd,8,10,"ng-container",32),I()),n&2){let e=c().$implicit;s(2),T(e.name),s(2),p("ngForOf",e.menus)}}function md(n,t){if(n&1&&(r(0,"sup",13)(1,"div",26),m(2),b(3,"async"),b(4,"number"),a()()),n&2){let e=c(6);s(2),y(" ",O(4,3,O(3,1,e.moreMenuService.eligiblePromotions$))," ")}}function dd(n,t){if(n&1&&(x(0),r(1,"div",34),h(2,"i",35),r(3,"span",36),m(4),a(),g(5,md,5,5,"sup",13),b(6,"async"),a(),I()),n&2){let e=c().$implicit,i=c(4);s(2),be(e.class),s(2),T(e.label),s(),R(e.label=="Event"&&O(6,4,i.moreMenuService.eligiblePromotions$)>0?5:-1)}}function ud(n,t){if(n&1){let e=v();r(0,"li",33),_("click",function(){let o=u(e).$implicit,l=c(4);return f(o.disabled?null:l.moreMenuService.moreMenuAction(o.action))}),g(1,dd,7,6,"ng-container",28),a()}if(n&2){let e=t.$implicit;p("matTooltip",e.disabled?e.description:"")("ngClass",E(3,Ma,e.disabled)),s(),p("ngIf",e.isShow!==!1)}}function fd(n,t){if(n&1&&(x(0),r(1,"div",30),m(2),a(),h(3,"div",31),g(4,ud,2,5,"li",39),I()),n&2){let e=c().$implicit;s(2),T(e.name),s(2),p("ngForOf",e.menus)}}function gd(n,t){if(n&1&&(r(0,"div",38),g(1,fd,5,2,"ng-container",28),a()),n&2){let e=t.$implicit;s(),p("ngIf",(e.menus==null?null:e.menus.length)>0)}}function _d(n,t){if(n&1&&(r(0,"div",27),g(1,pd,5,2,"ng-container",28)(2,gd,2,1,"div",29),a()),n&2){let e=t.$implicit;s(),p("ngIf",(e.menus==null?null:e.menus.length)>0),s(),p("ngForOf",e.children)}}var $n=class n{constructor(t,e,i,o,l,C,N,ae,ke,Fe,je,ri){this.pageInitialService=t;this.salesOrderService=e;this.userRoleService=i;this.outletService=o;this.dialog=l;this.promotionEventService=C;this.moreMenuService=N;this._onlineStatusService=ae;this.toggleSidebar=ke;this.displayService=Fe;this.ecrSignalService=je;this.localDataService=ri;this.appConfig=this.pageInitialService.Data.AppConfigJSON,this.destroy$=new z,this.isOnline$=ae.getOnlineStatus$(),this.totalOfflineOrders$=this.localDataService.unsentOrders$.pipe(et(Tt=>Tt.length),At(1)),this.toggleSidebar.toggleState$.subscribe(Tt=>this.isChange=Tt)}salesOrder;appConfig;selectedCustomerId;userRole;salesPersonList=[];destroy$;outletRegister;salesPersonName;ngSelectInfinite;handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.dialog.open($e)}handleF2(){this.ngSelectInfinite&&this.ngSelectInfinite.ngSelectElement.focus()}disabledSalesOption=!1;salesPersonOptionTooltip=H("");isEnabledLoyaltyPoint;isOnline$;isChange=!0;totalOfflineOrders$;ngOnInit(){this.subscribeToObservable()}collapseSidebar(){this.toggleSidebar.toggleSidebar()}subscribeToObservable(){this.userRoleService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.userRole=t,this.checkDisabledSalesOption()}),this.salesOrderService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.salesOrder=t,this.checkDisabledSalesOption(t.CartItems),S.IsEmpty(this.salesOrder.Order.SalesID)&&(this.salesOrder.Order.SalesID=null)}),this.outletService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.initSalesPerson(t.ListSales),this.outletRegister=t}),this.promotionEventService.onClickToastPromo.pipe(k(this.destroy$)).subscribe(t=>{if(t){let e=this.dialog.getDialogById("promotion-event");S.IsEmpty(e)&&this.dialog.open(zi,{id:"promotion-event"})}})}checkDisabledSalesOption(t=[]){this.disabledSalesOption=!1,(t.filter(i=>S.IsNotEmpty(i.SalesID)).length>0||!this.userRole.SalesPerson)&&(this.disabledSalesOption=!0,this.salesPersonOptionTooltip.set("Sales person has been assigned to item")),this.userRole.SalesPerson||this.salesPersonOptionTooltip.set("You do not have permission to assign a sales person")}initSalesPerson(t){let e=new qn;e.ID=S.GuidEmpty,this.salesPersonList=[...t]}openOnlineStatusModal(){this.localDataService.unsentOrders$.pipe(Vt(1),Ee(t=>{let e=t.length>0?"ORDER":"SETUP";return this.dialog.open(Yi,{id:"ModalOfflineOrder",data:{activeTab:e}}).afterClosed()})).subscribe()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(B),d(V),d(me),d(Y),d(ne),d($t),d(kt),d(qe),d(Ko),d(Bi),d(Jt),d(Ye))};static \u0275cmp=P({type:n,selectors:[["sell-cart-header"]],viewQuery:function(e,i){if(e&1&&ve(id,7),e&2){let o;Se(o=ye())&&(i.ngSelectInfinite=o.first)}},hostBindings:function(e,i){e&1&&_("keydown.F4",function(l){return i.handleF8(l)},!1,it)("keydown.control.F2",function(l){return i.handleF2(l)},!1,it)},standalone:!1,decls:38,vars:34,consts:[["ngSelectInfinite",""],[1,"row","g-0","d-print-none","pt-2"],[1,"col-7","d-flex","align-items-center"],[1,"d-flex","align-items-center","justify-content-between","ms-8"],[1,"d-flex","align-items-center","pe-8","cursor-pointer",3,"click"],[1,"me-2"],[1,"fa","fa-circle",3,"ngClass"],[1,"fs-6","headings-font-family","pb-1","position-relative"],[1,"position-absolute","top-0","translate-middle","badge","rounded-pill","bg-danger","ms-3"],[1,"border-start",2,"height","30px"],["id","moreMenu","data-bs-toggle","dropdown",1,"d-flex","align-items-center","ps-8","cursor-pointer"],[1,"fa-solid","fa-caret-down","fa-lg"],[1,"fs-6","headings-font-family","pb-1"],[1,"badge","rounded-pill","bg-danger","ms-1","customize-badge"],["aria-labelledby","moreMenu",1,"dropdown-menu","more-actions"],["aria-labelledby","moreMenu",1,"d-flex"],["class","dropdown-header text-dark col pe-8",4,"ngFor","ngForOf"],[1,"col-5"],[1,"d-flex","align-items-center","justify-content-end"],[1,"mt-1"],[1,"fa-light","fa-id-badge",2,"font-size","17px"],[1,"fs-5",2,"width","calc(100% - 32px)",3,"matTooltip"],["bindValue","ID","bindLabel","Name","placeholder","Assign Sales Person","matTooltipPosition","above",1,"sales-person","select-max-width",3,"selectedChange","selectedLabel","clearable","ngClass","items","selected","disabled","optionTitle","matTooltip"],[1,"navbar","mobile-button"],["type","button","aria-controls","navigation-index","aria-expanded","false","aria-label","Toggle navigation",1,"navbar-toggler","navbar-toggler-right","float-end","toggle-menu","ps-2","pe-0","border-0",2,"width","max-content","height","max-content",3,"click"],[1,"navbar-toggler-bar","burger-lines"],[1,"d-flex","align-items-center","w-100","justify-content-center"],[1,"dropdown-header","text-dark","col","pe-8"],[4,"ngIf"],["class","mt-5",4,"ngFor","ngForOf"],[1,"h5","mb-4"],[1,"dropdown-divider","m-0"],[4,"ngFor","ngForOf"],["matTooltipPosition","above",1,"cursor-pointer",3,"click","matTooltip","ngClass"],[1,"dropdown-item","px-1"],["aria-hidden","true"],[1,"fw-normal","fs-5","ps-4"],[1,"blob","ms-2",2,"position","absolute",3,"ngClass"],[1,"mt-5"],["matTooltipPosition","above","class","cursor-pointer",3,"matTooltip","ngClass","click",4,"ngFor","ngForOf"]],template:function(e,i){if(e&1){let o=v();r(0,"div",1)(1,"div",2)(2,"div",3)(3,"span",4),_("click",function(){return u(o),f(i.openOnlineStatusModal())}),r(4,"span",5),h(5,"i",6),b(6,"async"),b(7,"async"),a(),r(8,"span",7),m(9),b(10,"async"),g(11,rd,4,5,"span",8),b(12,"async"),a()(),h(13,"span",9),r(14,"span",10)(15,"span",5),h(16,"i",11),a(),r(17,"span",12),m(18,"More Actions"),a(),g(19,ad,5,5,"sup",13),b(20,"async"),a(),r(21,"div",14)(22,"div",15),g(23,_d,3,2,"div",16),b(24,"async"),a()()()(),r(25,"div",17)(26,"div",18)(27,"div",19),h(28,"i",20),a(),r(29,"div",21)(30,"ng-select-infinite",22,0),b(32,"async"),w("selectedChange",function(C){return u(o),D(i.salesOrder.Order.SalesID,C)||(i.salesOrder.Order.SalesID=C),f(C)}),_("selectedLabel",function(C){return u(o),f(i.salesPersonName=C)}),a()(),r(33,"div",23)(34,"button",24),_("click",function(){return u(o),f(i.collapseSidebar())}),h(35,"span",25)(36,"span",25)(37,"span",25),a()()()()()}e&2&&(s(5),p("ngClass",ge(29,nd,O(6,15,i.isOnline$),!O(7,17,i.isOnline$))),s(4),y("",O(10,19,i.isOnline$)?"Online":"Offline"," "),s(2),R(O(12,21,i.totalOfflineOrders$)>0?11:-1),s(8),R(O(20,23,i.moreMenuService.eligiblePromotions$)>0?19:-1),s(4),p("ngForOf",O(24,25,i.moreMenuService.moreMenu$)),s(6),p("matTooltip",i.salesPersonName),s(),p("clearable",!0)("ngClass",E(32,od,!O(32,27,i.isOnline$)))("items",i.salesPersonList),M("selected",i.salesOrder.Order.SalesID),p("disabled",i.disabledSalesOption)("optionTitle",!0)("matTooltip",i.salesPersonOptionTooltip()),s(4),ko("change",i.isChange))},dependencies:[U,_e,$,Ni,ce,Ne,X],styles:[`.disabled{color:gray;pointer-events:none;cursor:not-allowed}.blob{background:#000;border-radius:50%;box-shadow:0 0 #000;height:15px;width:15px;transform:scale(1);animation:pulse-black 2s infinite}@keyframes pulse-black{0%{transform:scale(.95);box-shadow:0 0 #000000b3}70%{transform:scale(1);box-shadow:0 0 0 10px #0000}to{transform:scale(.95);box-shadow:0 0 #0000}}.blob.white{background:#fff;box-shadow:0 0 #fff;animation:pulse-white 2s infinite}@keyframes pulse-white{0%{transform:scale(.95);box-shadow:0 0 #ffffffb3}70%{transform:scale(1);box-shadow:0 0 0 10px #fff0}to{transform:scale(.95);box-shadow:0 0 #fff0}}.blob.red{background:#ff5252;box-shadow:0 0 #ff5252;animation:pulse-red 2s infinite}@keyframes pulse-red{0%{transform:scale(.95);box-shadow:0 0 #ff5252b3}70%{transform:scale(1);box-shadow:0 0 0 10px #ff525200}to{transform:scale(.95);box-shadow:0 0 #ff525200}}.blob.orange{background:#ff793f;box-shadow:0 0 #ff793f;animation:pulse-orange 2s infinite}@keyframes pulse-orange{0%{transform:scale(.95);box-shadow:0 0 #ff793fb3}70%{transform:scale(1);box-shadow:0 0 0 10px #ff793f00}to{transform:scale(.95);box-shadow:0 0 #ff793f00}}.blob.yellow{background:#ffb142;box-shadow:0 0 #ffb142;animation:pulse-yellow 2s infinite}@keyframes pulse-yellow{0%{transform:scale(.95);box-shadow:0 0 #ffb142b3}70%{transform:scale(1);box-shadow:0 0 0 10px #ffb14200}to{transform:scale(.95);box-shadow:0 0 #ffb14200}}.blob.blue{background:#34ace0;box-shadow:0 0 #34ace0;animation:pulse-blue 2s infinite}@keyframes pulse-blue{0%{transform:scale(.95);box-shadow:0 0 #34ace0b3}70%{transform:scale(1);box-shadow:0 0 0 10px #34ace000}to{transform:scale(.95);box-shadow:0 0 #34ace000}}.blob.green{background:#77d933;box-shadow:0 0 #77d933;animation:pulse-green 2s infinite}@keyframes pulse-green{0%{transform:scale(.95);box-shadow:0 0 #33d938b3}70%{transform:scale(1);box-shadow:0 0 0 10px #33d9b200}to{transform:scale(.95);box-shadow:0 0 #33d9b200}}.blob.purple{background:#8e44ad;box-shadow:0 0 #8e44ad;animation:pulse-purple 2s infinite}@keyframes pulse-purple{0%{transform:scale(.95);box-shadow:0 0 #8e44adb3}70%{transform:scale(1);box-shadow:0 0 0 10px #8e44ad00}to{transform:scale(.95);box-shadow:0 0 #8e44ad00}}ng-select-infinite.sales-person.select-max-width>ng-select{padding-right:10px;height:38px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{font-size:.75rem;border:.5px solid #d7d7d7;padding-right:6px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container>.ng-arrow-wrapper{width:12px;padding-bottom:2px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container>.ng-value-container{padding-left:6px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{min-height:38px!important;height:38px!important;border:none}ng-select-infinite.sales-person.select-max-width.offline>.ng-select.ng-select-single .ng-select-container{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container .ng-input{padding-left:5px!important}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container .ng-input>input{padding-top:5px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single>ng-dropdown-panel.ng-dropdown-panel{font-size:.75rem;width:95%!important}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-focused .ng-select-container{box-shadow:none!important;border-color:transparent!important}.change .burger-lines{transition:.4s}.change .burger-lines:nth-child(1){-webkit-transform:rotate(-45deg) translate(-8px,4px);transform:rotate(-45deg) translate(-8px,4px)}.change .burger-lines:nth-child(2){opacity:0}.change .burger-lines:nth-child(3){-webkit-transform:rotate(45deg) translate(-5px,0px);transform:rotate(45deg) translate(-5px)}.mobile-button{display:none}@media (max-width: 990px){.mobile-button{display:block}}.navbar-toggler:focus{box-shadow:none!important}.customize-badge{height:16px;width:16px;font-size:9px}
|
|
42
|
+
`],encapsulation:2})};var hd=["serialInput"];function bd(n,t){if(n&1){let e=v();r(0,"div",4)(1,"autocompleteV2",5),b(2,"async"),_("onHoverPrefixIcon",function(){u(e);let o=c();return f(o.onMouseEventPrefixIcon("hover"))})("onLeavePrefixIcon",function(){u(e);let o=c();return f(o.onMouseEventPrefixIcon("leave"))})("onSelect",function(o){u(e);let l=c();return f(l.onAddItem(o))})("onInputEnter",function(o){u(e);let l=c();return f(l.onBarcodeScan(o))})("clickPrefixIcon",function(){u(e);let o=c();return f(o.scannerMode="serial")}),a()()}if(n&2){let e,i=c(),o=q(3);s(),p("renderThumbnail",!0)("prefixIcon",i.barcodePrefixIcon)("clearOnSelect",!0)("renderThumbnail",i.renderThumbnail)("useCustomTemplate",!0)("itemTemplate",o)("outletId",(e=O(2,9,i.outletService.Data$))==null?null:e.EntityID)("inputLock",i.role.sell.ProductInputLock)("suffixIcon",i.role.sell.ProductInputLock?"fa-solid fa-text-slash":"")}}function vd(n,t){if(n&1){let e=v();r(0,"div",6)(1,"i",7),_("click",function(){u(e);let o=c();return f(o.scannerMode="barcode")})("mouseenter",function(){u(e);let o=c();return f(o.onMouseEventSerialInput("hover"))})("mouseleave",function(){u(e);let o=c();return f(o.onMouseEventSerialInput("leave"))}),a(),r(2,"input",8,1),w("ngModelChange",function(o){u(e);let l=c();return D(l.serial,o)||(l.serial=o),f(o)}),_("keydown",function(o){u(e);let l=c();return f(l.onKeyDown(o))}),a()()}if(n&2){let e=c();s(),be(e.serialPrefixIcon),s(),M("ngModel",e.serial)}}function Sd(n,t){if(n&1&&(r(0,"div",13)(1,"span"),m(2),b(3,"number"),a()()),n&2){let e=c().data;s(2),T(O(3,1,e==null?null:e.UnitPrice))}}function yd(n,t){if(n&1&&(r(0,"div",9)(1,"div",10)(2,"div"),m(3),a(),r(4,"small",11),m(5),a()(),g(6,Sd,4,3,"div",12),a()),n&2){let e=t.data,i=c();s(3),T(e==null?null:e.Value),s(2),T(e==null?null:e.Code),s(),p("ngIf",i.role.product.Price)}}var Jn=class n{constructor(t,e,i,o,l,C){this.shoppingCartService=t;this.pageInitialService=e;this.dialog=i;this.role=o;this.salesOrderService=l;this.outletService=C}barcodePrefixIcon="fa-solid fa-barcode";serialPrefixIcon="fa-barcode-read fa-solid";scannerMode="barcode";toastr=oe(ee);serialInputEl;serial;focusProductInput(){let t=document.getElementById("product");t&&t.focus()}renderThumbnail=!1;ngOnInit(){this.initThumbnailConfig()}ngAfterViewInit(){this.focusProductInput()}initThumbnailConfig(){let t=this.pageInitialService.Data.AppConfigJSON;this.renderThumbnail=t?.ModuleSell?.Grid?.ProductImageVisible}onAddItem(t){this.shoppingCartService.addCartItemById(t).then(()=>{this.openModalItemOnNew()})}onBarcodeScan(t){S.IsNotEmpty(t)&&this.shoppingCartService.addCartItemByCode(t).then(e=>{this.openModalItemOnNew()})}openModalItemOnNew(){let t=this.pageInitialService.Data.AppConfigJSON,e=this.salesOrderService.Data;if(t.ModuleSell.ProductDialog.OpenOnNewItemAdded){let o=e.CartItems.length-1;this.dialog.open($e,{data:{index:o,focus:"quantity"}})}}onKeyDown(t){t.key=="Enter"&&(S.IsNotEmpty(this.serial)?(this.shoppingCartService.addItemBySerial(this.serial),this.serial=null):this.toastr.warning("Serial Can`t be empty","Warning!"),this.setFocusInput())}setFocusInput(){this.serialInputEl&&setTimeout(()=>{this.serialInputEl?.nativeElement?.focus()},500)}onMouseEventPrefixIcon(t){t==="hover"?this.barcodePrefixIcon="fa-barcode-read fa-solid":this.barcodePrefixIcon="fa-solid fa-barcode"}onMouseEventSerialInput(t){t==="hover"?this.serialPrefixIcon="fa-solid fa-barcode":this.serialPrefixIcon="fa-barcode-read fa-solid"}static \u0275fac=function(e){return new(e||n)(d(Me),d(B),d(ne),d(Ht),d(V),d(Y))};static \u0275cmp=P({type:n,selectors:[["app-search-product"]],viewQuery:function(e,i){if(e&1&&ve(hd,5),e&2){let o;Se(o=ye())&&(i.serialInputEl=o.first)}},hostBindings:function(e,i){e&1&&_("keydown.control.F3",function(l){return i.focusProductInput(l)},!1,it)},standalone:!1,decls:4,vars:2,consts:[["itemTemplate",""],["serialInput",""],["class","px-4 py-4",4,"ngIf"],["class","px-4 py-4 position-relative",4,"ngIf"],[1,"px-4","py-4"],["inputID","product","requestUrl","/API/AC/GetVariantSuggestionByCodeNNameWithEntityID","placeholder","Search product by name / code","localStorage","products","prefixIconTitle","Switch to scan by serial number","notFoundMessageFor","product","data_cy","txt-product","suffixIconTitle","Customer Input by typing is locked",1,"form-control","autocomplete-product",3,"onHoverPrefixIcon","onLeavePrefixIcon","onSelect","onInputEnter","clickPrefixIcon","renderThumbnail","prefixIcon","clearOnSelect","useCustomTemplate","itemTemplate","outletId","inputLock","suffixIcon"],[1,"px-4","py-4","position-relative"],["matTooltip","Switch to scan by code",1,"position-absolute","pointer",2,"top","21px","left","20px",3,"click","mouseenter","mouseleave"],["type","text","placeholder","Scan Product's Serial Number","aria-label","Serial",1,"form-control","rounded",2,"padding-left","32px","height","38px",3,"ngModelChange","keydown","ngModel"],[1,"d-flex","align-items-center","justify-content-between","w-100"],[1,"ms-3","text-wrap","text-break"],[1,"opacity-75"],["class","ps-4",4,"ngIf"],[1,"ps-4"]],template:function(e,i){e&1&&g(0,bd,3,11,"div",2)(1,vd,4,3,"div",3)(2,yd,7,3,"ng-template",null,0,G),e&2&&(p("ngIf",i.scannerMode==="barcode"),s(),p("ngIf",i.scannerMode==="serial"))},dependencies:[$,te,K,ie,qt,ce,Ne,X],styles:[`autocompleteV2.autocomplete-product>mat-form-field>input{height:38px!important;border-radius:.375rem}autocompleteV2.autocomplete-product>mat-form-field>div.position-relative>span.prefix-icon{top:10px}
|
|
43
|
+
`],encapsulation:2})};var Id=(n,t)=>({"text-danger":n,"text-custom-warning":t});function Od(n,t){if(n&1&&(r(0,"div",4)(1,"div",5)(2,"div"),m(3),a()()()),n&2){let e=t.data,i=c();s(),p("ngClass",ge(3,Id,e.StateID==i.customerState.Suspended,e.StateID==i.customerState.WaitingForApproval))("title",e.StateID==i.customerState.Suspended?"Suspended":e.StateID==i.customerState.WaitingForApproval?"Waiting for Approval":""),s(2),T(e==null?null:e.Value)}}function Pd(n,t){if(n&1&&(x(0),r(1,"span",9),h(2,"i",10),r(3,"span",11),m(4),b(5,"number"),a()(),I()),n&2){let e=c(2);s(4),T(e.customerData!=null&&e.customerData.Point?O(5,1,e.customerData==null?null:e.customerData.Point):0)}}function Md(n,t){if(n&1&&(x(0),r(1,"span"),m(2,"/"),a(),r(3,"span"),x(4),r(5,"span"),m(6),b(7,"number"),a(),I(),a(),I()),n&2){let e=c(3);s(6),T(O(7,1,e.customerData==null?null:e.customerData.DebtLimit))}}function Dd(n,t){if(n&1&&(x(0),r(1,"span",12),h(2,"i",13),r(3,"span"),m(4),b(5,"number"),a(),g(6,Md,8,3,"ng-container",3),a(),I()),n&2){let e=c(2);s(4),y(" ",O(5,2,e.customerData==null?null:e.customerData.Debt)," "),s(2),p("ngIf",(e.customerData==null?null:e.customerData.DebtLimit)>0)}}function wd(n,t){if(n&1){let e=v();x(0),r(1,"div",6)(2,"div",7)(3,"div",8),_("click",function(){u(e);let o=c();return f(o.showPointModal())}),g(4,Pd,6,3,"ng-container",3)(5,Dd,7,4,"ng-container",3),a()()(),I()}if(n&2){let e=c();s(4),p("ngIf",e.isEnabledLoyaltyPoint),s(),p("ngIf",(e.userRole==null?null:e.userRole.DebtView)&&(e.customerData==null?null:e.customerData.Debt)>0)}}var Gn=class n{constructor(t,e,i,o,l,C,N,ae,ke,Fe,je,ri){this.customerService=t;this.dialog=e;this.userRoleService=i;this.orderProcessorService=o;this.salesOrderService=l;this.toastr=C;this.outletService=N;this.posService=ae;this.customerHttpService=ke;this.sf=Fe;this.orderCalculator=je;this.router=ri;this.destroy$=new z}handleF1(){let t=document.getElementById("ContactID");t&&t.focus()}customerData;destroy$;isEnabledLoyaltyPoint;salesOrder;userRole;customerState=aa;ngOnInit(){this.subscribeToObs()}subscribeToObs(){this.userRole=this.userRoleService.Data,this.salesOrderService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.salesOrder=t}),this.outletService.Data$.subscribe(t=>{this.customerData=this.customerHttpService.Data,this.initEnableLoyaltyPoint()})}openCustomerModal(){this.posService.Data.AppConfigJSON.ModuleSell?.Customer?.QuickAddEnabled&&this.userRoleService.Data.ContactsCreate&&this.dialog.open(Fr,{autoFocus:!1}).afterClosed().subscribe(e=>{if(e){let i=this.orderProcessorService.Data;this.orderProcessorService.pushNewValue(i),this.customerService.updateDiscountRate(e.DiscountRate)}})}onInputCustomer(t){this.orderProcessorService.Data.InputTextValue=t,t!==null&&t.length==0&&(this.customerService.onEmptyInputCustomer(),this.customerData=null)}onSelectCustomer(t){this.customerService.addCustomerById(t).pipe(k(this.destroy$)).subscribe(e=>{this.customerData=e,this.initEnableLoyaltyPoint()})}initEnableLoyaltyPoint(){let e=this.posService.Data.AppConfigJSON?.ApplicationLoyalty?.Enabled,i=this.outletService?.Data?.MemberPoint;this.isEnabledLoyaltyPoint=!1,e&&i&&this.customerData?.Point>0&&(this.isEnabledLoyaltyPoint=!0)}onDeleteCustomer(){S.IsNotEmpty(this.salesOrder?.ContactName)&&this.dialog.open(gi,{data:{title:"Re-assign customer",message:"Are you sure to re-assign the customer?"}}).afterClosed().pipe(pe(t=>t)).subscribe(t=>{this.customerService.onEmptyInputCustomer(),this.customerData=null,this.orderProcessorService.Data.InputTextValue=null,this.salesOrder.ContactName=null})}onScanCodeCustomer(t){t.length>0&&this.customerService.addCustomerByCode(t).pipe(k(this.destroy$)).subscribe(e=>{this.customerData=e,this.initEnableLoyaltyPoint()})}onEmitSelectedCustomer(t){if(t){let e=JSON.parse(t);this.salesOrder.ContactName=e.Value}}showPointModal(){let t=this.outletService.Data?.MemberPoint,e=this.customerService.pointBalanced,i=this.orderCalculator.Data;i>0?t&&e>0&&this.dialog.open(ti):i<0&&this.toastr.error("You cannot redeem point when amount is negative","Redeem Restricted")}onClickSuffixIcon2(){let t=this.salesOrder.Order.CustomerID;if(S.IsNotEmpty(t)){let e=this.router.serializeUrl(this.router.createUrlTree(["/menu/Contacts/Contact/Customers/Info"],{queryParams:{ID:t}}));window.open(e,"_blank")}}onDetectInputNativeElement(t){this.sf.searchFilterNativeEl=t}static \u0275fac=function(e){return new(e||n)(d(ei),d(ne),d(me),d(j),d(V),d(ee),d(Y),d(B),d(dt),d(Wr),d(Pe),d(Ct))};static \u0275cmp=P({type:n,selectors:[["app-search-customer"]],hostBindings:function(e,i){e&1&&_("keydown.control.F1",function(l){return i.handleF1(l)},!1,it)},standalone:!1,decls:5,vars:9,consts:[["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","suffixIconTitle2","Open Customer Details","data_cy","txt-customer","icon_data_cy","dialog-add-customer",1,"form-control","autocomplete-customer",3,"onInputChange","onInputEnter","onSelect","clickInputValue","clickPrefixIcon","clickSuffixIcon2","optionSelected","onDetectInputNativeElement","useTooltip","inputTextValue","readonly","inputLock","suffixIcon","suffixIcon2","useCustomTemplate","itemTemplate"],[4,"ngIf"],[1,"d-flex","align-items-center","justify-content-between","w-100"],[1,"ms-3","text-wrap","text-break",3,"ngClass","title"],[1,"customerPoint-tooltip","arrow-top"],[1,"d-block"],[1,"ms-1","cursor-pointer",2,"font-size","10px",3,"click"],["matTooltip","Point"],["aria-hidden","true",1,"fa","fa-star","text-primary"],[1,"ms-1"],["matTooltip","Debt",1,"ms-3"],["aria-hidden","true",1,"fa-solid","fa-dollar-sign","text-primary"]],template:function(e,i){if(e&1){let o=v();r(0,"div",1)(1,"autocompleteV2",2),_("onInputChange",function(C){return u(o),f(i.onInputCustomer(C))})("onInputEnter",function(C){return u(o),f(i.onScanCodeCustomer(C))})("onSelect",function(C){return u(o),f(i.onSelectCustomer(C))})("clickInputValue",function(){return u(o),f(i.onDeleteCustomer())})("clickPrefixIcon",function(){return u(o),f(i.openCustomerModal())})("clickSuffixIcon2",function(){return u(o),f(i.onClickSuffixIcon2())})("optionSelected",function(C){return u(o),f(i.onEmitSelectedCustomer(C))})("onDetectInputNativeElement",function(C){return u(o),f(i.onDetectInputNativeElement(C))}),a(),g(2,Od,4,6,"ng-template",null,0,G)(4,wd,6,2,"ng-container",3),a()}if(e&2){let o=q(3);s(),p("useTooltip",!0)("inputTextValue",i.salesOrder.ContactName)("readonly",i.salesOrder==null?null:i.salesOrder.ContactName)("inputLock",i.userRole==null?null:i.userRole.CustomerInputLock)("suffixIcon",i.userRole!=null&&i.userRole.CustomerInputLock?"fa-solid fa-text-slash":"")("suffixIcon2",i.salesOrder.ContactName?"fa-regular fa-arrow-up-right-from-square":null)("useCustomTemplate",!0)("itemTemplate",o),s(3),p("ngIf",i.customerData&&((i.userRole==null?null:i.userRole.DebtView)&&(i.customerData==null?null:i.customerData.Debt)>0||i.isEnabledLoyaltyPoint))}},dependencies:[U,$,qt,ce,X],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:20px;background-color:#dededea8;color:#787c7c;float:left;border-radius:3px;padding:3px 8px;position:absolute;top:54px}.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)}.text-custom-warning{color:#ff7a00d6}
|
|
44
|
+
`],encapsulation:2})};var Td=["cardContainer"],Ed=n=>({"cart-subscription-overdue":n}),Rd=n=>({"bg-gradient-danger":n}),Nd=n=>({"pb-2":n}),zn=class n{constructor(t,e){this.onlineStatusService=t;this.authService=e;this.isOnline$=this.onlineStatusService.getOnlineStatus$(),this.currentSubsStatus=e.getSubscriptionStatus()}cardContainer;isOnline$;currentSubsStatus;subscriptionStatus=Ft;onEventAddItem(){this.cardContainer&&setTimeout(()=>{let t=this.cardContainer.nativeElement.scrollHeight;this.cardContainer.nativeElement.scrollTop=t},1)}static \u0275fac=function(e){return new(e||n)(d(qe),d(Ut))};static \u0275cmp=P({type:n,selectors:[["sell-cart"]],viewQuery:function(e,i){if(e&1&&ve(Td,5),e&2){let o;Se(o=ye())&&(i.cardContainer=o.first)}},standalone:!1,decls:18,vars:11,consts:[["cardContainer",""],[1,"d-flex","flex-column","cart-height",3,"ngClass"],[1,"row","pt-2","border-bottom",2,"min-height","60px",3,"ngClass"],[1,"col-12","px-3"],[1,"row"],[1,"col-7","px-0"],[1,"col-5","ps-0","pe-4"],[1,"row","d-print-none","flex-grow-1",2,"height","0px","overflow-y","auto"],[1,"col-12","px-1"],[1,"me-6","h-100"],[3,"eventAddItem"],[1,"row","d-print-none","pb-4","pe-8",3,"ngClass"],[1,"col-12"]],template:function(e,i){if(e&1){let o=v();r(0,"div",1)(1,"div",2),b(2,"async"),r(3,"div",3),h(4,"sell-cart-header"),a()(),r(5,"div",4)(6,"div",5),h(7,"app-search-product"),a(),r(8,"div",6),h(9,"app-search-customer"),a()(),r(10,"div",7,0)(12,"div",8)(13,"div",9)(14,"sell-cart-body",10),_("eventAddItem",function(){return u(o),f(i.onEventAddItem())}),a()()()(),r(15,"div",11)(16,"div",12),h(17,"sell-cart-footer"),a()()()}e&2&&(p("ngClass",E(5,Ed,i.currentSubsStatus==i.subscriptionStatus.OVERDUE||i.currentSubsStatus==i.subscriptionStatus.SELL_ONLY)),s(),p("ngClass",E(7,Rd,!O(2,3,i.isOnline$))),s(14),p("ngClass",E(9,Nd,i.currentSubsStatus==i.subscriptionStatus.OVERDUE||i.currentSubsStatus==i.subscriptionStatus.SELL_ONLY)))},dependencies:[U,Wn,Qn,$n,Jn,Gn,Ne],styles:['@media print{div.py-4.border-bottom[_ngcontent-%COMP%]{border:none!important}}div.customize-scroll-bar[_ngcontent-%COMP%] [_ngcontent-%COMP%]::-webkit-scrollbar{width:4px}div.customize-scroll-bar[_ngcontent-%COMP%] [_ngcontent-%COMP%]::-webkit-scrollbar-track{box-shadow:inset 0 0 5px #bfd2da}div.customize-scroll-bar[_ngcontent-%COMP%] [_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#c4c4c4;border-radius:10px} .hg-theme-default .hg-button{height:70px!important;font-size:16px!important} .hg-button-bksp{width:21px} .hg-button[data-skbtn="{enter}"][_ngcontent-%COMP%]{width:90px}.cart-height[_ngcontent-%COMP%]{min-height:calc(100vh + -0px)}.cart-subscription-overdue[_ngcontent-%COMP%]{min-height:calc(100vh - 3rem)!important}']})};var Ad=n=>({"sell-subscription-overdue":n});function Ld(n,t){n&1&&(r(0,"div",9)(1,"div",10),h(2,"sell-left-content"),a(),r(3,"div",11),h(4,"sell-cart"),a()())}function Bd(n,t){if(n&1&&(x(0),g(1,Ld,5,0,"div",8),I()),n&2){let e=c();s(),p("ngIf",e.posHttpResponse)}}function Fd(n,t){n&1&&(r(0,"div",12)(1,"div",13),h(2,"sell-complete"),a()())}function jd(n,t){if(n&1&&h(0,"park-order",14),n&2){let e=c();p("data",e.receiptTemplate)("printTemplate",e.outletRegister.PrintTemplate)("config",e.appConfig)("stylesheet",e.posHttpResponse==null?null:e.posHttpResponse.StylesSheet)}}function Hd(n,t){if(n&1&&h(0,"POS-bill-receipt-A4",15),n&2){let e=c();p("data",e.receiptTemplate)("printTemplate",e.outletRegister.PrintTemplate)("config",e.appConfig)("outletInfo",e.outletRegister)("stylesheet",e.posHttpResponse==null?null:e.posHttpResponse.StylesSheet)}}function Ud(n,t){if(n&1&&h(0,"pos-receipt",16),n&2){let e=c();p("data",e.receiptTemplate)("printTemplate",e.outletRegister.PrintTemplate)("config",e.appConfig)("priceVisibleRestriction",!e.userRole.PriceVisible)("outletInfo",e.outletRegister)("stylesheet",e.posHttpResponse==null?null:e.posHttpResponse.StylesSheet)}}var fo=class n extends ar{constructor(e,i,o,l,C,N,ae,ke,Fe,je,ri,Tt,Kn,Yn,ai,wa,go,_o,ka,Wd,Qd,qd,$d,Jd,Gd){super(go);this._localDataService=e;this.posService=i;this.outletService=o;this.route=l;this.signalRClientService=C;this.orderProcessorService=N;this.decimalPipe=ae;this.paymentServiceGateway=ke;this.dialog=Fe;this.toastr=je;this.parkOrderService=ri;this.userRoleService=Tt;this.receiptService=Kn;this.orderHttpService=Yn;this.roleService=ai;this.intercomService=wa;this.authService=_o;this.ecrSignalRService=ka;this.ecrStorage=Wd;this.router=Qd;this.onlineStatusService=qd;this.httpService=$d;this.promotionCouponProviderService=Jd;this.promotionCouponService=Gd;this.destroy$=new z,this.currentSubsStatus=_o.getSubscriptionStatus(),(!ai.sell.Create&&!this.route.snapshot.queryParamMap.has("ID")||!ai.sell.Edit&&this.route.snapshot.queryParamMap.has("ID"))&&this.router.navigate(["/menu/Unauthorized/Main/Unauthorized"])}destroy$;sellState=xe;isOnline;posHttpResponse;currentState;receiptTemplate;isPrintBillMini=!1;isPrintBillA4=!1;isPrintPark=!1;outletRegister;appConfig;userRole;invoiceNumberEdit;currentSubsStatus;subscriptionStatus=Ft;renderer=oe(Mo);ngOnInit(){this.initialPage()}ngAfterViewInit(){let e=document.querySelector("#full-container");this.renderer.addClass(e,"full-container"),this.intercomService.hideLauncher()}initialPage(){this.menuData$.pipe(Ee(()=>this.posService.requestObservable()),Re(o=>{if(this.posService.pushNewValue(o.data),this.posHttpResponse=o.data,this.appConfig=o.data.AppConfigJSON,this.showModalEmptySalesOrderTag(),this.subscribeToObservable(),this.route.snapshot.queryParamMap.has("ID")){let l=this.route.snapshot.queryParamMap.get("ID");this.editInvoice(l)}else this.outletService.setActiveRegisterFromOptions(o.data.Registers,o.data.UserName);this.initializeRole(),this.initEcrSignalR()}),k(this.destroy$)).pipe(pe(o=>o.type=="Online"),et(o=>o.data),Ee(o=>this._localDataService.syncPOSStorage(o))).pipe(k(this.destroy$)).subscribe()}onOpenDialogOfflineOrder(){vo([this._localDataService.unsentOrders$.pipe(et(e=>e.length),Vt(1)),this.onlineStatusService.getOnlineStatus$().pipe(Vt(1))]).pipe(Ee(([e,i])=>{let o=this.dialog.getDialogById("ModalOfflineOrder")?.id;return e>0&&i&&!o?this.dialog.open(Yi,{disableClose:!0,id:"ModalOfflineOrder",data:{activeTab:"ORDER"}}).afterClosed():bo}),Vt(1)).subscribe()}showModalEmptySalesOrderTag(){this.posHttpResponse?.PoTypes?.length==0&&this.dialog.open(Sr,{id:"ModalInfo",data:{title:"Empty Sales Order",message:`
|
|
45
45
|
<div class="d-flex justify-content-center">
|
|
46
46
|
<img class="empty-state-img" src="https://res.cloudinary.com/pos/image/upload/v1703142558/POS/Images/Cashier/tags.svg"
|
|
47
47
|
alt="Empty Sales Order Tag" />
|
|
@@ -52,5 +52,5 @@ Printing in 8mm format instead!`,"Error!"),this.printReceiptMini(),t}),Re(()=>{t
|
|
|
52
52
|
<p class="text-center">
|
|
53
53
|
Please add the tag <a href="/menu/Setup/Tag/Sales_Order">here</a> to continue.
|
|
54
54
|
</p>
|
|
55
|
-
`,headerType:Le.Error},width:"28rem"})}initializeRole(){let e=new
|
|
56
|
-
`],encapsulation:2})},
|
|
55
|
+
`,headerType:Le.Error},width:"28rem"})}initializeRole(){let e=new vr(this.roleService);this.userRoleService.pushNewValue(e)}subscribeToObservable(){this.orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.currentState=e.posState}),this.signalRClientService.OnPaymentReceived.pipe(k(this.destroy$)).subscribe(e=>{this.onQRPaymentComplete(e)}),this.outletService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.outletRegister=e,this.onOpenDialogOfflineOrder()}),this.userRoleService.Data$.pipe(k(this.destroy$)).subscribe(e=>{this.userRole=e}),this.parkOrderService.onPrint$.pipe(k(this.destroy$)).subscribe(e=>{switch(this.isPrintBillA4=!1,this.isPrintBillMini=!1,this.isPrintPark=!1,this.receiptTemplate=e.template,e.type){case"BILL_A4":this.isPrintBillA4=!0;break;case"BILL_MINI":this.isPrintBillMini=!0;break;case"PARK":this.isPrintPark=!0;break}this.receiptService.printWindow().finally(()=>{this.receiptTemplate=null})})}onQRPaymentComplete(e){if(!S.IsEmpty(e)){let i=JSON.parse(e);this.paymentServiceGateway.onQRPaymentComplete(i,this.posHttpResponse.AppConfigJSON).then(o=>{this.dialog.getDialogById("ModalPayment").close();let N=`IDR ${this.decimalPipe.transform(i.gross_amount)} received. Please verify in customer mobile app!`;this.toastr.success(N," QR Settlement"),this.paymentServiceGateway.clearTransactionID(),this.orderProcessorService.updatePosState(1,o)}).catch(o=>{this.toastr.error(o.message,o.header?o.header:"Error")})}}editInvoice(e){this.orderProcessorService.updatePosState(2),this.orderHttpService.GetInvoiceBySoID(e).pipe(k(this.destroy$)).subscribe(i=>{this.invoiceNumberEdit=i.Invoice.Number,i.Invoice.Number=null,this.orderProcessorService.plainToClass(i)})}initEcrSignalR(){if(this.ecrSignalRService.isConnected()){let i=this.ecrStorage.ecrUrl();this.ecrSignalRService.initConnection(i)}}ngOnDestroy(){this.intercomService.showLauncher(),this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(i){return new(i||n)(d(Ye),d(B),d(Y),d(jo),d(Ho),d(j),d(X),d(Ui),d(ne),d(ee),d(we),d(me),d(Mt),d(Oe),d(Ht),d(zo),d(sr),d(Ut),d(Jt),d(Gi),d(Ct),d(qe),d(Qe),d(It),d(Xe))};static \u0275cmp=P({type:n,selectors:[["POS-sell-v3"]],features:[st([we,kt]),Oi],decls:9,vars:8,consts:[["COMPLETE",""],[1,"d-block","d-print-none"],[1,"container-fluid","sell-container",3,"ngClass"],[4,"ngIf","ngIfElse"],[1,"print_containers"],[3,"data","printTemplate","config","stylesheet",4,"ngIf"],[3,"data","printTemplate","config","outletInfo","stylesheet",4,"ngIf"],[3,"data","printTemplate","config","priceVisibleRestriction","outletInfo","stylesheet",4,"ngIf"],["class","row d-print-none",4,"ngIf"],[1,"row","d-print-none"],[1,"col-5","pe-6"],[1,"border-start","ps-6","col-7"],[1,"row"],[1,"col-12","px-0"],[3,"data","printTemplate","config","stylesheet"],[3,"data","printTemplate","config","outletInfo","stylesheet"],[3,"data","printTemplate","config","priceVisibleRestriction","outletInfo","stylesheet"]],template:function(i,o){if(i&1&&(h(0,"subscription-alert",1),r(1,"div",2),g(2,Bd,2,1,"ng-container",3)(3,Fd,3,0,"ng-template",null,0,G),a(),r(5,"div",4),g(6,jd,1,4,"park-order",5)(7,Hd,1,5,"POS-bill-receipt-A4",6)(8,Ud,1,6,"pos-receipt",7),a()),i&2){let l=q(4);s(),p("ngClass",E(6,Ad,o.currentSubsStatus==o.subscriptionStatus.OVERDUE||o.currentSubsStatus==o.subscriptionStatus.SELL_ONLY)),s(),p("ngIf",o.currentState!=o.sellState.IsComplete&&o.currentState!=o.sellState.UploadOrderFail)("ngIfElse",l),s(4),p("ngIf",o.isPrintPark&&o.receiptTemplate),s(),p("ngIf",o.receiptTemplate&&o.isPrintBillA4),s(),p("ngIf",o.receiptTemplate&&o.isPrintBillMini)}},dependencies:[Z,U,$,pn,Hn,qr,zn,hn,ze,xt,Ji,$i,Zi,Ar,Vr,Nr,Rr,vn,gr,oa],styles:[`.cart-background{background-color:#fcfdff}.sell-container{margin:0 auto!important;height:100%}.sell-container>.row{height:100%}.sell-container>.row>[class*=col-]{height:100%}.sell-container .quicky{overflow:hidden}.sell-subscription-overdue{height:calc(100vh - 3rem)!important;overflow-y:auto}.print_containers{display:none}@media print{.print_containers{display:block;text-align:left}.sell-subscription-overdue{height:auto!important;overflow-y:visible!important}}
|
|
56
|
+
`],encapsulation:2})},OS=[{path:"Offline",loadChildren:()=>import("./chunk-6HQRARSZ.js").then(n=>n.OfflineModule)},{path:"",loadComponent:()=>fo}];export{fo as SellV3Component,OS as routes};
|