dealpos 25.51.0 → 25.51.1
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-OURNAI65.js → chunk-243EB36Y.js} +2 -2
- package/browser/{chunk-5HIJCKLY.js → chunk-3K2A4Z67.js} +1 -1
- package/browser/{chunk-43G72GH2.js → chunk-4OP4E5Q4.js} +1 -1
- package/browser/{chunk-V6NXOOJA.js → chunk-4PDGY62B.js} +1 -1
- package/browser/{chunk-WR54IKY6.js → chunk-54SK3PVO.js} +1 -1
- package/browser/{chunk-VQKO557Q.js → chunk-55Z32OLJ.js} +1 -1
- package/browser/{chunk-SVUFU2AS.js → chunk-5XTMPVSF.js} +1 -1
- package/browser/{chunk-67UFIJ2O.js → chunk-6OULAYGH.js} +1 -1
- package/browser/{chunk-HIA4J5DB.js → chunk-6VYP636I.js} +1 -1
- package/browser/{chunk-PV27CMZ2.js → chunk-7264OPXA.js} +1 -1
- package/browser/{chunk-XWV7AI2C.js → chunk-7OQXKVTC.js} +1 -1
- package/browser/{chunk-6UY42XOC.js → chunk-AB7O2ERM.js} +1 -1
- package/browser/{chunk-T5IJP474.js → chunk-ABOSNV75.js} +1 -1
- package/browser/{chunk-HHCNN3XR.js → chunk-BCGNQKO5.js} +1 -1
- package/browser/{chunk-RU3GD3GY.js → chunk-BRQVQGLJ.js} +1 -1
- package/browser/{chunk-2EHLYOAD.js → chunk-BWVEZ3MZ.js} +1 -1
- package/browser/{chunk-RHDU4PR2.js → chunk-CAGFIP4G.js} +1 -1
- package/browser/{chunk-4MWVPOV6.js → chunk-CJ4ET4PG.js} +1 -1
- package/browser/{chunk-CRKJEU3Z.js → chunk-CR5CHTI7.js} +1 -1
- package/browser/{chunk-4CYACZL5.js → chunk-DAH4EEQV.js} +1 -1
- package/browser/{chunk-SCHTN7VQ.js → chunk-DBRZ7F2Z.js} +1 -1
- package/browser/{chunk-VA6MHJ5E.js → chunk-DNY4JYTC.js} +1 -1
- package/browser/{chunk-IM3B5EF2.js → chunk-E5TUY2II.js} +1 -1
- package/browser/chunk-EFDMYOLZ.js +4 -0
- package/browser/{chunk-NRTKHF45.js → chunk-EMHEIQNS.js} +1 -1
- package/browser/{chunk-QS2AUXB7.js → chunk-FEHMPX43.js} +1 -1
- package/browser/{chunk-WQMYMJLR.js → chunk-FVFTYYCC.js} +1 -1
- package/browser/{chunk-BVOUQJCA.js → chunk-GE5I6JYL.js} +1 -1
- package/browser/{chunk-ZNPC63ZV.js → chunk-GZ6OVEDL.js} +1 -1
- package/browser/{chunk-NQQB5U5S.js → chunk-H6RHVRGW.js} +1 -1
- package/browser/{chunk-6LZENMYE.js → chunk-HLCZLXPS.js} +1 -1
- package/browser/{chunk-N6EBK52R.js → chunk-IF6EZMOM.js} +2 -2
- package/browser/{chunk-OTLU2WY3.js → chunk-ISZRZRCT.js} +2 -2
- package/browser/{chunk-I7AQHKKG.js → chunk-JHBK7LOJ.js} +1 -1
- package/browser/{chunk-PQSGJR4P.js → chunk-KDISSQKT.js} +1 -1
- package/browser/{chunk-5ZPO7V26.js → chunk-KFC3V2GW.js} +1 -1
- package/browser/{chunk-KEILLJ6G.js → chunk-KHB5Q7IN.js} +1 -1
- package/browser/{chunk-P5XKSQ34.js → chunk-KIYO2YC2.js} +1 -1
- package/browser/{chunk-HVFYCXLX.js → chunk-KKM7I2BT.js} +1 -1
- package/browser/{chunk-DX56EYRS.js → chunk-LHTHIOAY.js} +1 -1
- package/browser/{chunk-A5LIALQE.js → chunk-M4FNFZNJ.js} +1 -1
- package/browser/{chunk-TOJPS7BJ.js → chunk-MEL6Z4NI.js} +1 -1
- package/browser/{chunk-XVTXHAKW.js → chunk-MHPLYS7O.js} +1 -1
- package/browser/{chunk-ZO3XZXWW.js → chunk-MJCLLJBB.js} +1 -1
- package/browser/{chunk-2GIDUMXS.js → chunk-MZDVGN2B.js} +1 -1
- package/browser/{chunk-SUCJCOST.js → chunk-NYMHQHNP.js} +1 -1
- package/browser/{chunk-6AHKVKAZ.js → chunk-O7SYLGUB.js} +2 -2
- package/browser/{chunk-OZ2R2K2V.js → chunk-OF3BZHBQ.js} +1 -1
- package/browser/{chunk-H2RXYP7A.js → chunk-OFWJY5WB.js} +1 -1
- package/browser/{chunk-3HDEMBWS.js → chunk-ORTAUDOX.js} +1 -1
- package/browser/{chunk-4OTZNFYS.js → chunk-PSLGWGNP.js} +1 -1
- package/browser/{chunk-MUWJSYXR.js → chunk-Q22HR52N.js} +1 -1
- package/browser/{chunk-ZNJ4JTTS.js → chunk-QEL7CGCP.js} +1 -1
- package/browser/{chunk-57WKDIDF.js → chunk-QHGZQ2IG.js} +1 -1
- package/browser/{chunk-6F45DEGR.js → chunk-R6DRKF4V.js} +8 -8
- package/browser/{chunk-HHM4L75O.js → chunk-RDASAJA5.js} +1 -1
- package/browser/{chunk-HSLDD424.js → chunk-RPBIQ4ME.js} +1 -1
- package/browser/{chunk-DJUOMCAV.js → chunk-RT7OZJYZ.js} +1 -1
- package/browser/{chunk-3PKJLXTC.js → chunk-RWW55Z7V.js} +1 -1
- package/browser/{chunk-V36Z6WRV.js → chunk-RWZGTR3S.js} +1 -1
- package/browser/{chunk-YXRJV3RQ.js → chunk-SQAFHZEO.js} +1 -1
- package/browser/{chunk-RF5FWMSR.js → chunk-T43ISYOP.js} +1 -1
- package/browser/{chunk-6O6OE4KQ.js → chunk-TKHSLAZH.js} +13 -13
- package/browser/{chunk-OAVGNXY4.js → chunk-TYVVSM36.js} +1 -1
- package/browser/{chunk-D7YMUC3H.js → chunk-U6FO6TSU.js} +1 -1
- package/browser/{chunk-XPN6EISF.js → chunk-UFVN6MTY.js} +1 -1
- package/browser/{chunk-VOY3BJZP.js → chunk-UI6U53UY.js} +1 -1
- package/browser/{chunk-B6TCVVAN.js → chunk-UPV6ZIB5.js} +1 -1
- package/browser/{chunk-6GCAXVFO.js → chunk-VG3B7TDX.js} +1 -1
- package/browser/{chunk-OR4H5IKL.js → chunk-VS6CGXUJ.js} +1 -1
- package/browser/{chunk-T6GXIGYG.js → chunk-WDUPZI6X.js} +1 -1
- package/browser/{chunk-TCW7SVU5.js → chunk-WTIIZBRC.js} +1 -1
- package/browser/{chunk-HQGZC4Y3.js → chunk-XCSDEGWL.js} +1 -1
- package/browser/{chunk-WFTIOB7Q.js → chunk-XDFUPYND.js} +1 -1
- package/browser/{chunk-3XDE3GJ3.js → chunk-XFU3EMCG.js} +1 -1
- package/browser/{chunk-7JBFR3T4.js → chunk-XGXXFTMA.js} +1 -1
- package/browser/{chunk-DCONKX6G.js → chunk-XMPWQ5UV.js} +1 -1
- package/browser/{chunk-ECW7GAZQ.js → chunk-XPM7J5AN.js} +1 -1
- package/browser/{chunk-HZP6OUOI.js → chunk-XW7VJLDW.js} +1 -1
- package/browser/{chunk-MTUBVUM5.js → chunk-Y6SAXN2J.js} +1 -1
- package/browser/{chunk-A2EDYIYP.js → chunk-YLXBICIW.js} +1 -1
- package/browser/{chunk-IHIJW73V.js → chunk-Z5HEFUTD.js} +1 -1
- package/browser/{chunk-YC2LQSY3.js → chunk-ZRJU5XBX.js} +1 -1
- package/browser/index.html +2 -2
- package/browser/{main-PHIUFC5R.js → main-6NLSRECT.js} +2 -2
- package/package.json +1 -1
- package/browser/chunk-QERITLZK.js +0 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{a as Jr}from"./chunk-76CUXDTU.js";import{a as vo}from"./chunk-HHM4L75O.js";import{b as ya,c as xa}from"./chunk-6I2YT4SH.js";import{a as fa}from"./chunk-UMFN4AJF.js";import{b as ga,e as Ca,f as _a,g as ha}from"./chunk-D6HBPIFD.js";import{a as Da}from"./chunk-HBAQBI6Z.js";import{A as ea,B as ta,C as ln,D as wt,E as kt,F as aa,G as sn,H as la,I as sa,J as pn,K as ma,L as ua,a as jr,b as ut,c as Ur,d as De,e as R,f as A,g as Wr,h as de,i as zi,j as Qr,k as qr,l as $,m as $r,n as Gr,o as Ce,p as Xe,q as Dt,r as we,s as Xt,t as Yi,u as Xi,v as Zi,w as en,x as bo,y as tn,z as U}from"./chunk-CRKJEU3Z.js";import"./chunk-YXCPHYC5.js";import"./chunk-JFLT7NX3.js";import"./chunk-NFWYR26Q.js";import"./chunk-GGDW5WFA.js";import{b as Pa}from"./chunk-OUJXEQKL.js";import{a as Oa,b as Ia}from"./chunk-LKVUZZ5J.js";import{a as va,b as Sa}from"./chunk-IEX7S7T7.js";import{a as Kr,b as Yr,c as Xr,d as on}from"./chunk-U56LRRCE.js";import{a as Ma,b as mn}from"./chunk-5VYU6SHE.js";import{a as ia,b as na}from"./chunk-6XNP4ZXB.js";import{c as rn,d as an}from"./chunk-5PDQ5UNO.js";import"./chunk-O22HDFH6.js";import"./chunk-AQKJ3LSN.js";import{a as Ft}from"./chunk-UX4QS4XQ.js";import"./chunk-SCAKRK4B.js";import{a as Ge,b as ft}from"./chunk-HAXEFEKW.js";import"./chunk-6G7LPAEQ.js";import{a as ba}from"./chunk-3DUSH3ND.js";import{a as dn}from"./chunk-SXRKKO75.js";import"./chunk-LGD5WUG2.js";import"./chunk-NQX7EX5A.js";import"./chunk-ZBHPM2JC.js";import"./chunk-P3KIIKY4.js";import{a as Hr,b as oa,c as ra}from"./chunk-VRKJC53Z.js";import{a as Ki}from"./chunk-NJ4KEQKH.js";import{a as da}from"./chunk-27OXTS7Y.js";import"./chunk-JOLAOKHD.js";import"./chunk-BYXBJQAS.js";import{a as ei}from"./chunk-Y4MERAVA.js";import{a as Me,b as Co,d as Ji}from"./chunk-7BVPHIEF.js";import{a as ho}from"./chunk-PF33HK6M.js";import"./chunk-5UDUWK67.js";import"./chunk-PNFJVQUF.js";import{a as _o}from"./chunk-25H27N7N.js";import{a as zr,b as nn}from"./chunk-4L4MSVOU.js";import{a as cn,b as ca,c as pa}from"./chunk-6WMEGLEF.js";import{a as gt,b as Zt}from"./chunk-5RFSSCAR.js";import{a as Zr}from"./chunk-WFVMID6Q.js";import"./chunk-FINTUPRM.js";import{a as Fr}from"./chunk-4USQPLEW.js";import"./chunk-J6U6UYNI.js";import{b as qi,c as ot}from"./chunk-NSNUUKNK.js";import{b as Fe}from"./chunk-EN2Y56CS.js";import"./chunk-Z3E24JZW.js";import"./chunk-BYXBJQAS.js";import{c as bi}from"./chunk-PXDS3HXW.js";import{a as Qi}from"./chunk-NQKVYQ6V.js";import{a as $i,b as Gi}from"./chunk-PSFQWURP.js";import{a as Br}from"./chunk-3XH2STFE.js";import"./chunk-P3TFDLWR.js";import"./chunk-BYXBJQAS.js";import{a as Wi}from"./chunk-V4V55JMO.js";import{a as Ar,b as Lr}from"./chunk-IDJEXQ5I.js";import"./chunk-DODZXMH2.js";import"./chunk-EZNBK62W.js";import{b as Bi,c as Pt,d as Ot,e as zt}from"./chunk-3MAZIRSX.js";import{a as br}from"./chunk-75FYOZH7.js";import"./chunk-CVN6ZXXJ.js";import{e as Vr}from"./chunk-AHTR7XKG.js";import"./chunk-NS6IC2PT.js";import"./chunk-3RK6DDJD.js";import"./chunk-SMEVWRVE.js";import"./chunk-JQDS4BXR.js";import"./chunk-F3HDP5CA.js";import"./chunk-AJAUI7BA.js";import"./chunk-MWGICBEB.js";import{d as Hi,e as Ui}from"./chunk-ODYEJFNJ.js";import"./chunk-WSWTWRKJ.js";import{b as Tr,c as Er,d as Rr,e as Nr}from"./chunk-ZO3XZXWW.js";import"./chunk-OB6KFXD6.js";import"./chunk-QJ3CWKQT.js";import"./chunk-ZOYWCF3Q.js";import{c as fr}from"./chunk-SWF6XISV.js";import"./chunk-GXAF3JUO.js";import"./chunk-LB5UXGDG.js";import"./chunk-YDL2MTWE.js";import"./chunk-7YYWBCWJ.js";import"./chunk-CCIHCGP5.js";import{a as ht,c as mt}from"./chunk-FM7BHGBW.js";import{a as gr,c as Cr,e as _r}from"./chunk-TP6ZUC53.js";import{a as Dr,c as wr,d as kr}from"./chunk-3PKJLXTC.js";import{a as hr,b as vr}from"./chunk-ECW7GAZQ.js";import"./chunk-E634BI4W.js";import{a as pr}from"./chunk-BAXZ74LK.js";import{C as Ir,D as Ye,F as Yt,G as It,u as B,v as j,w as ge}from"./chunk-3ZH3XK5V.js";import{b as se,c as Ke}from"./chunk-V6D6TV7B.js";import{F as Or,N as Kt,O as be,a as Sr,b as yr,n as ji,t as xr,u as Mr,x as Pr}from"./chunk-QWLNF7VL.js";import{a as tr}from"./chunk-UIVJ2JQT.js";import"./chunk-EQLHPWVB.js";import{d as _t}from"./chunk-SCGKVOSE.js";import{e as F,f as Le,g as ae}from"./chunk-N5RDRDT7.js";import{N as dr,ca as mr,ea as ur}from"./chunk-N7OS7SFI.js";import"./chunk-4HLKKTIV.js";import"./chunk-RIZ4YVMH.js";import{a as Ae}from"./chunk-2FWFPV5I.js";import"./chunk-Z76C52NM.js";import{A as Gt,D as sr,F as fe,G as qe,a as ir,b as $t,c as z,d as nr,e as Lt,g as or,h as Q,j as rr,l as pt,m as ar,o as ee,r as lr,s as dt}from"./chunk-7MRUPBXU.js";import{a as qt,c as Jt}from"./chunk-T5IJP474.js";import{a as cr}from"./chunk-DJUOMCAV.js";import"./chunk-5RYL4EJ2.js";import{b as Mt}from"./chunk-KBLVOO4J.js";import{a as S}from"./chunk-WUV22SZ4.js";import{a as er}from"./chunk-NQQB5U5S.js";import{p as X,s as $e}from"./chunk-TANYEHMZ.js";import{$b as ye,$c as Ko,Ab as g,Ac as T,Ad as Yo,Bc as me,Ca as E,Cb as C,Cc as hi,Db as gi,E as oe,Eb as pe,Fb as ie,Gb as ne,Ha as Bo,Hb as m,Hc as v,I as fi,Ib as r,Ic as M,Ja as jo,Jb as a,Jc as Z,Kb as h,Kc as Ne,Lb as Ct,M as Vo,Mb as lt,N as jt,Nc as yt,Nd as Xo,Ob as Ue,Pb as We,Pd as Zo,Qa as ki,Qb as Ci,Qc as Jo,Rb as y,Rd as xt,Sa as tt,Sd as Wt,Ub as _,Ud as Qt,Va as it,Vb as fo,Vc as Ni,Wb as c,Wc as zo,Xa as s,Y as Ht,Ya as He,_b as Se,aa as Re,ac as xe,c as Eo,cc as Qo,d as q,da as k,db as Ho,dc as qo,e as mo,eb as d,ec as nt,fa as Ie,fc as go,gc as $o,ib as P,ic as le,id as H,jb as St,jc as p,k as Ro,ka as Ao,kb as Ti,kc as w,kd as Vi,la as at,lc as x,ld as Ut,ma as vt,mb as Ei,mc as Te,nc as Go,o as uo,oa as N,ob as K,oc as O,od as Ai,pa as J,pc as I,pd as Li,qc as D,qd as Ve,sd as Qe,t as et,ta as u,u as wi,ua as f,uc as _i,ud as Y,vb as Uo,vc as Ri,wb as Wo,wd as Fi,xa as Lo,xd as re,ya as Fo,yc as st,z as No,zc as ct}from"./chunk-L3U6V3BF.js";import"./chunk-WFMAM73Y.js";import{k as To}from"./chunk-SNAKHGZS.js";var un=class{ID;Code;Name;Title;Field;Address;ContactInfo;Logo;FooterLeft;FooterRight;FooterNote;PrintMode;PrintLX300;DeliveryNote;AppendQR;ItemRenderMode;CssClass;RemoveImage;DisplayName;DisplayNameCode};var ti=class{ParkLabel;Note;NumberOfPerson;ID;Alias;Created;CustomerDisplay;Number;Duration};var fn=class n{constructor(t,e,i,o,l,b){this.dialogRef=t;this._orderProcessorService=e;this._posService=i;this.salesOrderService=o;this.parkService=l;this.data=b;this.initModalDialog(),this.initConfig(),this.parkLabel=b.ParkLabel,this.form.ParkLabel=b.ParkLabel,this.form.Note=o.Data.Order.Note}modalConfig=new B;labelPlaceholder;form=new ti;parkLabel;initConfig(){let t=this._posService.Data.AppConfigJSON;this.labelPlaceholder=t.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkLabelPlaceholder}initModalDialog(){this.modalConfig.title=this.data.title,this.modalConfig.customWidth="600px"}onOk(){this.setParkTitle(),this.parkService.park(this.form).subscribe(t=>{this.dialogRef.close(!0)})}setParkTitle(){let t=this._orderProcessorService.Data.posState,e=this.salesOrderService.Data.Order.Number;t==5?this.salesOrderService.Data.SplitParkLabel=S.IsEmpty(this.parkLabel)?e:this.parkLabel:S.IsEmpty(this.parkLabel)?this.form.ParkLabel=e:this.form.ParkLabel=this.parkLabel}static \u0275fac=function(e){return new(e||n)(d(F),d(U),d(A),d(R),d(ke),d(Le))};static \u0275cmp=P({type:n,selectors:[["POS-modal-park-input"]],standalone:!1,decls:17,vars:3,consts:[[3,"onCancel","onOk","onClose","config"],[1,"ods-info-box"],[1,"fas","fa-info-circle",2,"font-size","1.2rem","margin-top","2px"],["href","https://ods.dealpos.app","target","_blank",2,"color","#0d6efd","font-weight","600","text-decoration","underline"],[1,"w-100","mt-4"],[1,"mb-3"],["type","text","required","","placeholder","E.g. Mr. John Doe","matTooltip","Same as Order Number when blank",1,"form-control","w-100","height-input",3,"ngModelChange","ngModel"],["placeholder","ex: Customer will return tommorow",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onCancel",function(){return i.dialogRef.close()})("onOk",function(){return i.onOk()})("onClose",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1),h(3,"i",2),r(4,"div"),p(5," Use our "),r(6,"a",3),p(7," Order Display Fulfillment System "),a(),p(8," to view the Parked Orders from your warehouse area. "),a()(),r(9,"div",4)(10,"strong",5),p(11,"Label"),a(),r(12,"input",6),D("ngModelChange",function(l){return I(i.parkLabel,l)||(i.parkLabel=l),l}),a()(),r(13,"div",4)(14,"strong",5),p(15,"Note"),a(),r(16,"POS-tinymce-editor",7),D("ngModelChange",function(l){return I(i.form.Note,l)||(i.form.Note=l),l}),a()()()()),e&2&&(m("config",i.modalConfig),s(12),O("ngModel",i.parkLabel),s(4),O("ngModel",i.form.Note))},dependencies:[z,Q,Gt,ee,j,se,gt],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 Cn=class n{constructor(t){this._dialogRef=t;this.modalConfig=new B,this.modalConfig.title="Select Print Type",this.modalConfig.hideFooter=!0}modalConfig;onPrintOrder(){this._dialogRef.close("ORDER")}onPrintBill(){this._dialogRef.close("BILL")}static \u0275fac=function(e){return new(e||n)(d(F))};static \u0275cmp=P({type:n,selectors:[["POS-modal-print"]],standalone:!1,decls:17,vars:1,consts:[[3,"onCancel","onClose","config"],[1,"d-flex"],[1,"btn","btn-gray","btn-lg","me-1",3,"click"],["src","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()}),h(4,"img",3),r(5,"h4",4),p(6,"Order"),a(),r(7,"div",5),p(8,"For order for the kitchen"),a()(),r(9,"a",6),_("click",function(){return i.onPrintBill()}),h(10,"img",7),r(11,"h4",4),p(12,"Bill"),a(),r(13,"div",5),p(14,"To see amount of the bill"),a(),r(15,"div",5),p(16,"(Pre-settlement bill)"),a()()()()()),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 Xa=n=>({"mat-tab-group-height":n});function Za(n,t){if(n&1){let e=y();r(0,"div",2)(1,"div",6)(2,"span",7),h(3,"i",8),a(),r(4,"input",9),D("ngModelChange",function(o){u(e);let l=c();return I(l.filter,o)||(l.filter=o),f(o)}),a()()()}if(n&2){let e=c();s(4),O("ngModel",e.filter)}}function el(n,t){if(n&1&&(r(0,"h5",14),h(1,"i"),r(2,"span"),p(3),a()()),n&2){let e=c().$implicit;s(),le(e.Icon),s(2),w(e.Name)}}function tl(n,t){if(n&1){let e=y();r(0,"div",13)(1,"park-card",15),_("onSelect",function(){let o=u(e).$implicit,l=c(2);return f(l.onSelect(o))}),a()()}if(n&2){let e,i=t.$implicit,o=c().$implicit,l=c();s(),m("title",l.replaceWithAlias()&&i.Alias?i.Alias:i.Name)("alias",i.Alias)("isOccupied",i.IsOccupied)("icon",o.Icon)("selected",((e=l.parkOptionSelected())==null?null:e.Name)===i.Name)}}function il(n,t){if(n&1&&(r(0,"mat-tab",4),K(1,el,4,3,"ng-template",10),r(2,"div",11)(3,"div",12),ie(4,tl,2,5,"div",13,gi),v(6,"Filter"),a()()()),n&2){let e=t.$implicit,i=c();m("label",e.Name),s(4),ne(Ne(6,1,e.Options,i.filter(),"Name"))}}function nl(n,t){if(n&1){let e=y();r(0,"div",5)(1,"POS-tinymce-editor",16),D("ngModelChange",function(o){u(e);let l=c();return I(l.parkNote,o)||(l.parkNote=o),f(o)}),a()()}if(n&2){let e=c();s(),O("ngModel",e.parkNote)}}var ni=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=J(F);posService=J(A);modalConfig=new B;filter=E("");parkLayout=E(null);parkOptionSelected=E(null);replaceWithAlias=E(!1);showInputNote=E(!1);parkNote=E("");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(Le))};static \u0275cmp=P({type:n,selectors:[["app-modal-park"]],decls:8,vars:6,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container",2,"max-height","395px","min-height","395px"],[1,"search-container"],["mat-stretch-tabs","false",1,"mt-2",3,"ngClass"],[3,"label"],[1,"mt-4"],[1,"input-group","w-100"],[1,"input-group-text","txtFilter","rounded-start-1"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["type","text","placeholder","Search by number or note","aria-label","Search",1,"txtFilter","form-control","border-start-0","rounded","rounded-start-0",3,"ngModelChange","ngModel"],["mat-tab-label",""],[1,"container","mt-5"],[1,"row"],[1,"col-3","mb-4","px-2"],[1,"d-flex","align-items-center","gap-3"],[3,"onSelect","title","alias","isOccupied","icon","selected"],["height","180px","placeholder","Input the park note (E.g. this is for Mr. John)",3,"ngModelChange","ngModel"]],template:function(e,i){if(e&1&&(r(0,"modal-material",0),_("keydown.F2",function(){return i.onOk()})("onOk",function(){return i.onOk()})("onCancel",function(){return i.onCancel()})("onClose",function(){return i.onCancel()}),r(1,"content")(2,"div",1),g(3,Za,5,1,"div",2),r(4,"mat-tab-group",3),ie(5,il,7,5,"mat-tab",4,gi),a(),g(7,nl,2,1,"div",5),a()()()),e&2){let o,l,b;m("config",i.modalConfig),s(3),C(((o=i.parkLayout().Layout)==null?null:o.length)>0?3:-1),s(),m("ngClass",T(4,Xa,i.showInputNote()&&((l=i.parkOptionSelected())==null?null:l.Name))),s(),ne(i.parkLayout().Layout),s(2),C(i.showInputNote()&&((b=i.parkOptionSelected())!=null&&b.Name)?7:-1)}},dependencies:[re,H,ge,j,Jr,Kt,fe,z,Q,ee,zt,Bi,Pt,Ot,Zt,gt,Mr],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 _n=class n{constructor(t,e,i,o,l,b,V,G,ve){this.dialogRef=t;this.parkOrderRetrieve=e;this._orderDataService=i;this._posHttpResponseService=o;this._orderProcessorService=l;this._orderHttpService=b;this._dialog=V;this._outletRegisterService=G;this.parkService=ve;this.salesOrderData=this._orderDataService.Data,this.appConfig=this._posHttpResponseService.Data.AppConfigJSON,this.parkLayoutPack=this._outletRegisterService.Data.ParkLayoutPack}modalConfig=new B;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(ni,{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(F),d(Le),d(R),d(A),d(U),d(De),d(ae),d($),d(ke))};static \u0275cmp=P({type:n,selectors:[["POS-modal-repark"]],standalone:!1,decls:13,vars:2,consts:[[3,"onClose","onCancel","title","config"],[1,"d-flex"],[1,"btn","btn-gray","btn-lg",3,"click"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onClose",function(){return i.dialogRef.close()})("onCancel",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1)(3,"a",2),_("click",function(){return i.onRepark()}),r(4,"h4"),p(5,"Re-Park"),a(),r(6,"span"),p(7,"Store order to same location"),a()(),r(8,"a",2),_("click",function(){return i.onMove()}),r(9,"h4"),p(10,"Move"),a(),r(11,"span"),p(12,"Shift order to Different location"),a()()()()()),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 oi=class{Name;Alias;IsOccupied;Note};var hn=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 Si=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 hn,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 bi,this.Title="",this.TypeName="",this.PaymentState=0,this.Number="",this.Created="",this.AfterSell=!0}};var ri=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 oi;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 bn=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 vn=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,l,b,V,G){this._posService=t;this._orderDataService=e;this._cashierCalculatorService=i;this._outletService=o;this._OrderHttpService=l;this._receiptCalculatorService=b;this._orderProcessorService=V;this._customerHttpService=G;this.subscribeToObservableChanges()}posData;completeData;park=new ri(null);outletInfo=new Ji;datePipe=new Qe("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 Si;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 console.log(t),t}generateQrContent(){let t="";if(this.AppConfigJSON?.PrintConfigInvoice?.InvoiceQR?.TransformTo==3){let i=this.AppConfigJSON?.PrintConfigInvoice?.InvoiceQR?.Content,o=this.posData?.Order?.Number,l=this.completeData.ObjectID,b=window?.location?.host;switch(i){case 2:t=l;break;case 1:t=o;break;case 3:t=`receipt.dealpos.app?Data=${btoa(`${l}_${b}`)}`;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 bn;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=ot(Fe,this.posData.CartItems);if(e){let o=this.posData.CartItems.filter(l=>S.IsNotEmpty(l.SplitQuantity)&&l.SplitQuantity>0);this.CartItems=o.map(l=>(l.Quantity=l.SplitQuantity,l))}else if(t&&this.AppConfigJSON.ApplicationParkAndRetrieve.PrintBehaviour.PrintAdditionalItemsOnlyOnRePark)if(this.CartItems=Array(),this.ParkTemp.length>0)for(let o of i){let l=this.ParkTemp.find(b=>b.ID==o.ID);l==null?this.CartItems.push(o):o.Quantity!=l.Quantity&&(o.Quantity=o.Quantity-l.Quantity,this.CartItems.push(o))}else this.CartItems=i;else this.CartItems=i}generateBillInvoice(){let t=new vn;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 Si;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,l=1;e?.length>0&&i<o&&(l=2);let b=i-o;return(Math.abs(b)<=t||b>=0)&&(l=3),l}generateTop(t,e){let i=new Date(e),o=new Date(t),l=i.getTime()-o.getTime();return Math.floor(l/(1e3*3600*24))}getSubmitedOrderDate(){let t=this.posData.Order?.Date,e=this.AppConfigJSON.PrintConfigInvoice?.DocumentVisibility?.OrderTimeVisible,i="",o=new Date;if(e){let l=new Date(t);l.setHours(o.getHours()),l.setMinutes(o.getMinutes()),i=this.datePipe.transform(l,"dd MMM yyyy HH:mm")}else i=this.datePipe.transform(t,"dd MMM yyyy");return i}getSubmitedCustomer(){return S.IsEmpty(this.completeData)?{}:this.completeData.Contact}getParkLabel(){let t=this.AppConfigJSON.ApplicationParkAndRetrieve.PrintOutput.LabelPrefix,e=this.AppConfigJSON.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,i=this.posData.Order.ParkLabel;if(S.IsNotEmpty(this.posData.SplitParkLabel)&&(i=this.posData.SplitParkLabel),e&&S.IsNotEmpty(i)){let o=this.park.GetAlias(i);i=o||i}return i?S.IsEmpty(t)?i:S.StringFormat("{0} # {1}",t,i):""}GetSubmittedNumber(){return S.IsNotEmpty(this.completeData)?this.completeData.InvoiceNumber:this.posData.Invoice.Number?this.posData.Invoice.Number:this.posData.Order.Number}generateCartItemSummary(){let t=[];for(let e of this.posData.CartItems)t.push(new Xi(e.Total,this._cashierCalculatorService.currencySymbol,e.Variant.Name,1));return t}generatePaymentSummary(){let t=[],e;for(let o=0;o<this.posData.Payments.length;o++){let l="Payment"+(o+1);this.AppConfigJSON.PrintConfigInvoice.Footer.PaymentMethodVisible&&(l=this.findPaymentName(Number(this.posData.Payments[o].MethodID))),e=new Xi(this.posData.Payments[o].PaidAmount,this._cashierCalculatorService.currencySymbol,l,1),t.push(e)}let i=this.generateChangeSummary();return i!==null&&t.push(i),t}generateChangeSummary(){let t=this._cashierCalculatorService.currencySymbol,e=this._cashierCalculatorService.Data,i=this.posData.TotalPaidAmount,o=0,l=null;return o=i-e,o>0&&(l=new Xi(o,t,"Change",1)),l}findPaymentName(t){return this._outletService.Data.Payments.find(e=>e.ID==t).Name}printWindow(){return To(this,null,function*(){return new Promise(t=>{setTimeout(()=>{window.print(),t()},500)})})}static \u0275fac=function(e){return new(e||n)(N(A),N(R),N(Ce),N($),N(De),N(Zi),N(U),N(ft))};static \u0275prov=at({token:n,factory:n.\u0275fac,providedIn:"root"})};var ke=class n{constructor(t,e,i,o,l,b,V,G,ve,Be){this.httpService=t;this.receiptService=e;this.orderProcessorService=i;this.pageInitialService=o;this.salesOrderService=l;this.toastrService=b;this.promotionEventService=V;this.outletService=G;this.orderHttpService=ve;this.dialog=Be;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(be.GetPark,[{key:"EntityID",value:t},{key:"RegisterID",value:e}])}removeOrder(t,e){let i={OrderID:t};return e?this.httpService.post(be.VoidPark,i):this.httpService.post(be.RemovePark,i)}mergePark(t){return this.httpService.post(be.MergePark,t)}getOutstanding(t){let e={EntityID:t};return this.httpService.post(be.GetOutStanding,e)}splitOrder(t){return this.httpService.post(be.SplitOrder,t)}park(t){let e=ot(ut,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(be.ParkOrder,i).pipe(Ie(o=>{this.orderProcessorService.updatePosState(3,o),this.orderProcessorService.createNewTransactionInSameOutletRegister(!0)}))}clearPromotionAppliedInPark(){this.dialog.open($r,{id:"modal-promotion-confirm",data:{message:`
|
|
1
|
+
import{a as Gr}from"./chunk-76CUXDTU.js";import{a as vo}from"./chunk-RDASAJA5.js";import{b as ya,c as xa}from"./chunk-6I2YT4SH.js";import{a as fa}from"./chunk-UMFN4AJF.js";import{b as ga,e as Ca,f as _a,g as ha}from"./chunk-D6HBPIFD.js";import{a as Da}from"./chunk-HBAQBI6Z.js";import{A as ea,B as ta,C as ln,D as wt,E as kt,F as aa,G as sn,H as la,I as sa,J as pn,K as ma,L as ua,a as jr,b as ut,c as Ur,d as De,e as R,f as A,g as Wr,h as de,i as zi,j as Qr,k as qr,l as $,m as $r,n as Jr,o as Ce,p as Xe,q as Dt,r as we,s as Xt,t as Yi,u as Xi,v as Zi,w as en,x as bo,y as tn,z as U}from"./chunk-CR5CHTI7.js";import"./chunk-YXCPHYC5.js";import"./chunk-JFLT7NX3.js";import"./chunk-NFWYR26Q.js";import"./chunk-GGDW5WFA.js";import{b as Pa}from"./chunk-OUJXEQKL.js";import{a as Oa,b as Ia}from"./chunk-LKVUZZ5J.js";import{a as va,b as Sa}from"./chunk-IEX7S7T7.js";import{a as Kr,b as Yr,c as Xr,d as on}from"./chunk-U56LRRCE.js";import{a as Ma,b as mn}from"./chunk-5VYU6SHE.js";import{a as ia,b as na}from"./chunk-6XNP4ZXB.js";import{c as rn,d as an}from"./chunk-5PDQ5UNO.js";import"./chunk-O22HDFH6.js";import"./chunk-AQKJ3LSN.js";import{a as Ft}from"./chunk-UX4QS4XQ.js";import"./chunk-SCAKRK4B.js";import{a as Je,b as ft}from"./chunk-HAXEFEKW.js";import"./chunk-6G7LPAEQ.js";import{a as ba}from"./chunk-3DUSH3ND.js";import{a as dn}from"./chunk-SXRKKO75.js";import"./chunk-LGD5WUG2.js";import"./chunk-NQX7EX5A.js";import"./chunk-ZBHPM2JC.js";import"./chunk-P3KIIKY4.js";import{a as Hr,b as oa,c as ra}from"./chunk-VRKJC53Z.js";import{a as Ki}from"./chunk-NJ4KEQKH.js";import{a as da}from"./chunk-27OXTS7Y.js";import"./chunk-JOLAOKHD.js";import"./chunk-BYXBJQAS.js";import{a as ei}from"./chunk-Y4MERAVA.js";import{a as Me,b as Co,d as Gi}from"./chunk-7BVPHIEF.js";import{a as ho}from"./chunk-PF33HK6M.js";import"./chunk-5UDUWK67.js";import"./chunk-PNFJVQUF.js";import{a as _o}from"./chunk-25H27N7N.js";import{a as zr,b as nn}from"./chunk-4L4MSVOU.js";import{a as cn,b as ca,c as pa}from"./chunk-6WMEGLEF.js";import{a as gt,b as Zt}from"./chunk-5RFSSCAR.js";import{a as Zr}from"./chunk-WFVMID6Q.js";import"./chunk-FINTUPRM.js";import{a as Fr}from"./chunk-4USQPLEW.js";import"./chunk-J6U6UYNI.js";import{b as qi,c as ot}from"./chunk-NSNUUKNK.js";import{b as Fe}from"./chunk-EN2Y56CS.js";import"./chunk-Z3E24JZW.js";import"./chunk-BYXBJQAS.js";import{c as bi}from"./chunk-PXDS3HXW.js";import{a as Qi}from"./chunk-NQKVYQ6V.js";import{a as $i,b as Ji}from"./chunk-PSFQWURP.js";import{a as Br}from"./chunk-3XH2STFE.js";import"./chunk-P3TFDLWR.js";import"./chunk-BYXBJQAS.js";import{a as Wi}from"./chunk-V4V55JMO.js";import{a as Ar,b as Lr}from"./chunk-IDJEXQ5I.js";import"./chunk-DODZXMH2.js";import"./chunk-EZNBK62W.js";import{b as Bi,c as Pt,d as Ot,e as zt}from"./chunk-3MAZIRSX.js";import{a as br}from"./chunk-75FYOZH7.js";import"./chunk-CVN6ZXXJ.js";import{e as Vr}from"./chunk-AHTR7XKG.js";import"./chunk-NS6IC2PT.js";import"./chunk-3RK6DDJD.js";import"./chunk-SMEVWRVE.js";import"./chunk-JQDS4BXR.js";import"./chunk-F3HDP5CA.js";import"./chunk-AJAUI7BA.js";import"./chunk-MWGICBEB.js";import{d as Hi,e as Ui}from"./chunk-ODYEJFNJ.js";import"./chunk-WSWTWRKJ.js";import{b as Tr,c as Er,d as Rr,e as Nr}from"./chunk-MJCLLJBB.js";import"./chunk-OB6KFXD6.js";import"./chunk-QJ3CWKQT.js";import"./chunk-ZOYWCF3Q.js";import{c as fr}from"./chunk-SWF6XISV.js";import"./chunk-GXAF3JUO.js";import"./chunk-LB5UXGDG.js";import"./chunk-YDL2MTWE.js";import"./chunk-7YYWBCWJ.js";import"./chunk-CCIHCGP5.js";import{a as ht,c as mt}from"./chunk-FM7BHGBW.js";import{a as gr,c as Cr,e as _r}from"./chunk-TP6ZUC53.js";import{a as Dr,c as wr,d as kr}from"./chunk-RWW55Z7V.js";import{a as hr,b as vr}from"./chunk-XPM7J5AN.js";import"./chunk-E634BI4W.js";import{a as pr}from"./chunk-BAXZ74LK.js";import{C as Ir,D as Ye,F as Yt,G as It,u as B,v as j,w as ge}from"./chunk-3ZH3XK5V.js";import{b as se,c as Ke}from"./chunk-V6D6TV7B.js";import{F as Or,N as Kt,O as be,a as Sr,b as yr,n as ji,t as xr,u as Mr,x as Pr}from"./chunk-QWLNF7VL.js";import{a as tr}from"./chunk-UIVJ2JQT.js";import"./chunk-EQLHPWVB.js";import{d as _t}from"./chunk-SCGKVOSE.js";import{e as F,f as Le,g as ae}from"./chunk-N5RDRDT7.js";import{N as dr,ca as mr,ea as ur}from"./chunk-N7OS7SFI.js";import"./chunk-4HLKKTIV.js";import"./chunk-RIZ4YVMH.js";import{a as Ae}from"./chunk-2FWFPV5I.js";import"./chunk-Z76C52NM.js";import{A as Jt,D as sr,F as fe,G as qe,a as ir,b as $t,c as z,d as nr,e as Lt,g as or,h as Q,j as rr,l as pt,m as ar,o as ee,r as lr,s as dt}from"./chunk-7MRUPBXU.js";import{a as qt,c as Gt}from"./chunk-ABOSNV75.js";import{a as cr}from"./chunk-RT7OZJYZ.js";import"./chunk-5RYL4EJ2.js";import{b as Mt}from"./chunk-KBLVOO4J.js";import{a as S}from"./chunk-WUV22SZ4.js";import{a as er}from"./chunk-H6RHVRGW.js";import{p as X,s as $e}from"./chunk-TANYEHMZ.js";import{$b as ye,$c as Ko,Ab as g,Ac as T,Ad as Yo,Bc as me,Ca as E,Cb as C,Cc as hi,Db as gi,E as oe,Eb as pe,Fb as ie,Gb as ne,Ha as Bo,Hb as m,Hc as v,I as fi,Ib as r,Ic as M,Ja as jo,Jb as a,Jc as Z,Kb as h,Kc as Ne,Lb as Ct,M as Vo,Mb as lt,N as jt,Nc as yt,Nd as Xo,Ob as Ue,Pb as We,Pd as Zo,Qa as ki,Qb as Ci,Qc as Go,Rb as y,Rd as xt,Sa as tt,Sd as Wt,Ub as _,Ud as Qt,Va as it,Vb as fo,Vc as Ni,Wb as c,Wc as zo,Xa as s,Y as Ht,Ya as He,_b as Se,aa as Re,ac as xe,c as Eo,cc as Qo,d as q,da as k,db as Ho,dc as qo,e as mo,eb as d,ec as nt,fa as Ie,fc as go,gc as $o,ib as P,ic as le,id as H,jb as St,jc as p,k as Ro,ka as Ao,kb as Ti,kc as w,kd as Vi,la as at,lc as x,ld as Ut,ma as vt,mb as Ei,mc as Te,nc as Jo,o as uo,oa as N,ob as K,oc as O,od as Ai,pa as G,pc as I,pd as Li,qc as D,qd as Ve,sd as Qe,t as et,ta as u,u as wi,ua as f,uc as _i,ud as Y,vb as Uo,vc as Ri,wb as Wo,wd as Fi,xa as Lo,xd as re,ya as Fo,yc as st,z as No,zc as ct}from"./chunk-L3U6V3BF.js";import"./chunk-WFMAM73Y.js";import{k as To}from"./chunk-SNAKHGZS.js";var un=class{ID;Code;Name;Title;Field;Address;ContactInfo;Logo;FooterLeft;FooterRight;FooterNote;PrintMode;PrintLX300;DeliveryNote;AppendQR;ItemRenderMode;CssClass;RemoveImage;DisplayName;DisplayNameCode};var ti=class{ParkLabel;Note;NumberOfPerson;ID;Alias;Created;CustomerDisplay;Number;Duration};var fn=class n{constructor(t,e,i,o,l,b){this.dialogRef=t;this._orderProcessorService=e;this._posService=i;this.salesOrderService=o;this.parkService=l;this.data=b;this.initModalDialog(),this.initConfig(),this.parkLabel=b.ParkLabel,this.form.ParkLabel=b.ParkLabel,this.form.Note=o.Data.Order.Note}modalConfig=new B;labelPlaceholder;form=new ti;parkLabel;initConfig(){let t=this._posService.Data.AppConfigJSON;this.labelPlaceholder=t.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkLabelPlaceholder}initModalDialog(){this.modalConfig.title=this.data.title,this.modalConfig.customWidth="600px"}onOk(){this.setParkTitle(),this.parkService.park(this.form).subscribe(t=>{this.dialogRef.close(!0)})}setParkTitle(){let t=this._orderProcessorService.Data.posState,e=this.salesOrderService.Data.Order.Number;t==5?this.salesOrderService.Data.SplitParkLabel=S.IsEmpty(this.parkLabel)?e:this.parkLabel:S.IsEmpty(this.parkLabel)?this.form.ParkLabel=e:this.form.ParkLabel=this.parkLabel}static \u0275fac=function(e){return new(e||n)(d(F),d(U),d(A),d(R),d(ke),d(Le))};static \u0275cmp=P({type:n,selectors:[["POS-modal-park-input"]],standalone:!1,decls:17,vars:3,consts:[[3,"onCancel","onOk","onClose","config"],[1,"ods-info-box"],[1,"fas","fa-info-circle",2,"font-size","1.2rem","margin-top","2px"],["href","https://ods.dealpos.app","target","_blank",2,"color","#0d6efd","font-weight","600","text-decoration","underline"],[1,"w-100","mt-4"],[1,"mb-3"],["type","text","required","","placeholder","E.g. Mr. John Doe","matTooltip","Same as Order Number when blank",1,"form-control","w-100","height-input",3,"ngModelChange","ngModel"],["placeholder","ex: Customer will return tommorow",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onCancel",function(){return i.dialogRef.close()})("onOk",function(){return i.onOk()})("onClose",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1),h(3,"i",2),r(4,"div"),p(5," Use our "),r(6,"a",3),p(7," Order Display Fulfillment System "),a(),p(8," to view the Parked Orders from your warehouse area. "),a()(),r(9,"div",4)(10,"strong",5),p(11,"Label"),a(),r(12,"input",6),D("ngModelChange",function(l){return I(i.parkLabel,l)||(i.parkLabel=l),l}),a()(),r(13,"div",4)(14,"strong",5),p(15,"Note"),a(),r(16,"POS-tinymce-editor",7),D("ngModelChange",function(l){return I(i.form.Note,l)||(i.form.Note=l),l}),a()()()()),e&2&&(m("config",i.modalConfig),s(12),O("ngModel",i.parkLabel),s(4),O("ngModel",i.form.Note))},dependencies:[z,Q,Jt,ee,j,se,gt],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 Cn=class n{constructor(t){this._dialogRef=t;this.modalConfig=new B,this.modalConfig.title="Select Print Type",this.modalConfig.hideFooter=!0}modalConfig;onPrintOrder(){this._dialogRef.close("ORDER")}onPrintBill(){this._dialogRef.close("BILL")}static \u0275fac=function(e){return new(e||n)(d(F))};static \u0275cmp=P({type:n,selectors:[["POS-modal-print"]],standalone:!1,decls:17,vars:1,consts:[[3,"onCancel","onClose","config"],[1,"d-flex"],[1,"btn","btn-gray","btn-lg","me-1",3,"click"],["src","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()}),h(4,"img",3),r(5,"h4",4),p(6,"Order"),a(),r(7,"div",5),p(8,"For order for the kitchen"),a()(),r(9,"a",6),_("click",function(){return i.onPrintBill()}),h(10,"img",7),r(11,"h4",4),p(12,"Bill"),a(),r(13,"div",5),p(14,"To see amount of the bill"),a(),r(15,"div",5),p(16,"(Pre-settlement bill)"),a()()()()()),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 Xa=n=>({"mat-tab-group-height":n});function Za(n,t){if(n&1){let e=y();r(0,"div",2)(1,"div",6)(2,"span",7),h(3,"i",8),a(),r(4,"input",9),D("ngModelChange",function(o){u(e);let l=c();return I(l.filter,o)||(l.filter=o),f(o)}),a()()()}if(n&2){let e=c();s(4),O("ngModel",e.filter)}}function el(n,t){if(n&1&&(r(0,"h5",14),h(1,"i"),r(2,"span"),p(3),a()()),n&2){let e=c().$implicit;s(),le(e.Icon),s(2),w(e.Name)}}function tl(n,t){if(n&1){let e=y();r(0,"div",13)(1,"park-card",15),_("onSelect",function(){let o=u(e).$implicit,l=c(2);return f(l.onSelect(o))}),a()()}if(n&2){let e,i=t.$implicit,o=c().$implicit,l=c();s(),m("title",l.replaceWithAlias()&&i.Alias?i.Alias:i.Name)("alias",i.Alias)("isOccupied",i.IsOccupied)("icon",o.Icon)("selected",((e=l.parkOptionSelected())==null?null:e.Name)===i.Name)}}function il(n,t){if(n&1&&(r(0,"mat-tab",4),K(1,el,4,3,"ng-template",10),r(2,"div",11)(3,"div",12),ie(4,tl,2,5,"div",13,gi),v(6,"Filter"),a()()()),n&2){let e=t.$implicit,i=c();m("label",e.Name),s(4),ne(Ne(6,1,e.Options,i.filter(),"Name"))}}function nl(n,t){if(n&1){let e=y();r(0,"div",5)(1,"POS-tinymce-editor",16),D("ngModelChange",function(o){u(e);let l=c();return I(l.parkNote,o)||(l.parkNote=o),f(o)}),a()()}if(n&2){let e=c();s(),O("ngModel",e.parkNote)}}var ni=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=G(F);posService=G(A);modalConfig=new B;filter=E("");parkLayout=E(null);parkOptionSelected=E(null);replaceWithAlias=E(!1);showInputNote=E(!1);parkNote=E("");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(Le))};static \u0275cmp=P({type:n,selectors:[["app-modal-park"]],decls:8,vars:6,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container",2,"max-height","395px","min-height","395px"],[1,"search-container"],["mat-stretch-tabs","false",1,"mt-2",3,"ngClass"],[3,"label"],[1,"mt-4"],[1,"input-group","w-100"],[1,"input-group-text","txtFilter","rounded-start-1"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["type","text","placeholder","Search by number or note","aria-label","Search",1,"txtFilter","form-control","border-start-0","rounded","rounded-start-0",3,"ngModelChange","ngModel"],["mat-tab-label",""],[1,"container","mt-5"],[1,"row"],[1,"col-3","mb-4","px-2"],[1,"d-flex","align-items-center","gap-3"],[3,"onSelect","title","alias","isOccupied","icon","selected"],["height","180px","placeholder","Input the park note (E.g. this is for Mr. John)",3,"ngModelChange","ngModel"]],template:function(e,i){if(e&1&&(r(0,"modal-material",0),_("keydown.F2",function(){return i.onOk()})("onOk",function(){return i.onOk()})("onCancel",function(){return i.onCancel()})("onClose",function(){return i.onCancel()}),r(1,"content")(2,"div",1),g(3,Za,5,1,"div",2),r(4,"mat-tab-group",3),ie(5,il,7,5,"mat-tab",4,gi),a(),g(7,nl,2,1,"div",5),a()()()),e&2){let o,l,b;m("config",i.modalConfig),s(3),C(((o=i.parkLayout().Layout)==null?null:o.length)>0?3:-1),s(),m("ngClass",T(4,Xa,i.showInputNote()&&((l=i.parkOptionSelected())==null?null:l.Name))),s(),ne(i.parkLayout().Layout),s(2),C(i.showInputNote()&&((b=i.parkOptionSelected())!=null&&b.Name)?7:-1)}},dependencies:[re,H,ge,j,Gr,Kt,fe,z,Q,ee,zt,Bi,Pt,Ot,Zt,gt,Mr],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 _n=class n{constructor(t,e,i,o,l,b,V,J,ve){this.dialogRef=t;this.parkOrderRetrieve=e;this._orderDataService=i;this._posHttpResponseService=o;this._orderProcessorService=l;this._orderHttpService=b;this._dialog=V;this._outletRegisterService=J;this.parkService=ve;this.salesOrderData=this._orderDataService.Data,this.appConfig=this._posHttpResponseService.Data.AppConfigJSON,this.parkLayoutPack=this._outletRegisterService.Data.ParkLayoutPack}modalConfig=new B;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(ni,{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(F),d(Le),d(R),d(A),d(U),d(De),d(ae),d($),d(ke))};static \u0275cmp=P({type:n,selectors:[["POS-modal-repark"]],standalone:!1,decls:13,vars:2,consts:[[3,"onClose","onCancel","title","config"],[1,"d-flex"],[1,"btn","btn-gray","btn-lg",3,"click"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onClose",function(){return i.dialogRef.close()})("onCancel",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1)(3,"a",2),_("click",function(){return i.onRepark()}),r(4,"h4"),p(5,"Re-Park"),a(),r(6,"span"),p(7,"Store order to same location"),a()(),r(8,"a",2),_("click",function(){return i.onMove()}),r(9,"h4"),p(10,"Move"),a(),r(11,"span"),p(12,"Shift order to Different location"),a()()()()()),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 oi=class{Name;Alias;IsOccupied;Note};var hn=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 Si=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 hn,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 bi,this.Title="",this.TypeName="",this.PaymentState=0,this.Number="",this.Created="",this.AfterSell=!0}};var ri=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 oi;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 bn=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 vn=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,l,b,V,J){this._posService=t;this._orderDataService=e;this._cashierCalculatorService=i;this._outletService=o;this._OrderHttpService=l;this._receiptCalculatorService=b;this._orderProcessorService=V;this._customerHttpService=J;this.subscribeToObservableChanges()}posData;completeData;park=new ri(null);outletInfo=new Gi;datePipe=new Qe("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 Si;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 console.log(t),t}generateQrContent(){let t="";if(this.AppConfigJSON?.PrintConfigInvoice?.InvoiceQR?.TransformTo==3){let i=this.AppConfigJSON?.PrintConfigInvoice?.InvoiceQR?.Content,o=this.posData?.Order?.Number,l=this.completeData.ObjectID,b=window?.location?.host;switch(i){case 2:t=l;break;case 1:t=o;break;case 3:t=`receipt.dealpos.app?Data=${btoa(`${l}_${b}`)}`;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 bn;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=ot(Fe,this.posData.CartItems);if(e){let o=this.posData.CartItems.filter(l=>S.IsNotEmpty(l.SplitQuantity)&&l.SplitQuantity>0);this.CartItems=o.map(l=>(l.Quantity=l.SplitQuantity,l))}else if(t&&this.AppConfigJSON.ApplicationParkAndRetrieve.PrintBehaviour.PrintAdditionalItemsOnlyOnRePark)if(this.CartItems=Array(),this.ParkTemp.length>0)for(let o of i){let l=this.ParkTemp.find(b=>b.ID==o.ID);l==null?this.CartItems.push(o):o.Quantity!=l.Quantity&&(o.Quantity=o.Quantity-l.Quantity,this.CartItems.push(o))}else this.CartItems=i;else this.CartItems=i}generateBillInvoice(){let t=new vn;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 Si;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,l=1;e?.length>0&&i<o&&(l=2);let b=i-o;return(Math.abs(b)<=t||b>=0)&&(l=3),l}generateTop(t,e){let i=new Date(e),o=new Date(t),l=i.getTime()-o.getTime();return Math.floor(l/(1e3*3600*24))}getSubmitedOrderDate(){let t=this.posData.Order?.Date,e=this.AppConfigJSON.PrintConfigInvoice?.DocumentVisibility?.OrderTimeVisible,i="",o=new Date;if(e){let l=new Date(t);l.setHours(o.getHours()),l.setMinutes(o.getMinutes()),i=this.datePipe.transform(l,"dd MMM yyyy HH:mm")}else i=this.datePipe.transform(t,"dd MMM yyyy");return i}getSubmitedCustomer(){return S.IsEmpty(this.completeData)?{}:this.completeData.Contact}getParkLabel(){let t=this.AppConfigJSON.ApplicationParkAndRetrieve.PrintOutput.LabelPrefix,e=this.AppConfigJSON.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,i=this.posData.Order.ParkLabel;if(S.IsNotEmpty(this.posData.SplitParkLabel)&&(i=this.posData.SplitParkLabel),e&&S.IsNotEmpty(i)){let o=this.park.GetAlias(i);i=o||i}return i?S.IsEmpty(t)?i:S.StringFormat("{0} # {1}",t,i):""}GetSubmittedNumber(){return S.IsNotEmpty(this.completeData)?this.completeData.InvoiceNumber:this.posData.Invoice.Number?this.posData.Invoice.Number:this.posData.Order.Number}generateCartItemSummary(){let t=[];for(let e of this.posData.CartItems)t.push(new Xi(e.Total,this._cashierCalculatorService.currencySymbol,e.Variant.Name,1));return t}generatePaymentSummary(){let t=[],e;for(let o=0;o<this.posData.Payments.length;o++){let l="Payment"+(o+1);this.AppConfigJSON.PrintConfigInvoice.Footer.PaymentMethodVisible&&(l=this.findPaymentName(Number(this.posData.Payments[o].MethodID))),e=new Xi(this.posData.Payments[o].PaidAmount,this._cashierCalculatorService.currencySymbol,l,1),t.push(e)}let i=this.generateChangeSummary();return i!==null&&t.push(i),t}generateChangeSummary(){let t=this._cashierCalculatorService.currencySymbol,e=this._cashierCalculatorService.Data,i=this.posData.TotalPaidAmount,o=0,l=null;return o=i-e,o>0&&(l=new Xi(o,t,"Change",1)),l}findPaymentName(t){return this._outletService.Data.Payments.find(e=>e.ID==t).Name}printWindow(){return To(this,null,function*(){return new Promise(t=>{setTimeout(()=>{window.print(),t()},500)})})}static \u0275fac=function(e){return new(e||n)(N(A),N(R),N(Ce),N($),N(De),N(Zi),N(U),N(ft))};static \u0275prov=at({token:n,factory:n.\u0275fac,providedIn:"root"})};var ke=class n{constructor(t,e,i,o,l,b,V,J,ve,Be){this.httpService=t;this.receiptService=e;this.orderProcessorService=i;this.pageInitialService=o;this.salesOrderService=l;this.toastrService=b;this.promotionEventService=V;this.outletService=J;this.orderHttpService=ve;this.dialog=Be;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(be.GetPark,[{key:"EntityID",value:t},{key:"RegisterID",value:e}])}removeOrder(t,e){let i={OrderID:t};return e?this.httpService.post(be.VoidPark,i):this.httpService.post(be.RemovePark,i)}mergePark(t){return this.httpService.post(be.MergePark,t)}getOutstanding(t){let e={EntityID:t};return this.httpService.post(be.GetOutStanding,e)}splitOrder(t){return this.httpService.post(be.SplitOrder,t)}park(t){let e=ot(ut,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(be.ParkOrder,i).pipe(Ie(o=>{this.orderProcessorService.updatePosState(3,o),this.orderProcessorService.createNewTransactionInSameOutletRegister(!0)}))}clearPromotionAppliedInPark(){this.dialog.open($r,{id:"modal-promotion-confirm",data:{message:`
|
|
2
2
|
Promotion cannot be applied when Park,
|
|
3
3
|
Order will be restored to before the promotion is applied
|
|
4
|
-
`},disableClose:!0})}parkOrder(){let t=this.salesOrderService.Data,e=this.pageInitialService.Data.AppConfigJSON;if(t.CartItems.length==0){this.toastrService.warning("You must have at least one item","No Item in Cart!");return}if(!(!this.validateCustomerRequired(e,t)||!this.validateUsedPromotion(t))){if(S.IsEmpty(t.Order.RegisterID)){this.toastrService.warning(Ir.emptyEntity,Ae.Warning);return}this.validateShowParkModal()}}validateCustomerRequired(t,e){return t.ModuleSell.Header.CustomerRequired&&e.Order.CustomerID==null?(this.toastrService.warning("Customer is needed before parking orders!","Missing customer!"),!1):!0}validateUsedPromotion(t){let e=this.promotionEventService.selectedPromotion;return S.IsNotEmpty(e)||S.IsNotEmpty(t.Order.PromotionCoupon)?(this.toastrService.warning("Orders with applied promotions or coupons cannot be parked!","Park Not Allowed!"),!1):!0}validateShowParkModal(){let t=this.outletService.Data.ParkLayoutPack,e=this.pageInitialService.Data.AppConfigJSON,i=this.salesOrderService.Data;if(t&&S.IsNotEmpty(t.ID))this.orderProcessorService.Data.posState==4?this.showReparkModal():this.showParkSelectModal(e,i);else{if(!this.validateRetrieveMode(e))return;this.setDefaultParkNote(e),this.showParkInputModal()}}showParkSelectModal(t,e){let i=this.orderProcessorService.Data,o=this.outletService.Data.ParkLayoutPack;this.orderHttpService.getVacant(e.Order.EntityID).subscribe(l=>{let b=t.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkDialogTitle,V=i.posState==5,G=t.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,ve=V?"Split Order":b;this.dialog.open(ni,{data:{title:ve,parkLayoutPack:this.generateParkLayoutOptions(o,l.Orders),replaceWithAlias:G,orderNote:e.Order?.Note}}).afterClosed().pipe(oe(Be=>S.IsNotEmpty(Be)),Re(Be=>{let je=new ti;return je.ParkLabel=Be.Name,je.Note=Be.Note,this.park(je)})).subscribe()})}showReparkModal(){this.dialog.open(_n,{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(fn,{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(Cn).afterClosed().pipe(oe(t=>S.IsNotEmpty(t))).subscribe(t=>{t=="ORDER"?this.emitParkReceipt(!1,!1,!0):this.emitBillReceipt()})}emitParkReceipt(t,e=!1,i=!1){let o=this.receiptService.generateParkReceipt(t,e);(this.pageInitialService.Data.AppConfigJSON.ApplicationParkAndRetrieve?.PrintBehaviour?.PrintAfterPark||i)&&this._onPrint.next({type:"PARK",template:o})}emitBillReceipt(){let t=this.outletService.Data,e;1==t.PrintTemplate.PrintMode?(e=this.receiptService.generateBillInvoice(),this._onPrint.next({type:"BILL_A4",template:e})):(e=this.receiptService.generateBillReceipt(),this._onPrint.next({type:"BILL_MINI",template:e}))}generateParkLayoutOptions(t,e=[]){return t.Layout=t.Layout.map(i=>{i.Options=[];for(let o=1;o<=i.Size;o++){let l=new oi;l.Name=i.Name+o,l.Alias=this.generateAlias(t,l.Name),l.IsOccupied=this.IsOccupied(l.Name,e),i.Options.push(l)}return i}),t}generateAlias(t,e){let i="";if(t.Alias){let o=t.Alias.filter(l=>l.Name==e);o.length>0&&(i=`${o[0]?.Alias}`)}return i}IsOccupied(t,e){let i=e.filter(l=>l.ParkLabel==t),o=!1;return i.length>0&&(o=!0),o}static \u0275fac=function(e){return new(e||n)(N($e),N(Et),N(U),N(A),N(R),N(X),N(Xt),N($),N(De),N(ae))};static \u0275prov=at({token:n,factory:n.\u0275fac,providedIn:"root"})};var Sn=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=St({type:n});static \u0275inj=vt({imports:[re,fe,Gi,It,zr,zt,Qt,Kt,Ke,nn]})};var ka=n=>({"opacity-50":n});function al(n,t){if(n&1){let e=y();r(0,"div",5)(1,"h6",6),p(2,"Verify Via"),a(),r(3,"div",7)(4,"button",8),_("click",function(){u(e);let o=c();return f(o.onChooseVerifyType("phone"))}),r(5,"div",9)(6,"div"),h(7,"i",10),a(),r(8,"div",11),p(9),a()()()(),r(10,"div",12)(11,"button",8),_("click",function(){u(e);let o=c();return f(o.onChooseVerifyType("email"))}),r(12,"div",9),h(13,"i",13),r(14,"div",11),p(15),a()()()(),r(16,"div",12)(17,"button",14),_("click",function(o){return u(e),c().onChooseVerifyType("pin"),f(o.preventDefault())}),r(18,"div",9),h(19,"i",15),r(20,"div",16),p(21,"Use PIN"),a()()()()()}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,ka,!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,ka,!e.email)),s(),x(" ",e.email?e.email:"Email is not registered"," ")}}function ll(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"),a(),p(6,","),a(),r(7,"div"),p(8," Please read this "),r(9,"a",20),p(10,"article"),a(),p(11," to turn on "),a()()(),r(12,"div")(13,"div",21)(14,"button",22),_("click",function(){u(e);let o=c();return f(o.onRedeem())}),p(15,"Redeem"),a()()()}}var yn=class n{toastrService=J(X);onVerify=new He;pointUsedChange=new He;redeemEvent=new He;isVerifyEnabled=!1;phone;email;pointUsed;pointBalance;onPointUsedChange(){this.pointUsedChange.emit(this.pointUsed)}ngAfterViewInit(){this.setFocusInput()}setFocusInput(){setTimeout(()=>{document.getElementById("pointInput")?.focus()},300)}onChooseVerifyType(t){this.checkPointUsed()&&this.onVerify.emit(t)}onRedeem(){this.checkPointUsed()&&this.redeemEvent.emit()}checkPointUsed(){return S.IsEmpty(this.pointUsed)||this.pointUsed<=0?(this.toastrService.warning("Please enter the points before redeeming!","Field Input Required!"),this.setFocusInput(),!1):!0}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["point-step"]],inputs:{isVerifyEnabled:"isVerifyEnabled",phone:"phone",email:"email",pointUsed:"pointUsed",pointBalance:"pointBalance"},outputs:{onVerify:"onVerify",pointUsedChange:"pointUsedChange",redeemEvent:"onRedeem"},decls:13,vars:6,consts:[[1,"d-flex","align-items-center","justify-content-center"],[1,"me-3"],["type","text","autoNum","","id","pointInput",1,"form-control","input-point",3,"ngModelChange","ngModel","max"],[1,"me-3","d-flex","align-items-center","justify-content-center"],[1,"fs-1"],[1,"mt-8"],[1,"mb-6","text-center"],[1,"text-center"],["type","button",1,"btn","btn-light","btn-sm","p-3","w-75",3,"click","disabled"],[1,"d-flex","align-items-center"],[1,"fa-brands","fa-whatsapp","fs-2","ps-2",2,"color","#25d366"],[1,"fs-5","w-100",3,"ngClass"],[1,"mt-4","text-center"],[1,"ps-2","fa-solid","fa-envelope","fs-3",2,"color","#c71610"],["type","button","matTooltip","Inform the customer to download the Brand Loyalty App and setup PIN in Profile Menu to authorize Point Redemption","matTooltipPosition","right","matTooltipClass","primary-tooltip",1,"btn","btn-light","btn-sm","p-3","w-75",3,"click"],[1,"ps-2","fa-solid","fa-key","fs-3"],[1,"fs-5","w-100"],[1,"mt-8","d-flex","justify-content-center"],[1,"text-center","alert","alert-warning","py-4","px-8","mb-0"],[1,"fw-bold","text-danger",2,"font-size","13px"],["href","https://support.dealpos.com/en/articles/9158486-redeem-loyalty-point-authorization-using-otp","target","_blank"],[1,"d-flex","justify-content-center","mt-12"],[1,"btn","btn-success",3,"click"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1)(2,"input",2),D("ngModelChange",function(l){return I(i.pointUsed,l)||(i.pointUsed=l),l}),_("ngModelChange",function(){return i.onPointUsedChange()}),a()(),r(3,"div",3)(4,"span",1),p(5,"Of"),a(),r(6,"span",4),p(7),v(8,"number"),a()(),r(9,"div"),p(10,"Points"),a()(),g(11,al,22,10,"div",5)(12,ll,16,0)),e&2&&(s(2),O("ngModel",i.pointUsed),m("max",i.pointBalance),s(5),w(M(8,4,i.pointBalance)),s(4),C(i.isVerifyEnabled?11:12))},dependencies:[re,H,ht,mt,fe,z,Q,ee,Ke,se,Y],styles:[".input-point[_ngcontent-%COMP%]{width:120px;height:44px;font-size:1.375rem;text-align:center}"]})};var sl=n=>({"error-input":n});function cl(n,t){if(n&1&&(r(0,"span"),p(1),a()),n&2){let e=c(3);s(),x(" ",e.config.separator," ")}}function pl(n,t){if(n&1){let e=y();Ue(0),r(1,"input",5,0),_("paste",function(o){u(e);let l=c(2);return f(l.handlePaste(o))})("keyup",function(o){let l=u(e).index,b=c(2);return f(b.onKeyUp(o,l))})("input",function(o){let l=u(e).index,b=c(2);return f(b.onInput(o,l))})("keydown",function(o){let l=u(e).index,b=c(2);return f(b.onKeyDown(o,l))}),a(),K(3,cl,2,1,"span",6),We()}if(n&2){let e=t.$implicit,i=t.index,o=t.last,l=c(2);s(),le(Ri("otp-input ",l.config.inputClass)),m("pattern",l.config.allowNumbersOnly?"\\d*":"")("type",l.inputType)("placeholder",(l.config==null?null:l.config.placeholder)||"")("ngStyle",l.config.inputStyles)("formControl",l.otpForm.controls[e])("id",l.getBoxId(i))("ngClass",T(11,sl,(l.config==null?null:l.config.showError)&&(l.formControl==null?null:l.formControl.invalid)&&((l.formControl==null?null:l.formControl.dirty)||(l.formControl==null?null:l.formControl.touched)))),s(2),m("ngIf",l.config.separator&&!o)}}function dl(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),K(2,pl,4,13,"ng-container",4),a()()}if(n&2){let e=c();le(Ri("ng-otp-input-wrapper wrapper ",e.config.containerClass)),m("id",Ri("c_",e.componentKey))("ngStyle",e.config.containerStyles),s(2),m("ngForOf",e.controlKeys)}}var bt=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)}},yi=class{static keys(t){return t?Object.keys(t):[]}},Mo=(()=>{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 yi.keys(this.otpForm?.controls)}get formControl(){return this.formCtrl??this.inj?.get(or)}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 rr({});for(let i=0;i<this.config.length;i++)this.otpForm.addControl(this.getControlName(i),new pt);this.otpForm.valueChanges.pipe(k(this.destroy$)).subscribe(i=>{yi.keys(this.otpForm.controls).forEach(o=>{var l=this.otpForm.controls[o].value;l&&l.length>1&&(l.length>=this.config.length?this.setValue(l):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 l=this.getBoxId(o-1),b=this.getBoxId(o);if(bt.ifKey(i,"Enter")){let G=this.document.getElementById(b)?.closest("form");if(G){i.preventDefault();let ve=new Event("submit",{bubbles:!0,cancelable:!0});G.dispatchEvent(ve);return}}if(bt.ifSpacebar(i))return i.preventDefault(),!1;if(bt.ifBackspace(i)){i.target.value?this.clearInput(b,o):(this.clearInput(l,o-1),this.setSelected(l)),this.rebuildValue();return}if(bt.ifDelete(i)){i.target.value?this.clearInput(b,o):(this.clearInput(l,o-1),this.setSelected(l)),this.rebuildValue();return}}hasVal(i){return i!=null&&i!=null&&(!i?.trim||i.trim()!="")}onInput(i,o){let l=this.hasVal(this.currentVal)?`${this.currentVal}${i.target.value}`:i.target.value;if(this.config.allowNumbersOnly&&!this.validateNumber(l)){i.target.value=null,i.stopPropagation(),i.preventDefault(),this.clearInput(null,o);return}if(this.ifValidKeyCode(null,i.target.value)){let b=this.getBoxId(o+1);this.setSelected(b),this.rebuildValue()}else{i.target.value=null;let b=this.getControlName(o);this.otpForm.controls[b]?.setValue(null),this.rebuildValue()}}onKeyUp(i,o){bt.ifTab(i)&&(o-=1);let l=this.getBoxId(o+1),b=this.getBoxId(o-1);if(bt.ifRightArrow(i)){i.preventDefault(),this.setSelected(l);return}if(bt.ifLeftArrow(i)){i.preventDefault(),this.setSelected(b);return}}validateNumber(i){return i&&/^[0-9]+$/.test(i)}getBoxId(i){return`otp_${i}_${this.componentKey}`}clearInput(i,o){let l=this.getControlName(o);if(this.otpForm.controls[l]?.setValue(null),i){let b=this.document.getElementById(i);b&&b instanceof HTMLInputElement&&(b.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 l=o??i.key;return this.config?.allowNumbersOnly?this.validateNumber(l):/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)||/^[a-zA-Z0-9%*_\-@#$!]$/.test(l)&&l.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,l)=>{this.otpForm.get(this.getControlName(l))&&this.otpForm.get(this.getControlName(l)).setValue(o)}),this.config.disableAutoFocus||setTimeout(()=>{let o=this.document.getElementById(`c_${this.componentKey}`);var l=i.length<this.config.length?i.length:this.config.length-1;let b=o.getElementsByClassName("otp-input")[l];b&&b.focus&&setTimeout(()=>{b.focus()},1)},0),this.rebuildValue()}}rebuildValue(){let i=null;yi.keys(this.otpForm.controls).forEach(o=>{let l=this.otpForm.controls[o].value;if(l){let b=l.length>1,V=!this.config.allowNumbersOnly&&this.config.letterCase&&(this.config.letterCase.toLocaleLowerCase()=="upper"||this.config.letterCase.toLocaleLowerCase()=="lower");l=l[0];let G=V?this.config.letterCase.toLocaleLowerCase()=="upper"?l.toUpperCase():l.toLowerCase():l;V&&G==l?V=!1:l=G,i==null?i=l:i+=l,(b||V)&&this.otpForm.controls[o].setValue(l)}}),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 l=o.getData("Text");i.stopPropagation(),i.preventDefault(),!(!l||this.config.allowNumbersOnly&&!this.validateNumber(l))&&this.setValue(l)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}};t.\u0275fac=function(o){return new(o||t)(d(Fo),d(Lo))},t.\u0275cmp=P({type:t,selectors:[["ng-otp-input"],["ngx-otp-input"]],inputs:{config:"config",formCtrl:"formCtrl",disabled:"disabled"},outputs:{onBlur:"onBlur",onInputChange:"onInputChange"},features:[st([{provide:ir,useExisting:Ao(()=>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,l){o&1&&K(0,dl,3,7,"div",1),o&2&&m("ngIf",l.otpForm==null?null:l.otpForm.controls)},dependencies:[qe,z,Q,sr,dt,Ut,Vi,Ai,H],styles:[".otp-input[_ngcontent-%COMP%]{width:50px;height:50px;border-radius:4px;border:solid 1px #c5c5c5;text-align:center;font-size:32px}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]{margin:0 .51rem}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]:first-child{margin-left:0}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]:last-child{margin-right:0}.n-o-c[_ngcontent-%COMP%]{display:flex;align-items:center}.error-input[_ngcontent-%COMP%]{border-color:red}@media screen and (max-width: 767px){.otp-input[_ngcontent-%COMP%]{width:40px;font-size:24px;height:40px}}@media screen and (max-width: 420px){.otp-input[_ngcontent-%COMP%]{width:30px;font-size:18px;height:30px}}"]});let n=t;return n})(),Mn=(()=>{let t=class t{};t.\u0275fac=function(o){return new(o||t)},t.\u0275mod=St({type:t}),t.\u0275inj=vt({imports:[Mo]});let n=t;return n})();function ul(n,t){if(n&1&&(r(0,"div"),p(1," OTP has been sent to "),r(2,"span",5),p(3),a()()),n&2){let e=c();s(3),w(e.contact)}}function fl(n,t){if(n&1&&h(0,"ng-otp-input",3),n&2){let e=c(2);m("formCtrl",e.otpCtrl)("config",e.otpConfig)}}function gl(n,t){if(n&1&&g(0,fl,1,2,"ng-otp-input",3),n&2){let e=c();C(e.showPinInput()?0:-1)}}function Cl(n,t){if(n&1&&h(0,"ng-otp-input",3),n&2){let e=c();m("formCtrl",e.otpCtrl)("config",e.otpConfig)}}function _l(n,t){if(n&1){let e=y();r(0,"div",4)(1,"span"),p(2,"Didn`t get a code? "),a(),r(3,"a",6),_("click",function(){u(e);let o=c();return f(o.onResendCode())}),p(4,"Click to resend"),a()()}}var Pn=class n{type;contact;clearPin=!1;onVerify=new He;resendCode=new He;showPinInput=E(!0);otpCtrl=new pt;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(Vo(300),oe(t=>t.length===6)).subscribe(t=>{this.onVerify.emit(t)})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["verify-step"]],inputs:{type:"type",contact:"contact",clearPin:"clearPin"},outputs:{onVerify:"onVerify",resendCode:"resendCode"},features:[Bo],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),a(),g(3,ul,4,1,"div"),a(),r(4,"div",2),g(5,gl,1,1)(6,Cl,1,2,"ng-otp-input",3),a(),g(7,_l,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:[Mn,Mo,qe],encapsulation:2})};function hl(n,t){if(n&1){let e=y();Ct(0,"button",7),fo("click",function(){u(e);let o=c();return f(o.onCancel())}),p(1,"Cancel"),lt()}}function bl(n,t){if(n&1){let e=y();Ct(0,"button",8),fo("click",function(){u(e);let o=c();return f(o.onConfirm())}),p(1,"Confirm"),lt()}}var On=class n{pointUsed=Ni(0);redeemPointValue=Ni(0);showCancelBtn=Ni(!1);confirmEvent=new He;cancelEvent=new He;onConfirm(){this.confirmEvent.emit()}onCancel(){this.cancelEvent.emit()}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["confirm-step"]],inputs:{pointUsed:[1,"pointUsed"],redeemPointValue:[1,"redeemPointValue"],showCancelBtn:[1,"showCancelBtn"]},outputs:{confirmEvent:"onConfirm",cancelEvent:"onCancel"},decls:19,vars:7,consts:[[1,"text-center"],[1,"fs-5"],[1,"d-flex","justify-content-center","text-success","align-items-center"],[1,"me-3",2,"font-size","1.5rem"],[1,"d-flex","justify-content-center","text-danger","align-items-center"],[1,"btn","btn-danger","mt-12"],[1,"btn","btn-success","mt-12"],[1,"btn","btn-danger","mt-12",3,"click"],[1,"btn","btn-success","mt-12",3,"click"]],template:function(e,i){e&1&&(Ct(0,"div",0)(1,"div",1),p(2,"Redeem"),lt(),Ct(3,"div",2)(4,"span",3),p(5),v(6,"number"),lt(),Ct(7,"small"),p(8,"Point"),lt()(),Ct(9,"div",1),p(10,"~"),lt(),Ct(11,"div",4)(12,"span",3),p(13),v(14,"number"),lt(),Ct(15,"small"),p(16,"Discount"),lt()(),g(17,hl,2,0,"button",5)(18,bl,2,0,"button",6),lt()),e&2&&(s(5),w(M(6,3,i.pointUsed())),s(8),w(M(14,5,i.pointUsed()*i.redeemPointValue())),s(4),C(i.showCancelBtn()?17:18))},dependencies:[re,Y],encapsulation:2})};var li=class n{constructor(t,e,i,o,l,b,V,G,ve,Be){this.customerHttpService=t;this.salesOrderService=e;this.pageInitialService=i;this.shoppingCartService=o;this.invoiceCalculatorService=l;this.orderProcessorService=b;this.toastr=V;this.promotionCouponService=G;this.httpService=ve;this.registerService=Be}customerId;customerData;_isCustomerVerfiedOtp=!1;get isCustomerVerfiedOtp(){return this._isCustomerVerfiedOtp}addCustomerById(t){return new Eo(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(Re(e=>(this.salesOrderService.Data.ContactName=e.Display,this.addCustomerById(e.ID))))}setSalesOrderCustomerId(t){let e=this.salesOrderService.Data,i=this.registerService.Data.ListSales,o=t.SalesID,l=i.find(b=>b.ID===o);S.IsNotEmpty(t.SalesID)&&l&&(e.Order.SalesID=t.SalesID)}setCustomerData(t){let e=this.salesOrderService.Data;if(t.EntityID==S.GuidEmpty)this.customerData=t;else if(t.EntityID!=e.Order.EntityID){e.Order.CustomerID=null,e.ContactName=null;let i=`${t?.Name} is exclusive to ${t?.EntityName} Outlet and cannot be used in other outlets!`;alert(i)}else this.customerData=t}checkResetRedeemPoint(){let t=!1;return S.IsNotEmpty(this.customerId)&&(t=!0),t}applyCustomerPricebook(t){let e=this.salesOrderService.Data;if(S.IsNotEmpty(t.PricebookID)){let i=e.CartItems.map(o=>(o.Variant.PriceBook&&o.Variant.PriceBook.length!==0&&o.Variant.PriceBook.forEach(l=>{l.ID===t.PricebookID&&o.Quantity>=l.MinimumQuantity&&(o=this.shoppingCartService.applyPricebookToItem(o,l))}),o));e.CartItems=i}}updateTaxCustomer(t){let i=this.pageInitialService.Data.Taxes.find(o=>o.ID==t);i&&(this.salesOrderService.Data.Order.TaxTypeID=i.ID,this.invoiceCalculatorService.tax=i)}resetCartOnChangeCustomer(t){let e=this.pageInitialService.Data.AppConfigJSON;this.customerId!=t&&e.ModuleSell.Customer.ClearCartOnChange&&(this.salesOrderService.Data.CartItems=[]),this.customerId=t}updateDiscountRate(t=0){if(t>0){let e=this.promotionCouponService.coupon,i=this.salesOrderService.Data.Order.Discount;e&&e.Requirement?.Type==1?i==e.Amount?t>e.Amount&&(this.toastr.warning("Member discount is applied because member discount is greater than Coupon Discount","Warning"),this.promotionCouponService.removeAppliedDiscountOnCustomerChange(),this.salesOrderService.Data.Order.Discount=t):(this.salesOrderService.Data.Order.Discount=t,this.salesOrderService.Data.Order.CustomerDiscountRate=t):(this.salesOrderService.Data.Order.Discount=t,this.salesOrderService.Data.Order.CustomerDiscountRate=t)}}applyConfigFullPriceOnly(){let t=this.filterGroupByDiscountRate(),e=this.salesOrderService.Data.CartItems;t?.OrderDiscountFullPriceProductOnly?this.filterItemWithDisc(e).length>0?e=this.applyItemsDisc(e,this.customerData.DiscountRate):this.updateDiscountRate(this.customerData.DiscountRate):this.updateDiscountRate(this.customerData.DiscountRate)}filterGroupByDiscountRate(){let e=(this.customerData?.Groups?this.customerData?.Groups:[]).filter(o=>o.OrderDiscountPercentage==this.customerData.DiscountRate),i;return e.length>1?(i=e.find(o=>o.OrderDiscountFullPriceProductOnly==!0),i||(i=e[0])):i=e[0],i}applyItemsDisc(t,e){return t=t.map(i=>(i.Discount==0&&i.DiscountAmount==0&&i.PriceTypeID!=3&&i.Price==i.UnitPrice&&S.IsEmpty(i.PriceBookID)&&(i.Discount=e,i.HasCustomerDiscount=!0),i)),t}filterItemWithDisc(t){return t.filter(i=>i.Discount>0||i.DiscountAmount>0||i.PriceTypeID==3||i.Price!=i.UnitPrice||S.IsNotEmpty(i.PriceBookID))}onEmptyInputCustomer(){S.IsNotEmpty(this.customerId)&&(this.promotionCouponService.removeAppliedDiscountOnCustomerChange(),this.resetAppliedPoint(),this.resetCustomerPricebook(),this.removeCustomerDiscountRate()),this.orderProcessorService.Data.InputTextValue="",this.customerId=JSON.parse(JSON.stringify(this.salesOrderService.Data.Order.CustomerID)),this._isCustomerVerfiedOtp=!1,this.customerData=null,this.salesOrderService.Data.ContactName=null,this.salesOrderService.Data.Order.CustomerID=null,this.customerHttpService.Data=new _o,this.customerData=new _o,this.salesOrderService.pushNewValue()}removeCustomerDiscountRate(){let t=this.filterGroupByDiscountRate(),e=this.salesOrderService.Data.CartItems;t?.OrderDiscountFullPriceProductOnly?this.filterItemWithDisc(e).length>0?this.salesOrderService.Data.CartItems=e.map(o=>(o.HasCustomerDiscount&&(o.Discount=0,o.HasCustomerDiscount=!1),o)):(this.salesOrderService.Data.Order.Discount=0,this.salesOrderService.Data.Order.CustomerDiscountRate=0):(this.salesOrderService.Data.Order.Discount=0,this.salesOrderService.Data.Order.CustomerDiscountRate=0)}resetCustomerPricebook(){if(this.customerData){let t=this.customerData.PricebookID;if(S.IsNotEmpty(t)){let e=this.salesOrderService.Data.CartItems;this.salesOrderService.Data.CartItems=e.map(i=>(i.PriceBookID==t&&(i.Discount=i.Variant.PriceDiscount,i.Note=i.Variant.PriceNote,i.PriceNote=i.Variant.PriceNote,i.PriceBookID=S.GuidEmpty,i.Price=i.Variant.UnitPrice,i.UnitPrice=i.Variant.UnitPrice),i))}}}resetAppliedPoint(){let t=this.salesOrderService.Data;t.Order.PointUsed>0&&(t.Order.PointUsed=0,t.Order.DiscountAmount=0)}redeemPoint(t){let e=this.pageInitialService.Data.AppConfigJSON,i=this.salesOrderService.Data,o=e.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,l=t*o,b=i.RedeemableAmount;l>b&&(o>0?(t=Math.ceil(b/o),l=b):(t=0,l=0),this.toastr.warning("You enter the number of points more than the total amount","Points Adjusted")),i.Order.PointUsed=t||0,i.Order.DiscountAmount=l,this.salesOrderService.pushNewValue(i)}sendOtpViaEmail(t){return this.httpService.post("/API/otp/email",{Email:t})}sendOtpViaWhatsApp(t){return this.httpService.post("/API/otp/WhatsApp",{Number:t})}verifyEmailOtp(t,e){return this.httpService.post("/API/otp/verifyemail",{Email:t,OTP:e}).pipe(Ie(()=>this._isCustomerVerfiedOtp=!0))}verifyPin(t,e){return this.httpService.post("/API/pos/VerifyPin",{PIN:t,CustomerID:e}).pipe(Ie(()=>this._isCustomerVerfiedOtp=!0))}verifyWhatsAppOtp(t,e){return this.httpService.post("/API/otp/verifywhatsapp",{Number:t,OTP:e}).pipe(Ie(()=>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(ft),N(R),N(A),N(we),N(Ce),N(U),N(X),N(Xe),N($e),N($))};static \u0275prov=at({token:n,factory:n.\u0275fac,providedIn:"root"})};var yl=["stepper"];function xl(n,t){n&1&&p(0,"Points")}function Ml(n,t){n&1&&p(0,"Verify")}function Pl(n,t){n&1&&p(0,"Confirm")}var si=class n{dialogRef=J(F);outletRegisterService=J($);pageInitialService=J(A);customerHttpService=J(ft);customerService=J(li);orderService=J(R);toastr=J(X);modalConfig;enabledLoyaltyPoint=E(!1);stepper;pointUsed=0;pointBalance=E(0);redeemPointValue=E(0);email=E(null);phone=E(null);contactToResend=E(null);verifyType=E(null);clearPin=E(!1);selectedTab=E(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 B,this.modalConfig.title="Redeem Point",this.modalConfig.customWidth="500px",this.modalConfig.hideFooter=!0}initConfigEnabledVerify(){let t=this.pageInitialService.Data.AppConfigJSON,e=t?.ApplicationLoyalty?.VerifyRedemption,i=t?.ApplicationLoyalty?.Enabled,o=this.outletRegisterService.Data?.MemberPoint;this.enabledLoyaltyPoint.set(e&&i&&o)}initPointUsed(){let t=this.orderService.Data?.Order?.PointUsed;this.pointUsed=t||0,this.pointUsed>0&&this.selectedTab.set(2)}initAvailablePoint(){let t=this.customerHttpService.Data.Point,e=this.customerHttpService.Data.PointUsed,i=(t||0)-(e||0);this.pointBalance.set(i)}onClose(){this.dialogRef.close()}onCancelRedeem(){let t=this.orderService.Data;t.Order.PointUsed=0,t.Order.DiscountAmount=0,this.orderService.pushNewValue(t),this.toastr.info("Redeem point has been canceled","Canceled"),this.onClose()}onRedeem(){this.stepper.next(),this.stepper.next()}onVerify(t){switch(t){case"phone":this.contactToResend.set(this.phone()),this.handlingSentOtpViaPhone();break;case"email":this.contactToResend.set(this.email()),this.handlingSentOtpViaEmail();break;case"pin":this.stepper.next();break}this.verifyType.set(t)}handlingSentOtpViaPhone(){this.customerService.sendOtpViaWhatsApp(this.phone()).subscribe(t=>{this.stepper.selectedIndex==0&&this.stepper.next(),this.toastr.success(`OTP has been sent to ${this.phone()}`,"OTP Sent")})}handlingSentOtpViaEmail(){this.customerService.sendOtpViaEmail(this.email()).subscribe(t=>{this.stepper.selectedIndex==0&&this.stepper.next(),this.toastr.success(`OTP has been sent to ${this.email()}`,"Email Sent")})}onVerifyCode(t){switch(this.verifyType()){case"phone":this.verifyPhoneOtp(t);break;case"email":this.verifyEmailOtp(t);break;case"pin":this.verifyCustomerPin(t);break}}verifyEmailOtp(t){this.customerService.verifyEmailOtp(this.email(),t).subscribe(e=>{this.toastr.success(e.Message,"Successfully verified"),this.stepper.next()})}verifyPhoneOtp(t){this.customerService.verifyWhatsAppOtp(this.phone(),t).subscribe(e=>{this.toastr.success(e.Message,"Successfully verified"),this.stepper.next()})}verifyCustomerPin(t){let e=this.orderService.Data?.Order?.CustomerID;this.clearPin.set(!1),this.customerService.verifyPin(t,e).subscribe({next:i=>{this.toastr.success(i.Message,"Successfully verified"),this.stepper.next()},error:i=>{this.clearPin.set(!0)}})}onResendCode(){this.onVerify(this.verifyType())}onConfirm(){this.calculatePointToDiscount()}calculatePointToDiscount(){let t=this.pageInitialService.Data.AppConfigJSON,e=this.orderService.Data,i=e.RedeemableAmount,o=this.pointUsed,l=t.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,b=this.pointUsed*l;b>i&&(o=Math.ceil(i/l),b=i),(S.IsNotEmpty(e.Order.PointUsed)?e.Order.PointUsed:0)!=o&&(e.Order.PointUsed=o||0,e.Order.DiscountAmount=b,this.orderService.pushNewValue(e),this.toastr.success("Point has been redeemed","Success")),this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["modal-redeem-point"]],viewQuery:function(e,i){if(e&1&&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),K(7,xl,1,0,"ng-template",6),r(8,"div",7)(9,"point-step",8),_("onVerify",function(b){return u(o),f(i.onVerify(b))}),D("pointUsedChange",function(b){return u(o),I(i.pointUsed,b)||(i.pointUsed=b),f(b)}),_("onRedeem",function(){return u(o),f(i.onRedeem())}),a()()(),r(10,"mat-step",9),K(11,Ml,1,0,"ng-template",6),r(12,"div",7)(13,"verify-step",10),_("resendCode",function(){return u(o),f(i.onResendCode())})("onVerify",function(b){return u(o),f(i.onVerifyCode(b))}),a()()(),r(14,"mat-step",11),K(15,Pl,1,0,"ng-template",6),r(16,"div",7)(17,"confirm-step",12),_("onConfirm",function(){return u(o),f(i.onConfirm())})("onCancel",function(){return u(o),f(i.onCancelRedeem())}),a()()()()()()()()}e&2&&(m("preventEnterEvent",!0)("config",i.modalConfig),s(4),m("linear",!0)("selectedIndex",i.selectedTab()),s(2),m("editable",!0),Uo("aria-labelledby",i.selectedTab()==2?"stepDisabled":""),s(3),m("isVerifyEnabled",i.enabledLoyaltyPoint()),O("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:[ge,j,fe,ha,Ca,ga,_a,yn,Pn,On],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 Ol(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"),h(2,"i",19),a(),r(3,"span"),p(4),v(5,"number"),a()()}if(n&2){let e=c(2);s(4),x(" ",M(5,1,e.pointUsed)," Points redeemed ")}}function Il(n,t){if(n&1){let e=y();r(0,"tab",3)(1,"div",6)(2,"div",7)(3,"label",8),p(4,"Discount %"),a()(),r(5,"div",9)(6,"input",10),D("ngModelChange",function(o){u(e);let l=c();return I(l.discount1,o)||(l.discount1=o),f(o)}),a(),r(7,"span",11),p(8,"%"),a(),r(9,"span",12),p(10,"+"),a(),r(11,"input",13),D("ngModelChange",function(o){u(e);let l=c();return I(l.discount2,o)||(l.discount2=o),f(o)}),a(),r(12,"span",11),p(13,"%"),a()()(),r(14,"div",14)(15,"div",7)(16,"label",8),p(17),a()(),r(18,"div",15)(19,"input",16),D("ngModelChange",function(o){u(e);let l=c();return I(l.discountAmount,o)||(l.discountAmount=o),f(o)}),a(),g(20,Ol,6,3,"div",17),a()()()}if(n&2){let e=c();m("active",e.tabActive=="Discount"),s(6),O("ngModel",e.discount1),s(5),O("ngModel",e.discount2),s(6),x("Discount ",e.currencySymbol),s(2),m("disabled",e.pointUsed&&e.pointUsed>0),O("ngModel",e.discountAmount),s(),C(e.pointUsed&&e.pointUsed>0?20:-1)}}function Dl(n,t){if(n&1){let e=y();r(0,"tab",4)(1,"div",6)(2,"div",7)(3,"label",8),p(4,"Tax"),a()(),r(5,"div",9)(6,"ng-select",20),_("change",function(o){u(e);let l=c();return f(l.updateTax(o))}),a()()(),r(7,"div",14)(8,"div",7)(9,"label",8),p(10,"Surcharge"),a()(),r(11,"div",9)(12,"input",21),D("ngModelChange",function(o){u(e);let l=c();return I(l.surcharge,o)||(l.surcharge=o),f(o)}),a(),r(13,"span",11),p(14,"%"),a()()()()}if(n&2){let e=c();s(6),m("clearable",!1)("ngModel",e.salesOrder.Order.TaxTypeID)("items",e.taxes),s(6),O("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"),a()(),r(5,"div",23)(6,"input",24),D("ngModelChange",function(o){u(e);let l=c();return I(l.discountAfterTax,o)||(l.discountAfterTax=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onDiscountAfterTaxChange())}),a()()(),r(7,"div",25)(8,"div",22)(9,"label",8),p(10,"Discount Calculator"),a()(),r(11,"div",26)(12,"input",27),D("ngModelChange",function(o){u(e);let l=c();return I(l.discounts[0],o)||(l.discounts[0]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),a(),r(13,"span"),p(14," %"),a(),r(15,"span",12),p(16,"+"),a(),r(17,"input",28),D("ngModelChange",function(o){u(e);let l=c();return I(l.discounts[1],o)||(l.discounts[1]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),a(),r(18,"span"),p(19," %"),a(),r(20,"span",12),p(21,"+"),a(),r(22,"input",29),D("ngModelChange",function(o){u(e);let l=c();return I(l.discounts[2],o)||(l.discounts[2]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),a(),r(23,"span"),p(24," %"),a()()()()}if(n&2){let e=c();s(6),O("ngModel",e.discountAfterTax),s(6),O("ngModel",e.discounts[0]),s(5),O("ngModel",e.discounts[1]),s(5),O("ngModel",e.discounts[2])}}var ci=class n{constructor(t,e,i,o,l,b,V,G,ve,Be){this.dialogRef=t;this.orderService=e;this.invoiceCalculatorService=i;this.pageInitialService=o;this.roleService=l;this.customerHttpService=b;this.orderProcessorService=V;this.promotionCouponService=G;this.dialog=ve;this.data=Be;let je=this.pageInitialService?.Data?.AppConfigJSON;this.modalConfig.title="Discount and Tax",this.modalConfig.customWidth="480px",this.salesOrder=this.orderService.Data,this.userRole=this.roleService.Data,this.isPreferedPayment=je?.ApplicationLoyalty?.PreferedPayment,this.tabActive=this.data?.tabIndexActive,this.isEditOrder=this.orderProcessorService.Data.posState==2,this.customer=b.Data,this.initDiscountAndTax(),this.initAvailablePoint(),this.initTabLoyaltyTitle()}modalConfig=new B;discount1;discount2;discountAmount;surcharge;discountAfterTax;currencySymbol;salesOrder;discounts=[];taxes;selectedTax;userRole;tabActive;isEditOrder;isPreferedPayment;customerPoint;customer;tabLoyaltyTitle;pointUsed;availablePoint;initAvailablePoint(){let t=this.customerHttpService.Data.Point,e=this.customerHttpService.Data.PointUsed;this.customerPoint=t,this.availablePoint=(t||0)-(e||0)}initTabLoyaltyTitle(){let e=this.pageInitialService?.Data?.AppConfigJSON?.ApplicationLoyalty?.Label;this.tabLoyaltyTitle=S.IsNotEmpty(e)?e:"Loyalty"}initDiscountAndTax(){this.discount1=this.salesOrder.Order.Discount,this.discount2=this.salesOrder.Order.Discount2,this.discountAmount=this.salesOrder.Order.DiscountAmount,this.surcharge=this.salesOrder.Invoice.SurchargePcg,this.discountAfterTax=this.invoiceCalculatorService.discountAfterTax,this.currencySymbol=this.invoiceCalculatorService.currencySymbol,this.taxes=this.pageInitialService.Data.Taxes,this.selectedTax=this.invoiceCalculatorService.tax,this.pointUsed=this.salesOrder.Order.PointUsed}updateTax(t){this.selectedTax=t}onOk(){this.resetAppliedCoupon(),this.applyChangesDiscountAmount(),this.salesOrder.Order.Discount=this.discount1,this.salesOrder.Order.Discount2=this.discount2,this.salesOrder.Invoice.SurchargePcg=this.surcharge,this.salesOrder.Invoice.TempSurchargePcg=this.surcharge,this.invoiceCalculatorService.discountAfterTax=this.discountAfterTax,this.salesOrder.Order.TaxTypeID=this.selectedTax.ID,this.invoiceCalculatorService.tax=this.selectedTax,this.orderService.pushNewValue(this.salesOrder),this.onClose()}onClose(){this.dialogRef.close()}calculateDiscountCalculator(){var t=100;this.discounts.forEach(e=>{t=t*(100-e)/100}),this.discount1=100-t}onDiscountAfterTaxChange(){this.discountAmount=this.discountAfterTax;let e=this.invoiceCalculatorService.TotalBeforeTax-this.discountAmount,i=this.orderService.Data.Order.TaxTypeID,o=this.pageInitialService.Data.Taxes,l=S.FilterByID(o,i);if(S.IsNotEmpty(l)&&l.CalculationTypeID==0){let b=1+l.Rate/100,V=e*b;this.discountAmount=(V-(V-this.discountAfterTax))/b}}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(si)}static \u0275fac=function(e){return new(e||n)(d(F),d(R),d(Ce),d(A),d(de),d(ft),d(U),d(Xe),d(ae),d(Le))};static \u0275cmp=P({type:n,selectors:[["POS-modal-discount"]],decls:7,vars:4,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],[3,"onTabChange"],["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(l){return i.onTabChange(l)}),g(4,Il,21,7,"tab",3),g(5,Dl,15,6,"tab",4),g(6,wl,25,4,"tab",5),a()()()()),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:[re,fe,z,Q,ee,cn,pa,ca,ge,j,_t,ht,mt,Ke,Y],encapsulation:2})};var Dn=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=St({type:n});static \u0275inj=vt({imports:[re,fe]})};var wn=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=St({type:n});static \u0275inj=vt({imports:[re,fe,qe,ge,Kt,_t,fa,ht,cn,Ke,Mn,Zt,Vr,zt,ht,Qt,ba,fr,Wi,Dn,Sa,It,Gi,xa,dn,_t,ci,Ft,Ui,aa]})};var kn=class n{constructor(t,e,i,o,l,b,V){this.orderProcessorService=t;this.posDataService=e;this.signalBroadCast=i;this.calculatorService=o;this.OrderHttpService=l;this.localDataService=b;this.posService=V;this.newSale=new He}newSale;retrySubmit(){let t=this.posService.Data.AppConfigJSON,e=this.posDataService.Data;this.posDataService.submitOrder(t).then(i=>{i.Success?(this.broadcastToCustomerDisplay(i),this.posDataService.pushNewValue(e),this.orderProcessorService.updatePosState(1,i)):(this.posDataService.pushNewValue(e),this.orderProcessorService.updatePosState(1,i))}).catch(i=>{console.log(i)})}broadcastToCustomerDisplay(t){let i=this.posDataService.Data.TotalPaidAmount-this.calculatorService.Data;this.signalBroadCast.BroadcastStateToCustomerDisplay(1,t.ObjectID,t.LoyaltyPoint,i).subscribe()}saveOffline(){let t=this.posDataService.Data,e=this.OrderHttpService.generatePOSDataForSubmission(t,!1);this.localDataService.syncOrder(e).subscribe(()=>{this.newSale.next()})}static \u0275fac=function(e){return new(e||n)(d(U),d(R),d(en),d(Ce),d(De),d(Ye),d(A))};static \u0275cmp=P({type:n,selectors:[["app-retry"]],outputs:{newSale:"newSale"},decls:21,vars:0,consts:[[1,"card"],[1,"card-header","bg-gradient-danger"],[1,"d-flex","justify-content-between"],[1,"fa-solid","fa-times-circle","me-1","text-danger"],[1,"card-body"],[1,"row","justify-content-center","g-0","mt-8"],[1,"col-8","text-center"],[1,"text-danger","fs-5"],[1,"row","mt-4","justify-content-center","g-0","mb-9"],[1,"col-5","text-center"],["type","button","matTooltipPosition","above","matTooltip","Upload your local / offline order to the cloud",1,"btn","btn-success","btn-lg","fs-3",3,"click"],[1,"card-footer","bg-light-gray"],[1,"row","justify-content-between","py-6"],[1,"col-auto"],["type","button","matTooltipPosition","above","matTooltip","Temporarily save data locally until connection to the server is restored",1,"btn","btn-light-gray",3,"click"],[1,"fa-solid","fa-save","me-2",2,"font-size","14px"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1)(2,"div",2)(3,"h2"),h(4,"i",3),p(5," Order Upload Fail! "),a()()(),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. "),a()()(),r(11,"div",8)(12,"div",9)(13,"button",10),_("click",function(){return i.retrySubmit()}),p(14," Retry Upload "),a()()()(),r(15,"div",11)(16,"div",12)(17,"div",13)(18,"button",14),_("click",function(){return i.saveOffline()}),h(19,"i",15),p(20,"Save Offline "),a()()()()())},dependencies:[Ke,se],encapsulation:2})};var Ea=(()=>{let t=class t{constructor(){this.emailRegex=S.emailRegex,this.phoneNumberRegex=S.phoneNumberRegex}validate(i){let o=this.emailRegex,l=this.phoneNumberRegex,b=o.test(i.value),V=l.test(i.value);if(b||V||i.value=="")return null;{let G="Please input a valid email or phone number";return V?G="Please input a valid email":b&&(G="Please input a valid phone number"),{invalidEmailOrPhoneNumber:{value:i.value,errMessage:G}}}}};t.\u0275fac=function(o){return new(o||t)},t.\u0275dir=Ti({type:t,selectors:[["","pOSIsInvalidEmailOrPhoneNumber",""]],features:[st([{provide:nr,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!"),h(3,"br"),p(4," Click the link below "),a()(),r(5,"a",3),p(6,"more information"),a(),p(7," > "))}function El(n,t){if(n&1){let e=y();r(0,"div",4)(1,"div",5)(2,"span",6),h(3,"i",7),a(),h(4,"input",8),r(5,"button",9),p(6,"Copy to Clipboard"),a()()(),r(7,"div",10)(8,"div",11)(9,"span",12),h(10,"i",13),a(),h(11,"input",14),r(12,"button",15),_("click",function(){u(e);let o=c();return f(o.onSendViaWhatsApp())}),p(13,"Send via WhatsApp"),a()()()}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 B;whatsAppNumberCtrl;ngOnInit(){this.modalConfig.title="Midtrans Payment Link",this.modalConfig.hideFooter=!0,this.modalConfig.customWidth="500px",this.initWaNumberCtrl()}initWaNumberCtrl(){this.whatsAppNumberCtrl=new ar(null,[Lt.pattern("^[0-9]*$"),Lt.required])}close(){this._dialogRef.close()}onSendViaWhatsApp(){let t=this.whatsAppNumberCtrl.value;if(t){let e="https://wa.me/"+t+"?text="+this.data.link;window.open(e,"_blank")}else this._toast.error("Phone Number must be insert")}static \u0275fac=function(e){return new(e||n)(d(F),d(X),d(Le))};static \u0275cmp=P({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),a()()),e&2&&(m("config",i.modalConfig),s(2),C(i.data.link==null||i.data.link==""?2:3))},dependencies:[z,Q,dt,j,ya],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"),a()),n&2){let e=c(3);m("queryParams",me(1,Bl,e.completeData.OutDeliveryID,e.outletRegister.PrintTemplate.ID))}}function ql(n,t){if(n&1&&(r(0,"a",42),p(1,"Invoice & Delivery Order"),a()),n&2){let e=c(3);m("queryParams",hi(1,jl,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)"),a()),n&2){let e=c(3);m("href",e.getInvoicePrintURL(!0),tt)}}function Gl(n,t){if(n&1&&(r(0,"a",44),p(1,"Packing Slip"),a()),n&2){let e=c(3);m("queryParams",T(1,Hl,e.completeData.OutDeliveryID))}}function Jl(n,t){if(n&1&&(r(0,"div",28),h(1,"button",39),r(2,"div",40),g(3,Ql,2,4,"a",41),g(4,ql,2,5,"a",42),g(5,$l,2,1,"a",43),g(6,Gl,2,3,"a",44),a()()),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! "),a()()())}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())}),h(3,"i"),a(),r(4,"input",48),_("ngModelChange",function(o){u(e);let l=c(2);return f(l.isPhoneOrEmail(o))}),a()(),r(5,"div",49)(6,"button",50),_("click",function(){u(e);let o=c(2);return f(o.sendReceiptToContact())}),p(7," Send Receipt "),a()()()}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),a()),n&2){let e=c(2);s(),x(" ",e.customerContact.errors==null||e.customerContact.errors.invalidEmailOrPhoneNumber==null?null:e.customerContact.errors.invalidEmailOrPhoneNumber.errMessage," ")}}function Xl(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 "),a()}}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())}),h(2,"i",55),p(3,"Generate Payment Link "),a()()}}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())}),h(2,"i",57),p(3,"Verify Payment Settlement "),a()()}}function ts(n,t){if(n&1&&(r(0,"div",38)(1,"div",52),g(2,Zl,4,0,"div",53),g(3,es,4,0,"div",53),a()()),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"),h(4,"i",26),p(5," Sell Complete "),r(6,"small",27),p(7),a()(),r(8,"div"),g(9,Jl,7,4,"div",28),a()()(),r(10,"div",13)(11,"div",29),g(12,zl,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,Xl,2,0,"button",36),r(19,"button",37),_("click",function(){u(e);let o=c();return f(o.newSale())}),p(20," New Sale (F8) "),a()()()()()(),g(21,ts,4,2,"div",38),a()}if(n&2){let e=c();s(),m("ngClass",me(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())}),a()}}function os(n,t){if(n&1&&(r(0,"a",11),p(1),a()),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),a()),n&2){let e=c();s(),x(" Invoice #",e.completeData==null?null:e.completeData.InvoiceNumber," ")}}function as(n,t){if(n&1&&(p(0),v(1,"number")),n&2){let e=c().$implicit;Te(" ",e.CurrencySymbol," ",M(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),a(),r(3,"div",61),g(4,as,2,4)(5,ls,1,0),a()()),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),ie(1,ss,6,2,"div",59,pe),a()),n&2){let e=c();s(),ne(e.itemSummary)}}function ps(n,t){if(n&1&&(r(0,"div",62)(1,"div",64),p(2),a(),r(3,"div",65),p(4),v(5,"number"),a()()),n&2){let e=t.$implicit,i=t.$index,o=c(2);s(),m("hidden",!o.role.PriceVisible),s(),Te(" ",e.Label,": ",e.CurrencySymbol," "),s(),m("hidden",!o.role.PriceVisible)("ngClass",i+1===o.amountSummary.length?"amount":""),s(),x(" ",M(5,6,e.Amount)," ")}}function ds(n,t){if(n&1&&(r(0,"div",62)(1,"div",64),p(2),a(),r(3,"div",66),p(4),v(5,"number"),a()()),n&2){let e=t.$implicit,i=c(3);s(),m("hidden",!i.role.PriceVisible),s(),Te(" ",e.Label,": ",e.CurrencySymbol," "),s(),m("hidden",!i.role.PriceVisible),s(),x(" ",M(5,5,e.Amount)," ")}}function ms(n,t){if(n&1&&(r(0,"div",63),ie(1,ds,6,7,"div",62,pe),a()),n&2){let e=c(2);s(),ne(e.paymentSummary)}}function us(n,t){if(n&1&&(r(0,"div",14),ie(1,ps,6,8,"div",62,pe),g(3,ms,3,0,"div",63),a()),n&2){let e=c();s(),ne(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"),a(),r(4,"P",69),p(5),v(6,"number"),a()()()),n&2){let e=c();s(5),x("",M(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 l=c();return f(l.isGlobalPrintEnabled()?null:o.preventDefault())}),h(1,"i",71),a()}if(n&2){let e=c();m("href",e.getInvoicePrintURL(!1),tt)("matTooltip",e.isGlobalPrintEnabled()?"Print in New Tab":"Required Global Print Role")("ngStyle",me(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"),a()(),h(4,"div",72),a()),n&2){let e=c();s(4),m("innerHtml",e.completeData.LoyaltyPoint,ki)}}function _s(n,t){if(n&1&&h(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&&h(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 bs(n,t){if(n&1&&(g(0,hs,1,5,"pos-receipt-a4",74),v(1,"async")),n&2){let e,i=c(2);C((e=M(1,1,i.receiptTemplateA4$))?0:-1,e)}}function vs(n,t){if(n&1&&(g(0,_s,1,8,"pos-receipt",73),g(1,bs,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 "),a()())}var Tn=class n{constructor(t,e,i,o,l,b,V,G,ve,Be,je,mi,Ii,Di,At,ui,wo,po,ko,Ka,Ya){this._posDataService=t;this._posService=e;this._orderProcessorService=i;this._OrderHttpService=o;this._PaymentHttpService=l;this._receiptService=b;this._outletService=V;this._toastr=G;this._onlineStatusService=ve;this._matDialog=Be;this._signalBroadCast=je;this._calculatorService=mi;this._userRoleService=Ii;this._router=Di;this._receiptCalculatorService=At;this.datePipe=ui;this.decimalPipe=wo;this.paymentGatewayService=po;this.paymentHttpService=ko;this.shoppingCartService=Ka;this.roleService=Ya;this.isGlobalPrintEnabled.set(this.roleService.global.Print)}whatsappSendReceiptService=J(vo);handleF8(){this.newSale()}salesOrder=new ut;receiptTemplate=null;receiptTemplateA4$;completeData=new Ur;printMode=2;outletRegister=new Ji;role;finalAmountDifferent=!1;amountSummary=[];itemSummary=[];paymentSummary=[];isOnline=!1;destroy$=new q;get posStorage(){return this._posService.Data}currentSellState;isOrderDateNow;sellState=Me;receiptIcon="fa-brands fa-whatsapp";customerContact=new pt;printOnPayment=E(!0);isSuccessRetrySubmit=E(!1);isGlobalPrintEnabled=E(!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(oe(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 Xo&&(t?.url?.includes("Sell")||(this._orderProcessorService.createNewTransactionInSameOutletRegister(),this._signalBroadCast.BroadcastStateToCustomerDisplay(0).subscribe()))})}InitPrintInvoice(){this.currentSellState==1&&(this.checkOrderNumber(),this.print())}initCustomerContact(){if(this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.DefaultReceiptChannel==0){this.receiptIcon="fa-solid fa-envelope";let t=this.completeData?.Contact?.Email;this.customerContact.setValue(t)}else if(this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.DefaultReceiptChannel==1){this.receiptIcon="fa-brands fa-whatsapp";let t=this.completeData?.Contact?.Mobile;this.customerContact.setValue(t)}}isPhoneOrEmail(t){let e=S.emailRegex,i=S.phoneNumberRegex,o=e,l=i,b=o.test(t),V=l.test(t);if(b)return this.receiptIcon="fa-solid fa-envelope","Email";if(V)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,l=e-i;if(l!=o&&l!=0){this.finalAmountDifferent=!0;let b=this.decimalPipe.transform(e);setTimeout(()=>{this._toastr.warning(`Final Amount should be ${b}! 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",Ae.Info);return}this._OrderHttpService.sendEmail(this.customerContact.value,this.completeData.ObjectID).then(t=>{this._toastr.success(t.Message,"Email sent!")})}sendReceiptByWhatsaap(){let t=this.customerContact.value;this.whatsappSendReceiptService.createCustomerFromNewNumberAndSendReceipt(t,this._calculatorService.currencySymbol,this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.WhatsappReceipt,{Final:this.completeData.Final,InvoiceNumber:this.completeData.InvoiceNumber,ObjectID:this.completeData.ObjectID},this._posService.Data?.WhatsAppConfigJSON?.TextReceipt)}print(){this.printMode==2?(this.printReceiptMini(),this.printOnPayment()&&this.printWindow()):this.printMode==1&&this.printReceiptA4()}printReceiptMini(){this.receiptTemplate=this._receiptService.generateReceiptMini()}setLoyaltyLabelConfig(){let t=this.posStorage?.AppConfigJSON;t.LoyaltyLabel=t.ApplicationLoyalty.Label,this.posStorage.AppConfigJSON=t}printReceiptA4(){this.receiptTemplateA4$==null?this.receiptTemplateA4$=this._OrderHttpService.generateReceiptA4(this.completeData.ObjectID).pipe(k(this.destroy$),et(t=>(t.Data.AfterSell=!0,t.Data)),fi(t=>{throw this._toastr.error(`Could not print in A4 format!
|
|
5
|
-
Printing in 8mm format instead!`,"Error!"),this.printReceiptMini(),t}),Ie(()=>{this.printOnPayment()&&this.printWindow()}),Ht(1)):this.printWindow()}printWindow(){let t=document.title;document.title=this.getCustomPrintFileName(),setTimeout(()=>{window.print(),document.title=t},500)}getCustomPrintFileName(){return`Invoice_${this.completeData?.InvoiceNumber}`}isNotEmpty(t){return S.IsNotEmpty(t)}verifyPaymentSettlement(){let t=this._calculatorService.Data,e=this.paymentGatewayService.paymentMethod,i=this.paymentGatewayService.generatePaymentVerificationData(t,e.EMoneyTypeID);this.paymentHttpService.VerifyPayment(i,e.EMoneyTypeID).pipe(k(this.destroy$)).subscribe({next:o=>{this._toastr.success(o.Message,"QR Settlement")}})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}sendReceiptToContact(){let t=S.emailRegex,e=S.phoneNumberRegex,i=this.customerContact.value,o=t.test(i),l=e.test(i);o?this.sendEmail():l&&this.sendReceiptByWhatsaap()}static \u0275fac=function(e){return new(e||n)(d(R),d(A),d(U),d(De),d(bo),d(Et),d($),d(X),d(Ge),d(ae),d(en),d(Ce),d(de),d(xt),d(Zi),d(Qe),d(Y),d(tn),d(bo),d(we),d(Mt))};static \u0275cmp=P({type:n,selectors:[["sell-complete"]],hostBindings:function(e,i){e&1&&_("keydown.F8",function(){return i.handleF8()},it)},features:[st([vo])],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"),a()()(),r(6,"div",5)(7,"div",6),g(8,is,22,16,"div",7)(9,ns,1,0,"app-retry"),a(),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),a()(),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()}),h(23,"i",20),p(24,"Print Receipt "),a()(),g(25,gs,2,6,"a",21),a()()(),g(26,Cs,5,1,"div",7),a()()()(),r(27,"div",22),g(28,vs,2,2)(29,Ss,3,0,"div",23),a()),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:[re,H,Ai,fe,z,Q,Gt,It,mn,Ma,an,rn,Qt,Wt,kn,qe,dt,Ke,se,Ea,Ve,Y],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 En=class n{constructor(t,e){this._dialogRef=t;this._orderProcessorService=e;this.modalConfig.title="Clear Order?",this.modalConfig.headerType=Ae.Success}modalConfig=new B;ngOnInit(){}onOk(){this._orderProcessorService.createNewTransactionInSameOutletRegister(!1),this._orderProcessorService.emitClearOrder(),this.close()}close(){this._dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(F),d(U))};static \u0275cmp=P({type:n,selectors:[["POS-modal-clear"]],standalone:!1,decls:4,vars:2,consts:[[3,"onOk","onCancel","onClose","config"],[1,"fw-normal"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.onOk()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"h4",1),p(3),a()()()),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 Oo=(i=>(i[i.INTERNAL=1]="INTERNAL",i[i.EKSTERNAL=2]="EKSTERNAL",i[i.EKSTERNALINTERNAL=3]="EKSTERNALINTERNAL",i))(Oo||{});function xs(n,t){if(n&1){let e=y();r(0,"div",1)(1,"radio-options",12),D("modelChange",function(o){u(e);let l=c();return I(l.selectedProvider,o)||(l.selectedProvider=o),f(o)}),a(),r(2,"label",13),p(3,"Choose Provider"),a()()}if(n&2){let e=c();s(),m("options",e.couponProviders()),O("model",e.selectedProvider),m("disabled",e.hasSelectedCoupon)}}function Ms(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 "),a()}}function Ps(n,t){if(n&1){let e=y();r(0,"button",15),_("click",function(o){u(e);let l=c();return f(l.onOk(o))})("keyup.F2",function(o){u(e);let l=c();return f(l.onOk(o))}),p(1," Ok (F2) "),a()}}var Rn=class n{constructor(t,e,i,o,l,b,V){this.promotionService=t;this._orderDataService=e;this._posService=i;this.dialogRef=o;this.roleService=l;this.toastr=b;this.promotionCouponProvider=V;this.destroy$=new q,this.modeType=!1,this.typeText="password",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye-slash",this.couponInputLock=l.Data.CouponInputLock,this.initProviders(),this.subscribeToObservable(),this.initModalConfig(),this.initSelectedProvider()}modalConfig=new B;modeType;typeText;typeIcon;PromotionCoupon;PromotionNote;couponType;destroy$;onInputCouponCode=!1;selectedProvider="Internal";couponInputLock=!1;startInput;couponredemptionType=Oo;couponProviders=E([]);initModalConfig(){this.modalConfig.title="Redeem Coupon",this.modalConfig.customWidth="400px",this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0}subscribeToObservable(){this._orderDataService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.PromotionCoupon=t.Order.PromotionCoupon,this.PromotionNote=t.Order.PromotionNote})}initProviders(){this.couponProviders.update(t=>{let e=this._posService.Data.AppConfigJSON.ProviderOption,i=e.map(o=>({Key:o,Value:o}));return e?.length>0?[{Key:"Internal",Value:"DealPOS"},...i]:[]})}initSelectedProvider(){let t=this.promotionCouponProvider.coupon,e=this.promotionCouponProvider.couponProvider;S.IsNotEmpty(t)?this.selectedProvider=e:this.selectedProvider="Internal"}get hasSelectedCoupon(){let t=this._orderDataService.Data.Order;return S.IsNotEmpty(t.PromotionCoupon)}onOk(t){(t!="Enter"||t=="Enter"&&this.onInputCouponCode)&&this.onSubmitCoupon()}onSubmitCoupon(){S.IsNotEmpty(this.PromotionCoupon)?(this.applyCouponCode(),this.dialogRef.close()):this.toastr.warning("Coupon can't be empty","Warning")}onRemoveCoupon(){let t=this.promotionCouponProvider.coupon;S.IsNotEmpty(t)?this.promotionCouponProvider.removeCoupon():this.promotionService.removeAppliedCoupon(),this.dialogRef.close()}applyCouponCode(){if(this.selectedProvider==="Internal")this.promotionService.RedeemCoupon(this.PromotionCoupon,this.PromotionNote);else{let t=`(${this.selectedProvider}) ${this.PromotionNote?this.PromotionNote:""}`;this.promotionCouponProvider.redeemCoupon(this.PromotionCoupon,this.selectedProvider,t)}}onClose(){this.dialogRef.close()}showPassword(){this.modeType?(this.typeText="text",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye"):(this.typeText="password",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye-slash")}onKeyDown(t){let e=t.target.value;this.couponInputLock&&(t.key=="Enter"?this.PromotionCoupon=e:this.validateInputLock())}validateInputLock(){if(typeof this.PromotionCoupon=="string")if(this.PromotionCoupon==""||this.PromotionCoupon.length==0)this.startInput=new Date;else{let t=new Date;this.startInput=this.startInput?this.startInput:new Date,t.getTime()-this.startInput.getTime()>500&&(this.PromotionCoupon=null)}else this.startInput=new Date}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(Xe),d(R),d(A),d(F),d(de),d(X),d(Dt))};static \u0275cmp=P({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,xs,4,3,"div",1),r(3,"div",2)(4,"input",3),D("ngModelChange",function(l){return I(i.PromotionCoupon,l)||(i.PromotionCoupon=l),l}),_("paste",function(l){return i.couponInputLock?l.preventDefault():""})("keydown",function(l){return i.onKeyDown(l)})("focus",function(){return i.onInputCouponCode=!0})("blur",function(){return i.onInputCouponCode=!1}),a(),r(5,"i",4),_("click",function(){return i.modeType=!i.modeType,i.showPassword()}),a(),r(6,"label",5),p(7,"Coupon"),a()(),r(8,"div",6)(9,"textarea",7),D("ngModelChange",function(l){return I(i.PromotionNote,l)||(i.PromotionNote=l),l}),a(),r(10,"label",8),p(11,"Note"),a()()(),r(12,"footer")(13,"button",9),_("click",function(){return i.onClose()}),p(14," Cancel "),a(),g(15,Ms,2,0,"button",10)(16,Ps,2,0,"button",11),a()()),e&2&&(m("config",i.modalConfig),s(2),C(i.couponProviders().length>0?2:-1),s(2),m("type",i.typeText),O("ngModel",i.PromotionCoupon),m("disabled",i.hasSelectedCoupon),s(),le(i.typeIcon),s(4),O("ngModel",i.PromotionNote),m("disabled",i.hasSelectedCoupon),s(6),C(i.hasSelectedCoupon?15:16))},dependencies:[z,Q,ee,j,Hi],styles:[".passwordIcon[_ngcontent-%COMP%]{position:relative;margin:0 auto!important;cursor:pointer;left:20.5rem;top:-2.3rem;z-index:999}"]})};var Nn=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 B;ReturNumber;destroy$;ngOnInit(){this.initInvoiceRetur()}initInvoiceRetur(){this.ReturNumber=null,this._orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(t=>{t.posState===7&&(this.ReturNumber=t.ReturNumber)})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}onOk(){let t=this._orderDataService.Data.Order.EntityID;this._OrderHttpService.GetReturnInvoice(this.ReturNumber,t).pipe(k(this.destroy$)).subscribe(e=>{let i=this._orderProcessorService.Data;i.ReturNumber=this.ReturNumber,this._orderProcessorService.ReturnOrder(e),this._orderProcessorService.updatePosState(7),this.dialogRef.close()})}static \u0275fac=function(e){return new(e||n)(d(F),d(R),d(U),d(De))};static \u0275cmp=P({type:n,selectors:[["pos-modal-return"]],standalone:!1,decls:6,vars:2,consts:[[3,"onOk","onCancel","onClose","config"],[1,"form-floating-outline"],["type","text","data-cy","ReturnNumber","id","ReturNumber","name","ReturNumber",1,"form-control",3,"ngModelChange","ngModel"],["for","ReturNumber"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.onOk()})("onCancel",function(){return i.dialogRef.close()})("onClose",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1)(3,"input",2),D("ngModelChange",function(l){return I(i.ReturNumber,l)||(i.ReturNumber=l),l}),a(),r(4,"label",3),p(5,"Number Invoice"),a()()()()),e&2&&(m("config",i.modalConfig),s(3),O("ngModel",i.ReturNumber))},dependencies:[z,Q,ee,j],encapsulation:2})};var Os=["serialInput"],Vn=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 B;serial;onKeyDown(t){t.key=="Enter"&&(S.IsNotEmpty(this.serial)?(this.shoppingCartService.addItemBySerial(this.serial),this.serial=null):this.toastr.warning("Serial Can`t be empty","Warning!"),this.setFocusInput())}setFocusInput(){this.serialInputEl&&setTimeout(()=>{this.serialInputEl?.nativeElement?.focus()},500)}static \u0275fac=function(e){return new(e||n)(d(F),d(we),d(X))};static \u0275cmp=P({type:n,selectors:[["POS-modal-serial"]],viewQuery:function(e,i){if(e&1&&Se(Os,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),D("ngModelChange",function(b){return u(o),I(i.serial,b)||(i.serial=b),f(b)}),_("keydown",function(b){return u(o),f(i.onKeyDown(b))}),a(),r(5,"span",4),h(6,"i",5),a()()()()}e&2&&(m("config",i.modalConfig),s(3),O("ngModel",i.serial))},dependencies:[z,Q,ee,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 Is(n,t){if(n&1&&(r(0,"tr")(1,"td"),p(2),a(),r(3,"td"),p(4),v(5,"date"),a(),r(6,"td"),p(7),v(8,"date"),a(),r(9,"td",4),p(10),a(),r(11,"td",4),p(12),v(13,"number"),a()()),n&2){let e=t.$implicit;s(2),w(e.Order.Number),s(2),w(Z(5,5,e.Order.ClientTimestamp,"dd MMM yyyy")),s(3),w(Z(8,8,e.Order.ClientTimestamp,"HH:mm")),s(3),w(e.Items.length),s(2),w(M(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"),a(),r(6,"th"),p(7,"Date"),a(),r(8,"th"),p(9,"Time"),a(),r(10,"th",4),p(11,"Qty"),a(),r(12,"th",4),p(13,"Total"),a()()(),r(14,"tbody"),ie(15,Is,14,13,"tr",null,pe),a()()()),n&2){let e=c();s(15),ne(e.offlineOrders)}}function ws(n,t){n&1&&(r(0,"h1",1),p(1,"There is no offline orders!"),a())}var An=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=>ot(ut,e))})}static \u0275fac=function(e){return new(e||n)(d(Ye))};static \u0275cmp=P({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,ws,2,0,"h1",1),e&2&&C(i.offlineOrders!=null&&i.offlineOrders.length>0?0:1)},dependencies:[Y,Qe],encapsulation:2})};var Ts=n=>({"bg-gradient-danger":n});function Es(n,t){if(n&1&&(p(0),v(1,"number")),n&2){let e=c();x(" ",M(1,1,e.onlineProducts)," ")}}function Rs(n,t){n&1&&(r(0,"small",4),p(1," Failed to get Online Products "),a())}function Ns(n,t){if(n&1&&(p(0),v(1,"date")),n&2){let e=c();x(" ",Z(1,1,e.syncDate,"dd MMM yyyy HH:mm")," ")}}function Vs(n,t){n&1&&p(0," Never been synced ")}function As(n,t){if(n&1&&(r(0,"p"),p(1),a()),n&2){let e=c();s(),x("You last synced ",e.dayDiff," days ago!")}}var Ln=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(oe(t=>t.length>0),Re(t=>{let e=Array.from(new Set(t.map(i=>i.ProductID))).map(i=>t.find(o=>o.ProductID===i));return this.offlineProduct=e.length,this.httpService.POSText("/api/catalog/product/ProductRowsCount",'{"ProductDiscontinued":false,"VariantDiscontinued":false,"CategoryDiscontinued":false,"From":"0001-01-01T00:00:00","To":"0001-01-01T00:00:00"}')}),et(t=>JSON.parse(t))).subscribe({next:t=>{this.onlineProducts=t.Count,this.getSyncTime()},error:t=>{console.error(t)}})}syncToLocalDatabase(){wi([this.syncOutlets(),this.syncProducts(),this.syncOutletPrices()]).pipe(k(this.destroy$),Re(()=>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$),oe(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(be.SynOutlet).pipe(k(this.destroy$),Re(t=>this.indexDbService.syncRegisters(t)))}syncProducts(){return this.httpService.get(be.SyncProducts).pipe(k(this.destroy$),Re(t=>this.indexDbService.syncVariants(t)))}syncOutletPrices(){return this.httpService.get(be.SynOutletPrice).pipe(k(this.destroy$),Re(t=>this.indexDbService.syncOutletPrice(t)))}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(Ye),d(X),d($e),d(F))};static \u0275cmp=P({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"),a(),r(6,"td",3),g(7,Es,2,3)(8,Rs,2,0,"small",4),a(),r(9,"td",5)(10,"div",6)(11,"button",7),_("click",function(){return i.syncToLocalDatabase()}),h(12,"i",8),r(13,"span"),p(14,"Sync"),a()()()()(),r(15,"tr")(16,"td",9),p(17,"Offline Products"),a(),r(18,"td"),p(19),v(20,"number"),a()(),r(21,"tr")(22,"td",9),p(23,"Last Sync"),a(),r(24,"td"),g(25,Ns,2,4)(26,Vs,1,0),g(27,As,2,1,"p"),a()()()()()),e&2&&(s(6),m("ngClass",T(7,Ts,!i.onlineProducts)),s(),C(i.onlineProducts?7:8),s(12),x(" ",M(20,5,i.offlineProduct)," "),s(6),C(i.syncDate?25:26),s(2),C(i.dayDiff>14?27:-1))},dependencies:[H,Y,Qe],encapsulation:2})};var Fs=["navTabs"],Fn=class n{constructor(t,e){this._router=t;this.dialogRef=e}tabs;modalConfig=new B;ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig.headerType=Ae.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(xt),d(F))};static \u0275cmp=P({type:n,selectors:[["pos-modal-sync"]],viewQuery:function(e,i){if(e&1&&Se(Fs,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(b){return u(o),f(i.onChangeTab(b))}),r(4,"mat-tab",3),h(5,"sync-products"),a(),r(6,"mat-tab",4),h(7,"sync-orders"),a()(),r(8,"div",5)(9,"button",6),_("click",function(){return u(o),f(i.goToOfflinePage())}),h(10,"i",7),p(11," Go to Details "),a()()()()}e&2&&(m("config",i.modalConfig),s(2),m("dynamicHeight",!1))},dependencies:[j,Pt,Ot,An,Ln],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 js=(n,t)=>({"btn-secondary":n,"btn-outline-secondary":t}),Hs=(n,t)=>({"btn-outline-secondary":n,"btn-secondary":t});function Us(n,t){if(n&1){let e=y();r(0,"div")(1,"label",12),h(2,"i",13),r(3,"span"),p(4,"Deduct Inventory from Outlet :"),a()(),r(5,"p-select",14),D("ngModelChange",function(o){u(e);let l=c();return I(l.deliveryEntityID,o)||(l.deliveryEntityID=o),f(o)}),a()()}if(n&2){let e=c();s(5),m("options",e.entities),O("ngModel",e.deliveryEntityID),m("filter",!0)("showClear",!0)("showClear",!1)("disabled",e.isDisabledNgSelectOutlet)}}function Ws(n,t){if(n&1){let e=y();r(0,"div",10)(1,"div",29)(2,"label",30),h(3,"i",31),r(4,"span"),p(5,"Recipient"),a()(),r(6,"input",32),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.shipping.Name,o)||(l.shipping.Name=o),f(o)}),a()(),r(7,"div",29)(8,"label",33),h(9,"i",34),r(10,"span"),p(11,"Phone"),a()(),r(12,"input",35),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.shipping.Phone,o)||(l.shipping.Phone=o),f(o)}),a()(),r(13,"div",36)(14,"label",37),h(15,"i",38),r(16,"span"),p(17,"City"),a()(),r(18,"input",39),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.shipping.City,o)||(l.shipping.City=o),f(o)}),a()(),r(19,"div",40)(20,"label",41),h(21,"i",42),r(22,"span"),p(23,"Delivery Address"),a()(),r(24,"POS-tinymce-editor",43),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.shipping.Address,o)||(l.shipping.Address=o),f(o)}),a()()()}if(n&2){let e=c(2);s(6),O("ngModel",e.shipping.Name),s(6),O("ngModel",e.shipping.Phone),s(6),O("ngModel",e.shipping.City),s(6),O("ngModel",e.shipping.Address)}}function Qs(n,t){if(n&1){let e=y();r(0,"div",15)(1,"div",16)(2,"label",12),h(3,"i",17),r(4,"span"),p(5),a()(),r(6,"div",16)(7,"p-datepicker",18),D("ngModelChange",function(o){u(e);let l=c();return I(l.posData.Invoice.DateCustom,o)||(l.posData.Invoice.DateCustom=o),f(o)}),a()()(),r(8,"div",16)(9,"label",19),h(10,"i",20),r(11,"span"),p(12,"Time"),a()(),r(13,"div",16)(14,"app-timepicker",21),D("timeChange",function(o){u(e);let l=c();return I(l.posData.Invoice.TimeCustom,o)||(l.posData.Invoice.TimeCustom=o),f(o)}),a()()()(),r(15,"div",22)(16,"div",23)(17,"div")(18,"p-checkbox",24),D("ngModelChange",function(o){u(e);let l=c();return I(l.recipientNotBuyer,o)||(l.recipientNotBuyer=o),f(o)}),a()(),r(19,"div",25)(20,"span"),h(21,"i",26),a(),r(22,"h6",23)(23,"span"),p(24,"Recipient \u2260 Buyer"),a(),r(25,"span",27),h(26,"i",28),a()()()()(),g(27,Ws,25,4,"div",10)}if(n&2){let e=c();s(5),x(" ",e.dateLabel," "),s(2),O("ngModel",e.posData.Invoice.DateCustom),m("baseZIndex",1e4)("showClear",!0),s(7),O("time",e.posData.Invoice.TimeCustom),m("showIcon",!0)("showCloseBtn",!1)("fullWidth",!0)("showClear",!0),s(4),O("ngModel",e.recipientNotBuyer),m("binary",!0),s(9),C(e.recipientNotBuyer?27:-1)}}var di=class n{constructor(t,e,i,o,l,b,V){this._dialogRef=t;this._orderDataService=e;this._posService=i;this._orderProcessorService=o;this._productHttpService=l;this._outletService=b;this.datePipe=V;this.destroy$=new q,this.initStartTime(),this.subscribePosData(),this.initModal()}modalConfig=new B;isDisabledNgSelectOutlet=!1;isDelivery=E(!1);customDate=null;shipping=new bi;deliveryEntityID="";posData=new ut;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 bi})}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=ot(Fe,this.posData.CartItems),i;this.posData.CartItems=e.map(o=>(o.isSerialType()&&(i=t.findIndex(l=>l.VariantID==o.VariantID),i!==-1&&(o.Serial=this.filterSerialBySelectedSerial(o.Serial,t[i].Serial))),o)),this._orderDataService.pushNewValue(this.posData)}filterSerialBySelectedSerial(t=[],e){let i;return e.filter(l=>(i=t.findIndex(b=>b.Number==l.Number),i!==-1))}close(){this._dialogRef.close()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(F),d(R),d(A),d(U),d(Ki),d($),d(Qe))};static \u0275cmp=P({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()}),h(6,"i",5),r(7,"span",6),p(8," Now "),r(9,"small",7)(10,"em"),p(11,"(in store purchase)"),a()()()(),r(12,"button",8),_("click",function(){return i.isDelivery.set(!0),i.changeDelivery()}),h(13,"i",9),r(14,"span",6),p(15," Later "),r(16,"small",7)(17,"em"),p(18,"(shipped to customer address)"),a()()()()()(),r(19,"div",10)(20,"div",11),g(21,Us,6,6,"div")(22,Qs,28,12),a()()()()()),e&2&&(m("config",i.modalConfig),s(5),le(me(8,js,!i.isDelivery(),i.isDelivery())),m("disabled",i.disableShippingNow),s(7),le(me(11,Hs,!i.isDelivery(),i.isDelivery())),m("disabled",i.disableShippingLater),s(9),C(i.isDelivery()?22:21))},dependencies:[ge,j,Nr,Rr,fe,z,Q,ee,Lr,Ar,Wi,kr,wr,Zt,gt,Er,Tr],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 Bn=class n{constructor(t){this.httpService=t}getParkedOrder(t,e){return this.httpService.get(be.GetPark,[{key:"EntityID",value:t},{key:"RegisterID",value:e}])}removeOrder(t,e){let i={OrderID:t};return e?this.httpService.post(be.VoidPark,i):this.httpService.post(be.RemovePark,i)}mergePark(t){return this.httpService.post(be.MergePark,t)}getOutstanding(t){let e={EntityID:t};return this.httpService.post(be.GetOutStanding,e)}static \u0275fac=function(e){return new(e||n)(N($e))};static \u0275prov=at({token:n,factory:n.\u0275fac,providedIn:"root"})};var $s=(n,t)=>({"d-flex align-items-center justify-content-center":n,"custom-container-height":t}),Na=()=>["ParkLabel","Number"],Va=n=>({"no-hover":n}),Aa=n=>({"bg-danger":n}),La=n=>({"text-white":n}),Fa=(n,t,e)=>({"duration-green":n,"duration-yellow":t,"duration-red":e});function Gs(n,t){if(n&1&&(r(0,"span",12),p(1),a()),n&2){let e=t.$implicit,i=t.$index;m("hidden",i==0),s(),x(" ",e.ParkLabel??e.Number," ")}}function Js(n,t){if(n&1&&(r(0,"div",7),ie(1,Gs,2,2,"span",12,pe),r(3,"span",13),p(4,"will be merged to"),a(),r(5,"span",14),p(6),a()()),n&2){let e=c(2);s(),ne(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,Js,7,1,"div",7),r(2,"div",8)(3,"span",9),h(4,"i",10),a(),r(5,"input",11),D("ngModelChange",function(o){u(e);let l=c();return I(l.filter,o)||(l.filter=o),f(o)}),a()()()}if(n&2){let e=c();s(),C(e.listMerge.length>1?1:-1),s(4),O("ngModel",e.filter)}}function Ks(n,t){if(n&1&&h(0,"i"),n&2){let e=c(2).$implicit;le(e.Icon)}}function Ys(n,t){if(n&1&&(r(0,"h5",22),g(1,Ks,1,2,"i",23),r(2,"span"),p(3),v(4,"limitTo"),a()()),n&2){let e=c().$implicit,i=c(4);s(),C(e.Icon?1:-1),s(2),x(" ",i.parkedOrders.length<5?e.Name:Z(4,2,e.Name,5)," ")}}function Xs(n,t){if(n&1&&(r(0,"div",36),h(1,"i",42),r(2,"span",35),p(3),v(4,"slice"),a()()),n&2){let e=c().$implicit;s(2),m("matTooltip",e.CustomerDisplay),s(),x(" ",e.CustomerDisplay.length>20?Ne(4,2,e.CustomerDisplay,0,20)+"...":e.CustomerDisplay," ")}}function Zs(n,t){if(n&1&&(r(0,"div",38),p(1),a()),n&2){let e=c().$implicit;s(),x(" ",e.alias," ")}}function ec(n,t){if(n&1){let e=y();r(0,"div",24)(1,"div",25)(2,"div",26),_("click",function(o){let l=u(e).$implicit;return c(6).onOrderClicked(l),f(o.preventDefault())}),r(3,"h5",27)(4,"div",28),p(5),a(),r(6,"span",29),_("click",function(o){let l=u(e).$implicit;return c(6).remove(l),f(o.stopPropagation())}),h(7,"i",30),a()(),r(8,"div",31)(9,"div",32)(10,"div",33),h(11,"i",34),r(12,"span",35),p(13),v(14,"slice"),a()(),r(15,"div",36),h(16,"i",37),p(17),v(18,"date"),a(),g(19,Xs,5,6,"div",36),g(20,Zs,2,1,"div",38),a(),r(21,"div",39)(22,"div",40),p(23),a(),r(24,"input",41),D("ngModelChange",function(o){let l=u(e).$implicit;return I(l.selected,o)||(l.selected=o),f(o)}),_("change",function(){let o=u(e).$implicit,l=c(6);return f(l.chooseMerge(o))})("click",function(o){return u(e),f(o.stopPropagation())}),a()()()()()()}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,Va,o))("matTooltip",o?"You\u2019re currently retrieving this order and cannot retrieve it again!":""),s(2),m("ngClass",T(24,Aa,o)),s(),m("ngClass",T(26,La,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?Ne(14,15,e.Number,0,15)+"...":e.Number," "),s(4),x(" ",Z(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",hi(28,Fa,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),O("ngModel",e.selected)}}function tc(n,t){if(n&1&&(r(0,"div",20),ie(1,ec,25,32,"div",24,pe),v(3,"FilterByArray"),a()),n&2){let e=c().$implicit,i=c(4);s(),ne(Ne(3,0,e.List,ct(4,Na),i.filter))}}function ic(n,t){n&1&&(r(0,"div",21),h(1,"app-empty-state"),a())}function nc(n,t){if(n&1&&(r(0,"mat-tab"),K(1,Ys,5,5,"ng-template",18),r(2,"div",19),g(3,tc,4,5,"div",20)(4,ic,2,0,"div",21),a()()),n&2){let e=t.$implicit;s(3),C(e.List.length>0?3:4)}}function oc(n,t){if(n&1&&(r(0,"mat-tab-group",17),ie(1,nc,5,1,"mat-tab",null,pe),a()),n&2){let e=c(3);s(),ne(e.Layout)}}function rc(n,t){if(n&1&&(r(0,"div",15),g(1,oc,3,0,"mat-tab-group",17),a()),n&2){let e=c(2);s(),C(e.parkedOrders.length!=0?1:-1)}}function ac(n,t){if(n&1&&(r(0,"div",36),h(1,"i",42),r(2,"span",35),p(3),v(4,"slice"),a()()),n&2){let e=c().$implicit;s(2),m("matTooltip",e.CustomerDisplay),s(),w(e.CustomerDisplay.length>20?Ne(4,2,e.CustomerDisplay,0,20)+"...":e.CustomerDisplay)}}function lc(n,t){if(n&1&&(r(0,"div",38),p(1),a()),n&2){let e=c().$implicit;s(),x(" ",e.alias," ")}}function sc(n,t){if(n&1){let e=y();r(0,"div",24)(1,"div",44)(2,"div",26),_("click",function(o){let l=u(e).$implicit;return c(3).onOrderClicked(l),f(o.preventDefault())}),r(3,"h5",27)(4,"div",28),p(5),a(),r(6,"span",29),_("click",function(o){let l=u(e).$implicit;return c(3).remove(l),f(o.stopPropagation())}),h(7,"i",45),a()(),r(8,"div",31)(9,"div",32)(10,"div",33),h(11,"i",34),r(12,"span",35),p(13),v(14,"slice"),a()(),r(15,"div",36),h(16,"i",37),p(17),v(18,"date"),a(),g(19,ac,5,6,"div",36),g(20,lc,2,1,"div",38),a(),r(21,"div",39)(22,"div",40),p(23),a(),r(24,"input",41),D("ngModelChange",function(o){let l=u(e).$implicit;return I(l.selected,o)||(l.selected=o),f(o)}),_("change",function(){let o=u(e).$implicit,l=c(3);return f(l.chooseMerge(o))})("click",function(o){return u(e),f(o.stopPropagation())}),a()()()()()()}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,Va,o))("matTooltip",o?"You\u2019re currently retrieving this order and cannot retrieve it again!":""),s(2),m("ngClass",T(24,Aa,o)),s(),m("ngClass",T(26,La,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?Ne(14,15,e.Number,0,18)+"...":e.Number),s(4),x(" ",Z(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",hi(28,Fa,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),O("ngModel",e.selected)}}function cc(n,t){if(n&1&&(r(0,"div",16)(1,"div",43),ie(2,sc,25,32,"div",24,pe),v(4,"FilterByArray"),a()()),n&2){let e=c(2);s(2),ne(Ne(4,0,e.parkedOrders,ct(4,Na),e.filter))}}function pc(n,t){if(n&1&&g(0,rc,2,1,"div",15)(1,cc,5,5,"div",16),n&2){let e=c();C(e.retreiveMode==1?0:e.retreiveMode==0?1:-1)}}function dc(n,t){n&1&&h(0,"app-empty-state",3)}function mc(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"),a()}}function uc(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"),a()}}var jn=class n{constructor(t,e,i,o,l,b,V,G,ve,Be){this._dialogRef=t;this._parkedOrderService=e;this._localData=i;this._OrderHttpService=o;this._orderProcessorService=l;this._posHttpResponseService=b;this._salesOrderDataService=V;this.outletService=G;this._toastr=ve;this.roleService=Be;let je=this._salesOrderDataService.Data;this.entityId=je.Order.EntityID,this.templateID=G.Data.PrintTemplate.ID,this.RegisterID=je.Order.RegisterID,this.park=new ri(this.outletService.Data.ParkLayoutPack),this.Layout=G.Data?.ParkLayoutPack?.Layout,this.initModalDialog(),this.initConfig(),this.initSelectedRetrieve(),this.getData()}modalConfig=new B;filter;entityId;parkedOrders=[];filterAlwaysVisible;replaceAlias;parkDeletionRestriction;parkEnableMerge;AuthorizeParkOrderDeletion;listMerge=[];park;templateID;RegisterID;voidEnabled;retreiveMode;Layout;isRetrieve=E(!1);parkLabel=E(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 l=new Date(o.Created),V=Math.abs(new Date().getTime()-l.getTime()),G=Math.floor(V%864e5/36e5),ve=Math.round(V%864e5%36e5/6e4);o.Duration=G>0?ve+G*60:ve});else{i.Alias=this.park.GetAlias(i.ParkLabel),i.MemberIdentification=i.MemberIdentification?i.MemberIdentification:"";let o=new Date(i.Created),b=Math.abs(new Date().getTime()-o.getTime()),V=Math.floor(b%864e5/36e5),G=Math.round(b%864e5%36e5/6e4);i.Duration=V>0?G+V*60:G}}),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(F),d(Bn),d(Ye),d(De),d(U),d(A),d(R),d($),d(X),d(de))};static \u0275cmp=P({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,pc,2,1)(5,dc,1,0,"app-empty-state",3),a()(),r(6,"footer",4)(7,"div",5),g(8,mc,2,0,"a",6),g(9,uc,2,0,"a",6),a()()()),e&2&&(m("config",i.modalConfig),s(2),m("ngClass",me(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:[H,z,$t,Q,ee,j,se,Bi,Pt,Ot,Br,Fi,Qe,ji,Pr],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 Ba=[{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 Hn=class{OrderID;ParkLabel;Items};var fc=n=>({"no-border":n});function gc(n,t){if(n&1){let e=y();r(0,"tr",13)(1,"td"),p(2),a(),r(3,"td"),p(4),v(5,"number"),a(),r(6,"td")(7,"div",14)(8,"button",15),_("click",function(){let o=u(e).$index,l=c();return f(l.onRemoveQuantity(o))}),p(9,"-"),a(),r(10,"input",16),D("ngModelChange",function(o){let l=u(e).$implicit;return I(l.SplitQuantity,o)||(l.SplitQuantity=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onSplitedQuantityChange())}),a(),r(11,"button",17),_("click",function(){let o=u(e).$index,l=c();return f(l.onAddQuantity(o))}),p(12,"+"),a()()(),r(13,"td",18),p(14),v(15,"number"),a()()}if(n&2){let e=t.$implicit,i=t.$index,o=c();m("ngClass",T(11,fc,i==(o.cartItems==null?null:o.cartItems.length)-1)),s(2),w(e==null||e.Variant==null?null:e.Variant.Name),s(2),w(M(5,7,e==null?null:e.Price)),s(6),O("ngModel",e.SplitQuantity),m("max",e.Quantity)("min",0),s(4),w(M(15,9,e==null?null:e.Quantity))}}var Un=class n{constructor(t,e,i,o,l,b){this.dialogRef=t;this.salesOrderDataService=e;this.parkService=i;this.orderProcessorService=o;this.toastr=l;this.calculatorService=b;let V=this.salesOrderDataService?.Data?.CartItems;this.cartItems=ot(Fe,V),this.salesOrderData=ot(ut,this.salesOrderDataService.Data),this.currencySymbol=this.calculatorService.currencySymbol}modalConfig=new B;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 Hn,this.splitData.OrderID=this.salesOrderDataService?.Data?.Order?.ID,this.splitData.ParkLabel=this.parkLabel,this.splitData.Items=this.cartItems.map(t=>({ID:t.ID,Quantity:t.SplitQuantity}))}onSplitedQuantityChange(){this.splitPriceTotal=this.cartItems.map(t=>t.SplitQuantity?t.SplitQuantity:0).reduce((t,e,i)=>t+e*this.cartItems[i]?.Price,0)}onAddQuantity(t){this.cartItems=this.cartItems.map((e,i)=>(i==t&&e.SplitQuantity<e.Quantity&&(e.SplitQuantity+=1),e)),this.onSplitedQuantityChange()}onRemoveQuantity(t){this.cartItems=this.cartItems.map((e,i)=>(i==t&&e.SplitQuantity>0&&(e.SplitQuantity-=1),e)),this.onSplitedQuantityChange()}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(F),d(R),d(ke),d(U),d(X),d(Ce))};static \u0275cmp=P({type:n,selectors:[["app-modal-split"]],features:[st([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),D("ngModelChange",function(l){return I(i.parkLabel,l)||(i.parkLabel=l),l}),a()(),r(7,"div",6)(8,"div",7),p(9,"Splitted Amount"),a(),r(10,"div",8),p(11),v(12,"number"),a()(),r(13,"table",9)(14,"thead",10)(15,"tr")(16,"th"),p(17,"Name"),a(),r(18,"th"),p(19,"Price"),a(),r(20,"th",11),p(21,"Qty Split"),a(),r(22,"th",12),p(23,"Qty"),a()()(),r(24,"tbody"),ie(25,gc,16,13,"tr",13,pe),a()()()()()()()),e&2&&(m("config",i.modalConfig),s(6),O("ngModel",i.parkLabel),s(5),Te("",i.currencySymbol," ",i.splitPriceTotal?M(12,4,i.splitPriceTotal):0),s(14),ne(i.cartItems))},dependencies:[re,H,ge,j,ht,mt,fe,z,Q,ee,Pa,Y],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 Wn=class n{constructor(t,e){this.data=t;this._dialogRef=e;this.message=t.message,this.initModal()}modalConfig=new B;message;initModal(){this.modalConfig.title=this.data.title,this.modalConfig.headerType=Ae.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(Le),d(F))};static \u0275cmp=P({type:n,selectors:[["POS-modal-info"]],standalone:!1,decls:4,vars:2,consts:[[3,"onCancel","onClose","config"],[1,"fw-normal","d-flex","justify-content-center"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"h4",1),p(3),a()()()),e&2&&(m("config",i.modalConfig),s(3),w(i.message))},dependencies:[j],encapsulation:2})};var Qn=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 B;cartItem=new Fe;role;isSerialItem=!1;priceVisible;unitPriceEditor;pricebookSelector;pricebookCopyDesc;calculatorQtyDisabled;calculatorPriceDisabled;productCalculator=E(!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=E(!1);enableCalculatorNote=E(!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 Io=(l=>(l[l.SELL_INPUT=0]="SELL_INPUT",l[l.DISCOUNT=1]="DISCOUNT",l[l.PRODUCT=2]="PRODUCT",l[l.SERIAL=3]="SERIAL",l[l.CALCULATOR=4]="CALCULATOR",l))(Io||{});var Cc=(n,t)=>({"tooltip-container-bottom":n,"tooltip-container-top":t});function _c(n,t){n&1&&Ci(0)}var qn=class n{text;position;content;static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["POS-tooltip"]],inputs:{text:"text",position:"position",content:"content"},standalone:!1,decls:3,vars:6,consts:[[3,"ngClass"],[4,"ngTemplateOutlet"]],template:function(e,i){e&1&&(r(0,"div",0),p(1),K(2,_c,1,0,"ng-container",1),a()),e&2&&(m("ngClass",me(3,Cc,i.position=="top"||!i.position,i.position=="bottom")),s(),x(" ",i.text," "),s(),m("ngTemplateOutlet",i.content))},dependencies:[H,Li],styles:['.tooltip-container-top[_ngcontent-%COMP%]{box-shadow:0 0 5px #0003;margin:.7rem 1rem 1rem;min-width:50px;max-width:400px;background:#fff;border:1px solid #ccc;pointer-events:none;position:relative;min-height:1rem;padding:.5rem;border-radius:4px}.tooltip-container-top[_ngcontent-%COMP%]:after, .tooltip-container-top[_ngcontent-%COMP%]:before{content:"";display:block;position:absolute;bottom:100%;width:0;height:0;border-style:solid}.tooltip-container-top[_ngcontent-%COMP%]:after{left:calc(49% + 2px);border-color:transparent transparent #fff transparent;border-width:6px}.tooltip-container-top[_ngcontent-%COMP%]:before{left:49%;border-color:transparent transparent #ccc transparent;border-width:8px}.tooltip-container-bottom[_ngcontent-%COMP%]{box-shadow:0 0 5px #0003;margin:.7rem 1rem 1rem;min-width:50px;max-width:400px;background:#fff;border:1px solid #ccc;pointer-events:none;position:relative;min-height:1rem;padding:.5rem;border-radius:4px}.tooltip-container-bottom[_ngcontent-%COMP%]:after, .tooltip-container-bottom[_ngcontent-%COMP%]:before{content:"";display:block;position:absolute;bottom:100%;width:0;height:0;border-style:solid}.tooltip-container-bottom[_ngcontent-%COMP%]:after{left:calc(40% + 2px);border-color:#fff transparent transparent transparent;border-width:6px;top:100%}.tooltip-container-bottom[_ngcontent-%COMP%]:before{left:40%;border-color:#ccc transparent transparent transparent;border-width:8px;top:100%}']})};var $n=class n{constructor(t,e,i){this.overlayPositionBuilder=t;this.elementRef=e;this.overlay=i}content;position;overlayRef;ngOnInit(){let t=this.initPosition(),e=this.overlayPositionBuilder.flexibleConnectedTo(this.elementRef).withPositions([t]);this.overlayRef=this.overlay.create({positionStrategy:e})}initPosition(){let t={originX:"center",originY:"bottom",overlayX:"center",overlayY:"top"};switch(this.position){case"top":t={originX:"center",originY:"top",overlayX:"center",overlayY:"bottom"};break}return t}show(){if(this.content){this.overlayRef.detach();let t=new dr(qn),e=this.overlayRef.attach(t);typeof this.content=="string"?e.instance.text=this.content:e.instance.content=this.content,e.instance.position=this.position}}hide(){this.overlayRef.detach()}static \u0275fac=function(e){return new(e||n)(d(mr),d(jo),d(ur))};static \u0275dir=Ti({type:n,selectors:[["","customTooltip",""]],hostBindings:function(e,i){e&1&&_("mouseenter",function(){return i.show()})("mouseleave",function(){return i.hide()})},inputs:{content:[0,"customTooltip","content"],position:"position"},standalone:!1})};var Sc=["quantity"],yc=["price"],xc=["discount"],Mc=["unitCost"],Oi=n=>({selected:n}),Pc=n=>({"mt-8":n}),ja=n=>({"qtyBtn-disabled":n}),Oc=()=>["/menu/Products/Catalog/Variants/Info"],Ic=n=>({ID:n}),Dc=n=>({"editable-box":n}),wc=n=>({"col-12":n});function kc(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 "),a()}if(n&2){let e=c();m("ngClass",T(1,Oi,e.modalItemState.PRODUCT==e.currentState))}}function Tc(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 "),a()}if(n&2){let e=c();m("ngClass",T(1,Oi,e.modalItemState.SERIAL==e.currentState))}}function Ec(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 "),a()}if(n&2){let e=c();m("ngClass",T(1,Oi,e.modalItemState.CALCULATOR==e.currentState))}}function Rc(n,t){if(n&1&&(r(0,"div",29)(1,"div",30)(2,"div"),p(3),a(),r(4,"small",31),p(5),a()()()),n&2){let e=t.data;s(3),w(e==null?null:e.Value),s(2),w(e==null?null:e.Code)}}function Nc(n,t){if(n&1){let e=y();r(0,"div",16)(1,"div",27)(2,"autocompleteV2",28,0),_("onSelect",function(o){u(e);let l=c(2);return f(l.onAddItem(o))})("onInputEnter",function(o){u(e);let l=c(2);return f(l.onEnterProductCode(o))}),a(),K(4,Rc,6,2,"ng-template",null,1,yt),a()()}if(n&2){let e=nt(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 Vc(n,t){n&1&&(r(0,"div",20)(1,"div",32),p(2," Edit Prepaid Package Quantity is disabled during EDIT MODE "),a(),r(3,"div"),p(4," If you make a mistake, please delete the item and then add again "),a()())}function Ac(n,t){if(n&1&&(r(0,"span"),p(1),a()),n&2){let e=c(3);s(),x("(",e.cartItem.Variant==null?null:e.cartItem.Variant.UOMName,")")}}function Lc(n,t){if(n&1){let e=y();r(0,"div",38)(1,"strong")(2,"span"),p(3),a()(),r(4,"input",43),D("ngModelChange",function(o){u(e);let l=c(3);return I(l.cartItem.UnitQuantity,o)||(l.cartItem.UnitQuantity=o),f(o)}),a()()}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),O("ngModel",e.cartItem.UnitQuantity)}}function Fc(n,t){if(n&1&&(h(0,"input",40,3),v(2,"number")),n&2){let e=c(3);m("value",M(2,1,e.cartItem.Price))}}function Bc(n,t){if(n&1){let e=y();r(0,"input",44,3),D("ngModelChange",function(o){u(e);let l=c(3);return I(l.cartItem.Price,o)||(l.cartItem.Price=o),f(o)}),a()}if(n&2){let e=c(3);m("simpleKeyboard",e.keyboard)("readonly",!e.unitPriceEditor||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible),O("ngModel",e.cartItem.Price)}}function jc(n,t){if(n&1&&(r(0,"div",42)(1,"span",45),p(2),a()()),n&2){let e,i=c(3);s(2),x("Pricebook ",(e=i.selectedPriceBook())==null?null:e.Name," is applied")}}function Hc(n,t){if(n&1){let e=y();r(0,"div",21)(1,"div",33)(2,"strong"),p(3," Qty "),g(4,Ac,2,1,"span"),a(),r(5,"div",34)(6,"button",35),_("click",function(){u(e);let o=c(2);return f(o.updateItemQuantity(o.cartItem.Quantity!=null?o.cartItem.Quantity-1:0))}),p(7," - "),a(),r(8,"input",36,2),_("ngModelChange",function(o){u(e);let l=c(2);return f(l.updateItemQuantity(o))}),a(),r(10,"button",37),_("click",function(){u(e);let o=c(2);return f(o.updateItemQuantity(o.cartItem.Quantity!=null?o.cartItem.Quantity+1:1))}),p(11," + "),a()()(),g(12,Lc,5,5,"div",38),r(13,"div",39)(14,"strong"),p(15,"Price"),a(),g(16,Fc,3,3,"input",40)(17,Bc,2,3,"input",41),a(),g(18,jc,3,1,"div",42),a()}if(n&2){let e=c(2);m("ngClass",T(15,Pc,e.statusModal=="create")),s(4),C(e.cartItem.Variant!=null&&e.cartItem.Variant.UOM&&(e.cartItem.Variant!=null&&e.cartItem.Variant.UOMName)?4:-1),s(2),m("ngClass",T(17,ja,(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(19,ja,(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?12:-1),s(),m("hidden",!e.priceVisible),s(3),C(!e.unitPriceEditor||e.cartItem!=null&&e.cartItem.PromotionGift&&!e.editingItemPromotionVisible?16:17),s(2),C(e.selectedPriceBook()?18:-1)}}function Uc(n,t){if(n&1){let e=y();r(0,"div",23)(1,"strong"),p(2,"Sales Person"),a(),r(3,"ng-select-infinite",46),_("selectedChange",function(o){u(e);let l=c(2);return f(l.updateSales(o))}),D("selectedChange",function(o){u(e);let l=c(2);return I(l.cartItem.SalesID,o)||(l.cartItem.SalesID=o),f(o)}),a()()}if(n&2){let e=c(2);s(3),m("customTooltip",e.salesPersonName)("items",e.sales),O("selected",e.cartItem.SalesID)}}function Wc(n,t){if(n&1){let e=y();r(0,"div",23)(1,"strong"),p(2,"Fulfillment From"),a(),r(3,"ng-select",47),_("ngModelChange",function(){u(e);let o=c(2);return f(o.onDeliveryEntityChange())}),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.cartItem.EntityID,o)||(l.cartItem.EntityID=o),f(o)}),a()()}if(n&2){let e=c(2);s(3),m("disabled",e.isSellEdit())("items",e.entities),O("ngModel",e.cartItem.EntityID)}}function Qc(n,t){if(n&1){let e=y();r(0,"div",15),g(1,Nc,6,6,"div",16),g(2,Vc,5,0,"div",20),g(3,Hc,19,21,"div",21),r(4,"div",22),g(5,Uc,4,3,"div",23),g(6,Wc,4,3,"div",23),a(),r(7,"div",24)(8,"div",25)(9,"POS-tinymce-editor",26),D("ngModelChange",function(o){u(e);let l=c();return I(l.cartItem.Note,o)||(l.cartItem.Note=o),f(o)}),a()()()()}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),O("ngModel",e.cartItem.Note)}}function qc(n,t){if(n&1&&(h(0,"input",40),v(1,"number")),n&2){let e=c(2);m("value",M(1,1,e.cartItem.Discount))}}function $c(n,t){if(n&1){let e=y();r(0,"input",74,4),_("ngModelChange",function(o){u(e);let l=c(2);return f(l.updateDiscountPercentage(o))}),a()}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 Gc(n,t){if(n&1&&(h(0,"input",40),v(1,"number")),n&2){let e=c(2);m("value",M(1,1,e.inputedDiscountAmount))}}function Jc(n,t){if(n&1){let e=y();r(0,"input",75,5),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.inputedDiscountAmount,o)||(l.inputedDiscountAmount=o),f(o)}),_("ngModelChange",function(o){u(e);let l=c(2);return f(l.onDiscountAmountChange(o))}),a()}if(n&2){let e=c(2);m("max",e.cartItem==null?null:e.cartItem.GrossTotal)("simpleKeyboard",e.keyboard),O("ngModel",e.inputedDiscountAmount),m("preventNegative",!0)("readonly",!e.role.Discount||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)}}function zc(n,t){if(n&1&&(r(0,"div",54)(1,"div",50)(2,"strong"),p(3,"Discount Amount / Qty"),a()(),r(4,"div",51)(5,"div",76)(6,"p"),p(7),v(8,"number"),a()()()()),n&2){let e=c(2);s(7),w(M(8,1,e.cartItem.DiscountAmount))}}function Kc(n,t){if(n&1){let e=y();r(0,"div",54)(1,"div",50)(2,"strong"),p(3,"Pricebook"),a()(),r(4,"div",51)(5,"ng-select",77),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.pricebookId,o)||(l.pricebookId=o),f(o)}),_("ngModelChange",function(){u(e);let o=c(2);return f(o.pricebookChange())})("clear",function(){u(e);let o=c(2);return f(o.onClearPricebook())}),a()()()}if(n&2){let e=c(2);s(5),m("items",e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.PriceBook),O("ngModel",e.pricebookId),m("disabled",e.pricebookDisabled)}}function Yc(n,t){if(n&1&&(r(0,"div",68)(1,"h5",78),p(2),v(3,"number"),a()()),n&2){let e=c(2);s(2),x(" ",M(3,1,e.cartItem.Discount),"% ")}}function Xc(n,t){if(n&1&&(r(0,"div",69)(1,"h5"),p(2),v(3,"number"),a(),r(4,"span",67),p(5,"x"),a(),r(6,"h5"),p(7),v(8,"number"),a()()),n&2){let e=c(2);s(2),w(M(3,2,e.cartItem.Quantity)),s(5),w(M(8,4,e.cartItem.DiscountAmount))}}function Zc(n,t){if(n&1&&(r(0,"h5",72),p(1),v(2,"number"),a()),n&2){let e=c(2);s(),x(" -",M(2,1,(e.cartItem==null?null:e.cartItem.GrossTotal)*(e.cartItem.Discount/100))," ")}}function ep(n,t){if(n&1&&(r(0,"div",71)(1,"h5",72),p(2),v(3,"number"),a()()),n&2){let e=c(2);s(2),x(" -",M(3,1,e.cartItem.Quantity*e.cartItem.DiscountAmount)," ")}}function tp(n,t){if(n&1&&(r(0,"div",73)(1,"div",79)(2,"h5"),p(3,"Grand Total"),a()(),r(4,"div",79)(5,"h5"),p(6),v(7,"number"),a()()()),n&2){let e=c(2);s(6),w(M(7,1,e.cartItem.Total))}}function ip(n,t){if(n&1){let e=y();r(0,"div",16)(1,"div",48)(2,"div",49)(3,"div",50)(4,"strong"),p(5,"Discount %"),a()(),r(6,"div",51)(7,"div",52),g(8,qc,2,3,"input",40)(9,$c,2,4,"input",53),a()()(),r(10,"div",54)(11,"div",50)(12,"strong"),p(13,"Discount Amount"),a()(),r(14,"div",51)(15,"div",52),g(16,Gc,2,3,"input",40)(17,Jc,2,5,"input",55),a()()(),r(18,"div",56)(19,"div",57)(20,"input",58),D("ngModelChange",function(o){u(e);let l=c();return I(l.isDiscMultipliciedQty,o)||(l.isDiscMultipliciedQty=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onSwitchToggleDiscount())}),a()(),r(21,"div",59)(22,"strong"),p(23,"*Quantity"),a(),r(24,"span",60),h(25,"i",61),a()()(),g(26,zc,9,3,"div",54),g(27,Kc,6,3,"div",54),a(),r(28,"div",62)(29,"div",63)(30,"h4"),p(31,"Discount Simulation"),a(),r(32,"h4",64),p(33),a()(),r(34,"div",65)(35,"div",50)(36,"div",66)(37,"h5"),p(38),v(39,"number"),a(),r(40,"span",67),p(41,"x"),a(),r(42,"h5"),p(43),v(44,"number"),a()(),g(45,Yc,4,3,"div",68),g(46,Xc,9,6,"div",69),a(),r(47,"div",50)(48,"div",70)(49,"h5"),p(50),v(51,"number"),a()(),r(52,"div",71),g(53,Zc,3,3,"h5",72),a(),g(54,ep,4,3,"div",71),a(),g(55,tp,8,3,"div",73),a()()()}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),O("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(M(39,14,e.cartItem.Quantity)),s(5),w(M(44,16,e.cartItem.Price)),s(2),C(e.cartItem.Discount?45:-1),s(),C(e.cartItem.DiscountAmount>0?46:-1),s(4),w(M(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 np(n,t){n&1&&(r(0,"div",82),h(1,"i",100),r(2,"h6"),p(3,"No Image"),a()())}function op(n,t){if(n&1&&h(0,"img",83),n&2){let e=c(2);m("src",e.cartItem.Variant.ThumbnailUrl,tt)}}function rp(n,t){if(n&1){let e=y();r(0,"div",93)(1,"div",99),p(2),v(3,"number"),a(),r(4,"button",101),_("click",function(){u(e);let o=c(2);return f(o.toggleEditCost())}),h(5,"i",102),a()()}if(n&2){let e=c(2);s(2),Te(" ",e.currencySymbol," ",Z(3,2,e.cartItem.Cost,"1.0-4")," ")}}function ap(n,t){if(n&1){let e=y();r(0,"div",94)(1,"div",103)(2,"input",104),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.cartItem.Cost,o)||(l.cartItem.Cost=o),f(o)}),a(),r(3,"button",105),_("click",function(){u(e);let o=c(2);return f(o.toggleEditCost())}),h(4,"i",106),a()()()}if(n&2){let e=c(2);s(2),O("ngModel",e.cartItem.Cost)}}function lp(n,t){if(n&1&&(r(0,"div",91)(1,"div",87)(2,"div",88),p(3,"Commission"),a(),r(4,"div",99),p(5),v(6,"number"),a()()()),n&2){let e=c(2);m("ngClass",e.generalPriceCol),s(5),Te(" ",e.currencySymbol," ",M(6,3,1e4)," ")}}function sp(n,t){if(n&1&&(r(0,"div",98)(1,"div",87)(2,"div",88),p(3,"Storage Location"),a(),r(4,"div",99),p(5),a()()()),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",110),p(2),a(),r(3,"td",111),p(4),v(5,"number"),a(),r(6,"td",111),p(7),v(8,"number"),a()()),n&2){let e=t.$implicit,i=c(3);s(2),x(" ",e.Name," "),s(2),x(" ",M(5,4,e.MinimumQuantity)," "),s(3),Te(" ",i.currencySymbol," ",M(8,6,e.UnitPrice)," ")}}function pp(n,t){if(n&1&&(r(0,"div",22)(1,"h5",85),p(2,"Pricebook"),a(),r(3,"div",97)(4,"table",107)(5,"thead")(6,"tr")(7,"th",108),p(8,"Name"),a(),r(9,"th",109),p(10,"Min Qty"),a(),r(11,"th",109),p(12,"Price"),a()()(),r(13,"tbody"),ie(14,cp,9,8,"tr",null,pe),v(16,"sortBy"),a()()()()),n&2){let e=c(2);s(14),ne(Ne(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",80)(2,"a",81),g(3,np,4,0,"div",82)(4,op,1,1,"img",83),a()(),r(5,"div",84)(6,"div",16)(7,"h5",85),p(8,"Inventory"),a(),r(9,"div",86)(10,"div",87)(11,"div",88),p(12,"On Hand"),a(),r(13,"div",89),p(14),a()()(),r(15,"div",86)(16,"div",87)(17,"div",88),p(18,"Allocated"),a(),r(19,"div",89),p(20),a()()(),r(21,"div",86)(22,"div",90)(23,"div",88),p(24,"Available"),a(),r(25,"div",89),p(26),a()()()(),r(27,"div",22)(28,"h5",85),p(29,"General Price"),a(),r(30,"div",91)(31,"div",92)(32,"div",88),p(33,"Cost"),a(),g(34,rp,6,5,"div",93),g(35,ap,5,1,"div",94),a()(),r(36,"div",91)(37,"div",95)(38,"div",88),p(39,"Price"),a(),r(40,"div",96),p(41),v(42,"number"),a()()(),g(43,lp,7,5,"div",91),a(),r(44,"div",22)(45,"div",97)(46,"div",16)(47,"h5",85),p(48,"Advanced"),a(),r(49,"div",98)(50,"div",87)(51,"div",88),p(52,"Content"),a(),r(53,"div",99),p(54),v(55,"number"),a()()(),g(56,sp,6,1,"div",98),a()()(),g(57,pp,17,4,"div",22),a()()),n&2){let e=c();s(2),m("routerLink",ct(25,Oc))("queryParams",T(26,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),w(e.onHand),s(6),w(e.allocated),s(6),x(" ",e.onHand-e.allocated," "),s(4),m("ngClass",e.generalPriceCol),s(),m("ngClass",T(28,Dc,e.enabledEditCost())),s(3),C(e.enabledEditCost()?-1:34),s(),C(e.enabledEditCost()?35:-1),s(),m("ngClass",e.generalPriceCol),s(5),Te(" ",e.currencySymbol," ",M(42,21,e.cartItem.Variant.UnitPrice)," "),s(2),C(e.role.Commission&&(e.cartItem!=null&&e.cartItem.SalesCommission)?43:-1),s(6),le(T(30,wc,!(!(e.AppConfigJSON==null||e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.Grid==null)&&e.AppConfigJSON.ModuleSell.Grid.StorageVisible)||!e.cartItem.Variant.Storage)),s(5),Go(" ",e.cartItem==null?null:e.cartItem.VariantUnitQuantity," (@",e.currencySymbol,"",M(55,23,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?56:-1),s(),C((e.cartItem==null||e.cartItem.Variant==null||e.cartItem.Variant.PriceBook==null?null:e.cartItem.Variant.PriceBook.length)>0?57:-1)}}function mp(n,t){if(n&1){let e=y();r(0,"app-item-serial",112),D("cartItemChange",function(o){u(e);let l=c();return I(l.cartItem,o)||(l.cartItem=o),f(o)})("serialsChange",function(o){u(e);let l=c();return I(l.serials,o)||(l.serials=o),f(o)}),a()}if(n&2){let e=c();m("entityId",e.deliveryEntityId),O("cartItem",e.cartItem),m("disabled",e.orderManager.posState==2&&e.constants.IsNotEmpty(e.cartItem.ID)),O("serials",e.serials)}}function up(n,t){if(n&1){let e=y();r(0,"div",18)(1,"item-calculator-tab",113),_("discountTotal",function(o){u(e);let l=c();return f(l.cartItem.Discount=o)})("priceTotal",function(o){u(e);let l=c();return f(l.cartItem.Price=o)})("qtyTotal",function(o){u(e);let l=c();return f(l.cartItem.Quantity=o)})("noteChanges",function(o){u(e);let l=c();return f(l.enableCalculatorNote()?l.cartItem.Note=o:null)}),a()()}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 Je=class n extends Qn{constructor(e,i,o,l,b,V,G,ve,Be,je,mi,Ii,Di,At,ui){super();this._dialogRef=e;this.data=i;this._shoppingCartService=o;this._outletService=l;this._posService=b;this._orderProcessorService=V;this._orderDataService=G;this._variantService=ve;this._toastr=Be;this.decimalPipe=je;this._matDialog=mi;this._numpadService=Ii;this._userRoleService=Di;this._onlineStatusService=At;this.cdRef=ui;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=zo(Ft);_quantityElement;_priceElement;_discountElement;_costElement;invoiceCalculatorService=J(Ce);salesPersonName;destroy$;AppConfigJSON=new Gr;orderManager;salesOrderData;isOnline=!0;currentState;modalItemState=Io;isDiscMultipliciedQty=!0;inputedDiscountAmount=0;serials=[];constants=S;deliveryEntityId;selectedPriceBook=E(null);isPrepaidPackage=E(!1);isSellEdit=E(!1);deliveryStateID=Co;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=qi(Fe,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 Fe}initSelectedPriceBook(){if(this.cartItem.PriceTypeID==2){let e=this.cartItem.Variant&&this.cartItem.Variant.PriceBook?this.cartItem.Variant.PriceBook:[];if(e.length==1)this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=e[0].ID;else{let i=e.find(o=>o.ID==this.cartItem.PriceBookID);this.pricebookId=i?.ID}this.setSelectedPricebook()}}checkPriceBookDisabled(){if(this.cartItem.Variant){let e=this.cartItem.Variant.TypeID!=11&&!this.pricebookSelector,i=this.cartItem.Variant.TypeID==11&&this.cartItem.Variant.SellPriceType==0&&!this.pricebookSelector;this.pricebookDisabled=e||i}}checkCalculatorPriceDisabled(){if(this.cartItem.Variant){let e=this.cartItem.Variant.TypeID!=11&&!this.unitPriceEditor,i=this.cartItem.Variant.TypeID==11&&this.cartItem.Variant.SellPriceType==0&&!this.unitPriceEditor;this.calculatorPriceDisabled=e||i}}checkQtyInputDisabled(){let e=this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion,i=S.IsNotEmpty(this.cartItem.ID);return!!(e&&!this.role.SellEditor&&this.orderManager.posState==4&&i||i&&this.cartItem?.Serial?.length>0)}checkCalculatorQtyDisabled(){let e=this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkOrderDeletion,i=this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion;this.calculatorQtyDisabled=!e&&this.orderManager.posState===4&&!this.role.Order&&i}checkEmptySalesID(){if(this.salesOrderData.Order!=null){let e=this.salesOrderData.Order.SalesID;this.isEmptySalesID=S.IsEmpty(e)}}pricebookChange(){S.IsNotEmpty(this.pricebookId)&&(this.cartItem.pricebookUpdate(this.pricebookId,!this.pricebookDisabled,this.pricebookCopyDesc),this.setSelectedPricebook())}setSelectedPricebook(){let e=this.cartItem.getSelectedPricebook(this.pricebookId);this.selectedPriceBook.set(e)}onClearPricebook(){this.cartItem=this._shoppingCartService.resetAppliedPricebook(this.cartItem)}updateHeaderTitle(e){this.modalConfig.title=e}onDeliveryEntityChange(){let e=this.entities.find(i=>i.ID==this.cartItem.EntityID);e?this.cartItem.EntityName=e.Name:delete this.cartItem.EntityName}onOk(e){this.cartItem.removeEnterNote(),!(!this.validateConfigDefaultQuantity(e)||(this.cartItem.Variant.SellPriceType==2&&(this.cartItem.Cost=this.cartItem.Price),!this._shoppingCartService.validatePriceMinimum(this.cartItem)))&&(this.validateOnSubmit(),document.getElementById("product").focus())}validateConfigDefaultQuantity(e){let i=this.cartItem.Quantity;if(e=="Enter"){if(this.isSerial())return!1;if(!this.quantityToOneInDialog)return i>0}return!0}validateOnSubmit(){if(S.IsEmpty(this.cartItem.VariantID)){this._toastr.error("Enter item data before clicking OK!","No item is entered!");return}S.IsEmpty(this.cartItem.Quantity)&&this.updateItemQuantity(1),this.generateSerialItem(),this.checkValidateSerialItem(this.cartItem)&&this.onSubmitCartItem()}onSubmitCartItem(){if(this.data==null){let e=this.cartItem;this._shoppingCartService.pushNewItemToArray(e,!0),this._shoppingCartService.addAvailableComponent(e)}else this._shoppingCartService.updateCartItem(this.cartItem,this.data.index);this._orderProcessorService.reedemPointToDiscount(),this._dialogRef.close()}generateSerialItem(){this.cartItem.isSerialType()&&this.serials.length>0&&(!this.cartItem.Serial||this.cartItem?.Serial?.length==0)&&(this.cartItem.Serial=this.serials.map(e=>({Number:e,Quantity:-1,ExpiryDate:null})),this.cartItem.Quantity=this.serials.length*-1)}onCancel(){this._dialogRef.close()}checkValidateSerialItem(e){return this._shoppingCartService.validateSerialItem(e)}updateItemQuantity(e){!this.role.Return&&e<0||(this.cartItem.Quantity=e,this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=this.cartItem.PriceBookID,this.setSelectedPricebook())}updateDiscountPercentage(e){this.cartItem.Discount=Number(e)}updateOrUnitPrice(e){this.oriUnitPrice=e}quantityEditDisabled(){return this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion&&!this.role.Order&&S.IsNotEmpty(this.cartItem.ID)}onAddItem(e){let i=this.salesOrderData.Order.EntityID;this._variantService.findVariantByID(e,i).then(o=>{let l=o,b=new Fe;b.patchByVariant(l),this.addItem(b)})}onEnterProductCode(e){let i=this.salesOrderData.Order.EntityID;this._variantService.findVariantByCode(e,i).then(o=>{if(o){let l=Object.assign(new Fr,o),b=new Fe;b.patchByVariant(l),this.addItem(b)}else this.onProductNotFound(e)}).catch(o=>{window.alert(`Barcode "${e}" is not registered in the product`)})}onProductNotFound(e){this._matDialog.open(Wn,{data:{message:`Barcode "${e}" is not registered in the product`,title:"Product not found"},width:"30%"}),this.playAudio()}playAudio(){let e=new Audio;e.src="/Sounds/bell_ring.mp3",e.load(),e.play()}addItem(e){this.onHand=0,this.AppConfigJSON.ModuleSell.ProductDialog.QuantityToOneInDialog?e.Quantity=1:this._quantityElement.nativeElement.focus(),this.cartItem=this.checkItemQuantityDefault(e),this.isSerialItem=this.isSerial();let l=`Editing Cart item - ${e.Variant?e.Variant.Name:null}`;this.updateOrUnitPrice(e.UnitPriceOriginal),this.updateHeaderTitle(l),this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=this.cartItem.PriceBookID,this.checkPriceBookDisabled(),this.checkCalculatorPriceDisabled(),this.checkCalculatorQtyDisabled(),this.initIsUnitPriceEditor()}getStockItem(){this._variantService.getStockByID(this.cartItem.VariantID,this.salesOrderData.Order.EntityID).then(e=>{e&&(this.queryInventoryOnOpen=!0,this.allocated=e.Allocated,this.onHand=e.OnHand)})}onCalculatorQty(e){this.updateItemQuantity(e)}onCalculatorPrice(e){this.cartItem.Price=parseFloat(e)}onCalculatorUnitQty(e){this.cartItem.UnitQuantity=parseFloat(e)}resizeCloudinaryImage(e){return e&&(e=e.replace("w_80","w_150")),e}onDiscountAmountChange(e){this.isDiscMultipliciedQty?this.cartItem.DiscountAmount=e:this.cartItem.DiscountAmount=e/this.cartItem.Quantity}onSwitchToggleDiscount(){this.isDiscMultipliciedQty?this.cartItem.DiscountAmount=this.cartItem.DiscountAmount*this.cartItem.Quantity:this.cartItem.DiscountAmount=this.cartItem.DiscountAmount/this.cartItem.Quantity}onEditCost(){let e=!this.enabledEditCost();this.enabledEditCost.set(e),this.cdRef.detectChanges(),this.enabledEditCost()&&this._costElement.nativeElement?.focus()}onCalculatorValueChange(e){this.cartItem.Discount=e.discount,this.cartItem.Price=e.price,this.cartItem.Quantity=e.qty}toggleEditCost(){return this.enabledEditCost.update(e=>!e)}get generalPriceCol(){return this.role.Commission&&this.cartItem?.SalesCommission?"col-4":"col-6"}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(i){return new(i||n)(d(F),d(Le),d(we),d($),d(A),d(U),d(R),d(Ki),d(X),d(Y),d(ae),d(oa),d(de),d(Ge),d(Ko))};static \u0275cmp=P({type:n,selectors:[["POS-modal-item"]],viewQuery:function(i,o){if(i&1&&(Qo(o.calculatorTab,Ft,5),Se(Sc,5),Se(yc,5),Se(xc,5),Se(Mc,5)),i&2){qo();let l;ye(l=xe())&&(o._quantityElement=l.first),ye(l=xe())&&(o._priceElement=l.first),ye(l=xe())&&(o._discountElement=l.first),ye(l=xe())&&(o._costElement=l.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",3,"ngClass"],[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,"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"],["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",3,"ngClass"],[1,"info-value-wrapper"],[1,"info-input"],[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"],["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",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(b){return o.onOk(b)})("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 "),a(),r(7,"a",11),_("click",function(){return o.onTabChange(o.modalItemState.DISCOUNT)}),p(8," Discount "),a(),g(9,kc,2,3,"a",12),g(10,Tc,2,3,"a",13),g(11,Ec,2,3,"a",13),a()(),r(12,"div",14),g(13,Qc,10,6,"div",15),g(14,ip,56,20,"div",16),g(15,dp,58,32,"div",16),g(16,mp,1,4,"app-item-serial",17),g(17,up,2,7,"div",18),a()()()()),i&2&&(m("config",o.modalConfig),s(5),m("ngClass",T(11,Oi,o.modalItemState.SELL_INPUT==o.currentState)),s(2),m("ngClass",T(13,Oi,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:[H,z,$t,Q,ee,j,_t,$n,mt,se,gt,Wt,ra,va,Yt,$i,Ft,Y,Or],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."),a()())}function Cp(n,t){n&1&&(r(0,"span",9),p(1,"Enter the port or device URL used by your ECR middleware."),a())}var Gn=class n{constructor(t){this.dialogRef=t;this.config.title="Connect ECR",this.config.customWidth="400px"}ecrService=J(wt);config=new B;urlCtrl=new pt("https://localhost:5001/EcrHub",[Lt.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.",l=this.ecrService.isConnected()?t:i,b=this.ecrService.isConnected()?e:o;return{title:l,description:b}}static \u0275fac=function(e){return new(e||n)(d(F))};static \u0275cmp=P({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),h(4,"i",3),r(5,"h2"),p(6),a(),r(7,"span",4),p(8),a()(),r(9,"div",5)(10,"label",6),p(11,"Port / URL"),a(),h(12,"input",7),g(13,gp,3,0,"div",8)(14,Cp,2,0,"span",9),a()()()()),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:[re,H,ge,j,qe,z,Q,dt],encapsulation:2})};function _p(n,t){if(n&1){let e=y();r(0,"div",12)(1,"radio-options",13),D("modelChange",function(o){u(e);let l=c(2);return I(l.odsConfigType,o)||(l.odsConfigType=o),f(o)}),a(),r(2,"label",14),p(3,"Choose Configuration"),a()()}if(n&2){let e=c(2);s(),O("model",e.odsConfigType),m("options",t.options.OrderDisplayBroadcastModeType)}}function hp(n,t){if(n&1&&(g(0,_p,4,2,"div",12),v(1,"async")),n&2){let e,i=c();C((e=M(1,1,i.odsConfig$))?0:-1,e)}}function bp(n,t){n&1&&(r(0,"div",4)(1,"div",15),h(2,"i",16),a(),r(3,"div",17)(4,"div"),p(5," Choose outlet first before configuring Order Display! "),a()()())}var Jn=class n{constructor(t,e,i,o){this.dialogRef=t;this.httpService=e;this.outletRegisterService=i;this.data=o;this.modalConfig=new B,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(Ie(e=>{this.odsConfigType=e.form?.OrderDisplayBroadcastMode}),fi(e=>(console.error("Error loading ODS configuration:",e),uo({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"}]}}))),Ht(1))}onSave(){let e={EntityID:this.outletRegisterService.Data.EntityID,OrderDisplayBroadcastMode:this.odsConfigType};this.httpService.post("/api/outlet/UpdateOrderDisplayBroadcastMode",e).pipe(Ie(()=>{this.dialogRef.close(e)}),fi(i=>(console.error("Error saving ODS configuration:",i),uo(null)))).subscribe()}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(F),d($e),d($),d(Le))};static \u0275cmp=P({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,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. "),a()()(),r(10,"div",7)(11,"div",8),h(12,"img",9),r(13,"p",10),p(14," You can access this feature through "),r(15,"a",11),p(16,"ods.dealpos.app"),a()()()()()()()()),e&2&&(m("config",i.modalConfig),s(5),C(i.hasOutlet?5:6),s(10),m("href",i.odsLink,tt))},dependencies:[re,fe,Ui,Hi,ge,j,Ve],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 vp(n,t){if(n&1&&(r(0,"span",10),p(1),a()),n&2){let e=c().$implicit;s(),x(": ",e.value)}}function Sp(n,t){if(n&1&&(r(0,"p",6),p(1),g(2,vp,2,1,"span",10),a()),n&2){let e=t.$implicit;s(),x(" ",e.label," "),s(),C(e.value?2:-1)}}function yp(n,t){if(n&1&&(r(0,"div",11)(1,"p",12)(2,"span",13),p(3," Valid until "),r(4,"span",14),p(5),v(6,"date"),a()()()()),n&2){let e=c(2);s(5),w(Z(6,1,e.coupon==null||e.coupon.Requirement==null?null:e.coupon.Requirement.ExpiryDate,"longDate"))}}function xp(n,t){if(n&1&&g(0,yp,7,4,"div",11),n&2){let e=c();C((e.coupon==null||e.coupon.Requirement==null?null:e.coupon.Requirement.ExpiryDate)!=="0001-01-01T00:00:00"?0:-1)}}function Mp(n,t){n&1&&(r(0,"p",15),h(1,"i",16),r(2,"span",14),p(3,"Edit Mode: "),a(),p(4," Coupon information is displayed for reference only. Coupon removal is not available in edit mode. "),a())}function Pp(n,t){n&1&&(r(0,"p",9),h(1,"i",17),r(2,"span",14),p(3,"Important: "),a(),p(4," Removing the coupon removes the invoice level discount. Any discounts already applied to individual items will be kept. "),a())}function Op(n,t){if(n&1&&g(0,Mp,5,0,"p",15)(1,Pp,5,0,"p",9),n&2){let e=c();C(e.isRemoveCouponOnEdit()?1:0)}}function Ip(n,t){n&1&&(r(0,"p",9),h(1,"i",17),r(2,"span",14),p(3,"Important: "),a(),p(4,"Removing this coupon will reset your cart to its original state. All discounts and price changes from this coupon will be removed. "),a())}var zn=class n{invoiceCalculatorService=J(Ce);dialogRef=J(F);decimalPipe=J(Y);couponService=J(Xe);couponProviderService=J(Dt);salesOrder=J(R);orderProcessorService=J(U);posService=J(A);modalConfig;couponLabel=E(null);couponRequirements=E([]);coupon=this.couponService.coupon;couponProvider=this.couponProviderService.coupon;isEdit=E(!1);isRemoveCouponOnEdit=Jo(()=>this.posService.Data?.AppConfigJSON?.ModuleSell?.RemoveCouponOnEdit);activedCoupon=E(this.couponProviderService.coupon||this.couponService.coupon);currencySymbol=this.invoiceCalculatorService.currencySymbol==="Rp"?"Rp.":this.invoiceCalculatorService.currencySymbol;constructor(){this.initModalConfig(),this.initCouponLabel(),this.generateCouponRequirement()}initModalConfig(){let t=this.orderProcessorService.Data.posState;this.modalConfig=new B,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(){let t=this.salesOrder?.Data?.Order?.PromotionCoupon;return`Coupon ${this.maskCouponCode(t)} Applied`}maskCouponCode(t){return t?`***${t.slice(-2)}`:""}generateCouponRequirement(){let t=[];if(this.coupon?.ApplyToProduct?.length>0&&t.push({label:"Required Specific Product",value:null}),this.coupon?.Requirement?.MaximumDiscount&&t.push({label:"Maximum Discount",value:`${this.currencySymbol} ${this.decimalPipe.transform(this.coupon?.Requirement?.MaximumDiscount)}`}),this.coupon?.Requirement?.MinimumSpendingAmount&&t.push({label:"Minimum Spending",value:`${this.currencySymbol} ${this.decimalPipe.transform(this.coupon?.Requirement?.MinimumSpendingAmount)}`}),this.coupon?.Requirement?.FullPriceProductOnly&&t.push({label:"Full Price Product Only",value:null}),S.IsNotEmpty(this.coupon?.Requirement?.CustomerName)){let i=this.coupon?.Requirement?.CustomerName,o=this.coupon?.Requirement?.CustomerCode;t.push({label:"Exclusive for "+i+(o?` - ${o}`:""),value:null})}this.coupon?.Requirement?.CouponDeductedAmount&&t.push({label:"Point Deduction",value:`${this.decimalPipe.transform(this.coupon?.Requirement?.CouponDeductedAmount)}`}),this.couponRequirements.set(t)}initCouponLabel(){let t=this.couponProviderService.coupon||this.couponService.coupon,e=this.couponProviderService.coupon,i="";if(!t){this.couponLabel.set("");return}if(e)e.Type==="Percentage"?i=e.Amount>0?`${this.decimalPipe.transform(e.Amount)}% Discount`:"No Disc Applied.":i=e.Amount>0?`${this.currencySymbol} ${this.decimalPipe.transform(e.Amount)} Discount`:"No Disc Applied.";else switch(t?.Requirement?.Type){case 2:i=t?.Amount>0?`${this.currencySymbol} ${this.decimalPipe.transform(t?.Amount)} Discount`:"No Disc Applied.";break;case 1:i=t?.Amount>0?`${this.decimalPipe.transform(t?.Amount)}% Discount`:"No Disc Applied.";break;case 5:i="Authorize Full Access";break;case 4:i="Authorize Parked Deletion";break;case 3:i="Authorize Return";break;case 6:i="Authorize Delete Item";break;default:i="Coupon Applied";break}this.couponLabel.set(i)}onClose(){this.dialogRef.close(!1)}onRemove(){this.dialogRef.close(!0)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["app-modal-confirm-remove-coupon"]],decls:15,vars:6,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container-fluid"],[1,"card","coupon-card","mb-8"],[1,"card-body","text-center",2,"padding","0.2rem"],[1,"mb-6","badge","text-bg-success","fs-3","text-white"],[1,"d-flex","flex-column","gap-4"],[1,"mb-0"],[1,"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,"text-success","fw-semibold"],[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)(3,"div",2)(4,"div",3)(5,"span",4),p(6),a(),r(7,"div",5),ie(8,Sp,3,2,"p",6,gi),g(10,xp,1,1),a()()(),r(11,"div",7)(12,"div",8),g(13,Op,2,1)(14,Ip,5,0,"p",9),a()()()()()),e&2){let o;m("config",i.modalConfig),s(5),le(((o=i.activedCoupon())==null?null:o.Amount)>0?"badge-success":"badge-warning"),s(),x(" ",i.couponLabel()," "),s(2),ne(i.couponRequirements()),s(2),C(!(i.coupon==null||i.coupon.Requirement==null)&&i.coupon.Requirement.ExpiryDate?10:-1),s(3),C(i.isEdit()?13:14)}},dependencies:[re,ge,j,Qe],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 Dp=n=>({"is-invalid":n});function wp(n,t){n&1&&(r(0,"div",8)(1,"span"),p(2,"Host URL is required."),a()())}function kp(n,t){n&1&&(r(0,"span",9),p(1,"Enter the port or device URL used by your Cash Machine."),a())}var Kn=class n{constructor(t){this.dialogRef=t;this.config.title="Cash Machine",this.config.customWidth="400px",this.config.hideCancel=!0,this.config.okText=this.cashMachineService.isConnected()?"Disconnect":"Connect Now"}config=new B;urlCtrl=new pt("https://localhost:7065/CashMachineHUB",[Lt.required]);cashMachineService=J(kt);onClose(){this.dialogRef.close()}onConnect(){this.urlCtrl.valid&&this.dialogRef.close(this.urlCtrl.value)}get modalContentWording(){let t="Cash Machine Connected",e="Your Cash Machine is now online. You can process cash-in payments immediately.",i="Cash Machine Not Connected",o="To enable cash-in payments using the Cash Machine, please connect the device through the port or URL below.",l=this.cashMachineService.isConnected()?t:i,b=this.cashMachineService.isConnected()?e:o;return{title:l,description:b}}static \u0275fac=function(e){return new(e||n)(d(F))};static \u0275cmp=P({type:n,selectors:[["app-modal-connect-cash-machine"]],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-money-from-bracket","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),h(4,"i",3),r(5,"h2"),p(6),a(),r(7,"span",4),p(8),a()(),r(9,"div",5)(10,"label",6),p(11,"Port / URL"),a(),h(12,"input",7),g(13,wp,3,0,"div",8)(14,kp,2,0,"span",9),a()()()()),e&2&&(m("config",i.config)("dynamicValidated",i.urlCtrl.valid),s(4),m("ngClass",i.cashMachineService.isConnected()?"text-success":"text-danger"),s(2),w(i.modalContentWording.title),s(2),w(i.modalContentWording.description),s(4),m("ngClass",T(8,Dp,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:[re,H,qe,z,Q,dt,ge,j],encapsulation:2})};var Vt=class n{constructor(t,e,i,o,l,b,V,G,ve,Be,je,mi,Ii,Di,At,ui,wo,po){this.roleService=t;this.orderProcessorService=e;this.promotionService=i;this.promotionCouponService=o;this.promotionCouponProvider=l;this.dialog=b;this.parkOrderService=V;this.salesOrderService=G;this.outletRegisterService=ve;this.pageInitialService=Be;this.toastrService=je;this.httpService=mi;this.shoppingCartService=Ii;this.customerDisplay=Di;this.ecrService=At;this.ecrSignalR=ui;this.cashMachineService=wo;this.orderDisplayService=po;this.destroy$=new q,this.sourceMenu=[...Ba],this._moreMenu=new mo(this.sourceMenu),this.moreMenu$=this._moreMenu.asObservable(),this.initElgiblePromotion(),this.subscribeObservable()}_moreMenu;moreMenu$;eligiblePromotions$;destroy$;sourceMenu;_enabledDragDrop=new mo(!0);enabledDragDrop$=this._enabledDragDrop.asObservable();subscribeObservable(){wi([this.orderProcessorService.Data$,this.salesOrderService.Data$]).pipe(k(this.destroy$)).subscribe(([t,e])=>{this.filterMoreMenu(t.posState)}),this.roleService.Data$.pipe(k(this.destroy$)).subscribe({next:()=>{this.filterMoreMenu(0)}})}initElgiblePromotion(){this.eligiblePromotions$=this.promotionService.Data$.pipe(et(()=>this.promotionService.getTotalEligiblePromotion()))}moreMenuAction(t){switch(t){case"ADD_ITEM":this.dialog.open(Je);break;case"COUPON":let e=this.salesOrderService.Data?.Order?.PromotionCoupon;S.IsNotEmpty(e)?this.dialog.open(zn).afterClosed().pipe(oe(o=>o)).subscribe(()=>this.removePromotionCoupon()):this.dialog.open(Rn);break;case"PROMOTION":this.dialog.open(sn,{id:"promotion-event"});break;case"UPLOAD":this.onImportItems();break;case"RETURN":this.dialog.open(Nn);break;case"CLEAR":this.dialog.open(En);break;case"SERIAL":this.dialog.open(Vn);break;case"SPLIT":this.onSplitItem();break;case"PRINT":this.parkOrderService.onPrintRetrieve();break;case"CANCEL":this.onCancel();break;case"SYNC":this.dialog.open(Fn);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.promotionCouponService.removeAppliedCoupon()}openOdsConfigDialog(){this.dialog.open(Jn).afterClosed().pipe(oe(t=>!!t),Ie(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(Gn).afterClosed().pipe(oe(e=>!!e)).subscribe(e=>{this.ecrSignalR.initConnection(e)})}confirmDisableEcr(){this.dialog.open(ei,{data:{title:"Disconnect ECR",message:"Are you sure you want to disconnect ECR?",okText:"OK",headerType:Ae.Warning},width:"500px"}).afterClosed().pipe(oe(t=>t),Ie(()=>{this.ecrService.disconnect(),this.ecrSignalR.stopConnection()})).subscribe(()=>{this.toastrService.success("ECR is disconnected","Success")})}openModalCashMachineUrl(){this.dialog.open(Kn).afterClosed().pipe(oe(t=>!!t)).subscribe(t=>{this.cashMachineService.initConnection(t)})}confirmDisableCashMachine(){this.dialog.open(ei,{data:{title:"Disconnect Cash Machine",message:"Are you sure you want to disconnect Cash Machine?",okText:"OK",headerType:Ae.Warning},width:"500px"}).afterClosed().pipe(oe(t=>t),Ie(()=>{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(Ir.emptyEntity,Ae.Warning);return}this.validateShowParkModal()}}validateCustomerRequired(t,e){return t.ModuleSell.Header.CustomerRequired&&e.Order.CustomerID==null?(this.toastrService.warning("Customer is needed before parking orders!","Missing customer!"),!1):!0}validateUsedPromotion(t){let e=this.promotionEventService.selectedPromotion;return S.IsNotEmpty(e)||S.IsNotEmpty(t.Order.PromotionCoupon)?(this.toastrService.warning("Orders with applied promotions or coupons cannot be parked!","Park Not Allowed!"),!1):!0}validateShowParkModal(){let t=this.outletService.Data.ParkLayoutPack,e=this.pageInitialService.Data.AppConfigJSON,i=this.salesOrderService.Data;if(t&&S.IsNotEmpty(t.ID))this.orderProcessorService.Data.posState==4?this.showReparkModal():this.showParkSelectModal(e,i);else{if(!this.validateRetrieveMode(e))return;this.setDefaultParkNote(e),this.showParkInputModal()}}showParkSelectModal(t,e){let i=this.orderProcessorService.Data,o=this.outletService.Data.ParkLayoutPack;this.orderHttpService.getVacant(e.Order.EntityID).subscribe(l=>{let b=t.ApplicationParkAndRetrieve.UserInterfaceLabel.ParkDialogTitle,V=i.posState==5,J=t.ApplicationParkAndRetrieve.ParkLayoutTemplate.EnableAlias,ve=V?"Split Order":b;this.dialog.open(ni,{data:{title:ve,parkLayoutPack:this.generateParkLayoutOptions(o,l.Orders),replaceWithAlias:J,orderNote:e.Order?.Note}}).afterClosed().pipe(oe(Be=>S.IsNotEmpty(Be)),Re(Be=>{let je=new ti;return je.ParkLabel=Be.Name,je.Note=Be.Note,this.park(je)})).subscribe()})}showReparkModal(){this.dialog.open(_n,{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(fn,{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(Cn).afterClosed().pipe(oe(t=>S.IsNotEmpty(t))).subscribe(t=>{t=="ORDER"?this.emitParkReceipt(!1,!1,!0):this.emitBillReceipt()})}emitParkReceipt(t,e=!1,i=!1){let o=this.receiptService.generateParkReceipt(t,e);(this.pageInitialService.Data.AppConfigJSON.ApplicationParkAndRetrieve?.PrintBehaviour?.PrintAfterPark||i)&&this._onPrint.next({type:"PARK",template:o})}emitBillReceipt(){let t=this.outletService.Data,e;1==t.PrintTemplate.PrintMode?(e=this.receiptService.generateBillInvoice(),this._onPrint.next({type:"BILL_A4",template:e})):(e=this.receiptService.generateBillReceipt(),this._onPrint.next({type:"BILL_MINI",template:e}))}generateParkLayoutOptions(t,e=[]){return t.Layout=t.Layout.map(i=>{i.Options=[];for(let o=1;o<=i.Size;o++){let l=new oi;l.Name=i.Name+o,l.Alias=this.generateAlias(t,l.Name),l.IsOccupied=this.IsOccupied(l.Name,e),i.Options.push(l)}return i}),t}generateAlias(t,e){let i="";if(t.Alias){let o=t.Alias.filter(l=>l.Name==e);o.length>0&&(i=`${o[0]?.Alias}`)}return i}IsOccupied(t,e){let i=e.filter(l=>l.ParkLabel==t),o=!1;return i.length>0&&(o=!0),o}static \u0275fac=function(e){return new(e||n)(N($e),N(Et),N(U),N(A),N(R),N(X),N(Xt),N($),N(De),N(ae))};static \u0275prov=at({token:n,factory:n.\u0275fac,providedIn:"root"})};var Sn=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=St({type:n});static \u0275inj=vt({imports:[re,fe,Ji,It,zr,zt,Qt,Kt,Ke,nn]})};var ka=n=>({"opacity-50":n});function al(n,t){if(n&1){let e=y();r(0,"div",5)(1,"h6",6),p(2,"Verify Via"),a(),r(3,"div",7)(4,"button",8),_("click",function(){u(e);let o=c();return f(o.onChooseVerifyType("phone"))}),r(5,"div",9)(6,"div"),h(7,"i",10),a(),r(8,"div",11),p(9),a()()()(),r(10,"div",12)(11,"button",8),_("click",function(){u(e);let o=c();return f(o.onChooseVerifyType("email"))}),r(12,"div",9),h(13,"i",13),r(14,"div",11),p(15),a()()()(),r(16,"div",12)(17,"button",14),_("click",function(o){return u(e),c().onChooseVerifyType("pin"),f(o.preventDefault())}),r(18,"div",9),h(19,"i",15),r(20,"div",16),p(21,"Use PIN"),a()()()()()}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,ka,!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,ka,!e.email)),s(),x(" ",e.email?e.email:"Email is not registered"," ")}}function ll(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"),a(),p(6,","),a(),r(7,"div"),p(8," Please read this "),r(9,"a",20),p(10,"article"),a(),p(11," to turn on "),a()()(),r(12,"div")(13,"div",21)(14,"button",22),_("click",function(){u(e);let o=c();return f(o.onRedeem())}),p(15,"Redeem"),a()()()}}var yn=class n{toastrService=G(X);onVerify=new He;pointUsedChange=new He;redeemEvent=new He;isVerifyEnabled=!1;phone;email;pointUsed;pointBalance;onPointUsedChange(){this.pointUsedChange.emit(this.pointUsed)}ngAfterViewInit(){this.setFocusInput()}setFocusInput(){setTimeout(()=>{document.getElementById("pointInput")?.focus()},300)}onChooseVerifyType(t){this.checkPointUsed()&&this.onVerify.emit(t)}onRedeem(){this.checkPointUsed()&&this.redeemEvent.emit()}checkPointUsed(){return S.IsEmpty(this.pointUsed)||this.pointUsed<=0?(this.toastrService.warning("Please enter the points before redeeming!","Field Input Required!"),this.setFocusInput(),!1):!0}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["point-step"]],inputs:{isVerifyEnabled:"isVerifyEnabled",phone:"phone",email:"email",pointUsed:"pointUsed",pointBalance:"pointBalance"},outputs:{onVerify:"onVerify",pointUsedChange:"pointUsedChange",redeemEvent:"onRedeem"},decls:13,vars:6,consts:[[1,"d-flex","align-items-center","justify-content-center"],[1,"me-3"],["type","text","autoNum","","id","pointInput",1,"form-control","input-point",3,"ngModelChange","ngModel","max"],[1,"me-3","d-flex","align-items-center","justify-content-center"],[1,"fs-1"],[1,"mt-8"],[1,"mb-6","text-center"],[1,"text-center"],["type","button",1,"btn","btn-light","btn-sm","p-3","w-75",3,"click","disabled"],[1,"d-flex","align-items-center"],[1,"fa-brands","fa-whatsapp","fs-2","ps-2",2,"color","#25d366"],[1,"fs-5","w-100",3,"ngClass"],[1,"mt-4","text-center"],[1,"ps-2","fa-solid","fa-envelope","fs-3",2,"color","#c71610"],["type","button","matTooltip","Inform the customer to download the Brand Loyalty App and setup PIN in Profile Menu to authorize Point Redemption","matTooltipPosition","right","matTooltipClass","primary-tooltip",1,"btn","btn-light","btn-sm","p-3","w-75",3,"click"],[1,"ps-2","fa-solid","fa-key","fs-3"],[1,"fs-5","w-100"],[1,"mt-8","d-flex","justify-content-center"],[1,"text-center","alert","alert-warning","py-4","px-8","mb-0"],[1,"fw-bold","text-danger",2,"font-size","13px"],["href","https://support.dealpos.com/en/articles/9158486-redeem-loyalty-point-authorization-using-otp","target","_blank"],[1,"d-flex","justify-content-center","mt-12"],[1,"btn","btn-success",3,"click"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1)(2,"input",2),D("ngModelChange",function(l){return I(i.pointUsed,l)||(i.pointUsed=l),l}),_("ngModelChange",function(){return i.onPointUsedChange()}),a()(),r(3,"div",3)(4,"span",1),p(5,"Of"),a(),r(6,"span",4),p(7),v(8,"number"),a()(),r(9,"div"),p(10,"Points"),a()(),g(11,al,22,10,"div",5)(12,ll,16,0)),e&2&&(s(2),O("ngModel",i.pointUsed),m("max",i.pointBalance),s(5),w(M(8,4,i.pointBalance)),s(4),C(i.isVerifyEnabled?11:12))},dependencies:[re,H,ht,mt,fe,z,Q,ee,Ke,se,Y],styles:[".input-point[_ngcontent-%COMP%]{width:120px;height:44px;font-size:1.375rem;text-align:center}"]})};var sl=n=>({"error-input":n});function cl(n,t){if(n&1&&(r(0,"span"),p(1),a()),n&2){let e=c(3);s(),x(" ",e.config.separator," ")}}function pl(n,t){if(n&1){let e=y();Ue(0),r(1,"input",5,0),_("paste",function(o){u(e);let l=c(2);return f(l.handlePaste(o))})("keyup",function(o){let l=u(e).index,b=c(2);return f(b.onKeyUp(o,l))})("input",function(o){let l=u(e).index,b=c(2);return f(b.onInput(o,l))})("keydown",function(o){let l=u(e).index,b=c(2);return f(b.onKeyDown(o,l))}),a(),K(3,cl,2,1,"span",6),We()}if(n&2){let e=t.$implicit,i=t.index,o=t.last,l=c(2);s(),le(Ri("otp-input ",l.config.inputClass)),m("pattern",l.config.allowNumbersOnly?"\\d*":"")("type",l.inputType)("placeholder",(l.config==null?null:l.config.placeholder)||"")("ngStyle",l.config.inputStyles)("formControl",l.otpForm.controls[e])("id",l.getBoxId(i))("ngClass",T(11,sl,(l.config==null?null:l.config.showError)&&(l.formControl==null?null:l.formControl.invalid)&&((l.formControl==null?null:l.formControl.dirty)||(l.formControl==null?null:l.formControl.touched)))),s(2),m("ngIf",l.config.separator&&!o)}}function dl(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),K(2,pl,4,13,"ng-container",4),a()()}if(n&2){let e=c();le(Ri("ng-otp-input-wrapper wrapper ",e.config.containerClass)),m("id",Ri("c_",e.componentKey))("ngStyle",e.config.containerStyles),s(2),m("ngForOf",e.controlKeys)}}var bt=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)}},yi=class{static keys(t){return t?Object.keys(t):[]}},Mo=(()=>{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 yi.keys(this.otpForm?.controls)}get formControl(){return this.formCtrl??this.inj?.get(or)}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 rr({});for(let i=0;i<this.config.length;i++)this.otpForm.addControl(this.getControlName(i),new pt);this.otpForm.valueChanges.pipe(k(this.destroy$)).subscribe(i=>{yi.keys(this.otpForm.controls).forEach(o=>{var l=this.otpForm.controls[o].value;l&&l.length>1&&(l.length>=this.config.length?this.setValue(l):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 l=this.getBoxId(o-1),b=this.getBoxId(o);if(bt.ifKey(i,"Enter")){let J=this.document.getElementById(b)?.closest("form");if(J){i.preventDefault();let ve=new Event("submit",{bubbles:!0,cancelable:!0});J.dispatchEvent(ve);return}}if(bt.ifSpacebar(i))return i.preventDefault(),!1;if(bt.ifBackspace(i)){i.target.value?this.clearInput(b,o):(this.clearInput(l,o-1),this.setSelected(l)),this.rebuildValue();return}if(bt.ifDelete(i)){i.target.value?this.clearInput(b,o):(this.clearInput(l,o-1),this.setSelected(l)),this.rebuildValue();return}}hasVal(i){return i!=null&&i!=null&&(!i?.trim||i.trim()!="")}onInput(i,o){let l=this.hasVal(this.currentVal)?`${this.currentVal}${i.target.value}`:i.target.value;if(this.config.allowNumbersOnly&&!this.validateNumber(l)){i.target.value=null,i.stopPropagation(),i.preventDefault(),this.clearInput(null,o);return}if(this.ifValidKeyCode(null,i.target.value)){let b=this.getBoxId(o+1);this.setSelected(b),this.rebuildValue()}else{i.target.value=null;let b=this.getControlName(o);this.otpForm.controls[b]?.setValue(null),this.rebuildValue()}}onKeyUp(i,o){bt.ifTab(i)&&(o-=1);let l=this.getBoxId(o+1),b=this.getBoxId(o-1);if(bt.ifRightArrow(i)){i.preventDefault(),this.setSelected(l);return}if(bt.ifLeftArrow(i)){i.preventDefault(),this.setSelected(b);return}}validateNumber(i){return i&&/^[0-9]+$/.test(i)}getBoxId(i){return`otp_${i}_${this.componentKey}`}clearInput(i,o){let l=this.getControlName(o);if(this.otpForm.controls[l]?.setValue(null),i){let b=this.document.getElementById(i);b&&b instanceof HTMLInputElement&&(b.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 l=o??i.key;return this.config?.allowNumbersOnly?this.validateNumber(l):/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)||/^[a-zA-Z0-9%*_\-@#$!]$/.test(l)&&l.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,l)=>{this.otpForm.get(this.getControlName(l))&&this.otpForm.get(this.getControlName(l)).setValue(o)}),this.config.disableAutoFocus||setTimeout(()=>{let o=this.document.getElementById(`c_${this.componentKey}`);var l=i.length<this.config.length?i.length:this.config.length-1;let b=o.getElementsByClassName("otp-input")[l];b&&b.focus&&setTimeout(()=>{b.focus()},1)},0),this.rebuildValue()}}rebuildValue(){let i=null;yi.keys(this.otpForm.controls).forEach(o=>{let l=this.otpForm.controls[o].value;if(l){let b=l.length>1,V=!this.config.allowNumbersOnly&&this.config.letterCase&&(this.config.letterCase.toLocaleLowerCase()=="upper"||this.config.letterCase.toLocaleLowerCase()=="lower");l=l[0];let J=V?this.config.letterCase.toLocaleLowerCase()=="upper"?l.toUpperCase():l.toLowerCase():l;V&&J==l?V=!1:l=J,i==null?i=l:i+=l,(b||V)&&this.otpForm.controls[o].setValue(l)}}),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 l=o.getData("Text");i.stopPropagation(),i.preventDefault(),!(!l||this.config.allowNumbersOnly&&!this.validateNumber(l))&&this.setValue(l)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}};t.\u0275fac=function(o){return new(o||t)(d(Fo),d(Lo))},t.\u0275cmp=P({type:t,selectors:[["ng-otp-input"],["ngx-otp-input"]],inputs:{config:"config",formCtrl:"formCtrl",disabled:"disabled"},outputs:{onBlur:"onBlur",onInputChange:"onInputChange"},features:[st([{provide:ir,useExisting:Ao(()=>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,l){o&1&&K(0,dl,3,7,"div",1),o&2&&m("ngIf",l.otpForm==null?null:l.otpForm.controls)},dependencies:[qe,z,Q,sr,dt,Ut,Vi,Ai,H],styles:[".otp-input[_ngcontent-%COMP%]{width:50px;height:50px;border-radius:4px;border:solid 1px #c5c5c5;text-align:center;font-size:32px}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]{margin:0 .51rem}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]:first-child{margin-left:0}.ng-otp-input-wrapper[_ngcontent-%COMP%] .otp-input[_ngcontent-%COMP%]:last-child{margin-right:0}.n-o-c[_ngcontent-%COMP%]{display:flex;align-items:center}.error-input[_ngcontent-%COMP%]{border-color:red}@media screen and (max-width: 767px){.otp-input[_ngcontent-%COMP%]{width:40px;font-size:24px;height:40px}}@media screen and (max-width: 420px){.otp-input[_ngcontent-%COMP%]{width:30px;font-size:18px;height:30px}}"]});let n=t;return n})(),Mn=(()=>{let t=class t{};t.\u0275fac=function(o){return new(o||t)},t.\u0275mod=St({type:t}),t.\u0275inj=vt({imports:[Mo]});let n=t;return n})();function ul(n,t){if(n&1&&(r(0,"div"),p(1," OTP has been sent to "),r(2,"span",5),p(3),a()()),n&2){let e=c();s(3),w(e.contact)}}function fl(n,t){if(n&1&&h(0,"ng-otp-input",3),n&2){let e=c(2);m("formCtrl",e.otpCtrl)("config",e.otpConfig)}}function gl(n,t){if(n&1&&g(0,fl,1,2,"ng-otp-input",3),n&2){let e=c();C(e.showPinInput()?0:-1)}}function Cl(n,t){if(n&1&&h(0,"ng-otp-input",3),n&2){let e=c();m("formCtrl",e.otpCtrl)("config",e.otpConfig)}}function _l(n,t){if(n&1){let e=y();r(0,"div",4)(1,"span"),p(2,"Didn`t get a code? "),a(),r(3,"a",6),_("click",function(){u(e);let o=c();return f(o.onResendCode())}),p(4,"Click to resend"),a()()}}var Pn=class n{type;contact;clearPin=!1;onVerify=new He;resendCode=new He;showPinInput=E(!0);otpCtrl=new pt;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(Vo(300),oe(t=>t.length===6)).subscribe(t=>{this.onVerify.emit(t)})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["verify-step"]],inputs:{type:"type",contact:"contact",clearPin:"clearPin"},outputs:{onVerify:"onVerify",resendCode:"resendCode"},features:[Bo],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),a(),g(3,ul,4,1,"div"),a(),r(4,"div",2),g(5,gl,1,1)(6,Cl,1,2,"ng-otp-input",3),a(),g(7,_l,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:[Mn,Mo,qe],encapsulation:2})};function hl(n,t){if(n&1){let e=y();Ct(0,"button",7),fo("click",function(){u(e);let o=c();return f(o.onCancel())}),p(1,"Cancel"),lt()}}function bl(n,t){if(n&1){let e=y();Ct(0,"button",8),fo("click",function(){u(e);let o=c();return f(o.onConfirm())}),p(1,"Confirm"),lt()}}var On=class n{pointUsed=Ni(0);redeemPointValue=Ni(0);showCancelBtn=Ni(!1);confirmEvent=new He;cancelEvent=new He;onConfirm(){this.confirmEvent.emit()}onCancel(){this.cancelEvent.emit()}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["confirm-step"]],inputs:{pointUsed:[1,"pointUsed"],redeemPointValue:[1,"redeemPointValue"],showCancelBtn:[1,"showCancelBtn"]},outputs:{confirmEvent:"onConfirm",cancelEvent:"onCancel"},decls:19,vars:7,consts:[[1,"text-center"],[1,"fs-5"],[1,"d-flex","justify-content-center","text-success","align-items-center"],[1,"me-3",2,"font-size","1.5rem"],[1,"d-flex","justify-content-center","text-danger","align-items-center"],[1,"btn","btn-danger","mt-12"],[1,"btn","btn-success","mt-12"],[1,"btn","btn-danger","mt-12",3,"click"],[1,"btn","btn-success","mt-12",3,"click"]],template:function(e,i){e&1&&(Ct(0,"div",0)(1,"div",1),p(2,"Redeem"),lt(),Ct(3,"div",2)(4,"span",3),p(5),v(6,"number"),lt(),Ct(7,"small"),p(8,"Point"),lt()(),Ct(9,"div",1),p(10,"~"),lt(),Ct(11,"div",4)(12,"span",3),p(13),v(14,"number"),lt(),Ct(15,"small"),p(16,"Discount"),lt()(),g(17,hl,2,0,"button",5)(18,bl,2,0,"button",6),lt()),e&2&&(s(5),w(M(6,3,i.pointUsed())),s(8),w(M(14,5,i.pointUsed()*i.redeemPointValue())),s(4),C(i.showCancelBtn()?17:18))},dependencies:[re,Y],encapsulation:2})};var li=class n{constructor(t,e,i,o,l,b,V,J,ve,Be){this.customerHttpService=t;this.salesOrderService=e;this.pageInitialService=i;this.shoppingCartService=o;this.invoiceCalculatorService=l;this.orderProcessorService=b;this.toastr=V;this.promotionCouponService=J;this.httpService=ve;this.registerService=Be}customerId;customerData;_isCustomerVerfiedOtp=!1;get isCustomerVerfiedOtp(){return this._isCustomerVerfiedOtp}addCustomerById(t){return new Eo(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(Re(e=>(this.salesOrderService.Data.ContactName=e.Display,this.addCustomerById(e.ID))))}setSalesOrderCustomerId(t){let e=this.salesOrderService.Data,i=this.registerService.Data.ListSales,o=t.SalesID,l=i.find(b=>b.ID===o);S.IsNotEmpty(t.SalesID)&&l&&(e.Order.SalesID=t.SalesID)}setCustomerData(t){let e=this.salesOrderService.Data;if(t.EntityID==S.GuidEmpty)this.customerData=t;else if(t.EntityID!=e.Order.EntityID){e.Order.CustomerID=null,e.ContactName=null;let i=`${t?.Name} is exclusive to ${t?.EntityName} Outlet and cannot be used in other outlets!`;alert(i)}else this.customerData=t}checkResetRedeemPoint(){let t=!1;return S.IsNotEmpty(this.customerId)&&(t=!0),t}applyCustomerPricebook(t){let e=this.salesOrderService.Data;if(S.IsNotEmpty(t.PricebookID)){let i=e.CartItems.map(o=>(o.Variant.PriceBook&&o.Variant.PriceBook.length!==0&&o.Variant.PriceBook.forEach(l=>{l.ID===t.PricebookID&&o.Quantity>=l.MinimumQuantity&&(o=this.shoppingCartService.applyPricebookToItem(o,l))}),o));e.CartItems=i}}updateTaxCustomer(t){let i=this.pageInitialService.Data.Taxes.find(o=>o.ID==t);i&&(this.salesOrderService.Data.Order.TaxTypeID=i.ID,this.invoiceCalculatorService.tax=i)}resetCartOnChangeCustomer(t){let e=this.pageInitialService.Data.AppConfigJSON;this.customerId!=t&&e.ModuleSell.Customer.ClearCartOnChange&&(this.salesOrderService.Data.CartItems=[]),this.customerId=t}updateDiscountRate(t=0){if(t>0){let e=this.promotionCouponService.coupon,i=this.salesOrderService.Data.Order.Discount;e&&e.Requirement?.Type==1?i==e.Amount?t>e.Amount&&(this.toastr.warning("Member discount is applied because member discount is greater than Coupon Discount","Warning"),this.promotionCouponService.removeAppliedDiscountOnCustomerChange(),this.salesOrderService.Data.Order.Discount=t):(this.salesOrderService.Data.Order.Discount=t,this.salesOrderService.Data.Order.CustomerDiscountRate=t):(this.salesOrderService.Data.Order.Discount=t,this.salesOrderService.Data.Order.CustomerDiscountRate=t)}}applyConfigFullPriceOnly(){let t=this.filterGroupByDiscountRate(),e=this.salesOrderService.Data.CartItems;t?.OrderDiscountFullPriceProductOnly?this.filterItemWithDisc(e).length>0?e=this.applyItemsDisc(e,this.customerData.DiscountRate):this.updateDiscountRate(this.customerData.DiscountRate):this.updateDiscountRate(this.customerData.DiscountRate)}filterGroupByDiscountRate(){let e=(this.customerData?.Groups?this.customerData?.Groups:[]).filter(o=>o.OrderDiscountPercentage==this.customerData.DiscountRate),i;return e.length>1?(i=e.find(o=>o.OrderDiscountFullPriceProductOnly==!0),i||(i=e[0])):i=e[0],i}applyItemsDisc(t,e){return t=t.map(i=>(i.Discount==0&&i.DiscountAmount==0&&i.PriceTypeID!=3&&i.Price==i.UnitPrice&&S.IsEmpty(i.PriceBookID)&&(i.Discount=e,i.HasCustomerDiscount=!0),i)),t}filterItemWithDisc(t){return t.filter(i=>i.Discount>0||i.DiscountAmount>0||i.PriceTypeID==3||i.Price!=i.UnitPrice||S.IsNotEmpty(i.PriceBookID))}onEmptyInputCustomer(){S.IsNotEmpty(this.customerId)&&(this.promotionCouponService.removeAppliedDiscountOnCustomerChange(),this.resetAppliedPoint(),this.resetCustomerPricebook(),this.removeCustomerDiscountRate()),this.orderProcessorService.Data.InputTextValue="",this.customerId=JSON.parse(JSON.stringify(this.salesOrderService.Data.Order.CustomerID)),this._isCustomerVerfiedOtp=!1,this.customerData=null,this.salesOrderService.Data.ContactName=null,this.salesOrderService.Data.Order.CustomerID=null,this.customerHttpService.Data=new _o,this.customerData=new _o,this.salesOrderService.pushNewValue()}removeCustomerDiscountRate(){let t=this.filterGroupByDiscountRate(),e=this.salesOrderService.Data.CartItems;t?.OrderDiscountFullPriceProductOnly?this.filterItemWithDisc(e).length>0?this.salesOrderService.Data.CartItems=e.map(o=>(o.HasCustomerDiscount&&(o.Discount=0,o.HasCustomerDiscount=!1),o)):(this.salesOrderService.Data.Order.Discount=0,this.salesOrderService.Data.Order.CustomerDiscountRate=0):(this.salesOrderService.Data.Order.Discount=0,this.salesOrderService.Data.Order.CustomerDiscountRate=0)}resetCustomerPricebook(){if(this.customerData){let t=this.customerData.PricebookID;if(S.IsNotEmpty(t)){let e=this.salesOrderService.Data.CartItems;this.salesOrderService.Data.CartItems=e.map(i=>(i.PriceBookID==t&&(i.Discount=i.Variant.PriceDiscount,i.Note=i.Variant.PriceNote,i.PriceNote=i.Variant.PriceNote,i.PriceBookID=S.GuidEmpty,i.Price=i.Variant.UnitPrice,i.UnitPrice=i.Variant.UnitPrice),i))}}}resetAppliedPoint(){let t=this.salesOrderService.Data;t.Order.PointUsed>0&&(t.Order.PointUsed=0,t.Order.DiscountAmount=0)}redeemPoint(t){let e=this.pageInitialService.Data.AppConfigJSON,i=this.salesOrderService.Data,o=e.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,l=t*o,b=i.RedeemableAmount;l>b&&(o>0?(t=Math.ceil(b/o),l=b):(t=0,l=0),this.toastr.warning("You enter the number of points more than the total amount","Points Adjusted")),i.Order.PointUsed=t||0,i.Order.DiscountAmount=l,this.salesOrderService.pushNewValue(i)}sendOtpViaEmail(t){return this.httpService.post("/API/otp/email",{Email:t})}sendOtpViaWhatsApp(t){return this.httpService.post("/API/otp/WhatsApp",{Number:t})}verifyEmailOtp(t,e){return this.httpService.post("/API/otp/verifyemail",{Email:t,OTP:e}).pipe(Ie(()=>this._isCustomerVerfiedOtp=!0))}verifyPin(t,e){return this.httpService.post("/API/pos/VerifyPin",{PIN:t,CustomerID:e}).pipe(Ie(()=>this._isCustomerVerfiedOtp=!0))}verifyWhatsAppOtp(t,e){return this.httpService.post("/API/otp/verifywhatsapp",{Number:t,OTP:e}).pipe(Ie(()=>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(ft),N(R),N(A),N(we),N(Ce),N(U),N(X),N(Xe),N($e),N($))};static \u0275prov=at({token:n,factory:n.\u0275fac,providedIn:"root"})};var yl=["stepper"];function xl(n,t){n&1&&p(0,"Points")}function Ml(n,t){n&1&&p(0,"Verify")}function Pl(n,t){n&1&&p(0,"Confirm")}var si=class n{dialogRef=G(F);outletRegisterService=G($);pageInitialService=G(A);customerHttpService=G(ft);customerService=G(li);orderService=G(R);toastr=G(X);modalConfig;enabledLoyaltyPoint=E(!1);stepper;pointUsed=0;pointBalance=E(0);redeemPointValue=E(0);email=E(null);phone=E(null);contactToResend=E(null);verifyType=E(null);clearPin=E(!1);selectedTab=E(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 B,this.modalConfig.title="Redeem Point",this.modalConfig.customWidth="500px",this.modalConfig.hideFooter=!0}initConfigEnabledVerify(){let t=this.pageInitialService.Data.AppConfigJSON,e=t?.ApplicationLoyalty?.VerifyRedemption,i=t?.ApplicationLoyalty?.Enabled,o=this.outletRegisterService.Data?.MemberPoint;this.enabledLoyaltyPoint.set(e&&i&&o)}initPointUsed(){let t=this.orderService.Data?.Order?.PointUsed;this.pointUsed=t||0,this.pointUsed>0&&this.selectedTab.set(2)}initAvailablePoint(){let t=this.customerHttpService.Data.Point,e=this.customerHttpService.Data.PointUsed,i=(t||0)-(e||0);this.pointBalance.set(i)}onClose(){this.dialogRef.close()}onCancelRedeem(){let t=this.orderService.Data;t.Order.PointUsed=0,t.Order.DiscountAmount=0,this.orderService.pushNewValue(t),this.toastr.info("Redeem point has been canceled","Canceled"),this.onClose()}onRedeem(){this.stepper.next(),this.stepper.next()}onVerify(t){switch(t){case"phone":this.contactToResend.set(this.phone()),this.handlingSentOtpViaPhone();break;case"email":this.contactToResend.set(this.email()),this.handlingSentOtpViaEmail();break;case"pin":this.stepper.next();break}this.verifyType.set(t)}handlingSentOtpViaPhone(){this.customerService.sendOtpViaWhatsApp(this.phone()).subscribe(t=>{this.stepper.selectedIndex==0&&this.stepper.next(),this.toastr.success(`OTP has been sent to ${this.phone()}`,"OTP Sent")})}handlingSentOtpViaEmail(){this.customerService.sendOtpViaEmail(this.email()).subscribe(t=>{this.stepper.selectedIndex==0&&this.stepper.next(),this.toastr.success(`OTP has been sent to ${this.email()}`,"Email Sent")})}onVerifyCode(t){switch(this.verifyType()){case"phone":this.verifyPhoneOtp(t);break;case"email":this.verifyEmailOtp(t);break;case"pin":this.verifyCustomerPin(t);break}}verifyEmailOtp(t){this.customerService.verifyEmailOtp(this.email(),t).subscribe(e=>{this.toastr.success(e.Message,"Successfully verified"),this.stepper.next()})}verifyPhoneOtp(t){this.customerService.verifyWhatsAppOtp(this.phone(),t).subscribe(e=>{this.toastr.success(e.Message,"Successfully verified"),this.stepper.next()})}verifyCustomerPin(t){let e=this.orderService.Data?.Order?.CustomerID;this.clearPin.set(!1),this.customerService.verifyPin(t,e).subscribe({next:i=>{this.toastr.success(i.Message,"Successfully verified"),this.stepper.next()},error:i=>{this.clearPin.set(!0)}})}onResendCode(){this.onVerify(this.verifyType())}onConfirm(){this.calculatePointToDiscount()}calculatePointToDiscount(){let t=this.pageInitialService.Data.AppConfigJSON,e=this.orderService.Data,i=e.RedeemableAmount,o=this.pointUsed,l=t.ApplicationLoyalty.LoyaltyPoint.RedeemPointValue,b=this.pointUsed*l;b>i&&(o=Math.ceil(i/l),b=i),(S.IsNotEmpty(e.Order.PointUsed)?e.Order.PointUsed:0)!=o&&(e.Order.PointUsed=o||0,e.Order.DiscountAmount=b,this.orderService.pushNewValue(e),this.toastr.success("Point has been redeemed","Success")),this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["modal-redeem-point"]],viewQuery:function(e,i){if(e&1&&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),K(7,xl,1,0,"ng-template",6),r(8,"div",7)(9,"point-step",8),_("onVerify",function(b){return u(o),f(i.onVerify(b))}),D("pointUsedChange",function(b){return u(o),I(i.pointUsed,b)||(i.pointUsed=b),f(b)}),_("onRedeem",function(){return u(o),f(i.onRedeem())}),a()()(),r(10,"mat-step",9),K(11,Ml,1,0,"ng-template",6),r(12,"div",7)(13,"verify-step",10),_("resendCode",function(){return u(o),f(i.onResendCode())})("onVerify",function(b){return u(o),f(i.onVerifyCode(b))}),a()()(),r(14,"mat-step",11),K(15,Pl,1,0,"ng-template",6),r(16,"div",7)(17,"confirm-step",12),_("onConfirm",function(){return u(o),f(i.onConfirm())})("onCancel",function(){return u(o),f(i.onCancelRedeem())}),a()()()()()()()()}e&2&&(m("preventEnterEvent",!0)("config",i.modalConfig),s(4),m("linear",!0)("selectedIndex",i.selectedTab()),s(2),m("editable",!0),Uo("aria-labelledby",i.selectedTab()==2?"stepDisabled":""),s(3),m("isVerifyEnabled",i.enabledLoyaltyPoint()),O("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:[ge,j,fe,ha,Ca,ga,_a,yn,Pn,On],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 Ol(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"),h(2,"i",19),a(),r(3,"span"),p(4),v(5,"number"),a()()}if(n&2){let e=c(2);s(4),x(" ",M(5,1,e.pointUsed)," Points redeemed ")}}function Il(n,t){if(n&1){let e=y();r(0,"tab",3)(1,"div",6)(2,"div",7)(3,"label",8),p(4,"Discount %"),a()(),r(5,"div",9)(6,"input",10),D("ngModelChange",function(o){u(e);let l=c();return I(l.discount1,o)||(l.discount1=o),f(o)}),a(),r(7,"span",11),p(8,"%"),a(),r(9,"span",12),p(10,"+"),a(),r(11,"input",13),D("ngModelChange",function(o){u(e);let l=c();return I(l.discount2,o)||(l.discount2=o),f(o)}),a(),r(12,"span",11),p(13,"%"),a()()(),r(14,"div",14)(15,"div",7)(16,"label",8),p(17),a()(),r(18,"div",15)(19,"input",16),D("ngModelChange",function(o){u(e);let l=c();return I(l.discountAmount,o)||(l.discountAmount=o),f(o)}),a(),g(20,Ol,6,3,"div",17),a()()()}if(n&2){let e=c();m("active",e.tabActive=="Discount"),s(6),O("ngModel",e.discount1),s(5),O("ngModel",e.discount2),s(6),x("Discount ",e.currencySymbol),s(2),m("disabled",e.pointUsed&&e.pointUsed>0),O("ngModel",e.discountAmount),s(),C(e.pointUsed&&e.pointUsed>0?20:-1)}}function Dl(n,t){if(n&1){let e=y();r(0,"tab",4)(1,"div",6)(2,"div",7)(3,"label",8),p(4,"Tax"),a()(),r(5,"div",9)(6,"ng-select",20),_("change",function(o){u(e);let l=c();return f(l.updateTax(o))}),a()()(),r(7,"div",14)(8,"div",7)(9,"label",8),p(10,"Surcharge"),a()(),r(11,"div",9)(12,"input",21),D("ngModelChange",function(o){u(e);let l=c();return I(l.surcharge,o)||(l.surcharge=o),f(o)}),a(),r(13,"span",11),p(14,"%"),a()()()()}if(n&2){let e=c();s(6),m("clearable",!1)("ngModel",e.salesOrder.Order.TaxTypeID)("items",e.taxes),s(6),O("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"),a()(),r(5,"div",23)(6,"input",24),D("ngModelChange",function(o){u(e);let l=c();return I(l.discountAfterTax,o)||(l.discountAfterTax=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onDiscountAfterTaxChange())}),a()()(),r(7,"div",25)(8,"div",22)(9,"label",8),p(10,"Discount Calculator"),a()(),r(11,"div",26)(12,"input",27),D("ngModelChange",function(o){u(e);let l=c();return I(l.discounts[0],o)||(l.discounts[0]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),a(),r(13,"span"),p(14," %"),a(),r(15,"span",12),p(16,"+"),a(),r(17,"input",28),D("ngModelChange",function(o){u(e);let l=c();return I(l.discounts[1],o)||(l.discounts[1]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),a(),r(18,"span"),p(19," %"),a(),r(20,"span",12),p(21,"+"),a(),r(22,"input",29),D("ngModelChange",function(o){u(e);let l=c();return I(l.discounts[2],o)||(l.discounts[2]=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.calculateDiscountCalculator())}),a(),r(23,"span"),p(24," %"),a()()()()}if(n&2){let e=c();s(6),O("ngModel",e.discountAfterTax),s(6),O("ngModel",e.discounts[0]),s(5),O("ngModel",e.discounts[1]),s(5),O("ngModel",e.discounts[2])}}var ci=class n{constructor(t,e,i,o,l,b,V,J,ve,Be){this.dialogRef=t;this.orderService=e;this.invoiceCalculatorService=i;this.pageInitialService=o;this.roleService=l;this.customerHttpService=b;this.orderProcessorService=V;this.promotionCouponService=J;this.dialog=ve;this.data=Be;let je=this.pageInitialService?.Data?.AppConfigJSON;this.modalConfig.title="Discount and Tax",this.modalConfig.customWidth="480px",this.salesOrder=this.orderService.Data,this.userRole=this.roleService.Data,this.isPreferedPayment=je?.ApplicationLoyalty?.PreferedPayment,this.tabActive=this.data?.tabIndexActive,this.isEditOrder=this.orderProcessorService.Data.posState==2,this.customer=b.Data,this.initDiscountAndTax(),this.initAvailablePoint(),this.initTabLoyaltyTitle()}modalConfig=new B;discount1;discount2;discountAmount;surcharge;discountAfterTax;currencySymbol;salesOrder;discounts=[];taxes;selectedTax;userRole;tabActive;isEditOrder;isPreferedPayment;customerPoint;customer;tabLoyaltyTitle;pointUsed;availablePoint;initAvailablePoint(){let t=this.customerHttpService.Data.Point,e=this.customerHttpService.Data.PointUsed;this.customerPoint=t,this.availablePoint=(t||0)-(e||0)}initTabLoyaltyTitle(){let e=this.pageInitialService?.Data?.AppConfigJSON?.ApplicationLoyalty?.Label;this.tabLoyaltyTitle=S.IsNotEmpty(e)?e:"Loyalty"}initDiscountAndTax(){this.discount1=this.salesOrder.Order.Discount,this.discount2=this.salesOrder.Order.Discount2,this.discountAmount=this.salesOrder.Order.DiscountAmount,this.surcharge=this.salesOrder.Invoice.SurchargePcg,this.discountAfterTax=this.invoiceCalculatorService.discountAfterTax,this.currencySymbol=this.invoiceCalculatorService.currencySymbol,this.taxes=this.pageInitialService.Data.Taxes,this.selectedTax=this.invoiceCalculatorService.tax,this.pointUsed=this.salesOrder.Order.PointUsed}updateTax(t){this.selectedTax=t}onOk(){this.resetAppliedCoupon(),this.applyChangesDiscountAmount(),this.salesOrder.Order.Discount=this.discount1,this.salesOrder.Order.Discount2=this.discount2,this.salesOrder.Invoice.SurchargePcg=this.surcharge,this.salesOrder.Invoice.TempSurchargePcg=this.surcharge,this.invoiceCalculatorService.discountAfterTax=this.discountAfterTax,this.salesOrder.Order.TaxTypeID=this.selectedTax.ID,this.invoiceCalculatorService.tax=this.selectedTax,this.orderService.pushNewValue(this.salesOrder),this.onClose()}onClose(){this.dialogRef.close()}calculateDiscountCalculator(){var t=100;this.discounts.forEach(e=>{t=t*(100-e)/100}),this.discount1=100-t}onDiscountAfterTaxChange(){this.discountAmount=this.discountAfterTax;let e=this.invoiceCalculatorService.TotalBeforeTax-this.discountAmount,i=this.orderService.Data.Order.TaxTypeID,o=this.pageInitialService.Data.Taxes,l=S.FilterByID(o,i);if(S.IsNotEmpty(l)&&l.CalculationTypeID==0){let b=1+l.Rate/100,V=e*b;this.discountAmount=(V-(V-this.discountAfterTax))/b}}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(si)}static \u0275fac=function(e){return new(e||n)(d(F),d(R),d(Ce),d(A),d(de),d(ft),d(U),d(Xe),d(ae),d(Le))};static \u0275cmp=P({type:n,selectors:[["POS-modal-discount"]],decls:7,vars:4,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],[3,"onTabChange"],["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(l){return i.onTabChange(l)}),g(4,Il,21,7,"tab",3),g(5,Dl,15,6,"tab",4),g(6,wl,25,4,"tab",5),a()()()()),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:[re,fe,z,Q,ee,cn,pa,ca,ge,j,_t,ht,mt,Ke,Y],encapsulation:2})};var Dn=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=St({type:n});static \u0275inj=vt({imports:[re,fe]})};var wn=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=St({type:n});static \u0275inj=vt({imports:[re,fe,qe,ge,Kt,_t,fa,ht,cn,Ke,Mn,Zt,Vr,zt,ht,Qt,ba,fr,Wi,Dn,Sa,It,Ji,xa,dn,_t,ci,Ft,Ui,aa]})};var kn=class n{constructor(t,e,i,o,l,b,V){this.orderProcessorService=t;this.posDataService=e;this.signalBroadCast=i;this.calculatorService=o;this.OrderHttpService=l;this.localDataService=b;this.posService=V;this.newSale=new He}newSale;retrySubmit(){let t=this.posService.Data.AppConfigJSON,e=this.posDataService.Data;this.posDataService.submitOrder(t).then(i=>{i.Success?(this.broadcastToCustomerDisplay(i),this.posDataService.pushNewValue(e),this.orderProcessorService.updatePosState(1,i)):(this.posDataService.pushNewValue(e),this.orderProcessorService.updatePosState(1,i))}).catch(i=>{console.log(i)})}broadcastToCustomerDisplay(t){let i=this.posDataService.Data.TotalPaidAmount-this.calculatorService.Data;this.signalBroadCast.BroadcastStateToCustomerDisplay(1,t.ObjectID,t.LoyaltyPoint,i).subscribe()}saveOffline(){let t=this.posDataService.Data,e=this.OrderHttpService.generatePOSDataForSubmission(t,!1);this.localDataService.syncOrder(e).subscribe(()=>{this.newSale.next()})}static \u0275fac=function(e){return new(e||n)(d(U),d(R),d(en),d(Ce),d(De),d(Ye),d(A))};static \u0275cmp=P({type:n,selectors:[["app-retry"]],outputs:{newSale:"newSale"},decls:21,vars:0,consts:[[1,"card"],[1,"card-header","bg-gradient-danger"],[1,"d-flex","justify-content-between"],[1,"fa-solid","fa-times-circle","me-1","text-danger"],[1,"card-body"],[1,"row","justify-content-center","g-0","mt-8"],[1,"col-8","text-center"],[1,"text-danger","fs-5"],[1,"row","mt-4","justify-content-center","g-0","mb-9"],[1,"col-5","text-center"],["type","button","matTooltipPosition","above","matTooltip","Upload your local / offline order to the cloud",1,"btn","btn-success","btn-lg","fs-3",3,"click"],[1,"card-footer","bg-light-gray"],[1,"row","justify-content-between","py-6"],[1,"col-auto"],["type","button","matTooltipPosition","above","matTooltip","Temporarily save data locally until connection to the server is restored",1,"btn","btn-light-gray",3,"click"],[1,"fa-solid","fa-save","me-2",2,"font-size","14px"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1)(2,"div",2)(3,"h2"),h(4,"i",3),p(5," Order Upload Fail! "),a()()(),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. "),a()()(),r(11,"div",8)(12,"div",9)(13,"button",10),_("click",function(){return i.retrySubmit()}),p(14," Retry Upload "),a()()()(),r(15,"div",11)(16,"div",12)(17,"div",13)(18,"button",14),_("click",function(){return i.saveOffline()}),h(19,"i",15),p(20,"Save Offline "),a()()()()())},dependencies:[Ke,se],encapsulation:2})};var Ea=(()=>{let t=class t{constructor(){this.emailRegex=S.emailRegex,this.phoneNumberRegex=S.phoneNumberRegex}validate(i){let o=this.emailRegex,l=this.phoneNumberRegex,b=o.test(i.value),V=l.test(i.value);if(b||V||i.value=="")return null;{let J="Please input a valid email or phone number";return V?J="Please input a valid email":b&&(J="Please input a valid phone number"),{invalidEmailOrPhoneNumber:{value:i.value,errMessage:J}}}}};t.\u0275fac=function(o){return new(o||t)},t.\u0275dir=Ti({type:t,selectors:[["","pOSIsInvalidEmailOrPhoneNumber",""]],features:[st([{provide:nr,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!"),h(3,"br"),p(4," Click the link below "),a()(),r(5,"a",3),p(6,"more information"),a(),p(7," > "))}function El(n,t){if(n&1){let e=y();r(0,"div",4)(1,"div",5)(2,"span",6),h(3,"i",7),a(),h(4,"input",8),r(5,"button",9),p(6,"Copy to Clipboard"),a()()(),r(7,"div",10)(8,"div",11)(9,"span",12),h(10,"i",13),a(),h(11,"input",14),r(12,"button",15),_("click",function(){u(e);let o=c();return f(o.onSendViaWhatsApp())}),p(13,"Send via WhatsApp"),a()()()}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 B;whatsAppNumberCtrl;ngOnInit(){this.modalConfig.title="Midtrans Payment Link",this.modalConfig.hideFooter=!0,this.modalConfig.customWidth="500px",this.initWaNumberCtrl()}initWaNumberCtrl(){this.whatsAppNumberCtrl=new ar(null,[Lt.pattern("^[0-9]*$"),Lt.required])}close(){this._dialogRef.close()}onSendViaWhatsApp(){let t=this.whatsAppNumberCtrl.value;if(t){let e="https://wa.me/"+t+"?text="+this.data.link;window.open(e,"_blank")}else this._toast.error("Phone Number must be insert")}static \u0275fac=function(e){return new(e||n)(d(F),d(X),d(Le))};static \u0275cmp=P({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),a()()),e&2&&(m("config",i.modalConfig),s(2),C(i.data.link==null||i.data.link==""?2:3))},dependencies:[z,Q,dt,j,ya],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"),a()),n&2){let e=c(3);m("queryParams",me(1,Bl,e.completeData.OutDeliveryID,e.outletRegister.PrintTemplate.ID))}}function ql(n,t){if(n&1&&(r(0,"a",42),p(1,"Invoice & Delivery Order"),a()),n&2){let e=c(3);m("queryParams",hi(1,jl,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)"),a()),n&2){let e=c(3);m("href",e.getInvoicePrintURL(!0),tt)}}function Jl(n,t){if(n&1&&(r(0,"a",44),p(1,"Packing Slip"),a()),n&2){let e=c(3);m("queryParams",T(1,Hl,e.completeData.OutDeliveryID))}}function Gl(n,t){if(n&1&&(r(0,"div",28),h(1,"button",39),r(2,"div",40),g(3,Ql,2,4,"a",41),g(4,ql,2,5,"a",42),g(5,$l,2,1,"a",43),g(6,Jl,2,3,"a",44),a()()),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! "),a()()())}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())}),h(3,"i"),a(),r(4,"input",48),_("ngModelChange",function(o){u(e);let l=c(2);return f(l.isPhoneOrEmail(o))}),a()(),r(5,"div",49)(6,"button",50),_("click",function(){u(e);let o=c(2);return f(o.sendReceiptToContact())}),p(7," Send Receipt "),a()()()}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),a()),n&2){let e=c(2);s(),x(" ",e.customerContact.errors==null||e.customerContact.errors.invalidEmailOrPhoneNumber==null?null:e.customerContact.errors.invalidEmailOrPhoneNumber.errMessage," ")}}function Xl(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 "),a()}}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())}),h(2,"i",55),p(3,"Generate Payment Link "),a()()}}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())}),h(2,"i",57),p(3,"Verify Payment Settlement "),a()()}}function ts(n,t){if(n&1&&(r(0,"div",38)(1,"div",52),g(2,Zl,4,0,"div",53),g(3,es,4,0,"div",53),a()()),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"),h(4,"i",26),p(5," Sell Complete "),r(6,"small",27),p(7),a()(),r(8,"div"),g(9,Gl,7,4,"div",28),a()()(),r(10,"div",13)(11,"div",29),g(12,zl,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,Xl,2,0,"button",36),r(19,"button",37),_("click",function(){u(e);let o=c();return f(o.newSale())}),p(20," New Sale (F8) "),a()()()()()(),g(21,ts,4,2,"div",38),a()}if(n&2){let e=c();s(),m("ngClass",me(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())}),a()}}function os(n,t){if(n&1&&(r(0,"a",11),p(1),a()),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),a()),n&2){let e=c();s(),x(" Invoice #",e.completeData==null?null:e.completeData.InvoiceNumber," ")}}function as(n,t){if(n&1&&(p(0),v(1,"number")),n&2){let e=c().$implicit;Te(" ",e.CurrencySymbol," ",M(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),a(),r(3,"div",61),g(4,as,2,4)(5,ls,1,0),a()()),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),ie(1,ss,6,2,"div",59,pe),a()),n&2){let e=c();s(),ne(e.itemSummary)}}function ps(n,t){if(n&1&&(r(0,"div",62)(1,"div",64),p(2),a(),r(3,"div",65),p(4),v(5,"number"),a()()),n&2){let e=t.$implicit,i=t.$index,o=c(2);s(),m("hidden",!o.role.PriceVisible),s(),Te(" ",e.Label,": ",e.CurrencySymbol," "),s(),m("hidden",!o.role.PriceVisible)("ngClass",i+1===o.amountSummary.length?"amount":""),s(),x(" ",M(5,6,e.Amount)," ")}}function ds(n,t){if(n&1&&(r(0,"div",62)(1,"div",64),p(2),a(),r(3,"div",66),p(4),v(5,"number"),a()()),n&2){let e=t.$implicit,i=c(3);s(),m("hidden",!i.role.PriceVisible),s(),Te(" ",e.Label,": ",e.CurrencySymbol," "),s(),m("hidden",!i.role.PriceVisible),s(),x(" ",M(5,5,e.Amount)," ")}}function ms(n,t){if(n&1&&(r(0,"div",63),ie(1,ds,6,7,"div",62,pe),a()),n&2){let e=c(2);s(),ne(e.paymentSummary)}}function us(n,t){if(n&1&&(r(0,"div",14),ie(1,ps,6,8,"div",62,pe),g(3,ms,3,0,"div",63),a()),n&2){let e=c();s(),ne(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"),a(),r(4,"P",69),p(5),v(6,"number"),a()()()),n&2){let e=c();s(5),x("",M(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 l=c();return f(l.isGlobalPrintEnabled()?null:o.preventDefault())}),h(1,"i",71),a()}if(n&2){let e=c();m("href",e.getInvoicePrintURL(!1),tt)("matTooltip",e.isGlobalPrintEnabled()?"Print in New Tab":"Required Global Print Role")("ngStyle",me(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"),a()(),h(4,"div",72),a()),n&2){let e=c();s(4),m("innerHtml",e.completeData.LoyaltyPoint,ki)}}function _s(n,t){if(n&1&&h(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&&h(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 bs(n,t){if(n&1&&(g(0,hs,1,5,"pos-receipt-a4",74),v(1,"async")),n&2){let e,i=c(2);C((e=M(1,1,i.receiptTemplateA4$))?0:-1,e)}}function vs(n,t){if(n&1&&(g(0,_s,1,8,"pos-receipt",73),g(1,bs,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 "),a()())}var Tn=class n{constructor(t,e,i,o,l,b,V,J,ve,Be,je,mi,Ii,Di,At,ui,wo,po,ko,Ka,Ya){this._posDataService=t;this._posService=e;this._orderProcessorService=i;this._OrderHttpService=o;this._PaymentHttpService=l;this._receiptService=b;this._outletService=V;this._toastr=J;this._onlineStatusService=ve;this._matDialog=Be;this._signalBroadCast=je;this._calculatorService=mi;this._userRoleService=Ii;this._router=Di;this._receiptCalculatorService=At;this.datePipe=ui;this.decimalPipe=wo;this.paymentGatewayService=po;this.paymentHttpService=ko;this.shoppingCartService=Ka;this.roleService=Ya;this.isGlobalPrintEnabled.set(this.roleService.global.Print)}whatsappSendReceiptService=G(vo);handleF8(){this.newSale()}salesOrder=new ut;receiptTemplate=null;receiptTemplateA4$;completeData=new Ur;printMode=2;outletRegister=new Gi;role;finalAmountDifferent=!1;amountSummary=[];itemSummary=[];paymentSummary=[];isOnline=!1;destroy$=new q;get posStorage(){return this._posService.Data}currentSellState;isOrderDateNow;sellState=Me;receiptIcon="fa-brands fa-whatsapp";customerContact=new pt;printOnPayment=E(!0);isSuccessRetrySubmit=E(!1);isGlobalPrintEnabled=E(!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(oe(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 Xo&&(t?.url?.includes("Sell")||(this._orderProcessorService.createNewTransactionInSameOutletRegister(),this._signalBroadCast.BroadcastStateToCustomerDisplay(0).subscribe()))})}InitPrintInvoice(){this.currentSellState==1&&(this.checkOrderNumber(),this.print())}initCustomerContact(){if(this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.DefaultReceiptChannel==0){this.receiptIcon="fa-solid fa-envelope";let t=this.completeData?.Contact?.Email;this.customerContact.setValue(t)}else if(this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.DefaultReceiptChannel==1){this.receiptIcon="fa-brands fa-whatsapp";let t=this.completeData?.Contact?.Mobile;this.customerContact.setValue(t)}}isPhoneOrEmail(t){let e=S.emailRegex,i=S.phoneNumberRegex,o=e,l=i,b=o.test(t),V=l.test(t);if(b)return this.receiptIcon="fa-solid fa-envelope","Email";if(V)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,l=e-i;if(l!=o&&l!=0){this.finalAmountDifferent=!0;let b=this.decimalPipe.transform(e);setTimeout(()=>{this._toastr.warning(`Final Amount should be ${b}! 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",Ae.Info);return}this._OrderHttpService.sendEmail(this.customerContact.value,this.completeData.ObjectID).then(t=>{this._toastr.success(t.Message,"Email sent!")})}sendReceiptByWhatsaap(){let t=this.customerContact.value;this.whatsappSendReceiptService.createCustomerFromNewNumberAndSendReceipt(t,this._calculatorService.currencySymbol,this.posStorage?.AppConfigJSON.ModuleSell.OrderComplete.WhatsappReceipt,{Final:this.completeData.Final,InvoiceNumber:this.completeData.InvoiceNumber,ObjectID:this.completeData.ObjectID},this._posService.Data?.WhatsAppConfigJSON?.TextReceipt)}print(){this.printMode==2?(this.printReceiptMini(),this.printOnPayment()&&this.printWindow()):this.printMode==1&&this.printReceiptA4()}printReceiptMini(){this.receiptTemplate=this._receiptService.generateReceiptMini()}setLoyaltyLabelConfig(){let t=this.posStorage?.AppConfigJSON;t.LoyaltyLabel=t.ApplicationLoyalty.Label,this.posStorage.AppConfigJSON=t}printReceiptA4(){this.receiptTemplateA4$==null?this.receiptTemplateA4$=this._OrderHttpService.generateReceiptA4(this.completeData.ObjectID).pipe(k(this.destroy$),et(t=>(t.Data.AfterSell=!0,t.Data)),fi(t=>{throw this._toastr.error(`Could not print in A4 format!
|
|
5
|
+
Printing in 8mm format instead!`,"Error!"),this.printReceiptMini(),t}),Ie(()=>{this.printOnPayment()&&this.printWindow()}),Ht(1)):this.printWindow()}printWindow(){let t=document.title;document.title=this.getCustomPrintFileName(),setTimeout(()=>{window.print(),document.title=t},500)}getCustomPrintFileName(){return`Invoice_${this.completeData?.InvoiceNumber}`}isNotEmpty(t){return S.IsNotEmpty(t)}verifyPaymentSettlement(){let t=this._calculatorService.Data,e=this.paymentGatewayService.paymentMethod,i=this.paymentGatewayService.generatePaymentVerificationData(t,e.EMoneyTypeID);this.paymentHttpService.VerifyPayment(i,e.EMoneyTypeID).pipe(k(this.destroy$)).subscribe({next:o=>{this._toastr.success(o.Message,"QR Settlement")}})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}sendReceiptToContact(){let t=S.emailRegex,e=S.phoneNumberRegex,i=this.customerContact.value,o=t.test(i),l=e.test(i);o?this.sendEmail():l&&this.sendReceiptByWhatsaap()}static \u0275fac=function(e){return new(e||n)(d(R),d(A),d(U),d(De),d(bo),d(Et),d($),d(X),d(Je),d(ae),d(en),d(Ce),d(de),d(xt),d(Zi),d(Qe),d(Y),d(tn),d(bo),d(we),d(Mt))};static \u0275cmp=P({type:n,selectors:[["sell-complete"]],hostBindings:function(e,i){e&1&&_("keydown.F8",function(){return i.handleF8()},it)},features:[st([vo])],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"),a()()(),r(6,"div",5)(7,"div",6),g(8,is,22,16,"div",7)(9,ns,1,0,"app-retry"),a(),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),a()(),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()}),h(23,"i",20),p(24,"Print Receipt "),a()(),g(25,gs,2,6,"a",21),a()()(),g(26,Cs,5,1,"div",7),a()()()(),r(27,"div",22),g(28,vs,2,2)(29,Ss,3,0,"div",23),a()),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:[re,H,Ai,fe,z,Q,Jt,It,mn,Ma,an,rn,Qt,Wt,kn,qe,dt,Ke,se,Ea,Ve,Y],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 En=class n{constructor(t,e){this._dialogRef=t;this._orderProcessorService=e;this.modalConfig.title="Clear Order?",this.modalConfig.headerType=Ae.Success}modalConfig=new B;ngOnInit(){}onOk(){this._orderProcessorService.createNewTransactionInSameOutletRegister(!1),this._orderProcessorService.emitClearOrder(),this.close()}close(){this._dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(F),d(U))};static \u0275cmp=P({type:n,selectors:[["POS-modal-clear"]],standalone:!1,decls:4,vars:2,consts:[[3,"onOk","onCancel","onClose","config"],[1,"fw-normal"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.onOk()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"h4",1),p(3),a()()()),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 Oo=(i=>(i[i.INTERNAL=1]="INTERNAL",i[i.EKSTERNAL=2]="EKSTERNAL",i[i.EKSTERNALINTERNAL=3]="EKSTERNALINTERNAL",i))(Oo||{});function xs(n,t){if(n&1){let e=y();r(0,"div",1)(1,"radio-options",12),D("modelChange",function(o){u(e);let l=c();return I(l.selectedProvider,o)||(l.selectedProvider=o),f(o)}),a(),r(2,"label",13),p(3,"Choose Provider"),a()()}if(n&2){let e=c();s(),m("options",e.couponProviders()),O("model",e.selectedProvider),m("disabled",e.hasSelectedCoupon)}}function Ms(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 "),a()}}function Ps(n,t){if(n&1){let e=y();r(0,"button",15),_("click",function(o){u(e);let l=c();return f(l.onOk(o))})("keyup.F2",function(o){u(e);let l=c();return f(l.onOk(o))}),p(1," Ok (F2) "),a()}}var Rn=class n{constructor(t,e,i,o,l,b,V){this.promotionService=t;this._orderDataService=e;this._posService=i;this.dialogRef=o;this.roleService=l;this.toastr=b;this.promotionCouponProvider=V;this.destroy$=new q,this.modeType=!1,this.typeText="password",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye-slash",this.couponInputLock=l.Data.CouponInputLock,this.initProviders(),this.subscribeToObservable(),this.initModalConfig(),this.initSelectedProvider()}modalConfig=new B;modeType;typeText;typeIcon;PromotionCoupon;PromotionNote;couponType;destroy$;onInputCouponCode=!1;selectedProvider="Internal";couponInputLock=!1;startInput;couponredemptionType=Oo;couponProviders=E([]);initModalConfig(){this.modalConfig.title="Redeem Coupon",this.modalConfig.customWidth="400px",this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0}subscribeToObservable(){this._orderDataService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.PromotionCoupon=t.Order.PromotionCoupon,this.PromotionNote=t.Order.PromotionNote})}initProviders(){this.couponProviders.update(t=>{let e=this._posService.Data.AppConfigJSON.ProviderOption,i=e.map(o=>({Key:o,Value:o}));return e?.length>0?[{Key:"Internal",Value:"DealPOS"},...i]:[]})}initSelectedProvider(){let t=this.promotionCouponProvider.coupon,e=this.promotionCouponProvider.couponProvider;S.IsNotEmpty(t)?this.selectedProvider=e:this.selectedProvider="Internal"}get hasSelectedCoupon(){let t=this._orderDataService.Data.Order;return S.IsNotEmpty(t.PromotionCoupon)}onOk(t){(t!="Enter"||t=="Enter"&&this.onInputCouponCode)&&this.onSubmitCoupon()}onSubmitCoupon(){S.IsNotEmpty(this.PromotionCoupon)?(this.applyCouponCode(),this.dialogRef.close()):this.toastr.warning("Coupon can't be empty","Warning")}onRemoveCoupon(){let t=this.promotionCouponProvider.coupon;S.IsNotEmpty(t)?this.promotionCouponProvider.removeCoupon():this.promotionService.removeAppliedCoupon(),this.dialogRef.close()}applyCouponCode(){if(this.selectedProvider==="Internal")this.promotionService.RedeemCoupon(this.PromotionCoupon,this.PromotionNote);else{let t=`(${this.selectedProvider}) ${this.PromotionNote?this.PromotionNote:""}`;this.promotionCouponProvider.redeemCoupon(this.PromotionCoupon,this.selectedProvider,t)}}onClose(){this.dialogRef.close()}showPassword(){this.modeType?(this.typeText="text",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye"):(this.typeText="password",this.typeIcon="passwordIcon fas fa-lg ng-star-inserted fa-eye-slash")}onKeyDown(t){let e=t.target.value;this.couponInputLock&&(t.key=="Enter"?this.PromotionCoupon=e:this.validateInputLock())}validateInputLock(){if(typeof this.PromotionCoupon=="string")if(this.PromotionCoupon==""||this.PromotionCoupon.length==0)this.startInput=new Date;else{let t=new Date;this.startInput=this.startInput?this.startInput:new Date,t.getTime()-this.startInput.getTime()>500&&(this.PromotionCoupon=null)}else this.startInput=new Date}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(Xe),d(R),d(A),d(F),d(de),d(X),d(Dt))};static \u0275cmp=P({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,xs,4,3,"div",1),r(3,"div",2)(4,"input",3),D("ngModelChange",function(l){return I(i.PromotionCoupon,l)||(i.PromotionCoupon=l),l}),_("paste",function(l){return i.couponInputLock?l.preventDefault():""})("keydown",function(l){return i.onKeyDown(l)})("focus",function(){return i.onInputCouponCode=!0})("blur",function(){return i.onInputCouponCode=!1}),a(),r(5,"i",4),_("click",function(){return i.modeType=!i.modeType,i.showPassword()}),a(),r(6,"label",5),p(7,"Coupon"),a()(),r(8,"div",6)(9,"textarea",7),D("ngModelChange",function(l){return I(i.PromotionNote,l)||(i.PromotionNote=l),l}),a(),r(10,"label",8),p(11,"Note"),a()()(),r(12,"footer")(13,"button",9),_("click",function(){return i.onClose()}),p(14," Cancel "),a(),g(15,Ms,2,0,"button",10)(16,Ps,2,0,"button",11),a()()),e&2&&(m("config",i.modalConfig),s(2),C(i.couponProviders().length>0?2:-1),s(2),m("type",i.typeText),O("ngModel",i.PromotionCoupon),m("disabled",i.hasSelectedCoupon),s(),le(i.typeIcon),s(4),O("ngModel",i.PromotionNote),m("disabled",i.hasSelectedCoupon),s(6),C(i.hasSelectedCoupon?15:16))},dependencies:[z,Q,ee,j,Hi],styles:[".passwordIcon[_ngcontent-%COMP%]{position:relative;margin:0 auto!important;cursor:pointer;left:20.5rem;top:-2.3rem;z-index:999}"]})};var Nn=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 B;ReturNumber;destroy$;ngOnInit(){this.initInvoiceRetur()}initInvoiceRetur(){this.ReturNumber=null,this._orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(t=>{t.posState===7&&(this.ReturNumber=t.ReturNumber)})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}onOk(){let t=this._orderDataService.Data.Order.EntityID;this._OrderHttpService.GetReturnInvoice(this.ReturNumber,t).pipe(k(this.destroy$)).subscribe(e=>{let i=this._orderProcessorService.Data;i.ReturNumber=this.ReturNumber,this._orderProcessorService.ReturnOrder(e),this._orderProcessorService.updatePosState(7),this.dialogRef.close()})}static \u0275fac=function(e){return new(e||n)(d(F),d(R),d(U),d(De))};static \u0275cmp=P({type:n,selectors:[["pos-modal-return"]],standalone:!1,decls:6,vars:2,consts:[[3,"onOk","onCancel","onClose","config"],[1,"form-floating-outline"],["type","text","data-cy","ReturnNumber","id","ReturNumber","name","ReturNumber",1,"form-control",3,"ngModelChange","ngModel"],["for","ReturNumber"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onOk",function(){return i.onOk()})("onCancel",function(){return i.dialogRef.close()})("onClose",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1)(3,"input",2),D("ngModelChange",function(l){return I(i.ReturNumber,l)||(i.ReturNumber=l),l}),a(),r(4,"label",3),p(5,"Number Invoice"),a()()()()),e&2&&(m("config",i.modalConfig),s(3),O("ngModel",i.ReturNumber))},dependencies:[z,Q,ee,j],encapsulation:2})};var Os=["serialInput"],Vn=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 B;serial;onKeyDown(t){t.key=="Enter"&&(S.IsNotEmpty(this.serial)?(this.shoppingCartService.addItemBySerial(this.serial),this.serial=null):this.toastr.warning("Serial Can`t be empty","Warning!"),this.setFocusInput())}setFocusInput(){this.serialInputEl&&setTimeout(()=>{this.serialInputEl?.nativeElement?.focus()},500)}static \u0275fac=function(e){return new(e||n)(d(F),d(we),d(X))};static \u0275cmp=P({type:n,selectors:[["POS-modal-serial"]],viewQuery:function(e,i){if(e&1&&Se(Os,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),D("ngModelChange",function(b){return u(o),I(i.serial,b)||(i.serial=b),f(b)}),_("keydown",function(b){return u(o),f(i.onKeyDown(b))}),a(),r(5,"span",4),h(6,"i",5),a()()()()}e&2&&(m("config",i.modalConfig),s(3),O("ngModel",i.serial))},dependencies:[z,Q,ee,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 Is(n,t){if(n&1&&(r(0,"tr")(1,"td"),p(2),a(),r(3,"td"),p(4),v(5,"date"),a(),r(6,"td"),p(7),v(8,"date"),a(),r(9,"td",4),p(10),a(),r(11,"td",4),p(12),v(13,"number"),a()()),n&2){let e=t.$implicit;s(2),w(e.Order.Number),s(2),w(Z(5,5,e.Order.ClientTimestamp,"dd MMM yyyy")),s(3),w(Z(8,8,e.Order.ClientTimestamp,"HH:mm")),s(3),w(e.Items.length),s(2),w(M(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"),a(),r(6,"th"),p(7,"Date"),a(),r(8,"th"),p(9,"Time"),a(),r(10,"th",4),p(11,"Qty"),a(),r(12,"th",4),p(13,"Total"),a()()(),r(14,"tbody"),ie(15,Is,14,13,"tr",null,pe),a()()()),n&2){let e=c();s(15),ne(e.offlineOrders)}}function ws(n,t){n&1&&(r(0,"h1",1),p(1,"There is no offline orders!"),a())}var An=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=>ot(ut,e))})}static \u0275fac=function(e){return new(e||n)(d(Ye))};static \u0275cmp=P({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,ws,2,0,"h1",1),e&2&&C(i.offlineOrders!=null&&i.offlineOrders.length>0?0:1)},dependencies:[Y,Qe],encapsulation:2})};var Ts=n=>({"bg-gradient-danger":n});function Es(n,t){if(n&1&&(p(0),v(1,"number")),n&2){let e=c();x(" ",M(1,1,e.onlineProducts)," ")}}function Rs(n,t){n&1&&(r(0,"small",4),p(1," Failed to get Online Products "),a())}function Ns(n,t){if(n&1&&(p(0),v(1,"date")),n&2){let e=c();x(" ",Z(1,1,e.syncDate,"dd MMM yyyy HH:mm")," ")}}function Vs(n,t){n&1&&p(0," Never been synced ")}function As(n,t){if(n&1&&(r(0,"p"),p(1),a()),n&2){let e=c();s(),x("You last synced ",e.dayDiff," days ago!")}}var Ln=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(oe(t=>t.length>0),Re(t=>{let e=Array.from(new Set(t.map(i=>i.ProductID))).map(i=>t.find(o=>o.ProductID===i));return this.offlineProduct=e.length,this.httpService.POSText("/api/catalog/product/ProductRowsCount",'{"ProductDiscontinued":false,"VariantDiscontinued":false,"CategoryDiscontinued":false,"From":"0001-01-01T00:00:00","To":"0001-01-01T00:00:00"}')}),et(t=>JSON.parse(t))).subscribe({next:t=>{this.onlineProducts=t.Count,this.getSyncTime()},error:t=>{console.error(t)}})}syncToLocalDatabase(){wi([this.syncOutlets(),this.syncProducts(),this.syncOutletPrices()]).pipe(k(this.destroy$),Re(()=>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$),oe(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(be.SynOutlet).pipe(k(this.destroy$),Re(t=>this.indexDbService.syncRegisters(t)))}syncProducts(){return this.httpService.get(be.SyncProducts).pipe(k(this.destroy$),Re(t=>this.indexDbService.syncVariants(t)))}syncOutletPrices(){return this.httpService.get(be.SynOutletPrice).pipe(k(this.destroy$),Re(t=>this.indexDbService.syncOutletPrice(t)))}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(Ye),d(X),d($e),d(F))};static \u0275cmp=P({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"),a(),r(6,"td",3),g(7,Es,2,3)(8,Rs,2,0,"small",4),a(),r(9,"td",5)(10,"div",6)(11,"button",7),_("click",function(){return i.syncToLocalDatabase()}),h(12,"i",8),r(13,"span"),p(14,"Sync"),a()()()()(),r(15,"tr")(16,"td",9),p(17,"Offline Products"),a(),r(18,"td"),p(19),v(20,"number"),a()(),r(21,"tr")(22,"td",9),p(23,"Last Sync"),a(),r(24,"td"),g(25,Ns,2,4)(26,Vs,1,0),g(27,As,2,1,"p"),a()()()()()),e&2&&(s(6),m("ngClass",T(7,Ts,!i.onlineProducts)),s(),C(i.onlineProducts?7:8),s(12),x(" ",M(20,5,i.offlineProduct)," "),s(6),C(i.syncDate?25:26),s(2),C(i.dayDiff>14?27:-1))},dependencies:[H,Y,Qe],encapsulation:2})};var Fs=["navTabs"],Fn=class n{constructor(t,e){this._router=t;this.dialogRef=e}tabs;modalConfig=new B;ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig.headerType=Ae.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(xt),d(F))};static \u0275cmp=P({type:n,selectors:[["pos-modal-sync"]],viewQuery:function(e,i){if(e&1&&Se(Fs,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(b){return u(o),f(i.onChangeTab(b))}),r(4,"mat-tab",3),h(5,"sync-products"),a(),r(6,"mat-tab",4),h(7,"sync-orders"),a()(),r(8,"div",5)(9,"button",6),_("click",function(){return u(o),f(i.goToOfflinePage())}),h(10,"i",7),p(11," Go to Details "),a()()()()}e&2&&(m("config",i.modalConfig),s(2),m("dynamicHeight",!1))},dependencies:[j,Pt,Ot,An,Ln],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 js=(n,t)=>({"btn-secondary":n,"btn-outline-secondary":t}),Hs=(n,t)=>({"btn-outline-secondary":n,"btn-secondary":t});function Us(n,t){if(n&1){let e=y();r(0,"div")(1,"label",12),h(2,"i",13),r(3,"span"),p(4,"Deduct Inventory from Outlet :"),a()(),r(5,"p-select",14),D("ngModelChange",function(o){u(e);let l=c();return I(l.deliveryEntityID,o)||(l.deliveryEntityID=o),f(o)}),a()()}if(n&2){let e=c();s(5),m("options",e.entities),O("ngModel",e.deliveryEntityID),m("filter",!0)("showClear",!0)("showClear",!1)("disabled",e.isDisabledNgSelectOutlet)}}function Ws(n,t){if(n&1){let e=y();r(0,"div",10)(1,"div",29)(2,"label",30),h(3,"i",31),r(4,"span"),p(5,"Recipient"),a()(),r(6,"input",32),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.shipping.Name,o)||(l.shipping.Name=o),f(o)}),a()(),r(7,"div",29)(8,"label",33),h(9,"i",34),r(10,"span"),p(11,"Phone"),a()(),r(12,"input",35),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.shipping.Phone,o)||(l.shipping.Phone=o),f(o)}),a()(),r(13,"div",36)(14,"label",37),h(15,"i",38),r(16,"span"),p(17,"City"),a()(),r(18,"input",39),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.shipping.City,o)||(l.shipping.City=o),f(o)}),a()(),r(19,"div",40)(20,"label",41),h(21,"i",42),r(22,"span"),p(23,"Delivery Address"),a()(),r(24,"POS-tinymce-editor",43),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.shipping.Address,o)||(l.shipping.Address=o),f(o)}),a()()()}if(n&2){let e=c(2);s(6),O("ngModel",e.shipping.Name),s(6),O("ngModel",e.shipping.Phone),s(6),O("ngModel",e.shipping.City),s(6),O("ngModel",e.shipping.Address)}}function Qs(n,t){if(n&1){let e=y();r(0,"div",15)(1,"div",16)(2,"label",12),h(3,"i",17),r(4,"span"),p(5),a()(),r(6,"div",16)(7,"p-datepicker",18),D("ngModelChange",function(o){u(e);let l=c();return I(l.posData.Invoice.DateCustom,o)||(l.posData.Invoice.DateCustom=o),f(o)}),a()()(),r(8,"div",16)(9,"label",19),h(10,"i",20),r(11,"span"),p(12,"Time"),a()(),r(13,"div",16)(14,"app-timepicker",21),D("timeChange",function(o){u(e);let l=c();return I(l.posData.Invoice.TimeCustom,o)||(l.posData.Invoice.TimeCustom=o),f(o)}),a()()()(),r(15,"div",22)(16,"div",23)(17,"div")(18,"p-checkbox",24),D("ngModelChange",function(o){u(e);let l=c();return I(l.recipientNotBuyer,o)||(l.recipientNotBuyer=o),f(o)}),a()(),r(19,"div",25)(20,"span"),h(21,"i",26),a(),r(22,"h6",23)(23,"span"),p(24,"Recipient \u2260 Buyer"),a(),r(25,"span",27),h(26,"i",28),a()()()()(),g(27,Ws,25,4,"div",10)}if(n&2){let e=c();s(5),x(" ",e.dateLabel," "),s(2),O("ngModel",e.posData.Invoice.DateCustom),m("baseZIndex",1e4)("showClear",!0),s(7),O("time",e.posData.Invoice.TimeCustom),m("showIcon",!0)("showCloseBtn",!1)("fullWidth",!0)("showClear",!0),s(4),O("ngModel",e.recipientNotBuyer),m("binary",!0),s(9),C(e.recipientNotBuyer?27:-1)}}var di=class n{constructor(t,e,i,o,l,b,V){this._dialogRef=t;this._orderDataService=e;this._posService=i;this._orderProcessorService=o;this._productHttpService=l;this._outletService=b;this.datePipe=V;this.destroy$=new q,this.initStartTime(),this.subscribePosData(),this.initModal()}modalConfig=new B;isDisabledNgSelectOutlet=!1;isDelivery=E(!1);customDate=null;shipping=new bi;deliveryEntityID="";posData=new ut;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 bi})}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=ot(Fe,this.posData.CartItems),i;this.posData.CartItems=e.map(o=>(o.isSerialType()&&(i=t.findIndex(l=>l.VariantID==o.VariantID),i!==-1&&(o.Serial=this.filterSerialBySelectedSerial(o.Serial,t[i].Serial))),o)),this._orderDataService.pushNewValue(this.posData)}filterSerialBySelectedSerial(t=[],e){let i;return e.filter(l=>(i=t.findIndex(b=>b.Number==l.Number),i!==-1))}close(){this._dialogRef.close()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(F),d(R),d(A),d(U),d(Ki),d($),d(Qe))};static \u0275cmp=P({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()}),h(6,"i",5),r(7,"span",6),p(8," Now "),r(9,"small",7)(10,"em"),p(11,"(in store purchase)"),a()()()(),r(12,"button",8),_("click",function(){return i.isDelivery.set(!0),i.changeDelivery()}),h(13,"i",9),r(14,"span",6),p(15," Later "),r(16,"small",7)(17,"em"),p(18,"(shipped to customer address)"),a()()()()()(),r(19,"div",10)(20,"div",11),g(21,Us,6,6,"div")(22,Qs,28,12),a()()()()()),e&2&&(m("config",i.modalConfig),s(5),le(me(8,js,!i.isDelivery(),i.isDelivery())),m("disabled",i.disableShippingNow),s(7),le(me(11,Hs,!i.isDelivery(),i.isDelivery())),m("disabled",i.disableShippingLater),s(9),C(i.isDelivery()?22:21))},dependencies:[ge,j,Nr,Rr,fe,z,Q,ee,Lr,Ar,Wi,kr,wr,Zt,gt,Er,Tr],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 Bn=class n{constructor(t){this.httpService=t}getParkedOrder(t,e){return this.httpService.get(be.GetPark,[{key:"EntityID",value:t},{key:"RegisterID",value:e}])}removeOrder(t,e){let i={OrderID:t};return e?this.httpService.post(be.VoidPark,i):this.httpService.post(be.RemovePark,i)}mergePark(t){return this.httpService.post(be.MergePark,t)}getOutstanding(t){let e={EntityID:t};return this.httpService.post(be.GetOutStanding,e)}static \u0275fac=function(e){return new(e||n)(N($e))};static \u0275prov=at({token:n,factory:n.\u0275fac,providedIn:"root"})};var $s=(n,t)=>({"d-flex align-items-center justify-content-center":n,"custom-container-height":t}),Na=()=>["ParkLabel","Number"],Va=n=>({"no-hover":n}),Aa=n=>({"bg-danger":n}),La=n=>({"text-white":n}),Fa=(n,t,e)=>({"duration-green":n,"duration-yellow":t,"duration-red":e});function Js(n,t){if(n&1&&(r(0,"span",12),p(1),a()),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),ie(1,Js,2,2,"span",12,pe),r(3,"span",13),p(4,"will be merged to"),a(),r(5,"span",14),p(6),a()()),n&2){let e=c(2);s(),ne(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),h(4,"i",10),a(),r(5,"input",11),D("ngModelChange",function(o){u(e);let l=c();return I(l.filter,o)||(l.filter=o),f(o)}),a()()()}if(n&2){let e=c();s(),C(e.listMerge.length>1?1:-1),s(4),O("ngModel",e.filter)}}function Ks(n,t){if(n&1&&h(0,"i"),n&2){let e=c(2).$implicit;le(e.Icon)}}function Ys(n,t){if(n&1&&(r(0,"h5",22),g(1,Ks,1,2,"i",23),r(2,"span"),p(3),v(4,"limitTo"),a()()),n&2){let e=c().$implicit,i=c(4);s(),C(e.Icon?1:-1),s(2),x(" ",i.parkedOrders.length<5?e.Name:Z(4,2,e.Name,5)," ")}}function Xs(n,t){if(n&1&&(r(0,"div",36),h(1,"i",42),r(2,"span",35),p(3),v(4,"slice"),a()()),n&2){let e=c().$implicit;s(2),m("matTooltip",e.CustomerDisplay),s(),x(" ",e.CustomerDisplay.length>20?Ne(4,2,e.CustomerDisplay,0,20)+"...":e.CustomerDisplay," ")}}function Zs(n,t){if(n&1&&(r(0,"div",38),p(1),a()),n&2){let e=c().$implicit;s(),x(" ",e.alias," ")}}function ec(n,t){if(n&1){let e=y();r(0,"div",24)(1,"div",25)(2,"div",26),_("click",function(o){let l=u(e).$implicit;return c(6).onOrderClicked(l),f(o.preventDefault())}),r(3,"h5",27)(4,"div",28),p(5),a(),r(6,"span",29),_("click",function(o){let l=u(e).$implicit;return c(6).remove(l),f(o.stopPropagation())}),h(7,"i",30),a()(),r(8,"div",31)(9,"div",32)(10,"div",33),h(11,"i",34),r(12,"span",35),p(13),v(14,"slice"),a()(),r(15,"div",36),h(16,"i",37),p(17),v(18,"date"),a(),g(19,Xs,5,6,"div",36),g(20,Zs,2,1,"div",38),a(),r(21,"div",39)(22,"div",40),p(23),a(),r(24,"input",41),D("ngModelChange",function(o){let l=u(e).$implicit;return I(l.selected,o)||(l.selected=o),f(o)}),_("change",function(){let o=u(e).$implicit,l=c(6);return f(l.chooseMerge(o))})("click",function(o){return u(e),f(o.stopPropagation())}),a()()()()()()}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,Va,o))("matTooltip",o?"You\u2019re currently retrieving this order and cannot retrieve it again!":""),s(2),m("ngClass",T(24,Aa,o)),s(),m("ngClass",T(26,La,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?Ne(14,15,e.Number,0,15)+"...":e.Number," "),s(4),x(" ",Z(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",hi(28,Fa,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),O("ngModel",e.selected)}}function tc(n,t){if(n&1&&(r(0,"div",20),ie(1,ec,25,32,"div",24,pe),v(3,"FilterByArray"),a()),n&2){let e=c().$implicit,i=c(4);s(),ne(Ne(3,0,e.List,ct(4,Na),i.filter))}}function ic(n,t){n&1&&(r(0,"div",21),h(1,"app-empty-state"),a())}function nc(n,t){if(n&1&&(r(0,"mat-tab"),K(1,Ys,5,5,"ng-template",18),r(2,"div",19),g(3,tc,4,5,"div",20)(4,ic,2,0,"div",21),a()()),n&2){let e=t.$implicit;s(3),C(e.List.length>0?3:4)}}function oc(n,t){if(n&1&&(r(0,"mat-tab-group",17),ie(1,nc,5,1,"mat-tab",null,pe),a()),n&2){let e=c(3);s(),ne(e.Layout)}}function rc(n,t){if(n&1&&(r(0,"div",15),g(1,oc,3,0,"mat-tab-group",17),a()),n&2){let e=c(2);s(),C(e.parkedOrders.length!=0?1:-1)}}function ac(n,t){if(n&1&&(r(0,"div",36),h(1,"i",42),r(2,"span",35),p(3),v(4,"slice"),a()()),n&2){let e=c().$implicit;s(2),m("matTooltip",e.CustomerDisplay),s(),w(e.CustomerDisplay.length>20?Ne(4,2,e.CustomerDisplay,0,20)+"...":e.CustomerDisplay)}}function lc(n,t){if(n&1&&(r(0,"div",38),p(1),a()),n&2){let e=c().$implicit;s(),x(" ",e.alias," ")}}function sc(n,t){if(n&1){let e=y();r(0,"div",24)(1,"div",44)(2,"div",26),_("click",function(o){let l=u(e).$implicit;return c(3).onOrderClicked(l),f(o.preventDefault())}),r(3,"h5",27)(4,"div",28),p(5),a(),r(6,"span",29),_("click",function(o){let l=u(e).$implicit;return c(3).remove(l),f(o.stopPropagation())}),h(7,"i",45),a()(),r(8,"div",31)(9,"div",32)(10,"div",33),h(11,"i",34),r(12,"span",35),p(13),v(14,"slice"),a()(),r(15,"div",36),h(16,"i",37),p(17),v(18,"date"),a(),g(19,ac,5,6,"div",36),g(20,lc,2,1,"div",38),a(),r(21,"div",39)(22,"div",40),p(23),a(),r(24,"input",41),D("ngModelChange",function(o){let l=u(e).$implicit;return I(l.selected,o)||(l.selected=o),f(o)}),_("change",function(){let o=u(e).$implicit,l=c(3);return f(l.chooseMerge(o))})("click",function(o){return u(e),f(o.stopPropagation())}),a()()()()()()}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,Va,o))("matTooltip",o?"You\u2019re currently retrieving this order and cannot retrieve it again!":""),s(2),m("ngClass",T(24,Aa,o)),s(),m("ngClass",T(26,La,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?Ne(14,15,e.Number,0,18)+"...":e.Number),s(4),x(" ",Z(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",hi(28,Fa,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),O("ngModel",e.selected)}}function cc(n,t){if(n&1&&(r(0,"div",16)(1,"div",43),ie(2,sc,25,32,"div",24,pe),v(4,"FilterByArray"),a()()),n&2){let e=c(2);s(2),ne(Ne(4,0,e.parkedOrders,ct(4,Na),e.filter))}}function pc(n,t){if(n&1&&g(0,rc,2,1,"div",15)(1,cc,5,5,"div",16),n&2){let e=c();C(e.retreiveMode==1?0:e.retreiveMode==0?1:-1)}}function dc(n,t){n&1&&h(0,"app-empty-state",3)}function mc(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"),a()}}function uc(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"),a()}}var jn=class n{constructor(t,e,i,o,l,b,V,J,ve,Be){this._dialogRef=t;this._parkedOrderService=e;this._localData=i;this._OrderHttpService=o;this._orderProcessorService=l;this._posHttpResponseService=b;this._salesOrderDataService=V;this.outletService=J;this._toastr=ve;this.roleService=Be;let je=this._salesOrderDataService.Data;this.entityId=je.Order.EntityID,this.templateID=J.Data.PrintTemplate.ID,this.RegisterID=je.Order.RegisterID,this.park=new ri(this.outletService.Data.ParkLayoutPack),this.Layout=J.Data?.ParkLayoutPack?.Layout,this.initModalDialog(),this.initConfig(),this.initSelectedRetrieve(),this.getData()}modalConfig=new B;filter;entityId;parkedOrders=[];filterAlwaysVisible;replaceAlias;parkDeletionRestriction;parkEnableMerge;AuthorizeParkOrderDeletion;listMerge=[];park;templateID;RegisterID;voidEnabled;retreiveMode;Layout;isRetrieve=E(!1);parkLabel=E(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 l=new Date(o.Created),V=Math.abs(new Date().getTime()-l.getTime()),J=Math.floor(V%864e5/36e5),ve=Math.round(V%864e5%36e5/6e4);o.Duration=J>0?ve+J*60:ve});else{i.Alias=this.park.GetAlias(i.ParkLabel),i.MemberIdentification=i.MemberIdentification?i.MemberIdentification:"";let o=new Date(i.Created),b=Math.abs(new Date().getTime()-o.getTime()),V=Math.floor(b%864e5/36e5),J=Math.round(b%864e5%36e5/6e4);i.Duration=V>0?J+V*60:J}}),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(F),d(Bn),d(Ye),d(De),d(U),d(A),d(R),d($),d(X),d(de))};static \u0275cmp=P({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,pc,2,1)(5,dc,1,0,"app-empty-state",3),a()(),r(6,"footer",4)(7,"div",5),g(8,mc,2,0,"a",6),g(9,uc,2,0,"a",6),a()()()),e&2&&(m("config",i.modalConfig),s(2),m("ngClass",me(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:[H,z,$t,Q,ee,j,se,Bi,Pt,Ot,Br,Fi,Qe,ji,Pr],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 Ba=[{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 Hn=class{OrderID;ParkLabel;Items};var fc=n=>({"no-border":n});function gc(n,t){if(n&1){let e=y();r(0,"tr",13)(1,"td"),p(2),a(),r(3,"td"),p(4),v(5,"number"),a(),r(6,"td")(7,"div",14)(8,"button",15),_("click",function(){let o=u(e).$index,l=c();return f(l.onRemoveQuantity(o))}),p(9,"-"),a(),r(10,"input",16),D("ngModelChange",function(o){let l=u(e).$implicit;return I(l.SplitQuantity,o)||(l.SplitQuantity=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onSplitedQuantityChange())}),a(),r(11,"button",17),_("click",function(){let o=u(e).$index,l=c();return f(l.onAddQuantity(o))}),p(12,"+"),a()()(),r(13,"td",18),p(14),v(15,"number"),a()()}if(n&2){let e=t.$implicit,i=t.$index,o=c();m("ngClass",T(11,fc,i==(o.cartItems==null?null:o.cartItems.length)-1)),s(2),w(e==null||e.Variant==null?null:e.Variant.Name),s(2),w(M(5,7,e==null?null:e.Price)),s(6),O("ngModel",e.SplitQuantity),m("max",e.Quantity)("min",0),s(4),w(M(15,9,e==null?null:e.Quantity))}}var Un=class n{constructor(t,e,i,o,l,b){this.dialogRef=t;this.salesOrderDataService=e;this.parkService=i;this.orderProcessorService=o;this.toastr=l;this.calculatorService=b;let V=this.salesOrderDataService?.Data?.CartItems;this.cartItems=ot(Fe,V),this.salesOrderData=ot(ut,this.salesOrderDataService.Data),this.currencySymbol=this.calculatorService.currencySymbol}modalConfig=new B;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 Hn,this.splitData.OrderID=this.salesOrderDataService?.Data?.Order?.ID,this.splitData.ParkLabel=this.parkLabel,this.splitData.Items=this.cartItems.map(t=>({ID:t.ID,Quantity:t.SplitQuantity}))}onSplitedQuantityChange(){this.splitPriceTotal=this.cartItems.map(t=>t.SplitQuantity?t.SplitQuantity:0).reduce((t,e,i)=>t+e*this.cartItems[i]?.Price,0)}onAddQuantity(t){this.cartItems=this.cartItems.map((e,i)=>(i==t&&e.SplitQuantity<e.Quantity&&(e.SplitQuantity+=1),e)),this.onSplitedQuantityChange()}onRemoveQuantity(t){this.cartItems=this.cartItems.map((e,i)=>(i==t&&e.SplitQuantity>0&&(e.SplitQuantity-=1),e)),this.onSplitedQuantityChange()}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(F),d(R),d(ke),d(U),d(X),d(Ce))};static \u0275cmp=P({type:n,selectors:[["app-modal-split"]],features:[st([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),D("ngModelChange",function(l){return I(i.parkLabel,l)||(i.parkLabel=l),l}),a()(),r(7,"div",6)(8,"div",7),p(9,"Splitted Amount"),a(),r(10,"div",8),p(11),v(12,"number"),a()(),r(13,"table",9)(14,"thead",10)(15,"tr")(16,"th"),p(17,"Name"),a(),r(18,"th"),p(19,"Price"),a(),r(20,"th",11),p(21,"Qty Split"),a(),r(22,"th",12),p(23,"Qty"),a()()(),r(24,"tbody"),ie(25,gc,16,13,"tr",13,pe),a()()()()()()()),e&2&&(m("config",i.modalConfig),s(6),O("ngModel",i.parkLabel),s(5),Te("",i.currencySymbol," ",i.splitPriceTotal?M(12,4,i.splitPriceTotal):0),s(14),ne(i.cartItems))},dependencies:[re,H,ge,j,ht,mt,fe,z,Q,ee,Pa,Y],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 Wn=class n{constructor(t,e){this.data=t;this._dialogRef=e;this.message=t.message,this.initModal()}modalConfig=new B;message;initModal(){this.modalConfig.title=this.data.title,this.modalConfig.headerType=Ae.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(Le),d(F))};static \u0275cmp=P({type:n,selectors:[["POS-modal-info"]],standalone:!1,decls:4,vars:2,consts:[[3,"onCancel","onClose","config"],[1,"fw-normal","d-flex","justify-content-center"]],template:function(e,i){e&1&&(r(0,"modal-material",0),_("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"h4",1),p(3),a()()()),e&2&&(m("config",i.modalConfig),s(3),w(i.message))},dependencies:[j],encapsulation:2})};var Qn=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 B;cartItem=new Fe;role;isSerialItem=!1;priceVisible;unitPriceEditor;pricebookSelector;pricebookCopyDesc;calculatorQtyDisabled;calculatorPriceDisabled;productCalculator=E(!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=E(!1);enableCalculatorNote=E(!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 Io=(l=>(l[l.SELL_INPUT=0]="SELL_INPUT",l[l.DISCOUNT=1]="DISCOUNT",l[l.PRODUCT=2]="PRODUCT",l[l.SERIAL=3]="SERIAL",l[l.CALCULATOR=4]="CALCULATOR",l))(Io||{});var Cc=(n,t)=>({"tooltip-container-bottom":n,"tooltip-container-top":t});function _c(n,t){n&1&&Ci(0)}var qn=class n{text;position;content;static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["POS-tooltip"]],inputs:{text:"text",position:"position",content:"content"},standalone:!1,decls:3,vars:6,consts:[[3,"ngClass"],[4,"ngTemplateOutlet"]],template:function(e,i){e&1&&(r(0,"div",0),p(1),K(2,_c,1,0,"ng-container",1),a()),e&2&&(m("ngClass",me(3,Cc,i.position=="top"||!i.position,i.position=="bottom")),s(),x(" ",i.text," "),s(),m("ngTemplateOutlet",i.content))},dependencies:[H,Li],styles:['.tooltip-container-top[_ngcontent-%COMP%]{box-shadow:0 0 5px #0003;margin:.7rem 1rem 1rem;min-width:50px;max-width:400px;background:#fff;border:1px solid #ccc;pointer-events:none;position:relative;min-height:1rem;padding:.5rem;border-radius:4px}.tooltip-container-top[_ngcontent-%COMP%]:after, .tooltip-container-top[_ngcontent-%COMP%]:before{content:"";display:block;position:absolute;bottom:100%;width:0;height:0;border-style:solid}.tooltip-container-top[_ngcontent-%COMP%]:after{left:calc(49% + 2px);border-color:transparent transparent #fff transparent;border-width:6px}.tooltip-container-top[_ngcontent-%COMP%]:before{left:49%;border-color:transparent transparent #ccc transparent;border-width:8px}.tooltip-container-bottom[_ngcontent-%COMP%]{box-shadow:0 0 5px #0003;margin:.7rem 1rem 1rem;min-width:50px;max-width:400px;background:#fff;border:1px solid #ccc;pointer-events:none;position:relative;min-height:1rem;padding:.5rem;border-radius:4px}.tooltip-container-bottom[_ngcontent-%COMP%]:after, .tooltip-container-bottom[_ngcontent-%COMP%]:before{content:"";display:block;position:absolute;bottom:100%;width:0;height:0;border-style:solid}.tooltip-container-bottom[_ngcontent-%COMP%]:after{left:calc(40% + 2px);border-color:#fff transparent transparent transparent;border-width:6px;top:100%}.tooltip-container-bottom[_ngcontent-%COMP%]:before{left:40%;border-color:#ccc transparent transparent transparent;border-width:8px;top:100%}']})};var $n=class n{constructor(t,e,i){this.overlayPositionBuilder=t;this.elementRef=e;this.overlay=i}content;position;overlayRef;ngOnInit(){let t=this.initPosition(),e=this.overlayPositionBuilder.flexibleConnectedTo(this.elementRef).withPositions([t]);this.overlayRef=this.overlay.create({positionStrategy:e})}initPosition(){let t={originX:"center",originY:"bottom",overlayX:"center",overlayY:"top"};switch(this.position){case"top":t={originX:"center",originY:"top",overlayX:"center",overlayY:"bottom"};break}return t}show(){if(this.content){this.overlayRef.detach();let t=new dr(qn),e=this.overlayRef.attach(t);typeof this.content=="string"?e.instance.text=this.content:e.instance.content=this.content,e.instance.position=this.position}}hide(){this.overlayRef.detach()}static \u0275fac=function(e){return new(e||n)(d(mr),d(jo),d(ur))};static \u0275dir=Ti({type:n,selectors:[["","customTooltip",""]],hostBindings:function(e,i){e&1&&_("mouseenter",function(){return i.show()})("mouseleave",function(){return i.hide()})},inputs:{content:[0,"customTooltip","content"],position:"position"},standalone:!1})};var Sc=["quantity"],yc=["price"],xc=["discount"],Mc=["unitCost"],Oi=n=>({selected:n}),Pc=n=>({"mt-8":n}),ja=n=>({"qtyBtn-disabled":n}),Oc=()=>["/menu/Products/Catalog/Variants/Info"],Ic=n=>({ID:n}),Dc=n=>({"col-12":n}),wc=n=>({"editable-box":n});function kc(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 "),a()}if(n&2){let e=c();m("ngClass",T(1,Oi,e.modalItemState.PRODUCT==e.currentState))}}function Tc(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 "),a()}if(n&2){let e=c();m("ngClass",T(1,Oi,e.modalItemState.SERIAL==e.currentState))}}function Ec(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 "),a()}if(n&2){let e=c();m("ngClass",T(1,Oi,e.modalItemState.CALCULATOR==e.currentState))}}function Rc(n,t){if(n&1&&(r(0,"div",29)(1,"div",30)(2,"div"),p(3),a(),r(4,"small",31),p(5),a()()()),n&2){let e=t.data;s(3),w(e==null?null:e.Value),s(2),w(e==null?null:e.Code)}}function Nc(n,t){if(n&1){let e=y();r(0,"div",16)(1,"div",27)(2,"autocompleteV2",28,0),_("onSelect",function(o){u(e);let l=c(2);return f(l.onAddItem(o))})("onInputEnter",function(o){u(e);let l=c(2);return f(l.onEnterProductCode(o))}),a(),K(4,Rc,6,2,"ng-template",null,1,yt),a()()}if(n&2){let e=nt(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 Vc(n,t){n&1&&(r(0,"div",20)(1,"div",32),p(2," Edit Prepaid Package Quantity is disabled during EDIT MODE "),a(),r(3,"div"),p(4," If you make a mistake, please delete the item and then add again "),a()())}function Ac(n,t){if(n&1&&(r(0,"span"),p(1),a()),n&2){let e=c(3);s(),x("(",e.cartItem.Variant==null?null:e.cartItem.Variant.UOMName,")")}}function Lc(n,t){if(n&1){let e=y();r(0,"div",38)(1,"strong")(2,"span"),p(3),a()(),r(4,"input",43),D("ngModelChange",function(o){u(e);let l=c(3);return I(l.cartItem.UnitQuantity,o)||(l.cartItem.UnitQuantity=o),f(o)}),a()()}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),O("ngModel",e.cartItem.UnitQuantity)}}function Fc(n,t){if(n&1&&(h(0,"input",40,3),v(2,"number")),n&2){let e=c(3);m("value",M(2,1,e.cartItem.Price))}}function Bc(n,t){if(n&1){let e=y();r(0,"input",44,3),D("ngModelChange",function(o){u(e);let l=c(3);return I(l.cartItem.Price,o)||(l.cartItem.Price=o),f(o)}),a()}if(n&2){let e=c(3);m("simpleKeyboard",e.keyboard)("readonly",!e.unitPriceEditor||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible),O("ngModel",e.cartItem.Price)}}function jc(n,t){if(n&1&&(r(0,"div",42)(1,"span",45),p(2),a()()),n&2){let e,i=c(3);s(2),x("Pricebook ",(e=i.selectedPriceBook())==null?null:e.Name," is applied")}}function Hc(n,t){if(n&1){let e=y();r(0,"div",21)(1,"div",33)(2,"strong"),p(3," Qty "),g(4,Ac,2,1,"span"),a(),r(5,"div",34)(6,"button",35),_("click",function(){u(e);let o=c(2);return f(o.updateItemQuantity(o.cartItem.Quantity!=null?o.cartItem.Quantity-1:0))}),p(7," - "),a(),r(8,"input",36,2),_("ngModelChange",function(o){u(e);let l=c(2);return f(l.updateItemQuantity(o))}),a(),r(10,"button",37),_("click",function(){u(e);let o=c(2);return f(o.updateItemQuantity(o.cartItem.Quantity!=null?o.cartItem.Quantity+1:1))}),p(11," + "),a()()(),g(12,Lc,5,5,"div",38),r(13,"div",39)(14,"strong"),p(15,"Price"),a(),g(16,Fc,3,3,"input",40)(17,Bc,2,3,"input",41),a(),g(18,jc,3,1,"div",42),a()}if(n&2){let e=c(2);m("ngClass",T(15,Pc,e.statusModal=="create")),s(4),C(e.cartItem.Variant!=null&&e.cartItem.Variant.UOM&&(e.cartItem.Variant!=null&&e.cartItem.Variant.UOMName)?4:-1),s(2),m("ngClass",T(17,ja,(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(19,ja,(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?12:-1),s(),m("hidden",!e.priceVisible),s(3),C(!e.unitPriceEditor||e.cartItem!=null&&e.cartItem.PromotionGift&&!e.editingItemPromotionVisible?16:17),s(2),C(e.selectedPriceBook()?18:-1)}}function Uc(n,t){if(n&1){let e=y();r(0,"div",23)(1,"strong"),p(2,"Sales Person"),a(),r(3,"ng-select-infinite",46),_("selectedChange",function(o){u(e);let l=c(2);return f(l.updateSales(o))}),D("selectedChange",function(o){u(e);let l=c(2);return I(l.cartItem.SalesID,o)||(l.cartItem.SalesID=o),f(o)}),a()()}if(n&2){let e=c(2);s(3),m("customTooltip",e.salesPersonName)("items",e.sales),O("selected",e.cartItem.SalesID)}}function Wc(n,t){if(n&1){let e=y();r(0,"div",23)(1,"strong"),p(2,"Fulfillment From"),a(),r(3,"ng-select",47),_("ngModelChange",function(){u(e);let o=c(2);return f(o.onDeliveryEntityChange())}),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.cartItem.EntityID,o)||(l.cartItem.EntityID=o),f(o)}),a()()}if(n&2){let e=c(2);s(3),m("disabled",e.isSellEdit())("items",e.entities),O("ngModel",e.cartItem.EntityID)}}function Qc(n,t){if(n&1){let e=y();r(0,"div",15),g(1,Nc,6,6,"div",16),g(2,Vc,5,0,"div",20),g(3,Hc,19,21,"div",21),r(4,"div",22),g(5,Uc,4,3,"div",23),g(6,Wc,4,3,"div",23),a(),r(7,"div",24)(8,"div",25)(9,"POS-tinymce-editor",26),D("ngModelChange",function(o){u(e);let l=c();return I(l.cartItem.Note,o)||(l.cartItem.Note=o),f(o)}),a()()()()}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),O("ngModel",e.cartItem.Note)}}function qc(n,t){if(n&1&&(h(0,"input",40),v(1,"number")),n&2){let e=c(2);m("value",M(1,1,e.cartItem.Discount))}}function $c(n,t){if(n&1){let e=y();r(0,"input",74,4),_("ngModelChange",function(o){u(e);let l=c(2);return f(l.updateDiscountPercentage(o))}),a()}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 Jc(n,t){if(n&1&&(h(0,"input",40),v(1,"number")),n&2){let e=c(2);m("value",M(1,1,e.inputedDiscountAmount))}}function Gc(n,t){if(n&1){let e=y();r(0,"input",75,5),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.inputedDiscountAmount,o)||(l.inputedDiscountAmount=o),f(o)}),_("ngModelChange",function(o){u(e);let l=c(2);return f(l.onDiscountAmountChange(o))}),a()}if(n&2){let e=c(2);m("max",e.cartItem==null?null:e.cartItem.GrossTotal)("simpleKeyboard",e.keyboard),O("ngModel",e.inputedDiscountAmount),m("preventNegative",!0)("readonly",!e.role.Discount||(e.cartItem==null?null:e.cartItem.PromotionGift)&&!e.editingItemPromotionVisible)}}function zc(n,t){if(n&1&&(r(0,"div",54)(1,"div",50)(2,"strong"),p(3,"Discount Amount / Qty"),a()(),r(4,"div",51)(5,"div",76)(6,"p"),p(7),v(8,"number"),a()()()()),n&2){let e=c(2);s(7),w(M(8,1,e.cartItem.DiscountAmount))}}function Kc(n,t){if(n&1){let e=y();r(0,"div",54)(1,"div",50)(2,"strong"),p(3,"Pricebook"),a()(),r(4,"div",51)(5,"ng-select",77),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.pricebookId,o)||(l.pricebookId=o),f(o)}),_("ngModelChange",function(){u(e);let o=c(2);return f(o.pricebookChange())})("clear",function(){u(e);let o=c(2);return f(o.onClearPricebook())}),a()()()}if(n&2){let e=c(2);s(5),m("items",e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.PriceBook),O("ngModel",e.pricebookId),m("disabled",e.pricebookDisabled)}}function Yc(n,t){if(n&1&&(r(0,"div",68)(1,"h5",78),p(2),v(3,"number"),a()()),n&2){let e=c(2);s(2),x(" ",M(3,1,e.cartItem.Discount),"% ")}}function Xc(n,t){if(n&1&&(r(0,"div",69)(1,"h5"),p(2),v(3,"number"),a(),r(4,"span",67),p(5,"x"),a(),r(6,"h5"),p(7),v(8,"number"),a()()),n&2){let e=c(2);s(2),w(M(3,2,e.cartItem.Quantity)),s(5),w(M(8,4,e.cartItem.DiscountAmount))}}function Zc(n,t){if(n&1&&(r(0,"h5",72),p(1),v(2,"number"),a()),n&2){let e=c(2);s(),x(" -",M(2,1,(e.cartItem==null?null:e.cartItem.GrossTotal)*(e.cartItem.Discount/100))," ")}}function ep(n,t){if(n&1&&(r(0,"div",71)(1,"h5",72),p(2),v(3,"number"),a()()),n&2){let e=c(2);s(2),x(" -",M(3,1,e.cartItem.Quantity*e.cartItem.DiscountAmount)," ")}}function tp(n,t){if(n&1&&(r(0,"div",73)(1,"div",79)(2,"h5"),p(3,"Grand Total"),a()(),r(4,"div",79)(5,"h5"),p(6),v(7,"number"),a()()()),n&2){let e=c(2);s(6),w(M(7,1,e.cartItem.Total))}}function ip(n,t){if(n&1){let e=y();r(0,"div",16)(1,"div",48)(2,"div",49)(3,"div",50)(4,"strong"),p(5,"Discount %"),a()(),r(6,"div",51)(7,"div",52),g(8,qc,2,3,"input",40)(9,$c,2,4,"input",53),a()()(),r(10,"div",54)(11,"div",50)(12,"strong"),p(13,"Discount Amount"),a()(),r(14,"div",51)(15,"div",52),g(16,Jc,2,3,"input",40)(17,Gc,2,5,"input",55),a()()(),r(18,"div",56)(19,"div",57)(20,"input",58),D("ngModelChange",function(o){u(e);let l=c();return I(l.isDiscMultipliciedQty,o)||(l.isDiscMultipliciedQty=o),f(o)}),_("ngModelChange",function(){u(e);let o=c();return f(o.onSwitchToggleDiscount())}),a()(),r(21,"div",59)(22,"strong"),p(23,"*Quantity"),a(),r(24,"span",60),h(25,"i",61),a()()(),g(26,zc,9,3,"div",54),g(27,Kc,6,3,"div",54),a(),r(28,"div",62)(29,"div",63)(30,"h4"),p(31,"Discount Simulation"),a(),r(32,"h4",64),p(33),a()(),r(34,"div",65)(35,"div",50)(36,"div",66)(37,"h5"),p(38),v(39,"number"),a(),r(40,"span",67),p(41,"x"),a(),r(42,"h5"),p(43),v(44,"number"),a()(),g(45,Yc,4,3,"div",68),g(46,Xc,9,6,"div",69),a(),r(47,"div",50)(48,"div",70)(49,"h5"),p(50),v(51,"number"),a()(),r(52,"div",71),g(53,Zc,3,3,"h5",72),a(),g(54,ep,4,3,"div",71),a(),g(55,tp,8,3,"div",73),a()()()}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),O("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(M(39,14,e.cartItem.Quantity)),s(5),w(M(44,16,e.cartItem.Price)),s(2),C(e.cartItem.Discount?45:-1),s(),C(e.cartItem.DiscountAmount>0?46:-1),s(4),w(M(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 np(n,t){n&1&&(r(0,"div",82),h(1,"i",97),r(2,"h6"),p(3,"No Image"),a()())}function op(n,t){if(n&1&&h(0,"img",83),n&2){let e=c(2);m("src",e.cartItem.Variant.ThumbnailUrl,tt)}}function rp(n,t){if(n&1){let e=y();r(0,"button",102),_("click",function(){u(e);let o=c(4);return f(o.toggleEditCost())}),h(1,"i",103),a()}}function ap(n,t){if(n&1&&(r(0,"div",99)(1,"div",96),p(2),v(3,"number"),a(),g(4,rp,2,0,"button",101),a()),n&2){let e=c(3);s(2),Te(" ",e.currencySymbol," ",Z(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 lp(n,t){if(n&1){let e=y();r(0,"button",107),_("click",function(){u(e);let o=c(4);return f(o.toggleEditCost())}),h(1,"i",108),a()}}function sp(n,t){if(n&1){let e=y();r(0,"div",100)(1,"div",104)(2,"input",105),D("ngModelChange",function(o){u(e);let l=c(3);return I(l.cartItem.Cost,o)||(l.cartItem.Cost=o),f(o)}),a(),g(3,lp,2,0,"button",106),a()()}if(n&2){let e=c(3);s(2),O("ngModel",e.cartItem.Cost),s(),C(!(e.AppConfigJSON==null||e.AppConfigJSON.ModuleSell==null)&&e.AppConfigJSON.ModuleSell.Cost.Enabled?3:-1)}}function cp(n,t){if(n&1&&(r(0,"div",91)(1,"div",98)(2,"div",88),p(3,"Cost"),a(),g(4,ap,5,6,"div",99),g(5,sp,4,2,"div",100),a()()),n&2){let e=c(2);m("ngClass",e.generalPriceCol),s(),m("ngClass",T(4,wc,e.enabledEditCost())),s(3),C(e.enabledEditCost()?-1:4),s(),C(e.enabledEditCost()?5:-1)}}function pp(n,t){if(n&1&&(r(0,"div",91)(1,"div",87)(2,"div",88),p(3,"Commission"),a(),r(4,"div",96),p(5),v(6,"number"),a()()()),n&2){let e=c(2);m("ngClass",e.generalPriceCol),s(5),Te(" ",e.currencySymbol," ",M(6,3,1e4)," ")}}function dp(n,t){if(n&1&&(r(0,"div",95)(1,"div",87)(2,"div",88),p(3,"Storage Location"),a(),r(4,"div",96),p(5),a()()()),n&2){let e=c(2);s(5),x(" ",e.cartItem.Variant.Storage," ")}}function mp(n,t){if(n&1&&(r(0,"tr")(1,"td",112),p(2),a(),r(3,"td",113),p(4),v(5,"number"),a(),r(6,"td",113),p(7),v(8,"number"),a()()),n&2){let e=t.$implicit,i=c(3);s(2),x(" ",e.Name," "),s(2),x(" ",M(5,4,e.MinimumQuantity)," "),s(3),Te(" ",i.currencySymbol," ",M(8,6,e.UnitPrice)," ")}}function up(n,t){if(n&1&&(r(0,"div",22)(1,"h5",85),p(2,"Pricebook"),a(),r(3,"div",94)(4,"table",109)(5,"thead")(6,"tr")(7,"th",110),p(8,"Name"),a(),r(9,"th",111),p(10,"Min Qty"),a(),r(11,"th",111),p(12,"Price"),a()()(),r(13,"tbody"),ie(14,mp,9,8,"tr",null,pe),v(16,"sortBy"),a()()()()),n&2){let e=c(2);s(14),ne(Ne(16,0,e.cartItem==null||e.cartItem.Variant==null?null:e.cartItem.Variant.PriceBook,"asc","MinimumQuantity"))}}function fp(n,t){if(n&1&&(r(0,"div",16)(1,"div",80)(2,"a",81),g(3,np,4,0,"div",82)(4,op,1,1,"img",83),a()(),r(5,"div",84)(6,"div",16)(7,"h5",85),p(8,"Inventory"),a(),r(9,"div",86)(10,"div",87)(11,"div",88),p(12,"On Hand"),a(),r(13,"div",89),p(14),a()()(),r(15,"div",86)(16,"div",87)(17,"div",88),p(18,"Allocated"),a(),r(19,"div",89),p(20),a()()(),r(21,"div",86)(22,"div",90)(23,"div",88),p(24,"Available"),a(),r(25,"div",89),p(26),a()()()(),r(27,"div",22)(28,"h5",85),p(29,"General Price"),a(),g(30,cp,6,6,"div",91),r(31,"div",91)(32,"div",92)(33,"div",88),p(34,"Price"),a(),r(35,"div",93),p(36),v(37,"number"),a()()(),g(38,pp,7,5,"div",91),a(),r(39,"div",22)(40,"div",94)(41,"div",16)(42,"h5",85),p(43,"Advanced"),a(),r(44,"div",95)(45,"div",87)(46,"div",88),p(47,"Content"),a(),r(48,"div",96),p(49),v(50,"number"),a()()(),g(51,dp,6,1,"div",95),a()()(),g(52,up,17,4,"div",22),a()()),n&2){let e=c();s(2),m("routerLink",ct(22,Oc))("queryParams",T(23,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),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),Te(" ",e.currencySymbol," ",M(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,Dc,!(!(e.AppConfigJSON==null||e.AppConfigJSON.ModuleSell==null||e.AppConfigJSON.ModuleSell.Grid==null)&&e.AppConfigJSON.ModuleSell.Grid.StorageVisible)||!e.cartItem.Variant.Storage)),s(5),Jo(" ",e.cartItem==null?null:e.cartItem.VariantUnitQuantity," (@",e.currencySymbol,"",M(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 gp(n,t){if(n&1){let e=y();r(0,"app-item-serial",114),D("cartItemChange",function(o){u(e);let l=c();return I(l.cartItem,o)||(l.cartItem=o),f(o)})("serialsChange",function(o){u(e);let l=c();return I(l.serials,o)||(l.serials=o),f(o)}),a()}if(n&2){let e=c();m("entityId",e.deliveryEntityId),O("cartItem",e.cartItem),m("disabled",e.orderManager.posState==2&&e.constants.IsNotEmpty(e.cartItem.ID)),O("serials",e.serials)}}function Cp(n,t){if(n&1){let e=y();r(0,"div",18)(1,"item-calculator-tab",115),_("discountTotal",function(o){u(e);let l=c();return f(l.cartItem.Discount=o)})("priceTotal",function(o){u(e);let l=c();return f(l.cartItem.Price=o)})("qtyTotal",function(o){u(e);let l=c();return f(l.cartItem.Quantity=o)})("noteChanges",function(o){u(e);let l=c();return f(l.enableCalculatorNote()?l.cartItem.Note=o:null)}),a()()}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 Ge=class n extends Qn{constructor(e,i,o,l,b,V,J,ve,Be,je,mi,Ii,Di,At,ui){super();this._dialogRef=e;this.data=i;this._shoppingCartService=o;this._outletService=l;this._posService=b;this._orderProcessorService=V;this._orderDataService=J;this._variantService=ve;this._toastr=Be;this.decimalPipe=je;this._matDialog=mi;this._numpadService=Ii;this._userRoleService=Di;this._onlineStatusService=At;this.cdRef=ui;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=zo(Ft);_quantityElement;_priceElement;_discountElement;_costElement;invoiceCalculatorService=G(Ce);salesPersonName;destroy$;AppConfigJSON=new Jr;orderManager;salesOrderData;isOnline=!0;currentState;modalItemState=Io;isDiscMultipliciedQty=!0;inputedDiscountAmount=0;serials=[];constants=S;deliveryEntityId;selectedPriceBook=E(null);isPrepaidPackage=E(!1);isSellEdit=E(!1);deliveryStateID=Co;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=qi(Fe,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 Fe}initSelectedPriceBook(){if(this.cartItem.PriceTypeID==2){let e=this.cartItem.Variant&&this.cartItem.Variant.PriceBook?this.cartItem.Variant.PriceBook:[];if(e.length==1)this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=e[0].ID;else{let i=e.find(o=>o.ID==this.cartItem.PriceBookID);this.pricebookId=i?.ID}this.setSelectedPricebook()}}checkPriceBookDisabled(){if(this.cartItem.Variant){let e=this.cartItem.Variant.TypeID!=11&&!this.pricebookSelector,i=this.cartItem.Variant.TypeID==11&&this.cartItem.Variant.SellPriceType==0&&!this.pricebookSelector;this.pricebookDisabled=e||i}}checkCalculatorPriceDisabled(){if(this.cartItem.Variant){let e=this.cartItem.Variant.TypeID!=11&&!this.unitPriceEditor,i=this.cartItem.Variant.TypeID==11&&this.cartItem.Variant.SellPriceType==0&&!this.unitPriceEditor;this.calculatorPriceDisabled=e||i}}checkQtyInputDisabled(){let e=this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion,i=S.IsNotEmpty(this.cartItem.ID);return!!(e&&!this.role.SellEditor&&this.orderManager.posState==4&&i||i&&this.cartItem?.Serial?.length>0)}checkCalculatorQtyDisabled(){let e=this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkOrderDeletion,i=this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion;this.calculatorQtyDisabled=!e&&this.orderManager.posState===4&&!this.role.Order&&i}checkEmptySalesID(){if(this.salesOrderData.Order!=null){let e=this.salesOrderData.Order.SalesID;this.isEmptySalesID=S.IsEmpty(e)}}pricebookChange(){S.IsNotEmpty(this.pricebookId)&&(this.cartItem.pricebookUpdate(this.pricebookId,!this.pricebookDisabled,this.pricebookCopyDesc),this.setSelectedPricebook())}setSelectedPricebook(){let e=this.cartItem.getSelectedPricebook(this.pricebookId);this.selectedPriceBook.set(e)}onClearPricebook(){this.cartItem=this._shoppingCartService.resetAppliedPricebook(this.cartItem)}updateHeaderTitle(e){this.modalConfig.title=e}onDeliveryEntityChange(){let e=this.entities.find(i=>i.ID==this.cartItem.EntityID);e?this.cartItem.EntityName=e.Name:delete this.cartItem.EntityName}onOk(e){this.cartItem.removeEnterNote(),!(!this.validateConfigDefaultQuantity(e)||(this.cartItem.Variant.SellPriceType==2&&(this.cartItem.Cost=this.cartItem.Price),!this._shoppingCartService.validatePriceMinimum(this.cartItem)))&&(this.validateOnSubmit(),document.getElementById("product").focus())}validateConfigDefaultQuantity(e){let i=this.cartItem.Quantity;if(e=="Enter"){if(this.isSerial())return!1;if(!this.quantityToOneInDialog)return i>0}return!0}validateOnSubmit(){if(S.IsEmpty(this.cartItem.VariantID)){this._toastr.error("Enter item data before clicking OK!","No item is entered!");return}S.IsEmpty(this.cartItem.Quantity)&&this.updateItemQuantity(1),this.generateSerialItem(),this.checkValidateSerialItem(this.cartItem)&&this.onSubmitCartItem()}onSubmitCartItem(){if(this.data==null){let e=this.cartItem;this._shoppingCartService.pushNewItemToArray(e,!0),this._shoppingCartService.addAvailableComponent(e)}else this._shoppingCartService.updateCartItem(this.cartItem,this.data.index);this._orderProcessorService.reedemPointToDiscount(),this._dialogRef.close()}generateSerialItem(){this.cartItem.isSerialType()&&this.serials.length>0&&(!this.cartItem.Serial||this.cartItem?.Serial?.length==0)&&(this.cartItem.Serial=this.serials.map(e=>({Number:e,Quantity:-1,ExpiryDate:null})),this.cartItem.Quantity=this.serials.length*-1)}onCancel(){this._dialogRef.close()}checkValidateSerialItem(e){return this._shoppingCartService.validateSerialItem(e)}updateItemQuantity(e){!this.role.Return&&e<0||(this.cartItem.Quantity=e,this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=this.cartItem.PriceBookID,this.setSelectedPricebook())}updateDiscountPercentage(e){this.cartItem.Discount=Number(e)}updateOrUnitPrice(e){this.oriUnitPrice=e}quantityEditDisabled(){return this.AppConfigJSON.ApplicationParkAndRetrieve.AccessControl.AuthorizeParkedOrdersItemDeletion&&!this.role.Order&&S.IsNotEmpty(this.cartItem.ID)}onAddItem(e){let i=this.salesOrderData.Order.EntityID;this._variantService.findVariantByID(e,i).then(o=>{let l=o,b=new Fe;b.patchByVariant(l),this.addItem(b)})}onEnterProductCode(e){let i=this.salesOrderData.Order.EntityID;this._variantService.findVariantByCode(e,i).then(o=>{if(o){let l=Object.assign(new Fr,o),b=new Fe;b.patchByVariant(l),this.addItem(b)}else this.onProductNotFound(e)}).catch(o=>{window.alert(`Barcode "${e}" is not registered in the product`)})}onProductNotFound(e){this._matDialog.open(Wn,{data:{message:`Barcode "${e}" is not registered in the product`,title:"Product not found"},width:"30%"}),this.playAudio()}playAudio(){let e=new Audio;e.src="/Sounds/bell_ring.mp3",e.load(),e.play()}addItem(e){this.onHand=0,this.AppConfigJSON.ModuleSell.ProductDialog.QuantityToOneInDialog?e.Quantity=1:this._quantityElement.nativeElement.focus(),this.cartItem=this.checkItemQuantityDefault(e),this.isSerialItem=this.isSerial();let l=`Editing Cart item - ${e.Variant?e.Variant.Name:null}`;this.updateOrUnitPrice(e.UnitPriceOriginal),this.updateHeaderTitle(l),this.cartItem=this._shoppingCartService.applyPriceBook(this.cartItem),this.pricebookId=this.cartItem.PriceBookID,this.checkPriceBookDisabled(),this.checkCalculatorPriceDisabled(),this.checkCalculatorQtyDisabled(),this.initIsUnitPriceEditor()}getStockItem(){this._variantService.getStockByID(this.cartItem.VariantID,this.salesOrderData.Order.EntityID).then(e=>{e&&(this.queryInventoryOnOpen=!0,this.allocated=e.Allocated,this.onHand=e.OnHand)})}onCalculatorQty(e){this.updateItemQuantity(e)}onCalculatorPrice(e){this.cartItem.Price=parseFloat(e)}onCalculatorUnitQty(e){this.cartItem.UnitQuantity=parseFloat(e)}resizeCloudinaryImage(e){return e&&(e=e.replace("w_80","w_150")),e}onDiscountAmountChange(e){this.isDiscMultipliciedQty?this.cartItem.DiscountAmount=e:this.cartItem.DiscountAmount=e/this.cartItem.Quantity}onSwitchToggleDiscount(){this.isDiscMultipliciedQty?this.cartItem.DiscountAmount=this.cartItem.DiscountAmount*this.cartItem.Quantity:this.cartItem.DiscountAmount=this.cartItem.DiscountAmount/this.cartItem.Quantity}onEditCost(){let e=!this.enabledEditCost();this.enabledEditCost.set(e),this.cdRef.detectChanges(),this.enabledEditCost()&&this._costElement.nativeElement?.focus()}onCalculatorValueChange(e){this.cartItem.Discount=e.discount,this.cartItem.Price=e.price,this.cartItem.Quantity=e.qty}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.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(i){return new(i||n)(d(F),d(Le),d(we),d($),d(A),d(U),d(R),d(Ki),d(X),d(Y),d(ae),d(oa),d(de),d(Je),d(Ko))};static \u0275cmp=P({type:n,selectors:[["POS-modal-item"]],viewQuery:function(i,o){if(i&1&&(Qo(o.calculatorTab,Ft,5),Se(Sc,5),Se(yc,5),Se(xc,5),Se(Mc,5)),i&2){qo();let l;ye(l=xe())&&(o._quantityElement=l.first),ye(l=xe())&&(o._priceElement=l.first),ye(l=xe())&&(o._discountElement=l.first),ye(l=xe())&&(o._costElement=l.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",3,"ngClass"],[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,"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"],["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(b){return o.onOk(b)})("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 "),a(),r(7,"a",11),_("click",function(){return o.onTabChange(o.modalItemState.DISCOUNT)}),p(8," Discount "),a(),g(9,kc,2,3,"a",12),g(10,Tc,2,3,"a",13),g(11,Ec,2,3,"a",13),a()(),r(12,"div",14),g(13,Qc,10,6,"div",15),g(14,ip,56,20,"div",16),g(15,fp,53,27,"div",16),g(16,gp,1,4,"app-item-serial",17),g(17,Cp,2,7,"div",18),a()()()()),i&2&&(m("config",o.modalConfig),s(5),m("ngClass",T(11,Oi,o.modalItemState.SELL_INPUT==o.currentState)),s(2),m("ngClass",T(13,Oi,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:[H,z,$t,Q,ee,j,_t,$n,mt,se,gt,Wt,ra,va,Yt,$i,Ft,Y,Or],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 _p=n=>({"is-invalid":n});function hp(n,t){n&1&&(r(0,"div",8)(1,"span"),p(2,"Host URL is required."),a()())}function bp(n,t){n&1&&(r(0,"span",9),p(1,"Enter the port or device URL used by your ECR middleware."),a())}var Jn=class n{constructor(t){this.dialogRef=t;this.config.title="Connect ECR",this.config.customWidth="400px"}ecrService=G(wt);config=new B;urlCtrl=new pt("https://localhost:5001/EcrHub",[Lt.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.",l=this.ecrService.isConnected()?t:i,b=this.ecrService.isConnected()?e:o;return{title:l,description:b}}static \u0275fac=function(e){return new(e||n)(d(F))};static \u0275cmp=P({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),h(4,"i",3),r(5,"h2"),p(6),a(),r(7,"span",4),p(8),a()(),r(9,"div",5)(10,"label",6),p(11,"Port / URL"),a(),h(12,"input",7),g(13,hp,3,0,"div",8)(14,bp,2,0,"span",9),a()()()()),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,_p,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:[re,H,ge,j,qe,z,Q,dt],encapsulation:2})};function vp(n,t){if(n&1){let e=y();r(0,"div",12)(1,"radio-options",13),D("modelChange",function(o){u(e);let l=c(2);return I(l.odsConfigType,o)||(l.odsConfigType=o),f(o)}),a(),r(2,"label",14),p(3,"Choose Configuration"),a()()}if(n&2){let e=c(2);s(),O("model",e.odsConfigType),m("options",t.options.OrderDisplayBroadcastModeType)}}function Sp(n,t){if(n&1&&(g(0,vp,4,2,"div",12),v(1,"async")),n&2){let e,i=c();C((e=M(1,1,i.odsConfig$))?0:-1,e)}}function yp(n,t){n&1&&(r(0,"div",4)(1,"div",15),h(2,"i",16),a(),r(3,"div",17)(4,"div"),p(5," Choose outlet first before configuring Order Display! "),a()()())}var Gn=class n{constructor(t,e,i,o){this.dialogRef=t;this.httpService=e;this.outletRegisterService=i;this.data=o;this.modalConfig=new B,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(Ie(e=>{this.odsConfigType=e.form?.OrderDisplayBroadcastMode}),fi(e=>(console.error("Error loading ODS configuration:",e),uo({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"}]}}))),Ht(1))}onSave(){let e={EntityID:this.outletRegisterService.Data.EntityID,OrderDisplayBroadcastMode:this.odsConfigType};this.httpService.post("/api/outlet/UpdateOrderDisplayBroadcastMode",e).pipe(Ie(()=>{this.dialogRef.close(e)}),fi(i=>(console.error("Error saving ODS configuration:",i),uo(null)))).subscribe()}onClose(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||n)(d(F),d($e),d($),d(Le))};static \u0275cmp=P({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,Sp,2,3)(6,yp,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. "),a()()(),r(10,"div",7)(11,"div",8),h(12,"img",9),r(13,"p",10),p(14," You can access this feature through "),r(15,"a",11),p(16,"ods.dealpos.app"),a()()()()()()()()),e&2&&(m("config",i.modalConfig),s(5),C(i.hasOutlet?5:6),s(10),m("href",i.odsLink,tt))},dependencies:[re,fe,Ui,Hi,ge,j,Ve],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 xp(n,t){if(n&1&&(r(0,"span",10),p(1),a()),n&2){let e=c().$implicit;s(),x(": ",e.value)}}function Mp(n,t){if(n&1&&(r(0,"p",6),p(1),g(2,xp,2,1,"span",10),a()),n&2){let e=t.$implicit;s(),x(" ",e.label," "),s(),C(e.value?2:-1)}}function Pp(n,t){if(n&1&&(r(0,"div",11)(1,"p",12)(2,"span",13),p(3," Valid until "),r(4,"span",14),p(5),v(6,"date"),a()()()()),n&2){let e=c(2);s(5),w(Z(6,1,e.coupon==null||e.coupon.Requirement==null?null:e.coupon.Requirement.ExpiryDate,"longDate"))}}function Op(n,t){if(n&1&&g(0,Pp,7,4,"div",11),n&2){let e=c();C((e.coupon==null||e.coupon.Requirement==null?null:e.coupon.Requirement.ExpiryDate)!=="0001-01-01T00:00:00"?0:-1)}}function Ip(n,t){n&1&&(r(0,"p",15),h(1,"i",16),r(2,"span",14),p(3,"Edit Mode: "),a(),p(4," Coupon information is displayed for reference only. Coupon removal is not available in edit mode. "),a())}function Dp(n,t){n&1&&(r(0,"p",9),h(1,"i",17),r(2,"span",14),p(3,"Important: "),a(),p(4," Removing the coupon removes the invoice level discount. Any discounts already applied to individual items will be kept. "),a())}function wp(n,t){if(n&1&&g(0,Ip,5,0,"p",15)(1,Dp,5,0,"p",9),n&2){let e=c();C(e.isRemoveCouponOnEdit()?1:0)}}function kp(n,t){n&1&&(r(0,"p",9),h(1,"i",17),r(2,"span",14),p(3,"Important: "),a(),p(4,"Removing this coupon will reset your cart to its original state. All discounts and price changes from this coupon will be removed. "),a())}var zn=class n{invoiceCalculatorService=G(Ce);dialogRef=G(F);decimalPipe=G(Y);couponService=G(Xe);couponProviderService=G(Dt);salesOrder=G(R);orderProcessorService=G(U);posService=G(A);modalConfig;couponLabel=E(null);couponRequirements=E([]);coupon=this.couponService.coupon;couponProvider=this.couponProviderService.coupon;isEdit=E(!1);isRemoveCouponOnEdit=Go(()=>this.posService.Data?.AppConfigJSON?.ModuleSell?.RemoveCouponOnEdit);activedCoupon=E(this.couponProviderService.coupon||this.couponService.coupon);currencySymbol=this.invoiceCalculatorService.currencySymbol==="Rp"?"Rp.":this.invoiceCalculatorService.currencySymbol;constructor(){this.initModalConfig(),this.initCouponLabel(),this.generateCouponRequirement()}initModalConfig(){let t=this.orderProcessorService.Data.posState;this.modalConfig=new B,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(){let t=this.salesOrder?.Data?.Order?.PromotionCoupon;return`Coupon ${this.maskCouponCode(t)} Applied`}maskCouponCode(t){return t?`***${t.slice(-2)}`:""}generateCouponRequirement(){let t=[];if(this.coupon?.ApplyToProduct?.length>0&&t.push({label:"Required Specific Product",value:null}),this.coupon?.Requirement?.MaximumDiscount&&t.push({label:"Maximum Discount",value:`${this.currencySymbol} ${this.decimalPipe.transform(this.coupon?.Requirement?.MaximumDiscount)}`}),this.coupon?.Requirement?.MinimumSpendingAmount&&t.push({label:"Minimum Spending",value:`${this.currencySymbol} ${this.decimalPipe.transform(this.coupon?.Requirement?.MinimumSpendingAmount)}`}),this.coupon?.Requirement?.FullPriceProductOnly&&t.push({label:"Full Price Product Only",value:null}),S.IsNotEmpty(this.coupon?.Requirement?.CustomerName)){let i=this.coupon?.Requirement?.CustomerName,o=this.coupon?.Requirement?.CustomerCode;t.push({label:"Exclusive for "+i+(o?` - ${o}`:""),value:null})}this.coupon?.Requirement?.CouponDeductedAmount&&t.push({label:"Point Deduction",value:`${this.decimalPipe.transform(this.coupon?.Requirement?.CouponDeductedAmount)}`}),this.couponRequirements.set(t)}initCouponLabel(){let t=this.couponProviderService.coupon||this.couponService.coupon,e=this.couponProviderService.coupon,i="";if(!t){this.couponLabel.set("");return}if(e)e.Type==="Percentage"?i=e.Amount>0?`${this.decimalPipe.transform(e.Amount)}% Discount`:"No Disc Applied.":i=e.Amount>0?`${this.currencySymbol} ${this.decimalPipe.transform(e.Amount)} Discount`:"No Disc Applied.";else switch(t?.Requirement?.Type){case 2:i=t?.Amount>0?`${this.currencySymbol} ${this.decimalPipe.transform(t?.Amount)} Discount`:"No Disc Applied.";break;case 1:i=t?.Amount>0?`${this.decimalPipe.transform(t?.Amount)}% Discount`:"No Disc Applied.";break;case 5:i="Authorize Full Access";break;case 4:i="Authorize Parked Deletion";break;case 3:i="Authorize Return";break;case 6:i="Authorize Delete Item";break;default:i="Coupon Applied";break}this.couponLabel.set(i)}onClose(){this.dialogRef.close(!1)}onRemove(){this.dialogRef.close(!0)}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=P({type:n,selectors:[["app-modal-confirm-remove-coupon"]],decls:15,vars:6,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container-fluid"],[1,"card","coupon-card","mb-8"],[1,"card-body","text-center",2,"padding","0.2rem"],[1,"mb-6","badge","text-bg-success","fs-3","text-white"],[1,"d-flex","flex-column","gap-4"],[1,"mb-0"],[1,"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,"text-success","fw-semibold"],[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)(3,"div",2)(4,"div",3)(5,"span",4),p(6),a(),r(7,"div",5),ie(8,Mp,3,2,"p",6,gi),g(10,Op,1,1),a()()(),r(11,"div",7)(12,"div",8),g(13,wp,2,1)(14,kp,5,0,"p",9),a()()()()()),e&2){let o;m("config",i.modalConfig),s(5),le(((o=i.activedCoupon())==null?null:o.Amount)>0?"badge-success":"badge-warning"),s(),x(" ",i.couponLabel()," "),s(2),ne(i.couponRequirements()),s(2),C(!(i.coupon==null||i.coupon.Requirement==null)&&i.coupon.Requirement.ExpiryDate?10:-1),s(3),C(i.isEdit()?13:14)}},dependencies:[re,ge,j,Qe],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 Tp=n=>({"is-invalid":n});function Ep(n,t){n&1&&(r(0,"div",8)(1,"span"),p(2,"Host URL is required."),a()())}function Rp(n,t){n&1&&(r(0,"span",9),p(1,"Enter the port or device URL used by your Cash Machine."),a())}var Kn=class n{constructor(t){this.dialogRef=t;this.config.title="Cash Machine",this.config.customWidth="400px",this.config.hideCancel=!0,this.config.okText=this.cashMachineService.isConnected()?"Disconnect":"Connect Now"}config=new B;urlCtrl=new pt("https://localhost:7065/CashMachineHUB",[Lt.required]);cashMachineService=G(kt);onClose(){this.dialogRef.close()}onConnect(){this.urlCtrl.valid&&this.dialogRef.close(this.urlCtrl.value)}get modalContentWording(){let t="Cash Machine Connected",e="Your Cash Machine is now online. You can process cash-in payments immediately.",i="Cash Machine Not Connected",o="To enable cash-in payments using the Cash Machine, please connect the device through the port or URL below.",l=this.cashMachineService.isConnected()?t:i,b=this.cashMachineService.isConnected()?e:o;return{title:l,description:b}}static \u0275fac=function(e){return new(e||n)(d(F))};static \u0275cmp=P({type:n,selectors:[["app-modal-connect-cash-machine"]],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-money-from-bracket","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),h(4,"i",3),r(5,"h2"),p(6),a(),r(7,"span",4),p(8),a()(),r(9,"div",5)(10,"label",6),p(11,"Port / URL"),a(),h(12,"input",7),g(13,Ep,3,0,"div",8)(14,Rp,2,0,"span",9),a()()()()),e&2&&(m("config",i.config)("dynamicValidated",i.urlCtrl.valid),s(4),m("ngClass",i.cashMachineService.isConnected()?"text-success":"text-danger"),s(2),w(i.modalContentWording.title),s(2),w(i.modalContentWording.description),s(4),m("ngClass",T(8,Tp,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:[re,H,qe,z,Q,dt,ge,j],encapsulation:2})};var Vt=class n{constructor(t,e,i,o,l,b,V,J,ve,Be,je,mi,Ii,Di,At,ui,wo,po){this.roleService=t;this.orderProcessorService=e;this.promotionService=i;this.promotionCouponService=o;this.promotionCouponProvider=l;this.dialog=b;this.parkOrderService=V;this.salesOrderService=J;this.outletRegisterService=ve;this.pageInitialService=Be;this.toastrService=je;this.httpService=mi;this.shoppingCartService=Ii;this.customerDisplay=Di;this.ecrService=At;this.ecrSignalR=ui;this.cashMachineService=wo;this.orderDisplayService=po;this.destroy$=new q,this.sourceMenu=[...Ba],this._moreMenu=new mo(this.sourceMenu),this.moreMenu$=this._moreMenu.asObservable(),this.initElgiblePromotion(),this.subscribeObservable()}_moreMenu;moreMenu$;eligiblePromotions$;destroy$;sourceMenu;_enabledDragDrop=new mo(!0);enabledDragDrop$=this._enabledDragDrop.asObservable();subscribeObservable(){wi([this.orderProcessorService.Data$,this.salesOrderService.Data$]).pipe(k(this.destroy$)).subscribe(([t,e])=>{this.filterMoreMenu(t.posState)}),this.roleService.Data$.pipe(k(this.destroy$)).subscribe({next:()=>{this.filterMoreMenu(0)}})}initElgiblePromotion(){this.eligiblePromotions$=this.promotionService.Data$.pipe(et(()=>this.promotionService.getTotalEligiblePromotion()))}moreMenuAction(t){switch(t){case"ADD_ITEM":this.dialog.open(Ge);break;case"COUPON":let e=this.salesOrderService.Data?.Order?.PromotionCoupon;S.IsNotEmpty(e)?this.dialog.open(zn).afterClosed().pipe(oe(o=>o)).subscribe(()=>this.removePromotionCoupon()):this.dialog.open(Rn);break;case"PROMOTION":this.dialog.open(sn,{id:"promotion-event"});break;case"UPLOAD":this.onImportItems();break;case"RETURN":this.dialog.open(Nn);break;case"CLEAR":this.dialog.open(En);break;case"SERIAL":this.dialog.open(Vn);break;case"SPLIT":this.onSplitItem();break;case"PRINT":this.parkOrderService.onPrintRetrieve();break;case"CANCEL":this.onCancel();break;case"SYNC":this.dialog.open(Fn);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.promotionCouponService.removeAppliedCoupon()}openOdsConfigDialog(){this.dialog.open(Gn).afterClosed().pipe(oe(t=>!!t),Ie(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(Jn).afterClosed().pipe(oe(e=>!!e)).subscribe(e=>{this.ecrSignalR.initConnection(e)})}confirmDisableEcr(){this.dialog.open(ei,{data:{title:"Disconnect ECR",message:"Are you sure you want to disconnect ECR?",okText:"OK",headerType:Ae.Warning},width:"500px"}).afterClosed().pipe(oe(t=>t),Ie(()=>{this.ecrService.disconnect(),this.ecrSignalR.stopConnection()})).subscribe(()=>{this.toastrService.success("ECR is disconnected","Success")})}openModalCashMachineUrl(){this.dialog.open(Kn).afterClosed().pipe(oe(t=>!!t)).subscribe(t=>{this.cashMachineService.initConnection(t)})}confirmDisableCashMachine(){this.dialog.open(ei,{data:{title:"Disconnect Cash Machine",message:"Are you sure you want to disconnect Cash Machine?",okText:"OK",headerType:Ae.Warning},width:"500px"}).afterClosed().pipe(oe(t=>t),Ie(()=>{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}),Ie(()=>{t
|
|
|
37
37
|
</a>.
|
|
38
38
|
</div>
|
|
39
39
|
</div>
|
|
40
|
-
`,okText:"Connect"},this.dialog.open(ei,{data:e,width:"500px"}).afterClosed().pipe(oe(i=>i),Ie(()=>{t?this.customerDisplay.disconnect():this.customerDisplay.connect()})).subscribe(()=>{this.toastrService.success(`Customer Display is ${t?"disconnected":"connected"}`,"Success")})}enableDragDrop(t){let e=S.cloneObject(this._moreMenu.value);e=e.map(i=>(i.name=="Advanced"&&(i.menus=i.menus.map(o=>(o.action=="SORT"&&(o.label=t?"Disable Sort":"Enable Sort"),o))),i)),this._moreMenu.next(e),this._enabledDragDrop.next(t)}checkAvailableInventory(){let i=this.salesOrderService.Data.CartItems.map(l=>l.VariantID),o={Outlet:this.outletRegisterService.Data.EntityID,Cart:i};this.httpService.post(be.ValidateInventory,o).subscribe(l=>{this.setAvailableInventory(l)})}setAvailableInventory(t){let e=this.salesOrderService.Data,i=e.CartItems,o=0;e.CartItems=i.map(l=>{let b=t.findIndex(V=>V.VariantID==l.VariantID);return b!==-1&&(l.AvailableInventory=t[b].OnHand,(l.Variant?.TypeID<9||l.Variant?.TypeID==12)&&(o+=l.Quantity>l.AvailableInventory?1:0)),l}),this.showToastrValidateInventory(o),this.salesOrderService.pushNewValue(e)}showToastrValidateInventory(t){t>0?this.toastrService.error(`There are ${t} products in the cart dont have sufficient stock available`,"Validate Inventory"):this.toastrService.info("All products in the cart have sufficient stock available","Validate Inventory")}filterMoreMenu(t){let e=[];t==4?e=this.filterMenuByRole().map(i=>(i.menus=i.menus.filter(o=>o.action!=="CANCEL"),i)):t==5?e=this.filterMenuByRole().map(i=>(i.menus=i.menus.filter(o=>o.action!=="SPLIT"),i)):e=this.filterMenuByRole().filter(i=>i.name!=="Bill"),e=this.disabledMenuOnEdit(e,t),this._moreMenu.next(e)}disabledMenuOnEdit(t,e){let i=this.salesOrderService.Data;return e==2&&(t=t.map(o=>(o.children=o.children?.map(l=>(l.menus=l.menus.map(b=>{switch(b.action){case"PROMOTION":i?.getRewards()?.length>0&&(b.disabled=!0,b.description="Promotion event selection is disabled as this transaction already applies a reward from a promotion event");break}return b}),l)),o.menus=o.menus.map(l=>{switch(l.action){case"RETURN":l.disabled=!0,l.description="Return is disabled in edit mode";break}return l}),o))),t}filterMenuByRole(){let t=this.roleService?.Data,e=S.cloneObject(this.sourceMenu);return e=this.filterMenuByRoles([{action:"RETRIEVE",role:t.Retrieve},{action:"FULFILLMENT",role:t.Shipping},{action:"RETURN",role:t.Return},{action:"CLEAR",role:t.DeleteItem}],e),e}filterMenuByRoles(t,e=[]){let i;return e.map(o=>(o.menus=o.menus.map(l=>(i=t.findIndex(b=>b.action==l.action),i!==-1?l.disabled=t[i].role==!1:l.disabled=!1,l)),o))}onRetrieve(){let t=this.outletRegisterService.Data.ParkLayoutPack,e=this.pageInitialService.Data.AppConfigJSON;if(t?.Layout==null&&e.ApplicationParkAndRetrieve.Advance.retreiveMode==1){this.toastrService.error("Your retrieve config is in Group mode, to enable park please setting your Park layout at Outlet page","Error!");return}this.dialog.open(jn).afterClosed().pipe(k(this.destroy$),oe(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(di)}onImportItems(){let t=this.salesOrderService?.Data?.Order?.EntityID;this.dialog.open(dn,{data:{sampleUrl:er.files.csv.sell_import,API:be.UploadCsv,outletID:t,useUppy:!0,fileEndpoint:"/API/POS/UploadCsvV3"}}).afterClosed().pipe(oe(e=>!!e)).subscribe(e=>{let i;for(let o of e)i=new Fe,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(Un)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(N(de),N(U),N(Xt),N(Xe),N(Dt),N(ae),N(ke),N(R),N($),N(A),N(X),N($e),N(we),N(Yi),N(ln),N(wt),N(kt),N(zi))};static \u0275prov=at({token:n,factory:n.\u0275fac})};var Yn=class n{config=new B;dialogRef=J(F);salesOrderService=J(R);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=P({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),h(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? "),a()(),r(6,"div",4)(7,"button",5),_("click",function(){return i.onCreateNewOrder()}),h(8,"i",6),p(9," New Order "),a(),r(10,"button",5),_("click",function(){return i.onContinueEditing()}),h(11,"i",7),p(12," Continue Editing "),a()()()()),e&2&&m("config",i.config)},dependencies:[ge,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 $a=n=>({"quickkey-subscription-overdue":n}),Ga=()=>["/menu/Outlets/Master/Quick_Key_Templates/Form"],Np=n=>({ID:n}),Vp=n=>({OutletID:n});function Ap(n,t){if(n&1&&h(0,"img",17),n&2){let e=c(2).$implicit;m("ngSrc",e.ImageURLClient)}}function Lp(n,t){if(n&1&&(r(0,"div",15)(1,"div",16),g(2,Ap,1,1,"img",17),a()()),n&2){let e=c().$implicit;s(2),C(e.ImageURLClient?2:-1)}}function Fp(n,t){if(n&1&&(r(0,"div",16)(1,"p",18)(2,"span"),p(3),v(4,"slice"),a()()()),n&2){let e=c().$implicit;s(3),w(Ne(4,1,e.Display,0,3))}}function Bp(n,t){if(n&1&&(r(0,"small",19),p(1),v(2,"number"),a()),n&2){let e=c(2).$implicit;s(),w(M(2,1,e.Children[0].UnitPrice))}}function jp(n,t){if(n&1&&(r(0,"small",20),p(1),v(2,"lowestPrice"),v(3,"number"),v(4,"highestPrice"),v(5,"number"),a()),n&2){let e=c(2).$implicit;s(),Te("",M(3,4,M(2,2,e==null?null:e.Children))," - ",M(5,8,M(4,6,e==null?null:e.Children)))}}function Hp(n,t){if(n&1&&g(0,Bp,3,3,"small",19)(1,jp,6,10,"small",20),n&2){let e=c().$implicit;C(e.Children.length==1?0:1)}}function Up(n,t){if(n&1){let e=y();r(0,"div",13)(1,"a",14),_("click",function(){let o=u(e).$implicit,l=c(4);return f(l.onSelectProduct(o))}),g(2,Lp,3,1,"div",15)(3,Fp,5,5,"div",16),r(4,"small"),p(5),v(6,"slice"),a(),g(7,Hp,2,1),a()()}if(n&2){let e=t.$implicit,i=c(4);le(i.colConfigCSSClass),s(2),C(e.ImageURLClient?2:3),s(3),w(Ne(6,5,e.Display,0,36)),s(2),C(i.quickKeyPriceVisible?7:-1)}}function Wp(n,t){if(n&1&&(r(0,"mat-tab",6)(1,"div",7)(2,"div",8),ie(3,Up,8,9,"div",9,pe),r(5,"div",10)(6,"a",11),h(7,"i",12),a()()()()()),n&2){let e=t.$implicit,i=c(3);m("label",e.Name),s(3),ne(e==null?null:e.Items),s(2),le(i.colConfigCSSClass),s(),m("routerLink",ct(5,Ga))("queryParams",T(6,Np,i.quickKey.ID))}}function Qp(n,t){if(n&1){let e=y();r(0,"mat-tab-group",5),D("selectedIndexChange",function(o){u(e);let l=c(2);return I(l.quickeyTabActive,o)||(l.quickeyTabActive=o),f(o)}),ie(1,Wp,8,8,"mat-tab",6,pe),a()}if(n&2){let e=c(2);m("disableRipple",!0),O("selectedIndex",e.quickeyTabActive),s(),ne(e.quickKey==null?null:e.quickKey.Groups)}}function qp(n,t){if(n&1&&h(0,"img",26),n&2){let e=c(2).$implicit;m("src",e.ImageURLClient,tt)}}function $p(n,t){if(n&1&&(r(0,"div",15)(1,"div",16),g(2,qp,1,1,"img",26),a()()),n&2){let e=c().$implicit;s(2),C(e.ImageURLClient?2:-1)}}function Gp(n,t){if(n&1&&(r(0,"div",16)(1,"p",18)(2,"span"),p(3),v(4,"slice"),a()()()),n&2){let e=c().$implicit;s(3),w(Ne(4,1,e.Model,0,3))}}function Jp(n,t){if(n&1&&(r(0,"small",19),p(1),v(2,"number"),a()),n&2){let e=c().$implicit;s(),w(M(2,1,e.UnitPrice))}}function zp(n,t){if(n&1){let e=y();r(0,"div",13)(1,"a",14),_("click",function(){let o=u(e).$implicit,l=c(3);return f(l.onSelectVariant(o.ID))}),g(2,$p,3,1,"div",15)(3,Gp,5,5,"div",16),r(4,"small"),p(5),v(6,"slice"),a(),g(7,Jp,3,3,"small",19),a()()}if(n&2){let e=t.$implicit,i=c(3);le(i.colConfigCSSClass),s(2),C(e.ImageURLClient?2:3),s(3),w(Ne(6,5,e.Model,0,30)),s(2),C(i.quickKeyPriceVisible?7:-1)}}function Kp(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")}),h(2,"i",23),a(),r(3,"div",24)(4,"b"),p(5),a()()(),r(6,"div",7)(7,"div",25),ie(8,zp,8,9,"div",9,pe),a()()}if(n&2){let e=c(2);s(5),x(" ",e.subQuickeyPack.Display),s(3),ne(e.subQuickeyPack==null?null:e.subQuickeyPack.Children)}}function Yp(n,t){if(n&1&&g(0,Qp,3,2,"mat-tab-group",4)(1,Kp,10,1),n&2){let e=c();C(e.quickeyState=="QUICKEY"?0:1)}}function Xp(n,t){if(n&1&&(r(0,"div",3)(1,"a",27)(2,"strong"),p(3,"QUICK KEYS UNCONFIGURED"),a(),h(4,"i",28),r(5,"span"),p(6,"Click here to setup your Quick keys"),a()()()),n&2){let e=c();m("ngClass",T(3,$a,e.currentSubsStatus==e.subscriptionStatus.OVERDUE||e.currentSubsStatus==e.subscriptionStatus.SELL_ONLY)),s(),m("routerLink",ct(5,Ga))("queryParams",T(6,Vp,e.entityId))}}var Xn=class n{constructor(t,e,i,o,l,b){this.outletRegisterService=t;this.shoppingCartService=e;this.dialog=i;this.pageInitialService=o;this.salesOrderService=l;this.authService=b;this.destroy$=new q,this.quickeyState="QUICKEY",this.currentSubsStatus=this.authService.getSubscriptionStatus()}destroy$;quickKey;subQuickeyPack;entityId;quickeyState;quickeyTabActive=0;colConfigCSSClass;subscriptionStatus=qt;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(Je,{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($),d(we),d(ae),d(A),d(R),d(Jt))};static \u0275cmp=P({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,Yp,2,1)(4,Xp,7,8,"div",3),a()()()),e&2&&(s(2),m("ngClass",T(2,$a,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:[H,Pt,Ot,Wt,Yo,Fi,Y,Sr,yr],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 ed=n=>({"cursor-pointer":n}),td=(n,t)=>({"px-2 py-2 number-disabled":n,"py-1 px-1 bg-gradient-warning":t}),id=(n,t)=>({"d-flex justify-content-end align-items-center":n,"mt-1":t}),nd=(n,t)=>({label:n,tooltip:t}),Ja=n=>({data:n}),od=()=>({label:"Later",tooltip:"Fulfillment Later"}),rd=n=>({"bg-gradient-warning px-2":n}),ad=n=>({"me-3":n});function ld(n,t){if(n&1&&(r(0,"span"),p(1),a()),n&2){let e=c();s(),Te("",e.isSalesOrderEdit?"Edit Order ":"New Order ","#",e.salesOrder==null||e.salesOrder.Order==null?null:e.salesOrder.Order.Number)}}function sd(n,t){n&1&&(r(0,"div",8),p(1,"Order Number"),a())}function cd(n,t){n&1&&Ci(0)}function pd(n,t){if(n&1&&(r(0,"div",10),K(1,cd,1,0,"ng-container",13),a()),n&2){let e=c(),i=nt(17);s(),m("ngTemplateOutlet",i)("ngTemplateOutletContext",T(5,Ja,me(2,nd,e.isDifferentFullfillmentOutlet().outletName,e.isDifferentFullfillmentOutlet().outletName)))}}function dd(n,t){n&1&&Ci(0)}function md(n,t){if(n&1&&(r(0,"div",10),K(1,dd,1,0,"ng-container",13),a()),n&2){c();let e=nt(17);s(),m("ngTemplateOutlet",e)("ngTemplateOutletContext",T(3,Ja,ct(2,od)))}}function ud(n,t){if(n&1&&(r(0,"h5",18),p(1),v(2,"limitTo"),a()),n&2){let e=c().data;s(),w(Z(2,1,e==null?null:e.label,14))}}function fd(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),h(3,"i",17),a(),g(4,ud,3,4,"h5",18),a()()}if(n&2){let e=t.data;m("ngClass",T(4,rd,e.label))("matTooltip",e==null?null:e.tooltip),s(2),m("ngClass",T(6,ad,e.label)),s(2),C(e!=null&&e.label?4:-1)}}var Zn=class n{constructor(t,e,i,o,l,b,V,G){this.registerService=t;this.salesOrderService=e;this.pageInitialService=i;this.coreService=o;this.dialog=l;this.shoppingCartService=b;this.userRoleService=V;this.orderProcessorService=G;this.destroy$=new q}selectedOutlet;destroy$;salesOrder;register;userRole;isSalesOrderEdit=!1;selectedDate=new Date;isDifferentFullfillmentOutlet=E({isDifferent:!1,outletName:""});isFulfillmentLater=E(!1);minDate=E(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(Qr,{id:"registerModal",disableClose:!0}).afterClosed().pipe(k(this.destroy$),oe(t=>S.IsNotEmpty(t?.selectedRegister))).subscribe(t=>{t?.openStartingCashDialog&&this.openOpeningCashModal()})}openOpeningCashModal(){this.pageInitialService.Data.AppConfigJSON.ModuleShift.Closure.Enabled&&this.dialog.open(qr,{disableClose:!0}).afterClosed().pipe(oe(e=>S.IsNotEmpty(e))).subscribe(e=>{let i={RegisterID:this.salesOrder.Order.RegisterID,OpAmount:e.amount};console.log(i),this.coreService.recordOpeningCash(i),document.getElementById("product").focus()})}onAddItem(t){this.shoppingCartService.addCartItemById(t).then(()=>{this.openModalItemOnNew(t)})}onBarcodeScan(t){S.IsNotEmpty(t)&&this.shoppingCartService.addCartItemByCode(t).then(e=>{this.openModalItemOnNew(e.ID)})}openModalItemOnNew(t){if(this.pageInitialService.Data.AppConfigJSON.ModuleSell.ProductDialog.OpenOnNewItemAdded){let i=this.salesOrder.CartItems.find(l=>l.VariantID==t),o=this.salesOrder.Items.lastIndexOf(i);this.dialog.open(Je,{data:{index:o,focus:"quantity"}})}}onEditNumber(){this.userRole.NumberEditor&&this.dialog.open(sa,{width:"20%"})}openFulfillmentModal(){this.dialog.open(di)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}initCursorFocus(){let t=document.getElementById("product");t&&t.focus()}static \u0275fac=function(e){return new(e||n)(d($),d(R),d(A),d(Wr),d(ae),d(we),d(de),d(U))};static \u0275cmp=P({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())}),h(3,"i",4),a(),r(4,"div",5)(5,"h3",6),_("click",function(){return u(o),f(i.openRegisterModal())}),p(6),v(7,"limitTo"),a(),r(8,"h6",7),_("click",function(){return u(o),f(i.onEditNumber())}),g(9,ld,2,2,"span")(10,sd,2,0,"div",8),a()()(),r(11,"div",9),g(12,pd,2,7,"div",10),g(13,md,2,5,"div",10),r(14,"div",11)(15,"POS-invoice-date",12),D("ngModelChange",function(b){return u(o),I(i.selectedDate,b)||(i.selectedDate=b),f(b)}),_("ngModelChange",function(){return u(o),f(i.onSelectDate())}),a()()()(),K(16,fd,5,8,"ng-template",null,0,yt)}if(e&2){let o,l;s(4),m("ngClass",T(17,ed,i.userRole.NumberEditor)),s(),m("matTooltip",i.register==null?null:i.register.Name),s(),x(" ",Z(7,14,i.register!=null&&i.register.Name?i.register==null?null:i.register.Name:"Choose an Outlet",25)," "),s(2),m("ngClass",me(19,td,!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",me(22,id,!((o=i.isDifferentFullfillmentOutlet())!=null&&o.isDifferent)&&!i.isFulfillmentLater(),(o=i.isDifferentFullfillmentOutlet())==null?null:o.isDifferent)),s(),C((l=i.isDifferentFullfillmentOutlet())!=null&&l.isDifferent?12:-1),s(),C(i.isFulfillmentLater()?13:-1),s(2),O("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:[H,Li,Q,ee,se,nn,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 Cd=n=>({"bg-gradient-danger":n}),eo=class n{constructor(t){this.onlineStatusService=t;this.isOnline$=t.getOnlineStatus$()}isOnline$;static \u0275fac=function(e){return new(e||n)(d(Ge))};static \u0275cmp=P({type:n,selectors:[["sell-left-content"]],standalone:!1,decls:8,vars:5,consts:[[1,"d-flex","flex-column"],[1,"row","border-bottom","pt-2",2,"min-height","60px",3,"ngClass"],[1,"col-12"],[1,"row","mt-5"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1),v(2,"async"),r(3,"div",2),h(4,"sell-header"),a()(),r(5,"div",3)(6,"div",2),h(7,"sell-quick-key"),a()()()),e&2&&(s(),m("ngClass",T(3,Cd,!M(2,1,i.isOnline$))))},dependencies:[H,Xn,Zn,Ve],encapsulation:2})};var Bt=n=>({selected:n});function hd(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 "),a()}if(n&2){let e=c();m("ngClass",T(1,Bt,e.modalTabState.TYPE==e.currentTabState))}}function bd(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 "),a()}if(n&2){let e=c();m("ngClass",T(1,Bt,e.modalTabState.LOGISTICS==e.currentTabState))}}function vd(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 "),a()}if(n&2){let e=c();m("ngClass",T(1,Bt,e.modalTabState.NUMBER==e.currentTabState))}}function Sd(n,t){if(n&1){let e=y();r(0,"div",14)(1,"div",16)(2,"span",17),h(3,"i",18),a(),r(4,"input",19),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.poTypesSearchTerm,o)||(l.poTypesSearchTerm=o),f(o)}),a()()()}if(n&2){let e=c(2);s(4),O("ngModel",e.poTypesSearchTerm)}}function yd(n,t){if(n&1){let e=y();r(0,"div",15)(1,"label",20)(2,"input",21),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.posData.Order.TypeID,o)||(l.posData.Order.TypeID=o),f(o)}),_("click",function(){let o=u(e).$implicit,l=c(2);return f(l.onSelectSalesOrderTag(o))}),a(),p(3),a()()}if(n&2){let e=t.$implicit,i=t.$index,o=c(2);s(),m("for",_i("potype-"+i))("ngClass",T(8,Bt,o.posData.Order.TypeID==e.ID)),s(),m("id",_i("potype-"+i)),O("ngModel",o.posData.Order.TypeID),m("value",e.ID),s(),x(" ",e.Name," ")}}function xd(n,t){if(n&1&&(r(0,"div",8)(1,"div",13),g(2,Sd,5,1,"div",14),ie(3,yd,4,10,"div",15,pe),v(5,"FilterByName"),a()()),n&2){let e,i=c();s(2),C(((e=i.poTypes())==null?null:e.length)>5?2:-1),s(),ne(Z(5,1,i.poTypes(),i.poTypesSearchTerm()))}}function Md(n,t){if(n&1){let e=y();r(0,"POS-tinymce-editor",25),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.posData.Invoice.Note,o)||(l.posData.Invoice.Note=o),f(o)}),a()}if(n&2){let e=c(2);O("ngModel",e.posData.Invoice.Note)}}function Pd(n,t){if(n&1){let e=y();r(0,"textarea",26),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.posData.Invoice.Note,o)||(l.posData.Invoice.Note=o),f(o)}),a()}if(n&2){let e=c(2);O("ngModel",e.posData.Invoice.Note)}}function Od(n,t){if(n&1&&(r(0,"div",8)(1,"div",22),g(2,Md,1,1,"POS-tinymce-editor",23),g(3,Pd,1,1,"textarea",24),a()()),n&2){let e=c();s(2),C(e.isOnline?2:-1),s(),C(e.isOnline?-1:3)}}function Id(n,t){if(n&1){let e=y();r(0,"POS-tinymce-editor",25),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.posData.Order.Note,o)||(l.posData.Order.Note=o),f(o)}),a()}if(n&2){let e=c(2);O("ngModel",e.posData.Order.Note)}}function Dd(n,t){if(n&1){let e=y();r(0,"textarea",26),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.posData.Order.Note,o)||(l.posData.Order.Note=o),f(o)}),a()}if(n&2){let e=c(2);O("ngModel",e.posData.Order.Note)}}function wd(n,t){if(n&1&&(r(0,"div",8)(1,"div",22),g(2,Id,1,1,"POS-tinymce-editor",23),g(3,Dd,1,1,"textarea",24),a()()),n&2){let e=c();s(2),C(e.isOnline?2:-1),s(),C(e.isOnline?-1:3)}}function kd(n,t){if(n&1){let e=y();r(0,"div",14)(1,"div",16)(2,"span",17),h(3,"i",18),a(),r(4,"input",19),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.serviceLogisticsSearchTerm,o)||(l.serviceLogisticsSearchTerm=o),f(o)}),a()()()}if(n&2){let e=c(2);s(4),O("ngModel",e.serviceLogisticsSearchTerm)}}function Td(n,t){if(n&1){let e=y();r(0,"div",15)(1,"label",20)(2,"input",21),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.posData.Order.LogisticsServiceID,o)||(l.posData.Order.LogisticsServiceID=o),f(o)}),_("click",function(){let o=u(e).$implicit,l=c(2);return f(l.onSelectLogisticsService(o.ID))}),a(),p(3),a()()}if(n&2){let e=t.$implicit,i=t.$index,o=c(2);s(),m("for",_i("potype-"+i))("ngClass",T(8,Bt,o.posData.Order.LogisticsServiceID==e.ID)),s(),m("id",_i("potype-"+i)),O("ngModel",o.posData.Order.LogisticsServiceID),m("value",e.ID),s(),x(" ",e.Name," ")}}function Ed(n,t){if(n&1&&(r(0,"div",8)(1,"div",13),g(2,kd,5,1,"div",14),ie(3,Td,4,10,"div",15,pe),v(5,"FilterByName"),a()()),n&2){let e,i=c();s(2),C(((e=i.serviceLogistics())==null?null:e.length)>5?2:-1),s(),ne(Z(5,1,i.serviceLogistics(),i.serviceLogisticsSearchTerm()))}}function Rd(n,t){if(n&1){let e=y();r(0,"div",36)(1,"span",37),p(2,"@"),a(),r(3,"input",38),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.exchangeRate,o)||(l.exchangeRate=o),f(o)}),a()()}if(n&2){let e=c(2);s(3),O("ngModel",e.exchangeRate)}}function Nd(n,t){if(n&1){let e=y();r(0,"div",9)(1,"div",27)(2,"strong",28),p(3,"Reference Number"),a(),r(4,"input",29),D("ngModelChange",function(o){u(e);let l=c();return I(l.posData.Order.ReferenceNumber,o)||(l.posData.Order.ReferenceNumber=o),f(o)}),a()(),r(5,"div",27)(6,"strong",30),p(7,"Invoice Number"),a(),r(8,"input",31),D("ngModelChange",function(o){u(e);let l=c();return I(l.posData.Invoice.Number,o)||(l.posData.Invoice.Number=o),f(o)}),a()()(),r(9,"div",9)(10,"div",27)(11,"div",32)(12,"strong",28),p(13,"Number of Person"),a(),r(14,"input",33),D("ngModelChange",function(o){u(e);let l=c();return I(l.posData.Order.NumberOfPerson,o)||(l.posData.Order.NumberOfPerson=o),f(o)}),a()()(),r(15,"div",27)(16,"strong",28),p(17,"Currency"),a(),r(18,"div",34)(19,"ng-select",35),D("ngModelChange",function(o){u(e);let l=c();return I(l.posData.Order.CurrencyID,o)||(l.posData.Order.CurrencyID=o),f(o)}),_("change",function(o){u(e);let l=c();return f(l.updateCurrencySymbol(o))}),a(),g(20,Rd,4,1,"div",36),a()()()}if(n&2){let e=c();s(4),O("ngModel",e.posData.Order.ReferenceNumber),s(4),O("ngModel",e.posData.Invoice.Number),m("disabled",!e.roleService.sell.Number),s(6),O("ngModel",e.posData.Order.NumberOfPerson),s(5),m("items",e.currencies()),O("ngModel",e.posData.Order.CurrencyID),m("clearable",!1),s(),C(e.posData.Order.CurrencyID!=e.defaultCurrencyID?20:-1)}}function Vd(n,t){if(n&1){let e=y();r(0,"div",36)(1,"span",37),p(2,"@"),a(),r(3,"input",38),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.exchangeRate,o)||(l.exchangeRate=o),f(o)}),a()()}if(n&2){let e=c(2);s(3),O("ngModel",e.exchangeRate)}}function Ad(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"),a(),r(5,"input",33),D("ngModelChange",function(o){u(e);let l=c();return I(l.posData.Order.NumberOfPerson,o)||(l.posData.Order.NumberOfPerson=o),f(o)}),a()()(),r(6,"div",27)(7,"strong",28),p(8,"Currency"),a(),r(9,"div",34)(10,"ng-select",35),D("ngModelChange",function(o){u(e);let l=c();return I(l.posData.Order.CurrencyID,o)||(l.posData.Order.CurrencyID=o),f(o)}),_("change",function(o){u(e);let l=c();return f(l.updateCurrencySymbol(o))}),a(),g(11,Vd,4,1,"div",36),a()()()}if(n&2){let e=c();s(5),O("ngModel",e.posData.Order.NumberOfPerson),s(5),m("items",e.currencies()),O("ngModel",e.posData.Order.CurrencyID),m("clearable",!1),s(),C(e.posData.Order.CurrencyID!=e.defaultCurrencyID?11:-1)}}var to=class n{constructor(t,e,i,o,l,b,V,G,ve){this._dialogRef=t;this._orderDataService=e;this._posService=i;this._cashierCalculatorService=o;this._outletRegisterService=l;this._orderHttpService=b;this._toastrService=V;this._onlineService=G;this.roleService=ve;this.destroy$=new q,this.currentTabState=1}serviceLogistics=E([]);serviceLogisticsSearchTerm=E("");poTypes=E([]);poTypesSearchTerm=E("");posData;config=new B;defaultCurrencyID;currencies=E([]);currentTabState;modalTabState=Ia;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=qi(un,i.Template);e.PrintTemplate=o,this._outletRegisterService.pushNewValue(e)})}onSelectLogisticsService(t){t===this.posData.Order.LogisticsServiceID?this.posData.Order.LogisticsServiceID=null:this.posData.Order.LogisticsServiceID=t}onTabChange(t){this.currentTabState=t}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(F),d(R),d(A),d(Ce),d($),d(De),d(X),d(Ge),d(Mt))};static \u0275cmp=P({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(l){return i.onOk(l)})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div")(5,"a",3),_("click",function(){return i.onTabChange(i.modalTabState.NOTE)}),p(6," Note "),a(),r(7,"a",4),_("click",function(){return i.onTabChange(i.modalTabState.INTERNAL_NOTE)}),p(8," Order Note "),a(),g(9,hd,2,3,"a",5),g(10,bd,2,3,"a",6),g(11,vd,2,3,"a",7),a()(),g(12,xd,6,4,"div",8)(13,Od,4,2,"div",8)(14,wd,4,2,"div",8)(15,Ed,6,4,"div",8)(16,Nd,21,8)(17,Ad,12,5,"div",9),a()()()),e&2){let o;m("config",i.config),s(5),m("ngClass",T(7,Bt,i.modalTabState.NOTE==i.currentTabState)),s(2),m("ngClass",T(9,Bt,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:[H,z,lr,Q,Gt,ee,j,_t,mt,se,gt,xr],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 Ld(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2," Amount "),a(),r(3,"td",19),p(4),v(5,"number"),a()()),n&2){let e=c(2);s(4),x(" ",M(5,1,e.calculatorService.GrossTotal)," ")}}function Fd(n,t){if(n&1&&(r(0,"span"),p(1),v(2,"number"),a()),n&2){let e=c(3);s(),x("",M(2,1,e.salesOrder.Order.Discount),"%")}}function Bd(n,t){if(n&1&&(r(0,"span"),p(1),v(2,"number"),a()),n&2){let e=c(3);s(),x("",Z(2,1,e.salesOrder.Order.Discount,"1.0-4"),"%")}}function jd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),g(3,Fd,3,3,"span"),g(4,Bd,3,4,"span"),a(),r(5,"td",20),p(6),v(7,"number"),a()()),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(M(7,4,e.calculatorService.Discount1Amount*-1))}}function Hd(n,t){if(n&1&&(r(0,"span"),p(1),v(2,"number"),a()),n&2){let e=c(3);s(),x("",M(2,1,e.salesOrder.Order.Discount2),"%")}}function Ud(n,t){if(n&1&&(r(0,"span"),p(1),v(2,"number"),a()),n&2){let e=c(3);s(),x("",Z(2,1,e.salesOrder.Order.Discount2,"1.0-4"),"%")}}function Wd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),g(3,Hd,3,3,"span"),g(4,Ud,3,4,"span"),a(),r(5,"td",20),p(6),v(7,"number"),a()()),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(M(7,4,e.calculatorService.Discount2Amount*-1))}}function Qd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),a(),r(3,"td",20),p(4),v(5,"number"),a()()),n&2){let e=c(2);s(2),Te(" ",e.appConfig==null||e.appConfig.CorePrint==null?null:e.appConfig.CorePrint.Alias.DiscountAmount," ",e.calculatorService.currencySymbol," "),s(2),w(M(5,3,e.salesOrder.Order.DiscountAmount*-1))}}function qd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),a(),r(3,"td",19),p(4),v(5,"number"),a()()),n&2){let e=c(2);s(2),x(" ",e.calculatorService==null||e.calculatorService.tax==null?null:e.calculatorService.tax.Label," "),s(2),w(M(5,2,e.calculatorService==null?null:e.calculatorService.TaxAmount))}}function $d(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),v(3,"number"),a(),r(4,"td",21),p(5),v(6,"number"),a()()),n&2){let e=c(2);s(2),x(" SURCHARGE ",M(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(" ",M(6,5,e.calculatorService==null?null:e.calculatorService.SurchargeAmount))}}function Gd(n,t){if(n&1&&(r(0,"div",0),h(1,"div",14)(2,"div",15),r(3,"div",16)(4,"table",17),g(5,Ld,6,3,"tr"),g(6,jd,8,6,"tr"),g(7,Wd,8,6,"tr"),g(8,Qd,6,5,"tr"),g(9,qd,6,4,"tr"),g(10,$d,7,7,"tr"),a()()()),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 Jd(n,t){if(n&1){let e=y();r(0,"button",22),_("click",function(){u(e);let o=c();return f(o.onOpenModalDiscount())}),h(1,"i",23),a()}}var io=class n{constructor(t,e,i,o,l,b,V,G,ve){this.calculatorService=t;this.salesOrderService=e;this.userRoleService=i;this.outletService=o;this.pageInitialService=l;this.dialog=b;this.orderProcessorService=V;this.payService=G;this.parkOrderService=ve;this.destroy$=new q}handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.payService.payOrder()}taxCalculationType=ho;destroy$;salesOrder;userRole;appConfig;parkLayoutPack;orderProcessor;isIgnoreDecimalDisc1;isIgnoreDecimalDisc2;outletRegister;parkOrderRetrieve;ngOnInit(){this.subscribeToObservable()}subscribeToObservable(){this.appConfig=this.pageInitialService.Data.AppConfigJSON,this.salesOrderService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.salesOrder=t,t.TotalQuantity,this.initIgnoreDecimal()}),this.userRoleService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.userRole=t}),this.outletService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.outletRegister=t,this.parkLayoutPack=t.ParkLayoutPack}),this.orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.orderProcessor=t})}initIgnoreDecimal(){this.isIgnoreDecimalDisc1=this.checkIgnoreDecimalDisc(this.salesOrder.Order.Discount),this.isIgnoreDecimalDisc2=this.checkIgnoreDecimalDisc(this.salesOrder.Order.Discount2)}onPark(){this.parkOrderService.parkOrder()}onPayOrder(){this.payService.payOrder()}onOpenModalDiscount(){this.dialog.open(ci,{data:{tabIndexActive:"Discount"}})}checkIgnoreDecimalDisc(t){let e=this.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal,i=t%1===0;return e&&i}onOpenNotesModal(){this.dialog.open(to,{width:"45%"})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(Ce),d(R),d(de),d($),d(A),d(ae),d(U),d(ma),d(ke))};static \u0275cmp=P({type:n,selectors:[["sell-cart-footer"]],hostBindings:function(e,i){e&1&&_("keydown.F8",function(l){return i.handleF8(l)},it)},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,Gd,11,6,"div",0),r(1,"div",1)(2,"div",2)(3,"button",3),_("click",function(){return i.onOpenNotesModal()}),h(4,"i",4),a()(),r(5,"div",5)(6,"button",6),_("click",function(){return i.onPark()}),h(7,"i",7),r(8,"span"),p(9),a()()(),r(10,"div",8)(11,"div",9),g(12,Jd,2,0,"button",10),r(13,"button",11),_("click",function(){return i.onPayOrder()}),r(14,"div",12)(15,"div")(16,"span"),p(17,"Pay"),a(),r(18,"small",13),p(19),v(20,"number"),a()(),r(21,"div"),p(22),v(23,"async"),v(24,"number"),a()()()()()()),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(" (",M(20,9,i.salesOrder.cartQuantity)," Items) "),s(3),x(" ",i.userRole!=null&&i.userRole.PriceVisible?M(24,13,M(23,11,i.calculatorService.Data$)):"-"," "))},dependencies:[H,se,Ve,Y],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 Kd=n=>({"ps-0":n});function Yd(n,t){if(n&1){let e=y();r(0,"input",40),D("ngModelChange",function(o){u(e);let l=c(2).$implicit;return I(l.Splited,o)||(l.Splited=o),f(o)}),a()}if(n&2){let e=c(2).$implicit;O("ngModel",e.Splited)}}function Xd(n,t){if(n&1&&(r(0,"small"),p(1),a()),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,Yd,1,1,"input",39),g(3,Xd,2,1,"small"),a()()),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 em(n,t){if(n&1&&(r(0,"div",41),h(1,"img",43),a()),n&2){let e=c(2).$implicit;s(),m("src",e.Variant==null?null:e.Variant.ThumbnailUrl,tt)}}function tm(n,t){n&1&&(r(0,"div",42),h(1,"i",44),a())}function im(n,t){if(n&1&&(r(0,"span",13),g(1,em,2,1,"div",41)(2,tm,2,0,"div",42),a()),n&2){let e=c().$implicit;s(),C(e.Variant!=null&&e.Variant.ThumbnailUrl?1:2)}}function nm(n,t){n&1&&h(0,"i",45)}function om(n,t){n&1&&h(0,"i",46)}function rm(n,t){if(n&1&&(r(0,"span",17),g(1,nm,1,0,"i",45)(2,om,1,0,"i",46),a()),n&2){let e=c().$implicit;s(),C(e.Taxable?1:2)}}function am(n,t){n&1&&h(0,"i",18)}function lm(n,t){if(n&1&&(r(0,"small",20),p(1),a()),n&2){let e=c().$implicit;s(),x(" ",e.Variant.CategoryName," ")}}function sm(n,t){if(n&1&&(r(0,"small",21),p(1),a()),n&2){let e=c().$implicit;s(),x(" ",e.Variant.BrandName," ")}}function cm(n,t){if(n&1&&(r(0,"small",22),p(1),a()),n&2){let e=c().$implicit;s(),x(" ",e.Variant.Storage," ")}}function pm(n,t){if(n&1&&h(0,"small",24),n&2){let e=c().$implicit;m("innerHtml",e.Note?e.Note:e.PriceNote,ki)}}function dm(n,t){if(n&1&&(r(0,"small",25),p(1," Sold by "),r(2,"i"),p(3),a()()),n&2){let e=c().$implicit;s(3),w(e.SalesName)}}function mm(n,t){if(n&1&&(r(0,"small")(1,"i",47),p(2),a()()),n&2){let e=c().$implicit;s(2),x("Fulfillment from: ",e.EntityName)}}function um(n,t){if(n&1&&(r(0,"div",28),h(1,"i",48),a()),n&2){let e=c().$implicit;m("matTooltip",e.AvailableInventory<e.Quantity?e.AvailableInventory+" Available Stock":"")}}function fm(n,t){if(n&1){let e=y();r(0,"span",49),_("click",function(){u(e);let o=c().$index,l=c(2);return f(l.onEditItem(o,"quantity"))}),p(1),v(2,"number"),a()}if(n&2){let e=c().$implicit,i=c(2);s(),x(" ",Z(2,1,e.Quantity,"1.0-"+i.qtyDecimalPlace()))}}function gm(n,t){if(n&1){let e=y();r(0,"span",50),p(1,"x"),a(),r(2,"div",51),_("click",function(){u(e);let o=c().$index,l=c(2);return f(l.onEditItem(o,"quantity"))}),r(3,"span",52),p(4),v(5,"number"),a()()}if(n&2){let e=c().$implicit,i=c(2);s(4),w(Z(5,1,e.UnitQuantity,"1.0-"+i.qtyDecimalPlace()))}}function Cm(n,t){if(n&1&&(r(0,"span",31),p(1),v(2,"number"),a()),n&2){let e=c().$implicit,i=c(2);s(),x("@",Z(2,1,e.VariantUnitQuantity,"1.0-"+i.qtyDecimalPlace()))}}function _m(n,t){if(n&1&&(r(0,"small",32),p(1),a()),n&2){let e=c().$implicit,i=c(2);s(),w(i.isNotEmpty(e.Variant.UOM)?e.Variant.UOMName:"")}}function hm(n,t){if(n&1&&(r(0,"div",55),p(1),v(2,"number"),a()),n&2){let e=c(4).$implicit;s(),x(" ",Z(2,1,e.UnitPriceOriginal,"1.0-4")," ")}}function bm(n,t){if(n&1){let e=y();r(0,"div",54),_("click",function(){u(e);let o=c(3).$index,l=c(2);return f(l.onEditItem(o,"price"))}),g(1,hm,3,4,"div",55),r(2,"div",30),p(3),v(4,"number"),a()()}if(n&2){let e=c(3).$implicit;s(),C(e.UnitPriceOriginal>e.Price?1:-1),s(2),x(" ",Z(4,2,e.Price,"1.0-4")," ")}}function vm(n,t){if(n&1){let e=y();r(0,"div",49),_("click",function(){u(e);let o=c(3).$index,l=c(2);return f(l.onEditItem(o,"price"))}),p(1),v(2,"number"),a()}if(n&2){let e=c(3).$implicit;s(),x(" ",Z(2,1,e.Price,"1.0-4")," ")}}function Sm(n,t){if(n&1&&g(0,bm,5,5,"div",53)(1,vm,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 ym(n,t){if(n&1&&(r(0,"div",27),g(1,Sm,2,1),a()),n&2){let e=c().$implicit;s(),C(e.Price!==e.Total?1:-1)}}function xm(n,t){if(n&1&&(r(0,"div"),p(1),v(2,"number"),a()),n&2){let e=c().$implicit;s(),x(" ",e.Discount==0?"":M(2,1,e.Discount*-1)+"%"," ")}}function Mm(n,t){if(n&1&&(r(0,"div"),p(1),v(2,"number"),a()),n&2){let e=c().$implicit;s(),x(" ",e.DiscountAmount==0?"":M(2,1,e.DiscountAmount*-1)," ")}}function Pm(n,t){if(n&1&&(r(0,"div",56),p(1),v(2,"number"),a()),n&2){let e=c(2).$implicit;s(),x(" ",Z(2,1,e.UnitPriceOriginal,"1.0-4")," ")}}function Om(n,t){if(n&1&&(r(0,"div",30),g(1,Pm,3,4,"div",56),r(2,"div",27),p(3),v(4,"amountFraction"),a()()),n&2){let e=c().$implicit;s(),C(e.UnitPriceOriginal>e.Price?1:-1),s(2),x(" ",M(4,2,e.Total)," ")}}function Im(n,t){if(n&1&&(r(0,"div",27)(1,"div",30),p(2),v(3,"amountFraction"),a()()),n&2){let e=c().$implicit,i=c(2);s(2),x(" ",i.userRole.PriceVisible?M(3,1,e.Total):" - "," ")}}function Dm(n,t){if(n&1){let e=y();r(0,"span",57),_("click",function(){u(e);let o=c().$implicit,l=c(2);return f(l.removeItem(o))}),h(1,"i",58),a()}}function wm(n,t){if(n&1){let e=y();r(0,"tr",9),v(1,"async"),_("contextmenu",function(o){let l=u(e),b=l.$implicit,V=l.$index,G=c(2);return f(G.onContextMenu(o,b,V))}),g(2,Zd,4,2,"td",10),r(3,"td",11),_("click",function(){let o=u(e).$index,l=c(2);return f(l.onEditItem(o,"quantity"))}),r(4,"div",12),g(5,im,3,1,"span",13),r(6,"div",14)(7,"div",15)(8,"span",16),p(9),a(),g(10,rm,3,1,"span",17),g(11,am,1,0,"i",18),a(),r(12,"div",19),p(13),a(),g(14,lm,2,1,"small",20),g(15,sm,2,1,"small",21),g(16,cm,2,1,"small",22),r(17,"div"),h(18,"app-serial-note",23),a(),g(19,pm,1,1,"small",24),g(20,dm,4,1,"small",25),g(21,mm,3,1,"small"),a()()(),r(22,"td",26)(23,"div",27),g(24,um,2,1,"div",28),r(25,"div",29),g(26,fm,3,4,"span",30),g(27,gm,6,4),g(28,Cm,3,4,"span",31),g(29,_m,2,1,"small",32),a()()(),r(30,"td"),g(31,ym,2,1,"div",27),a(),r(32,"td",33),_("click",function(){let o=u(e).$index,l=c(2);return f(l.onEditItem(o,"discount"))}),r(33,"div",34),g(34,xm,3,3,"div"),g(35,Mm,3,3,"div"),a()(),r(36,"td",35),_("click",function(){let o=u(e).$index,l=c(2);return f(l.onEditItem(o,"price"))}),g(37,Om,5,4,"div",30)(38,Im,4,3,"div",27),a(),r(39,"td",36)(40,"div",37),g(41,Dm,2,0,"span",38),a()()()}if(n&2){let e=t.$implicit,i=c(2);m("cdkDragDisabled",!M(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,Kd,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 km(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 l=c();return f(l.drop(o))}),ie(4,wm,42,29,"tr",8,pe),a()()()()}if(n&2){let e=c();s(4),ne(e.cartItems)}}function Tm(n,t){n&1&&(r(0,"div",2)(1,"div",5)(2,"div",59)(3,"div",60)(4,"div",61),h(5,"i",62),a(),r(6,"div",63)(7,"span"),p(8,"Empty Cart"),a(),h(9,"br"),r(10,"span"),p(11,"Add products to the cart"),a(),h(12,"br"),r(13,"span"),p(14,"or scan barcode"),a()()()()()())}function Em(n,t){if(n&1){let e=y();r(0,"button",64),_("click",function(){let o=u(e).item,l=c();return f(l.onReverse(o,!0))}),p(1," Return "),a(),r(2,"button",65),_("click",function(){let o=u(e).item,l=c();return f(l.onReverse(o,!1))}),p(3,"Sales"),a(),r(4,"button",64),_("click",function(){let o=u(e).item,l=c();return f(l.onSumPrice(o))}),p(5," Merge / SUM Price "),a(),r(6,"button",64),_("click",function(){let o=u(e).item,l=c();return f(l.onBundlePrice(o))}),p(7," Bundle Price "),a()}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 no=class n{constructor(t,e,i,o,l,b,V){this.salesOrderService=t;this.roleService=e;this.shoppingCartService=i;this.pageInitialService=o;this.dialog=l;this.orderProcessorService=b;this.moreMenuService=V;this.destroy$=new q,this.eventAddItem=new He,this.enabledDragDrop$=this.moreMenuService.enabledDragDrop$}destroy$;cartItems=[];userRole;appConfig;currentSellState;hasItemDeletion;eventAddItem;isAddItem=!0;sellState=Me;showThumbnail;enabledDragDrop$;inventoryType=Qi;qtyDecimalPlace=E(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){gr(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(Je,{data:{index:t,focus:e}})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(R),d(de),d(we),d(A),d(ae),d(U),d(Vt))};static \u0275cmp=P({type:n,selectors:[["sell-cart-body"]],viewQuery:function(e,i){if(e&1&&Se(on,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,km,6,0,"div",1)(1,Tm,15,0,"div",2),h(2,"div",3),r(3,"mat-menu",null,0),K(5,Em,8,3,"ng-template",4),a()),e&2){let o=nt(4);C(i.cartItems.length>0?0:1),s(2),go("left",i.contextMenuPosition.x)("top",i.contextMenuPosition.y),m("matMenuTriggerFor",o)}},dependencies:[H,$t,Q,ee,_r,Cr,Xr,Kr,Yr,on,se,Zr,Ve,Y,br],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 oo=class{ID;Name;Code;Address;Phone;Email;SalesTarget;SalesPersonGroupID;Bin};var Nm=["ngSelectInfinite"],Vm=(n,t)=>({"text-success":n,"text-danger":t}),Am=n=>({offline:n}),za=n=>({"opacity-50":n}),ao=(n,t)=>({red:n,green:t});function Lm(n,t){if(n&1&&(r(0,"span",8),p(1),v(2,"async"),v(3,"number"),a()),n&2){let e=c();s(),x(" ",M(3,3,M(2,1,e.totalOfflineOrders$))," ")}}function Fm(n,t){if(n&1&&(r(0,"sup",13)(1,"div",26),p(2),v(3,"async"),v(4,"number"),a()()),n&2){let e=c();s(2),x(" ",M(4,3,M(3,1,e.moreMenuService.eligiblePromotions$))," ")}}function Bm(n,t){if(n&1&&h(0,"span",37),n&2){let e=c(4);m("ngClass",me(1,ao,!e.displayService.isEnabled(),e.displayService.isEnabled()))}}function jm(n,t){if(n&1&&h(0,"span",37),n&2){let e=c(4);m("ngClass",me(1,ao,!e.orderDisplayService.isEnabled(),e.orderDisplayService.isEnabled()))}}function Hm(n,t){if(n&1&&h(0,"span",37),n&2){let e=c(4);m("ngClass",me(1,ao,!e.ecrSignalService.isConnected(),e.ecrSignalService.isConnected()))}}function Um(n,t){if(n&1&&h(0,"span",37),n&2){let e=c(4);m("ngClass",me(1,ao,!e.cashMachineService.isConnected(),e.cashMachineService.isConnected()))}}function Wm(n,t){if(n&1){let e=y();Ue(0),r(1,"li",33),_("click",function(){let o=u(e).$implicit,l=c(3);return f(o.disabled?null:l.moreMenuService.moreMenuAction(o.action))}),r(2,"div",34),h(3,"i",35),r(4,"span",36),p(5),a(),g(6,Bm,1,4,"span",37),g(7,jm,1,4,"span",37),g(8,Hm,1,4,"span",37),g(9,Um,1,4,"span",37),a()(),We()}if(n&2){let e=t.$implicit;s(),m("matTooltip",e.disabled?e.description:"")("ngClass",T(10,za,e.disabled)),Wo("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 Qm(n,t){if(n&1&&(Ue(0),r(1,"div",30),p(2),a(),h(3,"div",31),K(4,Wm,10,12,"ng-container",32),We()),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,"sup",13)(1,"div",26),p(2),v(3,"async"),v(4,"number"),a()()),n&2){let e=c(6);s(2),x(" ",M(4,3,M(3,1,e.moreMenuService.eligiblePromotions$))," ")}}function $m(n,t){if(n&1&&(Ue(0),r(1,"div",34),h(2,"i",35),r(3,"span",36),p(4),a(),g(5,qm,5,5,"sup",13),v(6,"async"),a(),We()),n&2){let e=c().$implicit,i=c(4);s(2),le(e.class),s(2),w(e.label),s(),C(e.label=="Event"&&M(6,4,i.moreMenuService.eligiblePromotions$)>0?5:-1)}}function Gm(n,t){if(n&1){let e=y();r(0,"li",33),_("click",function(){let o=u(e).$implicit,l=c(4);return f(o.disabled?null:l.moreMenuService.moreMenuAction(o.action))}),K(1,$m,7,6,"ng-container",28),a()}if(n&2){let e=t.$implicit;m("matTooltip",e.disabled?e.description:"")("ngClass",T(3,za,e.disabled)),s(),m("ngIf",e.isShow!==!1)}}function Jm(n,t){if(n&1&&(Ue(0),r(1,"div",30),p(2),a(),h(3,"div",31),K(4,Gm,2,5,"li",39),We()),n&2){let e=c().$implicit;s(2),w(e.name),s(2),m("ngForOf",e.menus)}}function zm(n,t){if(n&1&&(r(0,"div",38),K(1,Jm,5,2,"ng-container",28),a()),n&2){let e=t.$implicit;s(),m("ngIf",(e.menus==null?null:e.menus.length)>0)}}function Km(n,t){if(n&1&&(r(0,"div",27),K(1,Qm,5,2,"ng-container",28)(2,zm,2,1,"div",29),a()),n&2){let e=t.$implicit;s(),m("ngIf",(e.menus==null?null:e.menus.length)>0),s(),m("ngForOf",e.children)}}var ro=class n{constructor(t,e,i,o,l,b,V,G,ve,Be,je,mi,Ii,Di){this.pageInitialService=t;this.salesOrderService=e;this.userRoleService=i;this.outletService=o;this.dialog=l;this.promotionEventService=b;this.moreMenuService=V;this._onlineStatusService=G;this.toggleSidebar=ve;this.displayService=Be;this.ecrSignalService=je;this.cashMachineService=mi;this.localDataService=Ii;this.orderDisplayService=Di;this.appConfig=this.pageInitialService.Data.AppConfigJSON,this.destroy$=new q,this.isOnline$=G.getOnlineStatus$(),this.totalOfflineOrders$=this.localDataService.unsentOrders$.pipe(et(At=>At.length),Ht(1)),this.toggleSidebar.toggleState$.subscribe(At=>this.isChange=At)}salesOrder;appConfig;selectedCustomerId;userRole;salesPersonList=[];destroy$;outletRegister;salesPersonName;ngSelectInfinite;handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.dialog.open(Je)}handleF2(){this.ngSelectInfinite&&this.ngSelectInfinite.ngSelectElement.focus()}disabledSalesOption=!1;salesPersonOptionTooltip=E("");isEnabledLoyaltyPoint;isOnline$;isChange=!0;totalOfflineOrders$;ngOnInit(){this.subscribeToObservable()}collapseSidebar(){this.toggleSidebar.toggleSidebar()}subscribeToObservable(){this.userRoleService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.userRole=t,this.checkDisabledSalesOption()}),this.salesOrderService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.salesOrder=t,this.checkDisabledSalesOption(t.CartItems),S.IsEmpty(this.salesOrder.Order.SalesID)&&(this.salesOrder.Order.SalesID=null)}),this.outletService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.initSalesPerson(t.ListSales),this.outletRegister=t}),this.promotionEventService.onClickToastPromo.pipe(k(this.destroy$)).subscribe(t=>{if(t){let e=this.dialog.getDialogById("promotion-event");S.IsEmpty(e)&&this.dialog.open(sn,{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 oo;e.ID=S.GuidEmpty,this.salesPersonList=[...t]}openOnlineStatusModal(){this.localDataService.unsentOrders$.pipe(jt(1),Re(t=>{let e=t.length>0?"ORDER":"SETUP";return this.dialog.open(pn,{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(R),d(de),d($),d(ae),d(Xt),d(Vt),d(Ge),d(pr),d(Yi),d(wt),d(kt),d(Ye),d(zi))};static \u0275cmp=P({type:n,selectors:[["sell-cart-header"]],viewQuery:function(e,i){if(e&1&&Se(Nm,7),e&2){let o;ye(o=xe())&&(i.ngSelectInfinite=o.first)}},hostBindings:function(e,i){e&1&&_("keydown.F4",function(l){return i.handleF8(l)},it)("keydown.control.F2",function(l){return i.handleF2(l)},it)},standalone:!1,decls:38,vars:34,consts:[["ngSelectInfinite",""],[1,"row","g-0","d-print-none","pt-2"],[1,"col-7","d-flex","align-items-center"],[1,"d-flex","align-items-center","justify-content-between","ms-8"],[1,"d-flex","align-items-center","pe-8","cursor-pointer",3,"click"],[1,"me-2"],[1,"fa","fa-circle",3,"ngClass"],[1,"fs-6","headings-font-family","pb-1","position-relative"],[1,"position-absolute","top-0","translate-middle","badge","rounded-pill","bg-danger","ms-3"],[1,"border-start",2,"height","30px"],["id","moreMenu","data-bs-toggle","dropdown",1,"d-flex","align-items-center","ps-8","cursor-pointer"],[1,"fa-solid","fa-caret-down","fa-lg"],[1,"fs-6","headings-font-family","pb-1"],[1,"badge","rounded-pill","bg-danger","ms-1","customize-badge"],["aria-labelledby","moreMenu",1,"dropdown-menu","more-actions"],["aria-labelledby","moreMenu",1,"d-flex"],["class","dropdown-header text-dark col pe-8",4,"ngFor","ngForOf"],[1,"col-5"],[1,"d-flex","align-items-center","justify-content-end"],[1,"mt-1"],[1,"fa-light","fa-id-badge",2,"font-size","17px"],[1,"fs-5",2,"width","calc(100% - 32px)",3,"matTooltip"],["bindValue","ID","bindLabel","Name","placeholder","Assign Sales Person","matTooltipPosition","above",1,"sales-person","select-max-width",3,"selectedChange","selectedLabel","clearable","ngClass","items","selected","disabled","optionTitle","matTooltip"],[1,"navbar","mobile-button"],["type","button","aria-controls","navigation-index","aria-expanded","false","aria-label","Toggle navigation",1,"navbar-toggler","navbar-toggler-right","float-end","toggle-menu","ps-2","pe-0","border-0",2,"width","max-content","height","max-content",3,"click"],[1,"navbar-toggler-bar","burger-lines"],[1,"d-flex","align-items-center","w-100","justify-content-center"],[1,"dropdown-header","text-dark","col","pe-8"],[4,"ngIf"],["class","mt-5",4,"ngFor","ngForOf"],[1,"h5","mb-4"],[1,"dropdown-divider","m-0"],[4,"ngFor","ngForOf"],["matTooltipPosition","above",1,"cursor-pointer",3,"click","matTooltip","ngClass"],[1,"dropdown-item","px-1"],["aria-hidden","true"],[1,"fw-normal","fs-5","ps-4"],[1,"blob","ms-2",2,"position","absolute",3,"ngClass"],[1,"mt-5"],["matTooltipPosition","above","class","cursor-pointer",3,"matTooltip","ngClass","click",4,"ngFor","ngForOf"]],template:function(e,i){if(e&1){let o=y();r(0,"div",1)(1,"div",2)(2,"div",3)(3,"span",4),_("click",function(){return u(o),f(i.openOnlineStatusModal())}),r(4,"span",5),h(5,"i",6),v(6,"async"),v(7,"async"),a(),r(8,"span",7),p(9),v(10,"async"),g(11,Lm,4,5,"span",8),v(12,"async"),a()(),h(13,"span",9),r(14,"span",10)(15,"span",5),h(16,"i",11),a(),r(17,"span",12),p(18,"More Actions"),a(),g(19,Fm,5,5,"sup",13),v(20,"async"),a(),r(21,"div",14)(22,"div",15),K(23,Km,3,2,"div",16),v(24,"async"),a()()()(),r(25,"div",17)(26,"div",18)(27,"div",19),h(28,"i",20),a(),r(29,"div",21)(30,"ng-select-infinite",22,0),v(32,"async"),D("selectedChange",function(b){return u(o),I(i.salesOrder.Order.SalesID,b)||(i.salesOrder.Order.SalesID=b),f(b)}),_("selectedLabel",function(b){return u(o),f(i.salesPersonName=b)}),a()(),r(33,"div",23)(34,"button",24),_("click",function(){return u(o),f(i.collapseSidebar())}),h(35,"span",25)(36,"span",25)(37,"span",25),a()()()()()}e&2&&(s(5),m("ngClass",me(29,Vm,M(6,15,i.isOnline$),!M(7,17,i.isOnline$))),s(4),x("",M(10,19,i.isOnline$)?"Online":"Offline"," "),s(2),C(M(12,21,i.totalOfflineOrders$)>0?11:-1),s(8),C(M(20,23,i.moreMenuService.eligiblePromotions$)>0?19:-1),s(4),m("ngForOf",M(24,25,i.moreMenuService.moreMenu$)),s(6),m("matTooltip",i.salesPersonName),s(),m("clearable",!0)("ngClass",T(32,Am,!M(32,27,i.isOnline$)))("items",i.salesPersonList),O("selected",i.salesOrder.Order.SalesID),m("disabled",i.disabledSalesOption)("optionTitle",!0)("matTooltip",i.salesPersonOptionTooltip()),s(4),$o("change",i.isChange))},dependencies:[H,Vi,Ut,$i,se,Ve,Y],styles:[`.disabled{color:gray;pointer-events:none;cursor:not-allowed}.blob{background:#000;border-radius:50%;box-shadow:0 0 #000;height:15px;width:15px;transform:scale(1);animation:pulse-black 2s infinite}@keyframes pulse-black{0%{transform:scale(.95);box-shadow:0 0 #000000b3}70%{transform:scale(1);box-shadow:0 0 0 10px #0000}to{transform:scale(.95);box-shadow:0 0 #0000}}.blob.white{background:#fff;box-shadow:0 0 #fff;animation:pulse-white 2s infinite}@keyframes pulse-white{0%{transform:scale(.95);box-shadow:0 0 #ffffffb3}70%{transform:scale(1);box-shadow:0 0 0 10px #fff0}to{transform:scale(.95);box-shadow:0 0 #fff0}}.blob.red{background:#ff5252;box-shadow:0 0 #ff5252;animation:pulse-red 2s infinite}@keyframes pulse-red{0%{transform:scale(.95);box-shadow:0 0 #ff5252b3}70%{transform:scale(1);box-shadow:0 0 0 10px #ff525200}to{transform:scale(.95);box-shadow:0 0 #ff525200}}.blob.orange{background:#ff793f;box-shadow:0 0 #ff793f;animation:pulse-orange 2s infinite}@keyframes pulse-orange{0%{transform:scale(.95);box-shadow:0 0 #ff793fb3}70%{transform:scale(1);box-shadow:0 0 0 10px #ff793f00}to{transform:scale(.95);box-shadow:0 0 #ff793f00}}.blob.yellow{background:#ffb142;box-shadow:0 0 #ffb142;animation:pulse-yellow 2s infinite}@keyframes pulse-yellow{0%{transform:scale(.95);box-shadow:0 0 #ffb142b3}70%{transform:scale(1);box-shadow:0 0 0 10px #ffb14200}to{transform:scale(.95);box-shadow:0 0 #ffb14200}}.blob.blue{background:#34ace0;box-shadow:0 0 #34ace0;animation:pulse-blue 2s infinite}@keyframes pulse-blue{0%{transform:scale(.95);box-shadow:0 0 #34ace0b3}70%{transform:scale(1);box-shadow:0 0 0 10px #34ace000}to{transform:scale(.95);box-shadow:0 0 #34ace000}}.blob.green{background:#77d933;box-shadow:0 0 #77d933;animation:pulse-green 2s infinite}@keyframes pulse-green{0%{transform:scale(.95);box-shadow:0 0 #33d938b3}70%{transform:scale(1);box-shadow:0 0 0 10px #33d9b200}to{transform:scale(.95);box-shadow:0 0 #33d9b200}}.blob.purple{background:#8e44ad;box-shadow:0 0 #8e44ad;animation:pulse-purple 2s infinite}@keyframes pulse-purple{0%{transform:scale(.95);box-shadow:0 0 #8e44adb3}70%{transform:scale(1);box-shadow:0 0 0 10px #8e44ad00}to{transform:scale(.95);box-shadow:0 0 #8e44ad00}}ng-select-infinite.sales-person.select-max-width>ng-select{padding-right:10px;height:38px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{font-size:.75rem;border:.5px solid #d7d7d7;padding-right:6px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container>.ng-arrow-wrapper{width:12px;padding-bottom:2px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container>.ng-value-container{padding-left:6px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{min-height:38px!important;height:38px!important;border:none}ng-select-infinite.sales-person.select-max-width.offline>.ng-select.ng-select-single .ng-select-container{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container .ng-input{padding-left:5px!important}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container .ng-input>input{padding-top:5px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single>ng-dropdown-panel.ng-dropdown-panel{font-size:.75rem;width:95%!important}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-focused .ng-select-container{box-shadow:none!important;border-color:transparent!important}.change .burger-lines{transition:.4s}.change .burger-lines:nth-child(1){-webkit-transform:rotate(-45deg) translate(-8px,4px);transform:rotate(-45deg) translate(-8px,4px)}.change .burger-lines:nth-child(2){opacity:0}.change .burger-lines:nth-child(3){-webkit-transform:rotate(45deg) translate(-5px,0px);transform:rotate(45deg) translate(-5px)}.mobile-button{display:none}@media (max-width: 990px){.mobile-button{display:block}}.navbar-toggler:focus{box-shadow:none!important}.customize-badge{height:16px;width:16px;font-size:9px}
|
|
43
|
-
`],encapsulation:2})};var
|
|
44
|
-
`],encapsulation:2})};var
|
|
45
|
-
`],encapsulation:2})};var
|
|
40
|
+
`,okText:"Connect"},this.dialog.open(ei,{data:e,width:"500px"}).afterClosed().pipe(oe(i=>i),Ie(()=>{t?this.customerDisplay.disconnect():this.customerDisplay.connect()})).subscribe(()=>{this.toastrService.success(`Customer Display is ${t?"disconnected":"connected"}`,"Success")})}enableDragDrop(t){let e=S.cloneObject(this._moreMenu.value);e=e.map(i=>(i.name=="Advanced"&&(i.menus=i.menus.map(o=>(o.action=="SORT"&&(o.label=t?"Disable Sort":"Enable Sort"),o))),i)),this._moreMenu.next(e),this._enabledDragDrop.next(t)}checkAvailableInventory(){let i=this.salesOrderService.Data.CartItems.map(l=>l.VariantID),o={Outlet:this.outletRegisterService.Data.EntityID,Cart:i};this.httpService.post(be.ValidateInventory,o).subscribe(l=>{this.setAvailableInventory(l)})}setAvailableInventory(t){let e=this.salesOrderService.Data,i=e.CartItems,o=0;e.CartItems=i.map(l=>{let b=t.findIndex(V=>V.VariantID==l.VariantID);return b!==-1&&(l.AvailableInventory=t[b].OnHand,(l.Variant?.TypeID<9||l.Variant?.TypeID==12)&&(o+=l.Quantity>l.AvailableInventory?1:0)),l}),this.showToastrValidateInventory(o),this.salesOrderService.pushNewValue(e)}showToastrValidateInventory(t){t>0?this.toastrService.error(`There are ${t} products in the cart dont have sufficient stock available`,"Validate Inventory"):this.toastrService.info("All products in the cart have sufficient stock available","Validate Inventory")}filterMoreMenu(t){let e=[];t==4?e=this.filterMenuByRole().map(i=>(i.menus=i.menus.filter(o=>o.action!=="CANCEL"),i)):t==5?e=this.filterMenuByRole().map(i=>(i.menus=i.menus.filter(o=>o.action!=="SPLIT"),i)):e=this.filterMenuByRole().filter(i=>i.name!=="Bill"),e=this.disabledMenuOnEdit(e,t),this._moreMenu.next(e)}disabledMenuOnEdit(t,e){let i=this.salesOrderService.Data;return e==2&&(t=t.map(o=>(o.children=o.children?.map(l=>(l.menus=l.menus.map(b=>{switch(b.action){case"PROMOTION":i?.getRewards()?.length>0&&(b.disabled=!0,b.description="Promotion event selection is disabled as this transaction already applies a reward from a promotion event");break}return b}),l)),o.menus=o.menus.map(l=>{switch(l.action){case"RETURN":l.disabled=!0,l.description="Return is disabled in edit mode";break}return l}),o))),t}filterMenuByRole(){let t=this.roleService?.Data,e=S.cloneObject(this.sourceMenu);return e=this.filterMenuByRoles([{action:"RETRIEVE",role:t.Retrieve},{action:"FULFILLMENT",role:t.Shipping},{action:"RETURN",role:t.Return},{action:"CLEAR",role:t.DeleteItem}],e),e}filterMenuByRoles(t,e=[]){let i;return e.map(o=>(o.menus=o.menus.map(l=>(i=t.findIndex(b=>b.action==l.action),i!==-1?l.disabled=t[i].role==!1:l.disabled=!1,l)),o))}onRetrieve(){let t=this.outletRegisterService.Data.ParkLayoutPack,e=this.pageInitialService.Data.AppConfigJSON;if(t?.Layout==null&&e.ApplicationParkAndRetrieve.Advance.retreiveMode==1){this.toastrService.error("Your retrieve config is in Group mode, to enable park please setting your Park layout at Outlet page","Error!");return}this.dialog.open(jn).afterClosed().pipe(k(this.destroy$),oe(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(di)}onImportItems(){let t=this.salesOrderService?.Data?.Order?.EntityID;this.dialog.open(dn,{data:{sampleUrl:er.files.csv.sell_import,API:be.UploadCsv,outletID:t,useUppy:!0,fileEndpoint:"/API/POS/UploadCsvV3"}}).afterClosed().pipe(oe(e=>!!e)).subscribe(e=>{let i;for(let o of e)i=new Fe,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(Un)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(N(de),N(U),N(Xt),N(Xe),N(Dt),N(ae),N(ke),N(R),N($),N(A),N(X),N($e),N(we),N(Yi),N(ln),N(wt),N(kt),N(zi))};static \u0275prov=at({token:n,factory:n.\u0275fac})};var Yn=class n{config=new B;dialogRef=G(F);salesOrderService=G(R);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=P({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),h(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? "),a()(),r(6,"div",4)(7,"button",5),_("click",function(){return i.onCreateNewOrder()}),h(8,"i",6),p(9," New Order "),a(),r(10,"button",5),_("click",function(){return i.onContinueEditing()}),h(11,"i",7),p(12," Continue Editing "),a()()()()),e&2&&m("config",i.config)},dependencies:[ge,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 $a=n=>({"quickkey-subscription-overdue":n}),Ja=()=>["/menu/Outlets/Master/Quick_Key_Templates/Form"],Lp=n=>({ID:n}),Fp=n=>({OutletID:n});function Bp(n,t){if(n&1&&h(0,"img",17),n&2){let e=c(2).$implicit;m("ngSrc",e.ImageURLClient)}}function jp(n,t){if(n&1&&(r(0,"div",15)(1,"div",16),g(2,Bp,1,1,"img",17),a()()),n&2){let e=c().$implicit;s(2),C(e.ImageURLClient?2:-1)}}function Hp(n,t){if(n&1&&(r(0,"div",16)(1,"p",18)(2,"span"),p(3),v(4,"slice"),a()()()),n&2){let e=c().$implicit;s(3),w(Ne(4,1,e.Display,0,3))}}function Up(n,t){if(n&1&&(r(0,"small",19),p(1),v(2,"number"),a()),n&2){let e=c(2).$implicit;s(),w(M(2,1,e.Children[0].UnitPrice))}}function Wp(n,t){if(n&1&&(r(0,"small",20),p(1),v(2,"lowestPrice"),v(3,"number"),v(4,"highestPrice"),v(5,"number"),a()),n&2){let e=c(2).$implicit;s(),Te("",M(3,4,M(2,2,e==null?null:e.Children))," - ",M(5,8,M(4,6,e==null?null:e.Children)))}}function Qp(n,t){if(n&1&&g(0,Up,3,3,"small",19)(1,Wp,6,10,"small",20),n&2){let e=c().$implicit;C(e.Children.length==1?0:1)}}function qp(n,t){if(n&1){let e=y();r(0,"div",13)(1,"a",14),_("click",function(){let o=u(e).$implicit,l=c(4);return f(l.onSelectProduct(o))}),g(2,jp,3,1,"div",15)(3,Hp,5,5,"div",16),r(4,"small"),p(5),v(6,"slice"),a(),g(7,Qp,2,1),a()()}if(n&2){let e=t.$implicit,i=c(4);le(i.colConfigCSSClass),s(2),C(e.ImageURLClient?2:3),s(3),w(Ne(6,5,e.Display,0,36)),s(2),C(i.quickKeyPriceVisible?7:-1)}}function $p(n,t){if(n&1&&(r(0,"mat-tab",6)(1,"div",7)(2,"div",8),ie(3,qp,8,9,"div",9,pe),r(5,"div",10)(6,"a",11),h(7,"i",12),a()()()()()),n&2){let e=t.$implicit,i=c(3);m("label",e.Name),s(3),ne(e==null?null:e.Items),s(2),le(i.colConfigCSSClass),s(),m("routerLink",ct(5,Ja))("queryParams",T(6,Lp,i.quickKey.ID))}}function Jp(n,t){if(n&1){let e=y();r(0,"mat-tab-group",5),D("selectedIndexChange",function(o){u(e);let l=c(2);return I(l.quickeyTabActive,o)||(l.quickeyTabActive=o),f(o)}),ie(1,$p,8,8,"mat-tab",6,pe),a()}if(n&2){let e=c(2);m("disableRipple",!0),O("selectedIndex",e.quickeyTabActive),s(),ne(e.quickKey==null?null:e.quickKey.Groups)}}function Gp(n,t){if(n&1&&h(0,"img",26),n&2){let e=c(2).$implicit;m("src",e.ImageURLClient,tt)}}function zp(n,t){if(n&1&&(r(0,"div",15)(1,"div",16),g(2,Gp,1,1,"img",26),a()()),n&2){let e=c().$implicit;s(2),C(e.ImageURLClient?2:-1)}}function Kp(n,t){if(n&1&&(r(0,"div",16)(1,"p",18)(2,"span"),p(3),v(4,"slice"),a()()()),n&2){let e=c().$implicit;s(3),w(Ne(4,1,e.Model,0,3))}}function Yp(n,t){if(n&1&&(r(0,"small",19),p(1),v(2,"number"),a()),n&2){let e=c().$implicit;s(),w(M(2,1,e.UnitPrice))}}function Xp(n,t){if(n&1){let e=y();r(0,"div",13)(1,"a",14),_("click",function(){let o=u(e).$implicit,l=c(3);return f(l.onSelectVariant(o.ID))}),g(2,zp,3,1,"div",15)(3,Kp,5,5,"div",16),r(4,"small"),p(5),v(6,"slice"),a(),g(7,Yp,3,3,"small",19),a()()}if(n&2){let e=t.$implicit,i=c(3);le(i.colConfigCSSClass),s(2),C(e.ImageURLClient?2:3),s(3),w(Ne(6,5,e.Model,0,30)),s(2),C(i.quickKeyPriceVisible?7:-1)}}function Zp(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")}),h(2,"i",23),a(),r(3,"div",24)(4,"b"),p(5),a()()(),r(6,"div",7)(7,"div",25),ie(8,Xp,8,9,"div",9,pe),a()()}if(n&2){let e=c(2);s(5),x(" ",e.subQuickeyPack.Display),s(3),ne(e.subQuickeyPack==null?null:e.subQuickeyPack.Children)}}function ed(n,t){if(n&1&&g(0,Jp,3,2,"mat-tab-group",4)(1,Zp,10,1),n&2){let e=c();C(e.quickeyState=="QUICKEY"?0:1)}}function td(n,t){if(n&1&&(r(0,"div",3)(1,"a",27)(2,"strong"),p(3,"QUICK KEYS UNCONFIGURED"),a(),h(4,"i",28),r(5,"span"),p(6,"Click here to setup your Quick keys"),a()()()),n&2){let e=c();m("ngClass",T(3,$a,e.currentSubsStatus==e.subscriptionStatus.OVERDUE||e.currentSubsStatus==e.subscriptionStatus.SELL_ONLY)),s(),m("routerLink",ct(5,Ja))("queryParams",T(6,Fp,e.entityId))}}var Xn=class n{constructor(t,e,i,o,l,b){this.outletRegisterService=t;this.shoppingCartService=e;this.dialog=i;this.pageInitialService=o;this.salesOrderService=l;this.authService=b;this.destroy$=new q,this.quickeyState="QUICKEY",this.currentSubsStatus=this.authService.getSubscriptionStatus()}destroy$;quickKey;subQuickeyPack;entityId;quickeyState;quickeyTabActive=0;colConfigCSSClass;subscriptionStatus=qt;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(Ge,{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($),d(we),d(ae),d(A),d(R),d(Gt))};static \u0275cmp=P({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,ed,2,1)(4,td,7,8,"div",3),a()()()),e&2&&(s(2),m("ngClass",T(2,$a,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:[H,Pt,Ot,Wt,Yo,Fi,Y,Sr,yr],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 nd=n=>({"cursor-pointer":n}),od=(n,t)=>({"px-2 py-2 number-disabled":n,"py-1 px-1 bg-gradient-warning":t}),rd=(n,t)=>({"d-flex justify-content-end align-items-center":n,"mt-1":t}),ad=(n,t)=>({label:n,tooltip:t}),Ga=n=>({data:n}),ld=()=>({label:"Later",tooltip:"Fulfillment Later"}),sd=n=>({"bg-gradient-warning px-2":n}),cd=n=>({"me-3":n});function pd(n,t){if(n&1&&(r(0,"span"),p(1),a()),n&2){let e=c();s(),Te("",e.isSalesOrderEdit?"Edit Order ":"New Order ","#",e.salesOrder==null||e.salesOrder.Order==null?null:e.salesOrder.Order.Number)}}function dd(n,t){n&1&&(r(0,"div",8),p(1,"Order Number"),a())}function md(n,t){n&1&&Ci(0)}function ud(n,t){if(n&1&&(r(0,"div",10),K(1,md,1,0,"ng-container",13),a()),n&2){let e=c(),i=nt(17);s(),m("ngTemplateOutlet",i)("ngTemplateOutletContext",T(5,Ga,me(2,ad,e.isDifferentFullfillmentOutlet().outletName,e.isDifferentFullfillmentOutlet().outletName)))}}function fd(n,t){n&1&&Ci(0)}function gd(n,t){if(n&1&&(r(0,"div",10),K(1,fd,1,0,"ng-container",13),a()),n&2){c();let e=nt(17);s(),m("ngTemplateOutlet",e)("ngTemplateOutletContext",T(3,Ga,ct(2,ld)))}}function Cd(n,t){if(n&1&&(r(0,"h5",18),p(1),v(2,"limitTo"),a()),n&2){let e=c().data;s(),w(Z(2,1,e==null?null:e.label,14))}}function _d(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),h(3,"i",17),a(),g(4,Cd,3,4,"h5",18),a()()}if(n&2){let e=t.data;m("ngClass",T(4,sd,e.label))("matTooltip",e==null?null:e.tooltip),s(2),m("ngClass",T(6,cd,e.label)),s(2),C(e!=null&&e.label?4:-1)}}var Zn=class n{constructor(t,e,i,o,l,b,V,J){this.registerService=t;this.salesOrderService=e;this.pageInitialService=i;this.coreService=o;this.dialog=l;this.shoppingCartService=b;this.userRoleService=V;this.orderProcessorService=J;this.destroy$=new q}selectedOutlet;destroy$;salesOrder;register;userRole;isSalesOrderEdit=!1;selectedDate=new Date;isDifferentFullfillmentOutlet=E({isDifferent:!1,outletName:""});isFulfillmentLater=E(!1);minDate=E(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(Qr,{id:"registerModal",disableClose:!0}).afterClosed().pipe(k(this.destroy$),oe(t=>S.IsNotEmpty(t?.selectedRegister))).subscribe(t=>{t?.openStartingCashDialog&&this.openOpeningCashModal()})}openOpeningCashModal(){this.pageInitialService.Data.AppConfigJSON.ModuleShift.Closure.Enabled&&this.dialog.open(qr,{disableClose:!0}).afterClosed().pipe(oe(e=>S.IsNotEmpty(e))).subscribe(e=>{let i={RegisterID:this.salesOrder.Order.RegisterID,OpAmount:e.amount};console.log(i),this.coreService.recordOpeningCash(i),document.getElementById("product").focus()})}onAddItem(t){this.shoppingCartService.addCartItemById(t).then(()=>{this.openModalItemOnNew(t)})}onBarcodeScan(t){S.IsNotEmpty(t)&&this.shoppingCartService.addCartItemByCode(t).then(e=>{this.openModalItemOnNew(e.ID)})}openModalItemOnNew(t){if(this.pageInitialService.Data.AppConfigJSON.ModuleSell.ProductDialog.OpenOnNewItemAdded){let i=this.salesOrder.CartItems.find(l=>l.VariantID==t),o=this.salesOrder.Items.lastIndexOf(i);this.dialog.open(Ge,{data:{index:o,focus:"quantity"}})}}onEditNumber(){this.userRole.NumberEditor&&this.dialog.open(sa,{width:"20%"})}openFulfillmentModal(){this.dialog.open(di)}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}initCursorFocus(){let t=document.getElementById("product");t&&t.focus()}static \u0275fac=function(e){return new(e||n)(d($),d(R),d(A),d(Wr),d(ae),d(we),d(de),d(U))};static \u0275cmp=P({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())}),h(3,"i",4),a(),r(4,"div",5)(5,"h3",6),_("click",function(){return u(o),f(i.openRegisterModal())}),p(6),v(7,"limitTo"),a(),r(8,"h6",7),_("click",function(){return u(o),f(i.onEditNumber())}),g(9,pd,2,2,"span")(10,dd,2,0,"div",8),a()()(),r(11,"div",9),g(12,ud,2,7,"div",10),g(13,gd,2,5,"div",10),r(14,"div",11)(15,"POS-invoice-date",12),D("ngModelChange",function(b){return u(o),I(i.selectedDate,b)||(i.selectedDate=b),f(b)}),_("ngModelChange",function(){return u(o),f(i.onSelectDate())}),a()()()(),K(16,_d,5,8,"ng-template",null,0,yt)}if(e&2){let o,l;s(4),m("ngClass",T(17,nd,i.userRole.NumberEditor)),s(),m("matTooltip",i.register==null?null:i.register.Name),s(),x(" ",Z(7,14,i.register!=null&&i.register.Name?i.register==null?null:i.register.Name:"Choose an Outlet",25)," "),s(2),m("ngClass",me(19,od,!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",me(22,rd,!((o=i.isDifferentFullfillmentOutlet())!=null&&o.isDifferent)&&!i.isFulfillmentLater(),(o=i.isDifferentFullfillmentOutlet())==null?null:o.isDifferent)),s(),C((l=i.isDifferentFullfillmentOutlet())!=null&&l.isDifferent?12:-1),s(),C(i.isFulfillmentLater()?13:-1),s(2),O("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:[H,Li,Q,ee,se,nn,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 bd=n=>({"bg-gradient-danger":n}),eo=class n{constructor(t){this.onlineStatusService=t;this.isOnline$=t.getOnlineStatus$()}isOnline$;static \u0275fac=function(e){return new(e||n)(d(Je))};static \u0275cmp=P({type:n,selectors:[["sell-left-content"]],standalone:!1,decls:8,vars:5,consts:[[1,"d-flex","flex-column"],[1,"row","border-bottom","pt-2",2,"min-height","60px",3,"ngClass"],[1,"col-12"],[1,"row","mt-5"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"div",1),v(2,"async"),r(3,"div",2),h(4,"sell-header"),a()(),r(5,"div",3)(6,"div",2),h(7,"sell-quick-key"),a()()()),e&2&&(s(),m("ngClass",T(3,bd,!M(2,1,i.isOnline$))))},dependencies:[H,Xn,Zn,Ve],encapsulation:2})};var Bt=n=>({selected:n});function Sd(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 "),a()}if(n&2){let e=c();m("ngClass",T(1,Bt,e.modalTabState.TYPE==e.currentTabState))}}function yd(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 "),a()}if(n&2){let e=c();m("ngClass",T(1,Bt,e.modalTabState.LOGISTICS==e.currentTabState))}}function xd(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 "),a()}if(n&2){let e=c();m("ngClass",T(1,Bt,e.modalTabState.NUMBER==e.currentTabState))}}function Md(n,t){if(n&1){let e=y();r(0,"div",14)(1,"div",16)(2,"span",17),h(3,"i",18),a(),r(4,"input",19),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.poTypesSearchTerm,o)||(l.poTypesSearchTerm=o),f(o)}),a()()()}if(n&2){let e=c(2);s(4),O("ngModel",e.poTypesSearchTerm)}}function Pd(n,t){if(n&1){let e=y();r(0,"div",15)(1,"label",20)(2,"input",21),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.posData.Order.TypeID,o)||(l.posData.Order.TypeID=o),f(o)}),_("click",function(){let o=u(e).$implicit,l=c(2);return f(l.onSelectSalesOrderTag(o))}),a(),p(3),a()()}if(n&2){let e=t.$implicit,i=t.$index,o=c(2);s(),m("for",_i("potype-"+i))("ngClass",T(8,Bt,o.posData.Order.TypeID==e.ID)),s(),m("id",_i("potype-"+i)),O("ngModel",o.posData.Order.TypeID),m("value",e.ID),s(),x(" ",e.Name," ")}}function Od(n,t){if(n&1&&(r(0,"div",8)(1,"div",13),g(2,Md,5,1,"div",14),ie(3,Pd,4,10,"div",15,pe),v(5,"FilterByName"),a()()),n&2){let e,i=c();s(2),C(((e=i.poTypes())==null?null:e.length)>5?2:-1),s(),ne(Z(5,1,i.poTypes(),i.poTypesSearchTerm()))}}function Id(n,t){if(n&1){let e=y();r(0,"POS-tinymce-editor",25),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.posData.Invoice.Note,o)||(l.posData.Invoice.Note=o),f(o)}),a()}if(n&2){let e=c(2);O("ngModel",e.posData.Invoice.Note)}}function Dd(n,t){if(n&1){let e=y();r(0,"textarea",26),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.posData.Invoice.Note,o)||(l.posData.Invoice.Note=o),f(o)}),a()}if(n&2){let e=c(2);O("ngModel",e.posData.Invoice.Note)}}function wd(n,t){if(n&1&&(r(0,"div",8)(1,"div",22),g(2,Id,1,1,"POS-tinymce-editor",23),g(3,Dd,1,1,"textarea",24),a()()),n&2){let e=c();s(2),C(e.isOnline?2:-1),s(),C(e.isOnline?-1:3)}}function kd(n,t){if(n&1){let e=y();r(0,"POS-tinymce-editor",25),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.posData.Order.Note,o)||(l.posData.Order.Note=o),f(o)}),a()}if(n&2){let e=c(2);O("ngModel",e.posData.Order.Note)}}function Td(n,t){if(n&1){let e=y();r(0,"textarea",26),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.posData.Order.Note,o)||(l.posData.Order.Note=o),f(o)}),a()}if(n&2){let e=c(2);O("ngModel",e.posData.Order.Note)}}function Ed(n,t){if(n&1&&(r(0,"div",8)(1,"div",22),g(2,kd,1,1,"POS-tinymce-editor",23),g(3,Td,1,1,"textarea",24),a()()),n&2){let e=c();s(2),C(e.isOnline?2:-1),s(),C(e.isOnline?-1:3)}}function Rd(n,t){if(n&1){let e=y();r(0,"div",14)(1,"div",16)(2,"span",17),h(3,"i",18),a(),r(4,"input",19),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.serviceLogisticsSearchTerm,o)||(l.serviceLogisticsSearchTerm=o),f(o)}),a()()()}if(n&2){let e=c(2);s(4),O("ngModel",e.serviceLogisticsSearchTerm)}}function Nd(n,t){if(n&1){let e=y();r(0,"div",15)(1,"label",20)(2,"input",21),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.posData.Order.LogisticsServiceID,o)||(l.posData.Order.LogisticsServiceID=o),f(o)}),_("click",function(){let o=u(e).$implicit,l=c(2);return f(l.onSelectLogisticsService(o.ID))}),a(),p(3),a()()}if(n&2){let e=t.$implicit,i=t.$index,o=c(2);s(),m("for",_i("potype-"+i))("ngClass",T(8,Bt,o.posData.Order.LogisticsServiceID==e.ID)),s(),m("id",_i("potype-"+i)),O("ngModel",o.posData.Order.LogisticsServiceID),m("value",e.ID),s(),x(" ",e.Name," ")}}function Vd(n,t){if(n&1&&(r(0,"div",8)(1,"div",13),g(2,Rd,5,1,"div",14),ie(3,Nd,4,10,"div",15,pe),v(5,"FilterByName"),a()()),n&2){let e,i=c();s(2),C(((e=i.serviceLogistics())==null?null:e.length)>5?2:-1),s(),ne(Z(5,1,i.serviceLogistics(),i.serviceLogisticsSearchTerm()))}}function Ad(n,t){if(n&1){let e=y();r(0,"div",36)(1,"span",37),p(2,"@"),a(),r(3,"input",38),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.exchangeRate,o)||(l.exchangeRate=o),f(o)}),a()()}if(n&2){let e=c(2);s(3),O("ngModel",e.exchangeRate)}}function Ld(n,t){if(n&1){let e=y();r(0,"div",9)(1,"div",27)(2,"strong",28),p(3,"Reference Number"),a(),r(4,"input",29),D("ngModelChange",function(o){u(e);let l=c();return I(l.posData.Order.ReferenceNumber,o)||(l.posData.Order.ReferenceNumber=o),f(o)}),a()(),r(5,"div",27)(6,"strong",30),p(7,"Invoice Number"),a(),r(8,"input",31),D("ngModelChange",function(o){u(e);let l=c();return I(l.posData.Invoice.Number,o)||(l.posData.Invoice.Number=o),f(o)}),a()()(),r(9,"div",9)(10,"div",27)(11,"div",32)(12,"strong",28),p(13,"Number of Person"),a(),r(14,"input",33),D("ngModelChange",function(o){u(e);let l=c();return I(l.posData.Order.NumberOfPerson,o)||(l.posData.Order.NumberOfPerson=o),f(o)}),a()()(),r(15,"div",27)(16,"strong",28),p(17,"Currency"),a(),r(18,"div",34)(19,"ng-select",35),D("ngModelChange",function(o){u(e);let l=c();return I(l.posData.Order.CurrencyID,o)||(l.posData.Order.CurrencyID=o),f(o)}),_("change",function(o){u(e);let l=c();return f(l.updateCurrencySymbol(o))}),a(),g(20,Ad,4,1,"div",36),a()()()}if(n&2){let e=c();s(4),O("ngModel",e.posData.Order.ReferenceNumber),s(4),O("ngModel",e.posData.Invoice.Number),m("disabled",!e.roleService.sell.Number),s(6),O("ngModel",e.posData.Order.NumberOfPerson),s(5),m("items",e.currencies()),O("ngModel",e.posData.Order.CurrencyID),m("clearable",!1),s(),C(e.posData.Order.CurrencyID!=e.defaultCurrencyID?20:-1)}}function Fd(n,t){if(n&1){let e=y();r(0,"div",36)(1,"span",37),p(2,"@"),a(),r(3,"input",38),D("ngModelChange",function(o){u(e);let l=c(2);return I(l.exchangeRate,o)||(l.exchangeRate=o),f(o)}),a()()}if(n&2){let e=c(2);s(3),O("ngModel",e.exchangeRate)}}function Bd(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"),a(),r(5,"input",33),D("ngModelChange",function(o){u(e);let l=c();return I(l.posData.Order.NumberOfPerson,o)||(l.posData.Order.NumberOfPerson=o),f(o)}),a()()(),r(6,"div",27)(7,"strong",28),p(8,"Currency"),a(),r(9,"div",34)(10,"ng-select",35),D("ngModelChange",function(o){u(e);let l=c();return I(l.posData.Order.CurrencyID,o)||(l.posData.Order.CurrencyID=o),f(o)}),_("change",function(o){u(e);let l=c();return f(l.updateCurrencySymbol(o))}),a(),g(11,Fd,4,1,"div",36),a()()()}if(n&2){let e=c();s(5),O("ngModel",e.posData.Order.NumberOfPerson),s(5),m("items",e.currencies()),O("ngModel",e.posData.Order.CurrencyID),m("clearable",!1),s(),C(e.posData.Order.CurrencyID!=e.defaultCurrencyID?11:-1)}}var to=class n{constructor(t,e,i,o,l,b,V,J,ve){this._dialogRef=t;this._orderDataService=e;this._posService=i;this._cashierCalculatorService=o;this._outletRegisterService=l;this._orderHttpService=b;this._toastrService=V;this._onlineService=J;this.roleService=ve;this.destroy$=new q,this.currentTabState=1}serviceLogistics=E([]);serviceLogisticsSearchTerm=E("");poTypes=E([]);poTypesSearchTerm=E("");posData;config=new B;defaultCurrencyID;currencies=E([]);currentTabState;modalTabState=Ia;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=qi(un,i.Template);e.PrintTemplate=o,this._outletRegisterService.pushNewValue(e)})}onSelectLogisticsService(t){t===this.posData.Order.LogisticsServiceID?this.posData.Order.LogisticsServiceID=null:this.posData.Order.LogisticsServiceID=t}onTabChange(t){this.currentTabState=t}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(F),d(R),d(A),d(Ce),d($),d(De),d(X),d(Je),d(Mt))};static \u0275cmp=P({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(l){return i.onOk(l)})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div")(5,"a",3),_("click",function(){return i.onTabChange(i.modalTabState.NOTE)}),p(6," Note "),a(),r(7,"a",4),_("click",function(){return i.onTabChange(i.modalTabState.INTERNAL_NOTE)}),p(8," Order Note "),a(),g(9,Sd,2,3,"a",5),g(10,yd,2,3,"a",6),g(11,xd,2,3,"a",7),a()(),g(12,Od,6,4,"div",8)(13,wd,4,2,"div",8)(14,Ed,4,2,"div",8)(15,Vd,6,4,"div",8)(16,Ld,21,8)(17,Bd,12,5,"div",9),a()()()),e&2){let o;m("config",i.config),s(5),m("ngClass",T(7,Bt,i.modalTabState.NOTE==i.currentTabState)),s(2),m("ngClass",T(9,Bt,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:[H,z,lr,Q,Jt,ee,j,_t,mt,se,gt,xr],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 jd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2," Amount "),a(),r(3,"td",19),p(4),v(5,"number"),a()()),n&2){let e=c(2);s(4),x(" ",M(5,1,e.calculatorService.GrossTotal)," ")}}function Hd(n,t){if(n&1&&(r(0,"span"),p(1),v(2,"number"),a()),n&2){let e=c(3);s(),x("",M(2,1,e.salesOrder.Order.Discount),"%")}}function Ud(n,t){if(n&1&&(r(0,"span"),p(1),v(2,"number"),a()),n&2){let e=c(3);s(),x("",Z(2,1,e.salesOrder.Order.Discount,"1.0-4"),"%")}}function Wd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),g(3,Hd,3,3,"span"),g(4,Ud,3,4,"span"),a(),r(5,"td",20),p(6),v(7,"number"),a()()),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(M(7,4,e.calculatorService.Discount1Amount*-1))}}function Qd(n,t){if(n&1&&(r(0,"span"),p(1),v(2,"number"),a()),n&2){let e=c(3);s(),x("",M(2,1,e.salesOrder.Order.Discount2),"%")}}function qd(n,t){if(n&1&&(r(0,"span"),p(1),v(2,"number"),a()),n&2){let e=c(3);s(),x("",Z(2,1,e.salesOrder.Order.Discount2,"1.0-4"),"%")}}function $d(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),g(3,Qd,3,3,"span"),g(4,qd,3,4,"span"),a(),r(5,"td",20),p(6),v(7,"number"),a()()),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(M(7,4,e.calculatorService.Discount2Amount*-1))}}function Jd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),a(),r(3,"td",20),p(4),v(5,"number"),a()()),n&2){let e=c(2);s(2),Te(" ",e.appConfig==null||e.appConfig.CorePrint==null?null:e.appConfig.CorePrint.Alias.DiscountAmount," ",e.calculatorService.currencySymbol," "),s(2),w(M(5,3,e.salesOrder.Order.DiscountAmount*-1))}}function Gd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),a(),r(3,"td",19),p(4),v(5,"number"),a()()),n&2){let e=c(2);s(2),x(" ",e.calculatorService==null||e.calculatorService.tax==null?null:e.calculatorService.tax.Label," "),s(2),w(M(5,2,e.calculatorService==null?null:e.calculatorService.TaxAmount))}}function zd(n,t){if(n&1&&(r(0,"tr")(1,"th",18),p(2),v(3,"number"),a(),r(4,"td",21),p(5),v(6,"number"),a()()),n&2){let e=c(2);s(2),x(" SURCHARGE ",M(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(" ",M(6,5,e.calculatorService==null?null:e.calculatorService.SurchargeAmount))}}function Kd(n,t){if(n&1&&(r(0,"div",0),h(1,"div",14)(2,"div",15),r(3,"div",16)(4,"table",17),g(5,jd,6,3,"tr"),g(6,Wd,8,6,"tr"),g(7,$d,8,6,"tr"),g(8,Jd,6,5,"tr"),g(9,Gd,6,4,"tr"),g(10,zd,7,7,"tr"),a()()()),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 Yd(n,t){if(n&1){let e=y();r(0,"button",22),_("click",function(){u(e);let o=c();return f(o.onOpenModalDiscount())}),h(1,"i",23),a()}}var io=class n{constructor(t,e,i,o,l,b,V,J,ve){this.calculatorService=t;this.salesOrderService=e;this.userRoleService=i;this.outletService=o;this.pageInitialService=l;this.dialog=b;this.orderProcessorService=V;this.payService=J;this.parkOrderService=ve;this.destroy$=new q}handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.payService.payOrder()}taxCalculationType=ho;destroy$;salesOrder;userRole;appConfig;parkLayoutPack;orderProcessor;isIgnoreDecimalDisc1;isIgnoreDecimalDisc2;outletRegister;parkOrderRetrieve;ngOnInit(){this.subscribeToObservable()}subscribeToObservable(){this.appConfig=this.pageInitialService.Data.AppConfigJSON,this.salesOrderService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.salesOrder=t,t.TotalQuantity,this.initIgnoreDecimal()}),this.userRoleService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.userRole=t}),this.outletService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.outletRegister=t,this.parkLayoutPack=t.ParkLayoutPack}),this.orderProcessorService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.orderProcessor=t})}initIgnoreDecimal(){this.isIgnoreDecimalDisc1=this.checkIgnoreDecimalDisc(this.salesOrder.Order.Discount),this.isIgnoreDecimalDisc2=this.checkIgnoreDecimalDisc(this.salesOrder.Order.Discount2)}onPark(){this.parkOrderService.parkOrder()}onPayOrder(){this.payService.payOrder()}onOpenModalDiscount(){this.dialog.open(ci,{data:{tabIndexActive:"Discount"}})}checkIgnoreDecimalDisc(t){let e=this.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal,i=t%1===0;return e&&i}onOpenNotesModal(){this.dialog.open(to,{width:"45%"})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(Ce),d(R),d(de),d($),d(A),d(ae),d(U),d(ma),d(ke))};static \u0275cmp=P({type:n,selectors:[["sell-cart-footer"]],hostBindings:function(e,i){e&1&&_("keydown.F8",function(l){return i.handleF8(l)},it)},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,Kd,11,6,"div",0),r(1,"div",1)(2,"div",2)(3,"button",3),_("click",function(){return i.onOpenNotesModal()}),h(4,"i",4),a()(),r(5,"div",5)(6,"button",6),_("click",function(){return i.onPark()}),h(7,"i",7),r(8,"span"),p(9),a()()(),r(10,"div",8)(11,"div",9),g(12,Yd,2,0,"button",10),r(13,"button",11),_("click",function(){return i.onPayOrder()}),r(14,"div",12)(15,"div")(16,"span"),p(17,"Pay"),a(),r(18,"small",13),p(19),v(20,"number"),a()(),r(21,"div"),p(22),v(23,"async"),v(24,"number"),a()()()()()()),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(" (",M(20,9,i.salesOrder.cartQuantity)," Items) "),s(3),x(" ",i.userRole!=null&&i.userRole.PriceVisible?M(24,13,M(23,11,i.calculatorService.Data$)):"-"," "))},dependencies:[H,se,Ve,Y],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 Zd=n=>({"ps-0":n});function em(n,t){if(n&1){let e=y();r(0,"input",40),D("ngModelChange",function(o){u(e);let l=c(2).$implicit;return I(l.Splited,o)||(l.Splited=o),f(o)}),a()}if(n&2){let e=c(2).$implicit;O("ngModel",e.Splited)}}function tm(n,t){if(n&1&&(r(0,"small"),p(1),a()),n&2){let e=c(2).$index;s(),x("",e+1,".")}}function im(n,t){if(n&1&&(r(0,"td",10)(1,"div",12),g(2,em,1,1,"input",39),g(3,tm,2,1,"small"),a()()),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 nm(n,t){if(n&1&&(r(0,"div",41),h(1,"img",43),a()),n&2){let e=c(2).$implicit;s(),m("src",e.Variant==null?null:e.Variant.ThumbnailUrl,tt)}}function om(n,t){n&1&&(r(0,"div",42),h(1,"i",44),a())}function rm(n,t){if(n&1&&(r(0,"span",13),g(1,nm,2,1,"div",41)(2,om,2,0,"div",42),a()),n&2){let e=c().$implicit;s(),C(e.Variant!=null&&e.Variant.ThumbnailUrl?1:2)}}function am(n,t){n&1&&h(0,"i",45)}function lm(n,t){n&1&&h(0,"i",46)}function sm(n,t){if(n&1&&(r(0,"span",17),g(1,am,1,0,"i",45)(2,lm,1,0,"i",46),a()),n&2){let e=c().$implicit;s(),C(e.Taxable?1:2)}}function cm(n,t){n&1&&h(0,"i",18)}function pm(n,t){if(n&1&&(r(0,"small",20),p(1),a()),n&2){let e=c().$implicit;s(),x(" ",e.Variant.CategoryName," ")}}function dm(n,t){if(n&1&&(r(0,"small",21),p(1),a()),n&2){let e=c().$implicit;s(),x(" ",e.Variant.BrandName," ")}}function mm(n,t){if(n&1&&(r(0,"small",22),p(1),a()),n&2){let e=c().$implicit;s(),x(" ",e.Variant.Storage," ")}}function um(n,t){if(n&1&&h(0,"small",24),n&2){let e=c().$implicit;m("innerHtml",e.Note?e.Note:e.PriceNote,ki)}}function fm(n,t){if(n&1&&(r(0,"small",25),p(1," Sold by "),r(2,"i"),p(3),a()()),n&2){let e=c().$implicit;s(3),w(e.SalesName)}}function gm(n,t){if(n&1&&(r(0,"small")(1,"i",47),p(2),a()()),n&2){let e=c().$implicit;s(2),x("Fulfillment from: ",e.EntityName)}}function Cm(n,t){if(n&1&&(r(0,"div",28),h(1,"i",48),a()),n&2){let e=c().$implicit;m("matTooltip",e.AvailableInventory<e.Quantity?e.AvailableInventory+" Available Stock":"")}}function _m(n,t){if(n&1){let e=y();r(0,"span",49),_("click",function(){u(e);let o=c().$index,l=c(2);return f(l.onEditItem(o,"quantity"))}),p(1),v(2,"number"),a()}if(n&2){let e=c().$implicit,i=c(2);s(),x(" ",Z(2,1,e.Quantity,"1.0-"+i.qtyDecimalPlace()))}}function hm(n,t){if(n&1){let e=y();r(0,"span",50),p(1,"x"),a(),r(2,"div",51),_("click",function(){u(e);let o=c().$index,l=c(2);return f(l.onEditItem(o,"quantity"))}),r(3,"span",52),p(4),v(5,"number"),a()()}if(n&2){let e=c().$implicit,i=c(2);s(4),w(Z(5,1,e.UnitQuantity,"1.0-"+i.qtyDecimalPlace()))}}function bm(n,t){if(n&1&&(r(0,"span",31),p(1),v(2,"number"),a()),n&2){let e=c().$implicit,i=c(2);s(),x("@",Z(2,1,e.VariantUnitQuantity,"1.0-"+i.qtyDecimalPlace()))}}function vm(n,t){if(n&1&&(r(0,"small",32),p(1),a()),n&2){let e=c().$implicit,i=c(2);s(),w(i.isNotEmpty(e.Variant.UOM)?e.Variant.UOMName:"")}}function Sm(n,t){if(n&1&&(r(0,"div",55),p(1),v(2,"number"),a()),n&2){let e=c(4).$implicit;s(),x(" ",Z(2,1,e.UnitPriceOriginal,"1.0-4")," ")}}function ym(n,t){if(n&1){let e=y();r(0,"div",54),_("click",function(){u(e);let o=c(3).$index,l=c(2);return f(l.onEditItem(o,"price"))}),g(1,Sm,3,4,"div",55),r(2,"div",30),p(3),v(4,"number"),a()()}if(n&2){let e=c(3).$implicit;s(),C(e.UnitPriceOriginal>e.Price?1:-1),s(2),x(" ",Z(4,2,e.Price,"1.0-4")," ")}}function xm(n,t){if(n&1){let e=y();r(0,"div",49),_("click",function(){u(e);let o=c(3).$index,l=c(2);return f(l.onEditItem(o,"price"))}),p(1),v(2,"number"),a()}if(n&2){let e=c(3).$implicit;s(),x(" ",Z(2,1,e.Price,"1.0-4")," ")}}function Mm(n,t){if(n&1&&g(0,ym,5,5,"div",53)(1,xm,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 Pm(n,t){if(n&1&&(r(0,"div",27),g(1,Mm,2,1),a()),n&2){let e=c().$implicit;s(),C(e.Price!==e.Total?1:-1)}}function Om(n,t){if(n&1&&(r(0,"div"),p(1),v(2,"number"),a()),n&2){let e=c().$implicit;s(),x(" ",e.Discount==0?"":M(2,1,e.Discount*-1)+"%"," ")}}function Im(n,t){if(n&1&&(r(0,"div"),p(1),v(2,"number"),a()),n&2){let e=c().$implicit;s(),x(" ",e.DiscountAmount==0?"":M(2,1,e.DiscountAmount*-1)," ")}}function Dm(n,t){if(n&1&&(r(0,"div",56),p(1),v(2,"number"),a()),n&2){let e=c(2).$implicit;s(),x(" ",Z(2,1,e.UnitPriceOriginal,"1.0-4")," ")}}function wm(n,t){if(n&1&&(r(0,"div",30),g(1,Dm,3,4,"div",56),r(2,"div",27),p(3),v(4,"amountFraction"),a()()),n&2){let e=c().$implicit;s(),C(e.UnitPriceOriginal>e.Price?1:-1),s(2),x(" ",M(4,2,e.Total)," ")}}function km(n,t){if(n&1&&(r(0,"div",27)(1,"div",30),p(2),v(3,"amountFraction"),a()()),n&2){let e=c().$implicit,i=c(2);s(2),x(" ",i.userRole.PriceVisible?M(3,1,e.Total):" - "," ")}}function Tm(n,t){if(n&1){let e=y();r(0,"span",57),_("click",function(){u(e);let o=c().$implicit,l=c(2);return f(l.removeItem(o))}),h(1,"i",58),a()}}function Em(n,t){if(n&1){let e=y();r(0,"tr",9),v(1,"async"),_("contextmenu",function(o){let l=u(e),b=l.$implicit,V=l.$index,J=c(2);return f(J.onContextMenu(o,b,V))}),g(2,im,4,2,"td",10),r(3,"td",11),_("click",function(){let o=u(e).$index,l=c(2);return f(l.onEditItem(o,"quantity"))}),r(4,"div",12),g(5,rm,3,1,"span",13),r(6,"div",14)(7,"div",15)(8,"span",16),p(9),a(),g(10,sm,3,1,"span",17),g(11,cm,1,0,"i",18),a(),r(12,"div",19),p(13),a(),g(14,pm,2,1,"small",20),g(15,dm,2,1,"small",21),g(16,mm,2,1,"small",22),r(17,"div"),h(18,"app-serial-note",23),a(),g(19,um,1,1,"small",24),g(20,fm,4,1,"small",25),g(21,gm,3,1,"small"),a()()(),r(22,"td",26)(23,"div",27),g(24,Cm,2,1,"div",28),r(25,"div",29),g(26,_m,3,4,"span",30),g(27,hm,6,4),g(28,bm,3,4,"span",31),g(29,vm,2,1,"small",32),a()()(),r(30,"td"),g(31,Pm,2,1,"div",27),a(),r(32,"td",33),_("click",function(){let o=u(e).$index,l=c(2);return f(l.onEditItem(o,"discount"))}),r(33,"div",34),g(34,Om,3,3,"div"),g(35,Im,3,3,"div"),a()(),r(36,"td",35),_("click",function(){let o=u(e).$index,l=c(2);return f(l.onEditItem(o,"price"))}),g(37,wm,5,4,"div",30)(38,km,4,3,"div",27),a(),r(39,"td",36)(40,"div",37),g(41,Tm,2,0,"span",38),a()()()}if(n&2){let e=t.$implicit,i=c(2);m("cdkDragDisabled",!M(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,Zd,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 Rm(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 l=c();return f(l.drop(o))}),ie(4,Em,42,29,"tr",8,pe),a()()()()}if(n&2){let e=c();s(4),ne(e.cartItems)}}function Nm(n,t){n&1&&(r(0,"div",2)(1,"div",5)(2,"div",59)(3,"div",60)(4,"div",61),h(5,"i",62),a(),r(6,"div",63)(7,"span"),p(8,"Empty Cart"),a(),h(9,"br"),r(10,"span"),p(11,"Add products to the cart"),a(),h(12,"br"),r(13,"span"),p(14,"or scan barcode"),a()()()()()())}function Vm(n,t){if(n&1){let e=y();r(0,"button",64),_("click",function(){let o=u(e).item,l=c();return f(l.onReverse(o,!0))}),p(1," Return "),a(),r(2,"button",65),_("click",function(){let o=u(e).item,l=c();return f(l.onReverse(o,!1))}),p(3,"Sales"),a(),r(4,"button",64),_("click",function(){let o=u(e).item,l=c();return f(l.onSumPrice(o))}),p(5," Merge / SUM Price "),a(),r(6,"button",64),_("click",function(){let o=u(e).item,l=c();return f(l.onBundlePrice(o))}),p(7," Bundle Price "),a()}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 no=class n{constructor(t,e,i,o,l,b,V){this.salesOrderService=t;this.roleService=e;this.shoppingCartService=i;this.pageInitialService=o;this.dialog=l;this.orderProcessorService=b;this.moreMenuService=V;this.destroy$=new q,this.eventAddItem=new He,this.enabledDragDrop$=this.moreMenuService.enabledDragDrop$}destroy$;cartItems=[];userRole;appConfig;currentSellState;hasItemDeletion;eventAddItem;isAddItem=!0;sellState=Me;showThumbnail;enabledDragDrop$;inventoryType=Qi;qtyDecimalPlace=E(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){gr(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(Ge,{data:{index:t,focus:e}})}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(e){return new(e||n)(d(R),d(de),d(we),d(A),d(ae),d(U),d(Vt))};static \u0275cmp=P({type:n,selectors:[["sell-cart-body"]],viewQuery:function(e,i){if(e&1&&Se(on,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,Rm,6,0,"div",1)(1,Nm,15,0,"div",2),h(2,"div",3),r(3,"mat-menu",null,0),K(5,Vm,8,3,"ng-template",4),a()),e&2){let o=nt(4);C(i.cartItems.length>0?0:1),s(2),go("left",i.contextMenuPosition.x)("top",i.contextMenuPosition.y),m("matMenuTriggerFor",o)}},dependencies:[H,$t,Q,ee,_r,Cr,Xr,Kr,Yr,on,se,Zr,Ve,Y,br],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 oo=class{ID;Name;Code;Address;Phone;Email;SalesTarget;SalesPersonGroupID;Bin};var Lm=["ngSelectInfinite"],Fm=(n,t)=>({"text-success":n,"text-danger":t}),Bm=n=>({offline:n}),za=n=>({"opacity-50":n}),ao=(n,t)=>({red:n,green:t});function jm(n,t){if(n&1&&(r(0,"span",8),p(1),v(2,"async"),v(3,"number"),a()),n&2){let e=c();s(),x(" ",M(3,3,M(2,1,e.totalOfflineOrders$))," ")}}function Hm(n,t){if(n&1&&(r(0,"sup",13)(1,"div",26),p(2),v(3,"async"),v(4,"number"),a()()),n&2){let e=c();s(2),x(" ",M(4,3,M(3,1,e.moreMenuService.eligiblePromotions$))," ")}}function Um(n,t){if(n&1&&h(0,"span",37),n&2){let e=c(4);m("ngClass",me(1,ao,!e.displayService.isEnabled(),e.displayService.isEnabled()))}}function Wm(n,t){if(n&1&&h(0,"span",37),n&2){let e=c(4);m("ngClass",me(1,ao,!e.orderDisplayService.isEnabled(),e.orderDisplayService.isEnabled()))}}function Qm(n,t){if(n&1&&h(0,"span",37),n&2){let e=c(4);m("ngClass",me(1,ao,!e.ecrSignalService.isConnected(),e.ecrSignalService.isConnected()))}}function qm(n,t){if(n&1&&h(0,"span",37),n&2){let e=c(4);m("ngClass",me(1,ao,!e.cashMachineService.isConnected(),e.cashMachineService.isConnected()))}}function $m(n,t){if(n&1){let e=y();Ue(0),r(1,"li",33),_("click",function(){let o=u(e).$implicit,l=c(3);return f(o.disabled?null:l.moreMenuService.moreMenuAction(o.action))}),r(2,"div",34),h(3,"i",35),r(4,"span",36),p(5),a(),g(6,Um,1,4,"span",37),g(7,Wm,1,4,"span",37),g(8,Qm,1,4,"span",37),g(9,qm,1,4,"span",37),a()(),We()}if(n&2){let e=t.$implicit;s(),m("matTooltip",e.disabled?e.description:"")("ngClass",T(10,za,e.disabled)),Wo("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&&(Ue(0),r(1,"div",30),p(2),a(),h(3,"div",31),K(4,$m,10,12,"ng-container",32),We()),n&2){let e=c().$implicit;s(2),w(e.name),s(2),m("ngForOf",e.menus)}}function Gm(n,t){if(n&1&&(r(0,"sup",13)(1,"div",26),p(2),v(3,"async"),v(4,"number"),a()()),n&2){let e=c(6);s(2),x(" ",M(4,3,M(3,1,e.moreMenuService.eligiblePromotions$))," ")}}function zm(n,t){if(n&1&&(Ue(0),r(1,"div",34),h(2,"i",35),r(3,"span",36),p(4),a(),g(5,Gm,5,5,"sup",13),v(6,"async"),a(),We()),n&2){let e=c().$implicit,i=c(4);s(2),le(e.class),s(2),w(e.label),s(),C(e.label=="Event"&&M(6,4,i.moreMenuService.eligiblePromotions$)>0?5:-1)}}function Km(n,t){if(n&1){let e=y();r(0,"li",33),_("click",function(){let o=u(e).$implicit,l=c(4);return f(o.disabled?null:l.moreMenuService.moreMenuAction(o.action))}),K(1,zm,7,6,"ng-container",28),a()}if(n&2){let e=t.$implicit;m("matTooltip",e.disabled?e.description:"")("ngClass",T(3,za,e.disabled)),s(),m("ngIf",e.isShow!==!1)}}function Ym(n,t){if(n&1&&(Ue(0),r(1,"div",30),p(2),a(),h(3,"div",31),K(4,Km,2,5,"li",39),We()),n&2){let e=c().$implicit;s(2),w(e.name),s(2),m("ngForOf",e.menus)}}function Xm(n,t){if(n&1&&(r(0,"div",38),K(1,Ym,5,2,"ng-container",28),a()),n&2){let e=t.$implicit;s(),m("ngIf",(e.menus==null?null:e.menus.length)>0)}}function Zm(n,t){if(n&1&&(r(0,"div",27),K(1,Jm,5,2,"ng-container",28)(2,Xm,2,1,"div",29),a()),n&2){let e=t.$implicit;s(),m("ngIf",(e.menus==null?null:e.menus.length)>0),s(),m("ngForOf",e.children)}}var ro=class n{constructor(t,e,i,o,l,b,V,J,ve,Be,je,mi,Ii,Di){this.pageInitialService=t;this.salesOrderService=e;this.userRoleService=i;this.outletService=o;this.dialog=l;this.promotionEventService=b;this.moreMenuService=V;this._onlineStatusService=J;this.toggleSidebar=ve;this.displayService=Be;this.ecrSignalService=je;this.cashMachineService=mi;this.localDataService=Ii;this.orderDisplayService=Di;this.appConfig=this.pageInitialService.Data.AppConfigJSON,this.destroy$=new q,this.isOnline$=J.getOnlineStatus$(),this.totalOfflineOrders$=this.localDataService.unsentOrders$.pipe(et(At=>At.length),Ht(1)),this.toggleSidebar.toggleState$.subscribe(At=>this.isChange=At)}salesOrder;appConfig;selectedCustomerId;userRole;salesPersonList=[];destroy$;outletRegister;salesPersonName;ngSelectInfinite;handleF8(){this.dialog.openDialogs&&this.dialog.openDialogs.length>0||this.dialog.open(Ge)}handleF2(){this.ngSelectInfinite&&this.ngSelectInfinite.ngSelectElement.focus()}disabledSalesOption=!1;salesPersonOptionTooltip=E("");isEnabledLoyaltyPoint;isOnline$;isChange=!0;totalOfflineOrders$;ngOnInit(){this.subscribeToObservable()}collapseSidebar(){this.toggleSidebar.toggleSidebar()}subscribeToObservable(){this.userRoleService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.userRole=t,this.checkDisabledSalesOption()}),this.salesOrderService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.salesOrder=t,this.checkDisabledSalesOption(t.CartItems),S.IsEmpty(this.salesOrder.Order.SalesID)&&(this.salesOrder.Order.SalesID=null)}),this.outletService.Data$.pipe(k(this.destroy$)).subscribe(t=>{this.initSalesPerson(t.ListSales),this.outletRegister=t}),this.promotionEventService.onClickToastPromo.pipe(k(this.destroy$)).subscribe(t=>{if(t){let e=this.dialog.getDialogById("promotion-event");S.IsEmpty(e)&&this.dialog.open(sn,{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 oo;e.ID=S.GuidEmpty,this.salesPersonList=[...t]}openOnlineStatusModal(){this.localDataService.unsentOrders$.pipe(jt(1),Re(t=>{let e=t.length>0?"ORDER":"SETUP";return this.dialog.open(pn,{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(R),d(de),d($),d(ae),d(Xt),d(Vt),d(Je),d(pr),d(Yi),d(wt),d(kt),d(Ye),d(zi))};static \u0275cmp=P({type:n,selectors:[["sell-cart-header"]],viewQuery:function(e,i){if(e&1&&Se(Lm,7),e&2){let o;ye(o=xe())&&(i.ngSelectInfinite=o.first)}},hostBindings:function(e,i){e&1&&_("keydown.F4",function(l){return i.handleF8(l)},it)("keydown.control.F2",function(l){return i.handleF2(l)},it)},standalone:!1,decls:38,vars:34,consts:[["ngSelectInfinite",""],[1,"row","g-0","d-print-none","pt-2"],[1,"col-7","d-flex","align-items-center"],[1,"d-flex","align-items-center","justify-content-between","ms-8"],[1,"d-flex","align-items-center","pe-8","cursor-pointer",3,"click"],[1,"me-2"],[1,"fa","fa-circle",3,"ngClass"],[1,"fs-6","headings-font-family","pb-1","position-relative"],[1,"position-absolute","top-0","translate-middle","badge","rounded-pill","bg-danger","ms-3"],[1,"border-start",2,"height","30px"],["id","moreMenu","data-bs-toggle","dropdown",1,"d-flex","align-items-center","ps-8","cursor-pointer"],[1,"fa-solid","fa-caret-down","fa-lg"],[1,"fs-6","headings-font-family","pb-1"],[1,"badge","rounded-pill","bg-danger","ms-1","customize-badge"],["aria-labelledby","moreMenu",1,"dropdown-menu","more-actions"],["aria-labelledby","moreMenu",1,"d-flex"],["class","dropdown-header text-dark col pe-8",4,"ngFor","ngForOf"],[1,"col-5"],[1,"d-flex","align-items-center","justify-content-end"],[1,"mt-1"],[1,"fa-light","fa-id-badge",2,"font-size","17px"],[1,"fs-5",2,"width","calc(100% - 32px)",3,"matTooltip"],["bindValue","ID","bindLabel","Name","placeholder","Assign Sales Person","matTooltipPosition","above",1,"sales-person","select-max-width",3,"selectedChange","selectedLabel","clearable","ngClass","items","selected","disabled","optionTitle","matTooltip"],[1,"navbar","mobile-button"],["type","button","aria-controls","navigation-index","aria-expanded","false","aria-label","Toggle navigation",1,"navbar-toggler","navbar-toggler-right","float-end","toggle-menu","ps-2","pe-0","border-0",2,"width","max-content","height","max-content",3,"click"],[1,"navbar-toggler-bar","burger-lines"],[1,"d-flex","align-items-center","w-100","justify-content-center"],[1,"dropdown-header","text-dark","col","pe-8"],[4,"ngIf"],["class","mt-5",4,"ngFor","ngForOf"],[1,"h5","mb-4"],[1,"dropdown-divider","m-0"],[4,"ngFor","ngForOf"],["matTooltipPosition","above",1,"cursor-pointer",3,"click","matTooltip","ngClass"],[1,"dropdown-item","px-1"],["aria-hidden","true"],[1,"fw-normal","fs-5","ps-4"],[1,"blob","ms-2",2,"position","absolute",3,"ngClass"],[1,"mt-5"],["matTooltipPosition","above","class","cursor-pointer",3,"matTooltip","ngClass","click",4,"ngFor","ngForOf"]],template:function(e,i){if(e&1){let o=y();r(0,"div",1)(1,"div",2)(2,"div",3)(3,"span",4),_("click",function(){return u(o),f(i.openOnlineStatusModal())}),r(4,"span",5),h(5,"i",6),v(6,"async"),v(7,"async"),a(),r(8,"span",7),p(9),v(10,"async"),g(11,jm,4,5,"span",8),v(12,"async"),a()(),h(13,"span",9),r(14,"span",10)(15,"span",5),h(16,"i",11),a(),r(17,"span",12),p(18,"More Actions"),a(),g(19,Hm,5,5,"sup",13),v(20,"async"),a(),r(21,"div",14)(22,"div",15),K(23,Zm,3,2,"div",16),v(24,"async"),a()()()(),r(25,"div",17)(26,"div",18)(27,"div",19),h(28,"i",20),a(),r(29,"div",21)(30,"ng-select-infinite",22,0),v(32,"async"),D("selectedChange",function(b){return u(o),I(i.salesOrder.Order.SalesID,b)||(i.salesOrder.Order.SalesID=b),f(b)}),_("selectedLabel",function(b){return u(o),f(i.salesPersonName=b)}),a()(),r(33,"div",23)(34,"button",24),_("click",function(){return u(o),f(i.collapseSidebar())}),h(35,"span",25)(36,"span",25)(37,"span",25),a()()()()()}e&2&&(s(5),m("ngClass",me(29,Fm,M(6,15,i.isOnline$),!M(7,17,i.isOnline$))),s(4),x("",M(10,19,i.isOnline$)?"Online":"Offline"," "),s(2),C(M(12,21,i.totalOfflineOrders$)>0?11:-1),s(8),C(M(20,23,i.moreMenuService.eligiblePromotions$)>0?19:-1),s(4),m("ngForOf",M(24,25,i.moreMenuService.moreMenu$)),s(6),m("matTooltip",i.salesPersonName),s(),m("clearable",!0)("ngClass",T(32,Bm,!M(32,27,i.isOnline$)))("items",i.salesPersonList),O("selected",i.salesOrder.Order.SalesID),m("disabled",i.disabledSalesOption)("optionTitle",!0)("matTooltip",i.salesPersonOptionTooltip()),s(4),$o("change",i.isChange))},dependencies:[H,Vi,Ut,$i,se,Ve,Y],styles:[`.disabled{color:gray;pointer-events:none;cursor:not-allowed}.blob{background:#000;border-radius:50%;box-shadow:0 0 #000;height:15px;width:15px;transform:scale(1);animation:pulse-black 2s infinite}@keyframes pulse-black{0%{transform:scale(.95);box-shadow:0 0 #000000b3}70%{transform:scale(1);box-shadow:0 0 0 10px #0000}to{transform:scale(.95);box-shadow:0 0 #0000}}.blob.white{background:#fff;box-shadow:0 0 #fff;animation:pulse-white 2s infinite}@keyframes pulse-white{0%{transform:scale(.95);box-shadow:0 0 #ffffffb3}70%{transform:scale(1);box-shadow:0 0 0 10px #fff0}to{transform:scale(.95);box-shadow:0 0 #fff0}}.blob.red{background:#ff5252;box-shadow:0 0 #ff5252;animation:pulse-red 2s infinite}@keyframes pulse-red{0%{transform:scale(.95);box-shadow:0 0 #ff5252b3}70%{transform:scale(1);box-shadow:0 0 0 10px #ff525200}to{transform:scale(.95);box-shadow:0 0 #ff525200}}.blob.orange{background:#ff793f;box-shadow:0 0 #ff793f;animation:pulse-orange 2s infinite}@keyframes pulse-orange{0%{transform:scale(.95);box-shadow:0 0 #ff793fb3}70%{transform:scale(1);box-shadow:0 0 0 10px #ff793f00}to{transform:scale(.95);box-shadow:0 0 #ff793f00}}.blob.yellow{background:#ffb142;box-shadow:0 0 #ffb142;animation:pulse-yellow 2s infinite}@keyframes pulse-yellow{0%{transform:scale(.95);box-shadow:0 0 #ffb142b3}70%{transform:scale(1);box-shadow:0 0 0 10px #ffb14200}to{transform:scale(.95);box-shadow:0 0 #ffb14200}}.blob.blue{background:#34ace0;box-shadow:0 0 #34ace0;animation:pulse-blue 2s infinite}@keyframes pulse-blue{0%{transform:scale(.95);box-shadow:0 0 #34ace0b3}70%{transform:scale(1);box-shadow:0 0 0 10px #34ace000}to{transform:scale(.95);box-shadow:0 0 #34ace000}}.blob.green{background:#77d933;box-shadow:0 0 #77d933;animation:pulse-green 2s infinite}@keyframes pulse-green{0%{transform:scale(.95);box-shadow:0 0 #33d938b3}70%{transform:scale(1);box-shadow:0 0 0 10px #33d9b200}to{transform:scale(.95);box-shadow:0 0 #33d9b200}}.blob.purple{background:#8e44ad;box-shadow:0 0 #8e44ad;animation:pulse-purple 2s infinite}@keyframes pulse-purple{0%{transform:scale(.95);box-shadow:0 0 #8e44adb3}70%{transform:scale(1);box-shadow:0 0 0 10px #8e44ad00}to{transform:scale(.95);box-shadow:0 0 #8e44ad00}}ng-select-infinite.sales-person.select-max-width>ng-select{padding-right:10px;height:38px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{font-size:.75rem;border:.5px solid #d7d7d7;padding-right:6px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container>.ng-arrow-wrapper{width:12px;padding-bottom:2px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container>.ng-value-container{padding-left:6px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container{min-height:38px!important;height:38px!important;border:none}ng-select-infinite.sales-person.select-max-width.offline>.ng-select.ng-select-single .ng-select-container{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container .ng-input{padding-left:5px!important}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single .ng-select-container .ng-input>input{padding-top:5px}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-single>ng-dropdown-panel.ng-dropdown-panel{font-size:.75rem;width:95%!important}ng-select-infinite.sales-person.select-max-width>.ng-select.ng-select-focused .ng-select-container{box-shadow:none!important;border-color:transparent!important}.change .burger-lines{transition:.4s}.change .burger-lines:nth-child(1){-webkit-transform:rotate(-45deg) translate(-8px,4px);transform:rotate(-45deg) translate(-8px,4px)}.change .burger-lines:nth-child(2){opacity:0}.change .burger-lines:nth-child(3){-webkit-transform:rotate(45deg) translate(-5px,0px);transform:rotate(45deg) translate(-5px)}.mobile-button{display:none}@media (max-width: 990px){.mobile-button{display:block}}.navbar-toggler:focus{box-shadow:none!important}.customize-badge{height:16px;width:16px;font-size:9px}
|
|
43
|
+
`],encapsulation:2})};var tu=["serialInput"];function iu(n,t){if(n&1){let e=y();r(0,"div",2)(1,"autocompleteV2",4),v(2,"async"),_("onHoverPrefixIcon",function(){u(e);let o=c();return f(o.onMouseEventPrefixIcon("hover"))})("onLeavePrefixIcon",function(){u(e);let o=c();return f(o.onMouseEventPrefixIcon("leave"))})("onSelect",function(o){u(e);let l=c();return f(l.onAddItem(o))})("onInputEnter",function(o){u(e);let l=c();return f(l.onBarcodeScan(o))})("clickPrefixIcon",function(){u(e);let o=c();return f(o.scannerMode="serial")}),a()()}if(n&2){let e,i=c(),o=nt(3);s(),m("renderThumbnail",!0)("prefixIcon",i.barcodePrefixIcon)("clearOnSelect",!0)("renderThumbnail",i.renderThumbnail)("useCustomTemplate",!0)("itemTemplate",o)("outletId",(e=M(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 nu(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"))}),a(),r(2,"input",6,1),D("ngModelChange",function(o){u(e);let l=c();return I(l.serial,o)||(l.serial=o),f(o)}),_("keydown",function(o){u(e);let l=c();return f(l.onKeyDown(o))}),a()()}if(n&2){let e=c();s(),le(e.serialPrefixIcon),s(),O("ngModel",e.serial)}}function ou(n,t){if(n&1&&(r(0,"div",10)(1,"span"),p(2),v(3,"number"),a()()),n&2){let e=c().data;s(2),w(M(3,1,e==null?null:e.UnitPrice))}}function ru(n,t){if(n&1&&(r(0,"div",7)(1,"div",8)(2,"div"),p(3),a(),r(4,"small",9),p(5),a()(),g(6,ou,4,3,"div",10),a()),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 lo=class n{constructor(t,e,i,o,l,b){this.shoppingCartService=t;this.pageInitialService=e;this.dialog=i;this.role=o;this.salesOrderService=l;this.outletService=b}barcodePrefixIcon="fa-solid fa-barcode";serialPrefixIcon="fa-barcode-read fa-solid";scannerMode="barcode";toastr=G(X);serialInputEl;serial;focusProductInput(){let t=document.getElementById("product");t&&t.focus()}renderThumbnail=!1;ngOnInit(){this.initThumbnailConfig()}ngAfterViewInit(){this.focusProductInput()}initThumbnailConfig(){let t=this.pageInitialService.Data.AppConfigJSON;this.renderThumbnail=t?.ModuleSell?.Grid?.ProductImageVisible}onAddItem(t){this.shoppingCartService.addCartItemById(t).then(()=>{this.openModalItemOnNew()})}onBarcodeScan(t){S.IsNotEmpty(t)&&this.shoppingCartService.addCartItemByCode(t).then(e=>{this.openModalItemOnNew()})}openModalItemOnNew(){let t=this.pageInitialService.Data.AppConfigJSON,e=this.salesOrderService.Data;if(t.ModuleSell.ProductDialog.OpenOnNewItemAdded){let o=e.CartItems.length-1;this.dialog.open(Ge,{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(we),d(A),d(ae),d(Mt),d(R),d($))};static \u0275cmp=P({type:n,selectors:[["app-search-product"]],viewQuery:function(e,i){if(e&1&&Se(tu,5),e&2){let o;ye(o=xe())&&(i.serialInputEl=o.first)}},hostBindings:function(e,i){e&1&&_("keydown.control.F3",function(l){return i.focusProductInput(l)},it)},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,iu,3,11,"div",2),g(1,nu,4,3,"div",3),K(2,ru,7,3,"ng-template",null,0,yt)),e&2&&(C(i.scannerMode==="barcode"?0:-1),s(),C(i.scannerMode==="serial"?1:-1))},dependencies:[z,Q,ee,Yt,se,Ve,Y],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 lu=(n,t)=>({"text-danger":n,"text-custom-warning":t});function su(n,t){if(n&1&&(r(0,"div",4)(1,"div",5)(2,"div"),p(3),a()()()),n&2){let e=t.data,i=c();s(),m("ngClass",me(3,lu,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 cu(n,t){if(n&1&&(Ue(0),r(1,"span",9),h(2,"i",10),r(3,"span",11),p(4),v(5,"number"),a()(),We()),n&2){let e=c(2);s(4),w(e.customerData!=null&&e.customerData.Point?M(5,1,e.customerData==null?null:e.customerData.Point):0)}}function pu(n,t){if(n&1&&(Ue(0),r(1,"span"),p(2,"/"),a(),r(3,"span"),Ue(4),r(5,"span"),p(6),v(7,"number"),a(),We(),a(),We()),n&2){let e=c(3);s(6),w(M(7,1,e.customerData==null?null:e.customerData.DebtLimit))}}function du(n,t){if(n&1&&(Ue(0),r(1,"span",12),h(2,"i",13),r(3,"span"),p(4),v(5,"number"),a(),K(6,pu,8,3,"ng-container",3),a(),We()),n&2){let e=c(2);s(4),x(" ",M(5,2,e.customerData==null?null:e.customerData.Debt)," "),s(2),m("ngIf",(e.customerData==null?null:e.customerData.DebtLimit)>0)}}function mu(n,t){if(n&1&&(Ue(0),r(1,"span",14),h(2,"i",15),r(3,"span",11),p(4),a()(),We()),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 uu(n,t){if(n&1){let e=y();Ue(0),r(1,"div",6)(2,"div",7)(3,"div",8),_("click",function(){u(e);let o=c();return f(o.showPointModal())}),K(4,cu,6,3,"ng-container",3)(5,du,7,4,"ng-container",3)(6,mu,5,1,"ng-container",3),a()()(),We()}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 so=class n{constructor(t,e,i,o,l,b,V,J,ve,Be,je,mi){this.customerService=t;this.dialog=e;this.userRoleService=i;this.orderProcessorService=o;this.salesOrderService=l;this.toastr=b;this.outletService=V;this.posService=J;this.customerHttpService=ve;this.sf=Be;this.orderCalculator=je;this.router=mi;this.destroy$=new q}handleF1(){let t=document.getElementById("ContactID");t&&t.focus()}customerData;destroy$;isEnabledLoyaltyPoint;salesOrder;userRole;customerState=Da;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(la,{autoFocus:!1}).afterClosed().subscribe(e=>{if(e){let i=this.orderProcessorService.Data;this.orderProcessorService.pushNewValue(i),this.customerService.updateDiscountRate(e.DiscountRate)}})}onInputCustomer(t){this.orderProcessorService.Data.InputTextValue=t,t!==null&&t.length==0&&(this.customerService.onEmptyInputCustomer(),this.customerData=null)}onSelectCustomer(t){this.customerService.addCustomerById(t).pipe(k(this.destroy$)).subscribe(e=>{this.customerData=e,this.initEnableLoyaltyPoint()})}initEnableLoyaltyPoint(){let e=this.posService.Data.AppConfigJSON?.ApplicationLoyalty?.Enabled,i=this.outletService?.Data?.MemberPoint;this.isEnabledLoyaltyPoint=!1,e&&i&&this.customerData?.Point>0&&(this.isEnabledLoyaltyPoint=!0)}onDeleteCustomer(){S.IsNotEmpty(this.salesOrder?.ContactName)&&this.dialog.open(ei,{data:{title:"Re-assign customer",message:"Are you sure to re-assign the customer?"}}).afterClosed().pipe(oe(t=>t)).subscribe(t=>{this.customerService.onEmptyInputCustomer(),this.customerData=null,this.orderProcessorService.Data.InputTextValue=null,this.salesOrder.ContactName=null})}onScanCodeCustomer(t){t.length>0&&this.customerService.addCustomerByCode(t).pipe(k(this.destroy$)).subscribe(e=>{this.customerData=e,this.initEnableLoyaltyPoint()})}onEmitSelectedCustomer(t){if(t){let e=JSON.parse(t);this.salesOrder.ContactName=e.Value}}showPointModal(){let t=this.outletService.Data?.MemberPoint,e=this.customerService.pointBalanced,i=this.orderCalculator.Data;i>0?t&&e>0&&this.dialog.open(si):i<0&&this.toastr.error("You cannot redeem point when amount is negative","Redeem Restricted")}onClickSuffixIcon2(){let t=this.salesOrder.Order.CustomerID;if(S.IsNotEmpty(t)){let e=this.router.serializeUrl(this.router.createUrlTree(["/menu/Contacts/Contact/Customers/Info"],{queryParams:{ID:t}}));window.open(e,"_blank")}}onDetectInputNativeElement(t){this.sf.searchFilterNativeEl=t}static \u0275fac=function(e){return new(e||n)(d(li),d(ae),d(de),d(U),d(R),d(X),d($),d(A),d(ft),d(da),d(Ce),d(xt))};static \u0275cmp=P({type:n,selectors:[["app-search-customer"]],hostBindings:function(e,i){e&1&&_("keydown.control.F1",function(l){return i.handleF1(l)},it)},standalone:!1,decls:5,vars:9,consts:[["itemTemplate",""],[1,"px-4","py-4","position-relative"],["requestUrl","/API/AC/GetCustomerSuggestion","placeholder","Assign Customer","inputID","ContactID","notFoundMessageFor","customer","prefixIcon","fa-light fa-user-plus","prefixIconTitle","New Customer Form","suffixIconTitle","Customer Input by typing is locked","suffixIconTitle2","Open Customer Details","data_cy","txt-customer","icon_data_cy","dialog-add-customer",1,"form-control","autocomplete-customer",3,"onInputChange","onInputEnter","onSelect","clickInputValue","clickPrefixIcon","clickSuffixIcon2","optionSelected","onDetectInputNativeElement","useTooltip","inputTextValue","readonly","inputLock","suffixIcon","suffixIcon2","useCustomTemplate","itemTemplate"],[4,"ngIf"],[1,"d-flex","align-items-center","justify-content-between","w-100"],[1,"ms-3","text-wrap","text-break",3,"ngClass","title"],[1,"customerPoint-tooltip","arrow-top"],[1,"d-block"],[1,"ms-1","cursor-pointer",2,"font-size","10px",3,"click"],["matTooltip","Point"],["aria-hidden","true",1,"fa","fa-star","text-primary"],[1,"ms-1"],["matTooltip","Debt",1,"ms-3"],["aria-hidden","true",1,"fa-solid","fa-dollar-sign","text-primary"],["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(b){return u(o),f(i.onInputCustomer(b))})("onInputEnter",function(b){return u(o),f(i.onScanCodeCustomer(b))})("onSelect",function(b){return u(o),f(i.onSelectCustomer(b))})("clickInputValue",function(){return u(o),f(i.onDeleteCustomer())})("clickPrefixIcon",function(){return u(o),f(i.openCustomerModal())})("clickSuffixIcon2",function(){return u(o),f(i.onClickSuffixIcon2())})("optionSelected",function(b){return u(o),f(i.onEmitSelectedCustomer(b))})("onDetectInputNativeElement",function(b){return u(o),f(i.onDetectInputNativeElement(b))}),a(),K(2,su,4,6,"ng-template",null,0,yt)(4,uu,7,3,"ng-container",3),a()}if(e&2){let o=nt(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),s(3),m("ngIf",i.customerData&&((i.userRole==null?null:i.userRole.DebtView)&&(i.customerData==null?null:i.customerData.Debt)>0||i.isEnabledLoyaltyPoint))}},dependencies:[H,Ut,Yt,se,Y],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 gu=["cardContainer"],Cu=n=>({"cart-subscription-overdue":n}),_u=n=>({"bg-gradient-danger":n}),hu=n=>({"pb-2":n}),co=class n{constructor(t,e){this.onlineStatusService=t;this.authService=e;this.isOnline$=this.onlineStatusService.getOnlineStatus$(),this.currentSubsStatus=e.getSubscriptionStatus()}cardContainer;isOnline$;currentSubsStatus;subscriptionStatus=qt;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(Je),d(Gt))};static \u0275cmp=P({type:n,selectors:[["sell-cart"]],viewQuery:function(e,i){if(e&1&&Se(gu,5),e&2){let o;ye(o=xe())&&(i.cardContainer=o.first)}},standalone:!1,decls:18,vars:11,consts:[["cardContainer",""],[1,"d-flex","flex-column","cart-height",3,"ngClass"],[1,"row","pt-2","border-bottom",2,"min-height","60px",3,"ngClass"],[1,"col-12","px-3"],[1,"row"],[1,"col-7","px-0"],[1,"col-5","ps-0","pe-4"],[1,"row","d-print-none","flex-grow-1",2,"height","0px","overflow-y","auto"],[1,"col-12","px-1"],[1,"me-6","h-100"],[3,"eventAddItem"],[1,"row","d-print-none","pb-4","pe-8",3,"ngClass"],[1,"col-12"]],template:function(e,i){if(e&1){let o=y();r(0,"div",1)(1,"div",2),v(2,"async"),r(3,"div",3),h(4,"sell-cart-header"),a()(),r(5,"div",4)(6,"div",5),h(7,"app-search-product"),a(),r(8,"div",6),h(9,"app-search-customer"),a()(),r(10,"div",7,0)(12,"div",8)(13,"div",9)(14,"sell-cart-body",10),_("eventAddItem",function(){return u(o),f(i.onEventAddItem())}),a()()()(),r(15,"div",11)(16,"div",12),h(17,"sell-cart-footer"),a()()()}e&2&&(m("ngClass",T(5,Cu,i.currentSubsStatus==i.subscriptionStatus.OVERDUE||i.currentSubsStatus==i.subscriptionStatus.SELL_ONLY)),s(),m("ngClass",T(7,_u,!M(2,3,i.isOnline$))),s(14),m("ngClass",T(9,hu,i.currentSubsStatus==i.subscriptionStatus.OVERDUE||i.currentSubsStatus==i.subscriptionStatus.SELL_ONLY)))},dependencies:[H,io,no,ro,lo,so,Ve],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 vu=n=>({"sell-subscription-overdue":n});function Su(n,t){n&1&&(r(0,"div",7)(1,"div",8),h(2,"sell-left-content"),a(),r(3,"div",9),h(4,"sell-cart"),a()())}function yu(n,t){if(n&1&&g(0,Su,5,0,"div",7),n&2){let e=c();C(e.posHttpResponse?0:-1)}}function xu(n,t){n&1&&(r(0,"div",2)(1,"div",10),h(2,"sell-complete"),a()())}function Mu(n,t){if(n&1&&h(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 Pu(n,t){if(n&1&&h(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 Ou(n,t){if(n&1&&h(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 Do=class n extends hr{constructor(e,i,o,l,b,V,J,ve,Be,je,mi,Ii,Di,At,ui,wo,po,ko,Ka,Ya,Iu,Du,wu,ku,Tu,Eu,Ru){super(po);this._localDataService=e;this.posService=i;this.outletService=o;this.route=l;this.signalRClientService=b;this.orderProcessorService=V;this.decimalPipe=J;this.paymentServiceGateway=ve;this.dialog=Be;this.toastr=je;this.parkOrderService=mi;this.userRoleService=Ii;this.receiptService=Di;this.orderHttpService=At;this.roleService=ui;this.intercomService=wo;this.authService=ko;this.ecrSignalRService=Ka;this.ecrStorage=Ya;this.router=Iu;this.onlineStatusService=Du;this.httpService=wu;this.promotionCouponProviderService=ku;this.promotionCouponService=Tu;this.cashMachineService=Eu;this.salesOrderService=Ru;this.destroy$=new q,this.currentSubsStatus=ko.getSubscriptionStatus(),(!ui.sell.Create&&!this.route.snapshot.queryParamMap.has("ID")||!ui.sell.Edit&&this.route.snapshot.queryParamMap.has("ID"))&&this.router.navigate(["/menu/Unauthorized/Main/Unauthorized"])}destroy$;sellState=Me;isOnline;posHttpResponse;currentState;receiptTemplate;isPrintBillMini=!1;isPrintBillA4=!1;isPrintPark=!1;outletRegister;appConfig;userRole;invoiceNumberEdit;currentSubsStatus;subscriptionStatus=qt;renderer=G(Ho);ngOnInit(){this.initialPage()}ngAfterViewInit(){let e=document.querySelector("#full-container");this.renderer.addClass(e,"full-container"),this.intercomService.hideLauncher()}initialPage(){this.menuData$.pipe(Re(()=>this.posService.requestObservable()),Ie(o=>{let l=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(),l){let b=this.route.snapshot?.queryParamMap?.get("ID");this.editInvoice(b)}else this.openModalConfirmContinueEdit(o.data.Registers,o.data.UserName);this.initializeRole(),this.ecrSignalRService.initEcrOnStartup(),this.cashMachineService.initCashMachineOnStartup()}),k(this.destroy$)).pipe(oe(o=>o.type=="Online"),et(o=>o.data),Re(o=>this._localDataService.syncPOSStorage(o))).pipe(k(this.destroy$)).subscribe()}onOpenDialogOfflineOrder(){No([this._localDataService.unsentOrders$.pipe(et(e=>e.length),jt(1)),this.onlineStatusService.getOnlineStatus$().pipe(jt(1))]).pipe(Re(([e,i])=>{let o=this.dialog.getDialogById("ModalOfflineOrder")?.id;return e>0&&i&&!o?this.dialog.open(pn,{disableClose:!0,id:"ModalOfflineOrder",data:{activeTab:"ORDER"}}).afterClosed():Ro}),jt(1)).subscribe()}showModalEmptySalesOrderTag(){this.posHttpResponse?.PoTypes?.length==0&&this.dialog.open(Hr,{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}),Ie(()=>{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:Ae.Error},width:"28rem"})}initializeRole(){let e=new jr(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 V=`IDR ${this.decimalPipe.transform(i.gross_amount)} received. Please verify in customer mobile app!`;this.toastr.success(V," 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(Yn).afterClosed().pipe(oe(o=>!S.IsEmpty(o))).subscribe(o=>{if(o==="CONTINUE_EDITING"){let l=this.salesOrderService.Data?.Order?.ID;this.router.navigate(["/menu/Sell"],{queryParams:{ID:l},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($),d(Zo),d(tr),d(U),d(Y),d(tn),d(ae),d(X),d(ke),d(de),d(Et),d(De),d(Mt),d(cr),d(vr),d(
|
|
57
|
-
`],encapsulation:2})}
|
|
56
|
+
`,headerType:Ae.Error},width:"28rem"})}initializeRole(){let e=new jr(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 V=`IDR ${this.decimalPipe.transform(i.gross_amount)} received. Please verify in customer mobile app!`;this.toastr.success(V," 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(Yn).afterClosed().pipe(oe(o=>!S.IsEmpty(o))).subscribe(o=>{if(o==="CONTINUE_EDITING"){let l=this.salesOrderService.Data?.Order?.ID;this.router.navigate(["/menu/Sell"],{queryParams:{ID:l},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($),d(Zo),d(tr),d(U),d(Y),d(tn),d(ae),d(X),d(ke),d(de),d(Et),d(De),d(Mt),d(cr),d(vr),d(Gt),d(wt),d(ln),d(xt),d(Je),d($e),d(Dt),d(Xe),d(kt),d(R))};static \u0275cmp=P({type:n,selectors:[["POS-sell-v3"]],features:[st([ke,Vt]),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&&(h(0,"subscription-alert",0),r(1,"div",1),g(2,yu,1,1)(3,xu,3,0,"div",2),a(),r(4,"div",3),g(5,Mu,1,4,"park-order",4),g(6,Pu,1,5,"POS-bill-receipt-A4",5),g(7,Ou,1,6,"pos-receipt",6),a()),i&2&&(s(),m("ngClass",T(5,vu,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:[re,H,Sn,eo,ua,co,wn,qe,It,an,rn,mn,na,ia,ta,ea,Tn,Dr,Oa],styles:[`.cart-background{background-color:#fcfdff}.sell-container{margin:0 auto!important;height:100%}.sell-container>.row{height:100%}.sell-container>.row>[class*=col-]{height:100%}.sell-container .quicky{overflow:hidden}.sell-subscription-overdue{height:calc(100vh - 3rem)!important;overflow-y:auto}.print_containers{display:none}@media print{.print_containers{display:block;text-align:left}.sell-subscription-overdue{height:auto!important;overflow-y:visible!important}}
|
|
57
|
+
`],encapsulation:2})},zy=[{path:"Offline",loadChildren:()=>import("./chunk-RWZGTR3S.js").then(n=>n.OfflineModule)},{path:"",loadComponent:()=>Do}];export{Do as SellV3Component,zy as routes};
|