dealpos 25.48.3 → 25.48.4
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-4VZ44DFH.js → chunk-335MTOI2.js} +1 -1
- package/browser/{chunk-ZX2PZLXX.js → chunk-3DSF6ERB.js} +1 -1
- package/browser/{chunk-YPG7NXW6.js → chunk-3R6XTRIS.js} +1 -1
- package/browser/{chunk-BFH7QECY.js → chunk-443UJP4E.js} +1 -1
- package/browser/{chunk-76HEQQHO.js → chunk-4CPJUJ5L.js} +1 -1
- package/browser/{chunk-FR45A6EK.js → chunk-4F7IU5IR.js} +1 -1
- package/browser/{chunk-O2SKATLU.js → chunk-4IBCJLJE.js} +1 -1
- package/browser/{chunk-ISNO6K5N.js → chunk-5THS2GXN.js} +1 -1
- package/browser/{chunk-VJJIUPEN.js → chunk-5VQTC5KM.js} +1 -1
- package/browser/{chunk-SRC3HH3O.js → chunk-6BXLBSVS.js} +1 -1
- package/browser/{chunk-4LPKNH7W.js → chunk-6GBUH4A7.js} +1 -1
- package/browser/{chunk-PMVUKT2P.js → chunk-73R34UN3.js} +1 -1
- package/browser/chunk-7BVPHIEF.js +1 -0
- package/browser/{chunk-N6QOUUEK.js → chunk-A2HQD76V.js} +1 -1
- package/browser/{chunk-7PWZYJQP.js → chunk-A2R2SRZS.js} +1 -1
- package/browser/{chunk-IYXZ6DM6.js → chunk-BYRR2B2X.js} +1 -1
- package/browser/{chunk-S43AJQWQ.js → chunk-CA34NNP2.js} +1 -1
- package/browser/{chunk-XNRJ3UHI.js → chunk-CKHIFDBW.js} +1 -1
- package/browser/{chunk-5BE4626O.js → chunk-COHKLV67.js} +1 -1
- package/browser/{chunk-UGA6CKWS.js → chunk-D45QKGTU.js} +1 -1
- package/browser/{chunk-MNEZCILO.js → chunk-DF4DHBHG.js} +1 -1
- package/browser/{chunk-JLJ6CCD3.js → chunk-DI4JWRN2.js} +1 -1
- package/browser/{chunk-57LTUNGL.js → chunk-DLRH3QKL.js} +1 -1
- package/browser/{chunk-YSM3FPZM.js → chunk-E42VMBXZ.js} +1 -1
- package/browser/{chunk-BDINGIQV.js → chunk-EPINMFAX.js} +1 -1
- package/browser/{chunk-WTAIDRV6.js → chunk-F2I7C3M3.js} +1 -1
- package/browser/{chunk-HE7N7GWE.js → chunk-FSSIO7GL.js} +1 -1
- package/browser/{chunk-5WC44KI7.js → chunk-FZCOVHS7.js} +1 -1
- package/browser/{chunk-VXOS2AWO.js → chunk-GAMK6E3M.js} +1 -1
- package/browser/{chunk-VG3PJFDU.js → chunk-GC6XKSVW.js} +2 -2
- package/browser/{chunk-RFRD7Y7N.js → chunk-GRT6SQUV.js} +1 -1
- package/browser/{chunk-GFZBO5RW.js → chunk-HAIP6P4F.js} +1 -1
- package/browser/{chunk-KU2O2EHB.js → chunk-HMEQKB3Z.js} +1 -1
- package/browser/{chunk-CJCEJIDM.js → chunk-HMXHET62.js} +1 -1
- package/browser/{chunk-MWJTE5VJ.js → chunk-HNGDEK6A.js} +1 -1
- package/browser/{chunk-O3R6FNX7.js → chunk-HNGOCAAQ.js} +1 -1
- package/browser/{chunk-O5A5DNRB.js → chunk-HSURS7A5.js} +1 -1
- package/browser/{chunk-C7XESRQV.js → chunk-JQQXPIW7.js} +1 -1
- package/browser/{chunk-C5DGBRES.js → chunk-JSYUX55K.js} +1 -1
- package/browser/{chunk-NXNTQNWD.js → chunk-K522UIWE.js} +1 -1
- package/browser/{chunk-G6XFCO2C.js → chunk-K6UBXXMV.js} +1 -1
- package/browser/{chunk-TYV6AS5A.js → chunk-KL7TZ4L3.js} +1 -1
- package/browser/{chunk-AY2G4OD6.js → chunk-KS4MCBAD.js} +1 -1
- package/browser/{chunk-7NB2JM2Z.js → chunk-KVYFWAXC.js} +1 -1
- package/browser/{chunk-NCSIYRDC.js → chunk-LOSZONX5.js} +1 -1
- package/browser/{chunk-3BIA7JJK.js → chunk-MBB74QVL.js} +1 -1
- package/browser/{chunk-DZPZK3FC.js → chunk-MSVDVTIV.js} +1 -1
- package/browser/{chunk-QVUZMITO.js → chunk-MTMXY32O.js} +1 -1
- package/browser/{chunk-CJJZ3NN6.js → chunk-MU6SCZAC.js} +1 -1
- package/browser/{chunk-WGOJUNBF.js → chunk-N5UL5CKI.js} +1 -1
- package/browser/{chunk-2YNPPAZH.js → chunk-NGBNFGPJ.js} +1 -1
- package/browser/{chunk-QGKX2IE5.js → chunk-NIA3RUK3.js} +1 -1
- package/browser/{chunk-SNEK2BS2.js → chunk-NIT4LLPE.js} +1 -1
- package/browser/{chunk-AOWEKBY6.js → chunk-OFSDKSGP.js} +1 -1
- package/browser/{chunk-LLYADZXM.js → chunk-OLKDSXBA.js} +1 -1
- package/browser/{chunk-VKFZNKM5.js → chunk-PFCZZYN7.js} +1 -1
- package/browser/{chunk-L5VX4XJU.js → chunk-QGWSDMHC.js} +1 -1
- package/browser/{chunk-3ALPLNFL.js → chunk-QQ2YQAKU.js} +1 -1
- package/browser/{chunk-Y3KLG6WD.js → chunk-QWGF65NY.js} +2 -2
- package/browser/{chunk-XQEJUVQP.js → chunk-QZ5KTZ5O.js} +1 -1
- package/browser/{chunk-KTPBLT2O.js → chunk-RF626YRZ.js} +1 -1
- package/browser/{chunk-QKNGNLDI.js → chunk-ROLD7LRS.js} +2 -2
- package/browser/{chunk-MVISUVLB.js → chunk-S7F2VAOO.js} +1 -1
- package/browser/{chunk-JDXKVQWT.js → chunk-SLOQCSJQ.js} +1 -1
- package/browser/{chunk-HQ574TNK.js → chunk-SZCBZJWT.js} +1 -1
- package/browser/{chunk-W2BNI7QT.js → chunk-T6O6272L.js} +2 -2
- package/browser/{chunk-YTQA4ZQ5.js → chunk-T7FNDCBZ.js} +1 -1
- package/browser/{chunk-Y6BFENML.js → chunk-TFTQPXT2.js} +1 -1
- package/browser/{chunk-JNZBO6JV.js → chunk-TNW4DJDF.js} +1 -1
- package/browser/{chunk-5ATOLSOU.js → chunk-TX4QVA3F.js} +1 -1
- package/browser/{chunk-WNAYJWEQ.js → chunk-U544TRDM.js} +1 -1
- package/browser/{chunk-I2VTAB36.js → chunk-V2R4WJOF.js} +1 -1
- package/browser/{chunk-WFN42V6H.js → chunk-VFQB2MVW.js} +1 -1
- package/browser/{chunk-4PJRRPIJ.js → chunk-W3TN26PX.js} +13 -13
- package/browser/{chunk-PVW5CNDF.js → chunk-WCIAQ44B.js} +2 -2
- package/browser/{chunk-NTC7KH7U.js → chunk-X2JPG7JJ.js} +1 -1
- package/browser/{chunk-CTYPZCCF.js → chunk-X7GD2PTG.js} +1 -1
- package/browser/{chunk-2RLL7E46.js → chunk-Y23YZCOK.js} +1 -1
- package/browser/{chunk-M2WWQMGM.js → chunk-Y2EBDHRL.js} +1 -1
- package/browser/{chunk-OUYWPXOM.js → chunk-Y4V2WEIH.js} +1 -1
- package/browser/{chunk-BD6OKJBW.js → chunk-Y54ES5RG.js} +1 -1
- package/browser/{chunk-DTOZS4FK.js → chunk-YXVOA736.js} +1 -1
- package/browser/{chunk-S6FFSXPE.js → chunk-ZCQ45ILW.js} +1 -1
- package/browser/{chunk-KZXFGU4G.js → chunk-ZH54LQDR.js} +2 -2
- package/browser/index.html +2 -2
- package/browser/{main-OHTLAVEH.js → main-33B7R4OS.js} +2 -2
- package/package.json +1 -1
- package/browser/chunk-CVNF5DNI.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-HMEQKB3Z.js";import"./chunk-NJIOGT5G.js";import"./chunk-443UJP4E.js";import"./chunk-32QBWLTN.js";import"./chunk-3RK6DDJD.js";import"./chunk-M3DKYPGC.js";import"./chunk-LNDHYAFW.js";import"./chunk-U544TRDM.js";import"./chunk-KZFNI67M.js";import"./chunk-4BXCIT62.js";import"./chunk-D4FCXEV4.js";import"./chunk-COHKLV67.js";import"./chunk-BYRR2B2X.js";import"./chunk-R2GUMKAU.js";import"./chunk-BT7NN7PT.js";import"./chunk-26YFRPR2.js";import"./chunk-JBS5UYZC.js";import"./chunk-TEGIL5RZ.js";import"./chunk-ZTD4APMR.js";import"./chunk-7P3L3ODB.js";import"./chunk-FU2ZGMX4.js";import"./chunk-2FWFPV5I.js";import"./chunk-SLX34TWD.js";import"./chunk-DWZ5JTI2.js";import"./chunk-TX4QVA3F.js";import"./chunk-ZCQ45ILW.js";import"./chunk-36GWLMZX.js";import"./chunk-YVBGB3JF.js";import"./chunk-WUV22SZ4.js";import"./chunk-JSYUX55K.js";import"./chunk-LGOSIAUC.js";import"./chunk-IEVGW2RT.js";import"./chunk-WFMAM73Y.js";import"./chunk-SNAKHGZS.js";export{a as SensitiveFieldComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Dt}from"./chunk-L6PKNRWO.js";import{b as kt}from"./chunk-SIQZO2WM.js";import{b as At,d as Pt,e as Nt}from"./chunk-
|
|
1
|
+
import{a as Dt}from"./chunk-L6PKNRWO.js";import{b as kt}from"./chunk-SIQZO2WM.js";import{b as At,d as Pt,e as Nt}from"./chunk-TFTQPXT2.js";import{a as Mt,b as Ft,c as Et,d as Lt,e as Bt}from"./chunk-7YUPYNWQ.js";import{a as wt}from"./chunk-QPAUI5EG.js";import{a as Vt}from"./chunk-45E6XCHN.js";import{b as Ot,c as Le}from"./chunk-COHKLV67.js";import{b as Tt}from"./chunk-R2GUMKAU.js";import{a as tt}from"./chunk-B7AC4RMR.js";import{a as vt,c as Ct,d as It}from"./chunk-S7FOJJP2.js";import{b as ct,c as ft,d as gt,e as bt,g as yt,j as xt,k as se,l as St}from"./chunk-FU2ZGMX4.js";import{A as lt,F as ot,T as at,V as z,W as Q,X as le,_ as oe,da as rt,fa as st,ka as pt,la as dt,ma as ut,na as mt,oa as _t,pa as ae,qa as re,w as ve,x as H,xa as ht,z as nt}from"./chunk-SLX34TWD.js";import{F as ne,a as ye,h as te,o as ie}from"./chunk-DWZ5JTI2.js";import{s as it}from"./chunk-LGOSIAUC.js";import{$ as Ne,$c as v,Ab as N,Ac as Ue,Ca as B,Fb as r,Fc as ge,Gb as _,Gc as be,Hb as h,Ia as Te,Ib as R,Lc as L,Mb as C,Nb as I,Ob as M,Oc as G,Pb as T,Pc as We,Sb as x,Sc as Ye,Tc as V,Ub as s,Vb as je,Wb as Me,Xa as c,Xb as S,Y as Pe,Ya as w,Yb as k,Za as $e,Zb as f,_b as g,aa as Re,ad as X,ca as He,cc as Y,d as Ie,dc as Ve,eb as _e,fa as de,fc as he,ga as ze,gc as y,gd as Ze,hc as E,ib as W,ic as A,id as Je,jb as qe,jc as fe,jd as Fe,ka as ue,la as me,ma as Qe,mb as we,mc as K,md as Xe,na as Oe,nb as Ge,nc as $,nd as Ee,o as Ae,oa as Ke,ob as p,oc as q,od as et,pa as F,t as pe,ta as u,ua as m,va as U,vd as ee,wb as O,wc as Z,xc as ke,yb as P,yc as D,zc as J}from"./chunk-IEVGW2RT.js";import{a as Be,b as De}from"./chunk-SNAKHGZS.js";var Rt=`
|
|
2
2
|
.p-multiselect {
|
|
3
3
|
display: inline-flex;
|
|
4
4
|
cursor: pointer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O,b as Ve}from"./chunk-PS7477UG.js";import"./chunk-GDRHD33K.js";import{c as Fe}from"./chunk-NSNUUKNK.js";import{c as Ee}from"./chunk-ZX2PZLXX.js";import"./chunk-L6PKNRWO.js";import"./chunk-SIQZO2WM.js";import{e as Oe,f as Pe}from"./chunk-WNAYJWEQ.js";import"./chunk-Y6BFENML.js";import"./chunk-7YUPYNWQ.js";import"./chunk-2CL5FM3P.js";import"./chunk-QPAUI5EG.js";import"./chunk-45E6XCHN.js";import"./chunk-SIDUUVNA.js";import"./chunk-5BE4626O.js";import{a as Te,b as ve}from"./chunk-IYXZ6DM6.js";import"./chunk-R2GUMKAU.js";import"./chunk-BT7NN7PT.js";import"./chunk-26YFRPR2.js";import{b as ye,c as Se}from"./chunk-JBS5UYZC.js";import{N as we}from"./chunk-TEGIL5RZ.js";import"./chunk-B7AC4RMR.js";import"./chunk-EQLHPWVB.js";import"./chunk-ZTD4APMR.js";import"./chunk-7P3L3ODB.js";import"./chunk-S7FOJJP2.js";import"./chunk-FU2ZGMX4.js";import"./chunk-2FWFPV5I.js";import"./chunk-SLX34TWD.js";import{F as xe,h as De,o as be}from"./chunk-DWZ5JTI2.js";import"./chunk-5ATOLSOU.js";import"./chunk-S6FFSXPE.js";import"./chunk-36GWLMZX.js";import{b as Z}from"./chunk-YVBGB3JF.js";import{a as fe}from"./chunk-WUV22SZ4.js";import"./chunk-C5DGBRES.js";import"./chunk-LGOSIAUC.js";import{$ as Y,Ab as u,Ac as he,Cb as de,Db as pe,Eb as ce,Fb as p,Fc as c,Gb as o,Gc as v,Ha as re,Hb as r,Hc as _,Ib as y,Lc as w,Ob as B,Pb as T,Qd as Ce,Sb as V,Sd as ge,Tc as ue,Ub as d,Xa as l,Y as P,Ya as le,aa as E,cc as g,eb as F,gd as j,hc as s,ib as A,ic as W,jc as C,kc as me,mb as se,mc as Q,nc as X,nd as L,ob as S,oc as ee,od as M,pb as k,qd as _e,sd as G,t as D,ta as b,tb as R,ua as x,ub as N,vd as $,wc as U,xc as f,yb as h,yc as I,zc as te}from"./chunk-IEVGW2RT.js";import"./chunk-WFMAM73Y.js";import{a as ne,b as oe}from"./chunk-SNAKHGZS.js";var H=class{Cost;Profit;Sales;SalesWithTax;Tax;Count;TopOutlet};var ae=t=>({"border-bottom":t}),ie=()=>["/menu/Reports/Sales_Report/Standard/Summary"],Be=(t,a,e)=>({From:t,To:a,ListIDs:e}),Le=t=>({today:t}),We=(t,a)=>({From:t,To:a});function $e(t,a){if(t&1){let e=T();o(0,"div",6)(1,"a",15),s(2),r(),o(3,"ul",16)(4,"li")(5,"a",17),V("click",function(){b(e);let n=d();return n.isTodayFilter=!n.isTodayFilter,x(n.onChangeFilterPeriod())}),s(6),r()()()()}if(t&2){let e=d();l(2),C(" ",e.isTodayFilter?"Today":"Last 7 Days"," "),l(),p("ngClass",I(3,Le,!e.isTodayFilter)),l(3),C(" ",e.isTodayFilter?"Last 7 Days":"Today"," ")}}function He(t,a){t&1&&(o(0,"span",7),s(1,"Today"),r())}function Ye(t,a){if(t&1&&(o(0,"div",18)(1,"a",9),c(2,"date"),c(3,"date"),o(4,"div",10),s(5,"Tax"),r(),o(6,"div",19)(7,"small",20),s(8),r(),o(9,"h2",11),s(10),c(11,"number"),r()()()(),o(12,"div",8)(13,"a",9),c(14,"date"),c(15,"date"),o(16,"div",10),s(17,"Sales + Tax"),r(),o(18,"div",19)(19,"small",20),s(20),r(),o(21,"h2",11),s(22),c(23,"number"),r()()()()),t&2){let e=d();l(),p("routerLink",f(27,ie))("queryParams",te(28,We,_(2,9,e.isTodayFilter?e.today:e.chartData==null?null:e.chartData.From,"yyyy-MM-dd"),_(3,12,e.isTodayFilter?e.today:e.dateTo,"yyyy-MM-dd"))),l(7),C(" ",e.dashboardConfig==null?null:e.dashboardConfig.CurrencySymbol," "),l(2),C(" ",_(11,15,e.salesData==null?null:e.salesData.Tax,"1.0-0")," "),l(2),p("ngClass",I(31,ae,e.role.product.Cost)),l(),p("routerLink",f(33,ie))("queryParams",te(34,We,_(14,18,e.isTodayFilter?e.today:e.chartData==null?null:e.chartData.From,"yyyy-MM-dd"),_(15,21,e.isTodayFilter?e.today:e.dateTo,"yyyy-MM-dd"))),l(7),C(" ",e.dashboardConfig==null?null:e.dashboardConfig.CurrencySymbol," "),l(2),C(" ",_(23,24,e.salesData==null?null:e.salesData.SalesWithTax,"1.0-0")," ")}}function Ue(t,a){if(t&1&&(o(0,"div",8)(1,"div")(2,"div",21),s(3,"Cost"),r(),o(4,"div",19)(5,"small",20),s(6),r(),o(7,"h2",11),s(8),c(9,"number"),r()()()()),t&2){let e=d();p("ngClass",I(6,ae,e.role.report.Profit)),l(6),C(" ",e.dashboardConfig==null?null:e.dashboardConfig.CurrencySymbol," "),l(2),C(" ",_(9,3,e.salesData==null?null:e.salesData.Cost,"1.0-0")," ")}}function je(t,a){if(t&1&&(o(0,"div",12)(1,"div")(2,"div",22),s(3),r(),o(4,"div",23)(5,"small",20),s(6),r(),o(7,"h2",11),s(8),c(9,"number"),r()()()()),t&2){let e=d();l(3),C(" ",e.includeTax?"Gross Profit":"Profit"," "),l(3),C(" ",e.dashboardConfig==null?null:e.dashboardConfig.CurrencySymbol," "),l(2),C(" ",_(9,3,e.salesData==null?null:e.salesData.Profit,"1.0-0")," ")}}var K=class t{constructor(a,e){this.dashboardService=a;this.role=e;this.chartConfig=this.dashboardService.getLineChartConfig()}chartData;salesData;dashboardConfig;filterSalesWidget=new le;chartConfig;todaySalesData;weeklySalesData;isTodayFilter=!0;showPeriodFilter;includeTax;today=new Date;dateTo;filterByOutletIds=ue([]);ngOnChanges(a){if(a.chartData&&a.chartData.currentValue){this.initSalesData();let e=a?.chartData?.currentValue?.Series;e=this.setChartLineColor(e),e=this.setSalesTaxLegend(e),this.chartConfig=oe(ne({},this.chartConfig),{series:e}),this.chartConfig=this.dashboardService.setSeriesPointStart(this.chartData.From,this.chartConfig),this.initPeriodFilter(e),this.getDateTo()}}initPeriodFilter(a){this.showPeriodFilter=a[0]?.data?.length>=7}initSalesData(){this.salesData=new H,this.includeTax=this.isIncludeTax(),this.salesData.Sales=this.dashboardService.getTotalData("Sales",this.chartData.Series,1),this.salesData.SalesWithTax=this.dashboardService.getTotalData("Sales + Tax",this.chartData.Series,1),this.salesData.Cost=this.dashboardService.getTotalData("Cost",this.chartData.Series,1),this.salesData.Tax=this.salesData.SalesWithTax-this.salesData.Sales,this.salesData.Profit=(this.includeTax?this.salesData.SalesWithTax:this.salesData.Sales)-this.salesData.Cost,this.salesData.Count=this.dashboardService.getTotalData("Count",this.chartData.Series,1),this.todaySalesData=Fe(H,this.salesData)}setChartLineColor(a=[]){return a?.map(e=>(e.name=="Sales"&&(e.color="rgb(44, 175, 254)",e.fillColor=this.dashboardService.getLinierGradient("rgb(44, 175, 254)")),e.name=="Cost"&&(e.color="#fb404b",e.fillColor=this.dashboardService.getLinierGradient("#fb404b")),e.name=="Sales + Tax"&&(e.color="#2ECC71",e.fillColor=this.dashboardService.getLinierGradient("#2ECC71")),e))}onChangeFilterPeriod(){this.isTodayFilter?this.salesData=this.todaySalesData:(this.generateWeeklySalesData(),this.salesData=this.weeklySalesData),this.filterSalesWidget.emit({period:this.isTodayFilter?"TODAY":"WEEKLY"})}getDateTo(){let a=new Date,e=new Date(this.chartData.From);a.setDate(e.getDate()+7),this.dateTo=a}generateWeeklySalesData(){if(fe.IsEmpty(this.weeklySalesData)){let a=this.dashboardService.getTotalData("Sales",this.chartData.Series,7),e=this.dashboardService.getTotalData("Sales + Tax",this.chartData.Series,7),i=this.dashboardService.getTotalData("Cost",this.chartData.Series,7),n=this.dashboardService.getTotalData("Count",this.chartData.Series,7),m=e-a,z=(this.includeTax?e:a)-i;this.weeklySalesData=this.weeklySalesData?this.weeklySalesData:new H,this.weeklySalesData.Sales=a,this.weeklySalesData.SalesWithTax=e,this.weeklySalesData.Cost=i,this.weeklySalesData.Profit=z,this.weeklySalesData.Tax=m,this.weeklySalesData.Count=n}}isIncludeTax(){let a=this.chartData.Series;return this.dashboardService.filterSeriesByName("Sales + Tax",a).visible}setSalesTaxLegend(a){return a=a.map(e=>(e.name=="Sales + Tax"&&(e.showInLegend=this.salesData.Tax>0),e)),a}static \u0275fac=function(e){return new(e||t)(F(O),F(Z))};static \u0275cmp=A({type:t,selectors:[["app-sales-widget"]],inputs:{chartData:"chartData",dashboardConfig:"dashboardConfig",filterByOutletIds:[1,"filterByOutletIds"]},outputs:{filterSalesWidget:"onFilter"},features:[U([O]),re],decls:25,vars:30,consts:[[1,"d-flex","flex-row","flex-wrap","mt-8","justify-content-between"],[1,"chart-widget"],["containerId","salesChart",3,"config"],[1,"sales-card-widget"],[1,"border","rounded","rounded-bottom-0","px-8","py-4","w-100","h-auto"],[1,"border-bottom","d-flex","align-items-center","justify-content-end",2,"height","42px"],[1,"btn-group"],[1,"link-dark","fs-2","headings-font-family"],[1,"text-end","card-row","d-flex","align-items-center","justify-content-end",3,"ngClass"],["target","_blank",1,"link-dark",3,"routerLink","queryParams"],[1,"fs-5"],[1,"fw-normal"],[1,"text-end","d-flex","align-items-center","justify-content-end","card-row"],[1,"card-footer","border","rounded-bottom","border-top-0","text-end","p-3"],["routerLink","/menu/Setup/Configuration/Application"],["type","button","data-bs-toggle","dropdown","aria-expanded","false",1,"dropdown-toggle","link-dark","fs-2","headings-font-family"],[1,"dropdown-menu","p-0",2,"position","absolute","right","20px !important",3,"ngClass"],["role","button",1,"dropdown-item","fs-4",3,"click"],[1,"text-end","border-bottom","card-row","d-flex","align-items-center","justify-content-end"],[1,"d-flex","align-items-center","justify-content-end"],[1,"me-2"],[1,"fs-5","text-danger"],[1,"fs-5","text-success"],[1,"d-flex","align-items-center"]],template:function(e,i){e&1&&(o(0,"div",0)(1,"div",1),y(2,"app-chart-container",2),r(),o(3,"div",3)(4,"div",4)(5,"div",5),h(6,$e,7,5,"div",6)(7,He,2,0,"span",7),r(),o(8,"div",8)(9,"a",9),c(10,"date"),c(11,"date"),o(12,"div",10),s(13,"Order"),r(),o(14,"h2",11),s(15),c(16,"number"),r()()(),h(17,Ye,24,37),h(18,Ue,10,8,"div",8),h(19,je,10,6,"div",12),r(),o(20,"div",13)(21,"a",14)(22,"small"),s(23),c(24,"date"),r()()()()()),e&2&&(l(2),p("config",i.chartConfig),l(4),u(!(i.role==null||i.role.dashboard==null)&&i.role.dashboard.View&&i.showPeriodFilter?6:7),l(2),p("ngClass",I(23,ae,(i.salesData==null?null:i.salesData.Tax)||i.role.product.Cost)),l(),p("routerLink",f(25,ie))("queryParams",he(26,Be,_(10,11,i.isTodayFilter?i.today:i.chartData==null?null:i.chartData.From,"yyyy-MM-dd"),_(11,14,i.isTodayFilter?i.today:i.dateTo,"yyyy-MM-dd"),i.filterByOutletIds())),l(6),W(_(16,17,i.salesData==null?null:i.salesData.Count,"1.0-0")),l(2),u((i.salesData==null?null:i.salesData.Tax)>0?17:-1),l(),u(i.role.product.Cost?18:-1),l(),u(i.role.report.Profit&&i.role.product.Cost?19:-1),l(4),me("",_(24,20,i.dashboardConfig==null?null:i.dashboardConfig.SpanConfigTime,"dd MMM HH:mm")," ",i.dashboardConfig==null?null:i.dashboardConfig.SmallTimeZone))},dependencies:[$,j,Ve,ge,Ce,we,G,_e],styles:[".chart-widget[_ngcontent-%COMP%]{width:80%}.link-dark[_ngcontent-%COMP%]{color:#333!important}.dropdown-menu.show.today[_ngcontent-%COMP%]{inset:0 auto auto -34px!important}.sales-card-widget[_ngcontent-%COMP%]{width:19%}.sales-card-widget[_ngcontent-%COMP%] .card-row[_ngcontent-%COMP%]{height:64px}@media only screen and (max-width: 767px){.chart-widget[_ngcontent-%COMP%]{width:100%}.sales-card-widget[_ngcontent-%COMP%]{width:100%;margin-top:12px}}@media only screen and (min-width: 768px) and (max-width: 991px){.chart-widget[_ngcontent-%COMP%]{width:100%}.sales-card-widget[_ngcontent-%COMP%]{width:100%;margin-top:12px}}"]})};var Ge=t=>({active:t});function Ze(t,a){if(t&1&&(o(0,"div",1),s(1),r(),o(2,"div",2)(3,"small",3),s(4),r(),o(5,"h2",4),s(6),r()()),t&2){let e=d();l(),W(e.title),l(3),W(e.currencySymbol),l(2),W(e.value)}}function Ke(t,a){if(t&1&&(o(0,"div",1),s(1),r(),o(2,"h2",4),s(3,"-"),r()),t&2){let e=d();l(),W(e.title)}}var q=class t{title;isActive;currencySymbol;value;showValue;constructor(){}ngOnInit(){}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=A({type:t,selectors:[["app-card-widget"]],inputs:{title:"title",isActive:"isActive",currencySymbol:"currencySymbol",value:"value",showValue:"showValue"},decls:3,vars:4,consts:[[1,"card-widget","pe-0",3,"ngClass"],[1,"fs-4","headings-font-family"],[1,"d-flex","justify-content-start","align-items-center"],[1,"fw-normal","me-2"],[1,"fw-normal"]],template:function(e,i){e&1&&(o(0,"div",0),h(1,Ze,7,3)(2,Ke,4,1),r()),e&2&&(p("ngClass",I(2,Ge,i.isActive)),l(),u(i.showValue?1:2))},dependencies:[$,j],styles:[".card-widget[_ngcontent-%COMP%]{padding:20px;border-radius:6px;min-height:95px;border:.5px solid #e4e4e4;width:100%}.active[_ngcontent-%COMP%]{background-color:#f0f0f0}@media only screen and (max-width: 767px){.card-widget[_ngcontent-%COMP%]{width:200px}}@media only screen and (min-width: 768px) and (max-width: 991px){.card-widget[_ngcontent-%COMP%]{width:200px}}"]})};var qe=()=>[L,import("./chunk-UIIVXERD.js").then(t=>t.PaymentWidgetComponent),M],ze=()=>[L,import("./chunk-3CSCTT6I.js").then(t=>t.PurchaseWidgetComponent),M],Je=()=>[L,import("./chunk-PQ6W7KXC.js").then(t=>t.DebtWidgetComponent),M],Qe=()=>[L,import("./chunk-2MPRVJXH.js").then(t=>t.ProductWidgetComponent),M],Xe=()=>[L,import("./chunk-WM2DGNWH.js").then(t=>t.InventoryWidgetComponent),M],et=()=>({role:"Payment View Role"}),tt=()=>({role:"Buy Report Role"}),it=()=>({role:"Debt View Role"}),at=()=>({role:"Report View Role"}),nt=()=>({role:"Inventory View Role"});function ot(t,a){if(t&1){let e=T();o(0,"div",13)(1,"h6"),s(2,"Outlet"),r(),o(3,"outlet-selector",14),ee("ngModelChange",function(n){b(e);let m=d();return X(m.dashboardFilter.Outlets,n)||(m.dashboardFilter.Outlets=n),x(n)}),r()()}if(t&2){let e=d();l(3),p("multiple",!0)("accessType",e.outletAccess),Q("ngModel",e.dashboardFilter.Outlets)}}function rt(t,a){if(t&1){let e=T();o(0,"div",19),V("click",function(){let n=b(e).$implicit,m=d(2);return x(m.onClickCardWidget(n))}),y(1,"app-card-widget",20),c(2,"number"),r()}if(t&2){let e=a.$implicit,i=d(),n=d();l(),p("title",e.title)("matTooltip",e.tooltip)("currencySymbol",i==null||i.ConfigData==null?null:i.ConfigData.CurrencySymbol)("value",e.value==null?"-":_(2,6,e.value,"1.0-0"))("showValue",e.showValue)("isActive",e.id==n.activeTab)}}function lt(t,a){if(t&1){let e=T();o(0,"app-sales-widget",21),V("onFilter",function(n){b(e);let m=d(2);return x(m.onFilterSalesWidget(n))}),r()}if(t&2){let e=d(),i=d();p("dashboardConfig",e==null?null:e.ConfigData)("chartData",e==null?null:e.HighChartData)("filterByOutletIds",i.dashboardFilter.Outlets)}}function st(t,a){t&1&&B(0)}function dt(t,a){if(t&1){let e=T();o(0,"app-payment-widget",23),c(1,"async"),V("onFilter",function(n){b(e);let m=d(4);return x(m.onFilterPaymentWidget(n))}),r()}if(t&2){let e,i=d(3),n=d();p("dashboardConfig",i==null?null:i.ConfigData)("chartData",(e=v(1,2,n.paymentData$))==null?null:e.Data)}}function pt(t,a){if(t&1&&S(0,st,1,0,"ng-container",22)(1,dt,2,4,"ng-template",null,2,w),t&2){let e=g(2),i=d(3),n=g(12);p("ngTemplateOutlet",i.role.payment.View?e:n)("ngTemplateOutletContext",f(2,et))}}function ct(t,a){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function mt(t,a){t&1&&(k(0,pt,3,3)(1,ct,2,0),R(2,0,qe,null,1),N(0,-1))}function ht(t,a){t&1&&B(0)}function ut(t,a){if(t&1&&(y(0,"app-purchase-widget",18),c(1,"async")),t&2){let e,i=d(3),n=d();p("dashboardConfig",i==null?null:i.ConfigData)("chartData",(e=v(1,3,n.purchaseData$))==null?null:e.HighChartData)("filterByOutletIds",n.dashboardFilter.Outlets)}}function _t(t,a){if(t&1&&S(0,ht,1,0,"ng-container",22)(1,ut,2,5,"ng-template",null,3,w),t&2){let e=g(2),i=d(3),n=g(12);p("ngTemplateOutlet",i.role.buy.Report?e:n)("ngTemplateOutletContext",f(2,tt))}}function Ct(t,a){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function gt(t,a){t&1&&(k(0,_t,3,3)(1,Ct,2,0),R(2,0,ze,null,1),N(0,-1))}function ft(t,a){t&1&&B(0)}function Dt(t,a){if(t&1&&(y(0,"app-debt-widget",25),c(1,"async")),t&2){let e,i=d(3),n=d();p("dashboardConfig",i==null?null:i.ConfigData)("debtData",(e=v(1,2,n.debtData$))==null?null:e.PageData)}}function bt(t,a){if(t&1&&S(0,ft,1,0,"ng-container",22)(1,Dt,2,4,"ng-template",null,4,w),t&2){let e=g(2),i=d(3),n=g(12);p("ngTemplateOutlet",i.role.debt.View?e:n)("ngTemplateOutletContext",f(2,it))}}function xt(t,a){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function yt(t,a){t&1&&(k(0,bt,3,3)(1,xt,2,0),R(2,0,Je,null,1),N(0,-1))}function St(t,a){t&1&&B(0)}function Tt(t,a){if(t&1&&(y(0,"app-product-widget",26),c(1,"async")),t&2){let e,i=d(3),n=d();p("dashboardConfig",i==null?null:i.ConfigData)("productData",(e=v(1,2,n.productData$))==null?null:e.PageData)}}function vt(t,a){if(t&1&&S(0,St,1,0,"ng-container",22)(1,Tt,2,4,"ng-template",null,5,w),t&2){let e=g(2),i=d(3),n=g(12);p("ngTemplateOutlet",i.role.report.View?e:n)("ngTemplateOutletContext",f(2,at))}}function wt(t,a){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function Ot(t,a){t&1&&(k(0,vt,3,3)(1,wt,2,0),R(2,0,Qe,null,1),N(0,-1))}function Pt(t,a){t&1&&B(0)}function Et(t,a){if(t&1&&(y(0,"app-inventory-widget",27),c(1,"async")),t&2){let e,i=d(3),n=d();p("dashboardConfig",i==null?null:i.ConfigData)("inventoryData",(e=v(1,2,n.inventoryData$))==null?null:e.PageData)}}function Ft(t,a){if(t&1&&S(0,Pt,1,0,"ng-container",22)(1,Et,2,4,"ng-template",null,6,w),t&2){let e=g(2),i=d(3),n=g(12);p("ngTemplateOutlet",i.role.inventory.View?e:n)("ngTemplateOutletContext",f(2,nt))}}function Vt(t,a){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function Wt(t,a){t&1&&(k(0,Ft,3,3)(1,Vt,2,0),R(2,0,Xe,null,1),N(0,-1))}function It(t,a){if(t&1&&(o(0,"div",12)(1,"div",15)(2,"div",16),pe(3,rt,3,9,"div",17,de),c(5,"async"),r(),h(6,lt,1,3,"app-sales-widget",18),h(7,mt,4,0),h(8,gt,4,0),h(9,yt,4,0),h(10,Ot,4,0),h(11,Wt,4,0),r()()),t&2){let e=d();l(3),ce(v(5,6,e.cardWidget$)),l(3),u(e.activeTab=="SALES"?6:-1),l(),u(e.activeTab=="PAYMENT"?7:-1),l(),u(e.activeTab=="PURCHASE"?8:-1),l(),u(e.activeTab=="DEBT"?9:-1),l(),u(e.activeTab=="PRODUCT"?10:-1),l(),u(e.activeTab=="INVENTORY"?11:-1)}}function Mt(t,a){if(t&1&&(o(0,"div",24)(1,"div",28)(2,"div"),y(3,"img",29),r(),o(4,"h1",30),s(5,"You are not authorized"),r(),o(6,"p"),s(7," This page requires role "),o(8,"span",31),s(9),r(),s(10," to be accessed. Please contact your Administrator to gain access! "),r()()()),t&2){let e=a.role;l(9),C("[",e,"]")}}var ke=class t extends Te{constructor(e,i,n){super(e);this.dashboardService=i;this.role=n;this.menuData$.subscribe(),this.initSalesData(),this.initCardWidget(),this.initPaymentData(),this.initPurchaseData(),this.initInventoryData(),this.initDebtData(),this.initProductData()}cardWidget$;outletAccess=2;dashboardFilter={Outlets:[]};salesData$;paymentData$;purchaseData$;debtData$;productData$;inventoryData$;activeTab="SALES";initSalesData(){this.salesData$=this.dashboardService.getDashboardSales(this.dashboardFilter).pipe(P(1))}initPaymentData(){this.paymentData$=this.dashboardService.getDashboardPayment(this.dashboardFilter).pipe(P(1))}initPurchaseData(){this.purchaseData$=this.dashboardService.getDashboardPurchase(this.dashboardFilter).pipe(P(1))}initDebtData(){this.debtData$=this.dashboardService.getDashboardDebt(this.dashboardFilter).pipe(P(1))}initProductData(){this.productData$=this.dashboardService.getDashboardProduct(this.dashboardFilter).pipe(P(1))}initInventoryData(){this.inventoryData$=this.dashboardService.getDashboardInventory(this.dashboardFilter).pipe(P(1))}initCardWidget(){switch(this.activeTab){case"SALES":this.cardWidget$=this.salesData$.pipe(D(e=>this.dashboardService.getTotalData("Sales",e.HighChartData.Series,1)),Y(0),E(e=>this.dashboardService.setWidgetData(e,this.activeTab)));break;case"PAYMENT":this.cardWidget$=this.paymentData$.pipe(D(e=>this.dashboardService.getTotalData("All",e.Data.Series,1)),Y(0),E(e=>this.dashboardService.setWidgetData(e,this.activeTab)));break;case"PURCHASE":this.cardWidget$=this.purchaseData$.pipe(D(e=>this.dashboardService.getTotalData("Purchase",e.HighChartData.Series,1)),Y(0),E(e=>this.dashboardService.setWidgetData(e,this.activeTab)));break;case"DEBT":this.cardWidget$=this.debtData$.pipe(D(e=>e.PageData.Receivable),Y(0),E(e=>this.dashboardService.setWidgetData(e,this.activeTab)));break}}onFilterByOutlet(){switch(this.activeTab){case"SALES":this.initSalesData(),this.initCardWidget();break;case"PURCHASE":this.initPurchaseData(),this.initCardWidget();break;case"DEBT":this.initDebtData(),this.initCardWidget();break;case"PRODUCT":this.initProductData();break;case"INVENTORY":this.initInventoryData();break;case"PAYMENT":this.initPaymentData();break}}onClickCardWidget(e){this.activeTab=e.id,this.initCardWidget()}onFilterSalesWidget(e){this.cardWidget$=this.salesData$.pipe(D(i=>e.period=="WEEKLY"?this.dashboardService.getTotalData("Sales",i.HighChartData.Series,7):this.dashboardService.getTotalData("Sales",i.HighChartData.Series,1)),E(i=>(this.dashboardService.setWidgetData(i,"SALES"),this.dashboardService.widgets$)),D(i=>i.map(n=>(n.id=="SALES"&&(n.tooltip=e.period=="TODAY"?"Total Sales Today":"Total Sales last 7 days"),n))))}onFilterPaymentWidget(e){this.cardWidget$=this.paymentData$.pipe(D(i=>e.period=="WEEKLY"?this.dashboardService.getTotalData("All",i.Data.Series,7):this.dashboardService.getTotalData("All",i.Data.Series,1)),E(i=>(this.dashboardService.setWidgetData(i,"PAYMENT"),this.dashboardService.widgets$)),D(i=>i.map(n=>(n.id=="PAYMENT"&&(n.tooltip=e.period=="TODAY"?"Total Payment Today":"Total Payment last 7 days"),n))))}static \u0275fac=function(i){return new(i||t)(F(ve),F(O),F(Z))};static \u0275cmp=A({type:t,selectors:[["POS-dashboard-v2"]],features:[U([O]),se],decls:13,vars:7,consts:[["pageFilterTemplate",""],["NOT_AUTHORIZED",""],["PAYMENT",""],["BUY",""],["DEBT",""],["PRODUCT",""],["INVENTORY",""],[3,"onSubmit","filterChange","hideSearchBox","pageData","isFilterOnDropdown","filter"],[1,"content"],[1,"container-fluid","bg-light-gray","p-8"],[1,"row"],[1,"col-12"],[1,"card","mb-0"],[1,"dialog-filter"],["appendTo","body","placeholder","Select Outlets",3,"ngModelChange","multiple","accessType","ngModel"],[1,"card-body"],[1,"d-flex","flex-row","flex-nowrap","justify-content-between","align-items-center","overflow-auto",2,"column-gap","18px"],[1,"cursor-pointer","card-widget-tab"],[3,"dashboardConfig","chartData","filterByOutletIds"],[1,"cursor-pointer","card-widget-tab",3,"click"],["matTooltipPosition","above",3,"title","matTooltip","currencySymbol","value","showValue","isActive"],[3,"onFilter","dashboardConfig","chartData","filterByOutletIds"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"onFilter","dashboardConfig","chartData"],[1,"d-flex","align-items-center","justify-content-center","mt-8",2,"height","350px"],[3,"dashboardConfig","debtData"],[3,"dashboardConfig","productData"],[3,"dashboardConfig","inventoryData"],[1,"text-center"],["src","https://cdn.dealpos.xyz/web-image/locked.svg",2,"width","160px"],[1,"mt-2","mb-6"],[1,"fw-bold"]],template:function(i,n){if(i&1){let m=T();o(0,"mainpanel-cmp",7),V("onSubmit",function(){return b(m),x(n.onFilterByOutlet())}),ee("filterChange",function(J){return b(m),X(n.dashboardFilter,J)||(n.dashboardFilter=J),x(J)}),o(1,"filters"),S(2,ot,4,3,"ng-template",null,0,w),r(),o(4,"content")(5,"div",8)(6,"div",9)(7,"div",10)(8,"div",11),h(9,It,12,8,"div",12),c(10,"async"),r()()()()()(),S(11,Mt,11,1,"ng-template",null,1,w)}if(i&2){let m;p("hideSearchBox",!0)("pageData",n.menuData)("isFilterOnDropdown",!1),Q("filter",n.dashboardFilter),l(9),u((m=v(10,5,n.salesData$))?9:-1,m)}},dependencies:[$,Pe,Oe,xe,De,be,K,q,Ee,Se,ye,M,G],styles:[".card-widget-tab[_ngcontent-%COMP%]{flex:1 1 0px}@media only screen and (max-width: 767px){.card-widget-tab[_ngcontent-%COMP%]{margin-right:1rem;margin-top:.5rem;width:auto}}@media only screen and (min-width: 768px) and (max-width: 991px){.card-widget-tab[_ngcontent-%COMP%]{margin-right:1rem;margin-top:.5rem;width:auto}}"]})};export{ke as DashboardV2Component};
|
|
1
|
+
import{a as O,b as Ve}from"./chunk-PS7477UG.js";import"./chunk-GDRHD33K.js";import{c as Fe}from"./chunk-NSNUUKNK.js";import{c as Ee}from"./chunk-3DSF6ERB.js";import"./chunk-L6PKNRWO.js";import"./chunk-SIQZO2WM.js";import{e as Oe,f as Pe}from"./chunk-U544TRDM.js";import"./chunk-TFTQPXT2.js";import"./chunk-7YUPYNWQ.js";import"./chunk-2CL5FM3P.js";import"./chunk-QPAUI5EG.js";import"./chunk-45E6XCHN.js";import"./chunk-SIDUUVNA.js";import"./chunk-COHKLV67.js";import{a as Te,b as ve}from"./chunk-BYRR2B2X.js";import"./chunk-R2GUMKAU.js";import"./chunk-BT7NN7PT.js";import"./chunk-26YFRPR2.js";import{b as ye,c as Se}from"./chunk-JBS5UYZC.js";import{N as we}from"./chunk-TEGIL5RZ.js";import"./chunk-B7AC4RMR.js";import"./chunk-EQLHPWVB.js";import"./chunk-ZTD4APMR.js";import"./chunk-7P3L3ODB.js";import"./chunk-S7FOJJP2.js";import"./chunk-FU2ZGMX4.js";import"./chunk-2FWFPV5I.js";import"./chunk-SLX34TWD.js";import{F as xe,h as De,o as be}from"./chunk-DWZ5JTI2.js";import"./chunk-TX4QVA3F.js";import"./chunk-ZCQ45ILW.js";import"./chunk-36GWLMZX.js";import{b as Z}from"./chunk-YVBGB3JF.js";import{a as fe}from"./chunk-WUV22SZ4.js";import"./chunk-JSYUX55K.js";import"./chunk-LGOSIAUC.js";import{$ as Y,Ab as u,Ac as he,Cb as de,Db as pe,Eb as ce,Fb as p,Fc as c,Gb as o,Gc as v,Ha as re,Hb as r,Hc as _,Ib as y,Lc as w,Ob as B,Pb as T,Qd as Ce,Sb as V,Sd as ge,Tc as ue,Ub as d,Xa as l,Y as P,Ya as le,aa as E,cc as g,eb as F,gd as j,hc as s,ib as A,ic as W,jc as C,kc as me,mb as se,mc as Q,nc as X,nd as L,ob as S,oc as ee,od as M,pb as k,qd as _e,sd as G,t as D,ta as b,tb as R,ua as x,ub as N,vd as $,wc as U,xc as f,yb as h,yc as I,zc as te}from"./chunk-IEVGW2RT.js";import"./chunk-WFMAM73Y.js";import{a as ne,b as oe}from"./chunk-SNAKHGZS.js";var H=class{Cost;Profit;Sales;SalesWithTax;Tax;Count;TopOutlet};var ae=t=>({"border-bottom":t}),ie=()=>["/menu/Reports/Sales_Report/Standard/Summary"],Be=(t,a,e)=>({From:t,To:a,ListIDs:e}),Le=t=>({today:t}),We=(t,a)=>({From:t,To:a});function $e(t,a){if(t&1){let e=T();o(0,"div",6)(1,"a",15),s(2),r(),o(3,"ul",16)(4,"li")(5,"a",17),V("click",function(){b(e);let n=d();return n.isTodayFilter=!n.isTodayFilter,x(n.onChangeFilterPeriod())}),s(6),r()()()()}if(t&2){let e=d();l(2),C(" ",e.isTodayFilter?"Today":"Last 7 Days"," "),l(),p("ngClass",I(3,Le,!e.isTodayFilter)),l(3),C(" ",e.isTodayFilter?"Last 7 Days":"Today"," ")}}function He(t,a){t&1&&(o(0,"span",7),s(1,"Today"),r())}function Ye(t,a){if(t&1&&(o(0,"div",18)(1,"a",9),c(2,"date"),c(3,"date"),o(4,"div",10),s(5,"Tax"),r(),o(6,"div",19)(7,"small",20),s(8),r(),o(9,"h2",11),s(10),c(11,"number"),r()()()(),o(12,"div",8)(13,"a",9),c(14,"date"),c(15,"date"),o(16,"div",10),s(17,"Sales + Tax"),r(),o(18,"div",19)(19,"small",20),s(20),r(),o(21,"h2",11),s(22),c(23,"number"),r()()()()),t&2){let e=d();l(),p("routerLink",f(27,ie))("queryParams",te(28,We,_(2,9,e.isTodayFilter?e.today:e.chartData==null?null:e.chartData.From,"yyyy-MM-dd"),_(3,12,e.isTodayFilter?e.today:e.dateTo,"yyyy-MM-dd"))),l(7),C(" ",e.dashboardConfig==null?null:e.dashboardConfig.CurrencySymbol," "),l(2),C(" ",_(11,15,e.salesData==null?null:e.salesData.Tax,"1.0-0")," "),l(2),p("ngClass",I(31,ae,e.role.product.Cost)),l(),p("routerLink",f(33,ie))("queryParams",te(34,We,_(14,18,e.isTodayFilter?e.today:e.chartData==null?null:e.chartData.From,"yyyy-MM-dd"),_(15,21,e.isTodayFilter?e.today:e.dateTo,"yyyy-MM-dd"))),l(7),C(" ",e.dashboardConfig==null?null:e.dashboardConfig.CurrencySymbol," "),l(2),C(" ",_(23,24,e.salesData==null?null:e.salesData.SalesWithTax,"1.0-0")," ")}}function Ue(t,a){if(t&1&&(o(0,"div",8)(1,"div")(2,"div",21),s(3,"Cost"),r(),o(4,"div",19)(5,"small",20),s(6),r(),o(7,"h2",11),s(8),c(9,"number"),r()()()()),t&2){let e=d();p("ngClass",I(6,ae,e.role.report.Profit)),l(6),C(" ",e.dashboardConfig==null?null:e.dashboardConfig.CurrencySymbol," "),l(2),C(" ",_(9,3,e.salesData==null?null:e.salesData.Cost,"1.0-0")," ")}}function je(t,a){if(t&1&&(o(0,"div",12)(1,"div")(2,"div",22),s(3),r(),o(4,"div",23)(5,"small",20),s(6),r(),o(7,"h2",11),s(8),c(9,"number"),r()()()()),t&2){let e=d();l(3),C(" ",e.includeTax?"Gross Profit":"Profit"," "),l(3),C(" ",e.dashboardConfig==null?null:e.dashboardConfig.CurrencySymbol," "),l(2),C(" ",_(9,3,e.salesData==null?null:e.salesData.Profit,"1.0-0")," ")}}var K=class t{constructor(a,e){this.dashboardService=a;this.role=e;this.chartConfig=this.dashboardService.getLineChartConfig()}chartData;salesData;dashboardConfig;filterSalesWidget=new le;chartConfig;todaySalesData;weeklySalesData;isTodayFilter=!0;showPeriodFilter;includeTax;today=new Date;dateTo;filterByOutletIds=ue([]);ngOnChanges(a){if(a.chartData&&a.chartData.currentValue){this.initSalesData();let e=a?.chartData?.currentValue?.Series;e=this.setChartLineColor(e),e=this.setSalesTaxLegend(e),this.chartConfig=oe(ne({},this.chartConfig),{series:e}),this.chartConfig=this.dashboardService.setSeriesPointStart(this.chartData.From,this.chartConfig),this.initPeriodFilter(e),this.getDateTo()}}initPeriodFilter(a){this.showPeriodFilter=a[0]?.data?.length>=7}initSalesData(){this.salesData=new H,this.includeTax=this.isIncludeTax(),this.salesData.Sales=this.dashboardService.getTotalData("Sales",this.chartData.Series,1),this.salesData.SalesWithTax=this.dashboardService.getTotalData("Sales + Tax",this.chartData.Series,1),this.salesData.Cost=this.dashboardService.getTotalData("Cost",this.chartData.Series,1),this.salesData.Tax=this.salesData.SalesWithTax-this.salesData.Sales,this.salesData.Profit=(this.includeTax?this.salesData.SalesWithTax:this.salesData.Sales)-this.salesData.Cost,this.salesData.Count=this.dashboardService.getTotalData("Count",this.chartData.Series,1),this.todaySalesData=Fe(H,this.salesData)}setChartLineColor(a=[]){return a?.map(e=>(e.name=="Sales"&&(e.color="rgb(44, 175, 254)",e.fillColor=this.dashboardService.getLinierGradient("rgb(44, 175, 254)")),e.name=="Cost"&&(e.color="#fb404b",e.fillColor=this.dashboardService.getLinierGradient("#fb404b")),e.name=="Sales + Tax"&&(e.color="#2ECC71",e.fillColor=this.dashboardService.getLinierGradient("#2ECC71")),e))}onChangeFilterPeriod(){this.isTodayFilter?this.salesData=this.todaySalesData:(this.generateWeeklySalesData(),this.salesData=this.weeklySalesData),this.filterSalesWidget.emit({period:this.isTodayFilter?"TODAY":"WEEKLY"})}getDateTo(){let a=new Date,e=new Date(this.chartData.From);a.setDate(e.getDate()+7),this.dateTo=a}generateWeeklySalesData(){if(fe.IsEmpty(this.weeklySalesData)){let a=this.dashboardService.getTotalData("Sales",this.chartData.Series,7),e=this.dashboardService.getTotalData("Sales + Tax",this.chartData.Series,7),i=this.dashboardService.getTotalData("Cost",this.chartData.Series,7),n=this.dashboardService.getTotalData("Count",this.chartData.Series,7),m=e-a,z=(this.includeTax?e:a)-i;this.weeklySalesData=this.weeklySalesData?this.weeklySalesData:new H,this.weeklySalesData.Sales=a,this.weeklySalesData.SalesWithTax=e,this.weeklySalesData.Cost=i,this.weeklySalesData.Profit=z,this.weeklySalesData.Tax=m,this.weeklySalesData.Count=n}}isIncludeTax(){let a=this.chartData.Series;return this.dashboardService.filterSeriesByName("Sales + Tax",a).visible}setSalesTaxLegend(a){return a=a.map(e=>(e.name=="Sales + Tax"&&(e.showInLegend=this.salesData.Tax>0),e)),a}static \u0275fac=function(e){return new(e||t)(F(O),F(Z))};static \u0275cmp=A({type:t,selectors:[["app-sales-widget"]],inputs:{chartData:"chartData",dashboardConfig:"dashboardConfig",filterByOutletIds:[1,"filterByOutletIds"]},outputs:{filterSalesWidget:"onFilter"},features:[U([O]),re],decls:25,vars:30,consts:[[1,"d-flex","flex-row","flex-wrap","mt-8","justify-content-between"],[1,"chart-widget"],["containerId","salesChart",3,"config"],[1,"sales-card-widget"],[1,"border","rounded","rounded-bottom-0","px-8","py-4","w-100","h-auto"],[1,"border-bottom","d-flex","align-items-center","justify-content-end",2,"height","42px"],[1,"btn-group"],[1,"link-dark","fs-2","headings-font-family"],[1,"text-end","card-row","d-flex","align-items-center","justify-content-end",3,"ngClass"],["target","_blank",1,"link-dark",3,"routerLink","queryParams"],[1,"fs-5"],[1,"fw-normal"],[1,"text-end","d-flex","align-items-center","justify-content-end","card-row"],[1,"card-footer","border","rounded-bottom","border-top-0","text-end","p-3"],["routerLink","/menu/Setup/Configuration/Application"],["type","button","data-bs-toggle","dropdown","aria-expanded","false",1,"dropdown-toggle","link-dark","fs-2","headings-font-family"],[1,"dropdown-menu","p-0",2,"position","absolute","right","20px !important",3,"ngClass"],["role","button",1,"dropdown-item","fs-4",3,"click"],[1,"text-end","border-bottom","card-row","d-flex","align-items-center","justify-content-end"],[1,"d-flex","align-items-center","justify-content-end"],[1,"me-2"],[1,"fs-5","text-danger"],[1,"fs-5","text-success"],[1,"d-flex","align-items-center"]],template:function(e,i){e&1&&(o(0,"div",0)(1,"div",1),y(2,"app-chart-container",2),r(),o(3,"div",3)(4,"div",4)(5,"div",5),h(6,$e,7,5,"div",6)(7,He,2,0,"span",7),r(),o(8,"div",8)(9,"a",9),c(10,"date"),c(11,"date"),o(12,"div",10),s(13,"Order"),r(),o(14,"h2",11),s(15),c(16,"number"),r()()(),h(17,Ye,24,37),h(18,Ue,10,8,"div",8),h(19,je,10,6,"div",12),r(),o(20,"div",13)(21,"a",14)(22,"small"),s(23),c(24,"date"),r()()()()()),e&2&&(l(2),p("config",i.chartConfig),l(4),u(!(i.role==null||i.role.dashboard==null)&&i.role.dashboard.View&&i.showPeriodFilter?6:7),l(2),p("ngClass",I(23,ae,(i.salesData==null?null:i.salesData.Tax)||i.role.product.Cost)),l(),p("routerLink",f(25,ie))("queryParams",he(26,Be,_(10,11,i.isTodayFilter?i.today:i.chartData==null?null:i.chartData.From,"yyyy-MM-dd"),_(11,14,i.isTodayFilter?i.today:i.dateTo,"yyyy-MM-dd"),i.filterByOutletIds())),l(6),W(_(16,17,i.salesData==null?null:i.salesData.Count,"1.0-0")),l(2),u((i.salesData==null?null:i.salesData.Tax)>0?17:-1),l(),u(i.role.product.Cost?18:-1),l(),u(i.role.report.Profit&&i.role.product.Cost?19:-1),l(4),me("",_(24,20,i.dashboardConfig==null?null:i.dashboardConfig.SpanConfigTime,"dd MMM HH:mm")," ",i.dashboardConfig==null?null:i.dashboardConfig.SmallTimeZone))},dependencies:[$,j,Ve,ge,Ce,we,G,_e],styles:[".chart-widget[_ngcontent-%COMP%]{width:80%}.link-dark[_ngcontent-%COMP%]{color:#333!important}.dropdown-menu.show.today[_ngcontent-%COMP%]{inset:0 auto auto -34px!important}.sales-card-widget[_ngcontent-%COMP%]{width:19%}.sales-card-widget[_ngcontent-%COMP%] .card-row[_ngcontent-%COMP%]{height:64px}@media only screen and (max-width: 767px){.chart-widget[_ngcontent-%COMP%]{width:100%}.sales-card-widget[_ngcontent-%COMP%]{width:100%;margin-top:12px}}@media only screen and (min-width: 768px) and (max-width: 991px){.chart-widget[_ngcontent-%COMP%]{width:100%}.sales-card-widget[_ngcontent-%COMP%]{width:100%;margin-top:12px}}"]})};var Ge=t=>({active:t});function Ze(t,a){if(t&1&&(o(0,"div",1),s(1),r(),o(2,"div",2)(3,"small",3),s(4),r(),o(5,"h2",4),s(6),r()()),t&2){let e=d();l(),W(e.title),l(3),W(e.currencySymbol),l(2),W(e.value)}}function Ke(t,a){if(t&1&&(o(0,"div",1),s(1),r(),o(2,"h2",4),s(3,"-"),r()),t&2){let e=d();l(),W(e.title)}}var q=class t{title;isActive;currencySymbol;value;showValue;constructor(){}ngOnInit(){}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=A({type:t,selectors:[["app-card-widget"]],inputs:{title:"title",isActive:"isActive",currencySymbol:"currencySymbol",value:"value",showValue:"showValue"},decls:3,vars:4,consts:[[1,"card-widget","pe-0",3,"ngClass"],[1,"fs-4","headings-font-family"],[1,"d-flex","justify-content-start","align-items-center"],[1,"fw-normal","me-2"],[1,"fw-normal"]],template:function(e,i){e&1&&(o(0,"div",0),h(1,Ze,7,3)(2,Ke,4,1),r()),e&2&&(p("ngClass",I(2,Ge,i.isActive)),l(),u(i.showValue?1:2))},dependencies:[$,j],styles:[".card-widget[_ngcontent-%COMP%]{padding:20px;border-radius:6px;min-height:95px;border:.5px solid #e4e4e4;width:100%}.active[_ngcontent-%COMP%]{background-color:#f0f0f0}@media only screen and (max-width: 767px){.card-widget[_ngcontent-%COMP%]{width:200px}}@media only screen and (min-width: 768px) and (max-width: 991px){.card-widget[_ngcontent-%COMP%]{width:200px}}"]})};var qe=()=>[L,import("./chunk-UIIVXERD.js").then(t=>t.PaymentWidgetComponent),M],ze=()=>[L,import("./chunk-3CSCTT6I.js").then(t=>t.PurchaseWidgetComponent),M],Je=()=>[L,import("./chunk-PQ6W7KXC.js").then(t=>t.DebtWidgetComponent),M],Qe=()=>[L,import("./chunk-2MPRVJXH.js").then(t=>t.ProductWidgetComponent),M],Xe=()=>[L,import("./chunk-WM2DGNWH.js").then(t=>t.InventoryWidgetComponent),M],et=()=>({role:"Payment View Role"}),tt=()=>({role:"Buy Report Role"}),it=()=>({role:"Debt View Role"}),at=()=>({role:"Report View Role"}),nt=()=>({role:"Inventory View Role"});function ot(t,a){if(t&1){let e=T();o(0,"div",13)(1,"h6"),s(2,"Outlet"),r(),o(3,"outlet-selector",14),ee("ngModelChange",function(n){b(e);let m=d();return X(m.dashboardFilter.Outlets,n)||(m.dashboardFilter.Outlets=n),x(n)}),r()()}if(t&2){let e=d();l(3),p("multiple",!0)("accessType",e.outletAccess),Q("ngModel",e.dashboardFilter.Outlets)}}function rt(t,a){if(t&1){let e=T();o(0,"div",19),V("click",function(){let n=b(e).$implicit,m=d(2);return x(m.onClickCardWidget(n))}),y(1,"app-card-widget",20),c(2,"number"),r()}if(t&2){let e=a.$implicit,i=d(),n=d();l(),p("title",e.title)("matTooltip",e.tooltip)("currencySymbol",i==null||i.ConfigData==null?null:i.ConfigData.CurrencySymbol)("value",e.value==null?"-":_(2,6,e.value,"1.0-0"))("showValue",e.showValue)("isActive",e.id==n.activeTab)}}function lt(t,a){if(t&1){let e=T();o(0,"app-sales-widget",21),V("onFilter",function(n){b(e);let m=d(2);return x(m.onFilterSalesWidget(n))}),r()}if(t&2){let e=d(),i=d();p("dashboardConfig",e==null?null:e.ConfigData)("chartData",e==null?null:e.HighChartData)("filterByOutletIds",i.dashboardFilter.Outlets)}}function st(t,a){t&1&&B(0)}function dt(t,a){if(t&1){let e=T();o(0,"app-payment-widget",23),c(1,"async"),V("onFilter",function(n){b(e);let m=d(4);return x(m.onFilterPaymentWidget(n))}),r()}if(t&2){let e,i=d(3),n=d();p("dashboardConfig",i==null?null:i.ConfigData)("chartData",(e=v(1,2,n.paymentData$))==null?null:e.Data)}}function pt(t,a){if(t&1&&S(0,st,1,0,"ng-container",22)(1,dt,2,4,"ng-template",null,2,w),t&2){let e=g(2),i=d(3),n=g(12);p("ngTemplateOutlet",i.role.payment.View?e:n)("ngTemplateOutletContext",f(2,et))}}function ct(t,a){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function mt(t,a){t&1&&(k(0,pt,3,3)(1,ct,2,0),R(2,0,qe,null,1),N(0,-1))}function ht(t,a){t&1&&B(0)}function ut(t,a){if(t&1&&(y(0,"app-purchase-widget",18),c(1,"async")),t&2){let e,i=d(3),n=d();p("dashboardConfig",i==null?null:i.ConfigData)("chartData",(e=v(1,3,n.purchaseData$))==null?null:e.HighChartData)("filterByOutletIds",n.dashboardFilter.Outlets)}}function _t(t,a){if(t&1&&S(0,ht,1,0,"ng-container",22)(1,ut,2,5,"ng-template",null,3,w),t&2){let e=g(2),i=d(3),n=g(12);p("ngTemplateOutlet",i.role.buy.Report?e:n)("ngTemplateOutletContext",f(2,tt))}}function Ct(t,a){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function gt(t,a){t&1&&(k(0,_t,3,3)(1,Ct,2,0),R(2,0,ze,null,1),N(0,-1))}function ft(t,a){t&1&&B(0)}function Dt(t,a){if(t&1&&(y(0,"app-debt-widget",25),c(1,"async")),t&2){let e,i=d(3),n=d();p("dashboardConfig",i==null?null:i.ConfigData)("debtData",(e=v(1,2,n.debtData$))==null?null:e.PageData)}}function bt(t,a){if(t&1&&S(0,ft,1,0,"ng-container",22)(1,Dt,2,4,"ng-template",null,4,w),t&2){let e=g(2),i=d(3),n=g(12);p("ngTemplateOutlet",i.role.debt.View?e:n)("ngTemplateOutletContext",f(2,it))}}function xt(t,a){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function yt(t,a){t&1&&(k(0,bt,3,3)(1,xt,2,0),R(2,0,Je,null,1),N(0,-1))}function St(t,a){t&1&&B(0)}function Tt(t,a){if(t&1&&(y(0,"app-product-widget",26),c(1,"async")),t&2){let e,i=d(3),n=d();p("dashboardConfig",i==null?null:i.ConfigData)("productData",(e=v(1,2,n.productData$))==null?null:e.PageData)}}function vt(t,a){if(t&1&&S(0,St,1,0,"ng-container",22)(1,Tt,2,4,"ng-template",null,5,w),t&2){let e=g(2),i=d(3),n=g(12);p("ngTemplateOutlet",i.role.report.View?e:n)("ngTemplateOutletContext",f(2,at))}}function wt(t,a){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function Ot(t,a){t&1&&(k(0,vt,3,3)(1,wt,2,0),R(2,0,Qe,null,1),N(0,-1))}function Pt(t,a){t&1&&B(0)}function Et(t,a){if(t&1&&(y(0,"app-inventory-widget",27),c(1,"async")),t&2){let e,i=d(3),n=d();p("dashboardConfig",i==null?null:i.ConfigData)("inventoryData",(e=v(1,2,n.inventoryData$))==null?null:e.PageData)}}function Ft(t,a){if(t&1&&S(0,Pt,1,0,"ng-container",22)(1,Et,2,4,"ng-template",null,6,w),t&2){let e=g(2),i=d(3),n=g(12);p("ngTemplateOutlet",i.role.inventory.View?e:n)("ngTemplateOutletContext",f(2,nt))}}function Vt(t,a){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function Wt(t,a){t&1&&(k(0,Ft,3,3)(1,Vt,2,0),R(2,0,Xe,null,1),N(0,-1))}function It(t,a){if(t&1&&(o(0,"div",12)(1,"div",15)(2,"div",16),pe(3,rt,3,9,"div",17,de),c(5,"async"),r(),h(6,lt,1,3,"app-sales-widget",18),h(7,mt,4,0),h(8,gt,4,0),h(9,yt,4,0),h(10,Ot,4,0),h(11,Wt,4,0),r()()),t&2){let e=d();l(3),ce(v(5,6,e.cardWidget$)),l(3),u(e.activeTab=="SALES"?6:-1),l(),u(e.activeTab=="PAYMENT"?7:-1),l(),u(e.activeTab=="PURCHASE"?8:-1),l(),u(e.activeTab=="DEBT"?9:-1),l(),u(e.activeTab=="PRODUCT"?10:-1),l(),u(e.activeTab=="INVENTORY"?11:-1)}}function Mt(t,a){if(t&1&&(o(0,"div",24)(1,"div",28)(2,"div"),y(3,"img",29),r(),o(4,"h1",30),s(5,"You are not authorized"),r(),o(6,"p"),s(7," This page requires role "),o(8,"span",31),s(9),r(),s(10," to be accessed. Please contact your Administrator to gain access! "),r()()()),t&2){let e=a.role;l(9),C("[",e,"]")}}var ke=class t extends Te{constructor(e,i,n){super(e);this.dashboardService=i;this.role=n;this.menuData$.subscribe(),this.initSalesData(),this.initCardWidget(),this.initPaymentData(),this.initPurchaseData(),this.initInventoryData(),this.initDebtData(),this.initProductData()}cardWidget$;outletAccess=2;dashboardFilter={Outlets:[]};salesData$;paymentData$;purchaseData$;debtData$;productData$;inventoryData$;activeTab="SALES";initSalesData(){this.salesData$=this.dashboardService.getDashboardSales(this.dashboardFilter).pipe(P(1))}initPaymentData(){this.paymentData$=this.dashboardService.getDashboardPayment(this.dashboardFilter).pipe(P(1))}initPurchaseData(){this.purchaseData$=this.dashboardService.getDashboardPurchase(this.dashboardFilter).pipe(P(1))}initDebtData(){this.debtData$=this.dashboardService.getDashboardDebt(this.dashboardFilter).pipe(P(1))}initProductData(){this.productData$=this.dashboardService.getDashboardProduct(this.dashboardFilter).pipe(P(1))}initInventoryData(){this.inventoryData$=this.dashboardService.getDashboardInventory(this.dashboardFilter).pipe(P(1))}initCardWidget(){switch(this.activeTab){case"SALES":this.cardWidget$=this.salesData$.pipe(D(e=>this.dashboardService.getTotalData("Sales",e.HighChartData.Series,1)),Y(0),E(e=>this.dashboardService.setWidgetData(e,this.activeTab)));break;case"PAYMENT":this.cardWidget$=this.paymentData$.pipe(D(e=>this.dashboardService.getTotalData("All",e.Data.Series,1)),Y(0),E(e=>this.dashboardService.setWidgetData(e,this.activeTab)));break;case"PURCHASE":this.cardWidget$=this.purchaseData$.pipe(D(e=>this.dashboardService.getTotalData("Purchase",e.HighChartData.Series,1)),Y(0),E(e=>this.dashboardService.setWidgetData(e,this.activeTab)));break;case"DEBT":this.cardWidget$=this.debtData$.pipe(D(e=>e.PageData.Receivable),Y(0),E(e=>this.dashboardService.setWidgetData(e,this.activeTab)));break}}onFilterByOutlet(){switch(this.activeTab){case"SALES":this.initSalesData(),this.initCardWidget();break;case"PURCHASE":this.initPurchaseData(),this.initCardWidget();break;case"DEBT":this.initDebtData(),this.initCardWidget();break;case"PRODUCT":this.initProductData();break;case"INVENTORY":this.initInventoryData();break;case"PAYMENT":this.initPaymentData();break}}onClickCardWidget(e){this.activeTab=e.id,this.initCardWidget()}onFilterSalesWidget(e){this.cardWidget$=this.salesData$.pipe(D(i=>e.period=="WEEKLY"?this.dashboardService.getTotalData("Sales",i.HighChartData.Series,7):this.dashboardService.getTotalData("Sales",i.HighChartData.Series,1)),E(i=>(this.dashboardService.setWidgetData(i,"SALES"),this.dashboardService.widgets$)),D(i=>i.map(n=>(n.id=="SALES"&&(n.tooltip=e.period=="TODAY"?"Total Sales Today":"Total Sales last 7 days"),n))))}onFilterPaymentWidget(e){this.cardWidget$=this.paymentData$.pipe(D(i=>e.period=="WEEKLY"?this.dashboardService.getTotalData("All",i.Data.Series,7):this.dashboardService.getTotalData("All",i.Data.Series,1)),E(i=>(this.dashboardService.setWidgetData(i,"PAYMENT"),this.dashboardService.widgets$)),D(i=>i.map(n=>(n.id=="PAYMENT"&&(n.tooltip=e.period=="TODAY"?"Total Payment Today":"Total Payment last 7 days"),n))))}static \u0275fac=function(i){return new(i||t)(F(ve),F(O),F(Z))};static \u0275cmp=A({type:t,selectors:[["POS-dashboard-v2"]],features:[U([O]),se],decls:13,vars:7,consts:[["pageFilterTemplate",""],["NOT_AUTHORIZED",""],["PAYMENT",""],["BUY",""],["DEBT",""],["PRODUCT",""],["INVENTORY",""],[3,"onSubmit","filterChange","hideSearchBox","pageData","isFilterOnDropdown","filter"],[1,"content"],[1,"container-fluid","bg-light-gray","p-8"],[1,"row"],[1,"col-12"],[1,"card","mb-0"],[1,"dialog-filter"],["appendTo","body","placeholder","Select Outlets",3,"ngModelChange","multiple","accessType","ngModel"],[1,"card-body"],[1,"d-flex","flex-row","flex-nowrap","justify-content-between","align-items-center","overflow-auto",2,"column-gap","18px"],[1,"cursor-pointer","card-widget-tab"],[3,"dashboardConfig","chartData","filterByOutletIds"],[1,"cursor-pointer","card-widget-tab",3,"click"],["matTooltipPosition","above",3,"title","matTooltip","currencySymbol","value","showValue","isActive"],[3,"onFilter","dashboardConfig","chartData","filterByOutletIds"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"onFilter","dashboardConfig","chartData"],[1,"d-flex","align-items-center","justify-content-center","mt-8",2,"height","350px"],[3,"dashboardConfig","debtData"],[3,"dashboardConfig","productData"],[3,"dashboardConfig","inventoryData"],[1,"text-center"],["src","https://cdn.dealpos.xyz/web-image/locked.svg",2,"width","160px"],[1,"mt-2","mb-6"],[1,"fw-bold"]],template:function(i,n){if(i&1){let m=T();o(0,"mainpanel-cmp",7),V("onSubmit",function(){return b(m),x(n.onFilterByOutlet())}),ee("filterChange",function(J){return b(m),X(n.dashboardFilter,J)||(n.dashboardFilter=J),x(J)}),o(1,"filters"),S(2,ot,4,3,"ng-template",null,0,w),r(),o(4,"content")(5,"div",8)(6,"div",9)(7,"div",10)(8,"div",11),h(9,It,12,8,"div",12),c(10,"async"),r()()()()()(),S(11,Mt,11,1,"ng-template",null,1,w)}if(i&2){let m;p("hideSearchBox",!0)("pageData",n.menuData)("isFilterOnDropdown",!1),Q("filter",n.dashboardFilter),l(9),u((m=v(10,5,n.salesData$))?9:-1,m)}},dependencies:[$,Pe,Oe,xe,De,be,K,q,Ee,Se,ye,M,G],styles:[".card-widget-tab[_ngcontent-%COMP%]{flex:1 1 0px}@media only screen and (max-width: 767px){.card-widget-tab[_ngcontent-%COMP%]{margin-right:1rem;margin-top:.5rem;width:auto}}@media only screen and (min-width: 768px) and (max-width: 991px){.card-widget-tab[_ngcontent-%COMP%]{margin-right:1rem;margin-top:.5rem;width:auto}}"]})};export{ke as DashboardV2Component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-BYRR2B2X.js";import{K as o}from"./chunk-IEVGW2RT.js";var s=class extends a{constructor(t,e,r,n){super(t);this.httpService=e;this.formDataAPI=r;this.route=n;let p=this.route.snapshot.queryParams;this.menuData$.pipe(o(()=>this.httpService.post(`/api/${this.formDataAPI}`,p))).subscribe(i=>{this.data=i,this.postBindForm(i)})}data={};get formData(){return this.data.Form}set formData(t){this.data.Form=t}get options(){return this.data.Options?this.data.Options:{}}get Roles(){return this.data.Roles?this.data.Roles:{}}postBindForm(t){}onSubmit(t,e=!1){this.preSubmitForm(),this.httpService.post(`/api/${t}`,this.formData).subscribe({next:r=>{this.onSubmitSuccess(r)},error:r=>{this.onSubmitError(r)}})}compare(t,e,r){return(t<e?-1:1)*(r?1:-1)}preSubmitForm(){}onSubmitSuccess(t){}onSubmitError(t){}};export{s as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
1
|
+
import{a as e}from"./chunk-S7F2VAOO.js";import{a as t}from"./chunk-SNAKHGZS.js";var i=class extends e{constructor(r,a,o,l,s,p,F){super(r,a,o,l,s,p,F)}preInitLoader(){this.loaderPayload=t({ListIDs:this.reportFilterService.initOutletFilter([])},this.loaderPayload)}preInitList(){this.pageData.Filter.ListIDs=this.loaderPayload.ListIDs,this.pageData.Filter.From=this.reportFilterService.initDateFromFilter(this.pageData?.Filter?.From),this.pageData.Filter.To=this.reportFilterService.initDateToFilter(this.pageData?.Filter?.To)}onFilterOutlets(){this.reportFilterService.setOutletFilter(this.pageData.Filter.ListIDs)}onFilterFromDate(){this.reportFilterService.setDateFromFilter(this.pageData?.Filter?.From)}onFilterToDate(){this.reportFilterService.setDateToFilter(this.pageData?.Filter?.To)}};export{i as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as u}from"./chunk-
|
|
1
|
+
import{c as u}from"./chunk-TX4QVA3F.js";import{b as s}from"./chunk-YVBGB3JF.js";import{Pd as a,pa as e}from"./chunk-IEVGW2RT.js";var g=(t,c)=>{let r=e(a),i=e(u);if(i.isTokenExpired())return i.returnUrl=c.url,r.navigate(["/"]),!1;let d=e(s),o=t.data?.roles;if(o){let n=t.data?.unauthorizedRedirect;if(!o.some(l=>d.isUserHasRole(l)))return n?r.navigate([n]):r.navigate(["menu/Unauthorized/Main/Unauthorized"]),!1}return!0};export{g as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Pe}from"./chunk-NXNTQNWD.js";import{a as Ce}from"./chunk-T7XU5W5A.js";import{a as _e}from"./chunk-VKFZNKM5.js";import{a as be}from"./chunk-BT7NN7PT.js";import{b as Se,c as Me}from"./chunk-JBS5UYZC.js";import{a as de}from"./chunk-B7AC4RMR.js";import"./chunk-EQLHPWVB.js";import"./chunk-7P3L3ODB.js";import{F as ge,b as me,h as fe,o as he}from"./chunk-DWZ5JTI2.js";import{a as T,c as f}from"./chunk-5ATOLSOU.js";import{a as ve}from"./chunk-S6FFSXPE.js";import"./chunk-36GWLMZX.js";import{b as I}from"./chunk-YVBGB3JF.js";import{a as M}from"./chunk-WUV22SZ4.js";import{a as pe}from"./chunk-C5DGBRES.js";import{p as ue}from"./chunk-LGOSIAUC.js";import{$ as q,Cb as j,Db as F,E,Eb as V,Fb as h,Fc as ie,Gb as o,Hb as s,Hc as ne,Ib as p,Md as ae,Od as se,Pd as b,Qd as le,Rd as ce,Sa as Y,Sb as C,Sd as G,Ub as Z,Xa as c,d as J,da as D,eb as v,ec as K,gc as $,gd as re,hc as m,ib as W,ic as B,jb as x,jc as z,la as d,ma as y,oa as _,pa as l,tc as X,vd as oe,wb as Q,yc as ee,zc as te}from"./chunk-IEVGW2RT.js";import"./chunk-WFMAM73Y.js";import"./chunk-SNAKHGZS.js";var r=class e{constructor(i,t){this.authService=i;this.router=t}canLoad(i,t){return this.authService.isTokenExpired()?(this.authService.returnUrl=this.getUrlRedirect(t),this.router.navigate(["/"]),!1):!0}getUrlRedirect(i){let t="/menu";i.forEach(a=>t+=`/${a.path}`);let n=this.router.currentNavigation().extractedUrl.queryParams;return Object.keys(n).forEach((a,g)=>{g==0?t=`${t}?${a}=${n[a]}`:t=`${t}&${a}=${n[a]}`}),t}static \u0275fac=function(t){return new(t||e)(_(f),_(b))};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var w=class e{constructor(i){this.toastrService=i;this.initPermissionToastr=!1}isPermissionGranted;initPermissionToastr;initPermission(){try{this.initPermissionToastr||Notification.requestPermission().then(t=>{this.isPermissionGranted=!1,t=="granted"&&(this.isPermissionGranted=!0),this.initPermissionToastr=!0})}catch(i){console.error(i)}}showAlert(i,t,n,u){let a=6e4;if(this.isPermissionGranted)try{let g=new Notification(t,{body:i,icon:u});g.onerror=(N=>{this.toastrService.info(this.setBody(i,n),t,{timeOut:a,enableHtml:this.hasUrl(n)})})}catch(g){console.error(g)}else this.toastrService.info(this.setBody(i,n),t,{timeOut:a,enableHtml:this.hasUrl(n)})}setBody(i,t){return this.hasUrl(t)&&(i=`<a href="${t}" target="_blank" class="ps-0">${i}</a>`),i}hasUrl(i){return!!(i&&i.length!==0)}static \u0275fac=function(t){return new(t||e)(_(ue))};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var Oe=[{T:"Dashboard",U:"/menu/Dashboard",I:"fa-solid fa-chart-pie"},{T:"Products",U:"/menu/Products",I:"fa-solid fa-tag"},{T:"Estimate",U:"/menu/Estimate",I:"fa-solid fa-clipboard"},{T:"Sell",U:"/menu/Sell",I:"fa-solid fa-cart-shopping"},{T:"Shift",U:"/menu/Shift/",I:"fa-solid fa-user-clock"},{T:"Reports",U:"/menu/Reports",I:"fa-solid fa-chart-area"},{T:"Contacts",U:"/menu/Contacts",I:"fas fa-address-book"},{T:"Orders",U:"/menu/Orders",I:"fas fa-file-invoice"},{T:"Payment",U:"/menu/Payment",I:"fas fa-money-bill-alt"},{T:"Debt",U:"/menu/Debt",I:"fas fa-dollar-sign"},{T:"Inventory",U:"/menu/Inventory",I:"fas fa-archive"},{T:"Adjustment",U:"/menu/Adjustment",I:"fas fa-scanner-gun"},{T:"Buy",U:"/menu/Buy",I:"fa-solid fa-cart-arrow-down"},{T:"Logistics",U:"/menu/Logistics",I:"fas fa-truck"},{T:"Fulfillment",U:"/menu/Fulfillment",I:"fas fa-dolly"},{T:"Manufacture",U:"/menu/Manufacture",I:"fas fa-industry"},{T:"Prepaid Package",U:"/menu/Prepaid_Package",I:"fa-solid fa-id-card"},{T:"Promotion",U:"/menu/Promotion",I:"fas fa-bullhorn"},{T:"Users",U:"/menu/Users",I:"fas fa-user"},{T:"Outlets",U:"/menu/Outlets",I:"fas fa-map-marker-alt"},{T:"Setup",U:"/menu/Setup",I:"fas fa-gear"},{T:"Developer",U:"/menu/Developer",I:"fas fa-code"}];var k=class e{role=l(I);authService=l(f);menu=Oe;filteredMenu=[];initFilteredMenu(){this.filteredMenu=this.menu.filter(i=>i.T==="Dashboard"?this.role.dashboard.View:i.T==="Products"?this.role.product.View:i.T==="Estimate"?this.role.estimate.Create:i.T==="Sell"?this.role.sell.Create:i.T==="Shift"?this.role.sell.Create:i.T==="Reports"?this.role.report.View:i.T==="Contacts"?this.role.contact.View:i.T==="Orders"?this.role.order.View:i.T==="Payment"?this.role.payment.View:i.T==="Debt"?this.role.debt.View:i.T==="Inventory"?this.role.inventory.View:i.T==="Adjustment"?this.role.adjustment.View:i.T==="Buy"?this.role.buy.Create:i.T==="Logistics"?this.role.logistic.View:i.T==="Manufacture"?this.role.manufacture.View:i.T==="Fulfillment"?this.role.fulfillment.View:i.T==="Prepaid Package"?this.role.prepaidPackage.View:i.T==="Promotion"?this.role.promotion.View:i.T==="Users"?this.role.users.View:i.T==="Outlets"?this.role.outlets.View:i.T==="Setup"?this.role.setup.View:i.T==="Developer"?this.role.developer.View:!0),this.filterBySubscriptionStatus()}filterBySubscriptionStatus(){let i=this.authService.getSubscriptionStatus();this.filteredMenu=this.filteredMenu.filter(t=>{switch(i){case 2:return t.T=="Sell"||t.T=="Shift";case 3:return!1;default:return!0}})}static \u0275fac=function(t){return new(t||e)};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var ye=[{T:"My Profile",U:"Profile/Main/My_Profile",I:"fas fa-user"},{T:"My Subscription",U:"Profile/Main/My_Subscription",I:"fa-solid fa-credit-card"},{T:"Notification",U:"Profile/Notification/Push",I:"fas fa-bell"},{T:"My Sales",U:"Profile/Main/My_Sales",I:"fas fa-history"}];var A=class e{role=l(I);authService=l(f);filteredMenu=[];initFilteredMenu(){let i=this.authService.getSubscriptionStatus();this.filteredMenu=ye.filter(t=>t.T=="My Profile"?this.role.profile.View:t.T=="My Subscription"?this.role.profile.Subscription:t.T=="Notification"?this.role.profile.Notification&&i!=2&&i!=3:t.T=="My Sales"?i!=2&&i!=3:!0)}static \u0275fac=function(t){return new(t||e)};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var Le=(e,i)=>({"full-container":e,"subscription-bar-visible":i}),Re=e=>[e];function Ne(e,i){if(e&1&&(o(0,"a",11),p(1,"i",35),o(2,"span"),m(3),s()()),e&2){let t=i.$implicit;h("routerLink",t==null?null:t.U),c(),$((t==null?null:t.I)+" me-2"),c(2),B(t==null?null:t.T)}}function Ee(e,i){if(e&1&&(o(0,"li",33,0)(2,"a",36),p(3,"i"),o(4,"p"),m(5),s()()()),e&2){let t=i.$implicit,n=Z();h("routerLinkActiveOptions",n.isActiveMatchOptions),Q("data-cy",t==null?null:t.T),c(2),h("matTooltip",n.toggleSideMenu?t==null?null:t.T:"")("routerLink",ee(7,Re,t==null?null:t.U)),c(),$(t==null?null:t.I),c(2),B(t==null?null:t.T)}}var P=class e{constructor(i,t,n,u,a,g,N,H){this.toggleSidebar=i;this.signalRClientService=t;this.notificationAlertService=n;this.router=u;this.authService=a;this.intercomService=g;N.initFilteredMenu(),H.initFilteredMenu(),this.leftSidebarMenu=N.filteredMenu,this.topMenu=H.filteredMenu,this.accountInfo=JSON.parse(localStorage.getItem("AccountInfo")),this.toggleSidebar.toggleState$.subscribe(Te=>this.isNavOpen=Te),this.destroy$=new J,this.initNotificationPermission()}isActiveMatchOptions={matrixParams:"subset",queryParams:"subset",paths:"subset",fragment:"exact"};toggleSideMenu=!1;isNavOpen;destroy$;activeMenu;appVersion=pe.version;currentSubStatus;subsStatusEnum=T;isFullContainer=!1;isHideIntercomLauncher;leftSidebarMenu;topMenu;accountInfo;ngOnInit(){this.subscribeToPushNotification(),this.getCurrentSubscriptionStatus(),this.initFullContainer()}initFullContainer(){this.router.events.pipe(E(i=>i instanceof ae),q(null),D(this.destroy$)).subscribe(i=>{this.isFullContainer=!1,(this.router.url.includes("Sell")&&!this.router.url.includes("v2")&&!this.router.url.includes("Offline")||this.router.url.includes("Buy")||this.router.url.includes("menu/Estimate")||this.router.url.includes("Transfer_Order/Form")||this.router.url.includes("Adjustment/Archive/Form")||this.router.url.includes("Job_Order/Archive/Form")||this.router.url.includes("/menu/Debt/Debt/Join_Invoice/Form")||this.router.url.includes("/menu/Debt/Debt/Join_Bill/New_Join_Bill"))&&(this.isFullContainer=!0)})}initNotificationPermission(){this.notificationAlertService.initPermission()}getCurrentSubscriptionStatus(){this.currentSubStatus=this.authService.getSubscriptionStatus()}subscribeToPushNotification(){let i=localStorage.getItem("NotificationOutletID");M.IsNotEmpty(i)&&M.isGuid(i)?this.signalRClientService.SubscribeGroup(i):this.signalRClientService.startConnection(),this.signalRClientService.OnReceivePushNotification.pipe(D(this.destroy$),E(t=>M.IsNotEmpty(t))).subscribe(t=>{if(M.IsNotEmpty(t)){let n=JSON.parse(t),u="https://cdn.dealpos.xyz/web-image/info-new.png";M.IsNotEmpty(n.Icon)&&(u=n.Icon),this.notificationAlertService.showAlert(n.Body,n.Header,n.URL,u)}})}ngAfterViewInit(){this.intercomService.inititalizeIntercom()}toggleMenu(){this.toggleSideMenu=!this.toggleSideMenu}logout(){this.authService.logout()}isNotEmpty(i){return M.IsNotEmpty(i)}onShowDropdown(){this.isHideIntercomLauncher=this.intercomService.isHideLauncher()}chatToggleChange(){this.isHideIntercomLauncher==!1?this.intercomService.hideLauncher():this.intercomService.showLauncher(),this.onShowDropdown()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(t){return new(t||e)(v(be),v(de),v(w),v(b),v(f),v(ve),v(k),v(A))};static \u0275cmp=W({type:e,selectors:[["POS-menu-master"]],standalone:!1,decls:54,vars:17,consts:[["rla","routerLinkActive"],[1,"wrapper"],["data-color","blue",1,"sidebar",3,"ngClass"],[1,"btn-minimize","d-lg-block","d-none","p-0","border-0","bg-white",3,"click"],[1,"fa-solid",3,"ngClass"],[1,"logo"],[1,"navbar","dropdown","bg-transparent","border-0"],["data-cy","companyName","data-bs-toggle","dropdown","aria-expanded","false","matTooltipPosition","above",1,"simple-text","text-start","dropdown-toggle","d-flex","align-items-center","justify-content-center",2,"cursor","pointer",3,"click","matTooltip"],[1,"dropdown-menu"],[1,"dropdown-header","text-dark","border-bottom"],[1,"divider","m-0"],[1,"dropdown-item","h5",3,"routerLink"],[1,"dropdown-item","h5",2,"cursor","pointer"],[1,"d-flex","align-items-center","justify-content-between"],[1,"fa-solid","fa-comment-dots","me-2"],[1,"checkbox_toggle","ms-3",3,"click"],["type","checkbox","id","chatToggle","name","ChatToggle",3,"ngModelChange","ngModel"],["for","chatToggle",1,"position-relative","rounded-pill","pointer"],[1,"dropdown-item","h5",2,"cursor","pointer",3,"click"],["aria-hidden","true",1,"fa-solid","fa-sign-out-alt","me-2"],[1,"divider"],[1,"dropdown-header","border-top"],["target","_blank",1,"dropdown-item","h5","changelog",3,"href"],["aria-hidden","true",1,"fa-solid","fa-sparkles","me-2"],[1,"fa-solid","fa-circle-exclamation","ms-2",2,"font-size","16px"],["target","_blank","href","http://support.dealpos.com",1,"dropdown-item","h5"],["aria-hidden","true",1,"fa-solid","fa-book","me-2"],["target","_blank","href","https://www.dealpos.app/",1,"dropdown-item","h5"],["aria-hidden","true",1,"fa-solid","fa-table-cells-large","me-2"],["target","_blank","href","http://blog.dealpos.com",1,"dropdown-item","h5"],["aria-hidden","true",1,"fa-brands","fa-blogger","me-2"],[1,"sidebar-wrapper"],[1,"nav"],["routerLinkActive","active",3,"routerLinkActiveOptions"],["id","full-container",1,"main-panel",3,"ngClass"],["aria-hidden","true"],["matTooltipPosition","above",1,"nav-link","position-relative","d-block",3,"matTooltip","routerLink"]],template:function(t,n){t&1&&(o(0,"div",1)(1,"div",2)(2,"button",3),C("click",function(){return n.toggleMenu()}),p(3,"i",4),s(),o(4,"div",5)(5,"div",6)(6,"a",7),C("click",function(){return n.onShowDropdown()}),m(7),ie(8,"limitText"),s(),o(9,"div",8)(10,"div",9),m(11),s(),p(12,"div",10),F(13,Ne,4,4,"a",11,j),o(15,"a",12)(16,"div",13)(17,"div"),p(18,"i",14),o(19,"span"),m(20,"Chat Support"),s()(),o(21,"div",15),C("click",function(a){return a.stopPropagation()}),o(22,"input",16),C("ngModelChange",function(){return n.chatToggleChange()}),s(),p(23,"label",17),s()()(),o(24,"a",18),C("click",function(){return n.logout()}),p(25,"i",19),o(26,"span"),m(27,"Log Out"),s()(),p(28,"div",20),o(29,"div",21),m(30," Links "),s(),o(31,"a",22),p(32,"i",23),o(33,"span"),m(34,"What's New"),p(35,"i",24),s()(),o(36,"a",25),p(37,"i",26),o(38,"span"),m(39,"Help Center"),s()(),o(40,"a",27),p(41,"i",28),o(42,"span"),m(43,"App Store"),s()(),o(44,"a",29),p(45,"i",30),o(46,"span"),m(47,"Company Blog"),s()()()()(),o(48,"div",31)(49,"ul",32),F(50,Ee,6,9,"li",33,j),s()()(),o(52,"div",34),p(53,"router-outlet"),s()()),t&2&&(K("nav-open",n.isNavOpen),c(),h("ngClass",n.toggleSideMenu?"collapses":""),c(2),h("ngClass",n.toggleSideMenu?"fa-angle-left cursor":"fa-angle-right cursor"),c(3),h("matTooltip",n.accountInfo==null?null:n.accountInfo.BrandName),c(),z(" ",ne(8,11,n.accountInfo==null?null:n.accountInfo.BrandName,12)," "),c(4),z("",n.accountInfo==null?null:n.accountInfo.UserName," "),c(2),V(n.topMenu),c(9),h("ngModel",!n.isHideIntercomLauncher),c(9),h("href",X("https://changelog.dealpos.com/?categories=cat_gAZdRhBYU7QVl&view=complete&v=",n.appVersion),Y),c(19),V(n.leftSidebarMenu),c(2),h("ngClass",te(14,Le,n.isFullContainer,n.isNotEmpty(n.currentSubStatus)&&n.currentSubStatus!==n.subsStatusEnum.PAID)))},dependencies:[Se,se,le,ce,me,fe,he,re,Ce],styles:['.sidebar[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .nav-link[_ngcontent-%COMP%], body[_ngcontent-%COMP%] > .navbar-collapse[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .nav-link[_ngcontent-%COMP%]{padding:10px 0 10px 10px!important}.sidebar-wrapper[_ngcontent-%COMP%]{max-height:calc(100% - 61px)!important;min-height:calc(100% - 61px)!important}@media (max-width: 991px){.sidebar-wrapper[_ngcontent-%COMP%]{overflow-y:scroll!important}}@media (pointer: coarse){.sidebar-wrapper[_ngcontent-%COMP%]{overflow-y:scroll!important}}@media (max-width: 468px){.navbar[_ngcontent-%COMP%] .navbar-brand[_ngcontent-%COMP%]{white-space:nowrap;max-width:7em;overflow:hidden;text-overflow:ellipsis}}@media only screen and (min-width: 992px){.sidebar[_ngcontent-%COMP%]{z-index:1050!important;transition:all .3s}.sidebar[_ngcontent-%COMP%] .sidebar-wrapper[_ngcontent-%COMP%]{transition:all .3s}.sidebar[_ngcontent-%COMP%] + .main-panel[_ngcontent-%COMP%]{transition:all .3s}.sidebar[_ngcontent-%COMP%] + .main-panel[_ngcontent-%COMP%] .navbar.fixed-top[_ngcontent-%COMP%]{transition:all .3s}.sidebar.collapses[_ngcontent-%COMP%], .sidebar.collapses[_ngcontent-%COMP%] .sidebar-wrapper[_ngcontent-%COMP%]{width:70px;transition:all .3s}.sidebar.collapses[_ngcontent-%COMP%] .logo[_ngcontent-%COMP%] .simple-text[_ngcontent-%COMP%]{background-color:#ffffff3b;border-radius:20px;height:40px;width:40px}.sidebar.collapses[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .nav-link[_ngcontent-%COMP%]{padding:10px 0 10px 10px!important;height:50px;text-align:center;margin:10px}.sidebar.collapses[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .nav-link[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{display:none}.sidebar.collapses[_ngcontent-%COMP%] + .main-panel[_ngcontent-%COMP%]{padding-left:70px}.sidebar.collapses[_ngcontent-%COMP%] + .main-panel[_ngcontent-%COMP%] .navbar.fixed-top[_ngcontent-%COMP%]{left:70px!important;transition:all .3s}.sidebar[_ngcontent-%COMP%] .btn-minimize[_ngcontent-%COMP%]{position:absolute;top:17px;right:-20px;z-index:7;-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);border-radius:50%;box-shadow:0 0 0 1px #091e4214,0 2px 4px 1px #091e4214;color:#000;cursor:pointer;height:24px;opacity:0;outline:0;width:24px;-webkit-transform-origin:7px;-ms-transform-origin:7px;transform-origin:7px;transition:opacity .5s;-webkit-transition:opacity .5s}.sidebar[_ngcontent-%COMP%] .btn-minimize[_ngcontent-%COMP%]:hover{color:#2996cc}.sidebar[_ngcontent-%COMP%]:hover .btn-minimize[_ngcontent-%COMP%]{opacity:1;background-color:#fff;position:absolute;top:17px;right:-20px;z-index:7;-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);border:0;border-radius:50%;box-shadow:0 0 0 1px #091e4214,0 2px 4px 1px #091e4214;color:#000;cursor:pointer;height:24px;opacity:0;outline:0;padding:0;width:24px;-webkit-transform-origin:7px;-ms-transform-origin:7px;transform-origin:7px;transition:opacity .5s;-webkit-transition:opacity .5s}.sidebar[_ngcontent-%COMP%]:hover .btn-minimize[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{cursor:pointer}.sidebar[_ngcontent-%COMP%]:hover .btn-minimize[_ngcontent-%COMP%]:hover{color:#2996cc}.sidebar[_ngcontent-%COMP%]:hover:hover .btn-minimize[_ngcontent-%COMP%]{opacity:1}}.full-container[_ngcontent-%COMP%]{padding-top:0!important}.changelog[_ngcontent-%COMP%]{color:#0006b1!important}.changelog[_ngcontent-%COMP%]:visited{color:#2e2e2e!important}.changelog[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{position:relative}.changelog[_ngcontent-%COMP%] span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#fe3a00!important;position:absolute;top:-4px;right:-18px}.changelog[_ngcontent-%COMP%]:visited span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#fff!important;position:absolute;top:-4px;right:-18px}.changelog[_ngcontent-%COMP%]:visited:hover span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#e9ecef!important;position:absolute;top:-4px;right:-18px}.subscription-bar-visible[_ngcontent-%COMP%]{padding-top:98px}.checkbox_toggle[_ngcontent-%COMP%]{position:relative}.checkbox_toggle[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{color:#868686;display:inline-block;padding-right:38px}.checkbox_toggle[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{width:23px;height:14px;background-color:#ccc;top:2.2px;right:0}.checkbox_toggle[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{display:none}.checkbox_toggle[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background-color:#1f77d0}.checkbox_toggle[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]:after{left:10px}.checkbox_toggle[_ngcontent-%COMP%] label[_ngcontent-%COMP%]:after{content:"";width:12px;height:12px;border-radius:50%;position:absolute;top:.8px;left:1px;transition:all .1s;background-color:#fff}']})};function De(e){let i=l(b),t="/menu";e.forEach(a=>t+=`/${a.path}`);let n=i.currentNavigation().extractedUrl.queryParams;return Object.keys(n).forEach((a,g)=>{g==0?t=`${t}?${a}=${n[a]}`:t=`${t}&${a}=${n[a]}`}),t}var O=(e,i)=>{let t=l(f),n=t.isTokenExpired(),u=l(b);return n?(t.returnUrl=De(i),u.navigate(["/"]),!1):e.path=="Dashboard"?je():!0};function je(){let e=l(b),i=l(f),t=!1,n=i.getRedirectUrl();return t=n.includes("Dashboard"),t==!1&&e.navigate([n]),t}var U=class e{paymentStorageService=l(Pe);canActivate(i,t){return this.paymentStorageService.clear(),!0}static \u0275fac=function(t){return new(t||e)};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var L=class e{reportService=l(_e);canActivate(i,t){return this.reportService.resetFilter(),!0}static \u0275fac=function(t){return new(t||e)};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var Fe=[{path:"",component:P,children:[{path:"Inventory",loadChildren:()=>import("./chunk-HE7N7GWE.js").then(e=>e.InventoryModule),canLoad:[r]},{path:"Reports",loadChildren:()=>import("./chunk-VXOS2AWO.js").then(e=>e.ReportsModule),canLoad:[r],canActivate:[L]},{path:"Sell",loadChildren:()=>import("./chunk-4PJRRPIJ.js").then(e=>e.routes),canLoad:[r]},{path:"Print",loadChildren:()=>import("./chunk-57GKJ4WM.js").then(e=>e.PrintModule),canLoad:[r]},{path:"Buy",loadComponent:()=>import("./chunk-HQ574TNK.js").then(e=>e.BuyV2Component),canMatch:[O]},{path:"Sell/V2",loadComponent:()=>import("./chunk-SNEK2BS2.js").then(e=>e.SellV2Component),canMatch:[O]},{path:"Dashboard",loadComponent:()=>import("./chunk-YPG7NXW6.js").then(e=>e.DashboardV2Component),canMatch:[O]},{path:"Products",loadChildren:()=>import("./chunk-VG3PJFDU.js").then(e=>e.ProductModule),canLoad:[r]},{path:"Shift",loadChildren:()=>import("./chunk-YSM3FPZM.js").then(e=>e.ShiftModule),canLoad:[r]},{path:"Debt",loadChildren:()=>import("./chunk-5WC44KI7.js").then(e=>e.DebtModule),canLoad:[r]},{path:"Logistics",loadChildren:()=>import("./chunk-W2BNI7QT.js").then(e=>e.DeliveryModule),canLoad:[r]},{path:"Users",loadChildren:()=>import("./chunk-PVW5CNDF.js").then(e=>e.UsersModule),canLoad:[r]},{path:"Setup",loadChildren:()=>import("./chunk-QKNGNLDI.js").then(e=>e.SetupModule),canLoad:[r]},{path:"Developer",loadChildren:()=>import("./chunk-WTAIDRV6.js").then(e=>e.DeveloperModule),canLoad:[r]},{path:"Contacts",loadChildren:()=>import("./chunk-WGOJUNBF.js").then(e=>e.ContactsModule),canLoad:[r]},{path:"Outlets",loadChildren:()=>import("./chunk-KZXFGU4G.js").then(e=>e.OutletsModule),canLoad:[r]},{path:"Orders",loadChildren:()=>import("./chunk-Y3KLG6WD.js").then(e=>e.OrdersModule),canLoad:[r]},{path:"Profile",loadChildren:()=>import("./chunk-KTPBLT2O.js").then(e=>e.ProfileModule),canLoad:[r]},{path:"Estimate",loadComponent:()=>import("./chunk-3BIA7JJK.js").then(e=>e.EstimateV2Component),canMatch:[O]},{path:"Adjustment",loadChildren:()=>import("./chunk-CTYPZCCF.js").then(e=>e.AdjustmentModule),canLoad:[r]},{path:"Payment",loadChildren:()=>import("./chunk-BD6OKJBW.js").then(e=>e.PaymentModule),canLoad:[r],canActivate:[U]},{path:"Promotion",loadChildren:()=>import("./chunk-RFRD7Y7N.js").then(e=>e.PromotionModule),canLoad:[r]},{path:"Manufacture",loadChildren:()=>import("./chunk-MNEZCILO.js").then(e=>e.ManufactureModule),canLoad:[r]},{path:"Prepaid_Package",loadChildren:()=>import("./chunk-JLJ6CCD3.js").then(e=>e.PrepaidPackageModule),canLoad:[r]},{path:"Fulfillment",loadChildren:()=>import("./chunk-C7XESRQV.js").then(e=>e.FulfillmentModule),canLoad:[r]},{path:"Unauthorized",loadChildren:()=>import("./chunk-N6QOUUEK.js").then(e=>e.UnauthorizedModule),canLoad:[r]},{path:"Not_Found",loadChildren:()=>import("./chunk-O5A5DNRB.js").then(e=>e.NotFoundModule),canLoad:[r]},{path:"",redirectTo:"/menu/Dashboard",pathMatch:"full"},{path:"**",redirectTo:"Not_Found"}]}],R=class e{static \u0275fac=function(t){return new(t||e)};static \u0275mod=x({type:e});static \u0275inj=y({imports:[G.forChild(Fe),G]})};var xe=class e{constructor(){}static \u0275fac=function(t){return new(t||e)};static \u0275mod=x({type:e,bootstrap:[P]});static \u0275inj=y({imports:[Me,R,ge,oe]})};export{xe as MenuMasterModule};
|
|
1
|
+
import{a as Pe}from"./chunk-K522UIWE.js";import{a as Ce}from"./chunk-T7XU5W5A.js";import{a as _e}from"./chunk-PFCZZYN7.js";import{a as be}from"./chunk-BT7NN7PT.js";import{b as Se,c as Me}from"./chunk-JBS5UYZC.js";import{a as de}from"./chunk-B7AC4RMR.js";import"./chunk-EQLHPWVB.js";import"./chunk-7P3L3ODB.js";import{F as ge,b as me,h as fe,o as he}from"./chunk-DWZ5JTI2.js";import{a as T,c as f}from"./chunk-TX4QVA3F.js";import{a as ve}from"./chunk-ZCQ45ILW.js";import"./chunk-36GWLMZX.js";import{b as I}from"./chunk-YVBGB3JF.js";import{a as M}from"./chunk-WUV22SZ4.js";import{a as pe}from"./chunk-JSYUX55K.js";import{p as ue}from"./chunk-LGOSIAUC.js";import{$ as q,Cb as j,Db as F,E,Eb as V,Fb as h,Fc as ie,Gb as o,Hb as s,Hc as ne,Ib as p,Md as ae,Od as se,Pd as b,Qd as le,Rd as ce,Sa as Y,Sb as C,Sd as G,Ub as Z,Xa as c,d as J,da as D,eb as v,ec as K,gc as $,gd as re,hc as m,ib as W,ic as B,jb as x,jc as z,la as d,ma as y,oa as _,pa as l,tc as X,vd as oe,wb as Q,yc as ee,zc as te}from"./chunk-IEVGW2RT.js";import"./chunk-WFMAM73Y.js";import"./chunk-SNAKHGZS.js";var r=class e{constructor(i,t){this.authService=i;this.router=t}canLoad(i,t){return this.authService.isTokenExpired()?(this.authService.returnUrl=this.getUrlRedirect(t),this.router.navigate(["/"]),!1):!0}getUrlRedirect(i){let t="/menu";i.forEach(a=>t+=`/${a.path}`);let n=this.router.currentNavigation().extractedUrl.queryParams;return Object.keys(n).forEach((a,g)=>{g==0?t=`${t}?${a}=${n[a]}`:t=`${t}&${a}=${n[a]}`}),t}static \u0275fac=function(t){return new(t||e)(_(f),_(b))};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var w=class e{constructor(i){this.toastrService=i;this.initPermissionToastr=!1}isPermissionGranted;initPermissionToastr;initPermission(){try{this.initPermissionToastr||Notification.requestPermission().then(t=>{this.isPermissionGranted=!1,t=="granted"&&(this.isPermissionGranted=!0),this.initPermissionToastr=!0})}catch(i){console.error(i)}}showAlert(i,t,n,u){let a=6e4;if(this.isPermissionGranted)try{let g=new Notification(t,{body:i,icon:u});g.onerror=(N=>{this.toastrService.info(this.setBody(i,n),t,{timeOut:a,enableHtml:this.hasUrl(n)})})}catch(g){console.error(g)}else this.toastrService.info(this.setBody(i,n),t,{timeOut:a,enableHtml:this.hasUrl(n)})}setBody(i,t){return this.hasUrl(t)&&(i=`<a href="${t}" target="_blank" class="ps-0">${i}</a>`),i}hasUrl(i){return!!(i&&i.length!==0)}static \u0275fac=function(t){return new(t||e)(_(ue))};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var Oe=[{T:"Dashboard",U:"/menu/Dashboard",I:"fa-solid fa-chart-pie"},{T:"Products",U:"/menu/Products",I:"fa-solid fa-tag"},{T:"Estimate",U:"/menu/Estimate",I:"fa-solid fa-clipboard"},{T:"Sell",U:"/menu/Sell",I:"fa-solid fa-cart-shopping"},{T:"Shift",U:"/menu/Shift/",I:"fa-solid fa-user-clock"},{T:"Reports",U:"/menu/Reports",I:"fa-solid fa-chart-area"},{T:"Contacts",U:"/menu/Contacts",I:"fas fa-address-book"},{T:"Orders",U:"/menu/Orders",I:"fas fa-file-invoice"},{T:"Payment",U:"/menu/Payment",I:"fas fa-money-bill-alt"},{T:"Debt",U:"/menu/Debt",I:"fas fa-dollar-sign"},{T:"Inventory",U:"/menu/Inventory",I:"fas fa-archive"},{T:"Adjustment",U:"/menu/Adjustment",I:"fas fa-scanner-gun"},{T:"Buy",U:"/menu/Buy",I:"fa-solid fa-cart-arrow-down"},{T:"Logistics",U:"/menu/Logistics",I:"fas fa-truck"},{T:"Fulfillment",U:"/menu/Fulfillment",I:"fas fa-dolly"},{T:"Manufacture",U:"/menu/Manufacture",I:"fas fa-industry"},{T:"Prepaid Package",U:"/menu/Prepaid_Package",I:"fa-solid fa-id-card"},{T:"Promotion",U:"/menu/Promotion",I:"fas fa-bullhorn"},{T:"Users",U:"/menu/Users",I:"fas fa-user"},{T:"Outlets",U:"/menu/Outlets",I:"fas fa-map-marker-alt"},{T:"Setup",U:"/menu/Setup",I:"fas fa-gear"},{T:"Developer",U:"/menu/Developer",I:"fas fa-code"}];var k=class e{role=l(I);authService=l(f);menu=Oe;filteredMenu=[];initFilteredMenu(){this.filteredMenu=this.menu.filter(i=>i.T==="Dashboard"?this.role.dashboard.View:i.T==="Products"?this.role.product.View:i.T==="Estimate"?this.role.estimate.Create:i.T==="Sell"?this.role.sell.Create:i.T==="Shift"?this.role.sell.Create:i.T==="Reports"?this.role.report.View:i.T==="Contacts"?this.role.contact.View:i.T==="Orders"?this.role.order.View:i.T==="Payment"?this.role.payment.View:i.T==="Debt"?this.role.debt.View:i.T==="Inventory"?this.role.inventory.View:i.T==="Adjustment"?this.role.adjustment.View:i.T==="Buy"?this.role.buy.Create:i.T==="Logistics"?this.role.logistic.View:i.T==="Manufacture"?this.role.manufacture.View:i.T==="Fulfillment"?this.role.fulfillment.View:i.T==="Prepaid Package"?this.role.prepaidPackage.View:i.T==="Promotion"?this.role.promotion.View:i.T==="Users"?this.role.users.View:i.T==="Outlets"?this.role.outlets.View:i.T==="Setup"?this.role.setup.View:i.T==="Developer"?this.role.developer.View:!0),this.filterBySubscriptionStatus()}filterBySubscriptionStatus(){let i=this.authService.getSubscriptionStatus();this.filteredMenu=this.filteredMenu.filter(t=>{switch(i){case 2:return t.T=="Sell"||t.T=="Shift";case 3:return!1;default:return!0}})}static \u0275fac=function(t){return new(t||e)};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var ye=[{T:"My Profile",U:"Profile/Main/My_Profile",I:"fas fa-user"},{T:"My Subscription",U:"Profile/Main/My_Subscription",I:"fa-solid fa-credit-card"},{T:"Notification",U:"Profile/Notification/Push",I:"fas fa-bell"},{T:"My Sales",U:"Profile/Main/My_Sales",I:"fas fa-history"}];var A=class e{role=l(I);authService=l(f);filteredMenu=[];initFilteredMenu(){let i=this.authService.getSubscriptionStatus();this.filteredMenu=ye.filter(t=>t.T=="My Profile"?this.role.profile.View:t.T=="My Subscription"?this.role.profile.Subscription:t.T=="Notification"?this.role.profile.Notification&&i!=2&&i!=3:t.T=="My Sales"?i!=2&&i!=3:!0)}static \u0275fac=function(t){return new(t||e)};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var Le=(e,i)=>({"full-container":e,"subscription-bar-visible":i}),Re=e=>[e];function Ne(e,i){if(e&1&&(o(0,"a",11),p(1,"i",35),o(2,"span"),m(3),s()()),e&2){let t=i.$implicit;h("routerLink",t==null?null:t.U),c(),$((t==null?null:t.I)+" me-2"),c(2),B(t==null?null:t.T)}}function Ee(e,i){if(e&1&&(o(0,"li",33,0)(2,"a",36),p(3,"i"),o(4,"p"),m(5),s()()()),e&2){let t=i.$implicit,n=Z();h("routerLinkActiveOptions",n.isActiveMatchOptions),Q("data-cy",t==null?null:t.T),c(2),h("matTooltip",n.toggleSideMenu?t==null?null:t.T:"")("routerLink",ee(7,Re,t==null?null:t.U)),c(),$(t==null?null:t.I),c(2),B(t==null?null:t.T)}}var P=class e{constructor(i,t,n,u,a,g,N,H){this.toggleSidebar=i;this.signalRClientService=t;this.notificationAlertService=n;this.router=u;this.authService=a;this.intercomService=g;N.initFilteredMenu(),H.initFilteredMenu(),this.leftSidebarMenu=N.filteredMenu,this.topMenu=H.filteredMenu,this.accountInfo=JSON.parse(localStorage.getItem("AccountInfo")),this.toggleSidebar.toggleState$.subscribe(Te=>this.isNavOpen=Te),this.destroy$=new J,this.initNotificationPermission()}isActiveMatchOptions={matrixParams:"subset",queryParams:"subset",paths:"subset",fragment:"exact"};toggleSideMenu=!1;isNavOpen;destroy$;activeMenu;appVersion=pe.version;currentSubStatus;subsStatusEnum=T;isFullContainer=!1;isHideIntercomLauncher;leftSidebarMenu;topMenu;accountInfo;ngOnInit(){this.subscribeToPushNotification(),this.getCurrentSubscriptionStatus(),this.initFullContainer()}initFullContainer(){this.router.events.pipe(E(i=>i instanceof ae),q(null),D(this.destroy$)).subscribe(i=>{this.isFullContainer=!1,(this.router.url.includes("Sell")&&!this.router.url.includes("v2")&&!this.router.url.includes("Offline")||this.router.url.includes("Buy")||this.router.url.includes("menu/Estimate")||this.router.url.includes("Transfer_Order/Form")||this.router.url.includes("Adjustment/Archive/Form")||this.router.url.includes("Job_Order/Archive/Form")||this.router.url.includes("/menu/Debt/Debt/Join_Invoice/Form")||this.router.url.includes("/menu/Debt/Debt/Join_Bill/New_Join_Bill"))&&(this.isFullContainer=!0)})}initNotificationPermission(){this.notificationAlertService.initPermission()}getCurrentSubscriptionStatus(){this.currentSubStatus=this.authService.getSubscriptionStatus()}subscribeToPushNotification(){let i=localStorage.getItem("NotificationOutletID");M.IsNotEmpty(i)&&M.isGuid(i)?this.signalRClientService.SubscribeGroup(i):this.signalRClientService.startConnection(),this.signalRClientService.OnReceivePushNotification.pipe(D(this.destroy$),E(t=>M.IsNotEmpty(t))).subscribe(t=>{if(M.IsNotEmpty(t)){let n=JSON.parse(t),u="https://cdn.dealpos.xyz/web-image/info-new.png";M.IsNotEmpty(n.Icon)&&(u=n.Icon),this.notificationAlertService.showAlert(n.Body,n.Header,n.URL,u)}})}ngAfterViewInit(){this.intercomService.inititalizeIntercom()}toggleMenu(){this.toggleSideMenu=!this.toggleSideMenu}logout(){this.authService.logout()}isNotEmpty(i){return M.IsNotEmpty(i)}onShowDropdown(){this.isHideIntercomLauncher=this.intercomService.isHideLauncher()}chatToggleChange(){this.isHideIntercomLauncher==!1?this.intercomService.hideLauncher():this.intercomService.showLauncher(),this.onShowDropdown()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(t){return new(t||e)(v(be),v(de),v(w),v(b),v(f),v(ve),v(k),v(A))};static \u0275cmp=W({type:e,selectors:[["POS-menu-master"]],standalone:!1,decls:54,vars:17,consts:[["rla","routerLinkActive"],[1,"wrapper"],["data-color","blue",1,"sidebar",3,"ngClass"],[1,"btn-minimize","d-lg-block","d-none","p-0","border-0","bg-white",3,"click"],[1,"fa-solid",3,"ngClass"],[1,"logo"],[1,"navbar","dropdown","bg-transparent","border-0"],["data-cy","companyName","data-bs-toggle","dropdown","aria-expanded","false","matTooltipPosition","above",1,"simple-text","text-start","dropdown-toggle","d-flex","align-items-center","justify-content-center",2,"cursor","pointer",3,"click","matTooltip"],[1,"dropdown-menu"],[1,"dropdown-header","text-dark","border-bottom"],[1,"divider","m-0"],[1,"dropdown-item","h5",3,"routerLink"],[1,"dropdown-item","h5",2,"cursor","pointer"],[1,"d-flex","align-items-center","justify-content-between"],[1,"fa-solid","fa-comment-dots","me-2"],[1,"checkbox_toggle","ms-3",3,"click"],["type","checkbox","id","chatToggle","name","ChatToggle",3,"ngModelChange","ngModel"],["for","chatToggle",1,"position-relative","rounded-pill","pointer"],[1,"dropdown-item","h5",2,"cursor","pointer",3,"click"],["aria-hidden","true",1,"fa-solid","fa-sign-out-alt","me-2"],[1,"divider"],[1,"dropdown-header","border-top"],["target","_blank",1,"dropdown-item","h5","changelog",3,"href"],["aria-hidden","true",1,"fa-solid","fa-sparkles","me-2"],[1,"fa-solid","fa-circle-exclamation","ms-2",2,"font-size","16px"],["target","_blank","href","http://support.dealpos.com",1,"dropdown-item","h5"],["aria-hidden","true",1,"fa-solid","fa-book","me-2"],["target","_blank","href","https://www.dealpos.app/",1,"dropdown-item","h5"],["aria-hidden","true",1,"fa-solid","fa-table-cells-large","me-2"],["target","_blank","href","http://blog.dealpos.com",1,"dropdown-item","h5"],["aria-hidden","true",1,"fa-brands","fa-blogger","me-2"],[1,"sidebar-wrapper"],[1,"nav"],["routerLinkActive","active",3,"routerLinkActiveOptions"],["id","full-container",1,"main-panel",3,"ngClass"],["aria-hidden","true"],["matTooltipPosition","above",1,"nav-link","position-relative","d-block",3,"matTooltip","routerLink"]],template:function(t,n){t&1&&(o(0,"div",1)(1,"div",2)(2,"button",3),C("click",function(){return n.toggleMenu()}),p(3,"i",4),s(),o(4,"div",5)(5,"div",6)(6,"a",7),C("click",function(){return n.onShowDropdown()}),m(7),ie(8,"limitText"),s(),o(9,"div",8)(10,"div",9),m(11),s(),p(12,"div",10),F(13,Ne,4,4,"a",11,j),o(15,"a",12)(16,"div",13)(17,"div"),p(18,"i",14),o(19,"span"),m(20,"Chat Support"),s()(),o(21,"div",15),C("click",function(a){return a.stopPropagation()}),o(22,"input",16),C("ngModelChange",function(){return n.chatToggleChange()}),s(),p(23,"label",17),s()()(),o(24,"a",18),C("click",function(){return n.logout()}),p(25,"i",19),o(26,"span"),m(27,"Log Out"),s()(),p(28,"div",20),o(29,"div",21),m(30," Links "),s(),o(31,"a",22),p(32,"i",23),o(33,"span"),m(34,"What's New"),p(35,"i",24),s()(),o(36,"a",25),p(37,"i",26),o(38,"span"),m(39,"Help Center"),s()(),o(40,"a",27),p(41,"i",28),o(42,"span"),m(43,"App Store"),s()(),o(44,"a",29),p(45,"i",30),o(46,"span"),m(47,"Company Blog"),s()()()()(),o(48,"div",31)(49,"ul",32),F(50,Ee,6,9,"li",33,j),s()()(),o(52,"div",34),p(53,"router-outlet"),s()()),t&2&&(K("nav-open",n.isNavOpen),c(),h("ngClass",n.toggleSideMenu?"collapses":""),c(2),h("ngClass",n.toggleSideMenu?"fa-angle-left cursor":"fa-angle-right cursor"),c(3),h("matTooltip",n.accountInfo==null?null:n.accountInfo.BrandName),c(),z(" ",ne(8,11,n.accountInfo==null?null:n.accountInfo.BrandName,12)," "),c(4),z("",n.accountInfo==null?null:n.accountInfo.UserName," "),c(2),V(n.topMenu),c(9),h("ngModel",!n.isHideIntercomLauncher),c(9),h("href",X("https://changelog.dealpos.com/?categories=cat_gAZdRhBYU7QVl&view=complete&v=",n.appVersion),Y),c(19),V(n.leftSidebarMenu),c(2),h("ngClass",te(14,Le,n.isFullContainer,n.isNotEmpty(n.currentSubStatus)&&n.currentSubStatus!==n.subsStatusEnum.PAID)))},dependencies:[Se,se,le,ce,me,fe,he,re,Ce],styles:['.sidebar[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .nav-link[_ngcontent-%COMP%], body[_ngcontent-%COMP%] > .navbar-collapse[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .nav-link[_ngcontent-%COMP%]{padding:10px 0 10px 10px!important}.sidebar-wrapper[_ngcontent-%COMP%]{max-height:calc(100% - 61px)!important;min-height:calc(100% - 61px)!important}@media (max-width: 991px){.sidebar-wrapper[_ngcontent-%COMP%]{overflow-y:scroll!important}}@media (pointer: coarse){.sidebar-wrapper[_ngcontent-%COMP%]{overflow-y:scroll!important}}@media (max-width: 468px){.navbar[_ngcontent-%COMP%] .navbar-brand[_ngcontent-%COMP%]{white-space:nowrap;max-width:7em;overflow:hidden;text-overflow:ellipsis}}@media only screen and (min-width: 992px){.sidebar[_ngcontent-%COMP%]{z-index:1050!important;transition:all .3s}.sidebar[_ngcontent-%COMP%] .sidebar-wrapper[_ngcontent-%COMP%]{transition:all .3s}.sidebar[_ngcontent-%COMP%] + .main-panel[_ngcontent-%COMP%]{transition:all .3s}.sidebar[_ngcontent-%COMP%] + .main-panel[_ngcontent-%COMP%] .navbar.fixed-top[_ngcontent-%COMP%]{transition:all .3s}.sidebar.collapses[_ngcontent-%COMP%], .sidebar.collapses[_ngcontent-%COMP%] .sidebar-wrapper[_ngcontent-%COMP%]{width:70px;transition:all .3s}.sidebar.collapses[_ngcontent-%COMP%] .logo[_ngcontent-%COMP%] .simple-text[_ngcontent-%COMP%]{background-color:#ffffff3b;border-radius:20px;height:40px;width:40px}.sidebar.collapses[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .nav-link[_ngcontent-%COMP%]{padding:10px 0 10px 10px!important;height:50px;text-align:center;margin:10px}.sidebar.collapses[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .nav-link[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{display:none}.sidebar.collapses[_ngcontent-%COMP%] + .main-panel[_ngcontent-%COMP%]{padding-left:70px}.sidebar.collapses[_ngcontent-%COMP%] + .main-panel[_ngcontent-%COMP%] .navbar.fixed-top[_ngcontent-%COMP%]{left:70px!important;transition:all .3s}.sidebar[_ngcontent-%COMP%] .btn-minimize[_ngcontent-%COMP%]{position:absolute;top:17px;right:-20px;z-index:7;-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);border-radius:50%;box-shadow:0 0 0 1px #091e4214,0 2px 4px 1px #091e4214;color:#000;cursor:pointer;height:24px;opacity:0;outline:0;width:24px;-webkit-transform-origin:7px;-ms-transform-origin:7px;transform-origin:7px;transition:opacity .5s;-webkit-transition:opacity .5s}.sidebar[_ngcontent-%COMP%] .btn-minimize[_ngcontent-%COMP%]:hover{color:#2996cc}.sidebar[_ngcontent-%COMP%]:hover .btn-minimize[_ngcontent-%COMP%]{opacity:1;background-color:#fff;position:absolute;top:17px;right:-20px;z-index:7;-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);border:0;border-radius:50%;box-shadow:0 0 0 1px #091e4214,0 2px 4px 1px #091e4214;color:#000;cursor:pointer;height:24px;opacity:0;outline:0;padding:0;width:24px;-webkit-transform-origin:7px;-ms-transform-origin:7px;transform-origin:7px;transition:opacity .5s;-webkit-transition:opacity .5s}.sidebar[_ngcontent-%COMP%]:hover .btn-minimize[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{cursor:pointer}.sidebar[_ngcontent-%COMP%]:hover .btn-minimize[_ngcontent-%COMP%]:hover{color:#2996cc}.sidebar[_ngcontent-%COMP%]:hover:hover .btn-minimize[_ngcontent-%COMP%]{opacity:1}}.full-container[_ngcontent-%COMP%]{padding-top:0!important}.changelog[_ngcontent-%COMP%]{color:#0006b1!important}.changelog[_ngcontent-%COMP%]:visited{color:#2e2e2e!important}.changelog[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{position:relative}.changelog[_ngcontent-%COMP%] span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#fe3a00!important;position:absolute;top:-4px;right:-18px}.changelog[_ngcontent-%COMP%]:visited span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#fff!important;position:absolute;top:-4px;right:-18px}.changelog[_ngcontent-%COMP%]:visited:hover span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#e9ecef!important;position:absolute;top:-4px;right:-18px}.subscription-bar-visible[_ngcontent-%COMP%]{padding-top:98px}.checkbox_toggle[_ngcontent-%COMP%]{position:relative}.checkbox_toggle[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{color:#868686;display:inline-block;padding-right:38px}.checkbox_toggle[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{width:23px;height:14px;background-color:#ccc;top:2.2px;right:0}.checkbox_toggle[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{display:none}.checkbox_toggle[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background-color:#1f77d0}.checkbox_toggle[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]:after{left:10px}.checkbox_toggle[_ngcontent-%COMP%] label[_ngcontent-%COMP%]:after{content:"";width:12px;height:12px;border-radius:50%;position:absolute;top:.8px;left:1px;transition:all .1s;background-color:#fff}']})};function De(e){let i=l(b),t="/menu";e.forEach(a=>t+=`/${a.path}`);let n=i.currentNavigation().extractedUrl.queryParams;return Object.keys(n).forEach((a,g)=>{g==0?t=`${t}?${a}=${n[a]}`:t=`${t}&${a}=${n[a]}`}),t}var O=(e,i)=>{let t=l(f),n=t.isTokenExpired(),u=l(b);return n?(t.returnUrl=De(i),u.navigate(["/"]),!1):e.path=="Dashboard"?je():!0};function je(){let e=l(b),i=l(f),t=!1,n=i.getRedirectUrl();return t=n.includes("Dashboard"),t==!1&&e.navigate([n]),t}var U=class e{paymentStorageService=l(Pe);canActivate(i,t){return this.paymentStorageService.clear(),!0}static \u0275fac=function(t){return new(t||e)};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var L=class e{reportService=l(_e);canActivate(i,t){return this.reportService.resetFilter(),!0}static \u0275fac=function(t){return new(t||e)};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var Fe=[{path:"",component:P,children:[{path:"Inventory",loadChildren:()=>import("./chunk-FSSIO7GL.js").then(e=>e.InventoryModule),canLoad:[r]},{path:"Reports",loadChildren:()=>import("./chunk-GAMK6E3M.js").then(e=>e.ReportsModule),canLoad:[r],canActivate:[L]},{path:"Sell",loadChildren:()=>import("./chunk-W3TN26PX.js").then(e=>e.routes),canLoad:[r]},{path:"Print",loadChildren:()=>import("./chunk-57GKJ4WM.js").then(e=>e.PrintModule),canLoad:[r]},{path:"Buy",loadComponent:()=>import("./chunk-SZCBZJWT.js").then(e=>e.BuyV2Component),canMatch:[O]},{path:"Sell/V2",loadComponent:()=>import("./chunk-NIT4LLPE.js").then(e=>e.SellV2Component),canMatch:[O]},{path:"Dashboard",loadComponent:()=>import("./chunk-3R6XTRIS.js").then(e=>e.DashboardV2Component),canMatch:[O]},{path:"Products",loadChildren:()=>import("./chunk-GC6XKSVW.js").then(e=>e.ProductModule),canLoad:[r]},{path:"Shift",loadChildren:()=>import("./chunk-E42VMBXZ.js").then(e=>e.ShiftModule),canLoad:[r]},{path:"Debt",loadChildren:()=>import("./chunk-FZCOVHS7.js").then(e=>e.DebtModule),canLoad:[r]},{path:"Logistics",loadChildren:()=>import("./chunk-T6O6272L.js").then(e=>e.DeliveryModule),canLoad:[r]},{path:"Users",loadChildren:()=>import("./chunk-WCIAQ44B.js").then(e=>e.UsersModule),canLoad:[r]},{path:"Setup",loadChildren:()=>import("./chunk-ROLD7LRS.js").then(e=>e.SetupModule),canLoad:[r]},{path:"Developer",loadChildren:()=>import("./chunk-F2I7C3M3.js").then(e=>e.DeveloperModule),canLoad:[r]},{path:"Contacts",loadChildren:()=>import("./chunk-N5UL5CKI.js").then(e=>e.ContactsModule),canLoad:[r]},{path:"Outlets",loadChildren:()=>import("./chunk-ZH54LQDR.js").then(e=>e.OutletsModule),canLoad:[r]},{path:"Orders",loadChildren:()=>import("./chunk-QWGF65NY.js").then(e=>e.OrdersModule),canLoad:[r]},{path:"Profile",loadChildren:()=>import("./chunk-RF626YRZ.js").then(e=>e.ProfileModule),canLoad:[r]},{path:"Estimate",loadComponent:()=>import("./chunk-MBB74QVL.js").then(e=>e.EstimateV2Component),canMatch:[O]},{path:"Adjustment",loadChildren:()=>import("./chunk-X7GD2PTG.js").then(e=>e.AdjustmentModule),canLoad:[r]},{path:"Payment",loadChildren:()=>import("./chunk-Y54ES5RG.js").then(e=>e.PaymentModule),canLoad:[r],canActivate:[U]},{path:"Promotion",loadChildren:()=>import("./chunk-GRT6SQUV.js").then(e=>e.PromotionModule),canLoad:[r]},{path:"Manufacture",loadChildren:()=>import("./chunk-DF4DHBHG.js").then(e=>e.ManufactureModule),canLoad:[r]},{path:"Prepaid_Package",loadChildren:()=>import("./chunk-DI4JWRN2.js").then(e=>e.PrepaidPackageModule),canLoad:[r]},{path:"Fulfillment",loadChildren:()=>import("./chunk-JQQXPIW7.js").then(e=>e.FulfillmentModule),canLoad:[r]},{path:"Unauthorized",loadChildren:()=>import("./chunk-A2HQD76V.js").then(e=>e.UnauthorizedModule),canLoad:[r]},{path:"Not_Found",loadChildren:()=>import("./chunk-HSURS7A5.js").then(e=>e.NotFoundModule),canLoad:[r]},{path:"",redirectTo:"/menu/Dashboard",pathMatch:"full"},{path:"**",redirectTo:"Not_Found"}]}],R=class e{static \u0275fac=function(t){return new(t||e)};static \u0275mod=x({type:e});static \u0275inj=y({imports:[G.forChild(Fe),G]})};var xe=class e{constructor(){}static \u0275fac=function(t){return new(t||e)};static \u0275mod=x({type:e,bootstrap:[P]});static \u0275inj=y({imports:[Me,R,ge,oe]})};export{xe as MenuMasterModule};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as xo}from"./chunk-YXCPHYC5.js";import{a as zt,b as Yt}from"./chunk-JFLT7NX3.js";import{a as Bo}from"./chunk-RACYAEOL.js";import{a as Di}from"./chunk-W3VF2RCW.js";import{e as wo}from"./chunk-QJUU75N6.js";import{b as ko}from"./chunk-D7DUI5NF.js";import{d as Ao}from"./chunk-TXJJUZ26.js";import{a as No}from"./chunk-BNNKSBQ6.js";import{a as Io}from"./chunk-IZLEZJ6U.js";import{a as he,b as Re,e as Lo}from"./chunk-4XJWQAS6.js";import{b as Eo}from"./chunk-DC3TCY6D.js";import{a as Do,b as Vo,c as Fo}from"./chunk-CQLZHUT4.js";import{a as Mo}from"./chunk-S27D5MBU.js";import{a as jo}from"./chunk-HGSF7LOB.js";import{b as Dn,c as Oo}from"./chunk-CVNF5DNI.js";import{a as xt}from"./chunk-25H27N7N.js";import{a as lo}from"./chunk-T7XU5W5A.js";import{a as To}from"./chunk-MNJSQKLX.js";import{a as Mi,b as xi,c as Ii}from"./chunk-OXWQ7ZZS.js";import{a as Ro}from"./chunk-4CPRMZL6.js";import{a as Ho}from"./chunk-ESDXMFGP.js";import{a as Ke}from"./chunk-J6U6UYNI.js";import{a as tt,b as mt,c as me}from"./chunk-NSNUUKNK.js";import{a as Oi,b as xe}from"./chunk-EN2Y56CS.js";import{a as Pn,b as Jt,c as On}from"./chunk-PXDS3HXW.js";import{b as Po}from"./chunk-WKM2QOAU.js";import{a as So}from"./chunk-ZMJLTU5O.js";import{g as bo}from"./chunk-PRVQ3NAP.js";import{d as Pi}from"./chunk-WMZLH4YK.js";import{p as mo}from"./chunk-6WATOQG3.js";import{d as co}from"./chunk-XTCEZONP.js";import{a as go,c as Dt}from"./chunk-D4FCXEV4.js";import{g as po}from"./chunk-6P2ASCNY.js";import{B as _o,C as oe,D as Oe,G as yo,u as ie,v as ne,w as Ot}from"./chunk-26YFRPR2.js";import{b as yi,c as $t}from"./chunk-JBS5UYZC.js";import{F as Mt,N as Si,O as U,g as fo,n as bi,o as ho,q as Co,t as vo}from"./chunk-TEGIL5RZ.js";import{a as rt}from"./chunk-B7AC4RMR.js";import{a as fi,c as hi}from"./chunk-EQLHPWVB.js";import{d as Pt,e as uo}from"./chunk-THT6CY5E.js";import{a as ee,b as so,e as te,f as fe,g as we}from"./chunk-ZTD4APMR.js";import{a as de}from"./chunk-2FWFPV5I.js";import{A as ro,B as ao,F as vi,c as Te,e as Ci,h as Pe,i as Xn,k as eo,l as et,n as to,o as Ee,p as io,s as St,x as no,y as oo}from"./chunk-DWZ5JTI2.js";import{b as _i}from"./chunk-YVBGB3JF.js";import{a as f}from"./chunk-WUV22SZ4.js";import{a as Zn}from"./chunk-C5DGBRES.js";import{p as F,s as ge}from"./chunk-LGOSIAUC.js";import{$ as li,Ab as C,Bb as ot,Bc as jn,Ca as R,Cb as ve,Db as K,E as ce,Eb as Z,Fb as p,Fc as y,Gb as a,Gc as x,Gd as $n,Hb as s,Hc as X,I as nt,Ib as b,Ic as yt,Jb as V,Kb as Q,Kd as Jn,Lb as Xe,Lc as Qn,M as ht,Mb as Ct,N as Qe,Nb as vt,Ob as pi,Oc as ae,Pb as E,Pd as zn,Q as Fe,Qa as Je,Qb as Fn,Qd as Yn,Sa as dt,Sb as S,Sc as bt,Sd as Kn,Ta as Vn,Tb as Ln,Tc as qt,Ub as m,Xa as l,Xc as gi,Y as Le,Yb as Ut,Zb as Wt,_b as Gt,aa as Y,b as ri,cc as ue,d as Me,da as Ie,dc as Bn,e as be,eb as P,fa as le,gc as ui,gd as Be,hc as d,ib as N,ic as M,id as Un,jb as di,jc as D,jd as Wn,k as gt,kc as _t,la as I,lc as Hn,ma as ci,mc as B,md as Gn,n as An,nc as A,nd as qn,o as ke,oa as g,ob as $,oc as H,od as ze,p as ft,pa as T,q as ai,qd as Ye,r as si,sd as q,t as J,ta as v,u as $e,ua as _,v as kn,vd as Se,wb as mi,yb as h,yc as j,zb as Sn,zc as Ue}from"./chunk-IEVGW2RT.js";import{a as ni,i as Ze,k as oi}from"./chunk-SNAKHGZS.js";var We=class{constructor(e){this.roleService=e;e&&this.setRole()}_Retrieve;_DateEditor;_NumberEditor;_PriceVisible;_UnitPriceEditor;_PricebookSelector;_Cost;_Return;_Discount;_SalesPerson;_PriceMinimum;_Payment;_CreditSalesLock;_CustomerInputLock;_PaymentCodeLock;_Shipping;_Tax;_DeleteItem;_BundlingPrice;_EmailRestriction;_ParkedDeletionAuthorized;_SellEditor;_ContactCreate;_PrepaidPackageCreate;_Order;_Reprint;_Contacts;_ContactsCreate;_InventoryView;_DebtView;_ClearCart;_SellDelete;_DeliveryEditor;_CouponInputLock;_Park;_Commission;setRole(){this._Retrieve=this.roleService.sell.RetrieveR,this._DateEditor=this.roleService.global.Date,this._NumberEditor=this.roleService.sell.Number,this._PriceVisible=this.roleService.sell.PriceVisible,this._SalesPerson=this.roleService.sell.SalesPerson,this._UnitPriceEditor=this.roleService.sell.UnitPriceEditor,this._PricebookSelector=this.roleService.sell.PricebookSelector,this._Cost=this.roleService.product.Cost,this._Return=this.roleService.sell.Return,this._Discount=this.roleService.sell.Discount,this._PriceMinimum=this.roleService.sell.PriceMinimum,this._Payment=this.roleService.sell.Payment,this._CreditSalesLock=this.roleService.sell.CreditSalesLock,this._CustomerInputLock=this.roleService.sell.CustomerInputLock,this._PaymentCodeLock=this.roleService.sell.PaymentCodeLock,this._Shipping=this.roleService.sell.Shipping,this._Tax=this.roleService.sell.Tax,this._DeleteItem=this.roleService.sell.DeleteItem,this._BundlingPrice=this.roleService.sell.BundlingPrice,this._EmailRestriction=this.roleService.sell.Email,this._SellEditor=this.roleService.sell.Edit,this._ContactCreate=this.roleService.contact.Create,this._PrepaidPackageCreate=this.roleService.prepaidPackage.Create,this._Order=this.roleService.order.View,this._Contacts=this.roleService.contact.View,this._ContactsCreate=this.roleService.contact.Create,this._InventoryView=this.roleService.inventory.View,this._DebtView=this.roleService.debt.View,this._ClearCart=this.roleService.sell.DeleteItem,this._SellDelete=this.roleService.sell.Delete,this._DeliveryEditor=this.roleService.logistic.Edit,this._Reprint=this.roleService.order.Print,this._CouponInputLock=this.roleService.sell.CouponInputLock,this._Park=this.roleService.sell.Park,this._Commission=this.roleService.product.CommissionView}get Park(){return this._Park}get CouponInputLock(){return this._CouponInputLock}set CouponInputLock(e){this._CouponInputLock=e}get Retrieve(){return this._Retrieve}get DateEditor(){return this._DateEditor}set DateEditor(e){this._DateEditor=e}get NumberEditor(){return this._NumberEditor}set NumberEditor(e){this._NumberEditor=e}get PriceVisible(){return this._PriceVisible}get UnitPriceEditor(){return this._UnitPriceEditor}set UnitPriceEditor(e){this._UnitPriceEditor=e}get PricebookSelector(){return this._PricebookSelector}set PricebookSelector(e){this._PricebookSelector=e}get Cost(){return this._Cost}get Return(){return this._Return}set Return(e){this._Return=e}get Discount(){return this._Discount}set Discount(e){this._Discount=e}get SalesPerson(){return this._SalesPerson}get PriceMinimum(){return this._PriceMinimum}get Payment(){return this._Payment}get CreditSalesLock(){return this._CreditSalesLock}get CustomerInputLock(){return this._CustomerInputLock}get PaymentCodeLock(){return this._PaymentCodeLock}get Shipping(){return this._Shipping}get Tax(){return this._Tax}set Tax(e){this._Tax=e}get DeleteItem(){return this._DeleteItem}set DeleteItem(e){this._DeleteItem=e}get BundlingPrice(){return this._BundlingPrice}get Email(){return this._EmailRestriction}get ParkedDeletionAuthorized(){return this._ParkedDeletionAuthorized}set ParkedDeletionAuthorized(e){this._ParkedDeletionAuthorized=e}get SellEditor(){return this._SellEditor}get PrepaidPackageCreate(){return this._PrepaidPackageCreate}get Order(){return this._Order}get Reprint(){return this._Reprint}get Contacts(){return this._Contacts}get ContactsCreate(){return this._ContactsCreate}get InventoryView(){return this._InventoryView}get DebtView(){return this._DebtView}get ClearCartRestriction(){return this._ClearCart}get SellDelete(){return this._SellDelete}get DeliveryEditor(){return this._DeliveryEditor}get Commission(){return this._Commission}};var Kt=class{DeliveryEntityID;Type;NewOrderID;constructor(){this.DeliveryEntityID="",this.Type=3}};var Ti=class{Type;Amount;Notification;ApplyToProduct;Requirement};var G=class{Order;Invoice;Shipping;Action;Payments;Items;CartItems;Promotion;ContactName;SplitParkLabel;get cartQuantity(){let e=0;for(let t of this.CartItems)e+=t.Quantity;return e}constructor(){this.Order=new Dn,this.Invoice=new Jt,this.Shipping=new On,this.Action=new Kt,this.Payments=Array(),this.Items=Array(),this.CartItems=Array(),this.ContactName=""}get TotalPaidAmount(){let e=0;return this.Payments.forEach(t=>{e+=t.PaidAmount}),e}get RedeemableAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID!=1);return this.GetAmountByCart(e)}get TotalQuantity(){let e=0;return this.CartItems.forEach(t=>{t.PromotionGift||(e+=t.Quantity)}),e}get CashOnlyAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID==1);return this.GetAmountByCart(e)}get PointOnlyAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID==2);return this.GetAmountByCart(e)}get PrepaidPackageItem(){return this.CartItems.filter(t=>t.Variant.TypeID==10)}GetAmountByCart(e){let t=0;return e.forEach(i=>{t+=i.Total}),t=t*(100-this.Order.Discount)/100,t=t*(100-this.Order.Discount2)/100,t}getRewards(){return this.CartItems.filter(t=>t.PromotionGift)}};Ze([tt(()=>Dn)],G.prototype,"Order",2),Ze([tt(()=>Jt)],G.prototype,"Invoice",2),Ze([tt(()=>On)],G.prototype,"Shipping",2),Ze([tt(()=>Kt)],G.prototype,"Action",2),Ze([tt(()=>Ke)],G.prototype,"Payments",2),Ze([tt(()=>Oi)],G.prototype,"Items",2),Ze([tt(()=>xe)],G.prototype,"CartItems",2),Ze([tt(()=>Ti)],G.prototype,"Promotion",2);var Ei=class{Success;Message;message;ObjectID;SalesOrderID;OutDeliveryID;Contact;LoyaltyPoint;InvoiceNumber;Creator;OrderTimeString;PrintMode;PaymentStateID;PaymentStateLabel;Final;InvoiceNumberResult;constructor(){this.Success=!0,this.Message="",this.ObjectID="",this.SalesOrderID="",this.OutDeliveryID="",this.Contact=null,this.LoyaltyPoint="",this.InvoiceNumber="",this.Creator="",this.OrderTimeString="",this.PrintMode=0,this.PaymentStateID=0,this.PaymentStateLabel="",this.Final=0}};var It=class n{constructor(e,t,i,o){this.httpService=e;this._localDataService=t;this._onlineStatusService=i;this._toastrService=o;this._onlineStatusService.getOnlineStatus$().subscribe(r=>{this.isOnline=r})}_Data=new be(null);Data$=this._Data.pipe(Fe(),ce(e=>e!==null));isOnline;get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}getSalesOrderPrint(e){return this.httpService.post("/API/POS/GetSalesOrderPrint",{TemplateID:e})}submitOrder(e,t){let i=this.generatePOSDataForSubmission(e,this.isOnline);if(this.isOnline)return this.submitOnline(i).pipe(this.handleTimeOutError(i));if(t.ModuleSell.EnableOfflineTransaction)return this._localDataService.syncOrder(i).pipe(J(()=>this.generateCompleteData(i)));this._toastrService.warning("Offline order is not Supported!","Info!")}uploadOfflineOrder(e){return this._localDataService.uploadSingleOrder(e).pipe(nt(t=>t?.message?.includes("objectStore does not exists")?this.submitOnline(e):ft(()=>t)))}submitOnline(e){return this.httpService.post(U.SubmitOrder,e,Zn.pos.submitOrderTimeout)}handleTimeOutError(e){return ri(nt(t=>{if(t instanceof si||t?.name=="TimeoutError"){let i=this.generateCompleteData(e);this.pushNewValue(i)}throw t}))}generatePOSDataForSubmission(e,t=!0){let i=Object.assign(new G,e);i.Items=[],i.Order.CustomerID==null&&(i.Order.CustomerID=f.GuidEmpty),i.Order.SalesID==null&&(i.Order.SalesID=f.GuidEmpty);let o=1;i.Payments=i.Payments.map(c=>(c.Date=i.Order.Date,c.Index=o,o++,delete c.TypeID,c));let r=1;for(let c of i.CartItems){let u=new Oi;u.ID=c.ID,u.VariantID=c.VariantID,u.Quantity=c.Quantity,u.Cost=c.Cost,u.Price=c.Price,u.Discount=c.Discount,u.DiscountAmount=c.DiscountAmount,u.Note=c.Note,u.Taxable=c.Variant.Taxable,u.LoyaltyPoint=c.LoyaltyPoint,u.UnitCost=c.Cost,u.UnitPrice=c.Price,u.UnitPriceOriginal=c.UnitPriceOriginal,u.UnitExpense=c.UnitExpense,u.EntityID=c.EntityID,u.Index=r,u.UnitQuantity=c.UnitQuantity,u.PriceTypeID=c.PriceTypeID,u.PriceNote=c.PriceNote,u.Splited=c.SplitQuantity>0,u.SplitQuantity=c.SplitQuantity,u.InventoryTypeID=c.Variant.TypeID,u.SalesID="",u.Serial=c.Serial,c.SalesID&&(u.SalesID=c.SalesID),delete c.CouponDiscount,i.Items.push(u),r++}return t?(delete i.CartItems,delete i.Order.ClientTimestamp):i.Order.ClientTimestamp=new Date,i}generateCompleteData(e){let t=new Ei;return t.InvoiceNumber=e.Order.Number,t.OrderTimeString=new Date().toString(),t.PaymentStateID=e.Action?.Type,t.PaymentStateLabel="Offline",t.Success=!0,t.OutDeliveryID=e.Action.DeliveryEntityID,t}GetReturnInvoice(e,t){return this.httpService.get(U.ReturInvoice,[{key:"EntityID",value:t},{key:"Number",value:e}])}GetInvoiceBySoID(e){return this.httpService.get(U.GetPOSDataByID,[{key:"ID",value:e}])}UploadCSV(e,t){let i={CartItems:e,EntityID:t};return this.httpService.post(U.UploadCsv,i)}sendEmail(e,t){return new Promise((i,o)=>{this._localDataService.isProductFromServer().subscribe(r=>{if(r){let c={invoiceID:t,email:e};this.httpService.post(U.SendInvoiceEmail,c).subscribe({next:u=>{i(u)},error:u=>{o(u)}})}else o(oe.wrongOfflineAction)})})}sendWhatsaap(e,t){let i={InvoiceID:e,PhoneNumber:t};return this.httpService.post(U.SendInvoiceWhatsapp,i)}createCustomerByInvoice(e,t){let i={InvoiceID:e,Mobile:t};return this.httpService.post(U.CreateCustomerInvoice,i)}saveCommission(e,t){let i={SOID:e,commission:t};return this.httpService.POSText("/API/Transaction/SetCommission",i)}generateReceiptA4(e){let t={ID:e};return this.httpService.post(U.InvoiceA4,t)}getVacant(e){return this.httpService.get(U.GetVacant,[{key:"EntityID",value:e}])}static \u0275fac=function(t){return new(t||n)(g(ge),g(Oe),g(he),g(F))};static \u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"})};var Xt=(r=>(r[r.cash=1]="cash",r[r.card=2]="card",r[r.emoney=3]="emoney",r[r.other=4]="other",r[r.ECR=99]="ECR",r))(Xt||{});var L=class n{constructor(e,t,i){this._OrderHttpService=e;this._customerHttpService=t;this._toastrService=i}_Data=new be(new G);transaction_id;Data$=this._Data.asObservable();get Data(){return this._Data.value}pushNewValue(e){if(e)this._Data.next(e);else{let t=this.Data;this._Data.next(t)}}submitOrder(e){return new Promise((t,i)=>{this.checkTransactionId(),this._OrderHttpService.submitOrder(this.Data,e).subscribe({next:o=>{t(o)},error:o=>{this.Data.Items=[],i(o)}})})}uploadOfflineOrder(){return this.checkTransactionId(),this._OrderHttpService.uploadOfflineOrder(this.Data)}checkTransactionId(){let t=this.Data.Payments.find(i=>i.TypeID==3);f.IsNotEmpty(t)&&f.IsEmpty(this.transaction_id)&&this._toastrService.warning("Midtrans transaction_id is empty. Please verify manually!","Mobile Payment Failure")}updateCustomerID(e){return this.Data.Order.CustomerID=e,this.pushNewValue(this.Data),new Promise((t,i)=>{this._customerHttpService.GetPrivilegeByID(e,this.Data.Order.EntityID).subscribe({next:o=>{this._customerHttpService.Data=o,this.pushNewValue(this.Data),t(o)},error:o=>{this.Data.Order.CustomerID=null,this.Data.ContactName=null;let r=o.error?.Message;o.status==409?this._toastrService.warning(r,"Warning"):this._toastrService.error(r,`API Error - ${o.status}`),i(o)}})})}static \u0275fac=function(t){return new(t||n)(g(It),g(Re),g(F))};static \u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"})};var z=class n{constructor(e,t,i){this._localDataService=e;this._onlineStatusService=t;this._httpService=i;this._onlineStatusService.getOnlineStatus$().subscribe(o=>{this.isOnline=o})}_Data=new be(null);Data$=this._Data.asObservable().pipe(ce(e=>e!==null),Fe());isOnline;get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}requestObservable(){return this.isOnline?this._httpService.get(U.GetPOSStorage).pipe(J(e=>({data:e,type:"Online"}))):this._localDataService.getPOSStorage().pipe(ce(e=>e!=null),J(e=>({data:e,type:"Offline"})))}getOutletName(e){return this.Data.Entities.find(i=>i.ID==e)?.Name}static \u0275fac=function(t){return new(t||n)(g(Oe),g(he),g(ge))};static \u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"})};var De=class n{constructor(e){this.roleService=e;this.pushNewValue(new We(e))}_Data=new be(new We(null));get Data(){return this._Data.value}Data$=this._Data.asObservable();pushNewValue(e){this._Data.next(e)}static \u0275fac=function(t){return new(t||n)(g(_i))};static \u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"})};var ti=class{ID;Code;EntityID;Name;Description;Start;StartDisplay;State;Open;CashierID;OpeningCash;EntityName;LoginID;Active;CustomerDisplayEnabled;OvoConfigurationID;CustomerDisplayID;ListImage;Suspended};var wi=class n{odsConfigType=R(0);setODSConfig(e){this.odsConfigType.set(e)}isEnabled(){return this.odsConfigType()>0}static \u0275fac=function(t){return new(t||n)};static \u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"})};var sr=n=>({active:n}),lr=n=>({gray:n});function cr(n,e){if(n&1){let t=E();a(0,"span",15),S("click",function(o){v(t);let r=m().$implicit;return m().closeRegister(r),_(o.stopPropagation())}),s()}}function dr(n,e){n&1&&(a(0,"div")(1,"span",16),d(2,"VACANT"),s()())}function mr(n,e){if(n&1&&(a(0,"div")(1,"span",17),b(2,"i",18),a(3,"span",19),d(4),s()(),a(5,"span",20),b(6,"i",21),a(7,"span",19),d(8),s()()()),n&2){let t=m().$implicit;l(4),M(t.LoginID),l(4),D("",t.StartDisplay.split(" ")[3]," - Now")}}function pr(n,e){if(n&1){let t=E();a(0,"div",8)(1,"div",9)(2,"div",10)(3,"h5",11),S("click",function(){let o=v(t).$implicit,r=m();return _(r.select(o))}),a(4,"span"),b(5,"i",12),d(6),y(7,"limitTo"),s(),h(8,cr,1,0,"span",13),s(),a(9,"div",14),S("click",function(){let o=v(t).$implicit,r=m();return _(r.select(o))}),h(10,dr,3,0,"div")(11,mr,9,2,"div"),s()()()()}if(n&2){let t,i=e.$implicit,o=m();l(),p("ngClass",i.Active?"active":""),l(),p("ngClass",j(9,sr,(i==null?null:i.ID)==(o.selectedRegister==null?null:o.selectedRegister.ID))),l(),p("ngClass",j(11,lr,i!=o.selectedRegister)),l(3),M(X(7,6,i.Name,15)),l(2),C(i.State!="Close"?8:-1),l(2),C((t=i.State)==="Close"?10:t==="Open"?11:-1)}}var Ri=class n{constructor(e,t,i,o,r,c,u){this._dialogRef=e;this._outletService=t;this._posService=i;this._userRoleService=o;this.router=r;this.httpService=c;this._odsService=u}originalSelectedRegister=null;registers;searchInput="";selectedRegister=new ti;modalConfig=new ie;role;get AppConfigJSON(){return this._posService.Data.AppConfigJSON}destroy$=new Me;ngOnInit(){this.subscribeToObsChanges(),this.initModalConfig()}subscribeToObsChanges(){this._posService.Data$.pipe(Ie(this.destroy$)).subscribe(e=>{this.registers=e.Registers}),this._outletService.Data$.pipe(Ie(this.destroy$)).subscribe(e=>{this.selectedRegister=this.findOutletRegisterById(e.RegisterID),this.originalSelectedRegister=this.selectedRegister?ni({},this.selectedRegister):null}),this._userRoleService.Data$.pipe(Ie(this.destroy$)).subscribe(e=>{this.role=e})}findOutletRegisterById(e){let t=this.registers.find(i=>i.ID===e);return t||new ti}initModalConfig(){this.modalConfig.hideFooter=!0,this.modalConfig.hideScrollbar=!0,this.modalConfig.title="Choose an outlet"}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}onClose(){this._dialogRef.close()}select(e){if(this.AppConfigJSON.ModuleShift.Closure.Enabled)if(this.selectedRegister.ID!=null&&this.selectedRegister.Open&&e.CashierID==null)confirm("You already have an active register with "+this.selectedRegister.Name+`!
|
|
1
|
+
import{a as xo}from"./chunk-YXCPHYC5.js";import{a as zt,b as Yt}from"./chunk-JFLT7NX3.js";import{a as Bo}from"./chunk-RACYAEOL.js";import{a as Di}from"./chunk-W3VF2RCW.js";import{e as wo}from"./chunk-QJUU75N6.js";import{b as ko}from"./chunk-D7DUI5NF.js";import{d as Ao}from"./chunk-TXJJUZ26.js";import{a as No}from"./chunk-BNNKSBQ6.js";import{a as Io}from"./chunk-IZLEZJ6U.js";import{a as he,b as Re,e as Lo}from"./chunk-4XJWQAS6.js";import{b as Eo}from"./chunk-DC3TCY6D.js";import{a as Do,b as Vo,c as Fo}from"./chunk-CQLZHUT4.js";import{a as Mo}from"./chunk-S27D5MBU.js";import{a as jo}from"./chunk-HGSF7LOB.js";import{c as Dn,d as Oo}from"./chunk-7BVPHIEF.js";import{a as xt}from"./chunk-25H27N7N.js";import{a as lo}from"./chunk-T7XU5W5A.js";import{a as To}from"./chunk-MNJSQKLX.js";import{a as Mi,b as xi,c as Ii}from"./chunk-OXWQ7ZZS.js";import{a as Ro}from"./chunk-4CPRMZL6.js";import{a as Ho}from"./chunk-ESDXMFGP.js";import{a as Ke}from"./chunk-J6U6UYNI.js";import{a as tt,b as mt,c as me}from"./chunk-NSNUUKNK.js";import{a as Oi,b as xe}from"./chunk-EN2Y56CS.js";import{a as Pn,b as Jt,c as On}from"./chunk-PXDS3HXW.js";import{b as Po}from"./chunk-WKM2QOAU.js";import{a as So}from"./chunk-ZMJLTU5O.js";import{g as bo}from"./chunk-PRVQ3NAP.js";import{d as Pi}from"./chunk-WMZLH4YK.js";import{p as mo}from"./chunk-6WATOQG3.js";import{d as co}from"./chunk-XTCEZONP.js";import{a as go,c as Dt}from"./chunk-D4FCXEV4.js";import{g as po}from"./chunk-6P2ASCNY.js";import{B as _o,C as oe,D as Oe,G as yo,u as ie,v as ne,w as Ot}from"./chunk-26YFRPR2.js";import{b as yi,c as $t}from"./chunk-JBS5UYZC.js";import{F as Mt,N as Si,O as U,g as fo,n as bi,o as ho,q as Co,t as vo}from"./chunk-TEGIL5RZ.js";import{a as rt}from"./chunk-B7AC4RMR.js";import{a as fi,c as hi}from"./chunk-EQLHPWVB.js";import{d as Pt,e as uo}from"./chunk-THT6CY5E.js";import{a as ee,b as so,e as te,f as fe,g as we}from"./chunk-ZTD4APMR.js";import{a as de}from"./chunk-2FWFPV5I.js";import{A as ro,B as ao,F as vi,c as Te,e as Ci,h as Pe,i as Xn,k as eo,l as et,n as to,o as Ee,p as io,s as St,x as no,y as oo}from"./chunk-DWZ5JTI2.js";import{b as _i}from"./chunk-YVBGB3JF.js";import{a as f}from"./chunk-WUV22SZ4.js";import{a as Zn}from"./chunk-JSYUX55K.js";import{p as F,s as ge}from"./chunk-LGOSIAUC.js";import{$ as li,Ab as C,Bb as ot,Bc as jn,Ca as R,Cb as ve,Db as K,E as ce,Eb as Z,Fb as p,Fc as y,Gb as a,Gc as x,Gd as $n,Hb as s,Hc as X,I as nt,Ib as b,Ic as yt,Jb as V,Kb as Q,Kd as Jn,Lb as Xe,Lc as Qn,M as ht,Mb as Ct,N as Qe,Nb as vt,Ob as pi,Oc as ae,Pb as E,Pd as zn,Q as Fe,Qa as Je,Qb as Fn,Qd as Yn,Sa as dt,Sb as S,Sc as bt,Sd as Kn,Ta as Vn,Tb as Ln,Tc as qt,Ub as m,Xa as l,Xc as gi,Y as Le,Yb as Ut,Zb as Wt,_b as Gt,aa as Y,b as ri,cc as ue,d as Me,da as Ie,dc as Bn,e as be,eb as P,fa as le,gc as ui,gd as Be,hc as d,ib as N,ic as M,id as Un,jb as di,jc as D,jd as Wn,k as gt,kc as _t,la as I,lc as Hn,ma as ci,mc as B,md as Gn,n as An,nc as A,nd as qn,o as ke,oa as g,ob as $,oc as H,od as ze,p as ft,pa as T,q as ai,qd as Ye,r as si,sd as q,t as J,ta as v,u as $e,ua as _,v as kn,vd as Se,wb as mi,yb as h,yc as j,zb as Sn,zc as Ue}from"./chunk-IEVGW2RT.js";import{a as ni,i as Ze,k as oi}from"./chunk-SNAKHGZS.js";var We=class{constructor(e){this.roleService=e;e&&this.setRole()}_Retrieve;_DateEditor;_NumberEditor;_PriceVisible;_UnitPriceEditor;_PricebookSelector;_Cost;_Return;_Discount;_SalesPerson;_PriceMinimum;_Payment;_CreditSalesLock;_CustomerInputLock;_PaymentCodeLock;_Shipping;_Tax;_DeleteItem;_BundlingPrice;_EmailRestriction;_ParkedDeletionAuthorized;_SellEditor;_ContactCreate;_PrepaidPackageCreate;_Order;_Reprint;_Contacts;_ContactsCreate;_InventoryView;_DebtView;_ClearCart;_SellDelete;_DeliveryEditor;_CouponInputLock;_Park;_Commission;setRole(){this._Retrieve=this.roleService.sell.RetrieveR,this._DateEditor=this.roleService.global.Date,this._NumberEditor=this.roleService.sell.Number,this._PriceVisible=this.roleService.sell.PriceVisible,this._SalesPerson=this.roleService.sell.SalesPerson,this._UnitPriceEditor=this.roleService.sell.UnitPriceEditor,this._PricebookSelector=this.roleService.sell.PricebookSelector,this._Cost=this.roleService.product.Cost,this._Return=this.roleService.sell.Return,this._Discount=this.roleService.sell.Discount,this._PriceMinimum=this.roleService.sell.PriceMinimum,this._Payment=this.roleService.sell.Payment,this._CreditSalesLock=this.roleService.sell.CreditSalesLock,this._CustomerInputLock=this.roleService.sell.CustomerInputLock,this._PaymentCodeLock=this.roleService.sell.PaymentCodeLock,this._Shipping=this.roleService.sell.Shipping,this._Tax=this.roleService.sell.Tax,this._DeleteItem=this.roleService.sell.DeleteItem,this._BundlingPrice=this.roleService.sell.BundlingPrice,this._EmailRestriction=this.roleService.sell.Email,this._SellEditor=this.roleService.sell.Edit,this._ContactCreate=this.roleService.contact.Create,this._PrepaidPackageCreate=this.roleService.prepaidPackage.Create,this._Order=this.roleService.order.View,this._Contacts=this.roleService.contact.View,this._ContactsCreate=this.roleService.contact.Create,this._InventoryView=this.roleService.inventory.View,this._DebtView=this.roleService.debt.View,this._ClearCart=this.roleService.sell.DeleteItem,this._SellDelete=this.roleService.sell.Delete,this._DeliveryEditor=this.roleService.logistic.Edit,this._Reprint=this.roleService.order.Print,this._CouponInputLock=this.roleService.sell.CouponInputLock,this._Park=this.roleService.sell.Park,this._Commission=this.roleService.product.CommissionView}get Park(){return this._Park}get CouponInputLock(){return this._CouponInputLock}set CouponInputLock(e){this._CouponInputLock=e}get Retrieve(){return this._Retrieve}get DateEditor(){return this._DateEditor}set DateEditor(e){this._DateEditor=e}get NumberEditor(){return this._NumberEditor}set NumberEditor(e){this._NumberEditor=e}get PriceVisible(){return this._PriceVisible}get UnitPriceEditor(){return this._UnitPriceEditor}set UnitPriceEditor(e){this._UnitPriceEditor=e}get PricebookSelector(){return this._PricebookSelector}set PricebookSelector(e){this._PricebookSelector=e}get Cost(){return this._Cost}get Return(){return this._Return}set Return(e){this._Return=e}get Discount(){return this._Discount}set Discount(e){this._Discount=e}get SalesPerson(){return this._SalesPerson}get PriceMinimum(){return this._PriceMinimum}get Payment(){return this._Payment}get CreditSalesLock(){return this._CreditSalesLock}get CustomerInputLock(){return this._CustomerInputLock}get PaymentCodeLock(){return this._PaymentCodeLock}get Shipping(){return this._Shipping}get Tax(){return this._Tax}set Tax(e){this._Tax=e}get DeleteItem(){return this._DeleteItem}set DeleteItem(e){this._DeleteItem=e}get BundlingPrice(){return this._BundlingPrice}get Email(){return this._EmailRestriction}get ParkedDeletionAuthorized(){return this._ParkedDeletionAuthorized}set ParkedDeletionAuthorized(e){this._ParkedDeletionAuthorized=e}get SellEditor(){return this._SellEditor}get PrepaidPackageCreate(){return this._PrepaidPackageCreate}get Order(){return this._Order}get Reprint(){return this._Reprint}get Contacts(){return this._Contacts}get ContactsCreate(){return this._ContactsCreate}get InventoryView(){return this._InventoryView}get DebtView(){return this._DebtView}get ClearCartRestriction(){return this._ClearCart}get SellDelete(){return this._SellDelete}get DeliveryEditor(){return this._DeliveryEditor}get Commission(){return this._Commission}};var Kt=class{DeliveryEntityID;Type;NewOrderID;constructor(){this.DeliveryEntityID="",this.Type=3}};var Ti=class{Type;Amount;Notification;ApplyToProduct;Requirement};var G=class{Order;Invoice;Shipping;Action;Payments;Items;CartItems;Promotion;ContactName;SplitParkLabel;get cartQuantity(){let e=0;for(let t of this.CartItems)e+=t.Quantity;return e}constructor(){this.Order=new Dn,this.Invoice=new Jt,this.Shipping=new On,this.Action=new Kt,this.Payments=Array(),this.Items=Array(),this.CartItems=Array(),this.ContactName=""}get TotalPaidAmount(){let e=0;return this.Payments.forEach(t=>{e+=t.PaidAmount}),e}get RedeemableAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID!=1);return this.GetAmountByCart(e)}get TotalQuantity(){let e=0;return this.CartItems.forEach(t=>{t.PromotionGift||(e+=t.Quantity)}),e}get CashOnlyAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID==1);return this.GetAmountByCart(e)}get PointOnlyAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID==2);return this.GetAmountByCart(e)}get PrepaidPackageItem(){return this.CartItems.filter(t=>t.Variant.TypeID==10)}GetAmountByCart(e){let t=0;return e.forEach(i=>{t+=i.Total}),t=t*(100-this.Order.Discount)/100,t=t*(100-this.Order.Discount2)/100,t}getRewards(){return this.CartItems.filter(t=>t.PromotionGift)}};Ze([tt(()=>Dn)],G.prototype,"Order",2),Ze([tt(()=>Jt)],G.prototype,"Invoice",2),Ze([tt(()=>On)],G.prototype,"Shipping",2),Ze([tt(()=>Kt)],G.prototype,"Action",2),Ze([tt(()=>Ke)],G.prototype,"Payments",2),Ze([tt(()=>Oi)],G.prototype,"Items",2),Ze([tt(()=>xe)],G.prototype,"CartItems",2),Ze([tt(()=>Ti)],G.prototype,"Promotion",2);var Ei=class{Success;Message;message;ObjectID;SalesOrderID;OutDeliveryID;Contact;LoyaltyPoint;InvoiceNumber;Creator;OrderTimeString;PrintMode;PaymentStateID;PaymentStateLabel;Final;InvoiceNumberResult;constructor(){this.Success=!0,this.Message="",this.ObjectID="",this.SalesOrderID="",this.OutDeliveryID="",this.Contact=null,this.LoyaltyPoint="",this.InvoiceNumber="",this.Creator="",this.OrderTimeString="",this.PrintMode=0,this.PaymentStateID=0,this.PaymentStateLabel="",this.Final=0}};var It=class n{constructor(e,t,i,o){this.httpService=e;this._localDataService=t;this._onlineStatusService=i;this._toastrService=o;this._onlineStatusService.getOnlineStatus$().subscribe(r=>{this.isOnline=r})}_Data=new be(null);Data$=this._Data.pipe(Fe(),ce(e=>e!==null));isOnline;get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}getSalesOrderPrint(e){return this.httpService.post("/API/POS/GetSalesOrderPrint",{TemplateID:e})}submitOrder(e,t){let i=this.generatePOSDataForSubmission(e,this.isOnline);if(this.isOnline)return this.submitOnline(i).pipe(this.handleTimeOutError(i));if(t.ModuleSell.EnableOfflineTransaction)return this._localDataService.syncOrder(i).pipe(J(()=>this.generateCompleteData(i)));this._toastrService.warning("Offline order is not Supported!","Info!")}uploadOfflineOrder(e){return this._localDataService.uploadSingleOrder(e).pipe(nt(t=>t?.message?.includes("objectStore does not exists")?this.submitOnline(e):ft(()=>t)))}submitOnline(e){return this.httpService.post(U.SubmitOrder,e,Zn.pos.submitOrderTimeout)}handleTimeOutError(e){return ri(nt(t=>{if(t instanceof si||t?.name=="TimeoutError"){let i=this.generateCompleteData(e);this.pushNewValue(i)}throw t}))}generatePOSDataForSubmission(e,t=!0){let i=Object.assign(new G,e);i.Items=[],i.Order.CustomerID==null&&(i.Order.CustomerID=f.GuidEmpty),i.Order.SalesID==null&&(i.Order.SalesID=f.GuidEmpty);let o=1;i.Payments=i.Payments.map(c=>(c.Date=i.Order.Date,c.Index=o,o++,delete c.TypeID,c));let r=1;for(let c of i.CartItems){let u=new Oi;u.ID=c.ID,u.VariantID=c.VariantID,u.Quantity=c.Quantity,u.Cost=c.Cost,u.Price=c.Price,u.Discount=c.Discount,u.DiscountAmount=c.DiscountAmount,u.Note=c.Note,u.Taxable=c.Variant.Taxable,u.LoyaltyPoint=c.LoyaltyPoint,u.UnitCost=c.Cost,u.UnitPrice=c.Price,u.UnitPriceOriginal=c.UnitPriceOriginal,u.UnitExpense=c.UnitExpense,u.EntityID=c.EntityID,u.Index=r,u.UnitQuantity=c.UnitQuantity,u.PriceTypeID=c.PriceTypeID,u.PriceNote=c.PriceNote,u.Splited=c.SplitQuantity>0,u.SplitQuantity=c.SplitQuantity,u.InventoryTypeID=c.Variant.TypeID,u.SalesID="",u.Serial=c.Serial,c.SalesID&&(u.SalesID=c.SalesID),delete c.CouponDiscount,i.Items.push(u),r++}return t?(delete i.CartItems,delete i.Order.ClientTimestamp):i.Order.ClientTimestamp=new Date,i}generateCompleteData(e){let t=new Ei;return t.InvoiceNumber=e.Order.Number,t.OrderTimeString=new Date().toString(),t.PaymentStateID=e.Action?.Type,t.PaymentStateLabel="Offline",t.Success=!0,t.OutDeliveryID=e.Action.DeliveryEntityID,t}GetReturnInvoice(e,t){return this.httpService.get(U.ReturInvoice,[{key:"EntityID",value:t},{key:"Number",value:e}])}GetInvoiceBySoID(e){return this.httpService.get(U.GetPOSDataByID,[{key:"ID",value:e}])}UploadCSV(e,t){let i={CartItems:e,EntityID:t};return this.httpService.post(U.UploadCsv,i)}sendEmail(e,t){return new Promise((i,o)=>{this._localDataService.isProductFromServer().subscribe(r=>{if(r){let c={invoiceID:t,email:e};this.httpService.post(U.SendInvoiceEmail,c).subscribe({next:u=>{i(u)},error:u=>{o(u)}})}else o(oe.wrongOfflineAction)})})}sendWhatsaap(e,t){let i={InvoiceID:e,PhoneNumber:t};return this.httpService.post(U.SendInvoiceWhatsapp,i)}createCustomerByInvoice(e,t){let i={InvoiceID:e,Mobile:t};return this.httpService.post(U.CreateCustomerInvoice,i)}saveCommission(e,t){let i={SOID:e,commission:t};return this.httpService.POSText("/API/Transaction/SetCommission",i)}generateReceiptA4(e){let t={ID:e};return this.httpService.post(U.InvoiceA4,t)}getVacant(e){return this.httpService.get(U.GetVacant,[{key:"EntityID",value:e}])}static \u0275fac=function(t){return new(t||n)(g(ge),g(Oe),g(he),g(F))};static \u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"})};var Xt=(r=>(r[r.cash=1]="cash",r[r.card=2]="card",r[r.emoney=3]="emoney",r[r.other=4]="other",r[r.ECR=99]="ECR",r))(Xt||{});var L=class n{constructor(e,t,i){this._OrderHttpService=e;this._customerHttpService=t;this._toastrService=i}_Data=new be(new G);transaction_id;Data$=this._Data.asObservable();get Data(){return this._Data.value}pushNewValue(e){if(e)this._Data.next(e);else{let t=this.Data;this._Data.next(t)}}submitOrder(e){return new Promise((t,i)=>{this.checkTransactionId(),this._OrderHttpService.submitOrder(this.Data,e).subscribe({next:o=>{t(o)},error:o=>{this.Data.Items=[],i(o)}})})}uploadOfflineOrder(){return this.checkTransactionId(),this._OrderHttpService.uploadOfflineOrder(this.Data)}checkTransactionId(){let t=this.Data.Payments.find(i=>i.TypeID==3);f.IsNotEmpty(t)&&f.IsEmpty(this.transaction_id)&&this._toastrService.warning("Midtrans transaction_id is empty. Please verify manually!","Mobile Payment Failure")}updateCustomerID(e){return this.Data.Order.CustomerID=e,this.pushNewValue(this.Data),new Promise((t,i)=>{this._customerHttpService.GetPrivilegeByID(e,this.Data.Order.EntityID).subscribe({next:o=>{this._customerHttpService.Data=o,this.pushNewValue(this.Data),t(o)},error:o=>{this.Data.Order.CustomerID=null,this.Data.ContactName=null;let r=o.error?.Message;o.status==409?this._toastrService.warning(r,"Warning"):this._toastrService.error(r,`API Error - ${o.status}`),i(o)}})})}static \u0275fac=function(t){return new(t||n)(g(It),g(Re),g(F))};static \u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"})};var z=class n{constructor(e,t,i){this._localDataService=e;this._onlineStatusService=t;this._httpService=i;this._onlineStatusService.getOnlineStatus$().subscribe(o=>{this.isOnline=o})}_Data=new be(null);Data$=this._Data.asObservable().pipe(ce(e=>e!==null),Fe());isOnline;get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}requestObservable(){return this.isOnline?this._httpService.get(U.GetPOSStorage).pipe(J(e=>({data:e,type:"Online"}))):this._localDataService.getPOSStorage().pipe(ce(e=>e!=null),J(e=>({data:e,type:"Offline"})))}getOutletName(e){return this.Data.Entities.find(i=>i.ID==e)?.Name}static \u0275fac=function(t){return new(t||n)(g(Oe),g(he),g(ge))};static \u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"})};var De=class n{constructor(e){this.roleService=e;this.pushNewValue(new We(e))}_Data=new be(new We(null));get Data(){return this._Data.value}Data$=this._Data.asObservable();pushNewValue(e){this._Data.next(e)}static \u0275fac=function(t){return new(t||n)(g(_i))};static \u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"})};var ti=class{ID;Code;EntityID;Name;Description;Start;StartDisplay;State;Open;CashierID;OpeningCash;EntityName;LoginID;Active;CustomerDisplayEnabled;OvoConfigurationID;CustomerDisplayID;ListImage;Suspended};var wi=class n{odsConfigType=R(0);setODSConfig(e){this.odsConfigType.set(e)}isEnabled(){return this.odsConfigType()>0}static \u0275fac=function(t){return new(t||n)};static \u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"})};var sr=n=>({active:n}),lr=n=>({gray:n});function cr(n,e){if(n&1){let t=E();a(0,"span",15),S("click",function(o){v(t);let r=m().$implicit;return m().closeRegister(r),_(o.stopPropagation())}),s()}}function dr(n,e){n&1&&(a(0,"div")(1,"span",16),d(2,"VACANT"),s()())}function mr(n,e){if(n&1&&(a(0,"div")(1,"span",17),b(2,"i",18),a(3,"span",19),d(4),s()(),a(5,"span",20),b(6,"i",21),a(7,"span",19),d(8),s()()()),n&2){let t=m().$implicit;l(4),M(t.LoginID),l(4),D("",t.StartDisplay.split(" ")[3]," - Now")}}function pr(n,e){if(n&1){let t=E();a(0,"div",8)(1,"div",9)(2,"div",10)(3,"h5",11),S("click",function(){let o=v(t).$implicit,r=m();return _(r.select(o))}),a(4,"span"),b(5,"i",12),d(6),y(7,"limitTo"),s(),h(8,cr,1,0,"span",13),s(),a(9,"div",14),S("click",function(){let o=v(t).$implicit,r=m();return _(r.select(o))}),h(10,dr,3,0,"div")(11,mr,9,2,"div"),s()()()()}if(n&2){let t,i=e.$implicit,o=m();l(),p("ngClass",i.Active?"active":""),l(),p("ngClass",j(9,sr,(i==null?null:i.ID)==(o.selectedRegister==null?null:o.selectedRegister.ID))),l(),p("ngClass",j(11,lr,i!=o.selectedRegister)),l(3),M(X(7,6,i.Name,15)),l(2),C(i.State!="Close"?8:-1),l(2),C((t=i.State)==="Close"?10:t==="Open"?11:-1)}}var Ri=class n{constructor(e,t,i,o,r,c,u){this._dialogRef=e;this._outletService=t;this._posService=i;this._userRoleService=o;this.router=r;this.httpService=c;this._odsService=u}originalSelectedRegister=null;registers;searchInput="";selectedRegister=new ti;modalConfig=new ie;role;get AppConfigJSON(){return this._posService.Data.AppConfigJSON}destroy$=new Me;ngOnInit(){this.subscribeToObsChanges(),this.initModalConfig()}subscribeToObsChanges(){this._posService.Data$.pipe(Ie(this.destroy$)).subscribe(e=>{this.registers=e.Registers}),this._outletService.Data$.pipe(Ie(this.destroy$)).subscribe(e=>{this.selectedRegister=this.findOutletRegisterById(e.RegisterID),this.originalSelectedRegister=this.selectedRegister?ni({},this.selectedRegister):null}),this._userRoleService.Data$.pipe(Ie(this.destroy$)).subscribe(e=>{this.role=e})}findOutletRegisterById(e){let t=this.registers.find(i=>i.ID===e);return t||new ti}initModalConfig(){this.modalConfig.hideFooter=!0,this.modalConfig.hideScrollbar=!0,this.modalConfig.title="Choose an outlet"}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}onClose(){this._dialogRef.close()}select(e){if(this.AppConfigJSON.ModuleShift.Closure.Enabled)if(this.selectedRegister.ID!=null&&this.selectedRegister.Open&&e.CashierID==null)confirm("You already have an active register with "+this.selectedRegister.Name+`!
|
|
2
2
|
Do you want to end your session?`)&&(this.onClose(),this.router.navigate(["menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}}));else if(!e.Open||this.selectedRegister.ID==e.ID)this.selectedRegister=e,this.onSubmitSelectedRegister();else{if(this.role.SellEditor==!1){alert("You cannot end shift for Register "+e.Name+" - Unauthorized Access");return}alert("This Register has already active register, Are you sure you want to end this register?"),this.onClose(),this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}})}else this.selectedRegister=e,this.onSubmitSelectedRegister()}onSubmitSelectedRegister(){if(this.selectedRegister.ID==null){alert("Please select a register first!");return}this._outletService.pushNewRegister(this.selectedRegister),this.loadOdsConfig(this.selectedRegister.EntityID),this._dialogRef.close({selectedRegister:this.selectedRegister,openStartingCashDialog:this.selectedRegister.ID!=this.originalSelectedRegister?.ID})}closeRegister(e){let t=this.selectedRegister.ID;if(this.role.SellEditor==!1){alert("You cannot end shift for Register "+e.Name+" - Unauthorized Access");return}t==e.ID?this.router.navigate(["/menu/Shift/Main/My_Shift"]):this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}}),this.onClose()}loadOdsConfig(e){this.httpService.get(`/api/outlet/GetOrderDisplayBroadcastMode?EntityID=${e}`).pipe(le(t=>{this._odsService.setODSConfig(t.form.OrderDisplayBroadcastMode)})).subscribe()}static \u0275fac=function(t){return new(t||n)(P(te),P(re),P(z),P(De),P(zn),P(ge),P(wi))};static \u0275cmp=N({type:n,selectors:[["pos-modal-register"]],standalone:!1,decls:12,vars:6,consts:[[3,"onClose","config"],[1,"ms-0","mb-8","search-container",3,"hidden"],[1,"input-group","mb-3","rounded-start-1"],[1,"input-group-text","txtFilter","rounded-end-0"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["data-cy","SearchOutlet","type","text","placeholder","Filter by Name","aria-label","Search",1,"txtFilter","form-control","border-start-0","rounded-1","rounded-start-0",3,"ngModelChange","ngModel"],[1,"container","custom-scroll"],[1,"row",2,"width","600px"],["data-cy","registers",1,"col-4"],[1,"card","border-0",3,"ngClass"],[1,"card-body","p-0",3,"ngClass"],[1,"card-title","mb-0",3,"click","ngClass"],[1,"fa-solid","fa-house","pe-1","fs-6"],[1,"fa","fa-xmark-circle","fa-lg","position-absolute",2,"text-shadow","0 1px 0 #afafaf","right","5px","top","16px"],[1,"card-text","px-0","py-2",3,"click"],[1,"fa","fa-xmark-circle","fa-lg","position-absolute",2,"text-shadow","0 1px 0 #afafaf","right","5px","top","16px",3,"click"],[1,"idle"],[1,"cashier"],["aria-hidden","true",1,"fa","fa-user","pe-2"],[1,"d-inline"],[1,"open"],["aria-hidden","true",1,"fa-regular","fa-clock","pe-2"]],template:function(t,i){t&1&&(a(0,"modal-material",0),S("onClose",function(){return i.onClose()}),a(1,"content")(2,"div",1)(3,"div",2)(4,"span",3),b(5,"i",4),s(),a(6,"input",5),H("ngModelChange",function(r){return A(i.searchInput,r)||(i.searchInput=r),r}),s()()(),a(7,"div",6)(8,"div",7),K(9,pr,12,13,"div",8,ve),y(11,"FilterByName"),s()()()()),t&2&&(p("config",i.modalConfig),l(2),p("hidden",i.registers.length<=6),l(4),B("ngModel",i.searchInput),l(3),Z(X(11,3,i.registers,i.searchInput)))},dependencies:[Be,Te,Pe,Ee,ne,bi,vo],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.search-container[_ngcontent-%COMP%]{transition:all .3s ease;width:97%}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]{position:relative;transition:all .3s ease;height:2.3rem}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover, .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e4d,0 0 8px 4px #89b03e33;border-radius:4px}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]{transition:all .3s ease;border-left:none!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]:focus{box-shadow:none!important;border-color:#ced4da!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .input-group-text[_ngcontent-%COMP%]{transition:all .3s ease;background-color:#fff;border-right:none!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .input-group-text[_ngcontent-%COMP%], .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .input-group-text[_ngcontent-%COMP%]{background-color:#89b03e1a;border-color:#84cc16!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .fa-magnifying-glass[_ngcontent-%COMP%]{transition:all .3s ease}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .fa-magnifying-glass[_ngcontent-%COMP%], .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .fa-magnifying-glass[_ngcontent-%COMP%]{color:#84cc16!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e66,0 0 12px 6px #89b03e40!important}.custom-scroll[_ngcontent-%COMP%]::-webkit-scrollbar{width:6px}.custom-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:#f1f1f1;border-radius:3px}.custom-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#89b03e;border-radius:3px}.custom-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:#7a9e37}.container[_ngcontent-%COMP%]{overflow-y:auto;overflow-x:hidden;max-height:260px;min-height:150px}.col-4[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]{width:180px;min-height:95px;margin-right:17px;margin-bottom:17px;position:relative}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]{display:block;outline:0;border:1px solid #B1AAAA;border-radius:5px;cursor:pointer}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{height:30px;border-radius:4px;padding:5px 10px;color:#fff;background:#b1aaaa;overflow:hidden}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{margin-right:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover, .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%]{background:#ffffe1;border:1px solid #89b03e}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover > h5[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%]{background:#89b03e}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover{border:1px solid #c9302c}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover > h6[_ngcontent-%COMP%]{background:#c9302c!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#c9302c}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover{background:#fff}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]{border:1px solid #f6a828}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%]{background:#f6a828!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover{border:1px solid #f6a828;background:#fff}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover > strong[_ngcontent-%COMP%]{background:#f6a828!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#f6a828}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] div[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.75rem!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{height:80px;padding:15px 10px;position:relative}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;font-weight:400;font-size:.875rem;width:100%;margin-bottom:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:first-child{margin-top:-10px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:last-child{margin-bottom:0}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{text-align:center;position:absolute;bottom:0;right:0;width:auto;background-color:#b1aaaa;border-radius:3px;padding:2px 5px;color:#fff;display:none!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.idle[_ngcontent-%COMP%]{display:block;font-size:1.25rem;text-align:center}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{position:absolute;width:27px;height:28px;cursor:pointer;top:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#000}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:last-of-type{right:-5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:nth-last-of-type(2){right:15px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{bottom:20px;right:5px;position:absolute}.col-4[_ngcontent-%COMP%] .duration[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{border:1px solid!important;position:absolute;bottom:-3px;left:58px;background:#fff;border-radius:5px}"]})};var ur=["inputCash"],Ni=class n{constructor(e,t){this.dialogRef=e;this.data=t;this.generateModalTitle$.subscribe()}registerService=T(re);loadPOSService=T(z);register=this.registerService.Data;username=this.loadPOSService?.Data?.UserName;amount=R(0);config=new ie;currentRegisterName;generateModalTitle$=this.registerService.Data$.pipe(ce(e=>f.IsNotEmpty(e)),le(()=>{let e=this.registerService.getOutletRegister(),t=e?.Name?.length>18?`${e?.Name?.substring(0,18)}...`:e?.Name;this.config.title="Open Shift",this.currentRegisterName=t}),ee());today=new Date;inputCashEl;ngOnInit(){this.config.customWidth="350px",this.config.hideCancel=!0}ngAfterViewInit(){this.inputCashEl?.nativeElement?.focus()}onOk(){this.dialogRef.close({amount:this.amount()})}static \u0275fac=function(t){return new(t||n)(P(te),P(fe))};static \u0275cmp=N({type:n,selectors:[["POS-modal-opening-cash"]],viewQuery:function(t,i){if(t&1&&Ut(ur,5),t&2){let o;Wt(o=Gt())&&(i.inputCashEl=o.first)}},standalone:!1,decls:25,vars:8,consts:[["inputCash",""],[3,"onOk","onCancel","onClose","config"],[1,"table","fs-5","text"],[1,"py-3"],[1,"text-end","pe-3"],[1,"py-4"],[1,"text-end"],["data-cy","InputCash","autoNum","",1,"border","form-control-lg","text-end","w-100",3,"ngModelChange","ngModel"]],template:function(t,i){if(t&1){let o=E();a(0,"modal-material",1),S("onOk",function(){return v(o),_(i.onOk())})("onCancel",function(){return v(o),_(i.dialogRef.close())})("onClose",function(){return v(o),_(i.dialogRef.close())}),a(1,"content")(2,"table",2)(3,"tr")(4,"td",3),d(5,"Outlet Register"),s(),a(6,"td",4),d(7),s()(),a(8,"tr")(9,"td",5),d(10,"Current User"),s(),a(11,"td",4),d(12),s()(),a(13,"tr")(14,"td",5),d(15,"Starting Time"),s(),a(16,"td",4),d(17),y(18,"date"),s()(),a(19,"tr")(20,"td",3),d(21,"Starting Cash"),s(),a(22,"td",6)(23,"input",7,0),H("ngModelChange",function(c){return v(o),A(i.amount,c)||(i.amount=c),_(c)}),s()()()()()()}t&2&&(p("config",i.config),l(7),M(i.currentRegisterName),l(5),M(i.username),l(5),M(X(18,5,i.today,"EEEE, HH:mm")),l(6),B("ngModel",i.amount))},dependencies:[Te,Pe,Ee,ne,Dt,Ye],styles:[".table-title-width[_ngcontent-%COMP%]{width:120px}"]})};var Ai=class{OrderNumberElement;InvoiceNumberElement;NewOrderID};var Et=class n{constructor(e,t,i){this._httpService=e;this._onlineStatusService=t;this._localDataService=i;this._onlineStatusService.getOnlineStatus$().subscribe(o=>{this.isOnline=o})}isOnline;GenerateNumber(e,t){if(this.isOnline)return this._httpService.get(U.GenerateNumber,[{key:"EntityID",value:e},{key:"TypeID",value:1}]);{let i=new Ai;return f.IsNotEmpty(t.NumberElement)&&(t.NumberElement.Seed+=1),f.IsNotEmpty(t.InvoiceNumberElement)&&(t.InvoiceNumberElement.Seed+=1),i.InvoiceNumberElement=t.InvoiceNumberElement,i.OrderNumberElement=t.NumberElement,i.NewOrderID=f.Guid_NewGuid(),ke(i)}}findRegisterById(e){return new Promise(t=>{this._localDataService.isConfigFromServer().subscribe(i=>{i?this._httpService.get(U.GetRegisterInfo,[{key:"RegisterID",value:e}]).subscribe(o=>{t(o)}):this._localDataService.findRegisterByID(e).subscribe(o=>{t(o)})})})}recordOpeningCash(e){return ai(this._httpService.post("/API/POS/RecordOpeningCash",e))}static \u0275fac=function(t){return new(t||n)(g(ge),g(he),g(Oe))};static \u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"})};var re=class n{constructor(e,t,i,o,r,c){this._signalRClientService=e;this._matDialog=t;this._posHttpResponseService=i;this._CoreHttpService=o;this._toastrService=r;this._roleService=c}datePipe=T(Ye);_Data=new be(null);Data$=this._Data.asObservable().pipe(ce(e=>e!==null),Fe());get Data(){return this._Data.value}getSalesname(e){return this.Data&&this.Data.ListSales?this._Data.value.ListSales.find(t=>t.ID==e)?.Name:""}setActiveRegisterFromOptions(e,t){let o=this._posHttpResponseService.Data.AppConfigJSON.ModuleShift.Closure.Enabled;if(e.length>1){let r=e.find(c=>c.LoginID==t);if(r)this.pushNewRegister(r);else{let c=this.getOutletRegisterFromLocalStorage(),u=this.Data?.RegisterID?this.Data.RegisterID:c?.ID;e.some(k=>k.ID==u)?o?this.openChooseRegisterModal():this.initRegisterFromLocalStorage():this.openChooseRegisterModal()}}e.length==1&&(this.pushNewRegister(e[0]),f.IsEmpty(e[0].LoginID)&&f.IsEmpty(e[0].CashierID)&&this.openOpeningCashModal(e[0].ID)),e.length==0&&this._toastrService.warning("You do not have access to any OUTLET","Warning")}openChooseRegisterModal(){this._matDialog.open(Ri,{id:"registerModal",disableClose:!0}).afterClosed().pipe(ce(e=>f.IsNotEmpty(e?.selectedRegister))).subscribe(e=>{e.selectedRegister&&this.openOpeningCashModal(e.selectedRegister.ID)})}openOpeningCashModal(e){this._posHttpResponseService.Data.AppConfigJSON.ModuleShift.Closure.Enabled&&this._matDialog.open(Ni,{disableClose:!0}).afterClosed().pipe(ce(o=>f.IsNotEmpty(o))).subscribe(o=>{let r={RegisterID:e,OpAmount:o.amount};this._CoreHttpService.recordOpeningCash(r).then(()=>{this.updateRegisterList(r)})})}updateRegisterList(e){let i=this._posHttpResponseService.Data.Registers.map(r=>r.ID==e.RegisterID?this.mapRegisterAsActiveRegister(r,e):r),o=this._posHttpResponseService.Data;o.Registers=i,this._posHttpResponseService.pushNewValue(o)}mapRegisterAsActiveRegister(e,t){let i=localStorage.getItem("AccountInfo");if(i){let r=JSON.parse(i);e.LoginID=r.UserName}e.OpeningCash=t.OpAmount,e.Open=!0,e.State="Open";let o=this.datePipe.transform(new Date,"dd MM yyyy HH:mm");return e.StartDisplay=o,e}initRegisterFromLocalStorage(){if(this._roleService.Data.DeleteItem==!1){let t=this.getOutletRegisterFromLocalStorage();t&&this.pushNewRegister(t)}}pushNewRegister(e){let t=this._Data.value,i=t?t.RegisterID:null;i!=e.ID&&this._CoreHttpService.findRegisterById(e.ID).then(o=>{o.RegisterCode=e.Code,o.DefaultPrintTemplate=o.PrintTemplate,o.SplitPaymentEnabled=this.findSplitPaymentConfig(o.EntityID),this._signalRClientService.SubscribeGroup(o.RegisterID,i),this.saveOutletRegisterToLocalStorage(e),this.pushNewValue(o)})}getOutletRegister(){let e=this.Data.RegisterID;return this._posHttpResponseService.Data.Registers.find(o=>o.ID==e)}pushNewValue(e){this._Data.next(e)}saveOutletRegisterToLocalStorage(e){if(this._roleService.Data.DeleteItem==!1){let i=JSON.stringify(e);localStorage.setItem("outlet_register",i)}}getOutletRegisterFromLocalStorage(){let e=this._roleService.Data.DeleteItem,t=localStorage.getItem("outlet_register"),i=null;return t&&(e?localStorage.removeItem("outlet_register"):i=JSON.parse(t)),i}findOutletRegisterById(e){return this._posHttpResponseService.Data.Registers.find(o=>o.ID===e)}findSplitPaymentConfig(e){let i=this._posHttpResponseService.Data.Entities.find(o=>o.ID===e);return i?i.SplitPaymentEnabled:!1}static \u0275fac=function(t){return new(t||n)(g(rt),g(we),g(z),g(Et),g(F),g(De))};static \u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"})};function gr(n,e){if(n&1&&(a(0,"span",5),d(1),y(2,"number"),s()),n&2){let t=m(3);l(),D("-",x(2,1,t.coupon.Amount),"%")}}function fr(n,e){if(n&1&&(a(0,"span",5),d(1),y(2,"number"),s()),n&2){let t=m(3);l(),D(" -",x(2,1,t.coupon.Amount)," ")}}function hr(n,e){if(n&1){let t=E();a(0,"button",9),S("click",function(){v(t);let o=m().$implicit,r=m(2);return _(r.onRemoveCouponDiscount(o))}),d(1," Remove "),s()}}function Cr(n,e){if(n&1){let t=E();a(0,"button",10),S("click",function(){v(t);let o=m().$implicit,r=m(2);return _(r.onApplyCouponDiscount(o))}),d(1," Apply "),s()}if(n&2){let t=m(3);p("disabled",t.hasAppliedCouponDiscount())}}function vr(n,e){if(n&1&&(a(0,"tr")(1,"td"),d(2),s(),a(3,"td"),d(4),s(),a(5,"td",4),d(6),y(7,"number"),s(),a(8,"td",4),h(9,gr,3,3,"span",5)(10,fr,3,3,"span",5),s(),a(11,"td",6),h(12,hr,2,0,"button",7)(13,Cr,2,1,"button",8),s()()),n&2){let t=e.$implicit,i=m(2);l(2),M(t==null||t.Variant==null?null:t.Variant.Name),l(2),M(t==null||t.Variant==null?null:t.Variant.Code),l(2),M(x(7,5,t.UnitPrice)),l(3),C((i.coupon==null||i.coupon.Requirement==null?null:i.coupon.Requirement.Type)==i.couponType.DiscountPercentage?9:10),l(3),C((t==null?null:t.CouponDiscount)>0?12:13)}}function _r(n,e){if(n&1&&K(0,vr,14,7,"tr",null,ot),n&2){let t=m();Z(t.eligibleItems())}}function yr(n,e){n&1&&(a(0,"tr")(1,"td",11),b(2,"app-empty-state",12),s()())}var ki=class n{constructor(e){this.data=e;this.coupon=this.data.coupon,this.initModalConfig(),this.initEligibleItems()}dialogRef=T(te);config;eligibleItems=R([]);coupon;couponType=zt;hasAppliedCouponDiscount=R(!1);initModalConfig(){this.config=new ie,this.config.title="Choose Item to Apply Discount",this.config.hideFooter=!0}initEligibleItems(){let e=this.data.coupon?.ApplyToProduct.map(t=>t.ID);e&&(this.eligibleItems.update(()=>this.data.cartItems.filter(i=>e.includes(i.VariantID))),this.hasAppliedCouponDiscount.update(()=>this.eligibleItems().some(t=>t.CouponDiscount>0)))}onApplyCouponDiscount(e){let t=[e];this.hasAppliedCouponDiscount.update(()=>!0),this.dialogRef.close(t)}onRemoveCouponDiscount(e){this.eligibleItems.update(t=>{let i=t.findIndex(o=>o.VariantID===e.VariantID);return i>-1&&(t[i].Discount=0,t[i].CouponDiscount=0),t}),this.hasAppliedCouponDiscount.update(()=>!1)}onClose(){this.dialogRef.close()}static \u0275fac=function(t){return new(t||n)(P(fe))};static \u0275cmp=N({type:n,selectors:[["app-modal-coupon-selected-item"]],decls:17,vars:2,consts:[[3,"onCancel","onClose","config"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],[1,"text-end"],[1,"text-danger"],[1,"text-center"],[1,"btn","btn-sm","btn-danger"],[1,"btn","btn-sm","btn-success",3,"disabled"],[1,"btn","btn-sm","btn-danger",3,"click"],[1,"btn","btn-sm","btn-success",3,"click","disabled"],["colspan","5"],["title","No eligible products","message","No products in the cart qualify for coupon use"]],template:function(t,i){t&1&&(a(0,"modal-material",0),S("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()}),a(1,"content")(2,"table",1)(3,"thead",2)(4,"tr")(5,"th",3),d(6,"Name"),s(),a(7,"th",3),d(8,"Code"),s(),a(9,"th",3),d(10,"Price"),s(),a(11,"th",3),d(12,"Discount"),s(),b(13,"th",3),s()(),a(14,"tbody"),h(15,_r,2,0)(16,yr,3,0,"tr"),s()()()()),t&2&&(p("config",i.config),l(15),C(i.eligibleItems().length!==0?15:16))},dependencies:[Se,Ot,ne,So,q],encapsulation:2})};var st=class{ModuleSell;ApplicationLoyalty;ApplicationMath;CoreDefaults;ModuleDelivery;ApplicationParkAndRetrieve;ApplicationRegisterClosure;PaymentConfigGopay;PaymentConfigLink;PrintConfigInvoice;CorePrint;PaymentConfigEmpatKali;ApplicationSettings;PrintConfigGeneral;ModuleProducts;ModuleContact;ApplicationTransactionNumbering;ModuleOrders;ModuleShift;ModuleBuy;ModuleAdjustment;TadaCouponVisible;CouponRedemptionType;ProviderOption};var se=class n{constructor(e,t,i,o){this._orderDataService=e;this._posService=t;this.POSMATH=i;this.decimalPipe=o;this._orderDataService.Data$.pipe(Y(r=>this._posService.Data$.pipe(J(c=>({appConfig:c.AppConfigJSON,salesOrder:r}))))).subscribe(r=>{this.salesOrderData=r.salesOrder,this.appConfigJSON=r.appConfig,this.calculateDiscountAmount(),this.pushNewValue(this.grandTotal)})}_Data=new be(0);Data$=this._Data.asObservable().pipe(Fe());tax=new xo;discountAfterTax=0;currencySymbol="Rp";get Data(){return this._Data.value}salesOrderData=new G;appConfigJSON=new st;pushNewValue(e){this._Data.next(e)}get grandTotal(){let e=this.TotalAfterSurcharge;return isNaN(e)?0:e}setDecimalDigit(e){let t=this.decimalPipe.transform(e,"1.0-4");return e=parseFloat(t.split(",").join("")),e}get TotalAfterTax(){let e=this.TaxAmount,t=this.TotalBeforeTax+e;return t=this.POSMATH.Round(t,this.appConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm),t}get TotalBeforeTax(){let e=this.tax?.CalculationTypeID===1,t=0;return e?t=this.DiscountTotal-this.TaxAmount:t=this.DiscountTotal,t}get TotalAfterSurcharge(){let e=this.TotalAfterTax+this.SurchargeAmount;return this.POSMATH.Round(e,this.appConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm)}get TotalAfterDiscountTaxable(){return this.GrossTotalTaxable-this.DiscountTotal}get TaxAmount(){if(this.tax!=null){let e=0,t=this.appConfigJSON.ApplicationMath.RoundingTaxDigit.DecimalPlaceValue,i=this.appConfigJSON.ApplicationMath.RoundingTaxDigit.RoundAlgorithm,o=this.GrossTotalTaxable;return this.tax.CalculationTypeID==1?e=this.tax.Rate/(100+this.tax.Rate)*o:e=this.tax.Rate/100*o,e=this.POSMATH.Round(e,t,i),e}else return 0}get SurchargeAmount(){return this.TotalAfterTax*this.salesOrderData.Invoice.SurchargePcg/100}get Discount1Amount(){return this.GrossTotal*this.salesOrderData.Order.Discount/100}get AfterDiscount1Amount(){return this.GrossTotal-this.Discount1Amount}get Discount2Amount(){return this.AfterDiscount1Amount*this.salesOrderData.Order.Discount2/100}get AfterDiscount2Amount(){return this.AfterDiscount1Amount-this.Discount2Amount}get DiscountTotal(){return this.AfterDiscount2Amount-this.salesOrderData.Order.DiscountAmount}calculateDiscountAmount(){let e=this.salesOrderData.Order.DiscountAmount,t=0;this.AfterDiscount2Amount>=0&&e>0&&e>this.AfterDiscount2Amount&&(t=this.AfterDiscount2Amount),t!==0&&t<=e&&this.GrossTotal!==0&&(e=t),this.salesOrderData.Order.DiscountAmount=e}get GrossTotal(){return this.sum(this.salesOrderData.CartItems,"Total")}get GrossTotalTaxable(){let e=this.salesOrderData.CartItems.filter(i=>i.Taxable),t=this.sum(e,"Total");if(e.length!==0){let i=this.calculateDiscountTaxableItem(e);t=t*(100-this.salesOrderData.Order.Discount)/100,t=t*(100-this.salesOrderData.Order.Discount2)/100,t=t-i}return t}calculateDiscountTaxableItem(e){let t=this.GrossTotal,i=this.salesOrderData.Order.DiscountAmount,o=0,r=0,c=0,u=0;for(let O of e)o=O.getItemAfterDiscount/t,r=o*i,u=r*O.Quantity,c+=u;return c}get GrossTotalNonTaxable(){let e=this.salesOrderData.CartItems.filter(i=>i.Taxable==!1),t=this.sum(e,"Total");return t=t*(100-this.salesOrderData.Order.Discount)/100,t=t*(100-this.salesOrderData.Order.Discount2)/100,t=t-this.salesOrderData.Order.DiscountAmount,t}sum(e,t){let i=e.reduce((o,r)=>o+r[t],0);return i=this.setDecimalDigit(i),i}GetPointOnlyAmount(){let e=this.salesOrderData.CartItems.filter(t=>t.Variant.PaymentTypeID==2);return this.GetAmountByCart(e)}GetCashOnlyAmount(){let e=this.salesOrderData.CartItems.filter(t=>t.Variant.PaymentTypeID==1);return this.GetAmountByCart(e)}GetCashAndPointAmountCart(){let e=this.salesOrderData.CartItems.filter(t=>t.Variant.PaymentTypeID!=1);return this.GetAmountByCart(e)}GetAmountByCart(e){let t=this.sum(e,"Total");return t=t*(100-this.salesOrderData.Order.Discount)/100,t=t*(100-this.salesOrderData.Order.Discount2)/100,t}calculateGrossTotal(e){return this.sum(e,"Total")}static \u0275fac=function(t){return new(t||n)(g(L),g(z),g(Io),g(q))};static \u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"})};var Vi=class{Code;Provider;EntityID;Customer;ShoppingCart};var wt=class n{salesOrderService=T(L);registerService=T(re);customerService=T(Re);orderCalculator=T(se);generateRedeemCouponDto(e,t){let i=new Vi,o=this.registerService.Data?.EntityID;return i.Code=e,i.Provider=t,i.ShoppingCart={Amount:this.orderCalculator.Data,Items:this.generateItems()},i.EntityID=o,i.Customer=this.generateCustomer(t),i}generateItems(){return this.salesOrderService.Data.CartItems.map(i=>({Price:i.Price,Quantity:i.Quantity,VariantID:i.VariantID,Code:i?.Variant?.Code}))}generateCustomer(e){let t=this.customerService.Data,i=this.salesOrderService?.Data?.Order?.CustomerID,o=null;return f.IsNotEmpty(i)&&(o={Phone:t.Mobile,Email:t.Email},e==="Internal"&&(o=ni({ID:i},o))),o}static \u0275fac=function(t){return new(t||n)};static \u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"})};var Rt=class n{constructor(e,t,i,o,r,c){this._httpService=e;this._orderDataService=t;this._userRoleService=i;this.toastr=o;this._invoiceCalculatorService=r;this.promotionCouponFactoryService=c;this.subscribeToObservable()}dialog=T(we);role;originalRoleData;_coupon=R(null);salesOrderBeforePromotion=R(null);isShowToastrInApplyCoupon=R(!1);get coupon(){return this._coupon()}subscribeToObservable(){this._userRoleService.Data$.subscribe(e=>{this.role=e,f.IsEmpty(this.originalRoleData)&&(this.originalRoleData=me(We,e))})}RedeemCoupon(e,t,i=!1){i||(this.isShowToastrInApplyCoupon.set(!0),this.copyOriginalSalesOrder());let o=this.promotionCouponFactoryService.generateRedeemCouponDto(e,"Internal");this._httpService.post(U.ValidateInternalCoupon,o).subscribe({next:r=>{switch(this._orderDataService.Data.Order.PromotionCoupon=e,this._orderDataService.Data.Order.PromotionNote=t,this._orderDataService.Data.Order.CouponType=1,r.Requirement?.Type){case 1:this.HandleDiscountPercentage(r);break;case 2:this.HandleDiscountAmount(r);break;case 3:this.handleCouponReturnAccess(r);break;case 4:this.handleCouponParkedDeletionAccess();break;case 5:this.handleFullAccessCoupon();break;case 6:this.handleDeleteItemCoupon();break}this._coupon.set(r),this.isShowToastrInApplyCoupon.set(!1)},error:r=>{this.removeAppliedCoupon(!1),this.isShowToastrInApplyCoupon.set(!1)}})}setCouponOnEdit(e){this._coupon.set(e),this.generateOriginalSalesOrderOnEdit()}generateOriginalSalesOrderOnEdit(){let e=me(G,this._orderDataService.Data);e.Order.PromotionCoupon=null,e.Order.PromotionNote=null,e.Order.Discount=0,e.Order.DiscountAmount=0,this.salesOrderBeforePromotion.set(e)}copyOriginalSalesOrder(){let e=me(G,this._orderDataService.Data);this.salesOrderBeforePromotion.set(e)}HandleDiscountPercentage(e,t=!1){e.Amount>0?e.Requirement?.MaximumDiscount>0?this.applyConfigMaxDiscount(e,t):e.Requirement?.FullPriceProductOnly?this.applyFullPriceDisc(e,t):this.applyDiscountPercentage(e,t):(this.role.Discount=t?this.originalRoleData.Discount:!0,this._userRoleService.pushNewValue(this.role))}applyFullPriceDisc(e,t=!1){let i=this._orderDataService.Data,o=this.filterItemWithDisc(i.CartItems),r=this.filterItemWithCouponDisc(i.CartItems);if(t)r.length>0?(i.CartItems=this.resetItemsDisc(i.CartItems),this._orderDataService.pushNewValue()):this.applyDiscountPercentage(e,t);else if(o.length>0){let c=this.filterItemWithoutDisc(i.CartItems);c.length>0?this.applyConfigItemsScope(e,c).subscribe(u=>{let O=this.applyItemsDisc(u,e);i.CartItems=this.updateCartItems(O,e),this._orderDataService.pushNewValue(i),this.showToastr(e)}):(this.removeAppliedCoupon(!1),this._orderDataService.pushNewValue(),this.toastr.error("No products in the cart qualify for coupon use","Coupon Not Applied"))}else this.applyDiscountPercentage(e,t)}updateCartItems(e,t){let o=this._orderDataService.Data.CartItems.map((r,c)=>{let u=e.find(O=>this.isSameCartItem(O,r));return u||r});return o=this.applyOneOfFirstQuantity(o,t),o}applyOneOfFirstQuantity(e,t){if(t?.Requirement?.RequirementDiscountType==2){let i=e.findIndex(o=>o.CouponDiscount>0);if(e[i]?.Quantity>1){let o=mt(xe,e[i]);o.Quantity=1,o.ID=f.GuidEmpty,e[i].Quantity=e[i].Quantity-1,e[i].CouponDiscount=0,e[i].Discount=0,e[i].DiscountAmount=0,e.push(o)}}return e}filterItemWithDisc(e){return e.filter(i=>i.Discount>0||i.DiscountAmount>0||i.Price!=i?.Variant?.UnitPrice||f.IsNotEmpty(i.PriceBookID)||i.PriceTypeID==2)}filterItemWithoutDisc(e){return e.filter(i=>this.itemConditionFullPriceOnly(i))}filterItemWithCouponDisc(e){return e.filter(i=>i.CouponDiscount>0)}applyDiscountPercentage(e,t=!1){let i=this._orderDataService.Data.Order.CustomerDiscountRate,o=e.Amount;if(t){let r=this._orderDataService.Data;this._orderDataService.Data.Order.Discount=0,r.CartItems=this.resetItemsDisc(r.CartItems),this._orderDataService.pushNewValue(r)}else o>=i?e.ApplyToProduct?.length>0?this.applyDiscountRequiredItems(e):(this._orderDataService.Data.Order.Discount=e.Amount,this._orderDataService.pushNewValue(),this.showToastr(e)):(this.toastr.warning("Member discount is applied because member discount is greater than Coupon Discount","Warning"),this.removeAppliedDiscountOnCustomerChange())}applyDiscountRequiredItems(e){let i=this._orderDataService.Data.CartItems.filter(o=>e.ApplyToProduct.map(r=>r.ID)?.includes(o.VariantID));this.applyConfigItemsScope(e,i).subscribe(o=>{let r=o.map(u=>(u.Discount=e.Amount,u.CouponDiscount=e.Amount,u)),c=this.updateCartItems(r,e);this._orderDataService.Data.CartItems=c,this._orderDataService.pushNewValue(),this.showToastr(e)})}showToastr(e){let t=e?.Requirement?.Notify;f.IsNotEmpty(t)&&this.isShowToastrInApplyCoupon()&&this.toastr.success(t,"Coupon Applied")}applyConfigMaxDiscount(e,t=!1){let i=this._orderDataService.Data.CartItems;e.Requirement?.FullPriceProductOnly&&(i=i.filter(o=>this.itemConditionFullPriceOnly(o))),this.applyConfigItemsScope(e,i,t).subscribe(o=>{this.applyMaxDiscount(e,o,t)})}applyConfigItemsScope(e,t,i=!1){let o=e.Requirement?.RequirementDiscountType;return(o==1||o==2)&&i==!1?this.dialog.open(ki,{data:{coupon:e,cartItems:t},id:"modal-coupon-selected-item"}).afterClosed().pipe(le(c=>{let k=this._orderDataService.Data.CartItems.some(W=>W.CouponDiscount>0);!c&&!k&&this.removeAppliedDiscountOnCustomerChange()}),ce(c=>!!c)):ke(t)}applyMaxDiscount(e,t,i=!1){let o=this._invoiceCalculatorService.calculateGrossTotal(t),r=this._orderDataService.Data,c=o*e.Amount/100,u=e.Requirement?.MaximumDiscount,O=t;c>=u?(r.Order.DiscountAmount=i?0:u,O=this.resetItemsDisc(t)):(r.Order.DiscountAmount=0,O=i?this.resetItemsDisc(t):this.applyItemsDisc(t,e)),r.CartItems=this.updateCartItems(O,e),this._orderDataService.pushNewValue(r),i||this.showToastr(e)}resetItemsDisc(e){return this.coupon?.Requirement?.RequirementDiscountType==2?e=this.resetConfigOneOfFirstQuantity(e):e=e.map(t=>(t.CouponDiscount>0&&(t.Discount=0,t.DiscountAmount=0,t.CouponDiscount=0),t)),e}resetConfigOneOfFirstQuantity(e){let t=e.findIndex(i=>i.CouponDiscount>0);if(t!==-1){let i=e.findIndex(o=>o.CouponDiscount==0&&e[t]?.VariantID==o?.VariantID);i!==-1?(e.splice(t,1),e[i].Quantity+=1):(e[t].CouponDiscount=0,e[t].Discount=0,e[t].DiscountAmount=0)}return e}applyItemsDisc(e,t){return t.ApplyToProduct?.length>0?e=this.applyDiscByVariant(e,t):e=e.map(i=>(i.Discount=t.Amount,i.CouponDiscount=t.Amount,i)),e}applyDiscByVariant(e,t){return e=e.map(i=>(t.ApplyToProduct.find(r=>r.ID==i.VariantID)&&this.itemConditionFullPriceOnly(i)&&(i.Discount=t.Amount,i.CouponDiscount=t.Amount),i)),e}itemConditionFullPriceOnly(e){return(e.Discount==0||e.CouponDiscount>0)&&e.DiscountAmount==0&&e.Price==e?.Variant?.UnitPrice&&f.IsEmpty(e.PriceBookID)}HandleDiscountAmount(e,t=!1){e.Amount>0?(e.ApplyToProduct?.length>0?this.applyDiscountInItem(e,t):(t?this._orderDataService.Data.Order.DiscountAmount=0:(this._orderDataService.Data.Order.DiscountAmount=e.Amount,this.showToastr(e)),this._orderDataService.pushNewValue()),this.resetCustomerPoint(t)):(this.role.Discount=t?this.originalRoleData.Discount:!0,this._userRoleService.pushNewValue(this.role))}applyDiscountInItem(e,t=!1){let i=this._orderDataService.Data;if(t)i.CartItems=this.resetItemsDisc(i.CartItems);else{let r=i.CartItems.filter(c=>e.ApplyToProduct.map(u=>u.ID)?.includes(c.VariantID));this.applyConfigItemsScope(e,r,t).subscribe(c=>{let u=c.map(O=>(O.DiscountAmount=e.Amount,O.CouponDiscount=e.Amount,O));i.CartItems=this.updateCartItems(u,e),this._orderDataService.pushNewValue(i),this.showToastr(e)})}}resetCustomerPoint(e){if(!e){let t=this._orderDataService.Data;t.Order.PointUsed=0}}handleCouponReturnAccess(e){let t=me(We,this.role);t.Return=!0,this._userRoleService.pushNewValue(t),this.isShowToastrInApplyCoupon()&&this.toastr.success("You got access to return a sales transaction!","Coupon Applied")}handleCouponParkedDeletionAccess(){let e=me(We,this.role);e.ParkedDeletionAuthorized=!0,this._userRoleService.pushNewValue(e),this.isShowToastrInApplyCoupon()&&this.toastr.success("You Have Access to delete park and delete item when retrieve!","Coupon Applied")}handleFullAccessCoupon(){let e=me(We,this.role);e.UnitPriceEditor=!0,e.Discount=!0,e.Return=!0,e.Tax=!0,e.NumberEditor=!0,e.DateEditor=!0,e.PricebookSelector=!0,e.DeleteItem=!0,e.ParkedDeletionAuthorized=!0,this._userRoleService.pushNewValue(e),this.isShowToastrInApplyCoupon()&&this.toastr.success("You now have Full Access for this Order!","Coupon Applied")}handleDeleteItemCoupon(){let e=me(We,this.role);e.DeleteItem=!0,this._userRoleService.pushNewValue(e),this.isShowToastrInApplyCoupon()&&this.toastr.success("You Have Access to delete item","Coupon Applied")}removeAppliedCoupon(e=!0){this._userRoleService.pushNewValue(this.originalRoleData),this._orderDataService.pushNewValue(this.salesOrderBeforePromotion()),this.salesOrderBeforePromotion.set(null),this._coupon.set(null),e&&this.toastr.warning("Coupon Cancelled","Warning")}resetCouponOnNewTransaction(){this._userRoleService.pushNewValue(this.originalRoleData),this._coupon.set(null)}removeAppliedDiscountOnCustomerChange(){if(this.coupon)switch(this.coupon.Requirement?.Type){case 1:this.HandleDiscountPercentage(this._coupon(),!0),this.removeAppliedCouponOnCustomerChange();break;case 2:this.HandleDiscountAmount(this._coupon(),!0),this.removeAppliedCouponOnCustomerChange();break}}removeAppliedCouponOnCustomerChange(){if(this.coupon){let e=this._orderDataService.Data;e.Order.PromotionCoupon=null,e.Order.PromotionNote=null,this._coupon.set(null),this._userRoleService.pushNewValue(this.originalRoleData),this._orderDataService.pushNewValue(e)}}isSameCartItem(e,t){return e.VariantID===t.VariantID&&e.Quantity===t.Quantity&&e.Price===t.Price&&e.Discount===t.Discount&&e.PriceBookID===t.PriceBookID}static \u0275fac=function(t){return new(t||n)(g(ge),g(L),g(De),g(F),g(se),g(wt))};static \u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"})};var Nt=class{CommissionID;ReturNumber;parkTemporaryItem;posState;InputTextValue;constructor(){this.posState=0,this.CommissionID="",this.ReturNumber="",this.parkTemporaryItem=[],this.InputTextValue=""}};var Fi=class n{constructor(e,t,i){this._promotionEventService=e;this._dialogRef=t;this.data=i;this.modalConfig=new ie,this.modalConfig.hideCancel=!0,this.modalConfig.hideClose=!0,this.modalConfig.headerType=de.Warning,this.modalConfig.title="Promotion Requirement unfulfilled!",this.modalConfig.customWidth="350px",this.modalConfig.okText="Ok",this.selectedPromotion=e.selectedPromotion}modalConfig;selectedPromotion;onOk(){this._promotionEventService.restoreOrder(),this._dialogRef.close()}static \u0275fac=function(t){return new(t||n)(P(Ae),P(te),P(fe))};static \u0275cmp=N({type:n,selectors:[["POS-modal-promotion-confirm"]],standalone:!1,decls:9,vars:4,consts:[[3,"onOk","config"],[1,"fst-italic","text-danger","mb-3"],[1,"mb-0"]],template:function(t,i){t&1&&(a(0,"modal-material",0),S("onOk",function(){return i.onOk()}),a(1,"content")(2,"div")(3,"h5"),d(4),s(),a(5,"p",1),d(6),s(),a(7,"p",2),d(8),s()()()()),t&2&&(p("config",i.modalConfig),l(4),M(i.selectedPromotion==null?null:i.selectedPromotion.Name),l(2),M(i.selectedPromotion==null?null:i.selectedPromotion.Description),l(2),M(i.data==null?null:i.data.message))},dependencies:[ne],encapsulation:2})};var Li=class extends xe{};var Vt=class n{constructor(e,t,i,o,r,c,u,O,k,W){this.variantService=e;this._posService=t;this._orderDataService=i;this.toastr=o;this._orderProcessorService=r;this._customerHttpService=c;this.promotionCouponService=u;this.promotionCouponExternalService=O;this.userRoleService=k;this.decimalPipe=W;this.subscribeToObservable()}salesOrderData;appConfigJson;entityID;audio=new Audio;subscribeToObservable(){this._posService.Data$.pipe(ee()).subscribe(e=>{this.appConfigJson=e.AppConfigJSON}),this._orderDataService.Data$.pipe(ee()).subscribe(e=>{this.salesOrderData=e,this.entityID=e.Order.EntityID}),this._orderProcessorService.Data$.pipe(ee()).subscribe(e=>{e.posState==3&&this.clearCartItemsInLocalStorage()})}addCartItemById(e,t,i=!0){return new Promise((o,r)=>{this.variantService.findVariantByID(e,this.entityID,i).then(c=>{this.createNewCartItem(c,t),o(c)}).catch(c=>{r(c)})})}addCartItemByCode(e){return new Promise((t,i)=>{let o=this.appConfigJson.ModuleSell.DigitalScale;o.Digit>0&&f.IsNotEmpty(o.Regex)&&e.length==o.Digit?this.parseDigitalScaleBarcodeWithRegex(e,o).then(c=>{c||(this.toastr.info("Matching Regex Rule to Barcode","Digital Scale"),this.findVariantByCode(e).then(u=>t(u)).catch(u=>i(u)))}):this.findVariantByCode(e).then(c=>t(c)).catch(c=>i(c))})}findVariantByCode(e){let t=this.appConfigJson.ModuleSell.BarcodeSerialEnabled;return new Promise((i,o)=>{this.variantService.findVariantByCode(e,this.entityID,t).then(r=>{i(r),this.createNewCartItem(r)}).catch(r=>{this.playBellRing(),o(r)})})}addItemBySerial(e){this.variantService.findVariantBySerial(e,this.entityID).subscribe(t=>{let i=this.salesOrderData.CartItems;if(i.length>0){let o,r=[],c=i.findIndex(u=>u.Variant.ID==t.ID);r=[],c!==-1?(o=i[c].Serial?.findIndex(u=>u.Number==e),r=[...i[c].Serial?i[c].Serial:[]],o==-1?(r.push({Number:e,Quantity:1}),i[c].Quantity=r.length):r.length>0?r[o].Quantity+=1:(r=[{Number:e,Quantity:1}],this.addNewSerials(t,e)),i[c].Serial=[...r],i[c].Quantity=i[c].calculateSerialQty(),this.updateCartItem(i[c],c)):this.addNewSerials(t,e)}else this.addNewSerials(t,e)})}addNewSerials(e,t){e.Serial=[{Number:t,Quantity:1}],this.createNewCartItem(e)}playBellRing(){this.audio.src="https://cdn.dealpos.xyz/web-audio/bell_ring.mp3",this.audio.load(),this.audio.play()}updateCartItem(e,t){this.salesOrderData.CartItems[t]=e,this._orderDataService.pushNewValue(this.salesOrderData),this.applyCustomerPoint(),this.reApplyPromotionCoupon(),this.saveItemsToLocalStorage()}deleteCartItem(e){this.salesOrderData.CartItems=this.salesOrderData.CartItems.filter(t=>t!==e),this._orderDataService.pushNewValue(this.salesOrderData),this.applyCustomerPoint(),this.isRemoveItemRequirement(e)&&this.reApplyPromotionCoupon()}parseDigitalScaleBarcodeWithRegex(e,t){return new Promise(i=>{let o=this.appConfigJson.ModuleSell.BarcodeSerialEnabled,r=new RegExp(t.Regex),c=e.match(r);if(console.log(c),f.IsNotEmpty(c)){let u=c[1],O=parseFloat(c[2]);console.log(O,"productQuantity"),O=O/t.QuantityDivider,this.variantService.findVariantByCode(u,this.entityID,o).then(k=>{this.createNewCartItem(k,null,O),i(!0)}).catch(()=>{i(!1)})}else i(!1)})}createNewCartItem(e,t,i){let o=new xe,r=this.appConfigJson.ModuleSell.ProductNotes.CopyProductDescription,c=this.appConfigJson.ModuleSell.ProductNotes.CopyPromotionName;o.patchByVariant(e,r,c),o=this.applyReward(o,t),f.IsEmpty(t)&&(o=this.applyPriceBook(o)),this.validateCartItem(o)&&(o.Quantity=i||o.Quantity,t?.PromotionType==2?this.handlingPromotionQuantity(o):this.pushNewItemToArray(o,o.PromotionGift),this.applyCustomerPoint()),this.addAvailableComponent(o)}applyCustomerPoint(){let e=this.salesOrderData.Order.CustomerID,t=f.IsEmpty(e);this._orderProcessorService.reedemPointToDiscount(t)}handlingPromotionQuantity(e){let t=me(xe,this.salesOrderData.CartItems),i=t.findIndex(o=>o.VariantID==e.VariantID&&o.PromotionGift);i!==-1?t[i].Quantity+=e.Quantity?e.Quantity:1:t=[...t,e],this.salesOrderData.CartItems=t,this._orderDataService.pushNewValue(this.salesOrderData)}applyPromotionProduct(e){let t=e.Variant.DiscountAmount;return t&&(e.Price=e.UnitPriceOriginal-t),e}applyReward(e,t){if(t){let i=this.appConfigJson.ModuleSell.ProductNotes.CopyPromotionName;e.Discount=t.Discount,e.Price=t.OriginalPrice;let o=t.OriginalPrice-t.UnitPrice;e.Price=e.UnitPriceOriginal-o,e.UnitPrice=e.UnitPriceOriginal-o,e.PromotionGift=!0,e.PromotionID=t.PromotionID,e.Quantity=t.Quantity?t.Quantity:1,e.PriceTypeID=3,e.Cost+=t.ExtraCost,e.UnitCost+=t.ExtraCost,e.PriceNote=t.PromotionName,i&&(e.Note=`${e.Note?e.Note:""} ${t.PromotionName} `)}return e}addAvailableComponent(e){let t=e.Price!=0,i=this.appConfigJson.ModuleSell.SellProductComponentDefaultPrice,o=e.Variant;if(o.Component!=null&&o.Component.length>0)for(let r of o.Component){let c=new Li;c.patchByVariant(r),c.Quantity=e.Quantity*r.Quantity,t&&!i&&(r.UnitPrice=0),c.Price=r.UnitPrice,this.pushNewItemToArray(c)}}pushNewItemToArray(e,t=!1){let i=this.salesOrderData.CartItems.findIndex(o=>o.VariantID==e.VariantID);if(e=this.applyPromotionProduct(e),i==-1||t)this.salesOrderData.CartItems.push(e);else{let o=this.appConfigJson.ModuleSell.QuickKey.NewRowBehaviour;if(o==2)this.salesOrderData.CartItems.push(e);else if(o==1)this._orderProcessorService.Data.posState==4?this.salesOrderData.CartItems.push(e):this.addingQuantityItem(i,e);else{if(!this.validatePrepaidPackage(e,i)){this.toastr.error("This prepaid package is already in the cart while editing. Please remove it first before adding again.","Cannot Add Item");return}this.addingQuantityItem(i,e)}}this._orderDataService.pushNewValue(this.salesOrderData),this.saveItemsToLocalStorage(),this.reApplyPromotionCoupon()}saveItemsToLocalStorage(){let e=this.userRoleService.Data.DeleteItem,t=this._orderProcessorService.Data?.posState;if(!e&&t!==4){let i=this._orderDataService.Data,o=i?.Order?.Number,r=i.CartItems,c={Number:o,CartItems:r};try{localStorage.setItem("cart_items",JSON.stringify(c))}catch(u){console.error("Error saving cart items to localStorage:",u)}}}clearCartItemsInLocalStorage(){localStorage.getItem("cart_items")&&(this.userRoleService.Data?.DeleteItem?this.clearCartItemsBasedOnCoupon():this.clearCartItemsStorage())}clearCartItemsBasedOnCoupon(){let e=this.promotionCouponService?.coupon;e&&(e.Requirement?.Type==5||e.Requirement?.Type==6)&&this.clearCartItemsStorage()}clearCartItemsStorage(){try{localStorage.removeItem("cart_items")}catch(e){console.error("Error clearing cart items from localStorage:",e)}}validatePrepaidPackage(e,t){let i=this.salesOrderData.CartItems[t],o=this._orderProcessorService.Data.posState,r=e.Variant.TypeID==10,c=f.IsNotEmpty(i.ID),u=!0;return o==2&&r&&c&&(u=!1),u}reApplyPromotionCoupon(){let e=this.salesOrderData.Order.CouponProvider,t=e=="Internal"||f.IsEmpty(e),i=this.salesOrderData.Order.PromotionCoupon,o=this.salesOrderData.Order.PromotionNote;f.IsNotEmpty(i)&&(t?this.promotionCouponService.RedeemCoupon(i,o,!0):this.promotionCouponExternalService.redeemCoupon(i,"External",o))}isRemoveItemRequirement(e){let t=this.promotionCouponService?.coupon,i=t?.ApplyToProduct,o=!0;return f.IsNotEmpty(t)&&i?.length>0&&(o=i.some(r=>r.ID==e.VariantID)),o}addingQuantityItem(e,t){let i=this.salesOrderData.CartItems.filter(u=>u.VariantID==t.VariantID),o=i.length,r=i.find(u=>!u.PromotionGift);this.salesOrderData.CartItems[e].PromotionGift&&o==1?this.salesOrderData.CartItems.push(t):(r.Quantity+=t.Quantity,r=this.applyPromotionProduct(r)),r&&(r=this.applyPriceBook(r))}validateCartItem(e){return e.Variant.CategoryTypeID==-1?(this.toastr.info(e.Variant.Name+" cannot be sold, check Category "+e.Variant.CategoryName+" settings","info"),!1):!(!this.validatePriceMinimum(e)||!this.validateSerialItem(e))}validatePriceMinimum(e){let t=!0,i=this.userRoleService.Data.PriceMinimum,o=this.appConfigJson.ModuleSell.ProductDialog.PriceMinimumTypeID;if(i){let r=0;switch(o){case 1:r=e.UnitPrice;break;case 2:r=e.UnitCost;break;case 3:r=e.UnitPriceMinimum;break}if(e.Price<r){t=!1;let c=f.StringFormat("You have no right to sell this item lower than {0}",this.decimalPipe.transform(r));alert(c)}}return t}validateSerialItem(e){let t=!0;if(e?.Serial?.length>0&&e.Variant.TypeID==4&&e.Quantity>0){let i=0;e?.Serial?.forEach(o=>{i+=o.Quantity}),i!=e.Quantity&&(this.toastr.error("Serial must be equal with the quantity","Error"),t=!1)}return t}applyPriceBook(e){let t=e.Variant.PriceBook!=null?e.Variant.PriceBook:[],i=this.findCustomerPricebook(t);if(t&&t.length!==0){let o=t.sort(function(r,c){return c.MinimumQuantity-r.MinimumQuantity}).filter(r=>e.Quantity>=r.MinimumQuantity&&r.MinimumQuantity!=0);o.length>0||f.IsNotEmpty(i)?f.IsNotEmpty(i)?e=this.applyPricebookToItem(e,i):e=this.applyPricebookToItem(e,o[0]):e=this.resetAppliedPricebook(e)}return e}resetAppliedPricebook(e){let i=(e?.Variant?.PriceBook).find(o=>o.ID==e.PriceBookID);return f.IsNotEmpty(i)&&(e.Discount=e.Variant.PriceDiscount,e.PriceBookID=f.GuidEmpty,e.Price=e.Variant.UnitPrice,e.UnitPrice=e.Variant.UnitPrice,e.PriceTypeID=0,e=this.applyPromotionProduct(e),e=this.removePromotionNote(e)),e}removePromotionNote(e){let t=this.appConfigJson.ModuleSell.ProductNotes;if(this.appConfigJson?.ModuleSell?.Pricebook?.PricebookVisible&&(e.Note=e.Note?.replace(e.PriceNote,""),e.PriceNote=""),t.CopyPromotionName){let o=e.Variant?.PriceNote;e.Note=`${o||""} ${e.Note?e.Note:""}`,e.PriceNote=o}return e}applyPricebookToItem(e,t){return e.Discount=t.PriceDiscount,e.UnitPrice=t.UnitPrice,e.PriceBookID=t.ID,e.Price=t.UnitPrice,e.PriceTypeID=2,e=this.assignItemNote(e,t),e}assignItemNote(e,t){return this.appConfigJson?.ModuleSell?.Pricebook?.PricebookVisible?(e.Note?.includes(e.PriceNote)?e.Note=e.Note?.replace(e.PriceNote,t.Name):e.Note=`${t.Name} ${e.Note?e.Note:""}`,e.PriceNote=t.Name):(e.Note="",e.PriceNote=""),e}findCustomerPricebook(e=[]){let t=this._customerHttpService.Data,i;return t&&(i=e.find(o=>o.ID==t.PricebookID)),i}static \u0275fac=function(t){return new(t||n)(g(Mo),g(z),g(L),g(F),g(je),g(Re),g(Rt),g(Bi),g(De),g(q))};static \u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"})};function Or(n,e){if(n&1&&(a(0,"div",2)(1,"div",4),b(2,"input",8),s()()),n&2){let t=m();l(2),p("formControl",t.searchControl)}}function Dr(n,e){n&1&&(a(0,"span"),d(1,"Apply"),s())}function Mr(n,e){n&1&&(a(0,"span"),d(1,"Applying..."),s())}function xr(n,e){if(n&1){let t=E();a(0,"tr")(1,"td"),d(2),s(),a(3,"td"),d(4),s(),a(5,"td",9),d(6),y(7,"number"),s(),a(8,"td",9),d(9),y(10,"number"),s(),a(11,"td",10)(12,"button",11),S("click",function(){let o=v(t).$implicit,r=m();return _(r.onSelectReward(o))}),h(13,Dr,2,0,"span"),h(14,Mr,2,0,"span"),s()()()}if(n&2){let t=e.$implicit,i=m();l(2),M(t.VariantName),l(2),M(t.VariantCode),l(2),M(x(7,7,t.OriginalPrice)),l(3),M(x(10,9,t.UnitPrice)),l(3),p("disabled",i.isApplyingReward()),l(),C(i.isApplyingReward()?-1:13),l(),C(i.isApplyingReward()?14:-1)}}var ji=class n{constructor(e,t,i,o,r,c){this._dialogRef=e;this._matDialog=t;this._shoppingCartService=i;this._promotionEventService=o;this._toastr=r;this.data=c;this.selectedPromotion=this._promotionEventService.selectedPromotion}modalConfig=new ie;selectedPromotion;rewards$;searchControl=new et;isApplyingReward=R(!1);ngOnInit(){this.modalConfig.title="Select a Reward",this.modalConfig.hideFooter=!0,this.initRewards(!0)}initRewards(e){this.rewards$=this.searchControl.valueChanges.pipe(li(""),ht(e?0:500),Fe(),Y(t=>{let i;return i=ke(this.data.rewards).pipe(J(o=>o.filter(r=>this.findKeywordInValue(t,r?.VariantCode)||this.findKeywordInValue(t,r?.VariantName)))),e=!0,i}))}findKeywordInValue(e,t){return t?.toUpperCase()?.indexOf(e?.toUpperCase())>-1}onSelectReward(e){return oi(this,null,function*(){if(!this.isApplyingReward()){this.isApplyingReward.set(!0);try{e.PromotionType=this.data.promotion.TypeID,yield this._shoppingCartService.addCartItemById(e.VariantID,e,!0).then(()=>{this._matDialog.closeAll(),this._promotionEventService.pushNewValue(this._promotionEventService.Data),this.showToastAppliedPromo()})}finally{this.isApplyingReward.set(!1)}}})}showToastAppliedPromo(){this._toastr.success("Applied "+this.selectedPromotion.Name+" to order!","Applied successfully!")}close(){this._dialogRef.close()}static \u0275fac=function(t){return new(t||n)(P(te),P(we),P(Vt),P(Ae),P(F),P(fe))};static \u0275cmp=N({type:n,selectors:[["POS-modal-select-item"]],standalone:!1,decls:23,vars:8,consts:[[3,"onCancel","onClose","config"],[1,"container"],[1,"row","mb-3"],[1,"row"],[1,"col-12"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],["type","text","placeholder","Type to filter reward",1,"form-control",3,"formControl"],[1,"text-end"],[1,"text-center"],[1,"btn","btn-sm","btn-success",3,"click","disabled"]],template:function(t,i){t&1&&(a(0,"modal-material",0),S("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),a(1,"content")(2,"div",1),h(3,Or,3,1,"div",2),a(4,"div",3)(5,"div",4)(6,"table",5)(7,"thead",6)(8,"tr")(9,"th",7),d(10,"Name"),s(),a(11,"th",7),d(12,"Code"),s(),a(13,"th",7),d(14,"Price"),s(),a(15,"th",7),d(16,"Promo"),s(),b(17,"th",7),s()(),a(18,"tbody"),K(19,xr,15,11,"tr",null,ve),y(21,"async"),y(22,"sortBy"),s()()()()()()()),t&2&&(p("config",i.modalConfig),l(3),C((i.data==null||i.data.rewards==null?null:i.data.rewards.length)>5?3:-1),l(16),Z(yt(22,4,x(21,2,i.rewards$),"desc","VariantCode")))},dependencies:[Te,Pe,St,ne,ze,q,Mt],styles:[".table-scroll[_ngcontent-%COMP%]{max-height:400px;overflow-y:auto}table[_ngcontent-%COMP%]{max-width:600px!important;overflow-x:hidden}"]})};function Ir(n,e){if(n&1&&(a(0,"div",3)(1,"div",5),b(2,"input",10),s()()),n&2){let t=m();l(2),p("formControl",t.searchCtrl)}}function Tr(n,e){n&1&&(a(0,"th",9),d(1,"Qty"),s())}function Er(n,e){n&1&&b(0,"th",8)}function wr(n,e){if(n&1){let t=E();a(0,"td")(1,"input",13),H("ngModelChange",function(o){v(t);let r=m().$implicit;return A(r.Quantity,o)||(r.Quantity=o),_(o)}),s()()}if(n&2){let t=m().$implicit;l(),B("ngModel",t.Quantity)}}function Rr(n,e){n&1&&(a(0,"span"),d(1,"Apply"),s())}function Nr(n,e){n&1&&(a(0,"span"),d(1,"Applying..."),s())}function Ar(n,e){if(n&1){let t=E();a(0,"td",12)(1,"button",14),S("click",function(){v(t);let o=m().$implicit,r=m();return _(r.onApplyReward(o))}),h(2,Rr,2,0,"span"),h(3,Nr,2,0,"span"),s()()}if(n&2){let t=m(2);l(),p("disabled",t.isApplyingReward()),l(),C(t.isApplyingReward()?-1:2),l(),C(t.isApplyingReward()?3:-1)}}function kr(n,e){if(n&1&&(a(0,"tr")(1,"td"),d(2),s(),a(3,"td"),d(4),s(),a(5,"td",11),d(6),y(7,"number"),s(),a(8,"td",11),d(9),y(10,"number"),s(),h(11,wr,2,1,"td")(12,Ar,4,3,"td",12),s()),n&2){let t=e.$implicit,i=m();l(2),M(t.VariantName),l(2),M(t.VariantCode),l(2),M(x(7,5,t.OriginalPrice)),l(3),M(x(10,7,t.UnitPrice)),l(2),C(i.rewardQuantity>1?11:12)}}var Qi=class n{constructor(e,t,i,o,r,c){this.data=e;this.shoppingCartService=t;this.promotionEventService=i;this.dialogRef=o;this.matDialog=r;this.toastr=c;this.searchCtrl=new et,this.rewardQuantity=e.rewardQuantity,this.sourceRewards=[...e.rewards]}modalConfig;rewards$;rewardQuantity;rewards;sourceRewards=[];searchCtrl;isApplyingReward=R(!1);ngOnInit(){this.initModalConfig(),this.initSearchCtrl(!0)}initModalConfig(){this.modalConfig=new ie,this.modalConfig.title="Select a Reward",this.rewardQuantity<2&&(this.modalConfig.hideFooter=!0)}initSearchCtrl(e){this.rewards$=this.searchCtrl.valueChanges.pipe(li(""),ht(e?0:500),Fe(),Y(t=>{let i;return i=ke(this.sourceRewards).pipe(J(o=>(o.length===1&&(o[0].Quantity=this.rewardQuantity),o)),J(o=>o.filter(r=>this.findKeywordInValue(t,r?.VariantCode)||this.findKeywordInValue(t,r?.VariantName)))),e=!1,i}),le(t=>{this.rewards=t}))}findKeywordInValue(e,t){return t?.toUpperCase()?.indexOf(e.toUpperCase())>-1}onApplyReward(e){return oi(this,null,function*(){if(!this.isApplyingReward()){this.isApplyingReward.set(!0);try{yield this.addRewardToShoppingCart(e)}finally{this.isApplyingReward.set(!1)}}})}onClose(){this.dialogRef.close()}onOk(){this.calculateRewardQty()>this.rewardQuantity?this.toastr.warning("Product reward exceeds the maximum amount earned","Warning"):[...this.rewards].filter(i=>i.Quantity>0).forEach(i=>{this.addRewardToShoppingCart(i)})}calculateRewardQty(){let e=0;return this.rewards.forEach(t=>{e+=t.Quantity?t.Quantity:0}),e}addRewardToShoppingCart(e){return e.PromotionType=this.data.promotion.TypeID,this.shoppingCartService.addCartItemById(e.VariantID,e,!0).then(()=>{this.matDialog.closeAll(),this.promotionEventService.pushNewValue(this.promotionEventService.Data)})}static \u0275fac=function(t){return new(t||n)(P(fe),P(Vt),P(Ae),P(te),P(we),P(F))};static \u0275cmp=N({type:n,selectors:[["app-modal-quantity-reward"]],standalone:!1,decls:27,vars:10,consts:[[3,"onCancel","onOk","onClose","config"],[1,"ms-3"],[1,"container"],[1,"row","mb-3"],[1,"row","table-scroll"],[1,"col-12"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],["scope","col",2,"width","66px"],["type","text","placeholder","Type to filter reward",1,"form-control",3,"formControl"],[1,"text-end"],[1,"text-center"],["type","text","autoNum","","min","0",1,"form-control",3,"ngModelChange","ngModel"],[1,"btn","btn-sm","btn-success",3,"click","disabled"]],template:function(t,i){t&1&&(a(0,"modal-material",0),S("onCancel",function(){return i.onClose()})("onOk",function(){return i.onOk()})("onClose",function(){return i.onClose()}),a(1,"header")(2,"small",1),d(3),s()(),a(4,"content")(5,"div",2),h(6,Ir,3,1,"div",3),a(7,"div",4)(8,"div",5)(9,"table",6)(10,"thead",7)(11,"tr")(12,"th",8),d(13,"Name"),s(),a(14,"th",8),d(15,"Code"),s(),a(16,"th",8),d(17,"Price"),s(),a(18,"th",8),d(19,"Promo"),s(),h(20,Tr,2,0,"th",9)(21,Er,1,0,"th",8),s()(),a(22,"tbody"),K(23,kr,13,9,"tr",null,ve),y(25,"async"),y(26,"sortBy"),s()()()()()()()),t&2&&(p("config",i.modalConfig),l(3),D(" ( ",i.rewardQuantity," products reward ) "),l(3),C((i.sourceRewards==null?null:i.sourceRewards.length)>5?6:-1),l(14),C(i.rewardQuantity>1?20:21),l(3),Z(yt(26,6,x(25,4,i.rewards$),"desc","VariantCode")))},dependencies:[Te,Pe,Ee,St,ne,Dt,ze,q,Mt],encapsulation:2})};var Ae=class n{constructor(e,t,i,o,r,c,u,O,k){this._orderDataService=e;this._outletService=t;this._invoiceCalculatorService=i;this._dialog=o;this._httpService=r;this._posService=c;this._toastr=u;this._signalrService=O;this.decimalPipe=k;this.previousQuantity=0,this.previousTotalEligible=0,this.subscribeNotification(),this._posService.Data$.subscribe(W=>{this.taxes=W.Taxes}),this._outletService.Data$.subscribe(W=>{this.loadPromotions(W.Promotion)}),this._orderDataService.Data$.pipe(ce(W=>{this.salesOrderData=W;let ye=this.calculateOrderReward(W.getRewards()),_n=this.calculateOrderReward(this.previousRewards);return this.previousQuantity!=W.TotalQuantity||_n<ye||this.isRestroreOrder}),ht(100)).subscribe(W=>{this.isRestroreOrder=!1,this.checkQtyPromotion(),this.applyQuantityPromotion(),this.previousRewards=[...W.getRewards()]}),this._invoiceCalculatorService.Data$.subscribe(W=>{this.checkEligiblePromotionWithMinSpend()})}_Data=new be([]);get Data(){return this._Data.getValue()}Data$=this._Data.asObservable();selectedPromotion=null;onClickToastPromo=new Me;previousQuantity;salesOrderData;orderDataBeforePromotion;taxes=[];previousTotalEligible;previousRewards=[];isRestroreOrder=!1;calculateOrderReward(e){let t=0;return e.length>0&&(t=e.map(i=>i.Quantity).reduce((i,o)=>i+o)),t}checkQtyPromotion(){let e=this._orderDataService.Data;this.checkEligibleQtyPromotion(e.CartItems),this.checkEligibleTierPromotion(e.CartItems),this.previousQuantity=e.TotalQuantity}subscribeNotification(){this._signalrService.OnPromotionEventChange.pipe(ee(),Y(()=>{let e=this._outletService.Data?.RegisterID;return this.getPromotions(e)})).subscribe(()=>{this._toastr.info("Promotion Event Updated","Promotion Update")})}getPromotions(e){return this._httpService.get(U.GetListPromotion,[{key:"RegisterID",value:e}]).pipe(le(t=>{this.loadPromotions(t)}))}loadPromotions(e){let t=this.getPromotionDesc(e);this.pushNewValue(t),this.checkQtyPromotion(),this.checkEligiblePromotionWithMinSpend()}pushNewValue(e){this.showToastEligiblePromotion(),this._Data.next(e)}checkSelectedPromotionRequirement(e){this.selectedPromotion!=null&&this.selectedPromotion.TypeID==e&&this.Data.find(i=>i.ID===this.selectedPromotion.ID)?.Eligible===!1&&(this._dialog.open(Fi,{id:"modal-promotion-confirm",data:{message:"Order will be restored to before the promotion is applied"},disableClose:!0}),this.isRestroreOrder=!0)}restoreOrder(){this._orderDataService.pushNewValue(this.orderDataBeforePromotion),this.selectedPromotion=null}getPromotionDesc(e=[]){return e?.map(i=>(i.Description=this.generatePromotionDesc(i),i))}checkEligiblePromotionWithMinSpend(){let e=this._invoiceCalculatorService.Data,t=this.Data?.filter(o=>(o.TypeID===1||o.TypeID==3)&&!this.checkExpiredPromotion(o)).map(o=>(e>=o.MinimumAmount?o.Eligible=!0:o.Eligible=!1,o)),i=this.mappingEligiblePromotion(t);this.pushNewValue(i),this.checkSelectedPromotionRequirement(1),this.checkSelectedPromotionRequirement(3)}checkEligibleQtyPromotion(e){let t=0,i=this.Data?.filter(r=>r.TypeID===2&&!this.checkExpiredPromotion(r)).map(r=>(r.Eligible=!1,r.ListVariant.length>0?(t=this.getQuantityByRequirementType(e,"variant",r.ListVariant),t>=r.MinimumAmount&&(r.Eligible=!0)):r.ListCategory.length>0?(t=this.getQuantityByRequirementType(e,"category",r.ListCategory),t>=r.MinimumAmount&&(r.Eligible=!0)):this.salesOrderData.TotalQuantity>=r.MinimumAmount&&(r.Eligible=!0),r)),o=this.mappingEligiblePromotion(i);this.pushNewValue(o)}checkEligibleTierPromotion(e){let t,i=this.Data?.filter(r=>r.TypeID===5&&!this.checkExpiredPromotion(r)).map(r=>(r.Eligible=!1,r.ListVariant.length>0?t=this.getQuantityByRequirementType(e,"variant",r.ListVariant):r.ListCategory.length>0?t=this.getQuantityByRequirementType(e,"category",r.ListCategory):t=this.salesOrderData.TotalQuantity,r.PromotionTieredQuantity.forEach(c=>{t>=c.Quantity&&(r.Eligible=!0)}),r)),o=this.mappingEligiblePromotion(i);this.pushNewValue(o)}getQuantityByRequirementType(e,t,i){let o=0,r;return t=="variant"?e.forEach(c=>{r=i.findIndex(u=>u.ID===c.VariantID),r!==-1&&(o+=c.Quantity)}):e.forEach(c=>{c.Variant&&(r=i.findIndex(u=>u.ID===c.Variant.CategoryID),r!==-1&&(o+=c.Quantity))}),o}mappingEligiblePromotion(e=[]){let t=this.Data;if(e?.length>0){let i;t=this.Data?.map(o=>(i=e.findIndex(r=>r.ID==o.ID),i!==-1&&(o=e[i]),o))}return t}checkExpiredPromotion(e){let t=new Date,i=new Date(e.StartDate),r=(f.IsEmpty(e.StartTime)?"00:00:00":e.StartTime).split(":").map(k=>parseInt(k));i.setHours(r[0],r[1],r[2]);let c=new Date(e.ExpirationDate),O=(f.IsEmpty(e.EndTime)?"23:59:59":e.EndTime).split(":").map(k=>parseInt(k));return c.setHours(O[0],O[1],O[2]),!(t.getTime()>=i.getTime()&&t.getTime()<=c.getTime())}showToastEligiblePromotion(){let e=this.getTotalEligiblePromotion(),t=f.IsNotEmpty(this.salesOrderData.Order.ID);this.previousTotalEligible!==e&&e>0&&!t&&this._toastr.info(e+" promotion(s) can be applied!","Promo available!",{timeOut:2e4}).onTap.pipe(Qe(1)).subscribe(()=>{this.onClickToastPromo.next(!0)}),this.previousTotalEligible=e}getTotalEligiblePromotion(){return this.Data?.filter(t=>t.Eligible).length}generatePromotionDesc(e){let t="";switch(e.TypeID){case 2:t+="Minimum "+this.decimalPipe.transform(e.MinimumAmount)+" ",e.ListVariant.length>0?(t=t+" piece of ",t+=this.generateItemListDescription(e.ListVariant)):e.ListCategory.length>0?(t+="from category ",t+=this.generateItemListDescription(e.ListCategory)):t+="items";break;case 1:t+="Minimum spend Rp. "+this.decimalPipe.transform(e.MinimumAmount);break;case 3:t+=`Apply
|
|
3
3
|
${e.Discount1!==0?"discount1 = "+e.Discount1+"%":""}
|
|
4
4
|
${e.Discount1!==0&&e.Discount2!==0?" and ":""}
|