dealpos 25.48.0 → 25.48.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/browser/{chunk-HYURPMUC.js → chunk-2RYEXHZV.js} +1 -1
  2. package/browser/{chunk-4KMRZ2TB.js → chunk-356KM5DR.js} +1 -1
  3. package/browser/chunk-36NP63VM.js +3 -0
  4. package/browser/{chunk-A4H6IBC3.js → chunk-3DAJFE6H.js} +1 -1
  5. package/browser/{chunk-KVE6HTDK.js → chunk-3ESMPFFS.js} +1 -1
  6. package/browser/{chunk-7TWRUF3H.js → chunk-3G264AW4.js} +1 -1
  7. package/browser/{chunk-S5HK3JOC.js → chunk-3VQBBLWE.js} +1 -1
  8. package/browser/{chunk-722XQJ5H.js → chunk-3YHMSAWW.js} +1 -1
  9. package/browser/{chunk-NS7V266J.js → chunk-4ISL77CE.js} +1 -1
  10. package/browser/{chunk-2IIAMAC2.js → chunk-4NNOZ2BP.js} +1 -1
  11. package/browser/{chunk-BTJPSMLV.js → chunk-4VSJH5SL.js} +1 -1
  12. package/browser/{chunk-P43N5BDV.js → chunk-5K7KFVM3.js} +1 -1
  13. package/browser/{chunk-YOIV5LCG.js → chunk-6EJSHQWL.js} +1 -1
  14. package/browser/{chunk-55K6ABR7.js → chunk-6ONTAEOO.js} +1 -1
  15. package/browser/{chunk-FUS5ABYT.js → chunk-6PR53KNR.js} +1 -1
  16. package/browser/{chunk-RFCZ4NNF.js → chunk-6YHYVBRQ.js} +1 -1
  17. package/browser/{chunk-HEPRCWZT.js → chunk-7HRIPBOK.js} +1 -1
  18. package/browser/{chunk-NFAOMT2P.js → chunk-7MD5PKPB.js} +2 -2
  19. package/browser/{chunk-DFUQ53YY.js → chunk-7NEKXENA.js} +1 -1
  20. package/browser/{chunk-HQMGZB3H.js → chunk-7V3SLYOQ.js} +1 -1
  21. package/browser/chunk-7ZUYXNKP.js +5 -0
  22. package/browser/{chunk-CWFUNJQI.js → chunk-ANPUR4EP.js} +1 -1
  23. package/browser/{chunk-YYGLCUQ6.js → chunk-BJF3WGIP.js} +1 -1
  24. package/browser/{chunk-ZNIIYEEO.js → chunk-BOLUBS5R.js} +2 -2
  25. package/browser/{chunk-OK5EBIMF.js → chunk-BYFPLENU.js} +2 -2
  26. package/browser/{chunk-LB7NU42O.js → chunk-CFU6YCXT.js} +1 -1
  27. package/browser/{chunk-YJFCUHVH.js → chunk-CLX7PIH6.js} +1 -1
  28. package/browser/{chunk-4AKG7BSF.js → chunk-DHY5NYN2.js} +1 -1
  29. package/browser/{chunk-5S5ZFAPJ.js → chunk-DV63TLIP.js} +1 -1
  30. package/browser/{chunk-NCLOGMP4.js → chunk-DWNXML7N.js} +1 -1
  31. package/browser/{chunk-Z2CO5BFP.js → chunk-E55DAXRW.js} +1 -1
  32. package/browser/{chunk-YWDEOTPR.js → chunk-E5IXDLDT.js} +1 -1
  33. package/browser/{chunk-54W52P5V.js → chunk-E7AQSX2U.js} +1 -1
  34. package/browser/{chunk-R3BLOGD6.js → chunk-EIHC54J5.js} +1 -1
  35. package/browser/{chunk-56J3O2YI.js → chunk-F7KTXCW4.js} +3 -3
  36. package/browser/{chunk-ECEHKAWW.js → chunk-FO5ZTXDH.js} +1 -1
  37. package/browser/{chunk-CJII6RPH.js → chunk-G4G5P6ZQ.js} +1 -1
  38. package/browser/{chunk-KWKY5NGW.js → chunk-GCP2MGQL.js} +1 -1
  39. package/browser/{chunk-BNYVOYYX.js → chunk-HCCADOVL.js} +1 -1
  40. package/browser/{chunk-K5L5HMWR.js → chunk-I7FZGSZZ.js} +1 -1
  41. package/browser/{chunk-OBXCVFDY.js → chunk-IVJVUXLS.js} +1 -1
  42. package/browser/{chunk-3KNGE65M.js → chunk-IVVSNJJ3.js} +1 -1
  43. package/browser/chunk-J76F72FK.js +24 -0
  44. package/browser/{chunk-63AFDUIT.js → chunk-K6CUAFH7.js} +12 -12
  45. package/browser/{chunk-6BKNXERF.js → chunk-KD24MXAU.js} +1 -1
  46. package/browser/{chunk-QPMF6WP7.js → chunk-KPHOGUDM.js} +1 -1
  47. package/browser/{chunk-KY577SRX.js → chunk-KRPYY55C.js} +1 -1
  48. package/browser/{chunk-IMVZUGYH.js → chunk-KZBNUY2K.js} +1 -1
  49. package/browser/{chunk-MNVLPMSI.js → chunk-LELZTT7A.js} +1 -1
  50. package/browser/{chunk-4IQRI3GN.js → chunk-LLHBXZ6B.js} +1 -1
  51. package/browser/{chunk-QHNGMJWX.js → chunk-MFLQHYOR.js} +1 -1
  52. package/browser/{chunk-WWQSFAIE.js → chunk-N3L2CE6S.js} +1 -1
  53. package/browser/{chunk-32RSQ3UU.js → chunk-NJD4GKTM.js} +1 -1
  54. package/browser/{chunk-MNZTXNPB.js → chunk-NZ4SK6LY.js} +1 -1
  55. package/browser/{chunk-H44MWYXB.js → chunk-OTUYSGSK.js} +4 -4
  56. package/browser/{chunk-YFRQWQ66.js → chunk-OWGJVIYJ.js} +1 -1
  57. package/browser/{chunk-3L267ZNV.js → chunk-P7BRWWWC.js} +1 -1
  58. package/browser/{chunk-MZIYTJ6Z.js → chunk-R36QPCUA.js} +1 -1
  59. package/browser/{chunk-DSF34FWR.js → chunk-RJMVCGIG.js} +1 -1
  60. package/browser/{chunk-4RKRHCPA.js → chunk-S7X7547X.js} +1 -1
  61. package/browser/{chunk-ND6K5DYL.js → chunk-SLDKONZE.js} +1 -1
  62. package/browser/{chunk-QQDH2U6C.js → chunk-TARA6KGA.js} +1 -1
  63. package/browser/{chunk-3THWKHRL.js → chunk-TON7E347.js} +1 -1
  64. package/browser/{chunk-VXHN6MWB.js → chunk-TT2F5I7H.js} +1 -1
  65. package/browser/{chunk-2LYXOQ5N.js → chunk-U4N5AZIO.js} +1 -1
  66. package/browser/{chunk-MYKOQWDM.js → chunk-U5LNORQV.js} +1 -1
  67. package/browser/{chunk-5WZX5UDC.js → chunk-UAQU4IQS.js} +1 -1
  68. package/browser/{chunk-VC7J7CSQ.js → chunk-UCOXEQFM.js} +1 -1
  69. package/browser/{chunk-WCCWWFYE.js → chunk-UQ5F3YKZ.js} +1 -1
  70. package/browser/{chunk-7XC4XIHR.js → chunk-USMW7JHL.js} +1 -1
  71. package/browser/{chunk-V4KJNBS7.js → chunk-UZKEO2IO.js} +1 -1
  72. package/browser/{chunk-RKBLZASG.js → chunk-VNBCF2XF.js} +1 -1
  73. package/browser/{chunk-SDRB6Y54.js → chunk-VVYOMXKJ.js} +1 -1
  74. package/browser/chunk-WBFJWUUR.js +1 -0
  75. package/browser/{chunk-UJTEC3AC.js → chunk-WKXWWL55.js} +1 -1
  76. package/browser/{chunk-L7CBHHVQ.js → chunk-WQMNK3UX.js} +1 -1
  77. package/browser/{chunk-4XGRIAZ2.js → chunk-WXH4A4T7.js} +1 -1
  78. package/browser/{chunk-AE6CDP2N.js → chunk-X3UFVTIQ.js} +1 -1
  79. package/browser/{chunk-BMSRWGKX.js → chunk-XSHCTIUH.js} +1 -1
  80. package/browser/{chunk-Q6KWA7ML.js → chunk-YBIA6E5J.js} +1 -1
  81. package/browser/{chunk-LPWVUN75.js → chunk-YBVDBTTE.js} +1 -1
  82. package/browser/{chunk-ZEIM63JO.js → chunk-YQOU4WGG.js} +1 -1
  83. package/browser/{chunk-QQXPISMR.js → chunk-YV4LSCS5.js} +1 -1
  84. package/browser/index.html +2 -2
  85. package/browser/{main-7GOIEWD6.js → main-BTMX7TBF.js} +2 -2
  86. package/package.json +1 -1
  87. package/browser/chunk-47T7IWRR.js +0 -5
  88. package/browser/chunk-AKFNDMFE.js +0 -3
  89. package/browser/chunk-NVYVELCF.js +0 -24
  90. package/browser/chunk-YUTT2QKH.js +0 -1
@@ -1 +1 @@
1
- import{a as c}from"./chunk-USJ6ILEE.js";import{a as t}from"./chunk-YYGLCUQ6.js";import{la as i}from"./chunk-JYZTRN6N.js";import{a}from"./chunk-SNAKHGZS.js";var n=class o{constructor(){}inititalizeIntercom(){let e=this.getFromLocalStorage();e?.Enabled&&window.Intercom("boot",{app_id:t.intercom.appId,name:e.Name,email:e.Email,created_at:e.Created,user_hash:e.Hash})}shutdown(){this.getFromLocalStorage()?.Enabled&&(window.Intercom("shutdown"),this.clearStorage())}clearStorage(){localStorage.removeItem("Intercom")}updateLocalStorage(e){localStorage.setItem("Intercom",JSON.stringify(e))}getFromLocalStorage(){let e=localStorage.getItem("Intercom");return JSON.parse(e)}hideLauncher(){let e=this.getFromLocalStorage();e?.Enabled&&(e.hide_default_launcher=!0,window.Intercom("update",a({app_id:t.intercom.appId},e)),this.updateLocalStorage(e))}showLauncher(){let e=this.getFromLocalStorage();e?.Enabled&&(e.hide_default_launcher=!1,window.Intercom("update",a({app_id:t.intercom.appId},e)),this.updateLocalStorage(e))}isHideLauncher(){let e=this.getFromLocalStorage();return c.IsEmpty(e?.hide_default_launcher)?!1:e?.hide_default_launcher}static \u0275fac=function(r){return new(r||o)};static \u0275prov=i({token:o,factory:o.\u0275fac,providedIn:"root"})};export{n as a};
1
+ import{a as c}from"./chunk-USJ6ILEE.js";import{a as t}from"./chunk-BJF3WGIP.js";import{la as i}from"./chunk-JYZTRN6N.js";import{a}from"./chunk-SNAKHGZS.js";var n=class o{constructor(){}inititalizeIntercom(){let e=this.getFromLocalStorage();e?.Enabled&&window.Intercom("boot",{app_id:t.intercom.appId,name:e.Name,email:e.Email,created_at:e.Created,user_hash:e.Hash})}shutdown(){this.getFromLocalStorage()?.Enabled&&(window.Intercom("shutdown"),this.clearStorage())}clearStorage(){localStorage.removeItem("Intercom")}updateLocalStorage(e){localStorage.setItem("Intercom",JSON.stringify(e))}getFromLocalStorage(){let e=localStorage.getItem("Intercom");return JSON.parse(e)}hideLauncher(){let e=this.getFromLocalStorage();e?.Enabled&&(e.hide_default_launcher=!0,window.Intercom("update",a({app_id:t.intercom.appId},e)),this.updateLocalStorage(e))}showLauncher(){let e=this.getFromLocalStorage();e?.Enabled&&(e.hide_default_launcher=!1,window.Intercom("update",a({app_id:t.intercom.appId},e)),this.updateLocalStorage(e))}isHideLauncher(){let e=this.getFromLocalStorage();return c.IsEmpty(e?.hide_default_launcher)?!1:e?.hide_default_launcher}static \u0275fac=function(r){return new(r||o)};static \u0275prov=i({token:o,factory:o.\u0275fac,providedIn:"root"})};export{n as a};
@@ -1 +1 @@
1
- import{a as g}from"./chunk-YFRQWQ66.js";import{Ca as l,Lc as h,e as c}from"./chunk-JYZTRN6N.js";var p=class extends g{constructor(t,e,s,i,n,a,o,r){super(t,e,s,i,n,a,o);this.httpService=e;this.toastrService=n;this.route=a;this.cdr=r;r&&h(()=>{this.infiniteListSignal(),this.cdr.markForCheck()})}toastrCount=0;nextPageDisabled=!1;extendData=!1;goToLast=!1;listTotal=0;_infiniteList$=new c([]);infiniteListSignal=l([]);get infiniteList(){return this._infiniteList$.value}set infiniteList(t){this._infiniteList$.next(t),this.infiniteListSignal.set(t)}originalData=[];StoreRowsCountAPIResult(t,e=!1){this.httpService.post("/api/"+t,this.pageData.Filter).subscribe(s=>{this.listTotal=s.Count,this.pageData.HideStoreApiCount=!0,e&&(this.pageData.Filter.RowCount=this.listTotal,this.goToLast=!0,this.pageData.Filter.PageNumber=1,this.getListData()),this.cdr&&this.cdr.markForCheck()})}NextPage(t){this.pageData.Filter.PageNumber=this.pageData.Filter.PageNumber||1,this.pageData.Filter.PageNumber+=1,this.extendData=t,this.getListData()}postInit(t){t?.Data?.length>0&&(this.toastrCount=0),t?.Data?.length===0&&this.toastrCount===0&&(this.toastrService?.info("No more data to load","Info"),this.toastrCount=1);let e=Array.isArray(t.Data?.hits),s=Array.isArray(t.Data?.[0]?.Variants),i=[...this.infiniteList];if(this.extendData){let a=i.at(-1),o=t.Data.find(r=>r.ID===a?.ID);if(s&&a)if(o){let r=t.Data.filter(u=>u.ID!==a?.ID);a.Variants=a.Variants.concat(o.Variants||[]),i=i.concat(r)}else i=i.concat(t.Data);else i=i.concat(e?t.Data.hits:t.Data);this.postExtendData(t),this.extendData=!1}else i=e?t.Data.hits:t.Data,this.assignAggregate(t);this.infiniteList=i,this.originalData=[...i];let n=e?t.Data.hits.length:t.Data.length;this.nextPageDisabled=n<this.pageData.Filter.RowCount,this.menuData.H=this.data.PageTitle||this.menuData.H,this.afterPostInit(t),this.cdr?.markForCheck?.()}afterPostInit(t){}preSearchFromPageOne(){this.goToLast=!1}postExtendData(t){}assignAggregate(t){}};export{p as a};
1
+ import{a as g}from"./chunk-OWGJVIYJ.js";import{Ca as l,Lc as h,e as c}from"./chunk-JYZTRN6N.js";var p=class extends g{constructor(t,e,s,i,n,a,o,r){super(t,e,s,i,n,a,o);this.httpService=e;this.toastrService=n;this.route=a;this.cdr=r;r&&h(()=>{this.infiniteListSignal(),this.cdr.markForCheck()})}toastrCount=0;nextPageDisabled=!1;extendData=!1;goToLast=!1;listTotal=0;_infiniteList$=new c([]);infiniteListSignal=l([]);get infiniteList(){return this._infiniteList$.value}set infiniteList(t){this._infiniteList$.next(t),this.infiniteListSignal.set(t)}originalData=[];StoreRowsCountAPIResult(t,e=!1){this.httpService.post("/api/"+t,this.pageData.Filter).subscribe(s=>{this.listTotal=s.Count,this.pageData.HideStoreApiCount=!0,e&&(this.pageData.Filter.RowCount=this.listTotal,this.goToLast=!0,this.pageData.Filter.PageNumber=1,this.getListData()),this.cdr&&this.cdr.markForCheck()})}NextPage(t){this.pageData.Filter.PageNumber=this.pageData.Filter.PageNumber||1,this.pageData.Filter.PageNumber+=1,this.extendData=t,this.getListData()}postInit(t){t?.Data?.length>0&&(this.toastrCount=0),t?.Data?.length===0&&this.toastrCount===0&&(this.toastrService?.info("No more data to load","Info"),this.toastrCount=1);let e=Array.isArray(t.Data?.hits),s=Array.isArray(t.Data?.[0]?.Variants),i=[...this.infiniteList];if(this.extendData){let a=i.at(-1),o=t.Data.find(r=>r.ID===a?.ID);if(s&&a)if(o){let r=t.Data.filter(u=>u.ID!==a?.ID);a.Variants=a.Variants.concat(o.Variants||[]),i=i.concat(r)}else i=i.concat(t.Data);else i=i.concat(e?t.Data.hits:t.Data);this.postExtendData(t),this.extendData=!1}else i=e?t.Data.hits:t.Data,this.assignAggregate(t);this.infiniteList=i,this.originalData=[...i];let n=e?t.Data.hits.length:t.Data.length;this.nextPageDisabled=n<this.pageData.Filter.RowCount,this.menuData.H=this.data.PageTitle||this.menuData.H,this.afterPostInit(t),this.cdr?.markForCheck?.()}afterPostInit(t){}preSearchFromPageOne(){this.goToLast=!1}postExtendData(t){}assignAggregate(t){}};export{p as a};
@@ -1,4 +1,4 @@
1
- import{a as Ye}from"./chunk-IPKXGQTW.js";import{a as Ct,b as vn}from"./chunk-FNH6K4S4.js";import{a as Ne}from"./chunk-66MCBKC7.js";import{a as gn}from"./chunk-UFBRV4CF.js";import{a as _n}from"./chunk-W4W2KCYV.js";import{a as bn}from"./chunk-MZIYTJ6Z.js";import{a as dn}from"./chunk-3PC6CTVP.js";import{a as ee,b as te}from"./chunk-HD2QU6GJ.js";import{c as fn}from"./chunk-CA6YBQT3.js";import{a as X}from"./chunk-3GPGJFQV.js";import"./chunk-BYXBJQAS.js";import{a as pn}from"./chunk-QEOGHVXA.js";import{b as Xt,c as en,d as tn,e as nn}from"./chunk-AUBQH6JY.js";import{e as sn,f as un}from"./chunk-4KMRZ2TB.js";import{a as cn}from"./chunk-IDQUQBKL.js";import{a as vt,b as mn}from"./chunk-TGEQUV6Z.js";import"./chunk-OBXCVFDY.js";import{b as an}from"./chunk-WCCWWFYE.js";import"./chunk-CS6HBROS.js";import"./chunk-JUS6LLVX.js";import{C as Ke}from"./chunk-BA3BDB5Y.js";import{b as Z,c as J}from"./chunk-C4WJKF7R.js";import{G as Qe,N as fe,O as rn,o as ln}from"./chunk-T25N3EEG.js";import{g as on}from"./chunk-A45GTZVV.js";import"./chunk-NWSIPELM.js";import{b as Zt,c as Ve,d as Fe,k as H,l as de}from"./chunk-L76WVZW6.js";import{a as we}from"./chunk-2FWFPV5I.js";import{G as bt,J as Re,X as gt,j as ft,m as Kt,oa as Jt,pa as _t,w as Yt,x as Wt,xa as ke,y as Oe}from"./chunk-O5SLP4JK.js";import{F as Qt}from"./chunk-RNLSEEMX.js";import"./chunk-MYKOQWDM.js";import"./chunk-ECEHKAWW.js";import{a as Ae,d as O}from"./chunk-USJ6ILEE.js";import"./chunk-YYGLCUQ6.js";import{$d as j,Ab as ue,Bb as pe,Bc as h,Ca as ge,Cb as s,Cc as T,Db as i,Dc as G,Eb as a,Ed as qt,Fb as u,Hc as P,Ia as Q,Ja as Dt,Kc as B,Lb as D,Lc as qe,Mb as q,Nb as Vt,Ob as N,Pc as _,Qb as m,Rb as Ee,Rc as Ht,Sa as Mt,Sb as Pe,Tb as je,Tc as ze,Ub as De,Vb as oe,Wb as ae,Wd as zt,Xa as l,Xb as Ft,Xc as ve,Y as It,Ya as Ue,Yc as Ut,Yd as Gt,Zb as Nt,Zd as U,_b as I,aa as mt,ac as Bt,be as $t,cc as z,cd as Y,db as re,dc as p,ec as x,ee as $e,fa as Et,fc as k,gc as At,hb as C,ib as wt,ic as Ot,jc as Rt,jd as A,ka as Be,kc as Lt,kd as jt,la as xe,lb as se,ma as Pt,mb as Se,md as me,na as Te,nb as v,od as W,pa as g,rd as y,sc as ce,sd as Ge,t as ct,ta as V,tb as _e,tc as E,ua as F,uc as M,va as dt,vb as d,vc as K,wc as Me,xb as f,yb as Ie,zb as kt}from"./chunk-JYZTRN6N.js";import"./chunk-WFMAM73Y.js";import{a as xt,b as Tt,k as St}from"./chunk-SNAKHGZS.js";var Cn=`
1
+ import{a as Ye}from"./chunk-IPKXGQTW.js";import{a as Ct,b as vn}from"./chunk-FNH6K4S4.js";import{a as Ne}from"./chunk-66MCBKC7.js";import{a as gn}from"./chunk-UFBRV4CF.js";import{a as _n}from"./chunk-W4W2KCYV.js";import{a as bn}from"./chunk-R36QPCUA.js";import{a as dn}from"./chunk-3PC6CTVP.js";import{a as ee,b as te}from"./chunk-HD2QU6GJ.js";import{c as fn}from"./chunk-CA6YBQT3.js";import{a as X}from"./chunk-3GPGJFQV.js";import"./chunk-BYXBJQAS.js";import{a as pn}from"./chunk-QEOGHVXA.js";import{b as Xt,c as en,d as tn,e as nn}from"./chunk-AUBQH6JY.js";import{e as sn,f as un}from"./chunk-356KM5DR.js";import{a as cn}from"./chunk-IDQUQBKL.js";import{a as vt,b as mn}from"./chunk-TGEQUV6Z.js";import"./chunk-IVJVUXLS.js";import{b as an}from"./chunk-UQ5F3YKZ.js";import"./chunk-CS6HBROS.js";import"./chunk-JUS6LLVX.js";import{C as Ke}from"./chunk-BA3BDB5Y.js";import{b as Z,c as J}from"./chunk-C4WJKF7R.js";import{G as Qe,N as fe,O as rn,o as ln}from"./chunk-T25N3EEG.js";import{g as on}from"./chunk-A45GTZVV.js";import"./chunk-NWSIPELM.js";import{b as Zt,c as Ve,d as Fe,k as H,l as de}from"./chunk-L76WVZW6.js";import{a as we}from"./chunk-2FWFPV5I.js";import{G as bt,J as Re,X as gt,j as ft,m as Kt,oa as Jt,pa as _t,w as Yt,x as Wt,xa as ke,y as Oe}from"./chunk-O5SLP4JK.js";import{F as Qt}from"./chunk-RNLSEEMX.js";import"./chunk-U5LNORQV.js";import"./chunk-FO5ZTXDH.js";import{a as Ae,d as O}from"./chunk-USJ6ILEE.js";import"./chunk-BJF3WGIP.js";import{$d as j,Ab as ue,Bb as pe,Bc as h,Ca as ge,Cb as s,Cc as T,Db as i,Dc as G,Eb as a,Ed as qt,Fb as u,Hc as P,Ia as Q,Ja as Dt,Kc as B,Lb as D,Lc as qe,Mb as q,Nb as Vt,Ob as N,Pc as _,Qb as m,Rb as Ee,Rc as Ht,Sa as Mt,Sb as Pe,Tb as je,Tc as ze,Ub as De,Vb as oe,Wb as ae,Wd as zt,Xa as l,Xb as Ft,Xc as ve,Y as It,Ya as Ue,Yc as Ut,Yd as Gt,Zb as Nt,Zd as U,_b as I,aa as mt,ac as Bt,be as $t,cc as z,cd as Y,db as re,dc as p,ec as x,ee as $e,fa as Et,fc as k,gc as At,hb as C,ib as wt,ic as Ot,jc as Rt,jd as A,ka as Be,kc as Lt,kd as jt,la as xe,lb as se,ma as Pt,mb as Se,md as me,na as Te,nb as v,od as W,pa as g,rd as y,sc as ce,sd as Ge,t as ct,ta as V,tb as _e,tc as E,ua as F,uc as M,va as dt,vb as d,vc as K,wc as Me,xb as f,yb as Ie,zb as kt}from"./chunk-JYZTRN6N.js";import"./chunk-WFMAM73Y.js";import{a as xt,b as Tt,k as St}from"./chunk-SNAKHGZS.js";var Cn=`
2
2
  .p-tabs {
3
3
  display: flex;
4
4
  flex-direction: column;
@@ -1 +1 @@
1
- import{c as J}from"./chunk-QHNGMJWX.js";import{a as G}from"./chunk-YFRQWQ66.js";import"./chunk-5S5ZFAPJ.js";import"./chunk-QFON23YX.js";import"./chunk-FIUZN6JU.js";import{e as q,f as z}from"./chunk-4KMRZ2TB.js";import"./chunk-3L267ZNV.js";import"./chunk-JEL3OND6.js";import"./chunk-M43HNBJQ.js";import"./chunk-X57HWGVJ.js";import"./chunk-5SFUSWFY.js";import"./chunk-534MIVWD.js";import"./chunk-TGEQUV6Z.js";import"./chunk-OBXCVFDY.js";import{b as A}from"./chunk-WCCWWFYE.js";import"./chunk-CS6HBROS.js";import"./chunk-JUS6LLVX.js";import"./chunk-BA3BDB5Y.js";import{b as j,c as k}from"./chunk-C4WJKF7R.js";import"./chunk-T25N3EEG.js";import"./chunk-RLQLFW36.js";import"./chunk-EQLHPWVB.js";import"./chunk-A45GTZVV.js";import"./chunk-NWSIPELM.js";import"./chunk-6SGN7MNX.js";import"./chunk-L76WVZW6.js";import"./chunk-2FWFPV5I.js";import"./chunk-O5SLP4JK.js";import{F as W,h as B,o as H}from"./chunk-RNLSEEMX.js";import"./chunk-MYKOQWDM.js";import"./chunk-ECEHKAWW.js";import"./chunk-USJ6ILEE.js";import"./chunk-YYGLCUQ6.js";import{Ab as M,Bb as w,Bc as C,Cb as d,Cc as F,Db as i,Dc as T,Eb as n,Hc as E,Mb as v,Ob as N,Qb as S,Xa as l,be as V,db as c,dc as o,ec as u,ee as R,hb as D,ic as _,jc as b,kc as h,lb as y,md as P,nb as I,od as L,rd as O,ta as p,ua as s,yb as x}from"./chunk-JYZTRN6N.js";import"./chunk-WFMAM73Y.js";import"./chunk-SNAKHGZS.js";function U(r,g){if(r&1){let e=v();i(0,"div")(1,"div",9)(2,"h6"),o(3,"Outlet"),n(),i(4,"outlet-selector",10),h("ngModelChange",function(t){p(e);let m=S();return b(m.pageData.Filter.ListIDs,t)||(m.pageData.Filter.ListIDs=t),s(t)}),n()()()}if(r&2){let e=S();l(4),d("accessType",2),_("ngModel",e.pageData.Filter.ListIDs),d("multiple",!0)}}function X(r,g){if(r&1&&(i(0,"tr")(1,"td"),o(2),n(),i(3,"td"),o(4),C(5,"number"),n(),i(6,"td"),o(7),C(8,"date"),n()()),r&2){let e=g.$implicit;l(2),u(e==null?null:e.EntityName),l(2),u(F(5,3,e==null?null:e.Number)),l(3),u(T(8,5,e==null?null:e.Modified,"dd MMM yyyy HH:mm"))}}var K=class r extends G{constructor(e,a,t){super(e,a,"Setup/Data/TransactionInvoiceNumber",null,t);this.httpService=a}preGetList(){let e=this.pageData.Filter?.ListIDs?this.pageData.Filter?.ListIDs:[];this.pageData.Filter={ListIDs:e}}static \u0275fac=function(a){return new(a||r)(c(A),c(R),c(V))};static \u0275cmp=D({type:r,selectors:[["app-invoice-numbering"]],features:[y],decls:19,vars:4,consts:[["pageFilterTemplate",""],[3,"onSubmit","filterChange","pageData","isFilterOnDropdown","hideSearchBox","filter"],[1,"container-fluid","mt-5"],[1,"table-responsive"],["id","tableGrid",1,"table"],[1,"thead-light","sticky-top-thead"],[1,"header"],["matTooltip","Next invoice number index to be generated",2,"width","200px"],[2,"width","200px"],[1,"dialog-filter"],["placeholder","Choose Outlet",3,"ngModelChange","accessType","ngModel","multiple"]],template:function(a,t){if(a&1){let m=v();i(0,"mainpanel-cmp",1),N("onSubmit",function(){return p(m),s(t.searchFromPageOne())}),h("filterChange",function(f){return p(m),b(t.pageData.Filter,f)||(t.pageData.Filter=f),s(f)}),i(1,"filters"),I(2,U,5,3,"ng-template",null,0,E),n(),i(4,"content")(5,"div",2)(6,"div",3)(7,"table",4)(8,"thead",5)(9,"tr",6)(10,"th"),o(11,"Outlet"),n(),i(12,"th",7),o(13," Next Number "),n(),i(14,"th",8),o(15,"Modified"),n()()(),i(16,"tbody"),M(17,X,9,8,"tr",null,x),n()()()()()()}a&2&&(d("pageData",t.menuData)("isFilterOnDropdown",!1)("hideSearchBox",!0),_("filter",t.pageData.Filter),l(17),w(t.data==null?null:t.data.Data))},dependencies:[O,z,q,J,W,B,H,k,j,L,P],encapsulation:2})};export{K as InvoiceNumberingComponent};
1
+ import{c as J}from"./chunk-MFLQHYOR.js";import{a as G}from"./chunk-OWGJVIYJ.js";import"./chunk-DV63TLIP.js";import"./chunk-QFON23YX.js";import"./chunk-FIUZN6JU.js";import{e as q,f as z}from"./chunk-356KM5DR.js";import"./chunk-P7BRWWWC.js";import"./chunk-JEL3OND6.js";import"./chunk-M43HNBJQ.js";import"./chunk-X57HWGVJ.js";import"./chunk-5SFUSWFY.js";import"./chunk-534MIVWD.js";import"./chunk-TGEQUV6Z.js";import"./chunk-IVJVUXLS.js";import{b as A}from"./chunk-UQ5F3YKZ.js";import"./chunk-CS6HBROS.js";import"./chunk-JUS6LLVX.js";import"./chunk-BA3BDB5Y.js";import{b as j,c as k}from"./chunk-C4WJKF7R.js";import"./chunk-T25N3EEG.js";import"./chunk-RLQLFW36.js";import"./chunk-EQLHPWVB.js";import"./chunk-A45GTZVV.js";import"./chunk-NWSIPELM.js";import"./chunk-6SGN7MNX.js";import"./chunk-L76WVZW6.js";import"./chunk-2FWFPV5I.js";import"./chunk-O5SLP4JK.js";import{F as W,h as B,o as H}from"./chunk-RNLSEEMX.js";import"./chunk-U5LNORQV.js";import"./chunk-FO5ZTXDH.js";import"./chunk-USJ6ILEE.js";import"./chunk-BJF3WGIP.js";import{Ab as M,Bb as w,Bc as C,Cb as d,Cc as F,Db as i,Dc as T,Eb as n,Hc as E,Mb as v,Ob as N,Qb as S,Xa as l,be as V,db as c,dc as o,ec as u,ee as R,hb as D,ic as _,jc as b,kc as h,lb as y,md as P,nb as I,od as L,rd as O,ta as p,ua as s,yb as x}from"./chunk-JYZTRN6N.js";import"./chunk-WFMAM73Y.js";import"./chunk-SNAKHGZS.js";function U(r,g){if(r&1){let e=v();i(0,"div")(1,"div",9)(2,"h6"),o(3,"Outlet"),n(),i(4,"outlet-selector",10),h("ngModelChange",function(t){p(e);let m=S();return b(m.pageData.Filter.ListIDs,t)||(m.pageData.Filter.ListIDs=t),s(t)}),n()()()}if(r&2){let e=S();l(4),d("accessType",2),_("ngModel",e.pageData.Filter.ListIDs),d("multiple",!0)}}function X(r,g){if(r&1&&(i(0,"tr")(1,"td"),o(2),n(),i(3,"td"),o(4),C(5,"number"),n(),i(6,"td"),o(7),C(8,"date"),n()()),r&2){let e=g.$implicit;l(2),u(e==null?null:e.EntityName),l(2),u(F(5,3,e==null?null:e.Number)),l(3),u(T(8,5,e==null?null:e.Modified,"dd MMM yyyy HH:mm"))}}var K=class r extends G{constructor(e,a,t){super(e,a,"Setup/Data/TransactionInvoiceNumber",null,t);this.httpService=a}preGetList(){let e=this.pageData.Filter?.ListIDs?this.pageData.Filter?.ListIDs:[];this.pageData.Filter={ListIDs:e}}static \u0275fac=function(a){return new(a||r)(c(A),c(R),c(V))};static \u0275cmp=D({type:r,selectors:[["app-invoice-numbering"]],features:[y],decls:19,vars:4,consts:[["pageFilterTemplate",""],[3,"onSubmit","filterChange","pageData","isFilterOnDropdown","hideSearchBox","filter"],[1,"container-fluid","mt-5"],[1,"table-responsive"],["id","tableGrid",1,"table"],[1,"thead-light","sticky-top-thead"],[1,"header"],["matTooltip","Next invoice number index to be generated",2,"width","200px"],[2,"width","200px"],[1,"dialog-filter"],["placeholder","Choose Outlet",3,"ngModelChange","accessType","ngModel","multiple"]],template:function(a,t){if(a&1){let m=v();i(0,"mainpanel-cmp",1),N("onSubmit",function(){return p(m),s(t.searchFromPageOne())}),h("filterChange",function(f){return p(m),b(t.pageData.Filter,f)||(t.pageData.Filter=f),s(f)}),i(1,"filters"),I(2,U,5,3,"ng-template",null,0,E),n(),i(4,"content")(5,"div",2)(6,"div",3)(7,"table",4)(8,"thead",5)(9,"tr",6)(10,"th"),o(11,"Outlet"),n(),i(12,"th",7),o(13," Next Number "),n(),i(14,"th",8),o(15,"Modified"),n()()(),i(16,"tbody"),M(17,X,9,8,"tr",null,x),n()()()()()()}a&2&&(d("pageData",t.menuData)("isFilterOnDropdown",!1)("hideSearchBox",!0),_("filter",t.pageData.Filter),l(17),w(t.data==null?null:t.data.Data))},dependencies:[O,z,q,J,W,B,H,k,j,L,P],encapsulation:2})};export{K as InvoiceNumberingComponent};
@@ -1,4 +1,4 @@
1
- import{a as et}from"./chunk-XACC6EMJ.js";import{a as it,b as ye}from"./chunk-Q2A4MYK3.js";import{b as nt,c as ve}from"./chunk-3L267ZNV.js";import{a as tt}from"./chunk-TGEQUV6Z.js";import{d as be}from"./chunk-CS6HBROS.js";import{b as Ue,c as Ye,d as Ie,e as Je,k as fe,l as ge}from"./chunk-L76WVZW6.js";import{$ as xe,C as Ze,D as pe,G as qe,K as Ge,M as He,S as _e,V as b,_ as he,fa as Qe,g as de,la as je,m as ze,oa as We,pa as z,r as Re,w as $,x as N,xa as Xe}from"./chunk-O5SLP4JK.js";import{$d as ue,Ca as S,Cb as a,Db as x,Eb as I,Fb as f,Hc as se,Ia as Ee,Id as me,Ja as Pe,Jb as V,Jd as le,Kb as B,Kc as Oe,Lc as Ae,Ld as K,Mb as F,Ob as L,Od as D,Pc as Ke,Qa as Y,Qb as r,Sa as Se,Tb as G,Ub as H,Vb as C,Wb as T,Xa as m,Xc as w,Ya as g,Yc as E,Zd as Ne,_b as Q,bc as U,cb as ke,cc as l,db as k,dc as ne,ed as De,fc as ie,fd as re,hb as J,ib as Ve,id as ae,jd as $e,ka as we,la as Me,lb as ee,ma as Le,na as W,nb as _,pa as P,rd as ce,sb as te,sc as oe,sd as A,ta as d,tb as h,tc as O,ua as p,uc as Be,va as X,vc as Fe}from"./chunk-JYZTRN6N.js";import{a as Z,b as q}from"./chunk-SNAKHGZS.js";var ot=`
1
+ import{a as et}from"./chunk-XACC6EMJ.js";import{a as it,b as ye}from"./chunk-Q2A4MYK3.js";import{b as nt,c as ve}from"./chunk-P7BRWWWC.js";import{a as tt}from"./chunk-TGEQUV6Z.js";import{d as be}from"./chunk-CS6HBROS.js";import{b as Ue,c as Ye,d as Ie,e as Je,k as fe,l as ge}from"./chunk-L76WVZW6.js";import{$ as xe,C as Ze,D as pe,G as qe,K as Ge,M as He,S as _e,V as b,_ as he,fa as Qe,g as de,la as je,m as ze,oa as We,pa as z,r as Re,w as $,x as N,xa as Xe}from"./chunk-O5SLP4JK.js";import{$d as ue,Ca as S,Cb as a,Db as x,Eb as I,Fb as f,Hc as se,Ia as Ee,Id as me,Ja as Pe,Jb as V,Jd as le,Kb as B,Kc as Oe,Lc as Ae,Ld as K,Mb as F,Ob as L,Od as D,Pc as Ke,Qa as Y,Qb as r,Sa as Se,Tb as G,Ub as H,Vb as C,Wb as T,Xa as m,Xc as w,Ya as g,Yc as E,Zd as Ne,_b as Q,bc as U,cb as ke,cc as l,db as k,dc as ne,ed as De,fc as ie,fd as re,hb as J,ib as Ve,id as ae,jd as $e,ka as we,la as Me,lb as ee,ma as Le,na as W,nb as _,pa as P,rd as ce,sb as te,sc as oe,sd as A,ta as d,tb as h,tc as O,ua as p,uc as Be,va as X,vc as Fe}from"./chunk-JYZTRN6N.js";import{a as Z,b as q}from"./chunk-SNAKHGZS.js";var ot=`
2
2
  .p-contextmenu {
3
3
  background: dt('contextmenu.background');
4
4
  color: dt('contextmenu.color');
@@ -1,4 +1,4 @@
1
- import{a as L}from"./chunk-CS6HBROS.js";import{c as ve,j as Se,k as C,l as _e}from"./chunk-L76WVZW6.js";import{X as xe,Y as ge,oa as Ce,pa as F,xa as ye}from"./chunk-O5SLP4JK.js";import{a as me,g as ke}from"./chunk-RNLSEEMX.js";import{a as be,c as fe}from"./chunk-MYKOQWDM.js";import{a as H}from"./chunk-USJ6ILEE.js";import{$d as he,Ca as Y,Cb as c,Db as m,Eb as k,Fb as M,Ia as h,Ib as E,Jb as A,Kb as O,Kc as ae,Mb as W,Ob as ee,Pc as j,Qb as u,Tb as R,Ub as te,Vb as B,Wb as w,Xa as a,Xc as g,Ya as _,Yc as se,Yd as ue,Zd as pe,bc as ne,cc as l,cd as D,db as I,dc as T,fc as ie,fd as le,hb as d,ib as K,jd as de,ka as P,la as $,lb as b,ma as q,mb as X,na as G,nb as x,pa as y,rd as N,sc as oe,ta as v,tb as z,tc as ce,ua as S,uc as V,va as p,vb as Z,vc as re,xb as J,ya as U}from"./chunk-JYZTRN6N.js";var Ne=e=>({"pe-none":e}),Fe=()=>["/menu/Profile/Main/My_Subscription"],Le=e=>({"text-decoration-none":e}),ze=e=>({"text-capitalize":e});function Ae(e,o){if(e&1&&(m(0,"div",1)(1,"h5",2),T(2),m(3,"a",3)(4,"u",4)(5,"span",4),T(6,"please"),k(),T(7," process your payment! "),k()()()()),e&2){let t=u();l("alert rounded-0 mb-0 text-center border-bottom "+(t.subscriptionState==null?null:t.subscriptionState.class)),a(2),ie(" ",t.subscriptionState==null?null:t.subscriptionState.message," "),a(),c("ngClass",V(7,Ne,t.isMySubscriptionMenu))("routerLink",ce(9,Fe)),a(),c("ngClass",V(10,Le,t.isMySubscriptionMenu)),a(),c("ngClass",V(12,ze,t.isNotEmpty(t.currentSubStatus)&&t.currentSubStatus!=t.subsStatusEnum.OVERDUE))}}var Ie=class e{constructor(o,t,i){this.document=o;this.router=t;this.authService=i}subscriptionStatus;subscriptionState;currentSubStatus;subsStatusEnum=be;isMySubscriptionMenu;htmlStyleElement;htmlBodyElement;ngOnInit(){this.checkMySubscriptionMenu(),this.initSubscriptionStatus(),this.getCurrentSubscriptionStatus()}getCurrentSubscriptionStatus(){this.overrideCssStickyHeader()}checkMySubscriptionMenu(){this.isMySubscriptionMenu=!1,this.router.url.includes("/Profile/Main/My_Subscription")&&(this.isMySubscriptionMenu=!0)}isNotEmpty(o){return H.IsNotEmpty(o)}overrideCssStickyHeader(){if(H.IsNotEmpty(this.currentSubStatus)&&this.currentSubStatus!==0){let o=`.sticky-top-thead th {
1
+ import{a as L}from"./chunk-CS6HBROS.js";import{c as ve,j as Se,k as C,l as _e}from"./chunk-L76WVZW6.js";import{X as xe,Y as ge,oa as Ce,pa as F,xa as ye}from"./chunk-O5SLP4JK.js";import{a as me,g as ke}from"./chunk-RNLSEEMX.js";import{a as be,c as fe}from"./chunk-U5LNORQV.js";import{a as H}from"./chunk-USJ6ILEE.js";import{$d as he,Ca as Y,Cb as c,Db as m,Eb as k,Fb as M,Ia as h,Ib as E,Jb as A,Kb as O,Kc as ae,Mb as W,Ob as ee,Pc as j,Qb as u,Tb as R,Ub as te,Vb as B,Wb as w,Xa as a,Xc as g,Ya as _,Yc as se,Yd as ue,Zd as pe,bc as ne,cc as l,cd as D,db as I,dc as T,fc as ie,fd as le,hb as d,ib as K,jd as de,ka as P,la as $,lb as b,ma as q,mb as X,na as G,nb as x,pa as y,rd as N,sc as oe,ta as v,tb as z,tc as ce,ua as S,uc as V,va as p,vb as Z,vc as re,xb as J,ya as U}from"./chunk-JYZTRN6N.js";var Ne=e=>({"pe-none":e}),Fe=()=>["/menu/Profile/Main/My_Subscription"],Le=e=>({"text-decoration-none":e}),ze=e=>({"text-capitalize":e});function Ae(e,o){if(e&1&&(m(0,"div",1)(1,"h5",2),T(2),m(3,"a",3)(4,"u",4)(5,"span",4),T(6,"please"),k(),T(7," process your payment! "),k()()()()),e&2){let t=u();l("alert rounded-0 mb-0 text-center border-bottom "+(t.subscriptionState==null?null:t.subscriptionState.class)),a(2),ie(" ",t.subscriptionState==null?null:t.subscriptionState.message," "),a(),c("ngClass",V(7,Ne,t.isMySubscriptionMenu))("routerLink",ce(9,Fe)),a(),c("ngClass",V(10,Le,t.isMySubscriptionMenu)),a(),c("ngClass",V(12,ze,t.isNotEmpty(t.currentSubStatus)&&t.currentSubStatus!=t.subsStatusEnum.OVERDUE))}}var Ie=class e{constructor(o,t,i){this.document=o;this.router=t;this.authService=i}subscriptionStatus;subscriptionState;currentSubStatus;subsStatusEnum=be;isMySubscriptionMenu;htmlStyleElement;htmlBodyElement;ngOnInit(){this.checkMySubscriptionMenu(),this.initSubscriptionStatus(),this.getCurrentSubscriptionStatus()}getCurrentSubscriptionStatus(){this.overrideCssStickyHeader()}checkMySubscriptionMenu(){this.isMySubscriptionMenu=!1,this.router.url.includes("/Profile/Main/My_Subscription")&&(this.isMySubscriptionMenu=!0)}isNotEmpty(o){return H.IsNotEmpty(o)}overrideCssStickyHeader(){if(H.IsNotEmpty(this.currentSubStatus)&&this.currentSubStatus!==0){let o=`.sticky-top-thead th {
2
2
  top: 100px !important;
3
3
  z-index: 1020;
4
4
  }`;this.htmlBodyElement=this.document.getElementsByTagName("body")[0],this.htmlStyleElement=this.document.createElement("style"),this.htmlStyleElement.appendChild(this.document.createTextNode(o)),this.htmlBodyElement.appendChild(this.htmlStyleElement)}}initSubscriptionStatus(){this.currentSubStatus=this.authService.getSubscriptionStatus(),this.subscriptionStatus=[{status:1,class:"alert-warning",message:"Your subscription is overdue. To avoid suspension, "},{status:2,class:"alert-danger",message:"Your subscription is partially suspended."},{status:3,class:"alert-danger",message:"Your subscription is suspended."}],this.subscriptionState=this.subscriptionStatus.filter(o=>o.status==this.currentSubStatus)[0]}ngOnDestroy(){this.htmlBodyElement&&this.htmlBodyElement.removeChild(this.htmlStyleElement)}static \u0275fac=function(t){return new(t||e)(I(U),I(ue),I(fe))};static \u0275cmp=d({type:e,selectors:[["subscription-alert"]],decls:1,vars:1,consts:[["role","alert",3,"class"],["role","alert"],[1,"fw-normal"],[1,"alert-link",3,"ngClass","routerLink"],[3,"ngClass"]],template:function(t,i){t&1&&Z(0,Ae,8,14,"div",0),t&2&&J((i.subscriptionState==null?null:i.subscriptionState.status)==i.currentSubStatus&&i.isNotEmpty(i.currentSubStatus)?0:-1)},dependencies:[N,D,he,pe],encapsulation:2})};var Oe=["data-p-icon","check"],Me=(()=>{class e extends L{static \u0275fac=(()=>{let t;return function(n){return(t||(t=h(e)))(n||e)}})();static \u0275cmp=d({type:e,selectors:[["","data-p-icon","check"]],features:[b],attrs:Oe,decls:1,vars:0,consts:[["d","M4.86199 11.5948C4.78717 11.5923 4.71366 11.5745 4.64596 11.5426C4.57826 11.5107 4.51779 11.4652 4.46827 11.4091L0.753985 7.69483C0.683167 7.64891 0.623706 7.58751 0.580092 7.51525C0.536478 7.44299 0.509851 7.36177 0.502221 7.27771C0.49459 7.19366 0.506156 7.10897 0.536046 7.03004C0.565935 6.95111 0.613367 6.88 0.674759 6.82208C0.736151 6.76416 0.8099 6.72095 0.890436 6.69571C0.970973 6.67046 1.05619 6.66385 1.13966 6.67635C1.22313 6.68886 1.30266 6.72017 1.37226 6.76792C1.44186 6.81567 1.4997 6.8786 1.54141 6.95197L4.86199 10.2503L12.6397 2.49483C12.7444 2.42694 12.8689 2.39617 12.9932 2.40745C13.1174 2.41873 13.2343 2.47141 13.3251 2.55705C13.4159 2.64268 13.4753 2.75632 13.4938 2.87973C13.5123 3.00315 13.4888 3.1292 13.4271 3.23768L5.2557 11.4091C5.20618 11.4652 5.14571 11.5107 5.07801 11.5426C5.01031 11.5745 4.9368 11.5923 4.86199 11.5948Z","fill","currentColor"]],template:function(i,n){i&1&&(p(),E(0,"path",0))},encapsulation:2})}return e})();var Re=["data-p-icon","minus"],Ee=(()=>{class e extends L{static \u0275fac=(()=>{let t;return function(n){return(t||(t=h(e)))(n||e)}})();static \u0275cmp=d({type:e,selectors:[["","data-p-icon","minus"]],features:[b],attrs:Re,decls:1,vars:0,consts:[["d","M13.2222 7.77778H0.777778C0.571498 7.77778 0.373667 7.69584 0.227806 7.54998C0.0819442 7.40412 0 7.20629 0 7.00001C0 6.79373 0.0819442 6.5959 0.227806 6.45003C0.373667 6.30417 0.571498 6.22223 0.777778 6.22223H13.2222C13.4285 6.22223 13.6263 6.30417 13.7722 6.45003C13.9181 6.5959 14 6.79373 14 7.00001C14 7.20629 13.9181 7.40412 13.7722 7.54998C13.6263 7.69584 13.4285 7.77778 13.2222 7.77778Z","fill","currentColor"]],template:function(i,n){i&1&&(p(),E(0,"path",0))},encapsulation:2})}return e})();var Be=`
@@ -1 +1 @@
1
- import{a as re,b as ae}from"./chunk-HVJHE6PQ.js";import"./chunk-RJJYGGF6.js";import"./chunk-VP2ZEIJA.js";import{a as ne}from"./chunk-R4OHTTCT.js";import"./chunk-QIJEAKQK.js";import"./chunk-QEOGHVXA.js";import"./chunk-4HCSE44G.js";import"./chunk-Q2A4MYK3.js";import{d as te,e as ie}from"./chunk-QPOOLLKY.js";import"./chunk-CSFFF2YO.js";import"./chunk-3RK6DDJD.js";import"./chunk-WNZKCNMC.js";import"./chunk-LOD3JYZW.js";import"./chunk-3KSZCJ6T.js";import"./chunk-6GLKD66N.js";import"./chunk-CBSYYTXQ.js";import{e as $}from"./chunk-GN3HVOCN.js";import"./chunk-G4IW5GPY.js";import{c as ee}from"./chunk-QHNGMJWX.js";import{a as K}from"./chunk-YFRQWQ66.js";import"./chunk-5S5ZFAPJ.js";import"./chunk-QFON23YX.js";import"./chunk-FIUZN6JU.js";import{a as J,e as Y,f as Z}from"./chunk-4KMRZ2TB.js";import"./chunk-3L267ZNV.js";import"./chunk-JEL3OND6.js";import"./chunk-IDQUQBKL.js";import"./chunk-VYQEM4T2.js";import"./chunk-UTAQ3FRE.js";import"./chunk-M43HNBJQ.js";import"./chunk-X57HWGVJ.js";import"./chunk-5SFUSWFY.js";import"./chunk-534MIVWD.js";import"./chunk-TGEQUV6Z.js";import"./chunk-OBXCVFDY.js";import{b as X}from"./chunk-WCCWWFYE.js";import"./chunk-CS6HBROS.js";import"./chunk-JUS6LLVX.js";import"./chunk-BA3BDB5Y.js";import"./chunk-C4WJKF7R.js";import{O as F}from"./chunk-T25N3EEG.js";import{d as Q}from"./chunk-7TBS7SPQ.js";import"./chunk-RLQLFW36.js";import"./chunk-EQLHPWVB.js";import"./chunk-A45GTZVV.js";import"./chunk-NWSIPELM.js";import"./chunk-6SGN7MNX.js";import"./chunk-L76WVZW6.js";import{a as z}from"./chunk-2FWFPV5I.js";import"./chunk-O5SLP4JK.js";import{F as U,h as j,o as G}from"./chunk-RNLSEEMX.js";import"./chunk-MYKOQWDM.js";import"./chunk-ECEHKAWW.js";import"./chunk-USJ6ILEE.js";import"./chunk-YYGLCUQ6.js";import{Ab as V,Bb as W,Bc as b,Ca as B,Cb as m,Cc as x,Db as r,Eb as a,Fb as S,Hc as O,Mb as y,Ob as w,Qb as s,Xa as c,Y as k,be as H,db as h,dc as u,ee as q,fa as I,hb as A,ic as g,jc as _,kc as f,kd as N,lb as M,nb as E,pa as P,rd as R,ta as l,ua as p,vb as v,xb as D,yb as L}from"./chunk-JYZTRN6N.js";import"./chunk-WFMAM73Y.js";import"./chunk-SNAKHGZS.js";function le(o,d){if(o&1){let t=y();r(0,"button",6),w("click",function(){l(t);let e=s();return p(e.onPrint())}),S(1,"i",7),r(2,"span"),u(3,"Print"),a()()}}function pe(o,d){if(o&1){let t=y();r(0,"div",8)(1,"h6"),u(2,"Outlet"),a(),r(3,"outlet-selector",9),f("ngModelChange",function(e){l(t);let i=s();return _(i.pageData.Filter.EntityID,e)||(i.pageData.Filter.EntityID=e),p(e)}),a(),r(4,"h6"),u(5,"Sales Order Tag"),a(),r(6,"ng-select",10),f("ngModelChange",function(e){l(t);let i=s();return _(i.pageData.Filter.SalesOrderTagID,e)||(i.pageData.Filter.SalesOrderTagID=e),p(e)}),a(),r(7,"h6"),u(8,"From"),a(),r(9,"div",11)(10,"div",12)(11,"datepicker",13),f("dateChange",function(e){l(t);let i=s();return _(i.pageData.Filter.From,e)||(i.pageData.Filter.From=e),p(e)}),a()(),r(12,"div",12)(13,"app-timepicker",14),f("timeChange",function(e){l(t);let i=s();return _(i.pageData.Filter.StartTime,e)||(i.pageData.Filter.StartTime=e),p(e)}),a()()(),r(14,"h6"),u(15,"To"),a(),r(16,"div",11)(17,"div",12)(18,"datepicker",15),f("dateChange",function(e){l(t);let i=s();return _(i.pageData.Filter.To,e)||(i.pageData.Filter.To=e),p(e)}),a()(),r(19,"div",12)(20,"app-timepicker",14),f("timeChange",function(e){l(t);let i=s();return _(i.pageData.Filter.EndTime,e)||(i.pageData.Filter.EndTime=e),p(e)}),a()()()()}if(o&2){let t=s();c(3),m("accessType",2),g("ngModel",t.pageData.Filter.EntityID),c(3),m("items",t.pageData==null||t.pageData.Options==null?null:t.pageData.Options.SalesOrderTags),g("ngModel",t.pageData.Filter.SalesOrderTagID),c(5),m("isFloatingLabel",!1),g("date",t.pageData.Filter.From),m("hidelClearBtn",!0),c(2),g("time",t.pageData.Filter.StartTime),m("fullWidth",!0),c(5),m("isFloatingLabel",!1)("hidelClearBtn",!0),g("date",t.pageData.Filter.To),c(2),g("time",t.pageData.Filter.EndTime),m("fullWidth",!0)}}function me(o,d){o&1&&(r(0,"div",19),u(1,"\xA0"),a())}function se(o,d){if(o&1&&(S(0,"pos-receipt-a4",16),r(1,"div",17),S(2,"div",18),a(),v(3,me,2,0,"div",19)),o&2){let t=d.$implicit,n=d.$index,e=s(),i=s();m("data",t)("printTemplate",i.printTemplates==null?null:i.printTemplates.get(t.PrintTemplateID))("config",e.AppConfig)("workOrderMode",!1)("fullMode",!0)("stylesheet",e.StylesSheet),c(3),D(n!==(e.Data==null?null:e.Data.length)-1?3:-1)}}function ce(o,d){o&1&&V(0,se,4,7,null,null,L),o&2&&W(d.Data)}var oe=class o extends K{constructor(t,n,e){super(t,n,"Tool/GetBulkPrintLoader","Tool/GetBulkPrintLoader",e,null,!0);this.httpService=n;this.initPrintListener()}dialogFilter=P(J);receipts$;printTemplates;invoiceIds=B([]);preInitList(){this.pageData.Filter.From=new Date,this.pageData.Filter.To=new Date,this.pageData.Filter.StartTime="00:00",this.pageData.Filter.EndTime="23:59"}onFilter(){this.receipts$=this.httpService.post(F.GetBulkPrintA4,this.pageData.Filter).pipe(I(t=>{t?.Data?.length==0?this.toastrService.info("There are no transaction",z.Info):this.generatePrintTemplate(t.PrintTemplates),this.invoiceIds.set(t.Data.map(n=>n?.Invoice?.ID))}),k(1))}generatePrintTemplate(t=[]){this.printTemplates=new Map(t.map(n=>[n.ID,n]))}onNewPrint(){this.dialogFilter.openDialog()}onPrint(){window.setTimeout(function(){window.print()},500)}initPrintListener(){window.addEventListener("afterprint",this.handleAfterPrint)}handleAfterPrint=()=>{this.invoiceIds()?.length>0&&this.httpService.post(F.UpdateLastPrintByListID,{ListID:this.invoiceIds()}).subscribe()};ngOnDestroy(){window.removeEventListener("afterprint",this.handleAfterPrint)}static \u0275fac=function(n){return new(n||o)(h(X),h(q),h(H))};static \u0275cmp=A({type:o,selectors:[["bulk-invoice-A4"]],features:[M],decls:13,vars:10,consts:[["pageFilterTemplate",""],[3,"textChange","onSubmit","pageData","hideSearchBox","text","hideSearchDropdown"],[1,"btn","btn-outline-secondary","me-3"],[1,"btn","btn-success",3,"click"],["filters",""],[1,"container-fluid","mt-5"],[1,"btn","btn-outline-secondary","me-3",3,"click"],[1,"fa","fa-print","me-3"],[1,"dialog-filter"],["placeholder","Choose an Outlet",3,"ngModelChange","accessType","ngModel"],["bindLabel","Name","bindValue","ID","placeholder","Choose Sales Order Tag",3,"ngModelChange","items","ngModel"],[1,"d-flex","align-items-center","gap-5"],[1,"w-100"],["placeholder","From","appearance","outline","name","From",1,"me-4",3,"dateChange","isFloatingLabel","date","hidelClearBtn"],[3,"timeChange","time","fullWidth"],["placeholder","To","appearance","outline","name","To",1,"me-4",3,"dateChange","isFloatingLabel","hidelClearBtn","date"],[3,"data","printTemplate","config","workOrderMode","fullMode","stylesheet"],[1,"d-print-none","mt-8"],[2,"border-top-style","dotted","margin-bottom","5px"],[1,"page-break"]],template:function(n,e){if(n&1){let i=y();r(0,"mainpanel-cmp",1),f("textChange",function(T){return l(i),_(e.pageData.Filter.Number,T)||(e.pageData.Filter.Number=T),p(T)}),w("onSubmit",function(){return l(i),p(e.onFilter())}),r(1,"actions"),v(2,le,4,0,"button",2),b(3,"async"),r(4,"button",3),w("click",function(){return l(i),p(e.onNewPrint())}),u(5,"New"),a()(),r(6,"div",4),E(7,pe,21,14,"ng-template",null,0,O),a(),r(9,"content")(10,"div",5),v(11,ce,2,0),b(12,"async"),a()()()}if(n&2){let i,C;m("pageData",e.menuData)("hideSearchBox",!0),g("text",e.pageData.Filter.Number),m("hideSearchDropdown",!0),c(2),D(((i=x(3,6,e.receipts$))==null||i.Data==null?null:i.Data.length)>0?2:-1),c(9),D((C=x(12,8,e.printTemplates&&e.receipts$))?11:-1,C)}},dependencies:[R,ae,re,Z,Y,ee,Q,ie,te,$,U,j,G,ne,N],styles:["input.p-inputtext{height:46.63px;border-color:#0000001f!important} input.p-inputtext :hover{border-color:#0000001f!important}@media print{.page-break[_ngcontent-%COMP%]{page-break-after:always}}"]})};export{oe as BulkInvoiceA4Component};
1
+ import{a as re,b as ae}from"./chunk-HVJHE6PQ.js";import"./chunk-RJJYGGF6.js";import"./chunk-VP2ZEIJA.js";import{a as ne}from"./chunk-R4OHTTCT.js";import"./chunk-QIJEAKQK.js";import"./chunk-QEOGHVXA.js";import"./chunk-4HCSE44G.js";import"./chunk-Q2A4MYK3.js";import{d as te,e as ie}from"./chunk-QPOOLLKY.js";import"./chunk-CSFFF2YO.js";import"./chunk-3RK6DDJD.js";import"./chunk-WNZKCNMC.js";import"./chunk-LOD3JYZW.js";import"./chunk-3KSZCJ6T.js";import"./chunk-6GLKD66N.js";import"./chunk-CBSYYTXQ.js";import{e as $}from"./chunk-GN3HVOCN.js";import"./chunk-G4IW5GPY.js";import{c as ee}from"./chunk-MFLQHYOR.js";import{a as K}from"./chunk-OWGJVIYJ.js";import"./chunk-DV63TLIP.js";import"./chunk-QFON23YX.js";import"./chunk-FIUZN6JU.js";import{a as J,e as Y,f as Z}from"./chunk-356KM5DR.js";import"./chunk-P7BRWWWC.js";import"./chunk-JEL3OND6.js";import"./chunk-IDQUQBKL.js";import"./chunk-VYQEM4T2.js";import"./chunk-UTAQ3FRE.js";import"./chunk-M43HNBJQ.js";import"./chunk-X57HWGVJ.js";import"./chunk-5SFUSWFY.js";import"./chunk-534MIVWD.js";import"./chunk-TGEQUV6Z.js";import"./chunk-IVJVUXLS.js";import{b as X}from"./chunk-UQ5F3YKZ.js";import"./chunk-CS6HBROS.js";import"./chunk-JUS6LLVX.js";import"./chunk-BA3BDB5Y.js";import"./chunk-C4WJKF7R.js";import{O as F}from"./chunk-T25N3EEG.js";import{d as Q}from"./chunk-7TBS7SPQ.js";import"./chunk-RLQLFW36.js";import"./chunk-EQLHPWVB.js";import"./chunk-A45GTZVV.js";import"./chunk-NWSIPELM.js";import"./chunk-6SGN7MNX.js";import"./chunk-L76WVZW6.js";import{a as z}from"./chunk-2FWFPV5I.js";import"./chunk-O5SLP4JK.js";import{F as U,h as j,o as G}from"./chunk-RNLSEEMX.js";import"./chunk-U5LNORQV.js";import"./chunk-FO5ZTXDH.js";import"./chunk-USJ6ILEE.js";import"./chunk-BJF3WGIP.js";import{Ab as V,Bb as W,Bc as b,Ca as B,Cb as m,Cc as x,Db as r,Eb as a,Fb as S,Hc as O,Mb as y,Ob as w,Qb as s,Xa as c,Y as k,be as H,db as h,dc as u,ee as q,fa as I,hb as A,ic as g,jc as _,kc as f,kd as N,lb as M,nb as E,pa as P,rd as R,ta as l,ua as p,vb as v,xb as D,yb as L}from"./chunk-JYZTRN6N.js";import"./chunk-WFMAM73Y.js";import"./chunk-SNAKHGZS.js";function le(o,d){if(o&1){let t=y();r(0,"button",6),w("click",function(){l(t);let e=s();return p(e.onPrint())}),S(1,"i",7),r(2,"span"),u(3,"Print"),a()()}}function pe(o,d){if(o&1){let t=y();r(0,"div",8)(1,"h6"),u(2,"Outlet"),a(),r(3,"outlet-selector",9),f("ngModelChange",function(e){l(t);let i=s();return _(i.pageData.Filter.EntityID,e)||(i.pageData.Filter.EntityID=e),p(e)}),a(),r(4,"h6"),u(5,"Sales Order Tag"),a(),r(6,"ng-select",10),f("ngModelChange",function(e){l(t);let i=s();return _(i.pageData.Filter.SalesOrderTagID,e)||(i.pageData.Filter.SalesOrderTagID=e),p(e)}),a(),r(7,"h6"),u(8,"From"),a(),r(9,"div",11)(10,"div",12)(11,"datepicker",13),f("dateChange",function(e){l(t);let i=s();return _(i.pageData.Filter.From,e)||(i.pageData.Filter.From=e),p(e)}),a()(),r(12,"div",12)(13,"app-timepicker",14),f("timeChange",function(e){l(t);let i=s();return _(i.pageData.Filter.StartTime,e)||(i.pageData.Filter.StartTime=e),p(e)}),a()()(),r(14,"h6"),u(15,"To"),a(),r(16,"div",11)(17,"div",12)(18,"datepicker",15),f("dateChange",function(e){l(t);let i=s();return _(i.pageData.Filter.To,e)||(i.pageData.Filter.To=e),p(e)}),a()(),r(19,"div",12)(20,"app-timepicker",14),f("timeChange",function(e){l(t);let i=s();return _(i.pageData.Filter.EndTime,e)||(i.pageData.Filter.EndTime=e),p(e)}),a()()()()}if(o&2){let t=s();c(3),m("accessType",2),g("ngModel",t.pageData.Filter.EntityID),c(3),m("items",t.pageData==null||t.pageData.Options==null?null:t.pageData.Options.SalesOrderTags),g("ngModel",t.pageData.Filter.SalesOrderTagID),c(5),m("isFloatingLabel",!1),g("date",t.pageData.Filter.From),m("hidelClearBtn",!0),c(2),g("time",t.pageData.Filter.StartTime),m("fullWidth",!0),c(5),m("isFloatingLabel",!1)("hidelClearBtn",!0),g("date",t.pageData.Filter.To),c(2),g("time",t.pageData.Filter.EndTime),m("fullWidth",!0)}}function me(o,d){o&1&&(r(0,"div",19),u(1,"\xA0"),a())}function se(o,d){if(o&1&&(S(0,"pos-receipt-a4",16),r(1,"div",17),S(2,"div",18),a(),v(3,me,2,0,"div",19)),o&2){let t=d.$implicit,n=d.$index,e=s(),i=s();m("data",t)("printTemplate",i.printTemplates==null?null:i.printTemplates.get(t.PrintTemplateID))("config",e.AppConfig)("workOrderMode",!1)("fullMode",!0)("stylesheet",e.StylesSheet),c(3),D(n!==(e.Data==null?null:e.Data.length)-1?3:-1)}}function ce(o,d){o&1&&V(0,se,4,7,null,null,L),o&2&&W(d.Data)}var oe=class o extends K{constructor(t,n,e){super(t,n,"Tool/GetBulkPrintLoader","Tool/GetBulkPrintLoader",e,null,!0);this.httpService=n;this.initPrintListener()}dialogFilter=P(J);receipts$;printTemplates;invoiceIds=B([]);preInitList(){this.pageData.Filter.From=new Date,this.pageData.Filter.To=new Date,this.pageData.Filter.StartTime="00:00",this.pageData.Filter.EndTime="23:59"}onFilter(){this.receipts$=this.httpService.post(F.GetBulkPrintA4,this.pageData.Filter).pipe(I(t=>{t?.Data?.length==0?this.toastrService.info("There are no transaction",z.Info):this.generatePrintTemplate(t.PrintTemplates),this.invoiceIds.set(t.Data.map(n=>n?.Invoice?.ID))}),k(1))}generatePrintTemplate(t=[]){this.printTemplates=new Map(t.map(n=>[n.ID,n]))}onNewPrint(){this.dialogFilter.openDialog()}onPrint(){window.setTimeout(function(){window.print()},500)}initPrintListener(){window.addEventListener("afterprint",this.handleAfterPrint)}handleAfterPrint=()=>{this.invoiceIds()?.length>0&&this.httpService.post(F.UpdateLastPrintByListID,{ListID:this.invoiceIds()}).subscribe()};ngOnDestroy(){window.removeEventListener("afterprint",this.handleAfterPrint)}static \u0275fac=function(n){return new(n||o)(h(X),h(q),h(H))};static \u0275cmp=A({type:o,selectors:[["bulk-invoice-A4"]],features:[M],decls:13,vars:10,consts:[["pageFilterTemplate",""],[3,"textChange","onSubmit","pageData","hideSearchBox","text","hideSearchDropdown"],[1,"btn","btn-outline-secondary","me-3"],[1,"btn","btn-success",3,"click"],["filters",""],[1,"container-fluid","mt-5"],[1,"btn","btn-outline-secondary","me-3",3,"click"],[1,"fa","fa-print","me-3"],[1,"dialog-filter"],["placeholder","Choose an Outlet",3,"ngModelChange","accessType","ngModel"],["bindLabel","Name","bindValue","ID","placeholder","Choose Sales Order Tag",3,"ngModelChange","items","ngModel"],[1,"d-flex","align-items-center","gap-5"],[1,"w-100"],["placeholder","From","appearance","outline","name","From",1,"me-4",3,"dateChange","isFloatingLabel","date","hidelClearBtn"],[3,"timeChange","time","fullWidth"],["placeholder","To","appearance","outline","name","To",1,"me-4",3,"dateChange","isFloatingLabel","hidelClearBtn","date"],[3,"data","printTemplate","config","workOrderMode","fullMode","stylesheet"],[1,"d-print-none","mt-8"],[2,"border-top-style","dotted","margin-bottom","5px"],[1,"page-break"]],template:function(n,e){if(n&1){let i=y();r(0,"mainpanel-cmp",1),f("textChange",function(T){return l(i),_(e.pageData.Filter.Number,T)||(e.pageData.Filter.Number=T),p(T)}),w("onSubmit",function(){return l(i),p(e.onFilter())}),r(1,"actions"),v(2,le,4,0,"button",2),b(3,"async"),r(4,"button",3),w("click",function(){return l(i),p(e.onNewPrint())}),u(5,"New"),a()(),r(6,"div",4),E(7,pe,21,14,"ng-template",null,0,O),a(),r(9,"content")(10,"div",5),v(11,ce,2,0),b(12,"async"),a()()()}if(n&2){let i,C;m("pageData",e.menuData)("hideSearchBox",!0),g("text",e.pageData.Filter.Number),m("hideSearchDropdown",!0),c(2),D(((i=x(3,6,e.receipts$))==null||i.Data==null?null:i.Data.length)>0?2:-1),c(9),D((C=x(12,8,e.printTemplates&&e.receipts$))?11:-1,C)}},dependencies:[R,ae,re,Z,Y,ee,Q,ie,te,$,U,j,G,ne,N],styles:["input.p-inputtext{height:46.63px;border-color:#0000001f!important} input.p-inputtext :hover{border-color:#0000001f!important}@media print{.page-break[_ngcontent-%COMP%]{page-break-after:always}}"]})};export{oe as BulkInvoiceA4Component};
@@ -0,0 +1,24 @@
1
+ import{a as io}from"./chunk-EQR3RN5K.js";import{a as no,c as oo}from"./chunk-G2VAG4V3.js";import{a as li}from"./chunk-IDOZYC3I.js";import{a as Yn,b as Xn,c as Zn,d as eo,e as to,f as ke}from"./chunk-C6YPXBIP.js";import{a as Kn}from"./chunk-3OHHXDTW.js";import{a as zn}from"./chunk-AMONIKLC.js";import"./chunk-5I5IONRY.js";import{a as ii}from"./chunk-JCTDWAYQ.js";import{a as $n}from"./chunk-5TKXFIDJ.js";import{a as ri}from"./chunk-MEG3XVPI.js";import{a as Gn}from"./chunk-C5AIOCPM.js";import{a as qn}from"./chunk-YRDGEYIV.js";import"./chunk-2KPICU7I.js";import"./chunk-NQX7EX5A.js";import"./chunk-DJTAYVZN.js";import"./chunk-P3KIIKY4.js";import{a as ki}from"./chunk-GODXDKX5.js";import{c as Qn,d as Un}from"./chunk-PSJRHKCL.js";import{a as ni,b as jn,c as Ln}from"./chunk-NVCUDJUL.js";import"./chunk-2MCEIRJY.js";import{a as Nt}from"./chunk-23PKMU5D.js";import{a as Xt}from"./chunk-AFBBEIKR.js";import"./chunk-IFOBYW26.js";import{b as Rn}from"./chunk-SVUUS5JD.js";import{a as Wn,b as Jn,c as Hn}from"./chunk-76RLGANX.js";import"./chunk-KYAKLZR7.js";import"./chunk-CA6YBQT3.js";import{a as oi,b as ai}from"./chunk-J7YNB6YX.js";import{a as Bn}from"./chunk-VP2ZEIJA.js";import"./chunk-BYXBJQAS.js";import"./chunk-5DQ4MJJT.js";import"./chunk-BYXBJQAS.js";import{b as Vn}from"./chunk-QIJEAKQK.js";import"./chunk-QEOGHVXA.js";import"./chunk-4HCSE44G.js";import{e as Dt}from"./chunk-AUBQH6JY.js";import{a as ei}from"./chunk-HL3ONSX6.js";import"./chunk-Q2A4MYK3.js";import{d as kn,e as ti}from"./chunk-QPOOLLKY.js";import"./chunk-CSFFF2YO.js";import"./chunk-3RK6DDJD.js";import"./chunk-WNZKCNMC.js";import"./chunk-LOD3JYZW.js";import"./chunk-3KSZCJ6T.js";import"./chunk-6GLKD66N.js";import"./chunk-CBSYYTXQ.js";import"./chunk-G4IW5GPY.js";import"./chunk-FIUZN6JU.js";import"./chunk-JEL3OND6.js";import"./chunk-IDQUQBKL.js";import{a as Dn,b as xn,c as Sn}from"./chunk-VX5HH3BW.js";import"./chunk-VYQEM4T2.js";import"./chunk-UTAQ3FRE.js";import{a as Mn,c as In,e as Pn,g as On}from"./chunk-M43HNBJQ.js";import{a as st,c as ct}from"./chunk-KKLNFVVN.js";import"./chunk-5SFUSWFY.js";import"./chunk-534MIVWD.js";import"./chunk-TGEQUV6Z.js";import{a as Tn,b as wn}from"./chunk-UQ5F3YKZ.js";import"./chunk-CS6HBROS.js";import{a as vn}from"./chunk-JUS6LLVX.js";import{A as Fn,G as An,q as _n,u as Ie,v as Pe,w as Oe,x as Nn,z as En}from"./chunk-BA3BDB5Y.js";import{b as rt,c as lt}from"./chunk-C4WJKF7R.js";import{O as Ae}from"./chunk-T25N3EEG.js";import{d as xt}from"./chunk-7TBS7SPQ.js";import{a as un,b as fn,c as gn}from"./chunk-EQLHPWVB.js";import{a as z,e as Me,f as Fe,g as Z,l as Zt}from"./chunk-A45GTZVV.js";import"./chunk-NWSIPELM.js";import"./chunk-6SGN7MNX.js";import"./chunk-L76WVZW6.js";import{a as ve}from"./chunk-2FWFPV5I.js";import"./chunk-O5SLP4JK.js";import{E as bn,F as Se,G as Ye,a as Ke,b as Cn,c as be,h as ae,l as ce,o as xe,r as yn,s as ze}from"./chunk-RNLSEEMX.js";import{a as hn}from"./chunk-FO5ZTXDH.js";import{a as S,d as he}from"./chunk-USJ6ILEE.js";import{a as dn}from"./chunk-BJF3WGIP.js";import{$ as je,$d as Yt,Ab as Ue,Ad as mn,Bb as We,Bc as f,Ca as Le,Cb as b,Cc as g,D as ot,Db as r,Dc as wt,E as V,Eb as a,Fb as M,Gb as Je,H as Hi,Hb as it,Hc as Gt,I as ye,Ib as kt,Ja as Fi,Jb as Vt,Kb as $t,Lb as on,Lc as rn,M as Gi,Mb as j,N as Ei,Ob as D,Pb as bt,Q as qi,Qa as Yi,Qb as p,Qc as qt,Sa as at,T as Ki,Ub as Rt,Vb as Bt,W as Tt,Wa as Xi,Wb as jt,Wd as pn,Xa as l,Y as X,Yb as Lt,Yd as Kt,Zb as Qt,Zd as zt,_b as ht,aa as Y,ac as vt,be as qe,ca as zi,cb as Zi,cc as an,cd as Ge,d as ge,db as u,dc as m,e as et,ec as te,ed as ln,ee as re,f as Ui,fa as E,fb as en,fc as $,ga as me,gc as He,hb as F,ic as U,jc as L,jd as sn,k as we,kc as W,kd as Ee,la as ne,lb as tn,lc as Ut,mc as Wt,md as cn,n as Wi,nb as ut,nc as Jt,o as tt,oa as Q,oc as Ai,od as De,p as Ji,pa as le,rd as se,sc as Ne,t as d,ta as P,tc as Ht,u as Ce,ua as O,uc as ie,v as Ni,vb as v,vc as _t,wb as nn,xb as _,y as dt,zb as Qe}from"./chunk-JYZTRN6N.js";import"./chunk-WFMAM73Y.js";import{a as w,b as B,e as Qi,k as yt}from"./chunk-SNAKHGZS.js";var H=class n{constructor(t,e){this.http=e;this.buyForm=t.group({NewOrderID:[""],Order:t.group({Att:[""],SupplierID:[""],Number:[""],Date:[new Date],ID:[S.GuidEmpty]}),Invoice:t.group({ID:[S.GuidEmpty],Due:[new Date],Tax:[0]}),Payment:t.group({ID:[S.GuidEmpty],Amount:[0],MethodID:[0],Code:[""],Note:[""],ImageUrl:[""]})})}outlet=new ce({ID:"",Name:"Choose an Outlet"});dueDays=new ce(0);deliveryEntityID=new ce(S.GuidEmpty);noteForm=new ce({Note:"",TagID:"",Currency:{ID:"",ExchangeRate:0,Symbol:""},InvoiceNumber:""});discountAndTaxForm=new ce({Discount:{Amount:0,Percentage:0},Tax:{ID:"",CalculationTypeName:"",Rate:0,Label:"",Discontinue:!1}});buyForm;setPONumber(t){let e="";if(t.Seed){let i=t.Seed+"";for(;i.length<t.Digit;)i="0"+i;e=S.StringFormat(t.Prefix,i)}this.buyForm.controls.Order.controls.Number.setValue(e)}setDueDateBasedOnDaysDue(t){console.log(t);let e=this.invoiceDate,i=new Date(S.cloneObject(e));i.setDate(i.getDate()+t),this.buyForm.controls.Invoice.controls.Due.setValue(i)}get dueDate(){return this.buyForm.controls.Invoice.controls.Due.value}get invoiceDate(){return this.buyForm.controls.Order.controls.Date.value}setAmount(t){this.buyForm.controls.Payment.controls.Amount.setValue(t)}setPaymentMethodID(t){this.buyForm.controls.Payment.controls.MethodID.setValue(t)}setTaxAmount(t){this.buyForm.controls.Invoice.controls.Tax.setValue(t)}setNewOrderID(t){this.buyForm.controls.NewOrderID.setValue(t)}setTax(t){let e=w({},this.discountAndTaxForm.value.Discount);this.discountAndTaxForm.setValue({Discount:e,Tax:t})}setCurrency(t){let e=this.noteForm.value;this.noteForm.setValue(B(w({},e),{Currency:t}))}setDeliveryEntityID(t){this.deliveryEntityID.setValue(t)}setdueDays(t){this.dueDays.setValue(t)}setBulkOrderForm(t){this.buyForm.controls.Order.setValue(t)}setBulkNoteForm(t){this.noteForm.setValue(t)}setBulkDiscountAndTaxForm(t){this.discountAndTaxForm.setValue(t)}setOutletForm(t){this.outlet.setValue(t)}setBulkInvoice(t){this.buyForm.controls.Invoice.setValue(w(w({},this.buyForm.controls.Invoice.value),t))}setBulkPayment(t){this.buyForm.controls.Payment.setValue(t)}resetOutletForm(){this.outlet.setValue({ID:"",Name:"Choose an Outlet"})}resetDueDaysForm(){this.dueDays.setValue(0)}resetDeliveryEntityID(){this.deliveryEntityID.setValue(S.GuidEmpty)}resetNoteForm(){this.noteForm.setValue(B(w({},this.noteForm.value),{Note:"",TagID:"",InvoiceNumber:""}))}resetDiscountAndTaxForm(){let t=this.discountAndTaxForm.value;this.discountAndTaxForm.setValue(B(w({},t),{Discount:{Amount:0,Percentage:0}}))}resetBuyForm(){this.buyForm.reset(),this.buyForm.controls.Invoice.controls.ID.setValue(S.GuidEmpty),this.buyForm.controls.Invoice.controls.Due.setValue(new Date),this.buyForm.controls.Order.controls.Date.setValue(new Date),this.buyForm.controls.Order.controls.ID.setValue(S.GuidEmpty),this.generateNumberOnNewTransaction()}generateNumberOnNewTransaction(){this.http.post("/API/Buy/GenerateNumber",{ID:this.outlet.value.ID}).subscribe(t=>{this.setNewOrderID(S.Guid_NewGuid()),this.buyForm.controls.Order.controls.Number.setValue(t.Number)})}static \u0275fac=function(e){return new(e||n)(Q(bn),Q(re))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};var de=class n{entities$;appConfigJSON$;taxes$;currencies$;supplierPOTypes$;predefinedNotes$;denomination$;defaultDueDays$;constructor(t,e){let i=t.get("/API/Buy2/Load").pipe(E(o=>e.setCurrency(o.Currencies.find(s=>s.ID==o.AppConfigJSON.CoreDefaults.CurrencyID))),X(1));this.denomination$=i.pipe(d(o=>o.Denomination)),this.entities$=i.pipe(d(o=>o.Entities)),this.appConfigJSON$=i.pipe(d(o=>o.AppConfigJSON)),this.taxes$=i.pipe(d(o=>o.Taxes),X(1)),this.currencies$=i.pipe(d(o=>o.Currencies),X(1)),this.supplierPOTypes$=i.pipe(d(o=>o.SupplierPOTypes)),this.predefinedNotes$=i.pipe(d(o=>o.PredefinedNotes)),this.defaultDueDays$=i.pipe(d(o=>o.AppConfigJSON.ModuleBuy.PaymentDialog.DefaultDueDays),E(o=>e.setdueDays(o)),E(o=>e.setDueDateBasedOnDaysDue(o)))}updateDueDays(){this.defaultDueDays$.subscribe()}static \u0275fac=function(e){return new(e||n)(Q(re),Q(H))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};var mt=class n{returnInvoiceNumber=new ce("");invoiceInfo$;constructor(t,e,i){let o=e.outlet.valueChanges.pipe(d(c=>c.ID),z());this.invoiceInfo$=this.returnInvoiceNumber.valueChanges.pipe(V(c=>!!c),me(o),Y(([c,I])=>t.post("/API/Buy/GetSupplierInvoiceRetur2",{EntityID:I,Number:c}).pipe(ye(()=>we))),X(1),z());let s=this.invoiceInfo$.pipe(d(c=>w({},c.Order)),E(c=>{let I={Att:c.Att,SupplierID:{Key:c.SupplierID,Value:c.SupplierName,OnSet:!0},Date:new Date,Number:e.buyForm.controls.Order.controls.Number.value,ID:S.GuidEmpty};e.setBulkOrderForm(I)}),z()),T=this.invoiceInfo$.pipe(d(c=>c.Order),E(c=>{let I={Note:`Return #${c.Number}`,TagID:c.TypeID,Currency:{ID:c.CurrencyID,ExchangeRate:c.CurrencyRate,Symbol:c.CurrencySymbol??"$"},InvoiceNumber:c.Number};e.setBulkNoteForm(I)}),z()),h=this.invoiceInfo$.pipe(d(c=>c.Order),me(i.taxes$),d(([c,I])=>B(w({},c),{Tax:I.find(J=>J.ID===c.TaxTypeID)})),E(c=>{let I={Discount:{Amount:c.DiscountAmount,Percentage:c.Discount},Tax:{ID:c.TaxTypeID,Rate:c.Tax?.Rate,CalculationTypeName:c.Tax?.CalculationTypeName,Label:c.Tax?.Label,Discontinue:!c.Tax?.Label}};e.setBulkDiscountAndTaxForm(I)}),z()),R=this.invoiceInfo$.pipe(d(c=>c.DeliveryEntityID),E(c=>e.setDeliveryEntityID(c)),z()),G=this.invoiceInfo$.pipe(d(c=>c.Invoice),E(c=>{let I={ID:c.ID,Tax:c.Tax};e.setBulkInvoice(I)}),z()),x=this.invoiceInfo$.pipe(d(c=>c.Payment),E(c=>{let I={ID:S.GuidEmpty,Amount:c.Amount,MethodID:c.MethodID,Note:c.Note,Code:c.Code,ImageUrl:c.ImageUrl};e.setBulkPayment(I)}),z());Ce(s,T,h,R,G,x).pipe(z()).subscribe()}static \u0275fac=function(e){return new(e||n)(Q(re),Q(H),Q(de))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};var ee=class n{constructor(t,e,i,o){this.matDialog=o;let s=e.outlet.valueChanges.pipe(d(c=>c.ID));this.addVariantThroughSerial$=this._addVariantThroughSerial.asObservable().pipe(me(s),Y(([c,I])=>t.get(Ae.GetVariantBySerial,[{key:"Serial",value:c},{key:"EntityID",value:I}]).pipe(ye(()=>we))),d(c=>this.setUnitPrice(c)),d(c=>B(w({},c),{Quantity:1,Total:c.UnitPrice,VariantID:c.ID})),d(c=>({action:"addAsSerial",variant:c})));let T=this.variantAutocomplete.valueChanges.pipe(V(c=>S.IsNotEmpty(c)&&c.type=="Code"),d(c=>c.str),me(s),Y(([c,I])=>t.get(Ae.GetVariantByCode,[{key:"Code",value:c},{key:"EntityID",value:I},{key:"Promotion",value:!0}]).pipe(ye(()=>we))),d(c=>this.setUnitPrice(c)),d(c=>B(w({},c),{Quantity:1,Total:c.UnitPrice*((100-c.PriceDiscount)/100),Discount:c.PriceDiscount,VariantID:c.ID}))),h=this.variantAutocomplete.valueChanges.pipe(V(c=>S.IsNotEmpty(c)&&c.type=="ID"),d(c=>c.str)),R=this.variantQuickKey.valueChanges,G=ot(h,R).pipe(me(s),Y(([c,I])=>t.get(Ae.GetVariantByID,[{key:"ID",value:c},{key:"EntityID",value:I}]).pipe(ye(()=>we))),d(c=>this.setUnitPrice(c)),d(c=>B(w({},c),{Quantity:1,Total:c.UnitPrice*((100-c.OrderPriceDiscount)/100),Discount:c.OrderPriceDiscount,VariantID:c.ID}))),x=ot(G,T).pipe(E(c=>{c.CategoryTypeID===1&&this.toastr.info(`${c.Name} is sellable only.`,ve.Info)}),V(c=>c.CategoryTypeID!==1),d(c=>({action:"add",variant:c})),E(()=>{this.cartDisplayRef&&setTimeout(()=>{let c=this.cartDisplayRef.nativeElement.scrollHeight;this.cartDisplayRef.nativeElement.scrollTop=c},1)})),A=i.invoiceInfo$.pipe(d(c=>({action:"returnInvoice",variants:c.Items.map(I=>B(w({},I.Variant),{Quantity:I.Quantity,Total:I.Total,UnitPrice:I.UnitPrice,Discount:I.Discount,Serial:I.Serial,ID:I.ID,DiscountAmount:I.DiscountAmount,VariantID:I.VariantID,UnitQuantity:I.UnitQuantity}))})));this.cart$=ot(x,A,this.deleteVariant$,this.dragDropCart$,this.returnCart$,this.updateVariant$,this.returnVariant$,this.purchaseVariant$,this.clearCart$,this.onEditForm$,this.addVariantThroughSerial$,this.addVariant$,this.onUploadCart$,this.listenRFID$).pipe(Tt((c,I)=>{let J=[...c],K=[],C=I.action;if(C=="add"){let y=I.variant;K=!!J.find(k=>k.VariantID==y.ID)?J.map(k=>k.VariantID==y.ID?B(w({},k),{Quantity:k.Quantity+1,Total:k.Total+k.UnitPrice}):k):[...J,y]}else if(C=="returnInvoice"||C=="onEditForm")K=I.variants;else if(C=="delete"){let y=I.index;K=J.filter((N,k)=>k!=y)}else if(C=="sort"){let y=I.ev;K=J,Mn(K,y.previousIndex,y.currentIndex)}else if(C=="returnCart")K=J.map(y=>B(w({},y),{Quantity:-Math.abs(y.Quantity),Total:-Math.abs(y.Total)}));else if(C=="update"){let y=I.index;K=J.map((N,k)=>k==y?I.variant:N)}else if(C=="returnVariant"){let y=I.index;K=J.map((N,k)=>k==y?B(w({},N),{Quantity:-Math.abs(N.Quantity),Total:-Math.abs(N.Total)}):N)}else if(C=="purchaseVariant"){let y=I.index;K=J.map((N,k)=>k==y?B(w({},N),{Quantity:Math.abs(N.Quantity),Total:Math.abs(N.Total)}):N)}else if(C=="clearCart")K=[];else if(C=="addAsSerial"){let y=B(w({},I.variant),{Serial:[{Number:I.variant.Serial.Number,Quantity:1,ExpiryDate:I.variant.Serial.ExpiryDate}]});if(!!J.find(k=>k.ID==y.ID)){let k=y.Serial[0],fe=J.find(pe=>pe.ID==y.ID),At=!!fe.Serial.find(pe=>pe.Number==k.Number)?[...fe.Serial].map(pe=>pe.Number==k.Number?B(w({},pe),{Quantity:pe.Quantity+1}):pe):[...fe.Serial,k];K=J.map(pe=>pe.ID==y.ID?B(w({},pe),{Quantity:pe.Quantity+1,Total:pe.Total+pe.UnitPrice,Serial:At}):pe)}else K=[...J,B(w({},y),{Quantity:1,Total:y.UnitPrice})]}else if(C=="uploadCart")K=[...J,...I.variants];else if(C=="addNewRow"){let y=I.variant;K=[...J,y]}else if(C=="rfid"){let y=I.variants;Object.keys(y).forEach(N=>{if(y.hasOwnProperty(N)){let k=y[N];if(k&&Object.keys(k.variant).length>0){let fe=J.findIndex(Ct=>Ct.Code.toLowerCase()===N.toLowerCase());if(fe!==-1){let Ct=Number(k.count);J[fe].Quantity+=Ct,J[fe].Total=+J[fe].UnitPrice*+J[fe].Quantity,delete y[N],K=[...J]}else{let Ct=k.variant,At=Number(k.count),pe=this.setUnitPrice(Ct),co=this.formatItemObject(B(w({},pe),{Quantity:At,Total:+pe.UnitPrice*+At}));delete y[N],K=[...J,co]}}}})}return K},[]),je([]),X(1)),this.totalVariantOrdered$=this.cart$.pipe(d(c=>c.map(I=>I.Quantity)),d(c=>c.reduce((I,J)=>I+J,0)),je(0))}toastr=le(qe);cartDisplayRef;variantAutocomplete=new ce;variantQuickKey=new ce;_listenRFID=new ge;listenRFID$=this._listenRFID.asObservable().pipe(d(t=>({action:"rfid",variants:t})));_deleteVariant=new ge;deleteVariant$=this._deleteVariant.asObservable().pipe(d(t=>({action:"delete",index:t})));_dragDropCart=new ge;dragDropCart$=this._dragDropCart.asObservable().pipe(d(t=>({action:"sort",ev:t})));_returnCart=new ge;returnCart$=this._returnCart.asObservable().pipe(d(()=>({action:"returnCart"})));_onEditForm=new et(null);onEditForm$=this._onEditForm.asObservable().pipe(V(t=>!!t),d(t=>({action:"onEditForm",variants:t})));_clearCart=new ge;clearCart$=this._clearCart.asObservable().pipe(d(()=>({action:"clearCart"})));_updateVariant=new ge;updateVariant$=this._updateVariant.asObservable().pipe(d(t=>({action:"update",variant:t.variant,index:t.index})));_returnVariant=new ge;returnVariant$=this._returnVariant.asObservable().pipe(d(t=>({action:"returnVariant",index:t})));_purchaseVariant=new ge;purchaseVariant$=this._purchaseVariant.asObservable().pipe(d(t=>({action:"purchaseVariant",index:t})));_addVariant=new ge;addVariant$=this._addVariant.asObservable().pipe(d(t=>({action:"addNewRow",variant:t})));_onUploadCart=new ge;onUploadCart$=this._onUploadCart.asObservable().pipe(d(t=>({action:"uploadCart",variants:t})));cart$;totalVariantOrdered$;_addVariantThroughSerial=new ge;addVariantThroughSerial$;deleteVariant(t){this._deleteVariant.next(t)}dragDropCart(t){this._dragDropCart.next(t)}returnCart(){this._returnCart.next()}updateVariant(t,e){this._updateVariant.next({variant:t,index:e})}returnVariant(t){this._returnVariant.next(t)}purchaseVariant(t){this._purchaseVariant.next(t)}clearCart(){this._clearCart.next()}editForm(t){this._onEditForm.next(t)}addVariant(t){this._addVariant.next(t)}addVariantThroughSerial(t){this._addVariantThroughSerial.next(t)}uploadCart(t){this._onUploadCart.next(t)}setUnitPrice(t){let e=w({},t);return S.IsNotEmpty(t.OrderPrice)?e.UnitPrice=t.OrderPrice:e.UnitPrice=t.UnitCost,e}formatItemObject=t=>{let o=t,{ID:e}=o,i=Qi(o,["ID"]);return B(w({},i),{Quantity:i.Quantity??1,Total:i.Total??i.UnitPrice,VariantID:e})};addCartRFID(t){this._listenRFID.next(t)}static \u0275fac=function(e){return new(e||n)(Q(re),Q(H),Q(mt),Q(Z))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};var Ve=class n{_isEdit=new ge;isEdit$;id$;isUnpaid$;dialog=le(Z);constructor(t,e,i,o,s){let T=tt(t.snapshot.queryParams);this.isEdit$=ot(T.pipe(d(C=>!!C.ID)),this._isEdit.asObservable()).pipe(X(1)),this.id$=T.pipe(V(C=>C.ID),d(C=>C.ID));let h=this.id$.pipe(Y(C=>e.post("/api/Buy2/GetDataByID2",{ID:C})),X(1)),R=dt(()=>o.entities$).pipe(Y(C=>h.pipe(d(y=>[y.Order,C]))),E(([C,y])=>{let N={Att:C.Att,SupplierID:{Key:C.SupplierID,Value:C.SupplierName,OnSet:!0},Date:C.Date,Number:C.Number,ID:C.ID};i.setBulkOrderForm(N)}),E(([C,y])=>{let N=y.find(k=>k.ID==C.EntityID);i.setOutletForm(N)})),G=h.pipe(d(C=>C.Items),d(C=>C.map(y=>B(w({},y.Variant),{Quantity:y.Quantity,Total:y.Total,Note:y.Note,UnitPrice:y.UnitPrice,Discount:y.Discount,Serial:y.Serial,ID:y.ID,VariantID:y.VariantID,UnitQuantity:y.UnitQuantity,QtyRequested:y.QtyRequested,DiscountAmount:y.DiscountAmount}))),E(C=>s.editForm(C))),x=dt(()=>o.currencies$).pipe(Y(C=>h.pipe(d(y=>[y.Order,C,y.Invoice]))),d(([C,y,N])=>B(w({},C),{Number:C.Number!=N.Number?N.Number:C.Number,Currency:y.find(k=>k.ID===C.CurrencyID)})),E(C=>{let y={Note:C.Note,TagID:C.TypeID,Currency:w({},C.Currency),InvoiceNumber:C.Number};i.setBulkNoteForm(y)})),A=h.pipe(d(C=>C.DeliveryEntityID),E(C=>i.setDeliveryEntityID(C))),c=dt(()=>o.taxes$).pipe(Y(C=>h.pipe(d(y=>[y.Order,C]))),d(([C,y])=>B(w({},C),{Taxes:y})),E(C=>{let y=C.Taxes.find(k=>k.ID===C.TaxTypeID);y?.Bin&&this.dialog.open(ni,{id:"ModalInfo",data:{title:"Default Tax Discontinued",message:`
2
+ <div class="d-flex justify-content-center my-4">
3
+ <img class="img-2x" src="https://cdn.dealpos.xyz/web-image/globalerror.svg"
4
+ alt="Empty Sales Order Tag" />
5
+ </div>
6
+ <h4 class="text-center mb-4">
7
+ Your Default Tax for this outlet has been discontinued!
8
+ </h4>
9
+ <p class="text-center">
10
+ Please change the default tax or re-activate the tax <a href="/menu/Setup/Payment/Tax">here</a>.
11
+ </p>
12
+ `,headerType:ve.Error},width:"31rem"}),(S.IsEmpty(y)||y?.Bin)&&(y=C.Taxes[0],C.TaxTypeID=y.ID);let N={Discount:{Amount:C.DiscountAmount,Percentage:C.Discount},Tax:{ID:C.TaxTypeID,Rate:y?.Rate,CalculationTypeName:y?.CalculationTypeName,Label:y?.Label??y?.Name,Discontinue:y?.Bin}};i.setBulkDiscountAndTaxForm(N)})),I=h.pipe(d(C=>C.Invoice),E(C=>{let y={ID:C.ID,Due:C.Due,Tax:C.Tax};i.setBulkInvoice(y)})),J=this.isEdit$.pipe(Y(C=>h.pipe(d(y=>y.Payment),E(y=>{let N={ID:C?y?.ID:S.GuidEmpty,Amount:C?y?.Amount:0,MethodID:y?.MethodID,Note:C?y?.Note:null,Code:y?.Code,ImageUrl:C?y?.ImageUrl:null};N.Amount!==void 0&&i.setBulkPayment(N)}))));this.isUnpaid$=J.pipe(d(C=>S.IsEmpty(C))),Ce(R,G,x,A,c,I,J).subscribe()}onNewPurchase(){this._isEdit.next(!1)}static \u0275fac=function(e){return new(e||n)(Q(pn),Q(re),Q(H),Q(de),Q(ee))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};var $e=class n{edit=le(Ve);_paymentComplete=new ge;paymentComplete$=this._paymentComplete.asObservable().pipe(X(1));_createNewTransaction=new et(!1);createNewTransaction$=this._createNewTransaction.asObservable();constructor(){}paymentComplete(t){this._paymentComplete.next(t)}createNewTransaction(){this._createNewTransaction.next(!0),this.edit.onNewPurchase()}static \u0275fac=function(e){return new(e||n)};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};var Xe=class n{quickKeyPack$;cardPayments$;cashPayments$;otherPayments$;updateDefaultTax$;isCashSuspended$;updatePaymentMethodID$;dialog=le(Z);constructor(t,e,i,o,s){let T=e.outlet.valueChanges.pipe(d(x=>x?.ID),z()),h=T.pipe(qi(),V(x=>!!x),me(i.isEdit$),Y(([x,A])=>t.get("/API/Buy2/GetOutletInfo",[{key:"EntityID",value:x},{key:"IsEdit",value:A}])),X(1),z()),R=h.pipe(me(i.isEdit$),V(([x,A])=>!A),d(([x,A])=>x),E(x=>e.setPONumber(x.NumberElement)),z());this.quickKeyPack$=h.pipe(d(x=>x.QuickKeyPack),z()),this.updateDefaultTax$=dt(()=>o.taxes$).pipe(Y(x=>h.pipe(d(A=>[x,A]))),me(i.isEdit$),V(([[x,A],c])=>!c),d(([[x,A],c])=>[x,A]),E(([x,A])=>{let c=x.find(I=>I.ID==A.DefaultTaxType);c?.Bin&&this.showTaxDiscontinuedDialog(),(S.IsEmpty(c)||c.Bin)&&(c=x.find(I=>!I.Bin)),e.setTax(c)}),z()),this.updatePaymentMethodID$=h.pipe(me(i.isEdit$),V(([x,A])=>!A),d(([x,A])=>x.Payments),d(x=>{let A=x.filter(c=>c.TypeID==1);return A.length?A:x.filter(c=>c.TypeID==2)}),E(x=>e.setPaymentMethodID(x[0].ID)),z()),this.cashPayments$=h.pipe(d(x=>x.Payments),d(x=>x.filter(A=>A.TypeID==1)),z()),this.cardPayments$=h.pipe(d(x=>x.Payments),d(x=>x.filter(A=>A.TypeID==2)),z()),this.otherPayments$=h.pipe(d(x=>x.Payments),d(x=>x.filter(A=>A.TypeID==4)),z()),this.isCashSuspended$=h.pipe(d(x=>x.Payments),d(x=>!!x.filter(c=>c.TypeID==1).length),z()),dt(()=>o.appConfigJSON$).pipe(me(i.isEdit$),V(([x,A])=>!A&&x.ModuleBuy.Shipping.BuyShippingDefault==0),Y(()=>Ce(T,s.createNewTransaction$)),E(([x,A])=>e.setDeliveryEntityID(x)),z()).subscribe(),R.subscribe(),this.updateDefaultTax$.subscribe(),this.updatePaymentMethodID$.subscribe()}showTaxDiscontinuedDialog(){this.dialog.open(ni,{id:"ModalInfo",data:{title:"Default Tax Discontinued",message:`
13
+ <div class="d-flex justify-content-center my-4">
14
+ <img class="img-2x" src="https://cdn.dealpos.xyz/web-image/globalerror.svg"
15
+ alt="Empty Sales Order Tag" />
16
+ </div>
17
+ <h4 class="text-center mb-4">
18
+ Your Default Tax for this outlet has been discontinued!
19
+ </h4>
20
+ <p class="text-center">
21
+ Please change the default tax or re-activate the tax <a href="/menu/Setup/Payment/Tax">here</a>.
22
+ </p>
23
+ `,headerType:ve.Error},width:"31rem"})}updateTax(){this.updateDefaultTax$.pipe(Ei(1)).subscribe()}updatePaymentMethodID(){this.updatePaymentMethodID$.pipe(Ei(1)).subscribe()}static \u0275fac=function(e){return new(e||n)(Q(re),Q(H),Q(Ve),Q(de),Q($e))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};function po(n,t){if(n&1&&(r(0,"mat-option",7),m(1),a()),n&2){let e=t.$implicit;b("value",e),l(),$(" ",e.Value," ")}}function uo(n,t){if(n&1){let e=j();r(0,"i",8),D("click",function(){P(e);let o=p();return O(o.openSupplierDetail())}),a()}}var ci=class n{constructor(t,e,i,o){this.http=t;this.form=e;this.matDialog=i;this.router=o}supplierPOTypes;appConfigJSON;filteredSuppliers$;supplier=new ce("");disabled=!1;onChange=t=>{};onTouched=()=>{};ngOnInit(){this.filteredSuppliers$=this.supplier.valueChanges.pipe(V(i=>typeof i=="string"&&i.length>=3),Gi(300),Y(i=>this.http.get("/API/AC/GetSupplierSuggestion",[{key:"count",value:100},{key:"prefix",value:i}]))),this.supplier.valueChanges.pipe(V(i=>typeof i!="string"),d(i=>i),E(i=>i?.Key!=S.GuidEmpty&&S.IsNotEmpty(i)?this.onChange(i.Key):this.onChange(null))).pipe(V(i=>S.IsNotEmpty(i)&&!i.OnSet),Y(i=>this.http.post("/API/Contact/GetSupplierDTO",{id:i.Key}).pipe(ye(()=>we))),d(i=>i.DaysDue),V(i=>i!=0),E(i=>this.form.setdueDays(i)),E(i=>this.form.setDueDateBasedOnDaysDue(i))).subscribe()}writeValue(t){this.supplier.setValue(t)}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}displaySupplierNameFn(t){return t?.Value}openNewSupplierModal(){this.matDialog.open(Qn,{data:{options:this.supplierPOTypes,config:this.appConfigJSON.ModuleContact,type:"supplier",title:"New Supplier Form"}}).afterClosed().pipe(V(t=>S.IsNotEmpty(t.supplier.Name)),Y(t=>{let e={contact:t.supplier,type:"supplier",groups:t.supplier.Group?t.supplier.Group:[]};return this.http.post("/API/Contact/Supplier/Create",e).pipe(d(i=>({Key:i.ID,Value:t.supplier.Name})))})).subscribe(t=>{this.writeValue(t),this.onChange(t.Key)})}openSupplierDetail(){let t=this.supplier.value.Key;if(S.IsNotEmpty(t)){let e=this.router.serializeUrl(this.router.createUrlTree(["/menu/Contacts/Contact/Suppliers/Info"],{queryParams:{ID:t}}));window.open(e,"_blank")}}static \u0275fac=function(e){return new(e||n)(u(re),u(H),u(Z),u(Kt))};static \u0275cmp=F({type:n,selectors:[["POS-supplier-autocomplete"]],inputs:{supplierPOTypes:"supplierPOTypes",appConfigJSON:"appConfigJSON"},features:[Ne([{provide:Ke,multi:!0,useExisting:n}])],decls:8,vars:7,consts:[["auto","matAutocomplete"],[1,"d-flex","align-items-center","position-relative"],["matTooltipPosition","above","matTooltip","New Supplier Form",1,"fa-light","fa-user-plus","position-absolute",2,"font-size","12px",3,"click"],["type","text","placeholder","Assign Supplier",3,"formControl","matAutocomplete"],[3,"displayWith"],[3,"value",4,"ngFor","ngForOf"],["matTooltipPosition","left","matTooltip","Open Supplier Details",1,"fa-regular","fa-arrow-up-right-from-square","position-absolute",2,"font-size","12px","right","0","cursor","pointer"],[3,"value"],["matTooltipPosition","left","matTooltip","Open Supplier Details",1,"fa-regular","fa-arrow-up-right-from-square","position-absolute",2,"font-size","12px","right","0","cursor","pointer",3,"click"]],template:function(e,i){if(e&1){let o=j();r(0,"div",1)(1,"i",2),D("click",function(){return P(o),O(i.openNewSupplierModal())}),a(),M(2,"input",3),r(3,"mat-autocomplete",4,0),ut(5,po,2,2,"mat-option",5),f(6,"async"),a(),v(7,uo,1,0,"i",6),a()}if(e&2){let o=ht(4);l(2),b("formControl",i.supplier)("matAutocomplete",o),l(),b("displayWith",i.displaySupplierNameFn),l(2),b("ngForOf",g(6,5,i.filteredSuppliers$)),l(2),_(i.supplier&&(i.supplier!=null&&i.supplier.value)&&(!(i.supplier==null||i.supplier.value==null)&&i.supplier.value.Key)?7:-1)}},dependencies:[se,ln,Fn,Nn,_n,En,Ye,be,ae,ze,lt,rt,Un,Ee],styles:["input[_ngcontent-%COMP%]{width:100%;height:38px!important;border-radius:.375rem;border:1px solid #ced4da;padding-left:32px;padding-right:32px}input[_ngcontent-%COMP%]::placeholder{color:#ced4da}i.fa-user-plus[_ngcontent-%COMP%]{font-size:16px;top:10.6px;left:13px}i.fa-arrow-up-right-from-square[_ngcontent-%COMP%]{transform:none;position:absolute;margin-right:13px;top:10.6px;font-size:12px}"]})};var go=["quantity"],Et=n=>({selected:n}),Co=()=>["/menu/Products/Catalog/Variants/Info"],yo=n=>({ID:n}),bo=n=>({"table-light":n});function ho(n,t){if(n&1){let e=j();r(0,"a",18),D("click",function(){P(e);let o=p();return O(o.onTabChange("Discount"))}),m(1," Discount "),a()}if(n&2){let e=p();b("ngClass",ie(1,Et,e.tabState=="Discount"))}}function vo(n,t){if(n&1){let e=j();r(0,"a",19),D("click",function(){P(e);let o=p();return O(o.onTabChange("Product"))}),m(1," Product "),a()}if(n&2){let e=p();b("ngClass",ie(1,Et,e.tabState=="Product"))}}function _o(n,t){if(n&1){let e=j();r(0,"a",20),D("click",function(){P(e);let o=p();return O(o.onTabChange("Serial"))}),m(1," Serial "),a()}if(n&2){let e=p();b("ngClass",ie(1,Et,e.tabState=="Serial"))}}function Do(n,t){if(n&1&&(r(0,"div",13)(1,"div",27),M(2,"POS-variant-autocomplete",28),a()()),n&2){let e=p(2);l(2),b("formControl",e.variantAutocomplete)("isOnModalVariant",!0)}}function xo(n,t){if(n&1&&(r(0,"span"),m(1),a()),n&2){let e=p(2);l(),$("(",e.variant.UOMName,")")}}function So(n,t){if(n&1){let e=j();r(0,"div",23)(1,"strong")(2,"span"),m(3),a()(),r(4,"input",29),W("ngModelChange",function(o){P(e);let s=p(2);return L(s.variant.UnitQuantity,o)||(s.variant.UnitQuantity=o),O(o)}),D("ngModelChange",function(){P(e);let o=p(2);return O(o.onUnitQtyChange())}),a()()}if(n&2){let e=p(2);l(3),te(e.unitQtyLabel),l(),b("preventNegative",!0)("decimalPlaces",e.isSerialItem?0:4),U("ngModel",e.variant.UnitQuantity)}}function Mo(n,t){if(n&1){let e=j();r(0,"div",24)(1,"strong"),m(2,"Cost"),a(),r(3,"input",30,1),W("ngModelChange",function(o){P(e);let s=p(2);return L(s.variant.UnitPrice,o)||(s.variant.UnitPrice=o),O(o)}),D("ngModelChange",function(){P(e);let o=p(2);return O(o.onPriceChange())}),a()()}if(n&2){let e=p(2);l(3),b("simpleKeyboard",e.keyboard),U("ngModel",e.variant.UnitPrice)}}function Io(n,t){if(n&1){let e=j();r(0,"div",12),v(1,Do,3,2,"div",13),r(2,"div",13)(3,"div",21)(4,"strong"),m(5," Qty "),v(6,xo,2,1,"span"),a(),r(7,"input",22,0),W("ngModelChange",function(o){P(e);let s=p();return L(s.variant.Quantity,o)||(s.variant.Quantity=o),O(o)}),D("ngModelChange",function(){P(e);let o=p();return O(o.onQtyChange())}),a()(),v(9,So,5,4,"div",23),v(10,Mo,5,2,"div",24),a(),r(11,"div",13)(12,"div",25)(13,"POS-tinymce-editor",26),W("ngModelChange",function(o){P(e);let s=p();return L(s.variant.Note,o)||(s.variant.Note=o),O(o)}),a()()()()}if(n&2){let e=p();l(),_(e.isCreate?1:-1),l(5),_(e.variant.UOMName?6:-1),l(),b("simpleKeyboard",e.keyboard)("decimalPlaces",e.isSerialItem?0:4),U("ngModel",e.variant.Quantity),b("disabled",e.isEditBuyForm&&e.isSerialItem),l(2),_(e.unitQtyLabel?9:-1),l(),_(e.role.product.Cost?10:-1),l(3),U("ngModel",e.variant.Note)}}function Po(n,t){if(n&1&&(r(0,"div",44)(1,"div",33)(2,"strong"),m(3,"Discount Amount / Qty"),a()(),r(4,"div",34)(5,"div",46)(6,"p"),m(7),f(8,"number"),a()()()()),n&2){let e=p(2);l(7),te(g(8,1,e.variant.DiscountAmount))}}function Oo(n,t){if(n&1&&(r(0,"div",52)(1,"h5",58),m(2),f(3,"number"),a()()),n&2){let e=p(3);l(2),$(" ",g(3,1,e.variant.Discount),"% ")}}function To(n,t){if(n&1&&(r(0,"div",53)(1,"h5"),m(2),f(3,"number"),a(),r(4,"span",51),m(5,"x"),a(),r(6,"h5"),m(7),f(8,"number"),a()()),n&2){let e=p(3);l(2),te(g(3,2,e.variant.Quantity)),l(5),te(g(8,4,e.variant.DiscountAmount))}}function wo(n,t){if(n&1&&(r(0,"h5",56),m(1),f(2,"number"),a()),n&2){let e=p(3);l(),$(" -",g(2,1,e.totalBeforeDiscount()*(e.variant.Discount/100))," ")}}function No(n,t){if(n&1&&(r(0,"div",55)(1,"h5",56),m(2),f(3,"number"),a()()),n&2){let e=p(3);l(2),$(" -",g(3,1,e.variant.Quantity*e.variant.DiscountAmount)," ")}}function Eo(n,t){if(n&1&&(r(0,"div",57)(1,"div",59)(2,"h5"),m(3,"Grand Total"),a()(),r(4,"div",59)(5,"h5"),m(6),f(7,"number"),a()()()),n&2){let e=p(3);l(6),te(g(7,1,e.totalAfterDiscount()))}}function Fo(n,t){if(n&1&&(r(0,"div",45)(1,"div",47)(2,"h4"),m(3,"Discount Simulation"),a(),r(4,"h4",48),m(5),a()(),r(6,"div",49)(7,"div",33)(8,"div",50)(9,"h5"),m(10),f(11,"number"),a(),r(12,"span",51),m(13,"x"),a(),r(14,"h5"),m(15),f(16,"number"),a()(),v(17,Oo,4,3,"div",52),v(18,To,9,6,"div",53),a(),r(19,"div",33)(20,"div",54)(21,"h5"),m(22),f(23,"number"),a()(),r(24,"div",55),v(25,wo,3,3,"h5",56),a(),v(26,No,4,3,"div",55),a(),v(27,Eo,8,3,"div",57),a()()),n&2){let e=p(2);l(5),$(" ",e.variant==null?null:e.variant.Name," "),l(5),te(g(11,9,e.variant.Quantity)),l(5),te(g(16,11,e.variant.UnitPrice)),l(2),_(e.variant.Discount?17:-1),l(),_(e.variant.DiscountAmount>0?18:-1),l(4),te(g(23,13,e.totalBeforeDiscount())),l(3),_(e.variant.Discount?25:-1),l(),_(e.variant.DiscountAmount>0?26:-1),l(),_(e.variant.DiscountAmount>0||e.variant.Discount>0?27:-1)}}function Ao(n,t){if(n&1){let e=j();r(0,"div",13)(1,"div",31)(2,"div",32)(3,"div",33)(4,"strong"),m(5,"Discount %"),a()(),r(6,"div",34)(7,"input",35,2),W("ngModelChange",function(o){P(e);let s=p();return L(s.variant.Discount,o)||(s.variant.Discount=o),O(o)}),D("ngModelChange",function(){P(e);let o=p();return O(o.onDiscountChange())}),a()()(),r(9,"div",36)(10,"div",33)(11,"strong"),m(12,"Discount Amount"),a()(),r(13,"div",34)(14,"input",37,2),W("ngModelChange",function(o){P(e);let s=p();return L(s.inputedDiscountAmount,o)||(s.inputedDiscountAmount=o),O(o)}),D("ngModelChange",function(o){P(e);let s=p();return O(s.onDiscountAmountChange(o))}),a()()(),r(16,"div",38)(17,"div",39)(18,"input",40),W("ngModelChange",function(o){P(e);let s=p();return L(s.isDiscMultipliciedQty,o)||(s.isDiscMultipliciedQty=o),O(o)}),D("ngModelChange",function(){P(e);let o=p();return O(o.onSwitchDiscountTypeChange())}),a()(),r(19,"div",41)(20,"strong"),m(21,"*Quantity"),a(),r(22,"span",42),M(23,"i",43),a()()(),v(24,Po,9,3,"div",44),a(),v(25,Fo,28,15,"div",45),a()}if(n&2){let e=p();l(7),b("simpleKeyboard",e.keyboard),U("ngModel",e.variant.Discount),b("min",0)("readonly",!e.role.sell.Discount),l(7),b("simpleKeyboard",e.keyboard),U("ngModel",e.inputedDiscountAmount),b("max",e.variant.UnitPrice*e.variant.Quantity)("min",0)("readonly",!e.role.sell.Discount),l(4),U("ngModel",e.isDiscMultipliciedQty),l(6),_(e.isDiscMultipliciedQty()?-1:24),l(),_(e.role.product.Cost?25:-1)}}function ko(n,t){n&1&&(M(0,"i",65),r(1,"h6"),m(2,"No Image"),a())}function Vo(n,t){if(n&1&&M(0,"img",62),n&2){let e=p(2);b("src",e.variant.ThumbnailUrl,at)}}function $o(n,t){if(n&1){let e=j();r(0,"button",78),D("click",function(){P(e);let o=p(),s=p(2);return O(s.setQuantityToMax(o))}),m(1," Place Order "),a()}}function Ro(n,t){if(n&1&&(r(0,"tbody")(1,"tr")(2,"th",66),M(3,"i",67),m(4,"Inventory "),a(),r(5,"th",66),M(6,"i",68),m(7),a(),r(8,"th",66),M(9,"i",69),m(10," Diff "),a(),r(11,"th",66),M(12,"i",70),m(13," Action "),a()(),r(14,"tr")(15,"th",71),m(16,"On Hand"),a(),r(17,"td",72),m(18),f(19,"number"),a(),M(20,"td",73)(21,"td",74),a(),r(22,"tr")(23,"th",71),m(24,"Allocated"),a(),r(25,"td",72),m(26),f(27,"number"),a()(),r(28,"tr")(29,"th",71),m(30,"Available"),a(),r(31,"td",72),m(32),f(33,"number"),a()(),r(34,"tr")(35,"th",71),m(36,"ROP"),a(),r(37,"td",72),m(38),f(39,"number"),a(),r(40,"td",56),m(41),f(42,"number"),a()(),r(43,"tr")(44,"th",71),m(45,"Max"),a(),r(46,"td",72),m(47),f(48,"number"),a(),r(49,"td",75),m(50),f(51,"number"),a(),r(52,"td",76),v(53,$o,2,0,"button",77),a()()()),n&2){let e=t,i=p(2);l(7),$("",i.outletName," "),l(11),$(" ",g(19,12,e.onHand)," "),l(8),$(" ",g(27,14,e.allocated)," "),l(6),$(" ",g(33,16,e.onHand-e.allocated)," "),l(6),$(" ",g(39,18,e.rop)," "),l(3),He(" ",e.ropDiff>=0?"+":"","",g(42,20,e.ropDiff)," "),l(6),$(" ",g(48,22,e.max)," "),l(3),He(" ",e.maxDiff>=0?"+":"","",g(51,24,e.maxDiff)," "),l(2),b("ngClass",ie(26,bo,i.variant.Quantity==e.max-e.onHand-e.allocated)),l(),_(i.variant.Quantity!=e.max-e.onHand-e.allocated?53:-1)}}function Bo(n,t){if(n&1&&(r(0,"div",14)(1,"div",60)(2,"a",61),v(3,ko,3,0)(4,Vo,1,1,"img",62),a()(),r(5,"div",63)(6,"table",64),v(7,Ro,54,28,"tbody"),f(8,"async"),a()()()),n&2){let e,i=p();l(2),b("routerLink",Ht(6,Co))("queryParams",ie(7,yo,i.variant==null?null:i.variant.ID)),l(),_((i.variant==null?null:i.variant.ThumbnailUrl)==null?3:4),l(4),_((e=g(8,4,i.variantStock$))?7:-1,e)}}function jo(n,t){if(n&1){let e=j();r(0,"POS-tab-serial",79),W("variantChange",function(o){P(e);let s=p();return L(s.variant,o)||(s.variant=o),O(o)})("isFocusOnSerialInputChange",function(o){P(e);let s=p();return L(s.isFocusOnSerialInput,o)||(s.isFocusOnSerialInput=o),O(o)})("serialsChange",function(o){P(e);let s=p();return L(s.serials,o)||(s.serials=o),O(o)}),a()}if(n&2){let e=p();b("disabledEditQty",e.isEditBuyForm)("outletID",e.outletID),U("variant",e.variant)("isFocusOnSerialInput",e.isFocusOnSerialInput)("serials",e.serials)}}var pt=class n{constructor(t,e,i,o,s,T){this.dialogRef=t;this.http=i;this.role=o;this.toastr=T;this.config=new Ie,this.config.title=e.variant?.Name??"Add Variant",this.config.customWidth="700px",this.config.noPadding=!0,this.appConfigJSON=e.appConfigJSON,this.unitQtyLabel=this.appConfigJSON.ModuleSell.ProductDialog.UnitQtyLabel,this.numpadVisible=this.appConfigJSON.ModuleSell.NumPadVisible,this.numpadVisible&&(this.keyboard=s.keyboard),this.isEditBuyForm=e.isEdit,this.outletID=e.outletID,this.outletName=e.outletName,this.variant=e.variant;let R=this.appConfigJSON?.ModuleSell?.ProductDialog?.QuantityToOneInDialog?1:null;if(this.variant)this.isSerialItem=this.variant.TypeID==4,this.variantStock$=this.getOnInventory(),this.inputedDiscountAmount.set(this.variant.DiscountAmount),this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount();else{this.isCreate=!0,this.variant={Name:"",Quantity:R,UnitQuantity:1,OrderPrice:0,Total:0,Note:"",UnitPrice:0,ThumbnailUrl:"",UOMName:"",TypeID:0,Discount:0,ID:"",DiscountAmount:0,Serial:[]};let G=this.variantAutocomplete.valueChanges.pipe(V(c=>c.type=="Code"),d(c=>c.str),Y(c=>i.get(Ae.GetVariantByCode,[{key:"Code",value:c},{key:"EntityID",value:this.outletID},{key:"Promotion",value:!0}]).pipe(ye(()=>we))),d(c=>this.setUnitPrice(c)),d(c=>B(w({},c),{Quantity:R,Total:c.UnitPrice,Discount:c.PriceDiscount}))),x=this.variantAutocomplete.valueChanges.pipe(V(c=>c.type=="ID"),d(c=>c.str),Y(c=>i.get(Ae.GetVariantByID,[{key:"ID",value:c},{key:"EntityID",value:this.outletID},{key:"Promotion",value:!1}]).pipe(ye(()=>we))),d(c=>this.setUnitPrice(c)),d(c=>B(w({},c),{Quantity:R,Total:c.UnitPrice,Discount:c.PriceDiscount})));ot(G,x).pipe(E(c=>this.setFocusField("quantity")),X(1)).subscribe(c=>{this.variant=c,this.isSerialItem=this.variant.TypeID==4,this.showInventory=!0,this.variantStock$=this.getOnInventory(),this.inputedDiscountAmount.set(this.variant.DiscountAmount),this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount()})}}calculatorTab=qt(ri);variantAutocomplete=new ce;_quantityElement;variant;variantStock$=we;isSerialItem=!1;outletID;outletName;appConfigJSON;numpadVisible;keyboard;isEditBuyForm=!1;unitQtyLabel;config;tabState="Cart";isCreate=!1;showInventory=!1;serials=[];isFocusOnSerialInput=!1;_onGetInventory=new et(void 0);onGetInventory$=this._onGetInventory.asObservable();isDiscMultipliciedQty=Le(!0);totalBeforeDiscount=Le(0);totalAfterDiscount=Le(0);inputedDiscountAmount=Le(0);setFocusField(t){switch(t){case"quantity":this._quantityElement.nativeElement.focus();break}}onPriceChange(){this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount()}onQtyChange(){this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount()}onUnitQtyChange(){this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount()}onDiscountChange(){this.calculateTotalAfterDiscount(),this.calculateTotalAfterDiscount()}onDiscountAmountChange(t){this.calculateDiscountAmount(t),this.calculateTotalAfterDiscount()}onSwitchDiscountTypeChange(){this.calculateDiscAmountOnSwitch(),this.calculateTotalAfterDiscount()}calculateDiscountAmount(t){this.isDiscMultipliciedQty()?this.variant.DiscountAmount=t:this.variant.DiscountAmount=t/this.getQty()}calculateDiscAmountOnSwitch(){let t=this.variant.DiscountAmount,e=this.getQty();this.isDiscMultipliciedQty()?this.variant.DiscountAmount=t*e:this.variant.DiscountAmount=t/e}calculateTotalBeforeDiscount(){let t=this.variant.UnitPrice*this.getQty();this.totalBeforeDiscount.set(t)}calculateTotalAfterDiscount(){let t=this.totalBeforeDiscount()-this.getTotalDiscPercentage();this.validateDiscountAmount(t);let e=this.getTotalDiscAmount(),i=t-e;this.totalAfterDiscount.set(i)}validateDiscountAmount(t){let e=this.variant.Quantity%1===0;t>0&&this.variant.DiscountAmount>t&&e&&(this.variant.DiscountAmount=t)}getTotalDiscPercentage(){return this.variant.Discount?this.totalBeforeDiscount()*this.variant.Discount/100:0}getTotalDiscAmount(){return this.variant.DiscountAmount?this.variant.DiscountAmount*this.getQty():0}getQty(){return this.variant.Quantity*this.variant.UnitQuantity}onTabChange(t){this.tabState=t,t==="Calculator"&&(console.log(this.calculatorTab()?.priceInputNativeElement),setTimeout(()=>this.calculatorTab()?.priceInputNativeElement?.focus(),100))}ok(){if(!this.isFocusOnSerialInput){if(this.checkQuantityIsNull(),this.isSerialItem){if(this.serials.length){let i=this.serials.map(o=>({Quantity:1,Number:o}));this.variant.Serial=[...this.variant.Serial,...i]}let t=this.variant.Serial?.map(i=>i.Quantity).reduce((i,o)=>i+o,0)??0,e=this.variant.Quantity;t!=e&&this.toastr.warning("Serial Quantity must be equal to Variant Quantity","Warning"),this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount()}this.dialogRef.close(B(w({},this.variant),{Total:this.totalAfterDiscount()}))}}close(){this.dialogRef.close()}checkQuantityIsNull(){this.variant.Quantity==null&&(this.variant.Quantity=1)}setQuantityToMax(t){let e=t.onHand-t.allocated;t.max>=e?(this.variant.Quantity=t.max-e,this.toastr.success("Qty adjusted to Max Inventory","Success"),this.ok()):this.toastr.warning("Your Inventory Available is more than Max Inventory","Warning")}getOnInventory(){return this.onGetInventory$.pipe(zi((t,e)=>t?tt(t):this.http.get(Ae.GetVariantStockByID,[{key:"ID",value:this.variant.ID},{key:"EntityID",value:this.outletID}]).pipe(d(i=>{let o=i.OnHand-i.Allocated;return{onHand:i.OnHand,allocated:i.Allocated,rop:i.ROP,max:i.Max,maxDiff:i.Max-i.OnHand-o,ropDiff:i.ROP-i.OnHand-o}})),null),d(t=>t),X(1))}setUnitPrice(t){let e=w({},t);return S.IsNotEmpty(t.OrderPrice)?e.UnitPrice=t.OrderPrice:e.UnitPrice=t.UnitCost,e}static \u0275fac=function(e){return new(e||n)(u(Me),u(Fe),u(re),u(he),u(jn),u(qe))};static \u0275cmp=F({type:n,selectors:[["POS-modal-variant"]],viewQuery:function(e,i){if(e&1&&(Lt(i.calculatorTab,ri,5),Rt(go,5)),e&2){Qt();let o;Bt(o=jt())&&(i._quantityElement=o.first)}},decls:19,vars:20,consts:[["quantity",""],["price",""],["discount",""],[3,"onOk","onCancel","onClose","config"],[1,"container","w-100","h-100"],[1,"row","border-bottom","mx-5","mt-8"],["data-cy","input_sell",1,"btn","btn-link",3,"click","ngClass"],["data-cy","discount",1,"btn","btn-link",3,"ngClass"],["data-cy","product",1,"btn","btn-link",3,"ngClass"],["data-cy","serial",1,"btn","btn-link",3,"ngClass"],["data-cy","calculator",1,"btn","btn-link",3,"click","ngClass"],[1,"mx-8"],[1,"py-8"],[1,"row"],[1,"row","py-8"],[3,"disabledEditQty","outletID","variant","isFocusOnSerialInput","serials"],[3,"hidden"],["priceLabel","Cost",3,"discountTotal","priceTotal","qtyTotal","noteChanges","price","discount","quantity","notes","variantName"],["data-cy","discount",1,"btn","btn-link",3,"click","ngClass"],["data-cy","product",1,"btn","btn-link",3,"click","ngClass"],["data-cy","serial",1,"btn","btn-link",3,"click","ngClass"],[1,"col-auto","mb-4","pe-0",2,"width","82px"],["id","txtCartQuantity","keyboardType","number","type","text","autoNum","",1,"form-control","input-numpad",2,"height","38px",3,"ngModelChange","simpleKeyboard","decimalPlaces","ngModel","disabled"],[1,"col-auto","pe-0",2,"width","82px"],[1,"col-auto","pe-0",2,"width","112px"],[1,"col","tinymce"],["height","210px",3,"ngModelChange","ngModel"],[1,"col"],[3,"formControl","isOnModalVariant"],["type","text","autoNum","",1,"form-control","input-numpad",2,"height","38px",3,"ngModelChange","preventNegative","decimalPlaces","ngModel"],["id","inputPrice","keyboardType","number","type","text","autoNum","",1,"form-control",2,"height","38px",3,"ngModelChange","simpleKeyboard","ngModel"],[1,"col-6","border-end","py-8"],[1,"row","d-flex","align-items-center"],[1,"col-6"],[1,"col-auto","ps-0"],["id","inputDiscount","keyboardType","number","type","text","autoNum","","percentage","","decimalPlaces","2",1,"form-control",2,"width","112px","height","38px",3,"ngModelChange","simpleKeyboard","ngModel","min","readonly"],[1,"row","d-flex","align-items-center","mt-6"],["id","inputDiscount","keyboardType","number","type","text","autoNum","",1,"form-control",2,"width","112px","height","38px",3,"ngModelChange","simpleKeyboard","ngModel","max","min","readonly"],[1,"d-flex","align-items-center","mt-4"],[1,"form-check","form-switch","form-switch-lg","ms-1","mt-1"],["type","checkbox","id","flexSwitchCheckDefault",1,"form-check-input",3,"ngModelChange","ngModel"],[1,"ms-4"],["matTooltipPosition","above","matTooltip",`Use the final discount amount if you want to discount the price of the total
24
+ quantity of the product. The nominal will be calculated automatically and filled in the discount amount box.`,1,"pointer"],[1,"fa-solid","fa-info-circle","ms-2"],[1,"row","d-flex","align-items-center","justify-content-start","mt-4"],[1,"col-6","py-8"],[1,"border","ps-6",2,"height","38px","padding-top","10px","width","112px","background-color","#e9ecef"],[1,"w-100","text-center"],[1,"text-start","mt-12"],[1,"row","mt-12"],[1,"w-100","d-flex","align-items-center","justify-content-end"],[1,"mx-1","fw-bold"],[1,"d-flex","align-items-center","justify-content-end","mt-2"],[1,"d-flex","align-items-center","justify-content-end","mt-2","text-danger"],[1,"w-100","d-flex","justify-content-end"],[1,"w-100","d-flex","justify-content-end","mt-2"],[1,"text-danger"],[1,"row","border-top","mx-0","px-0","mt-4"],[1,"fw-bold","text-danger"],[1,"col-6","d-flex","justify-content-end","mt-4"],[1,"col-sm-4","d-flex","justify-content-center","flex-column","align-items-center","text-body-secondary"],["target","_blank",2,"color","inherit",3,"routerLink","queryParams"],[1,"border","rounded",3,"src"],[1,"col-sm-8"],[1,"table","table-bordered","text-center","inventory-table","w-auto"],["aria-hidden","true",1,"fa-solid","fa-image","fa-5x"],[1,"bg-light-orange"],["aria-hidden","true",1,"fa-box-archive","fa-solid","fa-1x","me-2"],["aria-hidden","true",1,"fa-solid","fa-house","fa-1x","me-2"],["aria-hidden","true",1,"fa-solid","fa-plus-minus","fa-1x","me-2"],["aria-hidden","true",1,"fa-solid","fa-sliders","fa-1x","me-2"],[1,"table-light","text-start"],[1,"text-end"],["rowspan","3",1,"table-light"],["rowspan","4",1,"table-light"],[1,"text-success"],[3,"ngClass"],["type","button","matTooltipPosition","above","matTooltip","Adjust Bought Qty to max Inventory",1,"btn","btn-success","btn-sm","me-2",2,"font-size","12px"],["type","button","matTooltipPosition","above","matTooltip","Adjust Bought Qty to max Inventory",1,"btn","btn-success","btn-sm","me-2",2,"font-size","12px",3,"click"],[3,"variantChange","isFocusOnSerialInputChange","serialsChange","disabledEditQty","outletID","variant","isFocusOnSerialInput","serials"]],template:function(e,i){e&1&&(r(0,"modal-material",3),D("onOk",function(){return i.ok()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"div",4)(3,"div",5)(4,"div")(5,"a",6),D("click",function(){return i.onTabChange("Cart")}),m(6," Cart "),a(),v(7,ho,2,3,"a",7),v(8,vo,2,3,"a",8),v(9,_o,2,3,"a",9),r(10,"a",10),D("click",function(){return i.onTabChange("Calculator")}),m(11," Calculator "),a()()(),r(12,"div",11),v(13,Io,14,9,"div",12),v(14,Ao,26,12,"div",13),v(15,Bo,9,9,"div",14),v(16,jo,1,5,"POS-tab-serial",15),r(17,"div",16)(18,"item-calculator-tab",17),D("discountTotal",function(s){return i.variant.Discount=s,i.onDiscountChange()})("priceTotal",function(s){return i.variant.UnitPrice=s,i.onPriceChange()})("qtyTotal",function(s){return i.variant.Quantity=s,i.onQtyChange()})("noteChanges",function(s){return i.variant.Note=s}),a()()()()()()),e&2&&(b("config",i.config),l(5),b("ngClass",ie(16,Et,i.tabState=="Cart")),l(2),_(!i.isCreate||i.showInventory?7:-1),l(),_(!i.isCreate||i.showInventory?8:-1),l(),_(i.isSerialItem?9:-1),l(),b("ngClass",ie(18,Et,i.tabState=="Calculator")),l(3),_(i.tabState=="Cart"?13:-1),l(),_(i.tabState=="Discount"?14:-1),l(),_(i.tabState=="Product"?15:-1),l(),_(i.tabState=="Serial"?16:-1),l(),b("hidden",i.tabState!="Calculator"),l(),b("price",i.variant.UnitPrice)("discount",i.variant.Discount)("quantity",i.variant.Quantity)("notes",i.variant.Note)("variantName",i.variant==null?null:i.variant.Name))},dependencies:[se,Ge,ai,oi,Se,be,Cn,ae,xe,Dt,Oe,Pe,st,ct,An,Yt,zt,Gn,Ln,li,Ye,ze,io,ri,Ee,De],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}p-chips[_ngcontent-%COMP%] ul.p-inputtext{width:570px;max-width:570px;border:1px solid #C8D3DF}p-chips[_ngcontent-%COMP%] ul.p-inputtext li.p-chips-input-token>input[type=text]{border:none}p-chips[_ngcontent-%COMP%] .p-chips .p-chips-multiple-container:not(.p-disabled):hover{border:1px solid #C8D3DF}p-chips[_ngcontent-%COMP%] .p-chips-multiple-container{display:inline-block}p-chips[_ngcontent-%COMP%] .p-chips-multiple-container .p-chips-token{margin:2px;background:#96bf48}.inventory-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .inventory-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{line-height:6px!important}.btn-link[_ngcontent-%COMP%]{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.selected[_ngcontent-%COMP%]{color:#3b3b3b;border-bottom:4px solid #07a519}.form-check-input[_ngcontent-%COMP%]{clear:left}.form-switch.form-switch-lg[_ngcontent-%COMP%] .form-check-input[_ngcontent-%COMP%]{height:1.5rem;width:2.75rem;border-radius:3rem}.form-check-input[_ngcontent-%COMP%]:focus{border-color:#89b03e!important}.form-check-input[_ngcontent-%COMP%]:checked{border-color:#89b03e!important;background-color:#89b03e!important}"]})};var Mt=class n extends no{connection;_Data=new Ui(1);Data=this._Data.asObservable();httpService=le(re);toastService=le(qe);_cache=new Map;previousCountByEpc={};_isConnected=new et(!1);isConnected=this._isConnected.asObservable();_bufferTime=new et(100);set bufferTime(t){this._bufferTime.next(t)}get bufferTime(){return this._bufferTime.getValue()}intializeWebSocket(t="/"){return yt(this,null,function*(){if(t.length<=0){this.toastService.error("RFID URL cannot be empty",ve.Error);return}if(!(this.connection&&this.connection.state===fn.Connected)){this.connection=new gn().withUrl(t).configureLogging(un.Information).withAutomaticReconnect().build();try{yield this.connection.start(),yield this.initiateGroupSubscription(),this.onWebSocketMessageReceived(),this._isConnected.next(!0),this.toastService.success("RFID Connected",ve.Success)}catch(e){throw this._isConnected.next(!1),this.toastService.error(JSON.stringify(e),ve.Error),new Error(JSON.stringify(e))}}})}initiateGroupSubscription(){return yt(this,null,function*(){try{yield this.connection.invoke("SubscribeGroup",{CurrentID:"Buy"})}catch(t){throw this.toastService.error(JSON.stringify(t),ve.Error),new Error(JSON.stringify(t))}})}onWebSocketMessageReceived(){this.connection.on("ReceiveSignal",t=>{this._Data.next(t)})}getVariantByCode(t,e=S.GuidEmpty){let i=[{key:"Code",value:t},{key:"EntityID",value:e}];return this.httpService.get(Ae.GetVariantByCode,i).pipe(ye(o=>o instanceof mn?tt(null):Ji(()=>new Error(o.message))))}processGroupedData(t=S.GuidEmpty){return this._Data.pipe(V(e=>e!==null&&e&&Object.keys(e).length>0),Hi(this._bufferTime.getValue()),Ni(e=>Wi(e)),Ki(e=>e.epc),Ni(e=>e.pipe(Tt((i,o)=>[...i,o],[]),Y(i=>{let o=e.key;if(this._cache.has(o))return this._cache.get(o).pipe(d(s=>({epc:o,items:i,response:s})));{let s=this.getVariantByCode(o,t).pipe(V(T=>T),E(T=>this._cache.set(o,tt(T))));return this._cache.set(o,s),s.pipe(d(T=>({epc:o,items:i,response:T})))}}))),Tt((e,i)=>{let o=this.previousCountByEpc&&this.previousCountByEpc[i.epc]||0,s=i.items.length,T=s-o;return e[i.epc]={data:i.items,count:T,variant:i.response},this.previousCountByEpc[i.epc]=s,e},{}),X({bufferSize:1,refCount:!0}))}constructor(){super(),this.connection&&(this.connection.onclose=t=>yt(this,null,function*(){console.error("SignalR connection closed:",t)}),this.connection.onreconnecting=t=>yt(this,null,function*(){console.warn("SignalR reconnecting:",t)}),this.connection.onreconnected=t=>yt(this,null,function*(){console.log("SignalR reconnected:",t)}))}static \u0275fac=function(e){return new(e||n)};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};function Qo(n,t){if(n&1&&(r(0,"td",7),m(1),a()),n&2){let e=p().$index;l(),$(" ",e+1,". ")}}function Uo(n,t){if(n&1&&(r(0,"div",10),M(1,"img",21),a()),n&2){let e=p().$implicit;l(),b("src",e.ThumbnailUrl,at)}}function Wo(n,t){n&1&&(r(0,"div",11),M(1,"i",22),a())}function Jo(n,t){if(n&1&&(r(0,"span"),m(1),f(2,"quantityFraction"),a()),n&2){let e=p().$implicit;l(),te(g(2,1,e.Quantity))}}function Ho(n,t){n&1&&(r(0,"span",17),m(1," x "),a())}function Go(n,t){if(n&1&&(r(0,"span"),m(1),f(2,"number"),a()),n&2){let e=p().$implicit;l(),te(g(2,1,e.UnitQuantity))}}function qo(n,t){n&1&&(r(0,"span",17),m(1," x "),a())}function Ko(n,t){if(n&1&&(r(0,"span"),m(1),f(2,"number"),a()),n&2){let e=p().$implicit;l(),te(g(2,1,e.UnitPrice))}}function zo(n,t){if(n&1&&(r(0,"div"),m(1),f(2,"number"),a()),n&2){let e=p().$implicit;l(),$("-",g(2,1,e.Discount),"%")}}function Yo(n,t){if(n&1&&(r(0,"div"),m(1),f(2,"number"),a()),n&2){let e=p().$implicit;l(),$("-",g(2,1,e.DiscountAmount))}}function Xo(n,t){if(n&1&&(m(0),f(1,"number")),n&2){let e=p().$implicit;$(" ",g(1,1,e.Total)," ")}}function Zo(n,t){n&1&&m(0," - ")}function ea(n,t){if(n&1){let e=j();r(0,"tr",6),D("contextmenu",function(){let o=P(e).$index,s=p(2);return O(s.onContextMenu(o))})("click",function(){let o=P(e),s=o.$implicit,T=o.$index,h=p(2);return O(h.update(s,T))}),v(1,Qo,2,1,"td",7),r(2,"td",8)(3,"div",9),v(4,Uo,2,1,"div",10)(5,Wo,2,0,"div",11),r(6,"div",12)(7,"div"),m(8),a(),r(9,"span",13),m(10),a(),M(11,"app-serial-note",14)(12,"small",15),a()()(),r(13,"td",16)(14,"span"),v(15,Jo,3,3,"span"),v(16,Ho,2,0,"span",17),v(17,Go,3,3,"span"),v(18,qo,2,0,"span",17),v(19,Ko,3,3,"span"),a()(),r(20,"td",18),v(21,zo,3,3,"div"),v(22,Yo,3,3,"div"),a(),r(23,"td",16),v(24,Xo,2,3)(25,Zo,1,0),a(),r(26,"td",19)(27,"i",20),D("click",function(){let o=P(e).$index,s=p(2);return O(s.deleteVariant(o))}),a()()()}if(n&2){let e=t.$implicit,i=p(2);b("cdkDragDisabled",!i.enabledDragDrop),l(),_(i.appConfigJSON!=null&&i.appConfigJSON.ModuleBuy.Grid.RowNumberVisible?1:-1),l(),vt("ps-0",i.appConfigJSON==null?null:i.appConfigJSON.ModuleBuy.Grid.RowNumberVisible),l(2),_(e.ThumbnailUrl?4:5),l(4),te(e.Name),l(2),te(e.Code),l(),b("serials",e.Serial),l(),b("innerHtml",e.Note,Yi),l(3),_(e.Quantity!=1||e.UnitQuantity>1?15:-1),l(),_(e.UnitQuantity>1||e.UnitQuantity<=-1?16:-1),l(),_(e.UnitQuantity>1||e.UnitQuantity<=-1?17:-1),l(),_((e.Quantity>1||e.Quantity<=-1)&&i.role.product.Cost?18:-1),l(),_((e.Quantity>1||e.Quantity<=-1||e.Discount>0||e.DiscountAmount>0)&&i.role.product.Cost?19:-1),l(2),_(e.Discount?21:-1),l(),_(e.DiscountAmount?22:-1),l(2),_(i.role.product.Cost?24:25)}}function ta(n,t){if(n&1){let e=j();r(0,"div",1)(1,"table",3)(2,"tbody",4),D("cdkDropListDropped",function(o){P(e);let s=p();return O(s.drop(o))}),Ue(3,ea,28,17,"tr",5,Qe),a()()()}if(n&2){let e=p(),i=ht(3);b("cdkContextMenuTriggerFor",i),l(3),We(e.cart)}}function ia(n,t){n&1&&(r(0,"div",2)(1,"div",23)(2,"div",24)(3,"div",25)(4,"div",26),M(5,"i",27),a(),r(6,"div",28)(7,"span"),m(8,"Empty Cart"),a(),M(9,"br"),r(10,"span"),m(11,"Add products to the cart"),a(),M(12,"br"),r(13,"span"),m(14,"or scan barcode"),a()()()()()())}function na(n,t){if(n&1){let e=j();r(0,"button",31),D("click",function(){P(e);let o=p(2);return O(o.onReturn())}),m(1," Return "),a()}}function oa(n,t){if(n&1){let e=j();r(0,"div",29),v(1,na,2,0,"button",30),r(2,"button",31),D("click",function(){P(e);let o=p();return O(o.onPurchase())}),m(3," Purchase "),a()()}if(n&2){let e=p();l(),_(e.role.sell.Return?1:-1)}}var mi=class n{constructor(t,e,i,o,s,T){this.cartService=t;this.matDialog=e;this.role=i;this.form=o;this.sf=T}cart=[];appConfigJSON;isEdit;outletID;outletName;RFIDService=le(Mt);outletService=le(H);enabledDragDrop=!0;onOpenContextMenuIndex=-1;ngOnInit(){this.initDragDropEnabled(),this.outletService.outlet.valueChanges.pipe(Y(t=>this.RFIDService.processGroupedData(t.ID)),E(t=>this.cartService.addCartRFID(t))).subscribe()}initDragDropEnabled(){S.isMobileDevice&&(this.enabledDragDrop=!1)}deleteVariant(t){this.cartService.deleteVariant(t)}drop(t){this.cartService.dragDropCart(t)}onContextMenu(t){this.onOpenContextMenuIndex=t}onReturn(){this.cartService.returnVariant(this.onOpenContextMenuIndex)}onPurchase(){this.cartService.purchaseVariant(this.onOpenContextMenuIndex)}update(t,e){let i=w({},t);this.matDialog.open(pt,{data:{variant:i,appConfigJSON:this.appConfigJSON,isEdit:this.isEdit,outletID:this.outletID,outletName:this.outletName,deliveryEntityID:this.form.deliveryEntityID.value}}).afterClosed().pipe(V(o=>!!o)).subscribe(o=>{this.cartService.updateVariant(o,e),this.sf.searchFilterNativeEl.focus()})}static \u0275fac=function(e){return new(e||n)(u(ee),u(Z),u(he),u(H),u(ii),u(Nt))};static \u0275cmp=F({type:n,selectors:[["POS-cart-display"]],inputs:{cart:"cart",appConfigJSON:"appConfigJSON",isEdit:"isEdit",outletID:"outletID",outletName:"outletName"},decls:4,vars:1,consts:[["context_menu",""],[3,"cdkContextMenuTriggerFor"],[1,"row","g-0","h-100"],[1,"table","table-borderless"],["cdkDropList","",3,"cdkDropListDropped"],["cdkDrag","",1,"border-bottom",3,"cdkDragDisabled"],["cdkDrag","",1,"border-bottom",3,"contextmenu","click","cdkDragDisabled"],[2,"width","10px"],[2,"width","50%"],[1,"d-flex"],[1,"ratio","ratio-1x1",2,"width","55px"],[1,"item-image","d-flex","justify-content-center","align-items-center","text-center","fs-1"],[1,"ms-4","d-flex","flex-column","justify-content-center",2,"line-height","18px"],[1,"fw-normal","fs-6","text-muted"],[3,"serials"],["title","Note",1,"special-TinyMCE","m-0","fst-italic","d-block",3,"innerHtml"],[1,"text-end"],[1,"fs-6"],[1,"text-end","text-danger"],[1,"text-end",2,"width","75px"],[1,"fa-solid","fa-trash","fs-4","text-danger","pointer",3,"click"],[1,"item-image",3,"src"],[1,"fa-solid","fa-image",2,"color","#b4b4b4c2"],[1,"col-12"],[1,"d-flex","justify-content-center","align-items-center","h-100"],[1,"row"],[1,"col-12","d-flex","justify-content-center"],[1,"fa-regular","fa-cart-arrow-up","text-secondary",2,"font-size","110px"],[1,"col-12","justify-content-center","text-center","mt-5","empty-cart-description","text-secondary","headings-font-family"],["cdkMenu","",1,"example-menu"],["cdkMenuItem","",1,"example-menu-item"],["cdkMenuItem","",1,"example-menu-item",3,"click"]],template:function(e,i){e&1&&(v(0,ta,5,1,"div",1)(1,ia,15,0,"div",2),ut(2,oa,4,1,"ng-template",null,0,Gt)),e&2&&_(i.cart.length?0:1)},dependencies:[se,On,Pn,In,to,Zn,Xn,eo,Bn,De,ei],styles:[".item-image[_ngcontent-%COMP%]{height:50px;width:56px;display:block;border:solid 1px #dddddd;border-radius:5px;object-fit:contain}.example-menu[_ngcontent-%COMP%]{display:inline-flex;flex-direction:column;min-width:180px;max-width:280px;background-color:#fff;padding:6px 0}.example-menu-item[_ngcontent-%COMP%]{background-color:transparent;cursor:pointer;border:none;-webkit-user-select:none;user-select:none;min-width:64px;line-height:36px;padding:0 16px;display:flex;align-items:center;flex-direction:row;flex:1}.example-menu-item[_ngcontent-%COMP%]:hover{background-color:#f5f5f5}.example-menu-item[_ngcontent-%COMP%]:active{background-color:#dcdcdc}.table[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:not(caption) > *[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{padding:12px 10px} .cdk-menu.cdk-menu-group.example-menu{box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.empty-cart-description[_ngcontent-%COMP%]{font-size:14px;font-weight:500;color:#c7c7c7}"]})};var pi=class n{constructor(t,e){this.dialogRef=t;this.data=e;this.config.title="Return",this.invoiceNumber=e.invoiceNumber}config=new Ie;invoiceNumber;ok(){this.dialogRef.close(this.invoiceNumber)}static \u0275fac=function(e){return new(e||n)(u(Me),u(Fe))};static \u0275cmp=F({type:n,selectors:[["POS-modal-return-invoice"]],decls:6,vars:2,consts:[[3,"onOk","onCancel","onClose","config"],[1,"form-floating-outline","m-0"],["type","text","id","invoiceNumber","name","invoiceNumber",1,"form-control",3,"ngModelChange","ngModel"],["for","invoiceNumber"]],template:function(e,i){e&1&&(r(0,"modal-material",0),D("onOk",function(){return i.ok()})("onCancel",function(){return i.dialogRef.close()})("onClose",function(){return i.dialogRef.close()}),r(1,"content")(2,"div",1)(3,"input",2),W("ngModelChange",function(s){return L(i.invoiceNumber,s)||(i.invoiceNumber=s),s}),a(),r(4,"label",3),m(5,"Supplier Bill"),a()()()()),e&2&&(b("config",i.config),l(3),U("ngModel",i.invoiceNumber))},dependencies:[Se,be,ae,xe,Oe,Pe],encapsulation:2})};var di=class n{constructor(t){this.matDialog=t}invoiceNumber;disabled=!1;onChange=t=>{};onTouched=()=>{};writeValue(t){this.invoiceNumber=t}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}openModalReturnInvoice(){this.matDialog.open(pi,{data:{invoiceNumber:this.invoiceNumber}}).afterClosed().pipe(V(t=>!!t)).subscribe(t=>{this.invoiceNumber=t,this.onChange(this.invoiceNumber)})}static \u0275fac=function(e){return new(e||n)(u(Z))};static \u0275cmp=F({type:n,selectors:[["POS-return-invoice"]],features:[Ne([{provide:Ke,multi:!0,useExisting:n}])],decls:1,vars:0,consts:[["icon","fa-solid fa-file-invoice","label","Return Bill",3,"click"]],template:function(e,i){e&1&&(r(0,"POS-dropdown-item-more-action",0),D("click",function(){return i.openModalReturnInvoice()}),a())},dependencies:[Zt,ke],encapsulation:2})};var ui=class n{constructor(t){this.cart=t}returnCart(){this.cart.returnCart()}static \u0275fac=function(e){return new(e||n)(u(ee))};static \u0275cmp=F({type:n,selectors:[["POS-return-cart"]],decls:1,vars:0,consts:[["icon","fa-cart-shopping fa-solid","label","Return Cart",3,"click"]],template:function(e,i){e&1&&(r(0,"POS-dropdown-item-more-action",0),D("click",function(){return i.returnCart()}),a())},dependencies:[ke],encapsulation:2})};var fi=class n{constructor(t){this.cart=t}clearCart(){this.cart.clearCart()}static \u0275fac=function(e){return new(e||n)(u(ee))};static \u0275cmp=F({type:n,selectors:[["POS-clear-cart"]],decls:1,vars:0,consts:[["icon","fa-trash fa-solid","label","Clear",3,"click"]],template:function(e,i){e&1&&(r(0,"POS-dropdown-item-more-action",0),D("click",function(){return i.clearCart()}),a())},dependencies:[ke],encapsulation:2})};var gi=class n{constructor(t,e){this.matDialog=t;this.cart=e}appConfigJSON;isEditBuyForm;outletID;outletName;addVariant(){this.matDialog.open(pt,{data:{appConfigJSON:this.appConfigJSON,isEdit:this.isEditBuyForm,outletID:this.outletID,outletName:this.outletName}}).afterClosed().pipe(V(t=>!!t)).subscribe(t=>this.cart.addVariant(t))}static \u0275fac=function(e){return new(e||n)(u(Z),u(ee))};static \u0275cmp=F({type:n,selectors:[["POS-add-variant"]],inputs:{appConfigJSON:"appConfigJSON",isEditBuyForm:"isEditBuyForm",outletID:"outletID",outletName:"outletName"},decls:1,vars:0,consts:[["icon","fa-circle-plus fa-solid","label","Add",3,"click"]],template:function(e,i){e&1&&(r(0,"POS-dropdown-item-more-action",0),D("click",function(){return i.addVariant()}),a())},dependencies:[ke],encapsulation:2})};var Ci=class n{constructor(t,e){this.matDialog=t;this.cart=e}outletID;uploadCart(){this.matDialog.open(qn,{data:{sampleUrl:dn.files.csv.buy_import,outletID:this.outletID,fileEndpoint:"/API/Buy/UploadCsvV2",useUppy:!0}}).afterClosed().pipe(V(t=>!!t),d(t=>t.map(e=>B(w({},e.Variant),{UnitPrice:e.Cost,Total:e.Cost*e.Quantity*(1-e.Discount/100)-e.DiscountAmount,Quantity:e.Quantity,Serial:e.Serial,Note:e.Note,Discount:e.Discount,DiscountAmount:e.DiscountAmount})))).subscribe(t=>this.cart.uploadCart(t))}static \u0275fac=function(e){return new(e||n)(u(Z),u(ee))};static \u0275cmp=F({type:n,selectors:[["POS-upload-cart"]],inputs:{outletID:"outletID"},decls:1,vars:0,consts:[["icon","fa-upload fa-solid","label","Upload",3,"click"]],template:function(e,i){e&1&&(r(0,"POS-dropdown-item-more-action",0),D("click",function(){return i.uploadCart()}),a())},dependencies:[ke],encapsulation:2})};var aa=["serialInput"],yi=class n{constructor(t,e,i){this.dialogRef=t;this.toastr=e;this.cart=i;this.modalConfig.title="Scan Serial",this.modalConfig.customWidth="350px",this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0}serialInputEl;modalConfig=new Ie;serial;ngOnInit(){}onKeyDown(t){t.key=="Enter"&&(S.IsNotEmpty(this.serial)?(this.cart.addVariantThroughSerial(this.serial),this.serial=null):this.toastr.warning("Serial Can`t be empty","Warning!"),this.setFocusInput())}setFocusInput(){this.serialInputEl&&setTimeout(()=>{this.serialInputEl?.nativeElement?.focus()},500)}static \u0275fac=function(e){return new(e||n)(u(Me),u(qe),u(ee))};static \u0275cmp=F({type:n,selectors:[["POS-modal-scan-serial"]],viewQuery:function(e,i){if(e&1&&Rt(aa,5),e&2){let o;Bt(o=jt())&&(i.serialInputEl=o.first)}},decls:7,vars:2,consts:[["serialInput",""],[3,"onClose","config"],[1,"input-group","mt-3"],["type","text","placeholder","Input Product By Serial","aria-label","Serial",1,"form-control",3,"ngModelChange","keydown","ngModel"],[1,"input-group-text"],[1,"fa-solid","fa-barcode","fs-4"]],template:function(e,i){if(e&1){let o=j();r(0,"modal-material",1),D("onClose",function(){return P(o),O(i.dialogRef.close())}),r(1,"content")(2,"div",2)(3,"input",3,0),W("ngModelChange",function(T){return P(o),L(i.serial,T)||(i.serial=T),O(T)}),D("keydown",function(T){return P(o),O(i.onKeyDown(T))}),a(),r(5,"span",4),M(6,"i",5),a()()()()}e&2&&(b("config",i.modalConfig),l(3),U("ngModel",i.serial))},dependencies:[Se,be,ae,xe,Oe,Pe],styles:["input[_ngcontent-%COMP%]{height:55px;border-bottom-left-radius:4px;border-top-left-radius:4px}span.input-group-text[_ngcontent-%COMP%]{border-bottom-right-radius:4px;border-top-right-radius:4px}"]})};var bi=class n{constructor(t,e){this.matDialog=t;this.viewContainerRef=e}scanSerial(){this.matDialog.open(yi,{viewContainerRef:this.viewContainerRef})}static \u0275fac=function(e){return new(e||n)(u(Z),u(en))};static \u0275cmp=F({type:n,selectors:[["POS-scan-serial"]],decls:1,vars:0,consts:[["icon","fa-barcode-read fa-solid","label","Serial",3,"click"]],template:function(e,i){e&1&&(r(0,"POS-dropdown-item-more-action",0),D("click",function(){return i.scanSerial()}),a())},dependencies:[ke],encapsulation:2})};var ra=n=>({disabled:n}),la=(n,t)=>({red:n,green:t}),hi=class n{RFIDService=le(Mt);matDialog=le(Z);constructor(){}onOpenModal(){this.matDialog.open(oo).componentInstance.onOK.pipe($n("onPayload"),E(({hostURL:e,bufferTime:i})=>{this.RFIDService.bufferTime=i,this.RFIDService.intializeWebSocket(e)}),X(1)).subscribe()}ngOnInit(){}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=F({type:n,selectors:[["pos-rfid-buy-action"]],decls:8,vars:13,consts:[[1,"dropdown-item","px-1","d-flex",3,"click","ngClass"],["aria-hidden","true",1,"fa-solid","fa-wifi","fs-2"],[1,"pe-0","ps-4","fs-6"],[1,"blob",2,"position","absolute","top","0","right","0",3,"ngClass"]],template:function(e,i){e&1&&(r(0,"div",0),f(1,"async"),D("click",function(){return i.onOpenModal()}),M(2,"i",1),r(3,"label",2),m(4,"Connect RFID"),a(),M(5,"div",3),f(6,"async"),f(7,"async"),a()),e&2&&(b("ngClass",ie(8,ra,g(1,2,i.RFIDService.isConnected))),l(5),b("ngClass",_t(10,la,!g(6,4,i.RFIDService.isConnected),g(7,6,i.RFIDService.isConnected))))},dependencies:[se,Ge,Ee],styles:[".disabled[_ngcontent-%COMP%]{color:gray;pointer-events:none;cursor:not-allowed}.blob[_ngcontent-%COMP%]{background:#000;border-radius:50%;box-shadow:0 0 #000;height:15px;width:15px;transform:scale(1);animation:_ngcontent-%COMP%_pulse-black 2s infinite}@keyframes _ngcontent-%COMP%_pulse-black{0%{transform:scale(.95);box-shadow:0 0 #000000b3}70%{transform:scale(1);box-shadow:0 0 0 10px #0000}to{transform:scale(.95);box-shadow:0 0 #0000}}.blob.white[_ngcontent-%COMP%]{background:#fff;box-shadow:0 0 #fff;animation:_ngcontent-%COMP%_pulse-white 2s infinite}@keyframes _ngcontent-%COMP%_pulse-white{0%{transform:scale(.95);box-shadow:0 0 #ffffffb3}70%{transform:scale(1);box-shadow:0 0 0 10px #fff0}to{transform:scale(.95);box-shadow:0 0 #fff0}}.blob.red[_ngcontent-%COMP%]{background:#ff5252;box-shadow:0 0 #ff5252;animation:_ngcontent-%COMP%_pulse-red 2s infinite}@keyframes _ngcontent-%COMP%_pulse-red{0%{transform:scale(.95);box-shadow:0 0 #ff5252b3}70%{transform:scale(1);box-shadow:0 0 0 10px #ff525200}to{transform:scale(.95);box-shadow:0 0 #ff525200}}.blob.orange[_ngcontent-%COMP%]{background:#ff793f;box-shadow:0 0 #ff793f;animation:_ngcontent-%COMP%_pulse-orange 2s infinite}@keyframes _ngcontent-%COMP%_pulse-orange{0%{transform:scale(.95);box-shadow:0 0 #ff793fb3}70%{transform:scale(1);box-shadow:0 0 0 10px #ff793f00}to{transform:scale(.95);box-shadow:0 0 #ff793f00}}.blob.yellow[_ngcontent-%COMP%]{background:#ffb142;box-shadow:0 0 #ffb142;animation:_ngcontent-%COMP%_pulse-yellow 2s infinite}@keyframes _ngcontent-%COMP%_pulse-yellow{0%{transform:scale(.95);box-shadow:0 0 #ffb142b3}70%{transform:scale(1);box-shadow:0 0 0 10px #ffb14200}to{transform:scale(.95);box-shadow:0 0 #ffb14200}}.blob.blue[_ngcontent-%COMP%]{background:#34ace0;box-shadow:0 0 #34ace0;animation:_ngcontent-%COMP%_pulse-blue 2s infinite}@keyframes _ngcontent-%COMP%_pulse-blue{0%{transform:scale(.95);box-shadow:0 0 #34ace0b3}70%{transform:scale(1);box-shadow:0 0 0 10px #34ace000}to{transform:scale(.95);box-shadow:0 0 #34ace000}}.blob.green[_ngcontent-%COMP%]{background:#77d933;box-shadow:0 0 #77d933;animation:_ngcontent-%COMP%_pulse-green 2s infinite}@keyframes _ngcontent-%COMP%_pulse-green{0%{transform:scale(.95);box-shadow:0 0 #33d938b3}70%{transform:scale(1);box-shadow:0 0 0 10px #33d9b200}to{transform:scale(.95);box-shadow:0 0 #33d9b200}}.blob.purple[_ngcontent-%COMP%]{background:#8e44ad;box-shadow:0 0 #8e44ad;animation:_ngcontent-%COMP%_pulse-purple 2s infinite}@keyframes _ngcontent-%COMP%_pulse-purple{0%{transform:scale(.95);box-shadow:0 0 #8e44adb3}70%{transform:scale(1);box-shadow:0 0 0 10px #8e44ad00}to{transform:scale(.95);box-shadow:0 0 #8e44ad00}}"],changeDetection:0})};function sa(n,t){n&1&&(r(0,"li",10),M(1,"POS-return-cart"),a())}function ca(n,t){if(n&1&&(r(0,"li",10),M(1,"POS-return-invoice",14),a()),n&2){let e=p(2);l(),b("formControl",e.returnInvoiceNumber)}}function ma(n,t){if(n&1&&(r(0,"div",7)(1,"div",8),m(2,"Order"),a(),M(3,"div",9),v(4,sa,2,0,"li",10),v(5,ca,2,1,"li",10),a()),n&2){let e=p();l(4),_(e.role.sell.Return?4:-1),l(),_(e.role.sell.Return?5:-1)}}var vi=class n{constructor(t,e,i){this.role=t;this.matDialog=e;this.cart=i}returnInvoiceNumber=new ce("");appConfigJSON;isEditBuyForm;outletID;outletName;handleKeyboardEvent(t){t.key==="F4"&&this.matDialog.openDialogs.length===0&&this.addVariant()}addVariant(){this.matDialog.open(pt,{data:{appConfigJSON:this.appConfigJSON,isEdit:this.isEditBuyForm,outletID:this.outletID,outletName:this.outletName}}).afterClosed().pipe(V(t=>!!t)).subscribe(t=>this.cart.addVariant(t))}static \u0275fac=function(e){return new(e||n)(u(he),u(Z),u(ee))};static \u0275cmp=F({type:n,selectors:[["POS-more-actions"]],hostBindings:function(e,i){e&1&&D("keydown",function(s){return i.handleKeyboardEvent(s)},Xi)},inputs:{returnInvoiceNumber:"returnInvoiceNumber",appConfigJSON:"appConfigJSON",isEditBuyForm:"isEditBuyForm",outletID:"outletID",outletName:"outletName"},decls:27,vars:6,consts:[["id","moreMenu","data-bs-toggle","dropdown",1,"d-flex","align-items-center","cursor-pointer"],[1,"me-2"],[1,"fa-solid","fa-caret-down","fa-lg"],[1,"fs-6","headings-font-family","pb-1"],[1,"h-100","d-flex","align-items-center","justify-content-between"],["aria-labelledby","moreMenu",1,"dropdown-menu","more-actions"],[1,"d-flex",2,"width","30rem"],[1,"dropdown-header","text-dark","col"],[1,"h5","mb-4"],[1,"dropdown-divider","m-0"],[1,"cursor-pointer"],[3,"appConfigJSON","isEditBuyForm","outletID","outletName"],[3,"outletID"],[1,"cursor-pointer","position-relative"],[3,"formControl"]],template:function(e,i){e&1&&(r(0,"span",0)(1,"span",1),M(2,"i",2),a(),r(3,"span",3),m(4,"More Actions"),a()(),r(5,"div",4)(6,"div",5)(7,"div",6),v(8,ma,6,2,"div",7),r(9,"div",7)(10,"div",8),m(11,"Item"),a(),M(12,"div",9),r(13,"li",10),M(14,"POS-add-variant",11),a(),r(15,"li",10),M(16,"POS-scan-serial"),a(),r(17,"li",10),M(18,"POS-upload-cart",12),a(),r(19,"li",10),M(20,"POS-clear-cart"),a()(),r(21,"div",7)(22,"div",8),m(23,"Advanced"),a(),M(24,"div",9),r(25,"li",13),M(26,"pos-rfid-buy-action"),a()()()()()),e&2&&(l(8),_(i.role.sell.Return?8:-1),l(6),b("appConfigJSON",i.appConfigJSON)("isEditBuyForm",i.isEditBuyForm)("outletID",i.outletID)("outletName",i.outletName),l(4),b("outletID",i.outletID))},dependencies:[Ye,ae,ze,di,ui,fi,gi,Ci,bi,hi],encapsulation:2})};var _i=class n{constructor(t,e){this.dialogRef=t;this.config.title="Discount and Tax",this.config.customWidth="400px";let i=e.discount;this.discountAmount=i.Amount,this.discountPercentage=i.Percentage;let o=e.tax;this.taxID=o.ID,this.taxRate=o.Rate,this.taxType=o.CalculationTypeName,this.taxLabel=o.Label,this.taxes=e.taxes.filter(s=>!s.Bin),this.currencySymbol=e.currencySymbol}config=new Ie;tabIndexActive;discountAmount=0;discountPercentage=0;taxes=[];taxID="";taxRate=0;taxType="";taxLabel="";discounts=[];currencySymbol="";ok(){this.dialogRef.close({Discount:{Amount:this.discountAmount,Percentage:this.discountPercentage},Tax:{ID:this.taxID,Rate:this.taxRate,CalculationTypeName:this.taxType,Label:this.taxLabel,Discontinue:!1}})}close(){this.dialogRef.close()}calculateDiscountCalculator(){let t=100;this.discounts.forEach(e=>{t=t*(100-e)/100}),this.discountPercentage=100-t}updateTax(t){this.taxID=t.ID,this.taxRate=t.Rate,this.taxType=t.CalculationTypeName,this.taxLabel=t.Label}static \u0275fac=function(e){return new(e||n)(u(Me),u(Fe))};static \u0275cmp=F({type:n,selectors:[["POS-modal-discount-and-tax"]],decls:48,vars:10,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],["matTooltipPosition","above","matTooltip","Discount","tabTitle","Discount"],[1,"row","d-flex","align-items-center","justify-content-start"],[1,"col-3"],[1,"fw-bold","d-block"],[1,"col-9"],["type","text","data-cy","discount1","autoNum","","percentage","","decimalPlaces","2",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","ngModel"],[1,"ms-1"],[1,"row","d-flex","align-items-center","justify-content-start","mt-6"],["type","text","data-cy","discountamount","autoNum","",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","ngModel"],["matTooltipPosition","above","matTooltip","Tax","tabTitle","Tax"],["bindLabel","Label","appendTo","body","bindValue","ID","placeholder","Tax","data-cy","Tax",2,"width","150px",3,"change","clearable","ngModel","items"],["matTooltipPosition","above","matTooltip","Calculation","tabTitle","Calculator"],[1,"row","mt-6","g-0","d-flex","align-items-center","justify-content-start"],[1,"col-4"],[1,"col-8","ps-4"],["type","text","data-cy","discountCal1","autoNum","","percentage","","decimalPlaces","2",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],[1,"mx-2"],["type","text","data-cy","discountCal2","autoNum","","percentage","","decimalPlaces","2",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],["type","text","data-cy","discountCal3","autoNum","","percentage","","decimalPlaces","2",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(r(0,"modal-material",0),D("keydown.F2",function(){return i.ok()})("onOk",function(){return i.ok()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"div",1)(3,"custom-tabs"),Vt(4),r(5,"tab",2)(6,"div",3)(7,"div",4)(8,"label",5),m(9,"Discount %"),a()(),r(10,"div",6)(11,"input",7),W("ngModelChange",function(s){return L(i.discountPercentage,s)||(i.discountPercentage=s),s}),a(),r(12,"span",8),m(13,"%"),a()()(),r(14,"div",9)(15,"div",4)(16,"label",5),m(17),a()(),r(18,"div",6)(19,"input",10),W("ngModelChange",function(s){return L(i.discountAmount,s)||(i.discountAmount=s),s}),a()()()(),$t(),Vt(20),r(21,"tab",11)(22,"div",3)(23,"div",4)(24,"label",5),m(25,"Tax"),a()(),r(26,"div",6)(27,"ng-select",12),D("change",function(s){return i.updateTax(s)}),a()()()(),$t(),Vt(28),r(29,"tab",13)(30,"div",14)(31,"div",15)(32,"label",5),m(33,"Discount Calculator"),a()(),r(34,"div",16)(35,"input",17),W("ngModelChange",function(s){return L(i.discounts[0],s)||(i.discounts[0]=s),s}),D("ngModelChange",function(){return i.calculateDiscountCalculator()}),a(),r(36,"span"),m(37," %"),a(),r(38,"span",18),m(39,"+"),a(),r(40,"input",19),W("ngModelChange",function(s){return L(i.discounts[1],s)||(i.discounts[1]=s),s}),D("ngModelChange",function(){return i.calculateDiscountCalculator()}),a(),r(41,"span"),m(42," %"),a(),r(43,"span",18),m(44,"+"),a(),r(45,"input",20),W("ngModelChange",function(s){return L(i.discounts[2],s)||(i.discounts[2]=s),s}),D("ngModelChange",function(){return i.calculateDiscountCalculator()}),a(),r(46,"span"),m(47," %"),a()()()(),$t(),a()()()()),e&2&&(b("config",i.config),l(11),U("ngModel",i.discountPercentage),l(6),$("Discount ",i.currencySymbol),l(2),U("ngModel",i.discountAmount),l(8),b("clearable",!1)("ngModel",i.taxID)("items",i.taxes),l(8),U("ngModel",i.discounts[0]),l(5),U("ngModel",i.discounts[1]),l(5),U("ngModel",i.discounts[2]))},dependencies:[Se,be,ae,xe,Dt,Oe,Pe,Wn,Hn,Jn,st,ct,lt,rt,xt],encapsulation:2})};var Di=class n{constructor(t){this.matDialog=t}taxes=[];currencySymbol="";discTax;disabled=!1;onChange=t=>{};onTouched=()=>{};writeValue(t){this.discTax=t}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}openModalDiscountAndTax(){this.matDialog.open(_i,{data:{discount:w({},this.discTax.Discount),tax:w({},this.discTax.Tax),taxes:this.taxes,currencySymbol:this.currencySymbol}}).afterClosed().pipe(V(t=>!!t)).subscribe(t=>{this.discTax.Discount=w({},t.Discount),this.discTax.Tax=w({},t.Tax),this.onChange(this.discTax)})}static \u0275fac=function(e){return new(e||n)(u(Z))};static \u0275cmp=F({type:n,selectors:[["POS-discount-and-tax-form"]],inputs:{taxes:"taxes",currencySymbol:"currencySymbol"},features:[Ne([{provide:Ke,multi:!0,useExisting:n}])],decls:2,vars:0,consts:[["type","button","matTooltip","Discount / Tax","matTooltipPosition","above",1,"btn","btn-success","fs-5",2,"border-right","0.1px solid #fff",3,"click"],[1,"fa-light","fa-percent"]],template:function(e,i){e&1&&(r(0,"button",0),D("click",function(){return i.openModalDiscountAndTax()}),M(1,"i",1),a())},dependencies:[lt,rt,Zt],styles:["button[_ngcontent-%COMP%]{border-right:.1px solid #fff;border-top-right-radius:0;border-bottom-right-radius:0;position:relative;flex:1 1 auto}"]})};var Ft=n=>({selected:n}),pa=(n,t)=>({"col-sm-3":n,"col-sm-7":t});function da(n,t){if(n&1){let e=j();r(0,"div",10)(1,"label",11)(2,"input",12),W("ngModelChange",function(o){P(e);let s=p(2);return L(s.tagID,o)||(s.tagID=o),O(o)}),a(),m(3),a()()}if(n&2){let e=t.$implicit,i=t.$index,o=p(2);l(),b("for",Ai("potype-"+i))("ngClass",ie(8,Ft,o.tagID==e.ID)),l(),b("id",Ai("potype-"+i)),U("ngModel",o.tagID),b("value",e.ID),l(),$(" ",e.Name," ")}}function ua(n,t){if(n&1&&(r(0,"div",8),Ue(1,da,4,10,"div",10,Qe),a()),n&2){let e=p();l(),We(e.supplierPOTypes)}}function fa(n,t){if(n&1){let e=j();r(0,"strong",13),m(1,"Supplier Bill Number"),a(),r(2,"input",14),W("ngModelChange",function(o){P(e);let s=p();return L(s.invoiceNumber,o)||(s.invoiceNumber=o),O(o)}),a()}if(n&2){let e=p();l(2),U("ngModel",e.invoiceNumber)}}function ga(n,t){if(n&1){let e=j();r(0,"div",9)(1,"POS-tinymce-editor",15),W("ngModelChange",function(o){P(e);let s=p();return L(s.note,o)||(s.note=o),O(o)}),a()()}if(n&2){let e=p();l(),U("ngModel",e.note)}}function Ca(n,t){if(n&1){let e=j();r(0,"div",21)(1,"span",26),m(2,"@"),a(),r(3,"input",27),W("ngModelChange",function(o){P(e);let s=p(2);return L(s.exchangeRate,o)||(s.exchangeRate=o),O(o)}),a()()}if(n&2){let e=p(2);l(3),U("ngModel",e.exchangeRate)}}function ya(n,t){if(n&1){let e=j();r(0,"div",16)(1,"div",17)(2,"div",18),m(3,"Currency :"),a(),r(4,"div",19)(5,"ng-select",20),W("ngModelChange",function(o){P(e);let s=p();return L(s.currencyID,o)||(s.currencyID=o),O(o)}),a()(),v(6,Ca,4,1,"div",21),a()(),r(7,"div",22)(8,"div",23),m(9,"Term :"),a(),r(10,"div",24)(11,"ng-select",25),W("ngModelChange",function(o){P(e);let s=p();return L(s.note,o)||(s.note=o),O(o)}),a()()()}if(n&2){let e=p();l(4),b("ngClass",_t(8,pa,e.currencyID!=e.defaultCurrencyID,e.currencyID==e.defaultCurrencyID)),l(),b("items",e.currencies),U("ngModel",e.currencyID),b("clearable",!1),l(),_(e.currencyID!=e.defaultCurrencyID?6:-1),l(5),b("items",e.predefinedNotes),U("ngModel",e.note),b("clearable",!1)}}var xi=class n{constructor(t,e){this.dialogRef=t;this.config=new Ie,this.config.title="Purchase Order Note",this.config.customWidth="700px",this.note=e.note,this.tagID=e.tagID,this.currencyID=e.currencyID,this.exchangeRate=e.currencies.find(i=>i.ID==this.currencyID).ExchangeRate,this.supplierPOTypes=e.supplierPOTypes,this.predefinedNotes=e.predefinedNotes,this.currencies=e.currencies,this.defaultCurrencyID=e.defaultCurrencyID,this.invoiceNumber=e.invoiceNumber,S.IsEmpty(this.tagID)&&(this.tagID=this.supplierPOTypes[0]?.ID)}supplierPOTypes;predefinedNotes;currencies;currencyID;note;tagID;defaultCurrencyID;exchangeRate=0;invoiceNumber;tabState="Note";config;ok(){this.dialogRef.close({Note:this.note,TagID:this.tagID,Currency:B(w({},this.currencies.find(t=>t.ID==this.currencyID)),{ExchangeRate:this.exchangeRate}),InvoiceNumber:this.invoiceNumber})}close(){this.dialogRef.close()}onTabChange(t){this.tabState=t}static \u0275fac=function(e){return new(e||n)(u(Me),u(Fe))};static \u0275cmp=F({type:n,selectors:[["POS-modal-note"]],decls:18,vars:17,consts:[[3,"onCancel","onClose","onOk","config"],[1,"container-fluid"],[1,"row","border-bottom"],["data-cy","note",1,"btn","btn-link",3,"click","ngClass"],["data-cy","type",1,"btn","btn-link",3,"click","ngClass"],["data-cy","number",1,"btn","btn-link",3,"click","ngClass"],["data-cy","other",1,"btn","btn-link",3,"click","ngClass"],[1,"row","mt-8"],[1,"col-12"],[1,"col-12","tinymce"],[1,"rad-btn"],[3,"for","ngClass"],["type","radio",3,"ngModelChange","ngModel","value","id"],[1,"mb-2","ps-0"],["type","text","placeholder","Same as Purchase Order Number when blank",1,"form-control","w-50",3,"ngModelChange","ngModel"],[3,"ngModelChange","ngModel"],[1,"col-7","pe-0"],[1,"row"],[1,"col-sm-3","d-flex","align-items-center"],[1,"ps-0",3,"ngClass"],["bindLabel","Name","bindValue","ID","placeholder","Outlet","appendTo","body",3,"ngModelChange","items","ngModel","clearable"],[1,"col-sm-4","d-flex"],[1,"col-5","d-flex","align-items-center","ps-0"],[1,"col-sm-2"],[1,"col-sm-10"],["bindLabel","Label","bindValue","Description","placeholder","Term","appendTo","body",3,"ngModelChange","items","ngModel","clearable"],[1,"pt-4"],["type","text","autoNum","",1,"border","border-light",2,"width","100px",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(r(0,"modal-material",0),D("onCancel",function(){return i.close()})("onClose",function(){return i.close()})("onOk",function(){return i.ok()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div")(5,"a",3),D("click",function(){return i.onTabChange("Note")}),m(6," Note "),a(),r(7,"a",4),D("click",function(){return i.onTabChange("Tag")}),m(8," Tag "),a(),r(9,"a",5),D("click",function(){return i.onTabChange("Number")}),m(10," Number "),a(),r(11,"a",6),D("click",function(){return i.onTabChange("Other")}),m(12," Other "),a()()(),r(13,"div",7),v(14,ua,3,0,"div",8),v(15,fa,3,1),v(16,ga,2,1,"div",9),v(17,ya,12,11),a()()()()),e&2&&(b("config",i.config),l(5),b("ngClass",ie(9,Ft,i.tabState=="Note")),l(2),b("ngClass",ie(11,Ft,i.tabState=="Tag")),l(2),b("ngClass",ie(13,Ft,i.tabState=="Number")),l(2),b("ngClass",ie(15,Ft,i.tabState=="Other")),l(3),_(i.tabState=="Tag"?14:-1),l(),_(i.tabState=="Number"?15:-1),l(),_(i.tabState=="Note"?16:-1),l(),_(i.tabState=="Other"?17:-1))},dependencies:[se,Ge,Se,be,yn,ae,xe,Dt,xt,ai,oi,st,ct,Oe,Pe],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}content[_ngcontent-%COMP%] > div.container-fluid[_ngcontent-%COMP%]{min-height:200px}.tinymce[_ngcontent-%COMP%] a[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{z-index:2;position:absolute;right:15px;bottom:19px}.tinymce[_ngcontent-%COMP%] editor[_ngcontent-%COMP%]{height:max-content;z-index:1}.rad-btn[_ngcontent-%COMP%]{position:relative;display:inline-block}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #dddddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label.selected[_ngcontent-%COMP%]{background:#dcdcdc;border:1px solid #dcdcdc}.btn-link[_ngcontent-%COMP%]{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.selected[_ngcontent-%COMP%]{color:#3b3b3b;border-bottom:4px solid #07a519}a.btn.btn-link[_ngcontent-%COMP%]{color:inherit}"]})};var Si=class n{constructor(t){this.matDialog=t}supplierPOTypes;predefinedNotes;defaultCurrencyID;currencies;note;disabled=!1;onChange=t=>{};onTouched=()=>{};writeValue(t){this.note=t}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}openModalNote(){this.matDialog.open(xi,{data:{note:this.note.Note,tagID:this.note.TagID,exchangeRate:this.note.Currency.ExchangeRate,currencyID:this.note.Currency.ID,supplierPOTypes:this.supplierPOTypes,predefinedNotes:this.predefinedNotes,currencies:this.currencies,defaultCurrencyID:this.defaultCurrencyID,invoiceNumber:this.note.InvoiceNumber}}).afterClosed().pipe(V(t=>!!t)).subscribe(t=>{this.note=t,this.onChange(t)})}static \u0275fac=function(e){return new(e||n)(u(Z))};static \u0275cmp=F({type:n,selectors:[["POS-note-form"]],inputs:{supplierPOTypes:"supplierPOTypes",predefinedNotes:"predefinedNotes",defaultCurrencyID:"defaultCurrencyID",currencies:"currencies"},features:[Ne([{provide:Ke,multi:!0,useExisting:n}])],decls:2,vars:0,consts:[["type","button",1,"btn","btn-gray","w-100","h-100","fs-3","px-0","py-6","headings-font-family",3,"click"],[1,"fa-regular","fa-note-sticky","fa-xl"]],template:function(e,i){e&1&&(Je(0,"button",0),bt("click",function(){return i.openModalNote()}),kt(1,"i",1),it())},styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}"]})};function ba(n,t){if(n&1){let e=j();r(0,"div",10)(1,"div",12)(2,"h5"),m(3,"Add inventory to outlet"),a()(),r(4,"div",13)(5,"ng-select",14),W("ngModelChange",function(o){P(e);let s=p();return L(s.deliveryEntityID,o)||(s.deliveryEntityID=o),O(o)}),a()()()}if(n&2){let e=p();l(5),b("clearable",!1),U("ngModel",e.deliveryEntityID),b("items",e.outlets)("disabled",e.isEdit)}}function ha(n,t){n&1&&(r(0,"div",11)(1,"div",15)(2,"h5",16),m(3," Unfulfilled order, product inventory is awaiting "),a()()())}var Mi=class n{constructor(t,e,i){this.dialogRef=t;this.datePipe=e;this.data=i;this.config=new Ie,this.config.title="Purchase Order Fulfillment",this.config.customWidth="650px",this.isEdit=i.isEdit,this.deliveryEntityID=S.IsNotEmpty(i.deliveryEntityID)?i.deliveryEntityID:i.outletID,this.outlets=i.outlets,this.fulfillmentDate=i.fulfillmentDate,this.appConfigJSON=i.appConfigJSON,S.IsNotEmpty(i.deliveryEntityID)?this.tabState="Now":this.tabState="Later"}isEdit=!1;outlets;deliveryEntityID;tabState="Now";config;fulfillmentDate;fulfillmentTime;fulfillmentDateTime;shippingDateLabel="Fulfillment Date";appConfigJSON;ok(){this.tabState=="Later"&&this.setCustomDateField(),this.dialogRef.close(this.deliveryEntityID)}close(){this.dialogRef.close()}setCustomDateField(){this.fulfillmentDate=this.fulfillmentDate?this.fulfillmentDate:new Date;let t=this.fulfillmentTime?this.datePipe.transform(this.fulfillmentTime,"HH:mm"):"00:00",e=this.datePipe.transform(this.fulfillmentDate,"d MMM y");this.fulfillmentDateTime=`${e} ${t}`}onChangeTab(t){t=="Now"?(this.fulfillmentDate=null,this.deliveryEntityID=S.IsNotEmpty(this.data.deliveryEntityID)?this.data.deliveryEntityID:this.data.outletID):(this.deliveryEntityID=S.GuidEmpty,this.fulfillmentDate=new Date)}static \u0275fac=function(e){return new(e||n)(u(Me),u(cn),u(Fe))};static \u0275cmp=F({type:n,selectors:[["POS-modal-fulfillment"]],decls:20,vars:3,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container"],[1,"row","align-items-start","py-2","my-2"],[1,"col"],["name","fontStyle","aria-label","Font Style",1,"fulfillment-tab",3,"ngModelChange","change","ngModel"],["data-cy","Now","value","Now"],[1,"p-7","me-2"],[1,"text-body-secondary","tabDesc"],["data-cy","Later","value","Later"],[1,"p-7"],[1,"row","align-items-center","mt-5"],[1,"row","mt-8"],[1,"col-auto"],[1,"col","d-flex","justify-content-end"],["appendTo","body","bindLabel","Name","bindValue","ID","placeholder","Outlet","data-cy","DeductInventory",1,"tall","auto-grow",2,"width","250px",3,"ngModelChange","clearable","ngModel","items","disabled"],[1,"col-12","pe-0"],[1,"bg-gradient-warning","text-center","py-7","rounded-3","border","mb-7"]],template:function(e,i){e&1&&(r(0,"modal-material",0),D("onOk",function(){return i.ok()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"mat-button-toggle-group",4),W("ngModelChange",function(s){return L(i.tabState,s)||(i.tabState=s),s}),D("change",function(s){return i.onChangeTab(s.value)}),r(6,"mat-button-toggle",5)(7,"h3",6),m(8," Now "),r(9,"small",7)(10,"em"),m(11,"(in store purchase)"),a()()()(),r(12,"mat-button-toggle",8)(13,"h3",9),m(14," Later "),r(15,"small",7)(16,"em"),m(17,"(shipped to customer address)"),a()()()()()()(),v(18,ba,6,4,"div",10)(19,ha,4,0,"div",11),a()()()),e&2&&(b("config",i.config),l(5),U("ngModel",i.tabState),l(13),_(i.tabState=="Now"?18:19))},dependencies:[Oe,Pe,xt,Sn,Dn,xn,Se,ae,xe,ti,Vn],styles:[".container[_ngcontent-%COMP%]{min-height:150px} .p-datepicker.p-component.p-datepicker-timeonly{z-index:99999!important}.tabDesc[_ngcontent-%COMP%]{font-size:80%;font-weight:400} mat-button-toggle-group.fulfillment-tab mat-pseudo-checkbox{display:none}"]})};var Ii=class n{constructor(t){this.matDialog=t}outlets;outletID;appConfigJSON;isEdit;deliveryEntityID;disabled=!1;onChange=t=>{};onTouched=()=>{};writeValue(t){this.deliveryEntityID=t}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}openModalFulfillment(){this.matDialog.open(Mi,{data:{deliveryEntityID:this.deliveryEntityID,outlets:this.outlets,outletID:this.outletID,appConfigJSON:this.appConfigJSON,isEdit:this.isEdit}}).afterClosed().pipe(V(t=>!!t)).subscribe(t=>{this.deliveryEntityID=t,this.onChange(t)})}isDeliveryEntityIDEmpty(){return S.IsEmpty(this.deliveryEntityID)&&S.IsNotEmpty(this.outletID)}static \u0275fac=function(e){return new(e||n)(u(Z))};static \u0275cmp=F({type:n,selectors:[["POS-fulfillment-form"]],inputs:{outlets:"outlets",outletID:"outletID",appConfigJSON:"appConfigJSON",isEdit:"isEdit"},features:[Ne([{provide:Ke,multi:!0,useExisting:n}])],decls:4,vars:2,consts:[["type","button",1,"btn","btn-gray","w-100","h-100","fs-3","px-0","py-6","headings-font-family",3,"click"],[1,"fa-solid","fa-dolly","me-3"]],template:function(e,i){e&1&&(Je(0,"button",0),bt("click",function(){return i.openModalFulfillment()}),kt(1,"i",1),Je(2,"span"),m(3,"Fulfillment"),it()()),e&2&&vt("bg-gradient-warning",i.isDeliveryEntityIDEmpty())},styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}"]})};var lo=n=>({selected:n}),va=n=>({active:n});function _a(n,t){if(n&1){let e=j();r(0,"a",4),D("click",function(){P(e);let o=p();return O(o.isPayNow=!1)}),m(1," Later "),r(2,"span",7),m(3,"Take Credit"),a()()}if(n&2){let e=p();b("ngClass",ie(1,lo,!e.isPayNow))}}function Da(n,t){if(n&1){let e=j();r(0,"div",16)(1,"a",17),D("click",function(){let o=P(e).$implicit,s=p(4);return O(s.inputAmount=o)}),m(2),f(3,"number"),a()()}if(n&2){let e=t.$implicit,i=p(4);l(),b("ngClass",ie(5,va,i.paymentMethodID==i.cashPaymentID&&i.inputAmount==e)),l(),He("",i.currencySymbol," ",g(3,3,e))}}function xa(n,t){if(n&1&&(r(0,"div",14),Ue(1,Da,4,7,"div",16,Qe),a()),n&2){let e=p(3);l(),We(e.suggestedCash)}}function Sa(n,t){if(n&1&&(r(0,"div",19),m(1),f(2,"number"),a()),n&2){let e=p(4);b("ngClass",e.inputAmount>e.amountToPay?"success":"danger"),l(),He(" ",e.currencySymbol," ",g(2,3,e.inputAmount-e.amountToPay)," ")}}function Ma(n,t){if(n&1){let e=j();r(0,"input",18),W("ngModelChange",function(o){P(e);let s=p(3);return L(s.inputAmount,o)||(s.inputAmount=o),O(o)}),D("click",function(){P(e);let o=p(3);return o.paymentMethodID=o.cashPaymentID,o.paymentMethodState="Cash",O(o.paymentMethodName="Cash")}),a(),v(1,Sa,3,5,"div",19)}if(n&2){let e=p(3);U("ngModel",e.inputAmount),l(),_(e.inputAmount!=e.amountToPay?1:-1)}}function Ia(n,t){if(n&1){let e=j();r(0,"div",20),D("click",function(){P(e);let o=p(3);return o.paymentMethodID=o.cashPaymentID,O(o.paymentMethodState="Cash")}),M(1,"input",21),a()}if(n&2){let e=p(3);l(),b("value",e.currencySymbol+" -")}}function Pa(n,t){if(n&1&&(r(0,"div",8)(1,"div",10),M(2,"i",11),m(3," Cash "),a(),r(4,"div",12)(5,"div",13),v(6,xa,3,0,"div",14),r(7,"div",15),v(8,Ma,2,2)(9,Ia,2,1,"div"),a()()()()),n&2){let e=p(2);l(6),_(e.role.product.Cost?6:-1),l(2),_(e.role.product.Cost?8:9)}}function Oa(n,t){if(n&1){let e=j();r(0,"div",23)(1,"a",25),D("click",function(){let o=P(e).$implicit,s=p(3);return O(s.onSelectPaymentMethod(o.ID,"Card",o.Name))}),r(2,"span",26),M(3,"img",27),a(),r(4,"span",26),m(5),f(6,"limitText"),a()()()}if(n&2){let e=t.$implicit,i=p(3);l(),b("ngClass",i.paymentMethodID===e.ID?"active":""),l(),b("hidden",e.ImageUrl==null),l(),b("src",e.ImageUrl,at),l(),b("hidden",e.ImageUrl!=null),l(),$(" ",wt(6,5,e.Name,20)," ")}}function Ta(n,t){if(n&1){let e=j();r(0,"div",24)(1,"div",28)(2,"input",29),W("ngModelChange",function(o){P(e);let s=p(3);return L(s.paymentNote,o)||(s.paymentNote=o),O(o)}),a(),r(3,"input",30),W("ngModelChange",function(o){P(e);let s=p(3);return L(s.paymentCode,o)||(s.paymentCode=o),O(o)}),a()()()}if(n&2){let e=p(3);l(2),U("ngModel",e.paymentNote),l(),U("ngModel",e.paymentCode)}}function wa(n,t){if(n&1&&(r(0,"div",8)(1,"div",10),M(2,"i",22),m(3," Card "),a(),r(4,"div",12)(5,"div",13),Ue(6,Oa,7,8,"div",23,Qe),a(),v(8,Ta,4,2,"div",24),a()()),n&2){let e=p(2);l(6),We(e.cardPayments),l(2),_(e.paymentMethodState=="Card"?8:-1)}}function Na(n,t){if(n&1){let e=j();r(0,"div",23)(1,"a",25),D("click",function(){let o=P(e).$implicit,s=p(3);return O(s.onSelectPaymentMethod(o.ID,"Other",o.Name))}),m(2),f(3,"limitText"),a()()}if(n&2){let e=t.$implicit,i=p(3);l(),b("ngClass",i.paymentMethodID===e.ID?"active":""),l(),$(" ",wt(3,2,e.Name,20)," ")}}function Ea(n,t){if(n&1){let e=j();r(0,"div",24)(1,"div",28)(2,"input",29),W("ngModelChange",function(o){P(e);let s=p(3);return L(s.paymentNote,o)||(s.paymentNote=o),O(o)}),a(),r(3,"input",30),W("ngModelChange",function(o){P(e);let s=p(3);return L(s.paymentCode,o)||(s.paymentCode=o),O(o)}),a()()()}if(n&2){let e=p(3);l(2),U("ngModel",e.paymentNote),l(),U("ngModel",e.paymentCode)}}function Fa(n,t){if(n&1&&(r(0,"div",9)(1,"div",10),m(2,"Others"),a(),r(3,"div",12)(4,"div",13),Ue(5,Na,4,5,"div",23,Qe),a(),v(7,Ea,4,2,"div",24),a()()),n&2){let e=p(2);l(5),We(e.otherPayments),l(2),_(e.paymentMethodState=="Other"?7:-1)}}function Aa(n,t){if(n&1&&(r(0,"div"),v(1,Pa,10,2,"div",8),v(2,wa,9,1,"div",8),v(3,Fa,8,1,"div",9),a()),n&2){let e=p();l(),_(e.isCashSuspended?1:-1),l(),_(e.cardPayments.length>0?2:-1),l(),_(e.otherPayments.length>0?3:-1)}}function ka(n,t){if(n&1){let e=j();r(0,"div",6)(1,"div",31)(2,"h5",32),m(3,"Due"),a(),r(4,"datepicker",33),W("dateChange",function(o){P(e);let s=p();return L(s.dueDate,o)||(s.dueDate=o),O(o)}),D("dateChange",function(){P(e);let o=p();return O(o.onChangeDueDate())}),a()(),r(5,"div",34)(6,"h5",32),m(7,"Days Due"),a(),r(8,"div",12)(9,"input",35),W("ngModelChange",function(o){P(e);let s=p();return L(s.dueDays,o)||(s.dueDays=o),O(o)}),D("ngModelChange",function(){P(e);let o=p();return O(o.onChangeDueDay())}),a()()()()}if(n&2){let e=p();l(4),b("displayToggle",!1),U("date",e.dueDate),l(5),U("ngModel",e.dueDays)}}var Pi=class n{constructor(t,e,i){this.dialogRef=t;this.role=i;this.isDefaultTabPayLater=e.payDefaultState==!1,this.config=new Ie,this.config.title="Amount to Pay:",this.config.customWidth="650px",this.amountToPay=e.displayedAmountToPay,this.inputAmount=this.amountToPay,this.currencySymbol=e.currencySymbol,this.dueDate=e.dueDate,this.invoiceDate=e.invoiceDate,this.cashPaymentID=e.cashPaymentMethodID,this.cardPayments=e.cardPayments,this.otherPayments=e.otherPayments,this.paymentMethodID=e.paymentMethodID;let o=this.cardPayments.find(T=>T.ID==this.paymentMethodID);S.IsNotEmpty(o)&&(this.paymentMethodState="Card",this.paymentMethodName=o.Name);let s=this.otherPayments.find(T=>T.ID==this.paymentMethodID);S.IsNotEmpty(s)&&(this.paymentMethodState="Other",this.paymentMethodName=s.Name),this.paymentNote=e.paymentNote,this.paymentCode=e.paymentCode,this.isPayNow=e.payDefaultState,e.isEdit&&(this.isPayNow=!e.isUnpaidOnEdit),this.onChangeDueDate(),this.dueDays=e.dueDays,this.isCashSuspended=e.isCashSuspended,this.denomination=e.denomination,this.suggestedCash[0]=this.inputAmount,this.denomination.filter(T=>T>this.inputAmount).forEach(T=>{this.suggestedCash.length<3&&this.suggestedCash.push(T)}),console.log(this.suggestedCash)}config;isPayNow=!0;paymentMethodName="Cash";amountToPay=0;inputAmount=0;currencySymbol="";dueDate;dueDays;invoiceDate;cardPayments;otherPayments;cashPaymentID;paymentMethodID;paymentMethodState="Cash";paymentNote;paymentCode;displayedAmountToPay;denomination;suggestedCash=[];isCashSuspended;isDefaultTabPayLater=!1;ok(){let t={};this.isPayNow?(t.amount=this.inputAmount,t.paymentMethodID=this.paymentMethodID,t.paymentNote=this.paymentNote,t.paymentCode=this.paymentCode,t.payState="Now",t.paymentMethodName=this.paymentMethodName):(t.dueDate=this.dueDate,t.payState="Later"),this.dialogRef.close(t)}close(){this.dialogRef.close()}onSelectPaymentMethod(t,e,i){this.paymentMethodName=i,this.paymentMethodID==t?(this.paymentMethodID=this.cashPaymentID,this.paymentMethodState="Cash"):(this.paymentMethodID=t,this.paymentMethodState=e)}onChangeDueDay(){let t=new Date(S.cloneObject(this.invoiceDate));t.setDate(t.getDate()+this.dueDays),t.setHours(0,0,0,0),this.dueDate=t}onChangeDueDate(){this.dueDays=S.differentInDays(typeof this.invoiceDate=="string"?new Date(this.invoiceDate):this.invoiceDate,typeof this.dueDate=="string"?new Date(this.dueDate):this.dueDate)+1}static \u0275fac=function(e){return new(e||n)(u(Me),u(Fe),u(he))};static \u0275cmp=F({type:n,selectors:[["POS-modal-pay"]],decls:14,vars:10,consts:[[3,"onOk","onCancel","onClose","config"],[1,"mt-1","ms-2"],[1,"container","w-100","h-100"],[1,"row","border-bottom"],[1,"btn","btn-link",3,"click","ngClass"],[1,"btn","btn-link",3,"ngClass"],[1,"py-4"],[1,"fst-italic",2,"font-size","10px"],[1,"row","border-bottom","py-5"],[1,"row","py-5"],[1,"col-3","h5","pt-5"],[1,"fa-solid","fa-money-bill-wave"],[1,"col-9"],[1,"row"],[1,"row","mb-5"],[1,"col","pe-0","me-10","position-relative"],[1,"col-4","pe-0","ps-4"],[1,"btn","btn-outline-info","px-1","py-6","w-100",3,"click","ngClass"],["id","cashInput","type","text","placeholder","Custom Cash Amount","autoNum","",1,"form-control","form-control-lg","py-3","mb-3","px-6",3,"ngModelChange","click","ngModel"],[1,"change",3,"ngClass"],[3,"click"],["id","cashInput","type","text","placeholder","Custom Cash Amount","disabled","",1,"form-control","form-control-lg","py-3","mb-3","px-6",3,"value"],[1,"fa-regular","fa-credit-card"],[1,"col-auto","pe-0"],[1,"position-relative","row"],[1,"btn","btn-outline-info","mb-3","px-6",3,"click","ngClass"],[3,"hidden"],[2,"width","40px",3,"src"],[1,"paymentNote","col","row","g-0","pt-2","ms-6"],["type","text","placeholder","Payment Note",1,"form-control","w-50","border-end-0","py-6","col-6",3,"ngModelChange","ngModel"],["type","text","placeholder","Payment Code",1,"form-control","w-50","border-start-0","py-6","paymentCode","col-6",3,"ngModelChange","ngModel"],[1,"row","d-flex","align-items-center","g-0","later-payment"],[1,"col-3","fw-normal"],["appearance","fill","readOnly","true","name","orderDate",1,"col-9",3,"dateChange","displayToggle","date"],[1,"row","d-flex","align-items-center","g-0","later-payment","mt-10"],["type","text","autofocus","","autoNum","",1,"py-8","ps-8","form-control",3,"ngModelChange","ngModel"]],template:function(e,i){e&1&&(r(0,"modal-material",0),D("onOk",function(){return i.ok()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),r(1,"header")(2,"div",1),m(3),f(4,"number"),a()(),r(5,"content")(6,"div",2)(7,"div",3)(8,"div")(9,"a",4),D("click",function(){return i.isPayNow=!0}),m(10," Now "),a(),v(11,_a,4,3,"a",5),a()()(),v(12,Aa,4,3,"div"),v(13,ka,10,3,"div",6),a()()),e&2&&(b("config",i.config),l(3),$(" ",i.currencySymbol+" "+g(4,6,i.amountToPay)," "),l(6),b("ngClass",ie(8,lo,i.isPayNow)),l(2),_(i.amountToPay!=0||i.isDefaultTabPayLater?11:-1),l(),_(i.isPayNow?12:-1),l(),_(i.isPayNow?-1:13))},dependencies:[se,Ge,Se,be,ae,xe,ti,kn,Oe,Pe,st,ct,De,Xt],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}.change[_ngcontent-%COMP%]{position:absolute;top:0;height:40px;background:#89b03e;color:#fff;right:0;padding:0 10px;line-height:40px;font-size:16px}.change[_ngcontent-%COMP%]:before{content:"\\a";border-style:solid;border-width:40px 24px 0 0;border-color:transparent #89b03e transparent transparent;position:absolute;left:-24px}.change.danger[_ngcontent-%COMP%]{background:#c9302c}.change.danger[_ngcontent-%COMP%]:before{border-color:transparent #c9302c transparent transparent}.paymentNote[_ngcontent-%COMP%]:before{z-index:10;content:"";position:absolute;top:4px;left:calc(50% - 10px);height:90%;width:10px;background-color:inherit;border-right:1px solid lightgray;-webkit-transform:skewX(-10deg);-moz-transform:skewX(-10deg);-ms-transform:skewX(-10deg);transform:skew(-10deg)}.btn-link[_ngcontent-%COMP%]{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.selected[_ngcontent-%COMP%]{color:#3b3b3b;border-bottom:4px solid #07a519} .later-payment.date-picker .mat-mdc-form-field{font-size:4px}.ng-select.ng-select-width[_ngcontent-%COMP%] .ng-select-container{width:160px;max-width:160px}input[type=text][_ngcontent-%COMP%]:disabled{background:#dadada}.later-payment[_ngcontent-%COMP%] strong{font-size:20px}.later-payment[_ngcontent-%COMP%] input{font-size:20px}.later-payment[_ngcontent-%COMP%] .mat-mdc-form-field{width:100%;font-size:20px;border:1px solid #c8d3df}.later-payment[_ngcontent-%COMP%] .mat-mdc-form-field .mat-mdc-icon-button, .later-payment[_ngcontent-%COMP%] .mat-mdc-form-field .mat-mdc-button-persistent-ripple, .later-payment[_ngcontent-%COMP%] .mat-mdc-form-field .mat-mdc-form-field-icon-suffix{outline:none!important}']})};var Ze=class n{constructor(t,e,i){this.form=e;this.decimalPipe=i;let o=e.discountAndTaxForm.valueChanges;this.currency$=e.noteForm.valueChanges.pipe(d(h=>h.Currency),X(1),z()),this.currencySymbol$=this.currency$.pipe(d(h=>h.Symbol),z());let s=t.cart$.pipe(E(console.log),d(h=>h.map(R=>R.Total)),d(h=>h.reduce((R,G)=>R+G,0)),d(h=>this.setDecimalDigit(h)),X(1),z()),T=t.cart$.pipe(d(h=>h.filter(R=>R.Taxable).map(R=>R.Total)),d(h=>h.reduce((R,G)=>R+G,0)),d(h=>this.setDecimalDigit(h)),X(1),z());this.displayedAmount$=s,this.displayedDiscountPercentage$=Ce(this.displayedAmount$,o.pipe(d(h=>h.Discount.Percentage))).pipe(d(([h,R])=>({label:`Discount ${R}%`,value:h*(R/100)})),je({label:"",value:0}),X(1),z()),this.displayedDiscountAmount$=Ce(this.currencySymbol$,o.pipe(d(h=>h.Discount.Amount))).pipe(d(([h,R])=>({label:`Discount ${h}`,value:R})),je({label:"",value:0}),X(1),z()),this.displayedTax$=Ce(T,this.displayedDiscountPercentage$.pipe(d(h=>h.value)),this.displayedDiscountAmount$.pipe(d(h=>h.value)),o.pipe(d(h=>h.Tax))).pipe(V(([,,,h])=>!!h.Label),d(([h,R,G,x])=>({amountAfterDiscount:h-R-G,tax:x})),d(h=>{let R=h.amountAfterDiscount,G=h.tax;return{label:G.Label,tax:{id:G.ID,value:G.CalculationTypeName=="Add"?R*(G.Rate/100):G.Rate/(100+G.Rate)*R,type:G.CalculationTypeName,rate:G.Rate}}}),E(h=>e.setTaxAmount(h.tax.value)),je({label:"",tax:{id:"",value:0,type:"",rate:0}}),X(1),z()),this.amountAfterDiscountAndTax$=Ce(this.displayedAmount$,this.displayedDiscountPercentage$.pipe(d(h=>h.value)),this.displayedDiscountAmount$.pipe(d(h=>h.value)),this.displayedTax$.pipe(d(h=>h.tax)),t.cart$.pipe(d(h=>h.length))).pipe(d(([h,R,G,x,A])=>A?h-R-G+(x.type=="Add"?x.value:0):0),z()).pipe(X(1)),this.amountAfterDiscountAndTax$.subscribe()}paymentMethodName=Le("Cash");displayedAmount$;displayedDiscountPercentage$;displayedDiscountAmount$;displayedTax$;currency$;currencySymbol$;amountAfterDiscountAndTax$;get amountToPay(){return this.form.buyForm.controls.Payment.controls.Amount.value}get methodID(){return this.form.buyForm.controls.Payment.controls.MethodID.value}get code(){return this.form.buyForm.controls.Payment.controls.Code.value}get note(){return this.form.buyForm.controls.Payment.controls.Note.value}setDecimalDigit(t){let e=this.decimalPipe.transform(t,"1.0-4");return t=parseFloat(e.split(",").join("")),t}static \u0275fac=function(e){return new(e||n)(Q(ee),Q(H),Q(De))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};function Va(n,t){if(n&1&&(Je(0,"div"),m(1),f(2,"number"),it()),n&2){let e=p();l(),$(" ",g(2,1,e.amountToPayRounded)," ")}}function $a(n,t){n&1&&m(0," - ")}var Oi=class n{constructor(t,e,i,o,s,T,h,R,G,x,A){this.matDialog=t;this.toastr=e;this.form=i;this.cart=o;this.http=s;this.complete=T;this.role=h;this.load=R;this.posMath=G;this.math=x;this.paymentService=A}cartLength;amountToPay;currencySymbol;dueDate;cashPayments;cardPayments;otherPayments;paymentMethodID;paymentNote;paymentCode;defaultDueDays;invoiceDate;dueDays;appConfigJSON;isUnpaidOnEdit;isEditBuyForm;totalVariantOrdered;isCashSuspended;denomination;pay(){if(this.cartLength==0){this.toastr.info("You must have at least one item",ve.Info);return}if(this.form.discountAndTaxForm.value.Tax.Discontinue){this.toastr.info(`Cannot find the ${this.form.discountAndTaxForm.value.Tax.Label}, Set the tax discontinue status to \u201CNo\u201D to use tax or choose another tax type`,ve.Info);return}let t=S.IsEmpty(this.form.buyForm.controls.Order.controls.SupplierID.value);if(this.appConfigJSON.ModuleBuy.Header.SupplierRequired&&t){this.toastr.info("Supplier is required",ve.Info);return}this.matDialog.open(Pi,{data:{displayedAmountToPay:this.posMath.Round(this.amountToPay,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.RoundAlgorithm),amountToPay:this.posMath.Round(this.form.buyForm.controls.Payment.controls.Amount.value,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.RoundAlgorithm),currencySymbol:this.currencySymbol,dueDate:S.cloneObject(this.dueDate),dueDays:S.cloneObject(this.dueDays),cardPayments:this.cardPayments,otherPayments:this.otherPayments,cashPaymentMethodID:this.cashPayments[0]?.ID,paymentMethodID:this.paymentMethodID,paymentNote:this.paymentNote,paymentCode:this.paymentCode,invoiceDate:this.invoiceDate,payDefaultState:this.appConfigJSON.ModuleBuy.PaymentDialog.DefaultOption!=1,isUnpaidOnEdit:this.isUnpaidOnEdit,isEdit:this.isEditBuyForm,isCashSuspended:this.isCashSuspended,denomination:this.denomination}}).afterClosed().pipe(V(s=>!!s),d(s=>s)).pipe(E(s=>this.paymentService.paymentMethodName.set(s.paymentMethodName)),me(this.cart.cart$),d(([s,T])=>B(w({},s),{cart:T})),me(this.load.entities$),d(([s,T])=>B(w({},s),{entities:T})),me(this.load.supplierPOTypes$),d(([s,T])=>B(w({},s),{supplierPOTypes:T})),Y(s=>{S.IsEmpty(this.form.noteForm.value.TagID)&&this.form.setBulkNoteForm(B(w({},this.form.noteForm.value),{TagID:s.supplierPOTypes[0]?.ID}));let T=this.form.buyForm.controls,h=T.Invoice.controls,R=T.Payment.controls,G=this.form.outlet.value,x=T.Order.controls,A=this.form.noteForm.value,c=this.form.discountAndTaxForm.value,I=R.Amount.value,J=this.form.deliveryEntityID.value,K={ID:h.ID.value,Due:s.payState=="Now"?void 0:h.Due.value,Tax:h.Tax.value,Sales:I??0,PaymentStateID:s.payState=="Now"?3:1,Number:A.InvoiceNumber?A.InvoiceNumber:x.Number.value},C=s.cart.map(N=>B(w({},N),{VariantID:S.IsEmpty(N.VariantID)?N.ID:N.VariantID}));this.isEditBuyForm&&(C=C.map(N=>B(w({},N),{QtyRequested:N.Quantity})));let y={EntityID:G.ID,SupplierID:x.SupplierID.value,Date:x.Date.value,CurrencyID:A.Currency.ID,CurrencyRate:A.Currency.ExchangeRate,Discount:c.Discount.Percentage,DiscountAmount:c.Discount.Amount,Note:A.Note,Att:x.Att.value,TaxTypeID:c.Tax.ID,TypeID:A.TagID,Number:x.Number.value,ID:x.ID.value};if(s.payState=="Now"){let N={ID:R.ID?.value??S.GuidEmpty,MethodID:s.paymentMethodID,Code:s.paymentCode??"",Note:s.paymentNote??"",Amount:this.posMath.Round(s.amount,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.RoundAlgorithm),Date:y.Date,ImageUrl:R.ImageUrl?.value};s.amount<I?K.PaymentStateID=2:s.amount>I&&(K.PaymentStateID=5);let k={DeliveryEntityID:J,NewOrderID:this.isEditBuyForm?null:S.Guid_NewGuid(),Invoice:K,Order:y,Items:C,Payment:N};return this.http.post("/API/Buy/SubmitOrder2",k,1e4,!0).pipe(d(fe=>B(w({},fe),{differentNumber:fe.InvoiceNumber!=y.Number})),ye(fe=>{throw fe.error&&this.toastr.error(fe.error.Message,"Order Submission Failed"),new Error(fe)}))}else{let N={DeliveryEntityID:J,NewOrderID:this.isEditBuyForm?null:S.Guid_NewGuid(),Invoice:B(w({},K),{Due:s.dueDate}),Order:y,Items:C};return this.http.post("/API/Buy/SubmitOrder2",N,1e4,!0).pipe(d(k=>B(w({},k),{differentNumber:k.InvoiceNumber!=y.Number})),ye(k=>{throw k.error&&this.toastr.error(k.error.Message,"Order Submission Failed"),new Error(k)}))}})).subscribe(s=>{this.complete.paymentComplete(s),s.differentNumber&&this.toastr.info(`Bill number has been changed to ${s.InvoiceNumber}`,"Bill Number Changed!")})}get amountToPayRounded(){return this.posMath.Round(this.amountToPay,this.appConfigJSON?.ApplicationMath?.RoundingPurchaseDigit?.DecimalPlaceValue,this.appConfigJSON?.ApplicationMath?.RoundingPurchaseDigit.RoundAlgorithm)}static \u0275fac=function(e){return new(e||n)(u(Z),u(qe),u(H),u(ee),u(re),u($e),u(he),u(de),u(ki),u(ki),u(Ze))};static \u0275cmp=F({type:n,selectors:[["POS-pay-button"]],inputs:{cartLength:"cartLength",amountToPay:"amountToPay",currencySymbol:"currencySymbol",dueDate:"dueDate",cashPayments:"cashPayments",cardPayments:"cardPayments",otherPayments:"otherPayments",paymentMethodID:"paymentMethodID",paymentNote:"paymentNote",paymentCode:"paymentCode",defaultDueDays:"defaultDueDays",invoiceDate:"invoiceDate",dueDays:"dueDays",appConfigJSON:"appConfigJSON",isUnpaidOnEdit:"isUnpaidOnEdit",isEditBuyForm:"isEditBuyForm",totalVariantOrdered:"totalVariantOrdered",isCashSuspended:"isCashSuspended",denomination:"denomination"},decls:11,vars:7,consts:[["type","button",1,"btn","btn-success","fs-1","py-4",2,"border-left","0.1px solid #fff",3,"click"],[1,"d-flex","align-items-center","justify-content-between"],[1,"fs-6"]],template:function(e,i){e&1&&(Je(0,"button",0),bt("click",function(){return i.pay()}),Je(1,"div",1)(2,"div")(3,"span"),m(4,"Pay"),it(),Je(5,"small",2),m(6),f(7,"number"),f(8,"quantityFraction"),it()(),v(9,Va,3,3,"div")(10,$a,1,0),it()()),e&2&&(l(6),He(" (",g(7,3,i.cartLength)," Items & ",g(8,5,i.totalVariantOrdered)," Qty) "),l(3),_(i.role.product.Cost?9:10))},dependencies:[se,De,ei],styles:["button[_ngcontent-%COMP%]{border-right:.1px solid #fff;margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0;position:relative;flex:1 1 auto}"]})};var It=class n{noteForm;constructor(t){this.noteForm=t.noteForm}static \u0275fac=function(e){return new(e||n)(Q(H))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};var Pt=class n{deliveryEntityID;constructor(t){this.deliveryEntityID=t.deliveryEntityID}static \u0275fac=function(e){return new(e||n)(Q(H))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};var Ot=class n{dueDate$;dueDays$;constructor(t){let e=t.buyForm.controls.Invoice.controls.Due.valueChanges;this.dueDays$=t.dueDays.valueChanges,t.buyForm.controls.Order.controls.Date.valueChanges.pipe(E(console.log),me(this.dueDays$),E(([s,T])=>t.setDueDateBasedOnDaysDue(T)),E(console.log)).subscribe(),this.dueDate$=e,this.dueDate$.subscribe(s=>console.log(s,"dueDate$"))}static \u0275fac=function(e){return new(e||n)(Q(H))};static \u0275prov=ne({token:n,factory:n.\u0275fac,providedIn:"root"})};function La(n,t){if(n&1&&(r(0,"tr")(1,"th",11),m(2,"Amount"),a(),r(3,"td",12),m(4),f(5,"number"),a()()),n&2){let e=p();l(4),te(g(5,1,e.displayedAmount))}}function Qa(n,t){if(n&1&&(r(0,"td",13),m(1),f(2,"number"),a()),n&2){let e=p(3);l(),$(" ",g(2,1,e.displayedDiscountPercentage.value*-1))}}function Ua(n,t){if(n&1&&(r(0,"tr")(1,"th",11),m(2),a(),v(3,Qa,3,3,"td",13),a()),n&2){let e=p(2),i=p();l(2),te(e.displayedDiscountPercentage.label),l(),_(i.role.product.Cost?3:-1)}}function Wa(n,t){if(n&1&&(r(0,"td",13),m(1),f(2,"number"),a()),n&2){let e=p(3);l(),te(g(2,1,e.displayedDiscountAmount.value*-1))}}function Ja(n,t){if(n&1&&(r(0,"tr")(1,"th",11),m(2),a(),v(3,Wa,3,3,"td",13),a()),n&2){let e=p(2),i=p();l(2),te(e.displayedDiscountAmount.label),l(),_(i.role.product.Cost?3:-1)}}function Ha(n,t){if(n&1&&(r(0,"td",12),m(1),f(2,"number"),a()),n&2){let e=p(3);l(),te(g(2,1,e.displayedTax.tax.value))}}function Ga(n,t){if(n&1&&(r(0,"tr")(1,"th",11),m(2),a(),v(3,Ha,3,3,"td",12),a()),n&2){let e=p(2),i=p();l(2),te(e.displayedTax.label),l(),_(i.role.product.Cost?3:-1)}}function qa(n,t){if(n&1&&(v(0,Ua,4,2,"tr"),v(1,Ja,4,2,"tr"),v(2,Ga,4,2,"tr")),n&2){let e=p();_(e.displayedDiscountPercentage.value!=0?0:-1),l(),_(e.displayedDiscountAmount.value!=0?1:-1),l(),_(e.displayedTax.tax.value!=0?2:-1)}}function Ka(n,t){if(n&1&&(r(0,"div",0)(1,"div",9)(2,"table",10),v(3,La,6,3,"tr"),v(4,qa,3,3),f(5,"async"),a()()()),n&2){let e=t,i=p();l(3),_(i.showAmountWhenDiscountOrTaxIsApplied(e)&&e.displayedAmount&&i.role.product.Cost?3:-1),l(),_(g(5,2,i.cartLength$)?4:-1)}}var Ti=class n{constructor(t,e,i,o,s,T,h,R,G,x){this.payment=t;this.form=o;this.role=R;this.taxes$=i.taxes$,this.defaultCurrencyID$=i.appConfigJSON$.pipe(d(K=>K.CoreDefaults.CurrencyID)),this.totalVariantOrdered$=e.totalVariantOrdered$,this.cartLength$=e.cart$.pipe(d(K=>K.length)),this.amountAfterDiscountAndTax$=t.amountAfterDiscountAndTax$,this.discountAndTaxForm=o.discountAndTaxForm;let A=t.displayedAmount$,c=t.displayedDiscountPercentage$,I=t.displayedDiscountAmount$,J=t.displayedTax$;this.displayedDiscountAndTax$=Ce({displayedAmount:A,displayedDiscountPercentage:c,displayedDiscountAmount:I,displayedTax:J}),this.deliveryEntityID=T.deliveryEntityID,this.noteForm=s.noteForm,this.currencies$=i.currencies$,this.currencySymbol$=t.currencySymbol$,this.supplierPOTypes$=i.supplierPOTypes$,this.predefinedNotes$=i.predefinedNotes$,this.outlets$=i.entities$,this.cashPayments$=x.cashPayments$,this.cardPayments$=x.cardPayments$,this.otherPayments$=x.otherPayments$,this.defaultDueDays$=i.defaultDueDays$,this.dueDate$=h.dueDate$,this.dueDays$=h.dueDays$,this.appConfigJSON$=i.appConfigJSON$,this.isUnpaidOnEdit$=Ce(G.isEdit$,G.isUnpaid$).pipe(d(([K,C])=>K&&C)),this.isEdit$=G.isEdit$,this.outlet=o.outlet,this.isCashSuspended$=x.isCashSuspended$,this.denomination$=i.denomination$}taxes$;totalVariantOrdered$;displayedDiscountAndTax$;discountAndTaxForm;deliveryEntityID;noteForm;amountAfterDiscountAndTax$;currencies$;currencySymbol$;supplierPOTypes$;predefinedNotes$;defaultCurrencyID$;outlets$;cashPayments$;cardPayments$;otherPayments$;defaultDueDays$;dueDate$;dueDays$;appConfigJSON$;isUnpaidOnEdit$;isEdit$;isCashSuspended$;outlet;cartLength$;denomination$;get amountToPay(){return this.payment.amountToPay}get invoiceDate(){return this.form.invoiceDate}get paymentMethodID(){return this.payment.methodID}get paymentNote(){return this.payment.note}get paymentCode(){return this.payment.code}showAmountWhenDiscountOrTaxIsApplied(t){return t.displayedDiscountPercentage.value!=0||t.displayedDiscountAmount.value!=0||t.displayedTax.tax.value!=0}static \u0275fac=function(e){return new(e||n)(u(Ze),u(ee),u(de),u(H),u(It),u(Pt),u(Ot),u(he),u(Ve),u(Xe))};static \u0275cmp=F({type:n,selectors:[["POS-cart-footer"]],decls:34,vars:83,consts:[[1,"row","g-0","px-5","justify-content-end"],[1,"row","g-0","pb-6","px-5"],[1,"col-5","d-flex","justify-content-between","pe-5",2,"column-gap","12px"],[2,"flex-grow","1",3,"supplierPOTypes","predefinedNotes","defaultCurrencyID","currencies","formControl"],[2,"flex-grow","3",3,"outlets","formControl","appConfigJSON","outletID","isEdit"],[1,"col-7"],[1,"btn-group","w-100"],[2,"display","inline-flex",3,"taxes","currencySymbol","formControl"],[1,"w-100",2,"display","inline-flex",3,"amountToPay","currencySymbol","dueDate","dueDays","cardPayments","otherPayments","paymentMethodID","paymentCode","paymentNote","defaultDueDays","invoiceDate","appConfigJSON","cashPayments","isUnpaidOnEdit","isEditBuyForm","cartLength","totalVariantOrdered","isCashSuspended","denomination"],[1,"col-6",2,"padding-right","15px"],[1,"table","table-borderless"],[1,"text-start"],[1,"text-end","fs-5"],[1,"text-end","fs-5","text-danger"]],template:function(e,i){if(e&1&&(v(0,Ka,6,4,"div",0),f(1,"async"),r(2,"div",1)(3,"div",2),M(4,"POS-note-form",3),f(5,"async"),f(6,"async"),f(7,"async"),f(8,"async"),M(9,"POS-fulfillment-form",4),f(10,"async"),f(11,"async"),f(12,"async"),a(),r(13,"div",5)(14,"div",6),M(15,"POS-discount-and-tax-form",7),f(16,"async"),f(17,"async"),M(18,"POS-pay-button",8),f(19,"async"),f(20,"async"),f(21,"async"),f(22,"async"),f(23,"async"),f(24,"async"),f(25,"async"),f(26,"async"),f(27,"async"),f(28,"async"),f(29,"async"),f(30,"async"),f(31,"async"),f(32,"async"),f(33,"async"),a()()()),e&2){let o;_((o=g(1,33,i.displayedDiscountAndTax$))?0:-1,o),l(4),b("supplierPOTypes",g(5,35,i.supplierPOTypes$))("predefinedNotes",g(6,37,i.predefinedNotes$))("defaultCurrencyID",g(7,39,i.defaultCurrencyID$))("currencies",g(8,41,i.currencies$))("formControl",i.noteForm),l(5),b("outlets",g(10,43,i.outlets$))("formControl",i.deliveryEntityID)("appConfigJSON",g(11,45,i.appConfigJSON$))("outletID",i.outlet.value.ID)("isEdit",g(12,47,i.isEdit$)),l(6),b("taxes",g(16,49,i.taxes$))("currencySymbol",g(17,51,i.currencySymbol$))("formControl",i.discountAndTaxForm),l(3),b("amountToPay",g(19,53,i.amountAfterDiscountAndTax$))("currencySymbol",g(20,55,i.currencySymbol$))("dueDate",g(21,57,i.dueDate$))("dueDays",g(22,59,i.dueDays$))("cardPayments",g(23,61,i.cardPayments$))("otherPayments",g(24,63,i.otherPayments$))("paymentMethodID",i.paymentMethodID)("paymentCode",i.paymentCode)("paymentNote",i.paymentNote)("defaultDueDays",g(25,65,i.defaultDueDays$))("invoiceDate",i.invoiceDate)("appConfigJSON",g(26,67,i.appConfigJSON$))("cashPayments",g(27,69,i.cashPayments$))("isUnpaidOnEdit",g(28,71,i.isUnpaidOnEdit$))("isEditBuyForm",g(29,73,i.isEdit$))("cartLength",g(30,75,i.cartLength$))("totalVariantOrdered",g(31,77,i.totalVariantOrdered$))("isCashSuspended",g(32,79,i.isCashSuspended$))("denomination",g(33,81,i.denomination$))}},dependencies:[se,Di,Ye,ae,ze,Si,Ii,Oi,Ee,De],encapsulation:2})};var za=n=>({"date-warning":n}),Ya=()=>["/menu/Orders/Orders/Supplier_Bill/Info"],Xa=n=>({ID:n});function Za(n,t){if(n&1&&(m(0),f(1,"async"),f(2,"number")),n&2){let e=p().$implicit,i=p();He(" ",g(1,2,i.currencySymbol$)," ",g(2,4,e.Total)," ")}}function er(n,t){n&1&&m(0," - ")}function tr(n,t){if(n&1&&(r(0,"div",25)(1,"div",27),m(2),a(),r(3,"div",28),v(4,Za,3,6)(5,er,1,0),a()()),n&2){let e=t.$implicit,i=p();l(2),te(e.Name),l(2),_(i.role.product.Cost?4:5)}}function ir(n,t){if(n&1&&(r(0,"tr")(1,"td",31),m(2),a(),r(3,"td",32),m(4),f(5,"async"),a(),r(6,"td",31),m(7),f(8,"number"),a()()),n&2){p();let e=Jt(0),i=p();l(2),te(e.label),l(2),$(" ",g(5,3,i.currencySymbol$)," "),l(3),$(" ",g(8,5,e.value)," ")}}function nr(n,t){if(n&1&&(r(0,"tr")(1,"td",31),m(2,"Discount:"),a(),r(3,"td",32),m(4),f(5,"async"),a(),r(6,"td",31),m(7),f(8,"number"),a()()),n&2){p();let e=Jt(2),i=p();l(4),$(" ",g(5,2,i.currencySymbol$)," "),l(3),$(" ",g(8,4,e.value)," ")}}function or(n,t){if(n&1&&(r(0,"tr")(1,"td",31),m(2),a(),r(3,"td",32),m(4),f(5,"async"),a(),r(6,"td",31),m(7),f(8,"number"),a()()),n&2){p();let e=Jt(4),i=p();l(2),te(e.label),l(2),$(" ",g(5,3,i.currencySymbol$)," "),l(3),$(" ",g(8,5,e==null||e.tax==null?null:e.tax.value)," ")}}function ar(n,t){if(n&1&&(r(0,"tr",33)(1,"td",31),m(2),a(),r(3,"td",32),m(4),f(5,"async"),a(),r(6,"td",31),m(7),f(8,"async"),f(9,"number"),a()()),n&2){let e=p(2);l(2),$(" ",e.payment.paymentMethodName(),": "),l(2),$(" ",g(5,3,e.currencySymbol$)," "),l(3),$(" ",g(9,7,g(8,5,e.displayedAmount$))," ")}}function rr(n,t){if(n&1&&(Ut(0),f(1,"async"),Ut(2),f(3,"async"),Ut(4),f(5,"async"),r(6,"div",26)(7,"div",29)(8,"table",30)(9,"tbody")(10,"tr")(11,"td",31),m(12,"Amount:"),a(),r(13,"td",32),m(14),f(15,"async"),a(),r(16,"td",31),m(17),f(18,"async"),f(19,"number"),a()(),v(20,ir,9,7,"tr"),v(21,nr,9,6,"tr"),v(22,or,9,7,"tr"),v(23,ar,10,9,"tr",33),a()()()()),n&2){let e=p(),i=Wt(g(1,6,e.displayedDiscountPercentage$));l(2);let o=Wt(g(3,9,e.displayedDiscountAmount$));l(2);let s=Wt(g(5,12,e.displayedTax$));l(10),$(" ",g(15,15,e.currencySymbol$)," "),l(3),$(" ",g(19,19,g(18,17,e.displayedAmount$))," "),l(3),_(i.value>0?20:-1),l(),_(o.value>0?21:-1),l(),_((s==null||s.tax==null?null:s.tax.value)>0?22:-1),l(),_(e.payment.paymentMethodName()?23:-1)}}var wi=class n{constructor(t,e,i,o,s,T,h,R){this.payment=t;this.form=e;this.cart=i;this.complete=o;this.load=s;this.router=T;this.outletInfo=h;this.role=R;this.displayedAmount$=t.displayedAmount$,this.displayedDiscountPercentage$=t.displayedDiscountPercentage$,this.displayedDiscountAmount$=t.displayedDiscountAmount$,this.displayedTax$=t.displayedTax$}data;displayedAmount$;displayedDiscountPercentage$;displayedDiscountAmount$;displayedTax$;currencySymbol$;createNewTransaction(){this.clearCart(),this.resetBuyForm(),this.updateDueDays(),this.updateTax(),this.updatePaymentMethodID(),this.complete.paymentComplete(null),this.complete.createNewTransaction(),this.router.navigate([],{queryParams:{ID:null}})}get amountToPay(){return this.payment.amountToPay}resetBuyForm(){this.form.resetNoteForm(),this.form.resetDiscountAndTaxForm(),this.form.resetDueDaysForm(),this.form.resetBuyForm()}clearCart(){this.cart.clearCart()}updateDueDays(){this.load.updateDueDays()}updateTax(){this.outletInfo.updateTax()}updatePaymentMethodID(){this.outletInfo.updatePaymentMethodID()}static \u0275fac=function(e){return new(e||n)(u(Ze),u(H),u(ee),u($e),u(de),u(Kt),u(Xe),u(he))};static \u0275cmp=F({type:n,selectors:[["POS-complete"]],inputs:{data:[0,"paymentComplete","data"]},decls:38,vars:15,consts:[[1,"pt-7",2,"border-bottom","1px solid rgba(0, 0, 0, 0.1)"],[1,"ps-7","fw-normal","pb-7"],[1,"buy-complete"],[1,"container-fluid","pt-8"],[1,"row"],[1,"col-md-8"],[1,"card"],[1,"card-header"],[1,"d-flex","justify-content-between"],[1,"fa-solid","fa-check","me-1"],[1,"fst-italic"],[1,"card-body"],[1,"container"],[1,"row","mt-9","justify-content-center","g-0","mb-9"],[1,"col-9","text-center"],["type","button",1,"btn","btn-success","btn-lg","w-100","fs-2",3,"click"],[1,"card-footer","bg-light-gray"],[1,"row","justify-content-between","py-5"],[1,"col-auto"],["target","_blank",1,"btn","btn-light-gray",3,"href"],[1,"fa-solid","fa-print","me-2"],[1,"col-md-4"],[1,"card-header","bg-light-gray"],[1,"text-dark"],["target","_blank",1,"text-dark","fst-italic",3,"routerLink","queryParams"],[1,"row","my-1","p-5"],[1,"card-footer","pe-0","bg-white"],[1,"col-8"],[1,"col-4","text-end"],[1,"ms-auto"],[1,"table","table-borderless","mb-0","table-sm"],[1,"text-end"],[1,"text-start"],[2,"border-top","1px solid rgba(0, 0, 0, 0.1)"]],template:function(e,i){e&1&&(r(0,"div",0)(1,"h1",1),m(2,"New Purchase Order"),a()(),r(3,"section",2)(4,"div")(5,"div",3)(6,"div",4)(7,"div",5)(8,"div",6)(9,"div",7)(10,"div",8)(11,"h2"),M(12,"i",9),m(13," Purchase Complete "),r(14,"small",10),m(15),a()()()(),r(16,"div",11)(17,"div",12)(18,"div",13)(19,"div",14)(20,"button",15),D("click",function(){return i.createNewTransaction()}),m(21," New Purchase (F8) "),a()()()()(),r(22,"div",16)(23,"div",17)(24,"div",18)(25,"a",19),M(26,"i",20),m(27,"Print Receipt "),a()()()()()(),r(28,"div",21)(29,"div",6)(30,"div",22)(31,"h3",23)(32,"a",24),m(33),a()()(),Ue(34,tr,6,2,"div",25,Qe),f(36,"async"),v(37,rr,24,21,"div",26),a()()()()()()),e&2&&(l(9),an(ie(10,za,i.data.PaymentStateID<3)),l(6),$(" (",i.data.PaymentStateLabel,") "),l(10),b("href",i.data.Message,at),l(7),b("routerLink",Ht(12,Ya))("queryParams",ie(13,Xa,i.data.InvoiceID)),l(),$(" Supplier Bill #",i.data.InvoiceNumber," "),l(),We(g(36,8,i.cart.cart$)),l(3),_(i.role.product.Cost?37:-1))},dependencies:[se,Yt,zt,Ee,De],styles:[".print_containers[_ngcontent-%COMP%]{display:none}@media print{.print_containers[_ngcontent-%COMP%]{display:block;text-align:left}.buy-complete[_ngcontent-%COMP%]{display:none}}.table-sm[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .table-sm[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:10px!important}.buy-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-header[_ngcontent-%COMP%]{border-bottom:1px solid rgba(0,0,0,.125);padding-bottom:.9375rem}.buy-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-header[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:2rem}.buy-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-body[_ngcontent-%COMP%] .container[_ngcontent-%COMP%]{max-width:500px;margin-top:30px;margin-bottom:30px}.table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{vertical-align:middle;line-height:15px!important}"]})};var lr=["cartDisplayRef"],sr=(n,t)=>({label:n,tooltip:t}),cr=n=>({data:n}),mr=n=>({"bg-gradient-warning px-2":n}),pr=n=>({"me-3":n});function dr(n,t){n&1&&M(0,"POS-complete",2),n&2&&b("paymentComplete",t)}function ur(n,t){n&1&&on(0)}function fr(n,t){if(n&1&&(r(0,"div",9),ut(1,ur,1,0,"ng-container",31),a()),n&2){let e=p(2),i=ht(4);l(),b("ngTemplateOutlet",i)("ngTemplateOutletContext",ie(5,cr,_t(2,sr,e.fulfillmentOutletName(),e.fulfillmentOutletName())))}}function gr(n,t){if(n&1){let e=j();r(0,"div",3)(1,"div",4)(2,"div",5)(3,"div",6),M(4,"POS-select-outlet-form",7),f(5,"async"),f(6,"async"),f(7,"async"),M(8,"POS-invoice-number-form",8),f(9,"async"),r(10,"div"),v(11,fr,2,7,"div",9),M(12,"POS-invoice-date",10),a()()(),r(13,"div",11)(14,"div",12)(15,"div",13),M(16,"POS-more-actions",14),f(17,"async"),f(18,"async"),a(),r(19,"div",15)(20,"div",16),M(21,"i",17)(22,"input",18),a()(),r(23,"div",19)(24,"div",20)(25,"button",21),f(26,"async"),D("click",function(){P(e);let o=p();return O(o.collapseSidebar())}),M(27,"span",22)(28,"span",22)(29,"span",22),a()()()()()(),r(30,"div",23)(31,"div",5),M(32,"POS-quick-key",24),f(33,"async"),a(),r(34,"div",25)(35,"div",26)(36,"div",27),M(37,"POS-variant-autocomplete",28),a(),r(38,"div",15),M(39,"POS-supplier-autocomplete",29),f(40,"async"),f(41,"async"),a()(),M(42,"POS-cart-display",30,1),f(44,"async"),f(45,"async"),f(46,"async"),M(47,"POS-cart-footer"),a()()()}if(n&2){let e=p();l(4),b("outlets",g(5,31,e.outlets$))("isOpenAfterLoad",g(6,33,e.isOpenDialogOutlet$))("formControl",e.outlet)("disabled",g(7,35,e.isEdit$)),l(4),b("formControl",e.poNumber)("isEdit",g(9,37,e.isEdit$)),l(3),_(e.isFulfillmentDifferentOutlet()?11:-1),l(),b("formControl",e.date)("tooltip",e.role.global!=null&&e.role.global.Date?"":"Date role is required"),l(4),b("returnInvoiceNumber",e.returnInvoiceNumber)("appConfigJSON",g(17,39,e.appConfigJSON$))("isEditBuyForm",g(18,41,e.isEdit$))("outletID",e.outlet.value.ID)("outletName",e.outlet.value.Name),l(6),b("formControl",e.attention),l(3),vt("change",g(26,43,e.toggleState$)),l(7),b("quickKey",g(33,45,e.quickKeyPack$))("outletID",e.outlet.value.ID)("formControl",e.variantQuickKey),l(5),b("formControl",e.variantAutocomplete)("autocompleteEndpoint",e.variantAutocompleteEndpoint)("outletID",e.outlet.value.ID),l(2),b("formControl",e.supplierID)("supplierPOTypes",g(40,47,e.supplierPOTypes$))("appConfigJSON",g(41,49,e.appConfigJSON$)),l(3),b("cart",g(44,51,e.cart$))("appConfigJSON",g(45,53,e.appConfigJSON$))("isEdit",g(46,55,e.isEdit$))("outletID",e.outlet.value.ID)("outletName",e.outlet.value.Name)}}function Cr(n,t){if(n&1&&(r(0,"h5",36),m(1),f(2,"limitText"),a()),n&2){let e=p().data;l(),te(wt(2,1,e==null?null:e.label,14))}}function yr(n,t){if(n&1&&(r(0,"div",32)(1,"div",33)(2,"div",34),M(3,"i",35),a(),v(4,Cr,3,4,"h5",36),a()()),n&2){let e=t.data;b("ngClass",ie(4,mr,e.label))("matTooltip",e==null?null:e.tooltip),l(2),b("ngClass",ie(6,pr,e.label)),l(2),_(e!=null&&e.label?4:-1)}}var so=class n extends Tn{constructor(e,i,o,s,T,h,R,G,x,A,c,I,J){rn(()=>{this.cartDisplayRef()&&(s.cartDisplayRef=this.cartDisplayRef())});super(I);this.form=i;this.intercom=h;this.role=x;this.toggle=A;this.lowOnStock=c;this.menuData$.subscribe();let K=i.buyForm.controls.Order.controls;this.outlets$=e.entities$,this.outlet=i.outlet,this.isEdit$=R.isEdit$.pipe(E(C=>C?this.outlet.disable():this.outlet.enable())),this.date=K.Date,x.global.Date==!1&&this.date.disable(),this.supplierID=K.SupplierID,this.attention=K.Att,this.poNumber=i.buyForm.controls.Order.controls.Number,this.role?.sell?.Number||this.poNumber.disable(),this.quickKeyPack$=o.quickKeyPack$,this.variantAutocomplete=s.variantAutocomplete,this.variantQuickKey=s.variantQuickKey,this.returnInvoiceNumber=T.returnInvoiceNumber,this.cart$=s.cart$,this.appConfigJSON$=e.appConfigJSON$,this.isOpenDialogOutlet$=c.selectedLowOnStockData.length==0?this.isEdit$.pipe(Y(C=>G.createNewTransaction$.pipe(d(y=>y||C))),d(C=>!C)):tt(!1),c.selectedLowOnStockData.length&&(i.setOutletForm({ID:c.selectedLowOnStockData[0].EntityID,Name:c.selectedLowOnStockData[0].Outlet}),J.post("/API/catalog/variant/GetVariantByListID",{ListID:c.selectedLowOnStockData.map(C=>C.ID),EntityID:c.selectedLowOnStockData[0].EntityID}).pipe(d(C=>C.map(y=>this.setUnitPrice(y)).map(y=>({VariantID:y.ID,UnitPrice:y.UnitPrice})))).subscribe(C=>{i.setDeliveryEntityID(c.selectedLowOnStockData[0].EntityID);let y=c.selectedLowOnStockData.map(N=>({Quantity:N.Quantity,UnitQuantity:N.UnitQuantity,UnitPrice:C.find(k=>k.VariantID==N.VariantID).UnitPrice,Code:N.Code,Name:N.Product,DiscountAmount:N.DiscountAmount,Discount:N.Discount,Total:N.Total*C.find(k=>k.VariantID==N.VariantID).UnitPrice,VariantID:N.VariantID}));s.editForm(y)})),this.paymentComplete$=G.paymentComplete$,this.supplierPOTypes$=e.supplierPOTypes$,this.toggleState$=A.toggleState$,this.initFulfillmentDifferentOutlet()}cartDisplayRef=qt("cartDisplayRef",{read:Fi});variantAutocompleteEndpoint=Ae.GetVariantSuggestionsByEntityID;sf=le(Nt);outlets$;quickKeyPack$;outlet;poNumber;date;supplierID;variantAutocomplete=new ce;variantQuickKey=new ce;returnInvoiceNumber;cart$;appConfigJSON$;attention;isEdit$;paymentComplete$;supplierPOTypes$;isOpenDialogOutlet$;toggleState$;renderer=le(Zi);isFulfillmentDifferentOutlet=Le(!1);fulfillmentOutletName=Le("");ngAfterViewInit(){let e=document.querySelector("#full-container");this.renderer.addClass(e,"full-container"),this.intercom.hideLauncher()}initFulfillmentDifferentOutlet(){Ce([this.form.outlet.valueChanges.pipe(je(this.form.outlet.value)),this.form.deliveryEntityID.valueChanges.pipe(je(this.form.deliveryEntityID.value)),this.outlets$]).pipe(z()).subscribe(([e,i,o])=>{let s=e??this.form.outlet.value,T=i??this.form.deliveryEntityID.value;if(S.IsNotEmpty(T)&&T!=S.GuidEmpty&&s?.ID!=T){let h=o.find(R=>R.ID==T);this.fulfillmentOutletName.set(h?.Name??""),this.isFulfillmentDifferentOutlet.set(!0)}else this.isFulfillmentDifferentOutlet.set(!1)})}setUnitPrice(e){let i=w({},e);return S.IsNotEmpty(e.OrderPrice)?i.UnitPrice=e.OrderPrice:i.UnitPrice=e.UnitCost,i}ngOnDestroy(){this.lowOnStock.selectedLowOnStockData=[],this.intercom.showLauncher();let e=document.querySelector("#full-container");this.renderer.removeClass(e,"full-container")}collapseSidebar(){this.toggle.toggleSidebar()}static \u0275fac=function(i){return new(i||n)(u(de),u(H),u(Xe),u(ee),u(mt),u(hn),u(Ve),u($e),u(he),u(vn),u(ii),u(wn),u(re))};static \u0275cmp=F({type:n,selectors:[["POS-buy-v2"]],viewQuery:function(i,o){i&1&&Lt(o.cartDisplayRef,lr,5,Fi),i&2&&Qt()},features:[Ne([ee,$e,Ot,Ve,H,Pt,de,It,Xe,Ze,mt,Nt]),tn],decls:5,vars:3,consts:[["fulfillmentIndicator",""],["cartDisplayRef",""],[3,"paymentComplete"],[1,"container-fluid"],[1,"row","header","border-bottom"],[1,"col-5","border-end"],[1,"left-toolbar-container","h-100","d-flex","align-items-center","justify-content-between"],[3,"outlets","isOpenAfterLoad","formControl","disabled"],["transactionType","Purchase Order",3,"formControl","isEdit"],[1,"d-inline-block","pt-1","px-2","w-100"],[3,"formControl","tooltip"],[1,"col-7","d-flex","align-items-center"],[1,"row","flex-grow-1"],[1,"col-lg-7","col-5","d-flex","align-items-center"],[3,"returnInvoiceNumber","appConfigJSON","isEditBuyForm","outletID","outletName"],[1,"col-5","ps-0"],[1,"d-flex","align-items-center","position-relative"],[1,"fa-light","fa-id-badge","position-absolute"],["type","text","placeholder","Assign Attention",1,"border-bottom-0",3,"formControl"],[1,"col-2"],[1,"navbar","mobile-button","border-bottom-0"],["type","button","aria-controls","navigation-index","aria-expanded","false","aria-label","Toggle navigation",1,"navbar-toggler","navbar-toggler-right","float-end","toggle-menu","ps-2","pe-0","border-0",2,"width","max-content","height","max-content",3,"click"],[1,"navbar-toggler-bar","burger-lines"],[1,"row","content"],[3,"quickKey","outletID","formControl"],[1,"col-7","pt-5","px-0","d-flex","flex-column"],[1,"row","w-100","ms-0"],[1,"col-7","px-0"],["amountProperty","VariantCost",3,"formControl","autocompleteEndpoint","outletID"],[3,"formControl","supplierPOTypes","appConfigJSON"],[1,"cart-display",3,"cart","appConfigJSON","isEdit","outletID","outletName"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"ngClass","matTooltip"],["role","button",1,"d-flex","align-items-center","cursor-pointer","w-100"],[3,"ngClass"],[1,"fa-duotone","fa-light","fa-truck"],[1,"text--truncated"]],template:function(i,o){if(i&1&&(v(0,dr,1,1,"POS-complete",2),f(1,"async"),nn(2,gr,48,57,"div",3),ut(3,yr,5,8,"ng-template",null,0,Gt)),i&2){let s;_((s=g(1,1,o.paymentComplete$))?0:2,s)}},dependencies:[se,Ge,sn,Ye,be,ae,ze,Kn,zn,Rn,ci,li,Yn,mi,vi,Ti,wi,lt,rt,Ee,Xt],styles:[".left-toolbar-container[_ngcontent-%COMP%]{position:relative}.left-toolbar-container[_ngcontent-%COMP%] POS-invoice-number-form[_ngcontent-%COMP%]{position:absolute;top:34px;left:32px}.header[_ngcontent-%COMP%]{min-height:60px}.content[_ngcontent-%COMP%]{min-height:calc(100vh - 60px)}.supplier-more-menu[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.cart-display[_ngcontent-%COMP%]{flex-grow:1;height:0px;overflow-y:auto}input[_ngcontent-%COMP%]{width:100%;height:38px!important;border:0;border-bottom:1px solid #ced4da;padding-left:32px}input[_ngcontent-%COMP%]::placeholder{color:#ced4da}i.fa-id-badge[_ngcontent-%COMP%]{font-size:16px;top:10.6px;left:13px}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]{transition:.4s}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(1){-webkit-transform:rotate(-45deg) translate(-8px,4px);transform:rotate(-45deg) translate(-8px,4px)}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(2){opacity:0}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(3){-webkit-transform:rotate(45deg) translate(-5px,0px);transform:rotate(45deg) translate(-5px)}.mobile-button[_ngcontent-%COMP%]{display:none}@media (max-width: 990px){.mobile-button[_ngcontent-%COMP%]{display:block}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}.more-actions[_ngcontent-%COMP%] div.d-flex[_ngcontent-%COMP%]{width:30rem}.d-flex[_ngcontent-%COMP%] .text--truncated[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}"]})};export{so as BuyV2Component};