dealpos 26.24.3 → 26.25.0

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 (174) hide show
  1. package/browser/{chunk-2B7RNO36.js → chunk-2CTOK7WF.js} +1 -1
  2. package/browser/{chunk-BSSIWY6S.js → chunk-2K2CG57F.js} +1 -1
  3. package/browser/{chunk-XXMDSFUZ.js → chunk-2M3HN7QD.js} +1 -1
  4. package/browser/{chunk-4BUOW3BK.js → chunk-2W5LYATD.js} +1 -1
  5. package/browser/{chunk-MZHSISAK.js → chunk-2YPCH2ZV.js} +1 -1
  6. package/browser/chunk-4AAO7U7M.js +1 -0
  7. package/browser/chunk-4SFYGK6T.js +219 -0
  8. package/browser/{chunk-WCCF6FWD.js → chunk-5BY3YFWF.js} +1 -1
  9. package/browser/{chunk-ZUDLOG65.js → chunk-5LVVHUY6.js} +3 -3
  10. package/browser/{chunk-5DAAI4ZN.js → chunk-5WGVDICC.js} +1 -1
  11. package/browser/{chunk-IPFY4EHM.js → chunk-63ML5QNR.js} +1 -1
  12. package/browser/chunk-6AV2A4GV.js +1 -0
  13. package/browser/chunk-6FZ3ZQSJ.js +1 -0
  14. package/browser/{chunk-IRZQ5N6E.js → chunk-6TAHG6RW.js} +1 -1
  15. package/browser/chunk-6UDDM6WH.js +1 -0
  16. package/browser/chunk-76B3SRD7.js +1 -0
  17. package/browser/chunk-7BPDXYRA.js +1 -0
  18. package/browser/chunk-7Z7A4M2L.js +1 -0
  19. package/browser/chunk-7ZQBYNJF.js +1 -0
  20. package/browser/chunk-A264ALCM.js +149 -0
  21. package/browser/chunk-AGWZAVQL.js +1 -0
  22. package/browser/{chunk-YHIE4QGW.js → chunk-AH5ZMEF2.js} +1 -1
  23. package/browser/chunk-AIOQFGZH.js +1 -0
  24. package/browser/chunk-ARBG27NQ.js +24 -0
  25. package/browser/chunk-BCVW64FL.js +1 -0
  26. package/browser/chunk-BIUFFHOK.js +1 -0
  27. package/browser/chunk-DLFAOP72.js +1 -0
  28. package/browser/{chunk-RHZABOIL.js → chunk-DM7WNZOE.js} +1 -1
  29. package/browser/{chunk-KRTDMX5F.js → chunk-DMCMZRRZ.js} +13 -13
  30. package/browser/chunk-DOIAYZZL.js +1 -0
  31. package/browser/{chunk-K256RKYO.js → chunk-DTY3AQ7M.js} +1 -1
  32. package/browser/{chunk-YYS3VB7J.js → chunk-EH7TKKKW.js} +1 -1
  33. package/browser/{chunk-Q6OOZGE7.js → chunk-EXVI7AXX.js} +1 -1
  34. package/browser/{chunk-AOBFJSCV.js → chunk-FBK7JRJD.js} +1 -1
  35. package/browser/{chunk-FQTMARVD.js → chunk-FCL4YJDW.js} +1 -1
  36. package/browser/{chunk-2XSA5DXI.js → chunk-FM5C34MI.js} +1 -1
  37. package/browser/{chunk-Z5N25TQ6.js → chunk-FSDGJUKK.js} +4 -4
  38. package/browser/chunk-FVQZO7QR.js +4 -0
  39. package/browser/chunk-GGCEEWGS.js +3 -0
  40. package/browser/chunk-GL5CHFQO.js +1 -0
  41. package/browser/{chunk-SVR65DW7.js → chunk-GRYW7LFL.js} +1 -1
  42. package/browser/{chunk-TMRA2LJA.js → chunk-GTKWCXAS.js} +1 -1
  43. package/browser/{chunk-6C6Y66GX.js → chunk-GUZ5L6FK.js} +1 -1
  44. package/browser/{chunk-3DX7PJCG.js → chunk-H267ZHFF.js} +1 -1
  45. package/browser/{chunk-OUGKII2M.js → chunk-H44RKVGT.js} +1 -1
  46. package/browser/chunk-H4LL7WFL.js +1 -0
  47. package/browser/chunk-H5V2TOAA.js +1 -0
  48. package/browser/{chunk-UATPKFKX.js → chunk-H5ZVFHAZ.js} +1 -1
  49. package/browser/{chunk-I7G775LH.js → chunk-HYR6HX6C.js} +2 -2
  50. package/browser/{chunk-JBK6EAWN.js → chunk-IGDSG57U.js} +1 -1
  51. package/browser/chunk-IHC57ZXP.js +1 -0
  52. package/browser/chunk-IUCKTJTG.js +1 -0
  53. package/browser/{chunk-RSWH6QZV.js → chunk-IUE6FKVW.js} +1 -1
  54. package/browser/{chunk-ISRBPSFL.js → chunk-JD47F5J6.js} +1 -1
  55. package/browser/chunk-JIWK4TE6.js +1 -0
  56. package/browser/{chunk-JZA7CLGQ.js → chunk-JTDI7WZX.js} +1 -1
  57. package/browser/chunk-K3MT4ZKO.js +1 -0
  58. package/browser/chunk-KQWSM2C3.js +1 -0
  59. package/browser/{chunk-GLFIIHKG.js → chunk-L3A7PETM.js} +1 -1
  60. package/browser/{chunk-AUC3Y6KE.js → chunk-LUSOAMGK.js} +1 -1
  61. package/browser/{chunk-D73L3LWE.js → chunk-LXZ6NTTO.js} +1 -1
  62. package/browser/chunk-MSZV3TPX.js +4 -0
  63. package/browser/{chunk-HSF3YXPI.js → chunk-N7S7MN6G.js} +1 -1
  64. package/browser/{chunk-UOO5DWXA.js → chunk-N7WDC6TI.js} +1 -1
  65. package/browser/{chunk-DCTULUOF.js → chunk-NIAWRIMZ.js} +1 -1
  66. package/browser/{chunk-MDRAXXTN.js → chunk-NKYV4HQH.js} +1 -1
  67. package/browser/chunk-NVSQPZQN.js +1 -0
  68. package/browser/{chunk-Y5QWKCF6.js → chunk-OCH6ZCSE.js} +1 -1
  69. package/browser/{chunk-JLV6KRKH.js → chunk-OM7T4CCX.js} +1 -1
  70. package/browser/{chunk-MXCXUHIA.js → chunk-OOISBCNX.js} +1 -1
  71. package/browser/{chunk-4JHSPD6M.js → chunk-PI4WR3XN.js} +1 -1
  72. package/browser/chunk-PN5CPSHP.js +1 -0
  73. package/browser/chunk-PP4H72YU.js +4 -0
  74. package/browser/{chunk-VA5J45ZX.js → chunk-Q6FAFWIG.js} +1 -1
  75. package/browser/chunk-QEC4IJ22.js +1 -0
  76. package/browser/chunk-QFM4IYM3.js +1 -0
  77. package/browser/{chunk-6P2Z4OGF.js → chunk-QOIWHMJQ.js} +1 -1
  78. package/browser/{chunk-ARLM5HT7.js → chunk-QS4OI5DN.js} +1 -1
  79. package/browser/chunk-QSCLMBXS.js +2 -0
  80. package/browser/{chunk-4CFSWWES.js → chunk-QSXJPF7N.js} +2 -2
  81. package/browser/chunk-RJXSWOYZ.js +1 -0
  82. package/browser/{chunk-W3VSO5OO.js → chunk-RRMMBOFO.js} +1 -1
  83. package/browser/{chunk-I432ASSA.js → chunk-S4ANXNII.js} +1 -1
  84. package/browser/{chunk-45TF4EPT.js → chunk-SAYRWSZV.js} +1 -1
  85. package/browser/chunk-SGE22NPD.js +1 -0
  86. package/browser/chunk-SMZZJOV3.js +1 -0
  87. package/browser/chunk-SSNAC2P6.js +1 -0
  88. package/browser/chunk-SXBI5GYV.js +1 -0
  89. package/browser/chunk-TKFF5GTB.js +1 -0
  90. package/browser/chunk-TYIS4MEB.js +1 -0
  91. package/browser/chunk-UALNA42U.js +3 -0
  92. package/browser/{chunk-YZLQSTEE.js → chunk-UU7MSW4T.js} +1 -1
  93. package/browser/{chunk-2EIGJPJY.js → chunk-UVNV4N6Z.js} +1 -1
  94. package/browser/{chunk-CEF6JEUW.js → chunk-UVOTWHLP.js} +1 -1
  95. package/browser/{chunk-GR2DZQVM.js → chunk-V7ZEG3FW.js} +1 -1
  96. package/browser/chunk-VI7LWSJB.js +18 -0
  97. package/browser/chunk-VIPE7VER.js +1 -0
  98. package/browser/{chunk-SHEBJJHA.js → chunk-VLJ3XFCL.js} +1 -1
  99. package/browser/{chunk-5SOWFNGT.js → chunk-VNL6JZMB.js} +1 -1
  100. package/browser/chunk-VRWOQRZY.js +2 -0
  101. package/browser/chunk-VX6YLYZ6.js +1 -0
  102. package/browser/{chunk-OLWDO546.js → chunk-WJZSM6CH.js} +1 -1
  103. package/browser/chunk-WPBXRCAC.js +21 -0
  104. package/browser/chunk-WQYQ23YP.js +2 -0
  105. package/browser/chunk-WTNXIHLT.js +10 -0
  106. package/browser/{chunk-X7EMDIPG.js → chunk-WWYE5CKD.js} +1 -1
  107. package/browser/chunk-WXVQVRB2.js +1 -0
  108. package/browser/{chunk-ERUZY6II.js → chunk-X7YJB2WE.js} +1 -1
  109. package/browser/chunk-XENT225D.js +1 -0
  110. package/browser/chunk-XLOLWNK5.js +11 -0
  111. package/browser/{chunk-JGHPQ3HM.js → chunk-YAP5NE7B.js} +1 -1
  112. package/browser/chunk-YCXB2SKH.js +1 -0
  113. package/browser/chunk-YJWTW76X.js +11 -0
  114. package/browser/chunk-YQIGTLOF.js +1 -0
  115. package/browser/{chunk-NTYA3R5W.js → chunk-YTPVFV7T.js} +1 -1
  116. package/browser/{chunk-P6AUFTPU.js → chunk-YXFO2NVH.js} +1 -1
  117. package/browser/{chunk-RP2BVXFT.js → chunk-ZIHWSOWL.js} +1 -1
  118. package/browser/index.html +3 -3
  119. package/browser/{main-Q547ZELD.js → main-APKHUE7Z.js} +1 -1
  120. package/package.json +1 -1
  121. package/browser/chunk-22224FRT.js +0 -2
  122. package/browser/chunk-2VMZIZI4.js +0 -1
  123. package/browser/chunk-2YPYREDX.js +0 -1
  124. package/browser/chunk-37SPYYF6.js +0 -24
  125. package/browser/chunk-4FXF3VYI.js +0 -1
  126. package/browser/chunk-53IUTQDD.js +0 -3
  127. package/browser/chunk-574K5BXS.js +0 -1
  128. package/browser/chunk-7SGW56PA.js +0 -209
  129. package/browser/chunk-A26AFN6H.js +0 -1
  130. package/browser/chunk-ACRQTRLU.js +0 -1
  131. package/browser/chunk-ASOXCX3H.js +0 -1
  132. package/browser/chunk-AYT7PWA5.js +0 -18
  133. package/browser/chunk-BAGD7QMP.js +0 -1
  134. package/browser/chunk-CH4ONME7.js +0 -1
  135. package/browser/chunk-CLFJ4OQC.js +0 -1
  136. package/browser/chunk-DEYAQY5I.js +0 -1
  137. package/browser/chunk-DFMBXBJG.js +0 -1
  138. package/browser/chunk-DPZGTM44.js +0 -1
  139. package/browser/chunk-EJRXQ6YL.js +0 -1
  140. package/browser/chunk-EVJKTFLK.js +0 -1
  141. package/browser/chunk-FFIBBT6I.js +0 -1
  142. package/browser/chunk-FJJ4PKEQ.js +0 -4
  143. package/browser/chunk-FJROBI3X.js +0 -1
  144. package/browser/chunk-H3DMDZQL.js +0 -1
  145. package/browser/chunk-IFHFPZCS.js +0 -11
  146. package/browser/chunk-IZKLDQVT.js +0 -1
  147. package/browser/chunk-KES6BKT7.js +0 -4
  148. package/browser/chunk-NCXE4TUD.js +0 -1
  149. package/browser/chunk-NUKODNHE.js +0 -1
  150. package/browser/chunk-OCOZN352.js +0 -4
  151. package/browser/chunk-Q2APW6B7.js +0 -1
  152. package/browser/chunk-QGG7LSMM.js +0 -1
  153. package/browser/chunk-QLOHLTVV.js +0 -1
  154. package/browser/chunk-QNZAGZZG.js +0 -1
  155. package/browser/chunk-RZQFBOL2.js +0 -1
  156. package/browser/chunk-SF4VW27O.js +0 -149
  157. package/browser/chunk-SO2A6K4T.js +0 -2
  158. package/browser/chunk-T5HTGU5Q.js +0 -1
  159. package/browser/chunk-TJLWJLVZ.js +0 -1
  160. package/browser/chunk-TKRZNMT4.js +0 -1
  161. package/browser/chunk-TV265QVK.js +0 -1
  162. package/browser/chunk-URTZZKWH.js +0 -10
  163. package/browser/chunk-V6ESFS4G.js +0 -1
  164. package/browser/chunk-VD2ZTVKX.js +0 -1
  165. package/browser/chunk-VKAXELWO.js +0 -1
  166. package/browser/chunk-VRMFMZYP.js +0 -2
  167. package/browser/chunk-WC7BWF6O.js +0 -1
  168. package/browser/chunk-WEZGO22L.js +0 -1
  169. package/browser/chunk-WNN32EIK.js +0 -20
  170. package/browser/chunk-XBGAHJTI.js +0 -1
  171. package/browser/chunk-XU26LNQG.js +0 -1
  172. package/browser/chunk-XW7QIFIE.js +0 -11
  173. package/browser/chunk-YREIXP4V.js +0 -3
  174. package/browser/chunk-Z3PDXWRL.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as _}from"./chunk-MXCXUHIA.js";import{Ga as F,L as B,P as A,Wc as L,bb as $,c as f,ha as M,ia as K,j as y,ja as b,k as v,ka as w,la as P,oa as R,s as U,td as N,ua as V}from"./chunk-KYVLS64M.js";import{j as S}from"./chunk-KMHZKFQS.js";var ie={name:"pos-offline",version:_.pos.indexedDBVersion,objectStoresMeta:[{store:"Order",storeConfig:{keyPath:"id",autoIncrement:!0},storeSchema:[{name:"Action",options:{unique:!1},keypath:"Action"},{name:"Items",options:{unique:!1},keypath:"Items"},{name:"CartItems",options:{unique:!1},keypath:"CartItems"},{name:"Invoice",options:{unique:!1},keypath:"Invoice"},{name:"Order",options:{unique:!1},keypath:"Order"},{name:"Payments",options:{unique:!1},keypath:"Payments"},{name:"Shipping",options:{unique:!1},keypath:"Shipping"},{name:"ContactName",options:{unique:!1},keypath:"ContactName"}]},{store:"Outlet",storeConfig:{keyPath:"RegisterID",autoIncrement:!1},storeSchema:[{name:"DefaultSalesOrderTag",options:{unique:!1},keypath:"DefaultSalesOrderTag"},{name:"DefaultTaxType",options:{unique:!1},keypath:"DefaultTaxType"},{name:"DefaultWarehouse",options:{unique:!1},keypath:"DefaultWarehouse"},{name:"EntityID",options:{unique:!1},keypath:"EntityID"},{name:"EntityName",options:{unique:!1},keypath:"EntityName"},{name:"InvoiceNumberElement",options:{unique:!1},keypath:"InvoiceNumberElement"},{name:"ListSales",options:{unique:!1},keypath:"ListSales"},{name:"MemberPoint",options:{unique:!1},keypath:"MemberPoint"},{name:"NewOrderID",options:{unique:!1},keypath:"NewOrderID"},{name:"NumberElement",options:{unique:!1},keypath:"NumberElement"},{name:"ParkLayoutPack",options:{unique:!1},keypath:"ParkLayoutPack"},{name:"PrintTemplate",options:{unique:!1},keypath:"PrintTemplate"},{name:"QuickKeyPack",options:{unique:!1},keypath:"QuickKeyPack"},{name:"RegisterID",options:{unique:!1},keypath:"RegisterID"},{name:"ShippingDefault",options:{unique:!1},keypath:"ShippingDefault"}]},{store:"OutletPrice",storeConfig:{keyPath:"id",autoIncrement:!0},storeSchema:[{name:"EntityID",options:{unique:!1},keypath:"EntityID"},{name:"ExtraCost",options:{unique:!1},keypath:"ExtraCost"},{name:"PriceDiscount",options:{unique:!1},keypath:"PriceDiscount"},{name:"UnitCost",options:{unique:!1},keypath:"UnitCost"},{name:"UnitPrice",options:{unique:!1},keypath:"UnitPrice"},{name:"VariantID",options:{unique:!1},keypath:"VariantID"}]},{store:"POSStorage",storeConfig:{keyPath:"id",autoIncrement:!1},storeSchema:[{name:"AppConfigJSON",options:{unique:!1},keypath:"AppConfigJSON"},{name:"BINS",options:{unique:!1},keypath:"BINS"},{name:"Currencies",options:{unique:!1},keypath:"Currencies"},{name:"CustomerOptions",options:{unique:!1},keypath:"CustomerOptions"},{name:"Denomination",options:{unique:!1},keypath:"Denomination"},{name:"Entities",options:{unique:!1},keypath:"Entities"},{name:"PaymentTypes",options:{unique:!1},keypath:"PaymentTypes"},{name:"Payments",options:{unique:!1},keypath:"Payments"},{name:"PoTypes",options:{unique:!1},keypath:"PoTypes"},{name:"ProductCount",options:{unique:!1},keypath:"ProductCount"},{name:"Registers",options:{unique:!1},keypath:"Registers"},{name:"Restriction",options:{unique:!1},keypath:"Restriction"},{name:"Roles",options:{unique:!1},keypath:"Roles"},{name:"SalesID",options:{unique:!1},keypath:"SalesID"},{name:"ServerDateString",options:{unique:!1},keypath:"ServerDateString"},{name:"ServerTime",options:{unique:!1},keypath:"ServerTime"},{name:"Taxes",options:{unique:!1},keypath:"Taxes"},{name:"UserID",options:{unique:!1},keypath:"UserID"},{name:"UserName",options:{unique:!1},keypath:"UserName"},{name:"Version",options:{unique:!1},keypath:"Version"}]},{store:"Product",storeConfig:{keyPath:"ID",autoIncrement:!1},storeSchema:[{name:"BrandName",options:{unique:!1},keypath:"BrandName"},{name:"CategoryName",options:{unique:!1},keypath:"CategoryName"},{name:"CategoryTypeID",options:{unique:!1},keypath:"CategoryTypeID"},{name:"Code",options:{unique:!1},keypath:"Code"},{name:"Component",options:{unique:!1},keypath:"Component"},{name:"Created",options:{unique:!1},keypath:"Created"},{name:"Description",options:{unique:!1},keypath:"Description"},{name:"ExtraCost",options:{unique:!1},keypath:"ExtraCost"},{name:"ID",options:{unique:!1},keypath:"ID"},{name:"ImageUrl",options:{unique:!1},keypath:"ImageUrl"},{name:"LoyaltyPoint",options:{unique:!1},keypath:"LoyaltyPoint"},{name:"Name",options:{unique:!1},keypath:"Name"},{name:"OrderPrice",options:{unique:!1},keypath:"OrderPrice"},{name:"OrderPriceDiscount",options:{unique:!1},keypath:"OrderPriceDiscount"},{name:"Ordered",options:{unique:!1},keypath:"Ordered"},{name:"PaymentTypeID",options:{unique:!1},keypath:"PaymentTypeID"},{name:"PriceBook",options:{unique:!1},keypath:"PriceBook"},{name:"PriceDiscount",options:{unique:!1},keypath:"PriceDiscount"},{name:"PriceNote",options:{unique:!1},keypath:"PriceNote"},{name:"PriceTypeID",options:{unique:!1},keypath:"PriceTypeID"},{name:"ProductID",options:{unique:!1},keypath:"ProductID"},{name:"Taxable",options:{unique:!1},keypath:"Taxable"},{name:"ThumbnailUrl",options:{unique:!1},keypath:"ThumbnailUrl"},{name:"TypeID",options:{unique:!1},keypath:"TypeID"},{name:"UOM",options:{unique:!1},keypath:"UOM"},{name:"UnitCost",options:{unique:!1},keypath:"UnitCost"},{name:"UnitExpense",options:{unique:!1},keypath:"UnitExpense"},{name:"UnitPrice",options:{unique:!1},keypath:"UnitPrice"},{name:"UnitPriceOriginal",options:{unique:!1},keypath:"UnitPriceOriginal"},{name:"UnitQuantity",options:{unique:!1},keypath:"UnitQuantity"},{name:"OnHand",options:{unique:!1},keypath:"OnHand"}]},{store:"SyncTime",storeConfig:{keyPath:"id",autoIncrement:!1},storeSchema:[{name:"time",keypath:"time",options:{unique:!0}}]},{store:"FailedOrder",storeConfig:{keyPath:"id",autoIncrement:!0},storeSchema:[{name:"Action",options:{unique:!1},keypath:"Action"},{name:"Items",options:{unique:!1},keypath:"Items"},{name:"CartItems",options:{unique:!1},keypath:"CartItems"},{name:"Invoice",options:{unique:!1},keypath:"Invoice"},{name:"Order",options:{unique:!1},keypath:"Order"},{name:"Payments",options:{unique:!1},keypath:"Payments"},{name:"Shipping",options:{unique:!1},keypath:"Shipping"}]},{store:"SuccessOrder",storeConfig:{keyPath:"id",autoIncrement:!0},storeSchema:[{name:"Number",options:{unique:!1},keypath:"Order.Number"}]}]};var k=(function(s){return s.readonly="readonly",s.readwrite="readwrite",s})(k||{}),G=new b(null),Q=new b("Indexed DB"),H=new b("Server Indexed DB");function J(s,d){return s.objectStoreNames.contains(d)}function C(s,d,e){if(!s){e("You need to use the openDatabase function to create a database before you query it!");return}J(s,d)||e(`objectStore does not exists: ${d}`)}function x(s,d){let e=s.transaction(d.storeName,d.dbMode);return e.onerror=d.error,e.onabort=d.abort,e}function q(s,d,e,n){return{storeName:d,dbMode:s,error:t=>{e(t)},abort:t=>{e(t)}}}var E=[];function g(s,d,e,n){return new Promise((t,o)=>{s||o("IndexedDB not available");let r=s.open(d,e),a;r.onsuccess=()=>{a=r.result,E.push(a),t(a)},r.onerror=()=>{o(`IndexedDB error: ${r.error}`)},typeof n=="function"&&(r.onupgradeneeded=i=>{n(i,a)})})}function O(s,d,e,n,t){return S(this,null,function*(){return new Promise((o,r)=>{if(!s)return;let a=s.open(d,e);a.onupgradeneeded=i=>S(null,null,function*(){let c=i.target.result,h=n.map(p=>S(null,null,function*(){if(!c.objectStoreNames.contains(p.store)){let l=c.createObjectStore(p.store,p.storeConfig);for(let m of p.storeSchema)l.createIndex(m.name,m.keypath,m.options)}}));yield Promise.all(h);let u=t&&t();if(u){let p=Object.keys(u).map(l=>parseInt(l,10)).filter(l=>l>i.oldVersion).sort((l,m)=>l-m);for(let l of p)u[l](c,a.transaction)}c.close(),o()}),a.onsuccess=i=>{i.target.result.close(),o()},a.onerror=i=>{r(i)}})})}function W(s,d,e){if(!s||!d||!e)throw Error('Params: "dbName", "version", "storeName" are mandatory.');return new f(n=>{try{let t=d+1,o=indexedDB.open(s,t);o.onupgradeneeded=r=>{let a=r.target.result;a.deleteObjectStore(e),a.close(),console.log("onupgradeneeded"),n.next(),n.complete()},o.onerror=r=>n.error(r)}catch(t){n.error(t)}})}function X(s){return new Promise((d,e)=>{if(!s){e(new Error("No database to close"));return}try{s.close(),d()}catch(n){e(`Error closing database: ${n}`)}})}function D(){return function(s,d,e){let n=e.value;return e.value=function(...t){let o=n.apply(this,t);return o instanceof f?o.pipe(A(()=>S(this,null,function*(){let r=E.map(a=>S(this,null,function*(){yield X(a)}));yield Promise.all(r),E.length=0}))):o},e}}var Z=(()=>{class s{constructor(e,n){this.dbConfigs=e,this.indexedDB=n,this.defaultDatabaseName=null,Object.values(this.dbConfigs).forEach((t,o,r)=>this.instanciateConfig(t,r.length===1))}instanciateConfig(e,n){return S(this,null,function*(){if(!e.name)throw new Error("NgxIndexedDB: Please, provide the dbName in the configuration");if((e.isDefault??!1)&&this.defaultDatabaseName)throw new Error("NgxIndexedDB: Only one database can be set as default");((e.isDefault??!1)&&!this.defaultDatabaseName||n)&&(this.defaultDatabaseName=e.name,this.selectedDb=e.name),yield O(this.indexedDB,e.name,e.version,e.objectStoresMeta,e.migrationFactory),g(this.indexedDB,e.name).then(t=>{t.version!==e.version&&(L()&&(console.warn(`
1
+ import{a as _}from"./chunk-OOISBCNX.js";import{Ga as F,L as B,P as A,Wc as L,bb as $,c as f,ha as M,ia as K,j as y,ja as b,k as v,ka as w,la as P,oa as R,s as U,td as N,ua as V}from"./chunk-KYVLS64M.js";import{j as S}from"./chunk-KMHZKFQS.js";var ie={name:"pos-offline",version:_.pos.indexedDBVersion,objectStoresMeta:[{store:"Order",storeConfig:{keyPath:"id",autoIncrement:!0},storeSchema:[{name:"Action",options:{unique:!1},keypath:"Action"},{name:"Items",options:{unique:!1},keypath:"Items"},{name:"CartItems",options:{unique:!1},keypath:"CartItems"},{name:"Invoice",options:{unique:!1},keypath:"Invoice"},{name:"Order",options:{unique:!1},keypath:"Order"},{name:"Payments",options:{unique:!1},keypath:"Payments"},{name:"Shipping",options:{unique:!1},keypath:"Shipping"},{name:"ContactName",options:{unique:!1},keypath:"ContactName"}]},{store:"Outlet",storeConfig:{keyPath:"RegisterID",autoIncrement:!1},storeSchema:[{name:"DefaultSalesOrderTag",options:{unique:!1},keypath:"DefaultSalesOrderTag"},{name:"DefaultTaxType",options:{unique:!1},keypath:"DefaultTaxType"},{name:"DefaultWarehouse",options:{unique:!1},keypath:"DefaultWarehouse"},{name:"EntityID",options:{unique:!1},keypath:"EntityID"},{name:"EntityName",options:{unique:!1},keypath:"EntityName"},{name:"InvoiceNumberElement",options:{unique:!1},keypath:"InvoiceNumberElement"},{name:"ListSales",options:{unique:!1},keypath:"ListSales"},{name:"MemberPoint",options:{unique:!1},keypath:"MemberPoint"},{name:"NewOrderID",options:{unique:!1},keypath:"NewOrderID"},{name:"NumberElement",options:{unique:!1},keypath:"NumberElement"},{name:"ParkLayoutPack",options:{unique:!1},keypath:"ParkLayoutPack"},{name:"PrintTemplate",options:{unique:!1},keypath:"PrintTemplate"},{name:"QuickKeyPack",options:{unique:!1},keypath:"QuickKeyPack"},{name:"RegisterID",options:{unique:!1},keypath:"RegisterID"},{name:"ShippingDefault",options:{unique:!1},keypath:"ShippingDefault"}]},{store:"OutletPrice",storeConfig:{keyPath:"id",autoIncrement:!0},storeSchema:[{name:"EntityID",options:{unique:!1},keypath:"EntityID"},{name:"ExtraCost",options:{unique:!1},keypath:"ExtraCost"},{name:"PriceDiscount",options:{unique:!1},keypath:"PriceDiscount"},{name:"UnitCost",options:{unique:!1},keypath:"UnitCost"},{name:"UnitPrice",options:{unique:!1},keypath:"UnitPrice"},{name:"VariantID",options:{unique:!1},keypath:"VariantID"}]},{store:"POSStorage",storeConfig:{keyPath:"id",autoIncrement:!1},storeSchema:[{name:"AppConfigJSON",options:{unique:!1},keypath:"AppConfigJSON"},{name:"BINS",options:{unique:!1},keypath:"BINS"},{name:"Currencies",options:{unique:!1},keypath:"Currencies"},{name:"CustomerOptions",options:{unique:!1},keypath:"CustomerOptions"},{name:"Denomination",options:{unique:!1},keypath:"Denomination"},{name:"Entities",options:{unique:!1},keypath:"Entities"},{name:"PaymentTypes",options:{unique:!1},keypath:"PaymentTypes"},{name:"Payments",options:{unique:!1},keypath:"Payments"},{name:"PoTypes",options:{unique:!1},keypath:"PoTypes"},{name:"ProductCount",options:{unique:!1},keypath:"ProductCount"},{name:"Registers",options:{unique:!1},keypath:"Registers"},{name:"Restriction",options:{unique:!1},keypath:"Restriction"},{name:"Roles",options:{unique:!1},keypath:"Roles"},{name:"SalesID",options:{unique:!1},keypath:"SalesID"},{name:"ServerDateString",options:{unique:!1},keypath:"ServerDateString"},{name:"ServerTime",options:{unique:!1},keypath:"ServerTime"},{name:"Taxes",options:{unique:!1},keypath:"Taxes"},{name:"UserID",options:{unique:!1},keypath:"UserID"},{name:"UserName",options:{unique:!1},keypath:"UserName"},{name:"Version",options:{unique:!1},keypath:"Version"}]},{store:"Product",storeConfig:{keyPath:"ID",autoIncrement:!1},storeSchema:[{name:"BrandName",options:{unique:!1},keypath:"BrandName"},{name:"CategoryName",options:{unique:!1},keypath:"CategoryName"},{name:"CategoryTypeID",options:{unique:!1},keypath:"CategoryTypeID"},{name:"Code",options:{unique:!1},keypath:"Code"},{name:"Component",options:{unique:!1},keypath:"Component"},{name:"Created",options:{unique:!1},keypath:"Created"},{name:"Description",options:{unique:!1},keypath:"Description"},{name:"ExtraCost",options:{unique:!1},keypath:"ExtraCost"},{name:"ID",options:{unique:!1},keypath:"ID"},{name:"ImageUrl",options:{unique:!1},keypath:"ImageUrl"},{name:"LoyaltyPoint",options:{unique:!1},keypath:"LoyaltyPoint"},{name:"Name",options:{unique:!1},keypath:"Name"},{name:"OrderPrice",options:{unique:!1},keypath:"OrderPrice"},{name:"OrderPriceDiscount",options:{unique:!1},keypath:"OrderPriceDiscount"},{name:"Ordered",options:{unique:!1},keypath:"Ordered"},{name:"PaymentTypeID",options:{unique:!1},keypath:"PaymentTypeID"},{name:"PriceBook",options:{unique:!1},keypath:"PriceBook"},{name:"PriceDiscount",options:{unique:!1},keypath:"PriceDiscount"},{name:"PriceNote",options:{unique:!1},keypath:"PriceNote"},{name:"PriceTypeID",options:{unique:!1},keypath:"PriceTypeID"},{name:"ProductID",options:{unique:!1},keypath:"ProductID"},{name:"Taxable",options:{unique:!1},keypath:"Taxable"},{name:"ThumbnailUrl",options:{unique:!1},keypath:"ThumbnailUrl"},{name:"TypeID",options:{unique:!1},keypath:"TypeID"},{name:"UOM",options:{unique:!1},keypath:"UOM"},{name:"UnitCost",options:{unique:!1},keypath:"UnitCost"},{name:"UnitExpense",options:{unique:!1},keypath:"UnitExpense"},{name:"UnitPrice",options:{unique:!1},keypath:"UnitPrice"},{name:"UnitPriceOriginal",options:{unique:!1},keypath:"UnitPriceOriginal"},{name:"UnitQuantity",options:{unique:!1},keypath:"UnitQuantity"},{name:"OnHand",options:{unique:!1},keypath:"OnHand"}]},{store:"SyncTime",storeConfig:{keyPath:"id",autoIncrement:!1},storeSchema:[{name:"time",keypath:"time",options:{unique:!0}}]},{store:"FailedOrder",storeConfig:{keyPath:"id",autoIncrement:!0},storeSchema:[{name:"Action",options:{unique:!1},keypath:"Action"},{name:"Items",options:{unique:!1},keypath:"Items"},{name:"CartItems",options:{unique:!1},keypath:"CartItems"},{name:"Invoice",options:{unique:!1},keypath:"Invoice"},{name:"Order",options:{unique:!1},keypath:"Order"},{name:"Payments",options:{unique:!1},keypath:"Payments"},{name:"Shipping",options:{unique:!1},keypath:"Shipping"}]},{store:"SuccessOrder",storeConfig:{keyPath:"id",autoIncrement:!0},storeSchema:[{name:"Number",options:{unique:!1},keypath:"Order.Number"}]}]};var k=(function(s){return s.readonly="readonly",s.readwrite="readwrite",s})(k||{}),G=new b(null),Q=new b("Indexed DB"),H=new b("Server Indexed DB");function J(s,d){return s.objectStoreNames.contains(d)}function C(s,d,e){if(!s){e("You need to use the openDatabase function to create a database before you query it!");return}J(s,d)||e(`objectStore does not exists: ${d}`)}function x(s,d){let e=s.transaction(d.storeName,d.dbMode);return e.onerror=d.error,e.onabort=d.abort,e}function q(s,d,e,n){return{storeName:d,dbMode:s,error:t=>{e(t)},abort:t=>{e(t)}}}var E=[];function g(s,d,e,n){return new Promise((t,o)=>{s||o("IndexedDB not available");let r=s.open(d,e),a;r.onsuccess=()=>{a=r.result,E.push(a),t(a)},r.onerror=()=>{o(`IndexedDB error: ${r.error}`)},typeof n=="function"&&(r.onupgradeneeded=i=>{n(i,a)})})}function O(s,d,e,n,t){return S(this,null,function*(){return new Promise((o,r)=>{if(!s)return;let a=s.open(d,e);a.onupgradeneeded=i=>S(null,null,function*(){let c=i.target.result,h=n.map(p=>S(null,null,function*(){if(!c.objectStoreNames.contains(p.store)){let l=c.createObjectStore(p.store,p.storeConfig);for(let m of p.storeSchema)l.createIndex(m.name,m.keypath,m.options)}}));yield Promise.all(h);let u=t&&t();if(u){let p=Object.keys(u).map(l=>parseInt(l,10)).filter(l=>l>i.oldVersion).sort((l,m)=>l-m);for(let l of p)u[l](c,a.transaction)}c.close(),o()}),a.onsuccess=i=>{i.target.result.close(),o()},a.onerror=i=>{r(i)}})})}function W(s,d,e){if(!s||!d||!e)throw Error('Params: "dbName", "version", "storeName" are mandatory.');return new f(n=>{try{let t=d+1,o=indexedDB.open(s,t);o.onupgradeneeded=r=>{let a=r.target.result;a.deleteObjectStore(e),a.close(),console.log("onupgradeneeded"),n.next(),n.complete()},o.onerror=r=>n.error(r)}catch(t){n.error(t)}})}function X(s){return new Promise((d,e)=>{if(!s){e(new Error("No database to close"));return}try{s.close(),d()}catch(n){e(`Error closing database: ${n}`)}})}function D(){return function(s,d,e){let n=e.value;return e.value=function(...t){let o=n.apply(this,t);return o instanceof f?o.pipe(A(()=>S(this,null,function*(){let r=E.map(a=>S(this,null,function*(){yield X(a)}));yield Promise.all(r),E.length=0}))):o},e}}var Z=(()=>{class s{constructor(e,n){this.dbConfigs=e,this.indexedDB=n,this.defaultDatabaseName=null,Object.values(this.dbConfigs).forEach((t,o,r)=>this.instanciateConfig(t,r.length===1))}instanciateConfig(e,n){return S(this,null,function*(){if(!e.name)throw new Error("NgxIndexedDB: Please, provide the dbName in the configuration");if((e.isDefault??!1)&&this.defaultDatabaseName)throw new Error("NgxIndexedDB: Only one database can be set as default");((e.isDefault??!1)&&!this.defaultDatabaseName||n)&&(this.defaultDatabaseName=e.name,this.selectedDb=e.name),yield O(this.indexedDB,e.name,e.version,e.objectStoresMeta,e.migrationFactory),g(this.indexedDB,e.name).then(t=>{t.version!==e.version&&(L()&&(console.warn(`
2
2
  Your DB Config doesn't match the most recent version of the DB with name ${e.name}, please update it
3
3
  DB current version: ${t.version};
4
4
  Your configuration: ${e.version};
@@ -1 +1 @@
1
- import{a as O}from"./chunk-HP2XUQGY.js";import{a as Ee}from"./chunk-M7RK44J7.js";import"./chunk-S4O4XHL6.js";import{c as Oe}from"./chunk-NZXJPRXS.js";import{a as we}from"./chunk-3JF6BHHX.js";import"./chunk-BKZQ7DWL.js";import"./chunk-X2BF4P6B.js";import"./chunk-26OH33CP.js";import{g as ye,h as ve}from"./chunk-6C6Y66GX.js";import"./chunk-ZIFDXGAA.js";import"./chunk-RDPIGDPR.js";import"./chunk-5MFMEZN7.js";import"./chunk-REKKC3GE.js";import"./chunk-BM6BALOR.js";import"./chunk-PZV2OPOG.js";import"./chunk-JGFMZR43.js";import"./chunk-JCSUMYGG.js";import"./chunk-IRZQ5N6E.js";import{a as Se}from"./chunk-6K6JOBI3.js";import{a as Te}from"./chunk-YYS3VB7J.js";import"./chunk-YBYU2NPK.js";import"./chunk-Y6PUTPXJ.js";import"./chunk-MZHSISAK.js";import"./chunk-NKXJK5OA.js";import"./chunk-YCVG7SEH.js";import"./chunk-P2FAKIKL.js";import"./chunk-IJDHU46P.js";import"./chunk-IQFUVZ6Y.js";import"./chunk-MQW2LRVQ.js";import{a as De,b as be}from"./chunk-ZFSMBBTC.js";import"./chunk-YNQPX5G6.js";import{N as xe}from"./chunk-HL4M3UN2.js";import"./chunk-QSEKGLC7.js";import"./chunk-DCS4THVW.js";import"./chunk-2B7RNO36.js";import"./chunk-7HKIQJO2.js";import"./chunk-GXXXD7U4.js";import"./chunk-TECQKS2T.js";import"./chunk-HMY7DJXX.js";import"./chunk-HGTO3QEP.js";import"./chunk-5YJ3RTH6.js";import"./chunk-WOETHOGU.js";import"./chunk-ZIR7IDMB.js";import"./chunk-ONJ4E7DL.js";import"./chunk-IIFF2GRQ.js";import"./chunk-UNE3K3SG.js";import"./chunk-PDGCWLMX.js";import{E as fe,h as Ce,o as ge}from"./chunk-TG23CQGV.js";import"./chunk-OLWDO546.js";import"./chunk-K256RKYO.js";import"./chunk-PRQZ2TZC.js";import{b as j}from"./chunk-CORTGR3V.js";import{a as _e}from"./chunk-PTRS3UA6.js";import"./chunk-MXCXUHIA.js";import"./chunk-FWVQ6CFL.js";import{$b as D,Aa as ie,Ab as c,Ba as ae,Bb as o,Cb as r,Cc as h,Db as S,Ec as _,Ic as w,Jb as N,Lc as ce,Mb as v,Nd as ue,Pb as P,Pd as he,Qc as pe,Ra as l,Rb as d,Ya as E,ab as M,ec as s,fb as ne,fc as F,fd as U,gb as y,gc as C,hb as W,hc as se,jc as z,kc as J,kd as R,lc as Q,mb as I,nb as A,nd as me,pa as T,pd as G,qa as x,sd as L,tb as m,tc as Y,uc as b,vb as u,vc as V,wa as te,wc as X,xb as oe,xc as de,yb as re,za as f,zb as le}from"./chunk-KYVLS64M.js";import{a as B,b as H}from"./chunk-KMHZKFQS.js";var k=class{Cost;Profit;Sales;SalesWithTax;Tax;Count;TopOutlet};var ee=t=>({"border-bottom":t}),$=()=>["/menu/Reports/Sales_Report/Standard/Summary"],Ne=(t,n,e)=>({From:t,To:n,ListIDs:e}),Re=t=>({today:t}),Pe=(t,n)=>({From:t,To:n});function Le(t,n){if(t&1){let e=v();o(0,"div",6)(1,"a",15),s(2),r(),o(3,"ul",16)(4,"li")(5,"a",17),P("click",function(){T(e);let a=d();return a.isTodayFilter=!a.isTodayFilter,x(a.onChangeFilterPeriod())}),s(6),r()()()()}if(t&2){let e=d();l(2),C(" ",e.isTodayFilter?"Today":"Last 7 Days"," "),l(),c("ngClass",V(3,Re,!e.isTodayFilter)),l(3),C(" ",e.isTodayFilter?"Last 7 Days":"Today"," ")}}function ke(t,n){t&1&&(o(0,"span",7),s(1,"Today"),r())}function Be(t,n){if(t&1&&(o(0,"div",18)(1,"a",9),h(2,"date"),h(3,"date"),o(4,"div",10),s(5,"Tax"),r(),o(6,"div",19)(7,"small",20),s(8),r(),o(9,"h2",11),s(10),h(11,"number"),r()()()(),o(12,"div",8)(13,"a",9),h(14,"date"),h(15,"date"),o(16,"div",10),s(17,"Sales + Tax"),r(),o(18,"div",19)(19,"small",20),s(20),r(),o(21,"h2",11),s(22),h(23,"number"),r()()()()),t&2){let e=d();l(),c("routerLink",b(27,$))("queryParams",X(28,Pe,_(2,9,e.isTodayFilter?e.today:e.chartData==null?null:e.chartData.From,"yyyy-MM-dd"),_(3,12,e.isTodayFilter?e.today:e.dateTo,"yyyy-MM-dd"))),l(7),C(" ",e.dashboardConfig==null?null:e.dashboardConfig.CurrencySymbol," "),l(2),C(" ",_(11,15,e.salesData==null?null:e.salesData.Tax,"1.0-0")," "),l(2),c("ngClass",V(31,ee,e.role.product.Cost)),l(),c("routerLink",b(33,$))("queryParams",X(34,Pe,_(14,18,e.isTodayFilter?e.today:e.chartData==null?null:e.chartData.From,"yyyy-MM-dd"),_(15,21,e.isTodayFilter?e.today:e.dateTo,"yyyy-MM-dd"))),l(7),C(" ",e.dashboardConfig==null?null:e.dashboardConfig.CurrencySymbol," "),l(2),C(" ",_(23,24,e.salesData==null?null:e.salesData.SalesWithTax,"1.0-0")," ")}}function He(t,n){if(t&1&&(o(0,"div",8)(1,"div")(2,"div",21),s(3,"Cost"),r(),o(4,"div",19)(5,"small",20),s(6),r(),o(7,"h2",11),s(8),h(9,"number"),r()()()()),t&2){let e=d();c("ngClass",V(6,ee,e.role.report.Profit)),l(6),C(" ",e.dashboardConfig==null?null:e.dashboardConfig.CurrencySymbol," "),l(2),C(" ",_(9,3,e.salesData==null?null:e.salesData.Cost,"1.0-0")," ")}}function Ye(t,n){if(t&1&&(o(0,"div",12)(1,"div")(2,"div",22),s(3),r(),o(4,"div",19)(5,"small",20),s(6),r(),o(7,"h2",11),s(8),h(9,"number"),r()()()()),t&2){let e=d();l(3),C(" ",e.includeTax?"Gross Profit":"Profit"," "),l(3),C(" ",e.dashboardConfig==null?null:e.dashboardConfig.CurrencySymbol," "),l(2),C(" ",_(9,3,e.salesData==null?null:e.salesData.Profit,"1.0-0")," ")}}var Z=class t{constructor(n,e){this.dashboardService=n;this.role=e;this.chartConfig=this.dashboardService.getLineChartConfig()}chartData;salesData;dashboardConfig;filterSalesWidget=new te;chartConfig;todaySalesData;weeklySalesData;isTodayFilter=!0;showPeriodFilter;includeTax;today=new Date;dateTo;filterByOutletIds=pe([]);ngOnChanges(n){if(n.chartData&&n.chartData.currentValue){this.initSalesData();let e=n?.chartData?.currentValue?.Series;e=this.setChartLineColor(e),e=this.setSalesTaxLegend(e),this.chartConfig=H(B({},this.chartConfig),{series:e}),this.chartConfig=this.dashboardService.setSeriesPointStart(this.chartData.From,this.chartConfig),this.initPeriodFilter(e),this.getDateTo()}}initPeriodFilter(n){this.showPeriodFilter=n[0]?.data?.length>=7}initSalesData(){this.salesData=new k,this.includeTax=this.isIncludeTax(),this.salesData.Sales=this.dashboardService.getTotalData("Sales",this.chartData.Series,1),this.salesData.SalesWithTax=this.dashboardService.getTotalData("Sales + Tax",this.chartData.Series,1),this.salesData.Cost=this.dashboardService.getTotalData("Cost",this.chartData.Series,1),this.salesData.Tax=this.salesData.SalesWithTax-this.salesData.Sales,this.salesData.Profit=(this.includeTax?this.salesData.SalesWithTax:this.salesData.Sales)-this.salesData.Cost,this.salesData.Count=this.dashboardService.getTotalData("Count",this.chartData.Series,1),this.todaySalesData=Oe(k,this.salesData)}setChartLineColor(n=[]){return n?.map(e=>(e.name=="Sales"&&(e.color="rgb(44, 175, 254)",e.fillColor=this.dashboardService.getLinierGradient("rgb(44, 175, 254)")),e.name=="Cost"&&(e.color="#fb404b",e.fillColor=this.dashboardService.getLinierGradient("#fb404b")),e.name=="Sales + Tax"&&(e.color="#2ECC71",e.fillColor=this.dashboardService.getLinierGradient("#2ECC71")),e))}onChangeFilterPeriod(){this.isTodayFilter?this.salesData=this.todaySalesData:(this.generateWeeklySalesData(),this.salesData=this.weeklySalesData),this.filterSalesWidget.emit({period:this.isTodayFilter?"TODAY":"WEEKLY"})}getDateTo(){let n=new Date,e=new Date(this.chartData.From);n.setDate(e.getDate()+7),this.dateTo=n}generateWeeklySalesData(){if(_e.IsEmpty(this.weeklySalesData)){let n=this.dashboardService.getTotalData("Sales",this.chartData.Series,7),e=this.dashboardService.getTotalData("Sales + Tax",this.chartData.Series,7),i=this.dashboardService.getTotalData("Cost",this.chartData.Series,7),a=this.dashboardService.getTotalData("Count",this.chartData.Series,7),p=e-n,g=(this.includeTax?e:n)-i;this.weeklySalesData=this.weeklySalesData?this.weeklySalesData:new k,this.weeklySalesData.Sales=n,this.weeklySalesData.SalesWithTax=e,this.weeklySalesData.Cost=i,this.weeklySalesData.Profit=g,this.weeklySalesData.Tax=p,this.weeklySalesData.Count=a}}isIncludeTax(){let n=this.chartData.Series;return this.dashboardService.filterSeriesByName("Sales + Tax",n).visible}setSalesTaxLegend(n){return n=n.map(e=>(e.name=="Sales + Tax"&&(e.showInLegend=this.salesData.Tax>0),e)),n}static \u0275fac=function(e){return new(e||t)(E(O),E(j))};static \u0275cmp=M({type:t,selectors:[["app-sales-widget"]],inputs:{chartData:"chartData",dashboardConfig:"dashboardConfig",filterByOutletIds:[1,"filterByOutletIds"]},outputs:{filterSalesWidget:"onFilter"},features:[Y([O]),ae],decls:25,vars:30,consts:[[1,"d-flex","flex-row","flex-wrap","mt-8","justify-content-between"],[1,"chart-widget"],["containerId","salesChart",3,"config"],[1,"sales-card-widget"],[1,"border","rounded","rounded-bottom-0","px-8","py-4","w-100","h-auto"],[1,"border-bottom","d-flex","align-items-center","justify-content-end",2,"height","42px"],[1,"btn-group"],[1,"link-dark","fs-2","headings-font-family"],[1,"text-end","card-row","d-flex","align-items-center","justify-content-end",3,"ngClass"],["target","_blank",1,"link-dark",3,"routerLink","queryParams"],[1,"fs-5"],[1,"fw-normal"],[1,"text-end","d-flex","align-items-center","justify-content-end","card-row"],[1,"card-footer","border","rounded-bottom","border-top-0","text-end","p-3"],["routerLink","/menu/Setup/Configuration/Application"],["type","button","data-bs-toggle","dropdown","aria-expanded","false",1,"dropdown-toggle","link-dark","fs-2","headings-font-family"],[1,"dropdown-menu","p-0",2,"position","absolute","right","20px !important",3,"ngClass"],["role","button",1,"dropdown-item","fs-4",3,"click"],[1,"text-end","border-bottom","card-row","d-flex","align-items-center","justify-content-end"],[1,"d-flex","align-items-center","justify-content-end"],[1,"me-2"],[1,"fs-5","text-danger"],[1,"fs-5","text-success"]],template:function(e,i){e&1&&(o(0,"div",0)(1,"div",1),S(2,"app-chart-container",2),r(),o(3,"div",3)(4,"div",4)(5,"div",5),m(6,Le,7,5,"div",6)(7,ke,2,0,"span",7),r(),o(8,"div",8)(9,"a",9),h(10,"date"),h(11,"date"),o(12,"div",10),s(13,"Order"),r(),o(14,"h2",11),s(15),h(16,"number"),r()()(),m(17,Be,24,37),m(18,He,10,8,"div",8),m(19,Ye,10,6,"div",12),r(),o(20,"div",13)(21,"a",14)(22,"small"),s(23),h(24,"date"),r()()()()()),e&2&&(l(2),c("config",i.chartConfig),l(4),u(!(i.role==null||i.role.dashboard==null)&&i.role.dashboard.View&&i.showPeriodFilter?6:7),l(2),c("ngClass",V(23,ee,(i.salesData==null?null:i.salesData.Tax)||i.role.product.Cost)),l(),c("routerLink",b(25,$))("queryParams",de(26,Ne,_(10,11,i.isTodayFilter?i.today:i.chartData==null?null:i.chartData.From,"yyyy-MM-dd"),_(11,14,i.isTodayFilter?i.today:i.dateTo,"yyyy-MM-dd"),i.filterByOutletIds())),l(6),F(_(16,17,i.salesData==null?null:i.salesData.Count,"1.0-0")),l(2),u((i.salesData==null?null:i.salesData.Tax)>0?17:-1),l(),u(i.role.product.Cost?18:-1),l(),u(i.role.report.Profit&&i.role.product.Cost?19:-1),l(4),se("",_(24,20,i.dashboardConfig==null?null:i.dashboardConfig.SpanConfigTime,"dd MMM HH:mm")," ",i.dashboardConfig==null?null:i.dashboardConfig.SmallTimeZone))},dependencies:[L,U,Ee,he,ue,xe,G,me],styles:[".chart-widget[_ngcontent-%COMP%]{width:80%}.link-dark[_ngcontent-%COMP%]{color:#333!important}.dropdown-menu.show.today[_ngcontent-%COMP%]{inset:0 auto auto -34px!important}.sales-card-widget[_ngcontent-%COMP%]{width:19%}.sales-card-widget[_ngcontent-%COMP%] .card-row[_ngcontent-%COMP%]{height:64px}@media only screen and (max-width:767px){.chart-widget[_ngcontent-%COMP%]{width:100%}.sales-card-widget[_ngcontent-%COMP%]{width:100%;margin-top:12px}}@media only screen and (min-width:768px)and (max-width:991px){.chart-widget[_ngcontent-%COMP%]{width:100%}.sales-card-widget[_ngcontent-%COMP%]{width:100%;margin-top:12px}}"]})};var Ue=t=>({active:t});function Ge(t,n){if(t&1&&(o(0,"div",1),s(1),r(),o(2,"div",2)(3,"small",3),s(4),r(),o(5,"h2",4),s(6),r()()),t&2){let e=d();l(),F(e.title),l(3),F(e.currencySymbol),l(2),F(e.value)}}function je(t,n){if(t&1&&(o(0,"div",1),s(1),r(),o(2,"h2",4),s(3,"-"),r()),t&2){let e=d();l(),F(e.title)}}var K=class t{title;isActive;currencySymbol;value;showValue;constructor(){}ngOnInit(){}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=M({type:t,selectors:[["app-card-widget"]],inputs:{title:"title",isActive:"isActive",currencySymbol:"currencySymbol",value:"value",showValue:"showValue"},decls:3,vars:4,consts:[[1,"card-widget","pe-0",3,"ngClass"],[1,"fs-4","headings-font-family"],[1,"d-flex","justify-content-start","align-items-center"],[1,"fw-normal","me-2"],[1,"fw-normal"]],template:function(e,i){e&1&&(o(0,"div",0),m(1,Ge,7,3)(2,je,4,1),r()),e&2&&(c("ngClass",V(2,Ue,i.isActive)),l(),u(i.showValue?1:2))},dependencies:[L,U],styles:[".card-widget[_ngcontent-%COMP%]{padding:20px;border-radius:6px;min-height:95px;border:.5px solid #e4e4e4;width:100%}.active[_ngcontent-%COMP%]{background-color:#f0f0f0}@media only screen and (max-width:767px){.card-widget[_ngcontent-%COMP%]{width:200px}}@media only screen and (min-width:768px)and (max-width:991px){.card-widget[_ngcontent-%COMP%]{width:200px}}"]})};var Ze=()=>[R,import("./chunk-HFZ6CP5O.js").then(t=>t.PaymentWidgetComponent)],Ke=()=>[R,import("./chunk-WCON5ROC.js").then(t=>t.PurchaseWidgetComponent)],qe=()=>[R,import("./chunk-47GUYGT7.js").then(t=>t.DebtWidgetComponent)],ze=()=>[R,import("./chunk-74ANNEMH.js").then(t=>t.ProductWidgetComponent)],Je=()=>[R,import("./chunk-MMBDCSDX.js").then(t=>t.InventoryWidgetComponent)],Qe=()=>({role:"Payment View Role"}),Xe=()=>({role:"Buy Report Role"}),$e=()=>({role:"Debt View Role"}),et=()=>({role:"Report View Role"}),tt=()=>({role:"Inventory View Role"});function it(t,n){if(t&1){let e=v();o(0,"div",13)(1,"h6"),s(2,"Outlet"),r(),o(3,"outlet-selector",14),Q("ngModelChange",function(a){T(e);let p=d();return J(p.dashboardFilter().Outlets,a)||(p.dashboardFilter().Outlets=a),x(a)}),r()()}if(t&2){let e=d();l(3),c("multiple",!0)("accessType",e.outletAccess()),z("ngModel",e.dashboardFilter().Outlets)}}function at(t,n){if(t&1){let e=v();o(0,"div",19),P("click",function(){let a=T(e).$implicit,p=d(2);return x(p.onClickCardWidget(a))}),S(1,"app-card-widget",20),h(2,"number"),r()}if(t&2){let e=n.$implicit,i=d(),a=d();l(),c("title",e.title)("matTooltip",e.tooltip)("currencySymbol",i==null||i.ConfigData==null?null:i.ConfigData.CurrencySymbol)("value",e.value==null?"-":_(2,6,e.value,"1.0-0"))("showValue",e.showValue)("isActive",e.id==a.activeTab())}}function nt(t,n){if(t&1){let e=v();o(0,"app-sales-widget",21),P("onFilter",function(a){T(e);let p=d(2);return x(p.onFilterSalesWidget(a))}),r()}if(t&2){let e=d(),i=d();c("dashboardConfig",e==null?null:e.ConfigData)("chartData",e==null?null:e.HighChartData)("filterByOutletIds",i.dashboardFilter().Outlets)}}function ot(t,n){t&1&&N(0)}function rt(t,n){if(t&1){let e=v();o(0,"app-payment-widget",23),P("onFilter",function(a){T(e);let p=d(4);return x(p.onFilterPaymentWidget(a))}),r()}if(t&2){let e,i=d(3),a=d();c("dashboardConfig",i==null?null:i.ConfigData)("chartData",(e=a.paymentData())==null?null:e.Data)}}function lt(t,n){if(t&1&&y(0,ot,1,0,"ng-container",22)(1,rt,1,2,"ng-template",null,2,w),t&2){let e=D(2),i=d(3),a=D(11);c("ngTemplateOutlet",i.role.payment.View?e:a)("ngTemplateOutletContext",b(2,Qe))}}function st(t,n){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function dt(t,n){t&1&&(W(0,lt,3,3)(1,st,2,0),I(2,0,Ze,null,1),A(0,-1))}function ct(t,n){t&1&&N(0)}function pt(t,n){if(t&1&&S(0,"app-purchase-widget",18),t&2){let e,i=d(3),a=d();c("dashboardConfig",i==null?null:i.ConfigData)("chartData",(e=a.purchaseData())==null?null:e.HighChartData)("filterByOutletIds",a.dashboardFilter().Outlets)}}function mt(t,n){if(t&1&&y(0,ct,1,0,"ng-container",22)(1,pt,1,3,"ng-template",null,3,w),t&2){let e=D(2),i=d(3),a=D(11);c("ngTemplateOutlet",i.role.buy.Report?e:a)("ngTemplateOutletContext",b(2,Xe))}}function ut(t,n){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function ht(t,n){t&1&&(W(0,mt,3,3)(1,ut,2,0),I(2,0,Ke,null,1),A(0,-1))}function _t(t,n){t&1&&N(0)}function Ct(t,n){if(t&1&&S(0,"app-debt-widget",25),t&2){let e,i=d(3),a=d();c("dashboardConfig",i==null?null:i.ConfigData)("debtData",(e=a.debtData())==null?null:e.PageData)}}function gt(t,n){if(t&1&&y(0,_t,1,0,"ng-container",22)(1,Ct,1,2,"ng-template",null,4,w),t&2){let e=D(2),i=d(3),a=D(11);c("ngTemplateOutlet",i.role.debt.View?e:a)("ngTemplateOutletContext",b(2,$e))}}function ft(t,n){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function Dt(t,n){t&1&&(W(0,gt,3,3)(1,ft,2,0),I(2,0,qe,null,1),A(0,-1))}function bt(t,n){t&1&&N(0)}function St(t,n){if(t&1&&S(0,"app-product-widget",26),t&2){let e,i=d(3),a=d();c("dashboardConfig",i==null?null:i.ConfigData)("productData",(e=a.productData())==null?null:e.PageData)}}function Tt(t,n){if(t&1&&y(0,bt,1,0,"ng-container",22)(1,St,1,2,"ng-template",null,5,w),t&2){let e=D(2),i=d(3),a=D(11);c("ngTemplateOutlet",i.role.report.View?e:a)("ngTemplateOutletContext",b(2,et))}}function xt(t,n){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function yt(t,n){t&1&&(W(0,Tt,3,3)(1,xt,2,0),I(2,0,ze,null,1),A(0,-1))}function vt(t,n){t&1&&N(0)}function wt(t,n){if(t&1&&S(0,"app-inventory-widget",27),t&2){let e,i=d(3),a=d();c("dashboardConfig",i==null?null:i.ConfigData)("logisticsData",(e=a.logisticsData())==null?null:e.PageData)}}function Ot(t,n){if(t&1&&y(0,vt,1,0,"ng-container",22)(1,wt,1,2,"ng-template",null,6,w),t&2){let e=D(2),i=d(3),a=D(11);c("ngTemplateOutlet",i.role.inventory.View?e:a)("ngTemplateOutletContext",b(2,tt))}}function Et(t,n){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function Pt(t,n){t&1&&(W(0,Ot,3,3)(1,Et,2,0),I(2,0,Je,null,1),A(0,-1))}function Ft(t,n){if(t&1&&(o(0,"div",12)(1,"div",15)(2,"div",16),re(3,at,3,9,"div",17,oe),r(),m(5,nt,1,3,"app-sales-widget",18),m(6,dt,4,0),m(7,ht,4,0),m(8,Dt,4,0),m(9,yt,4,0),m(10,Pt,4,0),r()()),t&2){let e=d();l(3),le(e.cardWidgetComputed()),l(2),u(e.activeTab()=="SALES"?5:-1),l(),u(e.activeTab()=="PAYMENT"?6:-1),l(),u(e.activeTab()=="PURCHASE"?7:-1),l(),u(e.activeTab()=="DEBT"?8:-1),l(),u(e.activeTab()=="PRODUCT"?9:-1),l(),u(e.activeTab()=="LOGISTICS"?10:-1)}}function Vt(t,n){if(t&1&&(o(0,"div",24)(1,"div",28)(2,"div"),S(3,"img",29),r(),o(4,"h1",30),s(5,"You are not authorized"),r(),o(6,"p"),s(7," This page requires role "),o(8,"span",31),s(9),r(),s(10," to be accessed. Please contact your Administrator to gain access! "),r()()()),t&2){let e=n.role;l(9),C("[",e,"]")}}var We=class t extends Se{constructor(e,i,a){super(e);this.dashboardService=i;this.role=a;this.menuData$.subscribe(),this.fetchAllData(),ie(()=>{this.updateCardWidget()})}cardWidget=f([]);outletAccess=f(2);dashboardFilter=f({Outlets:[]});salesData=f(null);paymentData=f(null);purchaseData=f(null);debtData=f(null);productData=f(null);logisticsData=f(null);activeTab=f("SALES");cardWidgetComputed=ce(()=>this.cardWidget().map(e=>{let i=!1;if(e.id==="SALES"?i=this.role.dashboard.View:e.id==="PAYMENT"?i=this.role.payment.View:e.id==="PURCHASE"?i=this.role.buy.Create&&this.role.buy.Report:e.id==="DEBT"?i=this.role.debt.View:e.id==="PRODUCT"?i=this.role.report.View:e.id==="LOGISTICS"?i=this.role.inventory.View:i=!0,!i)return null;let a=e.tooltip;return e.id==="SALES"?a=this.activeTab()==="SALES"?e.tooltip:"Total Sales Today":e.id==="PAYMENT"?a=this.activeTab()==="PAYMENT"?e.tooltip:"Total Payment Today":e.id==="PURCHASE"?a=this.activeTab()==="PURCHASE"?e.tooltip:"Total Purchase Today":e.id==="DEBT"?a=this.activeTab()==="DEBT"?e.tooltip:"Total Debt Today":e.id==="PRODUCT"?a=this.activeTab()==="PRODUCT"?e.tooltip:"Total Product Today":e.id==="LOGISTICS"&&(a=this.activeTab()==="LOGISTICS"?e.tooltip:"Total Logistics Today"),H(B({},e),{tooltip:a})}).filter(e=>e!==null));fetchAllData(){this.dashboardService.getDashboardSales(this.dashboardFilter()).subscribe(e=>this.salesData.set(e))}updateCardWidget(){let e=this.activeTab();if(e==="SALES"&&this.salesData()){let i=this.dashboardService.getTotalData("Sales",this.salesData().HighChartData.Series,1);this.dashboardService.setWidgetData(i,e).subscribe(a=>this.cardWidget.set(a))}else if(e==="PAYMENT"&&this.paymentData()){let i=this.dashboardService.getTotalData("All",this.paymentData().Data.Series,1);this.dashboardService.setWidgetData(i,e).subscribe(a=>this.cardWidget.set(a))}else if(e==="PURCHASE"&&this.purchaseData()){let i=this.dashboardService.getTotalData("Purchase",this.purchaseData().HighChartData.Series,1);this.dashboardService.setWidgetData(i,e).subscribe(a=>this.cardWidget.set(a))}else if(e==="DEBT"&&this.debtData()){let i=this.debtData().PageData.Receivable;this.dashboardService.setWidgetData(i,e).subscribe(a=>this.cardWidget.set(a))}else if(e==="LOGISTICS"&&this.logisticsData()){let i=this.logisticsData()?.PageData?.Logistic?.Total;i&&this.dashboardService.setWidgetData(i,e).subscribe(a=>this.cardWidget.set(a)),this.dashboardService.getDashboardLogistics(this.dashboardFilter()).subscribe(a=>{this.logisticsData.set(a)})}}onFilterByOutlet(){this.dashboardService.clearCache(),this.fetchAllData(),this.updateCardWidget()}onClickCardWidget(e){switch(this.activeTab.set(e.id),e.id){case"SALES":this.dashboardService.getDashboardSales(this.dashboardFilter()).subscribe(i=>this.salesData.set(i));break;case"PURCHASE":this.dashboardService.getDashboardPurchase(this.dashboardFilter()).subscribe(i=>this.purchaseData.set(i));break;case"DEBT":this.dashboardService.getDashboardDebt(this.dashboardFilter()).subscribe(i=>this.debtData.set(i));break;case"PRODUCT":this.dashboardService.getDashboardProduct(this.dashboardFilter()).subscribe(i=>this.productData.set(i));break;case"LOGISTICS":this.dashboardService.getDashboardLogistics(this.dashboardFilter()).subscribe(i=>{console.log("Received logistics data => ",i.PageData),this.logisticsData.set(i)});break;case"PAYMENT":this.dashboardService.getDashboardPayment(this.dashboardFilter()).subscribe(i=>this.paymentData.set(i));break;default:new Error("Invalid widget type")}this.updateCardWidget()}onFilterSalesWidget(e){if(!this.salesData())return;let i=e.period==="WEEKLY"?7:1,a=this.dashboardService.getTotalData("Sales",this.salesData().HighChartData.Series,i);this.dashboardService.setWidgetData(a,"SALES").subscribe(p=>{this.cardWidget.set(p.map(g=>(g.id==="SALES"&&(g.tooltip=e.period==="TODAY"?"Total Sales Today":"Total Sales last 7 days"),g)))})}onFilterPaymentWidget(e){if(!this.paymentData())return;let i=e.period==="WEEKLY"?7:1,a=this.dashboardService.getTotalData("All",this.paymentData().Data.Series,i);this.dashboardService.setWidgetData(a,"PAYMENT").subscribe(p=>{this.cardWidget.set(p.map(g=>(g.id==="PAYMENT"&&(g.tooltip=e.period==="TODAY"?"Total Payment Today":"Total Payment last 7 days"),g)))})}static \u0275fac=function(i){return new(i||t)(E(Te),E(O),E(j))};static \u0275cmp=M({type:t,selectors:[["POS-dashboard-v2"]],features:[Y([O]),ne],decls:12,vars:5,consts:[["pageFilterTemplate",""],["NOT_AUTHORIZED",""],["PAYMENT",""],["BUY",""],["DEBT",""],["PRODUCT",""],["INVENTORY",""],[3,"onSubmit","filterChange","hideSearchBox","pageData","isFilterOnDropdown","filter"],[1,"content"],[1,"container-fluid","bg-light-gray","p-8"],[1,"row"],[1,"col-12"],[1,"card","mb-0"],[1,"dialog-filter"],["appendTo","body","placeholder","Select Outlets",3,"ngModelChange","multiple","accessType","ngModel"],[1,"card-body"],[1,"d-flex","flex-row","flex-nowrap","justify-content-between","align-items-center","overflow-auto",2,"column-gap","18px"],[1,"cursor-pointer","card-widget-tab"],[3,"dashboardConfig","chartData","filterByOutletIds"],[1,"cursor-pointer","card-widget-tab",3,"click"],["matTooltipPosition","above",3,"title","matTooltip","currencySymbol","value","showValue","isActive"],[3,"onFilter","dashboardConfig","chartData","filterByOutletIds"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"onFilter","dashboardConfig","chartData"],[1,"d-flex","align-items-center","justify-content-center","mt-8",2,"height","350px"],[3,"dashboardConfig","debtData"],[3,"dashboardConfig","productData"],[3,"dashboardConfig","logisticsData"],[1,"text-center"],["src","https://cdn.dealpos.xyz/web-image/locked.svg",2,"width","160px"],[1,"mt-2","mb-6"],[1,"fw-bold"]],template:function(i,a){if(i&1){let p=v();o(0,"mainpanel-cmp",7),P("onSubmit",function(){return a.onFilterByOutlet()}),Q("filterChange",function(q){return T(p),J(a.dashboardFilter,q)||(a.dashboardFilter=q),x(q)}),o(1,"filters"),y(2,it,4,3,"ng-template",null,0,w),r(),o(4,"content")(5,"div",8)(6,"div",9)(7,"div",10)(8,"div",11),m(9,Ft,11,6,"div",12),r()()()()()(),y(10,Vt,11,1,"ng-template",null,1,w)}if(i&2){let p;c("hideSearchBox",!0)("pageData",a.menuData)("isFilterOnDropdown",!1),z("filter",a.dashboardFilter),l(9),u((p=a.salesData())?9:-1,p)}},dependencies:[L,ve,ye,fe,Ce,ge,Z,K,we,be,De,G],styles:[".card-widget-tab[_ngcontent-%COMP%]{flex:1 1 0px}@media only screen and (max-width:767px){.card-widget-tab[_ngcontent-%COMP%]{margin-right:1rem;margin-top:.5rem;width:auto}}@media only screen and (min-width:768px)and (max-width:991px){.card-widget-tab[_ngcontent-%COMP%]{margin-right:1rem;margin-top:.5rem;width:auto}}"]})};export{We as DashboardV2Component};
1
+ import{a as O}from"./chunk-HP2XUQGY.js";import{a as Ee}from"./chunk-M7RK44J7.js";import"./chunk-S4O4XHL6.js";import{c as Oe}from"./chunk-NZXJPRXS.js";import{a as we}from"./chunk-3JF6BHHX.js";import"./chunk-BKZQ7DWL.js";import"./chunk-X2BF4P6B.js";import"./chunk-26OH33CP.js";import{g as ye,h as ve}from"./chunk-GUZ5L6FK.js";import"./chunk-ZIFDXGAA.js";import"./chunk-RDPIGDPR.js";import"./chunk-5MFMEZN7.js";import"./chunk-REKKC3GE.js";import"./chunk-BM6BALOR.js";import"./chunk-PZV2OPOG.js";import"./chunk-JGFMZR43.js";import"./chunk-JCSUMYGG.js";import{a as Se}from"./chunk-6K6JOBI3.js";import"./chunk-6TAHG6RW.js";import{a as Te}from"./chunk-EH7TKKKW.js";import"./chunk-YBYU2NPK.js";import"./chunk-Y6PUTPXJ.js";import"./chunk-2YPCH2ZV.js";import"./chunk-NKXJK5OA.js";import"./chunk-YCVG7SEH.js";import"./chunk-P2FAKIKL.js";import"./chunk-IJDHU46P.js";import"./chunk-IQFUVZ6Y.js";import"./chunk-MQW2LRVQ.js";import{a as De,b as be}from"./chunk-ZFSMBBTC.js";import"./chunk-YNQPX5G6.js";import{N as xe}from"./chunk-HL4M3UN2.js";import"./chunk-QSEKGLC7.js";import"./chunk-DCS4THVW.js";import"./chunk-2CTOK7WF.js";import"./chunk-7HKIQJO2.js";import"./chunk-GXXXD7U4.js";import"./chunk-TECQKS2T.js";import"./chunk-HMY7DJXX.js";import"./chunk-HGTO3QEP.js";import"./chunk-5YJ3RTH6.js";import"./chunk-WOETHOGU.js";import"./chunk-ZIR7IDMB.js";import"./chunk-ONJ4E7DL.js";import"./chunk-IIFF2GRQ.js";import"./chunk-UNE3K3SG.js";import"./chunk-PDGCWLMX.js";import{E as fe,h as Ce,o as ge}from"./chunk-TG23CQGV.js";import"./chunk-WJZSM6CH.js";import"./chunk-DTY3AQ7M.js";import"./chunk-PRQZ2TZC.js";import{b as j}from"./chunk-CORTGR3V.js";import{a as _e}from"./chunk-PTRS3UA6.js";import"./chunk-OOISBCNX.js";import"./chunk-FWVQ6CFL.js";import{$b as D,Aa as ie,Ab as c,Ba as ae,Bb as o,Cb as r,Cc as h,Db as S,Ec as _,Ic as w,Jb as N,Lc as ce,Mb as v,Nd as ue,Pb as P,Pd as he,Qc as pe,Ra as l,Rb as d,Ya as E,ab as M,ec as s,fb as ne,fc as F,fd as U,gb as y,gc as C,hb as W,hc as se,jc as z,kc as J,kd as R,lc as Q,mb as I,nb as A,nd as me,pa as T,pd as G,qa as x,sd as L,tb as m,tc as Y,uc as b,vb as u,vc as V,wa as te,wc as X,xb as oe,xc as de,yb as re,za as f,zb as le}from"./chunk-KYVLS64M.js";import{a as B,b as H}from"./chunk-KMHZKFQS.js";var k=class{Cost;Profit;Sales;SalesWithTax;Tax;Count;TopOutlet};var ee=t=>({"border-bottom":t}),$=()=>["/menu/Reports/Sales_Report/Standard/Summary"],Ne=(t,n,e)=>({From:t,To:n,ListIDs:e}),Re=t=>({today:t}),Pe=(t,n)=>({From:t,To:n});function Le(t,n){if(t&1){let e=v();o(0,"div",6)(1,"a",15),s(2),r(),o(3,"ul",16)(4,"li")(5,"a",17),P("click",function(){T(e);let a=d();return a.isTodayFilter=!a.isTodayFilter,x(a.onChangeFilterPeriod())}),s(6),r()()()()}if(t&2){let e=d();l(2),C(" ",e.isTodayFilter?"Today":"Last 7 Days"," "),l(),c("ngClass",V(3,Re,!e.isTodayFilter)),l(3),C(" ",e.isTodayFilter?"Last 7 Days":"Today"," ")}}function ke(t,n){t&1&&(o(0,"span",7),s(1,"Today"),r())}function Be(t,n){if(t&1&&(o(0,"div",18)(1,"a",9),h(2,"date"),h(3,"date"),o(4,"div",10),s(5,"Tax"),r(),o(6,"div",19)(7,"small",20),s(8),r(),o(9,"h2",11),s(10),h(11,"number"),r()()()(),o(12,"div",8)(13,"a",9),h(14,"date"),h(15,"date"),o(16,"div",10),s(17,"Sales + Tax"),r(),o(18,"div",19)(19,"small",20),s(20),r(),o(21,"h2",11),s(22),h(23,"number"),r()()()()),t&2){let e=d();l(),c("routerLink",b(27,$))("queryParams",X(28,Pe,_(2,9,e.isTodayFilter?e.today:e.chartData==null?null:e.chartData.From,"yyyy-MM-dd"),_(3,12,e.isTodayFilter?e.today:e.dateTo,"yyyy-MM-dd"))),l(7),C(" ",e.dashboardConfig==null?null:e.dashboardConfig.CurrencySymbol," "),l(2),C(" ",_(11,15,e.salesData==null?null:e.salesData.Tax,"1.0-0")," "),l(2),c("ngClass",V(31,ee,e.role.product.Cost)),l(),c("routerLink",b(33,$))("queryParams",X(34,Pe,_(14,18,e.isTodayFilter?e.today:e.chartData==null?null:e.chartData.From,"yyyy-MM-dd"),_(15,21,e.isTodayFilter?e.today:e.dateTo,"yyyy-MM-dd"))),l(7),C(" ",e.dashboardConfig==null?null:e.dashboardConfig.CurrencySymbol," "),l(2),C(" ",_(23,24,e.salesData==null?null:e.salesData.SalesWithTax,"1.0-0")," ")}}function He(t,n){if(t&1&&(o(0,"div",8)(1,"div")(2,"div",21),s(3,"Cost"),r(),o(4,"div",19)(5,"small",20),s(6),r(),o(7,"h2",11),s(8),h(9,"number"),r()()()()),t&2){let e=d();c("ngClass",V(6,ee,e.role.report.Profit)),l(6),C(" ",e.dashboardConfig==null?null:e.dashboardConfig.CurrencySymbol," "),l(2),C(" ",_(9,3,e.salesData==null?null:e.salesData.Cost,"1.0-0")," ")}}function Ye(t,n){if(t&1&&(o(0,"div",12)(1,"div")(2,"div",22),s(3),r(),o(4,"div",19)(5,"small",20),s(6),r(),o(7,"h2",11),s(8),h(9,"number"),r()()()()),t&2){let e=d();l(3),C(" ",e.includeTax?"Gross Profit":"Profit"," "),l(3),C(" ",e.dashboardConfig==null?null:e.dashboardConfig.CurrencySymbol," "),l(2),C(" ",_(9,3,e.salesData==null?null:e.salesData.Profit,"1.0-0")," ")}}var Z=class t{constructor(n,e){this.dashboardService=n;this.role=e;this.chartConfig=this.dashboardService.getLineChartConfig()}chartData;salesData;dashboardConfig;filterSalesWidget=new te;chartConfig;todaySalesData;weeklySalesData;isTodayFilter=!0;showPeriodFilter;includeTax;today=new Date;dateTo;filterByOutletIds=pe([]);ngOnChanges(n){if(n.chartData&&n.chartData.currentValue){this.initSalesData();let e=n?.chartData?.currentValue?.Series;e=this.setChartLineColor(e),e=this.setSalesTaxLegend(e),this.chartConfig=H(B({},this.chartConfig),{series:e}),this.chartConfig=this.dashboardService.setSeriesPointStart(this.chartData.From,this.chartConfig),this.initPeriodFilter(e),this.getDateTo()}}initPeriodFilter(n){this.showPeriodFilter=n[0]?.data?.length>=7}initSalesData(){this.salesData=new k,this.includeTax=this.isIncludeTax(),this.salesData.Sales=this.dashboardService.getTotalData("Sales",this.chartData.Series,1),this.salesData.SalesWithTax=this.dashboardService.getTotalData("Sales + Tax",this.chartData.Series,1),this.salesData.Cost=this.dashboardService.getTotalData("Cost",this.chartData.Series,1),this.salesData.Tax=this.salesData.SalesWithTax-this.salesData.Sales,this.salesData.Profit=(this.includeTax?this.salesData.SalesWithTax:this.salesData.Sales)-this.salesData.Cost,this.salesData.Count=this.dashboardService.getTotalData("Count",this.chartData.Series,1),this.todaySalesData=Oe(k,this.salesData)}setChartLineColor(n=[]){return n?.map(e=>(e.name=="Sales"&&(e.color="rgb(44, 175, 254)",e.fillColor=this.dashboardService.getLinierGradient("rgb(44, 175, 254)")),e.name=="Cost"&&(e.color="#fb404b",e.fillColor=this.dashboardService.getLinierGradient("#fb404b")),e.name=="Sales + Tax"&&(e.color="#2ECC71",e.fillColor=this.dashboardService.getLinierGradient("#2ECC71")),e))}onChangeFilterPeriod(){this.isTodayFilter?this.salesData=this.todaySalesData:(this.generateWeeklySalesData(),this.salesData=this.weeklySalesData),this.filterSalesWidget.emit({period:this.isTodayFilter?"TODAY":"WEEKLY"})}getDateTo(){let n=new Date,e=new Date(this.chartData.From);n.setDate(e.getDate()+7),this.dateTo=n}generateWeeklySalesData(){if(_e.IsEmpty(this.weeklySalesData)){let n=this.dashboardService.getTotalData("Sales",this.chartData.Series,7),e=this.dashboardService.getTotalData("Sales + Tax",this.chartData.Series,7),i=this.dashboardService.getTotalData("Cost",this.chartData.Series,7),a=this.dashboardService.getTotalData("Count",this.chartData.Series,7),p=e-n,g=(this.includeTax?e:n)-i;this.weeklySalesData=this.weeklySalesData?this.weeklySalesData:new k,this.weeklySalesData.Sales=n,this.weeklySalesData.SalesWithTax=e,this.weeklySalesData.Cost=i,this.weeklySalesData.Profit=g,this.weeklySalesData.Tax=p,this.weeklySalesData.Count=a}}isIncludeTax(){let n=this.chartData.Series;return this.dashboardService.filterSeriesByName("Sales + Tax",n).visible}setSalesTaxLegend(n){return n=n.map(e=>(e.name=="Sales + Tax"&&(e.showInLegend=this.salesData.Tax>0),e)),n}static \u0275fac=function(e){return new(e||t)(E(O),E(j))};static \u0275cmp=M({type:t,selectors:[["app-sales-widget"]],inputs:{chartData:"chartData",dashboardConfig:"dashboardConfig",filterByOutletIds:[1,"filterByOutletIds"]},outputs:{filterSalesWidget:"onFilter"},features:[Y([O]),ae],decls:25,vars:30,consts:[[1,"d-flex","flex-row","flex-wrap","mt-8","justify-content-between"],[1,"chart-widget"],["containerId","salesChart",3,"config"],[1,"sales-card-widget"],[1,"border","rounded","rounded-bottom-0","px-8","py-4","w-100","h-auto"],[1,"border-bottom","d-flex","align-items-center","justify-content-end",2,"height","42px"],[1,"btn-group"],[1,"link-dark","fs-2","headings-font-family"],[1,"text-end","card-row","d-flex","align-items-center","justify-content-end",3,"ngClass"],["target","_blank",1,"link-dark",3,"routerLink","queryParams"],[1,"fs-5"],[1,"fw-normal"],[1,"text-end","d-flex","align-items-center","justify-content-end","card-row"],[1,"card-footer","border","rounded-bottom","border-top-0","text-end","p-3"],["routerLink","/menu/Setup/Configuration/Application"],["type","button","data-bs-toggle","dropdown","aria-expanded","false",1,"dropdown-toggle","link-dark","fs-2","headings-font-family"],[1,"dropdown-menu","p-0",2,"position","absolute","right","20px !important",3,"ngClass"],["role","button",1,"dropdown-item","fs-4",3,"click"],[1,"text-end","border-bottom","card-row","d-flex","align-items-center","justify-content-end"],[1,"d-flex","align-items-center","justify-content-end"],[1,"me-2"],[1,"fs-5","text-danger"],[1,"fs-5","text-success"]],template:function(e,i){e&1&&(o(0,"div",0)(1,"div",1),S(2,"app-chart-container",2),r(),o(3,"div",3)(4,"div",4)(5,"div",5),m(6,Le,7,5,"div",6)(7,ke,2,0,"span",7),r(),o(8,"div",8)(9,"a",9),h(10,"date"),h(11,"date"),o(12,"div",10),s(13,"Order"),r(),o(14,"h2",11),s(15),h(16,"number"),r()()(),m(17,Be,24,37),m(18,He,10,8,"div",8),m(19,Ye,10,6,"div",12),r(),o(20,"div",13)(21,"a",14)(22,"small"),s(23),h(24,"date"),r()()()()()),e&2&&(l(2),c("config",i.chartConfig),l(4),u(!(i.role==null||i.role.dashboard==null)&&i.role.dashboard.View&&i.showPeriodFilter?6:7),l(2),c("ngClass",V(23,ee,(i.salesData==null?null:i.salesData.Tax)||i.role.product.Cost)),l(),c("routerLink",b(25,$))("queryParams",de(26,Ne,_(10,11,i.isTodayFilter?i.today:i.chartData==null?null:i.chartData.From,"yyyy-MM-dd"),_(11,14,i.isTodayFilter?i.today:i.dateTo,"yyyy-MM-dd"),i.filterByOutletIds())),l(6),F(_(16,17,i.salesData==null?null:i.salesData.Count,"1.0-0")),l(2),u((i.salesData==null?null:i.salesData.Tax)>0?17:-1),l(),u(i.role.product.Cost?18:-1),l(),u(i.role.report.Profit&&i.role.product.Cost?19:-1),l(4),se("",_(24,20,i.dashboardConfig==null?null:i.dashboardConfig.SpanConfigTime,"dd MMM HH:mm")," ",i.dashboardConfig==null?null:i.dashboardConfig.SmallTimeZone))},dependencies:[L,U,Ee,he,ue,xe,G,me],styles:[".chart-widget[_ngcontent-%COMP%]{width:80%}.link-dark[_ngcontent-%COMP%]{color:#333!important}.dropdown-menu.show.today[_ngcontent-%COMP%]{inset:0 auto auto -34px!important}.sales-card-widget[_ngcontent-%COMP%]{width:19%}.sales-card-widget[_ngcontent-%COMP%] .card-row[_ngcontent-%COMP%]{height:64px}@media only screen and (max-width:767px){.chart-widget[_ngcontent-%COMP%]{width:100%}.sales-card-widget[_ngcontent-%COMP%]{width:100%;margin-top:12px}}@media only screen and (min-width:768px)and (max-width:991px){.chart-widget[_ngcontent-%COMP%]{width:100%}.sales-card-widget[_ngcontent-%COMP%]{width:100%;margin-top:12px}}"]})};var Ue=t=>({active:t});function Ge(t,n){if(t&1&&(o(0,"div",1),s(1),r(),o(2,"div",2)(3,"small",3),s(4),r(),o(5,"h2",4),s(6),r()()),t&2){let e=d();l(),F(e.title),l(3),F(e.currencySymbol),l(2),F(e.value)}}function je(t,n){if(t&1&&(o(0,"div",1),s(1),r(),o(2,"h2",4),s(3,"-"),r()),t&2){let e=d();l(),F(e.title)}}var K=class t{title;isActive;currencySymbol;value;showValue;constructor(){}ngOnInit(){}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=M({type:t,selectors:[["app-card-widget"]],inputs:{title:"title",isActive:"isActive",currencySymbol:"currencySymbol",value:"value",showValue:"showValue"},decls:3,vars:4,consts:[[1,"card-widget","pe-0",3,"ngClass"],[1,"fs-4","headings-font-family"],[1,"d-flex","justify-content-start","align-items-center"],[1,"fw-normal","me-2"],[1,"fw-normal"]],template:function(e,i){e&1&&(o(0,"div",0),m(1,Ge,7,3)(2,je,4,1),r()),e&2&&(c("ngClass",V(2,Ue,i.isActive)),l(),u(i.showValue?1:2))},dependencies:[L,U],styles:[".card-widget[_ngcontent-%COMP%]{padding:20px;border-radius:6px;min-height:95px;border:.5px solid #e4e4e4;width:100%}.active[_ngcontent-%COMP%]{background-color:#f0f0f0}@media only screen and (max-width:767px){.card-widget[_ngcontent-%COMP%]{width:200px}}@media only screen and (min-width:768px)and (max-width:991px){.card-widget[_ngcontent-%COMP%]{width:200px}}"]})};var Ze=()=>[R,import("./chunk-HFZ6CP5O.js").then(t=>t.PaymentWidgetComponent)],Ke=()=>[R,import("./chunk-WCON5ROC.js").then(t=>t.PurchaseWidgetComponent)],qe=()=>[R,import("./chunk-47GUYGT7.js").then(t=>t.DebtWidgetComponent)],ze=()=>[R,import("./chunk-74ANNEMH.js").then(t=>t.ProductWidgetComponent)],Je=()=>[R,import("./chunk-MMBDCSDX.js").then(t=>t.InventoryWidgetComponent)],Qe=()=>({role:"Payment View Role"}),Xe=()=>({role:"Buy Report Role"}),$e=()=>({role:"Debt View Role"}),et=()=>({role:"Report View Role"}),tt=()=>({role:"Inventory View Role"});function it(t,n){if(t&1){let e=v();o(0,"div",13)(1,"h6"),s(2,"Outlet"),r(),o(3,"outlet-selector",14),Q("ngModelChange",function(a){T(e);let p=d();return J(p.dashboardFilter().Outlets,a)||(p.dashboardFilter().Outlets=a),x(a)}),r()()}if(t&2){let e=d();l(3),c("multiple",!0)("accessType",e.outletAccess()),z("ngModel",e.dashboardFilter().Outlets)}}function at(t,n){if(t&1){let e=v();o(0,"div",19),P("click",function(){let a=T(e).$implicit,p=d(2);return x(p.onClickCardWidget(a))}),S(1,"app-card-widget",20),h(2,"number"),r()}if(t&2){let e=n.$implicit,i=d(),a=d();l(),c("title",e.title)("matTooltip",e.tooltip)("currencySymbol",i==null||i.ConfigData==null?null:i.ConfigData.CurrencySymbol)("value",e.value==null?"-":_(2,6,e.value,"1.0-0"))("showValue",e.showValue)("isActive",e.id==a.activeTab())}}function nt(t,n){if(t&1){let e=v();o(0,"app-sales-widget",21),P("onFilter",function(a){T(e);let p=d(2);return x(p.onFilterSalesWidget(a))}),r()}if(t&2){let e=d(),i=d();c("dashboardConfig",e==null?null:e.ConfigData)("chartData",e==null?null:e.HighChartData)("filterByOutletIds",i.dashboardFilter().Outlets)}}function ot(t,n){t&1&&N(0)}function rt(t,n){if(t&1){let e=v();o(0,"app-payment-widget",23),P("onFilter",function(a){T(e);let p=d(4);return x(p.onFilterPaymentWidget(a))}),r()}if(t&2){let e,i=d(3),a=d();c("dashboardConfig",i==null?null:i.ConfigData)("chartData",(e=a.paymentData())==null?null:e.Data)}}function lt(t,n){if(t&1&&y(0,ot,1,0,"ng-container",22)(1,rt,1,2,"ng-template",null,2,w),t&2){let e=D(2),i=d(3),a=D(11);c("ngTemplateOutlet",i.role.payment.View?e:a)("ngTemplateOutletContext",b(2,Qe))}}function st(t,n){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function dt(t,n){t&1&&(W(0,lt,3,3)(1,st,2,0),I(2,0,Ze,null,1),A(0,-1))}function ct(t,n){t&1&&N(0)}function pt(t,n){if(t&1&&S(0,"app-purchase-widget",18),t&2){let e,i=d(3),a=d();c("dashboardConfig",i==null?null:i.ConfigData)("chartData",(e=a.purchaseData())==null?null:e.HighChartData)("filterByOutletIds",a.dashboardFilter().Outlets)}}function mt(t,n){if(t&1&&y(0,ct,1,0,"ng-container",22)(1,pt,1,3,"ng-template",null,3,w),t&2){let e=D(2),i=d(3),a=D(11);c("ngTemplateOutlet",i.role.buy.Report?e:a)("ngTemplateOutletContext",b(2,Xe))}}function ut(t,n){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function ht(t,n){t&1&&(W(0,mt,3,3)(1,ut,2,0),I(2,0,Ke,null,1),A(0,-1))}function _t(t,n){t&1&&N(0)}function Ct(t,n){if(t&1&&S(0,"app-debt-widget",25),t&2){let e,i=d(3),a=d();c("dashboardConfig",i==null?null:i.ConfigData)("debtData",(e=a.debtData())==null?null:e.PageData)}}function gt(t,n){if(t&1&&y(0,_t,1,0,"ng-container",22)(1,Ct,1,2,"ng-template",null,4,w),t&2){let e=D(2),i=d(3),a=D(11);c("ngTemplateOutlet",i.role.debt.View?e:a)("ngTemplateOutletContext",b(2,$e))}}function ft(t,n){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function Dt(t,n){t&1&&(W(0,gt,3,3)(1,ft,2,0),I(2,0,qe,null,1),A(0,-1))}function bt(t,n){t&1&&N(0)}function St(t,n){if(t&1&&S(0,"app-product-widget",26),t&2){let e,i=d(3),a=d();c("dashboardConfig",i==null?null:i.ConfigData)("productData",(e=a.productData())==null?null:e.PageData)}}function Tt(t,n){if(t&1&&y(0,bt,1,0,"ng-container",22)(1,St,1,2,"ng-template",null,5,w),t&2){let e=D(2),i=d(3),a=D(11);c("ngTemplateOutlet",i.role.report.View?e:a)("ngTemplateOutletContext",b(2,et))}}function xt(t,n){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function yt(t,n){t&1&&(W(0,Tt,3,3)(1,xt,2,0),I(2,0,ze,null,1),A(0,-1))}function vt(t,n){t&1&&N(0)}function wt(t,n){if(t&1&&S(0,"app-inventory-widget",27),t&2){let e,i=d(3),a=d();c("dashboardConfig",i==null?null:i.ConfigData)("logisticsData",(e=a.logisticsData())==null?null:e.PageData)}}function Ot(t,n){if(t&1&&y(0,vt,1,0,"ng-container",22)(1,wt,1,2,"ng-template",null,6,w),t&2){let e=D(2),i=d(3),a=D(11);c("ngTemplateOutlet",i.role.inventory.View?e:a)("ngTemplateOutletContext",b(2,tt))}}function Et(t,n){t&1&&(o(0,"div",24),s(1," LOADING... "),r())}function Pt(t,n){t&1&&(W(0,Ot,3,3)(1,Et,2,0),I(2,0,Je,null,1),A(0,-1))}function Ft(t,n){if(t&1&&(o(0,"div",12)(1,"div",15)(2,"div",16),re(3,at,3,9,"div",17,oe),r(),m(5,nt,1,3,"app-sales-widget",18),m(6,dt,4,0),m(7,ht,4,0),m(8,Dt,4,0),m(9,yt,4,0),m(10,Pt,4,0),r()()),t&2){let e=d();l(3),le(e.cardWidgetComputed()),l(2),u(e.activeTab()=="SALES"?5:-1),l(),u(e.activeTab()=="PAYMENT"?6:-1),l(),u(e.activeTab()=="PURCHASE"?7:-1),l(),u(e.activeTab()=="DEBT"?8:-1),l(),u(e.activeTab()=="PRODUCT"?9:-1),l(),u(e.activeTab()=="LOGISTICS"?10:-1)}}function Vt(t,n){if(t&1&&(o(0,"div",24)(1,"div",28)(2,"div"),S(3,"img",29),r(),o(4,"h1",30),s(5,"You are not authorized"),r(),o(6,"p"),s(7," This page requires role "),o(8,"span",31),s(9),r(),s(10," to be accessed. Please contact your Administrator to gain access! "),r()()()),t&2){let e=n.role;l(9),C("[",e,"]")}}var We=class t extends Se{constructor(e,i,a){super(e);this.dashboardService=i;this.role=a;this.menuData$.subscribe(),this.fetchAllData(),ie(()=>{this.updateCardWidget()})}cardWidget=f([]);outletAccess=f(2);dashboardFilter=f({Outlets:[]});salesData=f(null);paymentData=f(null);purchaseData=f(null);debtData=f(null);productData=f(null);logisticsData=f(null);activeTab=f("SALES");cardWidgetComputed=ce(()=>this.cardWidget().map(e=>{let i=!1;if(e.id==="SALES"?i=this.role.dashboard.View:e.id==="PAYMENT"?i=this.role.payment.View:e.id==="PURCHASE"?i=this.role.buy.Create&&this.role.buy.Report:e.id==="DEBT"?i=this.role.debt.View:e.id==="PRODUCT"?i=this.role.report.View:e.id==="LOGISTICS"?i=this.role.inventory.View:i=!0,!i)return null;let a=e.tooltip;return e.id==="SALES"?a=this.activeTab()==="SALES"?e.tooltip:"Total Sales Today":e.id==="PAYMENT"?a=this.activeTab()==="PAYMENT"?e.tooltip:"Total Payment Today":e.id==="PURCHASE"?a=this.activeTab()==="PURCHASE"?e.tooltip:"Total Purchase Today":e.id==="DEBT"?a=this.activeTab()==="DEBT"?e.tooltip:"Total Debt Today":e.id==="PRODUCT"?a=this.activeTab()==="PRODUCT"?e.tooltip:"Total Product Today":e.id==="LOGISTICS"&&(a=this.activeTab()==="LOGISTICS"?e.tooltip:"Total Logistics Today"),H(B({},e),{tooltip:a})}).filter(e=>e!==null));fetchAllData(){this.dashboardService.getDashboardSales(this.dashboardFilter()).subscribe(e=>this.salesData.set(e))}updateCardWidget(){let e=this.activeTab();if(e==="SALES"&&this.salesData()){let i=this.dashboardService.getTotalData("Sales",this.salesData().HighChartData.Series,1);this.dashboardService.setWidgetData(i,e).subscribe(a=>this.cardWidget.set(a))}else if(e==="PAYMENT"&&this.paymentData()){let i=this.dashboardService.getTotalData("All",this.paymentData().Data.Series,1);this.dashboardService.setWidgetData(i,e).subscribe(a=>this.cardWidget.set(a))}else if(e==="PURCHASE"&&this.purchaseData()){let i=this.dashboardService.getTotalData("Purchase",this.purchaseData().HighChartData.Series,1);this.dashboardService.setWidgetData(i,e).subscribe(a=>this.cardWidget.set(a))}else if(e==="DEBT"&&this.debtData()){let i=this.debtData().PageData.Receivable;this.dashboardService.setWidgetData(i,e).subscribe(a=>this.cardWidget.set(a))}else if(e==="LOGISTICS"&&this.logisticsData()){let i=this.logisticsData()?.PageData?.Logistic?.Total;i&&this.dashboardService.setWidgetData(i,e).subscribe(a=>this.cardWidget.set(a)),this.dashboardService.getDashboardLogistics(this.dashboardFilter()).subscribe(a=>{this.logisticsData.set(a)})}}onFilterByOutlet(){this.dashboardService.clearCache(),this.fetchAllData(),this.updateCardWidget()}onClickCardWidget(e){switch(this.activeTab.set(e.id),e.id){case"SALES":this.dashboardService.getDashboardSales(this.dashboardFilter()).subscribe(i=>this.salesData.set(i));break;case"PURCHASE":this.dashboardService.getDashboardPurchase(this.dashboardFilter()).subscribe(i=>this.purchaseData.set(i));break;case"DEBT":this.dashboardService.getDashboardDebt(this.dashboardFilter()).subscribe(i=>this.debtData.set(i));break;case"PRODUCT":this.dashboardService.getDashboardProduct(this.dashboardFilter()).subscribe(i=>this.productData.set(i));break;case"LOGISTICS":this.dashboardService.getDashboardLogistics(this.dashboardFilter()).subscribe(i=>{console.log("Received logistics data => ",i.PageData),this.logisticsData.set(i)});break;case"PAYMENT":this.dashboardService.getDashboardPayment(this.dashboardFilter()).subscribe(i=>this.paymentData.set(i));break;default:new Error("Invalid widget type")}this.updateCardWidget()}onFilterSalesWidget(e){if(!this.salesData())return;let i=e.period==="WEEKLY"?7:1,a=this.dashboardService.getTotalData("Sales",this.salesData().HighChartData.Series,i);this.dashboardService.setWidgetData(a,"SALES").subscribe(p=>{this.cardWidget.set(p.map(g=>(g.id==="SALES"&&(g.tooltip=e.period==="TODAY"?"Total Sales Today":"Total Sales last 7 days"),g)))})}onFilterPaymentWidget(e){if(!this.paymentData())return;let i=e.period==="WEEKLY"?7:1,a=this.dashboardService.getTotalData("All",this.paymentData().Data.Series,i);this.dashboardService.setWidgetData(a,"PAYMENT").subscribe(p=>{this.cardWidget.set(p.map(g=>(g.id==="PAYMENT"&&(g.tooltip=e.period==="TODAY"?"Total Payment Today":"Total Payment last 7 days"),g)))})}static \u0275fac=function(i){return new(i||t)(E(Te),E(O),E(j))};static \u0275cmp=M({type:t,selectors:[["POS-dashboard-v2"]],features:[Y([O]),ne],decls:12,vars:5,consts:[["pageFilterTemplate",""],["NOT_AUTHORIZED",""],["PAYMENT",""],["BUY",""],["DEBT",""],["PRODUCT",""],["INVENTORY",""],[3,"onSubmit","filterChange","hideSearchBox","pageData","isFilterOnDropdown","filter"],[1,"content"],[1,"container-fluid","bg-light-gray","p-8"],[1,"row"],[1,"col-12"],[1,"card","mb-0"],[1,"dialog-filter"],["appendTo","body","placeholder","Select Outlets",3,"ngModelChange","multiple","accessType","ngModel"],[1,"card-body"],[1,"d-flex","flex-row","flex-nowrap","justify-content-between","align-items-center","overflow-auto",2,"column-gap","18px"],[1,"cursor-pointer","card-widget-tab"],[3,"dashboardConfig","chartData","filterByOutletIds"],[1,"cursor-pointer","card-widget-tab",3,"click"],["matTooltipPosition","above",3,"title","matTooltip","currencySymbol","value","showValue","isActive"],[3,"onFilter","dashboardConfig","chartData","filterByOutletIds"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"onFilter","dashboardConfig","chartData"],[1,"d-flex","align-items-center","justify-content-center","mt-8",2,"height","350px"],[3,"dashboardConfig","debtData"],[3,"dashboardConfig","productData"],[3,"dashboardConfig","logisticsData"],[1,"text-center"],["src","https://cdn.dealpos.xyz/web-image/locked.svg",2,"width","160px"],[1,"mt-2","mb-6"],[1,"fw-bold"]],template:function(i,a){if(i&1){let p=v();o(0,"mainpanel-cmp",7),P("onSubmit",function(){return a.onFilterByOutlet()}),Q("filterChange",function(q){return T(p),J(a.dashboardFilter,q)||(a.dashboardFilter=q),x(q)}),o(1,"filters"),y(2,it,4,3,"ng-template",null,0,w),r(),o(4,"content")(5,"div",8)(6,"div",9)(7,"div",10)(8,"div",11),m(9,Ft,11,6,"div",12),r()()()()()(),y(10,Vt,11,1,"ng-template",null,1,w)}if(i&2){let p;c("hideSearchBox",!0)("pageData",a.menuData)("isFilterOnDropdown",!1),z("filter",a.dashboardFilter),l(9),u((p=a.salesData())?9:-1,p)}},dependencies:[L,ve,ye,fe,Ce,ge,Z,K,we,be,De,G],styles:[".card-widget-tab[_ngcontent-%COMP%]{flex:1 1 0px}@media only screen and (max-width:767px){.card-widget-tab[_ngcontent-%COMP%]{margin-right:1rem;margin-top:.5rem;width:auto}}@media only screen and (min-width:768px)and (max-width:991px){.card-widget-tab[_ngcontent-%COMP%]{margin-right:1rem;margin-top:.5rem;width:auto}}"]})};export{We as DashboardV2Component};
@@ -1 +1 @@
1
- import{a as P}from"./chunk-4FXF3VYI.js";import{Ab as u,Bb as o,Cb as r,Db as m,Nd as M,Ra as i,Rb as a,ab as x,ac as C,dc as v,ec as c,fc as _,gc as f,qc as h,tb as g,vb as b,wb as s,yb as p,zb as d}from"./chunk-KYVLS64M.js";import"./chunk-KMHZKFQS.js";function w(n,t){if(n&1&&(o(0,"div",3)(1,"a",4)(2,"div",5)(3,"div",6)(4,"div",7)(5,"div",8)(6,"div",9),m(7,"i"),r()(),o(8,"div",10)(9,"span",11),c(10),r(),m(11,"br"),o(12,"span",12),c(13),r()()()()()()()),n&2){let e=t.$implicit,l=a(2).$implicit,k=a();i(),u("routerLink",e.path),i(5),C("background-color",k.getCssColor(l.colorClass)),i(),v(h("",e.icon," icon-inner")),i(3),f(" ",e.label," "),i(3),f(" ",e.description," ")}}function y(n,t){if(n&1&&(o(0,"div",2),p(1,w,14,8,"div",3,s),r()),n&2){let e=a().$implicit;i(),d(e.children)}}function O(n,t){if(n&1&&(o(0,"h4",1),c(1),r(),g(2,y,3,0,"div",2)),n&2){let e=t.$implicit;i(),_(e.label),i(),b(e.children&&e.children.length>0?2:-1)}}var S=class n{settingsData=P;getCssColor(t){return t?t.match(/^#|^rgb|^hsl/)?t:`var(${t.startsWith("--")?t:`--${t.replace(/^\$/,"")}`})`:null}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=x({type:n,selectors:[["POS-home"]],decls:3,vars:0,consts:[[1,"px-12"],[1,"fw-bold","mt-6"],[1,"row","mt-4"],[1,"col-md-6","col-xl-4","col-lg-6","col-sm-12","px-4"],[3,"routerLink"],[1,"card","cursor-pointer",2,"height","75%"],[1,"card-body"],[1,"row","px-3"],[1,"col-2","p-0","d-flex","justify-content-center","align-items-center"],[1,"border","d-flex","justify-content-center","align-items-center","icon"],[1,"col-10","text-start","ps-2"],[1,"mb-3","fw-bold",2,"font-size","0.8rem"],[2,"font-size","0.6rem"]],template:function(e,l){e&1&&(o(0,"div",0),p(1,O,3,2,null,null,s),r()),e&2&&(i(),d(l.settingsData))},dependencies:[M],styles:[".card[_ngcontent-%COMP%]{transition:all .3s ease-in-out;border-radius:18px}.card[_ngcontent-%COMP%]:hover{box-shadow:0 2px 5px 1px #0000001a}.cursor-pointer[_ngcontent-%COMP%]{cursor:pointer}.icon[_ngcontent-%COMP%]{width:27px;height:27px;font-size:clamp(12px,1.5vw,14px);border-radius:10px}.icon-inner[_ngcontent-%COMP%]{line-height:1;font-size:.7rem}[_nghost-%COMP%]{--color-1: #cbb3e6;--color-2: #b3e6bb;--color-3: #ebaec4;--color-4: #a4d4f5;--color-5: #b3e6bb;--color-6: #a8def0;--color-7: #b3e8d1;--color-8: #b3e0e6;--color-9: #f2baa7;--color-10: #b3e6dc}"]})};export{S as HomeComponent};
1
+ import{a as P}from"./chunk-K3MT4ZKO.js";import{Ab as u,Bb as o,Cb as r,Db as m,Nd as M,Ra as i,Rb as a,ab as x,ac as C,dc as v,ec as c,fc as _,gc as f,qc as h,tb as g,vb as b,wb as s,yb as p,zb as d}from"./chunk-KYVLS64M.js";import"./chunk-KMHZKFQS.js";function w(n,t){if(n&1&&(o(0,"div",3)(1,"a",4)(2,"div",5)(3,"div",6)(4,"div",7)(5,"div",8)(6,"div",9),m(7,"i"),r()(),o(8,"div",10)(9,"span",11),c(10),r(),m(11,"br"),o(12,"span",12),c(13),r()()()()()()()),n&2){let e=t.$implicit,l=a(2).$implicit,k=a();i(),u("routerLink",e.path),i(5),C("background-color",k.getCssColor(l.colorClass)),i(),v(h("",e.icon," icon-inner")),i(3),f(" ",e.label," "),i(3),f(" ",e.description," ")}}function y(n,t){if(n&1&&(o(0,"div",2),p(1,w,14,8,"div",3,s),r()),n&2){let e=a().$implicit;i(),d(e.children)}}function O(n,t){if(n&1&&(o(0,"h4",1),c(1),r(),g(2,y,3,0,"div",2)),n&2){let e=t.$implicit;i(),_(e.label),i(),b(e.children&&e.children.length>0?2:-1)}}var S=class n{settingsData=P;getCssColor(t){return t?t.match(/^#|^rgb|^hsl/)?t:`var(${t.startsWith("--")?t:`--${t.replace(/^\$/,"")}`})`:null}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=x({type:n,selectors:[["POS-home"]],decls:3,vars:0,consts:[[1,"px-12"],[1,"fw-bold","mt-6"],[1,"row","mt-4"],[1,"col-md-6","col-xl-4","col-lg-6","col-sm-12","px-4"],[3,"routerLink"],[1,"card","cursor-pointer",2,"height","75%"],[1,"card-body"],[1,"row","px-3"],[1,"col-2","p-0","d-flex","justify-content-center","align-items-center"],[1,"border","d-flex","justify-content-center","align-items-center","icon"],[1,"col-10","text-start","ps-2"],[1,"mb-3","fw-bold",2,"font-size","0.8rem"],[2,"font-size","0.6rem"]],template:function(e,l){e&1&&(o(0,"div",0),p(1,O,3,2,null,null,s),r()),e&2&&(i(),d(l.settingsData))},dependencies:[M],styles:[".card[_ngcontent-%COMP%]{transition:all .3s ease-in-out;border-radius:18px}.card[_ngcontent-%COMP%]:hover{box-shadow:0 2px 5px 1px #0000001a}.cursor-pointer[_ngcontent-%COMP%]{cursor:pointer}.icon[_ngcontent-%COMP%]{width:27px;height:27px;font-size:clamp(12px,1.5vw,14px);border-radius:10px}.icon-inner[_ngcontent-%COMP%]{line-height:1;font-size:.7rem}[_nghost-%COMP%]{--color-1: #cbb3e6;--color-2: #b3e6bb;--color-3: #ebaec4;--color-4: #a4d4f5;--color-5: #b3e6bb;--color-6: #a8def0;--color-7: #b3e8d1;--color-8: #b3e0e6;--color-9: #f2baa7;--color-10: #b3e6dc}"]})};export{S as HomeComponent};
@@ -1 +1 @@
1
- import{c as u}from"./chunk-OLWDO546.js";import{b as s}from"./chunk-CORTGR3V.js";import{Md as a,la as e}from"./chunk-KYVLS64M.js";var g=(t,c)=>{let r=e(a),i=e(u);if(i.isTokenExpired())return i.returnUrl=c.url,r.navigate(["/"]),!1;let d=e(s),o=t.data?.roles;if(o){let n=t.data?.unauthorizedRedirect;if(!o.some(l=>d.isUserHasRole(l)))return n?r.navigate([n]):r.navigate(["menu/Unauthorized/Main/Unauthorized"]),!1}return!0};export{g as a};
1
+ import{c as u}from"./chunk-WJZSM6CH.js";import{b as s}from"./chunk-CORTGR3V.js";import{Md as a,la as e}from"./chunk-KYVLS64M.js";var g=(t,c)=>{let r=e(a),i=e(u);if(i.isTokenExpired())return i.returnUrl=c.url,r.navigate(["/"]),!1;let d=e(s),o=t.data?.roles;if(o){let n=t.data?.unauthorizedRedirect;if(!o.some(l=>d.isUserHasRole(l)))return n?r.navigate([n]):r.navigate(["menu/Unauthorized/Main/Unauthorized"]),!1}return!0};export{g as a};
@@ -1,4 +1,4 @@
1
- import{k as ze,o as tt,q as it,r as nt}from"./chunk-P2FAKIKL.js";import{a as Ke,b as qe}from"./chunk-ZFSMBBTC.js";import{a as ot,b as rt}from"./chunk-2B7RNO36.js";import{a as Ye,b as Je,e as Qe,f as Xe,g as Ze,h as et}from"./chunk-7HKIQJO2.js";import{a as z}from"./chunk-HMY7DJXX.js";import{a as oe,b as Ge,c as We}from"./chunk-ZIR7IDMB.js";import{F as je,a as Le,c as Ue,h as He,l as Be,s as $e}from"./chunk-TG23CQGV.js";import{a as v}from"./chunk-PTRS3UA6.js";import{n as k,q}from"./chunk-FWVQ6CFL.js";import{$b as Me,Aa as ie,Ab as h,Bb as s,C as Z,Cb as d,Db as M,G as r,H as pe,I as ee,Jb as $,K as ue,Ka as ye,L as D,Ma as be,Mb as w,O as me,Pb as y,Pc as A,Qc as W,Ra as l,Rb as p,Rc as Ae,Sb as xe,Tb as j,Ya as F,Zb as Te,_ as u,_b as Ie,aa as te,ab as V,ac as Ee,bb as ve,bc as ke,c as le,ca as I,d as se,dc as S,e as P,ec as x,fc as E,fd as Ne,ga as fe,gb as Ce,gc as Pe,ha as U,i as ce,ia as ge,k as X,ka as H,kd as K,l as _,la as B,m as a,pa as C,pb as Oe,qa as O,qc as De,r as g,s as de,sd as Re,tb as m,tc as Fe,vb as f,vc as G,wa as b,wc as ne,xb as _e,yb as Se,yc as Ve,za as he,zb as we}from"./chunk-KYVLS64M.js";import{a as R,b as L}from"./chunk-KMHZKFQS.js";var N=class{static emptyDate="Please fill invoice date";static emptyNumber="Please fill invoice number";static emptyOrderNumber="Number is Required";static failGetMenu="Fail to get pos menu";static failToGetRetur="Fail to get retur";static failGetLocalPosStorage="Fail to get setting and option from local storage, Please re-cache your data while online!";static failGetVariant='"Error getting variant with {0} {1}" - {2}';static failGetLocalVariant="Fail to get variant from local storage, Please re-cache your data while online!";static emptyBarcodeFormat='No product with barcode "{0}"';static emptyCustomerFormat='No customer with code "{0}"';static failGetSalesOrder="Fail to get sales order";static failBin="Fail to bin transaction";static failGetCustomer="Fail to get customer's data";static failCreateCustomer="Fail to create customer";static noRoleContact="You have no right to create new customer";static submitLocally="Connection unavailable ~ offline! Order stored locally";static offlineMode="There is no internet connection, it is now in offline mode";static OfflineOrderNotSupport="Offline order is not Supported!";static failOrderConnectionTimeOut="Connection timeout! Please try uploading your order again!";static failDeletePark="Fail to delete park";static emptyAccessRegister="You do not have access to any Register";static failGenerateNewNumber="Fail to generate new number";static emptyPayment="There is no active payment method.";static failOpenRegister="Fail to open register";static failGetLocalOutletInfo="Fail to get outlet information from local storage, Please re-cache your data while online!";static failTrySubmit=`[Error submitting order]
1
+ import{k as ze,o as tt,q as it,r as nt}from"./chunk-P2FAKIKL.js";import{a as Ke,b as qe}from"./chunk-ZFSMBBTC.js";import{a as ot,b as rt}from"./chunk-2CTOK7WF.js";import{a as Ye,b as Je,e as Qe,f as Xe,g as Ze,h as et}from"./chunk-7HKIQJO2.js";import{a as z}from"./chunk-HMY7DJXX.js";import{a as oe,b as Ge,c as We}from"./chunk-ZIR7IDMB.js";import{F as je,a as Le,c as Ue,h as He,l as Be,s as $e}from"./chunk-TG23CQGV.js";import{a as v}from"./chunk-PTRS3UA6.js";import{n as k,q}from"./chunk-FWVQ6CFL.js";import{$b as Me,Aa as ie,Ab as h,Bb as s,C as Z,Cb as d,Db as M,G as r,H as pe,I as ee,Jb as $,K as ue,Ka as ye,L as D,Ma as be,Mb as w,O as me,Pb as y,Pc as A,Qc as W,Ra as l,Rb as p,Rc as Ae,Sb as xe,Tb as j,Ya as F,Zb as Te,_ as u,_b as Ie,aa as te,ab as V,ac as Ee,bb as ve,bc as ke,c as le,ca as I,d as se,dc as S,e as P,ec as x,fc as E,fd as Ne,ga as fe,gb as Ce,gc as Pe,ha as U,i as ce,ia as ge,k as X,ka as H,kd as K,l as _,la as B,m as a,pa as C,pb as Oe,qa as O,qc as De,r as g,s as de,sd as Re,tb as m,tc as Fe,vb as f,vc as G,wa as b,wc as ne,xb as _e,yb as Se,yc as Ve,za as he,zb as we}from"./chunk-KYVLS64M.js";import{a as R,b as L}from"./chunk-KMHZKFQS.js";var N=class{static emptyDate="Please fill invoice date";static emptyNumber="Please fill invoice number";static emptyOrderNumber="Number is Required";static failGetMenu="Fail to get pos menu";static failToGetRetur="Fail to get retur";static failGetLocalPosStorage="Fail to get setting and option from local storage, Please re-cache your data while online!";static failGetVariant='"Error getting variant with {0} {1}" - {2}';static failGetLocalVariant="Fail to get variant from local storage, Please re-cache your data while online!";static emptyBarcodeFormat='No product with barcode "{0}"';static emptyCustomerFormat='No customer with code "{0}"';static failGetSalesOrder="Fail to get sales order";static failBin="Fail to bin transaction";static failGetCustomer="Fail to get customer's data";static failCreateCustomer="Fail to create customer";static noRoleContact="You have no right to create new customer";static submitLocally="Connection unavailable ~ offline! Order stored locally";static offlineMode="There is no internet connection, it is now in offline mode";static OfflineOrderNotSupport="Offline order is not Supported!";static failOrderConnectionTimeOut="Connection timeout! Please try uploading your order again!";static failDeletePark="Fail to delete park";static emptyAccessRegister="You do not have access to any Register";static failGenerateNewNumber="Fail to generate new number";static emptyPayment="There is no active payment method.";static failOpenRegister="Fail to open register";static failGetLocalOutletInfo="Fail to get outlet information from local storage, Please re-cache your data while online!";static failTrySubmit=`[Error submitting order]
2
2
  {0}`;static failTryCreateCustomer=`"[Error creating customer]
3
3
  "{0}`;static createCustomerOffline="Create customer is not supported when the connection offline";static emptyCustomer="Please select customer!";static emptySalesPerson="Please select sales person!";static emptySalesType="Please select sales type!";static failCreateNewVariant="Fail to create new variant";static requiredDefaultCategory="[WARNING] - POS / Quick Create Product requires Default Category";static emptyVariant="Item is undefined, please re-type";static emptyPOItem="You must have at least one item";static emptyEntity="Please select entity before proceeding..";static failGetRetrieve="Fail to get retrieve";static failTryPark=`[Error submitting park]
4
4
  {0}`;static failTryGetPark=`[Error during get park]
@@ -0,0 +1 @@
1
+ import{a as u}from"./chunk-DLFAOP72.js";import{I as s,za as p}from"./chunk-KYVLS64M.js";import{a,b as o}from"./chunk-KMHZKFQS.js";var n=class extends u{constructor(t,e,r,d){super(t);this.httpService=e;this.formDataAPI=r;this.route=d;let m=this.route.snapshot.queryParams;this.menuData$.pipe(s(()=>this.httpService.post(`/api/${this.formDataAPI}`,m))).subscribe(i=>{this.data.set(i),this.postBindForm(i)})}data=p(null);get formData(){return this.data()?.Form}set formData(t){this.data.update(e=>o(a({},e||{}),{Form:t}))}get options(){return this.data()?.Options?this.data().Options:{}}get Roles(){return this.data()?.Roles?this.data().Roles:{}}postBindForm(t){}onSubmit(t,e=!1){this.preSubmitForm(),this.httpService.post(`/api/${t}`,this.formData).subscribe({next:r=>{this.onSubmitSuccess(r)},error:r=>{this.onSubmitError(r)}})}compare(t,e,r){return(t<e?-1:1)*(r?1:-1)}preSubmitForm(){}onSubmitSuccess(t){}onSubmitError(t){}};export{n as a};