dealpos 25.33.1 → 25.33.3

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 (227) hide show
  1. package/browser/{chunk-SAH7IP6B.js → chunk-23F7BAD4.js} +1 -1
  2. package/browser/chunk-26VM7INR.js +1 -0
  3. package/browser/{chunk-GZPYBKLU.js → chunk-27B3EJYS.js} +1 -1
  4. package/browser/{chunk-GKMHUTWU.js → chunk-2CF4DNRJ.js} +1 -1
  5. package/browser/{chunk-3Y6ALAKB.js → chunk-2CR4RLOO.js} +1 -1
  6. package/browser/{chunk-I2RZGXSU.js → chunk-2GYZF4SG.js} +1 -1
  7. package/browser/{chunk-RUY73ZXB.js → chunk-2HNTEQIO.js} +1 -1
  8. package/browser/{chunk-PN42JNTR.js → chunk-2JQMOR3F.js} +1 -1
  9. package/browser/{chunk-ZR67IS3A.js → chunk-2PHUXLDC.js} +1 -1
  10. package/browser/{chunk-RRKEIWWF.js → chunk-2PQVXABG.js} +1 -1
  11. package/browser/{chunk-JCV45T2Q.js → chunk-2QIJACIE.js} +1 -1
  12. package/browser/{chunk-FD3YITS3.js → chunk-2SGAADSU.js} +1 -1
  13. package/browser/{chunk-QBXDN6EK.js → chunk-2Y7ETRYY.js} +1 -1
  14. package/browser/{chunk-QSBXKK7O.js → chunk-3DNIXXKN.js} +1 -1
  15. package/browser/{chunk-KZRSQLLX.js → chunk-3GFVCNY7.js} +1 -1
  16. package/browser/{chunk-LBQMTOMR.js → chunk-3KWHPBIS.js} +1 -1
  17. package/browser/{chunk-CXCIK73V.js → chunk-3LN2ZQ5M.js} +1 -1
  18. package/browser/{chunk-23ZINFRQ.js → chunk-3OCFMCN6.js} +1 -1
  19. package/browser/{chunk-MYYAY3DG.js → chunk-4CDO4BGU.js} +1 -1
  20. package/browser/{chunk-TFG4W2SP.js → chunk-4DRK677C.js} +1 -1
  21. package/browser/{chunk-LQRO2X2G.js → chunk-4DTXPMOC.js} +1 -1
  22. package/browser/chunk-4JRXN7L6.js +8 -0
  23. package/browser/{chunk-OTM4XCOI.js → chunk-4LY2EDTJ.js} +1 -1
  24. package/browser/{chunk-FZJ2KHO5.js → chunk-4QABXC6I.js} +1 -1
  25. package/browser/{chunk-ZN4NX5IC.js → chunk-4SXNNKVU.js} +1 -1
  26. package/browser/{chunk-LXIGDPIK.js → chunk-4WQVX4OG.js} +1 -1
  27. package/browser/{chunk-6ABJSGTB.js → chunk-4X34JSTE.js} +1 -1
  28. package/browser/{chunk-V7PKUK2B.js → chunk-5FWBKPIR.js} +1 -1
  29. package/browser/{chunk-GSJ6SIKG.js → chunk-5KIYRKDB.js} +1 -1
  30. package/browser/{chunk-44DP4B2F.js → chunk-5OWBM526.js} +1 -1
  31. package/browser/chunk-5SG3U2LE.js +1 -0
  32. package/browser/{chunk-DAPBC4VF.js → chunk-5X4TYOVV.js} +1 -1
  33. package/browser/{chunk-OKTYQSEE.js → chunk-6HWLZ7MY.js} +1 -1
  34. package/browser/{chunk-GE3HYQI3.js → chunk-6IPMQNXW.js} +1 -1
  35. package/browser/{chunk-UKMVTEK2.js → chunk-6JDIOP24.js} +1 -1
  36. package/browser/{chunk-AX6SAOHJ.js → chunk-6K2OUQQO.js} +1 -1
  37. package/browser/{chunk-ICKXBQIB.js → chunk-6SJFXBQD.js} +1 -1
  38. package/browser/{chunk-TC4KHMDU.js → chunk-6Y6JUUIW.js} +1 -1
  39. package/browser/{chunk-7A47FQCF.js → chunk-75R46V26.js} +1 -1
  40. package/browser/{chunk-SOE2NRSN.js → chunk-7CO272RZ.js} +1 -1
  41. package/browser/{chunk-2XNKBCZT.js → chunk-7ENTF2JM.js} +2 -2
  42. package/browser/{chunk-HSJLVJO7.js → chunk-7J46C3HU.js} +1 -1
  43. package/browser/{chunk-KPTDYFSC.js → chunk-7JSHH4R2.js} +1 -1
  44. package/browser/chunk-7Q44L4FM.js +3 -0
  45. package/browser/{chunk-MY7AWJC2.js → chunk-7UDFGZYI.js} +1 -1
  46. package/browser/{chunk-FT3Y3TLO.js → chunk-7ZQLZ3LI.js} +1 -1
  47. package/browser/{chunk-IZ4ZKSUB.js → chunk-AC3QBCJI.js} +1 -1
  48. package/browser/{chunk-VLLWRHIC.js → chunk-AFTCPQ2Z.js} +1 -1
  49. package/browser/{chunk-OWVU6UUD.js → chunk-ASUCEKKD.js} +1 -1
  50. package/browser/{chunk-NPPJAY77.js → chunk-ATKSX3BI.js} +1 -1
  51. package/browser/{chunk-GWRKEEMZ.js → chunk-B7EGVH5M.js} +1 -1
  52. package/browser/{chunk-DWMQDYCW.js → chunk-BCST7SJD.js} +2 -2
  53. package/browser/{chunk-5P3WBU6E.js → chunk-C3N7XCPM.js} +1 -1
  54. package/browser/{chunk-2GLJ2JYF.js → chunk-CA6TV26I.js} +1 -1
  55. package/browser/{chunk-A4IWXQNL.js → chunk-CESNQI72.js} +1 -1
  56. package/browser/{chunk-ZRR7ZRMT.js → chunk-CHMP2XLU.js} +1 -1
  57. package/browser/{chunk-4MP2QVUO.js → chunk-CO5HNLC3.js} +1 -1
  58. package/browser/{chunk-FUWXXPV6.js → chunk-D4XF6ATY.js} +1 -1
  59. package/browser/{chunk-QIY5VPUF.js → chunk-DGYJPXD2.js} +1 -1
  60. package/browser/{chunk-UHVX3YMN.js → chunk-DMK5QYXM.js} +1 -1
  61. package/browser/{chunk-USLEDKAZ.js → chunk-DXQHYGPP.js} +1 -1
  62. package/browser/{chunk-JOVEWS47.js → chunk-DYMSPCUQ.js} +1 -1
  63. package/browser/{chunk-557ENNEJ.js → chunk-EF6MO54B.js} +1 -1
  64. package/browser/{chunk-FV5IEXH4.js → chunk-EHJK2TZP.js} +1 -1
  65. package/browser/{chunk-MYDD5N75.js → chunk-ESETI6U2.js} +1 -1
  66. package/browser/{chunk-C3VA5WSC.js → chunk-EXXHAXIE.js} +1 -1
  67. package/browser/{chunk-WOIM4V7A.js → chunk-F7A5YBE3.js} +1 -1
  68. package/browser/{chunk-Y5WXMDXZ.js → chunk-FEOJH4YT.js} +1 -1
  69. package/browser/{chunk-FBW6B5RT.js → chunk-FJMA54MJ.js} +1 -1
  70. package/browser/{chunk-5FLP5GW7.js → chunk-FNBVGME7.js} +1 -1
  71. package/browser/{chunk-OR3J6WS4.js → chunk-FQT6I56Q.js} +1 -1
  72. package/browser/chunk-G473IPAB.js +1 -0
  73. package/browser/{chunk-R6CGU363.js → chunk-G4M5BBLD.js} +1 -1
  74. package/browser/{chunk-6JQVOJRF.js → chunk-GF3LE5GG.js} +1 -1
  75. package/browser/{chunk-V4P3RTYJ.js → chunk-GNW7WFRF.js} +1 -1
  76. package/browser/{chunk-7DBELJ54.js → chunk-GRDFUJDB.js} +1 -1
  77. package/browser/{chunk-IPSWK42O.js → chunk-GSYSJCJO.js} +2 -2
  78. package/browser/{chunk-QQEMHNJR.js → chunk-GWQO5XR3.js} +1 -1
  79. package/browser/{chunk-UDWWB3EN.js → chunk-GYY77CVS.js} +1 -1
  80. package/browser/{chunk-2RMKBZ2Q.js → chunk-H34CGBCE.js} +1 -1
  81. package/browser/{chunk-X6XFIARI.js → chunk-H5V7XYWU.js} +1 -1
  82. package/browser/{chunk-F7Z6MA4Q.js → chunk-HKSXEKBU.js} +1 -1
  83. package/browser/{chunk-RVFSB5N3.js → chunk-HVVCKBEX.js} +1 -1
  84. package/browser/{chunk-GTWDSRNK.js → chunk-HXXLRVAY.js} +1 -1
  85. package/browser/chunk-HYW3752X.js +1 -0
  86. package/browser/{chunk-H5CLXQVL.js → chunk-I2XKWI7S.js} +1 -1
  87. package/browser/{chunk-LGZ5Q2GS.js → chunk-IF4IHL75.js} +1 -1
  88. package/browser/{chunk-CSDUWJT5.js → chunk-IGMWKNR7.js} +1 -1
  89. package/browser/{chunk-WZJE5UVL.js → chunk-IOMMQNQV.js} +1 -1
  90. package/browser/{chunk-SUVLUVXI.js → chunk-IQTKJ75B.js} +1 -1
  91. package/browser/{chunk-B7SOO5L3.js → chunk-IRFJ42AU.js} +1 -1
  92. package/browser/{chunk-IG4W2TLL.js → chunk-IXGNTK76.js} +1 -1
  93. package/browser/{chunk-TNR5DDAL.js → chunk-J2N33O52.js} +1 -1
  94. package/browser/{chunk-R2TIYFDZ.js → chunk-J6CP7GKF.js} +1 -1
  95. package/browser/{chunk-U3IU7SQE.js → chunk-JFW3YXFQ.js} +1 -1
  96. package/browser/chunk-JFWQ6WMR.js +1 -0
  97. package/browser/{chunk-OVDAQH64.js → chunk-JL245CSS.js} +1 -1
  98. package/browser/{chunk-A63IZ2M2.js → chunk-JNNSXEJR.js} +1 -1
  99. package/browser/{chunk-NCQBSGVI.js → chunk-JUXFOJTD.js} +1 -1
  100. package/browser/{chunk-JP32QZCH.js → chunk-JX46UHZU.js} +1 -1
  101. package/browser/{chunk-NA2E4U54.js → chunk-JXYX3EPH.js} +1 -1
  102. package/browser/{chunk-44CJAK76.js → chunk-K2KWXQ27.js} +1 -1
  103. package/browser/{chunk-JEAUWLOG.js → chunk-K2RY2UAW.js} +1 -1
  104. package/browser/{chunk-2ZKVCBQL.js → chunk-KAP27Y52.js} +1 -1
  105. package/browser/{chunk-V6YWIQ4N.js → chunk-KFBEFMSM.js} +1 -1
  106. package/browser/{chunk-N5KACKWK.js → chunk-KM2HKOBY.js} +1 -1
  107. package/browser/{chunk-BH2NWNI6.js → chunk-L3QWXIFA.js} +1 -1
  108. package/browser/{chunk-PYOAODA4.js → chunk-LAKOPFJU.js} +1 -1
  109. package/browser/{chunk-WD3WDFFQ.js → chunk-LIZXMNGH.js} +1 -1
  110. package/browser/{chunk-M672IATW.js → chunk-LQ5QJ4EI.js} +1 -1
  111. package/browser/{chunk-O6YS7HWF.js → chunk-LS4HUMWF.js} +1 -1
  112. package/browser/{chunk-YTL2A7M6.js → chunk-LVXIAYA2.js} +1 -1
  113. package/browser/{chunk-TJGCUVKV.js → chunk-M2QK4P35.js} +1 -1
  114. package/browser/{chunk-OJ67R2M3.js → chunk-MIBHIYLI.js} +1 -1
  115. package/browser/{chunk-Y2EMQU6T.js → chunk-MJFNCSAV.js} +1 -1
  116. package/browser/{chunk-LJC4R6OE.js → chunk-MPU5CCEX.js} +1 -1
  117. package/browser/{chunk-ZX3JDU5U.js → chunk-MRCXYWK7.js} +1 -1
  118. package/browser/{chunk-KACMGPPD.js → chunk-MSGJXJYJ.js} +1 -1
  119. package/browser/{chunk-QKVT4R45.js → chunk-MVIMZ6NA.js} +2 -2
  120. package/browser/{chunk-WJUA4NOW.js → chunk-MXI7U4Y6.js} +1 -1
  121. package/browser/{chunk-U3GB3XPB.js → chunk-MZD4PYPB.js} +1 -1
  122. package/browser/{chunk-6KKK43W2.js → chunk-N5O35YCN.js} +1 -1
  123. package/browser/{chunk-TG3EXUGW.js → chunk-NA4Q6BMJ.js} +1 -1
  124. package/browser/{chunk-MDWAAAAE.js → chunk-NE4UQDXL.js} +1 -1
  125. package/browser/chunk-NL6VWRWF.js +1 -0
  126. package/browser/{chunk-BYPYMJTK.js → chunk-NNPN5V6Z.js} +1 -1
  127. package/browser/{chunk-ULPIXFJG.js → chunk-NQF3I6AQ.js} +1 -1
  128. package/browser/{chunk-YP253EXN.js → chunk-NQOE5O3H.js} +1 -1
  129. package/browser/{chunk-JTVQZG2W.js → chunk-O4LLQJLA.js} +1 -1
  130. package/browser/{chunk-3WXH7TC2.js → chunk-O5YBRGFV.js} +1 -1
  131. package/browser/{chunk-57MF7DME.js → chunk-O6V6TXYB.js} +1 -1
  132. package/browser/{chunk-YOI6AW4O.js → chunk-OETRMFSK.js} +1 -1
  133. package/browser/{chunk-2XMGXXSA.js → chunk-OFMEKBOQ.js} +1 -1
  134. package/browser/{chunk-WFYOTWZX.js → chunk-OG2S3ECN.js} +1 -1
  135. package/browser/{chunk-ULHKFBSV.js → chunk-OQ334FTE.js} +1 -1
  136. package/browser/{chunk-D3MXHLH7.js → chunk-ORADADFD.js} +1 -1
  137. package/browser/{chunk-6BTW2J5N.js → chunk-OWPJAIOW.js} +1 -1
  138. package/browser/{chunk-GBXW7QCR.js → chunk-OWSJ7SJP.js} +1 -1
  139. package/browser/{chunk-AJBYNIGH.js → chunk-P36Z2Q2X.js} +1 -1
  140. package/browser/{chunk-TQPOA654.js → chunk-P63D2M46.js} +1 -1
  141. package/browser/{chunk-S5FSMJQX.js → chunk-P7SYPRMD.js} +1 -1
  142. package/browser/{chunk-EE6Q7MTA.js → chunk-PGBLZQZV.js} +3 -3
  143. package/browser/{chunk-YM3XPKCI.js → chunk-PILVBZE6.js} +1 -1
  144. package/browser/{chunk-WLORDCWC.js → chunk-PP6MNON6.js} +1 -1
  145. package/browser/{chunk-NFYBEIT4.js → chunk-PQUF3LRY.js} +1 -1
  146. package/browser/{chunk-NV2CVPNB.js → chunk-PXE3SNOR.js} +1 -1
  147. package/browser/{chunk-7IAVOBRB.js → chunk-PZXRSIP6.js} +1 -1
  148. package/browser/{chunk-VVJXK36P.js → chunk-Q4A7DDAZ.js} +1 -1
  149. package/browser/{chunk-43SD2LRI.js → chunk-QACVHZNZ.js} +1 -1
  150. package/browser/{chunk-ONPMCQJG.js → chunk-QBBMXIVG.js} +1 -1
  151. package/browser/{chunk-TFQACQ2G.js → chunk-QBSDJ7ZY.js} +1 -1
  152. package/browser/chunk-QD3KWUXF.js +1 -0
  153. package/browser/{chunk-LUBF4EHM.js → chunk-QGQE5D7M.js} +1 -1
  154. package/browser/{chunk-WAMP3ZZQ.js → chunk-QJZBVGUT.js} +1 -1
  155. package/browser/{chunk-CDWJCIL2.js → chunk-QKS57HOB.js} +1 -1
  156. package/browser/{chunk-QHU5A2VO.js → chunk-QSF44FW2.js} +1 -1
  157. package/browser/{chunk-BCWW7Y2T.js → chunk-QXLTEMGO.js} +1 -1
  158. package/browser/{chunk-PPWWM7R4.js → chunk-R252C5HM.js} +1 -1
  159. package/browser/{chunk-AYL43YXH.js → chunk-R44I6IR7.js} +1 -1
  160. package/browser/{chunk-FFLZJTNS.js → chunk-R57UVE6D.js} +1 -1
  161. package/browser/{chunk-S2JC7T5C.js → chunk-R5HXWIDB.js} +1 -1
  162. package/browser/{chunk-TPEXCEVI.js → chunk-RCANV6GW.js} +1 -1
  163. package/browser/{chunk-YZOSHDT3.js → chunk-S6UO67AT.js} +1 -1
  164. package/browser/{chunk-D5BAEFCK.js → chunk-SAH2VPIY.js} +1 -1
  165. package/browser/chunk-SCGWHTH7.js +1 -0
  166. package/browser/{chunk-ODSZMOU5.js → chunk-SDIK6O2Z.js} +1 -1
  167. package/browser/{chunk-AJEIAGQW.js → chunk-SMUUKOJZ.js} +1 -1
  168. package/browser/{chunk-5QTFAB3S.js → chunk-SQXCXGLK.js} +1 -1
  169. package/browser/{chunk-OH4QBQCQ.js → chunk-SSHYD4OE.js} +1 -1
  170. package/browser/{chunk-H3HM5Q2A.js → chunk-SZXQWHBO.js} +1 -1
  171. package/browser/{chunk-3STBDZHM.js → chunk-T47QWLZY.js} +1 -1
  172. package/browser/{chunk-G7XJTTIW.js → chunk-TMACENTH.js} +1 -1
  173. package/browser/{chunk-KZOENNYH.js → chunk-TPQEOIK7.js} +1 -1
  174. package/browser/{chunk-ENNJQBDB.js → chunk-TRURAFXK.js} +1 -1
  175. package/browser/{chunk-HHKXW7AO.js → chunk-TSRU64Y6.js} +1 -1
  176. package/browser/{chunk-YY2XI4GB.js → chunk-TVWAOPGO.js} +1 -1
  177. package/browser/{chunk-WGVQUSNZ.js → chunk-U6QMM4FZ.js} +1 -1
  178. package/browser/{chunk-7CFWCYCD.js → chunk-UD6LJYER.js} +1 -1
  179. package/browser/{chunk-JF3B5CXP.js → chunk-UJ6CSWW7.js} +1 -1
  180. package/browser/{chunk-GY3UG4VG.js → chunk-UKKFUEUF.js} +1 -1
  181. package/browser/{chunk-OMFWHP5N.js → chunk-ULY5PCYT.js} +1 -1
  182. package/browser/{chunk-XWTOJM2Q.js → chunk-UN45PHQC.js} +1 -1
  183. package/browser/{chunk-6WP4FXW7.js → chunk-UNERUJ6Z.js} +1 -1
  184. package/browser/{chunk-BTKHED2U.js → chunk-UVBIMCGQ.js} +1 -1
  185. package/browser/{chunk-DHRN5QNC.js → chunk-UZGY2QDB.js} +1 -1
  186. package/browser/{chunk-PRWQAMSB.js → chunk-VGQZ2QT3.js} +1 -1
  187. package/browser/{chunk-QESKIRSK.js → chunk-VJPD6EYA.js} +1 -1
  188. package/browser/{chunk-DR7EZXM2.js → chunk-VLGOLBLH.js} +1 -1
  189. package/browser/{chunk-PYKWLOZT.js → chunk-W4FNMTVI.js} +1 -1
  190. package/browser/{chunk-L6V2NY4E.js → chunk-W5WJIKYL.js} +1 -1
  191. package/browser/{chunk-GHJMCNWR.js → chunk-WAFRNTTW.js} +1 -1
  192. package/browser/{chunk-EMIOR2AO.js → chunk-WGO2RAXM.js} +1 -1
  193. package/browser/{chunk-YIDG6PA6.js → chunk-WGV74EJE.js} +1 -1
  194. package/browser/{chunk-26KF723V.js → chunk-WQKH5AEN.js} +1 -1
  195. package/browser/{chunk-X3C3XTGE.js → chunk-X2FYFSD6.js} +1 -1
  196. package/browser/{chunk-7I2YE5GD.js → chunk-X7OOXEJK.js} +1 -1
  197. package/browser/{chunk-GRGVTVVF.js → chunk-XACAUM4I.js} +1 -1
  198. package/browser/{chunk-MFHD36TR.js → chunk-XE2XWXKX.js} +1 -1
  199. package/browser/{chunk-KHGXOTFH.js → chunk-XEN2UMFL.js} +1 -1
  200. package/browser/{chunk-7IUOZN33.js → chunk-XMGAU3CI.js} +1 -1
  201. package/browser/{chunk-QUYGU4S3.js → chunk-XTSDKAHO.js} +1 -1
  202. package/browser/{chunk-4F47EOGA.js → chunk-Y4GWMIHA.js} +1 -1
  203. package/browser/{chunk-BEAJXEIQ.js → chunk-YBCSONKM.js} +1 -1
  204. package/browser/{chunk-2LGWP36Z.js → chunk-YKM33JR5.js} +1 -1
  205. package/browser/{chunk-PBJT67ND.js → chunk-YLQ2QXS2.js} +1 -1
  206. package/browser/{chunk-E7VQ3MRN.js → chunk-YQ4PVPM5.js} +1 -1
  207. package/browser/{chunk-3GNF6T3S.js → chunk-YVVFYHF7.js} +1 -1
  208. package/browser/{chunk-CQTY3YBQ.js → chunk-Z5LFI6A5.js} +1 -1
  209. package/browser/chunk-ZKAAESOC.js +1 -0
  210. package/browser/{chunk-4CESOX3B.js → chunk-ZRO2AZMB.js} +1 -1
  211. package/browser/{chunk-RCQAWZI7.js → chunk-ZW6IATXM.js} +1 -1
  212. package/browser/{chunk-PAY5YM4R.js → chunk-ZXNGEXWM.js} +1 -1
  213. package/browser/{chunk-K54YNOL7.js → chunk-ZZNHFTQQ.js} +1 -1
  214. package/browser/index.html +2 -2
  215. package/browser/{main-SIFQCEOE.js → main-OD6SCKDN.js} +2 -2
  216. package/package.json +1 -1
  217. package/browser/chunk-4L4LOCER.js +0 -1
  218. package/browser/chunk-5QOKN5SA.js +0 -1
  219. package/browser/chunk-7DKHREO4.js +0 -1
  220. package/browser/chunk-BH2HTSHJ.js +0 -1
  221. package/browser/chunk-DEWFYDEH.js +0 -1
  222. package/browser/chunk-EMG6GGPN.js +0 -1
  223. package/browser/chunk-FVHWNW7U.js +0 -8
  224. package/browser/chunk-OFH4W2M6.js +0 -1
  225. package/browser/chunk-Q6S2XJUS.js +0 -1
  226. package/browser/chunk-SZGRSMXH.js +0 -3
  227. package/browser/chunk-W7WO22Z4.js +0 -1
@@ -1 +1 @@
1
- import{a as lt}from"./chunk-7DKHREO4.js";import{a as rt}from"./chunk-XWTOJM2Q.js";import{a as at}from"./chunk-7IAVOBRB.js";import{B as et,C as ot,D as it,E as nt,u as Y,v as Z,w as tt}from"./chunk-AJBYNIGH.js";import{ga as K,ha as X}from"./chunk-2RMKBZ2Q.js";import{O as v,n as I}from"./chunk-SAH7IP6B.js";import{a as J}from"./chunk-2FWFPV5I.js";import{D as q,a as G,c as H,h as U,o as $}from"./chunk-JEAUWLOG.js";import{a as T}from"./chunk-KPTDYFSC.js";import{$a as a,E as b,Eb as E,Fa as w,Gb as A,Hb as F,Ib as n,Jb as r,Kb as u,Ob as x,Qb as d,Rb as c,Td as z,Uc as W,Xc as O,db as p,ec as f,fa as P,fc as k,gc as L,hd as M,jc as V,kb as C,kc as B,lc as j,na as N,nc as R,pc as Q,qb as m,va as y,vb as s,wa as S,xc as g,zc as _}from"./chunk-FVHWNW7U.js";var ft=i=>({selected:i});function gt(i,t){if(i&1){let e=x();n(0,"div",6)(1,"div",7)(2,"span",8),u(3,"i",9),r(),n(4,"input",10),j("ngModelChange",function(l){y(e);let h=c();return B(h.outletQuery,l)||(h.outletQuery=l),S(l)}),r()()()}if(i&2){let e=c();a(4),V("ngModel",e.outletQuery)}}function _t(i,t){if(i&1){let e=x();n(0,"div",12),d("click",function(){y(e);let l=c().$implicit,h=c();return S(h.selectOutlet(l))}),u(1,"i",13),n(2,"h5"),f(3),g(4,"limitTo"),r(),n(5,"div",14),f(6,"VACANT"),r()()}if(i&2){let e=c().$implicit,o=c();s("ngClass",Q(5,ft,e.ID===o.id)),a(3),k(_(4,2,e.Name,15))}}function ht(i,t){if(i&1&&m(0,_t,7,7,"div",11),i&2){let e=t.$implicit,o=c();s("ngIf",e.ID!==o.sourceOutletID)}}var D=class i{constructor(t,e,o){this.dialogRef=t;this.data=e;this.toastr=o;this.config.title=e.dialogTitle,this.config.customWidth="600px",this.config.bodyScrollable=!0,this.id=e.outletID,this.sourceOutletID=e.sourceOutletID}outletQuery="";config=new ot;name="";id="";sourceOutletID="";outlet;selectOutlet(t){this.outlet=t,this.name=t.Name,this.id=t.ID}ok(){T.IsNotEmpty(this.name)&&T.IsNotEmpty(this.id)?this.dialogRef.close({Name:this.name,ID:Object.prototype.hasOwnProperty.call(this.outlet,"EntityID")?this.outlet.EntityID:this.outlet.ID}):this.toastr.info("Please select an outlet",J.Info)}static \u0275fac=function(e){return new(e||i)(p(Y),p(Z),p(z))};static \u0275cmp=C({type:i,selectors:[["POS-modal-select-outlet"]],decls:9,vars:5,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container-fluid"],[1,"row","mb-5"],["style","width: 200px","class","p-0",4,"ngIf"],[1,"row"],[1,"col-4","outlet-option","pointer",3,"ngClass"],[1,"p-0",2,"width","200px"],[1,"input-group","mb-3"],[1,"input-group-text","txtFilter"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["type","text","placeholder","Filter by Name","aria-label","Search",1,"txtFilter","form-control","border-start-0",3,"ngModelChange","ngModel"],["class","col-4 outlet-option pointer",3,"ngClass","click",4,"ngIf"],[1,"col-4","outlet-option","pointer",3,"click","ngClass"],[1,"fa-solid","fa-shop"],[1,"text-center","mt-6",2,"font-size","1.25rem"]],template:function(e,o){e&1&&(n(0,"modal-material",0),d("onOk",function(){return o.ok()})("onCancel",function(){return o.dialogRef.close()})("onClose",function(){return o.dialogRef.close()}),n(1,"content")(2,"div",1)(3,"div",2),m(4,gt,5,1,"div",3),r(),n(5,"div",4),A(6,ht,1,1,"div",5,E),g(8,"filterByName"),r()()()()),e&2&&(s("config",o.config),a(4),s("ngIf",o.data.outlets.length>6),a(2),F(_(8,2,o.data.outlets,o.outletQuery)))},dependencies:[M,W,O,nt,it,at,q,H,U,$,v,I],styles:[".row[_ngcontent-%COMP%]{row-gap:20px;column-gap:12px}.row[_ngcontent-%COMP%] .outlet-option[_ngcontent-%COMP%]{height:110px;width:175px;border:1px solid #B1AAAA;border-radius:5px;padding:0;font-size:14px;position:relative}.row[_ngcontent-%COMP%] .outlet-option[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{position:absolute;top:8px;left:10px;color:#fff}.row[_ngcontent-%COMP%] .outlet-option[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{border-radius:4px;color:#fff;background:#b1aaaa;overflow:hidden;height:30px;width:100%;display:flex;align-items:center;padding-left:38px}.row[_ngcontent-%COMP%] .outlet-option[_ngcontent-%COMP%]:hover, .row[_ngcontent-%COMP%] .outlet-option.selected[_ngcontent-%COMP%]{background:#ffffe1;border:1px solid #89b03e}.row[_ngcontent-%COMP%] .outlet-option[_ngcontent-%COMP%]:hover > h5[_ngcontent-%COMP%], .row[_ngcontent-%COMP%] .outlet-option.selected[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%]{background:#89b03e}"]})};function Ct(i,t){i&1&&u(0,"i",3)}var st=class i{constructor(t){this.matDialog=t}sf=N(rt);_isOpenAfterLoad;hideLocationIcon=!1;dialogTitle="Choose an Outlet";limitOutletText=25;sourceOutletID="";set isOpenAfterLoad(t){t!==void 0&&(this._isOpenAfterLoad=t,this._isOpenAfterLoad&&this._outlets?.length>1&&this.openModalSelectOutlet())}_outlets;set outlets(t){if(t)if(this._outlets=t,this._outlets.length==1){let e=this._outlets[0];this.assignOutlet(e.Name,Object.prototype.hasOwnProperty.call(e,"EntityID")?e.EntityID:e.ID)}else this._isOpenAfterLoad&&this.openModalSelectOutlet()}onCloseDialog=new w;outlet={ID:"",Name:"Choose an Outlet"};disabled=!1;onChange=t=>{};onTouched=()=>{};writeValue(t){this.outlet=t}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}openModalSelectOutlet(){this.disabled||(this.onTouched(),this.matDialog.getDialogById("select-outlet-modal")||this.matDialog.open(D,{id:"select-outlet-modal",data:{outlets:this._outlets,outletID:this.outlet.ID,dialogTitle:this.dialogTitle,sourceOutletID:this.sourceOutletID}}).afterClosed().pipe(b(t=>t),lt("modal select outlet"),P(()=>this.onCloseDialog.emit())).subscribe(t=>{this.assignOutlet(t.Name,t.ID),this.sf.searchFilterNativeEl?.focus()}))}assignOutlet(t,e){this.outlet={ID:e,Name:t},this.onChange(this.outlet)}static \u0275fac=function(e){return new(e||i)(p(tt))};static \u0275cmp=C({type:i,selectors:[["POS-select-outlet-form"]],inputs:{hideLocationIcon:"hideLocationIcon",dialogTitle:"dialogTitle",limitOutletText:"limitOutletText",sourceOutletID:"sourceOutletID",isOpenAfterLoad:"isOpenAfterLoad",outlets:"outlets"},outputs:{onCloseDialog:"onCloseDialog"},features:[R([{provide:G,multi:!0,useExisting:i}])],decls:5,vars:6,consts:[["matTooltipPosition","above",1,"outlet-container","d-flex","pointer",3,"click","matTooltip"],["class","fa-solid fa-location-dot",4,"ngIf"],[1,"ms-2","mb-0"],[1,"fa-solid","fa-location-dot"]],template:function(e,o){e&1&&(n(0,"div",0),d("click",function(){return o.openModalSelectOutlet()}),m(1,Ct,1,0,"i",1),n(2,"h3",2),f(3),g(4,"limitTo"),r()()),e&2&&(s("matTooltip",o.outlet==null?null:o.outlet.Name),a(),s("ngIf",!o.hideLocationIcon),a(2),L(" ",_(4,3,!(o.outlet==null||o.outlet.Name==null)&&o.outlet.Name.length?o.outlet==null?null:o.outlet.Name:"Choose an Outlet",o.limitOutletText)," "))},dependencies:[M,O,et,v,I,X,K],styles:[".outlet-container[_ngcontent-%COMP%] .fa-location-dot[_ngcontent-%COMP%]{color:#fb404b!important;font-size:32px}"]})};export{st as a};
1
+ import{a as lt}from"./chunk-HYW3752X.js";import{a as rt}from"./chunk-UN45PHQC.js";import{a as at}from"./chunk-PZXRSIP6.js";import{B as et,C as ot,D as it,E as nt,u as Y,v as Z,w as tt}from"./chunk-P36Z2Q2X.js";import{ga as K,ha as X}from"./chunk-H34CGBCE.js";import{O as v,n as I}from"./chunk-23F7BAD4.js";import{a as J}from"./chunk-2FWFPV5I.js";import{D as q,a as G,c as H,h as U,o as $}from"./chunk-K2RY2UAW.js";import{a as T}from"./chunk-7JSHH4R2.js";import{$a as a,Bc as _,E as b,Eb as E,Fa as w,Gb as A,Hb as F,Ib as n,Jb as r,Kb as u,Ob as x,Qb as d,Rb as c,Vd as z,Wc as W,Zc as O,db as p,ec as f,fa as P,fc as k,gc as L,jc as V,jd as M,kb as C,kc as B,lc as j,na as N,pc as R,qb as m,rc as Q,va as y,vb as s,wa as S,zc as g}from"./chunk-4JRXN7L6.js";var ft=i=>({selected:i});function gt(i,t){if(i&1){let e=x();n(0,"div",6)(1,"div",7)(2,"span",8),u(3,"i",9),r(),n(4,"input",10),j("ngModelChange",function(l){y(e);let h=c();return B(h.outletQuery,l)||(h.outletQuery=l),S(l)}),r()()()}if(i&2){let e=c();a(4),V("ngModel",e.outletQuery)}}function _t(i,t){if(i&1){let e=x();n(0,"div",12),d("click",function(){y(e);let l=c().$implicit,h=c();return S(h.selectOutlet(l))}),u(1,"i",13),n(2,"h5"),f(3),g(4,"limitTo"),r(),n(5,"div",14),f(6,"VACANT"),r()()}if(i&2){let e=c().$implicit,o=c();s("ngClass",Q(5,ft,e.ID===o.id)),a(3),k(_(4,2,e.Name,15))}}function ht(i,t){if(i&1&&m(0,_t,7,7,"div",11),i&2){let e=t.$implicit,o=c();s("ngIf",e.ID!==o.sourceOutletID)}}var D=class i{constructor(t,e,o){this.dialogRef=t;this.data=e;this.toastr=o;this.config.title=e.dialogTitle,this.config.customWidth="600px",this.config.bodyScrollable=!0,this.id=e.outletID,this.sourceOutletID=e.sourceOutletID}outletQuery="";config=new ot;name="";id="";sourceOutletID="";outlet;selectOutlet(t){this.outlet=t,this.name=t.Name,this.id=t.ID}ok(){T.IsNotEmpty(this.name)&&T.IsNotEmpty(this.id)?this.dialogRef.close({Name:this.name,ID:Object.prototype.hasOwnProperty.call(this.outlet,"EntityID")?this.outlet.EntityID:this.outlet.ID}):this.toastr.info("Please select an outlet",J.Info)}static \u0275fac=function(e){return new(e||i)(p(Y),p(Z),p(z))};static \u0275cmp=C({type:i,selectors:[["POS-modal-select-outlet"]],decls:9,vars:5,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container-fluid"],[1,"row","mb-5"],["style","width: 200px","class","p-0",4,"ngIf"],[1,"row"],[1,"col-4","outlet-option","pointer",3,"ngClass"],[1,"p-0",2,"width","200px"],[1,"input-group","mb-3"],[1,"input-group-text","txtFilter"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["type","text","placeholder","Filter by Name","aria-label","Search",1,"txtFilter","form-control","border-start-0",3,"ngModelChange","ngModel"],["class","col-4 outlet-option pointer",3,"ngClass","click",4,"ngIf"],[1,"col-4","outlet-option","pointer",3,"click","ngClass"],[1,"fa-solid","fa-shop"],[1,"text-center","mt-6",2,"font-size","1.25rem"]],template:function(e,o){e&1&&(n(0,"modal-material",0),d("onOk",function(){return o.ok()})("onCancel",function(){return o.dialogRef.close()})("onClose",function(){return o.dialogRef.close()}),n(1,"content")(2,"div",1)(3,"div",2),m(4,gt,5,1,"div",3),r(),n(5,"div",4),A(6,ht,1,1,"div",5,E),g(8,"filterByName"),r()()()()),e&2&&(s("config",o.config),a(4),s("ngIf",o.data.outlets.length>6),a(2),F(_(8,2,o.data.outlets,o.outletQuery)))},dependencies:[M,W,O,nt,it,at,q,H,U,$,v,I],styles:[".row[_ngcontent-%COMP%]{row-gap:20px;column-gap:12px}.row[_ngcontent-%COMP%] .outlet-option[_ngcontent-%COMP%]{height:110px;width:175px;border:1px solid #B1AAAA;border-radius:5px;padding:0;font-size:14px;position:relative}.row[_ngcontent-%COMP%] .outlet-option[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{position:absolute;top:8px;left:10px;color:#fff}.row[_ngcontent-%COMP%] .outlet-option[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{border-radius:4px;color:#fff;background:#b1aaaa;overflow:hidden;height:30px;width:100%;display:flex;align-items:center;padding-left:38px}.row[_ngcontent-%COMP%] .outlet-option[_ngcontent-%COMP%]:hover, .row[_ngcontent-%COMP%] .outlet-option.selected[_ngcontent-%COMP%]{background:#ffffe1;border:1px solid #89b03e}.row[_ngcontent-%COMP%] .outlet-option[_ngcontent-%COMP%]:hover > h5[_ngcontent-%COMP%], .row[_ngcontent-%COMP%] .outlet-option.selected[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%]{background:#89b03e}"]})};function Ct(i,t){i&1&&u(0,"i",3)}var st=class i{constructor(t){this.matDialog=t}sf=N(rt);_isOpenAfterLoad;hideLocationIcon=!1;dialogTitle="Choose an Outlet";limitOutletText=25;sourceOutletID="";set isOpenAfterLoad(t){t!==void 0&&(this._isOpenAfterLoad=t,this._isOpenAfterLoad&&this._outlets?.length>1&&this.openModalSelectOutlet())}_outlets;set outlets(t){if(t)if(this._outlets=t,this._outlets.length==1){let e=this._outlets[0];this.assignOutlet(e.Name,Object.prototype.hasOwnProperty.call(e,"EntityID")?e.EntityID:e.ID)}else this._isOpenAfterLoad&&this.openModalSelectOutlet()}onCloseDialog=new w;outlet={ID:"",Name:"Choose an Outlet"};disabled=!1;onChange=t=>{};onTouched=()=>{};writeValue(t){this.outlet=t}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}openModalSelectOutlet(){this.disabled||(this.onTouched(),this.matDialog.getDialogById("select-outlet-modal")||this.matDialog.open(D,{id:"select-outlet-modal",data:{outlets:this._outlets,outletID:this.outlet.ID,dialogTitle:this.dialogTitle,sourceOutletID:this.sourceOutletID}}).afterClosed().pipe(b(t=>t),lt("modal select outlet"),P(()=>this.onCloseDialog.emit())).subscribe(t=>{this.assignOutlet(t.Name,t.ID),this.sf.searchFilterNativeEl?.focus()}))}assignOutlet(t,e){this.outlet={ID:e,Name:t},this.onChange(this.outlet)}static \u0275fac=function(e){return new(e||i)(p(tt))};static \u0275cmp=C({type:i,selectors:[["POS-select-outlet-form"]],inputs:{hideLocationIcon:"hideLocationIcon",dialogTitle:"dialogTitle",limitOutletText:"limitOutletText",sourceOutletID:"sourceOutletID",isOpenAfterLoad:"isOpenAfterLoad",outlets:"outlets"},outputs:{onCloseDialog:"onCloseDialog"},features:[R([{provide:G,multi:!0,useExisting:i}])],decls:5,vars:6,consts:[["matTooltipPosition","above",1,"outlet-container","d-flex","pointer",3,"click","matTooltip"],["class","fa-solid fa-location-dot",4,"ngIf"],[1,"ms-2","mb-0"],[1,"fa-solid","fa-location-dot"]],template:function(e,o){e&1&&(n(0,"div",0),d("click",function(){return o.openModalSelectOutlet()}),m(1,Ct,1,0,"i",1),n(2,"h3",2),f(3),g(4,"limitTo"),r()()),e&2&&(s("matTooltip",o.outlet==null?null:o.outlet.Name),a(),s("ngIf",!o.hideLocationIcon),a(2),L(" ",_(4,3,!(o.outlet==null||o.outlet.Name==null)&&o.outlet.Name.length?o.outlet==null?null:o.outlet.Name:"Choose an Outlet",o.limitOutletText)," "))},dependencies:[M,O,et,v,I,X,K],styles:[".outlet-container[_ngcontent-%COMP%] .fa-location-dot[_ngcontent-%COMP%]{color:#fb404b!important;font-size:32px}"]})};export{st as a};
@@ -1,4 +1,4 @@
1
- import{a as f,b as k}from"./chunk-ODSZMOU5.js";import{P as M,sa as D}from"./chunk-ZN4NX5IC.js";import{o as I}from"./chunk-JEAUWLOG.js";import{Ka as m,Kc as c,Pa as x,Qb as b,Qc as y,db as h,id as F,ja as g,ka as l,lb as s,mb as p,na as o,nc as $,ob as d,xb as v,za as a}from"./chunk-FVHWNW7U.js";var _=(()=>{class t extends f{autofocus=!1;_autofocus=!1;focused=!1;platformId=o(x);document=o(y);host=o(m);ngAfterContentChecked(){this.autofocus===!1?this.host.nativeElement.removeAttribute("autofocus"):this.host.nativeElement.setAttribute("autofocus",!0),this.focused||this.autoFocus()}ngAfterViewChecked(){this.focused||this.autoFocus()}autoFocus(){F(this.platformId)&&this._autofocus&&setTimeout(()=>{let e=k.getFocusableElements(this.host?.nativeElement);e.length===0&&this.host.nativeElement.focus(),e.length>0&&e[0].focus(),this.focused=!0})}static \u0275fac=(()=>{let e;return function(i){return(e||(e=a(t)))(i||t)}})();static \u0275dir=p({type:t,selectors:[["","pAutoFocus",""]],inputs:{autofocus:[2,"autofocus","autofocus",c],_autofocus:[0,"pAutoFocus","_autofocus"]},features:[d]})}return t})(),P=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=s({type:t});static \u0275inj=l({})}return t})();var E=({dt:t})=>`
1
+ import{a as f,b as k}from"./chunk-SDIK6O2Z.js";import{P as M,sa as D}from"./chunk-4SXNNKVU.js";import{o as I}from"./chunk-K2RY2UAW.js";import{Ka as m,Mc as c,Pa as x,Qb as b,Sc as y,db as h,ja as g,ka as l,kd as F,lb as s,mb as p,na as o,ob as d,pc as $,xb as v,za as a}from"./chunk-4JRXN7L6.js";var _=(()=>{class t extends f{autofocus=!1;_autofocus=!1;focused=!1;platformId=o(x);document=o(y);host=o(m);ngAfterContentChecked(){this.autofocus===!1?this.host.nativeElement.removeAttribute("autofocus"):this.host.nativeElement.setAttribute("autofocus",!0),this.focused||this.autoFocus()}ngAfterViewChecked(){this.focused||this.autoFocus()}autoFocus(){F(this.platformId)&&this._autofocus&&setTimeout(()=>{let e=k.getFocusableElements(this.host?.nativeElement);e.length===0&&this.host.nativeElement.focus(),e.length>0&&e[0].focus(),this.focused=!0})}static \u0275fac=(()=>{let e;return function(i){return(e||(e=a(t)))(i||t)}})();static \u0275dir=p({type:t,selectors:[["","pAutoFocus",""]],inputs:{autofocus:[2,"autofocus","autofocus",c],_autofocus:[0,"pAutoFocus","_autofocus"]},features:[d]})}return t})(),P=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=s({type:t});static \u0275inj=l({})}return t})();var E=({dt:t})=>`
2
2
  .p-inputtext {
3
3
  font-family: inherit;
4
4
  font-feature-settings: inherit;
@@ -1 +1 @@
1
- import{ja as s}from"./chunk-FVHWNW7U.js";var d=(()=>{class r{isErrorState(t,e){return!!(t&&t.invalid&&(t.touched||e&&e.submitted))}static \u0275fac=function(e){return new(e||r)};static \u0275prov=s({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var i=class{_defaultMatcher;ngControl;_parentFormGroup;_parentForm;_stateChanges;errorState=!1;matcher;constructor(n,t,e,o,a){this._defaultMatcher=n,this.ngControl=t,this._parentFormGroup=e,this._parentForm=o,this._stateChanges=a}updateErrorState(){let n=this.errorState,t=this._parentFormGroup||this._parentForm,e=this.matcher||this._defaultMatcher,o=this.ngControl?this.ngControl.control:null,a=e?.isErrorState(o,t)??!1;a!==n&&(this.errorState=a,this._stateChanges.next())}};export{d as a,i as b};
1
+ import{ja as s}from"./chunk-4JRXN7L6.js";var d=(()=>{class r{isErrorState(t,e){return!!(t&&t.invalid&&(t.touched||e&&e.submitted))}static \u0275fac=function(e){return new(e||r)};static \u0275prov=s({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var i=class{_defaultMatcher;ngControl;_parentFormGroup;_parentForm;_stateChanges;errorState=!1;matcher;constructor(n,t,e,o,a){this._defaultMatcher=n,this.ngControl=t,this._parentFormGroup=e,this._parentForm=o,this._stateChanges=a}updateErrorState(){let n=this.errorState,t=this._parentFormGroup||this._parentForm,e=this.matcher||this._defaultMatcher,o=this.ngControl?this.ngControl.control:null,a=e?.isErrorState(o,t)??!1;a!==n&&(this.errorState=a,this._stateChanges.next())}};export{d as a,i as b};
@@ -1,2 +1,2 @@
1
- import{e as G,p as X,q as U}from"./chunk-7IUOZN33.js";import{fa as u,ga as R,ha as H}from"./chunk-2RMKBZ2Q.js";import{a as O}from"./chunk-JEAUWLOG.js";import{a as L}from"./chunk-KPTDYFSC.js";import{$a as n,Ib as m,Jb as d,Ka as y,Ma as b,Ob as I,Qb as s,Rb as p,Sb as T,Tb as A,Uc as V,Xc as N,_a as M,cd as P,db as x,ec as S,fc as k,hd as B,ka as g,kb as c,la as f,lb as D,na as v,nc as F,qb as w,qc as j,va as h,vb as o,wa as C,xb as _,xc as E,zc as z}from"./chunk-FVHWNW7U.js";var W=["*"];var Y=new f("MAT_CARD_CONFIG"),q=(()=>{class e{appearance;constructor(){let i=v(Y,{optional:!0});this.appearance=i?.appearance||"raised"}static \u0275fac=function(a){return new(a||e)};static \u0275cmp=c({type:e,selectors:[["mat-card"]],hostAttrs:[1,"mat-mdc-card","mdc-card"],hostVars:4,hostBindings:function(a,r){a&2&&_("mat-mdc-card-outlined",r.appearance==="outlined")("mdc-card--outlined",r.appearance==="outlined")},inputs:{appearance:"appearance"},exportAs:["matCard"],ngContentSelectors:W,decls:1,vars:0,template:function(a,r){a&1&&(T(),A(0))},styles:[`.mat-mdc-card{display:flex;flex-direction:column;box-sizing:border-box;position:relative;border-style:solid;border-width:0;background-color:var(--mdc-elevated-card-container-color, var(--mat-sys-surface-container-low));border-color:var(--mdc-elevated-card-container-color, var(--mat-sys-surface-container-low));border-radius:var(--mdc-elevated-card-container-shape, var(--mat-sys-corner-medium));box-shadow:var(--mdc-elevated-card-container-elevation, var(--mat-sys-level1))}.mat-mdc-card::after{position:absolute;top:0;left:0;width:100%;height:100%;border:solid 1px rgba(0,0,0,0);content:"";display:block;pointer-events:none;box-sizing:border-box;border-radius:var(--mdc-elevated-card-container-shape, var(--mat-sys-corner-medium))}.mat-mdc-card-outlined{background-color:var(--mdc-outlined-card-container-color, var(--mat-sys-surface));border-radius:var(--mdc-outlined-card-container-shape, var(--mat-sys-corner-medium));border-width:var(--mdc-outlined-card-outline-width, 1px);border-color:var(--mdc-outlined-card-outline-color, var(--mat-sys-outline-variant));box-shadow:var(--mdc-outlined-card-container-elevation, var(--mat-sys-level0))}.mat-mdc-card-outlined::after{border:none}.mdc-card__media{position:relative;box-sizing:border-box;background-repeat:no-repeat;background-position:center;background-size:cover}.mdc-card__media::before{display:block;content:""}.mdc-card__media:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.mdc-card__media:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}.mat-mdc-card-actions{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;min-height:52px;padding:8px}.mat-mdc-card-title{font-family:var(--mat-card-title-text-font, var(--mat-sys-title-large-font));line-height:var(--mat-card-title-text-line-height, var(--mat-sys-title-large-line-height));font-size:var(--mat-card-title-text-size, var(--mat-sys-title-large-size));letter-spacing:var(--mat-card-title-text-tracking, var(--mat-sys-title-large-tracking));font-weight:var(--mat-card-title-text-weight, var(--mat-sys-title-large-weight))}.mat-mdc-card-subtitle{color:var(--mat-card-subtitle-text-color, var(--mat-sys-on-surface));font-family:var(--mat-card-subtitle-text-font, var(--mat-sys-title-medium-font));line-height:var(--mat-card-subtitle-text-line-height, var(--mat-sys-title-medium-line-height));font-size:var(--mat-card-subtitle-text-size, var(--mat-sys-title-medium-size));letter-spacing:var(--mat-card-subtitle-text-tracking, var(--mat-sys-title-medium-tracking));font-weight:var(--mat-card-subtitle-text-weight, var(--mat-sys-title-medium-weight))}.mat-mdc-card-title,.mat-mdc-card-subtitle{display:block;margin:0}.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-title,.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-subtitle{padding:16px 16px 0}.mat-mdc-card-header{display:flex;padding:16px 16px 0}.mat-mdc-card-content{display:block;padding:0 16px}.mat-mdc-card-content:first-child{padding-top:16px}.mat-mdc-card-content:last-child{padding-bottom:16px}.mat-mdc-card-title-group{display:flex;justify-content:space-between;width:100%}.mat-mdc-card-avatar{height:40px;width:40px;border-radius:50%;flex-shrink:0;margin-bottom:16px;object-fit:cover}.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-subtitle,.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-title{line-height:normal}.mat-mdc-card-sm-image{width:80px;height:80px}.mat-mdc-card-md-image{width:112px;height:112px}.mat-mdc-card-lg-image{width:152px;height:152px}.mat-mdc-card-xl-image{width:240px;height:240px}.mat-mdc-card-subtitle~.mat-mdc-card-title,.mat-mdc-card-title~.mat-mdc-card-subtitle,.mat-mdc-card-header .mat-mdc-card-header-text .mat-mdc-card-title,.mat-mdc-card-header .mat-mdc-card-header-text .mat-mdc-card-subtitle,.mat-mdc-card-title-group .mat-mdc-card-title,.mat-mdc-card-title-group .mat-mdc-card-subtitle{padding-top:0}.mat-mdc-card-content>:last-child:not(.mat-mdc-card-footer){margin-bottom:0}.mat-mdc-card-actions-align-end{justify-content:flex-end}
1
+ import{e as G,p as X,q as U}from"./chunk-XMGAU3CI.js";import{fa as u,ga as R,ha as H}from"./chunk-H34CGBCE.js";import{a as O}from"./chunk-K2RY2UAW.js";import{a as L}from"./chunk-7JSHH4R2.js";import{$a as n,Bc as z,Ib as m,Jb as d,Ka as y,Ma as b,Ob as I,Qb as s,Rb as p,Sb as T,Tb as A,Wc as V,Zc as N,_a as M,db as x,ec as S,ed as P,fc as k,jd as B,ka as g,kb as c,la as f,lb as D,na as v,pc as F,qb as w,sc as j,va as h,vb as o,wa as C,xb as _,zc as E}from"./chunk-4JRXN7L6.js";var W=["*"];var Y=new f("MAT_CARD_CONFIG"),q=(()=>{class e{appearance;constructor(){let i=v(Y,{optional:!0});this.appearance=i?.appearance||"raised"}static \u0275fac=function(a){return new(a||e)};static \u0275cmp=c({type:e,selectors:[["mat-card"]],hostAttrs:[1,"mat-mdc-card","mdc-card"],hostVars:4,hostBindings:function(a,r){a&2&&_("mat-mdc-card-outlined",r.appearance==="outlined")("mdc-card--outlined",r.appearance==="outlined")},inputs:{appearance:"appearance"},exportAs:["matCard"],ngContentSelectors:W,decls:1,vars:0,template:function(a,r){a&1&&(T(),A(0))},styles:[`.mat-mdc-card{display:flex;flex-direction:column;box-sizing:border-box;position:relative;border-style:solid;border-width:0;background-color:var(--mdc-elevated-card-container-color, var(--mat-sys-surface-container-low));border-color:var(--mdc-elevated-card-container-color, var(--mat-sys-surface-container-low));border-radius:var(--mdc-elevated-card-container-shape, var(--mat-sys-corner-medium));box-shadow:var(--mdc-elevated-card-container-elevation, var(--mat-sys-level1))}.mat-mdc-card::after{position:absolute;top:0;left:0;width:100%;height:100%;border:solid 1px rgba(0,0,0,0);content:"";display:block;pointer-events:none;box-sizing:border-box;border-radius:var(--mdc-elevated-card-container-shape, var(--mat-sys-corner-medium))}.mat-mdc-card-outlined{background-color:var(--mdc-outlined-card-container-color, var(--mat-sys-surface));border-radius:var(--mdc-outlined-card-container-shape, var(--mat-sys-corner-medium));border-width:var(--mdc-outlined-card-outline-width, 1px);border-color:var(--mdc-outlined-card-outline-color, var(--mat-sys-outline-variant));box-shadow:var(--mdc-outlined-card-container-elevation, var(--mat-sys-level0))}.mat-mdc-card-outlined::after{border:none}.mdc-card__media{position:relative;box-sizing:border-box;background-repeat:no-repeat;background-position:center;background-size:cover}.mdc-card__media::before{display:block;content:""}.mdc-card__media:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.mdc-card__media:last-child{border-bottom-left-radius:inherit;border-bottom-right-radius:inherit}.mat-mdc-card-actions{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;min-height:52px;padding:8px}.mat-mdc-card-title{font-family:var(--mat-card-title-text-font, var(--mat-sys-title-large-font));line-height:var(--mat-card-title-text-line-height, var(--mat-sys-title-large-line-height));font-size:var(--mat-card-title-text-size, var(--mat-sys-title-large-size));letter-spacing:var(--mat-card-title-text-tracking, var(--mat-sys-title-large-tracking));font-weight:var(--mat-card-title-text-weight, var(--mat-sys-title-large-weight))}.mat-mdc-card-subtitle{color:var(--mat-card-subtitle-text-color, var(--mat-sys-on-surface));font-family:var(--mat-card-subtitle-text-font, var(--mat-sys-title-medium-font));line-height:var(--mat-card-subtitle-text-line-height, var(--mat-sys-title-medium-line-height));font-size:var(--mat-card-subtitle-text-size, var(--mat-sys-title-medium-size));letter-spacing:var(--mat-card-subtitle-text-tracking, var(--mat-sys-title-medium-tracking));font-weight:var(--mat-card-subtitle-text-weight, var(--mat-sys-title-medium-weight))}.mat-mdc-card-title,.mat-mdc-card-subtitle{display:block;margin:0}.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-title,.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-subtitle{padding:16px 16px 0}.mat-mdc-card-header{display:flex;padding:16px 16px 0}.mat-mdc-card-content{display:block;padding:0 16px}.mat-mdc-card-content:first-child{padding-top:16px}.mat-mdc-card-content:last-child{padding-bottom:16px}.mat-mdc-card-title-group{display:flex;justify-content:space-between;width:100%}.mat-mdc-card-avatar{height:40px;width:40px;border-radius:50%;flex-shrink:0;margin-bottom:16px;object-fit:cover}.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-subtitle,.mat-mdc-card-avatar~.mat-mdc-card-header-text .mat-mdc-card-title{line-height:normal}.mat-mdc-card-sm-image{width:80px;height:80px}.mat-mdc-card-md-image{width:112px;height:112px}.mat-mdc-card-lg-image{width:152px;height:152px}.mat-mdc-card-xl-image{width:240px;height:240px}.mat-mdc-card-subtitle~.mat-mdc-card-title,.mat-mdc-card-title~.mat-mdc-card-subtitle,.mat-mdc-card-header .mat-mdc-card-header-text .mat-mdc-card-title,.mat-mdc-card-header .mat-mdc-card-header-text .mat-mdc-card-subtitle,.mat-mdc-card-title-group .mat-mdc-card-title,.mat-mdc-card-title-group .mat-mdc-card-subtitle{padding-top:0}.mat-mdc-card-content>:last-child:not(.mat-mdc-card-footer){margin-bottom:0}.mat-mdc-card-actions-align-end{justify-content:flex-end}
2
2
  `],encapsulation:2,changeDetection:0})}return e})();var J=(()=>{class e{static \u0275fac=function(a){return new(a||e)};static \u0275mod=D({type:e});static \u0275inj=g({imports:[u,u]})}return e})();var $=(e,t)=>({"bg-gradient-warning":e,"disabled-date py-2 px-3":t});function tt(e,t){if(e&1){let i=I();m(0,"mat-card",3)(1,"mat-calendar",4),s("selectedChange",function(r){h(i);let l=p();return C(l.onSelectDate(r))}),d()()}if(e&2){let i=p();n(),o("selected",i.date)}}var K=class e{constructor(t){this.ref=t}tooltip;date=new Date;showCalendar=!1;disabled=!1;isToday=b(!0);onChange=t=>{};onTouched=()=>{};writeValue(t){this.date=t,this.date&&this.checkIsToday(this.date)}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}onSelectDate(t){this.showCalendar=!1,this.date=t,this.onChange(this.date),this.checkIsToday(this.date)}checkIsToday(t){t&&this.isToday.update(()=>L.isToDay(t))}closeCalendar(t){this.ref.nativeElement.contains(t.target)||(this.showCalendar=!1)}onShowCalendar(){this.disabled||(this.showCalendar=!this.showCalendar)}static \u0275fac=function(i){return new(i||e)(x(y))};static \u0275cmp=c({type:e,selectors:[["POS-invoice-date"]],hostBindings:function(i,a){i&1&&s("mousedown",function(l){return a.closeCalendar(l)},!1,M)},inputs:{tooltip:"tooltip"},features:[F([{provide:O,multi:!0,useExisting:e}])],decls:5,vars:10,consts:[["matTooltipPosition","above",1,"date-container","text-end","position-relative","p-1","px-2","pointer",3,"ngClass","matTooltip"],[1,"fw-normal","mb-0",3,"click"],["class","inline-calendar-card position-absolute",4,"ngIf"],[1,"inline-calendar-card","position-absolute"],[3,"selectedChange","selected"]],template:function(i,a){i&1&&(m(0,"div",0)(1,"h6",1),s("click",function(){return a.onShowCalendar()}),S(2),E(3,"date"),d(),w(4,tt,2,1,"mat-card",2),d()),i&2&&(o("ngClass",j(7,$,!a.isToday(),a.disabled))("matTooltip",a.tooltip),n(2),k(z(3,4,a.date,"dd MMMM yyyy")),n(2),o("ngIf",a.showCalendar))},dependencies:[B,V,N,P,J,q,X,G,U,H,R],styles:[".inline-calendar-card[_ngcontent-%COMP%]{width:300px;right:0;z-index:9999}.disabled-date[_ngcontent-%COMP%]{background-color:#ebebe4}"]})};export{J as a,K as b};
@@ -1,4 +1,4 @@
1
- import{Ba as R,Da as I,Ea as z,Hc as J,Ma as A,Mc as K,N as E,Nc as Q,Oc as W,Pa as X,Qc as Z,R as V,c as f,da as L,f as $,ha as P,id as N,ja as G,ka as Y,la as O,lb as H,ma as M,n as q,na as S,ta as C,u as U}from"./chunk-FVHWNW7U.js";import{j,p as y}from"./chunk-7DCB7DB2.js";function oe(c){c||(C(oe),c=S(I));let u=new f(e=>c.onDestroy(e.next.bind(e)));return e=>e.pipe(L(u))}function se(c,u){!u?.injector&&C(se);let e=u?.injector??S(R),r=new $(1),t=W(()=>{let n;try{n=c()}catch(o){K(()=>r.error(o));return}K(()=>r.next(n))},{injector:e,manualCleanup:!0});return e.get(I).onDestroy(()=>{t.destroy(),r.complete()}),r.asObservable()}function ce(c,u){let e=!u?.manualCleanup;e&&!u?.injector&&C(ce);let r=e?u?.injector?.get(I)??S(I):null,t=ie(u?.equal),n;u?.requireSync?n=A({kind:0},{equal:t}):n=A({kind:1,value:u?.initialValue},{equal:t});let o,i=c.subscribe({next:s=>n.set({kind:1,value:s}),error:s=>{if(u?.rejectErrors)throw s;n.set({kind:2,error:s})},complete:()=>{o?.()}});if(u?.requireSync&&n().kind===0)throw new P(601,!1);return o=r?.onDestroy(i.unsubscribe.bind(i)),Q(()=>{let s=n();switch(s.kind){case 1:return s.value;case 2:throw s.error;case 0:throw new P(601,!1)}},{equal:u?.equal})}function ie(c=Object.is){return(u,e)=>u.kind===1&&e.kind===1&&c(u.value,e.value)}function ae(c){c===void 0&&(C(ae),c=S(R));let u=c.get(z);return e=>new f(r=>{let t=u.add(),n=!1;function o(){n||(t(),n=!0)}let i=e.subscribe({next:s=>{r.next(s),o()},complete:()=>{r.complete(),o()},error:s=>{r.error(s),o()}});return i.add(()=>{r.unsubscribe(),o()}),i})}var x=function(c){return c.readonly="readonly",c.readwrite="readwrite",c}(x||{}),ee=new O(null),te=new O("Indexed DB"),ue=new O("Server Indexed DB");function de(c,u){return c.objectStoreNames.contains(u)}function w(c,u,e){if(!c){e("You need to use the openDatabase function to create a database before you query it!");return}de(c,u)||e(`objectStore does not exists: ${u}`)}function D(c,u){let e=c.transaction(u.storeName,u.dbMode);return e.onerror=u.error,e.onabort=u.abort,e}function v(c,u,e,r){return{storeName:u,dbMode:c,error:t=>{e(t)},abort:t=>{e(t)}}}var F=[];function b(c,u,e,r){return new Promise((t,n)=>{c||n("IndexedDB not available");let o=c.open(u,e),i;o.onsuccess=()=>{i=o.result,F.push(i),t(i)},o.onerror=()=>{n(`IndexedDB error: ${o.error}`)},typeof r=="function"&&(o.onupgradeneeded=s=>{r(s,i)})})}function T(c,u,e,r,t){return j(this,null,function*(){return new Promise((n,o)=>{if(!c)return;let i=c.open(u,e);i.onupgradeneeded=s=>j(null,null,function*(){let a=s.target.result,p=r.map(h=>j(null,null,function*(){if(!a.objectStoreNames.contains(h.store)){let l=a.createObjectStore(h.store,h.storeConfig);for(let g of h.storeSchema)l.createIndex(g.name,g.keypath,g.options)}}));yield Promise.all(p);let d=t&&t();if(d){let h=Object.keys(d).map(l=>parseInt(l,10)).filter(l=>l>s.oldVersion).sort((l,g)=>l-g);for(let l of h)d[l](a,i.transaction)}a.close(),n()}),i.onsuccess=s=>{s.target.result.close(),n()},i.onerror=s=>{o(s)}})})}function le(c,u,e){if(!c||!u||!e)throw Error('Params: "dbName", "version", "storeName" are mandatory.');return new f(r=>{try{let t=u+1,n=indexedDB.open(c,t);n.onupgradeneeded=o=>{let i=o.target.result;i.deleteObjectStore(e),i.close(),console.log("onupgradeneeded"),r.next(),r.complete()},n.onerror=o=>r.error(o)}catch(t){r.error(t)}})}function he(c){return new Promise((u,e)=>{if(!c){e(new Error("No database to close"));return}try{c.close(),u()}catch(r){e(`Error closing database: ${r}`)}})}function m(){return function(c,u,e){let r=e.value;return e.value=function(...t){let n=r.apply(this,t);return n instanceof f?n.pipe(V(()=>j(this,null,function*(){let o=F.map(i=>j(this,null,function*(){yield he(i)}));yield Promise.all(o),F.length=0}))):n},e}}var fe=(()=>{class c{constructor(e,r){this.dbConfigs=e,this.indexedDB=r,this.defaultDatabaseName=null,Object.values(this.dbConfigs).forEach((t,n,o)=>this.instanciateConfig(t,o.length===1))}instanciateConfig(e,r){return j(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||r)&&(this.defaultDatabaseName=e.name,this.selectedDb=e.name),yield T(this.indexedDB,e.name,e.version,e.objectStoresMeta,e.migrationFactory),b(this.indexedDB,e.name).then(t=>{t.version!==e.version&&(J()&&(console.warn(`
1
+ import{Ba as R,Da as I,Ea as z,Jc as J,Ma as A,N as E,Oc as K,Pa as X,Pc as Q,Qc as W,R as V,Sc as Z,c as f,da as L,f as $,ha as P,ja as G,ka as Y,kd as N,la as O,lb as H,ma as M,n as q,na as S,ta as C,u as U}from"./chunk-4JRXN7L6.js";import{j,p as y}from"./chunk-7DCB7DB2.js";function oe(c){c||(C(oe),c=S(I));let u=new f(e=>c.onDestroy(e.next.bind(e)));return e=>e.pipe(L(u))}function se(c,u){!u?.injector&&C(se);let e=u?.injector??S(R),r=new $(1),t=W(()=>{let n;try{n=c()}catch(o){K(()=>r.error(o));return}K(()=>r.next(n))},{injector:e,manualCleanup:!0});return e.get(I).onDestroy(()=>{t.destroy(),r.complete()}),r.asObservable()}function ce(c,u){let e=!u?.manualCleanup;e&&!u?.injector&&C(ce);let r=e?u?.injector?.get(I)??S(I):null,t=ie(u?.equal),n;u?.requireSync?n=A({kind:0},{equal:t}):n=A({kind:1,value:u?.initialValue},{equal:t});let o,i=c.subscribe({next:s=>n.set({kind:1,value:s}),error:s=>{if(u?.rejectErrors)throw s;n.set({kind:2,error:s})},complete:()=>{o?.()}});if(u?.requireSync&&n().kind===0)throw new P(601,!1);return o=r?.onDestroy(i.unsubscribe.bind(i)),Q(()=>{let s=n();switch(s.kind){case 1:return s.value;case 2:throw s.error;case 0:throw new P(601,!1)}},{equal:u?.equal})}function ie(c=Object.is){return(u,e)=>u.kind===1&&e.kind===1&&c(u.value,e.value)}function ae(c){c===void 0&&(C(ae),c=S(R));let u=c.get(z);return e=>new f(r=>{let t=u.add(),n=!1;function o(){n||(t(),n=!0)}let i=e.subscribe({next:s=>{r.next(s),o()},complete:()=>{r.complete(),o()},error:s=>{r.error(s),o()}});return i.add(()=>{r.unsubscribe(),o()}),i})}var x=function(c){return c.readonly="readonly",c.readwrite="readwrite",c}(x||{}),ee=new O(null),te=new O("Indexed DB"),ue=new O("Server Indexed DB");function de(c,u){return c.objectStoreNames.contains(u)}function w(c,u,e){if(!c){e("You need to use the openDatabase function to create a database before you query it!");return}de(c,u)||e(`objectStore does not exists: ${u}`)}function D(c,u){let e=c.transaction(u.storeName,u.dbMode);return e.onerror=u.error,e.onabort=u.abort,e}function v(c,u,e,r){return{storeName:u,dbMode:c,error:t=>{e(t)},abort:t=>{e(t)}}}var F=[];function b(c,u,e,r){return new Promise((t,n)=>{c||n("IndexedDB not available");let o=c.open(u,e),i;o.onsuccess=()=>{i=o.result,F.push(i),t(i)},o.onerror=()=>{n(`IndexedDB error: ${o.error}`)},typeof r=="function"&&(o.onupgradeneeded=s=>{r(s,i)})})}function T(c,u,e,r,t){return j(this,null,function*(){return new Promise((n,o)=>{if(!c)return;let i=c.open(u,e);i.onupgradeneeded=s=>j(null,null,function*(){let a=s.target.result,p=r.map(h=>j(null,null,function*(){if(!a.objectStoreNames.contains(h.store)){let l=a.createObjectStore(h.store,h.storeConfig);for(let g of h.storeSchema)l.createIndex(g.name,g.keypath,g.options)}}));yield Promise.all(p);let d=t&&t();if(d){let h=Object.keys(d).map(l=>parseInt(l,10)).filter(l=>l>s.oldVersion).sort((l,g)=>l-g);for(let l of h)d[l](a,i.transaction)}a.close(),n()}),i.onsuccess=s=>{s.target.result.close(),n()},i.onerror=s=>{o(s)}})})}function le(c,u,e){if(!c||!u||!e)throw Error('Params: "dbName", "version", "storeName" are mandatory.');return new f(r=>{try{let t=u+1,n=indexedDB.open(c,t);n.onupgradeneeded=o=>{let i=o.target.result;i.deleteObjectStore(e),i.close(),console.log("onupgradeneeded"),r.next(),r.complete()},n.onerror=o=>r.error(o)}catch(t){r.error(t)}})}function he(c){return new Promise((u,e)=>{if(!c){e(new Error("No database to close"));return}try{c.close(),u()}catch(r){e(`Error closing database: ${r}`)}})}function m(){return function(c,u,e){let r=e.value;return e.value=function(...t){let n=r.apply(this,t);return n instanceof f?n.pipe(V(()=>j(this,null,function*(){let o=F.map(i=>j(this,null,function*(){yield he(i)}));yield Promise.all(o),F.length=0}))):n},e}}var fe=(()=>{class c{constructor(e,r){this.dbConfigs=e,this.indexedDB=r,this.defaultDatabaseName=null,Object.values(this.dbConfigs).forEach((t,n,o)=>this.instanciateConfig(t,o.length===1))}instanciateConfig(e,r){return j(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||r)&&(this.defaultDatabaseName=e.name,this.selectedDb=e.name),yield T(this.indexedDB,e.name,e.version,e.objectStoresMeta,e.migrationFactory),b(this.indexedDB,e.name).then(t=>{t.version!==e.version&&(J()&&(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,4 +1,4 @@
1
- import{a as fi,b as Bt}from"./chunk-F6GAPEFT.js";import{a as Do}from"./chunk-UDWWB3EN.js";import{a as uo}from"./chunk-TK5H65DN.js";import{a as hi}from"./chunk-6L6CIH5M.js";import{e as Co}from"./chunk-YY2XI4GB.js";import{a as Je}from"./chunk-3PXI2XBC.js";import{a as gi,b as be}from"./chunk-FZJ2KHO5.js";import{b as bo}from"./chunk-AYL43YXH.js";import{d as yo}from"./chunk-26KF723V.js";import{a as _o}from"./chunk-GHJMCNWR.js";import{a as go}from"./chunk-UKMVTEK2.js";import{a as me,b as Te,e as Oo}from"./chunk-USLEDKAZ.js";import{b as ho}from"./chunk-VVJXK36P.js";import{a as co,b as So,c as Po}from"./chunk-KZRSQLLX.js";import{a as mo}from"./chunk-PBJT67ND.js";import{a as Io}from"./chunk-XWTOJM2Q.js";import{g as so}from"./chunk-R2TIYFDZ.js";import{d as ui}from"./chunk-TJGCUVKV.js";import{b as dn,c as lo}from"./chunk-MY7AWJC2.js";import{a as po}from"./chunk-D3MXHLH7.js";import{a as mn,b as Ht,c as pn}from"./chunk-AJEIAGQW.js";import{b as ao}from"./chunk-FFLZJTNS.js";import{a as Jn}from"./chunk-7CFWCYCD.js";import{a as Pt,b as Ci,c as vi,d as _i}from"./chunk-QSBXKK7O.js";import{a as fo}from"./chunk-M672IATW.js";import{p as Yn}from"./chunk-7IUOZN33.js";import{d as zn}from"./chunk-MDWAAAAE.js";import{a as vo}from"./chunk-OWVU6UUD.js";import{a as Mo}from"./chunk-ONPMCQJG.js";import{a as tt,b as st,c as xe}from"./chunk-HT35KHLT.js";import{h as Kn}from"./chunk-C3VA5WSC.js";import{a as Xn,b as bt}from"./chunk-B7SOO5L3.js";import{C as K,D as Z,E as yt,J as oo,K as X,L as ve,O as ro,u as Y,v as ce,w as Ie}from"./chunk-AJBYNIGH.js";import{ga as mi,ha as Lt}from"./chunk-2RMKBZ2Q.js";import{G as St,O as di,P as Q,g as eo,n as pi,o as to,q as io,u as no}from"./chunk-SAH7IP6B.js";import{a as et}from"./chunk-IG4W2TLL.js";import{a as Fn,c as Ln}from"./chunk-GIKR6Y2K.js";import{e as _t,f as Zn}from"./chunk-TC4KHMDU.js";import{a as ye,b as $n}from"./chunk-O6YS7HWF.js";import{a as ne}from"./chunk-2FWFPV5I.js";import{D as li,c as Oe,e as si,h as Ce,i as Hn,k as Bn,l as Ye,n as jn,o as De,p as Qn,s as vt,v as Un,w as Wn,y as Gn,z as qn}from"./chunk-JEAUWLOG.js";import{a as h,d as ci}from"./chunk-KPTDYFSC.js";import{a as Vn}from"./chunk-GTWDSRNK.js";import{$ as Xt,$a as l,$b as Ft,$c as Rn,Ac as Ct,Db as E,Dc as Pe,E as oe,Eb as gt,Gb as ft,Hb as ht,I as Xe,Ia as ti,Ib as a,Ja as cn,Jb as s,Kb as _,Lb as B,M as dt,Ma as re,Mb as j,N as He,Nb as ri,Nc as Ge,Ob as I,Od as Nn,Pd as An,Q as ke,Qb as b,Rb as d,Rd as kn,Td as H,Uc as Fe,Va as We,Wa as ut,Wc as he,Wd as Me,Xa as Pn,Xc as ae,Y as Ve,Yc as In,Zb as kt,Zc as xn,_b as Vt,_c as Tn,aa as z,ad as qe,b as Yt,cd as $e,d as Ae,da as Se,db as S,dc as U,e as fe,ec as m,ed as J,fa as se,fc as D,gc as O,hc as ai,hd as le,ib as ii,ic as Dn,ja as x,jc as k,k as mt,ka as ei,kb as N,kc as A,lb as ni,lc as V,ma as g,n as bn,na as R,o as we,p as pt,pc as F,q as Kt,qb as f,qc as Be,r as Zt,rd as En,sc as Mn,t as q,u as Ue,ub as On,v as Sn,va as C,vb as p,vd as wn,wa as v,xc as y,yc as M,zb as oi,zc as te}from"./chunk-FVHWNW7U.js";import{a as zt,h as Ze}from"./chunk-7DCB7DB2.js";var it=class{constructor(e){this.roleService=e;e&&this.setRole()}_Retrieve;_DateEditor;_NumberEditor;_PriceVisible;_UnitPriceEditor;_PricebookSelector;_Cost;_Return;_Discount;_SalesPerson;_PriceMinimum;_Payment;_CreditSalesLock;_CustomerInputLock;_PaymentCodeLock;_Shipping;_Tax;_DeleteItem;_BundlingPrice;_EmailRestriction;_ParkedDeletionAuthorized;_SellEditor;_ContactCreate;_PrepaidPackageCreate;_Order;_Reprint;_Contacts;_ContactsCreate;_InventoryView;_DebtView;_ClearCart;_SellDelete;_DeliveryEditor;_CouponInputLock;_Park;_Commission;setRole(){this._Retrieve=this.roleService.sell.RetrieveR,this._DateEditor=this.roleService.global.Date,this._NumberEditor=this.roleService.sell.Number,this._PriceVisible=this.roleService.sell.PriceVisible,this._SalesPerson=this.roleService.sell.SalesPerson,this._UnitPriceEditor=this.roleService.sell.UnitPriceEditor,this._PricebookSelector=this.roleService.sell.PricebookSelector,this._Cost=this.roleService.product.Cost,this._Return=this.roleService.sell.Return,this._Discount=this.roleService.sell.Discount,this._PriceMinimum=this.roleService.sell.PriceMinimum,this._Payment=this.roleService.sell.Payment,this._CreditSalesLock=this.roleService.sell.CreditSalesLock,this._CustomerInputLock=this.roleService.sell.CustomerInputLock,this._PaymentCodeLock=this.roleService.sell.PaymentCodeLock,this._Shipping=this.roleService.sell.Shipping,this._Tax=this.roleService.sell.Tax,this._DeleteItem=this.roleService.sell.DeleteItem,this._BundlingPrice=this.roleService.sell.BundlingPrice,this._EmailRestriction=this.roleService.sell.Email,this._SellEditor=this.roleService.sell.Edit,this._ContactCreate=this.roleService.contact.Create,this._PrepaidPackageCreate=this.roleService.prepaidPackage.Create,this._Order=this.roleService.order.View,this._Contacts=this.roleService.contact.View,this._ContactsCreate=this.roleService.contact.Create,this._InventoryView=this.roleService.inventory.View,this._DebtView=this.roleService.debt.View,this._ClearCart=this.roleService.sell.DeleteItem,this._SellDelete=this.roleService.sell.Delete,this._DeliveryEditor=this.roleService.logistic.Edit,this._Reprint=this.roleService.order.Print,this._CouponInputLock=this.roleService.sell.CouponInputLock,this._Park=this.roleService.sell.Park,this._Commission=this.roleService.product.CommissionView}get Park(){return this._Park}get CouponInputLock(){return this._CouponInputLock}set CouponInputLock(e){this._CouponInputLock=e}get Retrieve(){return this._Retrieve}get DateEditor(){return this._DateEditor}set DateEditor(e){this._DateEditor=e}get NumberEditor(){return this._NumberEditor}set NumberEditor(e){this._NumberEditor=e}get PriceVisible(){return this._PriceVisible}get UnitPriceEditor(){return this._UnitPriceEditor}set UnitPriceEditor(e){this._UnitPriceEditor=e}get PricebookSelector(){return this._PricebookSelector}set PricebookSelector(e){this._PricebookSelector=e}get Cost(){return this._Cost}get Return(){return this._Return}set Return(e){this._Return=e}get Discount(){return this._Discount}set Discount(e){this._Discount=e}get SalesPerson(){return this._SalesPerson}get PriceMinimum(){return this._PriceMinimum}get Payment(){return this._Payment}get CreditSalesLock(){return this._CreditSalesLock}get CustomerInputLock(){return this._CustomerInputLock}get PaymentCodeLock(){return this._PaymentCodeLock}get Shipping(){return this._Shipping}get Tax(){return this._Tax}set Tax(e){this._Tax=e}get DeleteItem(){return this._DeleteItem}set DeleteItem(e){this._DeleteItem=e}get BundlingPrice(){return this._BundlingPrice}get Email(){return this._EmailRestriction}get ParkedDeletionAuthorized(){return this._ParkedDeletionAuthorized}set ParkedDeletionAuthorized(e){this._ParkedDeletionAuthorized=e}get SellEditor(){return this._SellEditor}get PrepaidPackageCreate(){return this._PrepaidPackageCreate}get Order(){return this._Order}get Reprint(){return this._Reprint}get Contacts(){return this._Contacts}get ContactsCreate(){return this._ContactsCreate}get InventoryView(){return this._InventoryView}get DebtView(){return this._DebtView}get ClearCartRestriction(){return this._ClearCart}get SellDelete(){return this._SellDelete}get DeliveryEditor(){return this._DeliveryEditor}get Commission(){return this._Commission}};var jt=class{DeliveryEntityID;Type;NewOrderID;constructor(){this.DeliveryEntityID="",this.Type=3}};var G=class{Order;Invoice;Shipping;Action;Payments;Items;CartItems;ContactName;SplitParkLabel;get cartQuantity(){let e=0;for(let t of this.CartItems)e+=t.Quantity;return e}constructor(){this.Order=new dn,this.Invoice=new Ht,this.Shipping=new pn,this.Action=new jt,this.Payments=Array(),this.Items=Array(),this.CartItems=Array(),this.ContactName=""}get TotalPaidAmount(){let e=0;return this.Payments.forEach(t=>{e+=t.PaidAmount}),e}get RedeemableAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID!=1);return this.GetAmountByCart(e)}get TotalQuantity(){let e=0;return this.CartItems.forEach(t=>{t.PromotionGift||(e+=t.Quantity)}),e}get CashOnlyAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID==1);return this.GetAmountByCart(e)}get PointOnlyAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID==2);return this.GetAmountByCart(e)}get PrepaidPackageItem(){return this.CartItems.filter(t=>t.Variant.TypeID==10)}GetAmountByCart(e){let t=0;return e.forEach(i=>{t+=i.Total}),t=t*(100-this.Order.Discount)/100,t=t*(100-this.Order.Discount2)/100,t}getRewards(){return this.CartItems.filter(t=>t.PromotionGift)}};Ze([tt(()=>dn)],G.prototype,"Order",2),Ze([tt(()=>Ht)],G.prototype,"Invoice",2),Ze([tt(()=>pn)],G.prototype,"Shipping",2),Ze([tt(()=>jt)],G.prototype,"Action",2),Ze([tt(()=>Je)],G.prototype,"Payments",2),Ze([tt(()=>gi)],G.prototype,"Items",2),Ze([tt(()=>be)],G.prototype,"CartItems",2);var yi=class{Success;Message;message;ObjectID;SalesOrderID;OutDeliveryID;Contact;LoyaltyPoint;InvoiceNumber;Creator;OrderTimeString;PrintMode;PaymentStateID;PaymentStateLabel;Final;constructor(){this.Success=!0,this.Message="",this.ObjectID="",this.SalesOrderID="",this.OutDeliveryID="",this.Contact=null,this.LoyaltyPoint="",this.InvoiceNumber="",this.Creator="",this.OrderTimeString="",this.PrintMode=0,this.PaymentStateID=0,this.PaymentStateLabel="",this.Final=0}};var Ot=class o{constructor(e,t,i,n){this.httpService=e;this._localDataService=t;this._onlineStatusService=i;this._toastrService=n;this._onlineStatusService.getOnlineStatus$().subscribe(r=>{this.isOnline=r})}_Data=new fe(null);Data$=this._Data.pipe(ke(),oe(e=>e!==null));isOnline;get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}getSalesOrderPrint(e){return this.httpService.post("/API/POS/GetSalesOrderPrint",{TemplateID:e})}submitOrder(e,t){let i=this.generatePOSDataForSubmission(e,this.isOnline);if(this.isOnline)return this.submitOnline(i).pipe(this.handleTimeOutError(i));if(t.ModuleSell.EnableOfflineTransaction)return this._localDataService.syncOrder(i).pipe(q(()=>this.generateCompleteData(i)));this._toastrService.warning("Offline order is not Supported!","Info!")}uploadOfflineOrder(e){return this._localDataService.uploadSingleOrder(e).pipe(Xe(t=>t?.message?.includes("objectStore does not exists")?this.submitOnline(e):pt(()=>t)))}submitOnline(e){return this.httpService.post(Q.SubmitOrder,e,Vn.pos.submitOrderTimeout)}handleTimeOutError(e){return Yt(Xe(t=>{if(t instanceof Zt||t?.name=="TimeoutError"){let i=this.generateCompleteData(e);this.pushNewValue(i)}throw t}))}generatePOSDataForSubmission(e,t=!0){let i=Object.assign(new G,e);i.Items=[],i.Order.CustomerID==null&&(i.Order.CustomerID=h.GuidEmpty),i.Order.SalesID==null&&(i.Order.SalesID=h.GuidEmpty);let n=1;i.Payments=i.Payments.map(c=>(c.Date=i.Order.Date,c.Index=n,n++,delete c.TypeID,c));let r=1;for(let c of i.CartItems){let u=new gi;u.ID=c.ID,u.VariantID=c.VariantID,u.Quantity=c.Quantity,u.Cost=c.Cost,u.Price=c.Price,u.Discount=c.Discount,u.DiscountAmount=c.DiscountAmount,u.Note=c.Note,u.Taxable=c.Variant.Taxable,u.LoyaltyPoint=c.LoyaltyPoint,u.UnitCost=c.Cost,u.UnitPrice=c.Price,u.UnitPriceOriginal=c.UnitPriceOriginal,u.UnitExpense=c.UnitExpense,u.EntityID=c.EntityID,u.Index=r,u.UnitQuantity=c.UnitQuantity,u.PriceTypeID=c.PriceTypeID,u.PriceNote=c.PriceNote,u.Splited=c.SplitQuantity>0,u.SplitQuantity=c.SplitQuantity,u.InventoryTypeID=c.Variant.TypeID,u.SalesID="",u.Serial=c.Serial,c.SalesID&&(u.SalesID=c.SalesID),delete c.CouponDiscount,i.Items.push(u),r++}return t?(delete i.CartItems,delete i.Order.ClientTimestamp):i.Order.ClientTimestamp=new Date,i}generateCompleteData(e){let t=new yi;return t.InvoiceNumber=e.Order.Number,t.OrderTimeString=new Date().toString(),t.PaymentStateID=e.Action?.Type,t.PaymentStateLabel="Offline",t.Success=!0,t.OutDeliveryID=e.Action.DeliveryEntityID,t}GetReturnInvoice(e,t){return this.httpService.get(Q.ReturInvoice,[{key:"EntityID",value:t},{key:"Number",value:e}])}GetInvoiceBySoID(e){return this.httpService.get(Q.GetPOSDataByID,[{key:"ID",value:e}])}UploadCSV(e,t){let i={CartItems:e,EntityID:t};return this.httpService.post(Q.UploadCsv,i)}sendEmail(e,t){return new Promise((i,n)=>{this._localDataService.isProductFromServer().subscribe(r=>{if(r){let c={invoiceID:t,email:e};this.httpService.post(Q.SendInvoiceEmail,c).subscribe({next:u=>{i(u)},error:u=>{n(u)}})}else n(X.wrongOfflineAction)})})}sendWhatsaap(e,t){let i={InvoiceID:e,PhoneNumber:t};return this.httpService.post(Q.SendInvoiceWhatsapp,i)}createCustomerByInvoice(e,t){let i={InvoiceID:e,Mobile:t};return this.httpService.post(Q.CreateCustomerInvoice,i)}saveCommission(e,t){let i={SOID:e,commission:t};return this.httpService.POSText("/API/Transaction/SetCommission",i)}generateReceiptA4(e){let t={ID:e};return this.httpService.post(Q.InvoiceA4,t)}getVacant(e){return this.httpService.get(Q.GetVacant,[{key:"EntityID",value:e}])}static \u0275fac=function(t){return new(t||o)(g(Me),g(ve),g(me),g(H))};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var $=class o{constructor(e,t,i){this._localDataService=e;this._onlineStatusService=t;this._httpService=i;this._onlineStatusService.getOnlineStatus$().subscribe(n=>{this.isOnline=n})}_Data=new fe(null);Data$=this._Data.asObservable().pipe(oe(e=>e!==null),ke());isOnline;get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}requestObservable(){return this.isOnline?this._httpService.get(Q.GetPOSStorage).pipe(q(e=>({data:e,type:"Online"}))):this._localDataService.getPOSStorage().pipe(oe(e=>e!=null),q(e=>({data:e,type:"Offline"})))}getOutletName(e){return this.Data.Entities.find(i=>i.ID==e)?.Name}static \u0275fac=function(t){return new(t||o)(g(ve),g(me),g(Me))};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var _e=class o{constructor(e){this.roleService=e;this.pushNewValue(new it(e))}_Data=new fe(new it(null));get Data(){return this._Data.value}Data$=this._Data.asObservable();pushNewValue(e){this._Data.next(e)}static \u0275fac=function(t){return new(t||o)(g(ci))};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Wt=class{ID;Code;EntityID;Name;Description;Start;StartDisplay;State;Open;CashierID;OpeningCash;EntityName;LoginID;Active;CustomerDisplayEnabled;OvoConfigurationID;CustomerDisplayID;ListImage;Suspended};var Wo=o=>({active:o}),Go=o=>({gray:o});function qo(o,e){if(o&1){let t=I();a(0,"span",17),b("click",function(n){C(t);let r=d().$implicit;return d().closeRegister(r),v(n.stopPropagation())}),s()}}function $o(o,e){o&1&&(a(0,"div")(1,"span",18),m(2,"VACANT"),s()())}function Jo(o,e){if(o&1&&(a(0,"div")(1,"span",19),_(2,"i",20),a(3,"font"),m(4),s()(),a(5,"span",21),_(6,"i",22),a(7,"font"),m(8),s()()()),o&2){let t=d().$implicit;l(4),D(t.LoginID),l(4),O("",t.StartDisplay.split(" ")[3]," - Now")}}function zo(o,e){if(o&1){let t=I();a(0,"div",9)(1,"div",10)(2,"div",11)(3,"h5",12),b("click",function(){let n=C(t).$implicit,r=d();return v(r.select(n))}),a(4,"span"),_(5,"i",13),m(6),y(7,"limitTo"),s(),f(8,qo,1,0,"span",14),s(),a(9,"div",15),b("click",function(){let n=C(t).$implicit,r=d();return v(r.select(n))}),f(10,$o,3,0,"div",16)(11,Jo,9,2,"div",16),s()()()()}if(o&2){let t=e.$implicit,i=d();l(),p("ngClass",t.Active?"active":""),l(),p("ngClass",F(11,Wo,(t==null?null:t.ID)==(i.selectedRegister==null?null:i.selectedRegister.ID))),l(),p("ngClass",F(13,Go,t!=i.selectedRegister)),l(3),D(te(7,8,t.Name,15)),l(2),p("ngIf",t.State!="Close"),l(),p("ngSwitch",t.State),l(),p("ngSwitchCase","Close"),l(),p("ngSwitchCase","Open")}}var bi=class o{constructor(e,t,i,n,r){this._dialogRef=e;this._outletService=t;this._posService=i;this._userRoleService=n;this.router=r}originalSelectedRegister=null;registers;searchInput="";selectedRegister=new Wt;modalConfig=new K;role;get AppConfigJSON(){return this._posService.Data.AppConfigJSON}destroy$=new Ae;ngOnInit(){this.subscribeToObsChanges(),this.initModalConfig()}subscribeToObsChanges(){this._posService.Data$.pipe(Se(this.destroy$)).subscribe(e=>{this.registers=e.Registers}),this._outletService.Data$.pipe(Se(this.destroy$)).subscribe(e=>{this.selectedRegister=this.findOutletRegisterById(e.RegisterID),this.originalSelectedRegister=this.selectedRegister?zt({},this.selectedRegister):null}),this._userRoleService.Data$.pipe(Se(this.destroy$)).subscribe(e=>{this.role=e})}findOutletRegisterById(e){let t=this.registers.find(i=>i.ID===e);return t||new Wt}initModalConfig(){this.modalConfig.hideClose=!1,this.modalConfig.hideCancel=!1,this.modalConfig.bodyScrollable=!0,this.modalConfig.title="Choose an outlet"}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}close(){this._dialogRef.close()}onOk(){if(this.selectedRegister.ID==null){alert("Please select a register first!");return}this._outletService.pushNewRegister(this.selectedRegister),this._dialogRef.close({selectedRegister:this.selectedRegister,openStartingCashDialog:this.selectedRegister.ID!=this.originalSelectedRegister?.ID})}select(e){if(this.AppConfigJSON.ModuleShift.Closure.Enabled)if(this.selectedRegister.ID!=null&&this.selectedRegister.Open&&e.CashierID==null)confirm("You already have an active register with "+this.selectedRegister.Name+`!
1
+ import{a as fi,b as Bt}from"./chunk-F6GAPEFT.js";import{a as Do}from"./chunk-GYY77CVS.js";import{a as uo}from"./chunk-TK5H65DN.js";import{a as hi}from"./chunk-6L6CIH5M.js";import{e as Co}from"./chunk-TVWAOPGO.js";import{a as Je}from"./chunk-3PXI2XBC.js";import{a as gi,b as be}from"./chunk-4QABXC6I.js";import{b as bo}from"./chunk-R44I6IR7.js";import{d as yo}from"./chunk-WQKH5AEN.js";import{a as _o}from"./chunk-WAFRNTTW.js";import{a as go}from"./chunk-6JDIOP24.js";import{a as me,b as Te,e as Oo}from"./chunk-DXQHYGPP.js";import{b as ho}from"./chunk-Q4A7DDAZ.js";import{a as co,b as So,c as Po}from"./chunk-3GFVCNY7.js";import{a as mo}from"./chunk-YLQ2QXS2.js";import{a as Io}from"./chunk-UN45PHQC.js";import{g as so}from"./chunk-J6CP7GKF.js";import{d as ui}from"./chunk-M2QK4P35.js";import{b as dn,c as lo}from"./chunk-7UDFGZYI.js";import{a as po}from"./chunk-ORADADFD.js";import{a as mn,b as Ht,c as pn}from"./chunk-SMUUKOJZ.js";import{b as ao}from"./chunk-R57UVE6D.js";import{a as Jn}from"./chunk-UD6LJYER.js";import{a as Pt,b as Ci,c as vi,d as _i}from"./chunk-3DNIXXKN.js";import{a as fo}from"./chunk-LQ5QJ4EI.js";import{p as Yn}from"./chunk-XMGAU3CI.js";import{d as zn}from"./chunk-NE4UQDXL.js";import{a as vo}from"./chunk-ASUCEKKD.js";import{a as Mo}from"./chunk-QBBMXIVG.js";import{a as tt,b as st,c as xe}from"./chunk-HT35KHLT.js";import{h as Kn}from"./chunk-EXXHAXIE.js";import{a as Xn,b as bt}from"./chunk-IRFJ42AU.js";import{C as K,D as Z,E as yt,J as oo,K as X,L as ve,O as ro,u as Y,v as ce,w as Ie}from"./chunk-P36Z2Q2X.js";import{ga as mi,ha as Lt}from"./chunk-H34CGBCE.js";import{G as St,O as di,P as Q,g as eo,n as pi,o as to,q as io,u as no}from"./chunk-23F7BAD4.js";import{a as et}from"./chunk-IXGNTK76.js";import{a as Fn,c as Ln}from"./chunk-GIKR6Y2K.js";import{e as _t,f as Zn}from"./chunk-6Y6JUUIW.js";import{a as ye,b as $n}from"./chunk-LS4HUMWF.js";import{a as ne}from"./chunk-2FWFPV5I.js";import{D as li,c as Oe,e as si,h as Ce,i as Hn,k as Bn,l as Ye,n as jn,o as De,p as Qn,s as vt,v as Un,w as Wn,y as Gn,z as qn}from"./chunk-K2RY2UAW.js";import{a as h,d as ci}from"./chunk-7JSHH4R2.js";import{a as Vn}from"./chunk-HXXLRVAY.js";import{$ as Xt,$a as l,$b as Ft,$c as xn,Ac as M,Bc as te,Cc as Ct,Db as E,E as oe,Eb as gt,Fc as Pe,Gb as ft,Hb as ht,I as Xe,Ia as ti,Ib as a,Ja as cn,Jb as s,Kb as _,Lb as B,M as dt,Ma as re,Mb as j,N as He,Nb as ri,Ob as I,Pc as Ge,Q as ke,Qb as b,Qd as Nn,Rb as d,Rd as An,Td as kn,Va as We,Vd as H,Wa as ut,Wc as Fe,Xa as Pn,Y as Ve,Yc as he,Yd as Me,Zb as kt,Zc as ae,_b as Vt,_c as In,aa as z,ad as Tn,b as Yt,bd as Rn,cd as qe,d as Ae,da as Se,db as S,dc as U,e as fe,ec as m,ed as $e,fa as se,fc as D,gc as O,gd as J,hc as ai,ib as ii,ic as Dn,ja as x,jc as k,jd as le,k as mt,ka as ei,kb as N,kc as A,lb as ni,lc as V,ma as g,n as bn,na as R,o as we,p as pt,q as Kt,qb as f,r as Zt,rc as F,sc as Be,t as q,td as En,u as Ue,ub as On,uc as Mn,v as Sn,va as C,vb as p,wa as v,xd as wn,zb as oi,zc as y}from"./chunk-4JRXN7L6.js";import{a as zt,h as Ze}from"./chunk-7DCB7DB2.js";var it=class{constructor(e){this.roleService=e;e&&this.setRole()}_Retrieve;_DateEditor;_NumberEditor;_PriceVisible;_UnitPriceEditor;_PricebookSelector;_Cost;_Return;_Discount;_SalesPerson;_PriceMinimum;_Payment;_CreditSalesLock;_CustomerInputLock;_PaymentCodeLock;_Shipping;_Tax;_DeleteItem;_BundlingPrice;_EmailRestriction;_ParkedDeletionAuthorized;_SellEditor;_ContactCreate;_PrepaidPackageCreate;_Order;_Reprint;_Contacts;_ContactsCreate;_InventoryView;_DebtView;_ClearCart;_SellDelete;_DeliveryEditor;_CouponInputLock;_Park;_Commission;setRole(){this._Retrieve=this.roleService.sell.RetrieveR,this._DateEditor=this.roleService.global.Date,this._NumberEditor=this.roleService.sell.Number,this._PriceVisible=this.roleService.sell.PriceVisible,this._SalesPerson=this.roleService.sell.SalesPerson,this._UnitPriceEditor=this.roleService.sell.UnitPriceEditor,this._PricebookSelector=this.roleService.sell.PricebookSelector,this._Cost=this.roleService.product.Cost,this._Return=this.roleService.sell.Return,this._Discount=this.roleService.sell.Discount,this._PriceMinimum=this.roleService.sell.PriceMinimum,this._Payment=this.roleService.sell.Payment,this._CreditSalesLock=this.roleService.sell.CreditSalesLock,this._CustomerInputLock=this.roleService.sell.CustomerInputLock,this._PaymentCodeLock=this.roleService.sell.PaymentCodeLock,this._Shipping=this.roleService.sell.Shipping,this._Tax=this.roleService.sell.Tax,this._DeleteItem=this.roleService.sell.DeleteItem,this._BundlingPrice=this.roleService.sell.BundlingPrice,this._EmailRestriction=this.roleService.sell.Email,this._SellEditor=this.roleService.sell.Edit,this._ContactCreate=this.roleService.contact.Create,this._PrepaidPackageCreate=this.roleService.prepaidPackage.Create,this._Order=this.roleService.order.View,this._Contacts=this.roleService.contact.View,this._ContactsCreate=this.roleService.contact.Create,this._InventoryView=this.roleService.inventory.View,this._DebtView=this.roleService.debt.View,this._ClearCart=this.roleService.sell.DeleteItem,this._SellDelete=this.roleService.sell.Delete,this._DeliveryEditor=this.roleService.logistic.Edit,this._Reprint=this.roleService.order.Print,this._CouponInputLock=this.roleService.sell.CouponInputLock,this._Park=this.roleService.sell.Park,this._Commission=this.roleService.product.CommissionView}get Park(){return this._Park}get CouponInputLock(){return this._CouponInputLock}set CouponInputLock(e){this._CouponInputLock=e}get Retrieve(){return this._Retrieve}get DateEditor(){return this._DateEditor}set DateEditor(e){this._DateEditor=e}get NumberEditor(){return this._NumberEditor}set NumberEditor(e){this._NumberEditor=e}get PriceVisible(){return this._PriceVisible}get UnitPriceEditor(){return this._UnitPriceEditor}set UnitPriceEditor(e){this._UnitPriceEditor=e}get PricebookSelector(){return this._PricebookSelector}set PricebookSelector(e){this._PricebookSelector=e}get Cost(){return this._Cost}get Return(){return this._Return}set Return(e){this._Return=e}get Discount(){return this._Discount}set Discount(e){this._Discount=e}get SalesPerson(){return this._SalesPerson}get PriceMinimum(){return this._PriceMinimum}get Payment(){return this._Payment}get CreditSalesLock(){return this._CreditSalesLock}get CustomerInputLock(){return this._CustomerInputLock}get PaymentCodeLock(){return this._PaymentCodeLock}get Shipping(){return this._Shipping}get Tax(){return this._Tax}set Tax(e){this._Tax=e}get DeleteItem(){return this._DeleteItem}set DeleteItem(e){this._DeleteItem=e}get BundlingPrice(){return this._BundlingPrice}get Email(){return this._EmailRestriction}get ParkedDeletionAuthorized(){return this._ParkedDeletionAuthorized}set ParkedDeletionAuthorized(e){this._ParkedDeletionAuthorized=e}get SellEditor(){return this._SellEditor}get PrepaidPackageCreate(){return this._PrepaidPackageCreate}get Order(){return this._Order}get Reprint(){return this._Reprint}get Contacts(){return this._Contacts}get ContactsCreate(){return this._ContactsCreate}get InventoryView(){return this._InventoryView}get DebtView(){return this._DebtView}get ClearCartRestriction(){return this._ClearCart}get SellDelete(){return this._SellDelete}get DeliveryEditor(){return this._DeliveryEditor}get Commission(){return this._Commission}};var jt=class{DeliveryEntityID;Type;NewOrderID;constructor(){this.DeliveryEntityID="",this.Type=3}};var G=class{Order;Invoice;Shipping;Action;Payments;Items;CartItems;ContactName;SplitParkLabel;get cartQuantity(){let e=0;for(let t of this.CartItems)e+=t.Quantity;return e}constructor(){this.Order=new dn,this.Invoice=new Ht,this.Shipping=new pn,this.Action=new jt,this.Payments=Array(),this.Items=Array(),this.CartItems=Array(),this.ContactName=""}get TotalPaidAmount(){let e=0;return this.Payments.forEach(t=>{e+=t.PaidAmount}),e}get RedeemableAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID!=1);return this.GetAmountByCart(e)}get TotalQuantity(){let e=0;return this.CartItems.forEach(t=>{t.PromotionGift||(e+=t.Quantity)}),e}get CashOnlyAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID==1);return this.GetAmountByCart(e)}get PointOnlyAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID==2);return this.GetAmountByCart(e)}get PrepaidPackageItem(){return this.CartItems.filter(t=>t.Variant.TypeID==10)}GetAmountByCart(e){let t=0;return e.forEach(i=>{t+=i.Total}),t=t*(100-this.Order.Discount)/100,t=t*(100-this.Order.Discount2)/100,t}getRewards(){return this.CartItems.filter(t=>t.PromotionGift)}};Ze([tt(()=>dn)],G.prototype,"Order",2),Ze([tt(()=>Ht)],G.prototype,"Invoice",2),Ze([tt(()=>pn)],G.prototype,"Shipping",2),Ze([tt(()=>jt)],G.prototype,"Action",2),Ze([tt(()=>Je)],G.prototype,"Payments",2),Ze([tt(()=>gi)],G.prototype,"Items",2),Ze([tt(()=>be)],G.prototype,"CartItems",2);var yi=class{Success;Message;message;ObjectID;SalesOrderID;OutDeliveryID;Contact;LoyaltyPoint;InvoiceNumber;Creator;OrderTimeString;PrintMode;PaymentStateID;PaymentStateLabel;Final;constructor(){this.Success=!0,this.Message="",this.ObjectID="",this.SalesOrderID="",this.OutDeliveryID="",this.Contact=null,this.LoyaltyPoint="",this.InvoiceNumber="",this.Creator="",this.OrderTimeString="",this.PrintMode=0,this.PaymentStateID=0,this.PaymentStateLabel="",this.Final=0}};var Ot=class o{constructor(e,t,i,n){this.httpService=e;this._localDataService=t;this._onlineStatusService=i;this._toastrService=n;this._onlineStatusService.getOnlineStatus$().subscribe(r=>{this.isOnline=r})}_Data=new fe(null);Data$=this._Data.pipe(ke(),oe(e=>e!==null));isOnline;get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}getSalesOrderPrint(e){return this.httpService.post("/API/POS/GetSalesOrderPrint",{TemplateID:e})}submitOrder(e,t){let i=this.generatePOSDataForSubmission(e,this.isOnline);if(this.isOnline)return this.submitOnline(i).pipe(this.handleTimeOutError(i));if(t.ModuleSell.EnableOfflineTransaction)return this._localDataService.syncOrder(i).pipe(q(()=>this.generateCompleteData(i)));this._toastrService.warning("Offline order is not Supported!","Info!")}uploadOfflineOrder(e){return this._localDataService.uploadSingleOrder(e).pipe(Xe(t=>t?.message?.includes("objectStore does not exists")?this.submitOnline(e):pt(()=>t)))}submitOnline(e){return this.httpService.post(Q.SubmitOrder,e,Vn.pos.submitOrderTimeout)}handleTimeOutError(e){return Yt(Xe(t=>{if(t instanceof Zt||t?.name=="TimeoutError"){let i=this.generateCompleteData(e);this.pushNewValue(i)}throw t}))}generatePOSDataForSubmission(e,t=!0){let i=Object.assign(new G,e);i.Items=[],i.Order.CustomerID==null&&(i.Order.CustomerID=h.GuidEmpty),i.Order.SalesID==null&&(i.Order.SalesID=h.GuidEmpty);let n=1;i.Payments=i.Payments.map(c=>(c.Date=i.Order.Date,c.Index=n,n++,delete c.TypeID,c));let r=1;for(let c of i.CartItems){let u=new gi;u.ID=c.ID,u.VariantID=c.VariantID,u.Quantity=c.Quantity,u.Cost=c.Cost,u.Price=c.Price,u.Discount=c.Discount,u.DiscountAmount=c.DiscountAmount,u.Note=c.Note,u.Taxable=c.Variant.Taxable,u.LoyaltyPoint=c.LoyaltyPoint,u.UnitCost=c.Cost,u.UnitPrice=c.Price,u.UnitPriceOriginal=c.UnitPriceOriginal,u.UnitExpense=c.UnitExpense,u.EntityID=c.EntityID,u.Index=r,u.UnitQuantity=c.UnitQuantity,u.PriceTypeID=c.PriceTypeID,u.PriceNote=c.PriceNote,u.Splited=c.SplitQuantity>0,u.SplitQuantity=c.SplitQuantity,u.InventoryTypeID=c.Variant.TypeID,u.SalesID="",u.Serial=c.Serial,c.SalesID&&(u.SalesID=c.SalesID),delete c.CouponDiscount,i.Items.push(u),r++}return t?(delete i.CartItems,delete i.Order.ClientTimestamp):i.Order.ClientTimestamp=new Date,i}generateCompleteData(e){let t=new yi;return t.InvoiceNumber=e.Order.Number,t.OrderTimeString=new Date().toString(),t.PaymentStateID=e.Action?.Type,t.PaymentStateLabel="Offline",t.Success=!0,t.OutDeliveryID=e.Action.DeliveryEntityID,t}GetReturnInvoice(e,t){return this.httpService.get(Q.ReturInvoice,[{key:"EntityID",value:t},{key:"Number",value:e}])}GetInvoiceBySoID(e){return this.httpService.get(Q.GetPOSDataByID,[{key:"ID",value:e}])}UploadCSV(e,t){let i={CartItems:e,EntityID:t};return this.httpService.post(Q.UploadCsv,i)}sendEmail(e,t){return new Promise((i,n)=>{this._localDataService.isProductFromServer().subscribe(r=>{if(r){let c={invoiceID:t,email:e};this.httpService.post(Q.SendInvoiceEmail,c).subscribe({next:u=>{i(u)},error:u=>{n(u)}})}else n(X.wrongOfflineAction)})})}sendWhatsaap(e,t){let i={InvoiceID:e,PhoneNumber:t};return this.httpService.post(Q.SendInvoiceWhatsapp,i)}createCustomerByInvoice(e,t){let i={InvoiceID:e,Mobile:t};return this.httpService.post(Q.CreateCustomerInvoice,i)}saveCommission(e,t){let i={SOID:e,commission:t};return this.httpService.POSText("/API/Transaction/SetCommission",i)}generateReceiptA4(e){let t={ID:e};return this.httpService.post(Q.InvoiceA4,t)}getVacant(e){return this.httpService.get(Q.GetVacant,[{key:"EntityID",value:e}])}static \u0275fac=function(t){return new(t||o)(g(Me),g(ve),g(me),g(H))};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var $=class o{constructor(e,t,i){this._localDataService=e;this._onlineStatusService=t;this._httpService=i;this._onlineStatusService.getOnlineStatus$().subscribe(n=>{this.isOnline=n})}_Data=new fe(null);Data$=this._Data.asObservable().pipe(oe(e=>e!==null),ke());isOnline;get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}requestObservable(){return this.isOnline?this._httpService.get(Q.GetPOSStorage).pipe(q(e=>({data:e,type:"Online"}))):this._localDataService.getPOSStorage().pipe(oe(e=>e!=null),q(e=>({data:e,type:"Offline"})))}getOutletName(e){return this.Data.Entities.find(i=>i.ID==e)?.Name}static \u0275fac=function(t){return new(t||o)(g(ve),g(me),g(Me))};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var _e=class o{constructor(e){this.roleService=e;this.pushNewValue(new it(e))}_Data=new fe(new it(null));get Data(){return this._Data.value}Data$=this._Data.asObservable();pushNewValue(e){this._Data.next(e)}static \u0275fac=function(t){return new(t||o)(g(ci))};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Wt=class{ID;Code;EntityID;Name;Description;Start;StartDisplay;State;Open;CashierID;OpeningCash;EntityName;LoginID;Active;CustomerDisplayEnabled;OvoConfigurationID;CustomerDisplayID;ListImage;Suspended};var Wo=o=>({active:o}),Go=o=>({gray:o});function qo(o,e){if(o&1){let t=I();a(0,"span",17),b("click",function(n){C(t);let r=d().$implicit;return d().closeRegister(r),v(n.stopPropagation())}),s()}}function $o(o,e){o&1&&(a(0,"div")(1,"span",18),m(2,"VACANT"),s()())}function Jo(o,e){if(o&1&&(a(0,"div")(1,"span",19),_(2,"i",20),a(3,"font"),m(4),s()(),a(5,"span",21),_(6,"i",22),a(7,"font"),m(8),s()()()),o&2){let t=d().$implicit;l(4),D(t.LoginID),l(4),O("",t.StartDisplay.split(" ")[3]," - Now")}}function zo(o,e){if(o&1){let t=I();a(0,"div",9)(1,"div",10)(2,"div",11)(3,"h5",12),b("click",function(){let n=C(t).$implicit,r=d();return v(r.select(n))}),a(4,"span"),_(5,"i",13),m(6),y(7,"limitTo"),s(),f(8,qo,1,0,"span",14),s(),a(9,"div",15),b("click",function(){let n=C(t).$implicit,r=d();return v(r.select(n))}),f(10,$o,3,0,"div",16)(11,Jo,9,2,"div",16),s()()()()}if(o&2){let t=e.$implicit,i=d();l(),p("ngClass",t.Active?"active":""),l(),p("ngClass",F(11,Wo,(t==null?null:t.ID)==(i.selectedRegister==null?null:i.selectedRegister.ID))),l(),p("ngClass",F(13,Go,t!=i.selectedRegister)),l(3),D(te(7,8,t.Name,15)),l(2),p("ngIf",t.State!="Close"),l(),p("ngSwitch",t.State),l(),p("ngSwitchCase","Close"),l(),p("ngSwitchCase","Open")}}var bi=class o{constructor(e,t,i,n,r){this._dialogRef=e;this._outletService=t;this._posService=i;this._userRoleService=n;this.router=r}originalSelectedRegister=null;registers;searchInput="";selectedRegister=new Wt;modalConfig=new K;role;get AppConfigJSON(){return this._posService.Data.AppConfigJSON}destroy$=new Ae;ngOnInit(){this.subscribeToObsChanges(),this.initModalConfig()}subscribeToObsChanges(){this._posService.Data$.pipe(Se(this.destroy$)).subscribe(e=>{this.registers=e.Registers}),this._outletService.Data$.pipe(Se(this.destroy$)).subscribe(e=>{this.selectedRegister=this.findOutletRegisterById(e.RegisterID),this.originalSelectedRegister=this.selectedRegister?zt({},this.selectedRegister):null}),this._userRoleService.Data$.pipe(Se(this.destroy$)).subscribe(e=>{this.role=e})}findOutletRegisterById(e){let t=this.registers.find(i=>i.ID===e);return t||new Wt}initModalConfig(){this.modalConfig.hideClose=!1,this.modalConfig.hideCancel=!1,this.modalConfig.bodyScrollable=!0,this.modalConfig.title="Choose an outlet"}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}close(){this._dialogRef.close()}onOk(){if(this.selectedRegister.ID==null){alert("Please select a register first!");return}this._outletService.pushNewRegister(this.selectedRegister),this._dialogRef.close({selectedRegister:this.selectedRegister,openStartingCashDialog:this.selectedRegister.ID!=this.originalSelectedRegister?.ID})}select(e){if(this.AppConfigJSON.ModuleShift.Closure.Enabled)if(this.selectedRegister.ID!=null&&this.selectedRegister.Open&&e.CashierID==null)confirm("You already have an active register with "+this.selectedRegister.Name+`!
2
2
  Do you want to end your session?`)&&(this.close(),this.router.navigate(["menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}}));else if(!e.Open||this.selectedRegister.ID==e.ID)this.selectedRegister=e;else{if(this.role.SellEditor==!1){alert("You cannot end shift for Register "+e.Name+" - Unauthorized Access");return}alert("This Register has already active register, Are you sure you want to end this register?"),this.close(),this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}})}else this.selectedRegister=e}closeRegister(e){let t=this.selectedRegister.ID;if(this.role.SellEditor==!1){alert("You cannot end shift for Register "+e.Name+" - Unauthorized Access");return}t==e.ID?this.router.navigate(["/menu/Shift/Main/My_Shift"]):this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}}),this.close()}static \u0275fac=function(t){return new(t||o)(S(Y),S(ee),S($),S(_e),S(Nn))};static \u0275cmp=N({type:o,selectors:[["pos-modal-register"]],standalone:!1,decls:11,vars:7,consts:[[3,"onOk","onCancel","onClose","config"],[1,"ms-0","mb-8",2,"width","200px",3,"hidden"],[1,"input-group","mb-3"],[1,"input-group-text","txtFilter"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["data-cy","SearchOutlet","type","text","placeholder","Filter by Name","aria-label","Search",1,"txtFilter","form-control","border-start-0",3,"ngModelChange","ngModel"],[1,"container"],[1,"row",2,"width","600px"],["class","col-4","data-cy","registers",4,"ngFor","ngForOf"],["data-cy","registers",1,"col-4"],[1,"card","border-0",3,"ngClass"],[1,"card-body","p-0",3,"ngClass"],[1,"card-title","mb-0",3,"click","ngClass"],[1,"fa-solid","fa-house","pe-1","fs-6"],["class","fa fa-xmark-circle fa-lg position-absolute","style","text-shadow: 0 1px 0 #afafaf; right: 5px; top: 16px",3,"click",4,"ngIf"],[1,"card-text","px-0","py-2",3,"click","ngSwitch"],[4,"ngSwitchCase"],[1,"fa","fa-xmark-circle","fa-lg","position-absolute",2,"text-shadow","0 1px 0 #afafaf","right","5px","top","16px",3,"click"],[1,"idle"],[1,"cashier"],["aria-hidden","true",1,"fa","fa-user","pe-2"],[1,"open"],["aria-hidden","true",1,"fa-regular","fa-clock","pe-2"]],template:function(t,i){t&1&&(a(0,"modal-material",0),b("onOk",function(){return i.onOk()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),a(1,"content")(2,"div",1)(3,"div",2)(4,"span",3),_(5,"i",4),s(),a(6,"input",5),V("ngModelChange",function(r){return A(i.searchInput,r)||(i.searchInput=r),r}),s()()(),a(7,"div",6)(8,"div",7),f(9,zo,12,15,"div",8),y(10,"FilterByName"),s()()()()),t&2&&(p("config",i.modalConfig),l(2),p("hidden",i.registers.length<=6),l(4),k("ngModel",i.searchInput),l(3),p("ngForOf",te(10,4,i.registers,i.searchInput)))},dependencies:[Fe,he,ae,In,xn,Oe,Ce,De,Z,pi,no],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}.col-4[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]{width:180px;min-height:95px;margin-right:17px;margin-bottom:17px;position:relative}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]{display:block;outline:0;border:1px solid #B1AAAA;border-radius:5px;cursor:pointer}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{height:30px;border-radius:4px;padding:5px 10px;color:#fff;background:#b1aaaa;overflow:hidden}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{margin-right:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover, .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%]{background:#ffffe1;border:1px solid #89b03e}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover > h5[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%]{background:#89b03e}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover{border:1px solid #c9302c}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover > h6[_ngcontent-%COMP%]{background:#c9302c!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#c9302c}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover{background:#fff}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]{border:1px solid #f6a828}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%]{background:#f6a828!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover{border:1px solid #f6a828;background:#fff}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover > strong[_ngcontent-%COMP%]{background:#f6a828!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#f6a828}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] div[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.75rem!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{height:80px;padding:15px 10px;position:relative}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;font-weight:400;font-size:.875rem;width:100%;margin-bottom:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:first-child{margin-top:-10px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:last-child{margin-bottom:0}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{text-align:center;position:absolute;bottom:0;right:0;width:auto;background-color:#b1aaaa;border-radius:3px;padding:2px 5px;color:#fff;display:none!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.idle[_ngcontent-%COMP%]{display:block;font-size:1.25rem;text-align:center}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{position:absolute;width:27px;height:28px;cursor:pointer;top:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#000}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:last-of-type{right:-5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:nth-last-of-type(2){right:15px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{bottom:20px;right:5px;position:absolute}.col-4[_ngcontent-%COMP%] .duration[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{border:1px solid!important;position:absolute;bottom:-3px;left:58px;background:#fff;border-radius:5px}"]})};var Yo=["inputCash"],Si=class o{constructor(e,t){this.dialogRef=e;this.data=t;this.generateModalTitle$.subscribe()}registerService=R(ee);loadPOSService=R($);register=this.registerService.Data;username=this.loadPOSService?.Data?.UserName;amount=re(0);config=new K;currentRegisterName;generateModalTitle$=this.registerService.Data$.pipe(oe(e=>h.IsNotEmpty(e)),se(()=>{let e=this.registerService.getOutletRegister(),t=e?.Name?.length>18?`${e?.Name?.substring(0,18)}...`:e?.Name;this.config.title="Open Shift",this.currentRegisterName=t}),ye());today=new Date;inputCashEl;ngOnInit(){this.config.customWidth="350px",this.config.hideCancel=!0}ngAfterViewInit(){this.inputCashEl?.nativeElement?.focus()}onOk(){this.dialogRef.close({amount:this.amount()})}static \u0275fac=function(t){return new(t||o)(S(Y),S(ce))};static \u0275cmp=N({type:o,selectors:[["POS-modal-opening-cash"]],viewQuery:function(t,i){if(t&1&&kt(Yo,5),t&2){let n;Vt(n=Ft())&&(i.inputCashEl=n.first)}},standalone:!1,decls:25,vars:8,consts:[["inputCash",""],[3,"onOk","onCancel","onClose","config"],[1,"table","fs-5","text"],[1,"py-3"],[1,"text-end","pe-3"],[1,"py-4"],[1,"text-end"],["data-cy","InputCash","autoNum","",1,"border","form-control-lg","text-end","w-100",3,"ngModelChange","ngModel"]],template:function(t,i){if(t&1){let n=I();a(0,"modal-material",1),b("onOk",function(){return C(n),v(i.onOk())})("onCancel",function(){return C(n),v(i.dialogRef.close())})("onClose",function(){return C(n),v(i.dialogRef.close())}),a(1,"content")(2,"table",2)(3,"tr")(4,"td",3),m(5,"Outlet Register"),s(),a(6,"td",4),m(7),s()(),a(8,"tr")(9,"td",5),m(10,"Current User"),s(),a(11,"td",4),m(12),s()(),a(13,"tr")(14,"td",5),m(15,"Starting Time"),s(),a(16,"td",4),m(17),y(18,"date"),s()(),a(19,"tr")(20,"td",3),m(21,"Starting Cash"),s(),a(22,"td",6)(23,"input",7,0),V("ngModelChange",function(c){return C(n),A(i.amount,c)||(i.amount=c),v(c)}),s()()()()()()}t&2&&(p("config",i.config),l(7),D(i.currentRegisterName),l(5),D(i.username),l(5),D(te(18,5,i.today,"EEEE, HH:mm")),l(6),k("ngModel",i.amount))},dependencies:[Oe,Ce,De,Z,bt,$e],styles:[".table-title-width[_ngcontent-%COMP%]{width:120px}"]})};var Pi=class{OrderNumberElement;InvoiceNumberElement;NewOrderID};var Dt=class o{constructor(e,t,i){this._httpService=e;this._onlineStatusService=t;this._localDataService=i;this._onlineStatusService.getOnlineStatus$().subscribe(n=>{this.isOnline=n})}isOnline;GenerateNumber(e,t){if(this.isOnline)return this._httpService.get(Q.GenerateNumber,[{key:"EntityID",value:e},{key:"TypeID",value:1}]);{let i=new Pi;return h.IsNotEmpty(t.NumberElement)&&(t.NumberElement.Seed+=1),h.IsNotEmpty(t.InvoiceNumberElement)&&(t.InvoiceNumberElement.Seed+=1),i.InvoiceNumberElement=t.InvoiceNumberElement,i.OrderNumberElement=t.NumberElement,i.NewOrderID=h.Guid_NewGuid(),we(i)}}findRegisterById(e){return new Promise(t=>{this._localDataService.isConfigFromServer().subscribe(i=>{i?this._httpService.get(Q.GetRegisterInfo,[{key:"RegisterID",value:e}]).subscribe(n=>{t(n)}):this._localDataService.findRegisterByID(e).subscribe(n=>{t(n)})})})}recordOpeningCash(e){return Kt(this._httpService.post("/API/POS/RecordOpeningCash",e))}static \u0275fac=function(t){return new(t||o)(g(Me),g(me),g(ve))};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var ee=class o{constructor(e,t,i,n,r,c){this._signalRClientService=e;this._matDialog=t;this._posHttpResponseService=i;this._CoreHttpService=n;this._toastrService=r;this._roleService=c}datePipe=R($e);_Data=new fe(null);Data$=this._Data.asObservable().pipe(oe(e=>e!==null),ke());get Data(){return this._Data.value}getSalesname(e){return this.Data&&this.Data.ListSales?this._Data.value.ListSales.find(t=>t.ID==e)?.Name:""}setActiveRegisterFromOptions(e,t){let n=this._posHttpResponseService.Data.AppConfigJSON.ModuleShift.Closure.Enabled;if(e.length>1){let r=e.find(c=>c.LoginID==t);if(r)this.pushNewRegister(r);else{let c=this.getOutletRegisterFromLocalStorage(),u=this.Data?.RegisterID?this.Data.RegisterID:c?.ID;e.some(w=>w.ID==u)?n?this.openChooseRegisterModal():this.initRegisterFromLocalStorage():this.openChooseRegisterModal()}}e.length==1&&(this.pushNewRegister(e[0]),h.IsEmpty(e[0].LoginID)&&h.IsEmpty(e[0].CashierID)&&this.openOpeningCashModal(e[0].ID)),e.length==0&&this._toastrService.warning("You do not have access to any OUTLET","Warning")}openChooseRegisterModal(){this._matDialog.open(bi,{id:"registerModal",disableClose:!0}).afterClosed().pipe(oe(e=>h.IsNotEmpty(e?.selectedRegister))).subscribe(e=>{e.selectedRegister&&this.openOpeningCashModal(e.selectedRegister.ID)})}openOpeningCashModal(e){this._posHttpResponseService.Data.AppConfigJSON.ModuleShift.Closure.Enabled&&this._matDialog.open(Si,{disableClose:!0}).afterClosed().pipe(oe(n=>h.IsNotEmpty(n))).subscribe(n=>{let r={RegisterID:e,OpAmount:n.amount};this._CoreHttpService.recordOpeningCash(r).then(()=>{this.updateRegisterList(r)})})}updateRegisterList(e){let i=this._posHttpResponseService.Data.Registers.map(r=>r.ID==e.RegisterID?this.mapRegisterAsActiveRegister(r,e):r),n=this._posHttpResponseService.Data;n.Registers=i,this._posHttpResponseService.pushNewValue(n)}mapRegisterAsActiveRegister(e,t){let i=localStorage.getItem("AccountInfo");if(i){let r=JSON.parse(i);e.LoginID=r.UserName}e.OpeningCash=t.OpAmount,e.Open=!0,e.State="Open";let n=this.datePipe.transform(new Date,"dd MM yyyy HH:mm");return e.StartDisplay=n,e}initRegisterFromLocalStorage(){if(this._roleService.Data.DeleteItem==!1){let t=this.getOutletRegisterFromLocalStorage();t&&this.pushNewRegister(t)}}pushNewRegister(e){let t=this._Data.value,i=t?t.RegisterID:null;i!=e.ID&&this._CoreHttpService.findRegisterById(e.ID).then(n=>{n.RegisterCode=e.Code,n.DefaultPrintTemplate=n.PrintTemplate,this._signalRClientService.SubscribeGroup(n.RegisterID,i),this.saveOutletRegisterToLocalStorage(e),this.pushNewValue(n)})}getOutletRegister(){let e=this.Data.RegisterID;return this._posHttpResponseService.Data.Registers.find(n=>n.ID==e)}pushNewValue(e){this._Data.next(e)}saveOutletRegisterToLocalStorage(e){if(this._roleService.Data.DeleteItem==!1){let i=JSON.stringify(e);localStorage.setItem("outlet_register",i)}}getOutletRegisterFromLocalStorage(){let e=this._roleService.Data.DeleteItem,t=localStorage.getItem("outlet_register"),i=null;return t&&(e?localStorage.removeItem("outlet_register"):i=JSON.parse(t)),i}findOutletRegisterById(e){return this._posHttpResponseService.Data.Registers.find(n=>n.ID===e)}static \u0275fac=function(t){return new(t||o)(g(et),g(Ie),g($),g(Dt),g(H),g(_e))};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Oi=class{RegisterID;Number;Amount;TransactionID};var Mt=class{GroupID;Method;Data};var Di=class{Status;InvoiceID;LoyaltyPoint;diff};var Mi=class{GopayQr};var qt=(r=>(r[r.cash=1]="cash",r[r.card=2]="card",r[r.emoney=3]="emoney",r[r.other=4]="other",r[r.ECR=99]="ECR",r))(qt||{});var L=class o{constructor(e,t,i){this._OrderHttpService=e;this._customerHttpService=t;this._toastrService=i}_Data=new fe(new G);transaction_id;Data$=this._Data.asObservable();get Data(){return this._Data.value}pushNewValue(e){if(e)this._Data.next(e);else{let t=this.Data;this._Data.next(t)}}submitOrder(e){return new Promise((t,i)=>{this.checkTransactionId(),this._OrderHttpService.submitOrder(this.Data,e).subscribe({next:n=>{t(n)},error:n=>{this.Data.Items=[],i(n)}})})}uploadOfflineOrder(){return this.checkTransactionId(),this._OrderHttpService.uploadOfflineOrder(this.Data)}checkTransactionId(){let t=this.Data.Payments.find(i=>i.TypeID==3);h.IsNotEmpty(t)&&h.IsEmpty(this.transaction_id)&&this._toastrService.warning("Midtrans transaction_id is empty. Please verify manually!","Mobile Payment Failure")}updateCustomerID(e){return this.Data.Order.CustomerID=e,this.pushNewValue(this.Data),new Promise((t,i)=>{this._customerHttpService.GetPrivilegeByID(e,this.Data.Order.EntityID).subscribe({next:n=>{this._customerHttpService.Data=n,this.pushNewValue(this.Data),t(n)},error:n=>{this.Data.Order.CustomerID=null,this.Data.ContactName=null;let r=n.error?.Message;n.status==409?this._toastrService.warning(r,"Warning"):this._toastrService.error(r,`API Error - ${n.status}`),i(n)}})})}static \u0275fac=function(t){return new(t||o)(g(Ot),g(Te),g(H))};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Ii=class{Name;Quantity;Discount;DiscountAmount;Price;UnitQuantity};var xi=class{Items;AmountSummary;GopayQr;Number;Customer;SalesName;CurrencySymbol;FinalAmount};var Ti=class o{_state=re(this.initCustomerDisplayState());isEnabled=Ge(()=>this._state()?.enabled);connect(){let t={enabled:!0,timestamp:new Date().toDateString()};localStorage.setItem("customerDisplay",JSON.stringify(t)),this._state.set(t)}initCustomerDisplayState(){let e=localStorage.getItem("customerDisplay"),t={enabled:!1,timestamp:""};return h.IsNotEmpty(e)&&(t=JSON.parse(e)),t}disconnect(){let t={enabled:!1,timestamp:new Date().toDateString()};localStorage.setItem("customerDisplay",JSON.stringify(t)),this._state.set(t)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var ue=class{Amount;CurrencySymbol;Label;Type;constructor(e,t,i,n){this.Amount=e,this.CurrencySymbol=t,this.Label=i,this.Type=n}};var ot=class{ModuleSell;ApplicationLoyalty;ApplicationMath;CoreDefaults;ModuleDelivery;ApplicationParkAndRetrieve;ApplicationRegisterClosure;PaymentConfigGopay;PaymentConfigLink;PrintConfigInvoice;CorePrint;PaymentConfigEmpatKali;ApplicationSettings;PrintConfigGeneral;ModuleProducts;ModuleContact;ApplicationTransactionNumbering;ModuleOrders;ModuleShift;ModuleBuy;ModuleAdjustment;TadaCouponVisible;CouponRedemptionType;ProviderOption};var ie=class o{constructor(e,t,i,n){this._orderDataService=e;this._posService=t;this.POSMATH=i;this.decimalPipe=n;this._orderDataService.Data$.pipe(z(r=>this._posService.Data$.pipe(q(c=>({appConfig:c.AppConfigJSON,salesOrder:r}))))).subscribe(r=>{this.salesOrderData=r.salesOrder,this.appConfigJSON=r.appConfig,this.calculateDiscountAmount(),this.pushNewValue(this.grandTotal)})}_Data=new fe(0);Data$=this._Data.asObservable().pipe(ke());tax=new uo;discountAfterTax=0;currencySymbol="Rp";get Data(){return this._Data.value}salesOrderData=new G;appConfigJSON=new ot;pushNewValue(e){this._Data.next(e)}get grandTotal(){let e=this.TotalAfterSurcharge;return isNaN(e)?0:e}setDecimalDigit(e){let t=this.decimalPipe.transform(e,"1.0-4");return e=parseFloat(t.split(",").join("")),e}get TotalAfterTax(){let e=this.TaxAmount,t=this.TotalBeforeTax+e;return t=this.POSMATH.Round(t,this.appConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm),t}get TotalBeforeTax(){let e=this.tax?.CalculationTypeID===1,t=0;return e?t=this.DiscountTotal-this.TaxAmount:t=this.DiscountTotal,t}get TotalAfterSurcharge(){let e=this.TotalAfterTax+this.SurchargeAmount;return this.POSMATH.Round(e,this.appConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm)}get TotalAfterDiscountTaxable(){return this.GrossTotalTaxable-this.DiscountTotal}get TaxAmount(){if(this.tax!=null){let e=0,t=this.appConfigJSON.ApplicationMath.RoundingTaxDigit.DecimalPlaceValue,i=this.appConfigJSON.ApplicationMath.RoundingTaxDigit.RoundAlgorithm,n=this.GrossTotalTaxable;return this.tax.CalculationTypeID==1?e=this.tax.Rate/(100+this.tax.Rate)*n:e=this.tax.Rate/100*n,e=this.POSMATH.Round(e,t,i),e}else return 0}get SurchargeAmount(){return this.TotalAfterTax*this.salesOrderData.Invoice.SurchargePcg/100}get Discount1Amount(){return this.GrossTotal*this.salesOrderData.Order.Discount/100}get AfterDiscount1Amount(){return this.GrossTotal-this.Discount1Amount}get Discount2Amount(){return this.AfterDiscount1Amount*this.salesOrderData.Order.Discount2/100}get AfterDiscount2Amount(){return this.AfterDiscount1Amount-this.Discount2Amount}get DiscountTotal(){return this.AfterDiscount2Amount-this.salesOrderData.Order.DiscountAmount}calculateDiscountAmount(){let e=this.salesOrderData.Order.DiscountAmount,t=0;this.AfterDiscount2Amount>=0&&e>0&&e>this.AfterDiscount2Amount&&(t=this.AfterDiscount2Amount),t!==0&&t<=e&&this.GrossTotal!==0&&(e=t),this.salesOrderData.Order.DiscountAmount=e}get GrossTotal(){return this.sum(this.salesOrderData.CartItems,"Total")}get GrossTotalTaxable(){let e=this.salesOrderData.CartItems.filter(i=>i.Taxable),t=this.sum(e,"Total");if(e.length!==0){let i=this.calculateDiscountTaxableItem(e);t=t*(100-this.salesOrderData.Order.Discount)/100,t=t*(100-this.salesOrderData.Order.Discount2)/100,t=t-i}return t}calculateDiscountTaxableItem(e){let t=this.GrossTotal,i=this.salesOrderData.Order.DiscountAmount,n=0,r=0,c=0,u=0;for(let P of e)n=P.getItemAfterDiscount/t,r=n*i,u=r*P.Quantity,c+=u;return c}get GrossTotalNonTaxable(){let e=this.salesOrderData.CartItems.filter(i=>i.Taxable==!1),t=this.sum(e,"Total");return t=t*(100-this.salesOrderData.Order.Discount)/100,t=t*(100-this.salesOrderData.Order.Discount2)/100,t=t-this.salesOrderData.Order.DiscountAmount,t}sum(e,t){let i=e.reduce((n,r)=>n+r[t],0);return i=this.setDecimalDigit(i),i}GetPointOnlyAmount(){let e=this.salesOrderData.CartItems.filter(t=>t.Variant.PaymentTypeID==2);return this.GetAmountByCart(e)}GetCashOnlyAmount(){let e=this.salesOrderData.CartItems.filter(t=>t.Variant.PaymentTypeID==1);return this.GetAmountByCart(e)}GetCashAndPointAmountCart(){let e=this.salesOrderData.CartItems.filter(t=>t.Variant.PaymentTypeID!=1);return this.GetAmountByCart(e)}GetAmountByCart(e){let t=this.sum(e,"Total");return t=t*(100-this.salesOrderData.Order.Discount)/100,t=t*(100-this.salesOrderData.Order.Discount2)/100,t}calculateGrossTotal(e){return this.sum(e,"Total")}static \u0275fac=function(t){return new(t||o)(g(L),g($),g(go),g(J))};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Ri=class o{constructor(e,t,i,n){this._invoiceCalculatorService=e;this._decimalPipe=t;this._poshttpResponseService=i;this._orderService=n;this._poshttpResponseService.Data$.pipe(ye()).subscribe(r=>{this.appConfig=r.AppConfigJSON})}appConfig=new ot;generateAmountSummary(){let e=[];this.isUseTax()?e=this.generateSummaryTax():e=this.generateSummaryNonTax();let t=this.generateSurchargeSummary();return t&&e.push(...t),e}generateSummaryTax(){let e=this._invoiceCalculatorService.tax?.CalculationTypeID,t=[];return e==1?t=this.generateSummaryTaxInclude():t=this.generateSummaryTaxExclude(),t}generateSummaryNonTax(){let e=[],t=this.generateCartItemAmount();if(e.push(t),this.isDiscounted()){let i=this.generateDiscountSummary(),n=this.generateAmountTotal("Total");e.push(...i,n)}return e}generateSummaryTaxInclude(){let e=[];return this.isTaxReserveSequence()?e=this.generateTaxIncludeReserveSequence():e=this.generateTaxIncludeNormalSequence(),e}generateTaxIncludeReserveSequence(){let e=[];if(this.isTaxDetailVisible()==!1){let r=this._invoiceCalculatorService.TotalBeforeTax,c=this.isDiscounted()?"Amount":"Before Tax",u=this.isDiscounted()?this._invoiceCalculatorService.GrossTotal:r,P=new ue(u,this.currencySymbol,c,2);e.push(P)}if(this.isDiscounted()){let r=this.generateDiscountSummary(),c=this.generateBeforeTaxSummary();e.push(...r,c)}let i=this.generateTax(),n=this.generateAmountTotal();return e.push(...i,n),e}generateTaxIncludeNormalSequence(){let e=[],t=this.generateCartItemAmount();if(e.push(t),this.isDiscounted()){let n=this.generateDiscountSummary(),r=this.generateSummarySubTotal();e.push(...n,r)}let i=this.generateTax();if(e.push(...i),this.isTaxDetailVisible()==!1){let n=this.generateBeforeTaxSummary();e.push(n)}return e}generateSummaryTaxExclude(){let e=[],t=this.generateCartItemAmount(!0);if(e.push(t),this.isDiscounted()){let c=this.generateDiscountSummary(),u=this.generateSummarySubTotal();e.push(...c,u)}let i=this.generateTax(),n=this._invoiceCalculatorService.TotalAfterTax,r=new ue(n,this.currencySymbol,"Total",1);return e.push(...i,r),e}generateAmountTotal(e="Total Amount"){let t=this._invoiceCalculatorService.Data;return new ue(t,this.currencySymbol,e,1)}generateSummarySubTotal(){let e=this._invoiceCalculatorService.TotalAfterTax;return new ue(e,this.currencySymbol,"SubTotal",1)}generateBeforeTaxSummary(){let e=this._invoiceCalculatorService.TotalBeforeTax;return new ue(e,this.currencySymbol,"Before Tax",2)}isTaxDetailVisible(){return this.appConfig.PrintConfigInvoice?.Footer?.TaxDetailVisible}isUseTax(){let e=this._invoiceCalculatorService.tax;return e?.PrintVisible&&e?.Rate!=0}generateTax(){let e=[],t=this.isTaxDetailVisible(),i=t?2:1,n=this._invoiceCalculatorService.tax;if(t){let r=this.appConfig.PrintConfigInvoice.Footer.TaxableSales,c=this.calculateTaxableSales(),u=new ue(c,this.currencySymbol,r,i);e.push(u)}if(n.TypeID==2){let r=this.generateTaxTypeMultiple();e.push(...r)}else{let r=this.generateSingleTaxSummary(n.Label,this._invoiceCalculatorService.TaxAmount,i);e.push(r)}if(t){let r=this.appConfig.PrintConfigInvoice.Footer.TaxExemptSales,c=this._invoiceCalculatorService.GrossTotalNonTaxable,u=new ue(c,this.currencySymbol,r,i);e.push(u);let P=this.appConfig.PrintConfigInvoice.Footer.LabelWithZeroAmount;if(P){let w=new ue(0,this.currencySymbol,P,i);e.push(w)}}return e}generateCartItemAmount(e=!1){let t=this.isDiscounted()||e?this._invoiceCalculatorService.GrossTotal:this._invoiceCalculatorService.TotalAfterTax;return new ue(t,this.currencySymbol,"Amount",1)}get currencySymbol(){return this._invoiceCalculatorService.currencySymbol}generateDiscountSummary(){let e=[];if(this._invoiceCalculatorService.Discount1Amount!=0){let t=this._decimalPipe.transform(this._orderService.Data.Order.Discount),n=this.checkDiscountIgnoreDecimal(t)?"{0}":"{0} ({1}%)";e.push(new ue(this._invoiceCalculatorService.Discount1Amount*-1,this._invoiceCalculatorService.currencySymbol,h.StringFormat(n,this.appConfig.CorePrint.Alias.Discount1,t),1))}if(this._invoiceCalculatorService.Discount2Amount!=0){let t=this._decimalPipe.transform(this._orderService.Data.Order.Discount2),n=this.checkDiscountIgnoreDecimal(t)?"{0}":"{0} ({1}%)";e.push(new ue(this._invoiceCalculatorService.Discount2Amount*-1,this._invoiceCalculatorService.currencySymbol,h.StringFormat(n,this.appConfig.CorePrint.Alias.Discount2,t),1))}return this._orderService.Data.Order.DiscountAmount!=0&&this.appConfig.PrintConfigInvoice.ItemsFooter.DiscountAmountVisible&&e.push(new ue(this._orderService.Data.Order.DiscountAmount*-1,this._invoiceCalculatorService.currencySymbol,"Discount ("+this._invoiceCalculatorService.currencySymbol+")",1)),e}calculateTaxableSales(){let e=this._invoiceCalculatorService.tax,t=this._invoiceCalculatorService.TaxAmount,i=this._invoiceCalculatorService.GrossTotalTaxable;return e.Rate==0?0:e.CalculationTypeID==1?i-t:i}generateTaxTypeMultiple(){let e=this.appConfig.PrintConfigInvoice.Footer.TaxDetailVisible?2:1,t=[],i=this._invoiceCalculatorService.tax;var n=this._invoiceCalculatorService.TaxAmount;if(i.TypeID==2){let r=i?.Components?i?.Components:[],c=this._invoiceCalculatorService.GrossTotalTaxable,u=this.calculateTotalRate(r);r.forEach(P=>{if(i.CalculationTypeID==0){let w=P.Rate/100*c;t=[...t,this.generateSingleTaxSummary(P.Label,w,e)],i.MultipleTaxTypeID==1&&(c+=w)}else{let w=P.Rate/u*n;t=[...t,this.generateSingleTaxSummary(P.Label,w,e)]}})}else t=[...t,this.generateSingleTaxSummary(i.Label,n,e)];return t}calculateTotalRate(e){let t=0;return e&&e.length>0&&(t=e.map(i=>i.Rate).reduce((i,n)=>i+n)),t}generateSingleTaxSummary(e,t,i){let n=this._invoiceCalculatorService.currencySymbol;return new ue(t,n,e,i)}generateSurchargeSummary(){if(this._invoiceCalculatorService.SurchargeAmount==0)return;let e=[],t=this.appConfig.CorePrint,i=t&&t.Alias.SurchargePcg?t.Alias.SurchargePcg:"Surcharge";e.push(new ue(this._invoiceCalculatorService.SurchargeAmount,this._invoiceCalculatorService.currencySymbol,h.StringFormat("{0} ({1}%)",i,this._decimalPipe.transform(this._orderService.Data?.Invoice.SurchargePcg)),1));let n=this.generateAmountTotal();return e.push(n),e}checkDiscountIgnoreDecimal(e){let i=this.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal,n=parseFloat(e)%1,r=!1;return n!==0&&i&&(r=!0),r}isDiscounted(){let e=this._invoiceCalculatorService.Discount1Amount,t=this._invoiceCalculatorService.Discount2Amount,i=this._orderService.Data.Order.DiscountAmount,n=!1;return(e!=0||t!=0||i!=0)&&(n=!0),n}isTaxReserveSequence(){let e=this._invoiceCalculatorService.tax,t=!!e,i=t?e.CalculationTypeID:null,n=this.appConfig.PrintConfigInvoice.ItemsFooter.TaxIncludeBeforeTotalAmount;return t&&i===1&&n}static \u0275fac=function(t){return new(t||o)(g(ie),g(J),g($),g(L))};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var rt=class o{constructor(e,t,i,n){this._receiptCalculatorService=e;this._cashierCalculatorService=t;this._signal=i;this._customerHttpService=n;this.broadcastOrderUpdate$.subscribe()}_salesOrderDataModelService=R(L);_outletService=R(ee);displayService=R(Ti);localdata=R(ve);orderDataModel;broadcastOrderUpdate$=Ue([this._salesOrderDataModelService.Data$,this.localdata.isStoreOrderInServer(),$n(this.displayService.isEnabled)]).pipe(Sn(([e,t,i])=>{let n=this._outletService?.Data?.RegisterID;if(t&&i&&n){this.orderDataModel=e;let r=this.ConstructCartModelForCustomerDisplay(),c=new Mt;return c.GroupID=n+"_Subscriber",c.Method="POSCartAmountUpdated",c.Data=r,this._signal.broadcast(c).pipe(Xe(u=>(console.log(u),mt)))}else return mt}),Xe(e=>(console.log(e),mt)),ye());ConstructCartModelForCustomerDisplay(){let e=this._customerHttpService.Data,t=new xi;t.Number=this.orderDataModel.Order.Number,t.Items=Array();for(let i of this.orderDataModel.CartItems){let n=new Ii;n.Name=i.Variant.Name,n.Discount=i.Discount,n.DiscountAmount=i.DiscountAmount,n.Price=i.Price,n.Quantity=i.Quantity,n.UnitQuantity=i.UnitQuantity,t.Items.push(n)}return h.IsNotEmpty(this.orderDataModel.Order.SalesID)?t.SalesName=this._outletService.getSalesname(this.orderDataModel.Order.SalesID):t.SalesName="",h.IsNotEmpty(this.orderDataModel.Order.CustomerID)&&h.IsNotEmpty(e)&&(t.Customer=new Pt,t.Customer.Email=e.Email,t.Customer.Mobile=e.Mobile,t.Customer.Name=this.orderDataModel.ContactName),t.CurrencySymbol=this._cashierCalculatorService.currencySymbol,t.FinalAmount=this._cashierCalculatorService.Data,t.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),t}BroadcastStateToCustomerDisplay(e,t="",i="",n=0){let r=new Di;r.Status=e,r.InvoiceID=t,r.LoyaltyPoint=i,r.diff=n;let c=new Mt;return c.GroupID=this._outletService.Data.RegisterID+"_Subscriber",c.Method="POSStateUpdated",c.Data=r,this.displayService.isEnabled()?this.localdata.isStoreOrderInServer().pipe(z(u=>u?this._signal.broadcast(c):we(X.offlineMode))):mt}BroadcastQRToCustomerDisplay(e){let t=new Mi;t.GopayQr=e;let i=new Mt;return i.GroupID=this._outletService.Data.RegisterID+"_Subscriber",i.Method="POSQRPaymentActivated",i.Data=t,this.displayService.isEnabled()?this.localdata.isStoreOrderInServer().pipe(z(n=>n?this._signal.broadcast(i):we(X.offlineMode))):mt}static \u0275fac=function(t){return new(t||o)(g(Ri),g(ie),g(et),g(Te))};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Ei=class o{constructor(e){this.httpService=e}VerifyPayment(e,t){let i=this.getVerifyPaymentUrl(t);return this.httpService.post(i,e)}getVerifyPaymentUrl(e){let t;switch(e){case 0:t=Q.GopayVerifyPayment;break;case 1:t=Q.BcaVerifyPayment;break}return t}generateLink(e){return this.httpService.post(Q.GenerateLink,e)}generateQRCode(e,t){return this.httpService.post(e,t)}static \u0275fac=function(t){return new(t||o)(g(Me))};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var It=class o{constructor(e,t,i,n,r){this._posHubService=e;this._orderDataService=t;this._PaymentHttpService=i;this._InvoicecashierCalculatorService=n;this._toastrService=r}transactionId;qrPaymentMethodID;QRCodeHttpResponse;_paymentMethod;get paymentMethod(){return this._paymentMethod}resetPaymentMethod(){this._paymentMethod=null}onQRPaymentComplete(e,t){return new Promise((i,n)=>{if(e.transaction_id!==this.transactionId){let c=`transaction_id: ${e.transaction_id} / gross_amount: ${e.gross_amount}`;n({header:"Invalid QR Payment",message:c});return}if(e.gross_amount!==this._InvoicecashierCalculatorService.Data){let c=`paid_amount: ${e.gross_amount} vs invoice_amount: ${this._InvoicecashierCalculatorService.Data}`;n({header:"Invalid QR Payment",message:c});return}let r=this._orderDataService.Data.Order.Number;if(e.order_id.includes(r)==!1){let c=`Order ID: ${e.order_id} vs Order Number: ${r}`;n({header:"Invalid QR Payment",message:c});return}if(e.transaction_status!=="settlement"){let c=`Transaction status is ${e.transaction_status}`;n({header:"Invalid QR Payment",message:c});return}this.validateEMoneyPayment(t).subscribe(c=>{i(c)})})}generateNewPayment(e,t){let i=this._orderDataService.Data;h.IsEmpty(this.qrPaymentMethodID)&&alert("QR PaymentMethod.ID is not available!");let n=new Je;return n.PaidAmount=t,n.Amount=t,n.Date=i.Order.Date,n.MethodID=this.qrPaymentMethodID,n.Code=e,h.IsEmpty(e)&&this._toastrService.warning("Midtrans transaction_id is empty. Please verify manually!","Mobile Payment Failure"),n}sendStateCompleteToCustomerDisplay(e){this._posHubService.BroadcastStateToCustomerDisplay(1,e.ObjectID,e.LoyaltyPoint,0).subscribe()}generateQR(e,t){this._paymentMethod=t,this.qrPaymentMethodID=t.ID;let i=this.getServiceUrl(t.EMoneyTypeID);return this._PaymentHttpService.generateQRCode(i,e).pipe(q(c=>(c=this.manipulateBCAQrisImg(c,t.EMoneyTypeID),this.transactionId=c.Transaction_id,this.QRCodeHttpResponse=c,this._orderDataService.transaction_id=c.Transaction_id,this.sendQRToCustomerDisplay(c.Url),c)))}sendQRToCustomerDisplay(e){this._posHubService.BroadcastQRToCustomerDisplay(e).subscribe()}validateEMoneyPayment(e){if(h.IsNotEmpty(this.transactionId)){let t=this._InvoicecashierCalculatorService.Data,i=this._paymentMethod?.EMoneyTypeID,n=this.generatePaymentVerificationData(t,i);return this._PaymentHttpService.VerifyPayment(n,i).pipe(z(r=>(this.updatePosDataForSubmission(t),bn(this._orderDataService.submitOrder(e)).pipe(se(c=>{this.sendStateCompleteToCustomerDisplay(c)})))))}else{let t=new Error("Transaction ID is Empty");throw pt(()=>t)}}generatePaymentVerificationData(e,t){let i=this._orderDataService.Data,n=new Oi;return n.Number=i.Order.Number,n.Amount=e,n.TransactionID=this.transactionId,n.RegisterID=i.Order.RegisterID,t==1&&(n.Number=this.QRCodeHttpResponse.Number),n}updatePosDataForSubmission(e){let t=this._orderDataService.Data,i=this.generateNewPayment(this.transactionId,e),n=[];n.push(i),t.Invoice.Due=null,t.Action.Type=3,t.Order.InvoicedStateID=3,t.Payments=n,this._orderDataService.pushNewValue(t)}getServiceUrl(e){let t;switch(e){case 0:t=Q.GenerateGopayQrCode;break;case 1:t=Q.GenerateBcaQrCode;break}return t}manipulateBCAQrisImg(e,t){return t==1&&(e.Url=`data:image/png;base64, ${e.Url}`),e}clearTransactionID(){this.transactionId=null,this._orderDataService.transaction_id=null,this.QRCodeHttpResponse=null}getTransactionId(){return this.transactionId}static \u0275fac=function(t){return new(t||o)(g(rt),g(L),g(Ei),g(ie),g(H))};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var xt=class{CommissionID;ReturNumber;parkTemporaryItem;posState;InputTextValue;constructor(){this.posState=0,this.CommissionID="",this.ReturNumber="",this.parkTemporaryItem=[],this.InputTextValue=""}};var wi=class o{constructor(e,t,i){this._promotionEventService=e;this._dialogRef=t;this.data=i;this.modalConfig=new K,this.modalConfig.hideCancel=!0,this.modalConfig.hideClose=!0,this.modalConfig.headerType=ne.Warning,this.modalConfig.title="Promotion Requirement unfulfilled!",this.modalConfig.customWidth="350px",this.modalConfig.okText="Ok",this.selectedPromotion=e.selectedPromotion}modalConfig;selectedPromotion;onOk(){this._promotionEventService.restoreOrder(),this._dialogRef.close()}static \u0275fac=function(t){return new(t||o)(S(Ee),S(Y),S(ce))};static \u0275cmp=N({type:o,selectors:[["POS-modal-promotion-confirm"]],standalone:!1,decls:9,vars:4,consts:[[3,"onOk","config"],[1,"fst-italic","text-danger","mb-3"],[1,"mb-0"]],template:function(t,i){t&1&&(a(0,"modal-material",0),b("onOk",function(){return i.onOk()}),a(1,"content")(2,"div")(3,"h5"),m(4),s(),a(5,"p",1),m(6),s(),a(7,"p",2),m(8),s()()()()),t&2&&(p("config",i.modalConfig),l(4),D(i.selectedPromotion==null?null:i.selectedPromotion.Name),l(2),D(i.selectedPromotion==null?null:i.selectedPromotion.Description),l(2),D(i.data==null?null:i.data.message))},dependencies:[Z],encapsulation:2})};var Ni=class extends be{};function ir(o,e){if(o&1&&(a(0,"span",8),m(1),y(2,"number"),s()),o&2){let t=d(2);l(),O("-",M(2,1,t.coupon.Amount),"%")}}function nr(o,e){if(o&1&&(a(0,"span",8),m(1),y(2,"number"),s()),o&2){let t=d(2);l(),O(" -",M(2,1,t.coupon.Amount)," ")}}function or(o,e){if(o&1){let t=I();a(0,"button",12),b("click",function(){C(t);let n=d().$implicit,r=d();return v(r.onRemoveCouponDiscount(n))}),m(1," Remove "),s()}}function rr(o,e){if(o&1){let t=I();a(0,"button",13),b("click",function(){C(t);let n=d().$implicit,r=d();return v(r.onApplyCouponDiscount(n))}),m(1," Apply "),s()}if(o&2){let t=d(2);p("disabled",t.hasAppliedCouponDiscount())}}function ar(o,e){if(o&1&&(a(0,"tr")(1,"td"),m(2),s(),a(3,"td"),m(4),s(),a(5,"td",7),m(6),y(7,"number"),s(),a(8,"td",7),f(9,ir,3,3,"span",8)(10,nr,3,3,"span",8),s(),a(11,"td",9),f(12,or,2,0,"button",10)(13,rr,2,1,"button",11),s()()),o&2){let t=e.$implicit,i=d();l(2),D(t==null||t.Variant==null?null:t.Variant.Name),l(2),D(t==null||t.Variant==null?null:t.Variant.Code),l(2),D(M(7,5,t.UnitPrice)),l(3),E((i.coupon==null||i.coupon.Requirement==null?null:i.coupon.Requirement.Type)==i.couponType.DiscountPercentage?9:10),l(3),E((t==null?null:t.CouponDiscount)>0?12:13)}}var Ai=class o{constructor(e){this.data=e;this.coupon=this.data.coupon,this.initModalConfig(),this.initEligibleItems()}dialogRef=R(Y);config;eligibleItems=re([]);coupon;couponType=fi;hasAppliedCouponDiscount=re(!1);initModalConfig(){this.config=new K,this.config.title="Choose Item to Apply Discount",this.config.hideFooter=!0}initEligibleItems(){let e=this.data.coupon?.ApplyToProduct.map(t=>t.ID);e&&(this.eligibleItems.update(()=>this.data.cartItems.filter(i=>e.includes(i.VariantID))),this.hasAppliedCouponDiscount.update(()=>this.eligibleItems().some(t=>t.CouponDiscount>0)))}onApplyCouponDiscount(e){let t=[e];this.hasAppliedCouponDiscount.update(()=>!0),this.dialogRef.close(t)}onRemoveCouponDiscount(e){this.eligibleItems.update(t=>{let i=t.findIndex(n=>n.VariantID===e.VariantID);return i>-1&&(t[i].Discount=0,t[i].CouponDiscount=0),t}),this.hasAppliedCouponDiscount.update(()=>!1)}onClose(){this.dialogRef.close()}static \u0275fac=function(t){return new(t||o)(S(ce))};static \u0275cmp=N({type:o,selectors:[["app-modal-coupon-selected-item"]],decls:20,vars:1,consts:[[3,"onCancel","onClose","config"],[1,"container"],[1,"row"],[1,"col-12"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],[1,"text-end"],[1,"text-danger"],[1,"text-center"],[1,"btn","btn-sm","btn-danger"],[1,"btn","btn-sm","btn-success",3,"disabled"],[1,"btn","btn-sm","btn-danger",3,"click"],[1,"btn","btn-sm","btn-success",3,"click","disabled"]],template:function(t,i){t&1&&(a(0,"modal-material",0),b("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()}),a(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"table",4)(6,"thead",5)(7,"tr")(8,"th",6),m(9,"Name"),s(),a(10,"th",6),m(11,"Code"),s(),a(12,"th",6),m(13,"Price"),s(),a(14,"th",6),m(15,"Discount"),s(),_(16,"th",6),s()(),a(17,"tbody"),ft(18,ar,14,7,"tr",null,gt),s()()()()()()()),t&2&&(p("config",i.config),l(18),ht(i.eligibleItems()))},dependencies:[le,J,yt,Z],encapsulation:2})};var ki=class{Code;Provider;EntityID;Customer;ShoppingCart};var Vi=class o{salesOrderService=R(L);registerService=R(ee);customerService=R(Te);orderCalculator=R(ie);generateRedeemCouponDto(e,t){let i=new ki,n=this.registerService.Data?.EntityID;return i.Code=e,i.Provider=t,i.ShoppingCart={Amount:this.orderCalculator.Data,Items:this.generateItems()},i.EntityID=n,i.Customer=this.generateCustomer(t),i}generateItems(){return this.salesOrderService.Data.CartItems.map(i=>({Price:i.Price,Quantity:i.Quantity,VariantID:i.VariantID,Code:i?.Variant?.Code}))}generateCustomer(e){let t=this.customerService.Data,i=this.salesOrderService?.Data?.Order?.CustomerID,n=null;return h.IsNotEmpty(i)&&(n={Phone:t.Mobile,Email:t.Email},e==="Internal"&&(n=zt({ID:i},n))),n}static \u0275fac=function(t){return new(t||o)};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Rt=class o{constructor(e,t,i,n,r,c){this._httpService=e;this._orderDataService=t;this._userRoleService=i;this.toastr=n;this._invoiceCalculatorService=r;this.promotionCouponFactoryService=c;this.subscribeToObservable()}dialog=R(Ie);role;originalRoleData;_coupon;get coupon(){return this._coupon}subscribeToObservable(){this._userRoleService.Data$.subscribe(e=>{this.role=e,h.IsEmpty(this.originalRoleData)&&(this.originalRoleData=xe(it,e))})}RedeemCoupon(e,t,i=!0){let n=this.promotionCouponFactoryService.generateRedeemCouponDto(e,"Internal");this._httpService.post(Q.ValidateInternalCoupon,n).subscribe({next:r=>{switch(this._orderDataService.Data.Order.PromotionCoupon=e,this._orderDataService.Data.Order.PromotionNote=t,this._orderDataService.Data.Order.CouponType=1,r.Requirement?.Type){case 1:this.HandleDiscountPercentage(r,i);break;case 2:this.HandleDiscountAmount(r);break;case 3:this.HandleReturn();break;case 4:this.HandleParkedDeletion();break;case 5:this.HandleFullAccess(),i&&this.toastr.success("You now have Full Access for this Order!","Coupon Applied");break}this._coupon=r},error:r=>{this.resetAppliedCoupon(),this.removeAppliedCoupon(!1)}})}resetAppliedCoupon(){if(h.IsNotEmpty(this.coupon)){let e=this.coupon?.Requirement?.EmptyCartOnApplyCoupon;switch(this.coupon.Requirement?.Type){case 2:this.HandleDiscountAmount(this.coupon,!0),this.removeAppliedCoupon();break;case 1:this.HandleDiscountPercentage(this.coupon,!1,!0),this.removeAppliedCoupon();break;case 5:e?this.handleConfigEmptyItemsOnRemoveCoupon():this.resetRoleAfterAppliedCoupon();break;case 4:e?this.handleConfigEmptyItemsOnRemoveCoupon():this.HandleParkedDeletion(!0);break;case 3:this.HandleReturn(!0),this.removeAppliedCoupon();break}}}resetAppliedCouponDiscount(){if(this.coupon){switch(this.coupon.Requirement?.Type){case 1:this.HandleDiscountPercentage(this._coupon,!1,!0);break;case 2:this.HandleDiscountAmount(this._coupon,!0);break}this.removeAppliedCoupon()}}HandleDiscountPercentage(e,t,i=!1){e.Amount>0?e.Requirement?.MaximumDiscount>0?this.applyConfigMaxDiscount(e,i):e.Requirement?.FullPriceProductOnly?this.applyFullPriceDisc(e,t,i):this.applyDiscountPercentage(e,t,i):(this.role.Discount=i?this.originalRoleData.Discount:!0,this._userRoleService.pushNewValue(this.role))}applyFullPriceDisc(e,t,i=!1){let n=this._orderDataService.Data,r=this.filterItemWithDisc(n.CartItems),c=this.filterItemWithCouponDisc(n.CartItems);if(i)c.length>0?(n.CartItems=this.resetItemsDisc(n.CartItems),this._orderDataService.pushNewValue()):this.applyDiscountPercentage(e,!1,i);else if(r.length>0){let u=this.filterItemWithoutDisc(n.CartItems);u.length>0?this.applyConfigItemsScope(e,u).subscribe(P=>{let w=this.applyItemsDisc(P,e);n.CartItems=this.updateCartItems(w,e),this._orderDataService.pushNewValue(n),this.showToastr(e)}):(this.removeAppliedCoupon(),t=!1,this._orderDataService.pushNewValue())}else this.applyDiscountPercentage(e,!0,i)}updateCartItems(e,t){let n=this._orderDataService.Data.CartItems.map(r=>{let c=e.find(u=>u.VariantID==r.VariantID);return c||r});return n=this.applyOneOfFirstQuantity(n,t),n}applyOneOfFirstQuantity(e,t){if(t?.Requirement?.RequirementDiscountType==2){let i=e.findIndex(n=>n.CouponDiscount>0);if(e[i].Quantity>1){let n=st(be,e[i]);n.Quantity=1,e[i].Quantity=e[i].Quantity-1,e[i].CouponDiscount=0,e[i].Discount=0,e[i].DiscountAmount=0,e.push(n)}}return e}filterItemWithDisc(e){return e.filter(i=>i.Discount>0||i.DiscountAmount>0||i.Price!=i?.Variant?.UnitPrice||h.IsNotEmpty(i.PriceBookID)||i.PriceTypeID==2)}filterItemWithoutDisc(e){return e.filter(i=>this.itemConditionFullPriceOnly(i))}filterItemWithCouponDisc(e){return e.filter(i=>i.CouponDiscount>0)}applyDiscountPercentage(e,t,i=!1){let n=this._orderDataService.Data.Order.CustomerDiscountRate,r=e.Amount;if(i){let c=this._orderDataService.Data;this._orderDataService.Data.Order.Discount=0,c.CartItems=this.resetItemsDisc(c.CartItems),this._orderDataService.pushNewValue(c)}else r>=n?e.ApplyToProduct?.length>0?this.applyDiscountRequiredItems(e):(this._orderDataService.Data.Order.Discount=e.Amount,this._orderDataService.pushNewValue(),this.showToastr(e)):(this.toastr.warning("Member discount is applied because member discount is greater than Coupon Discount","Warning"),this.resetAppliedCouponDiscount())}applyDiscountRequiredItems(e){let i=this._orderDataService.Data.CartItems.filter(n=>e.ApplyToProduct.map(r=>r.ID)?.includes(n.VariantID));this.applyConfigItemsScope(e,i).subscribe(n=>{let r=n.map(u=>(u.Discount=e.Amount,u.CouponDiscount=e.Amount,u)),c=this.updateCartItems(r,e);this._orderDataService.Data.CartItems=c,this._orderDataService.pushNewValue(),this.showToastr(e)})}showToastr(e){e.Requirement?.Notify&&this.toastr.success(e.Requirement?.Notify,"Coupon Applied")}applyConfigMaxDiscount(e,t=!1){let i=this._orderDataService.Data.CartItems;e.Requirement?.FullPriceProductOnly&&(i=i.filter(n=>this.itemConditionFullPriceOnly(n))),this.applyConfigItemsScope(e,i).subscribe(n=>{this.applyMaxDiscount(e,n,t)})}applyConfigItemsScope(e,t){let i=e.Requirement?.RequirementDiscountType;return i==1||i==2?this.dialog.open(Ai,{data:{coupon:e,cartItems:t}}).afterClosed().pipe(se(r=>{let P=this._orderDataService.Data.CartItems.some(w=>w.CouponDiscount>0);!r&&!P&&this.resetAppliedCouponDiscount()}),oe(r=>!!r)):we(t)}applyMaxDiscount(e,t,i){let n=this._invoiceCalculatorService.calculateGrossTotal(t),r=this._orderDataService.Data,c=n*e.Amount/100,u=e.Requirement?.MaximumDiscount,P=t;c>=u?(r.Order.DiscountAmount=i?0:u,P=this.resetItemsDisc(t)):(r.Order.DiscountAmount=0,P=i?this.resetItemsDisc(t):this.applyItemsDisc(t,e)),r.CartItems=this.updateCartItems(P,e),this._orderDataService.pushNewValue(r)}resetItemsDisc(e){return this.coupon?.Requirement?.RequirementDiscountType==2?e=this.resetConfigOneOfFirstQuantity(e):e=e.map(t=>(t.CouponDiscount>0&&(t.Discount=0,t.DiscountAmount=0,t.CouponDiscount=0),t)),e}resetConfigOneOfFirstQuantity(e){let t=e.findIndex(i=>i.CouponDiscount>0);if(t!==-1){let i=e.findIndex(n=>n.CouponDiscount==0&&e[t]?.VariantID==n?.VariantID);i!==-1?(e.splice(t,1),e[i].Quantity+=1):(e[t].CouponDiscount=0,e[t].Discount=0,e[t].DiscountAmount=0)}return e}applyItemsDisc(e,t){return t.ApplyToProduct?.length>0?e=this.applyDiscByVariant(e,t):e=e.map(i=>(i.Discount=t.Amount,i.CouponDiscount=t.Amount,i)),e}applyDiscByVariant(e,t){return e=e.map(i=>(t.ApplyToProduct.find(r=>r.ID==i.VariantID)&&this.itemConditionFullPriceOnly(i)&&(i.Discount=t.Amount,i.CouponDiscount=t.Amount),i)),e}itemConditionFullPriceOnly(e){return(e.Discount==0||e.CouponDiscount>0)&&e.DiscountAmount==0&&e.Price==e?.Variant?.UnitPrice&&h.IsEmpty(e.PriceBookID)}HandleDiscountAmount(e,t=!1){e.Amount>0?(e.ApplyToProduct?.length>0?this.applyDiscountInItem(e,t):(t?this._orderDataService.Data.Order.DiscountAmount=0:(this._orderDataService.Data.Order.DiscountAmount=e.Amount,this.toastr.success(e?.Requirement?.Notify,"Coupon Applied")),this._orderDataService.pushNewValue()),this.resetCustomerPoint(t)):(this.role.Discount=t?this.originalRoleData.Discount:!0,this._userRoleService.pushNewValue(this.role))}applyDiscountInItem(e,t=!1){let i=this._orderDataService.Data;if(t)i.CartItems=this.resetItemsDisc(i.CartItems);else{let r=i.CartItems.filter(c=>e.ApplyToProduct.map(u=>u.ID)?.includes(c.VariantID));this.applyConfigItemsScope(e,r).subscribe(c=>{let u=c.map(P=>(P.DiscountAmount=e.Amount,P.CouponDiscount=e.Amount,P));i.CartItems=this.updateCartItems(u,e),this._orderDataService.pushNewValue(i),this.showToastr(e)})}}resetCustomerPoint(e){if(!e){let t=this._orderDataService.Data;t.Order.PointUsed=0}}HandleReturn(e=!1){this.role.Return=e?this.originalRoleData.Return:!0,this._userRoleService.pushNewValue(this.role)}HandleParkedDeletion(e=!1){this.role.ParkedDeletionAuthorized=e?this.originalRoleData.ParkedDeletionAuthorized:!0,this._userRoleService.pushNewValue(this.role),e?this.removeAppliedCoupon():this.toastr.success("You Have Access to delete park and delete item when retrieve!","Coupon Applied")}HandleFullAccess(){this.role.UnitPriceEditor=!0,this.role.Discount=!0,this.role.Return=!0,this.role.Tax=!1,this.role.NumberEditor=!0,this.role.DateEditor=!0,this.role.PricebookSelector=!0,this.role.DeleteItem=!0,this.role.ParkedDeletionAuthorized=!0,this._userRoleService.pushNewValue(this.role)}resetRoleAfterAppliedCoupon(e=!0){let t=xe(it,this.originalRoleData);this.role.UnitPriceEditor=t.UnitPriceEditor,this.role.Discount=t.Discount,this.role.Return=t.Return,this.role.Tax=t.Tax,this.role.NumberEditor=t.NumberEditor,this.role.DateEditor=t.DateEditor,this.role.PricebookSelector=t.PricebookSelector,this.role.ParkedDeletionAuthorized=t.ParkedDeletionAuthorized,this.role.DeleteItem=t.DeleteItem,this._userRoleService.pushNewValue(this.role),this.removeAppliedCoupon(e)}handleConfigEmptyItemsOnRemoveCoupon(){this._orderDataService.Data.CartItems?.length>0?this.dialog.open(po,{data:{title:"Empty Cart",message:"The cart will be cleared after removing the full access coupon. Are you sure?",headerType:ne.Warning,okText:"Yes",cancelText:"No"}}).afterClosed().pipe(oe(t=>t)).subscribe(()=>{this.clearCouponOnEmptyCart()}):this.clearCouponOnEmptyCart()}clearCouponOnEmptyCart(){let e=this._coupon?.Requirement?.Type,t=this._orderDataService.Data;t.Order.Discount=0,t.Order.Discount2=0,t.Order.DiscountAmount=0,t.CartItems=[],this._orderDataService.pushNewValue(t),this.clearCartItemsInLocalStorage(),e==5?this.resetRoleAfterAppliedCoupon():e==4&&this.HandleParkedDeletion(!0)}clearCartItemsInLocalStorage(){if(localStorage.getItem("cart_items"))try{localStorage.removeItem("cart_items")}catch(t){console.error("Error clearing cart items from localStorage:",t)}}removeAppliedCoupon(e=!0){let t=this._orderDataService.Data;t.Order.PromotionCoupon=null,t.Order.PromotionNote=null,this._coupon=null,this._orderDataService.pushNewValue(),e&&this.toastr.warning("Coupon Cancelled","Warning")}static \u0275fac=function(t){return new(t||o)(g(Me),g(L),g(_e),g(H),g(ie),g(Vi))};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};var Et=class o{constructor(e,t,i,n,r,c,u,P,w){this.variantService=e;this._posService=t;this._orderDataService=i;this.toastr=n;this._orderProcessorService=r;this._customerHttpService=c;this.promotionCouponService=u;this.userRoleService=P;this.decimalPipe=w;this.subscribeToObservable()}salesOrderData;appConfigJson;entityID;audio=new Audio;subscribeToObservable(){this._posService.Data$.subscribe(e=>{this.appConfigJson=e.AppConfigJSON}),this._orderDataService.Data$.subscribe(e=>{this.salesOrderData=e,this.entityID=e.Order.EntityID})}addCartItemById(e,t,i=!0){return new Promise((n,r)=>{this.variantService.findVariantByID(e,this.entityID,i).then(c=>{this.createNewCartItem(c,t),n(c)}).catch(c=>{r(c)})})}addCartItemByCode(e){return new Promise((t,i)=>{let n=this.appConfigJson.ModuleSell.DigitalScale;n.Digit>0&&h.IsNotEmpty(n.Regex)&&e.length==n.Digit?this.parseDigitalScaleBarcodeWithRegex(e,n).then(c=>{c||(this.toastr.info("Matching Regex Rule to Barcode","Digital Scale"),this.findVariantByCode(e).then(u=>t(u)).catch(u=>i(u)))}):this.findVariantByCode(e).then(c=>t(c)).catch(c=>i(c))})}findVariantByCode(e){let t=this.appConfigJson.ModuleSell.BarcodeSerialEnabled;return new Promise((i,n)=>{this.variantService.findVariantByCode(e,this.entityID,t).then(r=>{i(r),this.createNewCartItem(r)}).catch(r=>{this.playBellRing(),n(r)})})}addItemBySerial(e){this.variantService.findVariantBySerial(e,this.entityID).subscribe(t=>{let i=this.salesOrderData.CartItems;if(i.length>0){let n,r=[],c=i.findIndex(u=>u.Variant.ID==t.ID);r=[],c!==-1?(n=i[c].Serial?.findIndex(u=>u.Number==e),r=[...i[c].Serial?i[c].Serial:[]],n==-1?(r.push({Number:e,Quantity:1}),i[c].Quantity=r.length):r.length>0?r[n].Quantity+=1:(r=[{Number:e,Quantity:1}],this.addNewSerials(t,e)),i[c].Serial=[...r],i[c].Quantity=i[c].calculateSerialQty(),this.updateCartItem(i[c],c)):this.addNewSerials(t,e)}else this.addNewSerials(t,e)})}addNewSerials(e,t){e.Serial=[{Number:t,Quantity:1}],this.createNewCartItem(e)}playBellRing(){this.audio.src="//res.cloudinary.com/pos/video/upload/v1659947782/POS/Music/bell_ring.mp3",this.audio.load(),this.audio.play()}updateCartItem(e,t){this.salesOrderData.CartItems[t]=e,this._orderDataService.pushNewValue(this.salesOrderData),this.applyCustomerPoint(),this.reApplyPromotionCoupon(),this.saveItemsToLocalStorage()}deleteCartItem(e){this.salesOrderData.CartItems=this.salesOrderData.CartItems.filter(t=>t!==e),this._orderDataService.pushNewValue(this.salesOrderData),this.applyCustomerPoint(),this.reApplyPromotionCoupon()}parseDigitalScaleBarcodeWithRegex(e,t){return new Promise(i=>{let n=this.appConfigJson.ModuleSell.BarcodeSerialEnabled,r=new RegExp(t.Regex),c=e.match(r);if(console.log(c),h.IsNotEmpty(c)){let u=c[1],P=parseFloat(c[2]);console.log(P,"productQuantity"),P=P/t.QuantityDivider,this.variantService.findVariantByCode(u,this.entityID,n).then(w=>{this.createNewCartItem(w,null,P),i(!0)}).catch(()=>{i(!1)})}else i(!1)})}createNewCartItem(e,t,i){let n=new be,r=this.appConfigJson.ModuleSell.ProductNotes.CopyProductDescription,c=this.appConfigJson.ModuleSell.ProductNotes.CopyPromotionName;n.patchByVariant(e,r,c),n=this.applyReward(n,t),h.IsEmpty(t)&&(n=this.applyPriceBook(n)),this.validateCartItem(n)&&(n.Quantity=i||n.Quantity,t?.PromotionType==2?this.handlingPromotionQuantity(n):this.pushNewItemToArray(n,n.PromotionGift),this.applyCustomerPoint()),this.addAvailableComponent(n)}applyCustomerPoint(){let e=this.salesOrderData.Order.CustomerID,t=h.IsEmpty(e);this._orderProcessorService.reedemPointToDiscount(t)}handlingPromotionQuantity(e){let t=xe(be,this.salesOrderData.CartItems),i=t.findIndex(n=>n.VariantID==e.VariantID&&n.PromotionGift);i!==-1?t[i].Quantity+=e.Quantity?e.Quantity:1:t=[...t,e],this.salesOrderData.CartItems=t,this._orderDataService.pushNewValue(this.salesOrderData)}applyPromotionProduct(e){let t=e.Variant.DiscountAmount;return t&&(e.Price=e.UnitPriceOriginal-t),e}applyReward(e,t){if(t){let i=this.appConfigJson.ModuleSell.ProductNotes.CopyPromotionName;e.Discount=t.Discount,e.Price=t.OriginalPrice;let n=t.OriginalPrice-t.UnitPrice;e.Price=e.UnitPriceOriginal-n,e.UnitPrice=e.UnitPriceOriginal-n,e.PromotionGift=!0,e.PromotionID=t.PromotionID,e.Quantity=t.Quantity?t.Quantity:1,e.PriceTypeID=3,e.Cost+=t.ExtraCost,e.UnitCost+=t.ExtraCost,e.PriceNote=t.PromotionName,i&&(e.Note=`${e.Note?e.Note:""} ${t.PromotionName} `)}return e}addAvailableComponent(e){let t=e.Price!=0,i=this.appConfigJson.ModuleSell.SellProductComponentDefaultPrice,n=e.Variant;if(n.Component!=null&&n.Component.length>0)for(let r of n.Component){let c=new Ni;c.patchByVariant(r),c.Quantity=e.Quantity*r.Quantity,t&&!i&&(r.UnitPrice=0),c.Price=r.UnitPrice,this.pushNewItemToArray(c)}}pushNewItemToArray(e,t=!1){let i=this.salesOrderData.CartItems.findIndex(n=>n.VariantID==e.VariantID);if(e=this.applyPromotionProduct(e),i==-1||t)this.salesOrderData.CartItems.push(e);else{let n=this.appConfigJson.ModuleSell.QuickKey.NewRowBehaviour;if(n==2)this.salesOrderData.CartItems.push(e);else if(n==1)this._orderProcessorService.Data.posState==4?this.salesOrderData.CartItems.push(e):this.addingQuantityItem(i,e);else{if(!this.validatePrepaidPackage(e,i)){this.toastr.error("This prepaid package is already in the cart while editing. Please remove it first before adding again.","Cannot Add Item");return}this.addingQuantityItem(i,e)}}this._orderDataService.pushNewValue(this.salesOrderData),this.saveItemsToLocalStorage(),this.reApplyPromotionCoupon()}saveItemsToLocalStorage(){if(!this.userRoleService.Data.DeleteItem){let i=this._orderDataService.Data.CartItems;try{localStorage.setItem("cart_items",JSON.stringify(i))}catch(n){console.error("Error saving cart items to localStorage:",n)}}}clearCartItemsInLocalStorage(){if(!this.userRoleService.Data.DeleteItem)try{localStorage.removeItem("cart_items")}catch(t){console.error("Error clearing cart items from localStorage:",t)}}validatePrepaidPackage(e,t){let i=this.salesOrderData.CartItems[t],n=this._orderProcessorService.Data.posState,r=e.Variant.TypeID==10,c=h.IsNotEmpty(i.ID),u=!0;return n==2&&r&&c&&(u=!1),u}reApplyPromotionCoupon(){let e=this.salesOrderData.Order.CouponProvider,t=e=="Internal"||h.IsEmpty(e),i=this.salesOrderData.Order.PromotionCoupon,n=this.salesOrderData.Order.PromotionNote;h.IsNotEmpty(i)&&t&&this.promotionCouponService.RedeemCoupon(i,n,!1)}addingQuantityItem(e,t){let i=this.salesOrderData.CartItems.filter(u=>u.VariantID==t.VariantID),n=i.length,r=i.find(u=>!u.PromotionGift);this.salesOrderData.CartItems[e].PromotionGift&&n==1?this.salesOrderData.CartItems.push(t):(r.Quantity+=t.Quantity,r=this.applyPromotionProduct(r)),r&&(r=this.applyPriceBook(r))}validateCartItem(e){return e.Variant.CategoryTypeID==-1?(this.toastr.info(e.Variant.Name+" cannot be sold, check Category "+e.Variant.CategoryName+" settings","info"),!1):!(!this.validatePriceMinimum(e)||!this.validateSerialItem(e))}validatePriceMinimum(e){let t=!0,i=this.userRoleService.Data.PriceMinimum,n=this.appConfigJson.ModuleSell.ProductDialog.PriceMinimumTypeID;if(i){let r=0;switch(n){case 1:r=e.UnitPrice;break;case 2:r=e.UnitCost;break;case 3:r=e.UnitPriceMinimum;break}if(e.Price<r){t=!1;let c=h.StringFormat("You have no right to sell this item lower than {0}",this.decimalPipe.transform(r));alert(c)}}return t}validateSerialItem(e){let t=!0;if(e?.Serial?.length>0&&e.Variant.TypeID==4&&e.Quantity>0){let i=0;e?.Serial?.forEach(n=>{i+=n.Quantity}),i!=e.Quantity&&(this.toastr.error("Serial must be equal with the quantity","Error"),t=!1)}return t}applyPriceBook(e){let t=e.Variant.PriceBook!=null?e.Variant.PriceBook:[],i=this.findCustomerPricebook(t);if(t&&t.length!==0){let n=t.sort(function(r,c){return c.MinimumQuantity-r.MinimumQuantity}).filter(r=>e.Quantity>=r.MinimumQuantity&&r.MinimumQuantity!=0);n.length>0||h.IsNotEmpty(i)?h.IsNotEmpty(i)?e=this.applyPricebookToItem(e,i):e=this.applyPricebookToItem(e,n[0]):e=this.resetAppliedPricebook(e)}return e}resetAppliedPricebook(e){let i=(e?.Variant?.PriceBook).find(n=>n.ID==e.PriceBookID);return h.IsNotEmpty(i)&&(e.Discount=e.Variant.PriceDiscount,e.PriceBookID=h.GuidEmpty,e.Price=e.Variant.UnitPrice,e.UnitPrice=e.Variant.UnitPrice,e.PriceTypeID=0,e=this.applyPromotionProduct(e),e=this.removePromotionNote(e)),e}removePromotionNote(e){let t=this.appConfigJson.ModuleSell.ProductNotes;if(this.appConfigJson?.ModuleSell?.Pricebook?.PricebookVisible&&(e.Note=e.Note?.replace(e.PriceNote,""),e.PriceNote=""),t.CopyPromotionName){let n=e.Variant?.PriceNote;e.Note=`${n||""} ${e.Note?e.Note:""}`,e.PriceNote=n}return e}applyPricebookToItem(e,t){return e.Discount=t.PriceDiscount,e.UnitPrice=t.UnitPrice,e.PriceBookID=t.ID,e.Price=t.UnitPrice,e.PriceTypeID=2,e=this.assignItemNote(e,t),e}assignItemNote(e,t){return this.appConfigJson?.ModuleSell?.Pricebook?.PricebookVisible?(e.Note?.includes(e.PriceNote)?e.Note=e.Note?.replace(e.PriceNote,t.Name):e.Note=`${t.Name} ${e.Note?e.Note:""}`,e.PriceNote=t.Name):(e.Note="",e.PriceNote=""),e}findCustomerPricebook(e=[]){let t=this._customerHttpService.Data,i;return t&&(i=e.find(n=>n.ID==t.PricebookID)),i}static \u0275fac=function(t){return new(t||o)(g(mo),g($),g(L),g(H),g(ze),g(Te),g(Rt),g(_e),g(J))};static \u0275prov=x({token:o,factory:o.\u0275fac,providedIn:"root"})};function cr(o,e){if(o&1&&(a(0,"div",9)(1,"div",4),_(2,"input",10),s()()),o&2){let t=d();l(2),p("formControl",t.searchControl)}}function mr(o,e){if(o&1){let t=I();a(0,"tr")(1,"td"),m(2),s(),a(3,"td"),m(4),s(),a(5,"td",11),m(6),y(7,"number"),s(),a(8,"td",11),m(9),y(10,"number"),s(),a(11,"td",12)(12,"button",13),b("click",function(){let n=C(t).$implicit,r=d();return v(r.onSelectReward(n))}),m(13,"Apply"),s()()()}if(o&2){let t=e.$implicit;l(2),D(t.VariantName),l(2),D(t.VariantCode),l(2),D(M(7,4,t.OriginalPrice)),l(3),D(M(10,6,t.UnitPrice))}}var Li=class o{constructor(e,t,i,n,r,c){this._dialogRef=e;this._matDialog=t;this._shoppingCartService=i;this._promotionEventService=n;this._toastr=r;this.data=c;this.selectedPromotion=this._promotionEventService.selectedPromotion}modalConfig=new K;selectedPromotion;rewards$;searchControl=new Ye;ngOnInit(){this.modalConfig.title="Select a Reward",this.modalConfig.hideFooter=!0,this.initRewards(!0)}initRewards(e){this.rewards$=this.searchControl.valueChanges.pipe(Xt(""),dt(e?0:500),ke(),z(t=>{let i;return i=we(this.data.rewards).pipe(q(n=>n.filter(r=>this.findKeywordInValue(t,r?.VariantCode)||this.findKeywordInValue(t,r?.VariantName)))),e=!0,i}))}findKeywordInValue(e,t){return t?.toUpperCase()?.indexOf(e?.toUpperCase())>-1}onSelectReward(e){e.PromotionType=this.data.promotion.TypeID,this._shoppingCartService.addCartItemById(e.VariantID,e,!0).then(()=>{this._matDialog.closeAll(),this._promotionEventService.pushNewValue(this._promotionEventService.Data),this.showToastAppliedPromo()})}showToastAppliedPromo(){this._toastr.success("Applied "+this.selectedPromotion.Name+" to order!","Applied successfully!")}close(){this._dialogRef.close()}static \u0275fac=function(t){return new(t||o)(S(Y),S(Ie),S(Et),S(Ee),S(H),S(ce))};static \u0275cmp=N({type:o,selectors:[["POS-modal-select-item"]],standalone:!1,decls:22,vars:9,consts:[[3,"onCancel","onClose","config"],[1,"container"],["class","row mb-3",4,"ngIf"],[1,"row"],[1,"col-12"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],[4,"ngFor","ngForOf"],[1,"row","mb-3"],["type","text","placeholder","Type to filter reward",1,"form-control",3,"formControl"],[1,"text-end"],[1,"text-center"],[1,"btn","btn-sm","btn-success",3,"click"]],template:function(t,i){t&1&&(a(0,"modal-material",0),b("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),a(1,"content")(2,"div",1),f(3,cr,3,1,"div",2),a(4,"div",3)(5,"div",4)(6,"table",5)(7,"thead",6)(8,"tr")(9,"th",7),m(10,"Name"),s(),a(11,"th",7),m(12,"Code"),s(),a(13,"th",7),m(14,"Price"),s(),a(15,"th",7),m(16,"Promo"),s(),_(17,"th",7),s()(),a(18,"tbody"),f(19,mr,14,8,"tr",8),y(20,"async"),y(21,"sortBy"),s()()()()()()()),t&2&&(p("config",i.modalConfig),l(3),p("ngIf",(i.data==null||i.data.rewards==null?null:i.data.rewards.length)>5),l(16),p("ngForOf",Ct(21,5,M(20,3,i.rewards$),"desc","VariantCode")))},dependencies:[he,ae,Oe,Ce,vt,Z,qe,J,St],styles:[".table-scroll[_ngcontent-%COMP%]{max-height:400px;overflow-y:auto}table[_ngcontent-%COMP%]{max-width:600px!important;overflow-x:hidden}"]})};function pr(o,e){if(o&1&&(B(0),a(1,"div",13)(2,"div",7),_(3,"input",14),s()(),j()),o&2){let t=d();l(3),p("formControl",t.searchCtrl)}}function dr(o,e){o&1&&(B(0),a(1,"th",15),m(2,"Qty"),s(),j())}function ur(o,e){o&1&&_(0,"th",10)}function gr(o,e){if(o&1){let t=I();B(0),a(1,"td")(2,"input",17),V("ngModelChange",function(n){C(t);let r=d().$implicit;return A(r.Quantity,n)||(r.Quantity=n),v(n)}),s()(),j()}if(o&2){let t=d().$implicit;l(2),k("ngModel",t.Quantity)}}function fr(o,e){if(o&1){let t=I();a(0,"td",18)(1,"button",19),b("click",function(){C(t);let n=d().$implicit,r=d();return v(r.onApplyReward(n))}),m(2,"Apply"),s()()}}function hr(o,e){if(o&1&&(a(0,"tr")(1,"td"),m(2),s(),a(3,"td"),m(4),s(),a(5,"td",16),m(6),y(7,"number"),s(),a(8,"td",16),m(9),y(10,"number"),s(),f(11,gr,3,1,"ng-container",11)(12,fr,3,0,"ng-template",null,1,Pe),s()),o&2){let t=e.$implicit,i=U(13),n=d();l(2),D(t.VariantName),l(2),D(t.VariantCode),l(2),D(M(7,6,t.OriginalPrice)),l(3),D(M(10,8,t.UnitPrice)),l(2),p("ngIf",n.rewardQuantity>1)("ngIfElse",i)}}var Hi=class o{constructor(e,t,i,n,r,c){this.data=e;this.shoppingCartService=t;this.promotionEventService=i;this.dialogRef=n;this.matDialog=r;this.toastr=c;this.searchCtrl=new Ye,this.rewardQuantity=e.rewardQuantity,this.sourceRewards=[...e.rewards]}modalConfig;rewards$;rewardQuantity;rewards;sourceRewards=[];searchCtrl;ngOnInit(){this.initModalConfig(),this.initSearchCtrl(!0)}initModalConfig(){this.modalConfig=new K,this.modalConfig.title="Select a Reward",this.rewardQuantity<2&&(this.modalConfig.hideFooter=!0)}initSearchCtrl(e){this.rewards$=this.searchCtrl.valueChanges.pipe(Xt(""),dt(e?0:500),ke(),z(t=>{let i;return i=we(this.sourceRewards).pipe(q(n=>(n.length===1&&(n[0].Quantity=this.rewardQuantity),n)),q(n=>n.filter(r=>this.findKeywordInValue(t,r?.VariantCode)||this.findKeywordInValue(t,r?.VariantName)))),e=!1,i}),se(t=>{this.rewards=t}))}findKeywordInValue(e,t){return t?.toUpperCase()?.indexOf(e.toUpperCase())>-1}onApplyReward(e){this.addRewardToShoppingCart(e)}onClose(){this.dialogRef.close()}onOk(){this.calculateRewardQty()>this.rewardQuantity?this.toastr.warning("Product reward exceeds the maximum amount earned","Warning"):[...this.rewards].filter(i=>i.Quantity>0).forEach(i=>{this.addRewardToShoppingCart(i)})}calculateRewardQty(){let e=0;return this.rewards.forEach(t=>{e+=t.Quantity?t.Quantity:0}),e}addRewardToShoppingCart(e){e.PromotionType=this.data.promotion.TypeID,this.shoppingCartService.addCartItemById(e.VariantID,e,!0).then(()=>{this.matDialog.closeAll(),this.promotionEventService.pushNewValue(this.promotionEventService.Data)})}static \u0275fac=function(t){return new(t||o)(S(ce),S(Et),S(Ee),S(Y),S(Ie),S(H))};static \u0275cmp=N({type:o,selectors:[["app-modal-quantity-reward"]],standalone:!1,decls:27,vars:12,consts:[["APPLY",""],["APPLY_BUTTON",""],[3,"onCancel","onOk","onClose","config"],[1,"ms-3"],[1,"container"],[4,"ngIf"],[1,"row","table-scroll"],[1,"col-12"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],[4,"ngIf","ngIfElse"],[4,"ngFor","ngForOf"],[1,"row","mb-3"],["type","text","placeholder","Type to filter reward",1,"form-control",3,"formControl"],["scope","col",2,"width","66px"],[1,"text-end"],["type","text","autoNum","","min","0",1,"form-control",3,"ngModelChange","ngModel"],[1,"text-center"],[1,"btn","btn-sm","btn-success",3,"click"]],template:function(t,i){if(t&1){let n=I();a(0,"modal-material",2),b("onCancel",function(){return C(n),v(i.onClose())})("onOk",function(){return C(n),v(i.onOk())})("onClose",function(){return C(n),v(i.onClose())}),a(1,"header")(2,"small",3),m(3),s()(),a(4,"content")(5,"div",4),f(6,pr,4,1,"ng-container",5),a(7,"div",6)(8,"div",7)(9,"table",8)(10,"thead",9)(11,"tr")(12,"th",10),m(13,"Name"),s(),a(14,"th",10),m(15,"Code"),s(),a(16,"th",10),m(17,"Price"),s(),a(18,"th",10),m(19,"Promo"),s(),f(20,dr,3,0,"ng-container",11)(21,ur,1,0,"ng-template",null,0,Pe),s()(),a(23,"tbody"),f(24,hr,14,10,"tr",12),y(25,"async"),y(26,"sortBy"),s()()()()()()()}if(t&2){let n=U(22);p("config",i.modalConfig),l(3),O(" ( ",i.rewardQuantity," products reward ) "),l(3),p("ngIf",(i.sourceRewards==null?null:i.sourceRewards.length)>5),l(14),p("ngIf",i.rewardQuantity>1)("ngIfElse",n),l(4),p("ngForOf",Ct(26,8,M(25,6,i.rewards$),"desc","VariantCode"))}},dependencies:[he,ae,Oe,Ce,De,vt,Z,bt,qe,J,St],encapsulation:2})};var Ee=class o{constructor(e,t,i,n,r,c,u,P,w){this._orderDataService=e;this._outletService=t;this._invoiceCalculatorService=i;this._dialog=n;this._httpService=r;this._posService=c;this._toastr=u;this._signalrService=P;this.decimalPipe=w;this.previousQuantity=0,this.previousTotalEligible=0,this.subscribeNotification(),this._posService.Data$.subscribe(W=>{this.taxes=W.Taxes}),this._outletService.Data$.subscribe(W=>{this.loadPromotions(W.Promotion)}),this._orderDataService.Data$.pipe(oe(W=>{this.salesOrderData=W;let ge=this.calculateOrderReward(W.getRewards()),an=this.calculateOrderReward(this.previousRewards);return this.previousQuantity!=W.TotalQuantity||an<ge||this.isRestroreOrder}),dt(100)).subscribe(W=>{this.isRestroreOrder=!1,this.checkQtyPromotion(),this.applyQuantityPromotion(),this.previousRewards=[...W.getRewards()]}),this._invoiceCalculatorService.Data$.subscribe(W=>{this.checkEligiblePromotionWithMinSpend()})}_Data=new fe([]);get Data(){return this._Data.getValue()}Data$=this._Data.asObservable();selectedPromotion=null;onClickToastPromo=new Ae;previousQuantity;salesOrderData;orderDataBeforePromotion;taxes=[];previousTotalEligible;previousRewards=[];isRestroreOrder=!1;calculateOrderReward(e){let t=0;return e.length>0&&(t=e.map(i=>i.Quantity).reduce((i,n)=>i+n)),t}checkQtyPromotion(){let e=this._orderDataService.Data;this.checkEligibleQtyPromotion(e.CartItems),this.checkEligibleTierPromotion(e.CartItems),this.previousQuantity=e.TotalQuantity}subscribeNotification(){this._signalrService.OnPromotionEventChange.pipe(ye(),z(()=>{let e=this._outletService.Data?.RegisterID;return this.getPromotions(e)})).subscribe(()=>{this._toastr.info("Promotion Event Updated","Promotion Update")})}getPromotions(e){return this._httpService.get(Q.GetListPromotion,[{key:"RegisterID",value:e}]).pipe(se(t=>{this.loadPromotions(t)}))}loadPromotions(e){let t=this.getPromotionDesc(e);this.pushNewValue(t),this.checkQtyPromotion(),this.checkEligiblePromotionWithMinSpend()}pushNewValue(e){this.showToastEligiblePromotion(),this._Data.next(e)}checkSelectedPromotionRequirement(e){this.selectedPromotion!=null&&this.selectedPromotion.TypeID==e&&this.Data.find(i=>i.ID===this.selectedPromotion.ID)?.Eligible===!1&&(this._dialog.open(wi,{id:"modal-promotion-confirm",data:{message:"Order will be restored to before the promotion is applied"},disableClose:!0}),this.isRestroreOrder=!0)}restoreOrder(){this._orderDataService.pushNewValue(this.orderDataBeforePromotion),this.selectedPromotion=null}getPromotionDesc(e=[]){return e?.map(i=>(i.Description=this.generatePromotionDesc(i),i))}checkEligiblePromotionWithMinSpend(){let e=this._invoiceCalculatorService.Data,t=this.Data?.filter(n=>(n.TypeID===1||n.TypeID==3)&&!this.checkExpiredPromotion(n)).map(n=>(e>=n.MinimumAmount?n.Eligible=!0:n.Eligible=!1,n)),i=this.mappingEligiblePromotion(t);this.pushNewValue(i),this.checkSelectedPromotionRequirement(1),this.checkSelectedPromotionRequirement(3)}checkEligibleQtyPromotion(e){let t=0,i=this.Data?.filter(r=>r.TypeID===2&&!this.checkExpiredPromotion(r)).map(r=>(r.Eligible=!1,r.ListVariant.length>0?(t=this.getQuantityByRequirementType(e,"variant",r.ListVariant),t>=r.MinimumAmount&&(r.Eligible=!0)):r.ListCategory.length>0?(t=this.getQuantityByRequirementType(e,"category",r.ListCategory),t>=r.MinimumAmount&&(r.Eligible=!0)):this.salesOrderData.TotalQuantity>=r.MinimumAmount&&(r.Eligible=!0),r)),n=this.mappingEligiblePromotion(i);this.pushNewValue(n)}checkEligibleTierPromotion(e){let t,i=this.Data?.filter(r=>r.TypeID===5&&!this.checkExpiredPromotion(r)).map(r=>(r.Eligible=!1,r.ListVariant.length>0?t=this.getQuantityByRequirementType(e,"variant",r.ListVariant):r.ListCategory.length>0?t=this.getQuantityByRequirementType(e,"category",r.ListCategory):t=this.salesOrderData.TotalQuantity,r.PromotionTieredQuantity.forEach(c=>{t>=c.Quantity&&(r.Eligible=!0)}),r)),n=this.mappingEligiblePromotion(i);this.pushNewValue(n)}getQuantityByRequirementType(e,t,i){let n=0,r;return t=="variant"?e.forEach(c=>{r=i.findIndex(u=>u.ID===c.VariantID),r!==-1&&(n+=c.Quantity)}):e.forEach(c=>{c.Variant&&(r=i.findIndex(u=>u.ID===c.Variant.CategoryID),r!==-1&&(n+=c.Quantity))}),n}mappingEligiblePromotion(e=[]){let t=this.Data;if(e?.length>0){let i;t=this.Data?.map(n=>(i=e.findIndex(r=>r.ID==n.ID),i!==-1&&(n=e[i]),n))}return t}checkExpiredPromotion(e){let t=new Date,i=new Date(e.StartDate),r=(h.IsEmpty(e.StartTime)?"00:00:00":e.StartTime).split(":").map(w=>parseInt(w));i.setHours(r[0],r[1],r[2]);let c=new Date(e.ExpirationDate),P=(h.IsEmpty(e.EndTime)?"23:59:59":e.EndTime).split(":").map(w=>parseInt(w));return c.setHours(P[0],P[1],P[2]),!(t.getTime()>=i.getTime()&&t.getTime()<=c.getTime())}showToastEligiblePromotion(){let e=this.getTotalEligiblePromotion(),t=h.IsNotEmpty(this.salesOrderData.Order.ID);this.previousTotalEligible!==e&&e>0&&!t&&this._toastr.info(e+" promotion(s) can be applied!","Promo available!",{timeOut:2e4}).onTap.pipe(He(1)).subscribe(()=>{this.onClickToastPromo.next(!0)}),this.previousTotalEligible=e}getTotalEligiblePromotion(){return this.Data?.filter(t=>t.Eligible).length}generatePromotionDesc(e){let t="";switch(e.TypeID){case 2:t+="Minimum "+this.decimalPipe.transform(e.MinimumAmount)+" ",e.ListVariant.length>0?(t=t+" piece of ",t+=this.generateItemListDescription(e.ListVariant)):e.ListCategory.length>0?(t+="from category ",t+=this.generateItemListDescription(e.ListCategory)):t+="items";break;case 1:t+="Minimum spend Rp. "+this.decimalPipe.transform(e.MinimumAmount);break;case 3:t+=`Apply
3
3
  ${e.Discount1!==0?"discount1 = "+e.Discount1+"%":""}
4
4
  ${e.Discount1!==0&&e.Discount2!==0?" and ":""}