dealpos 26.6.0 → 26.6.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-XOAAD7TC.js → chunk-2LO5536L.js} +13 -13
- package/browser/{chunk-L7Q6M2EO.js → chunk-3H54S52Z.js} +1 -1
- package/browser/{chunk-QTYEJP4B.js → chunk-3NVF526K.js} +1 -1
- package/browser/{chunk-S5KPBQQZ.js → chunk-3OA6ODOK.js} +1 -1
- package/browser/{chunk-X6GDKW75.js → chunk-4L5PTHFI.js} +1 -1
- package/browser/{chunk-2KUFXQKV.js → chunk-4QNEJWU5.js} +1 -1
- package/browser/chunk-4V45TJTP.js +1 -0
- package/browser/{chunk-Q4DYVVNC.js → chunk-5JHYWYCN.js} +1 -1
- package/browser/chunk-63RZ6WAJ.js +1 -0
- package/browser/{chunk-5T4PSM5S.js → chunk-6JS54AA7.js} +1 -1
- package/browser/{chunk-HYWPI3IB.js → chunk-6XLMBFJT.js} +7 -6
- package/browser/{chunk-KE7EWK3E.js → chunk-6ZVFCPNB.js} +1 -1
- package/browser/{chunk-AW7YX7SO.js → chunk-7CYZS5FU.js} +1 -1
- package/browser/{chunk-4INNGSTP.js → chunk-7UL2ULPU.js} +1 -1
- package/browser/{chunk-TYKUXRYD.js → chunk-A6ZZHVZG.js} +1 -1
- package/browser/{chunk-IBK4I4YA.js → chunk-ART6DQDE.js} +1 -1
- package/browser/{chunk-MKTPUPKK.js → chunk-AWOPZY4W.js} +1 -1
- package/browser/{chunk-K3OII5WY.js → chunk-AXIPHPGL.js} +1 -1
- package/browser/{chunk-RJIFWL3L.js → chunk-C5G4LMN4.js} +1 -1
- package/browser/chunk-CGQDAACM.js +14 -0
- package/browser/{chunk-BIUCILTF.js → chunk-CJS22JOJ.js} +1 -1
- package/browser/{chunk-MRPBIBYM.js → chunk-CS44QCGF.js} +1 -1
- package/browser/{chunk-WE6APISC.js → chunk-DCF5LB73.js} +1 -1
- package/browser/{chunk-2OLIU2HZ.js → chunk-DI3FATFR.js} +1 -1
- package/browser/{chunk-YIBX63DL.js → chunk-DKUUHIV6.js} +1 -1
- package/browser/{chunk-CKUEZHTN.js → chunk-DY53LPQN.js} +2 -2
- package/browser/{chunk-YPLN7TQX.js → chunk-EHGROSU6.js} +1 -1
- package/browser/{chunk-OWVLLIPW.js → chunk-ELJMYJ56.js} +1 -1
- package/browser/{chunk-TPTNAN46.js → chunk-ESVHXFPV.js} +1 -1
- package/browser/chunk-F3YURFCX.js +1 -0
- package/browser/{chunk-FHWJBD4J.js → chunk-FGVTMPE7.js} +1 -1
- package/browser/{chunk-XPQ3GT2A.js → chunk-FKKN3F3R.js} +1 -1
- package/browser/{chunk-YQY3IWXH.js → chunk-FVCS6M37.js} +7 -7
- package/browser/chunk-G7UEQTHT.js +1 -0
- package/browser/{chunk-XB553QLA.js → chunk-HF7JXECJ.js} +1 -1
- package/browser/{chunk-TNHEN4G6.js → chunk-I7KFRA46.js} +1 -1
- package/browser/{chunk-455ONPCY.js → chunk-ICJ4I2AN.js} +1 -1
- package/browser/{chunk-R6RXCHEB.js → chunk-IDAWDZPC.js} +1 -1
- package/browser/{chunk-E3GEERGT.js → chunk-IT7JM6FE.js} +1 -1
- package/browser/{chunk-QRYZGVKV.js → chunk-J3K3S5FY.js} +2 -2
- package/browser/{chunk-T2LI6RYY.js → chunk-JAE74SHN.js} +2 -2
- package/browser/{chunk-VVE45YUX.js → chunk-JAWQRZ2O.js} +1 -1
- package/browser/{chunk-EJ5ZCV33.js → chunk-JWBQMWMA.js} +1 -1
- package/browser/{chunk-6PHSRDSC.js → chunk-KR6UQJ2M.js} +1 -1
- package/browser/{chunk-5NVXJ7LA.js → chunk-KVNBQHRV.js} +1 -1
- package/browser/{chunk-GQYAOCWU.js → chunk-L2AXRCVR.js} +1 -1
- package/browser/chunk-LLUGPN5N.js +1 -0
- package/browser/{chunk-JHHS2GXB.js → chunk-LY7FUXNK.js} +1 -1
- package/browser/{chunk-OFWTVKTH.js → chunk-M6IBPSDY.js} +1 -1
- package/browser/{chunk-Y42TC7BD.js → chunk-MFYR6OD2.js} +1 -1
- package/browser/{chunk-7LO6CG5K.js → chunk-MIU55ABA.js} +1 -1
- package/browser/{chunk-QVOCMALD.js → chunk-MNFFIWV5.js} +1 -1
- package/browser/{chunk-IA23243Z.js → chunk-MW4U6FME.js} +1 -1
- package/browser/{chunk-LOLCG6LT.js → chunk-NDHFAXSX.js} +1 -1
- package/browser/{chunk-CYCDYV4Z.js → chunk-NIMHPY7S.js} +1 -1
- package/browser/{chunk-OTJ6U7JT.js → chunk-OPHSNJ7C.js} +1 -1
- package/browser/{chunk-6R43XXT3.js → chunk-OWE2QLE3.js} +1 -1
- package/browser/{chunk-JF5DQ23B.js → chunk-OZZTSEBB.js} +1 -1
- package/browser/{chunk-ECZXWUQE.js → chunk-PFAIJAZB.js} +1 -1
- package/browser/{chunk-7ECFBTLY.js → chunk-PTMRXBZB.js} +1 -1
- package/browser/{chunk-SODFCBA4.js → chunk-PVBHCQP5.js} +1 -1
- package/browser/{chunk-3MX3NMZU.js → chunk-Q4S74G4I.js} +1 -1
- package/browser/chunk-Q6BUOQDP.js +4 -0
- package/browser/{chunk-PTTAGKOU.js → chunk-QBD56YAD.js} +1 -1
- package/browser/{chunk-ZZIQ3XWN.js → chunk-QF3EHE4E.js} +1 -1
- package/browser/{chunk-KCMVVC5N.js → chunk-QJDOVCCM.js} +1 -1
- package/browser/{chunk-C5FSL3L7.js → chunk-QN6GCPOY.js} +1 -1
- package/browser/{chunk-SPJIFA3Z.js → chunk-QSNRI7PO.js} +1 -1
- package/browser/{chunk-ETL3X5EX.js → chunk-RDU6CSEQ.js} +1 -1
- package/browser/{chunk-CGYCQPEK.js → chunk-RNYK6ECY.js} +1 -1
- package/browser/{chunk-TUZDVR36.js → chunk-RRRTL6JP.js} +1 -1
- package/browser/{chunk-6X6ZVYNV.js → chunk-S63IGKU2.js} +1 -1
- package/browser/{chunk-2JBPNVMR.js → chunk-SE56GE57.js} +1 -1
- package/browser/{chunk-M5F7IXNK.js → chunk-SZIJPPEJ.js} +1 -1
- package/browser/{chunk-YR6FSPL6.js → chunk-U7Q5HMUN.js} +1 -1
- package/browser/{chunk-Y7S5EJV7.js → chunk-UN3L4C4H.js} +1 -1
- package/browser/{chunk-VVFOEVL6.js → chunk-UUSD2ZRZ.js} +1 -1
- package/browser/{chunk-OAYFNEVP.js → chunk-V2B73ODJ.js} +1 -1
- package/browser/{chunk-7PLGHHZN.js → chunk-VC2FWOK2.js} +1 -1
- package/browser/{chunk-DVTPJXQ5.js → chunk-VSTYOST2.js} +1 -1
- package/browser/{chunk-W45JWXFN.js → chunk-VXIILH2M.js} +2 -2
- package/browser/{chunk-H7RC2HTT.js → chunk-VZBMECTE.js} +4 -4
- package/browser/{chunk-WBGQTSUG.js → chunk-WCD7UDIU.js} +1 -1
- package/browser/{chunk-6STIBSE6.js → chunk-X2NLB5LF.js} +1 -1
- package/browser/{chunk-2SB7K2RL.js → chunk-X5EUKR7D.js} +1 -1
- package/browser/{chunk-SEZHFMU7.js → chunk-XDE4KPBL.js} +1 -1
- package/browser/{chunk-N3CIGQQM.js → chunk-XO6PYXRO.js} +1 -1
- package/browser/{chunk-FG5DKIFD.js → chunk-XPMXF7SX.js} +1 -1
- package/browser/{chunk-67X5XD6V.js → chunk-XWPMXD3E.js} +1 -1
- package/browser/{chunk-FDWHVOKT.js → chunk-Y76GMD3F.js} +1 -1
- package/browser/{chunk-4GHYI725.js → chunk-Z2EX7PEN.js} +1 -1
- package/browser/{chunk-7N5M55MM.js → chunk-ZAGEYULB.js} +1 -1
- package/browser/index.html +2 -2
- package/browser/{main-7DVEI4M2.js → main-CFFMGBS7.js} +2 -2
- package/browser/{styles-K4EAIY4E.css → styles-E4MBUO45.css} +1 -1
- package/package.json +1 -1
- package/browser/chunk-JQRN2TZ4.js +0 -1
- package/browser/chunk-NOLOKD5Q.js +0 -1
- package/browser/chunk-T7UA2CEB.js +0 -1
- package/browser/chunk-UUSYD6FI.js +0 -1
- package/browser/chunk-VGCPQKBS.js +0 -1
- package/browser/chunk-XFHRE7Q7.js +0 -4
- package/browser/chunk-YKSNP3BA.js +0 -14
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{a as an}from"./chunk-ZM64NIQG.js";import{a as jr}from"./chunk-GCEN3WWZ.js";import{a as mo}from"./chunk-MRPBIBYM.js";import{b as ga,c as Ca}from"./chunk-IXCGJYSL.js";import{a as la,b as sa}from"./chunk-HVGGCITG.js";import{b as ca,e as pa,f as da,g as ma}from"./chunk-SFK5RYZM.js";import{A as Gr,B as tn,C as kt,D as Yr,E as oi,F as Xr,G as nn,H as ea,I as ta,J as rn,K as ra,L as aa,a as qe,b as Rr,c as Me,d as V,e as A,f as Nr,g as Qi,h as Vr,i as Ar,j as G,k as Lr,l as Fr,m as ge,n as Br,o as Mt,p as wt,q as de,r as ni,s as qi,t as Gi,u as zi,v as Ji,w as po,x as Ki,y as U,z as qr}from"./chunk-HYWPI3IB.js";import"./chunk-ZOBPTHDY.js";import{a as va}from"./chunk-HBAQBI6Z.js";import{a as Ot,b as ce}from"./chunk-34QIJADV.js";import"./chunk-H5NGH2GE.js";import"./chunk-GGDW5WFA.js";import{a as ha}from"./chunk-VCWK6RX5.js";import{a as ua,b as fa}from"./chunk-ND3RIVPG.js";import{a as Ur,b as Wr,c as Qr,d as Zi}from"./chunk-SJLEP6FX.js";import{a as _a,b as sn}from"./chunk-NOLOKD5Q.js";import{a as zr,b as Jr}from"./chunk-556UQHWI.js";import{c as Xi,d as en}from"./chunk-KMYX3TAJ.js";import"./chunk-WQECCCBD.js";import"./chunk-O7AVATSJ.js";import{a as At}from"./chunk-FZW6D464.js";import"./chunk-UQJXK4AV.js";import{a as pt,b as dt}from"./chunk-G36HUTHA.js";import"./chunk-QV7JAXIQ.js";import{a as ln}from"./chunk-UEYJLCPG.js";import"./chunk-NA5UDOK6.js";import"./chunk-NQX7EX5A.js";import"./chunk-OTL46AF6.js";import"./chunk-P3KIIKY4.js";import{a as Er,b as Kr,c as Zr}from"./chunk-CBJOORON.js";import{a as $i}from"./chunk-67F6DVYN.js";import{a as oa}from"./chunk-QC5ZMMHD.js";import"./chunk-ZHFXBX4S.js";import"./chunk-BYXBJQAS.js";import{a as ri}from"./chunk-NMTS3YYH.js";import{a as Pe,b as lo,d as Wi}from"./chunk-7BVPHIEF.js";import{a as co}from"./chunk-PF33HK6M.js";import"./chunk-5UDUWK67.js";import"./chunk-7LRCGQYB.js";import{a as so}from"./chunk-25H27N7N.js";import{a as Hr,b as Yi}from"./chunk-PSFSNRUA.js";import{a as on,b as ia,c as na}from"./chunk-HCJWXPQP.js";import{a as Ze}from"./chunk-MXT5CL2B.js";import{a as $r}from"./chunk-BGRQGTXE.js";import"./chunk-HZIMD6EA.js";import"./chunk-BYXBJQAS.js";import{a as Tr}from"./chunk-4USQPLEW.js";import"./chunk-J6U6UYNI.js";import{b as ti,c as Ie}from"./chunk-NSNUUKNK.js";import{b as Re}from"./chunk-JQRN2TZ4.js";import"./chunk-Z3E24JZW.js";import"./chunk-BYXBJQAS.js";import{c as xi}from"./chunk-PXDS3HXW.js";import{a as Ui}from"./chunk-NQKVYQ6V.js";import{a as Dt}from"./chunk-ZG67RK6U.js";import"./chunk-ERLFZP43.js";import{a as Hi}from"./chunk-6RG4P2MP.js";import{a as wr,b as kr}from"./chunk-TMJABEKM.js";import"./chunk-WZ4H2QCH.js";import"./chunk-MAZTVHVF.js";import"./chunk-JNIORAXC.js";import{b as Bi,c as xt,d as It,e as Yt}from"./chunk-OPB2XPWD.js";import{a as ii}from"./chunk-5J2QKKY7.js";import"./chunk-FYL3GGVQ.js";import{d as Mr}from"./chunk-LHMSMENB.js";import"./chunk-IBNMM6PL.js";import"./chunk-TPNVM7LE.js";import"./chunk-JWGBOTET.js";import"./chunk-OWTLSQQ2.js";import"./chunk-VL2K4VS6.js";import"./chunk-EVWV5K3V.js";import"./chunk-VUTMWXCW.js";import"./chunk-RXYWOHIG.js";import{a as mr}from"./chunk-FPLI2GLO.js";import"./chunk-TTIBJA6T.js";import{d as ei}from"./chunk-Y2SVOVXP.js";import"./chunk-63PUYCTB.js";import{b as Dr,c as Or}from"./chunk-VVE45YUX.js";import{a as Ir,b as Pr}from"./chunk-EI6LHFOD.js";import"./chunk-HKRRRS5Z.js";import"./chunk-VUQURUMC.js";import{c as lr}from"./chunk-MSPXAWJ5.js";import"./chunk-PSWOJ5IT.js";import"./chunk-KUQLG62N.js";import"./chunk-UKR6WSMU.js";import"./chunk-EXDHBZKS.js";import"./chunk-7JQAOKYW.js";import"./chunk-P3LYQU7S.js";import"./chunk-MESO3AH6.js";import{a as ct}from"./chunk-PYS23UW3.js";import{a as sr,c as cr,e as pr}from"./chunk-GMJBQR3Q.js";import{c as Sr,e as yr,f as xr}from"./chunk-2KUFXQKV.js";import{a as dr,b as ur}from"./chunk-67X5XD6V.js";import{a as ar}from"./chunk-D7IVR7NS.js";import"./chunk-TTUOKG4X.js";import"./chunk-F3X26H2E.js";import{a as H,b as j,d as br,e as Ye,g as Xt,h as Pt}from"./chunk-SUQNL3F5.js";import"./chunk-5X67NDWC.js";import"./chunk-65TS2FI5.js";import"./chunk-BQATLA3U.js";import{a as se,b as Ke}from"./chunk-YMCW77AL.js";import"./chunk-YNQPX5G6.js";import{F as vr,N as Zt,O as fe,a as fr,b as gr,n as ji,t as Cr,u as _r,x as hr}from"./chunk-AEEIEUNV.js";import{a as Yo}from"./chunk-KWRWTFOP.js";import"./chunk-EQLHPWVB.js";import{d as gt}from"./chunk-VJUJIONH.js";import"./chunk-KBGHJVCP.js";import{a as B,b as Oe,c as re}from"./chunk-MI6NPOA7.js";import"./chunk-XYUERTH2.js";import"./chunk-PXAONONR.js";import"./chunk-FNBP3JWI.js";import"./chunk-433OILLE.js";import"./chunk-K3VG42QW.js";import"./chunk-62FLHAOF.js";import"./chunk-UPFQNTMD.js";import"./chunk-YOLOS4V7.js";import{a as Fe}from"./chunk-2FWFPV5I.js";import"./chunk-JYQVZO6Y.js";import{C as or,E as be,F as Je,a as Zo,b as zt,c as Y,d as Xo,e as yi,g as er,h as q,j as tr,l as bt,m as ir,o as oe,r as nr,s as St,z as Jt}from"./chunk-XJFDP3JL.js";import{a as Gt,c as Kt}from"./chunk-K3OII5WY.js";import{a as rr}from"./chunk-2OLIU2HZ.js";import"./chunk-DQLTY6WY.js";import{b as yt}from"./chunk-TBGNID3E.js";import{a as b}from"./chunk-WUV22SZ4.js";import{a as Ko}from"./chunk-6R43XXT3.js";import{p as J,s as Le}from"./chunk-ELAN2H2C.js";import{$b as Se,Ac as st,Bb as g,Bc as T,Cc as _e,Cd as Go,Da as R,Db as C,Dc as Si,E as ie,Eb as Vt,Fb as pe,Gb as ee,Hb as te,I as vi,Ia as Eo,Ib as m,Ic as S,Jb as r,Jc as I,Kb as l,Kc as ne,Lb as v,Lc as Ae,M as Mo,Mb as ft,N as Bt,Nb as at,Oc as ht,Pb as He,Pd as zo,Qb as Ue,Ra as Ut,Rb as oo,Rc as ao,Rd as Jo,Sb as y,Ta as nt,Td as vt,Ud as $t,Vb as _,Wa as ut,Wb as ro,Wd as qt,Xb as c,Xc as Vi,Y as jt,Ya as s,Yc as Qo,Za as je,aa as Ve,ac as ye,bc as xe,bd as $o,c as Po,d as Q,da as k,dc as Lo,e as no,eb as Ro,ec as Fo,fa as ve,fb as d,fc as ot,gc as Bo,hc as jo,jb as M,jc as le,k as Do,kb as Wt,kc as p,kd as z,la as wo,lb as No,lc as w,ma as Ge,mc as x,md as Ai,na as Ht,nb as Ei,nc as Ee,nd as Qt,o as hi,oc as Ho,pa as N,pb as Z,pc as P,qa as $,qc as D,qd as Li,rc as O,rd as qo,sc as Ri,sd as ze,t as it,tc as Uo,u as Ti,ua as u,uc as Wo,ud as We,va as f,vc as bi,wb as Vo,wc as Ni,wd as K,xb as Ao,ya as ko,yd as Fi,z as Oo,za as To,zc as lt,zd as X}from"./chunk-Y2L5QWEJ.js";import"./chunk-WFMAM73Y.js";import{k as Io}from"./chunk-SNAKHGZS.js";var cn=class{ID;Code;Name;Title;Field;Address;ContactInfo;Logo;FooterLeft;FooterRight;FooterNote;PrintMode;PrintLX300;DeliveryNote;AppendQR;ItemRenderMode;CssClass;RemoveImage;DisplayName;DisplayNameCode};var ai=class{ParkLabel;Note;NumberOfPerson;ID;Alias;Created;CustomerDisplay;Number;Duration};var pn=class n{constructor(t,e,i,o,a,h){this.dialogRef=t;this._orderProcessorService=e;this._posService=i;this.salesOrderService=o;this.parkService=a;this.data=h;this.initModalDialog(),this.initConfig(),this.parkLabel=h.ParkLabel,this.form.ParkLabel=h.ParkLabel,this.form.Note=o.Data.Order.Note}modalConfig=new H;labelPlaceholder;form=new ai;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=b.IsEmpty(this.parkLabel)?e:this.parkLabel:b.IsEmpty(this.parkLabel)?this.form.ParkLabel=e:this.form.ParkLabel=this.parkLabel}static \u0275fac=function(e){return new(e||n)(d(B),d(U),d(A),d(V),d(ke),d(Oe))};static \u0275cmp=M({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),v(3,"i",2),r(4,"div"),p(5," Use our "),r(6,"a",3),p(7," Order Display Fulfillment System "),l(),p(8," to view the Parked Orders from your warehouse area. "),l()(),r(9,"div",4)(10,"strong",5),p(11,"Label"),l(),r(12,"input",6),O("ngModelChange",function(a){return D(i.parkLabel,a)||(i.parkLabel=a),a}),l()(),r(13,"div",4)(14,"strong",5),p(15,"Note"),l(),r(16,"POS-tinymce-editor",7),O("ngModelChange",function(a){return D(i.form.Note,a)||(i.form.Note=a),a}),l()()()()),e&2&&(m("config",i.modalConfig),s(12),P("ngModel",i.parkLabel),s(4),P("ngModel",i.form.Note))},dependencies:[Y,q,Jt,oe,j,se,Ze],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 dn=class n{constructor(t){this._dialogRef=t;this.modalConfig=new H,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(B))};static \u0275cmp=M({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","https://cdn.dealpos.xyz/web-image/order.png"],[1,"mt-1"],[1,"mt-0"],[1,"btn","btn-gray","btn-lg","ms-1",3,"click"],["src","https://cdn.dealpos.xyz/web-image/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()}),v(4,"img",3),r(5,"h4",4),p(6,"Order"),l(),r(7,"div",5),p(8,"For order for the kitchen"),l()(),r(9,"a",6),_("click",function(){return i.onPrintBill()}),v(10,"img",7),r(11,"h4",4),p(12,"Bill"),l(),r(13,"div",5),p(14,"To see amount of the bill"),l(),r(15,"div",5),p(16,"(Pre-settlement bill)"),l()()()()()),e&2&&m("config",i.modalConfig)},dependencies:[j],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 $a=n=>({"mat-tab-group-height":n});function qa(n,t){if(n&1){let e=y();r(0,"div",2)(1,"div",6)(2,"span",7),v(3,"i",8),l(),r(4,"input",9),O("ngModelChange",function(o){u(e);let a=c();return D(a.filter,o)||(a.filter=o),f(o)}),l()()()}if(n&2){let e=c();s(4),P("ngModel",e.filter)}}function Ga(n,t){if(n&1&&(r(0,"h5",14),v(1,"i"),r(2,"span"),p(3),l()()),n&2){let e=c().$implicit;s(),le(e.Icon),s(2),w(e.Name)}}function za(n,t){if(n&1){let e=y();r(0,"div",13)(1,"park-card",15),_("onSelect",function(){let o=u(e).$implicit,a=c(2);return f(a.onSelect(o))}),l()()}if(n&2){let e,i=t.$implicit,o=c().$implicit,a=c();s(),m("title",a.replaceWithAlias()&&i.Alias?i.Alias:i.Name)("alias",i.Alias)("isOccupied",i.IsOccupied)("icon",o.Icon)("selected",((e=a.parkOptionSelected())==null?null:e.Name)===i.Name)}}function Ja(n,t){if(n&1&&(r(0,"mat-tab",4),Z(1,Ga,4,3,"ng-template",10),r(2,"div",11)(3,"div",12),ee(4,za,2,5,"div",13,Vt),S(6,"Filter"),l()()()),n&2){let e=t.$implicit,i=c();m("label",e.Name),s(4),te(Ae(6,1,e.Options,i.filter(),"Name"))}}function Ka(n,t){if(n&1){let e=y();r(0,"div",5)(1,"POS-tinymce-editor",16),O("ngModelChange",function(o){u(e);let a=c();return D(a.parkNote,o)||(a.parkNote=o),f(o)}),l()()}if(n&2){let e=c();s(),P("ngModel",e.parkNote)}}var si=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),this.parkNote.set(t.orderNote||"")}dialogRef=$(B);posService=$(A);modalConfig=new H;filter=R("");parkLayout=R(null);parkOptionSelected=R(null);replaceWithAlias=R(!1);showInputNote=R(!1);parkNote=R("");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(Oe))};static \u0275cmp=M({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,qa,5,1,"div",2),r(4,"mat-tab-group",3),ee(5,Ja,7,5,"mat-tab",4,Vt),l(),g(7,Ka,2,1,"div",5),l()()()),e&2){let o,a,h;m("config",i.modalConfig),s(3),C(((o=i.parkLayout().Layout)==null?null:o.length)>0?3:-1),s(),m("ngClass",T(4,$a,i.showInputNote()&&((a=i.parkOptionSelected())==null?null:a.Name))),s(),te(i.parkLayout().Layout),s(2),C(i.showInputNote()&&((h=i.parkOptionSelected())!=null&&h.Name)?7:-1)}},dependencies:[X,z,j,jr,Zt,be,Y,q,oe,Yt,Bi,xt,It,Ze,_r],styles:["[_nghost-%COMP%] .mat-mdc-tab-group[_ngcontent-%COMP%]{--mat-tab-active-indicator-color: #89b03e;--mat-tab-focus-indicator-color: #89b03e;--mat-tab-focus-label-text-color: var(--bs-body-color);--mat-tab-active-label-text-color: var(--bs-body-color);--mat-tab-active-focus-label-text-color: var(--bs-body-color);--mat-tab-active-hover-label-text-color: var(--bs-body-color);--mat-tab-active-focus-indicator-color: #89b03e;--mat-tab-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 mn=class n{constructor(t,e,i,o,a,h,E,F,Ce){this.dialogRef=t;this.parkOrderRetrieve=e;this._orderDataService=i;this._posHttpResponseService=o;this._orderProcessorService=a;this._orderHttpService=h;this._dialog=E;this._outletRegisterService=F;this.parkService=Ce;this.salesOrderData=this._orderDataService.Data,this.appConfig=this._posHttpResponseService.Data.AppConfigJSON,this.parkLayoutPack=this._outletRegisterService.Data.ParkLayoutPack}modalConfig=new H;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(si,{data:{title:this.title,parkLayoutPack:this.parkLayoutPack,replaceWithAlias:this.appConfig.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,orderNote:this.salesOrderData?.Order?.Note}})})}get title(){return this._orderProcessorService.Data.posState==5?"Split Order":this.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkDialogTitle}static \u0275fac=function(e){return new(e||n)(d(B),d(Oe),d(V),d(A),d(U),d(Me),d(re),d(G),d(ke))};static \u0275cmp=M({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"),p(5,"Re-Park"),l(),r(6,"span"),p(7,"Store order to same location"),l()(),r(8,"a",2),_("click",function(){return i.onMove()}),r(9,"h4"),p(10,"Move"),l(),r(11,"span"),p(12,"Shift order to Different location"),l()()()()()),e&2&&m("title","Re-Park Order?")("config",i.modalConfig)},dependencies:[j],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 ci=class{Name;Alias;IsOccupied;Note};var un=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 Pi=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;Gopay;Number;Created;SalesName;ParkLabel;HeaderTitle;QRContent;Retur;ID;AfterSell;constructor(){this.OutletName="",this.Status=1,this.AmountSummary=[],this.Coupon="",this.Creator="",this.CurrencySymbol="",this.Customer=new un,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 xi,this.Title="",this.TypeName="",this.PaymentState=0,this.Number="",this.Created="",this.AfterSell=!0}};var pi=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 ci;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 fn=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 gn=class{AmountSummary;Contact;ContactDisplay;CurrencySymbol;FinalAmount;HeaderTitle;Invoice;IsPrice;Items;LoyaltyPoint;Order;Payments;PriceVisible;PrintPerson;PrintTime;SalesName;Shipping;TotalInWord};var Et=class n{constructor(t,e,i,o,a,h,E,F){this._posService=t;this._orderDataService=e;this._cashierCalculatorService=i;this._outletService=o;this._OrderHttpService=a;this._receiptCalculatorService=h;this._orderProcessorService=E;this._customerHttpService=F;this.subscribeToObservableChanges()}posData;completeData;park=new pi(null);outletInfo=new Wi;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 Pi;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.Invoice?.Note,t.RegisterCode=this.outletInfo.RegisterCode==null?"":this.outletInfo.RegisterCode,t.QRContent=this.generateQrContent(),t.ID=this.completeData?.ObjectID,t.Retur=b.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=b.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,a=this.completeData.ObjectID,h=window?.location?.host;switch(i){case 2:t=a;break;case 1:t=o;break;case 3:t=`receipt.dealpos.app?Data=${btoa(`${a}_${h}`)}`;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 fn;if(i.ExtraNote=b.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.Invoice?.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=Ie(Re,this.posData.CartItems);if(e){let o=this.posData.CartItems.filter(a=>b.IsNotEmpty(a.SplitQuantity)&&a.SplitQuantity>0);this.CartItems=o.map(a=>(a.Quantity=a.SplitQuantity,a))}else if(t&&this.AppConfigJSON.ApplicationParkAndRetrieve.PrintBehaviour.PrintAdditionalItemsOnlyOnRePark)if(this.CartItems=Array(),this.ParkTemp.length>0)for(let o of i){let a=this.ParkTemp.find(h=>h.ID==o.ID);a==null?this.CartItems.push(o):o.Quantity!=a.Quantity&&(o.Quantity=o.Quantity-a.Quantity,this.CartItems.push(o))}else this.CartItems=i;else this.CartItems=i}generateBillInvoice(){let t=new gn;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.Invoice?.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 Pi;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.Invoice.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=b.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,a=1;e?.length>0&&i<o&&(a=2);let h=i-o;return(Math.abs(h)<=t||h>=0)&&(a=3),a}generateTop(t,e){let i=new Date(e),o=new Date(t),a=i.getTime()-o.getTime();return Math.floor(a/(1e3*3600*24))}getSubmitedOrderDate(){let t=this.posData.Order?.Date,e=this.AppConfigJSON.PrintConfigInvoice?.DocumentVisibility?.OrderTimeVisible,i="",o=new Date;if(e){let a=new Date(t);a.setHours(o.getHours()),a.setMinutes(o.getMinutes()),i=this.datePipe.transform(a,"dd MMM yyyy HH:mm")}else i=this.datePipe.transform(t,"dd MMM yyyy");return i}getSubmitedCustomer(){return b.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(b.IsNotEmpty(this.posData.SplitParkLabel)&&(i=this.posData.SplitParkLabel),e&&b.IsNotEmpty(i)){let o=this.park.GetAlias(i);i=o||i}return i?b.IsEmpty(t)?i:b.StringFormat("{0} # {1}",t,i):""}GetSubmittedNumber(){return b.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 Gi(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 a="Payment"+(o+1);this.AppConfigJSON.PrintConfigInvoice.Footer.PaymentMethodVisible&&(a=this.findPaymentName(Number(this.posData.Payments[o].MethodID))),e=new Gi(this.posData.Payments[o].PaidAmount,this._cashierCalculatorService.currencySymbol,a,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,a=null;return o=i-e,o>0&&(a=new Gi(o,t,"Change",1)),a}findPaymentName(t){return this._outletService.Data.Payments.find(e=>e.ID==t).Name}printWindow(){return Io(this,null,function*(){return new Promise(t=>{setTimeout(()=>{window.print(),t()},500)})})}static \u0275fac=function(e){return new(e||n)(N(A),N(V),N(ge),N(G),N(Me),N(zi),N(U),N(dt))};static \u0275prov=Ge({token:n,factory:n.\u0275fac,providedIn:"root"})};var ke=class n{constructor(t,e,i,o,a,h,E,F,Ce,Te){this.httpService=t;this.receiptService=e;this.orderProcessorService=i;this.pageInitialService=o;this.salesOrderService=a;this.toastrService=h;this.promotionEventService=E;this.outletService=F;this.orderHttpService=Ce;this.dialog=Te;this._onPrint=new Q,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=Ie(qe,this.salesOrderService.Data);if(this.promotionEventService.selectedPromotion){this.clearPromotionAppliedInPark();return}e.Action.DeliveryEntityID=b.GuidEmpty,e.Action.Type=1,t.ParkLabel!=null&&(e.Order.ParkLabel=t.ParkLabel),e.Order.Note=t.Note,e.Order.InvoicedStateID=1,b.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(ve(o=>{this.orderProcessorService.updatePosState(3,o),this.orderProcessorService.createNewTransactionInSameOutletRegister(!0)}))}clearPromotionAppliedInPark(){this.dialog.open(Lr,{id:"modal-promotion-confirm",data:{message:`
|
|
1
|
+
import{a as an}from"./chunk-ZM64NIQG.js";import{a as Hr}from"./chunk-GCEN3WWZ.js";import{a as mo}from"./chunk-CS44QCGF.js";import{b as Ca,c as _a}from"./chunk-IXCGJYSL.js";import{a as sa,b as ca}from"./chunk-HVGGCITG.js";import{b as pa,e as da,f as ma,g as ua}from"./chunk-SFK5RYZM.js";import{A as zr,B as tn,C as kt,D as Zr,E as oi,F as ea,G as nn,H as ta,I as ia,J as rn,K as aa,L as la,a as qe,b as Nr,c as Me,d as V,e as A,f as Vr,g as Qi,h as Ar,i as Lr,j as G,k as Fr,l as Br,m as ge,n as jr,o as Mt,p as wt,q as de,r as ni,s as qi,t as Gi,u as zi,v as Ji,w as po,x as Ki,y as U,z as Gr}from"./chunk-6XLMBFJT.js";import"./chunk-ZOBPTHDY.js";import{a as ba}from"./chunk-HBAQBI6Z.js";import{a as Ot,b as ce}from"./chunk-34QIJADV.js";import"./chunk-H5NGH2GE.js";import"./chunk-GGDW5WFA.js";import{a as va}from"./chunk-VCWK6RX5.js";import{a as fa,b as ga}from"./chunk-ND3RIVPG.js";import{a as Wr,b as Qr,c as $r,d as Zi}from"./chunk-SJLEP6FX.js";import{a as ha,b as sn}from"./chunk-63RZ6WAJ.js";import{a as Jr,b as Kr}from"./chunk-556UQHWI.js";import{c as Xi,d as en}from"./chunk-KMYX3TAJ.js";import"./chunk-WQECCCBD.js";import"./chunk-O7AVATSJ.js";import{a as At}from"./chunk-FZW6D464.js";import"./chunk-UQJXK4AV.js";import{a as pt,b as dt}from"./chunk-G36HUTHA.js";import"./chunk-QV7JAXIQ.js";import{a as ln}from"./chunk-UEYJLCPG.js";import"./chunk-NA5UDOK6.js";import"./chunk-NQX7EX5A.js";import"./chunk-OTL46AF6.js";import"./chunk-P3KIIKY4.js";import{a as Rr,b as Yr,c as Xr}from"./chunk-CBJOORON.js";import{a as $i}from"./chunk-67F6DVYN.js";import{a as ra}from"./chunk-QC5ZMMHD.js";import"./chunk-ZHFXBX4S.js";import"./chunk-BYXBJQAS.js";import{a as ri}from"./chunk-NMTS3YYH.js";import{a as Pe,b as lo,d as Wi}from"./chunk-7BVPHIEF.js";import{a as co}from"./chunk-PF33HK6M.js";import"./chunk-5UDUWK67.js";import"./chunk-7LRCGQYB.js";import{a as so}from"./chunk-25H27N7N.js";import{a as Ur,b as Yi}from"./chunk-PSFSNRUA.js";import{a as on,b as na,c as oa}from"./chunk-HCJWXPQP.js";import{a as Ze}from"./chunk-MXT5CL2B.js";import{a as qr}from"./chunk-BGRQGTXE.js";import"./chunk-HZIMD6EA.js";import"./chunk-BYXBJQAS.js";import{a as Er}from"./chunk-4USQPLEW.js";import"./chunk-J6U6UYNI.js";import{b as ti,c as Ie}from"./chunk-NSNUUKNK.js";import{b as Re}from"./chunk-LLUGPN5N.js";import"./chunk-Z3E24JZW.js";import"./chunk-BYXBJQAS.js";import{c as xi}from"./chunk-PXDS3HXW.js";import{a as Ui}from"./chunk-NQKVYQ6V.js";import{a as Dt}from"./chunk-ZG67RK6U.js";import"./chunk-ERLFZP43.js";import{a as Hi}from"./chunk-6RG4P2MP.js";import{a as kr,b as Tr}from"./chunk-TMJABEKM.js";import"./chunk-WZ4H2QCH.js";import"./chunk-MAZTVHVF.js";import"./chunk-JNIORAXC.js";import{b as Bi,c as xt,d as It,e as Yt}from"./chunk-OPB2XPWD.js";import{a as ii}from"./chunk-5J2QKKY7.js";import"./chunk-FYL3GGVQ.js";import{d as wr}from"./chunk-LHMSMENB.js";import"./chunk-IBNMM6PL.js";import"./chunk-TPNVM7LE.js";import"./chunk-JWGBOTET.js";import"./chunk-OWTLSQQ2.js";import"./chunk-VL2K4VS6.js";import"./chunk-EVWV5K3V.js";import"./chunk-VUTMWXCW.js";import"./chunk-RXYWOHIG.js";import{a as mr}from"./chunk-FPLI2GLO.js";import"./chunk-TTIBJA6T.js";import{d as ei}from"./chunk-Y2SVOVXP.js";import{a as ur}from"./chunk-47ZKJUZF.js";import"./chunk-63PUYCTB.js";import{b as Or,c as Mr}from"./chunk-JAWQRZ2O.js";import{a as Pr,b as Dr}from"./chunk-EI6LHFOD.js";import"./chunk-HKRRRS5Z.js";import"./chunk-VUQURUMC.js";import{c as lr}from"./chunk-MSPXAWJ5.js";import"./chunk-PSWOJ5IT.js";import"./chunk-KUQLG62N.js";import"./chunk-UKR6WSMU.js";import"./chunk-EXDHBZKS.js";import"./chunk-7JQAOKYW.js";import"./chunk-P3LYQU7S.js";import"./chunk-MESO3AH6.js";import{a as ct}from"./chunk-PYS23UW3.js";import{a as sr,c as cr,e as pr}from"./chunk-GMJBQR3Q.js";import{c as yr,e as xr,f as Ir}from"./chunk-4QNEJWU5.js";import{a as dr,b as fr}from"./chunk-XWPMXD3E.js";import{a as ar}from"./chunk-D7IVR7NS.js";import"./chunk-TTUOKG4X.js";import"./chunk-F3X26H2E.js";import{a as H,b as j,d as Sr,e as Ye,g as Xt,h as Pt}from"./chunk-SUQNL3F5.js";import"./chunk-5X67NDWC.js";import"./chunk-65TS2FI5.js";import"./chunk-BQATLA3U.js";import{a as se,b as Ke}from"./chunk-YMCW77AL.js";import"./chunk-YNQPX5G6.js";import{F as br,N as Zt,O as fe,a as gr,b as Cr,n as ji,t as _r,u as hr,x as vr}from"./chunk-AEEIEUNV.js";import{a as Yo}from"./chunk-KWRWTFOP.js";import"./chunk-EQLHPWVB.js";import{d as gt}from"./chunk-VJUJIONH.js";import"./chunk-KBGHJVCP.js";import{a as B,b as Oe,c as re}from"./chunk-MI6NPOA7.js";import"./chunk-XYUERTH2.js";import"./chunk-PXAONONR.js";import"./chunk-FNBP3JWI.js";import"./chunk-433OILLE.js";import"./chunk-K3VG42QW.js";import"./chunk-62FLHAOF.js";import"./chunk-UPFQNTMD.js";import"./chunk-YOLOS4V7.js";import{a as Fe}from"./chunk-2FWFPV5I.js";import"./chunk-JYQVZO6Y.js";import{C as or,E as be,F as Je,a as Zo,b as zt,c as Y,d as Xo,e as yi,g as er,h as q,j as tr,l as bt,m as ir,o as oe,r as nr,s as St,z as Jt}from"./chunk-XJFDP3JL.js";import{a as Gt,c as Kt}from"./chunk-AXIPHPGL.js";import{a as rr}from"./chunk-DI3FATFR.js";import"./chunk-DQLTY6WY.js";import{b as yt}from"./chunk-TBGNID3E.js";import{a as S}from"./chunk-WUV22SZ4.js";import{a as Ko}from"./chunk-OWE2QLE3.js";import{p as J,s as Le}from"./chunk-ELAN2H2C.js";import{$b as Se,Ac as st,Bb as g,Bc as T,Cc as _e,Cd as Go,Da as R,Db as C,Dc as Si,E as ie,Eb as Vt,Fb as pe,Gb as ee,Hb as te,I as vi,Ia as Eo,Ib as m,Ic as b,Jb as r,Jc as I,Kb as l,Kc as ne,Lb as v,Lc as Ae,M as Mo,Mb as ft,N as Bt,Nb as at,Oc as ht,Pb as He,Pd as zo,Qb as Ue,Ra as Ut,Rb as oo,Rc as ao,Rd as Jo,Sb as y,Ta as nt,Td as vt,Ud as $t,Vb as _,Wa as ut,Wb as ro,Wd as qt,Xb as c,Xc as Vi,Y as jt,Ya as s,Yc as Qo,Za as je,aa as Ve,ac as ye,bc as xe,bd as $o,c as Po,d as Q,da as k,dc as Lo,e as no,eb as Ro,ec as Fo,fa as ve,fb as d,fc as ot,gc as Bo,hc as jo,jb as M,jc as le,k as Do,kb as Wt,kc as p,kd as z,la as wo,lb as No,lc as w,ma as Ge,mc as x,md as Ai,na as Ht,nb as Ei,nc as Ee,nd as Qt,o as hi,oc as Ho,pa as N,pb as Z,pc as P,qa as $,qc as D,qd as Li,rc as O,rd as qo,sc as Ri,sd as ze,t as it,tc as Uo,u as Ti,ua as u,uc as Wo,ud as We,va as f,vc as bi,wb as Vo,wc as Ni,wd as K,xb as Ao,ya as ko,yd as Fi,z as Oo,za as To,zc as lt,zd as X}from"./chunk-Y2L5QWEJ.js";import"./chunk-WFMAM73Y.js";import{k as Io}from"./chunk-SNAKHGZS.js";var cn=class{ID;Code;Name;Title;Field;Address;ContactInfo;Logo;FooterLeft;FooterRight;FooterNote;PrintMode;PrintLX300;DeliveryNote;AppendQR;ItemRenderMode;CssClass;RemoveImage;DisplayName;DisplayNameCode};var ai=class{ParkLabel;Note;NumberOfPerson;ID;Alias;Created;CustomerDisplay;Number;Duration};var pn=class n{constructor(t,e,i,o,a,h){this.dialogRef=t;this._orderProcessorService=e;this._posService=i;this.salesOrderService=o;this.parkService=a;this.data=h;this.initModalDialog(),this.initConfig(),this.parkLabel=h.ParkLabel,this.form.ParkLabel=h.ParkLabel,this.form.Note=o.Data.Order.Note}modalConfig=new H;labelPlaceholder;form=new ai;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(B),d(U),d(A),d(V),d(ke),d(Oe))};static \u0275cmp=M({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),v(3,"i",2),r(4,"div"),p(5," Use our "),r(6,"a",3),p(7," Order Display Fulfillment System "),l(),p(8," to view the Parked Orders from your warehouse area. "),l()(),r(9,"div",4)(10,"strong",5),p(11,"Label"),l(),r(12,"input",6),O("ngModelChange",function(a){return D(i.parkLabel,a)||(i.parkLabel=a),a}),l()(),r(13,"div",4)(14,"strong",5),p(15,"Note"),l(),r(16,"POS-tinymce-editor",7),O("ngModelChange",function(a){return D(i.form.Note,a)||(i.form.Note=a),a}),l()()()()),e&2&&(m("config",i.modalConfig),s(12),P("ngModel",i.parkLabel),s(4),P("ngModel",i.form.Note))},dependencies:[Y,q,Jt,oe,j,se,Ze],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 dn=class n{constructor(t){this._dialogRef=t;this.modalConfig=new H,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(B))};static \u0275cmp=M({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","https://cdn.dealpos.xyz/web-image/order.png"],[1,"mt-1"],[1,"mt-0"],[1,"btn","btn-gray","btn-lg","ms-1",3,"click"],["src","https://cdn.dealpos.xyz/web-image/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()}),v(4,"img",3),r(5,"h4",4),p(6,"Order"),l(),r(7,"div",5),p(8,"For order for the kitchen"),l()(),r(9,"a",6),_("click",function(){return i.onPrintBill()}),v(10,"img",7),r(11,"h4",4),p(12,"Bill"),l(),r(13,"div",5),p(14,"To see amount of the bill"),l(),r(15,"div",5),p(16,"(Pre-settlement bill)"),l()()()()()),e&2&&m("config",i.modalConfig)},dependencies:[j],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 qa=n=>({"mat-tab-group-height":n});function Ga(n,t){if(n&1){let e=y();r(0,"div",2)(1,"div",6)(2,"span",7),v(3,"i",8),l(),r(4,"input",9),O("ngModelChange",function(o){u(e);let a=c();return D(a.filter,o)||(a.filter=o),f(o)}),l()()()}if(n&2){let e=c();s(4),P("ngModel",e.filter)}}function za(n,t){if(n&1&&(r(0,"h5",14),v(1,"i"),r(2,"span"),p(3),l()()),n&2){let e=c().$implicit;s(),le(e.Icon),s(2),w(e.Name)}}function Ja(n,t){if(n&1){let e=y();r(0,"div",13)(1,"park-card",15),_("onSelect",function(){let o=u(e).$implicit,a=c(2);return f(a.onSelect(o))}),l()()}if(n&2){let e,i=t.$implicit,o=c().$implicit,a=c();s(),m("title",a.replaceWithAlias()&&i.Alias?i.Alias:i.Name)("alias",i.Alias)("isOccupied",i.IsOccupied)("icon",o.Icon)("selected",((e=a.parkOptionSelected())==null?null:e.Name)===i.Name)}}function Ka(n,t){if(n&1&&(r(0,"mat-tab",4),Z(1,za,4,3,"ng-template",10),r(2,"div",11)(3,"div",12),ee(4,Ja,2,5,"div",13,Vt),b(6,"Filter"),l()()()),n&2){let e=t.$implicit,i=c();m("label",e.Name),s(4),te(Ae(6,1,e.Options,i.filter(),"Name"))}}function Ya(n,t){if(n&1){let e=y();r(0,"div",5)(1,"POS-tinymce-editor",16),O("ngModelChange",function(o){u(e);let a=c();return D(a.parkNote,o)||(a.parkNote=o),f(o)}),l()()}if(n&2){let e=c();s(),P("ngModel",e.parkNote)}}var si=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),this.parkNote.set(t.orderNote||"")}dialogRef=$(B);posService=$(A);modalConfig=new H;filter=R("");parkLayout=R(null);parkOptionSelected=R(null);replaceWithAlias=R(!1);showInputNote=R(!1);parkNote=R("");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(Oe))};static \u0275cmp=M({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,Ga,5,1,"div",2),r(4,"mat-tab-group",3),ee(5,Ka,7,5,"mat-tab",4,Vt),l(),g(7,Ya,2,1,"div",5),l()()()),e&2){let o,a,h;m("config",i.modalConfig),s(3),C(((o=i.parkLayout().Layout)==null?null:o.length)>0?3:-1),s(),m("ngClass",T(4,qa,i.showInputNote()&&((a=i.parkOptionSelected())==null?null:a.Name))),s(),te(i.parkLayout().Layout),s(2),C(i.showInputNote()&&((h=i.parkOptionSelected())!=null&&h.Name)?7:-1)}},dependencies:[X,z,j,Hr,Zt,be,Y,q,oe,Yt,Bi,xt,It,Ze,hr],styles:["[_nghost-%COMP%] .mat-mdc-tab-group[_ngcontent-%COMP%]{--mat-tab-active-indicator-color: #89b03e;--mat-tab-focus-indicator-color: #89b03e;--mat-tab-focus-label-text-color: var(--bs-body-color);--mat-tab-active-label-text-color: var(--bs-body-color);--mat-tab-active-focus-label-text-color: var(--bs-body-color);--mat-tab-active-hover-label-text-color: var(--bs-body-color);--mat-tab-active-focus-indicator-color: #89b03e;--mat-tab-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 mn=class n{constructor(t,e,i,o,a,h,E,F,Ce){this.dialogRef=t;this.parkOrderRetrieve=e;this._orderDataService=i;this._posHttpResponseService=o;this._orderProcessorService=a;this._orderHttpService=h;this._dialog=E;this._outletRegisterService=F;this.parkService=Ce;this.salesOrderData=this._orderDataService.Data,this.appConfig=this._posHttpResponseService.Data.AppConfigJSON,this.parkLayoutPack=this._outletRegisterService.Data.ParkLayoutPack}modalConfig=new H;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(si,{data:{title:this.title,parkLayoutPack:this.parkLayoutPack,replaceWithAlias:this.appConfig.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,orderNote:this.salesOrderData?.Order?.Note}})})}get title(){return this._orderProcessorService.Data.posState==5?"Split Order":this.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkDialogTitle}static \u0275fac=function(e){return new(e||n)(d(B),d(Oe),d(V),d(A),d(U),d(Me),d(re),d(G),d(ke))};static \u0275cmp=M({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"),p(5,"Re-Park"),l(),r(6,"span"),p(7,"Store order to same location"),l()(),r(8,"a",2),_("click",function(){return i.onMove()}),r(9,"h4"),p(10,"Move"),l(),r(11,"span"),p(12,"Shift order to Different location"),l()()()()()),e&2&&m("title","Re-Park Order?")("config",i.modalConfig)},dependencies:[j],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 ci=class{Name;Alias;IsOccupied;Note};var un=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 Pi=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;Gopay;Number;Created;SalesName;ParkLabel;HeaderTitle;QRContent;Retur;ID;AfterSell;constructor(){this.OutletName="",this.Status=1,this.AmountSummary=[],this.Coupon="",this.Creator="",this.CurrencySymbol="",this.Customer=new un,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 xi,this.Title="",this.TypeName="",this.PaymentState=0,this.Number="",this.Created="",this.AfterSell=!0}};var pi=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 ci;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 fn=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 gn=class{AmountSummary;Contact;ContactDisplay;CurrencySymbol;FinalAmount;HeaderTitle;Invoice;IsPrice;Items;LoyaltyPoint;Order;Payments;PriceVisible;PrintPerson;PrintTime;SalesName;Shipping;TotalInWord};var Et=class n{constructor(t,e,i,o,a,h,E,F){this._posService=t;this._orderDataService=e;this._cashierCalculatorService=i;this._outletService=o;this._OrderHttpService=a;this._receiptCalculatorService=h;this._orderProcessorService=E;this._customerHttpService=F;this.subscribeToObservableChanges()}posData;completeData;park=new pi(null);outletInfo=new Wi;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 Pi;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.Invoice?.Note,t.RegisterCode=this.outletInfo.RegisterCode==null?"":this.outletInfo.RegisterCode,t.QRContent=this.generateQrContent(),t.ID=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,a=this.completeData.ObjectID,h=window?.location?.host;switch(i){case 2:t=a;break;case 1:t=o;break;case 3:t=`receipt.dealpos.app?Data=${btoa(`${a}_${h}`)}`;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 fn;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.Invoice?.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=Ie(Re,this.posData.CartItems);if(e){let o=this.posData.CartItems.filter(a=>S.IsNotEmpty(a.SplitQuantity)&&a.SplitQuantity>0);this.CartItems=o.map(a=>(a.Quantity=a.SplitQuantity,a))}else if(t&&this.AppConfigJSON.ApplicationParkAndRetrieve.PrintBehaviour.PrintAdditionalItemsOnlyOnRePark)if(this.CartItems=Array(),this.ParkTemp.length>0)for(let o of i){let a=this.ParkTemp.find(h=>h.ID==o.ID);a==null?this.CartItems.push(o):o.Quantity!=a.Quantity&&(o.Quantity=o.Quantity-a.Quantity,this.CartItems.push(o))}else this.CartItems=i;else this.CartItems=i}generateBillInvoice(){let t=new gn;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.Invoice?.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 Pi;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.Invoice.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,a=1;e?.length>0&&i<o&&(a=2);let h=i-o;return(Math.abs(h)<=t||h>=0)&&(a=3),a}generateTop(t,e){let i=new Date(e),o=new Date(t),a=i.getTime()-o.getTime();return Math.floor(a/(1e3*3600*24))}getSubmitedOrderDate(){let t=this.posData.Order?.Date,e=this.AppConfigJSON.PrintConfigInvoice?.DocumentVisibility?.OrderTimeVisible,i="",o=new Date;if(e){let a=new Date(t);a.setHours(o.getHours()),a.setMinutes(o.getMinutes()),i=this.datePipe.transform(a,"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 Gi(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 a="Payment"+(o+1);this.AppConfigJSON.PrintConfigInvoice.Footer.PaymentMethodVisible&&(a=this.findPaymentName(Number(this.posData.Payments[o].MethodID))),e=new Gi(this.posData.Payments[o].PaidAmount,this._cashierCalculatorService.currencySymbol,a,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,a=null;return o=i-e,o>0&&(a=new Gi(o,t,"Change",1)),a}findPaymentName(t){return this._outletService.Data.Payments.find(e=>e.ID==t).Name}printWindow(){return Io(this,null,function*(){return new Promise(t=>{setTimeout(()=>{window.print(),t()},500)})})}static \u0275fac=function(e){return new(e||n)(N(A),N(V),N(ge),N(G),N(Me),N(zi),N(U),N(dt))};static \u0275prov=Ge({token:n,factory:n.\u0275fac,providedIn:"root"})};var ke=class n{constructor(t,e,i,o,a,h,E,F,Ce,Te){this.httpService=t;this.receiptService=e;this.orderProcessorService=i;this.pageInitialService=o;this.salesOrderService=a;this.toastrService=h;this.promotionEventService=E;this.outletService=F;this.orderHttpService=Ce;this.dialog=Te;this._onPrint=new Q,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=Ie(qe,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(ve(o=>{this.orderProcessorService.updatePosState(3,o),this.orderProcessorService.createNewTransactionInSameOutletRegister(!0)}))}clearPromotionAppliedInPark(){this.dialog.open(Fr,{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(b.IsEmpty(t.Order.RegisterID)){this.toastrService.warning(br.emptyEntity,Fe.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 b.IsNotEmpty(e)||b.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&&b.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(a=>{let h=t.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkDialogTitle,E=i.posState==5,F=t.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,Ce=E?"Split Order":h;this.dialog.open(si,{data:{title:Ce,parkLayoutPack:this.generateParkLayoutOptions(o,a.Orders),replaceWithAlias:F,orderNote:e.Order?.Note}}).afterClosed().pipe(ie(Te=>b.IsNotEmpty(Te)),Ve(Te=>{let Be=new ai;return Be.ParkLabel=Te.Name,Be.Note=Te.Note,this.park(Be)})).subscribe()})}showReparkModal(){this.dialog.open(mn,{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&&b.IsNotEmpty(e)&&b.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(pn,{id:"park-form-modal",data:{title:t,labelDisable:i&&b.IsNotEmpty(i?.ID)||this.orderProcessorService.Data.posState==5,ParkLabel:this.salesOrderService.Data.Order.ParkLabel}})}onPrintRetrieve(){this.dialog.open(dn).afterClosed().pipe(ie(t=>b.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 a=new ci;a.Name=i.Name+o,a.Alias=this.generateAlias(t,a.Name),a.IsOccupied=this.IsOccupied(a.Name,e),i.Options.push(a)}return i}),t}generateAlias(t,e){let i="";if(t.Alias){let o=t.Alias.filter(a=>a.Name==e);o.length>0&&(i=`${o[0]?.Alias}`)}return i}IsOccupied(t,e){let i=e.filter(a=>a.ParkLabel==t),o=!1;return i.length>0&&(o=!0),o}static \u0275fac=function(e){return new(e||n)(N(Le),N(Et),N(U),N(A),N(V),N(J),N(ni),N(G),N(Me),N(re))};static \u0275prov=Ge({token:n,factory:n.\u0275fac,providedIn:"root"})};var Cn=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=Wt({type:n});static \u0275inj=Ht({imports:[X,be,Dt,Pt,Hr,Yt,qt,Zt,Ke,Yi]})};var ya=n=>({"opacity-50":n});function Xa(n,t){if(n&1){let e=y();r(0,"div",5)(1,"h6",6),p(2,"Verify Via"),l(),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"),v(7,"i",10),l(),r(8,"div",11),p(9),l()()()(),r(10,"div",12)(11,"button",8),_("click",function(){u(e);let o=c();return f(o.onChooseVerifyType("email"))}),r(12,"div",9),v(13,"i",13),r(14,"div",11),p(15),l()()()(),r(16,"div",12)(17,"button",14),_("click",function(o){return u(e),c().onChooseVerifyType("pin"),f(o.preventDefault())}),r(18,"div",9),v(19,"i",15),r(20,"div",16),p(21,"Use PIN"),l()()()()()}if(n&2){let e=c();s(4),m("disabled",!e.phone||(e.phone==null?null:e.phone.length)<6),s(4),m("ngClass",T(6,ya,!e.phone||(e.phone==null?null:e.phone.length)<6)),s(),x(" ",e.phone&&(e.phone==null?null:e.phone.length)>6?e.phone:"Mobile Phone is not registered"," "),s(2),m("disabled",!e.email),s(3),m("ngClass",T(8,ya,!e.email)),s(),x(" ",e.email?e.email:"Email is not registered"," ")}}function el(n,t){if(n&1){let e=y();r(0,"div",17)(1,"div",18)(2,"div"),p(3,"OTP Verification is turned "),r(4,"span",19),p(5,"OFF"),l(),p(6,","),l(),r(7,"div"),p(8," Please read this "),r(9,"a",20),p(10,"article"),l(),p(11," to turn on "),l()()(),r(12,"div")(13,"div",21)(14,"button",22),_("click",function(){u(e);let o=c();return f(o.onRedeem())}),p(15,"Redeem"),l()()()}}var _n=class n{toastrService=$(J);onVerify=new je;pointUsedChange=new je;redeemEvent=new je;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 b.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=M({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),O("ngModelChange",function(a){return D(i.pointUsed,a)||(i.pointUsed=a),a}),_("ngModelChange",function(){return i.onPointUsedChange()}),l()(),r(3,"div",3)(4,"span",1),p(5,"Of"),l(),r(6,"span",4),p(7),S(8,"number"),l()(),r(9,"div"),p(10,"Points"),l()(),g(11,Xa,22,10,"div",5)(12,el,16,0)),e&2&&(s(2),P("ngModel",i.pointUsed),m("max",i.pointBalance),s(5),w(I(8,4,i.pointBalance)),s(4),C(i.isVerifyEnabled?11:12))},dependencies:[X,z,ct,be,Y,q,oe,Ke,se,K],styles:[".input-point[_ngcontent-%COMP%]{width:120px;height:44px;font-size:1.375rem;text-align:center}"]})};var tl=n=>({"error-input":n});function il(n,t){if(n&1&&(r(0,"span"),p(1),l()),n&2){let e=c(3);s(),x(" ",e.config.separator," ")}}function nl(n,t){if(n&1){let e=y();He(0),r(1,"input",5,0),_("paste",function(o){u(e);let a=c(2);return f(a.handlePaste(o))})("keyup",function(o){let a=u(e).index,h=c(2);return f(h.onKeyUp(o,a))})("input",function(o){let a=u(e).index,h=c(2);return f(h.onInput(o,a))})("keydown",function(o){let a=u(e).index,h=c(2);return f(h.onKeyDown(o,a))}),l(),Z(3,il,2,1,"span",6),Ue()}if(n&2){let e=t.$implicit,i=t.index,o=t.last,a=c(2);s(),le(Ni("otp-input ",a.config.inputClass)),m("pattern",a.config.allowNumbersOnly?"\\d*":"")("type",a.inputType)("placeholder",(a.config==null?null:a.config.placeholder)||"")("ngStyle",a.config.inputStyles)("formControl",a.otpForm.controls[e])("id",a.getBoxId(i))("ngClass",T(11,tl,(a.config==null?null:a.config.showError)&&(a.formControl==null?null:a.formControl.invalid)&&((a.formControl==null?null:a.formControl.dirty)||(a.formControl==null?null:a.formControl.touched)))),s(2),m("ngIf",a.config.separator&&!o)}}function ol(n,t){if(n&1){let e=y();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),Z(2,nl,4,13,"ng-container",4),l()()}if(n&2){let e=c();le(Ni("ng-otp-input-wrapper wrapper ",e.config.containerClass)),m("id",Ni("c_",e.componentKey))("ngStyle",e.config.containerStyles),s(2),m("ngForOf",e.controlKeys)}}var _t=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)}},Di=class{static keys(t){return t?Object.keys(t):[]}},Co=(()=>{let t=class t{set disabled(i){this.setDisabledState(i)}get inputType(){return this.config?.isPasswordInput?"password":this.config?.allowNumbersOnly?"tel":"text"}get controlKeys(){return Di.keys(this.otpForm?.controls)}get formControl(){return this.formCtrl??this.inj?.get(er)}constructor(i,o){this.document=i,this.inj=o,this.config={length:4},this.onBlur=new Q,this.onInputChange=new Q,this.inputControls=new Array(this.config.length),this.componentKey=Math.random().toString(36).substring(2)+new Date().getTime().toString(36),this.destroy$=new Q,this.activeFocusCount=0,this.onChange=()=>{},this.onTouched=()=>{},this._isDisabled=!1}ngOnInit(){this.otpForm=new tr({});for(let i=0;i<this.config.length;i++)this.otpForm.addControl(this.getControlName(i),new bt);this.otpForm.valueChanges.pipe(k(this.destroy$)).subscribe(i=>{Di.keys(this.otpForm.controls).forEach(o=>{var a=this.otpForm.controls[o].value;a&&a.length>1&&(a.length>=this.config.length?this.setValue(a):this.rebuildValue())})})}setDisabledState(i){this._isDisabled=i,this.otpForm&&(i?this.otpForm.disable({emitEvent:!1}):this.otpForm.enable({emitEvent:!1}))}writeValue(i){this.currentVal=this.hasVal(i)?i:null,this.setValue(this.currentVal)}registerOnChange(i){this.onChange=i}registerOnTouched(i){this.onTouched=i}onFocusIn(){this.onTouched(),this.activeFocusCount++}onFocusOut(){setTimeout(()=>{this.activeFocusCount--,this.activeFocusCount===0&&(this.onTouched(),this.onBlur.next())},0)}ngAfterViewInit(){if(!this.config.disableAutoFocus){let i=this.document.getElementById(`c_${this.componentKey}`);if(i){let o=i.getElementsByClassName("otp-input")[0];o&&o.focus&&o.focus()}}}getControlName(i){return`ctrl_${i}`}onKeyDown(i,o){let a=this.getBoxId(o-1),h=this.getBoxId(o);if(_t.ifKey(i,"Enter")){let F=this.document.getElementById(h)?.closest("form");if(F){i.preventDefault();let Ce=new Event("submit",{bubbles:!0,cancelable:!0});F.dispatchEvent(Ce);return}}if(_t.ifSpacebar(i))return i.preventDefault(),!1;if(_t.ifBackspace(i)){i.target.value?this.clearInput(h,o):(this.clearInput(a,o-1),this.setSelected(a)),this.rebuildValue();return}if(_t.ifDelete(i)){i.target.value?this.clearInput(h,o):(this.clearInput(a,o-1),this.setSelected(a)),this.rebuildValue();return}}hasVal(i){return i!=null&&i!=null&&(!i?.trim||i.trim()!="")}onInput(i,o){let a=this.hasVal(this.currentVal)?`${this.currentVal}${i.target.value}`:i.target.value;if(this.config.allowNumbersOnly&&!this.validateNumber(a)){i.target.value=null,i.stopPropagation(),i.preventDefault(),this.clearInput(null,o);return}if(this.ifValidKeyCode(null,i.target.value)){let h=this.getBoxId(o+1);this.setSelected(h),this.rebuildValue()}else{i.target.value=null;let h=this.getControlName(o);this.otpForm.controls[h]?.setValue(null),this.rebuildValue()}}onKeyUp(i,o){_t.ifTab(i)&&(o-=1);let a=this.getBoxId(o+1),h=this.getBoxId(o-1);if(_t.ifRightArrow(i)){i.preventDefault(),this.setSelected(a);return}if(_t.ifLeftArrow(i)){i.preventDefault(),this.setSelected(h);return}}validateNumber(i){return i&&/^[0-9]+$/.test(i)}getBoxId(i){return`otp_${i}_${this.componentKey}`}clearInput(i,o){let a=this.getControlName(o);if(this.otpForm.controls[a]?.setValue(null),i){let h=this.document.getElementById(i);h&&h instanceof HTMLInputElement&&(h.value=null)}}setSelected(i){this.focusTo(i);let o=this.document.getElementById(i);o&&o.setSelectionRange&&setTimeout(()=>{o.setSelectionRange(0,1)},0)}ifValidKeyCode(i,o){let a=o??i.key;return this.config?.allowNumbersOnly?this.validateNumber(a):/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)||/^[a-zA-Z0-9%*_\-@#$!]$/.test(a)&&a.length==1}focusTo(i){let o=this.document.getElementById(i);o&&o.focus()}setValue(i){if(!(this.config.allowNumbersOnly&&isNaN(i))){if(this.otpForm?.reset(),!this.hasVal(i)){this.rebuildValue();return}i=i.toString().replace(/\s/g,""),Array.from(i).forEach((o,a)=>{this.otpForm.get(this.getControlName(a))&&this.otpForm.get(this.getControlName(a)).setValue(o)}),this.config.disableAutoFocus||setTimeout(()=>{let o=this.document.getElementById(`c_${this.componentKey}`);var a=i.length<this.config.length?i.length:this.config.length-1;let h=o.getElementsByClassName("otp-input")[a];h&&h.focus&&setTimeout(()=>{h.focus()},1)},0),this.rebuildValue()}}rebuildValue(){let i=null;Di.keys(this.otpForm.controls).forEach(o=>{let a=this.otpForm.controls[o].value;if(a){let h=a.length>1,E=!this.config.allowNumbersOnly&&this.config.letterCase&&(this.config.letterCase.toLocaleLowerCase()=="upper"||this.config.letterCase.toLocaleLowerCase()=="lower");a=a[0];let F=E?this.config.letterCase.toLocaleLowerCase()=="upper"?a.toUpperCase():a.toLowerCase():a;E&&F==a?E=!1:a=F,i==null?i=a:i+=a,(h||E)&&this.otpForm.controls[o].setValue(a)}}),this.currentVal!=i&&(this.currentVal=i,this.onChange(i),this.formCtrl?.setValue&&this.formCtrl.setValue(i),this.onInputChange.next(i))}handlePaste(i){let o=i.clipboardData||window.clipboardData;if(o)var a=o.getData("Text");i.stopPropagation(),i.preventDefault(),!(!a||this.config.allowNumbersOnly&&!this.validateNumber(a))&&this.setValue(a)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}};t.\u0275fac=function(o){return new(o||t)(d(To),d(ko))},t.\u0275cmp=M({type:t,selectors:[["ng-otp-input"],["ngx-otp-input"]],inputs:{config:"config",formCtrl:"formCtrl",disabled:"disabled"},outputs:{onBlur:"onBlur",onInputChange:"onInputChange"},features:[lt([{provide:Zo,useExisting:wo(()=>t),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(o,a){o&1&&Z(0,ol,3,7,"div",1),o&2&&m("ngIf",a.otpForm==null?null:a.otpForm.controls)},dependencies:[Je,Y,q,or,St,Qt,Ai,Li,z],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}}"]});let n=t;return n})(),hn=(()=>{let t=class t{};t.\u0275fac=function(o){return new(o||t)},t.\u0275mod=Wt({type:t}),t.\u0275inj=Ht({imports:[Co]});let n=t;return n})();function al(n,t){if(n&1&&(r(0,"div"),p(1," OTP has been sent to "),r(2,"span",5),p(3),l()()),n&2){let e=c();s(3),w(e.contact)}}function ll(n,t){if(n&1&&v(0,"ng-otp-input",3),n&2){let e=c(2);m("formCtrl",e.otpCtrl)("config",e.otpConfig)}}function sl(n,t){if(n&1&&g(0,ll,1,2,"ng-otp-input",3),n&2){let e=c();C(e.showPinInput()?0:-1)}}function cl(n,t){if(n&1&&v(0,"ng-otp-input",3),n&2){let e=c();m("formCtrl",e.otpCtrl)("config",e.otpConfig)}}function pl(n,t){if(n&1){let e=y();r(0,"div",4)(1,"span"),p(2,"Didn`t get a code? "),l(),r(3,"a",6),_("click",function(){u(e);let o=c();return f(o.onResendCode())}),p(4,"Click to resend"),l()()}}var vn=class n{type;contact;clearPin=!1;onVerify=new je;resendCode=new je;showPinInput=R(!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(Mo(300),ie(t=>t.length===6)).subscribe(t=>{this.onVerify.emit(t)})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=M({type:n,selectors:[["verify-step"]],inputs:{type:"type",contact:"contact",clearPin:"clearPin"},outputs:{onVerify:"onVerify",resendCode:"resendCode"},features:[Eo],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),p(2),l(),g(3,al,4,1,"div"),l(),r(4,"div",2),g(5,sl,1,1)(6,cl,1,2,"ng-otp-input",3),l(),g(7,pl,5,0,"div",4)),e&2&&(s(2),x(" Confirm Your ",i.type=="pin"?"PIN":"OTP"," "),s(),C(i.type!="pin"?3:-1),s(2),C(i.type=="pin"?5:6),s(2),C(i.type!="pin"?7:-1))},dependencies:[hn,Co,Je],encapsulation:2})};function dl(n,t){if(n&1){let e=y();ft(0,"button",7),ro("click",function(){u(e);let o=c();return f(o.onCancel())}),p(1,"Cancel"),at()}}function ml(n,t){if(n&1){let e=y();ft(0,"button",8),ro("click",function(){u(e);let o=c();return f(o.onConfirm())}),p(1,"Confirm"),at()}}var bn=class n{pointUsed=Vi(0);redeemPointValue=Vi(0);showCancelBtn=Vi(!1);confirmEvent=new je;cancelEvent=new je;onConfirm(){this.confirmEvent.emit()}onCancel(){this.cancelEvent.emit()}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=M({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&&(ft(0,"div",0)(1,"div",1),p(2,"Redeem"),at(),ft(3,"div",2)(4,"span",3),p(5),S(6,"number"),at(),ft(7,"small"),p(8,"Point"),at()(),ft(9,"div",1),p(10,"~"),at(),ft(11,"div",4)(12,"span",3),p(13),S(14,"number"),at(),ft(15,"small"),p(16,"Discount"),at()(),g(17,dl,2,0,"button",5)(18,ml,2,0,"button",6),at()),e&2&&(s(5),w(I(6,3,i.pointUsed())),s(8),w(I(14,5,i.pointUsed()*i.redeemPointValue())),s(4),C(i.showCancelBtn()?17:18))},dependencies:[X,K],encapsulation:2})};function ul(n,t){if(n&1&&(r(0,"span",5),p(1),S(2,"number"),l()),n&2){let e=c(3);s(),x("-",I(2,1,e.coupon.Amount),"%")}}function fl(n,t){if(n&1&&(r(0,"span",5),p(1),S(2,"number"),l()),n&2){let e=c(3);s(),x(" -",I(2,1,e.coupon.Amount)," ")}}function gl(n,t){if(n&1){let e=y();r(0,"button",9),_("click",function(){u(e);let o=c().$implicit,a=c(2);return f(a.onRemoveCouponDiscount(o))}),p(1," Remove "),l()}}function Cl(n,t){if(n&1){let e=y();r(0,"button",10),_("click",function(){u(e);let o=c().$implicit,a=c(2);return f(a.onApplyCouponDiscount(o))}),p(1," Apply "),l()}if(n&2){let e=c(3);m("disabled",e.hasAppliedCouponDiscount())}}function _l(n,t){if(n&1&&(r(0,"tr")(1,"td"),p(2),l(),r(3,"td"),p(4),l(),r(5,"td",4),p(6),S(7,"number"),l(),r(8,"td",4),g(9,ul,3,3,"span",5)(10,fl,3,3,"span",5),l(),r(11,"td",6),g(12,gl,2,0,"button",7)(13,Cl,2,1,"button",8),l()()),n&2){let e=t.$implicit,i=c(2);s(2),w(e==null||e.Variant==null?null:e.Variant.Name),s(2),w(e==null||e.Variant==null?null:e.Variant.Code),s(2),w(I(7,5,e.UnitPrice)),s(3),C((i.coupon==null||i.coupon.Requirement==null?null:i.coupon.Requirement.Type)==i.couponType.DiscountPercentage?9:10),s(3),C((e==null?null:e.CouponDiscount)>0?12:13)}}function hl(n,t){if(n&1&&ee(0,_l,14,7,"tr",null,Vt),n&2){let e=c();te(e.eligibleItems())}}function vl(n,t){n&1&&(r(0,"tr")(1,"td",11),v(2,"app-empty-state",12),l()())}var Sn=class n{constructor(t){this.data=t;this.coupon=this.data.coupon,this.initModalConfig(),this.initEligibleItems()}dialogRef=$(B);config;eligibleItems=R([]);coupon;couponType=an;hasAppliedCouponDiscount=R(!1);initModalConfig(){this.config=new H,this.config.title="Choose Item to Apply Discount",this.config.hideFooter=!0}initEligibleItems(){let t=this.data.coupon?.ApplyToProduct.map(e=>e.ID);t&&(this.eligibleItems.update(()=>this.data.cartItems.filter(i=>t.includes(i.VariantID))),this.hasAppliedCouponDiscount.update(()=>this.eligibleItems().some(e=>e.CouponDiscount>0)))}onApplyCouponDiscount(t){let e=[t];this.hasAppliedCouponDiscount.update(()=>!0),this.dialogRef.close(e)}onRemoveCouponDiscount(t){this.eligibleItems.update(e=>{let i=e.findIndex(o=>o.VariantID===t.VariantID);return i>-1&&(e[i].Discount=0,e[i].CouponDiscount=0),e}),this.hasAppliedCouponDiscount.update(()=>!1)}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(Oe))};static \u0275cmp=M({type:n,selectors:[["app-modal-coupon-selected-item"]],decls:17,vars:2,consts:[[3,"onCancel","onClose","config"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],[1,"text-end"],[1,"text-danger"],[1,"text-center"],[1,"btn","btn-sm","btn-danger"],[1,"btn","btn-sm","btn-success",3,"disabled"],[1,"btn","btn-sm","btn-danger",3,"click"],[1,"btn","btn-sm","btn-success",3,"click","disabled"],["colspan","5"],["title","No eligible products","message","No products in the cart qualify for coupon use"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()}),r(1,"content")(2,"table",1)(3,"thead",2)(4,"tr")(5,"th",3),p(6,"Name"),l(),r(7,"th",3),p(8,"Code"),l(),r(9,"th",3),p(10,"Price"),l(),r(11,"th",3),p(12,"Discount"),l(),v(13,"th",3),l()(),r(14,"tbody"),g(15,hl,2,0)(16,vl,3,0,"tr"),l()()()()),e&2&&(m("config",i.config),s(15),C(i.eligibleItems().length!==0?15:16))},dependencies:[X,j,ii,K],encapsulation:2})};var mt=class n{constructor(t,e,i,o,a,h){this._httpService=t;this._orderDataService=e;this._userRoleService=i;this.toastr=o;this._invoiceCalculatorService=a;this.promotionCouponFactoryService=h;this.subscribeToObservable()}dialog=$(re);role;originalRoleData;_coupon=R(null);salesOrderBeforePromotion=R(null);isShowToastrInApplyCoupon=R(!1);get coupon(){return this._coupon()}subscribeToObservable(){this._userRoleService.Data$.subscribe(t=>{this.role=t,b.IsEmpty(this.originalRoleData)&&(this.originalRoleData=Ie(Ot,t))})}RedeemCoupon(t,e,i=!1){if(!i){this.isShowToastrInApplyCoupon.set(!0);let a=this.copyOriginalSalesOrder();this.salesOrderBeforePromotion.set(a)}let o=this.promotionCouponFactoryService.generateRedeemCouponDto(t,"Internal");this._httpService.post(fe.ValidateInternalCoupon,o).subscribe({next:a=>{switch(this._orderDataService.Data.Order.PromotionCoupon=t,this._orderDataService.Data.Order.PromotionNote=e,this._orderDataService.Data.Order.CouponType=1,a.Requirement?.Type){case 1:this.HandleDiscountPercentage(a);break;case 2:this.HandleDiscountAmount(a);break;case 3:this.handleCouponReturnAccess(a);break;case 4:this.handleCouponParkedDeletionAccess();break;case 5:this.handleFullAccessCoupon();break;case 6:this.handleDeleteItemCoupon();break}this._coupon.set(a),this.isShowToastrInApplyCoupon.set(!1)},error:a=>{this.removeAppliedCoupon(!1),this.isShowToastrInApplyCoupon.set(!1)}})}setCouponOnEdit(t){t&&b.IsNotEmpty(t?.Type)&&(this._coupon.set(t),this.generateOriginalSalesOrderOnEdit())}generateOriginalSalesOrderOnEdit(){let t=Ie(qe,this._orderDataService.Data);t.Order.PromotionCoupon=null,t.Order.PromotionNote=null,t.Order.Discount=0,t.Order.DiscountAmount=0,this.salesOrderBeforePromotion.set(t)}copyOriginalSalesOrder(){return Ie(qe,this._orderDataService.Data)}HandleDiscountPercentage(t,e=!1){t.Amount>0?t.Requirement?.MaximumDiscount>0?this.applyConfigMaxDiscount(t,e):t.Requirement?.FullPriceProductOnly?this.applyFullPriceDisc(t,e):this.applyDiscountPercentage(t,e):(this.role.Discount=e?this.originalRoleData.Discount:!0,this._userRoleService.pushNewValue(this.role))}applyFullPriceDisc(t,e=!1){let i=this._orderDataService.Data;if(e)this.filterItemWithCouponDisc(i.CartItems).length>0?(i.CartItems=this.resetItemsDisc(i.CartItems),this._orderDataService.pushNewValue()):this.applyDiscountPercentage(t,e);else if(this.filterItemWithDisc(i.CartItems).length>0){let a=this.filterItemWithoutDisc(i.CartItems);a.length>0?this.applyConfigItemsScope(t,a).subscribe(h=>{let E=this.applyItemsDisc(h,t);i.CartItems=this.updateCartItems(E,t),this._orderDataService.pushNewValue(i),this.showToastr(t)}):(this.removeAppliedCoupon(!1),this._orderDataService.pushNewValue(),this.toastr.error("No products in the cart qualify for coupon use","Coupon Not Applied"))}else this.applyDiscountPercentage(t,e)}updateCartItems(t,e){let o=this._orderDataService.Data.CartItems.map((a,h)=>{let E=t.find(F=>this.isSameCartItem(F,a));return E||a});return o=this.applyOneOfFirstQuantity(o,e),o}applyOneOfFirstQuantity(t,e){if(e?.Requirement?.RequirementDiscountType==2){let i=t.findIndex(o=>o.CouponDiscount>0);if(t[i]?.Quantity>1){let o=ti(Re,t[i]);o.Quantity=1,o.ID=b.GuidEmpty,t[i].Quantity=t[i].Quantity-1,t[i].CouponDiscount=0,t[i].Discount=0,t[i].DiscountAmount=0,t.push(o)}}return t}filterItemWithDisc(t){return t.filter(i=>i.Discount>0||i.DiscountAmount>0||i.Price!=i?.Variant?.UnitPrice||b.IsNotEmpty(i.PriceBookID)||i.PriceTypeID==2)}filterItemWithoutDisc(t){return t.filter(i=>this.itemConditionFullPriceOnly(i))}filterItemWithCouponDisc(t){return t.filter(i=>i.CouponDiscount>0)}applyDiscountPercentage(t,e=!1){let i=this._orderDataService.Data.Order.CustomerDiscountRate,o=t.Amount;if(e){let a=this._orderDataService.Data;this._orderDataService.Data.Order.Discount=0,a.CartItems=this.resetItemsDisc(a.CartItems),this._orderDataService.pushNewValue(a)}else o>=i?t.ApplyToProduct?.length>0?this.applyDiscountRequiredItems(t):(this._orderDataService.Data.Order.Discount=t.Amount,this._orderDataService.pushNewValue(),this.showToastr(t)):(this.toastr.warning("Member discount is applied because member discount is greater than Coupon Discount","Warning"),this.removeAppliedDiscountOnCustomerChange())}applyDiscountRequiredItems(t){let i=this._orderDataService.Data.CartItems.filter(o=>t.ApplyToProduct.map(a=>a.ID)?.includes(o.VariantID));this.applyConfigItemsScope(t,i).subscribe(o=>{let a=o.map(E=>(E.Discount=t.Amount,E.CouponDiscount=t.Amount,E)),h=this.updateCartItems(a,t);this._orderDataService.Data.CartItems=h,this._orderDataService.pushNewValue(),this.showToastr(t)})}showToastr(t){let e=t?.Requirement?.Notify;b.IsNotEmpty(e)&&this.isShowToastrInApplyCoupon()&&this.toastr.success(e,"Coupon Applied")}applyConfigMaxDiscount(t,e=!1){let i=this._orderDataService.Data.CartItems;t.Requirement?.FullPriceProductOnly&&(i=i.filter(o=>this.itemConditionFullPriceOnly(o))),this.applyConfigItemsScope(t,i,e).subscribe(o=>{this.applyMaxDiscount(t,o,e)})}applyConfigItemsScope(t,e,i=!1){let o=t.Requirement?.RequirementDiscountType;return(o==1||o==2)&&i==!1?this.dialog.open(Sn,{data:{coupon:t,cartItems:e},id:"modal-coupon-selected-item"}).afterClosed().pipe(ve(h=>{let Ce=this._orderDataService.Data.CartItems.some(Te=>Te.CouponDiscount>0);!h&&!Ce&&this.removeAppliedDiscountOnCustomerChange()}),ie(h=>!!h)):hi(e)}applyMaxDiscount(t,e,i=!1){let o=this._invoiceCalculatorService.calculateGrossTotal(e),a=this._orderDataService.Data,h=o*t.Amount/100,E=t.Requirement?.MaximumDiscount,F=e;h>=E?(a.Order.DiscountAmount=i?0:E,F=this.resetItemsDisc(e)):(a.Order.DiscountAmount=0,F=i?this.resetItemsDisc(e):this.applyItemsDisc(e,t)),a.CartItems=this.updateCartItems(F,t),this._orderDataService.pushNewValue(a),i||this.showToastr(t)}resetItemsDisc(t){return this.coupon?.Requirement?.RequirementDiscountType==2?t=this.resetConfigOneOfFirstQuantity(t):t=t.map(e=>(e.CouponDiscount>0&&(e.Discount=0,e.DiscountAmount=0,e.CouponDiscount=0),e)),t}resetConfigOneOfFirstQuantity(t){let e=t.findIndex(i=>i.CouponDiscount>0);if(e!==-1){let i=t.findIndex(o=>o.CouponDiscount==0&&t[e]?.VariantID==o?.VariantID);i!==-1?(t.splice(e,1),t[i].Quantity+=1):(t[e].CouponDiscount=0,t[e].Discount=0,t[e].DiscountAmount=0)}return t}applyItemsDisc(t,e){return e.ApplyToProduct?.length>0?t=this.applyDiscByVariant(t,e):t=t.map(i=>(i.Discount=e.Amount,i.CouponDiscount=e.Amount,i)),t}applyDiscByVariant(t,e){return t=t.map(i=>(e.ApplyToProduct.find(a=>a.ID==i.VariantID)&&this.itemConditionFullPriceOnly(i)&&(i.Discount=e.Amount,i.CouponDiscount=e.Amount),i)),t}itemConditionFullPriceOnly(t){return(t.Discount==0||t.CouponDiscount>0)&&t.DiscountAmount==0&&t.Price==t?.Variant?.UnitPrice&&b.IsEmpty(t.PriceBookID)}HandleDiscountAmount(t,e=!1){t.Amount>0?(t.ApplyToProduct?.length>0?this.applyDiscountInItem(t,e):(e?this._orderDataService.Data.Order.DiscountAmount=0:(this._orderDataService.Data.Order.DiscountAmount=t.Amount,this.showToastr(t)),this._orderDataService.pushNewValue()),this.resetCustomerPoint(e)):(this.role.Discount=e?this.originalRoleData.Discount:!0,this._userRoleService.pushNewValue(this.role))}applyDiscountInItem(t,e=!1){let i=this._orderDataService.Data;if(e)i.CartItems=this.resetItemsDisc(i.CartItems);else{let a=i.CartItems.filter(h=>t.ApplyToProduct.map(E=>E.ID)?.includes(h.VariantID));this.applyConfigItemsScope(t,a,e).subscribe(h=>{let E=h.map(F=>(F.DiscountAmount=t.Amount,F.CouponDiscount=t.Amount,F));i.CartItems=this.updateCartItems(E,t),this._orderDataService.pushNewValue(i),this.showToastr(t)})}}resetCustomerPoint(t){if(!t){let e=this._orderDataService.Data;e.Order.PointUsed=0}}handleCouponReturnAccess(t){let e=Ie(Ot,this.role);e.Return=!0,this._userRoleService.pushNewValue(e),this.isShowToastrInApplyCoupon()&&this.toastr.success("You got access to return a sales transaction!","Coupon Applied")}handleCouponParkedDeletionAccess(){let t=Ie(Ot,this.role);t.ParkedDeletionAuthorized=!0,this._userRoleService.pushNewValue(t),this.isShowToastrInApplyCoupon()&&this.toastr.success("You Have Access to delete park and delete item when retrieve!","Coupon Applied")}handleFullAccessCoupon(){let t=Ie(Ot,this.role);t.UnitPriceEditor=!0,t.Discount=!0,t.Return=!0,t.Tax=!0,t.NumberEditor=!0,t.DateEditor=!0,t.PricebookSelector=!0,t.DeleteItem=!0,t.ParkedDeletionAuthorized=!0,this._userRoleService.pushNewValue(t),this.isShowToastrInApplyCoupon()&&this.toastr.success("You now have Full Access for this Order!","Coupon Applied")}handleDeleteItemCoupon(){let t=Ie(Ot,this.role);t.DeleteItem=!0,this._userRoleService.pushNewValue(t),this.isShowToastrInApplyCoupon()&&this.toastr.success("You Have Access to delete item","Coupon Applied")}removeAppliedCoupon(t=!0){this._userRoleService.pushNewValue(this.originalRoleData),this._orderDataService.pushNewValue(this.salesOrderBeforePromotion()),this.salesOrderBeforePromotion.set(null),this._coupon.set(null),t&&this.toastr.warning("Coupon Cancelled","Warning")}resetCouponOnNewTransaction(){this._userRoleService.pushNewValue(this.originalRoleData),this._coupon.set(null)}removeAppliedDiscountOnCustomerChange(){if(this.coupon)switch(this.coupon.Requirement?.Type){case 1:this.HandleDiscountPercentage(this._coupon(),!0),this.removeAppliedCouponOnCustomerChange();break;case 2:this.HandleDiscountAmount(this._coupon(),!0),this.removeAppliedCouponOnCustomerChange();break}}removeAppliedCouponOnCustomerChange(){if(this.coupon){let t=this._orderDataService.Data;t.Order.PromotionCoupon=null,t.Order.PromotionNote=null,this._coupon.set(null),this._userRoleService.pushNewValue(this.originalRoleData),this._orderDataService.pushNewValue(t)}}isSameCartItem(t,e){return t.VariantID===e.VariantID&&t.Quantity===e.Quantity&&t.Price===e.Price&&t.Discount===e.Discount&&t.PriceBookID===e.PriceBookID}static \u0275fac=function(e){return new(e||n)(N(Le),N(V),N(ce),N(J),N(ge),N(Br))};static \u0275prov=Ge({token:n,factory:n.\u0275fac,providedIn:"root"})};var di=class n{constructor(t,e,i,o,a,h,E,F,Ce,Te,Be){this.customerHttpService=t;this.salesOrderService=e;this.pageInitialService=i;this.shoppingCartService=o;this.invoiceCalculatorService=a;this.orderProcessorService=h;this.toastr=E;this.promotionCouponService=F;this.promotionCouponV2Service=Ce;this.httpService=Te;this.registerService=Be}customerId;customerData;_isCustomerVerfiedOtp=!1;get isCustomerVerfiedOtp(){return this._isCustomerVerfiedOtp}addCustomerById(t){return new Po(e=>{this.customerId=JSON.parse(JSON.stringify(this.salesOrderService.Data.Order.CustomerID)),this.resetCartOnChangeCustomer(t),b.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(Ve(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,a=i.find(h=>h.ID===o);b.IsNotEmpty(t.SalesID)&&a&&(e.Order.SalesID=t.SalesID)}setCustomerData(t){let e=this.salesOrderService.Data;if(t.EntityID==b.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 b.IsNotEmpty(this.customerId)&&(t=!0),t}applyCustomerPricebook(t){let e=this.salesOrderService.Data;if(b.IsNotEmpty(t.PricebookID)){let i=e.CartItems.map(o=>(o.Variant.PriceBook&&o.Variant.PriceBook.length!==0&&o.Variant.PriceBook.forEach(a=>{a.ID===t.PricebookID&&o.Quantity>=a.MinimumQuantity&&(o=this.shoppingCartService.applyPricebookToItem(o,a))}),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.promotionCouponV2Service.appliedCoupon(),i=this.salesOrderService.Data.Order.Discount;e&&e?.Type=="Percentage"?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&&b.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||b.IsNotEmpty(i.PriceBookID))}onEmptyInputCustomer(){b.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 so,this.customerData=new so,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(b.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=b.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,a=t*o,h=i.RedeemableAmount;a>h&&(o>0?(t=Math.ceil(h/o),a=h):(t=0,a=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=a,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(ve(()=>this._isCustomerVerfiedOtp=!0))}verifyPin(t,e){return this.httpService.post("/API/pos/VerifyPin",{PIN:t,CustomerID:e}).pipe(ve(()=>this._isCustomerVerfiedOtp=!0))}verifyWhatsAppOtp(t,e){return this.httpService.post("/API/otp/verifywhatsapp",{Number:t,OTP:e}).pipe(ve(()=>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)(N(dt),N(V),N(A),N(de),N(ge),N(U),N(J),N(mt),N(Mt),N(Le),N(G))};static \u0275prov=Ge({token:n,factory:n.\u0275fac,providedIn:"root"})};var Sl=["stepper"];function yl(n,t){n&1&&p(0,"Points")}function xl(n,t){n&1&&p(0,"Verify")}function Il(n,t){n&1&&p(0,"Confirm")}var mi=class n{dialogRef=$(B);outletRegisterService=$(G);pageInitialService=$(A);customerHttpService=$(dt);customerService=$(di);orderService=$(V);toastr=$(J);modalConfig;enabledLoyaltyPoint=R(!1);stepper;pointUsed=0;pointBalance=R(0);redeemPointValue=R(0);email=R(null);phone=R(null);contactToResend=R(null);verifyType=R(null);clearPin=R(!1);selectedTab=R(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 H,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,a=t.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,h=this.pointUsed*a;h>i&&(o=Math.ceil(i/a),h=i),(b.IsNotEmpty(e.Order.PointUsed)?e.Order.PointUsed:0)!=o&&(e.Order.PointUsed=o||0,e.Order.DiscountAmount=h,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=M({type:n,selectors:[["modal-redeem-point"]],viewQuery:function(e,i){if(e&1&&Se(Sl,5),e&2){let o;ye(o=xe())&&(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=y();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),Z(7,yl,1,0,"ng-template",6),r(8,"div",7)(9,"point-step",8),_("onVerify",function(h){return u(o),f(i.onVerify(h))}),O("pointUsedChange",function(h){return u(o),D(i.pointUsed,h)||(i.pointUsed=h),f(h)}),_("onRedeem",function(){return u(o),f(i.onRedeem())}),l()()(),r(10,"mat-step",9),Z(11,xl,1,0,"ng-template",6),r(12,"div",7)(13,"verify-step",10),_("resendCode",function(){return u(o),f(i.onResendCode())})("onVerify",function(h){return u(o),f(i.onVerifyCode(h))}),l()()(),r(14,"mat-step",11),Z(15,Il,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())}),l()()()()()()()()}e&2&&(m("preventEnterEvent",!0)("config",i.modalConfig),s(4),m("linear",!0)("selectedIndex",i.selectedTab()),s(2),m("editable",!0),Vo("aria-labelledby",i.selectedTab()==2?"stepDisabled":""),s(3),m("isVerifyEnabled",i.enabledLoyaltyPoint()),P("pointUsed",i.pointUsed),m("pointBalance",i.pointBalance())("email",i.email())("phone",i.phone()),s(),m("editable",!1),s(3),m("type",i.verifyType())("contact",i.contactToResend())("clearPin",i.clearPin()),s(4),m("pointUsed",i.pointUsed)("redeemPointValue",i.redeemPointValue())("showCancelBtn",i.selectedTab()==2))},dependencies:[X,be,j,ma,pa,ca,da,_n,vn,bn],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=y();r(0,"div",18),_("click",function(){u(e);let o=c(2);return f(o.onShowModalRedeem())}),r(1,"span"),v(2,"i",19),l(),r(3,"span"),p(4),S(5,"number"),l()()}if(n&2){let e=c(2);s(4),x(" ",I(5,1,e.pointUsed)," Points redeemed ")}}function Dl(n,t){if(n&1){let e=y();r(0,"tab",3)(1,"div",6)(2,"div",7)(3,"label",8),p(4,"Discount %"),l()(),r(5,"div",9)(6,"input",10),O("ngModelChange",function(o){u(e);let a=c();return D(a.discount1,o)||(a.discount1=o),f(o)}),l(),r(7,"span",11),p(8,"%"),l(),r(9,"span",12),p(10,"+"),l(),r(11,"input",13),O("ngModelChange",function(o){u(e);let a=c();return D(a.discount2,o)||(a.discount2=o),f(o)}),l(),r(12,"span",11),p(13,"%"),l()()(),r(14,"div",14)(15,"div",7)(16,"label",8),p(17),l()(),r(18,"div",15)(19,"input",16),O("ngModelChange",function(o){u(e);let a=c();return D(a.discountAmount,o)||(a.discountAmount=o),f(o)}),l(),g(20,Pl,6,3,"div",17),l()()()}if(n&2){let e=c();m("active",e.tabActive=="Discount"),s(6),P("ngModel",e.discount1),s(5),P("ngModel",e.discount2),s(6),x("Discount ",e.currencySymbol),s(2),m("disabled",e.pointUsed&&e.pointUsed>0),P("ngModel",e.discountAmount),s(),C(e.pointUsed&&e.pointUsed>0?20:-1)}}function Ol(n,t){if(n&1){let e=y();r(0,"tab",4)(1,"div",6)(2,"div",7)(3,"label",8),p(4,"Tax"),l()(),r(5,"div",9)(6,"ng-select",20),_("change",function(o){u(e);let a=c();return f(a.updateTax(o))}),l()()(),r(7,"div",14)(8,"div",7)(9,"label",8),p(10,"Surcharge"),l()(),r(11,"div",9)(12,"input",21),O("ngModelChange",function(o){u(e);let a=c();return D(a.surcharge,o)||(a.surcharge=o),f(o)}),l(),r(13,"span",11),p(14,"%"),l()()()()}if(n&2){let e=c();s(6),m("clearable",!1)("ngModel",e.salesOrder.Order.TaxTypeID)("items",e.taxes),s(6),P("ngModel",e.surcharge),m("max",100)("min",-100)}}function Ml(n,t){if(n&1){let e=y();r(0,"tab",5)(1,"div",6)(2,"div",22)(3,"strong"),p(4,"Discount After Tax"),l()(),r(5,"div",23)(6,"input",24),O("ngModelChange",function(o){u(e);let a=c();return D(a.discountAfterTax,o)||(a.discountAfterTax=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onDiscountAfterTaxChange())}),l()()(),r(7,"div",25)(8,"div",22)(9,"label",8),p(10,"Discount Calculator"),l()(),r(11,"div",26)(12,"input",27),O("ngModelChange",function(o){u(e);let a=c();return D(a.discounts[0],o)||(a.discounts[0]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),l(),r(13,"span"),p(14," %"),l(),r(15,"span",12),p(16,"+"),l(),r(17,"input",28),O("ngModelChange",function(o){u(e);let a=c();return D(a.discounts[1],o)||(a.discounts[1]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),l(),r(18,"span"),p(19," %"),l(),r(20,"span",12),p(21,"+"),l(),r(22,"input",29),O("ngModelChange",function(o){u(e);let a=c();return D(a.discounts[2],o)||(a.discounts[2]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),l(),r(23,"span"),p(24," %"),l()()()()}if(n&2){let e=c();s(6),P("ngModel",e.discountAfterTax),s(6),P("ngModel",e.discounts[0]),s(5),P("ngModel",e.discounts[1]),s(5),P("ngModel",e.discounts[2])}}var ui=class n{constructor(t,e,i,o,a,h,E,F,Ce,Te){this.dialogRef=t;this.orderService=e;this.invoiceCalculatorService=i;this.pageInitialService=o;this.roleService=a;this.customerHttpService=h;this.orderProcessorService=E;this.promotionCouponService=F;this.dialog=Ce;this.data=Te;let Be=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=Be?.ApplicationLoyalty?.PreferedPayment,this.tabActive=this.data?.tabIndexActive,this.isEditOrder=this.orderProcessorService.Data.posState==2,this.customer=h.Data,this.initDiscountAndTax(),this.initAvailablePoint(),this.initTabLoyaltyTitle()}modalConfig=new H;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=b.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,a=b.FilterByID(o,i);if(b.IsNotEmpty(a)&&a.CalculationTypeID==0){let h=1+a.Rate/100,E=e*h;this.discountAmount=(E-(E-this.discountAfterTax))/h}}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(mi)}static \u0275fac=function(e){return new(e||n)(d(B),d(V),d(ge),d(A),d(ce),d(dt),d(U),d(mt),d(re),d(Oe))};static \u0275cmp=M({type:n,selectors:[["POS-modal-discount"]],decls:7,vars:4,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],[3,"onTabChange"],["tabTitle","Discount",3,"active"],["matTooltipPosition","above","tabTitle","Tax"],["tabTitle","Calculator"],[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"],["role","button",3,"click"],[1,"fa-solid","fa-info-circle","ms-2"],["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"],[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(a){return i.onTabChange(a)}),g(4,Dl,21,7,"tab",3),g(5,Ol,15,6,"tab",4),g(6,Ml,25,4,"tab",5),l()()()()),e&2&&(m("config",i.modalConfig),s(4),C(i.userRole.Discount?4:-1),s(),C(i.userRole.Tax?5:-1),s(),C(i.userRole.Discount?6:-1))},dependencies:[X,be,Y,q,oe,on,na,ia,j,gt,ct,Ke,K],encapsulation:2})};var xn=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=Wt({type:n});static \u0275inj=Ht({imports:[X,be,Je,j,Zt,gt,la,on,Ke,hn,Ze,Mr,Yt,qt,lr,Hi,fa,Pt,Dt,Ca,ln,gt,ui,At,ei,ii,Xr]})};var In=class n{constructor(t,e,i,o,a,h,E){this.orderProcessorService=t;this.posDataService=e;this.signalBroadCast=i;this.calculatorService=o;this.OrderHttpService=a;this.localDataService=h;this.posService=E;this.newSale=new je}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(U),d(V),d(Ji),d(ge),d(Me),d(Ye),d(A))};static \u0275cmp=M({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"),v(4,"i",3),p(5," Order Upload Fail! "),l()()(),r(6,"div",4)(7,"div",5)(8,"div",6)(9,"p",7),p(10," Slow Connection Detected, Check the customer invoice list first. If the transaction isn't there, click the 'Retry' button. "),l()()(),r(11,"div",8)(12,"div",9)(13,"button",10),_("click",function(){return i.retrySubmit()}),p(14," Retry Upload "),l()()()(),r(15,"div",11)(16,"div",12)(17,"div",13)(18,"button",14),_("click",function(){return i.saveOffline()}),v(19,"i",15),p(20,"Save Offline "),l()()()()())},dependencies:[Ke,se],encapsulation:2})};var Pa=(()=>{let t=class t{constructor(){this.emailRegex=b.emailRegex,this.phoneNumberRegex=b.phoneNumberRegex}validate(i){let o=this.emailRegex,a=this.phoneNumberRegex,h=o.test(i.value),E=a.test(i.value);if(h||E||i.value=="")return null;{let F="Please input a valid email or phone number";return E?F="Please input a valid email":h&&(F="Please input a valid phone number"),{invalidEmailOrPhoneNumber:{value:i.value,errMessage:F}}}}};t.\u0275fac=function(o){return new(o||t)},t.\u0275dir=No({type:t,selectors:[["","pOSIsInvalidEmailOrPhoneNumber",""]],features:[lt([{provide:Xo,useExisting:t,multi:!0}])]});let n=t;return n})();function kl(n,t){n&1&&(r(0,"div",1)(1,"h4",2),p(2," For use this feature you must register first!"),v(3,"br"),p(4," Click the link below "),l()(),r(5,"a",3),p(6,"more information"),l(),p(7," > "))}function Tl(n,t){if(n&1){let e=y();r(0,"div",4)(1,"div",5)(2,"span",6),v(3,"i",7),l(),v(4,"input",8),r(5,"button",9),p(6,"Copy to Clipboard"),l()()(),r(7,"div",10)(8,"div",11)(9,"span",12),v(10,"i",13),l(),v(11,"input",14),r(12,"button",15),_("click",function(){u(e);let o=c();return f(o.onSendViaWhatsApp())}),p(13,"Send via WhatsApp"),l()()()}if(n&2){let e=c();s(4),m("value",e.data.link),s(),m("cdkCopyToClipboard",e.data.link),s(6),m("formControl",e.whatsAppNumberCtrl),s(),m("disabled",e.whatsAppNumberCtrl.invalid)}}var Mi=class n{constructor(t,e,i){this._dialogRef=t;this._toast=e;this.data=i}modalConfig=new H;whatsAppNumberCtrl;ngOnInit(){this.modalConfig.title="Midtrans Payment Link",this.modalConfig.hideFooter=!0,this.modalConfig.customWidth="500px",this.initWaNumberCtrl()}initWaNumberCtrl(){this.whatsAppNumberCtrl=new ir(null,[yi.pattern("^[0-9]*$"),yi.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(B),d(J),d(Oe))};static \u0275cmp=M({type:n,selectors:[["POS-modal-generate-link"]],standalone:!1,decls:4,vars:2,consts:[[3,"onOk","onCancel","onClose","config"],[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){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.close()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content"),g(2,kl,8,0)(3,Tl,14,4),l()()),e&2&&(m("config",i.modalConfig),s(2),C(i.data.link==null||i.data.link==""?2:3))},dependencies:[Y,q,St,j,ga],encapsulation:2})};var Nl=n=>({"rounded-0 rounded-start-2":n}),Vl=(n,t)=>({"bg-gradient-warning":n,"bg-gradient-danger":t}),Al=n=>({offline:n}),Ll=n=>({"ms-2":n}),Fl=(n,t)=>({ID:n,Template:t}),Bl=(n,t,e)=>({InvoiceID:n,OutID:t,Template:e}),jl=n=>({ID:n,Print:1,Printer:"Normal"}),Hl=n=>({ID:n}),Ul=(n,t)=>({cursor:n,opacity:t});function Wl(n,t){if(n&1&&(r(0,"a",41),p(1,"Delivery Order"),l()),n&2){let e=c(3);m("queryParams",_e(1,Fl,e.completeData.OutDeliveryID,e.outletRegister.PrintTemplate.ID))}}function Ql(n,t){if(n&1&&(r(0,"a",42),p(1,"Invoice & Delivery Order"),l()),n&2){let e=c(3);m("queryParams",Si(1,Bl,e.completeData.ObjectID,e.completeData.OutDeliveryID,e.outletRegister.PrintTemplate.ID))}}function $l(n,t){if(n&1&&(r(0,"a",43),p(1,"Invoice (No Price)"),l()),n&2){let e=c(3);m("href",e.getInvoicePrintURL(!0),nt)}}function ql(n,t){if(n&1&&(r(0,"a",44),p(1,"Packing Slip"),l()),n&2){let e=c(3);m("queryParams",T(1,jl,e.completeData.OutDeliveryID))}}function Gl(n,t){if(n&1&&(r(0,"div",28),v(1,"button",39),r(2,"div",40),g(3,Wl,2,4,"a",41),g(4,Ql,2,5,"a",42),g(5,$l,2,1,"a",43),g(6,ql,2,3,"a",44),l()()),n&2){let e=c(2);s(3),C(e.completeData.OutDeliveryID?3:-1),s(),C(e.completeData.OutDeliveryID?4:-1),s(),C(e.completeData?5:-1),s(),C(e.completeData.OutDeliveryID?6:-1)}}function zl(n,t){n&1&&(r(0,"div",30)(1,"div",34)(2,"p",45),p(3," Transaction saved to your browser's local storage. Please upload when connection is restored! "),l()()())}function Jl(n,t){if(n&1){let e=y();r(0,"div",31)(1,"div",46)(2,"div",47),_("click",function(){u(e);let o=c(2);return f(o.changeReceiptContact())}),v(3,"i"),l(),r(4,"input",48),_("ngModelChange",function(o){u(e);let a=c(2);return f(a.isPhoneOrEmail(o))}),l()(),r(5,"div",49)(6,"button",50),_("click",function(){u(e);let o=c(2);return f(o.sendReceiptToContact())}),p(7," Send Receipt "),l()()()}if(n&2){let e=c(2);s(3),le(e.receiptIcon+" fs-4"),s(),m("formControl",e.customerContact),s(2),m("disabled",e.customerContact.invalid)}}function Kl(n,t){if(n&1&&(r(0,"small",32),p(1),l()),n&2){let e=c(2);s(),x(" ",e.customerContact.errors==null||e.customerContact.errors.invalidEmailOrPhoneNumber==null?null:e.customerContact.errors.invalidEmailOrPhoneNumber.errMessage," ")}}function Yl(n,t){if(n&1){let e=y();r(0,"button",51),_("click",function(){u(e);let o=c(2);return f(o.onRetry())}),p(1," Retry Upload "),l()}}function Zl(n,t){if(n&1){let e=y();r(0,"div",53)(1,"button",54),_("click",function(){u(e);let o=c(3);return f(o.generateLink())}),v(2,"i",55),p(3,"Generate Payment Link "),l()()}}function Xl(n,t){if(n&1){let e=y();r(0,"div",53)(1,"button",56),_("click",function(){u(e);let o=c(3);return f(o.verifyPaymentSettlement())}),v(2,"i",57),p(3,"Verify Payment Settlement "),l()()}}function es(n,t){if(n&1&&(r(0,"div",38)(1,"div",52),g(2,Zl,4,0,"div",53),g(3,Xl,4,0,"div",53),l()()),n&2){let e=c(2);s(2),C(e.completeData.PaymentStateID==1?2:-1),s(),C(e.isNotEmpty(e.paymentGatewayService.getTransactionId())?3:-1)}}function ts(n,t){if(n&1){let e=y();r(0,"div",7)(1,"div",24)(2,"div",25)(3,"h2"),v(4,"i",26),p(5," Sell Complete "),r(6,"small",27),p(7),l()(),r(8,"div"),g(9,Gl,7,4,"div",28),l()()(),r(10,"div",13)(11,"div",29),g(12,zl,4,0,"div",30)(13,Jl,8,4,"div",31),g(14,Kl,2,1,"small",32),r(15,"div",33)(16,"div",34)(17,"div",35),g(18,Yl,2,0,"button",36),r(19,"button",37),_("click",function(){u(e);let o=c();return f(o.newSale())}),p(20," New Sale (F8) "),l()()()()()(),g(21,es,4,2,"div",38),l()}if(n&2){let e=c();s(),m("ngClass",_e(9,Vl,(!e.isOrderDateNow||e.completeData.PaymentStateID<3)&&e.completeData.PaymentStateLabel!="Offline",e.completeData.PaymentStateLabel=="Offline")),s(6),x(" (",e.completeData.PaymentStateLabel,")"),s(2),C(e.completeData.PaymentStateLabel=="Offline"?9:-1),s(2),m("ngClass",T(12,Al,e.completeData.PaymentStateLabel=="Offline")),s(),C(e.completeData.PaymentStateLabel=="Offline"?12:13),s(2),C(e.customerContact!=null&&e.customerContact.invalid&&(e.customerContact!=null&&e.customerContact.dirty||e.customerContact!=null&&e.customerContact.touched)?14:-1),s(4),C(e.completeData.PaymentStateLabel=="Offline"&&!e.isSuccessRetrySubmit()?18:-1),s(),m("ngClass",T(14,Ll,e.completeData.PaymentStateLabel=="Offline")),s(2),C(e.isOnline&&(e.completeData==null?null:e.completeData.PaymentStateID)==1||e.isNotEmpty(e.paymentGatewayService.getTransactionId())?21:-1)}}function is(n,t){if(n&1){let e=y();r(0,"app-retry",58),_("newSale",function(){u(e);let o=c();return f(o.newSale())}),l()}}function ns(n,t){if(n&1&&(r(0,"a",11),p(1),l()),n&2){let e=c();m("queryParams",T(2,Hl,e.completeData.ObjectID)),s(),x(" Invoice #",e.completeData==null?null:e.completeData.InvoiceNumber," ")}}function os(n,t){if(n&1&&(r(0,"span",12),p(1),l()),n&2){let e=c();s(),x(" Invoice #",e.completeData==null?null:e.completeData.InvoiceNumber," ")}}function rs(n,t){if(n&1&&(p(0),S(1,"number")),n&2){let e=c().$implicit;Ee(" ",e.CurrencySymbol," ",I(1,2,e.Amount)," ")}}function as(n,t){n&1&&p(0," - ")}function ls(n,t){if(n&1&&(r(0,"div",59)(1,"div",60),p(2),l(),r(3,"div",61),g(4,rs,2,4)(5,as,1,0),l()()),n&2){let e=t.$implicit,i=c(2);s(2),w(e.Label),s(2),C(i.role.PriceVisible?4:5)}}function ss(n,t){if(n&1&&(r(0,"div",13),ee(1,ls,6,2,"div",59,pe),l()),n&2){let e=c();s(),te(e.itemSummary)}}function cs(n,t){if(n&1&&(r(0,"div",62)(1,"div",64),p(2),l(),r(3,"div",65),p(4),S(5,"number"),l()()),n&2){let e=t.$implicit,i=t.$index,o=c(2);s(),m("hidden",!o.role.PriceVisible),s(),Ee(" ",e.Label,": ",e.CurrencySymbol," "),s(),m("hidden",!o.role.PriceVisible)("ngClass",i+1===o.amountSummary.length?"amount":""),s(),x(" ",I(5,6,e.Amount)," ")}}function ps(n,t){if(n&1&&(r(0,"div",62)(1,"div",64),p(2),l(),r(3,"div",66),p(4),S(5,"number"),l()()),n&2){let e=t.$implicit,i=c(3);s(),m("hidden",!i.role.PriceVisible),s(),Ee(" ",e.Label,": ",e.CurrencySymbol," "),s(),m("hidden",!i.role.PriceVisible),s(),x(" ",I(5,5,e.Amount)," ")}}function ds(n,t){if(n&1&&(r(0,"div",63),ee(1,ps,6,7,"div",62,pe),l()),n&2){let e=c(2);s(),te(e.paymentSummary)}}function ms(n,t){if(n&1&&(r(0,"div",14),ee(1,cs,6,8,"div",62,pe),g(3,ds,3,0,"div",63),l()),n&2){let e=c();s(),te(e.amountSummary),s(2),C((e.paymentSummary==null?null:e.paymentSummary.length)>0?3:-1)}}function us(n,t){if(n&1&&(r(0,"div",15)(1,"div",67)(2,"p",68),p(3,"INVALID AMOUNT CHARGE, CORRECT AMOUNT"),l(),r(4,"P",69),p(5),S(6,"number"),l()()()),n&2){let e=c();s(5),x("",I(6,1,e.completeData==null?null:e.completeData.Final)," ")}}function fs(n,t){if(n&1){let e=y();r(0,"a",70),_("click",function(o){u(e);let a=c();return f(a.isGlobalPrintEnabled()?null:o.preventDefault())}),v(1,"i",71),l()}if(n&2){let e=c();m("href",e.getInvoicePrintURL(!1),nt)("matTooltip",e.isGlobalPrintEnabled()?"Print in New Tab":"Required Global Print Role")("ngStyle",_e(3,Ul,e.isGlobalPrintEnabled()?"pointer":"default",e.isGlobalPrintEnabled()?"1":"0.5"))}}function gs(n,t){if(n&1&&(r(0,"div",7)(1,"div",9)(2,"h3",10),p(3,"Point Balance"),l()(),v(4,"div",72),l()),n&2){let e=c();s(4),m("innerHtml",e.completeData.LoyaltyPoint,Ut)}}function Cs(n,t){if(n&1&&v(0,"pos-receipt",73),n&2){let e=c(2);m("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 _s(n,t){if(n&1&&v(0,"pos-receipt-a4",74),n&2){let e=c(3);m("data",t)("printTemplate",e.outletRegister.PrintTemplate)("config",e.posStorage.AppConfigJSON)("workOrderMode",!1)("stylesheet",e.posStorage.StylesSheet)}}function hs(n,t){if(n&1&&(g(0,_s,1,5,"pos-receipt-a4",74),S(1,"async")),n&2){let e,i=c(2);C((e=I(1,1,i.receiptTemplateA4$))?0:-1,e)}}function vs(n,t){if(n&1&&(g(0,Cs,1,8,"pos-receipt",73),g(1,hs,2,3)),n&2){let e=c();C(e.receiptTemplate&&e.printMode==2?0:-1),s(),C(e.printMode==1?1:-1)}}function bs(n,t){n&1&&(r(0,"div",23)(1,"h1"),p(2," Cannot generate print preview because of client-server amount Mismatch "),l()())}var Pn=class n{constructor(t,e,i,o,a,h,E,F,Ce,Te,Be,gi,Ci,Nt,to,_i,yo,io,xo,Wa,Qa){this._posDataService=t;this._posService=e;this._orderProcessorService=i;this._OrderHttpService=o;this._PaymentHttpService=a;this._receiptService=h;this._outletService=E;this._toastr=F;this._onlineStatusService=Ce;this._matDialog=Te;this._signalBroadCast=Be;this._calculatorService=gi;this._userRoleService=Ci;this._router=Nt;this._receiptCalculatorService=to;this.datePipe=_i;this.decimalPipe=yo;this.paymentGatewayService=io;this.paymentHttpService=xo;this.shoppingCartService=Wa;this.roleService=Qa;this.isGlobalPrintEnabled.set(this.roleService.global.Print)}whatsappSendReceiptService=$(mo);handleF8(){this.newSale()}salesOrder=new qe;receiptTemplate=null;receiptTemplateA4$;completeData=new Rr;printMode=2;outletRegister=new Wi;role;finalAmountDifferent=!1;amountSummary=[];itemSummary=[];paymentSummary=[];isOnline=!1;destroy$=new Q;get posStorage(){return this._posService.Data}currentSellState;isOrderDateNow;sellState=Pe;receiptIcon="fa-brands fa-whatsapp";customerContact=new bt;printOnPayment=R(!0);isSuccessRetrySubmit=R(!1);isGlobalPrintEnabled=R(!0);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(ie(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&&b.IsNotEmpty(e)&&this.sendEmail()}resetUrlAfterRedirect(){this._router.events.pipe(k(this.destroy$)).subscribe(t=>{t instanceof zo&&(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=b.emailRegex,i=b.phoneNumberRegex,o=e,a=i,h=o.test(t),E=a.test(t);if(h)return this.receiptIcon="fa-solid fa-envelope","Email";if(E)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.forceToMax4DigitAfterDecimal(this._calculatorService.Data),o=t.ModuleSell.ToleranceAmount,a=e-i;if(a!=o&&a!=0){this.finalAmountDifferent=!0;let h=this.decimalPipe.transform(e);setTimeout(()=>{this._toastr.warning(`Final Amount should be ${h}! Use Print Receipt to print the correct Receipt!`,"Invalid Amount charged",{timeOut:1e4})},500)}else this.finalAmountDifferent=!1}}forceToMax4DigitAfterDecimal(t){let e=t;return this.isDecimalMoreThan4Digits(t)&&(e=parseFloat(t.toFixed(4))),e}isDecimalMoreThan4Digits(t){let e=t.toString(),i=e.indexOf(".");return i!==-1?e.substring(i+1).length>4:!1}checkOrderNumber(){let t=this.completeData.InvoiceNumberResult,e=b.IsNotEmpty(t)&&b.IsNotEmpty(t?.ProposedInvoiceNumber)&&t.ActualInvoiceNumber!=t.ProposedInvoiceNumber;this.completeData.InvoiceNumber!=this.salesOrder.Order.Number&&(this._toastr.warning(`Your ${e?"Order":"Transaction"} number is changed to ${this.completeData.InvoiceNumber}`,"Transaction Number Changed!"),this.salesOrder.Order.Number=this.completeData.InvoiceNumber),e&&this._toastr.warning("Your invoice number is changed to "+t.ActualInvoiceNumber,"Transaction Number Changed!")}generateLink(){this.posStorage.AppConfigJSON.PaymentConfigLink==!0&&this._matDialog.open(Mi);let t={InvoiceID:this.completeData.ObjectID};this._PaymentHttpService.generateLink(t).subscribe({next:e=>{this._matDialog.open(Mi,{data:{link:e.token.redirect_url}})},error:e=>{this._toastr.error(e.Message,"Couldn't generate link!")}})}newSale(){try{this._orderProcessorService.createNewTransactionInSameOutletRegister(!0),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"),b.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",Fe.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$),it(t=>(t.Data.AfterSell=!0,t.Data)),vi(t=>{throw this._toastr.error(`Could not print in A4 format!
|
|
5
|
-
Printing in 8mm format instead!`,"Error!"),this.printReceiptMini(),t}),ve(()=>{this.printOnPayment()&&this.printWindow()}),jt(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 b.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=b.emailRegex,e=b.phoneNumberRegex,i=this.customerContact.value,o=t.test(i),a=e.test(i);o?this.sendEmail():a&&this.sendReceiptByWhatsaap()}static \u0275fac=function(e){return new(e||n)(d(V),d(A),d(U),d(Me),d(po),d(Et),d(G),d(J),d(pt),d(re),d(Ji),d(ge),d(ce),d(vt),d(zi),d(We),d(K),d(Ki),d(po),d(de),d(yt))};static \u0275cmp=M({type:n,selectors:[["sell-complete"]],hostBindings:function(e,i){e&1&&_("keydown.F8",function(){return i.handleF8()},ut)},features:[lt([mo])],decls:30,vars:13,consts:[[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"],["target","_blank","routerLink","/menu/Orders/Orders/Customer_Invoice/Info",1,"text-dark","fst-italic",3,"queryParams"],[1,"text-dark","fst-italic"],[1,"card-body"],[1,"card-footer","bg-white"],[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",1,"btn","btn-outline-secondary","d-flex","align-items-center","justify-content-center","fs-5","border-start-0",2,"width","3rem",3,"href","matTooltip","ngStyle"],[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"],["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"],[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"],[1,"row","my-1"],[1,"col-8"],[1,"col-4","text-end"],[1,"d-flex","justify-content-end",2,"line-height","30px"],[1,"border-top"],[1,"text-end",3,"hidden"],[1,"text-end","w-50",3,"hidden","ngClass"],[1,"text-end","w-50",3,"hidden"],[1,"text-end"],[1,"fw-bold"],[1,"text-danger",2,"font-size","38px"],["target","_blank","matTooltipPosition","above",1,"btn","btn-outline-secondary","d-flex","align-items-center","justify-content-center","fs-5","border-start-0",2,"width","3rem",3,"click","href","matTooltip","ngStyle"],[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){e&1&&(r(0,"section",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"h1",4),p(5,"Order Complete"),l()()(),r(6,"div",5)(7,"div",6),g(8,ts,22,16,"div",7)(9,is,1,0,"app-retry"),l(),r(10,"div",8)(11,"div",7)(12,"div",9)(13,"h3",10),g(14,ns,2,4,"a",11)(15,os,2,1,"span",12),l()(),g(16,ss,3,0,"div",13),g(17,ms,4,1,"div",14),g(18,us,7,3,"div",15),r(19,"div",16)(20,"div",17)(21,"div",18)(22,"button",19),_("click",function(){return i.print()}),v(23,"i",20),p(24,"Print Receipt "),l()(),g(25,fs,2,6,"a",21),l()()(),g(26,gs,5,1,"div",7),l()()()(),r(27,"div",22),g(28,vs,2,2)(29,bs,3,0,"div",23),l()),e&2&&(s(8),C(i.currentSellState==i.sellState.IsComplete?8:9),s(6),C(i.isOnline&&i.completeData.ObjectID?14:15),s(2),C(i.itemSummary?16:-1),s(),C(!i.finalAmountDifferent&&i.role.PriceVisible?17:-1),s(),C(i.finalAmountDifferent?18:-1),s(3),m("matTooltip",i.isGlobalPrintEnabled()?i.printOnPayment()?"Print in Current Window":"You must enable print on payment config to use this button":"Required Global Print Role"),s(),m("ngClass",T(11,Nl,i.completeData.PaymentStateLabel!="Offline"))("disabled",i.printOnPayment()==!1||!i.isGlobalPrintEnabled()),s(3),C(i.completeData.PaymentStateLabel!="Offline"?25:-1),s(),C(i.completeData!=null&&i.completeData.LoyaltyPoint?26:-1),s(2),C(i.finalAmountDifferent==!1?28:29))},dependencies:[X,z,Li,be,Y,q,Jt,Pt,sn,_a,en,Xi,qt,$t,In,Je,St,Ke,se,Pa,ze,K],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.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 Dn=class n{constructor(t,e){this._dialogRef=t;this._orderProcessorService=e;this.modalConfig.title="Clear Order?",this.modalConfig.headerType=Fe.Success}modalConfig=new H;ngOnInit(){}onOk(){this._orderProcessorService.createNewTransactionInSameOutletRegister(!1),this._orderProcessorService.emitClearOrder(),this.close()}close(){this._dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(B),d(U))};static \u0275cmp=M({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),p(3),l()()()),e&2&&(m("config",i.modalConfig),s(3),w("This will replace current order's item(s) with blank order."))},dependencies:[j],encapsulation:2})};var vo=(i=>(i[i.INTERNAL=1]="INTERNAL",i[i.EKSTERNAL=2]="EKSTERNAL",i[i.EKSTERNALINTERNAL=3]="EKSTERNALINTERNAL",i))(vo||{});function Ss(n,t){if(n&1){let e=y();r(0,"div",1)(1,"radio-options",12),O("modelChange",function(o){u(e);let a=c();return D(a.selectedProvider,o)||(a.selectedProvider=o),f(o)}),l(),r(2,"label",13),p(3,"Choose Provider"),l()()}if(n&2){let e=c();s(),m("options",e.couponProviders()),P("model",e.selectedProvider),m("disabled",e.hasSelectedCoupon)}}function ys(n,t){if(n&1){let e=y();r(0,"button",14),_("click",function(){u(e);let o=c();return f(o.onRemoveCoupon())}),p(1," Remove "),l()}}function xs(n,t){if(n&1){let e=y();r(0,"button",15),_("click",function(o){u(e);let a=c();return f(a.onOk(o))})("keyup.F2",function(o){u(e);let a=c();return f(a.onOk(o))}),p(1," Ok (F2) "),l()}}var On=class n{constructor(t,e,i,o,a,h,E,F){this.promotionService=t;this._orderDataService=e;this._posService=i;this.dialogRef=o;this.roleService=a;this.toastr=h;this.promotionCouponProvider=E;this.promotionCouponV2Service=F;this.destroy$=new Q,this.modeType=!1,this.typeText="password",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye-slash",this.couponInputLock=a.Data.CouponInputLock,this.initProviders(),this.subscribeToObservable(),this.initModalConfig(),this.initSelectedProvider()}modalConfig=new H;modeType;typeText;typeIcon;PromotionCoupon;PromotionNote;couponType;destroy$;onInputCouponCode=!1;selectedProvider="Internal";couponInputLock=!1;startInput;couponredemptionType=vo;couponProviders=R([]);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;b.IsNotEmpty(t)?this.selectedProvider=e:this.selectedProvider="Internal"}get hasSelectedCoupon(){let t=this._orderDataService.Data.Order;return b.IsNotEmpty(t.PromotionCoupon)}onOk(t){(t!="Enter"||t=="Enter"&&this.onInputCouponCode)&&this.onSubmitCoupon()}onSubmitCoupon(){b.IsNotEmpty(this.PromotionCoupon)?(this.applyCouponCode(),this.dialogRef.close()):this.toastr.warning("Coupon can't be empty","Warning")}onRemoveCoupon(){let t=this.promotionCouponProvider.coupon;b.IsNotEmpty(t)?this.promotionCouponProvider.removeCoupon():this.promotionService.removeAppliedCoupon(),this.dialogRef.close()}applyCouponCode(){if(this.selectedProvider==="Internal")this.promotionCouponV2Service.redeemCoupon(this.PromotionCoupon).subscribe();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(mt),d(V),d(A),d(B),d(ce),d(J),d(wt),d(Mt))};static \u0275cmp=M({type:n,selectors:[["pos-modal-coupon-code"]],standalone:!1,decls:17,vars:10,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,Ss,4,3,"div",1),r(3,"div",2)(4,"input",3),O("ngModelChange",function(a){return D(i.PromotionCoupon,a)||(i.PromotionCoupon=a),a}),_("paste",function(a){return i.couponInputLock?a.preventDefault():""})("keydown",function(a){return i.onKeyDown(a)})("focus",function(){return i.onInputCouponCode=!0})("blur",function(){return i.onInputCouponCode=!1}),l(),r(5,"i",4),_("click",function(){return i.modeType=!i.modeType,i.showPassword()}),l(),r(6,"label",5),p(7,"Coupon"),l()(),r(8,"div",6)(9,"textarea",7),O("ngModelChange",function(a){return D(i.PromotionNote,a)||(i.PromotionNote=a),a}),l(),r(10,"label",8),p(11,"Note"),l()()(),r(12,"footer")(13,"button",9),_("click",function(){return i.onClose()}),p(14," Cancel "),l(),g(15,ys,2,0,"button",10)(16,xs,2,0,"button",11),l()()),e&2&&(m("config",i.modalConfig),s(2),C(i.couponProviders().length>0?2:-1),s(2),m("type",i.typeText),P("ngModel",i.PromotionCoupon),m("disabled",i.hasSelectedCoupon),s(),le(i.typeIcon),s(4),P("ngModel",i.PromotionNote),m("disabled",i.hasSelectedCoupon),s(6),C(i.hasSelectedCoupon?15:16))},dependencies:[Y,q,oe,j,ei],styles:[".passwordIcon[_ngcontent-%COMP%]{position:relative;margin:0 auto!important;cursor:pointer;left:20.5rem;top:-2.3rem;z-index:999}"]})};var Mn=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 Q}modalConfig=new H;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(B),d(V),d(U),d(Me))};static \u0275cmp=M({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),O("ngModelChange",function(a){return D(i.ReturNumber,a)||(i.ReturNumber=a),a}),l(),r(4,"label",3),p(5,"Number Invoice"),l()()()()),e&2&&(m("config",i.modalConfig),s(3),P("ngModel",i.ReturNumber))},dependencies:[Y,q,oe,j],encapsulation:2})};var Is=["serialInput"],wn=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 H;serial;onKeyDown(t){t.key=="Enter"&&(b.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(B),d(de),d(J))};static \u0275cmp=M({type:n,selectors:[["POS-modal-serial"]],viewQuery:function(e,i){if(e&1&&Se(Is,5),e&2){let o;ye(o=xe())&&(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=y();r(0,"modal-material",1),_("onClose",function(){return u(o),f(i.dialogRef.close())}),r(1,"content")(2,"div",2)(3,"input",3,0),O("ngModelChange",function(h){return u(o),D(i.serial,h)||(i.serial=h),f(h)}),_("keydown",function(h){return u(o),f(i.onKeyDown(h))}),l(),r(5,"span",4),v(6,"i",5),l()()()()}e&2&&(m("config",i.modalConfig),s(3),P("ngModel",i.serial))},dependencies:[Y,q,oe,j],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"),p(2),l(),r(3,"td"),p(4),S(5,"date"),l(),r(6,"td"),p(7),S(8,"date"),l(),r(9,"td",4),p(10),l(),r(11,"td",4),p(12),S(13,"number"),l()()),n&2){let e=t.$implicit;s(2),w(e.Order.Number),s(2),w(ne(5,5,e.Order.ClientTimestamp,"dd MMM yyyy")),s(3),w(ne(8,8,e.Order.ClientTimestamp,"HH:mm")),s(3),w(e.Items.length),s(2),w(I(13,11,e.TotalPaidAmount))}}function Ds(n,t){if(n&1&&(r(0,"div",0)(1,"table",2)(2,"thead",3)(3,"tr")(4,"th"),p(5,"Number"),l(),r(6,"th"),p(7,"Date"),l(),r(8,"th"),p(9,"Time"),l(),r(10,"th",4),p(11,"Qty"),l(),r(12,"th",4),p(13,"Total"),l()()(),r(14,"tbody"),ee(15,Ps,14,13,"tr",null,pe),l()()()),n&2){let e=c();s(15),te(e.offlineOrders)}}function Os(n,t){n&1&&(r(0,"h1",1),p(1,"There is no offline orders!"),l())}var kn=class n{constructor(t){this._localDataService=t;this.destroy$=new Q}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=>Ie(qe,e))})}static \u0275fac=function(e){return new(e||n)(d(Ye))};static \u0275cmp=M({type:n,selectors:[["sync-orders"]],standalone:!1,decls:2,vars:1,consts:[[1,"table-responsive","p-8"],[1,"text-center","p-8"],[1,"table"],[1,"thead-light"],[1,"text-end"]],template:function(e,i){e&1&&g(0,Ds,17,0,"div",0)(1,Os,2,0,"h1",1),e&2&&C(i.offlineOrders!=null&&i.offlineOrders.length>0?0:1)},dependencies:[K,We],encapsulation:2})};var ws=n=>({"bg-gradient-danger":n});function ks(n,t){if(n&1&&(p(0),S(1,"number")),n&2){let e=c();x(" ",I(1,1,e.onlineProducts)," ")}}function Ts(n,t){n&1&&(r(0,"small",4),p(1," Failed to get Online Products "),l())}function Es(n,t){if(n&1&&(p(0),S(1,"date")),n&2){let e=c();x(" ",ne(1,1,e.syncDate,"dd MMM yyyy HH:mm")," ")}}function Rs(n,t){n&1&&p(0," Never been synced ")}function Ns(n,t){if(n&1&&(r(0,"p"),p(1),l()),n&2){let e=c();s(),x("You last synced ",e.dayDiff," days ago!")}}var Tn=class n{constructor(t,e,i,o){this.indexDbService=t;this.toastr=e;this.httpService=i;this.dialogRef=o;this.destroy$=new Q}dayDiff;syncDate;offlineProduct=0;onlineProducts=0;destroy$;ngOnInit(){this.initOfflineProducts()}initOfflineProducts(){this.indexDbService.findAllVariant().pipe(ie(t=>t.length>0),Ve(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"}')}),it(t=>JSON.parse(t))).subscribe({next:t=>{this.onlineProducts=t.Count,this.getSyncTime()},error:t=>{console.error(t)}})}syncToLocalDatabase(){Ti([this.syncOutlets(),this.syncProducts(),this.syncOutletPrices()]).pipe(k(this.destroy$),Ve(()=>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$),ie(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$),Ve(t=>this.indexDbService.syncRegisters(t)))}syncProducts(){return this.httpService.get(fe.SyncProducts).pipe(k(this.destroy$),Ve(t=>this.indexDbService.syncVariants(t)))}syncOutletPrices(){return this.httpService.get(fe.SynOutletPrice).pipe(k(this.destroy$),Ve(t=>this.indexDbService.syncOutletPrice(t)))}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(Ye),d(J),d(Le),d(B))};static \u0275cmp=M({type:n,selectors:[["sync-products"]],standalone:!1,decls:28,vars:9,consts:[[1,"table-responsive","p-8"],[1,"table","table-bordered","table-sm","fs-5"],[1,"fw-bold",2,"width","125px"],[2,"width","175px",3,"ngClass"],[1,"fst-italic"],["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"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"table",1)(2,"tbody")(3,"tr")(4,"td",2),p(5,"Online Products"),l(),r(6,"td",3),g(7,ks,2,3)(8,Ts,2,0,"small",4),l(),r(9,"td",5)(10,"div",6)(11,"button",7),_("click",function(){return i.syncToLocalDatabase()}),v(12,"i",8),r(13,"span"),p(14,"Sync"),l()()()()(),r(15,"tr")(16,"td",9),p(17,"Offline Products"),l(),r(18,"td"),p(19),S(20,"number"),l()(),r(21,"tr")(22,"td",9),p(23,"Last Sync"),l(),r(24,"td"),g(25,Es,2,4)(26,Rs,1,0),g(27,Ns,2,1,"p"),l()()()()()),e&2&&(s(6),m("ngClass",T(7,ws,!i.onlineProducts)),s(),C(i.onlineProducts?7:8),s(12),x(" ",I(20,5,i.offlineProduct)," "),s(6),C(i.syncDate?25:26),s(2),C(i.dayDiff>14?27:-1))},dependencies:[z,K,We],encapsulation:2})};var As=["navTabs"],En=class n{constructor(t,e){this._router=t;this.dialogRef=e}tabs;modalConfig=new H;ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig.headerType=Fe.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(vt),d(B))};static \u0275cmp=M({type:n,selectors:[["pos-modal-sync"]],viewQuery:function(e,i){if(e&1&&Se(As,5),e&2){let o;ye(o=xe())&&(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=y();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(h){return u(o),f(i.onChangeTab(h))}),r(4,"mat-tab",3),v(5,"sync-products"),l(),r(6,"mat-tab",4),v(7,"sync-orders"),l()(),r(8,"div",5)(9,"button",6),_("click",function(){return u(o),f(i.goToOfflinePage())}),v(10,"i",7),p(11," Go to Details "),l()()()()}e&2&&(m("config",i.modalConfig),s(2),m("dynamicHeight",!1))},dependencies:[j,xt,It,kn,Tn],styles:[".mat-ink-bar{background-color:#93bd45!important} .sync mat-mdc-tab-body{height:200px} .mat-mdc-tab-body-content{overflow-x:hidden!important}"]})};var Fs=(n,t)=>({"btn-secondary":n,"btn-outline-secondary":t}),Bs=(n,t)=>({"btn-outline-secondary":n,"btn-secondary":t});function js(n,t){if(n&1){let e=y();r(0,"div")(1,"label",12),v(2,"i",13),r(3,"span"),p(4,"Deduct Inventory from Outlet :"),l()(),r(5,"p-select",14),O("ngModelChange",function(o){u(e);let a=c();return D(a.deliveryEntityID,o)||(a.deliveryEntityID=o),f(o)}),l()()}if(n&2){let e=c();s(5),m("options",e.entities),P("ngModel",e.deliveryEntityID),m("filter",!0)("showClear",!0)("showClear",!1)("disabled",e.isDisabledNgSelectOutlet)}}function Hs(n,t){if(n&1){let e=y();r(0,"div",10)(1,"div",29)(2,"label",30),v(3,"i",31),r(4,"span"),p(5,"Recipient"),l()(),r(6,"input",32),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.shipping.Name,o)||(a.shipping.Name=o),f(o)}),l()(),r(7,"div",29)(8,"label",33),v(9,"i",34),r(10,"span"),p(11,"Phone"),l()(),r(12,"input",35),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.shipping.Phone,o)||(a.shipping.Phone=o),f(o)}),l()(),r(13,"div",36)(14,"label",37),v(15,"i",38),r(16,"span"),p(17,"City"),l()(),r(18,"input",39),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.shipping.City,o)||(a.shipping.City=o),f(o)}),l()(),r(19,"div",40)(20,"label",41),v(21,"i",42),r(22,"span"),p(23,"Delivery Address"),l()(),r(24,"POS-tinymce-editor",43),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.shipping.Address,o)||(a.shipping.Address=o),f(o)}),l()()()}if(n&2){let e=c(2);s(6),P("ngModel",e.shipping.Name),s(6),P("ngModel",e.shipping.Phone),s(6),P("ngModel",e.shipping.City),s(6),P("ngModel",e.shipping.Address)}}function Us(n,t){if(n&1){let e=y();r(0,"div",15)(1,"div",16)(2,"label",12),v(3,"i",17),r(4,"span"),p(5),l()(),r(6,"div",16)(7,"p-datepicker",18),O("ngModelChange",function(o){u(e);let a=c();return D(a.posData.Invoice.DateCustom,o)||(a.posData.Invoice.DateCustom=o),f(o)}),l()()(),r(8,"div",16)(9,"label",19),v(10,"i",20),r(11,"span"),p(12,"Time"),l()(),r(13,"div",16)(14,"app-timepicker",21),O("timeChange",function(o){u(e);let a=c();return D(a.posData.Invoice.TimeCustom,o)||(a.posData.Invoice.TimeCustom=o),f(o)}),l()()()(),r(15,"div",22)(16,"div",23)(17,"div")(18,"p-checkbox",24),O("ngModelChange",function(o){u(e);let a=c();return D(a.recipientNotBuyer,o)||(a.recipientNotBuyer=o),f(o)}),l()(),r(19,"div",25)(20,"span"),v(21,"i",26),l(),r(22,"h6",23)(23,"span"),p(24,"Recipient \u2260 Buyer"),l(),r(25,"span",27),v(26,"i",28),l()()()()(),g(27,Hs,25,4,"div",10)}if(n&2){let e=c();s(5),x(" ",e.dateLabel," "),s(2),P("ngModel",e.posData.Invoice.DateCustom),m("baseZIndex",1e4)("showClear",!0),s(7),P("time",e.posData.Invoice.TimeCustom),m("showIcon",!0)("showCloseBtn",!1)("fullWidth",!0)("showClear",!0),s(4),P("ngModel",e.recipientNotBuyer),m("binary",!0),s(9),C(e.recipientNotBuyer?27:-1)}}var fi=class n{constructor(t,e,i,o,a,h,E){this._dialogRef=t;this._orderDataService=e;this._posService=i;this._orderProcessorService=o;this._productHttpService=a;this._outletService=h;this.datePipe=E;this.destroy$=new Q,this.initStartTime(),this.subscribePosData(),this.initModal()}modalConfig=new H;isDisabledNgSelectOutlet=!1;isDelivery=R(!1);customDate=null;shipping=new xi;deliveryEntityID="";posData=new qe;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(){b.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 xi})}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==b.GuidEmpty?this.isDelivery.set(!0):this.isDelivery.set(!1);let t=this.entities.find(e=>e.ID==this._outletService?.getOutletRegister()?.EntityID);if(b.IsNotEmpty(t.ID)){let e=t.FulfillmentOption;e==1?(this.isDelivery.set(!1),this.disableShippingLater=!0):e==2&&(this.isDelivery.set(!0),this.disableShippingNow=!0),this.changeDelivery()}}changeDelivery(){if(this.isDelivery())this.deliveryEntityID=b.GuidEmpty;else{let t=this._outletService.Data,e=this.posData.Action.DeliveryEntityID;b.IsNotEmpty(e)?this.deliveryEntityID=e:b.IsNotEmpty(t.DefaultWarehouse)?this.deliveryEntityID=t.DefaultWarehouse:this.deliveryEntityID=t.EntityID}}onOk(){this.getSerialByVariantIds(),this.setCustomDateField(),this.clearShippingData(),b.IsEmpty(this.deliveryEntityID)?this.posData.Order.DeliveryStateID=0:this.posData.Order.DeliveryStateID=3,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(b.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=Ie(Re,this.posData.CartItems),i;this.posData.CartItems=e.map(o=>(o.isSerialType()&&(i=t.findIndex(a=>a.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(a=>(i=t.findIndex(h=>h.Number==a.Number),i!==-1))}close(){this._dialogRef.close()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(B),d(V),d(A),d(U),d($i),d(G),d(We))};static \u0275cmp=M({type:n,selectors:[["POS-modal-shipping"]],decls:23,vars:14,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container"],[1,"row"],[1,"btn-group","col-12"],["type","button",1,"btn","btn-secondary","position-relative","btn-custom-size","col-5",3,"click","disabled"],[1,"fa-solid","fa-bolt"],[1,"ms-2"],[1,"ms-1"],["type","button",1,"btn","position-relative","btn-custom-size","col-7",3,"click","disabled"],[1,"fa-solid","fa-clock"],[1,"row","mt-12"],[1,"col-12"],["for","shippingDate",1,"mb-2"],[1,"fa","fa-store","me-1"],["optionLabel","Name","optionValue","ID","filterBy","Name","placeholder","Select a Outlet","appendTo","body",1,"w-100",2,"--p-select-padding-y","0.8rem",3,"ngModelChange","options","ngModel","filter","showClear","disabled"],[1,"d-flex","align-items-center","gap-3"],[1,"w-100"],[1,"fa-solid","fa-calendar","me-1"],["placeholder","Select Date","showIcon","","iconDisplay","input","appendTo","body","dateFormat","dd M yy",1,"w-100","date-custom",3,"ngModelChange","ngModel","baseZIndex","showClear"],["for","shippingTime",1,"mb-2"],[1,"fa","fa-clock","me-1"],["placeholder","Select Time",1,"date-custom",3,"timeChange","time","showIcon","showCloseBtn","fullWidth","showClear"],[1,"mt-12"],[1,"d-flex","align-items-center","gap-2"],[1,"custom-checkbox-style",3,"ngModelChange","ngModel","binary"],[1,"d-flex","align-items-center","gap-1"],[1,"fa-solid","fa-user","fs-5"],["pTooltip",`Enable this option when the person receiving the order is different from customer who made the purchase.
|
|
6
|
-
This is commonly used for gift deliveries, corporate orders, or when someone is buying on behalf of another person. When enabled, you'll need to provide the recipient's contact details and delivery address.`,"tooltipPosition","top","tooltipZIndex","10000"],[1,"fa","fa-info-circle"],[1,"col-4","pe-0"],["for","recipient"],[1,"fa-solid","fa-user","me-1","mb-2"],["id","recipient","placeholder","Enter recipient name","type","text",1,"w-100","form-control","rounded-1","custom-input-size",3,"ngModelChange","ngModel"],["for","phone"],[1,"fa-solid","fa-phone","me-1","mb-2"],["id","phone","placeholder","Enter recipent phone number","type","text",1,"w-100","form-control","rounded-1","custom-input-size",3,"ngModelChange","ngModel"],[1,"col-4"],["for","city"],[1,"fa-solid","fa-location-dot","me-1","mb-2"],["id","city","placeholder","Enter the recipient city","type","text",1,"w-100","form-control","rounded-1","custom-input-size",3,"ngModelChange","ngModel"],[1,"col-12","mt-8"],["for","address",1,"mb-3"],[1,"fa-solid","fa-address-book","me-1"],["id","address","placeholder","Enter the recipient address here ...",3,"ngModelChange","ngModel"]],template:function(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,"button",4),_("click",function(){return i.isDelivery.set(!1),i.changeDelivery()}),v(6,"i",5),r(7,"span",6),p(8," Now "),r(9,"small",7)(10,"em"),p(11,"(in store purchase)"),l()()()(),r(12,"button",8),_("click",function(){return i.isDelivery.set(!0),i.changeDelivery()}),v(13,"i",9),r(14,"span",6),p(15," Later "),r(16,"small",7)(17,"em"),p(18,"(shipped to customer address)"),l()()()()()(),r(19,"div",10)(20,"div",11),g(21,js,6,6,"div")(22,Us,28,12),l()()()()()),e&2&&(m("config",i.modalConfig),s(5),le(_e(8,Fs,!i.isDelivery(),i.isDelivery())),m("disabled",i.disableShippingNow),s(7),le(_e(11,Bs,!i.isDelivery(),i.isDelivery())),m("disabled",i.disableShippingLater),s(9),C(i.isDelivery()?22:21))},dependencies:[X,j,Or,Dr,be,Y,q,oe,kr,wr,Hi,xr,yr,Ze,Pr,Ir],styles:[".container[_ngcontent-%COMP%]{min-height:185px} p-datepicker.date-custom>span>input{padding-top:10px;padding-bottom:10px} app-timepicker.date-custom p-datepicker>span>input{padding-top:10px;padding-bottom:10px}.btn-custom-size[_ngcontent-%COMP%]{--bs-btn-padding-y: 1rem;--bs-btn-padding-x: 1rem;--bs-btn-font-size: 3.5rem;font-family:Roboto Slab,serif}.btn-custom-size[_ngcontent-%COMP%]:hover{background-color:var(--bs-light)!important;border-color:var(--bs-light)!important;color:#000!important}.custom-checkbox-style[_ngcontent-%COMP%]{--p-checkbox-checked-background: #89b03e;--p-checkbox-hover-border-color: #89b03e;--p-checkbox-checked-border-color: #89b03e;--p-checkbox-checked-hover-border-color: #89b03e;--p-checkbox-hover-border-color-background: #7c9b44;--p-checkbox-checked-hover-background: #89b03e}.custom-input-size[_ngcontent-%COMP%]{height:2.625rem;padding:.75rem!important;color:#343434;font-size:.75rem;border-radius:.25rem!important}"]})};var Rn=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)(N(Le))};static \u0275prov=Ge({token:n,factory:n.\u0275fac,providedIn:"root"})};var Qs=(n,t)=>({"d-flex align-items-center justify-content-center":n,"custom-container-height":t}),Oa=()=>["ParkLabel","Number"],Ma=n=>({"no-hover":n}),wa=n=>({"bg-danger":n}),ka=n=>({"text-white":n}),Ta=(n,t,e)=>({"duration-green":n,"duration-yellow":t,"duration-red":e});function $s(n,t){if(n&1&&(r(0,"span",12),p(1),l()),n&2){let e=t.$implicit,i=t.$index;m("hidden",i==0),s(),x(" ",e.ParkLabel??e.Number," ")}}function qs(n,t){if(n&1&&(r(0,"div",7),ee(1,$s,2,2,"span",12,pe),r(3,"span",13),p(4,"will be merged to"),l(),r(5,"span",14),p(6),l()()),n&2){let e=c(2);s(),te(e.listMerge),s(5),x(" ",e.listMerge[0].ParkLabel??e.listMerge[0].Number," ")}}function Gs(n,t){if(n&1){let e=y();r(0,"div",2),g(1,qs,7,1,"div",7),r(2,"div",8)(3,"span",9),v(4,"i",10),l(),r(5,"input",11),O("ngModelChange",function(o){u(e);let a=c();return D(a.filter,o)||(a.filter=o),f(o)}),l()()()}if(n&2){let e=c();s(),C(e.listMerge.length>1?1:-1),s(4),P("ngModel",e.filter)}}function zs(n,t){if(n&1&&v(0,"i"),n&2){let e=c(2).$implicit;le(e.Icon)}}function Js(n,t){if(n&1&&(r(0,"h5",22),g(1,zs,1,2,"i",23),r(2,"span"),p(3),S(4,"limitTo"),l()()),n&2){let e=c().$implicit,i=c(4);s(),C(e.Icon?1:-1),s(2),x(" ",i.parkedOrders.length<5?e.Name:ne(4,2,e.Name,5)," ")}}function Ks(n,t){if(n&1&&(r(0,"div",36),v(1,"i",42),r(2,"span",35),p(3),S(4,"slice"),l()()),n&2){let e=c().$implicit;s(2),m("matTooltip",e.CustomerDisplay),s(),x(" ",e.CustomerDisplay.length>20?Ae(4,2,e.CustomerDisplay,0,20)+"...":e.CustomerDisplay," ")}}function Ys(n,t){if(n&1&&(r(0,"div",38),p(1),l()),n&2){let e=c().$implicit;s(),x(" ",e.alias," ")}}function Zs(n,t){if(n&1){let e=y();r(0,"div",24)(1,"div",25)(2,"div",26),_("click",function(o){let a=u(e).$implicit;return c(6).onOrderClicked(a),f(o.preventDefault())}),r(3,"h5",27)(4,"div",28),p(5),l(),r(6,"span",29),_("click",function(o){let a=u(e).$implicit;return c(6).remove(a),f(o.stopPropagation())}),v(7,"i",30),l()(),r(8,"div",31)(9,"div",32)(10,"div",33),v(11,"i",34),r(12,"span",35),p(13),S(14,"slice"),l()(),r(15,"div",36),v(16,"i",37),p(17),S(18,"date"),l(),g(19,Ks,5,6,"div",36),g(20,Ys,2,1,"div",38),l(),r(21,"div",39)(22,"div",40),p(23),l(),r(24,"input",41),O("ngModelChange",function(o){let a=u(e).$implicit;return D(a.selected,o)||(a.selected=o),f(o)}),_("change",function(){let o=u(e).$implicit,a=c(6);return f(a.chooseMerge(o))})("click",function(o){return u(e),f(o.stopPropagation())}),l()()()()()()}if(n&2){let e=t.$implicit,i=c(6),o=(i.parkLabel()==e.ParkLabel||i.parkLabel()==e.Alias)&&i.isRetrieve();s(),m("ngClass",T(22,Ma,o))("matTooltip",o?"You\u2019re currently retrieving this order and cannot retrieve it again!":""),s(2),m("ngClass",T(24,wa,o)),s(),m("ngClass",T(26,ka,o)),s(),x(" ",i.replaceAlias&&e.Alias?e.Alias:e.ParkLabel," "),s(),m("hidden",(i.parkLabel()==e.ParkLabel||i.parkLabel()==e.Alias)&&i.isRetrieve()||i.AuthorizeParkOrderDeletion),s(6),m("matTooltip",e.Number),s(),x(" ",e.Number.length>15?Ae(14,15,e.Number,0,15)+"...":e.Number," "),s(4),x(" ",ne(18,19,e.Created,"dd-MMM HH:mm")," "),s(2),C(e.CustomerDisplay?19:-1),s(),C(i.replaceAlias?-1:20),s(2),m("ngClass",Si(28,Ta,e.Duration<=60,e.Duration>60&&e.Duration<=120,e.Duration>120)),s(),x(" ",e.Duration," minutes ago "),s(),m("hidden",i.parkLabel()&&i.isRetrieve()||!i.parkEnableMerge),P("ngModel",e.selected)}}function Xs(n,t){if(n&1&&(r(0,"div",20),ee(1,Zs,25,32,"div",24,pe),S(3,"FilterByArray"),l()),n&2){let e=c().$implicit,i=c(4);s(),te(Ae(3,0,e.List,st(4,Oa),i.filter))}}function ec(n,t){n&1&&(r(0,"div",21),v(1,"app-empty-state"),l())}function tc(n,t){if(n&1&&(r(0,"mat-tab"),Z(1,Js,5,5,"ng-template",18),r(2,"div",19),g(3,Xs,4,5,"div",20)(4,ec,2,0,"div",21),l()()),n&2){let e=t.$implicit;s(3),C(e.List.length>0?3:4)}}function ic(n,t){if(n&1&&(r(0,"mat-tab-group",17),ee(1,tc,5,1,"mat-tab",null,pe),l()),n&2){let e=c(3);s(),te(e.Layout)}}function nc(n,t){if(n&1&&(r(0,"div",15),g(1,ic,3,0,"mat-tab-group",17),l()),n&2){let e=c(2);s(),C(e.parkedOrders.length!=0?1:-1)}}function oc(n,t){if(n&1&&(r(0,"div",36),v(1,"i",42),r(2,"span",35),p(3),S(4,"slice"),l()()),n&2){let e=c().$implicit;s(2),m("matTooltip",e.CustomerDisplay),s(),w(e.CustomerDisplay.length>20?Ae(4,2,e.CustomerDisplay,0,20)+"...":e.CustomerDisplay)}}function rc(n,t){if(n&1&&(r(0,"div",38),p(1),l()),n&2){let e=c().$implicit;s(),x(" ",e.alias," ")}}function ac(n,t){if(n&1){let e=y();r(0,"div",24)(1,"div",44)(2,"div",26),_("click",function(o){let a=u(e).$implicit;return c(3).onOrderClicked(a),f(o.preventDefault())}),r(3,"h5",27)(4,"div",28),p(5),l(),r(6,"span",29),_("click",function(o){let a=u(e).$implicit;return c(3).remove(a),f(o.stopPropagation())}),v(7,"i",45),l()(),r(8,"div",31)(9,"div",32)(10,"div",33),v(11,"i",34),r(12,"span",35),p(13),S(14,"slice"),l()(),r(15,"div",36),v(16,"i",37),p(17),S(18,"date"),l(),g(19,oc,5,6,"div",36),g(20,rc,2,1,"div",38),l(),r(21,"div",39)(22,"div",40),p(23),l(),r(24,"input",41),O("ngModelChange",function(o){let a=u(e).$implicit;return D(a.selected,o)||(a.selected=o),f(o)}),_("change",function(){let o=u(e).$implicit,a=c(3);return f(a.chooseMerge(o))})("click",function(o){return u(e),f(o.stopPropagation())}),l()()()()()()}if(n&2){let e=t.$implicit,i=c(3),o=(i.parkLabel()==e.ParkLabel||i.parkLabel()==e.Alias)&&i.isRetrieve();s(),m("ngClass",T(22,Ma,o))("matTooltip",o?"You\u2019re currently retrieving this order and cannot retrieve it again!":""),s(2),m("ngClass",T(24,wa,o)),s(),m("ngClass",T(26,ka,o)),s(),x(" ",e.Alias?e.Alias:e.ParkLabel," "),s(),m("hidden",(i.parkLabel()==e.ParkLabel||i.parkLabel()==e.Alias)&&i.isRetrieve()||i.AuthorizeParkOrderDeletion),s(6),m("matTooltip",e.Number),s(),w(e.Number.length>18?Ae(14,15,e.Number,0,18)+"...":e.Number),s(4),x(" ",ne(18,19,e.Created,"dd-MMM HH:mm")," "),s(2),C(e.CustomerDisplay?19:-1),s(),C(i.replaceAlias?-1:20),s(2),m("ngClass",Si(28,Ta,e.Duration<=60,e.Duration>60&&e.Duration<=120,e.Duration>120)),s(),x(" ",e.Duration," minutes ago "),s(),m("hidden",i.parkLabel()&&i.isRetrieve()||!i.parkEnableMerge),P("ngModel",e.selected)}}function lc(n,t){if(n&1&&(r(0,"div",16)(1,"div",43),ee(2,ac,25,32,"div",24,pe),S(4,"FilterByArray"),l()()),n&2){let e=c(2);s(2),te(Ae(4,0,e.parkedOrders,st(4,Oa),e.filter))}}function sc(n,t){if(n&1&&g(0,nc,2,1,"div",15)(1,lc,5,5,"div",16),n&2){let e=c();C(e.retreiveMode==1?0:e.retreiveMode==0?1:-1)}}function cc(n,t){n&1&&v(0,"app-empty-state",3)}function pc(n,t){if(n&1){let e=y();r(0,"a",46),_("click",function(){u(e);let o=c();return f(o.clearSelection())}),p(1,"Clear All"),l()}}function dc(n,t){if(n&1){let e=y();r(0,"a",46),_("click",function(){u(e);let o=c();return f(o.merge())}),p(1,"Merge"),l()}}var Nn=class n{constructor(t,e,i,o,a,h,E,F,Ce,Te){this._dialogRef=t;this._parkedOrderService=e;this._localData=i;this._OrderHttpService=o;this._orderProcessorService=a;this._posHttpResponseService=h;this._salesOrderDataService=E;this.outletService=F;this._toastr=Ce;this.roleService=Te;let Be=this._salesOrderDataService.Data;this.entityId=Be.Order.EntityID,this.templateID=F.Data.PrintTemplate.ID,this.RegisterID=Be.Order.RegisterID,this.park=new pi(this.outletService.Data.ParkLayoutPack),this.Layout=F.Data?.ParkLayoutPack?.Layout,this.initModalDialog(),this.initConfig(),this.initSelectedRetrieve(),this.getData()}modalConfig=new H;filter;entityId;parkedOrders=[];filterAlwaysVisible;replaceAlias;parkDeletionRestriction;parkEnableMerge;AuthorizeParkOrderDeletion;listMerge=[];park;templateID;RegisterID;voidEnabled;retreiveMode;Layout;isRetrieve=R(!1);parkLabel=R(null);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)}initSelectedRetrieve(){let t=this._orderProcessorService.Data.posState;this.isRetrieve.update(()=>t===4),this.parkLabel.update(()=>this._salesOrderDataService.Data?.Order?.ParkLabel)}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 a=new Date(o.Created),E=Math.abs(new Date().getTime()-a.getTime()),F=Math.floor(E%864e5/36e5),Ce=Math.round(E%864e5%36e5/6e4);o.Duration=F>0?Ce+F*60:Ce});else{i.Alias=this.park.GetAlias(i.ParkLabel),i.MemberIdentification=i.MemberIdentification?i.MemberIdentification:"";let o=new Date(i.Created),h=Math.abs(new Date().getTime()-o.getTime()),E=Math.floor(h%864e5/36e5),F=Math.round(h%864e5%36e5/6e4);i.Duration=E>0?F+E*60:F}}),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 b.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.parkLabel()!=t.ParkLabel||this.parkLabel()!=t.Alias&&b.IsNotEmpty(t.Alias))&&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(B),d(Rn),d(Ye),d(Me),d(U),d(A),d(V),d(G),d(J),d(ce))};static \u0275cmp=M({type:n,selectors:[["POS-modal-retrieve"]],standalone:!1,decls:10,vars:9,consts:[[3,"onCancel","onClose","config"],[1,"container","px-4",3,"ngClass"],[1,"search-container","mb-6","px-0"],[1,"w-100"],[1,"d-flex","justify-content-between","mt-3"],[1,"d-flex","justify-content-end"],[1,"btn","btn-light-blue","text-primary","fw-bold","me-3"],[1,"merge-indicator"],[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-1","rounded-start-0",3,"ngModelChange","ngModel"],[1,"merge-label","fw-bold","bg-success",3,"hidden"],[1,"fw-semibold"],[1,"merge-label","merge-target","bg-success"],["mat-stretch-tabs","false",1,"mt-6"],[1,"container","mt-6"],["mat-stretch-tabs","false"],["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"],[1,"col-3"],[1,"card","border-1","position-relative",3,"ngClass","matTooltip"],[1,"card-body","p-0",3,"click"],[1,"card-title","d-flex","justify-content-between","align-items-center","px-3","pt-3",3,"ngClass"],[1,"label-title","text-truncate","px-2",3,"ngClass"],[3,"click","hidden"],[1,"fa","fa-xmark-circle","text-danger-soft"],[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"],["matTooltipPosition","above",3,"matTooltip"],[1,"mb-1","text-muted","small"],[1,"fa-regular","fa-calendar-check","pe-2"],[1,"text-muted","small"],[1,"duration-wrapper","d-flex","align-items-center"],[1,"badge","duration-badge",3,"ngClass"],["type","checkbox",1,"retrieve_checkbox","mb-1",3,"ngModelChange","change","click","hidden","ngModel"],[1,"fa","fa-user","pe-2"],[1,"row"],["matTooltipPosition","above",1,"card","border-0","position-relative",3,"ngClass","matTooltip"],[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,Gs,6,2,"div",2),g(4,sc,2,1)(5,cc,1,0,"app-empty-state",3),l()(),r(6,"footer",4)(7,"div",5),g(8,pc,2,0,"a",6),g(9,dc,2,0,"a",6),l()()()),e&2&&(m("config",i.modalConfig),s(2),m("ngClass",_e(6,Qs,i.parkedOrders.length==0,i.parkedOrders.length>0)),s(),C(i.parkedOrders.length>0||i.retreiveMode==1||i.filterAlwaysVisible?3:-1),s(),C(i.parkedOrders.length>0?4:5),s(4),C(i.listMerge.length>1?8:-1),s(),C(i.listMerge.length>1?9:-1))},dependencies:[z,Y,zt,q,oe,j,se,Bi,xt,It,ii,Fi,We,ji,hr],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.search-container[_ngcontent-%COMP%]{transition:all .3s ease;width:97%}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]{position:relative;transition:all .3s ease;height:2.3rem}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover, .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e4d,0 0 8px 4px #89b03e33;border-radius:4px}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]{transition:all .3s ease;border-left:none!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]:focus{box-shadow:none!important;border-color:#ced4da!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .input-group-text[_ngcontent-%COMP%]{transition:all .3s ease;background-color:#fff;border-right:none!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .input-group-text[_ngcontent-%COMP%], .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .input-group-text[_ngcontent-%COMP%]{background-color:#89b03e1a;border-color:#84cc16!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .fa-magnifying-glass[_ngcontent-%COMP%]{transition:all .3s ease}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .fa-magnifying-glass[_ngcontent-%COMP%], .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .fa-magnifying-glass[_ngcontent-%COMP%]{color:#84cc16!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e66,0 0 12px 6px #89b03e40!important}.custom-container-height[_ngcontent-%COMP%]{max-height:390px;min-height:390px}.nofocus[_ngcontent-%COMP%]:focus{outline:none!important}.merge-indicator[_ngcontent-%COMP%]{background-color:#e0e4dc;padding:12px;border-radius:.5rem;margin-bottom:.5rem;gap:4px;display:flex;flex-wrap:wrap;gap:8px;align-items:center}.merge-indicator[_ngcontent-%COMP%] .merge-label[_ngcontent-%COMP%]{color:#e0e4dc;padding:.55rem .75rem;border-radius:999px;font-size:.75rem;font-weight:500}.merge-indicator[_ngcontent-%COMP%] .merge-target[_ngcontent-%COMP%]{font-weight:700;color:#e0e4dc;font-size:.75rem}.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:not(.no-hover){transform:translateY(-3px);box-shadow:0 5px 15px #00000026;border-left:6px solid #84cc16}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover:not(.no-hover) h5.card-title[_ngcontent-%COMP%]{background:#84cc16}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover:not(.no-hover) .label-title[_ngcontent-%COMP%]{color:#fff!important}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover:not(.no-hover) .fa-xmark-circle[_ngcontent-%COMP%]{color:#c0392b!important}.col-3[_ngcontent-%COMP%] .card.no-hover[_ngcontent-%COMP%]{cursor:default}.col-3[_ngcontent-%COMP%] .card.no-hover[_ngcontent-%COMP%]:hover{transform:none;box-shadow:0 2px 10px #0000001a;border-left:4px solid #f0f0f0}.col-3[_ngcontent-%COMP%] .card.no-hover[_ngcontent-%COMP%]:hover h5.card-title[_ngcontent-%COMP%]{background:#e0e4dc}.col-3[_ngcontent-%COMP%] .card.no-hover[_ngcontent-%COMP%]:hover .label-title[_ngcontent-%COMP%]{color:#fff!important}.col-3[_ngcontent-%COMP%] .card.no-hover[_ngcontent-%COMP%]:hover .fa-xmark-circle[_ngcontent-%COMP%]{color:#e74c3c!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%]{--mat-tab-active-indicator-color: #89b03e;--mat-tab-focus-indicator-color: #89b03e;--mat-tab-focus-label-text-color: var(--bs-body-color);--mat-tab-active-label-text-color: var(--bs-body-color);--mat-tab-active-focus-label-text-color: var(--bs-body-color);--mat-tab-active-hover-label-text-color: var(--bs-body-color);--mat-tab-active-focus-indicator-color: #89b03e;--mat-tab-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 Ea=[{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"},{label:"Validate Inventory",class:"fa-archive fa-solid fs-3",action:"INVENTORY"},{label:"Disable Sort",class:"fa-sort fa-solid fs-3",action:"SORT"}]},{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:"Remote",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:"ECR",class:"fa-solid fa-mobile-signal-out fs-3",action:"ECR"},{label:"Cash Machine",class:"fa-solid fa-money-from-bracket fs-3",action:"CASH_MACHINE"}]}];var Vn=class{OrderID;ParkLabel;Items};var mc=n=>({"no-border":n});function uc(n,t){if(n&1){let e=y();r(0,"tr",13)(1,"td"),p(2),l(),r(3,"td"),p(4),S(5,"number"),l(),r(6,"td")(7,"div",14)(8,"button",15),_("click",function(){let o=u(e).$index,a=c();return f(a.onRemoveQuantity(o))}),p(9,"-"),l(),r(10,"input",16),O("ngModelChange",function(o){let a=u(e).$implicit;return D(a.SplitQuantity,o)||(a.SplitQuantity=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onSplitedQuantityChange())}),l(),r(11,"button",17),_("click",function(){let o=u(e).$index,a=c();return f(a.onAddQuantity(o))}),p(12,"+"),l()()(),r(13,"td",18),p(14),S(15,"number"),l()()}if(n&2){let e=t.$implicit,i=t.$index,o=c();m("ngClass",T(11,mc,i==(o.cartItems==null?null:o.cartItems.length)-1)),s(2),w(e==null||e.Variant==null?null:e.Variant.Name),s(2),w(I(5,7,e==null?null:e.Price)),s(6),P("ngModel",e.SplitQuantity),m("max",e.Quantity)("min",0),s(4),w(I(15,9,e==null?null:e.Quantity))}}var An=class n{constructor(t,e,i,o,a,h){this.dialogRef=t;this.salesOrderDataService=e;this.parkService=i;this.orderProcessorService=o;this.toastr=a;this.calculatorService=h;let E=this.salesOrderDataService?.Data?.CartItems;this.cartItems=Ie(Re,E),this.salesOrderData=Ie(qe,this.salesOrderDataService.Data),this.currencySymbol=this.calculatorService.currencySymbol}modalConfig=new H;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 Vn,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(B),d(V),d(ke),d(U),d(J),d(ge))};static \u0275cmp=M({type:n,selectors:[["app-modal-split"]],features:[lt([ke])],decls:27,vars:6,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"],[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),O("ngModelChange",function(a){return D(i.parkLabel,a)||(i.parkLabel=a),a}),l()(),r(7,"div",6)(8,"div",7),p(9,"Splitted Amount"),l(),r(10,"div",8),p(11),S(12,"number"),l()(),r(13,"table",9)(14,"thead",10)(15,"tr")(16,"th"),p(17,"Name"),l(),r(18,"th"),p(19,"Price"),l(),r(20,"th",11),p(21,"Qty Split"),l(),r(22,"th",12),p(23,"Qty"),l()()(),r(24,"tbody"),ee(25,uc,16,13,"tr",13,pe),l()()()()()()()),e&2&&(m("config",i.modalConfig),s(6),P("ngModel",i.parkLabel),s(5),Ee("",i.currencySymbol," ",i.splitPriceTotal?I(12,4,i.splitPriceTotal):0),s(14),te(i.cartItems))},dependencies:[X,z,j,ct,be,Y,q,oe,K],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 Ln=class n{constructor(t,e){this.data=t;this._dialogRef=e;this.message=t.message,this.initModal()}modalConfig=new H;message;initModal(){this.modalConfig.title=this.data.title,this.modalConfig.headerType=Fe.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(Oe),d(B))};static \u0275cmp=M({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),p(3),l()()()),e&2&&(m("config",i.modalConfig),s(3),w(i.message))},dependencies:[j],encapsulation:2})};var Fn=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 H;cartItem=new Re;role;isSerialItem=!1;priceVisible;unitPriceEditor;pricebookSelector;pricebookCopyDesc;calculatorQtyDisabled;calculatorPriceDisabled;productCalculator=R(!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=R(!1);enableCalculatorNote=R(!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),this.enableCalculatorNote.set(t.ModuleSell?.ProductDialog?.CalculatorNote)}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 bo=(a=>(a[a.SELL_INPUT=0]="SELL_INPUT",a[a.DISCOUNT=1]="DISCOUNT",a[a.PRODUCT=2]="PRODUCT",a[a.SERIAL=3]="SERIAL",a[a.CALCULATOR=4]="CALCULATOR",a))(bo||{});var _c=["quantity"],hc=["price"],vc=["discount"],bc=["unitCost"],ki=n=>({selected:n}),Sc=n=>({"mt-8":n}),Ra=n=>({"qtyBtn-disabled":n}),yc=()=>["/menu/Products/Catalog/Variants/Info"],xc=n=>({ID:n}),Ic=n=>({"col-12":n}),Pc=n=>({"editable-box":n});function Dc(n,t){if(n&1){let e=y();r(0,"a",11),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalItemState.PRODUCT))}),p(1," Product "),l()}if(n&2){let e=c();m("ngClass",T(1,ki,e.modalItemState.PRODUCT==e.currentState))}}function Oc(n,t){if(n&1){let e=y();r(0,"a",19),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalItemState.SERIAL))}),p(1," Serial "),l()}if(n&2){let e=c();m("ngClass",T(1,ki,e.modalItemState.SERIAL==e.currentState))}}function Mc(n,t){if(n&1){let e=y();r(0,"a",19),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalItemState.CALCULATOR))}),p(1," Calculator "),l()}if(n&2){let e=c();m("ngClass",T(1,ki,e.modalItemState.CALCULATOR==e.currentState))}}function wc(n,t){if(n&1&&(r(0,"div",28)(1,"div",29)(2,"div"),p(3),l(),r(4,"small",30),p(5),l()()()),n&2){let e=t.data;s(3),w(e==null?null:e.Value),s(2),w(e==null?null:e.Code)}}function kc(n,t){if(n&1){let e=y();r(0,"div",16)(1,"div",26)(2,"autocompleteV2",27,0),_("onSelect",function(o){u(e);let a=c(2);return f(a.onAddItem(o))})("onInputEnter",function(o){u(e);let a=c(2);return f(a.onEnterProductCode(o))}),l(),Z(4,wc,6,2,"ng-template",null,1,ht),l()()}if(n&2){let e=ot(5),i=c(2);s(2),m("localStorage","products")("renderThumbnail",!0)("inputTextValue",i.cartItem==null||i.cartItem.Variant==null?null:i.cartItem.Variant.Name)("clearOnSelect",!1)("useCustomTemplate",!0)("itemTemplate",e)}}function Tc(n,t){n&1&&(r(0,"div",20)(1,"div",31),p(2," Edit Prepaid Package Quantity is disabled during EDIT MODE "),l(),r(3,"div"),p(4," If you make a mistake, please delete the item and then add again "),l()())}function Ec(n,t){if(n&1&&(r(0,"div",32),v(1,"div",44),l()),n&2){let e=c(3);s(),m("innerHTML",e._shoppingCartService.priceMinimumRestrictionWarning(),Ut)}}function Rc(n,t){if(n&1&&(r(0,"span"),p(1),l()),n&2){let e=c(3);s(),x("(",e.cartItem.Variant==null?null:e.cartItem.Variant.UOMName,")")}}function Nc(n,t){if(n&1){let e=y();r(0,"div",39)(1,"strong")(2,"span"),p(3),l()(),r(4,"input",45),O("ngModelChange",function(o){u(e);let a=c(3);return D(a.cartItem.UnitQuantity,o)||(a.cartItem.UnitQuantity=o),f(o)}),l()()}if(n&2){let e=c(3);s(3),w(e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.ProductDialog==null?null:e.AppConfigJSON.ModuleSell.ProductDialog.UnitQtyLabel),s(),m("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),P("ngModel",e.cartItem.UnitQuantity)}}function Vc(n,t){if(n&1&&(v(0,"input",41,3),S(2,"number")),n&2){let e=c(3);m("value",I(2,1,e.cartItem.Price))}}function Ac(n,t){if(n&1){let e=y();r(0,"input",46,3),O("ngModelChange",function(o){u(e);let a=c(3);return D(a.cartItem.Price,o)||(a.cartItem.Price=o),f(o)}),l()}if(n&2){let e=c(3);m("simpleKeyboard",e.keyboard)("readonly",!e.unitPriceEditor||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible),P("ngModel",e.cartItem.Price)}}function Lc(n,t){if(n&1&&(r(0,"div",43)(1,"span",47),p(2),l()()),n&2){let e,i=c(3);s(2),x("Pricebook ",(e=i.selectedPriceBook())==null?null:e.Name," is applied")}}function Fc(n,t){if(n&1){let e=y();g(0,Ec,2,1,"div",32),r(1,"div",33)(2,"div",34)(3,"strong"),p(4," Qty "),g(5,Rc,2,1,"span"),l(),r(6,"div",35)(7,"button",36),_("click",function(){u(e);let o=c(2);return f(o.updateItemQuantity(o.cartItem.Quantity!=null?o.cartItem.Quantity-1:0))}),p(8," - "),l(),r(9,"input",37,2),_("ngModelChange",function(o){u(e);let a=c(2);return f(a.updateItemQuantity(o))}),l(),r(11,"button",38),_("click",function(){u(e);let o=c(2);return f(o.updateItemQuantity(o.cartItem.Quantity!=null?o.cartItem.Quantity+1:1))}),p(12," + "),l()()(),g(13,Nc,5,5,"div",39),r(14,"div",40)(15,"strong"),p(16,"Price"),l(),g(17,Vc,3,3,"input",41)(18,Ac,2,3,"input",42),l(),g(19,Lc,3,1,"div",43),l()}if(n&2){let e=c(2);C(e._shoppingCartService.priceMinimumRestrictionWarning()&&e._shoppingCartService.priceMinimumRestrictionWarning().trim()!==""?0:-1),s(),m("ngClass",T(16,Sc,e.statusModal=="create")),s(4),C(e.cartItem.Variant!=null&&e.cartItem.Variant.UOM&&(e.cartItem.Variant!=null&&e.cartItem.Variant.UOMName)?5:-1),s(2),m("ngClass",T(18,Ra,(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible||e.checkQtyInputDisabled()))("disabled",(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible||e.checkQtyInputDisabled()||e.isSellEdit()&&e.isPrepaidPackage()),s(2),m("simpleKeyboard",e.keyboard)("preventNegative",!e.role.Return)("decimalPlaces",e.isSerialItem?0:e.AppConfigJSON==null||e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.ProductDialog==null?null:e.AppConfigJSON.ModuleSell.ProductDialog.DecimalPlaceDigit)("ngModel",e.cartItem.Quantity)("disabled",(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible||e.checkQtyInputDisabled()||e.isSellEdit()&&e.isPrepaidPackage()),s(2),m("ngClass",T(20,Ra,(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible||e.checkQtyInputDisabled()))("disabled",(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible||e.checkQtyInputDisabled()||e.isSellEdit()&&e.isPrepaidPackage()),s(2),C(!(e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.ProductDialog==null)&&e.AppConfigJSON.ModuleSell.ProductDialog.UnitQtyLabel?13:-1),s(),m("hidden",!e.priceVisible),s(3),C(!e.unitPriceEditor||e.cartItem!=null&&e.cartItem.PromotionGift&&!e.editingItemPromotionVisible?17:18),s(2),C(e.selectedPriceBook()?19:-1)}}function Bc(n,t){if(n&1){let e=y();r(0,"div",22)(1,"strong"),p(2,"Sales Person"),l(),r(3,"ng-select-infinite",48),_("selectedChange",function(o){u(e);let a=c(2);return f(a.updateSales(o))}),O("selectedChange",function(o){u(e);let a=c(2);return D(a.cartItem.SalesID,o)||(a.cartItem.SalesID=o),f(o)}),l()()}if(n&2){let e=c(2);s(3),m("customTooltip",e.salesPersonName)("items",e.sales),P("selected",e.cartItem.SalesID)}}function jc(n,t){if(n&1){let e=y();r(0,"div",22)(1,"strong"),p(2,"Fulfillment From"),l(),r(3,"ng-select",49),_("ngModelChange",function(){u(e);let o=c(2);return f(o.onDeliveryEntityChange())}),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.cartItem.EntityID,o)||(a.cartItem.EntityID=o),f(o)}),l()()}if(n&2){let e=c(2);s(3),m("disabled",e.isSellEdit())("items",e.entities),P("ngModel",e.cartItem.EntityID)}}function Hc(n,t){if(n&1){let e=y();r(0,"div",15),g(1,kc,6,6,"div",16),g(2,Tc,5,0,"div",20),g(3,Fc,20,22),r(4,"div",21),g(5,Bc,4,3,"div",22),g(6,jc,4,3,"div",22),l(),r(7,"div",23)(8,"div",24)(9,"POS-tinymce-editor",25),O("ngModelChange",function(o){u(e);let a=c();return D(a.cartItem.Note,o)||(a.cartItem.Note=o),f(o)}),l()()()()}if(n&2){let e=c();s(),C(e.statusModal==="create"?1:-1),s(),C(e.isSellEdit()&&e.isPrepaidPackage()?2:-1),s(),C(e.cartItem?3:-1),s(2),C(e.isEmptySalesID&&(e.sales==null?null:e.sales.length)>0&&e.role.SalesPerson?5:-1);let i=e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.ProductDialog==null?null:e.AppConfigJSON.ModuleSell.ProductDialog.SplitDeliveryOutletEnabled,o=(e.salesOrderData==null||e.salesOrderData.Order==null?null:e.salesOrderData.Order.DeliveryStateID)==e.deliveryStateID.Sent;s(),C(i&&o?6:-1),s(3),P("ngModel",e.cartItem.Note)}}function Uc(n,t){if(n&1&&(v(0,"input",41),S(1,"number")),n&2){let e=c(2);m("value",I(1,1,e.cartItem.Discount))}}function Wc(n,t){if(n&1){let e=y();r(0,"input",76,4),_("ngModelChange",function(o){u(e);let a=c(2);return f(a.updateDiscountPercentage(o))}),l()}if(n&2){let e=c(2);m("simpleKeyboard",e.keyboard)("ngModel",e.cartItem.Discount)("preventNegative",!0)("readonly",!e.role.Discount||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)}}function Qc(n,t){if(n&1&&(v(0,"input",41),S(1,"number")),n&2){let e=c(2);m("value",I(1,1,e.inputedDiscountAmount))}}function $c(n,t){if(n&1){let e=y();r(0,"input",77,5),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.inputedDiscountAmount,o)||(a.inputedDiscountAmount=o),f(o)}),_("ngModelChange",function(o){u(e);let a=c(2);return f(a.onDiscountAmountChange(o))}),l()}if(n&2){let e=c(2);m("max",e.cartItem==null?null:e.cartItem.GrossTotal)("simpleKeyboard",e.keyboard),P("ngModel",e.inputedDiscountAmount),m("preventNegative",!0)("readonly",!e.role.Discount||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)}}function qc(n,t){if(n&1&&(r(0,"div",56)(1,"div",52)(2,"strong"),p(3,"Discount Amount / Qty"),l()(),r(4,"div",53)(5,"div",78)(6,"p"),p(7),S(8,"number"),l()()()()),n&2){let e=c(2);s(7),w(I(8,1,e.cartItem.DiscountAmount))}}function Gc(n,t){if(n&1){let e=y();r(0,"div",56)(1,"div",52)(2,"strong"),p(3,"Pricebook"),l()(),r(4,"div",53)(5,"ng-select",79),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.pricebookId,o)||(a.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())}),l()()()}if(n&2){let e=c(2);s(5),m("items",e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.PriceBook),P("ngModel",e.pricebookId),m("disabled",e.pricebookDisabled)}}function zc(n,t){if(n&1&&(r(0,"div",70)(1,"h5",80),p(2),S(3,"number"),l()()),n&2){let e=c(2);s(2),x(" ",I(3,1,e.cartItem.Discount),"% ")}}function Jc(n,t){if(n&1&&(r(0,"div",71)(1,"h5"),p(2),S(3,"number"),l(),r(4,"span",69),p(5,"x"),l(),r(6,"h5"),p(7),S(8,"number"),l()()),n&2){let e=c(2);s(2),w(I(3,2,e.cartItem.Quantity)),s(5),w(I(8,4,e.cartItem.DiscountAmount))}}function Kc(n,t){if(n&1&&(r(0,"h5",74),p(1),S(2,"number"),l()),n&2){let e=c(2);s(),x(" -",I(2,1,(e.cartItem==null?null:e.cartItem.GrossTotal)*(e.cartItem.Discount/100))," ")}}function Yc(n,t){if(n&1&&(r(0,"div",73)(1,"h5",74),p(2),S(3,"number"),l()()),n&2){let e=c(2);s(2),x(" -",I(3,1,e.cartItem.Quantity*e.cartItem.DiscountAmount)," ")}}function Zc(n,t){if(n&1&&(r(0,"div",75)(1,"div",81)(2,"h5"),p(3,"Grand Total"),l()(),r(4,"div",81)(5,"h5"),p(6),S(7,"number"),l()()()),n&2){let e=c(2);s(6),w(I(7,1,e.cartItem.Total))}}function Xc(n,t){if(n&1){let e=y();r(0,"div",16)(1,"div",50)(2,"div",51)(3,"div",52)(4,"strong"),p(5,"Discount %"),l()(),r(6,"div",53)(7,"div",54),g(8,Uc,2,3,"input",41)(9,Wc,2,4,"input",55),l()()(),r(10,"div",56)(11,"div",52)(12,"strong"),p(13,"Discount Amount"),l()(),r(14,"div",53)(15,"div",54),g(16,Qc,2,3,"input",41)(17,$c,2,5,"input",57),l()()(),r(18,"div",58)(19,"div",59)(20,"input",60),O("ngModelChange",function(o){u(e);let a=c();return D(a.isDiscMultipliciedQty,o)||(a.isDiscMultipliciedQty=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onSwitchToggleDiscount())}),l()(),r(21,"div",61)(22,"strong"),p(23,"*Quantity"),l(),r(24,"span",62),v(25,"i",63),l()()(),g(26,qc,9,3,"div",56),g(27,Gc,6,3,"div",56),l(),r(28,"div",64)(29,"div",65)(30,"h4"),p(31,"Discount Simulation"),l(),r(32,"h4",66),p(33),l()(),r(34,"div",67)(35,"div",52)(36,"div",68)(37,"h5"),p(38),S(39,"number"),l(),r(40,"span",69),p(41,"x"),l(),r(42,"h5"),p(43),S(44,"number"),l()(),g(45,zc,4,3,"div",70),g(46,Jc,9,6,"div",71),l(),r(47,"div",52)(48,"div",72)(49,"h5"),p(50),S(51,"number"),l()(),r(52,"div",73),g(53,Kc,3,3,"h5",74),l(),g(54,Yc,4,3,"div",73),l(),g(55,Zc,8,3,"div",75),l()()()}if(n&2){let e=c();s(8),C(!e.role.Discount||e.cartItem!=null&&e.cartItem.PromotionGift&&!e.editingItemPromotionVisible?8:9),s(8),C(!e.role.Discount||e.cartItem!=null&&e.cartItem.PromotionGift&&!e.editingItemPromotionVisible?16:17),s(4),P("ngModel",e.isDiscMultipliciedQty),s(6),C(e.isDiscMultipliciedQty?-1:26),s(),C(e.cartItem.Variant!=null&&(!(e.cartItem==null||e.cartItem.Variant==null)&&e.cartItem.Variant.PriceBook)&&(e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.PriceBook.length)>0?27:-1),s(6),x(" ",e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.Name," "),s(5),w(I(39,14,e.cartItem.Quantity)),s(5),w(I(44,16,e.cartItem.Price)),s(2),C(e.cartItem.Discount?45:-1),s(),C(e.cartItem.DiscountAmount>0?46:-1),s(4),w(I(51,18,e.cartItem==null?null:e.cartItem.GrossTotal)),s(3),C(e.cartItem.Discount?53:-1),s(),C(e.cartItem.DiscountAmount>0?54:-1),s(),C(e.cartItem.DiscountAmount>0||e.cartItem.Discount>0?55:-1)}}function ep(n,t){n&1&&(r(0,"div",84),v(1,"i",99),r(2,"h6"),p(3,"No Image"),l()())}function tp(n,t){if(n&1&&v(0,"img",85),n&2){let e=c(2);m("src",e.cartItem.Variant.ThumbnailUrl,nt)}}function ip(n,t){if(n&1){let e=y();r(0,"button",104),_("click",function(){u(e);let o=c(4);return f(o.toggleEditCost())}),v(1,"i",105),l()}}function np(n,t){if(n&1&&(r(0,"div",101)(1,"div",98),p(2),S(3,"number"),l(),g(4,ip,2,0,"button",103),l()),n&2){let e=c(3);s(2),Ee(" ",e.currencySymbol," ",ne(3,3,e.cartItem.Cost,"1.0-4")," "),s(2),C(!(e.AppConfigJSON==null||e.AppConfigJSON.ModuleSell==null)&&e.AppConfigJSON.ModuleSell.Cost.Enabled?4:-1)}}function op(n,t){if(n&1){let e=y();r(0,"button",109),_("click",function(){u(e);let o=c(4);return f(o.toggleEditCost())}),v(1,"i",110),l()}}function rp(n,t){if(n&1){let e=y();r(0,"div",102)(1,"div",106)(2,"input",107),O("ngModelChange",function(o){u(e);let a=c(3);return D(a.cartItem.Cost,o)||(a.cartItem.Cost=o),f(o)}),l(),g(3,op,2,0,"button",108),l()()}if(n&2){let e=c(3);s(2),P("ngModel",e.cartItem.Cost),s(),C(!(e.AppConfigJSON==null||e.AppConfigJSON.ModuleSell==null)&&e.AppConfigJSON.ModuleSell.Cost.Enabled?3:-1)}}function ap(n,t){if(n&1&&(r(0,"div",93)(1,"div",100)(2,"div",90),p(3,"Cost"),l(),g(4,np,5,6,"div",101),g(5,rp,4,2,"div",102),l()()),n&2){let e=c(2);m("ngClass",e.generalPriceCol),s(),m("ngClass",T(4,Pc,e.enabledEditCost())),s(3),C(e.enabledEditCost()?-1:4),s(),C(e.enabledEditCost()?5:-1)}}function lp(n,t){if(n&1&&(r(0,"div",93)(1,"div",89)(2,"div",90),p(3,"Commission"),l(),r(4,"div",98),p(5),S(6,"number"),l()()()),n&2){let e=c(2);m("ngClass",e.generalPriceCol),s(5),Ee(" ",e.currencySymbol," ",I(6,3,1e4)," ")}}function sp(n,t){if(n&1&&(r(0,"div",97)(1,"div",89)(2,"div",90),p(3,"Storage Location"),l(),r(4,"div",98),p(5),l()()()),n&2){let e=c(2);s(5),x(" ",e.cartItem.Variant.Storage," ")}}function cp(n,t){if(n&1&&(r(0,"tr")(1,"td",114),p(2),l(),r(3,"td",115),p(4),S(5,"number"),l(),r(6,"td",115),p(7),S(8,"number"),l()()),n&2){let e=t.$implicit,i=c(3);s(2),x(" ",e.Name," "),s(2),x(" ",I(5,4,e.MinimumQuantity)," "),s(3),Ee(" ",i.currencySymbol," ",I(8,6,e.UnitPrice)," ")}}function pp(n,t){if(n&1&&(r(0,"div",21)(1,"h5",87),p(2,"Pricebook"),l(),r(3,"div",96)(4,"table",111)(5,"thead")(6,"tr")(7,"th",112),p(8,"Name"),l(),r(9,"th",113),p(10,"Min Qty"),l(),r(11,"th",113),p(12,"Price"),l()()(),r(13,"tbody"),ee(14,cp,9,8,"tr",null,pe),S(16,"sortBy"),l()()()()),n&2){let e=c(2);s(14),te(Ae(16,0,e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.PriceBook,"asc","MinimumQuantity"))}}function dp(n,t){if(n&1&&(r(0,"div",16)(1,"div",82)(2,"a",83),g(3,ep,4,0,"div",84)(4,tp,1,1,"img",85),l()(),r(5,"div",86)(6,"div",16)(7,"h5",87),p(8,"Inventory"),l(),r(9,"div",88)(10,"div",89)(11,"div",90),p(12,"On Hand"),l(),r(13,"div",91),p(14),l()()(),r(15,"div",88)(16,"div",89)(17,"div",90),p(18,"Allocated"),l(),r(19,"div",91),p(20),l()()(),r(21,"div",88)(22,"div",92)(23,"div",90),p(24,"Available"),l(),r(25,"div",91),p(26),l()()()(),r(27,"div",21)(28,"h5",87),p(29,"General Price"),l(),g(30,ap,6,6,"div",93),r(31,"div",93)(32,"div",94)(33,"div",90),p(34,"Price"),l(),r(35,"div",95),p(36),S(37,"number"),l()()(),g(38,lp,7,5,"div",93),l(),r(39,"div",21)(40,"div",96)(41,"div",16)(42,"h5",87),p(43,"Advanced"),l(),r(44,"div",97)(45,"div",89)(46,"div",90),p(47,"Content"),l(),r(48,"div",98),p(49),S(50,"number"),l()()(),g(51,sp,6,1,"div",97),l()()(),g(52,pp,17,4,"div",21),l()()),n&2){let e=c();s(2),m("routerLink",st(22,yc))("queryParams",T(23,xc,e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.ID)),s(),C((e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.ThumbnailUrl)==null?3:4),s(11),w(e.onHand),s(6),w(e.allocated),s(6),x(" ",e.onHand-e.allocated," "),s(4),C(!(e.AppConfigJSON==null||e.AppConfigJSON.ModuleSell==null)&&e.AppConfigJSON.ModuleSell.Cost.Visible&&e.role.Cost?30:-1),s(),m("ngClass",e.generalPriceCol),s(5),Ee(" ",e.currencySymbol," ",I(37,18,e.cartItem.Variant.UnitPrice)," "),s(2),C(e.role.Commission&&(e.cartItem!=null&&e.cartItem.SalesCommission)?38:-1),s(6),le(T(25,Ic,!(!(e.AppConfigJSON==null||e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.Grid==null)&&e.AppConfigJSON.ModuleSell.Grid.StorageVisible)||!e.cartItem.Variant.Storage)),s(5),Ho(" ",e.cartItem==null?null:e.cartItem.VariantUnitQuantity," (@",e.currencySymbol,"",I(50,20,e.cartItem.Price/(e.cartItem==null?null:e.cartItem.VariantUnitQuantity)),") "),s(2),C(!(e.AppConfigJSON==null||e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.Grid==null)&&e.AppConfigJSON.ModuleSell.Grid.StorageVisible&&e.cartItem.Variant.Storage?51:-1),s(),C((e.cartItem==null||e.cartItem.Variant==null||e.cartItem.Variant.PriceBook==null?null:e.cartItem.Variant.PriceBook.length)>0?52:-1)}}function mp(n,t){if(n&1){let e=y();r(0,"app-item-serial",116),O("cartItemChange",function(o){u(e);let a=c();return D(a.cartItem,o)||(a.cartItem=o),f(o)})("serialsChange",function(o){u(e);let a=c();return D(a.serials,o)||(a.serials=o),f(o)}),l()}if(n&2){let e=c();m("entityId",e.deliveryEntityId),P("cartItem",e.cartItem),m("disabled",e.orderManager.posState==2&&e.constants.IsNotEmpty(e.cartItem.ID)),P("serials",e.serials)}}function up(n,t){if(n&1){let e=y();r(0,"div",18)(1,"item-calculator-tab",117),_("discountTotal",function(o){u(e);let a=c();return f(a.cartItem.Discount=o)})("priceTotal",function(o){u(e);let a=c();return f(a.cartItem.Price=o)})("qtyTotal",function(o){u(e);let a=c();return f(a.cartItem.Quantity=o)})("noteChanges",function(o){u(e);let a=c();return f(a.enableCalculatorNote()?a.cartItem.Note=o:null)}),l()()}if(n&2){let e=c();m("hidden",e.modalItemState.CALCULATOR!=e.currentState),s(),m("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 Fn{constructor(e,i,o,a,h,E,F,Ce,Te,Be,gi,Ci,Nt,to,_i){super();this._dialogRef=e;this.data=i;this._shoppingCartService=o;this._outletService=a;this._posService=h;this._orderProcessorService=E;this._orderDataService=F;this._variantService=Ce;this._toastr=Te;this.decimalPipe=Be;this._matDialog=gi;this._numpadService=Ci;this._userRoleService=Nt;this._onlineStatusService=to;this.cdRef=_i;this.destroy$=new Q,this.entities=this._posService.Data.Entities,this.AppConfigJSON=this._posService.Data.AppConfigJSON,this.mapAppConfigJson(this.AppConfigJSON),this.subscribeToObservableChanges(),this.modalConfig.customWidth="800px",this.modalConfig.okText="Save",this.currencySymbol=this.invoiceCalculatorService.currencySymbol}calculatorTab=Qo(At);_quantityElement;_priceElement;_discountElement;_costElement;invoiceCalculatorService=$(ge);salesPersonName;destroy$;AppConfigJSON=new Fr;orderManager;salesOrderData;isOnline=!0;currentState;modalItemState=bo;isDiscMultipliciedQty=!0;inputedDiscountAmount=0;serials=[];constants=b;deliveryEntityId;selectedPriceBook=R(null);isPrepaidPackage=R(!1);isSellEdit=R(!1);deliveryStateID=lo;currencySymbol;ngOnInit(){this.initTabState(),this.isSerialItem=this.isSerial(),this.isPrepaidPackage.update(()=>this.cartItem?.Variant?.TypeID==10&&b.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;b.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=ti(Re,i),this.cartItem.EntityID==b.GuidEmpty&&(this.cartItem.EntityID=null),b.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 Re}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=b.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=b.IsEmpty(e)}}pricebookChange(){b.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()}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(b.IsEmpty(this.cartItem.VariantID)){this._toastr.error("Enter item data before clicking OK!","No item is entered!");return}b.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&&b.IsNotEmpty(this.cartItem.ID)}onAddItem(e){let i=this.salesOrderData.Order.EntityID;this._variantService.findVariantByID(e,i).then(o=>{let a=o,h=new Re;h.patchByVariant(a),this.addItem(h)})}onEnterProductCode(e){let i=this.salesOrderData.Order.EntityID;this._variantService.findVariantByCode(e,i).then(o=>{if(o){let a=Object.assign(new Tr,o),h=new Re;h.patchByVariant(a),this.addItem(h)}else this.onProductNotFound(e)}).catch(o=>{window.alert(`Barcode "${e}" is not registered in the product`)})}onProductNotFound(e){this._matDialog.open(Ln,{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 a=`Editing Cart item - ${e.Variant?e.Variant.Name:null}`;this.updateOrUnitPrice(e.UnitPriceOriginal),this.updateHeaderTitle(a),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}toggleEditCost(){return this.enabledEditCost.update(e=>!e)}get generalPriceCol(){return this.role.Commission&&this.cartItem?.SalesCommission&&this.AppConfigJSON?.ModuleSell?.Cost.Visible&&this.role.Cost?"col-4":this.role.Commission&&this.cartItem?.SalesCommission||this.AppConfigJSON?.ModuleSell?.Cost.Visible&&this.role.Cost?"col-6":"col-12"}ngOnDestroy(){this._shoppingCartService.priceMinimumRestrictionWarning.set(""),this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(i){return new(i||n)(d(B),d(Oe),d(de),d(G),d(A),d(U),d(V),d($i),d(J),d(K),d(re),d(Kr),d(ce),d(pt),d($o))};static \u0275cmp=M({type:n,selectors:[["POS-modal-item"]],viewQuery:function(i,o){if(i&1&&(Lo(o.calculatorTab,At,5),Se(_c,5),Se(hc,5),Se(vc,5),Se(bc,5)),i&2){Fo();let a;ye(a=xe())&&(o._quantityElement=a.first),ye(a=xe())&&(o._priceElement=a.first),ye(a=xe())&&(o._discountElement=a.first),ye(a=xe())&&(o._costElement=a.first)}},standalone:!1,features:[Ei],decls:18,vars:15,consts:[["variant",""],["itemTemplate",""],["quantity",""],["price",""],["discount",""],["AMOUNT",""],[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"],["data-cy","product",1,"btn","btn-link-tab",3,"ngClass"],["data-cy","serial",1,"btn","btn-link-tab",3,"ngClass"],[1,"mx-8"],[1,"py-8"],[1,"row"],[3,"entityId","cartItem","disabled","serials"],[3,"hidden"],["data-cy","serial",1,"btn","btn-link-tab",3,"click","ngClass"],[1,"alert","alert-warning","text-center","my-5","py-3"],[1,"row","mt-6"],[1,"col-auto","pe-0"],[1,"row","mt-6","mb-5"],[1,"col","tinymce"],["height","210px",3,"ngModelChange","ngModel"],[1,"col"],["inputID","product","requestUrl","/API/AC/GetVariantSuggestionByCodeNName","placeholder","Input product name / code",1,"form-control",3,"onSelect","onInputEnter","localStorage","renderThumbnail","inputTextValue","clearOnSelect","useCustomTemplate","itemTemplate"],[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,"bg-gradient-warning","p-4","justify-content-center","align-items-center","d-flex","gap-2",2,"margin-bottom","12px","border-radius","8px"],[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"],[1,"col-auto","pe-0",2,"width","82px"],[1,"col-auto","pe-0",2,"width","112px",3,"hidden"],["disabled","",1,"form-control","cart-input",3,"value"],["id","inputPrice","keyboardType","number","type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input",3,"simpleKeyboard","readonly","ngModel"],[1,"col-auto","d-flex","align-items-center","pt-5"],[3,"innerHTML"],["type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input","input-numpad",3,"ngModelChange","preventNegative","readOnly","decimalPlaces","ngModel"],["id","inputPrice","keyboardType","number","type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input",3,"ngModelChange","simpleKeyboard","readonly","ngModel"],[1,"bg-gradient-warning","py-4","px-2"],["position","top","parent","body","bindValue","ID","bindLabel","Name","placeholder","Sales Person",3,"selectedChange","customTooltip","items","selected"],["bindLabel","Name","bindValue","ID","placeholder","Delivery Outlet","appendTo","body",2,"width","200px",3,"ngModelChange","disabled","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"],["id","inputDiscount","keyboardType","number","type","text","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","cart-input",3,"simpleKeyboard","ngModel","preventNegative","readonly"],[1,"row","d-flex","align-items-center","justify-content-start","mt-4"],["id","inputDiscAmount","keyboardType","number","type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input",3,"max","simpleKeyboard","ngModel","preventNegative","readonly"],[1,"d-flex","align-items-center","mt-4"],[1,"form-check","form-switch","form-switch-lg","ms-1","mt-1"],["type","checkbox","id","flexSwitchCheckDefault",1,"form-check-input",3,"ngModelChange","ngModel"],[1,"ms-4"],["matTooltipPosition","above","matTooltip",`Use the final discount amount if you want to discount the price of the total
|
|
7
|
-
quantity of the product. The nominal will be calculated automatically and filled in the discount amount box.`,1,"pointer"],[1,"fa-solid","fa-info-circle","ms-2"],[1,"col-6","py-8"],[1,"w-100","text-center"],[1,"text-start","mt-12"],[1,"row","mt-12"],[1,"w-100","d-flex","align-items-center","justify-content-end"],[1,"mx-1","fw-bold"],[1,"d-flex","align-items-center","justify-content-end","mt-2"],[1,"d-flex","align-items-center","justify-content-end","mt-2","text-danger"],[1,"w-100","d-flex","justify-content-end"],[1,"w-100","d-flex","justify-content-end","mt-2"],[1,"text-danger"],[1,"row","border-top","mx-0","px-0","mt-4"],["id","inputDiscount","keyboardType","number","type","text","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","cart-input",3,"ngModelChange","simpleKeyboard","ngModel","preventNegative","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,"fw-bold","text-danger"],[1,"col-6","d-flex","justify-content-end","mt-4"],[1,"col-12","mt-4",2,"padding","10px"],["target","_blank",1,"d-flex","justify-content-center","align-items-center",2,"color","inherit",3,"routerLink","queryParams"],[1,"text-center"],[1,"border","rounded",3,"src"],[1,"col-12",2,"padding","10px"],[1,"border-bottom","section-header"],[1,"col-4","m-0","p-3"],[1,"info-box"],[1,"info-label","mb-2"],[1,"info-value","info-value-md"],[1,"info-box","available"],[1,"m-0","p-3",3,"ngClass"],[1,"info-box","price-highlight"],[1,"info-value","info-value-sm","mt-3"],[1,"col-12","m-0","p-3"],[1,"col-6","m-0","p-3"],[1,"info-value","info-value-sm"],["aria-hidden","true",1,"fa-solid","fa-image","fa-5x"],[1,"info-box",3,"ngClass"],[1,"info-value-wrapper"],[1,"info-input"],["aria-label","Toggle edit mode",1,"lock-toggle-btn"],["aria-label","Toggle edit mode",1,"lock-toggle-btn",3,"click"],[1,"fa","fa-lock"],[1,"info-input-wrapper"],["type","text","autoNum","",1,"info-value-input","form-control",3,"ngModelChange","ngModel"],["aria-label","Save and lock",1,"lock-toggle-btn","unlocked"],["aria-label","Save and lock",1,"lock-toggle-btn","unlocked",3,"click"],[1,"fa","fa-unlock"],[1,"table","table-bordered","inventory-table"],[1,"py-6","border-end"],[1,"py-6","border-end","text-end"],[1,"py-6"],[1,"py-6","text-end"],[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",6),_("onOk",function(h){return o.onOk(h)})("onCancel",function(){return o.onCancel()})("onClose",function(){return o.onCancel()}),r(1,"content",7)(2,"div",8)(3,"div",9)(4,"div")(5,"a",10),_("click",function(){return o.onTabChange(o.modalItemState.SELL_INPUT)}),p(6," Cart "),l(),r(7,"a",11),_("click",function(){return o.onTabChange(o.modalItemState.DISCOUNT)}),p(8," Discount "),l(),g(9,Dc,2,3,"a",12),g(10,Oc,2,3,"a",13),g(11,Mc,2,3,"a",13),l()(),r(12,"div",14),g(13,Hc,10,6,"div",15),g(14,Xc,56,20,"div",16),g(15,dp,53,27,"div",16),g(16,mp,1,4,"app-item-serial",17),g(17,up,2,7,"div",18),l()()()()),i&2&&(m("config",o.modalConfig),s(5),m("ngClass",T(11,ki,o.modalItemState.SELL_INPUT==o.currentState)),s(2),m("ngClass",T(13,ki,o.modalItemState.DISCOUNT==o.currentState)),s(2),C(!(o.cartItem==null||o.cartItem.Variant==null)&&o.cartItem.Variant.Name&&o.hasInventoryView?9:-1),s(),C(o.isSerialItem?10:-1),s(),C(o.productCalculator()?11:-1),s(2),C(o.modalItemState.SELL_INPUT==o.currentState?13:-1),s(),C(o.modalItemState.DISCOUNT==o.currentState?14:-1),s(),C(o.modalItemState.PRODUCT==o.currentState?15:-1),s(),C(o.modalItemState.SERIAL==o.currentState?16:-1),s(),C(o.productCalculator()?17:-1))},dependencies:[z,Y,zt,q,oe,j,gt,se,Ze,ct,$t,Zr,ua,Xt,Dt,At,sa,K,vr],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.tinymce[_ngcontent-%COMP%] a[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{z-index:2;position:absolute;right:15px;bottom:19px}.tinymce[_ngcontent-%COMP%] editor[_ngcontent-%COMP%]{height:max-content;z-index:1}.more[_ngcontent-%COMP%]{position:absolute;top:0;left:30px}.unit-qty[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{width:100px}p-chips[_ngcontent-%COMP%]{width:100%}p-chips[_ngcontent-%COMP%] ul.ui-inputtext{width:100%}p-chips[_ngcontent-%COMP%] ul.ui-inputtext li input.undefined{border:none}.inventory-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .inventory-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{line-height:6px!important}.cart-input[_ngcontent-%COMP%]{height:36px!important}.table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{vertical-align:middle;line-height:15px}ng-select-infinite[_ngcontent-%COMP%] div.ng-select-container{width:200px!important}.form-check-input[_ngcontent-%COMP%]{clear:left}.form-switch.form-switch-lg[_ngcontent-%COMP%] .form-check-input[_ngcontent-%COMP%]{height:1.5rem;width:2.75rem;border-radius:3rem}.form-check-input[_ngcontent-%COMP%]:focus{border-color:#89b03e!important}.form-check-input[_ngcontent-%COMP%]:checked{border-color:#89b03e!important;background-color:#89b03e!important}.qtyBtn-disabled[_ngcontent-%COMP%]{background-color:#e9ecef;color:#000!important}button.qty_btn[_ngcontent-%COMP%]{background:#eee;border:1px solid #ddd;width:36px}.section-header[_ngcontent-%COMP%]{padding-bottom:6px;margin-bottom:6px;padding-left:0}.info-box[_ngcontent-%COMP%]{background:#f8f9fa;border:1px solid #e5e5e5;border-radius:6px;padding:16px;text-align:center;position:relative;transition:all .3s ease;height:100%}.info-label[_ngcontent-%COMP%]{font-size:12px;color:#666;text-transform:uppercase;letter-spacing:.5px}.info-value[_ngcontent-%COMP%]{font-weight:600;color:#333}.info-value-sm[_ngcontent-%COMP%]{font-size:16px}.info-value-md[_ngcontent-%COMP%]{font-size:20px}.info-box.available[_ngcontent-%COMP%]{background:#f0f8f0;border-color:#d0e8d0}.info-box.available[_ngcontent-%COMP%] .info-value[_ngcontent-%COMP%]{color:#2d5f2d}.info-box.price-highlight[_ngcontent-%COMP%] .info-value[_ngcontent-%COMP%]{color:#0b5ed7}.info-box.editable-box.editing[_ngcontent-%COMP%]{background:#fffef0;border-color:#ffc107;box-shadow:0 0 0 3px #ffc1071a}.info-value-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:10px}.lock-toggle-btn[_ngcontent-%COMP%]{background:#0000000d;border:none;padding:6px;cursor:pointer;color:#666;transition:all .2s ease;display:flex;align-items:center;justify-content:center;border-radius:6px;width:32px;height:32px;flex-shrink:0}.lock-toggle-btn[_ngcontent-%COMP%]:hover{color:#0b5ed7;background:#0b5ed726;transform:scale(1.05)}.lock-toggle-btn.unlocked[_ngcontent-%COMP%]{color:#ff6b00;background:#ff6b0026}.lock-toggle-btn.unlocked[_ngcontent-%COMP%]:hover{color:#c50;background:#ff6b0040;transform:scale(1.05)}.info-input-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:10px;width:100%}.info-value-input[_ngcontent-%COMP%]{font-size:16px;font-weight:600;color:#333;border:2px solid #0b5ed7;border-radius:6px;text-align:center;background:#fff;width:100%;outline:none;transition:border-color .2s}.info-value-input[_ngcontent-%COMP%]:focus{border-color:#0056b3;box-shadow:0 0 0 3px #0b5ed71a}.editable-box[_ngcontent-%COMP%]{background:#fffef0;border-color:#ffc107;box-shadow:0 0 0 3px #ffc1071a}.section[_ngcontent-%COMP%]{margin-bottom:32px}.section-title[_ngcontent-%COMP%]{font-size:16px;font-weight:600;color:#333;margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #e5e5e5}.info-list[_ngcontent-%COMP%]{display:flex;flex-direction:column}.list-item[_ngcontent-%COMP%]{background:#fafafa;border:1px solid #e5e5e5;border-radius:6px;padding:14px 16px;font-size:14px;color:#333}table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{text-transform:none;background:#f8f9fa}"]})};var fp=n=>({"is-invalid":n});function gp(n,t){n&1&&(r(0,"div",8)(1,"span"),p(2,"Host URL is required."),l()())}function Cp(n,t){n&1&&(r(0,"span",9),p(1,"Enter the port or device URL used by your ECR middleware."),l())}var Bn=class n{constructor(t){this.dialogRef=t;this.config.title="Connect ECR",this.config.customWidth="400px"}ecrService=$(kt);config=new H;urlCtrl=new bt("https://localhost:5001/EcrHub",[yi.required]);onClose(){this.dialogRef.close()}onConnect(){this.urlCtrl.valid&&this.dialogRef.close(this.urlCtrl.value)}get modalContentWording(){let t="ECR Connected",e="Your ECR is now online. You can process payments using the BCA EDC machine immediately.",i="ECR Not Connected",o="To enable payments using the BCA EDC machine, please connect the ECR middleware through the port or URL below.",a=this.ecrService.isConnected()?t:i,h=this.ecrService.isConnected()?e:o;return{title:a,description:h}}static \u0275fac=function(e){return new(e||n)(d(B))};static \u0275cmp=M({type:n,selectors:[["app-modal-connect-ecr"]],decls:15,vars:10,consts:[[3,"onCancel","onClose","onOk","config","dynamicValidated"],[1,"d-flex","flex-column",2,"row-gap","1.5rem"],[1,"text-center","d-flex","flex-column","align-items-center",2,"row-gap","0.8rem"],[1,"fa-solid","fa-mobile-signal-out","fa-3x","d-flex","align-items-center","justify-content-center","bg-light",2,"border-radius","50%","width","80px","height","80px",3,"ngClass"],[1,"fw-normal"],[1,"card","d-flex","justify-content-center","p-8","bg-light-gray",2,"border-radius","12px","margin","0"],["for","floatingInput",1,"fw-semibold","mb-2"],["id","floatingInput","placeholder","Host URL","type","text",1,"form-control",2,"border-radius","8px","padding","12px 16px",3,"ngClass","formControl"],[1,"invalid-feedback","mt-4"],[1,"text-muted","mt-4"]],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,"div",2),v(4,"i",3),r(5,"h2"),p(6),l(),r(7,"span",4),p(8),l()(),r(9,"div",5)(10,"label",6),p(11,"Port / URL"),l(),v(12,"input",7),g(13,gp,3,0,"div",8)(14,Cp,2,0,"span",9),l()()()()),e&2&&(m("config",i.config)("dynamicValidated",i.urlCtrl.valid),s(4),m("ngClass",i.ecrService.isConnected()?"text-success":"text-danger"),s(2),w(i.modalContentWording.title),s(2),w(i.modalContentWording.description),s(4),m("ngClass",T(8,fp,i.urlCtrl.invalid&&(i.urlCtrl.touched||i.urlCtrl.dirty)))("formControl",i.urlCtrl),s(),C(i.urlCtrl.invalid&&(i.urlCtrl.touched||i.urlCtrl.dirty)?13:14))},dependencies:[X,z,j,Je,Y,q,St],encapsulation:2})};function _p(n,t){if(n&1){let e=y();r(0,"div",12)(1,"radio-options",13),O("modelChange",function(o){u(e);let a=c(2);return D(a.odsConfigType,o)||(a.odsConfigType=o),f(o)}),l(),r(2,"label",14),p(3,"Choose Configuration"),l()()}if(n&2){let e=c(2);s(),P("model",e.odsConfigType),m("options",t.options.OrderDisplayBroadcastModeType)}}function hp(n,t){if(n&1&&(g(0,_p,4,2,"div",12),S(1,"async")),n&2){let e,i=c();C((e=I(1,1,i.odsConfig$))?0:-1,e)}}function vp(n,t){n&1&&(r(0,"div",4)(1,"div",15),v(2,"i",16),l(),r(3,"div",17)(4,"div"),p(5," Choose outlet first before configuring Order Display! "),l()()())}var jn=class n{constructor(t,e,i,o){this.dialogRef=t;this.httpService=e;this.outletRegisterService=i;this.data=o;this.modalConfig=new H,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(ve(e=>{this.odsConfigType=e.form?.OrderDisplayBroadcastMode}),vi(e=>(console.error("Error loading ODS configuration:",e),hi({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"}]}}))),jt(1))}onSave(){let e={EntityID:this.outletRegisterService.Data.EntityID,OrderDisplayBroadcastMode:this.odsConfigType};this.httpService.post("/api/outlet/UpdateOrderDisplayBroadcastMode",e).pipe(ve(()=>{this.dialogRef.close(e)}),vi(i=>(console.error("Error saving ODS configuration:",i),hi(null)))).subscribe()}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(B),d(Le),d(G),d(Oe))};static \u0275cmp=M({type:n,selectors:[["modal-ods-config"]],decls:17,vars:3,consts:[[3,"onOk","onClose","onCancel","config"],[1,"container"],[1,"row"],[1,"col-12","text-center"],[1,"warning-banner","mt-4","d-flex","align-items-center","p-3","border","rounded","bg-light"],[1,"text-center","mt-4"],[1,"m-0"],[1,"col-12","mt-2"],[1,"text-center"],["src","https://cdn.dealpos.xyz/web-image/dealpos_order_fulfillment_u7xzqe.png","alt","Order Display System",1,"img-fluid","mb-4"],[1,"mb-0"],["target","_blank",1,"fw-bold",3,"href"],[1,"form-floating-outline","radio","border","rounded","mt-4",2,"height","auto !important"],["id","odsConfigType",3,"modelChange","model","options"],["for","odsConfigType"],[1,"ms-2","me-3"],[1,"fas","fa-exclamation-triangle","text-warning","fa-lg"],[1,"warning-text"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.onSave()})("onClose",function(){return i.onClose()})("onCancel",function(){return i.onClose()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div",3),g(5,hp,2,3)(6,vp,6,0,"div",4),r(7,"div",5)(8,"p",6),p(9," 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. "),l()()(),r(10,"div",7)(11,"div",8),v(12,"img",9),r(13,"p",10),p(14," You can access this feature through "),r(15,"a",11),p(16,"ods.dealpos.app"),l()()()()()()()()),e&2&&(m("config",i.modalConfig),s(5),C(i.hasOutlet?5:6),s(10),m("href",i.odsLink,nt))},dependencies:[X,be,ei,j,ze],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 bp(n,t){if(n&1&&(r(0,"p",9),p(1),l()),n&2){let e=t.$implicit;s(),x(" ",e," ")}}function Sp(n,t){if(n&1&&(r(0,"div",10)(1,"p",11)(2,"span",12),p(3," Valid until "),r(4,"span",13),p(5),S(6,"date"),l()()()()),n&2){c();let e=Wo(7);s(5),w(ne(6,1,e,"longDate"))}}function yp(n,t){if(n&1&&(r(0,"div",2)(1,"div",6)(2,"span",7),p(3),l(),r(4,"div",8),ee(5,bp,2,1,"p",9,Vt),Ri(7),g(8,Sp,7,4,"div",10),l()()()),n&2){let e,i,o,a=c();s(3),x(" ",(e=a.coupon())==null||e.Coupon==null?null:e.Coupon.Title," "),s(2),te((i=a.coupon())==null||i.Coupon==null?null:i.Coupon.Requirement),s(2);let h=Uo((o=a.coupon())==null||o.Coupon==null?null:o.Coupon.Expiry);s(),C(h&&h!=a.mindate?8:-1)}}function xp(n,t){n&1&&(r(0,"p",14),v(1,"i",15),r(2,"span",13),p(3,"Edit Mode: "),l(),p(4," Coupon information is displayed for reference only. Coupon removal is not available in edit mode. "),l())}function Ip(n,t){n&1&&(r(0,"p",5),v(1,"i",16),r(2,"span",13),p(3,"Important: "),l(),p(4," Removing the coupon removes the invoice level discount. Any discounts already applied to individual items will be kept. "),l())}function Pp(n,t){if(n&1&&g(0,xp,5,0,"p",14)(1,Ip,5,0,"p",5),n&2){let e=c();C(e.isRemoveCouponOnEdit()?1:0)}}function Dp(n,t){n&1&&(r(0,"p",5),v(1,"i",16),r(2,"span",13),p(3,"Important: "),l(),p(4,"Removing this coupon will reset your cart to its original state. All discounts and price changes from this coupon will be removed. "),l())}var Hn=class n{dialogRef=$(B);orderProcessorService=$(U);posService=$(A);promotionCouponService=$(Mt);promotionExternalCoupon=$(wt);modalConfig;isEdit=R(!1);isRemoveCouponOnEdit=ao(()=>this.posService.Data?.AppConfigJSON?.ModuleSell?.RemoveCouponOnEdit);mindate=b.MinDate;coupon=ao(()=>this.promotionCouponService.appliedCoupon()||this.promotionExternalCoupon.coupon);constructor(){this.initModalConfig()}initModalConfig(){let t=this.orderProcessorService.Data.posState;this.modalConfig=new H,this.modalConfig.title=this.generateDialogTitle(),this.modalConfig.customWidth="400px",this.isEdit.set(t===2),t===2?(this.isRemoveCouponOnEdit()?(this.modalConfig.okText="Remove",this.modalConfig.hideCancel=!0):(this.modalConfig.hideOk=!0,this.modalConfig.cancelText="Close"),this.isEdit.set(!0)):(this.modalConfig.okText="Remove",this.modalConfig.hideCancel=!0)}generateDialogTitle(){return`Coupon ${this.maskCouponCode(this.coupon()?.Code)} Applied`}maskCouponCode(t){return t?`***${t.slice(-2)}`:""}onClose(){this.dialogRef.close(!1)}onRemove(){this.dialogRef.close(!0)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=M({type:n,selectors:[["app-modal-confirm-remove-coupon"]],decls:8,vars:3,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container-fluid"],[1,"card","coupon-card","mb-8"],[1,"card","warning-card","mb-0"],[1,"card-body","d-flex","justify-content-center","align-items-center"],[1,"warning-msg","mb-0","text-warning-emphasis"],[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,"mb-0","p-4"],[1,"opacity-75"],[1,"fw-bold"],[1,"warning-msg","mb-0","text-info-emphasis"],[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){if(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),g(3,yp,9,3,"div",2),r(4,"div",3)(5,"div",4),g(6,Pp,2,1)(7,Dp,5,0,"p",5),l()()()()()),e&2){let o;m("config",i.modalConfig),s(3),C((o=i.coupon())!=null&&o.Coupon?3:-1),s(3),C(i.isEdit()?6:7)}},dependencies:[X,j,We],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;color:#fff;padding:12px 24px;border-radius:50px;font-size:1.4rem;font-weight:700;margin-bottom:20px;box-shadow:0 4px 15px #89b03e4d}.badge-success[_ngcontent-%COMP%]{background:linear-gradient(135deg,#89b03e,#a4c449)}.badge-warning[_ngcontent-%COMP%]{background:linear-gradient(135deg,#ffc107,#ffd451)}']})};var Rt=class n{constructor(t,e,i,o,a,h,E,F,Ce,Te,Be,gi,Ci,Nt,to,_i,yo,io){this.roleService=t;this.orderProcessorService=e;this.promotionService=i;this.promotionCouponV2Service=o;this.promotionCouponProvider=a;this.dialog=h;this.parkOrderService=E;this.salesOrderService=F;this.outletRegisterService=Ce;this.pageInitialService=Te;this.toastrService=Be;this.httpService=gi;this.shoppingCartService=Ci;this.customerDisplay=Nt;this.ecrService=to;this.ecrSignalR=_i;this.cashMachineService=yo;this.orderDisplayService=io;this.destroy$=new Q,this.sourceMenu=[...Ea],this._moreMenu=new no(this.sourceMenu),this.moreMenu$=this._moreMenu.asObservable(),this.initElgiblePromotion(),this.subscribeObservable()}_moreMenu;moreMenu$;eligiblePromotions$;destroy$;sourceMenu;_enabledDragDrop=new no(!0);enabledDragDrop$=this._enabledDragDrop.asObservable();subscribeObservable(){Ti([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(it(()=>this.promotionService.getTotalEligiblePromotion()))}moreMenuAction(t){switch(t){case"ADD_ITEM":this.dialog.open($e);break;case"COUPON":let e=this.salesOrderService.Data?.Order?.PromotionCoupon;b.IsNotEmpty(e)?this.dialog.open(Hn).afterClosed().pipe(ie(o=>o)).subscribe(()=>this.removePromotionCoupon()):this.dialog.open(On);break;case"PROMOTION":this.shoppingCartService.isNonAuthorizedCouponType?this.shoppingCartService.isShoppingCartLockedByPromotionCoupon():this.dialog.open(nn,{id:"promotion-event"});break;case"UPLOAD":this.onImportItems();break;case"RETURN":this.dialog.open(Mn);break;case"CLEAR":this.dialog.open(Dn);break;case"SERIAL":this.dialog.open(wn);break;case"SPLIT":this.onSplitItem();break;case"PRINT":this.parkOrderService.onPrintRetrieve();break;case"CANCEL":this.onCancel();break;case"SYNC":this.dialog.open(En);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;case"CASH_MACHINE":this.openModalCashMachineUrl();break}}removePromotionCoupon(){let t=this.promotionCouponProvider.coupon;b.IsNotEmpty(t)?this.promotionCouponProvider.removeCoupon():this.promotionCouponV2Service.removeAppliedCoupon()}openOdsConfigDialog(){this.dialog.open(jn).afterClosed().pipe(ie(t=>!!t),ve(t=>{this.orderDisplayService.setODSConfig(t.OrderDisplayBroadcastMode)})).subscribe(t=>{this.toastrService.success("Order Display Configuration applied successfully","Success")})}openModalInputEcrUrl(){this.ecrSignalR.isConnected()?this.confirmDisableEcr():this.dialog.open(Bn).afterClosed().pipe(ie(e=>!!e)).subscribe(e=>{this.ecrSignalR.initConnection(e)})}confirmDisableEcr(){this.dialog.open(ri,{data:{title:"Disconnect ECR",message:"Are you sure you want to disconnect ECR?",okText:"OK",headerType:Fe.Warning},width:"500px"}).afterClosed().pipe(ie(t=>t),ve(()=>{this.ecrService.disconnect(),this.ecrSignalR.stopConnection()})).subscribe(()=>{this.toastrService.success("ECR is disconnected","Success")})}openModalCashMachineUrl(){this.dialog.open(Yr).afterClosed().pipe(ie(t=>!!t)).subscribe(t=>{this.cashMachineService.initConnection(t)})}confirmDisableCashMachine(){this.dialog.open(ri,{data:{title:"Disconnect Cash Machine",message:"Are you sure you want to disconnect Cash Machine?",okText:"OK",headerType:Fe.Warning},width:"500px"}).afterClosed().pipe(ie(t=>t),ve(()=>{this.cashMachineService.stopConnection()})).subscribe(()=>{this.toastrService.success("Cash Machine 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(Sr.emptyEntity,Fe.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(a=>{let h=t.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkDialogTitle,E=i.posState==5,F=t.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,Ce=E?"Split Order":h;this.dialog.open(si,{data:{title:Ce,parkLayoutPack:this.generateParkLayoutOptions(o,a.Orders),replaceWithAlias:F,orderNote:e.Order?.Note}}).afterClosed().pipe(ie(Te=>S.IsNotEmpty(Te)),Ve(Te=>{let Be=new ai;return Be.ParkLabel=Te.Name,Be.Note=Te.Note,this.park(Be)})).subscribe()})}showReparkModal(){this.dialog.open(mn,{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(pn,{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(dn).afterClosed().pipe(ie(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 a=new ci;a.Name=i.Name+o,a.Alias=this.generateAlias(t,a.Name),a.IsOccupied=this.IsOccupied(a.Name,e),i.Options.push(a)}return i}),t}generateAlias(t,e){let i="";if(t.Alias){let o=t.Alias.filter(a=>a.Name==e);o.length>0&&(i=`${o[0]?.Alias}`)}return i}IsOccupied(t,e){let i=e.filter(a=>a.ParkLabel==t),o=!1;return i.length>0&&(o=!0),o}static \u0275fac=function(e){return new(e||n)(N(Le),N(Et),N(U),N(A),N(V),N(J),N(ni),N(G),N(Me),N(re))};static \u0275prov=Ge({token:n,factory:n.\u0275fac,providedIn:"root"})};var Cn=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=Wt({type:n});static \u0275inj=Ht({imports:[X,be,Dt,Pt,Ur,Yt,qt,Zt,Ke,Yi]})};var xa=n=>({"opacity-50":n});function el(n,t){if(n&1){let e=y();r(0,"div",5)(1,"h6",6),p(2,"Verify Via"),l(),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"),v(7,"i",10),l(),r(8,"div",11),p(9),l()()()(),r(10,"div",12)(11,"button",8),_("click",function(){u(e);let o=c();return f(o.onChooseVerifyType("email"))}),r(12,"div",9),v(13,"i",13),r(14,"div",11),p(15),l()()()(),r(16,"div",12)(17,"button",14),_("click",function(o){return u(e),c().onChooseVerifyType("pin"),f(o.preventDefault())}),r(18,"div",9),v(19,"i",15),r(20,"div",16),p(21,"Use PIN"),l()()()()()}if(n&2){let e=c();s(4),m("disabled",!e.phone||(e.phone==null?null:e.phone.length)<6),s(4),m("ngClass",T(6,xa,!e.phone||(e.phone==null?null:e.phone.length)<6)),s(),x(" ",e.phone&&(e.phone==null?null:e.phone.length)>6?e.phone:"Mobile Phone is not registered"," "),s(2),m("disabled",!e.email),s(3),m("ngClass",T(8,xa,!e.email)),s(),x(" ",e.email?e.email:"Email is not registered"," ")}}function tl(n,t){if(n&1){let e=y();r(0,"div",17)(1,"div",18)(2,"div"),p(3,"OTP Verification is turned "),r(4,"span",19),p(5,"OFF"),l(),p(6,","),l(),r(7,"div"),p(8," Please read this "),r(9,"a",20),p(10,"article"),l(),p(11," to turn on "),l()()(),r(12,"div")(13,"div",21)(14,"button",22),_("click",function(){u(e);let o=c();return f(o.onRedeem())}),p(15,"Redeem"),l()()()}}var _n=class n{toastrService=$(J);onVerify=new je;pointUsedChange=new je;redeemEvent=new je;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=M({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),O("ngModelChange",function(a){return D(i.pointUsed,a)||(i.pointUsed=a),a}),_("ngModelChange",function(){return i.onPointUsedChange()}),l()(),r(3,"div",3)(4,"span",1),p(5,"Of"),l(),r(6,"span",4),p(7),b(8,"number"),l()(),r(9,"div"),p(10,"Points"),l()(),g(11,el,22,10,"div",5)(12,tl,16,0)),e&2&&(s(2),P("ngModel",i.pointUsed),m("max",i.pointBalance),s(5),w(I(8,4,i.pointBalance)),s(4),C(i.isVerifyEnabled?11:12))},dependencies:[X,z,ct,be,Y,q,oe,Ke,se,K],styles:[".input-point[_ngcontent-%COMP%]{width:120px;height:44px;font-size:1.375rem;text-align:center}"]})};var il=n=>({"error-input":n});function nl(n,t){if(n&1&&(r(0,"span"),p(1),l()),n&2){let e=c(3);s(),x(" ",e.config.separator," ")}}function ol(n,t){if(n&1){let e=y();He(0),r(1,"input",5,0),_("paste",function(o){u(e);let a=c(2);return f(a.handlePaste(o))})("keyup",function(o){let a=u(e).index,h=c(2);return f(h.onKeyUp(o,a))})("input",function(o){let a=u(e).index,h=c(2);return f(h.onInput(o,a))})("keydown",function(o){let a=u(e).index,h=c(2);return f(h.onKeyDown(o,a))}),l(),Z(3,nl,2,1,"span",6),Ue()}if(n&2){let e=t.$implicit,i=t.index,o=t.last,a=c(2);s(),le(Ni("otp-input ",a.config.inputClass)),m("pattern",a.config.allowNumbersOnly?"\\d*":"")("type",a.inputType)("placeholder",(a.config==null?null:a.config.placeholder)||"")("ngStyle",a.config.inputStyles)("formControl",a.otpForm.controls[e])("id",a.getBoxId(i))("ngClass",T(11,il,(a.config==null?null:a.config.showError)&&(a.formControl==null?null:a.formControl.invalid)&&((a.formControl==null?null:a.formControl.dirty)||(a.formControl==null?null:a.formControl.touched)))),s(2),m("ngIf",a.config.separator&&!o)}}function rl(n,t){if(n&1){let e=y();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),Z(2,ol,4,13,"ng-container",4),l()()}if(n&2){let e=c();le(Ni("ng-otp-input-wrapper wrapper ",e.config.containerClass)),m("id",Ni("c_",e.componentKey))("ngStyle",e.config.containerStyles),s(2),m("ngForOf",e.controlKeys)}}var _t=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)}},Di=class{static keys(t){return t?Object.keys(t):[]}},Co=(()=>{let t=class t{set disabled(i){this.setDisabledState(i)}get inputType(){return this.config?.isPasswordInput?"password":this.config?.allowNumbersOnly?"tel":"text"}get controlKeys(){return Di.keys(this.otpForm?.controls)}get formControl(){return this.formCtrl??this.inj?.get(er)}constructor(i,o){this.document=i,this.inj=o,this.config={length:4},this.onBlur=new Q,this.onInputChange=new Q,this.inputControls=new Array(this.config.length),this.componentKey=Math.random().toString(36).substring(2)+new Date().getTime().toString(36),this.destroy$=new Q,this.activeFocusCount=0,this.onChange=()=>{},this.onTouched=()=>{},this._isDisabled=!1}ngOnInit(){this.otpForm=new tr({});for(let i=0;i<this.config.length;i++)this.otpForm.addControl(this.getControlName(i),new bt);this.otpForm.valueChanges.pipe(k(this.destroy$)).subscribe(i=>{Di.keys(this.otpForm.controls).forEach(o=>{var a=this.otpForm.controls[o].value;a&&a.length>1&&(a.length>=this.config.length?this.setValue(a):this.rebuildValue())})})}setDisabledState(i){this._isDisabled=i,this.otpForm&&(i?this.otpForm.disable({emitEvent:!1}):this.otpForm.enable({emitEvent:!1}))}writeValue(i){this.currentVal=this.hasVal(i)?i:null,this.setValue(this.currentVal)}registerOnChange(i){this.onChange=i}registerOnTouched(i){this.onTouched=i}onFocusIn(){this.onTouched(),this.activeFocusCount++}onFocusOut(){setTimeout(()=>{this.activeFocusCount--,this.activeFocusCount===0&&(this.onTouched(),this.onBlur.next())},0)}ngAfterViewInit(){if(!this.config.disableAutoFocus){let i=this.document.getElementById(`c_${this.componentKey}`);if(i){let o=i.getElementsByClassName("otp-input")[0];o&&o.focus&&o.focus()}}}getControlName(i){return`ctrl_${i}`}onKeyDown(i,o){let a=this.getBoxId(o-1),h=this.getBoxId(o);if(_t.ifKey(i,"Enter")){let F=this.document.getElementById(h)?.closest("form");if(F){i.preventDefault();let Ce=new Event("submit",{bubbles:!0,cancelable:!0});F.dispatchEvent(Ce);return}}if(_t.ifSpacebar(i))return i.preventDefault(),!1;if(_t.ifBackspace(i)){i.target.value?this.clearInput(h,o):(this.clearInput(a,o-1),this.setSelected(a)),this.rebuildValue();return}if(_t.ifDelete(i)){i.target.value?this.clearInput(h,o):(this.clearInput(a,o-1),this.setSelected(a)),this.rebuildValue();return}}hasVal(i){return i!=null&&i!=null&&(!i?.trim||i.trim()!="")}onInput(i,o){let a=this.hasVal(this.currentVal)?`${this.currentVal}${i.target.value}`:i.target.value;if(this.config.allowNumbersOnly&&!this.validateNumber(a)){i.target.value=null,i.stopPropagation(),i.preventDefault(),this.clearInput(null,o);return}if(this.ifValidKeyCode(null,i.target.value)){let h=this.getBoxId(o+1);this.setSelected(h),this.rebuildValue()}else{i.target.value=null;let h=this.getControlName(o);this.otpForm.controls[h]?.setValue(null),this.rebuildValue()}}onKeyUp(i,o){_t.ifTab(i)&&(o-=1);let a=this.getBoxId(o+1),h=this.getBoxId(o-1);if(_t.ifRightArrow(i)){i.preventDefault(),this.setSelected(a);return}if(_t.ifLeftArrow(i)){i.preventDefault(),this.setSelected(h);return}}validateNumber(i){return i&&/^[0-9]+$/.test(i)}getBoxId(i){return`otp_${i}_${this.componentKey}`}clearInput(i,o){let a=this.getControlName(o);if(this.otpForm.controls[a]?.setValue(null),i){let h=this.document.getElementById(i);h&&h instanceof HTMLInputElement&&(h.value=null)}}setSelected(i){this.focusTo(i);let o=this.document.getElementById(i);o&&o.setSelectionRange&&setTimeout(()=>{o.setSelectionRange(0,1)},0)}ifValidKeyCode(i,o){let a=o??i.key;return this.config?.allowNumbersOnly?this.validateNumber(a):/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)||/^[a-zA-Z0-9%*_\-@#$!]$/.test(a)&&a.length==1}focusTo(i){let o=this.document.getElementById(i);o&&o.focus()}setValue(i){if(!(this.config.allowNumbersOnly&&isNaN(i))){if(this.otpForm?.reset(),!this.hasVal(i)){this.rebuildValue();return}i=i.toString().replace(/\s/g,""),Array.from(i).forEach((o,a)=>{this.otpForm.get(this.getControlName(a))&&this.otpForm.get(this.getControlName(a)).setValue(o)}),this.config.disableAutoFocus||setTimeout(()=>{let o=this.document.getElementById(`c_${this.componentKey}`);var a=i.length<this.config.length?i.length:this.config.length-1;let h=o.getElementsByClassName("otp-input")[a];h&&h.focus&&setTimeout(()=>{h.focus()},1)},0),this.rebuildValue()}}rebuildValue(){let i=null;Di.keys(this.otpForm.controls).forEach(o=>{let a=this.otpForm.controls[o].value;if(a){let h=a.length>1,E=!this.config.allowNumbersOnly&&this.config.letterCase&&(this.config.letterCase.toLocaleLowerCase()=="upper"||this.config.letterCase.toLocaleLowerCase()=="lower");a=a[0];let F=E?this.config.letterCase.toLocaleLowerCase()=="upper"?a.toUpperCase():a.toLowerCase():a;E&&F==a?E=!1:a=F,i==null?i=a:i+=a,(h||E)&&this.otpForm.controls[o].setValue(a)}}),this.currentVal!=i&&(this.currentVal=i,this.onChange(i),this.formCtrl?.setValue&&this.formCtrl.setValue(i),this.onInputChange.next(i))}handlePaste(i){let o=i.clipboardData||window.clipboardData;if(o)var a=o.getData("Text");i.stopPropagation(),i.preventDefault(),!(!a||this.config.allowNumbersOnly&&!this.validateNumber(a))&&this.setValue(a)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}};t.\u0275fac=function(o){return new(o||t)(d(To),d(ko))},t.\u0275cmp=M({type:t,selectors:[["ng-otp-input"],["ngx-otp-input"]],inputs:{config:"config",formCtrl:"formCtrl",disabled:"disabled"},outputs:{onBlur:"onBlur",onInputChange:"onInputChange"},features:[lt([{provide:Zo,useExisting:wo(()=>t),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(o,a){o&1&&Z(0,rl,3,7,"div",1),o&2&&m("ngIf",a.otpForm==null?null:a.otpForm.controls)},dependencies:[Je,Y,q,or,St,Qt,Ai,Li,z],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}}"]});let n=t;return n})(),hn=(()=>{let t=class t{};t.\u0275fac=function(o){return new(o||t)},t.\u0275mod=Wt({type:t}),t.\u0275inj=Ht({imports:[Co]});let n=t;return n})();function ll(n,t){if(n&1&&(r(0,"div"),p(1," OTP has been sent to "),r(2,"span",5),p(3),l()()),n&2){let e=c();s(3),w(e.contact)}}function sl(n,t){if(n&1&&v(0,"ng-otp-input",3),n&2){let e=c(2);m("formCtrl",e.otpCtrl)("config",e.otpConfig)}}function cl(n,t){if(n&1&&g(0,sl,1,2,"ng-otp-input",3),n&2){let e=c();C(e.showPinInput()?0:-1)}}function pl(n,t){if(n&1&&v(0,"ng-otp-input",3),n&2){let e=c();m("formCtrl",e.otpCtrl)("config",e.otpConfig)}}function dl(n,t){if(n&1){let e=y();r(0,"div",4)(1,"span"),p(2,"Didn`t get a code? "),l(),r(3,"a",6),_("click",function(){u(e);let o=c();return f(o.onResendCode())}),p(4,"Click to resend"),l()()}}var vn=class n{type;contact;clearPin=!1;onVerify=new je;resendCode=new je;showPinInput=R(!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(Mo(300),ie(t=>t.length===6)).subscribe(t=>{this.onVerify.emit(t)})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=M({type:n,selectors:[["verify-step"]],inputs:{type:"type",contact:"contact",clearPin:"clearPin"},outputs:{onVerify:"onVerify",resendCode:"resendCode"},features:[Eo],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),p(2),l(),g(3,ll,4,1,"div"),l(),r(4,"div",2),g(5,cl,1,1)(6,pl,1,2,"ng-otp-input",3),l(),g(7,dl,5,0,"div",4)),e&2&&(s(2),x(" Confirm Your ",i.type=="pin"?"PIN":"OTP"," "),s(),C(i.type!="pin"?3:-1),s(2),C(i.type=="pin"?5:6),s(2),C(i.type!="pin"?7:-1))},dependencies:[hn,Co,Je],encapsulation:2})};function ml(n,t){if(n&1){let e=y();ft(0,"button",7),ro("click",function(){u(e);let o=c();return f(o.onCancel())}),p(1,"Cancel"),at()}}function ul(n,t){if(n&1){let e=y();ft(0,"button",8),ro("click",function(){u(e);let o=c();return f(o.onConfirm())}),p(1,"Confirm"),at()}}var bn=class n{pointUsed=Vi(0);redeemPointValue=Vi(0);showCancelBtn=Vi(!1);confirmEvent=new je;cancelEvent=new je;onConfirm(){this.confirmEvent.emit()}onCancel(){this.cancelEvent.emit()}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=M({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&&(ft(0,"div",0)(1,"div",1),p(2,"Redeem"),at(),ft(3,"div",2)(4,"span",3),p(5),b(6,"number"),at(),ft(7,"small"),p(8,"Point"),at()(),ft(9,"div",1),p(10,"~"),at(),ft(11,"div",4)(12,"span",3),p(13),b(14,"number"),at(),ft(15,"small"),p(16,"Discount"),at()(),g(17,ml,2,0,"button",5)(18,ul,2,0,"button",6),at()),e&2&&(s(5),w(I(6,3,i.pointUsed())),s(8),w(I(14,5,i.pointUsed()*i.redeemPointValue())),s(4),C(i.showCancelBtn()?17:18))},dependencies:[X,K],encapsulation:2})};function fl(n,t){if(n&1&&(r(0,"span",5),p(1),b(2,"number"),l()),n&2){let e=c(3);s(),x("-",I(2,1,e.coupon.Amount),"%")}}function gl(n,t){if(n&1&&(r(0,"span",5),p(1),b(2,"number"),l()),n&2){let e=c(3);s(),x(" -",I(2,1,e.coupon.Amount)," ")}}function Cl(n,t){if(n&1){let e=y();r(0,"button",9),_("click",function(){u(e);let o=c().$implicit,a=c(2);return f(a.onRemoveCouponDiscount(o))}),p(1," Remove "),l()}}function _l(n,t){if(n&1){let e=y();r(0,"button",10),_("click",function(){u(e);let o=c().$implicit,a=c(2);return f(a.onApplyCouponDiscount(o))}),p(1," Apply "),l()}if(n&2){let e=c(3);m("disabled",e.hasAppliedCouponDiscount())}}function hl(n,t){if(n&1&&(r(0,"tr")(1,"td"),p(2),l(),r(3,"td"),p(4),l(),r(5,"td",4),p(6),b(7,"number"),l(),r(8,"td",4),g(9,fl,3,3,"span",5)(10,gl,3,3,"span",5),l(),r(11,"td",6),g(12,Cl,2,0,"button",7)(13,_l,2,1,"button",8),l()()),n&2){let e=t.$implicit,i=c(2);s(2),w(e==null||e.Variant==null?null:e.Variant.Name),s(2),w(e==null||e.Variant==null?null:e.Variant.Code),s(2),w(I(7,5,e.UnitPrice)),s(3),C((i.coupon==null||i.coupon.Requirement==null?null:i.coupon.Requirement.Type)==i.couponType.DiscountPercentage?9:10),s(3),C((e==null?null:e.CouponDiscount)>0?12:13)}}function vl(n,t){if(n&1&&ee(0,hl,14,7,"tr",null,Vt),n&2){let e=c();te(e.eligibleItems())}}function bl(n,t){n&1&&(r(0,"tr")(1,"td",11),v(2,"app-empty-state",12),l()())}var Sn=class n{constructor(t){this.data=t;this.coupon=this.data.coupon,this.initModalConfig(),this.initEligibleItems()}dialogRef=$(B);config;eligibleItems=R([]);coupon;couponType=an;hasAppliedCouponDiscount=R(!1);initModalConfig(){this.config=new H,this.config.title="Choose Item to Apply Discount",this.config.hideFooter=!0}initEligibleItems(){let t=this.data.coupon?.ApplyToProduct.map(e=>e.ID);t&&(this.eligibleItems.update(()=>this.data.cartItems.filter(i=>t.includes(i.VariantID))),this.hasAppliedCouponDiscount.update(()=>this.eligibleItems().some(e=>e.CouponDiscount>0)))}onApplyCouponDiscount(t){let e=[t];this.hasAppliedCouponDiscount.update(()=>!0),this.dialogRef.close(e)}onRemoveCouponDiscount(t){this.eligibleItems.update(e=>{let i=e.findIndex(o=>o.VariantID===t.VariantID);return i>-1&&(e[i].Discount=0,e[i].CouponDiscount=0),e}),this.hasAppliedCouponDiscount.update(()=>!1)}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(Oe))};static \u0275cmp=M({type:n,selectors:[["app-modal-coupon-selected-item"]],decls:17,vars:2,consts:[[3,"onCancel","onClose","config"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],[1,"text-end"],[1,"text-danger"],[1,"text-center"],[1,"btn","btn-sm","btn-danger"],[1,"btn","btn-sm","btn-success",3,"disabled"],[1,"btn","btn-sm","btn-danger",3,"click"],[1,"btn","btn-sm","btn-success",3,"click","disabled"],["colspan","5"],["title","No eligible products","message","No products in the cart qualify for coupon use"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()}),r(1,"content")(2,"table",1)(3,"thead",2)(4,"tr")(5,"th",3),p(6,"Name"),l(),r(7,"th",3),p(8,"Code"),l(),r(9,"th",3),p(10,"Price"),l(),r(11,"th",3),p(12,"Discount"),l(),v(13,"th",3),l()(),r(14,"tbody"),g(15,vl,2,0)(16,bl,3,0,"tr"),l()()()()),e&2&&(m("config",i.config),s(15),C(i.eligibleItems().length!==0?15:16))},dependencies:[X,j,ii,K],encapsulation:2})};var mt=class n{constructor(t,e,i,o,a,h){this._httpService=t;this._orderDataService=e;this._userRoleService=i;this.toastr=o;this._invoiceCalculatorService=a;this.promotionCouponFactoryService=h;this.subscribeToObservable()}dialog=$(re);role;originalRoleData;_coupon=R(null);salesOrderBeforePromotion=R(null);isShowToastrInApplyCoupon=R(!1);get coupon(){return this._coupon()}subscribeToObservable(){this._userRoleService.Data$.subscribe(t=>{this.role=t,S.IsEmpty(this.originalRoleData)&&(this.originalRoleData=Ie(Ot,t))})}RedeemCoupon(t,e,i=!1){if(!i){this.isShowToastrInApplyCoupon.set(!0);let a=this.copyOriginalSalesOrder();this.salesOrderBeforePromotion.set(a)}let o=this.promotionCouponFactoryService.generateRedeemCouponDto(t,"Internal");this._httpService.post(fe.ValidateInternalCoupon,o).subscribe({next:a=>{switch(this._orderDataService.Data.Order.PromotionCoupon=t,this._orderDataService.Data.Order.PromotionNote=e,this._orderDataService.Data.Order.CouponType=1,a.Requirement?.Type){case 1:this.HandleDiscountPercentage(a);break;case 2:this.HandleDiscountAmount(a);break;case 3:this.handleCouponReturnAccess(a);break;case 4:this.handleCouponParkedDeletionAccess();break;case 5:this.handleFullAccessCoupon();break;case 6:this.handleDeleteItemCoupon();break}this._coupon.set(a),this.isShowToastrInApplyCoupon.set(!1)},error:a=>{this.removeAppliedCoupon(!1),this.isShowToastrInApplyCoupon.set(!1)}})}setCouponOnEdit(t){t&&S.IsNotEmpty(t?.Type)&&(this._coupon.set(t),this.generateOriginalSalesOrderOnEdit())}generateOriginalSalesOrderOnEdit(){let t=Ie(qe,this._orderDataService.Data);t.Order.PromotionCoupon=null,t.Order.PromotionNote=null,t.Order.Discount=0,t.Order.DiscountAmount=0,this.salesOrderBeforePromotion.set(t)}copyOriginalSalesOrder(){return Ie(qe,this._orderDataService.Data)}HandleDiscountPercentage(t,e=!1){t.Amount>0?t.Requirement?.MaximumDiscount>0?this.applyConfigMaxDiscount(t,e):t.Requirement?.FullPriceProductOnly?this.applyFullPriceDisc(t,e):this.applyDiscountPercentage(t,e):(this.role.Discount=e?this.originalRoleData.Discount:!0,this._userRoleService.pushNewValue(this.role))}applyFullPriceDisc(t,e=!1){let i=this._orderDataService.Data;if(e)this.filterItemWithCouponDisc(i.CartItems).length>0?(i.CartItems=this.resetItemsDisc(i.CartItems),this._orderDataService.pushNewValue()):this.applyDiscountPercentage(t,e);else if(this.filterItemWithDisc(i.CartItems).length>0){let a=this.filterItemWithoutDisc(i.CartItems);a.length>0?this.applyConfigItemsScope(t,a).subscribe(h=>{let E=this.applyItemsDisc(h,t);i.CartItems=this.updateCartItems(E,t),this._orderDataService.pushNewValue(i),this.showToastr(t)}):(this.removeAppliedCoupon(!1),this._orderDataService.pushNewValue(),this.toastr.error("No products in the cart qualify for coupon use","Coupon Not Applied"))}else this.applyDiscountPercentage(t,e)}updateCartItems(t,e){let o=this._orderDataService.Data.CartItems.map((a,h)=>{let E=t.find(F=>this.isSameCartItem(F,a));return E||a});return o=this.applyOneOfFirstQuantity(o,e),o}applyOneOfFirstQuantity(t,e){if(e?.Requirement?.RequirementDiscountType==2){let i=t.findIndex(o=>o.CouponDiscount>0);if(t[i]?.Quantity>1){let o=ti(Re,t[i]);o.Quantity=1,o.ID=S.GuidEmpty,t[i].Quantity=t[i].Quantity-1,t[i].CouponDiscount=0,t[i].Discount=0,t[i].DiscountAmount=0,t.push(o)}}return t}filterItemWithDisc(t){return t.filter(i=>i.Discount>0||i.DiscountAmount>0||i.Price!=i?.Variant?.UnitPrice||S.IsNotEmpty(i.PriceBookID)||i.PriceTypeID==2)}filterItemWithoutDisc(t){return t.filter(i=>this.itemConditionFullPriceOnly(i))}filterItemWithCouponDisc(t){return t.filter(i=>i.CouponDiscount>0)}applyDiscountPercentage(t,e=!1){let i=this._orderDataService.Data.Order.CustomerDiscountRate,o=t.Amount;if(e){let a=this._orderDataService.Data;this._orderDataService.Data.Order.Discount=0,a.CartItems=this.resetItemsDisc(a.CartItems),this._orderDataService.pushNewValue(a)}else o>=i?t.ApplyToProduct?.length>0?this.applyDiscountRequiredItems(t):(this._orderDataService.Data.Order.Discount=t.Amount,this._orderDataService.pushNewValue(),this.showToastr(t)):(this.toastr.warning("Member discount is applied because member discount is greater than Coupon Discount","Warning"),this.removeAppliedDiscountOnCustomerChange())}applyDiscountRequiredItems(t){let i=this._orderDataService.Data.CartItems.filter(o=>t.ApplyToProduct.map(a=>a.ID)?.includes(o.VariantID));this.applyConfigItemsScope(t,i).subscribe(o=>{let a=o.map(E=>(E.Discount=t.Amount,E.CouponDiscount=t.Amount,E)),h=this.updateCartItems(a,t);this._orderDataService.Data.CartItems=h,this._orderDataService.pushNewValue(),this.showToastr(t)})}showToastr(t){let e=t?.Requirement?.Notify;S.IsNotEmpty(e)&&this.isShowToastrInApplyCoupon()&&this.toastr.success(e,"Coupon Applied")}applyConfigMaxDiscount(t,e=!1){let i=this._orderDataService.Data.CartItems;t.Requirement?.FullPriceProductOnly&&(i=i.filter(o=>this.itemConditionFullPriceOnly(o))),this.applyConfigItemsScope(t,i,e).subscribe(o=>{this.applyMaxDiscount(t,o,e)})}applyConfigItemsScope(t,e,i=!1){let o=t.Requirement?.RequirementDiscountType;return(o==1||o==2)&&i==!1?this.dialog.open(Sn,{data:{coupon:t,cartItems:e},id:"modal-coupon-selected-item"}).afterClosed().pipe(ve(h=>{let Ce=this._orderDataService.Data.CartItems.some(Te=>Te.CouponDiscount>0);!h&&!Ce&&this.removeAppliedDiscountOnCustomerChange()}),ie(h=>!!h)):hi(e)}applyMaxDiscount(t,e,i=!1){let o=this._invoiceCalculatorService.calculateGrossTotal(e),a=this._orderDataService.Data,h=o*t.Amount/100,E=t.Requirement?.MaximumDiscount,F=e;h>=E?(a.Order.DiscountAmount=i?0:E,F=this.resetItemsDisc(e)):(a.Order.DiscountAmount=0,F=i?this.resetItemsDisc(e):this.applyItemsDisc(e,t)),a.CartItems=this.updateCartItems(F,t),this._orderDataService.pushNewValue(a),i||this.showToastr(t)}resetItemsDisc(t){return this.coupon?.Requirement?.RequirementDiscountType==2?t=this.resetConfigOneOfFirstQuantity(t):t=t.map(e=>(e.CouponDiscount>0&&(e.Discount=0,e.DiscountAmount=0,e.CouponDiscount=0),e)),t}resetConfigOneOfFirstQuantity(t){let e=t.findIndex(i=>i.CouponDiscount>0);if(e!==-1){let i=t.findIndex(o=>o.CouponDiscount==0&&t[e]?.VariantID==o?.VariantID);i!==-1?(t.splice(e,1),t[i].Quantity+=1):(t[e].CouponDiscount=0,t[e].Discount=0,t[e].DiscountAmount=0)}return t}applyItemsDisc(t,e){return e.ApplyToProduct?.length>0?t=this.applyDiscByVariant(t,e):t=t.map(i=>(i.Discount=e.Amount,i.CouponDiscount=e.Amount,i)),t}applyDiscByVariant(t,e){return t=t.map(i=>(e.ApplyToProduct.find(a=>a.ID==i.VariantID)&&this.itemConditionFullPriceOnly(i)&&(i.Discount=e.Amount,i.CouponDiscount=e.Amount),i)),t}itemConditionFullPriceOnly(t){return(t.Discount==0||t.CouponDiscount>0)&&t.DiscountAmount==0&&t.Price==t?.Variant?.UnitPrice&&S.IsEmpty(t.PriceBookID)}HandleDiscountAmount(t,e=!1){t.Amount>0?(t.ApplyToProduct?.length>0?this.applyDiscountInItem(t,e):(e?this._orderDataService.Data.Order.DiscountAmount=0:(this._orderDataService.Data.Order.DiscountAmount=t.Amount,this.showToastr(t)),this._orderDataService.pushNewValue()),this.resetCustomerPoint(e)):(this.role.Discount=e?this.originalRoleData.Discount:!0,this._userRoleService.pushNewValue(this.role))}applyDiscountInItem(t,e=!1){let i=this._orderDataService.Data;if(e)i.CartItems=this.resetItemsDisc(i.CartItems);else{let a=i.CartItems.filter(h=>t.ApplyToProduct.map(E=>E.ID)?.includes(h.VariantID));this.applyConfigItemsScope(t,a,e).subscribe(h=>{let E=h.map(F=>(F.DiscountAmount=t.Amount,F.CouponDiscount=t.Amount,F));i.CartItems=this.updateCartItems(E,t),this._orderDataService.pushNewValue(i),this.showToastr(t)})}}resetCustomerPoint(t){if(!t){let e=this._orderDataService.Data;e.Order.PointUsed=0}}handleCouponReturnAccess(t){let e=Ie(Ot,this.role);e.Return=!0,this._userRoleService.pushNewValue(e),this.isShowToastrInApplyCoupon()&&this.toastr.success("You got access to return a sales transaction!","Coupon Applied")}handleCouponParkedDeletionAccess(){let t=Ie(Ot,this.role);t.ParkedDeletionAuthorized=!0,this._userRoleService.pushNewValue(t),this.isShowToastrInApplyCoupon()&&this.toastr.success("You Have Access to delete park and delete item when retrieve!","Coupon Applied")}handleFullAccessCoupon(){let t=Ie(Ot,this.role);t.UnitPriceEditor=!0,t.Discount=!0,t.Return=!0,t.Tax=!0,t.NumberEditor=!0,t.DateEditor=!0,t.PricebookSelector=!0,t.DeleteItem=!0,t.ParkedDeletionAuthorized=!0,this._userRoleService.pushNewValue(t),this.isShowToastrInApplyCoupon()&&this.toastr.success("You now have Full Access for this Order!","Coupon Applied")}handleDeleteItemCoupon(){let t=Ie(Ot,this.role);t.DeleteItem=!0,this._userRoleService.pushNewValue(t),this.isShowToastrInApplyCoupon()&&this.toastr.success("You Have Access to delete item","Coupon Applied")}removeAppliedCoupon(t=!0){this._userRoleService.pushNewValue(this.originalRoleData),this._orderDataService.pushNewValue(this.salesOrderBeforePromotion()),this.salesOrderBeforePromotion.set(null),this._coupon.set(null),t&&this.toastr.warning("Coupon Cancelled","Warning")}resetCouponOnNewTransaction(){this._userRoleService.pushNewValue(this.originalRoleData),this._coupon.set(null)}removeAppliedDiscountOnCustomerChange(){if(this.coupon)switch(this.coupon.Requirement?.Type){case 1:this.HandleDiscountPercentage(this._coupon(),!0),this.removeAppliedCouponOnCustomerChange();break;case 2:this.HandleDiscountAmount(this._coupon(),!0),this.removeAppliedCouponOnCustomerChange();break}}removeAppliedCouponOnCustomerChange(){if(this.coupon){let t=this._orderDataService.Data;t.Order.PromotionCoupon=null,t.Order.PromotionNote=null,this._coupon.set(null),this._userRoleService.pushNewValue(this.originalRoleData),this._orderDataService.pushNewValue(t)}}isSameCartItem(t,e){return t.VariantID===e.VariantID&&t.Quantity===e.Quantity&&t.Price===e.Price&&t.Discount===e.Discount&&t.PriceBookID===e.PriceBookID}static \u0275fac=function(e){return new(e||n)(N(Le),N(V),N(ce),N(J),N(ge),N(jr))};static \u0275prov=Ge({token:n,factory:n.\u0275fac,providedIn:"root"})};var di=class n{constructor(t,e,i,o,a,h,E,F,Ce,Te,Be){this.customerHttpService=t;this.salesOrderService=e;this.pageInitialService=i;this.shoppingCartService=o;this.invoiceCalculatorService=a;this.orderProcessorService=h;this.toastr=E;this.promotionCouponService=F;this.promotionCouponV2Service=Ce;this.httpService=Te;this.registerService=Be}customerId;customerData;_isCustomerVerfiedOtp=!1;get isCustomerVerfiedOtp(){return this._isCustomerVerfiedOtp}addCustomerById(t){return new Po(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(Ve(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,a=i.find(h=>h.ID===o);S.IsNotEmpty(t.SalesID)&&a&&(e.Order.SalesID=t.SalesID)}setCustomerData(t){let e=this.salesOrderService.Data;if(t.EntityID==S.GuidEmpty)this.customerData=t,this.customerData.DebtCalculated=t.Debt;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,this.customerData.DebtCalculated=t.Debt}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(a=>{a.ID===t.PricebookID&&o.Quantity>=a.MinimumQuantity&&(o=this.shoppingCartService.applyPricebookToItem(o,a))}),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.promotionCouponV2Service.appliedCoupon(),i=this.salesOrderService.Data.Order.Discount;e&&e?.Type=="Percentage"?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 so,this.customerData=new so,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,a=t*o,h=i.RedeemableAmount;a>h&&(o>0?(t=Math.ceil(h/o),a=h):(t=0,a=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=a,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(ve(()=>this._isCustomerVerfiedOtp=!0))}verifyPin(t,e){return this.httpService.post("/API/pos/VerifyPin",{PIN:t,CustomerID:e}).pipe(ve(()=>this._isCustomerVerfiedOtp=!0))}verifyWhatsAppOtp(t,e){return this.httpService.post("/API/otp/verifywhatsapp",{Number:t,OTP:e}).pipe(ve(()=>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)(N(dt),N(V),N(A),N(de),N(ge),N(U),N(J),N(mt),N(Mt),N(Le),N(G))};static \u0275prov=Ge({token:n,factory:n.\u0275fac,providedIn:"root"})};var yl=["stepper"];function xl(n,t){n&1&&p(0,"Points")}function Il(n,t){n&1&&p(0,"Verify")}function Pl(n,t){n&1&&p(0,"Confirm")}var mi=class n{dialogRef=$(B);outletRegisterService=$(G);pageInitialService=$(A);customerHttpService=$(dt);customerService=$(di);orderService=$(V);toastr=$(J);modalConfig;enabledLoyaltyPoint=R(!1);stepper;pointUsed=0;pointBalance=R(0);redeemPointValue=R(0);email=R(null);phone=R(null);contactToResend=R(null);verifyType=R(null);clearPin=R(!1);selectedTab=R(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 H,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,a=t.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,h=this.pointUsed*a;h>i&&(o=Math.ceil(i/a),h=i),(S.IsNotEmpty(e.Order.PointUsed)?e.Order.PointUsed:0)!=o&&(e.Order.PointUsed=o||0,e.Order.DiscountAmount=h,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=M({type:n,selectors:[["modal-redeem-point"]],viewQuery:function(e,i){if(e&1&&Se(yl,5),e&2){let o;ye(o=xe())&&(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=y();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),Z(7,xl,1,0,"ng-template",6),r(8,"div",7)(9,"point-step",8),_("onVerify",function(h){return u(o),f(i.onVerify(h))}),O("pointUsedChange",function(h){return u(o),D(i.pointUsed,h)||(i.pointUsed=h),f(h)}),_("onRedeem",function(){return u(o),f(i.onRedeem())}),l()()(),r(10,"mat-step",9),Z(11,Il,1,0,"ng-template",6),r(12,"div",7)(13,"verify-step",10),_("resendCode",function(){return u(o),f(i.onResendCode())})("onVerify",function(h){return u(o),f(i.onVerifyCode(h))}),l()()(),r(14,"mat-step",11),Z(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())}),l()()()()()()()()}e&2&&(m("preventEnterEvent",!0)("config",i.modalConfig),s(4),m("linear",!0)("selectedIndex",i.selectedTab()),s(2),m("editable",!0),Vo("aria-labelledby",i.selectedTab()==2?"stepDisabled":""),s(3),m("isVerifyEnabled",i.enabledLoyaltyPoint()),P("pointUsed",i.pointUsed),m("pointBalance",i.pointBalance())("email",i.email())("phone",i.phone()),s(),m("editable",!1),s(3),m("type",i.verifyType())("contact",i.contactToResend())("clearPin",i.clearPin()),s(4),m("pointUsed",i.pointUsed)("redeemPointValue",i.redeemPointValue())("showCancelBtn",i.selectedTab()==2))},dependencies:[X,be,j,ua,da,pa,ma,_n,vn,bn],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 Dl(n,t){if(n&1){let e=y();r(0,"div",18),_("click",function(){u(e);let o=c(2);return f(o.onShowModalRedeem())}),r(1,"span"),v(2,"i",19),l(),r(3,"span"),p(4),b(5,"number"),l()()}if(n&2){let e=c(2);s(4),x(" ",I(5,1,e.pointUsed)," Points redeemed ")}}function Ol(n,t){if(n&1){let e=y();r(0,"tab",3)(1,"div",6)(2,"div",7)(3,"label",8),p(4,"Discount %"),l()(),r(5,"div",9)(6,"input",10),O("ngModelChange",function(o){u(e);let a=c();return D(a.discount1,o)||(a.discount1=o),f(o)}),l(),r(7,"span",11),p(8,"%"),l(),r(9,"span",12),p(10,"+"),l(),r(11,"input",13),O("ngModelChange",function(o){u(e);let a=c();return D(a.discount2,o)||(a.discount2=o),f(o)}),l(),r(12,"span",11),p(13,"%"),l()()(),r(14,"div",14)(15,"div",7)(16,"label",8),p(17),l()(),r(18,"div",15)(19,"input",16),O("ngModelChange",function(o){u(e);let a=c();return D(a.discountAmount,o)||(a.discountAmount=o),f(o)}),l(),g(20,Dl,6,3,"div",17),l()()()}if(n&2){let e=c();m("active",e.tabActive=="Discount"),s(6),P("ngModel",e.discount1),s(5),P("ngModel",e.discount2),s(6),x("Discount ",e.currencySymbol),s(2),m("disabled",e.pointUsed&&e.pointUsed>0),P("ngModel",e.discountAmount),s(),C(e.pointUsed&&e.pointUsed>0?20:-1)}}function Ml(n,t){if(n&1){let e=y();r(0,"tab",4)(1,"div",6)(2,"div",7)(3,"label",8),p(4,"Tax"),l()(),r(5,"div",9)(6,"ng-select",20),_("change",function(o){u(e);let a=c();return f(a.updateTax(o))}),l()()(),r(7,"div",14)(8,"div",7)(9,"label",8),p(10,"Surcharge"),l()(),r(11,"div",9)(12,"input",21),O("ngModelChange",function(o){u(e);let a=c();return D(a.surcharge,o)||(a.surcharge=o),f(o)}),l(),r(13,"span",11),p(14,"%"),l()()()()}if(n&2){let e=c();s(6),m("clearable",!1)("ngModel",e.salesOrder.Order.TaxTypeID)("items",e.taxes),s(6),P("ngModel",e.surcharge),m("max",100)("min",-100)}}function wl(n,t){if(n&1){let e=y();r(0,"tab",5)(1,"div",6)(2,"div",22)(3,"strong"),p(4,"Discount After Tax"),l()(),r(5,"div",23)(6,"input",24),O("ngModelChange",function(o){u(e);let a=c();return D(a.discountAfterTax,o)||(a.discountAfterTax=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onDiscountAfterTaxChange())}),l()()(),r(7,"div",25)(8,"div",22)(9,"label",8),p(10,"Discount Calculator"),l()(),r(11,"div",26)(12,"input",27),O("ngModelChange",function(o){u(e);let a=c();return D(a.discounts[0],o)||(a.discounts[0]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),l(),r(13,"span"),p(14," %"),l(),r(15,"span",12),p(16,"+"),l(),r(17,"input",28),O("ngModelChange",function(o){u(e);let a=c();return D(a.discounts[1],o)||(a.discounts[1]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),l(),r(18,"span"),p(19," %"),l(),r(20,"span",12),p(21,"+"),l(),r(22,"input",29),O("ngModelChange",function(o){u(e);let a=c();return D(a.discounts[2],o)||(a.discounts[2]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),l(),r(23,"span"),p(24," %"),l()()()()}if(n&2){let e=c();s(6),P("ngModel",e.discountAfterTax),s(6),P("ngModel",e.discounts[0]),s(5),P("ngModel",e.discounts[1]),s(5),P("ngModel",e.discounts[2])}}var ui=class n{constructor(t,e,i,o,a,h,E,F,Ce,Te){this.dialogRef=t;this.orderService=e;this.invoiceCalculatorService=i;this.pageInitialService=o;this.roleService=a;this.customerHttpService=h;this.orderProcessorService=E;this.promotionCouponService=F;this.dialog=Ce;this.data=Te;let Be=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=Be?.ApplicationLoyalty?.PreferedPayment,this.tabActive=this.data?.tabIndexActive,this.isEditOrder=this.orderProcessorService.Data.posState==2,this.customer=h.Data,this.initDiscountAndTax(),this.initAvailablePoint(),this.initTabLoyaltyTitle()}modalConfig=new H;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,a=S.FilterByID(o,i);if(S.IsNotEmpty(a)&&a.CalculationTypeID==0){let h=1+a.Rate/100,E=e*h;this.discountAmount=(E-(E-this.discountAfterTax))/h}}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(mi)}static \u0275fac=function(e){return new(e||n)(d(B),d(V),d(ge),d(A),d(ce),d(dt),d(U),d(mt),d(re),d(Oe))};static \u0275cmp=M({type:n,selectors:[["POS-modal-discount"]],decls:7,vars:4,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],[3,"onTabChange"],["tabTitle","Discount",3,"active"],["matTooltipPosition","above","tabTitle","Tax"],["tabTitle","Calculator"],[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"],["role","button",3,"click"],[1,"fa-solid","fa-info-circle","ms-2"],["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"],[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(a){return i.onTabChange(a)}),g(4,Ol,21,7,"tab",3),g(5,Ml,15,6,"tab",4),g(6,wl,25,4,"tab",5),l()()()()),e&2&&(m("config",i.modalConfig),s(4),C(i.userRole.Discount?4:-1),s(),C(i.userRole.Tax?5:-1),s(),C(i.userRole.Discount?6:-1))},dependencies:[X,be,Y,q,oe,on,oa,na,j,gt,ct,Ke,K],encapsulation:2})};var xn=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=Wt({type:n});static \u0275inj=Ht({imports:[X,be,Je,j,Zt,gt,sa,on,Ke,hn,Ze,wr,Yt,qt,lr,Hi,ga,Pt,Dt,_a,ln,gt,ui,At,ei,ii,ea]})};var In=class n{constructor(t,e,i,o,a,h,E){this.orderProcessorService=t;this.posDataService=e;this.signalBroadCast=i;this.calculatorService=o;this.OrderHttpService=a;this.localDataService=h;this.posService=E;this.newSale=new je}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(U),d(V),d(Ji),d(ge),d(Me),d(Ye),d(A))};static \u0275cmp=M({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"),v(4,"i",3),p(5," Order Upload Fail! "),l()()(),r(6,"div",4)(7,"div",5)(8,"div",6)(9,"p",7),p(10," Slow Connection Detected, Check the customer invoice list first. If the transaction isn't there, click the 'Retry' button. "),l()()(),r(11,"div",8)(12,"div",9)(13,"button",10),_("click",function(){return i.retrySubmit()}),p(14," Retry Upload "),l()()()(),r(15,"div",11)(16,"div",12)(17,"div",13)(18,"button",14),_("click",function(){return i.saveOffline()}),v(19,"i",15),p(20,"Save Offline "),l()()()()())},dependencies:[Ke,se],encapsulation:2})};var Da=(()=>{let t=class t{constructor(){this.emailRegex=S.emailRegex,this.phoneNumberRegex=S.phoneNumberRegex}validate(i){let o=this.emailRegex,a=this.phoneNumberRegex,h=o.test(i.value),E=a.test(i.value);if(h||E||i.value=="")return null;{let F="Please input a valid email or phone number";return E?F="Please input a valid email":h&&(F="Please input a valid phone number"),{invalidEmailOrPhoneNumber:{value:i.value,errMessage:F}}}}};t.\u0275fac=function(o){return new(o||t)},t.\u0275dir=No({type:t,selectors:[["","pOSIsInvalidEmailOrPhoneNumber",""]],features:[lt([{provide:Xo,useExisting:t,multi:!0}])]});let n=t;return n})();function Tl(n,t){n&1&&(r(0,"div",1)(1,"h4",2),p(2," For use this feature you must register first!"),v(3,"br"),p(4," Click the link below "),l()(),r(5,"a",3),p(6,"more information"),l(),p(7," > "))}function El(n,t){if(n&1){let e=y();r(0,"div",4)(1,"div",5)(2,"span",6),v(3,"i",7),l(),v(4,"input",8),r(5,"button",9),p(6,"Copy to Clipboard"),l()()(),r(7,"div",10)(8,"div",11)(9,"span",12),v(10,"i",13),l(),v(11,"input",14),r(12,"button",15),_("click",function(){u(e);let o=c();return f(o.onSendViaWhatsApp())}),p(13,"Send via WhatsApp"),l()()()}if(n&2){let e=c();s(4),m("value",e.data.link),s(),m("cdkCopyToClipboard",e.data.link),s(6),m("formControl",e.whatsAppNumberCtrl),s(),m("disabled",e.whatsAppNumberCtrl.invalid)}}var Mi=class n{constructor(t,e,i){this._dialogRef=t;this._toast=e;this.data=i}modalConfig=new H;whatsAppNumberCtrl;ngOnInit(){this.modalConfig.title="Midtrans Payment Link",this.modalConfig.hideFooter=!0,this.modalConfig.customWidth="500px",this.initWaNumberCtrl()}initWaNumberCtrl(){this.whatsAppNumberCtrl=new ir(null,[yi.pattern("^[0-9]*$"),yi.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(B),d(J),d(Oe))};static \u0275cmp=M({type:n,selectors:[["POS-modal-generate-link"]],standalone:!1,decls:4,vars:2,consts:[[3,"onOk","onCancel","onClose","config"],[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){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.close()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content"),g(2,Tl,8,0)(3,El,14,4),l()()),e&2&&(m("config",i.modalConfig),s(2),C(i.data.link==null||i.data.link==""?2:3))},dependencies:[Y,q,St,j,Ca],encapsulation:2})};var Vl=n=>({"rounded-0 rounded-start-2":n}),Al=(n,t)=>({"bg-gradient-warning":n,"bg-gradient-danger":t}),Ll=n=>({offline:n}),Fl=n=>({"ms-2":n}),Bl=(n,t)=>({ID:n,Template:t}),jl=(n,t,e)=>({InvoiceID:n,OutID:t,Template:e}),Hl=n=>({ID:n,Print:1,Printer:"Normal"}),Ul=n=>({ID:n}),Wl=(n,t)=>({cursor:n,opacity:t});function Ql(n,t){if(n&1&&(r(0,"a",41),p(1,"Delivery Order"),l()),n&2){let e=c(3);m("queryParams",_e(1,Bl,e.completeData.OutDeliveryID,e.outletRegister.PrintTemplate.ID))}}function $l(n,t){if(n&1&&(r(0,"a",42),p(1,"Invoice & Delivery Order"),l()),n&2){let e=c(3);m("queryParams",Si(1,jl,e.completeData.ObjectID,e.completeData.OutDeliveryID,e.outletRegister.PrintTemplate.ID))}}function ql(n,t){if(n&1&&(r(0,"a",43),p(1,"Invoice (No Price)"),l()),n&2){let e=c(3);m("href",e.getInvoicePrintURL(!0),nt)}}function Gl(n,t){if(n&1&&(r(0,"a",44),p(1,"Packing Slip"),l()),n&2){let e=c(3);m("queryParams",T(1,Hl,e.completeData.OutDeliveryID))}}function zl(n,t){if(n&1&&(r(0,"div",28),v(1,"button",39),r(2,"div",40),g(3,Ql,2,4,"a",41),g(4,$l,2,5,"a",42),g(5,ql,2,1,"a",43),g(6,Gl,2,3,"a",44),l()()),n&2){let e=c(2);s(3),C(e.completeData.OutDeliveryID?3:-1),s(),C(e.completeData.OutDeliveryID?4:-1),s(),C(e.completeData?5:-1),s(),C(e.completeData.OutDeliveryID?6:-1)}}function Jl(n,t){n&1&&(r(0,"div",30)(1,"div",34)(2,"p",45),p(3," Transaction saved to your browser's local storage. Please upload when connection is restored! "),l()()())}function Kl(n,t){if(n&1){let e=y();r(0,"div",31)(1,"div",46)(2,"div",47),_("click",function(){u(e);let o=c(2);return f(o.changeReceiptContact())}),v(3,"i"),l(),r(4,"input",48),_("ngModelChange",function(o){u(e);let a=c(2);return f(a.isPhoneOrEmail(o))}),l()(),r(5,"div",49)(6,"button",50),_("click",function(){u(e);let o=c(2);return f(o.sendReceiptToContact())}),p(7," Send Receipt "),l()()()}if(n&2){let e=c(2);s(3),le(e.receiptIcon+" fs-4"),s(),m("formControl",e.customerContact),s(2),m("disabled",e.customerContact.invalid)}}function Yl(n,t){if(n&1&&(r(0,"small",32),p(1),l()),n&2){let e=c(2);s(),x(" ",e.customerContact.errors==null||e.customerContact.errors.invalidEmailOrPhoneNumber==null?null:e.customerContact.errors.invalidEmailOrPhoneNumber.errMessage," ")}}function Zl(n,t){if(n&1){let e=y();r(0,"button",51),_("click",function(){u(e);let o=c(2);return f(o.onRetry())}),p(1," Retry Upload "),l()}}function Xl(n,t){if(n&1){let e=y();r(0,"div",53)(1,"button",54),_("click",function(){u(e);let o=c(3);return f(o.generateLink())}),v(2,"i",55),p(3,"Generate Payment Link "),l()()}}function es(n,t){if(n&1){let e=y();r(0,"div",53)(1,"button",56),_("click",function(){u(e);let o=c(3);return f(o.verifyPaymentSettlement())}),v(2,"i",57),p(3,"Verify Payment Settlement "),l()()}}function ts(n,t){if(n&1&&(r(0,"div",38)(1,"div",52),g(2,Xl,4,0,"div",53),g(3,es,4,0,"div",53),l()()),n&2){let e=c(2);s(2),C(e.completeData.PaymentStateID==1?2:-1),s(),C(e.isNotEmpty(e.paymentGatewayService.getTransactionId())?3:-1)}}function is(n,t){if(n&1){let e=y();r(0,"div",7)(1,"div",24)(2,"div",25)(3,"h2"),v(4,"i",26),p(5," Sell Complete "),r(6,"small",27),p(7),l()(),r(8,"div"),g(9,zl,7,4,"div",28),l()()(),r(10,"div",13)(11,"div",29),g(12,Jl,4,0,"div",30)(13,Kl,8,4,"div",31),g(14,Yl,2,1,"small",32),r(15,"div",33)(16,"div",34)(17,"div",35),g(18,Zl,2,0,"button",36),r(19,"button",37),_("click",function(){u(e);let o=c();return f(o.newSale())}),p(20," New Sale (F8) "),l()()()()()(),g(21,ts,4,2,"div",38),l()}if(n&2){let e=c();s(),m("ngClass",_e(9,Al,(!e.isOrderDateNow||e.completeData.PaymentStateID<3)&&e.completeData.PaymentStateLabel!="Offline",e.completeData.PaymentStateLabel=="Offline")),s(6),x(" (",e.completeData.PaymentStateLabel,")"),s(2),C(e.completeData.PaymentStateLabel=="Offline"?9:-1),s(2),m("ngClass",T(12,Ll,e.completeData.PaymentStateLabel=="Offline")),s(),C(e.completeData.PaymentStateLabel=="Offline"?12:13),s(2),C(e.customerContact!=null&&e.customerContact.invalid&&(e.customerContact!=null&&e.customerContact.dirty||e.customerContact!=null&&e.customerContact.touched)?14:-1),s(4),C(e.completeData.PaymentStateLabel=="Offline"&&!e.isSuccessRetrySubmit()?18:-1),s(),m("ngClass",T(14,Fl,e.completeData.PaymentStateLabel=="Offline")),s(2),C(e.isOnline&&(e.completeData==null?null:e.completeData.PaymentStateID)==1||e.isNotEmpty(e.paymentGatewayService.getTransactionId())?21:-1)}}function ns(n,t){if(n&1){let e=y();r(0,"app-retry",58),_("newSale",function(){u(e);let o=c();return f(o.newSale())}),l()}}function os(n,t){if(n&1&&(r(0,"a",11),p(1),l()),n&2){let e=c();m("queryParams",T(2,Ul,e.completeData.ObjectID)),s(),x(" Invoice #",e.completeData==null?null:e.completeData.InvoiceNumber," ")}}function rs(n,t){if(n&1&&(r(0,"span",12),p(1),l()),n&2){let e=c();s(),x(" Invoice #",e.completeData==null?null:e.completeData.InvoiceNumber," ")}}function as(n,t){if(n&1&&(p(0),b(1,"number")),n&2){let e=c().$implicit;Ee(" ",e.CurrencySymbol," ",I(1,2,e.Amount)," ")}}function ls(n,t){n&1&&p(0," - ")}function ss(n,t){if(n&1&&(r(0,"div",59)(1,"div",60),p(2),l(),r(3,"div",61),g(4,as,2,4)(5,ls,1,0),l()()),n&2){let e=t.$implicit,i=c(2);s(2),w(e.Label),s(2),C(i.role.PriceVisible?4:5)}}function cs(n,t){if(n&1&&(r(0,"div",13),ee(1,ss,6,2,"div",59,pe),l()),n&2){let e=c();s(),te(e.itemSummary)}}function ps(n,t){if(n&1&&(r(0,"div",62)(1,"div",64),p(2),l(),r(3,"div",65),p(4),b(5,"number"),l()()),n&2){let e=t.$implicit,i=t.$index,o=c(2);s(),m("hidden",!o.role.PriceVisible),s(),Ee(" ",e.Label,": ",e.CurrencySymbol," "),s(),m("hidden",!o.role.PriceVisible)("ngClass",i+1===o.amountSummary.length?"amount":""),s(),x(" ",I(5,6,e.Amount)," ")}}function ds(n,t){if(n&1&&(r(0,"div",62)(1,"div",64),p(2),l(),r(3,"div",66),p(4),b(5,"number"),l()()),n&2){let e=t.$implicit,i=c(3);s(),m("hidden",!i.role.PriceVisible),s(),Ee(" ",e.Label,": ",e.CurrencySymbol," "),s(),m("hidden",!i.role.PriceVisible),s(),x(" ",I(5,5,e.Amount)," ")}}function ms(n,t){if(n&1&&(r(0,"div",63),ee(1,ds,6,7,"div",62,pe),l()),n&2){let e=c(2);s(),te(e.paymentSummary)}}function us(n,t){if(n&1&&(r(0,"div",14),ee(1,ps,6,8,"div",62,pe),g(3,ms,3,0,"div",63),l()),n&2){let e=c();s(),te(e.amountSummary),s(2),C((e.paymentSummary==null?null:e.paymentSummary.length)>0?3:-1)}}function fs(n,t){if(n&1&&(r(0,"div",15)(1,"div",67)(2,"p",68),p(3,"INVALID AMOUNT CHARGE, CORRECT AMOUNT"),l(),r(4,"P",69),p(5),b(6,"number"),l()()()),n&2){let e=c();s(5),x("",I(6,1,e.completeData==null?null:e.completeData.Final)," ")}}function gs(n,t){if(n&1){let e=y();r(0,"a",70),_("click",function(o){u(e);let a=c();return f(a.isGlobalPrintEnabled()?null:o.preventDefault())}),v(1,"i",71),l()}if(n&2){let e=c();m("href",e.getInvoicePrintURL(!1),nt)("matTooltip",e.isGlobalPrintEnabled()?"Print in New Tab":"Required Global Print Role")("ngStyle",_e(3,Wl,e.isGlobalPrintEnabled()?"pointer":"default",e.isGlobalPrintEnabled()?"1":"0.5"))}}function Cs(n,t){if(n&1&&(r(0,"div",7)(1,"div",9)(2,"h3",10),p(3,"Point Balance"),l()(),v(4,"div",72),l()),n&2){let e=c();s(4),m("innerHtml",e.completeData.LoyaltyPoint,Ut)}}function _s(n,t){if(n&1&&v(0,"pos-receipt",73),n&2){let e=c(2);m("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 hs(n,t){if(n&1&&v(0,"pos-receipt-a4",74),n&2){let e=c(3);m("data",t)("printTemplate",e.outletRegister.PrintTemplate)("config",e.posStorage.AppConfigJSON)("workOrderMode",!1)("stylesheet",e.posStorage.StylesSheet)}}function vs(n,t){if(n&1&&(g(0,hs,1,5,"pos-receipt-a4",74),b(1,"async")),n&2){let e,i=c(2);C((e=I(1,1,i.receiptTemplateA4$))?0:-1,e)}}function bs(n,t){if(n&1&&(g(0,_s,1,8,"pos-receipt",73),g(1,vs,2,3)),n&2){let e=c();C(e.receiptTemplate&&e.printMode==2?0:-1),s(),C(e.printMode==1?1:-1)}}function Ss(n,t){n&1&&(r(0,"div",23)(1,"h1"),p(2," Cannot generate print preview because of client-server amount Mismatch "),l()())}var Pn=class n{constructor(t,e,i,o,a,h,E,F,Ce,Te,Be,gi,Ci,Nt,to,_i,yo,io,xo,Qa,$a){this._posDataService=t;this._posService=e;this._orderProcessorService=i;this._OrderHttpService=o;this._PaymentHttpService=a;this._receiptService=h;this._outletService=E;this._toastr=F;this._onlineStatusService=Ce;this._matDialog=Te;this._signalBroadCast=Be;this._calculatorService=gi;this._userRoleService=Ci;this._router=Nt;this._receiptCalculatorService=to;this.datePipe=_i;this.decimalPipe=yo;this.paymentGatewayService=io;this.paymentHttpService=xo;this.shoppingCartService=Qa;this.roleService=$a;this.isGlobalPrintEnabled.set(this.roleService.global.Print)}whatsappSendReceiptService=$(mo);handleF8(){this.newSale()}salesOrder=new qe;receiptTemplate=null;receiptTemplateA4$;completeData=new Nr;printMode=2;outletRegister=new Wi;role;finalAmountDifferent=!1;amountSummary=[];itemSummary=[];paymentSummary=[];isOnline=!1;destroy$=new Q;get posStorage(){return this._posService.Data}currentSellState;isOrderDateNow;sellState=Pe;receiptIcon="fa-brands fa-whatsapp";customerContact=new bt;printOnPayment=R(!0);isSuccessRetrySubmit=R(!1);isGlobalPrintEnabled=R(!0);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(ie(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 zo&&(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,a=i,h=o.test(t),E=a.test(t);if(h)return this.receiptIcon="fa-solid fa-envelope","Email";if(E)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.forceToMax4DigitAfterDecimal(this._calculatorService.Data),o=t.ModuleSell.ToleranceAmount,a=e-i;if(a!=o&&a!=0){this.finalAmountDifferent=!0;let h=this.decimalPipe.transform(e);setTimeout(()=>{this._toastr.warning(`Final Amount should be ${h}! Use Print Receipt to print the correct Receipt!`,"Invalid Amount charged",{timeOut:1e4})},500)}else this.finalAmountDifferent=!1}}forceToMax4DigitAfterDecimal(t){let e=t;return this.isDecimalMoreThan4Digits(t)&&(e=parseFloat(t.toFixed(4))),e}isDecimalMoreThan4Digits(t){let e=t.toString(),i=e.indexOf(".");return i!==-1?e.substring(i+1).length>4:!1}checkOrderNumber(){let t=this.completeData.InvoiceNumberResult,e=S.IsNotEmpty(t)&&S.IsNotEmpty(t?.ProposedInvoiceNumber)&&t.ActualInvoiceNumber!=t.ProposedInvoiceNumber;this.completeData.InvoiceNumber!=this.salesOrder.Order.Number&&(this._toastr.warning(`Your ${e?"Order":"Transaction"} number is changed to ${this.completeData.InvoiceNumber}`,"Transaction Number Changed!"),this.salesOrder.Order.Number=this.completeData.InvoiceNumber),e&&this._toastr.warning("Your invoice number is changed to "+t.ActualInvoiceNumber,"Transaction Number Changed!")}generateLink(){this.posStorage.AppConfigJSON.PaymentConfigLink==!0&&this._matDialog.open(Mi);let t={InvoiceID:this.completeData.ObjectID};this._PaymentHttpService.generateLink(t).subscribe({next:e=>{this._matDialog.open(Mi,{data:{link:e.token.redirect_url}})},error:e=>{this._toastr.error(e.Message,"Couldn't generate link!")}})}newSale(){try{this._orderProcessorService.createNewTransactionInSameOutletRegister(!0),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",Fe.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$),it(t=>(t.Data.AfterSell=!0,t.Data)),vi(t=>{throw this._toastr.error(`Could not print in A4 format!
|
|
5
|
+
Printing in 8mm format instead!`,"Error!"),this.printReceiptMini(),t}),ve(()=>{this.printOnPayment()&&this.printWindow()}),jt(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),a=e.test(i);o?this.sendEmail():a&&this.sendReceiptByWhatsaap()}static \u0275fac=function(e){return new(e||n)(d(V),d(A),d(U),d(Me),d(po),d(Et),d(G),d(J),d(pt),d(re),d(Ji),d(ge),d(ce),d(vt),d(zi),d(We),d(K),d(Ki),d(po),d(de),d(yt))};static \u0275cmp=M({type:n,selectors:[["sell-complete"]],hostBindings:function(e,i){e&1&&_("keydown.F8",function(){return i.handleF8()},ut)},features:[lt([mo])],decls:30,vars:13,consts:[[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"],["target","_blank","routerLink","/menu/Orders/Orders/Customer_Invoice/Info",1,"text-dark","fst-italic",3,"queryParams"],[1,"text-dark","fst-italic"],[1,"card-body"],[1,"card-footer","bg-white"],[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",1,"btn","btn-outline-secondary","d-flex","align-items-center","justify-content-center","fs-5","border-start-0",2,"width","3rem",3,"href","matTooltip","ngStyle"],[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"],["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"],[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"],[1,"row","my-1"],[1,"col-8"],[1,"col-4","text-end"],[1,"d-flex","justify-content-end",2,"line-height","30px"],[1,"border-top"],[1,"text-end",3,"hidden"],[1,"text-end","w-50",3,"hidden","ngClass"],[1,"text-end","w-50",3,"hidden"],[1,"text-end"],[1,"fw-bold"],[1,"text-danger",2,"font-size","38px"],["target","_blank","matTooltipPosition","above",1,"btn","btn-outline-secondary","d-flex","align-items-center","justify-content-center","fs-5","border-start-0",2,"width","3rem",3,"click","href","matTooltip","ngStyle"],[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){e&1&&(r(0,"section",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"h1",4),p(5,"Order Complete"),l()()(),r(6,"div",5)(7,"div",6),g(8,is,22,16,"div",7)(9,ns,1,0,"app-retry"),l(),r(10,"div",8)(11,"div",7)(12,"div",9)(13,"h3",10),g(14,os,2,4,"a",11)(15,rs,2,1,"span",12),l()(),g(16,cs,3,0,"div",13),g(17,us,4,1,"div",14),g(18,fs,7,3,"div",15),r(19,"div",16)(20,"div",17)(21,"div",18)(22,"button",19),_("click",function(){return i.print()}),v(23,"i",20),p(24,"Print Receipt "),l()(),g(25,gs,2,6,"a",21),l()()(),g(26,Cs,5,1,"div",7),l()()()(),r(27,"div",22),g(28,bs,2,2)(29,Ss,3,0,"div",23),l()),e&2&&(s(8),C(i.currentSellState==i.sellState.IsComplete?8:9),s(6),C(i.isOnline&&i.completeData.ObjectID?14:15),s(2),C(i.itemSummary?16:-1),s(),C(!i.finalAmountDifferent&&i.role.PriceVisible?17:-1),s(),C(i.finalAmountDifferent?18:-1),s(3),m("matTooltip",i.isGlobalPrintEnabled()?i.printOnPayment()?"Print in Current Window":"You must enable print on payment config to use this button":"Required Global Print Role"),s(),m("ngClass",T(11,Vl,i.completeData.PaymentStateLabel!="Offline"))("disabled",i.printOnPayment()==!1||!i.isGlobalPrintEnabled()),s(3),C(i.completeData.PaymentStateLabel!="Offline"?25:-1),s(),C(i.completeData!=null&&i.completeData.LoyaltyPoint?26:-1),s(2),C(i.finalAmountDifferent==!1?28:29))},dependencies:[X,z,Li,be,Y,q,Jt,Pt,sn,ha,en,Xi,qt,$t,In,Je,St,Ke,se,Da,ze,K],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.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 Dn=class n{constructor(t,e){this._dialogRef=t;this._orderProcessorService=e;this.modalConfig.title="Clear Order?",this.modalConfig.headerType=Fe.Success}modalConfig=new H;ngOnInit(){}onOk(){this._orderProcessorService.createNewTransactionInSameOutletRegister(!1),this._orderProcessorService.emitClearOrder(),this.close()}close(){this._dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(B),d(U))};static \u0275cmp=M({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),p(3),l()()()),e&2&&(m("config",i.modalConfig),s(3),w("This will replace current order's item(s) with blank order."))},dependencies:[j],encapsulation:2})};var vo=(i=>(i[i.INTERNAL=1]="INTERNAL",i[i.EKSTERNAL=2]="EKSTERNAL",i[i.EKSTERNALINTERNAL=3]="EKSTERNALINTERNAL",i))(vo||{});function ys(n,t){if(n&1){let e=y();r(0,"div",1)(1,"radio-options",12),O("modelChange",function(o){u(e);let a=c();return D(a.selectedProvider,o)||(a.selectedProvider=o),f(o)}),l(),r(2,"label",13),p(3,"Choose Provider"),l()()}if(n&2){let e=c();s(),m("options",e.couponProviders()),P("model",e.selectedProvider),m("disabled",e.hasSelectedCoupon)}}function xs(n,t){if(n&1){let e=y();r(0,"button",14),_("click",function(){u(e);let o=c();return f(o.onRemoveCoupon())}),p(1," Remove "),l()}}function Is(n,t){if(n&1){let e=y();r(0,"button",15),_("click",function(o){u(e);let a=c();return f(a.onOk(o))})("keyup.F2",function(o){u(e);let a=c();return f(a.onOk(o))}),p(1," Ok (F2) "),l()}}var On=class n{constructor(t,e,i,o,a,h,E,F){this.promotionService=t;this._orderDataService=e;this._posService=i;this.dialogRef=o;this.roleService=a;this.toastr=h;this.promotionCouponProvider=E;this.promotionCouponV2Service=F;this.destroy$=new Q,this.modeType=!1,this.typeText="password",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye-slash",this.couponInputLock=a.Data.CouponInputLock,this.initProviders(),this.subscribeToObservable(),this.initModalConfig(),this.initSelectedProvider()}modalConfig=new H;modeType;typeText;typeIcon;PromotionCoupon;PromotionNote;couponType;destroy$;onInputCouponCode=!1;selectedProvider="Internal";couponInputLock=!1;startInput;couponredemptionType=vo;couponProviders=R([]);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.promotionCouponV2Service.redeemCoupon(this.PromotionCoupon).subscribe();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(mt),d(V),d(A),d(B),d(ce),d(J),d(wt),d(Mt))};static \u0275cmp=M({type:n,selectors:[["pos-modal-coupon-code"]],standalone:!1,decls:17,vars:10,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,ys,4,3,"div",1),r(3,"div",2)(4,"input",3),O("ngModelChange",function(a){return D(i.PromotionCoupon,a)||(i.PromotionCoupon=a),a}),_("paste",function(a){return i.couponInputLock?a.preventDefault():""})("keydown",function(a){return i.onKeyDown(a)})("focus",function(){return i.onInputCouponCode=!0})("blur",function(){return i.onInputCouponCode=!1}),l(),r(5,"i",4),_("click",function(){return i.modeType=!i.modeType,i.showPassword()}),l(),r(6,"label",5),p(7,"Coupon"),l()(),r(8,"div",6)(9,"textarea",7),O("ngModelChange",function(a){return D(i.PromotionNote,a)||(i.PromotionNote=a),a}),l(),r(10,"label",8),p(11,"Note"),l()()(),r(12,"footer")(13,"button",9),_("click",function(){return i.onClose()}),p(14," Cancel "),l(),g(15,xs,2,0,"button",10)(16,Is,2,0,"button",11),l()()),e&2&&(m("config",i.modalConfig),s(2),C(i.couponProviders().length>0?2:-1),s(2),m("type",i.typeText),P("ngModel",i.PromotionCoupon),m("disabled",i.hasSelectedCoupon),s(),le(i.typeIcon),s(4),P("ngModel",i.PromotionNote),m("disabled",i.hasSelectedCoupon),s(6),C(i.hasSelectedCoupon?15:16))},dependencies:[Y,q,oe,j,ei],styles:[".passwordIcon[_ngcontent-%COMP%]{position:relative;margin:0 auto!important;cursor:pointer;left:20.5rem;top:-2.3rem;z-index:999}"]})};var Mn=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 Q}modalConfig=new H;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(B),d(V),d(U),d(Me))};static \u0275cmp=M({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),O("ngModelChange",function(a){return D(i.ReturNumber,a)||(i.ReturNumber=a),a}),l(),r(4,"label",3),p(5,"Number Invoice"),l()()()()),e&2&&(m("config",i.modalConfig),s(3),P("ngModel",i.ReturNumber))},dependencies:[Y,q,oe,j],encapsulation:2})};var Ps=["serialInput"],wn=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 H;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(B),d(de),d(J))};static \u0275cmp=M({type:n,selectors:[["POS-modal-serial"]],viewQuery:function(e,i){if(e&1&&Se(Ps,5),e&2){let o;ye(o=xe())&&(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=y();r(0,"modal-material",1),_("onClose",function(){return u(o),f(i.dialogRef.close())}),r(1,"content")(2,"div",2)(3,"input",3,0),O("ngModelChange",function(h){return u(o),D(i.serial,h)||(i.serial=h),f(h)}),_("keydown",function(h){return u(o),f(i.onKeyDown(h))}),l(),r(5,"span",4),v(6,"i",5),l()()()()}e&2&&(m("config",i.modalConfig),s(3),P("ngModel",i.serial))},dependencies:[Y,q,oe,j],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 Ds(n,t){if(n&1&&(r(0,"tr")(1,"td"),p(2),l(),r(3,"td"),p(4),b(5,"date"),l(),r(6,"td"),p(7),b(8,"date"),l(),r(9,"td",4),p(10),l(),r(11,"td",4),p(12),b(13,"number"),l()()),n&2){let e=t.$implicit;s(2),w(e.Order.Number),s(2),w(ne(5,5,e.Order.ClientTimestamp,"dd MMM yyyy")),s(3),w(ne(8,8,e.Order.ClientTimestamp,"HH:mm")),s(3),w(e.Items.length),s(2),w(I(13,11,e.TotalPaidAmount))}}function Os(n,t){if(n&1&&(r(0,"div",0)(1,"table",2)(2,"thead",3)(3,"tr")(4,"th"),p(5,"Number"),l(),r(6,"th"),p(7,"Date"),l(),r(8,"th"),p(9,"Time"),l(),r(10,"th",4),p(11,"Qty"),l(),r(12,"th",4),p(13,"Total"),l()()(),r(14,"tbody"),ee(15,Ds,14,13,"tr",null,pe),l()()()),n&2){let e=c();s(15),te(e.offlineOrders)}}function Ms(n,t){n&1&&(r(0,"h1",1),p(1,"There is no offline orders!"),l())}var kn=class n{constructor(t){this._localDataService=t;this.destroy$=new Q}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=>Ie(qe,e))})}static \u0275fac=function(e){return new(e||n)(d(Ye))};static \u0275cmp=M({type:n,selectors:[["sync-orders"]],standalone:!1,decls:2,vars:1,consts:[[1,"table-responsive","p-8"],[1,"text-center","p-8"],[1,"table"],[1,"thead-light"],[1,"text-end"]],template:function(e,i){e&1&&g(0,Os,17,0,"div",0)(1,Ms,2,0,"h1",1),e&2&&C(i.offlineOrders!=null&&i.offlineOrders.length>0?0:1)},dependencies:[K,We],encapsulation:2})};var ks=n=>({"bg-gradient-danger":n});function Ts(n,t){if(n&1&&(p(0),b(1,"number")),n&2){let e=c();x(" ",I(1,1,e.onlineProducts)," ")}}function Es(n,t){n&1&&(r(0,"small",4),p(1," Failed to get Online Products "),l())}function Rs(n,t){if(n&1&&(p(0),b(1,"date")),n&2){let e=c();x(" ",ne(1,1,e.syncDate,"dd MMM yyyy HH:mm")," ")}}function Ns(n,t){n&1&&p(0," Never been synced ")}function Vs(n,t){if(n&1&&(r(0,"p"),p(1),l()),n&2){let e=c();s(),x("You last synced ",e.dayDiff," days ago!")}}var Tn=class n{constructor(t,e,i,o){this.indexDbService=t;this.toastr=e;this.httpService=i;this.dialogRef=o;this.destroy$=new Q}dayDiff;syncDate;offlineProduct=0;onlineProducts=0;destroy$;ngOnInit(){this.initOfflineProducts()}initOfflineProducts(){this.indexDbService.findAllVariant().pipe(ie(t=>t.length>0),Ve(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"}')}),it(t=>JSON.parse(t))).subscribe({next:t=>{this.onlineProducts=t.Count,this.getSyncTime()},error:t=>{console.error(t)}})}syncToLocalDatabase(){Ti([this.syncOutlets(),this.syncProducts(),this.syncOutletPrices()]).pipe(k(this.destroy$),Ve(()=>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$),ie(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$),Ve(t=>this.indexDbService.syncRegisters(t)))}syncProducts(){return this.httpService.get(fe.SyncProducts).pipe(k(this.destroy$),Ve(t=>this.indexDbService.syncVariants(t)))}syncOutletPrices(){return this.httpService.get(fe.SynOutletPrice).pipe(k(this.destroy$),Ve(t=>this.indexDbService.syncOutletPrice(t)))}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(Ye),d(J),d(Le),d(B))};static \u0275cmp=M({type:n,selectors:[["sync-products"]],standalone:!1,decls:28,vars:9,consts:[[1,"table-responsive","p-8"],[1,"table","table-bordered","table-sm","fs-5"],[1,"fw-bold",2,"width","125px"],[2,"width","175px",3,"ngClass"],[1,"fst-italic"],["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"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"table",1)(2,"tbody")(3,"tr")(4,"td",2),p(5,"Online Products"),l(),r(6,"td",3),g(7,Ts,2,3)(8,Es,2,0,"small",4),l(),r(9,"td",5)(10,"div",6)(11,"button",7),_("click",function(){return i.syncToLocalDatabase()}),v(12,"i",8),r(13,"span"),p(14,"Sync"),l()()()()(),r(15,"tr")(16,"td",9),p(17,"Offline Products"),l(),r(18,"td"),p(19),b(20,"number"),l()(),r(21,"tr")(22,"td",9),p(23,"Last Sync"),l(),r(24,"td"),g(25,Rs,2,4)(26,Ns,1,0),g(27,Vs,2,1,"p"),l()()()()()),e&2&&(s(6),m("ngClass",T(7,ks,!i.onlineProducts)),s(),C(i.onlineProducts?7:8),s(12),x(" ",I(20,5,i.offlineProduct)," "),s(6),C(i.syncDate?25:26),s(2),C(i.dayDiff>14?27:-1))},dependencies:[z,K,We],encapsulation:2})};var Ls=["navTabs"],En=class n{constructor(t,e){this._router=t;this.dialogRef=e}tabs;modalConfig=new H;ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig.headerType=Fe.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(vt),d(B))};static \u0275cmp=M({type:n,selectors:[["pos-modal-sync"]],viewQuery:function(e,i){if(e&1&&Se(Ls,5),e&2){let o;ye(o=xe())&&(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=y();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(h){return u(o),f(i.onChangeTab(h))}),r(4,"mat-tab",3),v(5,"sync-products"),l(),r(6,"mat-tab",4),v(7,"sync-orders"),l()(),r(8,"div",5)(9,"button",6),_("click",function(){return u(o),f(i.goToOfflinePage())}),v(10,"i",7),p(11," Go to Details "),l()()()()}e&2&&(m("config",i.modalConfig),s(2),m("dynamicHeight",!1))},dependencies:[j,xt,It,kn,Tn],styles:[".mat-ink-bar{background-color:#93bd45!important} .sync mat-mdc-tab-body{height:200px} .mat-mdc-tab-body-content{overflow-x:hidden!important}"]})};var Bs=(n,t)=>({"btn-secondary":n,"btn-outline-secondary":t}),js=(n,t)=>({"btn-outline-secondary":n,"btn-secondary":t});function Hs(n,t){if(n&1){let e=y();r(0,"div")(1,"label",12),v(2,"i",13),r(3,"span"),p(4,"Deduct Inventory from Outlet :"),l()(),r(5,"p-select",14),O("ngModelChange",function(o){u(e);let a=c();return D(a.deliveryEntityID,o)||(a.deliveryEntityID=o),f(o)}),l()()}if(n&2){let e=c();s(5),m("options",e.entities),P("ngModel",e.deliveryEntityID),m("filter",!0)("showClear",!0)("showClear",!1)("disabled",e.isDisabledNgSelectOutlet)}}function Us(n,t){if(n&1){let e=y();r(0,"div",10)(1,"div",29)(2,"label",30),v(3,"i",31),r(4,"span"),p(5,"Recipient"),l()(),r(6,"input",32),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.shipping.Name,o)||(a.shipping.Name=o),f(o)}),l()(),r(7,"div",29)(8,"label",33),v(9,"i",34),r(10,"span"),p(11,"Phone"),l()(),r(12,"input",35),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.shipping.Phone,o)||(a.shipping.Phone=o),f(o)}),l()(),r(13,"div",36)(14,"label",37),v(15,"i",38),r(16,"span"),p(17,"City"),l()(),r(18,"input",39),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.shipping.City,o)||(a.shipping.City=o),f(o)}),l()(),r(19,"div",40)(20,"label",41),v(21,"i",42),r(22,"span"),p(23,"Delivery Address"),l()(),r(24,"POS-tinymce-editor",43),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.shipping.Address,o)||(a.shipping.Address=o),f(o)}),l()()()}if(n&2){let e=c(2);s(6),P("ngModel",e.shipping.Name),s(6),P("ngModel",e.shipping.Phone),s(6),P("ngModel",e.shipping.City),s(6),P("ngModel",e.shipping.Address)}}function Ws(n,t){if(n&1){let e=y();r(0,"div",15)(1,"div",16)(2,"label",12),v(3,"i",17),r(4,"span"),p(5),l()(),r(6,"div",16)(7,"p-datepicker",18),O("ngModelChange",function(o){u(e);let a=c();return D(a.posData.Invoice.DateCustom,o)||(a.posData.Invoice.DateCustom=o),f(o)}),l()()(),r(8,"div",16)(9,"label",19),v(10,"i",20),r(11,"span"),p(12,"Time"),l()(),r(13,"div",16)(14,"app-timepicker",21),O("timeChange",function(o){u(e);let a=c();return D(a.posData.Invoice.TimeCustom,o)||(a.posData.Invoice.TimeCustom=o),f(o)}),l()()()(),r(15,"div",22)(16,"div",23)(17,"div")(18,"p-checkbox",24),O("ngModelChange",function(o){u(e);let a=c();return D(a.recipientNotBuyer,o)||(a.recipientNotBuyer=o),f(o)}),l()(),r(19,"div",25)(20,"span"),v(21,"i",26),l(),r(22,"h6",23)(23,"span"),p(24,"Recipient \u2260 Buyer"),l(),r(25,"span",27),v(26,"i",28),l()()()()(),g(27,Us,25,4,"div",10)}if(n&2){let e=c();s(5),x(" ",e.dateLabel," "),s(2),P("ngModel",e.posData.Invoice.DateCustom),m("baseZIndex",1e4)("showClear",!0),s(7),P("time",e.posData.Invoice.TimeCustom),m("showIcon",!0)("showCloseBtn",!1)("fullWidth",!0)("showClear",!0),s(4),P("ngModel",e.recipientNotBuyer),m("binary",!0),s(9),C(e.recipientNotBuyer?27:-1)}}var fi=class n{constructor(t,e,i,o,a,h,E){this._dialogRef=t;this._orderDataService=e;this._posService=i;this._orderProcessorService=o;this._productHttpService=a;this._outletService=h;this.datePipe=E;this.destroy$=new Q,this.initStartTime(),this.subscribePosData(),this.initModal()}modalConfig=new H;isDisabledNgSelectOutlet=!1;isDelivery=R(!1);customDate=null;shipping=new xi;deliveryEntityID="";posData=new qe;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 xi})}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.set(!0):this.isDelivery.set(!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.set(!1),this.disableShippingLater=!0):e==2&&(this.isDelivery.set(!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(),S.IsEmpty(this.deliveryEntityID)?this.posData.Order.DeliveryStateID=0:this.posData.Order.DeliveryStateID=3,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=Ie(Re,this.posData.CartItems),i;this.posData.CartItems=e.map(o=>(o.isSerialType()&&(i=t.findIndex(a=>a.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(a=>(i=t.findIndex(h=>h.Number==a.Number),i!==-1))}close(){this._dialogRef.close()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(B),d(V),d(A),d(U),d($i),d(G),d(We))};static \u0275cmp=M({type:n,selectors:[["POS-modal-shipping"]],decls:23,vars:14,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container"],[1,"row"],[1,"btn-group","col-12"],["type","button",1,"btn","btn-secondary","position-relative","btn-custom-size","col-5",3,"click","disabled"],[1,"fa-solid","fa-bolt"],[1,"ms-2"],[1,"ms-1"],["type","button",1,"btn","position-relative","btn-custom-size","col-7",3,"click","disabled"],[1,"fa-solid","fa-clock"],[1,"row","mt-12"],[1,"col-12"],["for","shippingDate",1,"mb-2"],[1,"fa","fa-store","me-1"],["optionLabel","Name","optionValue","ID","filterBy","Name","placeholder","Select a Outlet","appendTo","body",1,"w-100",2,"--p-select-padding-y","0.8rem",3,"ngModelChange","options","ngModel","filter","showClear","disabled"],[1,"d-flex","align-items-center","gap-3"],[1,"w-100"],[1,"fa-solid","fa-calendar","me-1"],["placeholder","Select Date","showIcon","","iconDisplay","input","appendTo","body","dateFormat","dd M yy",1,"w-100","date-custom",3,"ngModelChange","ngModel","baseZIndex","showClear"],["for","shippingTime",1,"mb-2"],[1,"fa","fa-clock","me-1"],["placeholder","Select Time",1,"date-custom",3,"timeChange","time","showIcon","showCloseBtn","fullWidth","showClear"],[1,"mt-12"],[1,"d-flex","align-items-center","gap-2"],[1,"custom-checkbox-style",3,"ngModelChange","ngModel","binary"],[1,"d-flex","align-items-center","gap-1"],[1,"fa-solid","fa-user","fs-5"],["pTooltip",`Enable this option when the person receiving the order is different from customer who made the purchase.
|
|
6
|
+
This is commonly used for gift deliveries, corporate orders, or when someone is buying on behalf of another person. When enabled, you'll need to provide the recipient's contact details and delivery address.`,"tooltipPosition","top","tooltipZIndex","10000"],[1,"fa","fa-info-circle"],[1,"col-4","pe-0"],["for","recipient"],[1,"fa-solid","fa-user","me-1","mb-2"],["id","recipient","placeholder","Enter recipient name","type","text",1,"w-100","form-control","rounded-1","custom-input-size",3,"ngModelChange","ngModel"],["for","phone"],[1,"fa-solid","fa-phone","me-1","mb-2"],["id","phone","placeholder","Enter recipent phone number","type","text",1,"w-100","form-control","rounded-1","custom-input-size",3,"ngModelChange","ngModel"],[1,"col-4"],["for","city"],[1,"fa-solid","fa-location-dot","me-1","mb-2"],["id","city","placeholder","Enter the recipient city","type","text",1,"w-100","form-control","rounded-1","custom-input-size",3,"ngModelChange","ngModel"],[1,"col-12","mt-8"],["for","address",1,"mb-3"],[1,"fa-solid","fa-address-book","me-1"],["id","address","placeholder","Enter the recipient address here ...",3,"ngModelChange","ngModel"]],template:function(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,"button",4),_("click",function(){return i.isDelivery.set(!1),i.changeDelivery()}),v(6,"i",5),r(7,"span",6),p(8," Now "),r(9,"small",7)(10,"em"),p(11,"(in store purchase)"),l()()()(),r(12,"button",8),_("click",function(){return i.isDelivery.set(!0),i.changeDelivery()}),v(13,"i",9),r(14,"span",6),p(15," Later "),r(16,"small",7)(17,"em"),p(18,"(shipped to customer address)"),l()()()()()(),r(19,"div",10)(20,"div",11),g(21,Hs,6,6,"div")(22,Ws,28,12),l()()()()()),e&2&&(m("config",i.modalConfig),s(5),le(_e(8,Bs,!i.isDelivery(),i.isDelivery())),m("disabled",i.disableShippingNow),s(7),le(_e(11,js,!i.isDelivery(),i.isDelivery())),m("disabled",i.disableShippingLater),s(9),C(i.isDelivery()?22:21))},dependencies:[X,j,Mr,Or,be,Y,q,oe,Tr,kr,Hi,Ir,xr,Ze,Dr,Pr],styles:[".container[_ngcontent-%COMP%]{min-height:185px} p-datepicker.date-custom>span>input{padding-top:10px;padding-bottom:10px} app-timepicker.date-custom p-datepicker>span>input{padding-top:10px;padding-bottom:10px}.btn-custom-size[_ngcontent-%COMP%]{--bs-btn-padding-y: 1rem;--bs-btn-padding-x: 1rem;--bs-btn-font-size: 3.5rem;font-family:Roboto Slab,serif}.btn-custom-size[_ngcontent-%COMP%]:hover{background-color:var(--bs-light)!important;border-color:var(--bs-light)!important;color:#000!important}.custom-checkbox-style[_ngcontent-%COMP%]{--p-checkbox-checked-background: #89b03e;--p-checkbox-hover-border-color: #89b03e;--p-checkbox-checked-border-color: #89b03e;--p-checkbox-checked-hover-border-color: #89b03e;--p-checkbox-hover-border-color-background: #7c9b44;--p-checkbox-checked-hover-background: #89b03e}.custom-input-size[_ngcontent-%COMP%]{height:2.625rem;padding:.75rem!important;color:#343434;font-size:.75rem;border-radius:.25rem!important}"]})};var Rn=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)(N(Le))};static \u0275prov=Ge({token:n,factory:n.\u0275fac,providedIn:"root"})};var $s=(n,t)=>({"d-flex align-items-center justify-content-center":n,"custom-container-height":t}),Ma=()=>["ParkLabel","Number"],wa=n=>({"no-hover":n}),ka=n=>({"bg-danger":n}),Ta=n=>({"text-white":n}),Ea=(n,t,e)=>({"duration-green":n,"duration-yellow":t,"duration-red":e});function qs(n,t){if(n&1&&(r(0,"span",12),p(1),l()),n&2){let e=t.$implicit,i=t.$index;m("hidden",i==0),s(),x(" ",e.ParkLabel??e.Number," ")}}function Gs(n,t){if(n&1&&(r(0,"div",7),ee(1,qs,2,2,"span",12,pe),r(3,"span",13),p(4,"will be merged to"),l(),r(5,"span",14),p(6),l()()),n&2){let e=c(2);s(),te(e.listMerge),s(5),x(" ",e.listMerge[0].ParkLabel??e.listMerge[0].Number," ")}}function zs(n,t){if(n&1){let e=y();r(0,"div",2),g(1,Gs,7,1,"div",7),r(2,"div",8)(3,"span",9),v(4,"i",10),l(),r(5,"input",11),O("ngModelChange",function(o){u(e);let a=c();return D(a.filter,o)||(a.filter=o),f(o)}),l()()()}if(n&2){let e=c();s(),C(e.listMerge.length>1?1:-1),s(4),P("ngModel",e.filter)}}function Js(n,t){if(n&1&&v(0,"i"),n&2){let e=c(2).$implicit;le(e.Icon)}}function Ks(n,t){if(n&1&&(r(0,"h5",22),g(1,Js,1,2,"i",23),r(2,"span"),p(3),b(4,"limitTo"),l()()),n&2){let e=c().$implicit,i=c(4);s(),C(e.Icon?1:-1),s(2),x(" ",i.parkedOrders.length<5?e.Name:ne(4,2,e.Name,5)," ")}}function Ys(n,t){if(n&1&&(r(0,"div",36),v(1,"i",42),r(2,"span",35),p(3),b(4,"slice"),l()()),n&2){let e=c().$implicit;s(2),m("matTooltip",e.CustomerDisplay),s(),x(" ",e.CustomerDisplay.length>20?Ae(4,2,e.CustomerDisplay,0,20)+"...":e.CustomerDisplay," ")}}function Zs(n,t){if(n&1&&(r(0,"div",38),p(1),l()),n&2){let e=c().$implicit;s(),x(" ",e.alias," ")}}function Xs(n,t){if(n&1){let e=y();r(0,"div",24)(1,"div",25)(2,"div",26),_("click",function(o){let a=u(e).$implicit;return c(6).onOrderClicked(a),f(o.preventDefault())}),r(3,"h5",27)(4,"div",28),p(5),l(),r(6,"span",29),_("click",function(o){let a=u(e).$implicit;return c(6).remove(a),f(o.stopPropagation())}),v(7,"i",30),l()(),r(8,"div",31)(9,"div",32)(10,"div",33),v(11,"i",34),r(12,"span",35),p(13),b(14,"slice"),l()(),r(15,"div",36),v(16,"i",37),p(17),b(18,"date"),l(),g(19,Ys,5,6,"div",36),g(20,Zs,2,1,"div",38),l(),r(21,"div",39)(22,"div",40),p(23),l(),r(24,"input",41),O("ngModelChange",function(o){let a=u(e).$implicit;return D(a.selected,o)||(a.selected=o),f(o)}),_("change",function(){let o=u(e).$implicit,a=c(6);return f(a.chooseMerge(o))})("click",function(o){return u(e),f(o.stopPropagation())}),l()()()()()()}if(n&2){let e=t.$implicit,i=c(6),o=(i.parkLabel()==e.ParkLabel||i.parkLabel()==e.Alias)&&i.isRetrieve();s(),m("ngClass",T(22,wa,o))("matTooltip",o?"You\u2019re currently retrieving this order and cannot retrieve it again!":""),s(2),m("ngClass",T(24,ka,o)),s(),m("ngClass",T(26,Ta,o)),s(),x(" ",i.replaceAlias&&e.Alias?e.Alias:e.ParkLabel," "),s(),m("hidden",(i.parkLabel()==e.ParkLabel||i.parkLabel()==e.Alias)&&i.isRetrieve()||i.AuthorizeParkOrderDeletion),s(6),m("matTooltip",e.Number),s(),x(" ",e.Number.length>15?Ae(14,15,e.Number,0,15)+"...":e.Number," "),s(4),x(" ",ne(18,19,e.Created,"dd-MMM HH:mm")," "),s(2),C(e.CustomerDisplay?19:-1),s(),C(i.replaceAlias?-1:20),s(2),m("ngClass",Si(28,Ea,e.Duration<=60,e.Duration>60&&e.Duration<=120,e.Duration>120)),s(),x(" ",e.Duration," minutes ago "),s(),m("hidden",i.parkLabel()&&i.isRetrieve()||!i.parkEnableMerge),P("ngModel",e.selected)}}function ec(n,t){if(n&1&&(r(0,"div",20),ee(1,Xs,25,32,"div",24,pe),b(3,"FilterByArray"),l()),n&2){let e=c().$implicit,i=c(4);s(),te(Ae(3,0,e.List,st(4,Ma),i.filter))}}function tc(n,t){n&1&&(r(0,"div",21),v(1,"app-empty-state"),l())}function ic(n,t){if(n&1&&(r(0,"mat-tab"),Z(1,Ks,5,5,"ng-template",18),r(2,"div",19),g(3,ec,4,5,"div",20)(4,tc,2,0,"div",21),l()()),n&2){let e=t.$implicit;s(3),C(e.List.length>0?3:4)}}function nc(n,t){if(n&1&&(r(0,"mat-tab-group",17),ee(1,ic,5,1,"mat-tab",null,pe),l()),n&2){let e=c(3);s(),te(e.Layout)}}function oc(n,t){if(n&1&&(r(0,"div",15),g(1,nc,3,0,"mat-tab-group",17),l()),n&2){let e=c(2);s(),C(e.parkedOrders.length!=0?1:-1)}}function rc(n,t){if(n&1&&(r(0,"div",36),v(1,"i",42),r(2,"span",35),p(3),b(4,"slice"),l()()),n&2){let e=c().$implicit;s(2),m("matTooltip",e.CustomerDisplay),s(),w(e.CustomerDisplay.length>20?Ae(4,2,e.CustomerDisplay,0,20)+"...":e.CustomerDisplay)}}function ac(n,t){if(n&1&&(r(0,"div",38),p(1),l()),n&2){let e=c().$implicit;s(),x(" ",e.alias," ")}}function lc(n,t){if(n&1){let e=y();r(0,"div",24)(1,"div",44)(2,"div",26),_("click",function(o){let a=u(e).$implicit;return c(3).onOrderClicked(a),f(o.preventDefault())}),r(3,"h5",27)(4,"div",28),p(5),l(),r(6,"span",29),_("click",function(o){let a=u(e).$implicit;return c(3).remove(a),f(o.stopPropagation())}),v(7,"i",45),l()(),r(8,"div",31)(9,"div",32)(10,"div",33),v(11,"i",34),r(12,"span",35),p(13),b(14,"slice"),l()(),r(15,"div",36),v(16,"i",37),p(17),b(18,"date"),l(),g(19,rc,5,6,"div",36),g(20,ac,2,1,"div",38),l(),r(21,"div",39)(22,"div",40),p(23),l(),r(24,"input",41),O("ngModelChange",function(o){let a=u(e).$implicit;return D(a.selected,o)||(a.selected=o),f(o)}),_("change",function(){let o=u(e).$implicit,a=c(3);return f(a.chooseMerge(o))})("click",function(o){return u(e),f(o.stopPropagation())}),l()()()()()()}if(n&2){let e=t.$implicit,i=c(3),o=(i.parkLabel()==e.ParkLabel||i.parkLabel()==e.Alias)&&i.isRetrieve();s(),m("ngClass",T(22,wa,o))("matTooltip",o?"You\u2019re currently retrieving this order and cannot retrieve it again!":""),s(2),m("ngClass",T(24,ka,o)),s(),m("ngClass",T(26,Ta,o)),s(),x(" ",e.Alias?e.Alias:e.ParkLabel," "),s(),m("hidden",(i.parkLabel()==e.ParkLabel||i.parkLabel()==e.Alias)&&i.isRetrieve()||i.AuthorizeParkOrderDeletion),s(6),m("matTooltip",e.Number),s(),w(e.Number.length>18?Ae(14,15,e.Number,0,18)+"...":e.Number),s(4),x(" ",ne(18,19,e.Created,"dd-MMM HH:mm")," "),s(2),C(e.CustomerDisplay?19:-1),s(),C(i.replaceAlias?-1:20),s(2),m("ngClass",Si(28,Ea,e.Duration<=60,e.Duration>60&&e.Duration<=120,e.Duration>120)),s(),x(" ",e.Duration," minutes ago "),s(),m("hidden",i.parkLabel()&&i.isRetrieve()||!i.parkEnableMerge),P("ngModel",e.selected)}}function sc(n,t){if(n&1&&(r(0,"div",16)(1,"div",43),ee(2,lc,25,32,"div",24,pe),b(4,"FilterByArray"),l()()),n&2){let e=c(2);s(2),te(Ae(4,0,e.parkedOrders,st(4,Ma),e.filter))}}function cc(n,t){if(n&1&&g(0,oc,2,1,"div",15)(1,sc,5,5,"div",16),n&2){let e=c();C(e.retreiveMode==1?0:e.retreiveMode==0?1:-1)}}function pc(n,t){n&1&&v(0,"app-empty-state",3)}function dc(n,t){if(n&1){let e=y();r(0,"a",46),_("click",function(){u(e);let o=c();return f(o.clearSelection())}),p(1,"Clear All"),l()}}function mc(n,t){if(n&1){let e=y();r(0,"a",46),_("click",function(){u(e);let o=c();return f(o.merge())}),p(1,"Merge"),l()}}var Nn=class n{constructor(t,e,i,o,a,h,E,F,Ce,Te){this._dialogRef=t;this._parkedOrderService=e;this._localData=i;this._OrderHttpService=o;this._orderProcessorService=a;this._posHttpResponseService=h;this._salesOrderDataService=E;this.outletService=F;this._toastr=Ce;this.roleService=Te;let Be=this._salesOrderDataService.Data;this.entityId=Be.Order.EntityID,this.templateID=F.Data.PrintTemplate.ID,this.RegisterID=Be.Order.RegisterID,this.park=new pi(this.outletService.Data.ParkLayoutPack),this.Layout=F.Data?.ParkLayoutPack?.Layout,this.initModalDialog(),this.initConfig(),this.initSelectedRetrieve(),this.getData()}modalConfig=new H;filter;entityId;parkedOrders=[];filterAlwaysVisible;replaceAlias;parkDeletionRestriction;parkEnableMerge;AuthorizeParkOrderDeletion;listMerge=[];park;templateID;RegisterID;voidEnabled;retreiveMode;Layout;isRetrieve=R(!1);parkLabel=R(null);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)}initSelectedRetrieve(){let t=this._orderProcessorService.Data.posState;this.isRetrieve.update(()=>t===4),this.parkLabel.update(()=>this._salesOrderDataService.Data?.Order?.ParkLabel)}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 a=new Date(o.Created),E=Math.abs(new Date().getTime()-a.getTime()),F=Math.floor(E%864e5/36e5),Ce=Math.round(E%864e5%36e5/6e4);o.Duration=F>0?Ce+F*60:Ce});else{i.Alias=this.park.GetAlias(i.ParkLabel),i.MemberIdentification=i.MemberIdentification?i.MemberIdentification:"";let o=new Date(i.Created),h=Math.abs(new Date().getTime()-o.getTime()),E=Math.floor(h%864e5/36e5),F=Math.round(h%864e5%36e5/6e4);i.Duration=E>0?F+E*60:F}}),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.parkLabel()!=t.ParkLabel||this.parkLabel()!=t.Alias&&S.IsNotEmpty(t.Alias))&&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(B),d(Rn),d(Ye),d(Me),d(U),d(A),d(V),d(G),d(J),d(ce))};static \u0275cmp=M({type:n,selectors:[["POS-modal-retrieve"]],standalone:!1,decls:10,vars:9,consts:[[3,"onCancel","onClose","config"],[1,"container","px-4",3,"ngClass"],[1,"search-container","mb-6","px-0"],[1,"w-100"],[1,"d-flex","justify-content-between","mt-3"],[1,"d-flex","justify-content-end"],[1,"btn","btn-light-blue","text-primary","fw-bold","me-3"],[1,"merge-indicator"],[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-1","rounded-start-0",3,"ngModelChange","ngModel"],[1,"merge-label","fw-bold","bg-success",3,"hidden"],[1,"fw-semibold"],[1,"merge-label","merge-target","bg-success"],["mat-stretch-tabs","false",1,"mt-6"],[1,"container","mt-6"],["mat-stretch-tabs","false"],["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"],[1,"col-3"],[1,"card","border-1","position-relative",3,"ngClass","matTooltip"],[1,"card-body","p-0",3,"click"],[1,"card-title","d-flex","justify-content-between","align-items-center","px-3","pt-3",3,"ngClass"],[1,"label-title","text-truncate","px-2",3,"ngClass"],[3,"click","hidden"],[1,"fa","fa-xmark-circle","text-danger-soft"],[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"],["matTooltipPosition","above",3,"matTooltip"],[1,"mb-1","text-muted","small"],[1,"fa-regular","fa-calendar-check","pe-2"],[1,"text-muted","small"],[1,"duration-wrapper","d-flex","align-items-center"],[1,"badge","duration-badge",3,"ngClass"],["type","checkbox",1,"retrieve_checkbox","mb-1",3,"ngModelChange","change","click","hidden","ngModel"],[1,"fa","fa-user","pe-2"],[1,"row"],["matTooltipPosition","above",1,"card","border-0","position-relative",3,"ngClass","matTooltip"],[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,zs,6,2,"div",2),g(4,cc,2,1)(5,pc,1,0,"app-empty-state",3),l()(),r(6,"footer",4)(7,"div",5),g(8,dc,2,0,"a",6),g(9,mc,2,0,"a",6),l()()()),e&2&&(m("config",i.modalConfig),s(2),m("ngClass",_e(6,$s,i.parkedOrders.length==0,i.parkedOrders.length>0)),s(),C(i.parkedOrders.length>0||i.retreiveMode==1||i.filterAlwaysVisible?3:-1),s(),C(i.parkedOrders.length>0?4:5),s(4),C(i.listMerge.length>1?8:-1),s(),C(i.listMerge.length>1?9:-1))},dependencies:[z,Y,zt,q,oe,j,se,Bi,xt,It,ii,Fi,We,ji,vr],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.search-container[_ngcontent-%COMP%]{transition:all .3s ease;width:97%}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]{position:relative;transition:all .3s ease;height:2.3rem}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover, .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e4d,0 0 8px 4px #89b03e33;border-radius:4px}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]{transition:all .3s ease;border-left:none!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]:focus{box-shadow:none!important;border-color:#ced4da!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .input-group-text[_ngcontent-%COMP%]{transition:all .3s ease;background-color:#fff;border-right:none!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .input-group-text[_ngcontent-%COMP%], .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .input-group-text[_ngcontent-%COMP%]{background-color:#89b03e1a;border-color:#84cc16!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .fa-magnifying-glass[_ngcontent-%COMP%]{transition:all .3s ease}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .fa-magnifying-glass[_ngcontent-%COMP%], .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .fa-magnifying-glass[_ngcontent-%COMP%]{color:#84cc16!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e66,0 0 12px 6px #89b03e40!important}.custom-container-height[_ngcontent-%COMP%]{max-height:390px;min-height:390px}.nofocus[_ngcontent-%COMP%]:focus{outline:none!important}.merge-indicator[_ngcontent-%COMP%]{background-color:#e0e4dc;padding:12px;border-radius:.5rem;margin-bottom:.5rem;gap:4px;display:flex;flex-wrap:wrap;gap:8px;align-items:center}.merge-indicator[_ngcontent-%COMP%] .merge-label[_ngcontent-%COMP%]{color:#e0e4dc;padding:.55rem .75rem;border-radius:999px;font-size:.75rem;font-weight:500}.merge-indicator[_ngcontent-%COMP%] .merge-target[_ngcontent-%COMP%]{font-weight:700;color:#e0e4dc;font-size:.75rem}.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:not(.no-hover){transform:translateY(-3px);box-shadow:0 5px 15px #00000026;border-left:6px solid #84cc16}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover:not(.no-hover) h5.card-title[_ngcontent-%COMP%]{background:#84cc16}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover:not(.no-hover) .label-title[_ngcontent-%COMP%]{color:#fff!important}.col-3[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]:hover:not(.no-hover) .fa-xmark-circle[_ngcontent-%COMP%]{color:#c0392b!important}.col-3[_ngcontent-%COMP%] .card.no-hover[_ngcontent-%COMP%]{cursor:default}.col-3[_ngcontent-%COMP%] .card.no-hover[_ngcontent-%COMP%]:hover{transform:none;box-shadow:0 2px 10px #0000001a;border-left:4px solid #f0f0f0}.col-3[_ngcontent-%COMP%] .card.no-hover[_ngcontent-%COMP%]:hover h5.card-title[_ngcontent-%COMP%]{background:#e0e4dc}.col-3[_ngcontent-%COMP%] .card.no-hover[_ngcontent-%COMP%]:hover .label-title[_ngcontent-%COMP%]{color:#fff!important}.col-3[_ngcontent-%COMP%] .card.no-hover[_ngcontent-%COMP%]:hover .fa-xmark-circle[_ngcontent-%COMP%]{color:#e74c3c!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%]{--mat-tab-active-indicator-color: #89b03e;--mat-tab-focus-indicator-color: #89b03e;--mat-tab-focus-label-text-color: var(--bs-body-color);--mat-tab-active-label-text-color: var(--bs-body-color);--mat-tab-active-focus-label-text-color: var(--bs-body-color);--mat-tab-active-hover-label-text-color: var(--bs-body-color);--mat-tab-active-focus-indicator-color: #89b03e;--mat-tab-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 Ra=[{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"},{label:"Validate Inventory",class:"fa-archive fa-solid fs-3",action:"INVENTORY"},{label:"Disable Sort",class:"fa-sort fa-solid fs-3",action:"SORT"}]},{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:"Remote",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:"ECR",class:"fa-solid fa-mobile-signal-out fs-3",action:"ECR"},{label:"Cash Machine",class:"fa-solid fa-money-from-bracket fs-3",action:"CASH_MACHINE"}]}];var Vn=class{OrderID;ParkLabel;Items};var uc=n=>({"no-border":n});function fc(n,t){if(n&1){let e=y();r(0,"tr",13)(1,"td"),p(2),l(),r(3,"td"),p(4),b(5,"number"),l(),r(6,"td")(7,"div",14)(8,"button",15),_("click",function(){let o=u(e).$index,a=c();return f(a.onRemoveQuantity(o))}),p(9,"-"),l(),r(10,"input",16),O("ngModelChange",function(o){let a=u(e).$implicit;return D(a.SplitQuantity,o)||(a.SplitQuantity=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onSplitedQuantityChange())}),l(),r(11,"button",17),_("click",function(){let o=u(e).$index,a=c();return f(a.onAddQuantity(o))}),p(12,"+"),l()()(),r(13,"td",18),p(14),b(15,"number"),l()()}if(n&2){let e=t.$implicit,i=t.$index,o=c();m("ngClass",T(11,uc,i==(o.cartItems==null?null:o.cartItems.length)-1)),s(2),w(e==null||e.Variant==null?null:e.Variant.Name),s(2),w(I(5,7,e==null?null:e.Price)),s(6),P("ngModel",e.SplitQuantity),m("max",e.Quantity)("min",0),s(4),w(I(15,9,e==null?null:e.Quantity))}}var An=class n{constructor(t,e,i,o,a,h){this.dialogRef=t;this.salesOrderDataService=e;this.parkService=i;this.orderProcessorService=o;this.toastr=a;this.calculatorService=h;let E=this.salesOrderDataService?.Data?.CartItems;this.cartItems=Ie(Re,E),this.salesOrderData=Ie(qe,this.salesOrderDataService.Data),this.currencySymbol=this.calculatorService.currencySymbol}modalConfig=new H;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 Vn,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(B),d(V),d(ke),d(U),d(J),d(ge))};static \u0275cmp=M({type:n,selectors:[["app-modal-split"]],features:[lt([ke])],decls:27,vars:6,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"],[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),O("ngModelChange",function(a){return D(i.parkLabel,a)||(i.parkLabel=a),a}),l()(),r(7,"div",6)(8,"div",7),p(9,"Splitted Amount"),l(),r(10,"div",8),p(11),b(12,"number"),l()(),r(13,"table",9)(14,"thead",10)(15,"tr")(16,"th"),p(17,"Name"),l(),r(18,"th"),p(19,"Price"),l(),r(20,"th",11),p(21,"Qty Split"),l(),r(22,"th",12),p(23,"Qty"),l()()(),r(24,"tbody"),ee(25,fc,16,13,"tr",13,pe),l()()()()()()()),e&2&&(m("config",i.modalConfig),s(6),P("ngModel",i.parkLabel),s(5),Ee("",i.currencySymbol," ",i.splitPriceTotal?I(12,4,i.splitPriceTotal):0),s(14),te(i.cartItems))},dependencies:[X,z,j,ct,be,Y,q,oe,K],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 Ln=class n{constructor(t,e){this.data=t;this._dialogRef=e;this.message=t.message,this.initModal()}modalConfig=new H;message;initModal(){this.modalConfig.title=this.data.title,this.modalConfig.headerType=Fe.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(Oe),d(B))};static \u0275cmp=M({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),p(3),l()()()),e&2&&(m("config",i.modalConfig),s(3),w(i.message))},dependencies:[j],encapsulation:2})};var Fn=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 H;cartItem=new Re;role;isSerialItem=!1;priceVisible;unitPriceEditor;pricebookSelector;pricebookCopyDesc;calculatorQtyDisabled;calculatorPriceDisabled;productCalculator=R(!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=R(!1);enableCalculatorNote=R(!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),this.enableCalculatorNote.set(t.ModuleSell?.ProductDialog?.CalculatorNote)}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 bo=(a=>(a[a.SELL_INPUT=0]="SELL_INPUT",a[a.DISCOUNT=1]="DISCOUNT",a[a.PRODUCT=2]="PRODUCT",a[a.SERIAL=3]="SERIAL",a[a.CALCULATOR=4]="CALCULATOR",a))(bo||{});var hc=["quantity"],vc=["price"],bc=["discount"],Sc=["unitCost"],ki=n=>({selected:n}),yc=n=>({"mt-8":n}),Na=n=>({"qtyBtn-disabled":n}),xc=()=>["/menu/Products/Catalog/Variants/Info"],Ic=n=>({ID:n}),Pc=n=>({"col-12":n}),Dc=n=>({"editable-box":n});function Oc(n,t){if(n&1){let e=y();r(0,"a",11),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalItemState.PRODUCT))}),p(1," Product "),l()}if(n&2){let e=c();m("ngClass",T(1,ki,e.modalItemState.PRODUCT==e.currentState))}}function Mc(n,t){if(n&1){let e=y();r(0,"a",19),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalItemState.SERIAL))}),p(1," Serial "),l()}if(n&2){let e=c();m("ngClass",T(1,ki,e.modalItemState.SERIAL==e.currentState))}}function wc(n,t){if(n&1){let e=y();r(0,"a",19),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalItemState.CALCULATOR))}),p(1," Calculator "),l()}if(n&2){let e=c();m("ngClass",T(1,ki,e.modalItemState.CALCULATOR==e.currentState))}}function kc(n,t){if(n&1&&(r(0,"div",28)(1,"div",29)(2,"div"),p(3),l(),r(4,"small",30),p(5),l()()()),n&2){let e=t.data;s(3),w(e==null?null:e.Value),s(2),w(e==null?null:e.Code)}}function Tc(n,t){if(n&1){let e=y();r(0,"div",16)(1,"div",26)(2,"autocompleteV2",27,0),_("onSelect",function(o){u(e);let a=c(2);return f(a.onAddItem(o))})("onInputEnter",function(o){u(e);let a=c(2);return f(a.onEnterProductCode(o))}),l(),Z(4,kc,6,2,"ng-template",null,1,ht),l()()}if(n&2){let e=ot(5),i=c(2);s(2),m("localStorage","products")("renderThumbnail",!0)("inputTextValue",i.cartItem==null||i.cartItem.Variant==null?null:i.cartItem.Variant.Name)("clearOnSelect",!1)("useCustomTemplate",!0)("itemTemplate",e)}}function Ec(n,t){n&1&&(r(0,"div",20)(1,"div",31),p(2," Edit Prepaid Package Quantity is disabled during EDIT MODE "),l(),r(3,"div"),p(4," If you make a mistake, please delete the item and then add again "),l()())}function Rc(n,t){if(n&1&&(r(0,"div",32),v(1,"div",44),l()),n&2){let e=c(3);s(),m("innerHTML",e._shoppingCartService.priceMinimumRestrictionWarning(),Ut)}}function Nc(n,t){if(n&1&&(r(0,"span"),p(1),l()),n&2){let e=c(3);s(),x("(",e.cartItem.Variant==null?null:e.cartItem.Variant.UOMName,")")}}function Vc(n,t){if(n&1){let e=y();r(0,"div",39)(1,"strong")(2,"span"),p(3),l()(),r(4,"input",45),O("ngModelChange",function(o){u(e);let a=c(3);return D(a.cartItem.UnitQuantity,o)||(a.cartItem.UnitQuantity=o),f(o)}),l()()}if(n&2){let e=c(3);s(3),w(e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.ProductDialog==null?null:e.AppConfigJSON.ModuleSell.ProductDialog.UnitQtyLabel),s(),m("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),P("ngModel",e.cartItem.UnitQuantity)}}function Ac(n,t){if(n&1&&(v(0,"input",41,3),b(2,"number")),n&2){let e=c(3);m("value",I(2,1,e.cartItem.Price))}}function Lc(n,t){if(n&1){let e=y();r(0,"input",46,3),O("ngModelChange",function(o){u(e);let a=c(3);return D(a.cartItem.Price,o)||(a.cartItem.Price=o),f(o)}),l()}if(n&2){let e=c(3);m("simpleKeyboard",e.keyboard)("readonly",!e.unitPriceEditor||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible),P("ngModel",e.cartItem.Price)}}function Fc(n,t){if(n&1&&(r(0,"div",43)(1,"span",47),p(2),l()()),n&2){let e,i=c(3);s(2),x("Pricebook ",(e=i.selectedPriceBook())==null?null:e.Name," is applied")}}function Bc(n,t){if(n&1){let e=y();g(0,Rc,2,1,"div",32),r(1,"div",33)(2,"div",34)(3,"strong"),p(4," Qty "),g(5,Nc,2,1,"span"),l(),r(6,"div",35)(7,"button",36),_("click",function(){u(e);let o=c(2);return f(o.updateItemQuantity(o.cartItem.Quantity!=null?o.cartItem.Quantity-1:0))}),p(8," - "),l(),r(9,"input",37,2),_("ngModelChange",function(o){u(e);let a=c(2);return f(a.updateItemQuantity(o))}),l(),r(11,"button",38),_("click",function(){u(e);let o=c(2);return f(o.updateItemQuantity(o.cartItem.Quantity!=null?o.cartItem.Quantity+1:1))}),p(12," + "),l()()(),g(13,Vc,5,5,"div",39),r(14,"div",40)(15,"strong"),p(16,"Price"),l(),g(17,Ac,3,3,"input",41)(18,Lc,2,3,"input",42),l(),g(19,Fc,3,1,"div",43),l()}if(n&2){let e=c(2);C(e._shoppingCartService.priceMinimumRestrictionWarning()&&e._shoppingCartService.priceMinimumRestrictionWarning().trim()!==""?0:-1),s(),m("ngClass",T(16,yc,e.statusModal=="create")),s(4),C(e.cartItem.Variant!=null&&e.cartItem.Variant.UOM&&(e.cartItem.Variant!=null&&e.cartItem.Variant.UOMName)?5:-1),s(2),m("ngClass",T(18,Na,(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible||e.checkQtyInputDisabled()))("disabled",(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible||e.checkQtyInputDisabled()||e.isSellEdit()&&e.isPrepaidPackage()),s(2),m("simpleKeyboard",e.keyboard)("preventNegative",!e.role.Return)("decimalPlaces",e.isSerialItem?0:e.AppConfigJSON==null||e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.ProductDialog==null?null:e.AppConfigJSON.ModuleSell.ProductDialog.DecimalPlaceDigit)("ngModel",e.cartItem.Quantity)("disabled",(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible||e.checkQtyInputDisabled()||e.isSellEdit()&&e.isPrepaidPackage()),s(2),m("ngClass",T(20,Na,(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible||e.checkQtyInputDisabled()))("disabled",(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible||e.checkQtyInputDisabled()||e.isSellEdit()&&e.isPrepaidPackage()),s(2),C(!(e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.ProductDialog==null)&&e.AppConfigJSON.ModuleSell.ProductDialog.UnitQtyLabel?13:-1),s(),m("hidden",!e.priceVisible),s(3),C(!e.unitPriceEditor||e.cartItem!=null&&e.cartItem.PromotionGift&&!e.editingItemPromotionVisible?17:18),s(2),C(e.selectedPriceBook()?19:-1)}}function jc(n,t){if(n&1){let e=y();r(0,"div",22)(1,"strong"),p(2,"Sales Person"),l(),r(3,"ng-select-infinite",48),_("selectedChange",function(o){u(e);let a=c(2);return f(a.updateSales(o))}),O("selectedChange",function(o){u(e);let a=c(2);return D(a.cartItem.SalesID,o)||(a.cartItem.SalesID=o),f(o)}),l()()}if(n&2){let e=c(2);s(3),m("customTooltip",e.salesPersonName)("items",e.sales),P("selected",e.cartItem.SalesID)}}function Hc(n,t){if(n&1){let e=y();r(0,"div",22)(1,"strong"),p(2,"Fulfillment From"),l(),r(3,"ng-select",49),_("ngModelChange",function(){u(e);let o=c(2);return f(o.onDeliveryEntityChange())}),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.cartItem.EntityID,o)||(a.cartItem.EntityID=o),f(o)}),l()()}if(n&2){let e=c(2);s(3),m("disabled",e.isSellEdit())("items",e.entities),P("ngModel",e.cartItem.EntityID)}}function Uc(n,t){if(n&1){let e=y();r(0,"div",15),g(1,Tc,6,6,"div",16),g(2,Ec,5,0,"div",20),g(3,Bc,20,22),r(4,"div",21),g(5,jc,4,3,"div",22),g(6,Hc,4,3,"div",22),l(),r(7,"div",23)(8,"div",24)(9,"POS-tinymce-editor",25),O("ngModelChange",function(o){u(e);let a=c();return D(a.cartItem.Note,o)||(a.cartItem.Note=o),f(o)}),l()()()()}if(n&2){let e=c();s(),C(e.statusModal==="create"?1:-1),s(),C(e.isSellEdit()&&e.isPrepaidPackage()?2:-1),s(),C(e.cartItem?3:-1),s(2),C(e.isEmptySalesID&&(e.sales==null?null:e.sales.length)>0&&e.role.SalesPerson?5:-1);let i=e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.ProductDialog==null?null:e.AppConfigJSON.ModuleSell.ProductDialog.SplitDeliveryOutletEnabled,o=(e.salesOrderData==null||e.salesOrderData.Order==null?null:e.salesOrderData.Order.DeliveryStateID)==e.deliveryStateID.Sent;s(),C(i&&o?6:-1),s(3),P("ngModel",e.cartItem.Note)}}function Wc(n,t){if(n&1&&(v(0,"input",41),b(1,"number")),n&2){let e=c(2);m("value",I(1,1,e.cartItem.Discount))}}function Qc(n,t){if(n&1){let e=y();r(0,"input",76,4),_("ngModelChange",function(o){u(e);let a=c(2);return f(a.updateDiscountPercentage(o))}),l()}if(n&2){let e=c(2);m("simpleKeyboard",e.keyboard)("ngModel",e.cartItem.Discount)("preventNegative",!0)("readonly",!e.role.Discount||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)}}function $c(n,t){if(n&1&&(v(0,"input",41),b(1,"number")),n&2){let e=c(2);m("value",I(1,1,e.inputedDiscountAmount))}}function qc(n,t){if(n&1){let e=y();r(0,"input",77,5),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.inputedDiscountAmount,o)||(a.inputedDiscountAmount=o),f(o)}),_("ngModelChange",function(o){u(e);let a=c(2);return f(a.onDiscountAmountChange(o))}),l()}if(n&2){let e=c(2);m("max",e.cartItem==null?null:e.cartItem.GrossTotal)("simpleKeyboard",e.keyboard),P("ngModel",e.inputedDiscountAmount),m("preventNegative",!0)("readonly",!e.role.Discount||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)}}function Gc(n,t){if(n&1&&(r(0,"div",56)(1,"div",52)(2,"strong"),p(3,"Discount Amount / Qty"),l()(),r(4,"div",53)(5,"div",78)(6,"p"),p(7),b(8,"number"),l()()()()),n&2){let e=c(2);s(7),w(I(8,1,e.cartItem.DiscountAmount))}}function zc(n,t){if(n&1){let e=y();r(0,"div",56)(1,"div",52)(2,"strong"),p(3,"Pricebook"),l()(),r(4,"div",53)(5,"ng-select",79),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.pricebookId,o)||(a.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())}),l()()()}if(n&2){let e=c(2);s(5),m("items",e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.PriceBook),P("ngModel",e.pricebookId),m("disabled",e.pricebookDisabled)}}function Jc(n,t){if(n&1&&(r(0,"div",70)(1,"h5",80),p(2),b(3,"number"),l()()),n&2){let e=c(2);s(2),x(" ",I(3,1,e.cartItem.Discount),"% ")}}function Kc(n,t){if(n&1&&(r(0,"div",71)(1,"h5"),p(2),b(3,"number"),l(),r(4,"span",69),p(5,"x"),l(),r(6,"h5"),p(7),b(8,"number"),l()()),n&2){let e=c(2);s(2),w(I(3,2,e.cartItem.Quantity)),s(5),w(I(8,4,e.cartItem.DiscountAmount))}}function Yc(n,t){if(n&1&&(r(0,"h5",74),p(1),b(2,"number"),l()),n&2){let e=c(2);s(),x(" -",I(2,1,(e.cartItem==null?null:e.cartItem.GrossTotal)*(e.cartItem.Discount/100))," ")}}function Zc(n,t){if(n&1&&(r(0,"div",73)(1,"h5",74),p(2),b(3,"number"),l()()),n&2){let e=c(2);s(2),x(" -",I(3,1,e.cartItem.Quantity*e.cartItem.DiscountAmount)," ")}}function Xc(n,t){if(n&1&&(r(0,"div",75)(1,"div",81)(2,"h5"),p(3,"Grand Total"),l()(),r(4,"div",81)(5,"h5"),p(6),b(7,"number"),l()()()),n&2){let e=c(2);s(6),w(I(7,1,e.cartItem.Total))}}function ep(n,t){if(n&1){let e=y();r(0,"div",16)(1,"div",50)(2,"div",51)(3,"div",52)(4,"strong"),p(5,"Discount %"),l()(),r(6,"div",53)(7,"div",54),g(8,Wc,2,3,"input",41)(9,Qc,2,4,"input",55),l()()(),r(10,"div",56)(11,"div",52)(12,"strong"),p(13,"Discount Amount"),l()(),r(14,"div",53)(15,"div",54),g(16,$c,2,3,"input",41)(17,qc,2,5,"input",57),l()()(),r(18,"div",58)(19,"div",59)(20,"input",60),O("ngModelChange",function(o){u(e);let a=c();return D(a.isDiscMultipliciedQty,o)||(a.isDiscMultipliciedQty=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onSwitchToggleDiscount())}),l()(),r(21,"div",61)(22,"strong"),p(23,"*Quantity"),l(),r(24,"span",62),v(25,"i",63),l()()(),g(26,Gc,9,3,"div",56),g(27,zc,6,3,"div",56),l(),r(28,"div",64)(29,"div",65)(30,"h4"),p(31,"Discount Simulation"),l(),r(32,"h4",66),p(33),l()(),r(34,"div",67)(35,"div",52)(36,"div",68)(37,"h5"),p(38),b(39,"number"),l(),r(40,"span",69),p(41,"x"),l(),r(42,"h5"),p(43),b(44,"number"),l()(),g(45,Jc,4,3,"div",70),g(46,Kc,9,6,"div",71),l(),r(47,"div",52)(48,"div",72)(49,"h5"),p(50),b(51,"number"),l()(),r(52,"div",73),g(53,Yc,3,3,"h5",74),l(),g(54,Zc,4,3,"div",73),l(),g(55,Xc,8,3,"div",75),l()()()}if(n&2){let e=c();s(8),C(!e.role.Discount||e.cartItem!=null&&e.cartItem.PromotionGift&&!e.editingItemPromotionVisible?8:9),s(8),C(!e.role.Discount||e.cartItem!=null&&e.cartItem.PromotionGift&&!e.editingItemPromotionVisible?16:17),s(4),P("ngModel",e.isDiscMultipliciedQty),s(6),C(e.isDiscMultipliciedQty?-1:26),s(),C(e.cartItem.Variant!=null&&(!(e.cartItem==null||e.cartItem.Variant==null)&&e.cartItem.Variant.PriceBook)&&(e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.PriceBook.length)>0?27:-1),s(6),x(" ",e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.Name," "),s(5),w(I(39,14,e.cartItem.Quantity)),s(5),w(I(44,16,e.cartItem.Price)),s(2),C(e.cartItem.Discount?45:-1),s(),C(e.cartItem.DiscountAmount>0?46:-1),s(4),w(I(51,18,e.cartItem==null?null:e.cartItem.GrossTotal)),s(3),C(e.cartItem.Discount?53:-1),s(),C(e.cartItem.DiscountAmount>0?54:-1),s(),C(e.cartItem.DiscountAmount>0||e.cartItem.Discount>0?55:-1)}}function tp(n,t){n&1&&(r(0,"div",84),v(1,"i",99),r(2,"h6"),p(3,"No Image"),l()())}function ip(n,t){if(n&1&&v(0,"img",85),n&2){let e=c(2);m("src",e.cartItem.Variant.ThumbnailUrl,nt)}}function np(n,t){if(n&1){let e=y();r(0,"button",104),_("click",function(){u(e);let o=c(4);return f(o.toggleEditCost())}),v(1,"i",105),l()}}function op(n,t){if(n&1&&(r(0,"div",101)(1,"div",98),p(2),b(3,"number"),l(),g(4,np,2,0,"button",103),l()),n&2){let e=c(3);s(2),Ee(" ",e.currencySymbol," ",ne(3,3,e.cartItem.Cost,"1.0-4")," "),s(2),C(!(e.AppConfigJSON==null||e.AppConfigJSON.ModuleSell==null)&&e.AppConfigJSON.ModuleSell.Cost.Enabled?4:-1)}}function rp(n,t){if(n&1){let e=y();r(0,"button",109),_("click",function(){u(e);let o=c(4);return f(o.toggleEditCost())}),v(1,"i",110),l()}}function ap(n,t){if(n&1){let e=y();r(0,"div",102)(1,"div",106)(2,"input",107),O("ngModelChange",function(o){u(e);let a=c(3);return D(a.cartItem.Cost,o)||(a.cartItem.Cost=o),f(o)}),l(),g(3,rp,2,0,"button",108),l()()}if(n&2){let e=c(3);s(2),P("ngModel",e.cartItem.Cost),s(),C(!(e.AppConfigJSON==null||e.AppConfigJSON.ModuleSell==null)&&e.AppConfigJSON.ModuleSell.Cost.Enabled?3:-1)}}function lp(n,t){if(n&1&&(r(0,"div",93)(1,"div",100)(2,"div",90),p(3,"Cost"),l(),g(4,op,5,6,"div",101),g(5,ap,4,2,"div",102),l()()),n&2){let e=c(2);m("ngClass",e.generalPriceCol),s(),m("ngClass",T(4,Dc,e.enabledEditCost())),s(3),C(e.enabledEditCost()?-1:4),s(),C(e.enabledEditCost()?5:-1)}}function sp(n,t){if(n&1&&(r(0,"div",93)(1,"div",89)(2,"div",90),p(3,"Commission"),l(),r(4,"div",98),p(5),b(6,"number"),l()()()),n&2){let e=c(2);m("ngClass",e.generalPriceCol),s(5),Ee(" ",e.currencySymbol," ",I(6,3,1e4)," ")}}function cp(n,t){if(n&1&&(r(0,"div",97)(1,"div",89)(2,"div",90),p(3,"Storage Location"),l(),r(4,"div",98),p(5),l()()()),n&2){let e=c(2);s(5),x(" ",e.cartItem.Variant.Storage," ")}}function pp(n,t){if(n&1&&(r(0,"tr")(1,"td",114),p(2),l(),r(3,"td",115),p(4),b(5,"number"),l(),r(6,"td",115),p(7),b(8,"number"),l()()),n&2){let e=t.$implicit,i=c(3);s(2),x(" ",e.Name," "),s(2),x(" ",I(5,4,e.MinimumQuantity)," "),s(3),Ee(" ",i.currencySymbol," ",I(8,6,e.UnitPrice)," ")}}function dp(n,t){if(n&1&&(r(0,"div",21)(1,"h5",87),p(2,"Pricebook"),l(),r(3,"div",96)(4,"table",111)(5,"thead")(6,"tr")(7,"th",112),p(8,"Name"),l(),r(9,"th",113),p(10,"Min Qty"),l(),r(11,"th",113),p(12,"Price"),l()()(),r(13,"tbody"),ee(14,pp,9,8,"tr",null,pe),b(16,"sortBy"),l()()()()),n&2){let e=c(2);s(14),te(Ae(16,0,e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.PriceBook,"asc","MinimumQuantity"))}}function mp(n,t){if(n&1&&(r(0,"div",16)(1,"div",82)(2,"a",83),g(3,tp,4,0,"div",84)(4,ip,1,1,"img",85),l()(),r(5,"div",86)(6,"div",16)(7,"h5",87),p(8,"Inventory"),l(),r(9,"div",88)(10,"div",89)(11,"div",90),p(12,"On Hand"),l(),r(13,"div",91),p(14),b(15,"quantityFraction"),l()()(),r(16,"div",88)(17,"div",89)(18,"div",90),p(19,"Allocated"),l(),r(20,"div",91),p(21),b(22,"quantityFraction"),l()()(),r(23,"div",88)(24,"div",92)(25,"div",90),p(26,"Available"),l(),r(27,"div",91),p(28),b(29,"quantityFraction"),l()()()(),r(30,"div",21)(31,"h5",87),p(32,"General Price"),l(),g(33,lp,6,6,"div",93),r(34,"div",93)(35,"div",94)(36,"div",90),p(37,"Price"),l(),r(38,"div",95),p(39),b(40,"number"),l()()(),g(41,sp,7,5,"div",93),l(),r(42,"div",21)(43,"div",96)(44,"div",16)(45,"h5",87),p(46,"Advanced"),l(),r(47,"div",97)(48,"div",89)(49,"div",90),p(50,"Content"),l(),r(51,"div",98),p(52),b(53,"number"),l()()(),g(54,cp,6,1,"div",97),l()()(),g(55,dp,17,4,"div",21),l()()),n&2){let e=c();s(2),m("routerLink",st(28,xc))("queryParams",T(29,Ic,e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.ID)),s(),C((e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.ThumbnailUrl)==null?3:4),s(11),x(" ",I(15,18,e.onHand)," "),s(7),x(" ",I(22,20,e.allocated)," "),s(7),x(" ",I(29,22,e.onHand-e.allocated)," "),s(5),C(!(e.AppConfigJSON==null||e.AppConfigJSON.ModuleSell==null)&&e.AppConfigJSON.ModuleSell.Cost.Visible&&e.role.Cost?33:-1),s(),m("ngClass",e.generalPriceCol),s(5),Ee(" ",e.currencySymbol," ",I(40,24,e.cartItem.Variant.UnitPrice)," "),s(2),C(e.role.Commission&&(e.cartItem!=null&&e.cartItem.SalesCommission)?41:-1),s(6),le(T(31,Pc,!(!(e.AppConfigJSON==null||e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.Grid==null)&&e.AppConfigJSON.ModuleSell.Grid.StorageVisible)||!e.cartItem.Variant.Storage)),s(5),Ho(" ",e.cartItem==null?null:e.cartItem.VariantUnitQuantity," (@",e.currencySymbol,"",I(53,26,e.cartItem.Price/(e.cartItem==null?null:e.cartItem.VariantUnitQuantity)),") "),s(2),C(!(e.AppConfigJSON==null||e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.Grid==null)&&e.AppConfigJSON.ModuleSell.Grid.StorageVisible&&e.cartItem.Variant.Storage?54:-1),s(),C((e.cartItem==null||e.cartItem.Variant==null||e.cartItem.Variant.PriceBook==null?null:e.cartItem.Variant.PriceBook.length)>0?55:-1)}}function up(n,t){if(n&1){let e=y();r(0,"app-item-serial",116),O("cartItemChange",function(o){u(e);let a=c();return D(a.cartItem,o)||(a.cartItem=o),f(o)})("serialsChange",function(o){u(e);let a=c();return D(a.serials,o)||(a.serials=o),f(o)}),l()}if(n&2){let e=c();m("entityId",e.deliveryEntityId),P("cartItem",e.cartItem),m("disabled",e.orderManager.posState==2&&e.constants.IsNotEmpty(e.cartItem.ID)),P("serials",e.serials)}}function fp(n,t){if(n&1){let e=y();r(0,"div",18)(1,"item-calculator-tab",117),_("discountTotal",function(o){u(e);let a=c();return f(a.cartItem.Discount=o)})("priceTotal",function(o){u(e);let a=c();return f(a.cartItem.Price=o)})("qtyTotal",function(o){u(e);let a=c();return f(a.cartItem.Quantity=o)})("noteChanges",function(o){u(e);let a=c();return f(a.enableCalculatorNote()?a.cartItem.Note=o:null)}),l()()}if(n&2){let e=c();m("hidden",e.modalItemState.CALCULATOR!=e.currentState),s(),m("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 Fn{constructor(e,i,o,a,h,E,F,Ce,Te,Be,gi,Ci,Nt,to,_i){super();this._dialogRef=e;this.data=i;this._shoppingCartService=o;this._outletService=a;this._posService=h;this._orderProcessorService=E;this._orderDataService=F;this._variantService=Ce;this._toastr=Te;this.decimalPipe=Be;this._matDialog=gi;this._numpadService=Ci;this._userRoleService=Nt;this._onlineStatusService=to;this.cdRef=_i;this.destroy$=new Q,this.entities=this._posService.Data.Entities,this.AppConfigJSON=this._posService.Data.AppConfigJSON,this.mapAppConfigJson(this.AppConfigJSON),this.subscribeToObservableChanges(),this.modalConfig.customWidth="800px",this.modalConfig.okText="Save",this.currencySymbol=this.invoiceCalculatorService.currencySymbol}calculatorTab=Qo(At);_quantityElement;_priceElement;_discountElement;_costElement;invoiceCalculatorService=$(ge);salesPersonName;destroy$;AppConfigJSON=new Br;orderManager;salesOrderData;isOnline=!0;currentState;modalItemState=bo;isDiscMultipliciedQty=!0;inputedDiscountAmount=0;serials=[];constants=S;deliveryEntityId;selectedPriceBook=R(null);isPrepaidPackage=R(!1);isSellEdit=R(!1);deliveryStateID=lo;currencySymbol;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=ti(Re,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 Re}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()}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 a=o,h=new Re;h.patchByVariant(a),this.addItem(h)})}onEnterProductCode(e){let i=this.salesOrderData.Order.EntityID;this._variantService.findVariantByCode(e,i).then(o=>{if(o){let a=Object.assign(new Er,o),h=new Re;h.patchByVariant(a),this.addItem(h)}else this.onProductNotFound(e)}).catch(o=>{window.alert(`Barcode "${e}" is not registered in the product`)})}onProductNotFound(e){this._matDialog.open(Ln,{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 a=`Editing Cart item - ${e.Variant?e.Variant.Name:null}`;this.updateOrUnitPrice(e.UnitPriceOriginal),this.updateHeaderTitle(a),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}toggleEditCost(){return this.enabledEditCost.update(e=>!e)}get generalPriceCol(){return this.role.Commission&&this.cartItem?.SalesCommission&&this.AppConfigJSON?.ModuleSell?.Cost.Visible&&this.role.Cost?"col-4":this.role.Commission&&this.cartItem?.SalesCommission||this.AppConfigJSON?.ModuleSell?.Cost.Visible&&this.role.Cost?"col-6":"col-12"}ngOnDestroy(){this._shoppingCartService.priceMinimumRestrictionWarning.set(""),this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(i){return new(i||n)(d(B),d(Oe),d(de),d(G),d(A),d(U),d(V),d($i),d(J),d(K),d(re),d(Yr),d(ce),d(pt),d($o))};static \u0275cmp=M({type:n,selectors:[["POS-modal-item"]],viewQuery:function(i,o){if(i&1&&(Lo(o.calculatorTab,At,5),Se(hc,5),Se(vc,5),Se(bc,5),Se(Sc,5)),i&2){Fo();let a;ye(a=xe())&&(o._quantityElement=a.first),ye(a=xe())&&(o._priceElement=a.first),ye(a=xe())&&(o._discountElement=a.first),ye(a=xe())&&(o._costElement=a.first)}},standalone:!1,features:[Ei],decls:18,vars:15,consts:[["variant",""],["itemTemplate",""],["quantity",""],["price",""],["discount",""],["AMOUNT",""],[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"],["data-cy","product",1,"btn","btn-link-tab",3,"ngClass"],["data-cy","serial",1,"btn","btn-link-tab",3,"ngClass"],[1,"mx-8"],[1,"py-8"],[1,"row"],[3,"entityId","cartItem","disabled","serials"],[3,"hidden"],["data-cy","serial",1,"btn","btn-link-tab",3,"click","ngClass"],[1,"alert","alert-warning","text-center","my-5","py-3"],[1,"row","mt-6"],[1,"col-auto","pe-0"],[1,"row","mt-6","mb-5"],[1,"col","tinymce"],["height","210px",3,"ngModelChange","ngModel"],[1,"col"],["inputID","product","requestUrl","/API/AC/GetVariantSuggestionByCodeNName","placeholder","Input product name / code",1,"form-control",3,"onSelect","onInputEnter","localStorage","renderThumbnail","inputTextValue","clearOnSelect","useCustomTemplate","itemTemplate"],[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,"bg-gradient-warning","p-4","justify-content-center","align-items-center","d-flex","gap-2",2,"margin-bottom","12px","border-radius","8px"],[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"],[1,"col-auto","pe-0",2,"width","82px"],[1,"col-auto","pe-0",2,"width","112px",3,"hidden"],["disabled","",1,"form-control","cart-input",3,"value"],["id","inputPrice","keyboardType","number","type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input",3,"simpleKeyboard","readonly","ngModel"],[1,"col-auto","d-flex","align-items-center","pt-5"],[3,"innerHTML"],["type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input","input-numpad",3,"ngModelChange","preventNegative","readOnly","decimalPlaces","ngModel"],["id","inputPrice","keyboardType","number","type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input",3,"ngModelChange","simpleKeyboard","readonly","ngModel"],[1,"bg-gradient-warning","py-4","px-2"],["position","top","parent","body","bindValue","ID","bindLabel","Name","placeholder","Sales Person",3,"selectedChange","customTooltip","items","selected"],["bindLabel","Name","bindValue","ID","placeholder","Delivery Outlet","appendTo","body",2,"width","200px",3,"ngModelChange","disabled","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"],["id","inputDiscount","keyboardType","number","type","text","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","cart-input",3,"simpleKeyboard","ngModel","preventNegative","readonly"],[1,"row","d-flex","align-items-center","justify-content-start","mt-4"],["id","inputDiscAmount","keyboardType","number","type","text","autoNum","","emptyInputBehavior","zero",1,"form-control","cart-input",3,"max","simpleKeyboard","ngModel","preventNegative","readonly"],[1,"d-flex","align-items-center","mt-4"],[1,"form-check","form-switch","form-switch-lg","ms-1","mt-1"],["type","checkbox","id","flexSwitchCheckDefault",1,"form-check-input",3,"ngModelChange","ngModel"],[1,"ms-4"],["matTooltipPosition","above","matTooltip",`Use the final discount amount if you want to discount the price of the total
|
|
7
|
+
quantity of the product. The nominal will be calculated automatically and filled in the discount amount box.`,1,"pointer"],[1,"fa-solid","fa-info-circle","ms-2"],[1,"col-6","py-8"],[1,"w-100","text-center"],[1,"text-start","mt-12"],[1,"row","mt-12"],[1,"w-100","d-flex","align-items-center","justify-content-end"],[1,"mx-1","fw-bold"],[1,"d-flex","align-items-center","justify-content-end","mt-2"],[1,"d-flex","align-items-center","justify-content-end","mt-2","text-danger"],[1,"w-100","d-flex","justify-content-end"],[1,"w-100","d-flex","justify-content-end","mt-2"],[1,"text-danger"],[1,"row","border-top","mx-0","px-0","mt-4"],["id","inputDiscount","keyboardType","number","type","text","autoNum","","percentage","","decimalPlaces","2","emptyInputBehavior","zero",1,"form-control","cart-input",3,"ngModelChange","simpleKeyboard","ngModel","preventNegative","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,"fw-bold","text-danger"],[1,"col-6","d-flex","justify-content-end","mt-4"],[1,"col-12","mt-4",2,"padding","10px"],["target","_blank",1,"d-flex","justify-content-center","align-items-center",2,"color","inherit",3,"routerLink","queryParams"],[1,"text-center"],[1,"border","rounded",3,"src"],[1,"col-12",2,"padding","10px"],[1,"border-bottom","section-header"],[1,"col-4","m-0","p-3"],[1,"info-box"],[1,"info-label","mb-2"],[1,"info-value","info-value-md"],[1,"info-box","available"],[1,"m-0","p-3",3,"ngClass"],[1,"info-box","price-highlight"],[1,"info-value","info-value-sm","mt-3"],[1,"col-12","m-0","p-3"],[1,"col-6","m-0","p-3"],[1,"info-value","info-value-sm"],["aria-hidden","true",1,"fa-solid","fa-image","fa-5x"],[1,"info-box",3,"ngClass"],[1,"info-value-wrapper"],[1,"info-input"],["aria-label","Toggle edit mode",1,"lock-toggle-btn"],["aria-label","Toggle edit mode",1,"lock-toggle-btn",3,"click"],[1,"fa","fa-lock"],[1,"info-input-wrapper"],["type","text","autoNum","",1,"info-value-input","form-control",3,"ngModelChange","ngModel"],["aria-label","Save and lock",1,"lock-toggle-btn","unlocked"],["aria-label","Save and lock",1,"lock-toggle-btn","unlocked",3,"click"],[1,"fa","fa-unlock"],[1,"table","table-bordered","inventory-table"],[1,"py-6","border-end"],[1,"py-6","border-end","text-end"],[1,"py-6"],[1,"py-6","text-end"],[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",6),_("onOk",function(h){return o.onOk(h)})("onCancel",function(){return o.onCancel()})("onClose",function(){return o.onCancel()}),r(1,"content",7)(2,"div",8)(3,"div",9)(4,"div")(5,"a",10),_("click",function(){return o.onTabChange(o.modalItemState.SELL_INPUT)}),p(6," Cart "),l(),r(7,"a",11),_("click",function(){return o.onTabChange(o.modalItemState.DISCOUNT)}),p(8," Discount "),l(),g(9,Oc,2,3,"a",12),g(10,Mc,2,3,"a",13),g(11,wc,2,3,"a",13),l()(),r(12,"div",14),g(13,Uc,10,6,"div",15),g(14,ep,56,20,"div",16),g(15,mp,56,33,"div",16),g(16,up,1,4,"app-item-serial",17),g(17,fp,2,7,"div",18),l()()()()),i&2&&(m("config",o.modalConfig),s(5),m("ngClass",T(11,ki,o.modalItemState.SELL_INPUT==o.currentState)),s(2),m("ngClass",T(13,ki,o.modalItemState.DISCOUNT==o.currentState)),s(2),C(!(o.cartItem==null||o.cartItem.Variant==null)&&o.cartItem.Variant.Name&&o.hasInventoryView?9:-1),s(),C(o.isSerialItem?10:-1),s(),C(o.productCalculator()?11:-1),s(2),C(o.modalItemState.SELL_INPUT==o.currentState?13:-1),s(),C(o.modalItemState.DISCOUNT==o.currentState?14:-1),s(),C(o.modalItemState.PRODUCT==o.currentState?15:-1),s(),C(o.modalItemState.SERIAL==o.currentState?16:-1),s(),C(o.productCalculator()?17:-1))},dependencies:[z,Y,zt,q,oe,j,gt,se,Ze,ct,$t,Xr,fa,Xt,Dt,At,ca,K,br,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}.section-header[_ngcontent-%COMP%]{padding-bottom:6px;margin-bottom:6px;padding-left:0}.info-box[_ngcontent-%COMP%]{background:#f8f9fa;border:1px solid #e5e5e5;border-radius:6px;padding:16px;text-align:center;position:relative;transition:all .3s ease;height:100%}.info-label[_ngcontent-%COMP%]{font-size:12px;color:#666;text-transform:uppercase;letter-spacing:.5px}.info-value[_ngcontent-%COMP%]{font-weight:600;color:#333}.info-value-sm[_ngcontent-%COMP%]{font-size:16px}.info-value-md[_ngcontent-%COMP%]{font-size:20px}.info-box.available[_ngcontent-%COMP%]{background:#f0f8f0;border-color:#d0e8d0}.info-box.available[_ngcontent-%COMP%] .info-value[_ngcontent-%COMP%]{color:#2d5f2d}.info-box.price-highlight[_ngcontent-%COMP%] .info-value[_ngcontent-%COMP%]{color:#0b5ed7}.info-box.editable-box.editing[_ngcontent-%COMP%]{background:#fffef0;border-color:#ffc107;box-shadow:0 0 0 3px #ffc1071a}.info-value-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:10px}.lock-toggle-btn[_ngcontent-%COMP%]{background:#0000000d;border:none;padding:6px;cursor:pointer;color:#666;transition:all .2s ease;display:flex;align-items:center;justify-content:center;border-radius:6px;width:32px;height:32px;flex-shrink:0}.lock-toggle-btn[_ngcontent-%COMP%]:hover{color:#0b5ed7;background:#0b5ed726;transform:scale(1.05)}.lock-toggle-btn.unlocked[_ngcontent-%COMP%]{color:#ff6b00;background:#ff6b0026}.lock-toggle-btn.unlocked[_ngcontent-%COMP%]:hover{color:#c50;background:#ff6b0040;transform:scale(1.05)}.info-input-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:10px;width:100%}.info-value-input[_ngcontent-%COMP%]{font-size:16px;font-weight:600;color:#333;border:2px solid #0b5ed7;border-radius:6px;text-align:center;background:#fff;width:100%;outline:none;transition:border-color .2s}.info-value-input[_ngcontent-%COMP%]:focus{border-color:#0056b3;box-shadow:0 0 0 3px #0b5ed71a}.editable-box[_ngcontent-%COMP%]{background:#fffef0;border-color:#ffc107;box-shadow:0 0 0 3px #ffc1071a}.section[_ngcontent-%COMP%]{margin-bottom:32px}.section-title[_ngcontent-%COMP%]{font-size:16px;font-weight:600;color:#333;margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #e5e5e5}.info-list[_ngcontent-%COMP%]{display:flex;flex-direction:column}.list-item[_ngcontent-%COMP%]{background:#fafafa;border:1px solid #e5e5e5;border-radius:6px;padding:14px 16px;font-size:14px;color:#333}table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{text-transform:none;background:#f8f9fa}"]})};var gp=n=>({"is-invalid":n});function Cp(n,t){n&1&&(r(0,"div",8)(1,"span"),p(2,"Host URL is required."),l()())}function _p(n,t){n&1&&(r(0,"span",9),p(1,"Enter the port or device URL used by your ECR middleware."),l())}var Bn=class n{constructor(t){this.dialogRef=t;this.config.title="Connect ECR",this.config.customWidth="400px"}ecrService=$(kt);config=new H;urlCtrl=new bt("https://localhost:5001/EcrHub",[yi.required]);onClose(){this.dialogRef.close()}onConnect(){this.urlCtrl.valid&&this.dialogRef.close(this.urlCtrl.value)}get modalContentWording(){let t="ECR Connected",e="Your ECR is now online. You can process payments using the BCA EDC machine immediately.",i="ECR Not Connected",o="To enable payments using the BCA EDC machine, please connect the ECR middleware through the port or URL below.",a=this.ecrService.isConnected()?t:i,h=this.ecrService.isConnected()?e:o;return{title:a,description:h}}static \u0275fac=function(e){return new(e||n)(d(B))};static \u0275cmp=M({type:n,selectors:[["app-modal-connect-ecr"]],decls:15,vars:10,consts:[[3,"onCancel","onClose","onOk","config","dynamicValidated"],[1,"d-flex","flex-column",2,"row-gap","1.5rem"],[1,"text-center","d-flex","flex-column","align-items-center",2,"row-gap","0.8rem"],[1,"fa-solid","fa-mobile-signal-out","fa-3x","d-flex","align-items-center","justify-content-center","bg-light",2,"border-radius","50%","width","80px","height","80px",3,"ngClass"],[1,"fw-normal"],[1,"card","d-flex","justify-content-center","p-8","bg-light-gray",2,"border-radius","12px","margin","0"],["for","floatingInput",1,"fw-semibold","mb-2"],["id","floatingInput","placeholder","Host URL","type","text",1,"form-control",2,"border-radius","8px","padding","12px 16px",3,"ngClass","formControl"],[1,"invalid-feedback","mt-4"],[1,"text-muted","mt-4"]],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,"div",2),v(4,"i",3),r(5,"h2"),p(6),l(),r(7,"span",4),p(8),l()(),r(9,"div",5)(10,"label",6),p(11,"Port / URL"),l(),v(12,"input",7),g(13,Cp,3,0,"div",8)(14,_p,2,0,"span",9),l()()()()),e&2&&(m("config",i.config)("dynamicValidated",i.urlCtrl.valid),s(4),m("ngClass",i.ecrService.isConnected()?"text-success":"text-danger"),s(2),w(i.modalContentWording.title),s(2),w(i.modalContentWording.description),s(4),m("ngClass",T(8,gp,i.urlCtrl.invalid&&(i.urlCtrl.touched||i.urlCtrl.dirty)))("formControl",i.urlCtrl),s(),C(i.urlCtrl.invalid&&(i.urlCtrl.touched||i.urlCtrl.dirty)?13:14))},dependencies:[X,z,j,Je,Y,q,St],encapsulation:2})};function hp(n,t){if(n&1){let e=y();r(0,"div",12)(1,"radio-options",13),O("modelChange",function(o){u(e);let a=c(2);return D(a.odsConfigType,o)||(a.odsConfigType=o),f(o)}),l(),r(2,"label",14),p(3,"Choose Configuration"),l()()}if(n&2){let e=c(2);s(),P("model",e.odsConfigType),m("options",t.options.OrderDisplayBroadcastModeType)}}function vp(n,t){if(n&1&&(g(0,hp,4,2,"div",12),b(1,"async")),n&2){let e,i=c();C((e=I(1,1,i.odsConfig$))?0:-1,e)}}function bp(n,t){n&1&&(r(0,"div",4)(1,"div",15),v(2,"i",16),l(),r(3,"div",17)(4,"div"),p(5," Choose outlet first before configuring Order Display! "),l()()())}var jn=class n{constructor(t,e,i,o){this.dialogRef=t;this.httpService=e;this.outletRegisterService=i;this.data=o;this.modalConfig=new H,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(ve(e=>{this.odsConfigType=e.form?.OrderDisplayBroadcastMode}),vi(e=>(console.error("Error loading ODS configuration:",e),hi({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"}]}}))),jt(1))}onSave(){let e={EntityID:this.outletRegisterService.Data.EntityID,OrderDisplayBroadcastMode:this.odsConfigType};this.httpService.post("/api/outlet/UpdateOrderDisplayBroadcastMode",e).pipe(ve(()=>{this.dialogRef.close(e)}),vi(i=>(console.error("Error saving ODS configuration:",i),hi(null)))).subscribe()}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(B),d(Le),d(G),d(Oe))};static \u0275cmp=M({type:n,selectors:[["modal-ods-config"]],decls:17,vars:3,consts:[[3,"onOk","onClose","onCancel","config"],[1,"container"],[1,"row"],[1,"col-12","text-center"],[1,"warning-banner","mt-4","d-flex","align-items-center","p-3","border","rounded","bg-light"],[1,"text-center","mt-4"],[1,"m-0"],[1,"col-12","mt-2"],[1,"text-center"],["src","https://cdn.dealpos.xyz/web-image/dealpos_order_fulfillment_u7xzqe.png","alt","Order Display System",1,"img-fluid","mb-4"],[1,"mb-0"],["target","_blank",1,"fw-bold",3,"href"],[1,"form-floating-outline","radio","border","rounded","mt-4",2,"height","auto !important"],["id","odsConfigType",3,"modelChange","model","options"],["for","odsConfigType"],[1,"ms-2","me-3"],[1,"fas","fa-exclamation-triangle","text-warning","fa-lg"],[1,"warning-text"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.onSave()})("onClose",function(){return i.onClose()})("onCancel",function(){return i.onClose()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div",3),g(5,vp,2,3)(6,bp,6,0,"div",4),r(7,"div",5)(8,"p",6),p(9," 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. "),l()()(),r(10,"div",7)(11,"div",8),v(12,"img",9),r(13,"p",10),p(14," You can access this feature through "),r(15,"a",11),p(16,"ods.dealpos.app"),l()()()()()()()()),e&2&&(m("config",i.modalConfig),s(5),C(i.hasOutlet?5:6),s(10),m("href",i.odsLink,nt))},dependencies:[X,be,ei,j,ze],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 Sp(n,t){if(n&1&&(r(0,"p",9),p(1),l()),n&2){let e=t.$implicit;s(),x(" ",e," ")}}function yp(n,t){if(n&1&&(r(0,"div",10)(1,"p",11)(2,"span",12),p(3," Valid until "),r(4,"span",13),p(5),b(6,"date"),l()()()()),n&2){c();let e=Wo(7);s(5),w(ne(6,1,e,"longDate"))}}function xp(n,t){if(n&1&&(r(0,"div",2)(1,"div",6)(2,"span",7),p(3),l(),r(4,"div",8),ee(5,Sp,2,1,"p",9,Vt),Ri(7),g(8,yp,7,4,"div",10),l()()()),n&2){let e,i,o,a=c();s(3),x(" ",(e=a.coupon())==null||e.Coupon==null?null:e.Coupon.Title," "),s(2),te((i=a.coupon())==null||i.Coupon==null?null:i.Coupon.Requirement),s(2);let h=Uo((o=a.coupon())==null||o.Coupon==null?null:o.Coupon.Expiry);s(),C(h&&h!=a.mindate?8:-1)}}function Ip(n,t){n&1&&(r(0,"p",14),v(1,"i",15),r(2,"span",13),p(3,"Edit Mode: "),l(),p(4," Coupon information is displayed for reference only. Coupon removal is not available in edit mode. "),l())}function Pp(n,t){n&1&&(r(0,"p",5),v(1,"i",16),r(2,"span",13),p(3,"Important: "),l(),p(4," Removing the coupon removes the invoice level discount. Any discounts already applied to individual items will be kept. "),l())}function Dp(n,t){if(n&1&&g(0,Ip,5,0,"p",14)(1,Pp,5,0,"p",5),n&2){let e=c();C(e.isRemoveCouponOnEdit()?1:0)}}function Op(n,t){n&1&&(r(0,"p",5),v(1,"i",16),r(2,"span",13),p(3,"Important: "),l(),p(4,"Removing this coupon will reset your cart to its original state. All discounts and price changes from this coupon will be removed. "),l())}var Hn=class n{dialogRef=$(B);orderProcessorService=$(U);posService=$(A);promotionCouponService=$(Mt);promotionExternalCoupon=$(wt);modalConfig;isEdit=R(!1);isRemoveCouponOnEdit=ao(()=>this.posService.Data?.AppConfigJSON?.ModuleSell?.RemoveCouponOnEdit);mindate=S.MinDate;coupon=ao(()=>this.promotionCouponService.appliedCoupon()||this.promotionExternalCoupon.coupon);constructor(){this.initModalConfig()}initModalConfig(){let t=this.orderProcessorService.Data.posState;this.modalConfig=new H,this.modalConfig.title=this.generateDialogTitle(),this.modalConfig.customWidth="400px",this.isEdit.set(t===2),t===2?(this.isRemoveCouponOnEdit()?(this.modalConfig.okText="Remove",this.modalConfig.hideCancel=!0):(this.modalConfig.hideOk=!0,this.modalConfig.cancelText="Close"),this.isEdit.set(!0)):(this.modalConfig.okText="Remove",this.modalConfig.hideCancel=!0)}generateDialogTitle(){return`Coupon ${this.maskCouponCode(this.coupon()?.Code)} Applied`}maskCouponCode(t){return t?`***${t.slice(-2)}`:""}onClose(){this.dialogRef.close(!1)}onRemove(){this.dialogRef.close(!0)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=M({type:n,selectors:[["app-modal-confirm-remove-coupon"]],decls:8,vars:3,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container-fluid"],[1,"card","coupon-card","mb-8"],[1,"card","warning-card","mb-0"],[1,"card-body","d-flex","justify-content-center","align-items-center"],[1,"warning-msg","mb-0","text-warning-emphasis"],[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,"mb-0","p-4"],[1,"opacity-75"],[1,"fw-bold"],[1,"warning-msg","mb-0","text-info-emphasis"],[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){if(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),g(3,xp,9,3,"div",2),r(4,"div",3)(5,"div",4),g(6,Dp,2,1)(7,Op,5,0,"p",5),l()()()()()),e&2){let o;m("config",i.modalConfig),s(3),C((o=i.coupon())!=null&&o.Coupon?3:-1),s(3),C(i.isEdit()?6:7)}},dependencies:[X,j,We],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;color:#fff;padding:12px 24px;border-radius:50px;font-size:1.4rem;font-weight:700;margin-bottom:20px;box-shadow:0 4px 15px #89b03e4d}.badge-success[_ngcontent-%COMP%]{background:linear-gradient(135deg,#89b03e,#a4c449)}.badge-warning[_ngcontent-%COMP%]{background:linear-gradient(135deg,#ffc107,#ffd451)}']})};var Rt=class n{constructor(t,e,i,o,a,h,E,F,Ce,Te,Be,gi,Ci,Nt,to,_i,yo,io){this.roleService=t;this.orderProcessorService=e;this.promotionService=i;this.promotionCouponV2Service=o;this.promotionCouponProvider=a;this.dialog=h;this.parkOrderService=E;this.salesOrderService=F;this.outletRegisterService=Ce;this.pageInitialService=Te;this.toastrService=Be;this.httpService=gi;this.shoppingCartService=Ci;this.customerDisplay=Nt;this.ecrService=to;this.ecrSignalR=_i;this.cashMachineService=yo;this.orderDisplayService=io;this.destroy$=new Q,this.sourceMenu=[...Ra],this._moreMenu=new no(this.sourceMenu),this.moreMenu$=this._moreMenu.asObservable(),this.initElgiblePromotion(),this.subscribeObservable()}_moreMenu;moreMenu$;eligiblePromotions$;destroy$;sourceMenu;_enabledDragDrop=new no(!0);enabledDragDrop$=this._enabledDragDrop.asObservable();subscribeObservable(){Ti([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(it(()=>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(Hn).afterClosed().pipe(ie(o=>o)).subscribe(()=>this.removePromotionCoupon()):this.dialog.open(On);break;case"PROMOTION":this.shoppingCartService.isNonAuthorizedCouponType?this.shoppingCartService.isShoppingCartLockedByPromotionCoupon():this.dialog.open(nn,{id:"promotion-event"});break;case"UPLOAD":this.onImportItems();break;case"RETURN":this.dialog.open(Mn);break;case"CLEAR":this.dialog.open(Dn);break;case"SERIAL":this.dialog.open(wn);break;case"SPLIT":this.onSplitItem();break;case"PRINT":this.parkOrderService.onPrintRetrieve();break;case"CANCEL":this.onCancel();break;case"SYNC":this.dialog.open(En);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;case"CASH_MACHINE":this.openModalCashMachineUrl();break}}removePromotionCoupon(){let t=this.promotionCouponProvider.coupon;S.IsNotEmpty(t)?this.promotionCouponProvider.removeCoupon():this.promotionCouponV2Service.removeAppliedCoupon()}openOdsConfigDialog(){this.dialog.open(jn).afterClosed().pipe(ie(t=>!!t),ve(t=>{this.orderDisplayService.setODSConfig(t.OrderDisplayBroadcastMode)})).subscribe(t=>{this.toastrService.success("Order Display Configuration applied successfully","Success")})}openModalInputEcrUrl(){this.ecrSignalR.isConnected()?this.confirmDisableEcr():this.dialog.open(Bn).afterClosed().pipe(ie(e=>!!e)).subscribe(e=>{this.ecrSignalR.initConnection(e)})}confirmDisableEcr(){this.dialog.open(ri,{data:{title:"Disconnect ECR",message:"Are you sure you want to disconnect ECR?",okText:"OK",headerType:Fe.Warning},width:"500px"}).afterClosed().pipe(ie(t=>t),ve(()=>{this.ecrService.disconnect(),this.ecrSignalR.stopConnection()})).subscribe(()=>{this.toastrService.success("ECR is disconnected","Success")})}openModalCashMachineUrl(){this.dialog.open(Zr).afterClosed().pipe(ie(t=>!!t)).subscribe(t=>{this.cashMachineService.initConnection(t)})}confirmDisableCashMachine(){this.dialog.open(ri,{data:{title:"Disconnect Cash Machine",message:"Are you sure you want to disconnect Cash Machine?",okText:"OK",headerType:Fe.Warning},width:"500px"}).afterClosed().pipe(ie(t=>t),ve(()=>{this.cashMachineService.stopConnection()})).subscribe(()=>{this.toastrService.success("Cash Machine is disconnected","Success")})}confirmEnabledCustomerDisplay(){let t=this.customerDisplay.isEnabled(),e;t?e={title:"Disconnect from Customer Display",message:`
|
|
8
8
|
<div class="text-center">
|
|
9
9
|
<div class="fs-5 mb-3 fw-bold">
|
|
10
10
|
You are currently connected to the Customer Display App from this terminal. All display output is being mirrored to the customer screen.
|
|
@@ -37,12 +37,12 @@ Printing in 8mm format instead!`,"Error!"),this.printReceiptMini(),t}),ve(()=>{t
|
|
|
37
37
|
</a>.
|
|
38
38
|
</div>
|
|
39
39
|
</div>
|
|
40
|
-
`,okText:"Connect"},this.dialog.open(ri,{data:e,width:"500px"}).afterClosed().pipe(ie(i=>i),ve(()=>{t?this.customerDisplay.disconnect():this.customerDisplay.connect()})).subscribe(()=>{this.toastrService.success(`Customer Display is ${t?"disconnected":"connected"}`,"Success")})}enableDragDrop(t){let e=b.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(a=>a.VariantID),o={Outlet:this.outletRegisterService.Data.EntityID,Cart:i};this.httpService.post(fe.ValidateInventory,o).subscribe(a=>{this.setAvailableInventory(a)})}setAvailableInventory(t){let e=this.salesOrderService.Data,i=e.CartItems,o=0;e.CartItems=i.map(a=>{let h=t.findIndex(E=>E.VariantID==a.VariantID);return h!==-1&&(a.AvailableInventory=t[h].OnHand,(a.Variant?.TypeID<9||a.Variant?.TypeID==12)&&(o+=a.Quantity>a.AvailableInventory?1:0)),a}),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(a=>(a.menus=a.menus.map(h=>{switch(h.action){case"PROMOTION":i?.getRewards()?.length>0&&(h.disabled=!0,h.description="Promotion event selection is disabled as this transaction already applies a reward from a promotion event");break}return h}),a)),o.menus=o.menus.map(a=>{switch(a.action){case"RETURN":a.disabled=!0,a.description="Return is disabled in edit mode";break}return a}),o))),t}filterMenuByRole(){let t=this.roleService?.Data,e=b.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(a=>(i=t.findIndex(h=>h.action==a.action),i!==-1?a.disabled=t[i].role==!1:a.disabled=!1,a)),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(Nn).afterClosed().pipe(k(this.destroy$),ie(i=>b.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(fi)}onImportItems(){let t=this.salesOrderService?.Data?.Order?.EntityID;this.dialog.open(ln,{data:{sampleUrl:Ko.files.csv.sell_import,API:fe.UploadCsv,outletID:t,useUppy:!0,fileEndpoint:"/API/POS/UploadCsvV3"}}).afterClosed().pipe(ie(e=>!!e)).subscribe(e=>{let i;for(let o of e)i=new Re,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(An)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(N(ce),N(U),N(ni),N(Mt),N(wt),N(re),N(ke),N(V),N(G),N(A),N(J),N(Le),N(de),N(qi),N(tn),N(kt),N(oi),N(Qi))};static \u0275prov=Ge({token:n,factory:n.\u0275fac})};var Un=class n{config=new H;dialogRef=$(B);salesOrderService=$(V);constructor(){let t=this.salesOrderService.Data;this.config.title=`Editing Order #${t?.Order.Number}`,this.config.hideFooter=!0,this.config.customWidth="500px"}onContinueEditing(){this.dialogRef.close("CONTINUE_EDITING")}onCreateNewOrder(){this.dialogRef.close("CREATE_NEW_ORDER")}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=M({type:n,selectors:[["app-modal-confirm-edit"]],decls:13,vars:1,consts:[[3,"onClose","config"],[1,"warning-container"],[1,"fas","fa-exclamation-triangle","warning-icon"],[1,"warning-message"],[1,"d-flex","justify-content-end",2,"margin-top","18px"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","mx-3",3,"click"],[1,"fas","fa-plus","me-2"],[1,"fas","fa-edit","me-2"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onClose",function(){return i.onClose()}),r(1,"content")(2,"div",1),v(3,"i",2),r(4,"p",3),p(5," You are currently editing an order. Any unsaved changes will be lost if you proceed with a new order. Would you like to continue editing the current order or start processing a new order? "),l()(),r(6,"div",4)(7,"button",5),_("click",function(){return i.onCreateNewOrder()}),v(8,"i",6),p(9," New Order "),l(),r(10,"button",5),_("click",function(){return i.onContinueEditing()}),v(11,"i",7),p(12," Continue Editing "),l()()()()),e&2&&m("config",i.config)},dependencies:[X,j],styles:['.warning-container[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;gap:10px;background:#fff3cd;border:1px solid #ffeeba;border-radius:8px;padding:15px 15px 15px 20px}.warning-container[_ngcontent-%COMP%]:before{content:"";position:absolute;top:0;left:0;width:4px;height:100%;background:linear-gradient(to bottom,#f39c12,#e67e22);border-radius:8px 0 0 8px}.warning-icon[_ngcontent-%COMP%]{color:#856404;font-size:20px;flex-shrink:0}.warning-message[_ngcontent-%COMP%]{margin:0;color:#856404;font-size:14px;line-height:1.4}']})};var Ba=n=>({"quickkey-subscription-overdue":n}),ja=()=>["/menu/Outlets/Master/Quick_Key_Templates/Form"],kp=n=>({ID:n}),Tp=n=>({OutletID:n});function Ep(n,t){if(n&1&&v(0,"img",17),n&2){let e=c(2).$implicit;m("ngSrc",e.ImageURLClient)}}function Rp(n,t){if(n&1&&(r(0,"div",15)(1,"div",16),g(2,Ep,1,1,"img",17),l()()),n&2){let e=c().$implicit;s(2),C(e.ImageURLClient?2:-1)}}function Np(n,t){if(n&1&&(r(0,"div",16)(1,"p",18)(2,"span"),p(3),S(4,"slice"),l()()()),n&2){let e=c().$implicit;s(3),w(Ae(4,1,e.Display,0,3))}}function Vp(n,t){if(n&1&&(r(0,"small",19),p(1),S(2,"number"),l()),n&2){let e=c(2).$implicit;s(),w(I(2,1,e.Children[0].UnitPrice))}}function Ap(n,t){if(n&1&&(r(0,"small",20),p(1),S(2,"lowestPrice"),S(3,"number"),S(4,"highestPrice"),S(5,"number"),l()),n&2){let e=c(2).$implicit;s(),Ee("",I(3,4,I(2,2,e==null?null:e.Children))," - ",I(5,8,I(4,6,e==null?null:e.Children)))}}function Lp(n,t){if(n&1&&g(0,Vp,3,3,"small",19)(1,Ap,6,10,"small",20),n&2){let e=c().$implicit;C(e.Children.length==1?0:1)}}function Fp(n,t){if(n&1){let e=y();r(0,"div",13)(1,"a",14),_("click",function(){let o=u(e).$implicit,a=c(4);return f(a.onSelectProduct(o))}),g(2,Rp,3,1,"div",15)(3,Np,5,5,"div",16),r(4,"small"),p(5),S(6,"slice"),l(),g(7,Lp,2,1),l()()}if(n&2){let e=t.$implicit,i=c(4);le(i.colConfigCSSClass),s(2),C(e.ImageURLClient?2:3),s(3),w(Ae(6,5,e.Display,0,36)),s(2),C(i.quickKeyPriceVisible?7:-1)}}function Bp(n,t){if(n&1&&(r(0,"mat-tab",6)(1,"div",7)(2,"div",8),ee(3,Fp,8,9,"div",9,pe),r(5,"div",10)(6,"a",11),v(7,"i",12),l()()()()()),n&2){let e=t.$implicit,i=c(3);m("label",e.Name),s(3),te(e==null?null:e.Items),s(2),le(i.colConfigCSSClass),s(),m("routerLink",st(5,ja))("queryParams",T(6,kp,i.quickKey.ID))}}function jp(n,t){if(n&1){let e=y();r(0,"mat-tab-group",5),O("selectedIndexChange",function(o){u(e);let a=c(2);return D(a.quickeyTabActive,o)||(a.quickeyTabActive=o),f(o)}),ee(1,Bp,8,8,"mat-tab",6,pe),l()}if(n&2){let e=c(2);m("disableRipple",!0),P("selectedIndex",e.quickeyTabActive),s(),te(e.quickKey==null?null:e.quickKey.Groups)}}function Hp(n,t){if(n&1&&v(0,"img",26),n&2){let e=c(2).$implicit;m("src",e.ImageURLClient,nt)}}function Up(n,t){if(n&1&&(r(0,"div",15)(1,"div",16),g(2,Hp,1,1,"img",26),l()()),n&2){let e=c().$implicit;s(2),C(e.ImageURLClient?2:-1)}}function Wp(n,t){if(n&1&&(r(0,"div",16)(1,"p",18)(2,"span"),p(3),S(4,"slice"),l()()()),n&2){let e=c().$implicit;s(3),w(Ae(4,1,e.Model,0,3))}}function Qp(n,t){if(n&1&&(r(0,"small",19),p(1),S(2,"number"),l()),n&2){let e=c().$implicit;s(),w(I(2,1,e.UnitPrice))}}function $p(n,t){if(n&1){let e=y();r(0,"div",13)(1,"a",14),_("click",function(){let o=u(e).$implicit,a=c(3);return f(a.onSelectVariant(o.ID))}),g(2,Up,3,1,"div",15)(3,Wp,5,5,"div",16),r(4,"small"),p(5),S(6,"slice"),l(),g(7,Qp,3,3,"small",19),l()()}if(n&2){let e=t.$implicit,i=c(3);le(i.colConfigCSSClass),s(2),C(e.ImageURLClient?2:3),s(3),w(Ae(6,5,e.Model,0,30)),s(2),C(i.quickKeyPriceVisible?7:-1)}}function qp(n,t){if(n&1){let e=y();r(0,"div",21)(1,"div",22),_("click",function(){u(e);let o=c(2);return f(o.quickeyState="QUICKEY")}),v(2,"i",23),l(),r(3,"div",24)(4,"b"),p(5),l()()(),r(6,"div",7)(7,"div",25),ee(8,$p,8,9,"div",9,pe),l()()}if(n&2){let e=c(2);s(5),x(" ",e.subQuickeyPack.Display),s(3),te(e.subQuickeyPack==null?null:e.subQuickeyPack.Children)}}function Gp(n,t){if(n&1&&g(0,jp,3,2,"mat-tab-group",4)(1,qp,10,1),n&2){let e=c();C(e.quickeyState=="QUICKEY"?0:1)}}function zp(n,t){if(n&1&&(r(0,"div",3)(1,"a",27)(2,"strong"),p(3,"QUICK KEYS UNCONFIGURED"),l(),v(4,"i",28),r(5,"span"),p(6,"Click here to setup your Quick keys"),l()()()),n&2){let e=c();m("ngClass",T(3,Ba,e.currentSubsStatus==e.subscriptionStatus.OVERDUE||e.currentSubsStatus==e.subscriptionStatus.SELL_ONLY)),s(),m("routerLink",st(5,ja))("queryParams",T(6,Tp,e.entityId))}}var Wn=class n{constructor(t,e,i,o,a,h){this.outletRegisterService=t;this.shoppingCartService=e;this.dialog=i;this.pageInitialService=o;this.salesOrderService=a;this.authService=h;this.destroy$=new Q,this.quickeyState="QUICKEY",this.currentSubsStatus=this.authService.getSubscriptionStatus()}destroy$;quickKey;subQuickeyPack;entityId;quickeyState;quickeyTabActive=0;colConfigCSSClass;subscriptionStatus=Gt;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(){b.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(G),d(de),d(re),d(A),d(V),d(Kt))};static \u0275cmp=M({type:n,selectors:[["sell-quick-key"]],standalone:!1,decls:5,vars:4,consts:[[1,"row"],[1,"col-12"],[1,"quick-key-tab",3,"ngClass"],[1,"no-quick-key","d-flex","align-items-center","justify-content-center",3,"ngClass"],[1,"h-100","bgQuickkeyIllustration","landscape",3,"disableRipple","selectedIndex"],[1,"h-100","bgQuickkeyIllustration","landscape",3,"selectedIndexChange","disableRipple","selectedIndex"],[3,"label"],[1,"container","tabItems"],[1,"row","g-0"],[1,"column","px-6",3,"class"],[1,"column","d-flex","align-items-center","pb-6"],[1,"w-100",3,"routerLink","queryParams"],["aria-hidden","true",1,"fa","fa-plus-circle","fa-5x","d-flex","align-items-center","justify-content-center","bg-white","h-100","text-primary"],[1,"column","px-6"],[3,"click"],[1,"img-box","d-flex","align-items-center"],[1,"ratio","ratio-1x1"],["priority","","fill","",1,"full-screen-image",3,"ngSrc"],[1,"fw-normal","fs-1","d-flex","align-items-center","justify-content-center"],[1,"text-muted"],[1,"text-muted",2,"word-break","auto-phrase"],[1,"row","g-0","border","align-items-center","subquicKey"],[1,"col-auto","border-end","py-5","px-7","cursor-pointer",3,"click"],["aria-hidden","true",1,"fa","fa-arrow-left"],[1,"col","text-center","fw-bold","text-uppercase","fs-5"],[1,"row","g-0","rowSubQuickey"],[1,"full-screen-image",3,"src"],["id","LinkConfigureQuickkey","target","_blank",3,"routerLink","queryParams"],["aria-hidden","true",1,"fa-regular","fa-hand-pointer"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1)(2,"section",2),g(3,Gp,2,1)(4,zp,7,8,"div",3),l()()()),e&2&&(s(2),m("ngClass",T(2,Ba,i.currentSubsStatus==i.subscriptionStatus.OVERDUE||i.currentSubsStatus==i.subscriptionStatus.SELL_ONLY)),s(),C(i.quickKey!=null&&i.quickKey.Groups&&(i.quickKey==null||i.quickKey.Groups==null?null:i.quickKey.Groups.length)>0?3:4))},dependencies:[z,xt,It,$t,Go,Fi,K,fr,gr],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(https://cdn.dealpos.xyz/web-image/no-quick-key.png)!important;background-repeat:no-repeat;height:calc(100vh - 70px);background-size:contain}a#LinkConfigureQuickkey[_ngcontent-%COMP%]{background-color:#479ccf;padding:15px 25px;color:#fff;text-decoration:none;width:240px;display:block;opacity:.85;border-radius:6px}a#LinkConfigureQuickkey[_ngcontent-%COMP%]{position:absolute;top:200px;left:calc(50% - 120px)}a#LinkConfigureQuickkey[_ngcontent-%COMP%]:hover{opacity:.95}a#LinkConfigureQuickkey[_ngcontent-%COMP%] Strong[_ngcontent-%COMP%]{border-bottom:1px solid white;font-size:14px;margin:0 0 10px;padding:0 0 3px;display:block}a#LinkConfigureQuickkey[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{display:inline-block;height:35px;margin:0 10px 0 0;font-size:28px}a#LinkConfigureQuickkey[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:inline-block;font-size:14px;width:135px;vertical-align:top}"]})};var Kp=n=>({"cursor-pointer":n}),Yp=(n,t)=>({"px-2 py-2 number-disabled":n,"py-1 px-1 bg-gradient-warning":t}),Zp=(n,t)=>({"d-flex justify-content-end align-items-center":n,"mt-1":t}),Xp=(n,t)=>({label:n,tooltip:t}),Ha=n=>({data:n}),ed=()=>({label:"Later",tooltip:"Fulfillment Later"}),td=n=>({"bg-gradient-warning px-2":n}),id=n=>({"me-3":n});function nd(n,t){if(n&1&&(r(0,"span"),p(1),l()),n&2){let e=c();s(),Ee("",e.isSalesOrderEdit?"Edit Order ":"New Order ","#",e.salesOrder==null||e.salesOrder.Order==null?null:e.salesOrder.Order.Number)}}function od(n,t){n&1&&(r(0,"div",8),p(1,"Order Number"),l())}function rd(n,t){n&1&&oo(0)}function ad(n,t){if(n&1&&(r(0,"div",10),Z(1,rd,1,0,"ng-container",13),l()),n&2){let e=c(),i=ot(17);s(),m("ngTemplateOutlet",i)("ngTemplateOutletContext",T(5,Ha,_e(2,Xp,e.isDifferentFullfillmentOutlet().outletName,e.isDifferentFullfillmentOutlet().outletName)))}}function ld(n,t){n&1&&oo(0)}function sd(n,t){if(n&1&&(r(0,"div",10),Z(1,ld,1,0,"ng-container",13),l()),n&2){c();let e=ot(17);s(),m("ngTemplateOutlet",e)("ngTemplateOutletContext",T(3,Ha,st(2,ed)))}}function cd(n,t){if(n&1&&(r(0,"h5",18),p(1),S(2,"limitTo"),l()),n&2){let e=c().data;s(),w(ne(2,1,e==null?null:e.label,14))}}function pd(n,t){if(n&1){let e=y();r(0,"div",14)(1,"div",15),_("click",function(){u(e);let o=c();return f(o.openFulfillmentModal())}),r(2,"div",16),v(3,"i",17),l(),g(4,cd,3,4,"h5",18),l()()}if(n&2){let e=t.data;m("ngClass",T(4,td,e.label))("matTooltip",e==null?null:e.tooltip),s(2),m("ngClass",T(6,id,e.label)),s(2),C(e!=null&&e.label?4:-1)}}var Qn=class n{constructor(t,e,i,o,a,h,E,F){this.registerService=t;this.salesOrderService=e;this.pageInitialService=i;this.coreService=o;this.dialog=a;this.shoppingCartService=h;this.userRoleService=E;this.orderProcessorService=F;this.destroy$=new Q}selectedOutlet;destroy$;salesOrder;register;userRole;isSalesOrderEdit=!1;selectedDate=new Date;isDifferentFullfillmentOutlet=R({isDifferent:!1,outletName:""});isFulfillmentLater=R(!1);minDate=R(0);ngOnInit(){this.subscribeToObservable(),this.initMinDate()}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})}initMinDate(){let e=this.pageInitialService.Data?.UserGroupConfig?.InputDaysRange;e!=null&&e>=0?this.minDate.set(e):this.minDate.set(0)}checkIsDifferentFullfillmentOutlet(){let t=this.salesOrder.Action?.DeliveryEntityID;if(b.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==b.GuidEmpty&&(this.isDifferentFullfillmentOutlet.update(e=>(e.isDifferent=!1,e)),this.isFulfillmentLater.set(!0))}openRegisterModal(){this.isSalesOrderEdit||this.dialog.open(Vr,{id:"registerModal",disableClose:!0}).afterClosed().pipe(k(this.destroy$),ie(t=>b.IsNotEmpty(t?.selectedRegister))).subscribe(t=>{t?.openStartingCashDialog&&this.openOpeningCashModal()})}openOpeningCashModal(){this.pageInitialService.Data.AppConfigJSON.ModuleShift.Closure.Enabled&&this.dialog.open(Ar,{disableClose:!0}).afterClosed().pipe(ie(e=>b.IsNotEmpty(e))).subscribe(e=>{let i={RegisterID:this.salesOrder.Order.RegisterID,OpAmount:e.amount};this.coreService.recordOpeningCash(i),this.initCursorFocus()})}onAddItem(t){this.shoppingCartService.addCartItemById(t).then(()=>{this.openModalItemOnNew(t)})}onBarcodeScan(t){b.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(a=>a.VariantID==t),o=this.salesOrder.Items.lastIndexOf(i);this.dialog.open($e,{data:{index:o,focus:"quantity"}})}}onEditNumber(){this.userRole.NumberEditor&&this.dialog.open(ta,{width:"20%"})}openFulfillmentModal(){this.dialog.open(fi)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}initCursorFocus(){let t=document.getElementById("product"),e=this.selectedOutlet?.RegisterID;t&&b.IsNotEmpty(e)&&t.focus()}static \u0275fac=function(e){return new(e||n)(d(G),d(V),d(A),d(Nr),d(re),d(de),d(ce),d(U))};static \u0275cmp=M({type:n,selectors:[["sell-header"]],standalone:!1,decls:18,vars:25,consts:[["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",2,"width","27px"],[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"],[1,"text-body-secondary","fst-italic"],[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","minDate","maxDate"],[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=y();r(0,"div",1)(1,"div",2)(2,"div",3),_("click",function(){return u(o),f(i.openRegisterModal())}),v(3,"i",4),l(),r(4,"div",5)(5,"h3",6),_("click",function(){return u(o),f(i.openRegisterModal())}),p(6),S(7,"limitTo"),l(),r(8,"h6",7),_("click",function(){return u(o),f(i.onEditNumber())}),g(9,nd,2,2,"span")(10,od,2,0,"div",8),l()()(),r(11,"div",9),g(12,ad,2,7,"div",10),g(13,sd,2,5,"div",10),r(14,"div",11)(15,"POS-invoice-date",12),O("ngModelChange",function(h){return u(o),D(i.selectedDate,h)||(i.selectedDate=h),f(h)}),_("ngModelChange",function(){return u(o),f(i.onSelectDate())}),l()()()(),Z(16,pd,5,8,"ng-template",null,0,ht)}if(e&2){let o,a;s(4),m("ngClass",T(17,Kp,i.userRole.NumberEditor)),s(),m("matTooltip",i.register==null?null:i.register.Name),s(),x(" ",ne(7,14,i.register!=null&&i.register.Name?i.register==null?null:i.register.Name:"Choose an Outlet",25)," "),s(2),m("ngClass",_e(19,Yp,!i.userRole.NumberEditor,i.isSalesOrderEdit))("matTooltip",i.userRole.NumberEditor?"Sales order number":"Number Edit role is required"),s(),C(!(i.salesOrder==null||i.salesOrder.Order==null)&&i.salesOrder.Order.Number?9:10),s(2),m("ngClass",_e(22,Zp,!((o=i.isDifferentFullfillmentOutlet())!=null&&o.isDifferent)&&!i.isFulfillmentLater(),(o=i.isDifferentFullfillmentOutlet())==null?null:o.isDifferent)),s(),C((a=i.isDifferentFullfillmentOutlet())!=null&&a.isDifferent?12:-1),s(),C(i.isFulfillmentLater()?13:-1),s(2),P("ngModel",i.selectedDate),m("disabled",!(i.userRole!=null&&i.userRole.DateEditor))("tooltip",i.userRole!=null&&i.userRole.DateEditor?"":"Date role is required")("minDate",i.minDate())("maxDate",i.minDate()>0?1:null)}},dependencies:[z,qo,q,oe,se,Yi,ji],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}
|
|
41
|
-
`],encapsulation:2})};var $n=class n{static \u0275fac=function(e){return new(e||n)};static \u0275cmp=M({type:n,selectors:[["sell-left-content"]],standalone:!1,decls:7,vars:0,consts:[[1,"d-flex","flex-column"],[1,"row","border-bottom","pt-2",2,"min-height","60px"],[1,"col-12"],[1,"row","mt-5"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1)(2,"div",2),v(3,"sell-header"),l()(),r(4,"div",3)(5,"div",2),v(6,"sell-quick-key"),l()()())},dependencies:[Wn,Qn],encapsulation:2})};var Ft=n=>({selected:n});function ud(n,t){if(n&1){let e=y();r(0,"a",10),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalTabState.TYPE))}),p(1," Tag "),l()}if(n&2){let e=c();m("ngClass",T(1,Ft,e.modalTabState.TYPE==e.currentTabState))}}function fd(n,t){if(n&1){let e=y();r(0,"a",11),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalTabState.LOGISTICS))}),p(1," Logistics Service "),l()}if(n&2){let e=c();m("ngClass",T(1,Ft,e.modalTabState.LOGISTICS==e.currentTabState))}}function gd(n,t){if(n&1){let e=y();r(0,"a",12),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalTabState.NUMBER))}),p(1," Number "),l()}if(n&2){let e=c();m("ngClass",T(1,Ft,e.modalTabState.NUMBER==e.currentTabState))}}function Cd(n,t){if(n&1){let e=y();r(0,"div",14)(1,"div",16)(2,"span",17),v(3,"i",18),l(),r(4,"input",19),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.poTypesSearchTerm,o)||(a.poTypesSearchTerm=o),f(o)}),l()()()}if(n&2){let e=c(2);s(4),P("ngModel",e.poTypesSearchTerm)}}function _d(n,t){if(n&1){let e=y();r(0,"div",15)(1,"label",20)(2,"input",21),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.posData.Order.TypeID,o)||(a.posData.Order.TypeID=o),f(o)}),_("click",function(){let o=u(e).$implicit,a=c(2);return f(a.onSelectSalesOrderTag(o))}),l(),p(3),l()()}if(n&2){let e=t.$implicit,i=t.$index,o=c(2);s(),m("for",bi("potype-"+i))("ngClass",T(8,Ft,o.posData.Order.TypeID==e.ID)),s(),m("id",bi("potype-"+i)),P("ngModel",o.posData.Order.TypeID),m("value",e.ID),s(),x(" ",e.Name," ")}}function hd(n,t){if(n&1&&(r(0,"div",8)(1,"div",13),g(2,Cd,5,1,"div",14),ee(3,_d,4,10,"div",15,pe),S(5,"FilterByName"),l()()),n&2){let e,i=c();s(2),C(((e=i.poTypes())==null?null:e.length)>5?2:-1),s(),te(ne(5,1,i.poTypes(),i.poTypesSearchTerm()))}}function vd(n,t){if(n&1){let e=y();r(0,"POS-tinymce-editor",25),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.posData.Invoice.Note,o)||(a.posData.Invoice.Note=o),f(o)}),l()}if(n&2){let e=c(2);P("ngModel",e.posData.Invoice.Note)}}function bd(n,t){if(n&1){let e=y();r(0,"textarea",26),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.posData.Invoice.Note,o)||(a.posData.Invoice.Note=o),f(o)}),l()}if(n&2){let e=c(2);P("ngModel",e.posData.Invoice.Note)}}function Sd(n,t){if(n&1&&(r(0,"div",8)(1,"div",22),g(2,vd,1,1,"POS-tinymce-editor",23),g(3,bd,1,1,"textarea",24),l()()),n&2){let e=c();s(2),C(e.isOnline?2:-1),s(),C(e.isOnline?-1:3)}}function yd(n,t){if(n&1){let e=y();r(0,"POS-tinymce-editor",25),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.posData.Order.Note,o)||(a.posData.Order.Note=o),f(o)}),l()}if(n&2){let e=c(2);P("ngModel",e.posData.Order.Note)}}function xd(n,t){if(n&1){let e=y();r(0,"textarea",26),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.posData.Order.Note,o)||(a.posData.Order.Note=o),f(o)}),l()}if(n&2){let e=c(2);P("ngModel",e.posData.Order.Note)}}function Id(n,t){if(n&1&&(r(0,"div",8)(1,"div",22),g(2,yd,1,1,"POS-tinymce-editor",23),g(3,xd,1,1,"textarea",24),l()()),n&2){let e=c();s(2),C(e.isOnline?2:-1),s(),C(e.isOnline?-1:3)}}function Pd(n,t){if(n&1){let e=y();r(0,"div",14)(1,"div",16)(2,"span",17),v(3,"i",18),l(),r(4,"input",19),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.serviceLogisticsSearchTerm,o)||(a.serviceLogisticsSearchTerm=o),f(o)}),l()()()}if(n&2){let e=c(2);s(4),P("ngModel",e.serviceLogisticsSearchTerm)}}function Dd(n,t){if(n&1){let e=y();r(0,"div",15)(1,"label",20)(2,"input",21),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.posData.Order.LogisticsServiceID,o)||(a.posData.Order.LogisticsServiceID=o),f(o)}),_("click",function(){let o=u(e).$implicit,a=c(2);return f(a.onSelectLogisticsService(o.ID))}),l(),p(3),l()()}if(n&2){let e=t.$implicit,i=t.$index,o=c(2);s(),m("for",bi("potype-"+i))("ngClass",T(8,Ft,o.posData.Order.LogisticsServiceID==e.ID)),s(),m("id",bi("potype-"+i)),P("ngModel",o.posData.Order.LogisticsServiceID),m("value",e.ID),s(),x(" ",e.Name," ")}}function Od(n,t){if(n&1&&(r(0,"div",8)(1,"div",13),g(2,Pd,5,1,"div",14),ee(3,Dd,4,10,"div",15,pe),S(5,"FilterByName"),l()()),n&2){let e,i=c();s(2),C(((e=i.serviceLogistics())==null?null:e.length)>5?2:-1),s(),te(ne(5,1,i.serviceLogistics(),i.serviceLogisticsSearchTerm()))}}function Md(n,t){if(n&1){let e=y();r(0,"div",36)(1,"span",37),p(2,"@"),l(),r(3,"input",38),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.exchangeRate,o)||(a.exchangeRate=o),f(o)}),l()()}if(n&2){let e=c(2);s(3),P("ngModel",e.exchangeRate)}}function wd(n,t){if(n&1){let e=y();r(0,"div",9)(1,"div",27)(2,"strong",28),p(3,"Reference Number"),l(),r(4,"input",29),O("ngModelChange",function(o){u(e);let a=c();return D(a.posData.Order.ReferenceNumber,o)||(a.posData.Order.ReferenceNumber=o),f(o)}),l()(),r(5,"div",27)(6,"strong",30),p(7,"Invoice Number"),l(),r(8,"input",31),O("ngModelChange",function(o){u(e);let a=c();return D(a.posData.Invoice.Number,o)||(a.posData.Invoice.Number=o),f(o)}),l()()(),r(9,"div",9)(10,"div",27)(11,"div",32)(12,"strong",28),p(13,"Number of Person"),l(),r(14,"input",33),O("ngModelChange",function(o){u(e);let a=c();return D(a.posData.Order.NumberOfPerson,o)||(a.posData.Order.NumberOfPerson=o),f(o)}),l()()(),r(15,"div",27)(16,"strong",28),p(17,"Currency"),l(),r(18,"div",34)(19,"ng-select",35),O("ngModelChange",function(o){u(e);let a=c();return D(a.posData.Order.CurrencyID,o)||(a.posData.Order.CurrencyID=o),f(o)}),_("change",function(o){u(e);let a=c();return f(a.updateCurrencySymbol(o))}),l(),g(20,Md,4,1,"div",36),l()()()}if(n&2){let e=c();s(4),P("ngModel",e.posData.Order.ReferenceNumber),s(4),P("ngModel",e.posData.Invoice.Number),m("disabled",!e.roleService.sell.Number),s(6),P("ngModel",e.posData.Order.NumberOfPerson),s(5),m("items",e.currencies()),P("ngModel",e.posData.Order.CurrencyID),m("clearable",!1),s(),C(e.posData.Order.CurrencyID!=e.defaultCurrencyID?20:-1)}}function kd(n,t){if(n&1){let e=y();r(0,"div",36)(1,"span",37),p(2,"@"),l(),r(3,"input",38),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.exchangeRate,o)||(a.exchangeRate=o),f(o)}),l()()}if(n&2){let e=c(2);s(3),P("ngModel",e.exchangeRate)}}function Td(n,t){if(n&1){let e=y();r(0,"div",9)(1,"div",27)(2,"div",32)(3,"strong",28),p(4,"Number of Person"),l(),r(5,"input",33),O("ngModelChange",function(o){u(e);let a=c();return D(a.posData.Order.NumberOfPerson,o)||(a.posData.Order.NumberOfPerson=o),f(o)}),l()()(),r(6,"div",27)(7,"strong",28),p(8,"Currency"),l(),r(9,"div",34)(10,"ng-select",35),O("ngModelChange",function(o){u(e);let a=c();return D(a.posData.Order.CurrencyID,o)||(a.posData.Order.CurrencyID=o),f(o)}),_("change",function(o){u(e);let a=c();return f(a.updateCurrencySymbol(o))}),l(),g(11,kd,4,1,"div",36),l()()()}if(n&2){let e=c();s(5),P("ngModel",e.posData.Order.NumberOfPerson),s(5),m("items",e.currencies()),P("ngModel",e.posData.Order.CurrencyID),m("clearable",!1),s(),C(e.posData.Order.CurrencyID!=e.defaultCurrencyID?11:-1)}}var qn=class n{constructor(t,e,i,o,a,h,E,F,Ce){this._dialogRef=t;this._orderDataService=e;this._posService=i;this._cashierCalculatorService=o;this._outletRegisterService=a;this._orderHttpService=h;this._toastrService=E;this._onlineService=F;this.roleService=Ce;this.destroy$=new Q,this.currentTabState=1}serviceLogistics=R([]);serviceLogisticsSearchTerm=R("");poTypes=R([]);poTypesSearchTerm=R("");posData;config=new H;defaultCurrencyID;currencies=R([]);currentTabState;modalTabState=ha;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.set(t.ServicesLogistics||[]),this.poTypes.set(t.PoTypes||[]),this.currencies.set(t.Currencies||[])}),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}onSelectSalesOrderTag(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=ti(cn,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(B),d(V),d(A),d(ge),d(G),d(Me),d(J),d(pt),d(yt))};static \u0275cmp=M({type:n,selectors:[["POS-modal-note"]],standalone:!1,decls:18,vars:11,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"],["data-cy","tab-note","matTooltip","Internal Note - Not Printed on Invoice","matTooltipPosition","above",1,"btn","btn-link","note-tab",3,"click","ngClass"],["data-cy","tab-type",1,"btn","btn-link","note-tab",3,"ngClass"],["data-cy","tab-logistic",1,"btn","btn-link","note-tab",3,"ngClass"],["data-cy","tab-number",1,"btn","btn-link","note-tab",3,"ngClass"],[1,"row","mt-8"],[1,"row","mt-6"],["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"],[1,"ms-0","mb-8","search-container"],[1,"rad-btn"],[1,"input-group","mb-3","rounded-start-1"],[1,"input-group-text","txtFilter","rounded-end-0"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["data-cy","SearchOutlet","type","text","placeholder","Filter by Name","aria-label","Search",1,"txtFilter","form-control","border-start-0","rounded-1","rounded-start-0",3,"ngModelChange","ngModel"],[3,"for","ngClass"],["type","radio",3,"ngModelChange","click","ngModel","value","id"],[1,"col-12","tinymce"],[3,"ngModel"],["name","note","cols","80","rows","10",1,"form-control",3,"ngModel"],[3,"ngModelChange","ngModel"],["name","note","cols","80","rows","10",1,"form-control",3,"ngModelChange","ngModel"],[1,"col-6"],[1,"mb-3"],["placeholder","Preorder Number","matTooltip","PO number if the product must be pre-ordered",1,"form-control",2,"height","2.4rem",3,"ngModelChange","ngModel"],[1,"form-floating-outline","mb-3"],["type","text","required","","placeholder","Same as Order Number when blank","matTooltip","Same as Order Number when blank",1,"form-control",2,"height","2.4rem",3,"ngModelChange","ngModel","disabled"],[1,"form-floating-outline"],["placeholder","Number of Person","autoNum","",1,"form-control",2,"height","2.4rem",3,"ngModelChange","ngModel"],[1,"ps-0","align-items-center"],["bindLabel","Name","bindValue","ID","placeholder","Outlet","appendTo","body",1,"currency-option",2,"width","100% !important",3,"ngModelChange","change","items","ngModel","clearable"],[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){if(e&1&&(r(0,"modal-material",0),_("onOk",function(a){return i.onOk(a)})("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)}),p(6," Note "),l(),r(7,"a",4),_("click",function(){return i.onTabChange(i.modalTabState.INTERNAL_NOTE)}),p(8," Order Note "),l(),g(9,ud,2,3,"a",5),g(10,fd,2,3,"a",6),g(11,gd,2,3,"a",7),l()(),g(12,hd,6,4,"div",8)(13,Sd,4,2,"div",8)(14,Id,4,2,"div",8)(15,Od,6,4,"div",8)(16,wd,21,8)(17,Td,12,5,"div",9),l()()()),e&2){let o;m("config",i.config),s(5),m("ngClass",T(7,Ft,i.modalTabState.NOTE==i.currentTabState)),s(2),m("ngClass",T(9,Ft,i.modalTabState.INTERNAL_NOTE==i.currentTabState)),s(2),C(i.isOnline?9:-1),s(),C(i.isOnline&&i.serviceLogistics().length?10:-1),s(),C(i.isOnline?11:-1),s(),C((o=i.currentTabState)===i.modalTabState.TYPE?12:o===i.modalTabState.NOTE?13:o===i.modalTabState.INTERNAL_NOTE?14:o===i.modalTabState.LOGISTICS?15:o===i.modalTabState.NUMBER?16:o===i.modalTabState.OTHER?17:-1)}},dependencies:[z,Y,nr,q,Jt,oe,j,gt,se,Ze,ct,Cr],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}.search-container{transition:all .3s ease;width:97%}.search-container .input-group{position:relative;transition:all .3s ease;height:2.3rem}.search-container .input-group:hover,.search-container .input-group:focus-within{box-shadow:0 0 0 2px #89b03e4d,0 0 8px 4px #89b03e33;border-radius:4px}.search-container .input-group .txtFilter.form-control{transition:all .3s ease;border-left:none!important}.search-container .input-group .txtFilter.form-control:focus{box-shadow:none!important;border-color:#ced4da!important}.search-container .input-group .input-group-text{transition:all .3s ease;background-color:#fff;border-right:none!important}.search-container .input-group:hover .input-group-text,.search-container .input-group:focus-within .input-group-text{background-color:#89b03e1a;border-color:#84cc16!important}.search-container .input-group .fa-magnifying-glass{transition:all .3s ease}.search-container .input-group:hover .fa-magnifying-glass,.search-container .input-group:focus-within .fa-magnifying-glass{color:#84cc16!important}.search-container .input-group:focus-within{box-shadow:0 0 0 2px #89b03e66,0 0 12px 6px #89b03e40!important}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}
|
|
42
|
-
`],encapsulation:2})};function Ed(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2," Amount "),l(),r(3,"td",19),p(4),S(5,"number"),l()()),n&2){let e=c(2);s(4),x(" ",I(5,1,e.calculatorService.GrossTotal)," ")}}function Rd(n,t){if(n&1&&(r(0,"span"),p(1),S(2,"number"),l()),n&2){let e=c(3);s(),x("",I(2,1,e.salesOrder.Order.Discount),"%")}}function Nd(n,t){if(n&1&&(r(0,"span"),p(1),S(2,"number"),l()),n&2){let e=c(3);s(),x("",ne(2,1,e.salesOrder.Order.Discount,"1.0-4"),"%")}}function Vd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),g(3,Rd,3,3,"span"),g(4,Nd,3,4,"span"),l(),r(5,"td",20),p(6),S(7,"number"),l()()),n&2){let e=c(2);s(2),x(" ",e.appConfig==null||e.appConfig.CorePrint==null?null:e.appConfig.CorePrint.Alias.Discount1," "),s(),C(e.isIgnoreDecimalDisc1?3:-1),s(),C(e.appConfig!=null&&e.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal?-1:4),s(2),w(I(7,4,e.calculatorService.Discount1Amount*-1))}}function Ad(n,t){if(n&1&&(r(0,"span"),p(1),S(2,"number"),l()),n&2){let e=c(3);s(),x("",I(2,1,e.salesOrder.Order.Discount2),"%")}}function Ld(n,t){if(n&1&&(r(0,"span"),p(1),S(2,"number"),l()),n&2){let e=c(3);s(),x("",ne(2,1,e.salesOrder.Order.Discount2,"1.0-4"),"%")}}function Fd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),g(3,Ad,3,3,"span"),g(4,Ld,3,4,"span"),l(),r(5,"td",20),p(6),S(7,"number"),l()()),n&2){let e=c(2);s(2),x(" ",e.appConfig==null||e.appConfig.CorePrint==null?null:e.appConfig.CorePrint.Alias.Discount2," "),s(),C(e.isIgnoreDecimalDisc2?3:-1),s(),C(e.appConfig!=null&&e.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal?-1:4),s(2),w(I(7,4,e.calculatorService.Discount2Amount*-1))}}function Bd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),l(),r(3,"td",20),p(4),S(5,"number"),l()()),n&2){let e=c(2);s(2),Ee(" ",e.appConfig==null||e.appConfig.CorePrint==null?null:e.appConfig.CorePrint.Alias.DiscountAmount," ",e.calculatorService.currencySymbol," "),s(2),w(I(5,3,e.salesOrder.Order.DiscountAmount*-1))}}function jd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),l(),r(3,"td",19),p(4),S(5,"number"),l()()),n&2){let e=c(2);s(2),x(" ",e.calculatorService==null||e.calculatorService.tax==null?null:e.calculatorService.tax.Label," "),s(2),w(I(5,2,e.calculatorService==null?null:e.calculatorService.TaxAmount))}}function Hd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),S(3,"number"),l(),r(4,"td",21),p(5),S(6,"number"),l()()),n&2){let e=c(2);s(2),x(" SURCHARGE ",I(3,3,e.salesOrder==null?null:e.salesOrder.Invoice.SurchargePcg),"% "),s(2),m("ngClass",(e.salesOrder==null?null:e.salesOrder.Invoice.SurchargePcg)<0?"text-danger":""),s(),x(" ",I(6,5,e.calculatorService==null?null:e.calculatorService.SurchargeAmount))}}function Ud(n,t){if(n&1&&(r(0,"div",0),v(1,"div",14)(2,"div",15),r(3,"div",16)(4,"table",17),g(5,Ed,6,3,"tr"),g(6,Vd,8,6,"tr"),g(7,Fd,8,6,"tr"),g(8,Bd,6,5,"tr"),g(9,jd,6,4,"tr"),g(10,Hd,7,7,"tr"),l()()()),n&2){let e=c();s(5),C((e.calculatorService==null||e.calculatorService.tax==null?null:e.calculatorService.tax.CalculationTypeID)==e.taxCalculationType.Add&&(!(e.calculatorService==null||e.calculatorService.tax==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?5:-1),s(),C((e.salesOrder==null?null:e.salesOrder.Order.Discount)!=0?6:-1),s(),C((e.salesOrder==null?null:e.salesOrder.Order.Discount2)!=0?7:-1),s(),C((e.salesOrder==null?null:e.salesOrder.Order.DiscountAmount)!=0?8:-1),s(),C(!(e.calculatorService==null||e.calculatorService.tax==null)&&e.calculatorService.tax.Rate?9:-1),s(),C((e.salesOrder==null?null:e.salesOrder.Invoice.SurchargePcg)!=0?10:-1)}}function Wd(n,t){if(n&1){let e=y();r(0,"button",22),_("click",function(){u(e);let o=c();return f(o.onOpenModalDiscount())}),v(1,"i",23),l()}}var Gn=class n{constructor(t,e,i,o,a,h,E,F,Ce,Te){this.calculatorService=t;this.salesOrderService=e;this.userRoleService=i;this.outletService=o;this.pageInitialService=a;this.dialog=h;this.orderProcessorService=E;this.payService=F;this.parkOrderService=Ce;this.shoppingCartService=Te;this.destroy$=new Q}handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.payService.payOrder()}taxCalculationType=co;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.shoppingCartService.isShoppingCartLockedByPromotionCoupon()==!1&&this.dialog.open(ui,{data:{tabIndexActive:"Discount"}})}checkIgnoreDecimalDisc(t){let e=this.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal,i=t%1===0;return e&&i}onOpenNotesModal(){this.dialog.open(qn,{width:"45%"})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(ge),d(V),d(ce),d(G),d(A),d(re),d(U),d(ra),d(ke),d(de))};static \u0275cmp=M({type:n,selectors:[["sell-cart-footer"]],hostBindings:function(e,i){e&1&&_("keydown.F8",function(){return i.handleF8()},ut)},inputs:{parkOrderRetrieve:"parkOrderRetrieve"},standalone:!1,decls:25,vars:15,consts:[[1,"row"],[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","dialog-discount-tax","matTooltip","Discount / Tax","matTooltipPosition","above",1,"btn","btn-success","fs-5",2,"border-right","0.1px solid #fff"],["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,"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,Ud,11,6,"div",0),r(1,"div",1)(2,"div",2)(3,"button",3),_("click",function(){return i.onOpenNotesModal()}),v(4,"i",4),l()(),r(5,"div",5)(6,"button",6),_("click",function(){return i.onPark()}),v(7,"i",7),r(8,"span"),p(9),l()()(),r(10,"div",8)(11,"div",9),g(12,Wd,2,0,"button",10),r(13,"button",11),_("click",function(){return i.onPayOrder()}),r(14,"div",12)(15,"div")(16,"span"),p(17,"Pay"),l(),r(18,"small",13),p(19),S(20,"number"),l()(),r(21,"div"),p(22),S(23,"async"),S(24,"number"),l()()()()()()),e&2&&(C(i.userRole.PriceVisible?0:-1),s(5),m("matTooltip",i.userRole.Park?"":"You need `Park` role to access this button"),s(),m("disabled",!i.userRole.Park),s(3),w((i.appConfig==null||i.appConfig.ApplicationParkAndRetrieve==null||i.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel==null?null:i.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkButtonLabel)||"Park"),s(),m("matTooltip",i.userRole.Payment?"":"You need `Pay` role to access this button"),s(2),C(i.userRole.Tax||i.userRole.Discount?12:-1),s(),m("disabled",!i.userRole.Payment),s(6),x(" (",I(20,9,i.salesOrder.cartQuantity)," Items) "),s(3),x(" ",i.userRole!=null&&i.userRole.PriceVisible?I(24,13,I(23,11,i.calculatorService.Data$)):"-"," "))},dependencies:[z,se,ze,K],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 $d=n=>({"ps-0":n});function qd(n,t){if(n&1){let e=y();r(0,"input",40),O("ngModelChange",function(o){u(e);let a=c(2).$implicit;return D(a.Splited,o)||(a.Splited=o),f(o)}),l()}if(n&2){let e=c(2).$implicit;P("ngModel",e.Splited)}}function Gd(n,t){if(n&1&&(r(0,"small"),p(1),l()),n&2){let e=c(2).$index;s(),x("",e+1,".")}}function zd(n,t){if(n&1&&(r(0,"td",10)(1,"div",12),g(2,qd,1,1,"input",39),g(3,Gd,2,1,"small"),l()()),n&2){let e=c().$implicit,i=c(2);s(2),C(i.currentSellState==i.sellState.IsSplit&&e.Quantity>1?2:-1),s(),C(!(i.appConfig==null||i.appConfig.ModuleSell==null)&&i.appConfig.ModuleSell.Grid.RowNumberVisible?3:-1)}}function Jd(n,t){if(n&1&&(r(0,"div",41),v(1,"img",43),l()),n&2){let e=c(2).$implicit;s(),m("src",e.Variant==null?null:e.Variant.ThumbnailUrl,nt)}}function Kd(n,t){n&1&&(r(0,"div",42),v(1,"i",44),l())}function Yd(n,t){if(n&1&&(r(0,"span",13),g(1,Jd,2,1,"div",41)(2,Kd,2,0,"div",42),l()),n&2){let e=c().$implicit;s(),C(e.Variant!=null&&e.Variant.ThumbnailUrl?1:2)}}function Zd(n,t){n&1&&v(0,"i",45)}function Xd(n,t){n&1&&v(0,"i",46)}function em(n,t){if(n&1&&(r(0,"span",17),g(1,Zd,1,0,"i",45)(2,Xd,1,0,"i",46),l()),n&2){let e=c().$implicit;s(),C(e.Taxable?1:2)}}function tm(n,t){n&1&&v(0,"i",18)}function im(n,t){if(n&1&&(r(0,"small",20),p(1),l()),n&2){let e=c().$implicit;s(),x(" ",e.Variant.CategoryName," ")}}function nm(n,t){if(n&1&&(r(0,"small",21),p(1),l()),n&2){let e=c().$implicit;s(),x(" ",e.Variant.BrandName," ")}}function om(n,t){if(n&1&&(r(0,"small",22),p(1),l()),n&2){let e=c().$implicit;s(),x(" ",e.Variant.Storage," ")}}function rm(n,t){if(n&1&&v(0,"small",24),n&2){let e=c().$implicit;m("innerHtml",e.Note?e.Note:e.PriceNote,Ut)}}function am(n,t){if(n&1&&(r(0,"small",25),p(1," Sold by "),r(2,"i"),p(3),l()()),n&2){let e=c().$implicit;s(3),w(e.SalesName)}}function lm(n,t){if(n&1&&(r(0,"small")(1,"i",47),p(2),l()()),n&2){let e=c().$implicit;s(2),x("Fulfillment from: ",e.EntityName)}}function sm(n,t){if(n&1&&(r(0,"div",28),v(1,"i",48),l()),n&2){let e=c().$implicit;m("matTooltip",e.AvailableInventory<e.Quantity?e.AvailableInventory+" Available Stock":"")}}function cm(n,t){if(n&1){let e=y();r(0,"span",49),_("click",function(){u(e);let o=c().$index,a=c(2);return f(a.onEditItem(o,"quantity"))}),p(1),S(2,"number"),l()}if(n&2){let e=c().$implicit,i=c(2);s(),x(" ",ne(2,1,e.Quantity,"1.0-"+i.qtyDecimalPlace()))}}function pm(n,t){if(n&1){let e=y();r(0,"span",50),p(1,"x"),l(),r(2,"div",51),_("click",function(){u(e);let o=c().$index,a=c(2);return f(a.onEditItem(o,"quantity"))}),r(3,"span",52),p(4),S(5,"number"),l()()}if(n&2){let e=c().$implicit,i=c(2);s(4),w(ne(5,1,e.UnitQuantity,"1.0-"+i.qtyDecimalPlace()))}}function dm(n,t){if(n&1&&(r(0,"span",31),p(1),S(2,"number"),l()),n&2){let e=c().$implicit,i=c(2);s(),x("@",ne(2,1,e.VariantUnitQuantity,"1.0-"+i.qtyDecimalPlace()))}}function mm(n,t){if(n&1&&(r(0,"small",32),p(1),l()),n&2){let e=c().$implicit,i=c(2);s(),w(i.isNotEmpty(e.Variant.UOM)?e.Variant.UOMName:"")}}function um(n,t){if(n&1&&(r(0,"div",55),p(1),S(2,"number"),l()),n&2){let e=c(4).$implicit;s(),x(" ",ne(2,1,e.UnitPriceOriginal,"1.0-4")," ")}}function fm(n,t){if(n&1){let e=y();r(0,"div",54),_("click",function(){u(e);let o=c(3).$index,a=c(2);return f(a.onEditItem(o,"price"))}),g(1,um,3,4,"div",55),r(2,"div",30),p(3),S(4,"number"),l()()}if(n&2){let e=c(3).$implicit;s(),C(e.UnitPriceOriginal>e.Price?1:-1),s(2),x(" ",ne(4,2,e.Price,"1.0-4")," ")}}function gm(n,t){if(n&1){let e=y();r(0,"div",49),_("click",function(){u(e);let o=c(3).$index,a=c(2);return f(a.onEditItem(o,"price"))}),p(1),S(2,"number"),l()}if(n&2){let e=c(3).$implicit;s(),x(" ",ne(2,1,e.Price,"1.0-4")," ")}}function Cm(n,t){if(n&1&&g(0,fm,5,5,"div",53)(1,gm,3,4,"div",30),n&2){let e=c(4);C(!(e.appConfig==null||e.appConfig.ModuleSell==null||e.appConfig.ModuleSell.Promotion==null)&&e.appConfig.ModuleSell.Promotion.StrikethroughOriginalPrice?0:1)}}function _m(n,t){if(n&1&&(r(0,"div",27),g(1,Cm,2,1),l()),n&2){let e=c().$implicit;s(),C(e.Price!==e.Total?1:-1)}}function hm(n,t){if(n&1&&(r(0,"div"),p(1),S(2,"number"),l()),n&2){let e=c().$implicit;s(),x(" ",e.Discount==0?"":I(2,1,e.Discount*-1)+"%"," ")}}function vm(n,t){if(n&1&&(r(0,"div"),p(1),S(2,"number"),l()),n&2){let e=c().$implicit;s(),x(" ",e.DiscountAmount==0?"":I(2,1,e.DiscountAmount*-1)," ")}}function bm(n,t){if(n&1&&(r(0,"div",56),p(1),S(2,"number"),l()),n&2){let e=c(2).$implicit;s(),x(" ",ne(2,1,e.UnitPriceOriginal,"1.0-4")," ")}}function Sm(n,t){if(n&1&&(r(0,"div",30),g(1,bm,3,4,"div",56),r(2,"div",27),p(3),S(4,"amountFraction"),l()()),n&2){let e=c().$implicit;s(),C(e.UnitPriceOriginal>e.Price?1:-1),s(2),x(" ",I(4,2,e.Total)," ")}}function ym(n,t){if(n&1&&(r(0,"div",27)(1,"div",30),p(2),S(3,"amountFraction"),l()()),n&2){let e=c().$implicit,i=c(2);s(2),x(" ",i.userRole.PriceVisible?I(3,1,e.Total):" - "," ")}}function xm(n,t){if(n&1){let e=y();r(0,"span",57),_("click",function(){u(e);let o=c().$implicit,a=c(2);return f(a.removeItem(o))}),v(1,"i",58),l()}}function Im(n,t){if(n&1){let e=y();r(0,"tr",9),S(1,"async"),_("contextmenu",function(o){let a=u(e),h=a.$implicit,E=a.$index,F=c(2);return f(F.onContextMenu(o,h,E))}),g(2,zd,4,2,"td",10),r(3,"td",11),_("click",function(){let o=u(e).$index,a=c(2);return f(a.onEditItem(o,"quantity"))}),r(4,"div",12),g(5,Yd,3,1,"span",13),r(6,"div",14)(7,"div",15)(8,"span",16),p(9),l(),g(10,em,3,1,"span",17),g(11,tm,1,0,"i",18),l(),r(12,"div",19),p(13),l(),g(14,im,2,1,"small",20),g(15,nm,2,1,"small",21),g(16,om,2,1,"small",22),r(17,"div"),v(18,"app-serial-note",23),l(),g(19,rm,1,1,"small",24),g(20,am,4,1,"small",25),g(21,lm,3,1,"small"),l()()(),r(22,"td",26)(23,"div",27),g(24,sm,2,1,"div",28),r(25,"div",29),g(26,cm,3,4,"span",30),g(27,pm,6,4),g(28,dm,3,4,"span",31),g(29,mm,2,1,"small",32),l()()(),r(30,"td"),g(31,_m,2,1,"div",27),l(),r(32,"td",33),_("click",function(){let o=u(e).$index,a=c(2);return f(a.onEditItem(o,"discount"))}),r(33,"div",34),g(34,hm,3,3,"div"),g(35,vm,3,3,"div"),l()(),r(36,"td",35),_("click",function(){let o=u(e).$index,a=c(2);return f(a.onEditItem(o,"price"))}),g(37,Sm,5,4,"div",30)(38,ym,4,3,"div",27),l(),r(39,"td",36)(40,"div",37),g(41,xm,2,0,"span",38),l()()()}if(n&2){let e=t.$implicit,i=c(2);m("cdkDragDisabled",!I(1,25,i.enabledDragDrop$)),s(2),C(!(i.appConfig==null||i.appConfig.ModuleSell==null)&&i.appConfig.ModuleSell.Grid.RowNumberVisible||i.currentSellState==i.sellState.IsSplit&&e.Quantity>1?2:-1),s(),m("ngClass",T(27,$d,i.appConfig==null||i.appConfig.ModuleSell==null?null:i.appConfig.ModuleSell.Grid.RowNumberVisible)),s(2),C(i.showThumbnail?5:-1),s(4),x(" ",e.Variant.Name," "),s(),C(!(i.appConfig==null||i.appConfig.ModuleSell==null)&&i.appConfig.ModuleSell.Grid.TaxVisible?10:-1),s(),C(e.PromotionGift?11:-1),s(2),x(" ",e==null||e.Variant==null?null:e.Variant.Code," "),s(),C(!(i.appConfig==null||i.appConfig.ModuleSell==null)&&i.appConfig.ModuleSell.Grid.CategoryVisible?14:-1),s(),C(!(i.appConfig==null||i.appConfig.ModuleSell==null)&&i.appConfig.ModuleSell.Grid.ShowBrandItemCart?15:-1),s(),C(!(i.appConfig==null||i.appConfig.ModuleSell==null||i.appConfig.ModuleSell.Grid==null)&&i.appConfig.ModuleSell.Grid.StorageVisible?16:-1),s(2),m("serials",e.Serial),s(),C(e.Note||e.PriceNote?19:-1),s(),C(e.SalesName?20:-1),s(),C(e.EntityName?21:-1),s(3),C(e.AvailableInventory<e.Quantity&&((e==null||e.Variant==null?null:e.Variant.TypeID)<9||(e==null||e.Variant==null?null:e.Variant.TypeID)==i.inventoryType.Composite)?24:-1),s(2),C(e.Quantity!==1&&e.Quantity!==0||e.UnitQuantity>1||e.VariantUnitQuantity>1?26:-1),s(),C(e.UnitQuantity>1?27:-1),s(),C(e.VariantUnitQuantity>1?28:-1),s(),C(i.isNotEmpty(e.Variant.UOM)&&(!(i.appConfig==null||i.appConfig.ModuleSell==null)&&i.appConfig.ModuleSell.Grid.UOMVisible)?29:-1),s(2),C((e.Price!==e.Total||e.DiscountAmount>0||e.Discount>0||e.UnitPriceOriginal>e.Price)&&i.userRole.PriceVisible?31:-1),s(3),C(e.Discount>0?34:-1),s(),C(e.DiscountAmount>0?35:-1),s(2),C(!(i.appConfig==null||i.appConfig.ModuleSell==null||i.appConfig.ModuleSell.Promotion==null)&&i.appConfig.ModuleSell.Promotion.StrikethroughOriginalPrice&&e.Quantity==1&&i.userRole.PriceVisible?37:38),s(4),C(i.hasItemDeletion?41:-1)}}function Pm(n,t){if(n&1){let e=y();r(0,"div",1)(1,"div",5)(2,"table",6)(3,"tbody",7),_("cdkDropListDropped",function(o){u(e);let a=c();return f(a.drop(o))}),ee(4,Im,42,29,"tr",8,pe),l()()()()}if(n&2){let e=c();s(4),te(e.cartItems)}}function Dm(n,t){n&1&&(r(0,"div",2)(1,"div",5)(2,"div",59)(3,"div",60)(4,"div",61),v(5,"i",62),l(),r(6,"div",63)(7,"span"),p(8,"Empty Cart"),l(),v(9,"br"),r(10,"span"),p(11,"Add products to the cart"),l(),v(12,"br"),r(13,"span"),p(14,"or scan barcode"),l()()()()()())}function Om(n,t){if(n&1){let e=y();r(0,"button",64),_("click",function(){let o=u(e).item,a=c();return f(a.onReverse(o,!0))}),p(1," Return "),l(),r(2,"button",65),_("click",function(){let o=u(e).item,a=c();return f(a.onReverse(o,!1))}),p(3,"Sales"),l(),r(4,"button",64),_("click",function(){let o=u(e).item,a=c();return f(a.onSumPrice(o))}),p(5," Merge / SUM Price "),l(),r(6,"button",64),_("click",function(){let o=u(e).item,a=c();return f(a.onBundlePrice(o))}),p(7," Bundle Price "),l()}if(n&2){let e=c();m("disabled",!e.userRole.Return),s(4),m("disabled",!e.userRole.BundlingPrice),s(2),m("disabled",!e.userRole.BundlingPrice)}}var zn=class n{constructor(t,e,i,o,a,h,E){this.salesOrderService=t;this.roleService=e;this.shoppingCartService=i;this.pageInitialService=o;this.dialog=a;this.orderProcessorService=h;this.moreMenuService=E;this.destroy$=new Q,this.eventAddItem=new je,this.enabledDragDrop$=this.moreMenuService.enabledDragDrop$}destroy$;cartItems=[];userRole;appConfig;currentSellState;hasItemDeletion;eventAddItem;isAddItem=!0;sellState=Pe;showThumbnail;enabledDragDrop$;inventoryType=Ui;qtyDecimalPlace=R(4);ngOnInit(){this.subscribeToObservable(),this.initDragDropEnabled(),this.initDecimalPlaceDigit()}initDecimalPlaceDigit(){this.qtyDecimalPlace.update(t=>{let e=this.pageInitialService.Data.AppConfigJSON?.ModuleSell?.ProductDialog?.DecimalPlaceDigit;return b.IsNotEmpty(e)?e:4})}initDragDropEnabled(){b.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 b.IsNotEmpty(t)}drop(t){sr(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(ce),d(de),d(A),d(re),d(U),d(Rt))};static \u0275cmp=M({type:n,selectors:[["sell-cart-body"]],viewQuery:function(e,i){if(e&1&&Se(Zi,7),e&2){let o;ye(o=xe())&&(i.contextMenu=o.first)}},outputs:{eventAddItem:"eventAddItem"},standalone:!1,decls:6,vars:6,consts:[["contextMenu","matMenu"],[1,"row","g-0"],[1,"row","g-0","h-100"],[2,"visibility","hidden","position","fixed",3,"matMenuTriggerFor"],["matMenuContent",""],[1,"col-12"],[1,"table","table-borderless"],["cdkDropList","",3,"cdkDropListDropped"],["cdkDrag","",2,"border-bottom","0.5px solid #dee2e6",3,"cdkDragDisabled"],["cdkDrag","",2,"border-bottom","0.5px solid #dee2e6",3,"contextmenu","cdkDragDisabled"],[2,"width","10px"],[1,"pe-0",2,"width","50%",3,"click","ngClass"],[1,"d-flex","align-items-center"],[1,"me-4"],[1,"d-block",2,"line-height","18px"],[1,"fs-5","d-flex","align-items-center"],[1,"me-1"],[1,"fst-italic","m-0","me-3"],["title","Product Promotion",1,"fa-solid","fa-gift"],["title","Product Code",1,"fw-normal","fs-6","text-muted"],["title","Product Category",1,"fst-italic","text-muted","d-block"],["title","Brand Name",1,"text-muted","d-block"],["title","Storage",1,"text-muted","d-block"],[3,"serials"],["title","Note",1,"special-TinyMCE","m-0","fst-italic","d-block",3,"innerHtml"],["title","Sales Name",1,"text-success","fst-italic","d-block"],[1,"px-0","text-end",2,"width","15%"],[1,"d-flex","align-items-center","justify-content-end"],["matTooltipPosition","above",1,"me-2",3,"matTooltip"],[1,"d-flex","text-end","fw-normal","align-items-center",2,"line-height","20px"],[1,"fs-5"],["title","Variant Unit Quantity",1,"fs-5"],["title","UOM",1,"ps-1","fs-5"],[3,"click"],[1,"d-block","fw-normal","fs-5","text-danger","ps-3"],[1,"pe-0",3,"click"],[1,"mt-6","ps-0"],[1,"d-flex","justify-content-end","align-items-center"],["title","Delete Item",1,"fs-3","cursor-pointer"],["type","checkbox",1,"me-2",3,"ngModel"],["type","checkbox",1,"me-2",3,"ngModelChange","ngModel"],[1,"ratio","ratio-1x1",2,"width","55px"],[1,"item-image","d-flex","justify-content-center","align-items-center","text-center","fs-1"],[1,"item-image",3,"src"],[1,"fa-solid","fa-image",2,"color","#b4b4b4c2"],["title","Taxable",1,"fa-regular","fa-droplet-percent","fs-4","text-success"],["title","Non Taxable",1,"fa-regular","fa-droplet-percent","fs-4","text-danger"],[1,"text-warning","d-block"],[1,"fa-solid","fa-triangle-exclamation","not-enough-inventory"],[1,"fs-5",3,"click"],[1,"fs-6","me-1","ms-1"],[1,"d-flex","algin-items-center",3,"click"],["title","Unit Quantity",1,"fs-5","me-1"],[1,"d-inline-block","fs-5"],[1,"d-inline-block","fs-5",3,"click"],[1,"text-decoration-line-through","text-danger","fs-5"],[1,"text-decoration-line-through","text-danger","d-flex","align-items-center","justify-content-end"],["title","Delete Item",1,"fs-3","cursor-pointer",3,"click"],[1,"fa","fa-trash","text-danger","fs-4"],[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,Pm,6,0,"div",1)(1,Dm,15,0,"div",2),v(2,"div",3),r(3,"mat-menu",null,0),Z(5,Om,8,3,"ng-template",4),l()),e&2){let o=ot(4);C(i.cartItems.length>0?0:1),s(2),Bo("left",i.contextMenuPosition.x)("top",i.contextMenuPosition.y),m("matMenuTriggerFor",o)}},dependencies:[z,zt,q,oe,pr,cr,Qr,Ur,Wr,Zi,se,$r,ze,K,mr],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 Jn=class{ID;Name;Code;Address;Phone;Email;SalesTarget;SalesPersonGroupID;Bin};var wm=["ngSelectInfinite"],km=(n,t)=>({"text-success":n,"text-danger":t}),Ua=n=>({"opacity-50":n}),Yn=(n,t)=>({red:n,green:t});function Tm(n,t){n&1&&v(0,"div",5)}function Em(n,t){if(n&1&&(r(0,"span",9),p(1),S(2,"async"),S(3,"number"),l()),n&2){let e=c();s(),x(" ",I(3,3,I(2,1,e.totalOfflineOrders$))," ")}}function Rm(n,t){if(n&1&&(r(0,"sup",15)(1,"div",28),p(2),S(3,"async"),S(4,"number"),l()()),n&2){let e=c();s(2),x(" ",I(4,3,I(3,1,e.moreMenuService.eligiblePromotions$))," ")}}function Nm(n,t){if(n&1&&v(0,"span",39),n&2){let e=c(4);m("ngClass",_e(1,Yn,!e.displayService.isEnabled(),e.displayService.isEnabled()))}}function Vm(n,t){if(n&1&&v(0,"span",39),n&2){let e=c(4);m("ngClass",_e(1,Yn,!e.orderDisplayService.isEnabled(),e.orderDisplayService.isEnabled()))}}function Am(n,t){if(n&1&&v(0,"span",39),n&2){let e=c(4);m("ngClass",_e(1,Yn,!e.ecrSignalService.isConnected(),e.ecrSignalService.isConnected()))}}function Lm(n,t){if(n&1&&v(0,"span",39),n&2){let e=c(4);m("ngClass",_e(1,Yn,!e.cashMachineService.isConnected(),e.cashMachineService.isConnected()))}}function Fm(n,t){if(n&1){let e=y();He(0),r(1,"li",35),_("click",function(){let o=u(e).$implicit,a=c(3);return f(o.disabled?null:a.moreMenuService.moreMenuAction(o.action))}),r(2,"div",36),v(3,"i",37),r(4,"span",38),p(5),l(),g(6,Nm,1,4,"span",39),g(7,Vm,1,4,"span",39),g(8,Am,1,4,"span",39),g(9,Lm,1,4,"span",39),l()(),Ue()}if(n&2){let e=t.$implicit;s(),m("matTooltip",e.disabled?e.description:"")("ngClass",T(10,Ua,e.disabled)),Ao("data-cy",e.cy),s(2),le(e.class),s(2),x(" ",e.label," "),s(),C(e.action=="CUSTOMER_DISPLAY"?6:-1),s(),C(e.action=="ODS_CONFIG"?7:-1),s(),C(e.action=="ECR"?8:-1),s(),C(e.action=="CASH_MACHINE"?9:-1)}}function Bm(n,t){if(n&1&&(He(0),r(1,"div",32),p(2),l(),v(3,"div",33),Z(4,Fm,10,12,"ng-container",34),Ue()),n&2){let e=c().$implicit;s(2),w(e.name),s(2),m("ngForOf",e.menus)}}function jm(n,t){if(n&1&&(r(0,"sup",15)(1,"div",28),p(2),S(3,"async"),S(4,"number"),l()()),n&2){let e=c(6);s(2),x(" ",I(4,3,I(3,1,e.moreMenuService.eligiblePromotions$))," ")}}function Hm(n,t){if(n&1&&(He(0),r(1,"div",36),v(2,"i",37),r(3,"span",38),p(4),l(),g(5,jm,5,5,"sup",15),S(6,"async"),l(),Ue()),n&2){let e=c().$implicit,i=c(4);s(2),le(e.class),s(2),w(e.label),s(),C(e.label=="Event"&&I(6,4,i.moreMenuService.eligiblePromotions$)>0?5:-1)}}function Um(n,t){if(n&1){let e=y();r(0,"li",35),_("click",function(){let o=u(e).$implicit,a=c(4);return f(o.disabled?null:a.moreMenuService.moreMenuAction(o.action))}),Z(1,Hm,7,6,"ng-container",30),l()}if(n&2){let e=t.$implicit;m("matTooltip",e.disabled?e.description:"")("ngClass",T(3,Ua,e.disabled)),s(),m("ngIf",e.isShow!==!1)}}function Wm(n,t){if(n&1&&(He(0),r(1,"div",32),p(2),l(),v(3,"div",33),Z(4,Um,2,5,"li",41),Ue()),n&2){let e=c().$implicit;s(2),w(e.name),s(2),m("ngForOf",e.menus)}}function Qm(n,t){if(n&1&&(r(0,"div",40),Z(1,Wm,5,2,"ng-container",30),l()),n&2){let e=t.$implicit;s(),m("ngIf",(e.menus==null?null:e.menus.length)>0)}}function $m(n,t){if(n&1&&(r(0,"div",29),Z(1,Bm,5,2,"ng-container",30)(2,Qm,2,1,"div",31),l()),n&2){let e=t.$implicit;s(),m("ngIf",(e.menus==null?null:e.menus.length)>0),s(),m("ngForOf",e.children)}}var Kn=class n{constructor(t,e,i,o,a,h,E,F,Ce,Te,Be,gi,Ci){this.pageInitialService=t;this.salesOrderService=e;this.userRoleService=i;this.outletService=o;this.dialog=a;this.promotionEventService=h;this.moreMenuService=E;this.toggleSidebar=F;this.displayService=Ce;this.ecrSignalService=Te;this.cashMachineService=Be;this.localDataService=gi;this.orderDisplayService=Ci;this.appConfig=this.pageInitialService.Data.AppConfigJSON,this.destroy$=new Q,this.totalOfflineOrders$=this.localDataService.unsentOrders$.pipe(it(Nt=>Nt.length),jt(1)),this.toggleSidebar.toggleState$.subscribe(Nt=>this.isChange=Nt)}onlineStatusService=$(pt);salesOrder;appConfig;selectedCustomerId;userRole;salesPersonList=[];destroy$;outletRegister;salesPersonName;isOnline$=this.onlineStatusService.getOnlineStatus$();ngSelectInfinite;handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.dialog.open($e)}handleF2(){this.ngSelectInfinite&&this.ngSelectInfinite.ngSelectElement.focus()}disabledSalesOption=!1;salesPersonOptionTooltip=R("");isEnabledLoyaltyPoint;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),b.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");b.IsEmpty(e)&&this.dialog.open(nn,{id:"promotion-event"})}})}checkDisabledSalesOption(t=[]){this.disabledSalesOption=!1,(t.filter(i=>b.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 Jn;e.ID=b.GuidEmpty,this.salesPersonList=[...t]}openOnlineStatusModal(){this.localDataService.unsentOrders$.pipe(Bt(1),Ve(t=>{let e=t.length>0?"ORDER":"SETUP";return this.dialog.open(rn,{id:"ModalOfflineOrder",data:{activeTab:e}}).afterClosed()})).subscribe()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(A),d(V),d(ce),d(G),d(re),d(ni),d(Rt),d(ar),d(qi),d(kt),d(oi),d(Ye),d(Qi))};static \u0275cmp=M({type:n,selectors:[["sell-cart-header"]],viewQuery:function(e,i){if(e&1&&Se(wm,7),e&2){let o;ye(o=xe())&&(i.ngSelectInfinite=o.first)}},hostBindings:function(e,i){e&1&&_("keydown.F4",function(){return i.handleF8()},ut)("keydown.control.F2",function(){return i.handleF2()},ut)},standalone:!1,decls:37,vars:26,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","position-relative","pe-8","cursor-pointer",3,"click"],[1,"offline-bg"],[1,"me-2","z-1"],[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,"me-2"],[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","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=y();Ri(0),S(1,"async"),r(2,"div",1)(3,"div",2)(4,"div",3)(5,"span",4),_("click",function(){return u(o),f(i.openOnlineStatusModal())}),g(6,Tm,1,0,"div",5),r(7,"span",6),v(8,"i",7),l(),r(9,"span",8),p(10),g(11,Em,4,5,"span",9),S(12,"async"),l()(),v(13,"span",10),r(14,"span",11)(15,"span",12),v(16,"i",13),l(),r(17,"span",14),p(18,"More Actions"),l(),g(19,Rm,5,5,"sup",15),S(20,"async"),l(),r(21,"div",16)(22,"div",17),Z(23,$m,3,2,"div",18),S(24,"async"),l()()()(),r(25,"div",19)(26,"div",20)(27,"div",21),v(28,"i",22),l(),r(29,"div",23)(30,"ng-select-infinite",24,0),O("selectedChange",function(h){return u(o),D(i.salesOrder.Order.SalesID,h)||(i.salesOrder.Order.SalesID=h),f(h)}),_("selectedLabel",function(h){return u(o),f(i.salesPersonName=h)}),l()(),r(32,"div",25)(33,"button",26),_("click",function(){return u(o),f(i.collapseSidebar())}),v(34,"span",27)(35,"span",27)(36,"span",27),l()()()()()}if(e&2){let o=I(1,15,i.isOnline$);s(6),C(o?-1:6),s(2),m("ngClass",_e(23,km,o,!o)),s(2),x("",o?"Online":"Offline"," "),s(),C(I(12,17,i.totalOfflineOrders$)>0?11:-1),s(8),C(I(20,19,i.moreMenuService.eligiblePromotions$)>0?19:-1),s(4),m("ngForOf",I(24,21,i.moreMenuService.moreMenu$)),s(6),m("matTooltip",i.salesPersonName),s(),m("clearable",!0)("items",i.salesPersonList),P("selected",i.salesOrder.Order.SalesID),m("disabled",i.disabledSalesOption)("optionTitle",!0)("matTooltip",i.salesPersonOptionTooltip()),s(3),jo("change",i.isChange)}},dependencies:[z,Ai,Qt,Dt,se,ze,K],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>.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}.offline-bg{position:absolute;top:-17px;left:-22px;width:5.89rem;height:3.7rem;background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important;z-index:0}
|
|
43
|
-
`],encapsulation:2})};var
|
|
44
|
-
`],encapsulation:2})};var
|
|
45
|
-
`],encapsulation:2})};var
|
|
40
|
+
`,okText:"Connect"},this.dialog.open(ri,{data:e,width:"500px"}).afterClosed().pipe(ie(i=>i),ve(()=>{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(a=>a.VariantID),o={Outlet:this.outletRegisterService.Data.EntityID,Cart:i};this.httpService.post(fe.ValidateInventory,o).subscribe(a=>{this.setAvailableInventory(a)})}setAvailableInventory(t){let e=this.salesOrderService.Data,i=e.CartItems,o=0;e.CartItems=i.map(a=>{let h=t.findIndex(E=>E.VariantID==a.VariantID);return h!==-1&&(a.AvailableInventory=t[h].OnHand,(a.Variant?.TypeID<9||a.Variant?.TypeID==12)&&(o+=a.Quantity>a.AvailableInventory?1:0)),a}),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(a=>(a.menus=a.menus.map(h=>{switch(h.action){case"PROMOTION":i?.getRewards()?.length>0&&(h.disabled=!0,h.description="Promotion event selection is disabled as this transaction already applies a reward from a promotion event");break}return h}),a)),o.menus=o.menus.map(a=>{switch(a.action){case"RETURN":a.disabled=!0,a.description="Return is disabled in edit mode";break}return a}),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(a=>(i=t.findIndex(h=>h.action==a.action),i!==-1?a.disabled=t[i].role==!1:a.disabled=!1,a)),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(Nn).afterClosed().pipe(k(this.destroy$),ie(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(fi)}onImportItems(){let t=this.salesOrderService?.Data?.Order?.EntityID;this.dialog.open(ln,{data:{sampleUrl:Ko.files.csv.sell_import,API:fe.UploadCsv,outletID:t,useUppy:!0,fileEndpoint:"/API/POS/UploadCsvV3"}}).afterClosed().pipe(ie(e=>!!e)).subscribe(e=>{let i;for(let o of e)i=new Re,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(An)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(N(ce),N(U),N(ni),N(Mt),N(wt),N(re),N(ke),N(V),N(G),N(A),N(J),N(Le),N(de),N(qi),N(tn),N(kt),N(oi),N(Qi))};static \u0275prov=Ge({token:n,factory:n.\u0275fac})};var Un=class n{config=new H;dialogRef=$(B);salesOrderService=$(V);constructor(){let t=this.salesOrderService.Data;this.config.title=`Editing Order #${t?.Order.Number}`,this.config.hideFooter=!0,this.config.customWidth="500px"}onContinueEditing(){this.dialogRef.close("CONTINUE_EDITING")}onCreateNewOrder(){this.dialogRef.close("CREATE_NEW_ORDER")}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=M({type:n,selectors:[["app-modal-confirm-edit"]],decls:13,vars:1,consts:[[3,"onClose","config"],[1,"warning-container"],[1,"fas","fa-exclamation-triangle","warning-icon"],[1,"warning-message"],[1,"d-flex","justify-content-end",2,"margin-top","18px"],[1,"btn","btn-light-blue","text-primary","btn-lg","fw-bold","mx-3",3,"click"],[1,"fas","fa-plus","me-2"],[1,"fas","fa-edit","me-2"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onClose",function(){return i.onClose()}),r(1,"content")(2,"div",1),v(3,"i",2),r(4,"p",3),p(5," You are currently editing an order. Any unsaved changes will be lost if you proceed with a new order. Would you like to continue editing the current order or start processing a new order? "),l()(),r(6,"div",4)(7,"button",5),_("click",function(){return i.onCreateNewOrder()}),v(8,"i",6),p(9," New Order "),l(),r(10,"button",5),_("click",function(){return i.onContinueEditing()}),v(11,"i",7),p(12," Continue Editing "),l()()()()),e&2&&m("config",i.config)},dependencies:[X,j],styles:['.warning-container[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;gap:10px;background:#fff3cd;border:1px solid #ffeeba;border-radius:8px;padding:15px 15px 15px 20px}.warning-container[_ngcontent-%COMP%]:before{content:"";position:absolute;top:0;left:0;width:4px;height:100%;background:linear-gradient(to bottom,#f39c12,#e67e22);border-radius:8px 0 0 8px}.warning-icon[_ngcontent-%COMP%]{color:#856404;font-size:20px;flex-shrink:0}.warning-message[_ngcontent-%COMP%]{margin:0;color:#856404;font-size:14px;line-height:1.4}']})};var ja=n=>({"quickkey-subscription-overdue":n}),Ha=()=>["/menu/Outlets/Master/Quick_Key_Templates/Form"],Tp=n=>({ID:n}),Ep=n=>({OutletID:n});function Rp(n,t){if(n&1&&v(0,"img",17),n&2){let e=c(2).$implicit;m("ngSrc",e.ImageURLClient)}}function Np(n,t){if(n&1&&(r(0,"div",15)(1,"div",16),g(2,Rp,1,1,"img",17),l()()),n&2){let e=c().$implicit;s(2),C(e.ImageURLClient?2:-1)}}function Vp(n,t){if(n&1&&(r(0,"div",16)(1,"p",18)(2,"span"),p(3),b(4,"slice"),l()()()),n&2){let e=c().$implicit;s(3),w(Ae(4,1,e.Display,0,3))}}function Ap(n,t){if(n&1&&(r(0,"small",19),p(1),b(2,"number"),l()),n&2){let e=c(2).$implicit;s(),w(I(2,1,e.Children[0].UnitPrice))}}function Lp(n,t){if(n&1&&(r(0,"small",20),p(1),b(2,"lowestPrice"),b(3,"number"),b(4,"highestPrice"),b(5,"number"),l()),n&2){let e=c(2).$implicit;s(),Ee("",I(3,4,I(2,2,e==null?null:e.Children))," - ",I(5,8,I(4,6,e==null?null:e.Children)))}}function Fp(n,t){if(n&1&&g(0,Ap,3,3,"small",19)(1,Lp,6,10,"small",20),n&2){let e=c().$implicit;C(e.Children.length==1?0:1)}}function Bp(n,t){if(n&1){let e=y();r(0,"div",13)(1,"a",14),_("click",function(){let o=u(e).$implicit,a=c(4);return f(a.onSelectProduct(o))}),g(2,Np,3,1,"div",15)(3,Vp,5,5,"div",16),r(4,"small"),p(5),b(6,"slice"),l(),g(7,Fp,2,1),l()()}if(n&2){let e=t.$implicit,i=c(4);le(i.colConfigCSSClass),s(2),C(e.ImageURLClient?2:3),s(3),w(Ae(6,5,e.Display,0,36)),s(2),C(i.quickKeyPriceVisible?7:-1)}}function jp(n,t){if(n&1&&(r(0,"mat-tab",6)(1,"div",7)(2,"div",8),ee(3,Bp,8,9,"div",9,pe),r(5,"div",10)(6,"a",11),v(7,"i",12),l()()()()()),n&2){let e=t.$implicit,i=c(3);m("label",e.Name),s(3),te(e==null?null:e.Items),s(2),le(i.colConfigCSSClass),s(),m("routerLink",st(5,Ha))("queryParams",T(6,Tp,i.quickKey.ID))}}function Hp(n,t){if(n&1){let e=y();r(0,"mat-tab-group",5),O("selectedIndexChange",function(o){u(e);let a=c(2);return D(a.quickeyTabActive,o)||(a.quickeyTabActive=o),f(o)}),ee(1,jp,8,8,"mat-tab",6,pe),l()}if(n&2){let e=c(2);m("disableRipple",!0),P("selectedIndex",e.quickeyTabActive),s(),te(e.quickKey==null?null:e.quickKey.Groups)}}function Up(n,t){if(n&1&&v(0,"img",26),n&2){let e=c(2).$implicit;m("src",e.ImageURLClient,nt)}}function Wp(n,t){if(n&1&&(r(0,"div",15)(1,"div",16),g(2,Up,1,1,"img",26),l()()),n&2){let e=c().$implicit;s(2),C(e.ImageURLClient?2:-1)}}function Qp(n,t){if(n&1&&(r(0,"div",16)(1,"p",18)(2,"span"),p(3),b(4,"slice"),l()()()),n&2){let e=c().$implicit;s(3),w(Ae(4,1,e.Model,0,3))}}function $p(n,t){if(n&1&&(r(0,"small",19),p(1),b(2,"number"),l()),n&2){let e=c().$implicit;s(),w(I(2,1,e.UnitPrice))}}function qp(n,t){if(n&1){let e=y();r(0,"div",13)(1,"a",14),_("click",function(){let o=u(e).$implicit,a=c(3);return f(a.onSelectVariant(o.ID))}),g(2,Wp,3,1,"div",15)(3,Qp,5,5,"div",16),r(4,"small"),p(5),b(6,"slice"),l(),g(7,$p,3,3,"small",19),l()()}if(n&2){let e=t.$implicit,i=c(3);le(i.colConfigCSSClass),s(2),C(e.ImageURLClient?2:3),s(3),w(Ae(6,5,e.Model,0,30)),s(2),C(i.quickKeyPriceVisible?7:-1)}}function Gp(n,t){if(n&1){let e=y();r(0,"div",21)(1,"div",22),_("click",function(){u(e);let o=c(2);return f(o.quickeyState="QUICKEY")}),v(2,"i",23),l(),r(3,"div",24)(4,"b"),p(5),l()()(),r(6,"div",7)(7,"div",25),ee(8,qp,8,9,"div",9,pe),l()()}if(n&2){let e=c(2);s(5),x(" ",e.subQuickeyPack.Display),s(3),te(e.subQuickeyPack==null?null:e.subQuickeyPack.Children)}}function zp(n,t){if(n&1&&g(0,Hp,3,2,"mat-tab-group",4)(1,Gp,10,1),n&2){let e=c();C(e.quickeyState=="QUICKEY"?0:1)}}function Jp(n,t){if(n&1&&(r(0,"div",3)(1,"a",27)(2,"strong"),p(3,"QUICK KEYS UNCONFIGURED"),l(),v(4,"i",28),r(5,"span"),p(6,"Click here to setup your Quick keys"),l()()()),n&2){let e=c();m("ngClass",T(3,ja,e.currentSubsStatus==e.subscriptionStatus.OVERDUE||e.currentSubsStatus==e.subscriptionStatus.SELL_ONLY)),s(),m("routerLink",st(5,Ha))("queryParams",T(6,Ep,e.entityId))}}var Wn=class n{constructor(t,e,i,o,a,h){this.outletRegisterService=t;this.shoppingCartService=e;this.dialog=i;this.pageInitialService=o;this.salesOrderService=a;this.authService=h;this.destroy$=new Q,this.quickeyState="QUICKEY",this.currentSubsStatus=this.authService.getSubscriptionStatus()}destroy$;quickKey;subQuickeyPack;entityId;quickeyState;quickeyTabActive=0;colConfigCSSClass;subscriptionStatus=Gt;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(G),d(de),d(re),d(A),d(V),d(Kt))};static \u0275cmp=M({type:n,selectors:[["sell-quick-key"]],standalone:!1,decls:5,vars:4,consts:[[1,"row"],[1,"col-12"],[1,"quick-key-tab",3,"ngClass"],[1,"no-quick-key","d-flex","align-items-center","justify-content-center",3,"ngClass"],[1,"h-100","bgQuickkeyIllustration","landscape",3,"disableRipple","selectedIndex"],[1,"h-100","bgQuickkeyIllustration","landscape",3,"selectedIndexChange","disableRipple","selectedIndex"],[3,"label"],[1,"container","tabItems"],[1,"row","g-0"],[1,"column","px-6",3,"class"],[1,"column","d-flex","align-items-center","pb-6"],[1,"w-100",3,"routerLink","queryParams"],["aria-hidden","true",1,"fa","fa-plus-circle","fa-5x","d-flex","align-items-center","justify-content-center","bg-white","h-100","text-primary"],[1,"column","px-6"],[3,"click"],[1,"img-box","d-flex","align-items-center"],[1,"ratio","ratio-1x1"],["priority","","fill","",1,"full-screen-image",3,"ngSrc"],[1,"fw-normal","fs-1","d-flex","align-items-center","justify-content-center"],[1,"text-muted"],[1,"text-muted",2,"word-break","auto-phrase"],[1,"row","g-0","border","align-items-center","subquicKey"],[1,"col-auto","border-end","py-5","px-7","cursor-pointer",3,"click"],["aria-hidden","true",1,"fa","fa-arrow-left"],[1,"col","text-center","fw-bold","text-uppercase","fs-5"],[1,"row","g-0","rowSubQuickey"],[1,"full-screen-image",3,"src"],["id","LinkConfigureQuickkey","target","_blank",3,"routerLink","queryParams"],["aria-hidden","true",1,"fa-regular","fa-hand-pointer"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1)(2,"section",2),g(3,zp,2,1)(4,Jp,7,8,"div",3),l()()()),e&2&&(s(2),m("ngClass",T(2,ja,i.currentSubsStatus==i.subscriptionStatus.OVERDUE||i.currentSubsStatus==i.subscriptionStatus.SELL_ONLY)),s(),C(i.quickKey!=null&&i.quickKey.Groups&&(i.quickKey==null||i.quickKey.Groups==null?null:i.quickKey.Groups.length)>0?3:4))},dependencies:[z,xt,It,$t,Go,Fi,K,gr,Cr],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(https://cdn.dealpos.xyz/web-image/no-quick-key.png)!important;background-repeat:no-repeat;height:calc(100vh - 70px);background-size:contain}a#LinkConfigureQuickkey[_ngcontent-%COMP%]{background-color:#479ccf;padding:15px 25px;color:#fff;text-decoration:none;width:240px;display:block;opacity:.85;border-radius:6px}a#LinkConfigureQuickkey[_ngcontent-%COMP%]{position:absolute;top:200px;left:calc(50% - 120px)}a#LinkConfigureQuickkey[_ngcontent-%COMP%]:hover{opacity:.95}a#LinkConfigureQuickkey[_ngcontent-%COMP%] Strong[_ngcontent-%COMP%]{border-bottom:1px solid white;font-size:14px;margin:0 0 10px;padding:0 0 3px;display:block}a#LinkConfigureQuickkey[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{display:inline-block;height:35px;margin:0 10px 0 0;font-size:28px}a#LinkConfigureQuickkey[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:inline-block;font-size:14px;width:135px;vertical-align:top}"]})};var Yp=n=>({"cursor-pointer":n}),Zp=(n,t)=>({"px-2 py-2 number-disabled":n,"py-1 px-1 bg-gradient-warning":t}),Xp=(n,t)=>({"d-flex justify-content-end align-items-center":n,"mt-1":t}),ed=(n,t)=>({label:n,tooltip:t}),Ua=n=>({data:n}),td=()=>({label:"Later",tooltip:"Fulfillment Later"}),id=n=>({"bg-gradient-warning px-2":n}),nd=n=>({"me-3":n});function od(n,t){if(n&1&&(r(0,"span"),p(1),l()),n&2){let e=c();s(),Ee("",e.isSalesOrderEdit?"Edit Order ":"New Order ","#",e.salesOrder==null||e.salesOrder.Order==null?null:e.salesOrder.Order.Number)}}function rd(n,t){n&1&&(r(0,"div",8),p(1,"Order Number"),l())}function ad(n,t){n&1&&oo(0)}function ld(n,t){if(n&1&&(r(0,"div",10),Z(1,ad,1,0,"ng-container",13),l()),n&2){let e=c(),i=ot(17);s(),m("ngTemplateOutlet",i)("ngTemplateOutletContext",T(5,Ua,_e(2,ed,e.isDifferentFullfillmentOutlet().outletName,e.isDifferentFullfillmentOutlet().outletName)))}}function sd(n,t){n&1&&oo(0)}function cd(n,t){if(n&1&&(r(0,"div",10),Z(1,sd,1,0,"ng-container",13),l()),n&2){c();let e=ot(17);s(),m("ngTemplateOutlet",e)("ngTemplateOutletContext",T(3,Ua,st(2,td)))}}function pd(n,t){if(n&1&&(r(0,"h5",18),p(1),b(2,"limitTo"),l()),n&2){let e=c().data;s(),w(ne(2,1,e==null?null:e.label,14))}}function dd(n,t){if(n&1){let e=y();r(0,"div",14)(1,"div",15),_("click",function(){u(e);let o=c();return f(o.openFulfillmentModal())}),r(2,"div",16),v(3,"i",17),l(),g(4,pd,3,4,"h5",18),l()()}if(n&2){let e=t.data;m("ngClass",T(4,id,e.label))("matTooltip",e==null?null:e.tooltip),s(2),m("ngClass",T(6,nd,e.label)),s(2),C(e!=null&&e.label?4:-1)}}var Qn=class n{constructor(t,e,i,o,a,h,E,F){this.registerService=t;this.salesOrderService=e;this.pageInitialService=i;this.coreService=o;this.dialog=a;this.shoppingCartService=h;this.userRoleService=E;this.orderProcessorService=F;this.destroy$=new Q}selectedOutlet;destroy$;salesOrder;register;userRole;isSalesOrderEdit=!1;selectedDate=new Date;isDifferentFullfillmentOutlet=R({isDifferent:!1,outletName:""});isFulfillmentLater=R(!1);minDate=R(0);ngOnInit(){this.subscribeToObservable(),this.initMinDate()}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})}initMinDate(){let e=this.pageInitialService.Data?.UserGroupConfig?.InputDaysRange;e!=null&&e>=0?this.minDate.set(e):this.minDate.set(0)}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(Ar,{id:"registerModal",disableClose:!0}).afterClosed().pipe(k(this.destroy$),ie(t=>S.IsNotEmpty(t?.selectedRegister))).subscribe(t=>{t?.openStartingCashDialog&&this.openOpeningCashModal()})}openOpeningCashModal(){this.pageInitialService.Data.AppConfigJSON.ModuleShift.Closure.Enabled&&this.dialog.open(Lr,{disableClose:!0}).afterClosed().pipe(ie(e=>S.IsNotEmpty(e))).subscribe(e=>{let i={RegisterID:this.salesOrder.Order.RegisterID,OpAmount:e.amount};this.coreService.recordOpeningCash(i),this.initCursorFocus()})}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(a=>a.VariantID==t),o=this.salesOrder.Items.lastIndexOf(i);this.dialog.open($e,{data:{index:o,focus:"quantity"}})}}onEditNumber(){this.userRole.NumberEditor&&this.dialog.open(ia,{width:"20%"})}openFulfillmentModal(){this.dialog.open(fi)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}initCursorFocus(){let t=document.getElementById("product"),e=this.selectedOutlet?.RegisterID;t&&S.IsNotEmpty(e)&&t.focus()}static \u0275fac=function(e){return new(e||n)(d(G),d(V),d(A),d(Vr),d(re),d(de),d(ce),d(U))};static \u0275cmp=M({type:n,selectors:[["sell-header"]],standalone:!1,decls:18,vars:25,consts:[["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",2,"width","27px"],[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"],[1,"text-body-secondary","fst-italic"],[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","minDate","maxDate"],[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=y();r(0,"div",1)(1,"div",2)(2,"div",3),_("click",function(){return u(o),f(i.openRegisterModal())}),v(3,"i",4),l(),r(4,"div",5)(5,"h3",6),_("click",function(){return u(o),f(i.openRegisterModal())}),p(6),b(7,"limitTo"),l(),r(8,"h6",7),_("click",function(){return u(o),f(i.onEditNumber())}),g(9,od,2,2,"span")(10,rd,2,0,"div",8),l()()(),r(11,"div",9),g(12,ld,2,7,"div",10),g(13,cd,2,5,"div",10),r(14,"div",11)(15,"POS-invoice-date",12),O("ngModelChange",function(h){return u(o),D(i.selectedDate,h)||(i.selectedDate=h),f(h)}),_("ngModelChange",function(){return u(o),f(i.onSelectDate())}),l()()()(),Z(16,dd,5,8,"ng-template",null,0,ht)}if(e&2){let o,a;s(4),m("ngClass",T(17,Yp,i.userRole.NumberEditor)),s(),m("matTooltip",i.register==null?null:i.register.Name),s(),x(" ",ne(7,14,i.register!=null&&i.register.Name?i.register==null?null:i.register.Name:"Choose an Outlet",25)," "),s(2),m("ngClass",_e(19,Zp,!i.userRole.NumberEditor,i.isSalesOrderEdit))("matTooltip",i.userRole.NumberEditor?"Sales order number":"Number Edit role is required"),s(),C(!(i.salesOrder==null||i.salesOrder.Order==null)&&i.salesOrder.Order.Number?9:10),s(2),m("ngClass",_e(22,Xp,!((o=i.isDifferentFullfillmentOutlet())!=null&&o.isDifferent)&&!i.isFulfillmentLater(),(o=i.isDifferentFullfillmentOutlet())==null?null:o.isDifferent)),s(),C((a=i.isDifferentFullfillmentOutlet())!=null&&a.isDifferent?12:-1),s(),C(i.isFulfillmentLater()?13:-1),s(2),P("ngModel",i.selectedDate),m("disabled",!(i.userRole!=null&&i.userRole.DateEditor))("tooltip",i.userRole!=null&&i.userRole.DateEditor?"":"Date role is required")("minDate",i.minDate())("maxDate",i.minDate()>0?1:null)}},dependencies:[z,qo,q,oe,se,Yi,ji],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}
|
|
41
|
+
`],encapsulation:2})};var $n=class n{static \u0275fac=function(e){return new(e||n)};static \u0275cmp=M({type:n,selectors:[["sell-left-content"]],standalone:!1,decls:7,vars:0,consts:[[1,"d-flex","flex-column"],[1,"row","border-bottom","pt-2",2,"min-height","60px"],[1,"col-12"],[1,"row","mt-5"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1)(2,"div",2),v(3,"sell-header"),l()(),r(4,"div",3)(5,"div",2),v(6,"sell-quick-key"),l()()())},dependencies:[Wn,Qn],encapsulation:2})};var Ft=n=>({selected:n});function fd(n,t){if(n&1){let e=y();r(0,"a",10),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalTabState.TYPE))}),p(1," Tag "),l()}if(n&2){let e=c();m("ngClass",T(1,Ft,e.modalTabState.TYPE==e.currentTabState))}}function gd(n,t){if(n&1){let e=y();r(0,"a",11),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalTabState.LOGISTICS))}),p(1," Logistics Service "),l()}if(n&2){let e=c();m("ngClass",T(1,Ft,e.modalTabState.LOGISTICS==e.currentTabState))}}function Cd(n,t){if(n&1){let e=y();r(0,"a",12),_("click",function(){u(e);let o=c();return f(o.onTabChange(o.modalTabState.NUMBER))}),p(1," Number "),l()}if(n&2){let e=c();m("ngClass",T(1,Ft,e.modalTabState.NUMBER==e.currentTabState))}}function _d(n,t){if(n&1){let e=y();r(0,"div",14)(1,"div",16)(2,"span",17),v(3,"i",18),l(),r(4,"input",19),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.poTypesSearchTerm,o)||(a.poTypesSearchTerm=o),f(o)}),l()()()}if(n&2){let e=c(2);s(4),P("ngModel",e.poTypesSearchTerm)}}function hd(n,t){if(n&1){let e=y();r(0,"div",15)(1,"label",20)(2,"input",21),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.posData.Order.TypeID,o)||(a.posData.Order.TypeID=o),f(o)}),_("click",function(){let o=u(e).$implicit,a=c(2);return f(a.onSelectSalesOrderTag(o))}),l(),p(3),l()()}if(n&2){let e=t.$implicit,i=t.$index,o=c(2);s(),m("for",bi("potype-"+i))("ngClass",T(8,Ft,o.posData.Order.TypeID==e.ID)),s(),m("id",bi("potype-"+i)),P("ngModel",o.posData.Order.TypeID),m("value",e.ID),s(),x(" ",e.Name," ")}}function vd(n,t){if(n&1&&(r(0,"div",8)(1,"div",13),g(2,_d,5,1,"div",14),ee(3,hd,4,10,"div",15,pe),b(5,"FilterByName"),l()()),n&2){let e,i=c();s(2),C(((e=i.poTypes())==null?null:e.length)>5?2:-1),s(),te(ne(5,1,i.poTypes(),i.poTypesSearchTerm()))}}function bd(n,t){if(n&1){let e=y();r(0,"POS-tinymce-editor",25),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.posData.Invoice.Note,o)||(a.posData.Invoice.Note=o),f(o)}),l()}if(n&2){let e=c(2);P("ngModel",e.posData.Invoice.Note)}}function Sd(n,t){if(n&1){let e=y();r(0,"textarea",26),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.posData.Invoice.Note,o)||(a.posData.Invoice.Note=o),f(o)}),l()}if(n&2){let e=c(2);P("ngModel",e.posData.Invoice.Note)}}function yd(n,t){if(n&1&&(r(0,"div",8)(1,"div",22),g(2,bd,1,1,"POS-tinymce-editor",23),g(3,Sd,1,1,"textarea",24),l()()),n&2){let e=c();s(2),C(e.isOnline?2:-1),s(),C(e.isOnline?-1:3)}}function xd(n,t){if(n&1){let e=y();r(0,"POS-tinymce-editor",25),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.posData.Order.Note,o)||(a.posData.Order.Note=o),f(o)}),l()}if(n&2){let e=c(2);P("ngModel",e.posData.Order.Note)}}function Id(n,t){if(n&1){let e=y();r(0,"textarea",26),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.posData.Order.Note,o)||(a.posData.Order.Note=o),f(o)}),l()}if(n&2){let e=c(2);P("ngModel",e.posData.Order.Note)}}function Pd(n,t){if(n&1&&(r(0,"div",8)(1,"div",22),g(2,xd,1,1,"POS-tinymce-editor",23),g(3,Id,1,1,"textarea",24),l()()),n&2){let e=c();s(2),C(e.isOnline?2:-1),s(),C(e.isOnline?-1:3)}}function Dd(n,t){if(n&1){let e=y();r(0,"div",14)(1,"div",16)(2,"span",17),v(3,"i",18),l(),r(4,"input",19),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.serviceLogisticsSearchTerm,o)||(a.serviceLogisticsSearchTerm=o),f(o)}),l()()()}if(n&2){let e=c(2);s(4),P("ngModel",e.serviceLogisticsSearchTerm)}}function Od(n,t){if(n&1){let e=y();r(0,"div",15)(1,"label",20)(2,"input",21),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.posData.Order.LogisticsServiceID,o)||(a.posData.Order.LogisticsServiceID=o),f(o)}),_("click",function(){let o=u(e).$implicit,a=c(2);return f(a.onSelectLogisticsService(o.ID))}),l(),p(3),l()()}if(n&2){let e=t.$implicit,i=t.$index,o=c(2);s(),m("for",bi("potype-"+i))("ngClass",T(8,Ft,o.posData.Order.LogisticsServiceID==e.ID)),s(),m("id",bi("potype-"+i)),P("ngModel",o.posData.Order.LogisticsServiceID),m("value",e.ID),s(),x(" ",e.Name," ")}}function Md(n,t){if(n&1&&(r(0,"div",8)(1,"div",13),g(2,Dd,5,1,"div",14),ee(3,Od,4,10,"div",15,pe),b(5,"FilterByName"),l()()),n&2){let e,i=c();s(2),C(((e=i.serviceLogistics())==null?null:e.length)>5?2:-1),s(),te(ne(5,1,i.serviceLogistics(),i.serviceLogisticsSearchTerm()))}}function wd(n,t){if(n&1){let e=y();r(0,"div",36)(1,"span",37),p(2,"@"),l(),r(3,"input",38),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.exchangeRate,o)||(a.exchangeRate=o),f(o)}),l()()}if(n&2){let e=c(2);s(3),P("ngModel",e.exchangeRate)}}function kd(n,t){if(n&1){let e=y();r(0,"div",9)(1,"div",27)(2,"strong",28),p(3,"Reference Number"),l(),r(4,"input",29),O("ngModelChange",function(o){u(e);let a=c();return D(a.posData.Order.ReferenceNumber,o)||(a.posData.Order.ReferenceNumber=o),f(o)}),l()(),r(5,"div",27)(6,"strong",30),p(7,"Invoice Number"),l(),r(8,"input",31),O("ngModelChange",function(o){u(e);let a=c();return D(a.posData.Invoice.Number,o)||(a.posData.Invoice.Number=o),f(o)}),l()()(),r(9,"div",9)(10,"div",27)(11,"div",32)(12,"strong",28),p(13,"Number of Person"),l(),r(14,"input",33),O("ngModelChange",function(o){u(e);let a=c();return D(a.posData.Order.NumberOfPerson,o)||(a.posData.Order.NumberOfPerson=o),f(o)}),l()()(),r(15,"div",27)(16,"strong",28),p(17,"Currency"),l(),r(18,"div",34)(19,"ng-select",35),O("ngModelChange",function(o){u(e);let a=c();return D(a.posData.Order.CurrencyID,o)||(a.posData.Order.CurrencyID=o),f(o)}),_("change",function(o){u(e);let a=c();return f(a.updateCurrencySymbol(o))}),l(),g(20,wd,4,1,"div",36),l()()()}if(n&2){let e=c();s(4),P("ngModel",e.posData.Order.ReferenceNumber),s(4),P("ngModel",e.posData.Invoice.Number),m("disabled",!e.roleService.sell.Number),s(6),P("ngModel",e.posData.Order.NumberOfPerson),s(5),m("items",e.currencies()),P("ngModel",e.posData.Order.CurrencyID),m("clearable",!1),s(),C(e.posData.Order.CurrencyID!=e.defaultCurrencyID?20:-1)}}function Td(n,t){if(n&1){let e=y();r(0,"div",36)(1,"span",37),p(2,"@"),l(),r(3,"input",38),O("ngModelChange",function(o){u(e);let a=c(2);return D(a.exchangeRate,o)||(a.exchangeRate=o),f(o)}),l()()}if(n&2){let e=c(2);s(3),P("ngModel",e.exchangeRate)}}function Ed(n,t){if(n&1){let e=y();r(0,"div",9)(1,"div",27)(2,"div",32)(3,"strong",28),p(4,"Number of Person"),l(),r(5,"input",33),O("ngModelChange",function(o){u(e);let a=c();return D(a.posData.Order.NumberOfPerson,o)||(a.posData.Order.NumberOfPerson=o),f(o)}),l()()(),r(6,"div",27)(7,"strong",28),p(8,"Currency"),l(),r(9,"div",34)(10,"ng-select",35),O("ngModelChange",function(o){u(e);let a=c();return D(a.posData.Order.CurrencyID,o)||(a.posData.Order.CurrencyID=o),f(o)}),_("change",function(o){u(e);let a=c();return f(a.updateCurrencySymbol(o))}),l(),g(11,Td,4,1,"div",36),l()()()}if(n&2){let e=c();s(5),P("ngModel",e.posData.Order.NumberOfPerson),s(5),m("items",e.currencies()),P("ngModel",e.posData.Order.CurrencyID),m("clearable",!1),s(),C(e.posData.Order.CurrencyID!=e.defaultCurrencyID?11:-1)}}var qn=class n{constructor(t,e,i,o,a,h,E,F,Ce){this._dialogRef=t;this._orderDataService=e;this._posService=i;this._cashierCalculatorService=o;this._outletRegisterService=a;this._orderHttpService=h;this._toastrService=E;this._onlineService=F;this.roleService=Ce;this.destroy$=new Q,this.currentTabState=1}serviceLogistics=R([]);serviceLogisticsSearchTerm=R("");poTypes=R([]);poTypesSearchTerm=R("");posData;config=new H;defaultCurrencyID;currencies=R([]);currentTabState;modalTabState=va;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.set(t.ServicesLogistics||[]),this.poTypes.set(t.PoTypes||[]),this.currencies.set(t.Currencies||[])}),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}onSelectSalesOrderTag(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=ti(cn,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(B),d(V),d(A),d(ge),d(G),d(Me),d(J),d(pt),d(yt))};static \u0275cmp=M({type:n,selectors:[["POS-modal-note"]],standalone:!1,decls:18,vars:11,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"],["data-cy","tab-note","matTooltip","Internal Note - Not Printed on Invoice","matTooltipPosition","above",1,"btn","btn-link","note-tab",3,"click","ngClass"],["data-cy","tab-type",1,"btn","btn-link","note-tab",3,"ngClass"],["data-cy","tab-logistic",1,"btn","btn-link","note-tab",3,"ngClass"],["data-cy","tab-number",1,"btn","btn-link","note-tab",3,"ngClass"],[1,"row","mt-8"],[1,"row","mt-6"],["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"],[1,"ms-0","mb-8","search-container"],[1,"rad-btn"],[1,"input-group","mb-3","rounded-start-1"],[1,"input-group-text","txtFilter","rounded-end-0"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["data-cy","SearchOutlet","type","text","placeholder","Filter by Name","aria-label","Search",1,"txtFilter","form-control","border-start-0","rounded-1","rounded-start-0",3,"ngModelChange","ngModel"],[3,"for","ngClass"],["type","radio",3,"ngModelChange","click","ngModel","value","id"],[1,"col-12","tinymce"],[3,"ngModel"],["name","note","cols","80","rows","10",1,"form-control",3,"ngModel"],[3,"ngModelChange","ngModel"],["name","note","cols","80","rows","10",1,"form-control",3,"ngModelChange","ngModel"],[1,"col-6"],[1,"mb-3"],["placeholder","Preorder Number","matTooltip","PO number if the product must be pre-ordered",1,"form-control",2,"height","2.4rem",3,"ngModelChange","ngModel"],[1,"form-floating-outline","mb-3"],["type","text","required","","placeholder","Same as Order Number when blank","matTooltip","Same as Order Number when blank",1,"form-control",2,"height","2.4rem",3,"ngModelChange","ngModel","disabled"],[1,"form-floating-outline"],["placeholder","Number of Person","autoNum","",1,"form-control",2,"height","2.4rem",3,"ngModelChange","ngModel"],[1,"ps-0","align-items-center"],["bindLabel","Name","bindValue","ID","placeholder","Outlet","appendTo","body",1,"currency-option",2,"width","100% !important",3,"ngModelChange","change","items","ngModel","clearable"],[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){if(e&1&&(r(0,"modal-material",0),_("onOk",function(a){return i.onOk(a)})("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)}),p(6," Note "),l(),r(7,"a",4),_("click",function(){return i.onTabChange(i.modalTabState.INTERNAL_NOTE)}),p(8," Order Note "),l(),g(9,fd,2,3,"a",5),g(10,gd,2,3,"a",6),g(11,Cd,2,3,"a",7),l()(),g(12,vd,6,4,"div",8)(13,yd,4,2,"div",8)(14,Pd,4,2,"div",8)(15,Md,6,4,"div",8)(16,kd,21,8)(17,Ed,12,5,"div",9),l()()()),e&2){let o;m("config",i.config),s(5),m("ngClass",T(7,Ft,i.modalTabState.NOTE==i.currentTabState)),s(2),m("ngClass",T(9,Ft,i.modalTabState.INTERNAL_NOTE==i.currentTabState)),s(2),C(i.isOnline?9:-1),s(),C(i.isOnline&&i.serviceLogistics().length?10:-1),s(),C(i.isOnline?11:-1),s(),C((o=i.currentTabState)===i.modalTabState.TYPE?12:o===i.modalTabState.NOTE?13:o===i.modalTabState.INTERNAL_NOTE?14:o===i.modalTabState.LOGISTICS?15:o===i.modalTabState.NUMBER?16:o===i.modalTabState.OTHER?17:-1)}},dependencies:[z,Y,nr,q,Jt,oe,j,gt,se,Ze,ct,_r],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}.search-container{transition:all .3s ease;width:97%}.search-container .input-group{position:relative;transition:all .3s ease;height:2.3rem}.search-container .input-group:hover,.search-container .input-group:focus-within{box-shadow:0 0 0 2px #89b03e4d,0 0 8px 4px #89b03e33;border-radius:4px}.search-container .input-group .txtFilter.form-control{transition:all .3s ease;border-left:none!important}.search-container .input-group .txtFilter.form-control:focus{box-shadow:none!important;border-color:#ced4da!important}.search-container .input-group .input-group-text{transition:all .3s ease;background-color:#fff;border-right:none!important}.search-container .input-group:hover .input-group-text,.search-container .input-group:focus-within .input-group-text{background-color:#89b03e1a;border-color:#84cc16!important}.search-container .input-group .fa-magnifying-glass{transition:all .3s ease}.search-container .input-group:hover .fa-magnifying-glass,.search-container .input-group:focus-within .fa-magnifying-glass{color:#84cc16!important}.search-container .input-group:focus-within{box-shadow:0 0 0 2px #89b03e66,0 0 12px 6px #89b03e40!important}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}
|
|
42
|
+
`],encapsulation:2})};function Rd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2," Amount "),l(),r(3,"td",19),p(4),b(5,"number"),l()()),n&2){let e=c(2);s(4),x(" ",I(5,1,e.calculatorService.GrossTotal)," ")}}function Nd(n,t){if(n&1&&(r(0,"span"),p(1),b(2,"number"),l()),n&2){let e=c(3);s(),x("",I(2,1,e.salesOrder.Order.Discount),"%")}}function Vd(n,t){if(n&1&&(r(0,"span"),p(1),b(2,"number"),l()),n&2){let e=c(3);s(),x("",ne(2,1,e.salesOrder.Order.Discount,"1.0-4"),"%")}}function Ad(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),g(3,Nd,3,3,"span"),g(4,Vd,3,4,"span"),l(),r(5,"td",20),p(6),b(7,"number"),l()()),n&2){let e=c(2);s(2),x(" ",e.appConfig==null||e.appConfig.CorePrint==null?null:e.appConfig.CorePrint.Alias.Discount1," "),s(),C(e.isIgnoreDecimalDisc1?3:-1),s(),C(e.appConfig!=null&&e.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal?-1:4),s(2),w(I(7,4,e.calculatorService.Discount1Amount*-1))}}function Ld(n,t){if(n&1&&(r(0,"span"),p(1),b(2,"number"),l()),n&2){let e=c(3);s(),x("",I(2,1,e.salesOrder.Order.Discount2),"%")}}function Fd(n,t){if(n&1&&(r(0,"span"),p(1),b(2,"number"),l()),n&2){let e=c(3);s(),x("",ne(2,1,e.salesOrder.Order.Discount2,"1.0-4"),"%")}}function Bd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),g(3,Ld,3,3,"span"),g(4,Fd,3,4,"span"),l(),r(5,"td",20),p(6),b(7,"number"),l()()),n&2){let e=c(2);s(2),x(" ",e.appConfig==null||e.appConfig.CorePrint==null?null:e.appConfig.CorePrint.Alias.Discount2," "),s(),C(e.isIgnoreDecimalDisc2?3:-1),s(),C(e.appConfig!=null&&e.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal?-1:4),s(2),w(I(7,4,e.calculatorService.Discount2Amount*-1))}}function jd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),l(),r(3,"td",20),p(4),b(5,"number"),l()()),n&2){let e=c(2);s(2),Ee(" ",e.appConfig==null||e.appConfig.CorePrint==null?null:e.appConfig.CorePrint.Alias.DiscountAmount," ",e.calculatorService.currencySymbol," "),s(2),w(I(5,3,e.salesOrder.Order.DiscountAmount*-1))}}function Hd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),l(),r(3,"td",19),p(4),b(5,"number"),l()()),n&2){let e=c(2);s(2),x(" ",e.calculatorService==null||e.calculatorService.tax==null?null:e.calculatorService.tax.Label," "),s(2),w(I(5,2,e.calculatorService==null?null:e.calculatorService.TaxAmount))}}function Ud(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),b(3,"number"),l(),r(4,"td",21),p(5),b(6,"number"),l()()),n&2){let e=c(2);s(2),x(" SURCHARGE ",I(3,3,e.salesOrder==null?null:e.salesOrder.Invoice.SurchargePcg),"% "),s(2),m("ngClass",(e.salesOrder==null?null:e.salesOrder.Invoice.SurchargePcg)<0?"text-danger":""),s(),x(" ",I(6,5,e.calculatorService==null?null:e.calculatorService.SurchargeAmount))}}function Wd(n,t){if(n&1&&(r(0,"div",0),v(1,"div",14)(2,"div",15),r(3,"div",16)(4,"table",17),g(5,Rd,6,3,"tr"),g(6,Ad,8,6,"tr"),g(7,Bd,8,6,"tr"),g(8,jd,6,5,"tr"),g(9,Hd,6,4,"tr"),g(10,Ud,7,7,"tr"),l()()()),n&2){let e=c();s(5),C((e.calculatorService==null||e.calculatorService.tax==null?null:e.calculatorService.tax.CalculationTypeID)==e.taxCalculationType.Add&&(!(e.calculatorService==null||e.calculatorService.tax==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?5:-1),s(),C((e.salesOrder==null?null:e.salesOrder.Order.Discount)!=0?6:-1),s(),C((e.salesOrder==null?null:e.salesOrder.Order.Discount2)!=0?7:-1),s(),C((e.salesOrder==null?null:e.salesOrder.Order.DiscountAmount)!=0?8:-1),s(),C(!(e.calculatorService==null||e.calculatorService.tax==null)&&e.calculatorService.tax.Rate?9:-1),s(),C((e.salesOrder==null?null:e.salesOrder.Invoice.SurchargePcg)!=0?10:-1)}}function Qd(n,t){if(n&1){let e=y();r(0,"button",22),_("click",function(){u(e);let o=c();return f(o.onOpenModalDiscount())}),v(1,"i",23),l()}}var Gn=class n{constructor(t,e,i,o,a,h,E,F,Ce,Te){this.calculatorService=t;this.salesOrderService=e;this.userRoleService=i;this.outletService=o;this.pageInitialService=a;this.dialog=h;this.orderProcessorService=E;this.payService=F;this.parkOrderService=Ce;this.shoppingCartService=Te;this.destroy$=new Q}handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.payService.payOrder()}taxCalculationType=co;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.shoppingCartService.isShoppingCartLockedByPromotionCoupon()==!1&&this.dialog.open(ui,{data:{tabIndexActive:"Discount"}})}checkIgnoreDecimalDisc(t){let e=this.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal,i=t%1===0;return e&&i}onOpenNotesModal(){this.dialog.open(qn,{width:"45%"})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(ge),d(V),d(ce),d(G),d(A),d(re),d(U),d(aa),d(ke),d(de))};static \u0275cmp=M({type:n,selectors:[["sell-cart-footer"]],hostBindings:function(e,i){e&1&&_("keydown.F8",function(){return i.handleF8()},ut)},inputs:{parkOrderRetrieve:"parkOrderRetrieve"},standalone:!1,decls:25,vars:15,consts:[[1,"row"],[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","dialog-discount-tax","matTooltip","Discount / Tax","matTooltipPosition","above",1,"btn","btn-success","fs-5",2,"border-right","0.1px solid #fff"],["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,"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,Wd,11,6,"div",0),r(1,"div",1)(2,"div",2)(3,"button",3),_("click",function(){return i.onOpenNotesModal()}),v(4,"i",4),l()(),r(5,"div",5)(6,"button",6),_("click",function(){return i.onPark()}),v(7,"i",7),r(8,"span"),p(9),l()()(),r(10,"div",8)(11,"div",9),g(12,Qd,2,0,"button",10),r(13,"button",11),_("click",function(){return i.onPayOrder()}),r(14,"div",12)(15,"div")(16,"span"),p(17,"Pay"),l(),r(18,"small",13),p(19),b(20,"number"),l()(),r(21,"div"),p(22),b(23,"async"),b(24,"number"),l()()()()()()),e&2&&(C(i.userRole.PriceVisible?0:-1),s(5),m("matTooltip",i.userRole.Park?"":"You need `Park` role to access this button"),s(),m("disabled",!i.userRole.Park),s(3),w((i.appConfig==null||i.appConfig.ApplicationParkAndRetrieve==null||i.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel==null?null:i.appConfig.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkButtonLabel)||"Park"),s(),m("matTooltip",i.userRole.Payment?"":"You need `Pay` role to access this button"),s(2),C(i.userRole.Tax||i.userRole.Discount?12:-1),s(),m("disabled",!i.userRole.Payment),s(6),x(" (",I(20,9,i.salesOrder.cartQuantity)," Items) "),s(3),x(" ",i.userRole!=null&&i.userRole.PriceVisible?I(24,13,I(23,11,i.calculatorService.Data$)):"-"," "))},dependencies:[z,se,ze,K],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 qd=n=>({"ps-0":n});function Gd(n,t){if(n&1){let e=y();r(0,"input",40),O("ngModelChange",function(o){u(e);let a=c(2).$implicit;return D(a.Splited,o)||(a.Splited=o),f(o)}),l()}if(n&2){let e=c(2).$implicit;P("ngModel",e.Splited)}}function zd(n,t){if(n&1&&(r(0,"small"),p(1),l()),n&2){let e=c(2).$index;s(),x("",e+1,".")}}function Jd(n,t){if(n&1&&(r(0,"td",10)(1,"div",12),g(2,Gd,1,1,"input",39),g(3,zd,2,1,"small"),l()()),n&2){let e=c().$implicit,i=c(2);s(2),C(i.currentSellState==i.sellState.IsSplit&&e.Quantity>1?2:-1),s(),C(!(i.appConfig==null||i.appConfig.ModuleSell==null)&&i.appConfig.ModuleSell.Grid.RowNumberVisible?3:-1)}}function Kd(n,t){if(n&1&&(r(0,"div",41),v(1,"img",43),l()),n&2){let e=c(2).$implicit;s(),m("src",e.Variant==null?null:e.Variant.ThumbnailUrl,nt)}}function Yd(n,t){n&1&&(r(0,"div",42),v(1,"i",44),l())}function Zd(n,t){if(n&1&&(r(0,"span",13),g(1,Kd,2,1,"div",41)(2,Yd,2,0,"div",42),l()),n&2){let e=c().$implicit;s(),C(e.Variant!=null&&e.Variant.ThumbnailUrl?1:2)}}function Xd(n,t){n&1&&v(0,"i",45)}function em(n,t){n&1&&v(0,"i",46)}function tm(n,t){if(n&1&&(r(0,"span",17),g(1,Xd,1,0,"i",45)(2,em,1,0,"i",46),l()),n&2){let e=c().$implicit;s(),C(e.Taxable?1:2)}}function im(n,t){n&1&&v(0,"i",18)}function nm(n,t){if(n&1&&(r(0,"small",20),p(1),l()),n&2){let e=c().$implicit;s(),x(" ",e.Variant.CategoryName," ")}}function om(n,t){if(n&1&&(r(0,"small",21),p(1),l()),n&2){let e=c().$implicit;s(),x(" ",e.Variant.BrandName," ")}}function rm(n,t){if(n&1&&(r(0,"small",22),p(1),l()),n&2){let e=c().$implicit;s(),x(" ",e.Variant.Storage," ")}}function am(n,t){if(n&1&&v(0,"small",24),n&2){let e=c().$implicit;m("innerHtml",e.Note?e.Note:e.PriceNote,Ut)}}function lm(n,t){if(n&1&&(r(0,"small",25),p(1," Sold by "),r(2,"i"),p(3),l()()),n&2){let e=c().$implicit;s(3),w(e.SalesName)}}function sm(n,t){if(n&1&&(r(0,"small")(1,"i",47),p(2),l()()),n&2){let e=c().$implicit;s(2),x("Fulfillment from: ",e.EntityName)}}function cm(n,t){if(n&1&&(r(0,"div",28),v(1,"i",48),l()),n&2){let e=c().$implicit;m("matTooltip",e.AvailableInventory<e.Quantity?e.AvailableInventory+" Available Stock":"")}}function pm(n,t){if(n&1){let e=y();r(0,"span",49),_("click",function(){u(e);let o=c().$index,a=c(2);return f(a.onEditItem(o,"quantity"))}),p(1),b(2,"number"),l()}if(n&2){let e=c().$implicit,i=c(2);s(),x(" ",ne(2,1,e.Quantity,"1.0-"+i.qtyDecimalPlace()))}}function dm(n,t){if(n&1){let e=y();r(0,"span",50),p(1,"x"),l(),r(2,"div",51),_("click",function(){u(e);let o=c().$index,a=c(2);return f(a.onEditItem(o,"quantity"))}),r(3,"span",52),p(4),b(5,"number"),l()()}if(n&2){let e=c().$implicit,i=c(2);s(4),w(ne(5,1,e.UnitQuantity,"1.0-"+i.qtyDecimalPlace()))}}function mm(n,t){if(n&1&&(r(0,"span",31),p(1),b(2,"number"),l()),n&2){let e=c().$implicit,i=c(2);s(),x("@",ne(2,1,e.VariantUnitQuantity,"1.0-"+i.qtyDecimalPlace()))}}function um(n,t){if(n&1&&(r(0,"small",32),p(1),l()),n&2){let e=c().$implicit,i=c(2);s(),w(i.isNotEmpty(e.Variant.UOM)?e.Variant.UOMName:"")}}function fm(n,t){if(n&1&&(r(0,"div",55),p(1),b(2,"number"),l()),n&2){let e=c(4).$implicit;s(),x(" ",ne(2,1,e.UnitPriceOriginal,"1.0-4")," ")}}function gm(n,t){if(n&1){let e=y();r(0,"div",54),_("click",function(){u(e);let o=c(3).$index,a=c(2);return f(a.onEditItem(o,"price"))}),g(1,fm,3,4,"div",55),r(2,"div",30),p(3),b(4,"number"),l()()}if(n&2){let e=c(3).$implicit;s(),C(e.UnitPriceOriginal>e.Price?1:-1),s(2),x(" ",ne(4,2,e.Price,"1.0-4")," ")}}function Cm(n,t){if(n&1){let e=y();r(0,"div",49),_("click",function(){u(e);let o=c(3).$index,a=c(2);return f(a.onEditItem(o,"price"))}),p(1),b(2,"number"),l()}if(n&2){let e=c(3).$implicit;s(),x(" ",ne(2,1,e.Price,"1.0-4")," ")}}function _m(n,t){if(n&1&&g(0,gm,5,5,"div",53)(1,Cm,3,4,"div",30),n&2){let e=c(4);C(!(e.appConfig==null||e.appConfig.ModuleSell==null||e.appConfig.ModuleSell.Promotion==null)&&e.appConfig.ModuleSell.Promotion.StrikethroughOriginalPrice?0:1)}}function hm(n,t){if(n&1&&(r(0,"div",27),g(1,_m,2,1),l()),n&2){let e=c().$implicit;s(),C(e.Price!==e.Total?1:-1)}}function vm(n,t){if(n&1&&(r(0,"div"),p(1),b(2,"number"),l()),n&2){let e=c().$implicit;s(),x(" ",e.Discount==0?"":I(2,1,e.Discount*-1)+"%"," ")}}function bm(n,t){if(n&1&&(r(0,"div"),p(1),b(2,"number"),l()),n&2){let e=c().$implicit;s(),x(" ",e.DiscountAmount==0?"":I(2,1,e.DiscountAmount*-1)," ")}}function Sm(n,t){if(n&1&&(r(0,"div",56),p(1),b(2,"number"),l()),n&2){let e=c(2).$implicit;s(),x(" ",ne(2,1,e.UnitPriceOriginal,"1.0-4")," ")}}function ym(n,t){if(n&1&&(r(0,"div",30),g(1,Sm,3,4,"div",56),r(2,"div",27),p(3),b(4,"amountFraction"),l()()),n&2){let e=c().$implicit;s(),C(e.UnitPriceOriginal>e.Price?1:-1),s(2),x(" ",I(4,2,e.Total)," ")}}function xm(n,t){if(n&1&&(r(0,"div",27)(1,"div",30),p(2),b(3,"amountFraction"),l()()),n&2){let e=c().$implicit,i=c(2);s(2),x(" ",i.userRole.PriceVisible?I(3,1,e.Total):" - "," ")}}function Im(n,t){if(n&1){let e=y();r(0,"span",57),_("click",function(){u(e);let o=c().$implicit,a=c(2);return f(a.removeItem(o))}),v(1,"i",58),l()}}function Pm(n,t){if(n&1){let e=y();r(0,"tr",9),b(1,"async"),_("contextmenu",function(o){let a=u(e),h=a.$implicit,E=a.$index,F=c(2);return f(F.onContextMenu(o,h,E))}),g(2,Jd,4,2,"td",10),r(3,"td",11),_("click",function(){let o=u(e).$index,a=c(2);return f(a.onEditItem(o,"quantity"))}),r(4,"div",12),g(5,Zd,3,1,"span",13),r(6,"div",14)(7,"div",15)(8,"span",16),p(9),l(),g(10,tm,3,1,"span",17),g(11,im,1,0,"i",18),l(),r(12,"div",19),p(13),l(),g(14,nm,2,1,"small",20),g(15,om,2,1,"small",21),g(16,rm,2,1,"small",22),r(17,"div"),v(18,"app-serial-note",23),l(),g(19,am,1,1,"small",24),g(20,lm,4,1,"small",25),g(21,sm,3,1,"small"),l()()(),r(22,"td",26)(23,"div",27),g(24,cm,2,1,"div",28),r(25,"div",29),g(26,pm,3,4,"span",30),g(27,dm,6,4),g(28,mm,3,4,"span",31),g(29,um,2,1,"small",32),l()()(),r(30,"td"),g(31,hm,2,1,"div",27),l(),r(32,"td",33),_("click",function(){let o=u(e).$index,a=c(2);return f(a.onEditItem(o,"discount"))}),r(33,"div",34),g(34,vm,3,3,"div"),g(35,bm,3,3,"div"),l()(),r(36,"td",35),_("click",function(){let o=u(e).$index,a=c(2);return f(a.onEditItem(o,"price"))}),g(37,ym,5,4,"div",30)(38,xm,4,3,"div",27),l(),r(39,"td",36)(40,"div",37),g(41,Im,2,0,"span",38),l()()()}if(n&2){let e=t.$implicit,i=c(2);m("cdkDragDisabled",!I(1,25,i.enabledDragDrop$)),s(2),C(!(i.appConfig==null||i.appConfig.ModuleSell==null)&&i.appConfig.ModuleSell.Grid.RowNumberVisible||i.currentSellState==i.sellState.IsSplit&&e.Quantity>1?2:-1),s(),m("ngClass",T(27,qd,i.appConfig==null||i.appConfig.ModuleSell==null?null:i.appConfig.ModuleSell.Grid.RowNumberVisible)),s(2),C(i.showThumbnail?5:-1),s(4),x(" ",e.Variant.Name," "),s(),C(!(i.appConfig==null||i.appConfig.ModuleSell==null)&&i.appConfig.ModuleSell.Grid.TaxVisible?10:-1),s(),C(e.PromotionGift?11:-1),s(2),x(" ",e==null||e.Variant==null?null:e.Variant.Code," "),s(),C(!(i.appConfig==null||i.appConfig.ModuleSell==null)&&i.appConfig.ModuleSell.Grid.CategoryVisible?14:-1),s(),C(!(i.appConfig==null||i.appConfig.ModuleSell==null)&&i.appConfig.ModuleSell.Grid.ShowBrandItemCart?15:-1),s(),C(!(i.appConfig==null||i.appConfig.ModuleSell==null||i.appConfig.ModuleSell.Grid==null)&&i.appConfig.ModuleSell.Grid.StorageVisible?16:-1),s(2),m("serials",e.Serial),s(),C(e.Note||e.PriceNote?19:-1),s(),C(e.SalesName?20:-1),s(),C(e.EntityName?21:-1),s(3),C(e.AvailableInventory<e.Quantity&&((e==null||e.Variant==null?null:e.Variant.TypeID)<9||(e==null||e.Variant==null?null:e.Variant.TypeID)==i.inventoryType.Composite)?24:-1),s(2),C(e.Quantity!==1&&e.Quantity!==0||e.UnitQuantity>1||e.VariantUnitQuantity>1?26:-1),s(),C(e.UnitQuantity>1?27:-1),s(),C(e.VariantUnitQuantity>1?28:-1),s(),C(i.isNotEmpty(e.Variant.UOM)&&(!(i.appConfig==null||i.appConfig.ModuleSell==null)&&i.appConfig.ModuleSell.Grid.UOMVisible)?29:-1),s(2),C((e.Price!==e.Total||e.DiscountAmount>0||e.Discount>0||e.UnitPriceOriginal>e.Price)&&i.userRole.PriceVisible?31:-1),s(3),C(e.Discount>0?34:-1),s(),C(e.DiscountAmount>0?35:-1),s(2),C(!(i.appConfig==null||i.appConfig.ModuleSell==null||i.appConfig.ModuleSell.Promotion==null)&&i.appConfig.ModuleSell.Promotion.StrikethroughOriginalPrice&&e.Quantity==1&&i.userRole.PriceVisible?37:38),s(4),C(i.hasItemDeletion?41:-1)}}function Dm(n,t){if(n&1){let e=y();r(0,"div",1)(1,"div",5)(2,"table",6)(3,"tbody",7),_("cdkDropListDropped",function(o){u(e);let a=c();return f(a.drop(o))}),ee(4,Pm,42,29,"tr",8,pe),l()()()()}if(n&2){let e=c();s(4),te(e.cartItems)}}function Om(n,t){n&1&&(r(0,"div",2)(1,"div",5)(2,"div",59)(3,"div",60)(4,"div",61),v(5,"i",62),l(),r(6,"div",63)(7,"span"),p(8,"Empty Cart"),l(),v(9,"br"),r(10,"span"),p(11,"Add products to the cart"),l(),v(12,"br"),r(13,"span"),p(14,"or scan barcode"),l()()()()()())}function Mm(n,t){if(n&1){let e=y();r(0,"button",64),_("click",function(){let o=u(e).item,a=c();return f(a.onReverse(o,!0))}),p(1," Return "),l(),r(2,"button",65),_("click",function(){let o=u(e).item,a=c();return f(a.onReverse(o,!1))}),p(3,"Sales"),l(),r(4,"button",64),_("click",function(){let o=u(e).item,a=c();return f(a.onSumPrice(o))}),p(5," Merge / SUM Price "),l(),r(6,"button",64),_("click",function(){let o=u(e).item,a=c();return f(a.onBundlePrice(o))}),p(7," Bundle Price "),l()}if(n&2){let e=c();m("disabled",!e.userRole.Return),s(4),m("disabled",!e.userRole.BundlingPrice),s(2),m("disabled",!e.userRole.BundlingPrice)}}var zn=class n{constructor(t,e,i,o,a,h,E){this.salesOrderService=t;this.roleService=e;this.shoppingCartService=i;this.pageInitialService=o;this.dialog=a;this.orderProcessorService=h;this.moreMenuService=E;this.destroy$=new Q,this.eventAddItem=new je,this.enabledDragDrop$=this.moreMenuService.enabledDragDrop$}destroy$;cartItems=[];userRole;appConfig;currentSellState;hasItemDeletion;eventAddItem;isAddItem=!0;sellState=Pe;showThumbnail;enabledDragDrop$;inventoryType=Ui;qtyDecimalPlace=R(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){sr(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(ce),d(de),d(A),d(re),d(U),d(Rt))};static \u0275cmp=M({type:n,selectors:[["sell-cart-body"]],viewQuery:function(e,i){if(e&1&&Se(Zi,7),e&2){let o;ye(o=xe())&&(i.contextMenu=o.first)}},outputs:{eventAddItem:"eventAddItem"},standalone:!1,decls:6,vars:6,consts:[["contextMenu","matMenu"],[1,"row","g-0"],[1,"row","g-0","h-100"],[2,"visibility","hidden","position","fixed",3,"matMenuTriggerFor"],["matMenuContent",""],[1,"col-12"],[1,"table","table-borderless"],["cdkDropList","",3,"cdkDropListDropped"],["cdkDrag","",2,"border-bottom","0.5px solid #dee2e6",3,"cdkDragDisabled"],["cdkDrag","",2,"border-bottom","0.5px solid #dee2e6",3,"contextmenu","cdkDragDisabled"],[2,"width","10px"],[1,"pe-0",2,"width","50%",3,"click","ngClass"],[1,"d-flex","align-items-center"],[1,"me-4"],[1,"d-block",2,"line-height","18px"],[1,"fs-5","d-flex","align-items-center"],[1,"me-1"],[1,"fst-italic","m-0","me-3"],["title","Product Promotion",1,"fa-solid","fa-gift"],["title","Product Code",1,"fw-normal","fs-6","text-muted"],["title","Product Category",1,"fst-italic","text-muted","d-block"],["title","Brand Name",1,"text-muted","d-block"],["title","Storage",1,"text-muted","d-block"],[3,"serials"],["title","Note",1,"special-TinyMCE","m-0","fst-italic","d-block",3,"innerHtml"],["title","Sales Name",1,"text-success","fst-italic","d-block"],[1,"px-0","text-end",2,"width","15%"],[1,"d-flex","align-items-center","justify-content-end"],["matTooltipPosition","above",1,"me-2",3,"matTooltip"],[1,"d-flex","text-end","fw-normal","align-items-center",2,"line-height","20px"],[1,"fs-5"],["title","Variant Unit Quantity",1,"fs-5"],["title","UOM",1,"ps-1","fs-5"],[3,"click"],[1,"d-block","fw-normal","fs-5","text-danger","ps-3"],[1,"pe-0",3,"click"],[1,"mt-6","ps-0"],[1,"d-flex","justify-content-end","align-items-center"],["title","Delete Item",1,"fs-3","cursor-pointer"],["type","checkbox",1,"me-2",3,"ngModel"],["type","checkbox",1,"me-2",3,"ngModelChange","ngModel"],[1,"ratio","ratio-1x1",2,"width","55px"],[1,"item-image","d-flex","justify-content-center","align-items-center","text-center","fs-1"],[1,"item-image",3,"src"],[1,"fa-solid","fa-image",2,"color","#b4b4b4c2"],["title","Taxable",1,"fa-regular","fa-droplet-percent","fs-4","text-success"],["title","Non Taxable",1,"fa-regular","fa-droplet-percent","fs-4","text-danger"],[1,"text-warning","d-block"],[1,"fa-solid","fa-triangle-exclamation","not-enough-inventory"],[1,"fs-5",3,"click"],[1,"fs-6","me-1","ms-1"],[1,"d-flex","algin-items-center",3,"click"],["title","Unit Quantity",1,"fs-5","me-1"],[1,"d-inline-block","fs-5"],[1,"d-inline-block","fs-5",3,"click"],[1,"text-decoration-line-through","text-danger","fs-5"],[1,"text-decoration-line-through","text-danger","d-flex","align-items-center","justify-content-end"],["title","Delete Item",1,"fs-3","cursor-pointer",3,"click"],[1,"fa","fa-trash","text-danger","fs-4"],[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,Dm,6,0,"div",1)(1,Om,15,0,"div",2),v(2,"div",3),r(3,"mat-menu",null,0),Z(5,Mm,8,3,"ng-template",4),l()),e&2){let o=ot(4);C(i.cartItems.length>0?0:1),s(2),Bo("left",i.contextMenuPosition.x)("top",i.contextMenuPosition.y),m("matMenuTriggerFor",o)}},dependencies:[z,zt,q,oe,pr,cr,$r,Wr,Qr,Zi,se,qr,ze,K,mr],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 Jn=class{ID;Name;Code;Address;Phone;Email;SalesTarget;SalesPersonGroupID;Bin};var km=["ngSelectInfinite"],Tm=(n,t)=>({"text-success":n,"text-danger":t}),Wa=n=>({"opacity-50":n}),Yn=(n,t)=>({red:n,green:t});function Em(n,t){n&1&&v(0,"div",5)}function Rm(n,t){if(n&1&&(r(0,"span",9),p(1),b(2,"async"),b(3,"number"),l()),n&2){let e=c();s(),x(" ",I(3,3,I(2,1,e.totalOfflineOrders$))," ")}}function Nm(n,t){if(n&1&&(r(0,"sup",15)(1,"div",28),p(2),b(3,"async"),b(4,"number"),l()()),n&2){let e=c();s(2),x(" ",I(4,3,I(3,1,e.moreMenuService.eligiblePromotions$))," ")}}function Vm(n,t){if(n&1&&v(0,"span",39),n&2){let e=c(4);m("ngClass",_e(1,Yn,!e.displayService.isEnabled(),e.displayService.isEnabled()))}}function Am(n,t){if(n&1&&v(0,"span",39),n&2){let e=c(4);m("ngClass",_e(1,Yn,!e.orderDisplayService.isEnabled(),e.orderDisplayService.isEnabled()))}}function Lm(n,t){if(n&1&&v(0,"span",39),n&2){let e=c(4);m("ngClass",_e(1,Yn,!e.ecrSignalService.isConnected(),e.ecrSignalService.isConnected()))}}function Fm(n,t){if(n&1&&v(0,"span",39),n&2){let e=c(4);m("ngClass",_e(1,Yn,!e.cashMachineService.isConnected(),e.cashMachineService.isConnected()))}}function Bm(n,t){if(n&1){let e=y();He(0),r(1,"li",35),_("click",function(){let o=u(e).$implicit,a=c(3);return f(o.disabled?null:a.moreMenuService.moreMenuAction(o.action))}),r(2,"div",36),v(3,"i",37),r(4,"span",38),p(5),l(),g(6,Vm,1,4,"span",39),g(7,Am,1,4,"span",39),g(8,Lm,1,4,"span",39),g(9,Fm,1,4,"span",39),l()(),Ue()}if(n&2){let e=t.$implicit;s(),m("matTooltip",e.disabled?e.description:"")("ngClass",T(10,Wa,e.disabled)),Ao("data-cy",e.cy),s(2),le(e.class),s(2),x(" ",e.label," "),s(),C(e.action=="CUSTOMER_DISPLAY"?6:-1),s(),C(e.action=="ODS_CONFIG"?7:-1),s(),C(e.action=="ECR"?8:-1),s(),C(e.action=="CASH_MACHINE"?9:-1)}}function jm(n,t){if(n&1&&(He(0),r(1,"div",32),p(2),l(),v(3,"div",33),Z(4,Bm,10,12,"ng-container",34),Ue()),n&2){let e=c().$implicit;s(2),w(e.name),s(2),m("ngForOf",e.menus)}}function Hm(n,t){if(n&1&&(r(0,"sup",15)(1,"div",28),p(2),b(3,"async"),b(4,"number"),l()()),n&2){let e=c(6);s(2),x(" ",I(4,3,I(3,1,e.moreMenuService.eligiblePromotions$))," ")}}function Um(n,t){if(n&1&&(He(0),r(1,"div",36),v(2,"i",37),r(3,"span",38),p(4),l(),g(5,Hm,5,5,"sup",15),b(6,"async"),l(),Ue()),n&2){let e=c().$implicit,i=c(4);s(2),le(e.class),s(2),w(e.label),s(),C(e.label=="Event"&&I(6,4,i.moreMenuService.eligiblePromotions$)>0?5:-1)}}function Wm(n,t){if(n&1){let e=y();r(0,"li",35),_("click",function(){let o=u(e).$implicit,a=c(4);return f(o.disabled?null:a.moreMenuService.moreMenuAction(o.action))}),Z(1,Um,7,6,"ng-container",30),l()}if(n&2){let e=t.$implicit;m("matTooltip",e.disabled?e.description:"")("ngClass",T(3,Wa,e.disabled)),s(),m("ngIf",e.isShow!==!1)}}function Qm(n,t){if(n&1&&(He(0),r(1,"div",32),p(2),l(),v(3,"div",33),Z(4,Wm,2,5,"li",41),Ue()),n&2){let e=c().$implicit;s(2),w(e.name),s(2),m("ngForOf",e.menus)}}function $m(n,t){if(n&1&&(r(0,"div",40),Z(1,Qm,5,2,"ng-container",30),l()),n&2){let e=t.$implicit;s(),m("ngIf",(e.menus==null?null:e.menus.length)>0)}}function qm(n,t){if(n&1&&(r(0,"div",29),Z(1,jm,5,2,"ng-container",30)(2,$m,2,1,"div",31),l()),n&2){let e=t.$implicit;s(),m("ngIf",(e.menus==null?null:e.menus.length)>0),s(),m("ngForOf",e.children)}}var Kn=class n{constructor(t,e,i,o,a,h,E,F,Ce,Te,Be,gi,Ci){this.pageInitialService=t;this.salesOrderService=e;this.userRoleService=i;this.outletService=o;this.dialog=a;this.promotionEventService=h;this.moreMenuService=E;this.toggleSidebar=F;this.displayService=Ce;this.ecrSignalService=Te;this.cashMachineService=Be;this.localDataService=gi;this.orderDisplayService=Ci;this.appConfig=this.pageInitialService.Data.AppConfigJSON,this.destroy$=new Q,this.totalOfflineOrders$=this.localDataService.unsentOrders$.pipe(it(Nt=>Nt.length),jt(1)),this.toggleSidebar.toggleState$.subscribe(Nt=>this.isChange=Nt)}onlineStatusService=$(pt);salesOrder;appConfig;selectedCustomerId;userRole;salesPersonList=[];destroy$;outletRegister;salesPersonName;isOnline$=this.onlineStatusService.getOnlineStatus$();ngSelectInfinite;handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.dialog.open($e)}handleF2(){this.ngSelectInfinite&&this.ngSelectInfinite.ngSelectElement.focus()}disabledSalesOption=!1;salesPersonOptionTooltip=R("");isEnabledLoyaltyPoint;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(nn,{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 Jn;e.ID=S.GuidEmpty,this.salesPersonList=[...t]}openOnlineStatusModal(){this.localDataService.unsentOrders$.pipe(Bt(1),Ve(t=>{let e=t.length>0?"ORDER":"SETUP";return this.dialog.open(rn,{id:"ModalOfflineOrder",data:{activeTab:e}}).afterClosed()})).subscribe()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(A),d(V),d(ce),d(G),d(re),d(ni),d(Rt),d(ar),d(qi),d(kt),d(oi),d(Ye),d(Qi))};static \u0275cmp=M({type:n,selectors:[["sell-cart-header"]],viewQuery:function(e,i){if(e&1&&Se(km,7),e&2){let o;ye(o=xe())&&(i.ngSelectInfinite=o.first)}},hostBindings:function(e,i){e&1&&_("keydown.F4",function(){return i.handleF8()},ut)("keydown.control.F2",function(){return i.handleF2()},ut)},standalone:!1,decls:37,vars:26,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","position-relative","pe-8","cursor-pointer",3,"click"],[1,"offline-bg"],[1,"me-2","z-1"],[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,"me-2"],[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","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=y();Ri(0),b(1,"async"),r(2,"div",1)(3,"div",2)(4,"div",3)(5,"span",4),_("click",function(){return u(o),f(i.openOnlineStatusModal())}),g(6,Em,1,0,"div",5),r(7,"span",6),v(8,"i",7),l(),r(9,"span",8),p(10),g(11,Rm,4,5,"span",9),b(12,"async"),l()(),v(13,"span",10),r(14,"span",11)(15,"span",12),v(16,"i",13),l(),r(17,"span",14),p(18,"More Actions"),l(),g(19,Nm,5,5,"sup",15),b(20,"async"),l(),r(21,"div",16)(22,"div",17),Z(23,qm,3,2,"div",18),b(24,"async"),l()()()(),r(25,"div",19)(26,"div",20)(27,"div",21),v(28,"i",22),l(),r(29,"div",23)(30,"ng-select-infinite",24,0),O("selectedChange",function(h){return u(o),D(i.salesOrder.Order.SalesID,h)||(i.salesOrder.Order.SalesID=h),f(h)}),_("selectedLabel",function(h){return u(o),f(i.salesPersonName=h)}),l()(),r(32,"div",25)(33,"button",26),_("click",function(){return u(o),f(i.collapseSidebar())}),v(34,"span",27)(35,"span",27)(36,"span",27),l()()()()()}if(e&2){let o=I(1,15,i.isOnline$);s(6),C(o?-1:6),s(2),m("ngClass",_e(23,Tm,o,!o)),s(2),x("",o?"Online":"Offline"," "),s(),C(I(12,17,i.totalOfflineOrders$)>0?11:-1),s(8),C(I(20,19,i.moreMenuService.eligiblePromotions$)>0?19:-1),s(4),m("ngForOf",I(24,21,i.moreMenuService.moreMenu$)),s(6),m("matTooltip",i.salesPersonName),s(),m("clearable",!0)("items",i.salesPersonList),P("selected",i.salesOrder.Order.SalesID),m("disabled",i.disabledSalesOption)("optionTitle",!0)("matTooltip",i.salesPersonOptionTooltip()),s(3),jo("change",i.isChange)}},dependencies:[z,Ai,Qt,Dt,se,ze,K],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>.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}.offline-bg{position:absolute;top:-17px;left:-22px;width:5.89rem;height:3.7rem;background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important;z-index:0}
|
|
43
|
+
`],encapsulation:2})};var zm=["serialInput"];function Jm(n,t){if(n&1){let e=y();r(0,"div",2)(1,"autocompleteV2",4),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 a=c();return f(a.onAddItem(o))})("onInputEnter",function(o){u(e);let a=c();return f(a.onBarcodeScan(o))})("clickPrefixIcon",function(){u(e);let o=c();return f(o.scannerMode="serial")}),l()()}if(n&2){let e,i=c(),o=ot(3);s(),m("renderThumbnail",!0)("prefixIcon",i.barcodePrefixIcon)("clearOnSelect",!0)("renderThumbnail",i.renderThumbnail)("useCustomTemplate",!0)("itemTemplate",o)("outletId",(e=I(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 Km(n,t){if(n&1){let e=y();r(0,"div",3)(1,"i",5),_("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"))}),l(),r(2,"input",6,1),O("ngModelChange",function(o){u(e);let a=c();return D(a.serial,o)||(a.serial=o),f(o)}),_("keydown",function(o){u(e);let a=c();return f(a.onKeyDown(o))}),l()()}if(n&2){let e=c();s(),le(e.serialPrefixIcon),s(),P("ngModel",e.serial)}}function Ym(n,t){if(n&1&&(r(0,"div",10)(1,"span"),p(2),b(3,"number"),l()()),n&2){let e=c().data;s(2),w(I(3,1,e==null?null:e.UnitPrice))}}function Zm(n,t){if(n&1&&(r(0,"div",7)(1,"div",8)(2,"div"),p(3),l(),r(4,"small",9),p(5),l()(),g(6,Ym,4,3,"div",10),l()),n&2){let e=t.data,i=c();s(3),w(e==null?null:e.Value),s(2),w(e==null?null:e.Code),s(),C(i.role.product.Price?6:-1)}}var Zn=class n{constructor(t,e,i,o,a,h){this.shoppingCartService=t;this.pageInitialService=e;this.dialog=i;this.role=o;this.salesOrderService=a;this.outletService=h}barcodePrefixIcon="fa-solid fa-barcode";serialPrefixIcon="fa-barcode-read fa-solid";scannerMode="barcode";toastr=$(J);serialInputEl;serial;renderThumbnail=!1;ngOnInit(){this.initThumbnailConfig()}ngAfterViewInit(){}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(de),d(A),d(re),d(yt),d(V),d(G))};static \u0275cmp=M({type:n,selectors:[["app-search-product"]],viewQuery:function(e,i){if(e&1&&Se(zm,5),e&2){let o;ye(o=xe())&&(i.serialInputEl=o.first)}},standalone:!1,decls:4,vars:2,consts:[["itemTemplate",""],["serialInput",""],[1,"px-4","py-4"],[1,"px-4","py-4","position-relative"],["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"],["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"],[1,"ps-4"]],template:function(e,i){e&1&&(g(0,Jm,3,11,"div",2),g(1,Km,4,3,"div",3),Z(2,Zm,7,3,"ng-template",null,0,ht)),e&2&&(C(i.scannerMode==="barcode"?0:-1),s(),C(i.scannerMode==="serial"?1:-1))},dependencies:[Y,q,oe,Xt,se,ze,K],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}
|
|
44
|
+
`],encapsulation:2})};var eu=(n,t)=>({"text-danger":n,"text-custom-warning":t}),tu=n=>({"ms-3":n});function iu(n,t){if(n&1&&(r(0,"div",4)(1,"div",5)(2,"div"),p(3),l()()()),n&2){let e=t.data,i=c();s(),m("ngClass",_e(3,eu,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),w(e==null?null:e.Value)}}function nu(n,t){if(n&1&&(He(0),r(1,"span",9),v(2,"i",10),r(3,"span",11),p(4),b(5,"number"),l()(),Ue()),n&2){let e=c(2);s(4),w(e.customerData!=null&&e.customerData.Point?I(5,1,e.customerData==null?null:e.customerData.Point):0)}}function ou(n,t){if(n&1&&(He(0),r(1,"span"),p(2,"/"),l(),r(3,"span"),He(4),r(5,"span"),p(6),b(7,"number"),l(),Ue(),l(),Ue()),n&2){let e=c(3);s(6),w(I(7,1,e.customerData==null?null:e.customerData.DebtLimit))}}function ru(n,t){if(n&1&&(He(0),r(1,"span",12),v(2,"i",13),r(3,"span"),p(4),b(5,"number"),l(),Z(6,ou,8,3,"ng-container",3),l(),Ue()),n&2){let e=c(2);s(),le(T(6,tu,e.isEnabledLoyaltyPoint())),s(3),x(" ",I(5,4,e.customerData==null?null:e.customerData.Debt)," "),s(2),m("ngIf",(e.customerData==null?null:e.customerData.DebtLimit)>0)}}function au(n,t){if(n&1&&(He(0),r(1,"span",14),v(2,"i",15),r(3,"span",11),p(4),l()(),Ue()),n&2){let e=c(2);s(4),w(e.customerData.Groups.length>1?`${e.customerData.Groups.length} Groups`:e.customerData.Groups[0].Name)}}function lu(n,t){if(n&1){let e=y();He(0),r(1,"div",6)(2,"div",7)(3,"div",8),_("click",function(){u(e);let o=c();return f(o.showPointModal())}),Z(4,nu,6,3,"ng-container",3)(5,ru,7,8,"ng-container",3)(6,au,5,1,"ng-container",3),l()()(),Ue()}if(n&2){let e=c();s(4),m("ngIf",e.isEnabledLoyaltyPoint()),s(),m("ngIf",(e.userRole==null?null:e.userRole.DebtView)&&(e.customerData==null?null:e.customerData.Debt)>0),s(),m("ngIf",e.customerData.Groups.length>0)}}var Xn=class n{constructor(t,e,i,o,a,h,E,F,Ce,Te,Be,gi,Ci){this.customerService=t;this.dialog=e;this.userRoleService=i;this.orderProcessorService=o;this.salesOrderService=a;this.toastr=h;this.outletService=E;this.posService=F;this.customerHttpService=Ce;this.sf=Te;this.orderCalculator=Be;this.router=gi;this.shoppingCartService=Ci;this.destroy$=new Q}isDisabled=!1;handleF1(){let t=document.getElementById("ContactID");t&&t.focus()}customerData;destroy$;isEnabledLoyaltyPoint=R(!1);salesOrder;userRole;customerState=ba;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(ta,{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,o=this.customerData.LoyaltyEnabled;this.isEnabledLoyaltyPoint.set(!1),e&&i&&this.customerData?.Point>0&&o&&this.isEnabledLoyaltyPoint.set(!0)}onDeleteCustomer(){S.IsNotEmpty(this.salesOrder?.ContactName)&&this.dialog.open(ri,{data:{title:"Re-assign customer",message:"Are you sure to re-assign the customer?"}}).afterClosed().pipe(ie(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.customerService.pointBalanced,e=this.orderCalculator.Data;e>0?t>0&&this.isEnabledLoyaltyPoint()&&this.dialog.open(mi):e<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}get disabled(){return this.isDisabled&&!this.salesOrder.ContactName}showShoppingCartLockedDialog(){this.shoppingCartService.isShoppingCartLockedByPromotionCoupon()}static \u0275fac=function(e){return new(e||n)(d(di),d(re),d(ce),d(U),d(V),d(J),d(G),d(A),d(dt),d(ra),d(ge),d(vt),d(de))};static \u0275cmp=M({type:n,selectors:[["app-search-customer"]],hostBindings:function(e,i){e&1&&_("keydown.control.F1",function(){return i.handleF1()},ut)},inputs:{isDisabled:"isDisabled"},standalone:!1,decls:5,vars:11,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","disabled","tooltip"],[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"],["aria-hidden","true",1,"fa-solid","fa-dollar-sign","text-primary"],["matTooltip","Group",1,"ms-3"],["aria-hidden","true",1,"fa","fa-user-group","text-primary"]],template:function(e,i){if(e&1){let o=y();r(0,"div",1)(1,"autocompleteV2",2),_("onInputChange",function(h){return u(o),f(i.onInputCustomer(h))})("onInputEnter",function(h){return u(o),f(i.onScanCodeCustomer(h))})("onSelect",function(h){return u(o),f(i.onSelectCustomer(h))})("clickInputValue",function(){return u(o),f(i.shoppingCartService.isNonAuthorizedCouponType?i.showShoppingCartLockedDialog():i.onDeleteCustomer())})("clickPrefixIcon",function(){return u(o),f(i.openCustomerModal())})("clickSuffixIcon2",function(){return u(o),f(i.onClickSuffixIcon2())})("optionSelected",function(h){return u(o),f(i.onEmitSelectedCustomer(h))})("onDetectInputNativeElement",function(h){return u(o),f(i.onDetectInputNativeElement(h))}),l(),Z(2,iu,4,6,"ng-template",null,0,ht)(4,lu,7,3,"ng-container",3),l()}if(e&2){let o=ot(3);s(),m("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)("disabled",i.disabled)("tooltip",i.disabled?"Remove the coupon to assign a customer":""),s(3),m("ngIf",i.customerData&&((i.userRole==null?null:i.userRole.DebtView)&&(i.customerData==null?null:i.customerData.Debt)>0||i.isEnabledLoyaltyPoint()))}},dependencies:[z,Qt,Xt,se,K],styles:[`autocompleteV2.autocomplete-customer>mat-form-field>input{height:38px!important;border-radius:.375rem}autocompleteV2.autocomplete-customer>mat-form-field>div.position-relative>span.prefix-icon{top:10px}.customerPoint-tooltip{height: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}
|
|
45
|
+
`],encapsulation:2})};var cu=["cardContainer"],pu=n=>({"cart-subscription-overdue":n}),du=n=>({"pb-2":n}),eo=class n{constructor(t,e){this.authService=t;this.shoppingCartService=e;this.currentSubsStatus=t.getSubscriptionStatus()}cardContainer;currentSubsStatus;subscriptionStatus=Gt;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(Kt),d(de))};static \u0275cmp=M({type:n,selectors:[["sell-cart"]],viewQuery:function(e,i){if(e&1&&Se(cu,5),e&2){let o;ye(o=xe())&&(i.cardContainer=o.first)}},standalone:!1,decls:17,vars:7,consts:[["cardContainer",""],[1,"d-flex","flex-column","cart-height",3,"ngClass"],[1,"row","border-bottom",2,"min-height","60px"],[1,"col-12","px-3","pt-2"],[1,"row"],[1,"col-7","px-0"],[1,"col-5","ps-0","pe-4"],[3,"isDisabled"],[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=y();r(0,"div",1)(1,"div",2)(2,"div",3),v(3,"sell-cart-header"),l()(),r(4,"div",4)(5,"div",5),v(6,"app-search-product"),l(),r(7,"div",6),v(8,"app-search-customer",7),l()(),r(9,"div",8,0)(11,"div",9)(12,"div",10)(13,"sell-cart-body",11),_("eventAddItem",function(){return u(o),f(i.onEventAddItem())}),l()()()(),r(14,"div",12)(15,"div",13),v(16,"sell-cart-footer"),l()()()}e&2&&(m("ngClass",T(3,pu,i.currentSubsStatus==i.subscriptionStatus.OVERDUE||i.currentSubsStatus==i.subscriptionStatus.SELL_ONLY)),s(8),m("isDisabled",i.shoppingCartService.isNonAuthorizedCouponType),s(6),m("ngClass",T(5,du,i.currentSubsStatus==i.subscriptionStatus.OVERDUE||i.currentSubsStatus==i.subscriptionStatus.SELL_ONLY)))},dependencies:[z,Gn,zn,Kn,Zn,Xn],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 uu=n=>({"sell-subscription-overdue":n});function fu(n,t){n&1&&(r(0,"div",7)(1,"div",8),v(2,"sell-left-content"),l(),r(3,"div",9),v(4,"sell-cart"),l()())}function gu(n,t){if(n&1&&g(0,fu,5,0,"div",7),n&2){let e=c();C(e.posHttpResponse?0:-1)}}function Cu(n,t){n&1&&(r(0,"div",2)(1,"div",10),v(2,"sell-complete"),l()())}function _u(n,t){if(n&1&&v(0,"park-order",4),n&2){let e=c();m("data",e.receiptTemplate)("printTemplate",e.outletRegister.PrintTemplate)("config",e.appConfig)("stylesheet",e.posHttpResponse==null?null:e.posHttpResponse.StylesSheet)}}function hu(n,t){if(n&1&&v(0,"POS-bill-receipt-A4",5),n&2){let e=c();m("data",e.receiptTemplate)("printTemplate",e.outletRegister.PrintTemplate)("config",e.appConfig)("outletInfo",e.outletRegister)("stylesheet",e.posHttpResponse==null?null:e.posHttpResponse.StylesSheet)}}function vu(n,t){if(n&1&&v(0,"pos-receipt",6),n&2){let e=c();m("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 So=class n extends dr{constructor(e,i,o,a,h,E,F,Ce,Te,Be,gi,Ci,Nt,to,_i,yo,io,xo,Qa,$a,bu,Su,yu,xu,Iu,Pu,Du){super(io);this._localDataService=e;this.posService=i;this.outletService=o;this.route=a;this.signalRClientService=h;this.orderProcessorService=E;this.decimalPipe=F;this.paymentServiceGateway=Ce;this.dialog=Te;this.toastr=Be;this.parkOrderService=gi;this.userRoleService=Ci;this.receiptService=Nt;this.orderHttpService=to;this.roleService=_i;this.intercomService=yo;this.authService=xo;this.ecrSignalRService=Qa;this.ecrStorage=$a;this.router=bu;this.onlineStatusService=Su;this.httpService=yu;this.promotionCouponProviderService=xu;this.promotionCouponService=Iu;this.cashMachineService=Pu;this.salesOrderService=Du;this.destroy$=new Q,this.currentSubsStatus=xo.getSubscriptionStatus(),(!_i.sell.Create&&!this.route.snapshot.queryParamMap.has("ID")||!_i.sell.Edit&&this.route.snapshot.queryParamMap.has("ID"))&&this.router.navigate(["/menu/Unauthorized/Main/Unauthorized"])}destroy$;sellState=Pe;isOnline;posHttpResponse;currentState;receiptTemplate;isPrintBillMini=!1;isPrintBillA4=!1;isPrintPark=!1;outletRegister;appConfig;userRole;invoiceNumberEdit;currentSubsStatus;subscriptionStatus=Gt;renderer=$(Ro);ngOnInit(){this.initialPage()}ngAfterViewInit(){let e=document.querySelector("#full-container");this.renderer.addClass(e,"full-container"),this.intercomService.hideLauncher()}initialPage(){this.menuData$.pipe(Ve(()=>this.posService.requestObservable()),ve(o=>{let a=this.route.snapshot?.queryParamMap?.has("ID");if(this.posService.pushNewValue(o.data),this.posHttpResponse=o.data,this.appConfig=o.data.AppConfigJSON,this.showModalEmptySalesOrderTag(),this.subscribeToObservable(),a){let h=this.route.snapshot?.queryParamMap?.get("ID");this.editInvoice(h)}else this.openModalConfirmContinueEdit(o.data.Registers,o.data.UserName);this.initializeRole(),this.ecrSignalRService.initEcrOnStartup(),this.cashMachineService.initCashMachineOnStartup()}),k(this.destroy$)).pipe(ie(o=>o.type=="Online"),it(o=>o.data),Ve(o=>this._localDataService.syncPOSStorage(o))).pipe(k(this.destroy$)).subscribe()}onOpenDialogOfflineOrder(){Oo([this._localDataService.unsentOrders$.pipe(it(e=>e.length),Bt(1)),this.onlineStatusService.getOnlineStatus$().pipe(Bt(1))]).pipe(Ve(([e,i])=>{let o=this.dialog.getDialogById("ModalOfflineOrder")?.id;return e>0&&i&&!o?this.dialog.open(rn,{disableClose:!0,id:"ModalOfflineOrder",data:{activeTab:"ORDER"}}).afterClosed():Do}),Bt(1)).subscribe()}showModalEmptySalesOrderTag(){this.posHttpResponse?.PoTypes?.length==0&&this.dialog.open(Rr,{id:"ModalInfo",data:{title:"Empty Sales Order",message:`
|
|
46
46
|
<div class="d-flex justify-content-center">
|
|
47
47
|
<img class="empty-state-img" src="https://pub-5a8de9b3d4454b2faa2709eadbe7f51f.r2.dev/web-image/tags.svg"
|
|
48
48
|
alt="Empty Sales Order Tag" />
|
|
@@ -53,5 +53,5 @@ Printing in 8mm format instead!`,"Error!"),this.printReceiptMini(),t}),ve(()=>{t
|
|
|
53
53
|
<p class="text-center">
|
|
54
54
|
Please add the tag <a href="/menu/Setup/Tag/Sales_Order">here</a> to continue.
|
|
55
55
|
</p>
|
|
56
|
-
`,headerType:Fe.Error},width:"28rem"})}initializeRole(){let e=new Ot(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(!
|
|
57
|
-
`],encapsulation:2})},
|
|
56
|
+
`,headerType:Fe.Error},width:"28rem"})}initializeRole(){let e=new Ot(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 E=`IDR ${this.decimalPipe.transform(i.gross_amount)} received. Please verify in customer mobile app!`;this.toastr.success(E," 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)})}openModalConfirmContinueEdit(e,i){this.currentState==2?this.dialog.open(Un).afterClosed().pipe(ie(o=>!S.IsEmpty(o))).subscribe(o=>{if(o==="CONTINUE_EDITING"){let a=this.salesOrderService.Data?.Order?.ID;this.router.navigate(["/menu/Sell"],{queryParams:{ID:a},queryParamsHandling:"merge"})}else o==="CREATE_NEW_ORDER"&&(this.orderProcessorService.createNewTransactionInSameOutletRegister(!0),this.orderProcessorService.emitClearOrder())}):this.outletService.setActiveRegisterFromOptions(e,i)}ngOnDestroy(){this.intercomService.showLauncher(),this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(i){return new(i||n)(d(Ye),d(A),d(G),d(Jo),d(Yo),d(U),d(K),d(Ki),d(re),d(J),d(ke),d(ce),d(Et),d(Me),d(yt),d(rr),d(fr),d(Kt),d(kt),d(tn),d(vt),d(pt),d(Le),d(wt),d(mt),d(oi),d(V))};static \u0275cmp=M({type:n,selectors:[["POS-sell-v3"]],features:[lt([ke,Rt]),Ei],decls:8,vars:7,consts:[[1,"d-block","d-print-none"],[1,"container-fluid","sell-container",3,"ngClass"],[1,"row"],[1,"print_containers"],[3,"data","printTemplate","config","stylesheet"],[3,"data","printTemplate","config","outletInfo","stylesheet"],[3,"data","printTemplate","config","priceVisibleRestriction","outletInfo","stylesheet"],[1,"row","d-print-none"],[1,"col-5","pe-6"],[1,"border-start","ps-6","col-7"],[1,"col-12","px-0"]],template:function(i,o){i&1&&(v(0,"subscription-alert",0),r(1,"div",1),g(2,gu,1,1)(3,Cu,3,0,"div",2),l(),r(4,"div",3),g(5,_u,1,4,"park-order",4),g(6,hu,1,5,"POS-bill-receipt-A4",5),g(7,vu,1,6,"pos-receipt",6),l()),i&2&&(s(),m("ngClass",T(5,uu,o.currentSubsStatus==o.subscriptionStatus.OVERDUE||o.currentSubsStatus==o.subscriptionStatus.SELL_ONLY)),s(),C(o.currentState!=o.sellState.IsComplete&&o.currentState!=o.sellState.UploadOrderFail?2:3),s(3),C(o.isPrintPark&&o.receiptTemplate?5:-1),s(),C(o.receiptTemplate&&o.isPrintBillA4?6:-1),s(),C(o.receiptTemplate&&o.isPrintBillMini?7:-1))},dependencies:[X,z,Cn,$n,la,eo,xn,Je,Pt,en,Xi,sn,Kr,Jr,zr,Gr,Pn,yr],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}}
|
|
57
|
+
`],encapsulation:2})},cx=[{path:"Offline",loadChildren:()=>import("./chunk-NIMHPY7S.js").then(n=>n.OfflineModule)},{path:"",loadComponent:()=>So}];export{So as SellV3Component,cx as routes};
|