dealpos 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/POS/3rdpartylicenses.txt +1645 -0
  2. package/POS/assets/icons/icon-128x128.png +0 -0
  3. package/POS/assets/icons/icon-144x144.png +0 -0
  4. package/POS/assets/icons/icon-152x152.png +0 -0
  5. package/POS/assets/icons/icon-192x192.png +0 -0
  6. package/POS/assets/icons/icon-384x384.png +0 -0
  7. package/POS/assets/icons/icon-512x512.png +0 -0
  8. package/POS/assets/icons/icon-72x72.png +0 -0
  9. package/POS/assets/icons/icon-96x96.png +0 -0
  10. package/POS/chunk-26YXEYJK.js +1 -0
  11. package/POS/chunk-2DNKBN6G.js +1 -0
  12. package/POS/chunk-2FKYC63K.js +1 -0
  13. package/POS/chunk-2FWFPV5I.js +1 -0
  14. package/POS/chunk-2OSKJOSS.js +1 -0
  15. package/POS/chunk-2OXMYDYT.js +1 -0
  16. package/POS/chunk-2OZMF5DL.js +1 -0
  17. package/POS/chunk-2W3MAOOP.js +1 -0
  18. package/POS/chunk-33XCA4ER.js +14 -0
  19. package/POS/chunk-35V3VL6F.js +1 -0
  20. package/POS/chunk-3A7KA4YN.js +1 -0
  21. package/POS/chunk-3BODNSIH.js +1 -0
  22. package/POS/chunk-3FOIEYAT.js +4 -0
  23. package/POS/chunk-3PFXZUB6.js +7 -0
  24. package/POS/chunk-3QABPVXZ.js +3 -0
  25. package/POS/chunk-4BDQDYVB.js +1 -0
  26. package/POS/chunk-4CBDK52E.js +4 -0
  27. package/POS/chunk-4G26RHGA.js +1 -0
  28. package/POS/chunk-4MX7Q77M.js +2 -0
  29. package/POS/chunk-4UAHOTBD.js +1 -0
  30. package/POS/chunk-56EQRIAH.js +1 -0
  31. package/POS/chunk-5KBFQLSN.js +1 -0
  32. package/POS/chunk-5W7F4VJH.js +1 -0
  33. package/POS/chunk-64PDX5ZX.js +1 -0
  34. package/POS/chunk-65YDOCXF.js +1 -0
  35. package/POS/chunk-67VBXFVT.js +6 -0
  36. package/POS/chunk-6BQZINLH.js +1 -0
  37. package/POS/chunk-6L6CIH5M.js +1 -0
  38. package/POS/chunk-6PXJEE4K.js +1 -0
  39. package/POS/chunk-6S4Q5VRA.js +1 -0
  40. package/POS/chunk-75STMWUR.js +6 -0
  41. package/POS/chunk-76C33PK5.js +1 -0
  42. package/POS/chunk-77D6X2SQ.js +11 -0
  43. package/POS/chunk-7DWKYGA4.js +1 -0
  44. package/POS/chunk-7M6CWVRI.js +1 -0
  45. package/POS/chunk-7Q3437BR.js +1 -0
  46. package/POS/chunk-AA32I4UN.js +1 -0
  47. package/POS/chunk-AJMKP7YZ.js +1 -0
  48. package/POS/chunk-AOJW6WJT.js +1 -0
  49. package/POS/chunk-AOPKPEVH.js +1 -0
  50. package/POS/chunk-APJK7OH2.js +2 -0
  51. package/POS/chunk-APYNCJ2H.js +1 -0
  52. package/POS/chunk-AUYYX2UQ.js +45 -0
  53. package/POS/chunk-AVDGNFC7.js +1 -0
  54. package/POS/chunk-AWGZKLLY.js +1 -0
  55. package/POS/chunk-AYKDALBT.js +1 -0
  56. package/POS/chunk-B2OT7HA4.js +4 -0
  57. package/POS/chunk-B36XIZVJ.js +1 -0
  58. package/POS/chunk-B5FODXLM.js +1 -0
  59. package/POS/chunk-B7RM5KKA.js +1 -0
  60. package/POS/chunk-BCVO66L3.js +5 -0
  61. package/POS/chunk-BETKNHFK.js +1 -0
  62. package/POS/chunk-BH2ZVZIU.js +1 -0
  63. package/POS/chunk-BHXS5IA6.js +1 -0
  64. package/POS/chunk-BLZEDUEI.js +1 -0
  65. package/POS/chunk-BYXBJQAS.js +0 -0
  66. package/POS/chunk-BZC5JINN.js +5 -0
  67. package/POS/chunk-C43IYFVU.js +1 -0
  68. package/POS/chunk-CBW7IA6S.js +1 -0
  69. package/POS/chunk-CCGPOEE3.js +4 -0
  70. package/POS/chunk-CFIFFKWA.js +1 -0
  71. package/POS/chunk-CI45CZMG.js +1 -0
  72. package/POS/chunk-CJO25BBP.js +1 -0
  73. package/POS/chunk-CLL3TEL5.js +1 -0
  74. package/POS/chunk-CPUGWH3I.js +1 -0
  75. package/POS/chunk-CPW6IWAB.js +1 -0
  76. package/POS/chunk-CRSUSQ3W.js +1 -0
  77. package/POS/chunk-CW27R4N3.js +2 -0
  78. package/POS/chunk-CWU5DTSS.js +1 -0
  79. package/POS/chunk-CY2FQLP4.js +1 -0
  80. package/POS/chunk-DRGWLGRP.js +1 -0
  81. package/POS/chunk-DXF4M3Z6.js +1 -0
  82. package/POS/chunk-E72IOARD.js +1 -0
  83. package/POS/chunk-EA7CLJMQ.js +18 -0
  84. package/POS/chunk-ECMSF3OR.js +1 -0
  85. package/POS/chunk-EOFWQEK7.js +1 -0
  86. package/POS/chunk-EQOB7536.js +156 -0
  87. package/POS/chunk-ESD5O3BQ.js +1 -0
  88. package/POS/chunk-EZCHVNC5.js +3 -0
  89. package/POS/chunk-F3ZYFWTM.js +1 -0
  90. package/POS/chunk-F6GAPEFT.js +1 -0
  91. package/POS/chunk-FBR7TAEJ.js +5 -0
  92. package/POS/chunk-FE5LZK5I.js +1 -0
  93. package/POS/chunk-FOEYBSQT.js +2 -0
  94. package/POS/chunk-FWVI7M5F.js +1 -0
  95. package/POS/chunk-G4DDQBH4.js +1 -0
  96. package/POS/chunk-GDFWXFK2.js +1 -0
  97. package/POS/chunk-GHQFOULJ.js +2 -0
  98. package/POS/chunk-GNSQPTDB.js +1 -0
  99. package/POS/chunk-GSLPZSSX.js +1 -0
  100. package/POS/chunk-GVXSG66Q.js +1 -0
  101. package/POS/chunk-H55AJAX5.js +8 -0
  102. package/POS/chunk-HIRUHGYD.js +2 -0
  103. package/POS/chunk-HKR2C3HA.js +1 -0
  104. package/POS/chunk-HSOC6U4B.js +1 -0
  105. package/POS/chunk-I6CGSFEU.js +1 -0
  106. package/POS/chunk-I6YPWC52.js +1 -0
  107. package/POS/chunk-IDDHFZWG.js +1 -0
  108. package/POS/chunk-IE5R6YWY.js +1 -0
  109. package/POS/chunk-IOQ3OION.js +1 -0
  110. package/POS/chunk-IUKSWU5B.js +1 -0
  111. package/POS/chunk-IY6EDHBT.js +1 -0
  112. package/POS/chunk-IZGPRDGN.js +2 -0
  113. package/POS/chunk-J3W6DQKW.js +1 -0
  114. package/POS/chunk-JLWKTGB2.js +1 -0
  115. package/POS/chunk-JM3SJLS7.js +1 -0
  116. package/POS/chunk-JNUC6PO5.js +1 -0
  117. package/POS/chunk-K5XVN3MT.js +1 -0
  118. package/POS/chunk-KBQ5ZM55.js +1 -0
  119. package/POS/chunk-KCNSCS4R.js +1 -0
  120. package/POS/chunk-KI2MQKDF.js +1 -0
  121. package/POS/chunk-KNRLGMUT.js +1 -0
  122. package/POS/chunk-KR4OPCRF.js +1 -0
  123. package/POS/chunk-KW4B7WMB.js +1 -0
  124. package/POS/chunk-KYX6U2UX.js +1 -0
  125. package/POS/chunk-KZNSGBGF.js +2 -0
  126. package/POS/chunk-L3UWNQXB.js +1 -0
  127. package/POS/chunk-LHWN2J4H.js +15 -0
  128. package/POS/chunk-LJUP6CCS.js +1 -0
  129. package/POS/chunk-LY4FOMQ6.css +1 -0
  130. package/POS/chunk-LZ3SKBTU.js +1 -0
  131. package/POS/chunk-M5ONTRWK.js +1 -0
  132. package/POS/chunk-MA7NEQCZ.js +1 -0
  133. package/POS/chunk-MDKYCLYA.js +17 -0
  134. package/POS/chunk-MGDA6GY6.js +1 -0
  135. package/POS/chunk-MWWGZRMN.js +1 -0
  136. package/POS/chunk-NCATMO6T.js +1 -0
  137. package/POS/chunk-NDAI7L23.js +1 -0
  138. package/POS/chunk-NHUK6IK5.js +40 -0
  139. package/POS/chunk-NUZ5K7GT.js +1 -0
  140. package/POS/chunk-O2PELRQA.js +1 -0
  141. package/POS/chunk-OUOP65JB.js +1 -0
  142. package/POS/chunk-OXSD6KML.js +1 -0
  143. package/POS/chunk-PEOMRJUI.js +3 -0
  144. package/POS/chunk-PHGK3EAU.js +1 -0
  145. package/POS/chunk-PLC4GZ67.js +1 -0
  146. package/POS/chunk-PTF6AQY6.js +1 -0
  147. package/POS/chunk-PTXKBWBA.js +1 -0
  148. package/POS/chunk-Q3SJOSAG.js +1 -0
  149. package/POS/chunk-QBDEGNJP.js +1 -0
  150. package/POS/chunk-QCTMAR3L.js +1 -0
  151. package/POS/chunk-QZWOQRAM.js +1 -0
  152. package/POS/chunk-R5VG3XDC.js +1 -0
  153. package/POS/chunk-R7NR3M2Q.js +1 -0
  154. package/POS/chunk-RBKYZOZX.js +3 -0
  155. package/POS/chunk-RHQGCHFI.js +1 -0
  156. package/POS/chunk-RL3GYZVU.js +8 -0
  157. package/POS/chunk-RRKCUSBB.js +1 -0
  158. package/POS/chunk-S4OLP2TR.js +18 -0
  159. package/POS/chunk-SDH32O74.js +1 -0
  160. package/POS/chunk-SE7OFLAL.js +1 -0
  161. package/POS/chunk-SEVYM4GA.js +1 -0
  162. package/POS/chunk-SGRJ5YG2.js +1 -0
  163. package/POS/chunk-SNNLFZQ3.js +3 -0
  164. package/POS/chunk-SVNOJVQF.js +1 -0
  165. package/POS/chunk-TCLYGBIP.js +1 -0
  166. package/POS/chunk-TIDDF777.js +1 -0
  167. package/POS/chunk-TJQIORGG.js +1 -0
  168. package/POS/chunk-TK5H65DN.js +1 -0
  169. package/POS/chunk-TLHNFDPP.js +1 -0
  170. package/POS/chunk-TVNDX4KA.js +3 -0
  171. package/POS/chunk-TX6G2LAN.js +1 -0
  172. package/POS/chunk-U3O6FO5X.js +1 -0
  173. package/POS/chunk-UJMXJABS.js +1 -0
  174. package/POS/chunk-UNGT7KQO.js +1 -0
  175. package/POS/chunk-UPRH3DLS.js +1 -0
  176. package/POS/chunk-UVFDCVT4.js +2 -0
  177. package/POS/chunk-V22EVF6N.js +1 -0
  178. package/POS/chunk-V4RKZMUB.js +11 -0
  179. package/POS/chunk-VBOV2ZGQ.js +1 -0
  180. package/POS/chunk-VGGNSOCP.js +1 -0
  181. package/POS/chunk-VLGOEX3D.js +24 -0
  182. package/POS/chunk-VPAQFQA7.js +1 -0
  183. package/POS/chunk-VSMYP4AC.js +1 -0
  184. package/POS/chunk-VXCP4DBC.js +1 -0
  185. package/POS/chunk-W43P2XHR.js +1 -0
  186. package/POS/chunk-W7PIRMKD.js +1 -0
  187. package/POS/chunk-WG6PV6VL.js +4 -0
  188. package/POS/chunk-WK4T26FX.js +2 -0
  189. package/POS/chunk-WKS7JIOA.js +1 -0
  190. package/POS/chunk-WKXE4B24.js +1 -0
  191. package/POS/chunk-WLRXTHLM.js +1 -0
  192. package/POS/chunk-WSZGVB3P.js +1 -0
  193. package/POS/chunk-WXHOQKTU.js +1 -0
  194. package/POS/chunk-X55EKFUZ.js +1 -0
  195. package/POS/chunk-X7QMXCEW.js +4 -0
  196. package/POS/chunk-XIGLLWLV.js +1 -0
  197. package/POS/chunk-XRKZOON6.js +4 -0
  198. package/POS/chunk-XW2QKXZF.js +5 -0
  199. package/POS/chunk-XZPCPUT7.js +1 -0
  200. package/POS/chunk-Y5SPDICN.js +2 -0
  201. package/POS/chunk-Y7XBMFXR.js +1 -0
  202. package/POS/chunk-YATUCULL.js +1 -0
  203. package/POS/chunk-YBFOOZH4.js +2 -0
  204. package/POS/chunk-YBINYTS7.js +1 -0
  205. package/POS/chunk-YE2HNBMX.js +1 -0
  206. package/POS/chunk-YENHZRM5.js +9 -0
  207. package/POS/chunk-YHCFOJEX.js +1 -0
  208. package/POS/chunk-YKBQYDEJ.js +2 -0
  209. package/POS/chunk-YPFXYXHP.js +8 -0
  210. package/POS/chunk-YRHYSRBM.js +1 -0
  211. package/POS/chunk-YRITVFOW.js +1 -0
  212. package/POS/chunk-YRNTUREW.js +1 -0
  213. package/POS/chunk-YXRRTX7W.js +1 -0
  214. package/POS/chunk-Z426RGUL.js +24 -0
  215. package/POS/chunk-ZB45Y55B.js +1 -0
  216. package/POS/chunk-ZGRVB4IB.js +1 -0
  217. package/POS/chunk-ZJ3TX62Q.js +1 -0
  218. package/POS/chunk-ZKWXTWYY.js +1 -0
  219. package/POS/index.html +33 -0
  220. package/POS/main-CNMNNNEI.js +4 -0
  221. package/POS/main-VPAR6OBK.css +1 -0
  222. package/POS/manifest.webmanifest +59 -0
  223. package/POS/media/color-727V6BA6.png +0 -0
  224. package/POS/media/hue-3YTJE6JS.png +0 -0
  225. package/POS/media/primeicons-4GST5W3O.woff2 +0 -0
  226. package/POS/media/primeicons-DHQU4SEP.svg +345 -0
  227. package/POS/media/primeicons-GEFHGEHP.ttf +0 -0
  228. package/POS/media/primeicons-P53SE5CV.woff +0 -0
  229. package/POS/media/primeicons-RSSEDYLY.eot +0 -0
  230. package/POS/polyfills-FHOOFFEX.js +2 -0
  231. package/POS/scripts-3E2G6IZ4.js +10 -0
  232. package/POS/styles-T7FPZRNG.css +25 -0
  233. package/Styles/Master/app_custom.css +18 -0
  234. package/Styles/Master/login_custom.css +0 -0
  235. package/Styles/Print/PaperSize8cm_custom.css +1 -0
  236. package/Styles/Print/PaperSizeA4_custom.css +1 -0
  237. package/StylesB/Master/app_custom.css +0 -0
  238. package/package.json +1 -0
@@ -0,0 +1,24 @@
1
+ import{a as ji}from"./chunk-UJMXJABS.js";import{a as Li,c as Qi}from"./chunk-6S4Q5VRA.js";import{a as ki,b as Vi,c as Ri,d as $i,e as Bi,f as je}from"./chunk-F3ZYFWTM.js";import{a as Ht}from"./chunk-65YDOCXF.js";import"./chunk-GHQFOULJ.js";import{a as Fi}from"./chunk-AYKDALBT.js";import{a as Qt}from"./chunk-OUOP65JB.js";import{a as hi}from"./chunk-LJUP6CCS.js";import{a as xn}from"./chunk-KYX6U2UX.js";import{c as Mi,d as Pi}from"./chunk-MGDA6GY6.js";import"./chunk-ECMSF3OR.js";import{a as Ei}from"./chunk-4UAHOTBD.js";import{a as Ni}from"./chunk-WXHOQKTU.js";import"./chunk-6BQZINLH.js";import"./chunk-SE7OFLAL.js";import"./chunk-KNRLGMUT.js";import"./chunk-WLRXTHLM.js";import{a as Ut,b as Si,c as Ii}from"./chunk-YENHZRM5.js";import"./chunk-LZ3SKBTU.js";import{a as Tt}from"./chunk-5W7F4VJH.js";import"./chunk-GVXSG66Q.js";import{b as _i}from"./chunk-33XCA4ER.js";import"./chunk-VSMYP4AC.js";import"./chunk-IE5R6YWY.js";import{d as bi,e as Lt}from"./chunk-XW2QKXZF.js";import{b as Ai}from"./chunk-YKBQYDEJ.js";import{a as Oi,b as Ti,c as wi}from"./chunk-XIGLLWLV.js";import"./chunk-G4DDQBH4.js";import{a as ai}from"./chunk-ZJ3TX62Q.js";import{b as Di}from"./chunk-CLL3TEL5.js";import{a as Wt,b as Jt}from"./chunk-VXCP4DBC.js";import"./chunk-EZCHVNC5.js";import{e as _t}from"./chunk-7DWKYGA4.js";import"./chunk-64PDX5ZX.js";import{a as xi}from"./chunk-AOJW6WJT.js";import"./chunk-BYXBJQAS.js";import"./chunk-CJO25BBP.js";import"./chunk-Z426RGUL.js";import"./chunk-Q3SJOSAG.js";import{a as ri,b as li,c as si}from"./chunk-QZWOQRAM.js";import"./chunk-KI2MQKDF.js";import{a as jt}from"./chunk-ZGRVB4IB.js";import{a as ci,c as pi,e as mi,g as di}from"./chunk-I6YPWC52.js";import{a as at,b as rt}from"./chunk-FBR7TAEJ.js";import{a as ui,b as fi}from"./chunk-CBW7IA6S.js";import"./chunk-VPAQFQA7.js";import{a as ii}from"./chunk-AOPKPEVH.js";import{K as Be,O as vi,i as ee,k as Oe,l as $e,m as ie,n as Bt,o as Te,p as we,q as Ee,r as gi,t as yi,u as Ci}from"./chunk-V4RKZMUB.js";import{Aa as vt,Ba as bt,ua as oi}from"./chunk-2FKYC63K.js";import"./chunk-2W3MAOOP.js";import{a as zn,b as Yn,c as Xn}from"./chunk-DXF4M3Z6.js";import{e as ht,f as Dt}from"./chunk-WK4T26FX.js";import"./chunk-BCVO66L3.js";import"./chunk-LHWN2J4H.js";import{a as Ne}from"./chunk-2FWFPV5I.js";import{B as ti,C as Pe,D as qe,a as Ge,b as Zn,c as De,h as se,l as me,n as Me,q as ei,r as Ke}from"./chunk-4G26RHGA.js";import{a as ni}from"./chunk-MA7NEQCZ.js";import{a as O,d as xe}from"./chunk-26YXEYJK.js";import"./chunk-WG6PV6VL.js";import{a as ce}from"./chunk-RRKCUSBB.js";import{$a as Bn,$b as L,$c as Re,Ab as a,Bb as S,Cb as U,D as tt,Db as W,E as R,Fb as B,H as Nn,I as he,Ia as _n,Ib as b,Jc as Jn,Kb as d,L as Fn,Ld as Kn,M as bn,Nb as hn,Nd as qn,Od as Rt,P as An,Pa as Rn,Pc as it,Qa as nt,Qd as $t,Rc as He,S as kn,Sb as Nt,Sc as pe,Sd as ot,Ta as $n,Tb as Ft,U as Ot,Ua as l,Ub as At,Va as f,W as te,Wb as Un,Xb as Wn,Xc as Ve,Yb as ue,Z as pt,Zb as m,Zc as Hn,_ as ne,_b as Z,aa as Vn,ac as Je,bb as mt,cb as jn,cc as J,cd as A,d as _e,da as E,dc as Q,e as Xe,ea as de,eb as Ln,ec as H,f as Tn,fc as ke,gb as I,gc as F,ha as ae,hc as kt,ic as re,jc as Vt,jd as Gn,k as Ae,ka as K,la as Ce,mb as c,n as wn,o as Ze,ob as Ct,p as En,pa as N,qb as Qn,qc as g,rc as y,sc as Dn,t as u,u as Ie,ub as dt,v as vn,wa as D,wc as ve,xa as x,y as ct,zb as r}from"./chunk-H55AJAX5.js";import{a as T,b as $,d as On,j as yt}from"./chunk-KW4B7WMB.js";var q=class i{constructor(t,e){this.http=e;this.buyForm=t.group({NewOrderID:[""],Order:t.group({Att:[""],SupplierID:[""],Number:[""],Date:[new Date],ID:[O.GuidEmpty]}),Invoice:t.group({ID:[O.GuidEmpty],Due:[new Date],Tax:[0]}),Payment:t.group({Amount:[0],MethodID:[0],Code:[""],Note:[""]})})}outlet=new me({ID:"",Name:"Choose an Outlet"});dueDays=new me(0);deliveryEntityID=new me(O.GuidEmpty);noteForm=new me({Note:"",TagID:"",Currency:{ID:"",ExchangeRate:0,Symbol:""},InvoiceNumber:""});discountAndTaxForm=new me({Discount:{Amount:0,Percentage:0},Tax:{ID:"",CalculationTypeName:"",Rate:0,Label:"",Discontinue:!1}});buyForm;setPONumber(t){let e="";if(t.Seed){let n=t.Seed+"";for(;n.length<t.Digit;)n="0"+n;e=O.StringFormat(t.Prefix,n)}this.buyForm.controls.Order.controls.Number.setValue(e)}setDueDateBasedOnDaysDue(t){let e=this.invoiceDate,n=new Date(O.cloneObject(e));n.setDate(n.getDate()+t),this.buyForm.controls.Invoice.controls.Due.setValue(n)}get dueDate(){return this.buyForm.controls.Invoice.controls.Due.value}get invoiceDate(){return this.buyForm.controls.Order.controls.Date.value}setAmount(t){this.buyForm.controls.Payment.controls.Amount.setValue(t)}setPaymentMethodID(t){this.buyForm.controls.Payment.controls.MethodID.setValue(t)}setTaxAmount(t){this.buyForm.controls.Invoice.controls.Tax.setValue(t)}setNewOrderID(t){this.buyForm.controls.NewOrderID.setValue(t)}setTax(t){let e=T({},this.discountAndTaxForm.value.Discount);this.discountAndTaxForm.setValue({Discount:e,Tax:t})}setCurrency(t){let e=this.noteForm.value;this.noteForm.setValue($(T({},e),{Currency:t}))}setDeliveryEntityID(t){this.deliveryEntityID.setValue(t)}setdueDays(t){this.dueDays.setValue(t)}setBulkOrderForm(t){this.buyForm.controls.Order.setValue(t)}setBulkNoteForm(t){this.noteForm.setValue(t)}setBulkDiscountAndTaxForm(t){this.discountAndTaxForm.setValue(t)}setOutletForm(t){this.outlet.setValue(t)}setBulkInvoice(t){this.buyForm.controls.Invoice.setValue(t)}setBulkPayment(t){this.buyForm.controls.Payment.setValue(t)}resetOutletForm(){this.outlet.setValue({ID:"",Name:"Choose an Outlet"})}resetDueDaysForm(){this.dueDays.setValue(0)}resetDeliveryEntityID(){this.deliveryEntityID.setValue(O.GuidEmpty)}resetNoteForm(){this.noteForm.setValue($(T({},this.noteForm.value),{Note:"",TagID:"",InvoiceNumber:""}))}resetDiscountAndTaxForm(){let t=this.discountAndTaxForm.value;this.discountAndTaxForm.setValue($(T({},t),{Discount:{Amount:0,Percentage:0}}))}resetBuyForm(){this.buyForm.reset(),this.buyForm.controls.Invoice.controls.ID.setValue(O.GuidEmpty),this.buyForm.controls.Invoice.controls.Due.setValue(new Date),this.buyForm.controls.Order.controls.Date.setValue(new Date),this.buyForm.controls.Order.controls.ID.setValue(O.GuidEmpty),this.generateNumberOnNewTransaction()}generateNumberOnNewTransaction(){this.http.post("/API/Buy/GenerateNumber",{ID:this.outlet.value.ID}).subscribe(t=>{this.setNewOrderID(O.Guid_NewGuid()),this.buyForm.controls.Order.controls.Number.setValue(t.Number)})}static \u0275fac=function(e){return new(e||i)(K(ti),K(ce))};static \u0275prov=ae({token:i,factory:i.\u0275fac,providedIn:"root"})};var ge=class i{entities$;appConfigJSON$;taxes$;currencies$;supplierPOTypes$;predefinedNotes$;denomination$;defaultDueDays$;constructor(t,e){let n=t.get("/API/Buy2/Load").pipe(E(o=>e.setCurrency(o.Currencies.find(s=>s.ID==o.AppConfigJSON.CoreDefaults.CurrencyID))),te(1));this.denomination$=n.pipe(u(o=>o.Denomination)),this.entities$=n.pipe(u(o=>o.Entities)),this.appConfigJSON$=n.pipe(u(o=>o.AppConfigJSON)),this.taxes$=n.pipe(u(o=>o.Taxes),te(1)),this.currencies$=n.pipe(u(o=>o.Currencies),te(1)),this.supplierPOTypes$=n.pipe(u(o=>o.SupplierPOTypes)),this.predefinedNotes$=n.pipe(u(o=>o.PredefinedNotes)),this.defaultDueDays$=n.pipe(u(o=>o.AppConfigJSON.ModuleBuy.PaymentDialog.DefaultDueDays),E(o=>e.setdueDays(o)),E(o=>e.setDueDateBasedOnDaysDue(o)))}updateDueDays(){this.defaultDueDays$.subscribe()}static \u0275fac=function(e){return new(e||i)(K(ce),K(q))};static \u0275prov=ae({token:i,factory:i.\u0275fac,providedIn:"root"})};var lt=class i{returnInvoiceNumber=new me("");invoiceInfo$;constructor(t,e,n){let o=e.outlet.valueChanges.pipe(u(p=>p.ID),ee());this.invoiceInfo$=this.returnInvoiceNumber.valueChanges.pipe(R(p=>!!p),de(o),ne(([p,M])=>t.post("/API/Buy/GetSupplierInvoiceRetur2",{EntityID:M,Number:p}).pipe(he(()=>Ae))),te(1),ee());let s=this.invoiceInfo$.pipe(u(p=>T({},p.Order)),E(p=>{let M={Att:p.Att,SupplierID:{Key:p.SupplierID,Value:p.SupplierName,OnSet:!0},Date:new Date,Number:e.buyForm.controls.Order.controls.Number.value,ID:O.GuidEmpty};e.setBulkOrderForm(M)}),ee()),P=this.invoiceInfo$.pipe(u(p=>p.Order),E(p=>{let M={Note:`Return #${p.Number}`,TagID:p.TypeID,Currency:{ID:p.CurrencyID,ExchangeRate:p.CurrencyRate,Symbol:p.CurrencySymbol??"$"},InvoiceNumber:p.Number};e.setBulkNoteForm(M)}),ee()),_=this.invoiceInfo$.pipe(u(p=>p.Order),de(n.taxes$),u(([p,M])=>$(T({},p),{Tax:M.find(G=>G.ID===p.TaxTypeID)})),E(p=>{let M={Discount:{Amount:p.DiscountAmount,Percentage:p.Discount},Tax:{ID:p.TaxTypeID,Rate:p.Tax?.Rate,CalculationTypeName:p.Tax?.CalculationTypeName,Label:p.Tax?.Label,Discontinue:!p.Tax?.Label}};e.setBulkDiscountAndTaxForm(M)}),ee()),j=this.invoiceInfo$.pipe(u(p=>p.DeliveryEntityID),E(p=>e.setDeliveryEntityID(p)),ee()),z=this.invoiceInfo$.pipe(u(p=>p.Invoice),E(p=>{let M={ID:p.ID,Due:p.Due,Tax:p.Tax};e.setBulkInvoice(M)}),ee()),h=this.invoiceInfo$.pipe(u(p=>p.Payment),E(p=>{let M={Amount:p.Amount,MethodID:p.MethodID,Note:p.Note,Code:p.Code};e.setBulkPayment(M)}),ee());Ie(s,P,_,j,z,h).pipe(ee()).subscribe()}static \u0275fac=function(e){return new(e||i)(K(ce),K(q),K(ge))};static \u0275prov=ae({token:i,factory:i.\u0275fac,providedIn:"root"})};var oe=class i{constructor(t,e,n,o){this.matDialog=o;let s=e.outlet.valueChanges.pipe(u(p=>p.ID));this.addVariantThroughSerial$=this._addVariantThroughSerial.asObservable().pipe(de(s),ne(([p,M])=>t.get(Be.GetVariantBySerial,[{key:"Serial",value:p},{key:"EntityID",value:M}]).pipe(he(()=>Ae))),u(p=>this.setUnitPrice(p)),u(p=>$(T({},p),{Quantity:1,Total:p.UnitPrice,VariantID:p.ID})),u(p=>({action:"addAsSerial",variant:p})));let P=this.variantAutocomplete.valueChanges.pipe(R(p=>O.IsNotEmpty(p)&&p.type=="Code"),u(p=>p.str),de(s),ne(([p,M])=>t.get(Be.GetVariantByCode,[{key:"Code",value:p},{key:"EntityID",value:M},{key:"Promotion",value:!0}]).pipe(he(()=>Ae))),u(p=>this.setUnitPrice(p)),u(p=>$(T({},p),{Quantity:1,Total:p.UnitPrice*((100-p.PriceDiscount)/100),Discount:p.PriceDiscount,VariantID:p.ID}))),_=this.variantAutocomplete.valueChanges.pipe(R(p=>O.IsNotEmpty(p)&&p.type=="ID"),u(p=>p.str)),j=this.variantQuickKey.valueChanges,z=tt(_,j).pipe(de(s),ne(([p,M])=>t.get(Be.GetVariantByID,[{key:"ID",value:p},{key:"EntityID",value:M}]).pipe(he(()=>Ae))),u(p=>this.setUnitPrice(p)),u(p=>$(T({},p),{Quantity:1,Total:p.UnitPrice*((100-p.OrderPriceDiscount)/100),Discount:p.OrderPriceDiscount,VariantID:p.ID}))),h=tt(z,P).pipe(u(p=>({action:"add",variant:p})),E(()=>{this.cartDisplayRef&&setTimeout(()=>{let p=this.cartDisplayRef.nativeElement.scrollHeight;this.cartDisplayRef.nativeElement.scrollTop=p},1)})),k=n.invoiceInfo$.pipe(u(p=>({action:"returnInvoice",variants:p.Items.map(M=>$(T({},M.Variant),{Quantity:M.Quantity,Total:M.Total,UnitPrice:M.UnitPrice,Discount:M.Discount,Serial:M.Serial,ID:M.ID,DiscountAmount:M.DiscountAmount,VariantID:M.VariantID,UnitQuantity:M.UnitQuantity}))})));this.cart$=tt(h,k,this.deleteVariant$,this.dragDropCart$,this.returnCart$,this.updateVariant$,this.returnVariant$,this.purchaseVariant$,this.clearCart$,this.onEditForm$,this.addVariantThroughSerial$,this.addVariant$,this.onUploadCart$,this.listenRFID$).pipe(Ot((p,M)=>{let G=[...p],X=[],C=M.action;if(C=="add"){let v=M.variant;X=!!G.find(V=>V.VariantID==v.ID)?G.map(V=>V.VariantID==v.ID?$(T({},V),{Quantity:V.Quantity+1,Total:V.Total+V.UnitPrice}):V):[...G,v]}else if(C=="returnInvoice"||C=="onEditForm")X=M.variants;else if(C=="delete"){let v=M.index;X=G.filter((w,V)=>V!=v)}else if(C=="sort"){let v=M.ev;X=G,ci(X,v.previousIndex,v.currentIndex)}else if(C=="returnCart")X=G.map(v=>$(T({},v),{Quantity:-Math.abs(v.Quantity),Total:-Math.abs(v.Total)}));else if(C=="update"){let v=M.index;X=G.map((w,V)=>V==v?M.variant:w)}else if(C=="returnVariant"){let v=M.index;X=G.map((w,V)=>V==v?$(T({},w),{Quantity:-Math.abs(w.Quantity),Total:-Math.abs(w.Total)}):w)}else if(C=="purchaseVariant"){let v=M.index;X=G.map((w,V)=>V==v?$(T({},w),{Quantity:Math.abs(w.Quantity),Total:Math.abs(w.Total)}):w)}else if(C=="clearCart")X=[];else if(C=="addAsSerial"){let v=$(T({},M.variant),{Serial:[{Number:M.variant.Serial.Number,Quantity:1,ExpiryDate:M.variant.Serial.ExpiryDate}]});if(!!G.find(V=>V.ID==v.ID)){let V=v.Serial[0],be=G.find(fe=>fe.ID==v.ID),Et=!!be.Serial.find(fe=>fe.Number==V.Number)?[...be.Serial].map(fe=>fe.Number==V.Number?$(T({},fe),{Quantity:fe.Quantity+1}):fe):[...be.Serial,V];X=G.map(fe=>fe.ID==v.ID?$(T({},fe),{Quantity:fe.Quantity+1,Total:fe.Total+fe.UnitPrice,Serial:Et}):fe)}else X=[...G,$(T({},v),{Quantity:1,Total:v.UnitPrice})]}else if(C=="uploadCart")X=[...G,...M.variants];else if(C=="addNewRow"){let v=M.variant;X=[...G,v]}else if(C=="rfid"){let v=M.variants;Object.keys(v).forEach(w=>{if(v.hasOwnProperty(w)){let V=v[w];if(V&&Object.keys(V.variant).length>0){let be=G.findIndex(gt=>gt.Code.toLowerCase()===w.toLowerCase());if(be!==-1){let gt=Number(V.count);G[be].Quantity+=gt,G[be].Total=+G[be].UnitPrice*+G[be].Quantity,delete v[w],X=[...G]}else{let gt=V.variant,Et=Number(V.count),fe=this.setUnitPrice(gt),zi=this.formatItemObject($(T({},fe),{Quantity:Et,Total:+fe.UnitPrice*+Et}));delete v[w],X=[...G,zi]}}}})}return X},[]),pt([]),te(1)),this.totalVariantOrdered$=this.cart$.pipe(u(p=>p.map(M=>M.Quantity)),u(p=>p.reduce((M,G)=>M+G,0)),pt(0))}cartDisplayRef;variantAutocomplete=new me;variantQuickKey=new me;_listenRFID=new _e;listenRFID$=this._listenRFID.asObservable().pipe(u(t=>({action:"rfid",variants:t})));_deleteVariant=new _e;deleteVariant$=this._deleteVariant.asObservable().pipe(u(t=>({action:"delete",index:t})));_dragDropCart=new _e;dragDropCart$=this._dragDropCart.asObservable().pipe(u(t=>({action:"sort",ev:t})));_returnCart=new _e;returnCart$=this._returnCart.asObservable().pipe(u(()=>({action:"returnCart"})));_onEditForm=new Xe(null);onEditForm$=this._onEditForm.asObservable().pipe(R(t=>!!t),u(t=>({action:"onEditForm",variants:t})));_clearCart=new _e;clearCart$=this._clearCart.asObservable().pipe(u(()=>({action:"clearCart"})));_updateVariant=new _e;updateVariant$=this._updateVariant.asObservable().pipe(u(t=>({action:"update",variant:t.variant,index:t.index})));_returnVariant=new _e;returnVariant$=this._returnVariant.asObservable().pipe(u(t=>({action:"returnVariant",index:t})));_purchaseVariant=new _e;purchaseVariant$=this._purchaseVariant.asObservable().pipe(u(t=>({action:"purchaseVariant",index:t})));_addVariant=new _e;addVariant$=this._addVariant.asObservable().pipe(u(t=>({action:"addNewRow",variant:t})));_onUploadCart=new _e;onUploadCart$=this._onUploadCart.asObservable().pipe(u(t=>({action:"uploadCart",variants:t})));cart$;totalVariantOrdered$;_addVariantThroughSerial=new _e;addVariantThroughSerial$;deleteVariant(t){this._deleteVariant.next(t)}dragDropCart(t){this._dragDropCart.next(t)}returnCart(){this._returnCart.next()}updateVariant(t,e){this._updateVariant.next({variant:t,index:e})}returnVariant(t){this._returnVariant.next(t)}purchaseVariant(t){this._purchaseVariant.next(t)}clearCart(){this._clearCart.next()}editForm(t){this._onEditForm.next(t)}addVariant(t){this._addVariant.next(t)}addVariantThroughSerial(t){this._addVariantThroughSerial.next(t)}uploadCart(t){this._onUploadCart.next(t)}setUnitPrice(t){let e=T({},t);return O.IsNotEmpty(t.OrderPrice)?e.UnitPrice=t.OrderPrice:e.UnitPrice=t.UnitCost,e}formatItemObject=t=>{let o=t,{ID:e}=o,n=On(o,["ID"]);return $(T({},n),{Quantity:n.Quantity??1,Total:n.Total??n.UnitPrice,VariantID:e})};addCartRFID(t){this._listenRFID.next(t)}static \u0275fac=function(e){return new(e||i)(K(ce),K(q),K(lt),K(ie))};static \u0275prov=ae({token:i,factory:i.\u0275fac,providedIn:"root"})};var Le=class i{_isEdit=new _e;isEdit$;id$;isUnpaid$;dialog=Ce(ie);constructor(t,e,n,o,s){let P=Ze(t.snapshot.queryParams);this.isEdit$=tt(P.pipe(u(C=>!!C.ID)),this._isEdit.asObservable()).pipe(te(1)),this.id$=P.pipe(R(C=>C.ID),u(C=>C.ID));let _=this.id$.pipe(ne(C=>e.post("/api/Buy2/GetDataByID2",{ID:C})),te(1)),j=ct(()=>o.entities$).pipe(ne(C=>_.pipe(u(v=>[v.Order,C]))),E(([C,v])=>{let w={Att:C.Att,SupplierID:{Key:C.SupplierID,Value:C.SupplierName,OnSet:!0},Date:C.Date,Number:C.Number,ID:C.ID};n.setBulkOrderForm(w)}),E(([C,v])=>{let w=v.find(V=>V.ID==C.EntityID);n.setOutletForm(w)})),z=_.pipe(u(C=>C.Items),u(C=>C.map(v=>$(T({},v.Variant),{Quantity:v.Quantity,Total:v.Total,Note:v.Note,UnitPrice:v.UnitPrice,Discount:v.Discount,Serial:v.Serial,ID:v.ID,VariantID:v.VariantID,UnitQuantity:v.UnitQuantity,QtyRequested:v.QtyRequested,DiscountAmount:v.DiscountAmount}))),E(C=>s.editForm(C))),h=ct(()=>o.currencies$).pipe(ne(C=>_.pipe(u(v=>[v.Order,C,v.Invoice]))),u(([C,v,w])=>$(T({},C),{Number:C.Number!=w.Number?w.Number:C.Number,Currency:v.find(V=>V.ID===C.CurrencyID)})),E(C=>{let v={Note:C.Note,TagID:C.TypeID,Currency:T({},C.Currency),InvoiceNumber:C.Number};n.setBulkNoteForm(v)})),k=_.pipe(u(C=>C.DeliveryEntityID),E(C=>n.setDeliveryEntityID(C))),p=ct(()=>o.taxes$).pipe(ne(C=>_.pipe(u(v=>[v.Order,C]))),u(([C,v])=>$(T({},C),{Taxes:v})),E(C=>{let v=C.Taxes.find(V=>V.ID===C.TaxTypeID);v?.Bin&&this.dialog.open(Ut,{id:"ModalInfo",data:{title:"Default Tax Discontinued",message:`
2
+ <div class="d-flex justify-content-center my-4">
3
+ <img class="img-2x" src="https://res.cloudinary.com/pos/image/upload/v1705387550/POS/Images/Cashier/globalerror.svg"
4
+ alt="Empty Sales Order Tag" />
5
+ </div>
6
+ <h4 class="text-center mb-4">
7
+ Your Default Tax for this outlet has been discontinued!
8
+ </h4>
9
+ <p class="text-center">
10
+ Please change the default tax or re-activate the tax <a href="/menu/Setup/Payment/Tax">here</a>.
11
+ </p>
12
+ `,headerType:Ne.Error},width:"31rem"}),(O.IsEmpty(v)||v?.Bin)&&(v=C.Taxes[0],C.TaxTypeID=v.ID);let w={Discount:{Amount:C.DiscountAmount,Percentage:C.Discount},Tax:{ID:C.TaxTypeID,Rate:v?.Rate,CalculationTypeName:v?.CalculationTypeName,Label:v?.Label??v?.Name,Discontinue:v?.Bin}};n.setBulkDiscountAndTaxForm(w)})),M=_.pipe(u(C=>C.Invoice),E(C=>{let v={ID:C.ID,Due:C.Due,Tax:C.Tax};n.setBulkInvoice(v)})),G=_.pipe(u(C=>C.Payment),E(C=>{let v={Amount:C?.Amount,MethodID:C?.MethodID,Note:C?.Note,Code:C?.Code};v.Amount!==void 0&&n.setBulkPayment(v)}));this.isUnpaid$=G.pipe(u(C=>O.IsEmpty(C))),Ie(j,z,h,k,p,M,G).subscribe()}onNewPurchase(){this._isEdit.next(!1)}static \u0275fac=function(e){return new(e||i)(K(Kn),K(ce),K(q),K(ge),K(oe))};static \u0275prov=ae({token:i,factory:i.\u0275fac,providedIn:"root"})};var Qe=class i{edit=Ce(Le);_paymentComplete=new _e;paymentComplete$=this._paymentComplete.asObservable().pipe(te(1));_createNewTransaction=new Xe(!1);createNewTransaction$=this._createNewTransaction.asObservable();constructor(){}paymentComplete(t){this._paymentComplete.next(t)}createNewTransaction(){this._createNewTransaction.next(!0),this.edit.onNewPurchase()}static \u0275fac=function(e){return new(e||i)};static \u0275prov=ae({token:i,factory:i.\u0275fac,providedIn:"root"})};var ze=class i{quickKeyPack$;cardPayments$;cashPayments$;otherPayments$;updateDefaultTax$;isCashSuspended$;updatePaymentMethodID$;dialog=Ce(ie);constructor(t,e,n,o,s){let P=e.outlet.valueChanges.pipe(u(h=>h?.ID),ee()),_=P.pipe(An(),R(h=>!!h),de(n.isEdit$),ne(([h,k])=>t.get("/API/Buy2/GetOutletInfo",[{key:"EntityID",value:h},{key:"IsEdit",value:k}])),te(1),ee()),j=_.pipe(de(n.isEdit$),R(([h,k])=>!k),u(([h,k])=>h),E(h=>e.setPONumber(h.NumberElement)),ee());this.quickKeyPack$=_.pipe(u(h=>h.QuickKeyPack),ee()),this.updateDefaultTax$=ct(()=>o.taxes$).pipe(ne(h=>_.pipe(u(k=>[h,k]))),de(n.isEdit$),R(([[h,k],p])=>!p),u(([[h,k],p])=>[h,k]),E(([h,k])=>{let p=h.find(M=>M.ID==k.DefaultTaxType);p?.Bin&&this.dialog.open(Ut,{id:"ModalInfo",data:{title:"Default Tax Discontinued",message:`
13
+ <div class="d-flex justify-content-center my-4">
14
+ <img class="img-2x" src="https://res.cloudinary.com/pos/image/upload/v1705387550/POS/Images/Cashier/globalerror.svg"
15
+ alt="Empty Sales Order Tag" />
16
+ </div>
17
+ <h4 class="text-center mb-4">
18
+ Your Default Tax for this outlet has been discontinued!
19
+ </h4>
20
+ <p class="text-center">
21
+ Please change the default tax or re-activate the tax <a href="/menu/Setup/Payment/Tax">here</a>.
22
+ </p>
23
+ `,headerType:Ne.Error},width:"31rem"}),(O.IsEmpty(p)||p.Bin)&&(p=h.find(M=>!M.Bin)),e.setTax(p)}),ee()),this.updatePaymentMethodID$=_.pipe(de(n.isEdit$),R(([h,k])=>!k),u(([h,k])=>h.Payments),u(h=>{let k=h.filter(p=>p.TypeID==1);return k.length?k:h.filter(p=>p.TypeID==2)}),E(h=>e.setPaymentMethodID(h[0].ID)),ee()),this.cashPayments$=_.pipe(u(h=>h.Payments),u(h=>h.filter(k=>k.TypeID==1)),ee()),this.cardPayments$=_.pipe(u(h=>h.Payments),u(h=>h.filter(k=>k.TypeID==2)),ee()),this.otherPayments$=_.pipe(u(h=>h.Payments),u(h=>h.filter(k=>k.TypeID==4)),ee()),this.isCashSuspended$=_.pipe(u(h=>h.Payments),u(h=>!!h.filter(p=>p.TypeID==1).length),ee()),ct(()=>o.appConfigJSON$).pipe(de(n.isEdit$),R(([h,k])=>!k&&h.ModuleBuy.Shipping.BuyShippingDefault==0),ne(()=>Ie(P,s.createNewTransaction$)),E(([h,k])=>e.setDeliveryEntityID(h)),ee()).subscribe(),j.subscribe(),this.updateDefaultTax$.subscribe(),this.updatePaymentMethodID$.subscribe()}updateTax(){this.updateDefaultTax$.pipe(bn(1)).subscribe()}updatePaymentMethodID(){this.updatePaymentMethodID$.pipe(bn(1)).subscribe()}static \u0275fac=function(e){return new(e||i)(K(ce),K(q),K(Le),K(ge),K(Qe))};static \u0275prov=ae({token:i,factory:i.\u0275fac,providedIn:"root"})};function Xi(i,t){if(i&1&&(r(0,"mat-option",6),m(1),a()),i&2){let e=t.$implicit;c("value",e),l(),L(" ",e.Value," ")}}var Kt=class i{constructor(t,e,n){this.http=t;this.form=e;this.matDialog=n}supplierPOTypes;appConfigJSON;filteredSuppliers$;supplier=new me("");disabled=!1;onChange=t=>{};onTouched=()=>{};ngOnInit(){this.filteredSuppliers$=this.supplier.valueChanges.pipe(R(n=>typeof n=="string"&&n.length>=3),Fn(300),ne(n=>this.http.get("/API/AC/GetSupplierSuggestion",[{key:"count",value:100},{key:"prefix",value:n}]))),this.supplier.valueChanges.pipe(R(n=>typeof n!="string"),u(n=>n),E(n=>n?.Key!=O.GuidEmpty&&O.IsNotEmpty(n)?this.onChange(n.Key):this.onChange(null))).pipe(R(n=>O.IsNotEmpty(n)&&!n.OnSet),ne(n=>this.http.post("/API/Contact/GetSupplierDTO",{id:n.Key}).pipe(he(()=>Ae))),u(n=>n.DaysDue),R(n=>n!=0),E(n=>this.form.setdueDays(n)),E(n=>this.form.setDueDateBasedOnDaysDue(n))).subscribe()}writeValue(t){this.supplier.setValue(t)}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}displaySupplierNameFn(t){return t?.Value}openNewSupplierModal(){this.matDialog.open(Mi,{data:{options:this.supplierPOTypes,config:this.appConfigJSON.ModuleContact,type:"supplier",title:"New Supplier Form"}}).afterClosed().pipe(R(t=>O.IsNotEmpty(t.supplier.Name)),ne(t=>{let e={contact:t.supplier,type:"supplier",groups:t.supplier.Group?t.supplier.Group:[]};return this.http.post("/API/Contact/Supplier/Create",e).pipe(u(n=>({Key:n.ID,Value:t.supplier.Name})))})).subscribe(t=>{this.writeValue(t),this.onChange(t.Key)})}static \u0275fac=function(e){return new(e||i)(f(ce),f(q),f(ie))};static \u0275cmp=N({type:i,selectors:[["POS-supplier-autocomplete"]],inputs:{supplierPOTypes:"supplierPOTypes",appConfigJSON:"appConfigJSON"},standalone:!0,features:[ke([{provide:Ge,multi:!0,useExisting:i}]),F],decls:7,vars:6,consts:[["auto","matAutocomplete"],[1,"d-flex","align-items-center","position-relative"],["matTooltipPosition","above","matTooltip","New Supplier Form",1,"fa-light","fa-user-plus","position-absolute",2,"font-size","12px",3,"click"],["type","text","placeholder","Assign Supplier",3,"formControl","matAutocomplete"],[3,"displayWith"],[3,"value",4,"ngFor","ngForOf"],[3,"value"]],template:function(e,n){if(e&1){let o=B();r(0,"div",1)(1,"i",2),b("click",function(){return D(o),x(n.openNewSupplierModal())}),a(),S(2,"input",3),r(3,"mat-autocomplete",4,0),I(5,Xi,2,2,"mat-option",5),g(6,"async"),a()()}if(e&2){let o=ue(4);l(2),c("formControl",n.supplier)("matAutocomplete",o),l(),c("displayWith",n.displaySupplierNameFn),l(2),c("ngForOf",y(6,4,n.filteredSuppliers$))}},dependencies:[A,He,Ve,Ci,gi,oi,yi,qe,De,se,Ke,bt,vt,Pi],styles:["input[_ngcontent-%COMP%]{width:100%;height:38px!important;border-radius:.375rem;border:1px solid #ced4da;padding-left:32px}input[_ngcontent-%COMP%]::placeholder{color:#ced4da}i[_ngcontent-%COMP%]{font-size:16px;top:10.6px;left:13px}"]})};var eo=["quantity"],qt=i=>({selected:i}),to=()=>["/menu/Products/Catalog/Variants/Info"],no=i=>({ID:i}),io=i=>({"table-light":i});function oo(i,t){if(i&1){let e=B();r(0,"a",12),b("click",function(){D(e);let o=d();return x(o.onTabChange("Discount"))}),m(1," Discount "),a()}if(i&2){let e=d();c("ngClass",re(1,qt,e.tabState=="Discount"))}}function ao(i,t){if(i&1){let e=B();r(0,"a",13),b("click",function(){D(e);let o=d();return x(o.onTabChange("Product"))}),m(1," Product "),a()}if(i&2){let e=d();c("ngClass",re(1,qt,e.tabState=="Product"))}}function ro(i,t){if(i&1){let e=B();U(0),r(1,"a",14),b("click",function(){D(e);let o=d();return x(o.onTabChange("Serial"))}),m(2," Serial "),a(),W()}if(i&2){let e=d();l(),c("ngClass",re(1,qt,e.tabState=="Serial"))}}function lo(i,t){if(i&1&&(U(0),r(1,"div",11)(2,"div",23),S(3,"POS-variant-autocomplete",24),a()(),W()),i&2){let e=d(2);l(3),c("formControl",e.variantAutocomplete)("isOnModalVariant",!0)}}function so(i,t){if(i&1&&(r(0,"span"),m(1),a()),i&2){let e=d(2);l(),L("(",e.variant.UOMName,")")}}function co(i,t){if(i&1){let e=B();r(0,"div",25)(1,"strong")(2,"span"),m(3),a()(),r(4,"input",26),H("ngModelChange",function(o){D(e);let s=d(2);return Q(s.variant.UnitQuantity,o)||(s.variant.UnitQuantity=o),x(o)}),b("ngModelChange",function(){D(e);let o=d(2);return x(o.onUnitQtyChange())}),a()()}if(i&2){let e=d(2);l(3),Z(e.unitQtyLabel),l(),c("preventNegative",!0)("decimalPlaces",e.isSerialItem?0:4),J("ngModel",e.variant.UnitQuantity)}}function po(i,t){if(i&1){let e=B();r(0,"div",27)(1,"strong"),m(2,"Cost"),a(),r(3,"input",28,1),H("ngModelChange",function(o){D(e);let s=d(2);return Q(s.variant.UnitPrice,o)||(s.variant.UnitPrice=o),x(o)}),b("ngModelChange",function(){D(e);let o=d(2);return x(o.onPriceChange())}),a()()}if(i&2){let e=d(2);l(3),c("simpleKeyboard",e.keyboard),J("ngModel",e.variant.UnitPrice)}}function mo(i,t){if(i&1){let e=B();U(0),r(1,"div",15),I(2,lo,4,2,"ng-container",9),r(3,"div",16)(4,"div",17)(5,"strong"),m(6," Qty "),I(7,so,2,1,"span",9),a(),r(8,"input",18,0),H("ngModelChange",function(o){D(e);let s=d();return Q(s.variant.Quantity,o)||(s.variant.Quantity=o),x(o)}),b("ngModelChange",function(){D(e);let o=d();return x(o.onQtyChange())}),a()(),I(10,co,5,4,"div",19)(11,po,5,2,"div",20),a(),r(12,"div",11)(13,"div",21)(14,"POS-tinymce-editor",22),H("valueChange",function(o){D(e);let s=d();return Q(s.variant.Note,o)||(s.variant.Note=o),x(o)}),a()()()(),W()}if(i&2){let e=d();l(2),c("ngIf",e.isCreate),l(5),c("ngIf",e.variant.UOMName),l(),c("simpleKeyboard",e.keyboard)("decimalPlaces",e.isSerialItem?0:4),J("ngModel",e.variant.Quantity),c("disabled",e.isEditBuyForm&&e.isSerialItem),l(2),c("ngIf",e.unitQtyLabel),l(),c("ngIf",e.role.product.Cost),l(3),J("value",e.variant.Note)}}function uo(i,t){if(i&1&&(r(0,"div",42)(1,"div",31)(2,"strong"),m(3,"Discount Amount / Qty"),a()(),r(4,"div",32)(5,"div",51)(6,"p"),m(7),g(8,"number"),a()()()()),i&2){let e=d(2);l(7),Z(y(8,1,e.variant.DiscountAmount))}}function fo(i,t){if(i&1&&(U(0),r(1,"div",52)(2,"h5",53),m(3),g(4,"number"),a()(),W()),i&2){let e=d(2);l(3),L(" ",y(4,1,e.variant.Discount),"% ")}}function go(i,t){if(i&1&&(U(0),r(1,"div",54)(2,"h5"),m(3),g(4,"number"),a(),r(5,"span",48),m(6,"x"),a(),r(7,"h5"),m(8),g(9,"number"),a()(),W()),i&2){let e=d(2);l(3),Z(y(4,2,e.variant.Quantity)),l(5),Z(y(9,4,e.variant.DiscountAmount))}}function yo(i,t){if(i&1&&(U(0),r(1,"h5",55),m(2),g(3,"number"),a(),W()),i&2){let e=d(2);l(2),L(" -",y(3,1,e.totalBeforeDiscount()*(e.variant.Discount/100))," ")}}function Co(i,t){if(i&1&&(U(0),r(1,"div",50)(2,"h5",55),m(3),g(4,"number"),a()(),W()),i&2){let e=d(2);l(3),L(" -",y(4,1,e.variant.Quantity*e.variant.DiscountAmount)," ")}}function vo(i,t){if(i&1&&(U(0),r(1,"div",56)(2,"div",57)(3,"h5"),m(4,"Grand Total"),a()(),r(5,"div",57)(6,"h5"),m(7),g(8,"number"),a()()(),W()),i&2){let e=d(2);l(7),Z(y(8,1,e.totalAfterDiscount()))}}function bo(i,t){if(i&1){let e=B();r(0,"div",11)(1,"div",29)(2,"div",30)(3,"div",31)(4,"strong"),m(5,"Discount %"),a()(),r(6,"div",32)(7,"input",33,2),H("ngModelChange",function(o){D(e);let s=d();return Q(s.variant.Discount,o)||(s.variant.Discount=o),x(o)}),b("ngModelChange",function(){D(e);let o=d();return x(o.onDiscountChange())}),a()()(),r(9,"div",34)(10,"div",31)(11,"strong"),m(12,"Discount Amount"),a()(),r(13,"div",32)(14,"input",35,2),H("ngModelChange",function(o){D(e);let s=d();return Q(s.inputedDiscountAmount,o)||(s.inputedDiscountAmount=o),x(o)}),b("ngModelChange",function(o){D(e);let s=d();return x(s.onDiscountAmountChange(o))}),a()()(),r(16,"div",36)(17,"div",37)(18,"input",38),H("ngModelChange",function(o){D(e);let s=d();return Q(s.isDiscMultipliciedQty,o)||(s.isDiscMultipliciedQty=o),x(o)}),b("ngModelChange",function(){D(e);let o=d();return x(o.onSwitchDiscountTypeChange())}),a()(),r(19,"div",39)(20,"strong"),m(21,"*Quantity"),a(),r(22,"span",40),S(23,"i",41),a()()(),I(24,uo,9,3,"div",42),a(),r(25,"div",43)(26,"div",44)(27,"h4"),m(28,"Discount Simulation"),a(),r(29,"h4",45),m(30),a()(),r(31,"div",46)(32,"div",31)(33,"div",47)(34,"h5"),m(35),g(36,"number"),a(),r(37,"span",48),m(38,"x"),a(),r(39,"h5"),m(40),g(41,"number"),a()(),I(42,fo,5,3,"ng-container",9)(43,go,10,6,"ng-container",9),a(),r(44,"div",31)(45,"div",49)(46,"h5"),m(47),g(48,"number"),a()(),r(49,"div",50),I(50,yo,4,3,"ng-container",9),a(),I(51,Co,5,3,"ng-container",9),a(),I(52,vo,9,3,"ng-container",9),a()()()}if(i&2){let e=d();l(7),c("simpleKeyboard",e.keyboard),J("ngModel",e.variant.Discount),c("min",0)("readonly",!e.role.sell.Discount),l(7),c("simpleKeyboard",e.keyboard),J("ngModel",e.inputedDiscountAmount),c("max",e.variant.UnitPrice*e.variant.Quantity)("min",0)("readonly",!e.role.sell.Discount),l(4),J("ngModel",e.isDiscMultipliciedQty),l(6),dt(e.isDiscMultipliciedQty()?-1:24),l(6),L(" ",e.variant==null?null:e.variant.Name," "),l(5),Z(y(36,20,e.variant.Quantity)),l(5),Z(y(41,22,e.variant.UnitPrice)),l(2),c("ngIf",e.variant.Discount),l(),c("ngIf",e.variant.DiscountAmount>0),l(4),Z(y(48,24,e.totalBeforeDiscount())),l(3),c("ngIf",e.variant.Discount),l(),c("ngIf",e.variant.DiscountAmount>0),l(),c("ngIf",e.variant.DiscountAmount>0||e.variant.Discount>0)}}function _o(i,t){i&1&&(U(0),S(1,"i",64),r(2,"h6"),m(3,"No Image"),a(),W())}function ho(i,t){if(i&1&&S(0,"img",65),i&2){let e=d(2);c("src",e.variant.ThumbnailUrl,nt)}}function Do(i,t){if(i&1){let e=B();r(0,"button",78),b("click",function(){D(e);let o=d().ngIf,s=d(2);return x(s.setQuantityToMax(o))}),m(1," Place Order "),a()}}function xo(i,t){if(i&1&&(r(0,"tbody")(1,"tr")(2,"th",66),S(3,"i",67),m(4,"Inventory "),a(),r(5,"th",66),S(6,"i",68),m(7),a(),r(8,"th",66),S(9,"i",69),m(10," Diff "),a(),r(11,"th",66),S(12,"i",70),m(13," Action "),a()(),r(14,"tr")(15,"th",71),m(16,"On Hand"),a(),r(17,"td",72),m(18),g(19,"number"),a(),S(20,"td",73)(21,"td",74),a(),r(22,"tr")(23,"th",71),m(24,"Allocated"),a(),r(25,"td",72),m(26),g(27,"number"),a()(),r(28,"tr")(29,"th",71),m(30,"Available"),a(),r(31,"td",72),m(32),g(33,"number"),a()(),r(34,"tr")(35,"th",71),m(36,"ROP"),a(),r(37,"td",72),m(38),g(39,"number"),a(),r(40,"td",55),m(41),g(42,"number"),a()(),r(43,"tr")(44,"th",71),m(45,"Max"),a(),r(46,"td",72),m(47),g(48,"number"),a(),r(49,"td",75),m(50),g(51,"number"),a(),r(52,"td",76),I(53,Do,2,0,"button",77),a()()()),i&2){let e=t.ngIf,n=d(2);l(7),L("",n.outletName," "),l(11),L(" ",y(19,12,e.onHand)," "),l(8),L(" ",y(27,14,e.allocated)," "),l(6),L(" ",y(33,16,e.onHand-e.allocated)," "),l(6),L(" ",y(39,18,e.rop)," "),l(3),Je(" ",e.ropDiff>=0?"+":"","",y(42,20,e.ropDiff)," "),l(6),L(" ",y(48,22,e.max)," "),l(3),Je(" ",e.maxDiff>=0?"+":"","",y(51,24,e.maxDiff)," "),l(2),c("ngClass",re(26,io,n.variant.Quantity==e.max-e.onHand-e.allocated)),l(),c("ngIf",n.variant.Quantity!=e.max-e.onHand-e.allocated)}}function So(i,t){if(i&1&&(U(0),r(1,"div",58)(2,"div",59)(3,"a",60),I(4,_o,4,0,"ng-container",61)(5,ho,1,1,"ng-template",null,3,ve),a()(),r(7,"div",62)(8,"table",63),I(9,xo,54,28,"tbody",9),g(10,"async"),a()()(),W()),i&2){let e=ue(6),n=d();l(3),c("routerLink",kt(7,to))("queryParams",re(8,no,n.variant==null?null:n.variant.ID)),l(),c("ngIf",(n.variant==null?null:n.variant.ThumbnailUrl)==null)("ngIfElse",e),l(5),c("ngIf",y(10,5,n.variantStock$))}}function Io(i,t){if(i&1){let e=B();U(0),r(1,"POS-tab-serial",79),H("variantChange",function(o){D(e);let s=d();return Q(s.variant,o)||(s.variant=o),x(o)})("isFocusOnSerialInputChange",function(o){D(e);let s=d();return Q(s.isFocusOnSerialInput,o)||(s.isFocusOnSerialInput=o),x(o)})("serialsChange",function(o){D(e);let s=d();return Q(s.serials,o)||(s.serials=o),x(o)}),a(),W()}if(i&2){let e=d();l(),c("isEditBuyForm",e.isEditBuyForm)("outletID",e.outletID),J("variant",e.variant)("isFocusOnSerialInput",e.isFocusOnSerialInput)("serials",e.serials)}}var st=class i{constructor(t,e,n,o,s,P){this.dialogRef=t;this.http=n;this.role=o;this.toastr=P;this.config=new Te,this.config.title=e.variant?.Name??"Add Variant",this.config.customWidth="685px",this.appConfigJSON=e.appConfigJSON,this.unitQtyLabel=this.appConfigJSON.ModuleSell.ProductDialog.UnitQtyLabel,this.numpadVisible=this.appConfigJSON.ModuleSell.NumPadVisible,this.numpadVisible&&(this.keyboard=s.keyboard),this.isEditBuyForm=e.isEditBuyForm,this.outletID=e.outletID,this.outletName=e.outletName,this.variant=e.variant;let j=this.appConfigJSON?.ModuleSell?.ProductDialog?.QuantityToOneInDialog?1:null;if(this.variant)this.isSerialItem=this.variant.TypeID==4,this.variantStock$=this.getOnInventory(),this.inputedDiscountAmount.set(this.variant.DiscountAmount),this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount();else{this.isCreate=!0,this.variant={Name:"",Quantity:j,UnitQuantity:1,OrderPrice:0,Total:0,Note:"",UnitPrice:0,ThumbnailUrl:"",UOMName:"",TypeID:0,Discount:0,ID:"",DiscountAmount:0,Serial:[]};let z=this.variantAutocomplete.valueChanges.pipe(R(p=>p.type=="Code"),u(p=>p.str),ne(p=>n.get(Be.GetVariantByCode,[{key:"Code",value:p},{key:"EntityID",value:this.outletID},{key:"Promotion",value:!0}]).pipe(he(()=>Ae))),u(p=>this.setUnitPrice(p)),u(p=>$(T({},p),{Quantity:j,Total:p.UnitPrice,Discount:p.PriceDiscount}))),h=this.variantAutocomplete.valueChanges.pipe(R(p=>p.type=="ID"),u(p=>p.str),ne(p=>n.get(Be.GetVariantByID,[{key:"ID",value:p},{key:"EntityID",value:this.outletID},{key:"Promotion",value:!1}]).pipe(he(()=>Ae))),u(p=>this.setUnitPrice(p)),u(p=>$(T({},p),{Quantity:j,Total:p.UnitPrice,Discount:p.PriceDiscount})));tt(z,h).pipe(E(p=>this.setFocusField("quantity")),te(1)).subscribe(p=>{this.variant=p,this.isSerialItem=this.variant.TypeID==4,this.showInventory=!0,this.variantStock$=this.getOnInventory(),this.inputedDiscountAmount.set(this.variant.DiscountAmount),this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount()})}}variantAutocomplete=new me;_quantityElement;variant;variantStock$=Ae;isSerialItem=!1;outletID;outletName;appConfigJSON;numpadVisible;keyboard;isEditBuyForm=!1;unitQtyLabel;config;tabState="Cart";isCreate=!1;showInventory=!1;serials=[];isFocusOnSerialInput=!1;_onGetInventory=new Xe(void 0);onGetInventory$=this._onGetInventory.asObservable();isDiscMultipliciedQty=mt(!0);totalBeforeDiscount=mt(0);totalAfterDiscount=mt(0);inputedDiscountAmount=mt(0);setFocusField(t){switch(t){case"quantity":this._quantityElement.nativeElement.focus();break}}onPriceChange(){this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount()}onQtyChange(){this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount()}onUnitQtyChange(){this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount()}onDiscountChange(){this.calculateTotalAfterDiscount(),this.calculateTotalAfterDiscount()}onDiscountAmountChange(t){this.calculateDiscountAmount(t),this.calculateTotalAfterDiscount()}onSwitchDiscountTypeChange(){this.calculateDiscAmountOnSwitch(),this.calculateTotalAfterDiscount()}calculateDiscountAmount(t){this.isDiscMultipliciedQty()?this.variant.DiscountAmount=t:this.variant.DiscountAmount=t/this.getQty()}calculateDiscAmountOnSwitch(){let t=this.variant.DiscountAmount,e=this.getQty();this.isDiscMultipliciedQty()?this.variant.DiscountAmount=t*e:this.variant.DiscountAmount=t/e}calculateTotalBeforeDiscount(){let t=this.variant.UnitPrice*this.getQty();this.totalBeforeDiscount.set(t)}calculateTotalAfterDiscount(){let t=this.totalBeforeDiscount()-this.getTotalDiscPercentage();this.validateDiscountAmount(t);let e=this.getTotalDiscAmount(),n=t-e;this.totalAfterDiscount.set(n)}validateDiscountAmount(t){let e=this.variant.Quantity%1===0;t>0&&this.variant.DiscountAmount>t&&e&&(this.variant.DiscountAmount=t)}getTotalDiscPercentage(){return this.variant.Discount?this.totalBeforeDiscount()*this.variant.Discount/100:0}getTotalDiscAmount(){return this.variant.DiscountAmount?this.variant.DiscountAmount*this.getQty():0}getQty(){return this.variant.Quantity*this.variant.UnitQuantity}onTabChange(t){this.tabState=t}ok(){if(!this.isFocusOnSerialInput){if(this.checkQuantityIsNull(),this.isSerialItem){if(this.serials.length){let n=this.serials.map(o=>({Quantity:1,Number:o}));this.variant.Serial=[...this.variant.Serial,...n]}let t=this.variant.Serial?.map(n=>n.Quantity).reduce((n,o)=>n+o,0)??0,e=this.variant.Quantity;t!=e&&this.toastr.warning("Serial Quantity must be equal to Variant Quantity","Warning"),this.calculateTotalBeforeDiscount(),this.calculateTotalAfterDiscount()}this.dialogRef.close($(T({},this.variant),{Total:this.totalAfterDiscount()}))}}close(){this.dialogRef.close()}checkQuantityIsNull(){this.variant.Quantity==null&&(this.variant.Quantity=1)}setQuantityToMax(t){let e=t.onHand-t.allocated;t.max>=e?(this.variant.Quantity=t.max-e,this.toastr.success("Qty adjusted to Max Inventory","Success"),this.ok()):this.toastr.warning("Your Inventory Available is more than Max Inventory","Warning")}getOnInventory(){return this.onGetInventory$.pipe(Vn((t,e)=>t?Ze(t):this.http.get(Be.GetVariantStockByID,[{key:"ID",value:this.variant.ID},{key:"EntityID",value:this.outletID}]).pipe(u(n=>{let o=n.OnHand-n.Allocated;return{onHand:n.OnHand,allocated:n.Allocated,rop:n.ROP,max:n.Max,maxDiff:n.Max-n.OnHand-o,ropDiff:n.ROP-n.OnHand-o}})),null),u(t=>t),te(1))}setUnitPrice(t){let e=T({},t);return O.IsNotEmpty(t.OrderPrice)?e.UnitPrice=t.OrderPrice:e.UnitPrice=t.UnitCost,e}static \u0275fac=function(e){return new(e||i)(f(Oe),f($e),f(ce),f(xe),f(Si),f(ot))};static \u0275cmp=N({type:i,selectors:[["POS-modal-variant"]],viewQuery:function(e,n){if(e&1&&Nt(eo,5),e&2){let o;Ft(o=At())&&(n._quantityElement=o.first)}},standalone:!0,features:[F],decls:14,vars:11,consts:[["quantity",""],["price",""],["discount",""],["SHOW_IMAGE",""],[3,"onOk","onCancel","onClose","config"],[1,"row","border-bottom","mx-5"],["data-cy","input_sell",1,"btn","btn-link",3,"click","ngClass"],["class","btn btn-link","data-cy","discount",3,"ngClass","click",4,"ngIf"],["class","btn btn-link","data-cy","product",3,"ngClass","click",4,"ngIf"],[4,"ngIf"],[1,"mx-8"],[1,"row"],["data-cy","discount",1,"btn","btn-link",3,"click","ngClass"],["data-cy","product",1,"btn","btn-link",3,"click","ngClass"],["data-cy","serial",1,"btn","btn-link",3,"click","ngClass"],[1,"mt-8"],[1,"row","mt-8"],[1,"col-auto","mb-4","pe-0",2,"width","82px"],["id","txtCartQuantity","keyboardType","number","type","text","autoNum","",1,"form-control","input-numpad",2,"height","38px",3,"ngModelChange","simpleKeyboard","decimalPlaces","ngModel","disabled"],["class","col-auto pe-0","style","width: 82px",4,"ngIf"],["class","col-auto pe-0","style","width: 112px",4,"ngIf"],[1,"col","tinymce"],["height","210px",3,"valueChange","value"],[1,"col"],[3,"formControl","isOnModalVariant"],[1,"col-auto","pe-0",2,"width","82px"],["type","text","autoNum","",1,"form-control","input-numpad",2,"height","38px",3,"ngModelChange","preventNegative","decimalPlaces","ngModel"],[1,"col-auto","pe-0",2,"width","112px"],["id","inputPrice","keyboardType","number","type","text","autoNum","",1,"form-control",2,"height","38px",3,"ngModelChange","simpleKeyboard","ngModel"],[1,"col-6","border-end","py-8"],[1,"row","d-flex","align-items-center"],[1,"col-6"],[1,"col-auto","ps-0"],["id","inputDiscount","keyboardType","number","type","text","autoNum","","percentage","",1,"form-control",2,"width","112px","height","38px",3,"ngModelChange","simpleKeyboard","ngModel","min","readonly"],[1,"row","d-flex","align-items-center","mt-6"],["id","inputDiscount","keyboardType","number","type","text","autoNum","",1,"form-control",2,"width","112px","height","38px",3,"ngModelChange","simpleKeyboard","ngModel","max","min","readonly"],[1,"d-flex","align-items-center","mt-4"],[1,"form-check","form-switch","form-switch-lg","ms-1","mt-1"],["type","checkbox","id","flexSwitchCheckDefault",1,"form-check-input",3,"ngModelChange","ngModel"],[1,"ms-4"],["matTooltipPosition","above","matTooltip",`Use the final discount amount if you want to discount the price of the total
24
+ quantity of the product. The nominal will be calculated automatically and filled in the discount amount box.`,1,"pointer"],[1,"fa-solid","fa-info-circle","ms-2"],[1,"row","d-flex","align-items-center","justify-content-start","mt-4"],[1,"col-6","py-8"],[1,"w-100","text-center"],[1,"text-start","mt-12"],[1,"row","mt-12"],[1,"w-100","d-flex","align-items-center","justify-content-end"],[1,"mx-1","fw-bold"],[1,"w-100","d-flex","justify-content-end"],[1,"w-100","d-flex","justify-content-end","mt-2"],[1,"border","ps-6",2,"height","38px","padding-top","10px","width","112px","background-color","#e9ecef"],[1,"d-flex","align-items-center","justify-content-end","mt-2"],[1,"fw-bold","text-danger"],[1,"d-flex","align-items-center","justify-content-end","mt-2","text-danger"],[1,"text-danger"],[1,"row","border-top","mx-0","px-0","mt-4"],[1,"col-6","d-flex","justify-content-end","mt-4"],[1,"row","mt-6"],[1,"col-sm-4","d-flex","justify-content-center","flex-column","align-items-center","text-body-secondary"],["target","_blank",2,"color","inherit",3,"routerLink","queryParams"],[4,"ngIf","ngIfElse"],[1,"col-sm-8"],[1,"table","table-bordered","text-center","inventory-table","w-auto"],["aria-hidden","true",1,"fa-solid","fa-image","fa-5x"],[1,"border","rounded",3,"src"],[1,"bg-light-orange"],["aria-hidden","true",1,"fa-box-archive","fa-solid","fa-1x","me-2"],["aria-hidden","true",1,"fa-solid","fa-house","fa-1x","me-2"],["aria-hidden","true",1,"fa-solid","fa-plus-minus","fa-1x","me-2"],["aria-hidden","true",1,"fa-solid","fa-sliders","fa-1x","me-2"],[1,"table-light","text-start"],[1,"text-end"],["rowspan","3",1,"table-light"],["rowspan","4",1,"table-light"],[1,"text-success"],[3,"ngClass"],["style","font-size: 12px","type","button","class","btn btn-success btn-sm me-2","matTooltipPosition","above","matTooltip","Adjust Bought Qty to max Inventory",3,"click",4,"ngIf"],["type","button","matTooltipPosition","above","matTooltip","Adjust Bought Qty to max Inventory",1,"btn","btn-success","btn-sm","me-2",2,"font-size","12px",3,"click"],[3,"variantChange","isFocusOnSerialInputChange","serialsChange","isEditBuyForm","outletID","variant","isFocusOnSerialInput","serials"]],template:function(e,n){e&1&&(r(0,"modal-material",4),b("onOk",function(){return n.ok()})("onCancel",function(){return n.close()})("onClose",function(){return n.close()}),r(1,"content")(2,"div",5)(3,"div")(4,"a",6),b("click",function(){return n.onTabChange("Cart")}),m(5," Cart "),a(),I(6,oo,2,3,"a",7)(7,ao,2,3,"a",8)(8,ro,3,3,"ng-container",9),a()(),r(9,"div",10),I(10,mo,15,9,"ng-container",9)(11,bo,53,26,"div",11)(12,So,11,10,"ng-container",9)(13,Io,2,5,"ng-container",9),a()()()),e&2&&(c("config",n.config),l(4),c("ngClass",re(9,qt,n.tabState=="Cart")),l(2),c("ngIf",!n.isCreate||n.showInventory),l(),c("ngIf",!n.isCreate||n.showInventory),l(),c("ngIf",n.isSerialItem),l(2),c("ngIf",n.tabState=="Cart"),l(),dt(n.tabState=="Discount"?11:-1),l(),c("ngIf",n.tabState=="Product"),l(),c("ngIf",n.tabState=="Serial"))},dependencies:[A,it,pe,Ve,Re,Jt,Wt,Pe,De,Zn,se,Me,_t,Ee,we,at,rt,vi,$t,Rt,Ei,Ii,Ht,qe,Ke,ji],styles:[".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}p-chips[_ngcontent-%COMP%] ul.p-inputtext{width:570px;max-width:570px;border:1px solid #C8D3DF}p-chips[_ngcontent-%COMP%] ul.p-inputtext li.p-chips-input-token>input[type=text]{border:none}p-chips[_ngcontent-%COMP%] .p-chips .p-chips-multiple-container:not(.p-disabled):hover{border:1px solid #C8D3DF}p-chips[_ngcontent-%COMP%] .p-chips-multiple-container{display:inline-block}p-chips[_ngcontent-%COMP%] .p-chips-multiple-container .p-chips-token{margin:2px;background:#96bf48}.inventory-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .inventory-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{line-height:6px!important}.btn-link[_ngcontent-%COMP%]{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.selected[_ngcontent-%COMP%]{color:#3b3b3b;border-bottom:4px solid #07a519}.form-check-input[_ngcontent-%COMP%]{clear:left}.form-switch.form-switch-lg[_ngcontent-%COMP%] .form-check-input[_ngcontent-%COMP%]{height:1.5rem;width:2.75rem;border-radius:3rem}.form-check-input[_ngcontent-%COMP%]:focus{border-color:#89b03e!important}.form-check-input[_ngcontent-%COMP%]:checked{border-color:#89b03e!important;background-color:#89b03e!important}"]})};var St=class i extends Li{connection;_Data=new Tn(1);Data=this._Data.asObservable();httpService=Ce(ce);toastService=Ce(ot);_cache=new Map;previousCountByEpc={};_isConnected=new Xe(!1);isConnected=this._isConnected.asObservable();_bufferTime=new Xe(100);set bufferTime(t){this._bufferTime.next(t)}get bufferTime(){return this._bufferTime.getValue()}intializeWebSocket(t="/"){return yt(this,null,function*(){if(t.length<=0){this.toastService.error("RFID URL cannot be empty",Ne.Error);return}if(!(this.connection&&this.connection.state===Yn.Connected)){this.connection=new Xn().withUrl(t).configureLogging(zn.Information).withAutomaticReconnect().build();try{yield this.connection.start(),yield this.initiateGroupSubscription(),this.onWebSocketMessageReceived(),this._isConnected.next(!0),this.toastService.success("RFID Connected",Ne.Success)}catch(e){throw this._isConnected.next(!1),this.toastService.error(JSON.stringify(e),Ne.Error),new Error(JSON.stringify(e))}}})}initiateGroupSubscription(){return yt(this,null,function*(){try{yield this.connection.invoke("SubscribeGroup",{CurrentID:"Buy"})}catch(t){throw this.toastService.error(JSON.stringify(t),Ne.Error),new Error(JSON.stringify(t))}})}onWebSocketMessageReceived(){this.connection.on("ReceiveSignal",t=>{this._Data.next(t)})}getVariantByCode(t,e=O.GuidEmpty){let n=[{key:"Code",value:t},{key:"EntityID",value:e}];return this.httpService.get(Be.GetVariantByCode,n).pipe(he(o=>o instanceof Gn?Ze(null):En(()=>new Error(o.message))))}processGroupedData(t=O.GuidEmpty){return this._Data.pipe(R(e=>e!==null&&e&&Object.keys(e).length>0),Nn(this._bufferTime.getValue()),vn(e=>wn(e)),kn(e=>e.epc),vn(e=>e.pipe(Ot((n,o)=>[...n,o],[]),ne(n=>{let o=e.key;if(this._cache.has(o))return this._cache.get(o).pipe(u(s=>({epc:o,items:n,response:s})));{let s=this.getVariantByCode(o,t).pipe(R(P=>P),E(P=>this._cache.set(o,Ze(P))));return this._cache.set(o,s),s.pipe(u(P=>({epc:o,items:n,response:P})))}}))),Ot((e,n)=>{let o=this.previousCountByEpc&&this.previousCountByEpc[n.epc]||0,s=n.items.length,P=s-o;return e[n.epc]={data:n.items,count:P,variant:n.response},this.previousCountByEpc[n.epc]=s,e},{}),te({bufferSize:1,refCount:!0}))}constructor(){super(),this.connection&&(this.connection.onclose=t=>yt(this,null,function*(){console.error("SignalR connection closed:",t)}),this.connection.onreconnecting=t=>yt(this,null,function*(){console.warn("SignalR reconnecting:",t)}),this.connection.onreconnected=t=>yt(this,null,function*(){console.log("SignalR reconnected:",t)}))}static \u0275fac=function(e){return new(e||i)};static \u0275prov=ae({token:i,factory:i.\u0275fac,providedIn:"root"})};function Po(i,t){if(i&1&&(r(0,"td",24),m(1),a()),i&2){let e=d().index;l(),L(" ",e+1,". ")}}function Oo(i,t){if(i&1&&(U(0),r(1,"div",25),S(2,"img",26),a(),W()),i&2){let e=d().$implicit;l(2),c("src",e.ThumbnailUrl,nt)}}function To(i,t){i&1&&(r(0,"div",27),S(1,"i",28),a())}function wo(i,t){if(i&1&&(r(0,"span"),m(1),g(2,"quantityFraction"),a()),i&2){let e=d().$implicit;l(),Z(y(2,1,e.Quantity))}}function Eo(i,t){i&1&&(r(0,"span",29),m(1," x "),a())}function No(i,t){if(i&1&&(r(0,"span"),m(1),g(2,"number"),a()),i&2){let e=d().$implicit;l(),Z(y(2,1,e.UnitQuantity))}}function Fo(i,t){i&1&&(r(0,"span",29),m(1," x "),a())}function Ao(i,t){if(i&1&&(r(0,"span"),m(1),g(2,"number"),a()),i&2){let e=d().$implicit;l(),Z(y(2,1,e.UnitPrice))}}function ko(i,t){if(i&1&&(U(0),r(1,"div"),m(2),g(3,"number"),a(),W()),i&2){let e=d().$implicit;l(2),L("-",y(3,1,e.Discount),"%")}}function Vo(i,t){if(i&1&&(r(0,"div"),m(1),g(2,"number"),a()),i&2){let e=d().$implicit;l(),L("-",y(2,1,e.DiscountAmount),"")}}function Ro(i,t){if(i&1&&(U(0),m(1),g(2,"number"),W()),i&2){let e=d().$implicit;l(),Z(y(2,1,e.Total))}}function $o(i,t){i&1&&m(0,"-")}function Bo(i,t){if(i&1){let e=B();r(0,"tr",9),b("contextmenu",function(){let o=D(e).index,s=d(2);return x(s.onContextMenu(o))})("click",function(){let o=D(e),s=o.$implicit,P=o.index,_=d(2);return x(_.update(s,P))}),I(1,Po,2,1,"td",10),r(2,"td",11)(3,"div",12),I(4,Oo,3,1,"ng-container",13)(5,To,2,0,"ng-template",null,2,ve),r(7,"div",14)(8,"div"),m(9),a(),r(10,"span",15),m(11),a(),S(12,"app-serial-note",16)(13,"small",17),a()()(),r(14,"td",18)(15,"span"),I(16,wo,3,3,"span",19)(17,Eo,2,0,"span",20)(18,No,3,3,"span",19)(19,Fo,2,0,"span",20)(20,Ao,3,3,"span",19),a()(),r(21,"td",21),I(22,ko,4,3,"ng-container",19)(23,Vo,3,3,"div"),a(),r(24,"td",18),I(25,Ro,3,3,"ng-container",13)(26,$o,1,0,"ng-template",null,3,ve),a(),r(28,"td",22)(29,"i",23),b("click",function(){let o=D(e).index,s=d(2);return x(s.deleteVariant(o))}),a()()()}if(i&2){let e=t.$implicit,n=ue(6),o=ue(27),s=d(2);c("cdkDragDisabled",!s.enabledDragDrop),l(),c("ngIf",s.appConfigJSON==null?null:s.appConfigJSON.ModuleBuy.Grid.RowNumberVisible),l(),Ct("ps-0",s.appConfigJSON==null?null:s.appConfigJSON.ModuleBuy.Grid.RowNumberVisible),l(2),c("ngIf",e.ThumbnailUrl)("ngIfElse",n),l(5),Z(e.Name),l(2),Z(e.Code),l(),c("serials",e.Serial),l(),c("innerHtml",e.Note,Rn),l(3),c("ngIf",e.Quantity!=1||e.UnitQuantity>1),l(),c("ngIf",e.UnitQuantity>1||e.UnitQuantity<-1),l(),c("ngIf",e.UnitQuantity>1||e.UnitQuantity<-1),l(),c("ngIf",(e.Quantity>1||e.Quantity<-1)&&s.role.product.Cost),l(),c("ngIf",(e.Quantity>1||e.Quantity<-1||e.Discount>0||e.DiscountAmount>0)&&s.role.product.Cost),l(2),c("ngIf",e.Discount),l(),dt(e.DiscountAmount?23:-1),l(2),c("ngIf",s.role.product.Cost)("ngIfElse",o)}}function jo(i,t){if(i&1){let e=B();r(0,"div",5)(1,"table",6)(2,"tbody",7),b("cdkDropListDropped",function(o){D(e);let s=d();return x(s.drop(o))}),I(3,Bo,30,19,"tr",8),a()()()}if(i&2){let e=d(),n=ue(4);c("cdkContextMenuTriggerFor",n),l(3),c("ngForOf",e.cart)}}function Lo(i,t){i&1&&(r(0,"div",30)(1,"div",31)(2,"div",32)(3,"div",33)(4,"div",34),S(5,"i",35),a(),r(6,"div",36)(7,"span"),m(8,"Empty Cart"),a(),S(9,"br"),r(10,"span"),m(11,"Add products to the cart"),a(),S(12,"br"),r(13,"span"),m(14,"or scan barcode"),a()()()()()())}function Qo(i,t){if(i&1){let e=B();r(0,"button",39),b("click",function(){D(e);let o=d(2);return x(o.onReturn())}),m(1," Return "),a()}}function Uo(i,t){if(i&1){let e=B();r(0,"div",37),I(1,Qo,2,0,"button",38),r(2,"button",39),b("click",function(){D(e);let o=d();return x(o.onPurchase())}),m(3," Purchase "),a()()}if(i&2){let e=d();l(),c("ngIf",e.role.sell.Return)}}var zt=class i{constructor(t,e,n,o,s,P){this.cartService=t;this.matDialog=e;this.role=n;this.form=o;this.sf=P}cart=[];appConfigJSON;isEdit;outletID;outletName;RFIDService=Ce(St);outletService=Ce(q);enabledDragDrop=!0;onOpenContextMenuIndex=-1;ngOnInit(){this.initDragDropEnabled(),this.outletService.outlet.valueChanges.pipe(ne(t=>this.RFIDService.processGroupedData(t.ID)),E(t=>this.cartService.addCartRFID(t))).subscribe()}initDragDropEnabled(){O.isMobileDevice&&(this.enabledDragDrop=!1)}deleteVariant(t){this.cartService.deleteVariant(t)}drop(t){this.cartService.dragDropCart(t)}onContextMenu(t){this.onOpenContextMenuIndex=t}onReturn(){this.cartService.returnVariant(this.onOpenContextMenuIndex)}onPurchase(){this.cartService.purchaseVariant(this.onOpenContextMenuIndex)}update(t,e){let n=T({},t);this.matDialog.open(st,{data:{variant:n,appConfigJSON:this.appConfigJSON,isEdit:this.isEdit,outletID:this.outletID,outletName:this.outletName,deliveryEntityID:this.form.deliveryEntityID.value}}).afterClosed().pipe(R(o=>!!o)).subscribe(o=>{this.cartService.updateVariant(o,e),this.sf.searchFilterNativeEl.focus()})}static \u0275fac=function(e){return new(e||i)(f(oe),f(ie),f(xe),f(q),f(Qt),f(Tt))};static \u0275cmp=N({type:i,selectors:[["POS-cart-display"]],inputs:{cart:"cart",appConfigJSON:"appConfigJSON",isEdit:"isEdit",outletID:"outletID",outletName:"outletName"},standalone:!0,features:[F],decls:5,vars:2,consts:[["EMPTY_CART",""],["context_menu",""],["NO_IMAGE",""],["HIDDENCOST",""],[3,"cdkContextMenuTriggerFor",4,"ngIf","ngIfElse"],[3,"cdkContextMenuTriggerFor"],[1,"table","table-borderless"],["cdkDropList","",3,"cdkDropListDropped"],["class","border-bottom","cdkDrag","",3,"cdkDragDisabled","contextmenu","click",4,"ngFor","ngForOf"],["cdkDrag","",1,"border-bottom",3,"contextmenu","click","cdkDragDisabled"],["style","width: 10px",4,"ngIf"],[2,"width","50%"],[1,"d-flex"],[4,"ngIf","ngIfElse"],[1,"ms-4","d-flex","flex-column","justify-content-center",2,"line-height","18px"],[1,"fw-normal","fs-6","text-muted"],[3,"serials"],["title","Note",1,"special-TinyMCE","m-0","fst-italic","d-block",3,"innerHtml"],[1,"text-end"],[4,"ngIf"],["class","fs-6",4,"ngIf"],[1,"text-end","text-danger"],[1,"text-end",2,"width","75px"],[1,"fa-solid","fa-trash","fs-4","text-danger","pointer",3,"click"],[2,"width","10px"],[1,"ratio","ratio-1x1",2,"width","55px"],[1,"item-image",3,"src"],[1,"item-image","d-flex","justify-content-center","align-items-center","text-center","fs-1"],[1,"fa-solid","fa-image",2,"color","#b4b4b4c2"],[1,"fs-6"],[1,"row","g-0","h-100"],[1,"col-12"],[1,"d-flex","justify-content-center","align-items-center","h-100"],[1,"row"],[1,"col-12","d-flex","justify-content-center"],[1,"fa-regular","fa-cart-arrow-up","text-secondary",2,"font-size","110px"],[1,"col-12","justify-content-center","text-center","mt-5","empty-cart-description","text-secondary","headings-font-family"],["cdkMenu","",1,"example-menu"],["class","example-menu-item","cdkMenuItem","",3,"click",4,"ngIf"],["cdkMenuItem","",1,"example-menu-item",3,"click"]],template:function(e,n){if(e&1&&I(0,jo,4,2,"div",4)(1,Lo,15,0,"ng-template",null,0,ve)(3,Uo,4,1,"ng-template",null,1,ve),e&2){let o=ue(2);c("ngIf",n.cart.length)("ngIfElse",o)}},dependencies:[A,He,pe,Re,di,mi,pi,Bi,Ri,Vi,$i,xi,jt],styles:[".item-image[_ngcontent-%COMP%]{height:50px;width:56px;display:block;border:solid 1px #dddddd;border-radius:5px;object-fit:contain}.example-menu[_ngcontent-%COMP%]{display:inline-flex;flex-direction:column;min-width:180px;max-width:280px;background-color:#fff;padding:6px 0}.example-menu-item[_ngcontent-%COMP%]{background-color:transparent;cursor:pointer;border:none;-webkit-user-select:none;user-select:none;min-width:64px;line-height:36px;padding:0 16px;display:flex;align-items:center;flex-direction:row;flex:1}.example-menu-item[_ngcontent-%COMP%]:hover{background-color:#f5f5f5}.example-menu-item[_ngcontent-%COMP%]:active{background-color:#dcdcdc}.table[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:not(caption) > *[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{padding:12px 10px} .cdk-menu.cdk-menu-group.example-menu{box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.empty-cart-description[_ngcontent-%COMP%]{font-size:14px;font-weight:500;color:#c7c7c7}"]})};var Yt=class i{constructor(t,e){this.dialogRef=t;this.data=e;this.config.title="Return",this.invoiceNumber=e.invoiceNumber}config=new Te;invoiceNumber;ok(){this.dialogRef.close(this.invoiceNumber)}static \u0275fac=function(e){return new(e||i)(f(Oe),f($e))};static \u0275cmp=N({type:i,selectors:[["POS-modal-return-invoice"]],standalone:!0,features:[F],decls:6,vars:2,consts:[[3,"onOk","onCancel","onClose","config"],[1,"form-floating-outline","m-0"],["type","text","id","invoiceNumber","name","invoiceNumber",1,"form-control",3,"ngModelChange","ngModel"],["for","invoiceNumber"]],template:function(e,n){e&1&&(r(0,"modal-material",0),b("onOk",function(){return n.ok()})("onCancel",function(){return n.dialogRef.close()})("onClose",function(){return n.dialogRef.close()}),r(1,"content")(2,"div",1)(3,"input",2),H("ngModelChange",function(s){return Q(n.invoiceNumber,s)||(n.invoiceNumber=s),s}),a(),r(4,"label",3),m(5,"Supplier Bill"),a()()()()),e&2&&(c("config",n.config),l(3),J("ngModel",n.invoiceNumber))},dependencies:[A,Pe,De,se,Me,Ee,we]})};var Xt=class i{constructor(t){this.matDialog=t}invoiceNumber;disabled=!1;onChange=t=>{};onTouched=()=>{};writeValue(t){this.invoiceNumber=t}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}openModalReturnInvoice(){this.matDialog.open(Yt,{data:{invoiceNumber:this.invoiceNumber}}).afterClosed().pipe(R(t=>!!t)).subscribe(t=>{this.invoiceNumber=t,this.onChange(this.invoiceNumber)})}static \u0275fac=function(e){return new(e||i)(f(ie))};static \u0275cmp=N({type:i,selectors:[["POS-return-invoice"]],standalone:!0,features:[ke([{provide:Ge,multi:!0,useExisting:i}]),F],decls:1,vars:0,consts:[["icon","fa-solid fa-file-invoice","label","Return Bill",3,"click"]],template:function(e,n){e&1&&(r(0,"POS-dropdown-item-more-action",0),b("click",function(){return n.openModalReturnInvoice()}),a())},dependencies:[A,Bt,je]})};var Zt=class i{constructor(t){this.cart=t}returnCart(){this.cart.returnCart()}static \u0275fac=function(e){return new(e||i)(f(oe))};static \u0275cmp=N({type:i,selectors:[["POS-return-cart"]],standalone:!0,features:[F],decls:1,vars:0,consts:[["icon","fa-cart-shopping fa-solid","label","Return Cart",3,"click"]],template:function(e,n){e&1&&(r(0,"POS-dropdown-item-more-action",0),b("click",function(){return n.returnCart()}),a())},dependencies:[A,je]})};var en=class i{constructor(t){this.cart=t}clearCart(){this.cart.clearCart()}static \u0275fac=function(e){return new(e||i)(f(oe))};static \u0275cmp=N({type:i,selectors:[["POS-clear-cart"]],standalone:!0,features:[F],decls:1,vars:0,consts:[["icon","fa-trash fa-solid","label","Clear",3,"click"]],template:function(e,n){e&1&&(r(0,"POS-dropdown-item-more-action",0),b("click",function(){return n.clearCart()}),a())},dependencies:[A,je]})};var tn=class i{constructor(t,e){this.matDialog=t;this.cart=e}appConfigJSON;isEditBuyForm;outletID;outletName;addVariant(){this.matDialog.open(st,{data:{appConfigJSON:this.appConfigJSON,isEdit:this.isEditBuyForm,outletID:this.outletID,outletName:this.outletName}}).afterClosed().pipe(R(t=>!!t)).subscribe(t=>this.cart.addVariant(t))}static \u0275fac=function(e){return new(e||i)(f(ie),f(oe))};static \u0275cmp=N({type:i,selectors:[["POS-add-variant"]],inputs:{appConfigJSON:"appConfigJSON",isEditBuyForm:"isEditBuyForm",outletID:"outletID",outletName:"outletName"},standalone:!0,features:[F],decls:1,vars:0,consts:[["icon","fa-circle-plus fa-solid","label","Add",3,"click"]],template:function(e,n){e&1&&(r(0,"POS-dropdown-item-more-action",0),b("click",function(){return n.addVariant()}),a())},dependencies:[A,je]})};var nn=class i{constructor(t,e){this.matDialog=t;this.cart=e}outletID;uploadCart(){this.matDialog.open(Ni,{data:{sampleUrl:"https://res.cloudinary.com/pos/raw/upload/v1699867624/POS/CSV/ImportBuy_DealPOS_New.csv",outletID:this.outletID,fileEndpoint:"/API/Buy/UploadCsvV2",useUppy:!0}}).afterClosed().pipe(R(t=>!!t),u(t=>t.map(e=>$(T({},e.Variant),{UnitPrice:e.Cost,Total:e.Cost*e.Quantity,Quantity:e.Quantity,Serial:e.Serial,Note:e.Note})))).subscribe(t=>this.cart.uploadCart(t))}static \u0275fac=function(e){return new(e||i)(f(ie),f(oe))};static \u0275cmp=N({type:i,selectors:[["POS-upload-cart"]],inputs:{outletID:"outletID"},standalone:!0,features:[F],decls:1,vars:0,consts:[["icon","fa-upload fa-solid","label","Upload",3,"click"]],template:function(e,n){e&1&&(r(0,"POS-dropdown-item-more-action",0),b("click",function(){return n.uploadCart()}),a())},dependencies:[A,je]})};var Wo=["serialInput"],on=class i{constructor(t,e,n){this.dialogRef=t;this.toastr=e;this.cart=n;this.modalConfig.title="Scan Serial",this.modalConfig.customWidth="350px",this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0}serialInputEl;modalConfig=new Te;serial;ngOnInit(){}onKeyDown(t){t.key=="Enter"&&(O.IsNotEmpty(this.serial)?(this.cart.addVariantThroughSerial(this.serial),this.serial=null):this.toastr.warning("Serial Can`t be empty","Warning!"),this.setFocusInput())}setFocusInput(){this.serialInputEl&&setTimeout(()=>{this.serialInputEl?.nativeElement?.focus()},500)}static \u0275fac=function(e){return new(e||i)(f(Oe),f(ot),f(oe))};static \u0275cmp=N({type:i,selectors:[["POS-modal-scan-serial"]],viewQuery:function(e,n){if(e&1&&Nt(Wo,5),e&2){let o;Ft(o=At())&&(n.serialInputEl=o.first)}},standalone:!0,features:[F],decls:7,vars:2,consts:[["serialInput",""],[3,"onClose","config"],[1,"input-group","mt-3"],["type","text","placeholder","Input Product By Serial","aria-label","Serial",1,"form-control",3,"ngModelChange","keydown","ngModel"],[1,"input-group-text"],[1,"fa-solid","fa-barcode","fs-4"]],template:function(e,n){if(e&1){let o=B();r(0,"modal-material",1),b("onClose",function(){return D(o),x(n.dialogRef.close())}),r(1,"content")(2,"div",2)(3,"input",3,0),H("ngModelChange",function(P){return D(o),Q(n.serial,P)||(n.serial=P),x(P)}),b("keydown",function(P){return D(o),x(n.onKeyDown(P))}),a(),r(5,"span",4),S(6,"i",5),a()()()()}e&2&&(c("config",n.modalConfig),l(3),J("ngModel",n.serial))},dependencies:[A,Pe,De,se,Me,Ee,we],styles:["input[_ngcontent-%COMP%]{height:55px;border-bottom-left-radius:4px;border-top-left-radius:4px}span.input-group-text[_ngcontent-%COMP%]{border-bottom-right-radius:4px;border-top-right-radius:4px}"]})};var an=class i{constructor(t,e){this.matDialog=t;this.viewContainerRef=e}scanSerial(){this.matDialog.open(on,{viewContainerRef:this.viewContainerRef})}static \u0275fac=function(e){return new(e||i)(f(ie),f(Bn))};static \u0275cmp=N({type:i,selectors:[["POS-scan-serial"]],standalone:!0,features:[F],decls:1,vars:0,consts:[["icon","fa-barcode-read fa-solid","label","Serial",3,"click"]],template:function(e,n){e&1&&(r(0,"POS-dropdown-item-more-action",0),b("click",function(){return n.scanSerial()}),a())},dependencies:[A,je]})};var Jo=i=>({disabled:i}),Ho=(i,t)=>({red:i,green:t}),rn=class i{RFIDService=Ce(St);matDialog=Ce(ie);constructor(){}onOpenModal(){this.matDialog.open(Qi).componentInstance.onOK.pipe(hi("onPayload"),E(({hostURL:e,bufferTime:n})=>{this.RFIDService.bufferTime=n,this.RFIDService.intializeWebSocket(e)}),te(1)).subscribe()}ngOnInit(){}static \u0275fac=function(e){return new(e||i)};static \u0275cmp=N({type:i,selectors:[["pos-rfid-buy-action"]],standalone:!0,features:[F],decls:8,vars:13,consts:[[1,"dropdown-item","px-1","d-flex",3,"click","ngClass"],["aria-hidden","true",1,"fa-solid","fa-wifi","fs-2"],[1,"pe-0","ps-4","fs-6"],[1,"blob",2,"position","absolute","top","0","right","0",3,"ngClass"]],template:function(e,n){e&1&&(r(0,"div",0),g(1,"async"),b("click",function(){return n.onOpenModal()}),S(2,"i",1),r(3,"label",2),m(4,"Connect RFID"),a(),S(5,"div",3),g(6,"async"),g(7,"async"),a()),e&2&&(c("ngClass",re(8,Jo,y(1,2,n.RFIDService.isConnected))),l(5),c("ngClass",Vt(10,Ho,!y(6,4,n.RFIDService.isConnected),y(7,6,n.RFIDService.isConnected))))},dependencies:[A,it,Ve],styles:[".disabled[_ngcontent-%COMP%]{color:gray;pointer-events:none;cursor:not-allowed}.blob[_ngcontent-%COMP%]{background:#000;border-radius:50%;box-shadow:0 0 #000;height:15px;width:15px;transform:scale(1);animation:_ngcontent-%COMP%_pulse-black 2s infinite}@keyframes _ngcontent-%COMP%_pulse-black{0%{transform:scale(.95);box-shadow:0 0 #000000b3}70%{transform:scale(1);box-shadow:0 0 0 10px #0000}to{transform:scale(.95);box-shadow:0 0 #0000}}.blob.white[_ngcontent-%COMP%]{background:#fff;box-shadow:0 0 #fff;animation:_ngcontent-%COMP%_pulse-white 2s infinite}@keyframes _ngcontent-%COMP%_pulse-white{0%{transform:scale(.95);box-shadow:0 0 #ffffffb3}70%{transform:scale(1);box-shadow:0 0 0 10px #fff0}to{transform:scale(.95);box-shadow:0 0 #fff0}}.blob.red[_ngcontent-%COMP%]{background:#ff5252;box-shadow:0 0 #ff5252;animation:_ngcontent-%COMP%_pulse-red 2s infinite}@keyframes _ngcontent-%COMP%_pulse-red{0%{transform:scale(.95);box-shadow:0 0 #ff5252b3}70%{transform:scale(1);box-shadow:0 0 0 10px #ff525200}to{transform:scale(.95);box-shadow:0 0 #ff525200}}.blob.orange[_ngcontent-%COMP%]{background:#ff793f;box-shadow:0 0 #ff793f;animation:_ngcontent-%COMP%_pulse-orange 2s infinite}@keyframes _ngcontent-%COMP%_pulse-orange{0%{transform:scale(.95);box-shadow:0 0 #ff793fb3}70%{transform:scale(1);box-shadow:0 0 0 10px #ff793f00}to{transform:scale(.95);box-shadow:0 0 #ff793f00}}.blob.yellow[_ngcontent-%COMP%]{background:#ffb142;box-shadow:0 0 #ffb142;animation:_ngcontent-%COMP%_pulse-yellow 2s infinite}@keyframes _ngcontent-%COMP%_pulse-yellow{0%{transform:scale(.95);box-shadow:0 0 #ffb142b3}70%{transform:scale(1);box-shadow:0 0 0 10px #ffb14200}to{transform:scale(.95);box-shadow:0 0 #ffb14200}}.blob.blue[_ngcontent-%COMP%]{background:#34ace0;box-shadow:0 0 #34ace0;animation:_ngcontent-%COMP%_pulse-blue 2s infinite}@keyframes _ngcontent-%COMP%_pulse-blue{0%{transform:scale(.95);box-shadow:0 0 #34ace0b3}70%{transform:scale(1);box-shadow:0 0 0 10px #34ace000}to{transform:scale(.95);box-shadow:0 0 #34ace000}}.blob.green[_ngcontent-%COMP%]{background:#77d933;box-shadow:0 0 #77d933;animation:_ngcontent-%COMP%_pulse-green 2s infinite}@keyframes _ngcontent-%COMP%_pulse-green{0%{transform:scale(.95);box-shadow:0 0 #33d938b3}70%{transform:scale(1);box-shadow:0 0 0 10px #33d9b200}to{transform:scale(.95);box-shadow:0 0 #33d9b200}}.blob.purple[_ngcontent-%COMP%]{background:#8e44ad;box-shadow:0 0 #8e44ad;animation:_ngcontent-%COMP%_pulse-purple 2s infinite}@keyframes _ngcontent-%COMP%_pulse-purple{0%{transform:scale(.95);box-shadow:0 0 #8e44adb3}70%{transform:scale(1);box-shadow:0 0 0 10px #8e44ad00}to{transform:scale(.95);box-shadow:0 0 #8e44ad00}}"],changeDetection:0})};function Go(i,t){i&1&&(r(0,"li",11),S(1,"POS-return-cart"),a())}function Ko(i,t){if(i&1&&(r(0,"li",11),S(1,"POS-return-invoice",16),a()),i&2){let e=d(2);l(),c("formControl",e.returnInvoiceNumber)}}function qo(i,t){if(i&1&&(r(0,"div",8)(1,"div",9),m(2,"Order"),a(),S(3,"div",10),I(4,Go,2,0,"li",15)(5,Ko,2,1,"li",15),a()),i&2){let e=d();l(4),c("ngIf",e.role.sell.Return),l(),c("ngIf",e.role.sell.Return)}}var ln=class i{constructor(t,e,n){this.role=t;this.matDialog=e;this.cart=n}returnInvoiceNumber=new me("");appConfigJSON;isEditBuyForm;outletID;outletName;handleKeyboardEvent(t){t.key==="F4"&&this.matDialog.openDialogs.length===0&&this.addVariant()}addVariant(){this.matDialog.open(st,{data:{appConfigJSON:this.appConfigJSON,isEdit:this.isEditBuyForm,outletID:this.outletID,outletName:this.outletName}}).afterClosed().pipe(R(t=>!!t)).subscribe(t=>this.cart.addVariant(t))}static \u0275fac=function(e){return new(e||i)(f(xe),f(ie),f(oe))};static \u0275cmp=N({type:i,selectors:[["POS-more-actions"]],hostBindings:function(e,n){e&1&&b("keydown",function(s){return n.handleKeyboardEvent(s)},!1,$n)},inputs:{returnInvoiceNumber:"returnInvoiceNumber",appConfigJSON:"appConfigJSON",isEditBuyForm:"isEditBuyForm",outletID:"outletID",outletName:"outletName"},standalone:!0,features:[F],decls:27,vars:6,consts:[["id","moreMenu","data-bs-toggle","dropdown",1,"d-flex","align-items-center","cursor-pointer"],[1,"me-2"],[1,"fa-solid","fa-caret-down","fa-lg"],[1,"fs-6","headings-font-family","pb-1"],[1,"h-100","d-flex","align-items-center","justify-content-between"],["aria-labelledby","moreMenu",1,"dropdown-menu","more-actions"],[1,"d-flex",2,"width","30rem"],["class","dropdown-header text-dark col",4,"ngIf"],[1,"dropdown-header","text-dark","col"],[1,"h5","mb-4"],[1,"dropdown-divider","m-0"],[1,"cursor-pointer"],[3,"appConfigJSON","isEditBuyForm","outletID","outletName"],[3,"outletID"],[1,"cursor-pointer","position-relative"],["class","cursor-pointer",4,"ngIf"],[3,"formControl"]],template:function(e,n){e&1&&(r(0,"span",0)(1,"span",1),S(2,"i",2),a(),r(3,"span",3),m(4,"More Actions"),a()(),r(5,"div",4)(6,"div",5)(7,"div",6),I(8,qo,6,2,"div",7),r(9,"div",8)(10,"div",9),m(11,"Item"),a(),S(12,"div",10),r(13,"li",11),S(14,"POS-add-variant",12),a(),r(15,"li",11),S(16,"POS-scan-serial"),a(),r(17,"li",11),S(18,"POS-upload-cart",13),a(),r(19,"li",11),S(20,"POS-clear-cart"),a()(),r(21,"div",8)(22,"div",9),m(23,"Advanced"),a(),S(24,"div",10),r(25,"li",14),S(26,"pos-rfid-buy-action"),a()()()()()),e&2&&(l(8),c("ngIf",n.role.sell.Return),l(6),c("appConfigJSON",n.appConfigJSON)("isEditBuyForm",n.isEditBuyForm)("outletID",n.outletID)("outletName",n.outletName),l(4),c("outletID",n.outletID))},dependencies:[A,pe,qe,se,Ke,Xt,Zt,en,tn,nn,an,rn]})};var sn=class i{constructor(t,e){this.dialogRef=t;this.config.title="Discount and Tax",this.config.customWidth="400px";let n=e.discount;this.discountAmount=n.Amount,this.discountPercentage=n.Percentage;let o=e.tax;this.taxID=o.ID,this.taxRate=o.Rate,this.taxType=o.CalculationTypeName,this.taxLabel=o.Label,this.taxes=e.taxes.filter(s=>!s.Bin),this.currencySymbol=e.currencySymbol}config=new Te;tabIndexActive;discountAmount=0;discountPercentage=0;taxes=[];taxID="";taxRate=0;taxType="";taxLabel="";discounts=[];currencySymbol="";ok(){this.dialogRef.close({Discount:{Amount:this.discountAmount,Percentage:this.discountPercentage},Tax:{ID:this.taxID,Rate:this.taxRate,CalculationTypeName:this.taxType,Label:this.taxLabel,Discontinue:!1}})}close(){this.dialogRef.close()}calculateDiscountCalculator(){let t=100;this.discounts.forEach(e=>{t=t*(100-e)/100}),this.discountPercentage=100-t}updateTax(t){this.taxID=t.ID,this.taxRate=t.Rate,this.taxType=t.CalculationTypeName,this.taxLabel=t.Label}static \u0275fac=function(e){return new(e||i)(f(Oe),f($e))};static \u0275cmp=N({type:i,selectors:[["POS-modal-discount-and-tax"]],standalone:!0,features:[F],decls:48,vars:10,consts:[[3,"keydown.F2","onOk","onCancel","onClose","config"],[1,"container"],["matTooltipPosition","above","matTooltip","Discount","tabTitle","Discount"],[1,"row","d-flex","align-items-center","justify-content-start"],[1,"col-3"],[1,"fw-bold","d-block"],[1,"col-9"],["type","text","data-cy","discount1","autoNum","","percentage","","decimalPlaces","2",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","ngModel"],[1,"ms-1"],[1,"row","d-flex","align-items-center","justify-content-start","mt-6"],["type","text","data-cy","discountamount","autoNum","",1,"form-control","d-inline-block",2,"width","100px",3,"ngModelChange","ngModel"],["matTooltipPosition","above","matTooltip","Tax","tabTitle","Tax"],["bindLabel","Label","appendTo","body","bindValue","ID","placeholder","Tax","data-cy","Tax",2,"width","150px",3,"change","clearable","ngModel","items"],["matTooltipPosition","above","matTooltip","Calculation","tabTitle","Calculator"],[1,"row","mt-6","g-0","d-flex","align-items-center","justify-content-start"],[1,"col-4"],[1,"col-8","ps-4"],["type","text","data-cy","discountCal1","autoNum","","percentage","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],[1,"mx-2"],["type","text","data-cy","discountCal2","autoNum","","percentage","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"],["type","text","data-cy","discountCal3","autoNum","","percentage","",1,"form-control","d-inline-block",2,"width","47px",3,"ngModelChange","ngModel"]],template:function(e,n){e&1&&(r(0,"modal-material",0),b("keydown.F2",function(){return n.ok()})("onOk",function(){return n.ok()})("onCancel",function(){return n.close()})("onClose",function(){return n.close()}),r(1,"content")(2,"div",1)(3,"custom-tabs"),U(4),r(5,"tab",2)(6,"div",3)(7,"div",4)(8,"label",5),m(9,"Discount %"),a()(),r(10,"div",6)(11,"input",7),H("ngModelChange",function(s){return Q(n.discountPercentage,s)||(n.discountPercentage=s),s}),a(),r(12,"span",8),m(13,"%"),a()()(),r(14,"div",9)(15,"div",4)(16,"label",5),m(17),a()(),r(18,"div",6)(19,"input",10),H("ngModelChange",function(s){return Q(n.discountAmount,s)||(n.discountAmount=s),s}),a()()()(),W(),U(20),r(21,"tab",11)(22,"div",3)(23,"div",4)(24,"label",5),m(25,"Tax"),a()(),r(26,"div",6)(27,"ng-select",12),b("change",function(s){return n.updateTax(s)}),a()()()(),W(),U(28),r(29,"tab",13)(30,"div",14)(31,"div",15)(32,"label",5),m(33,"Discount Calculator"),a()(),r(34,"div",16)(35,"input",17),H("ngModelChange",function(s){return Q(n.discounts[0],s)||(n.discounts[0]=s),s}),b("ngModelChange",function(){return n.calculateDiscountCalculator()}),a(),r(36,"span"),m(37," %"),a(),r(38,"span",18),m(39,"+"),a(),r(40,"input",19),H("ngModelChange",function(s){return Q(n.discounts[1],s)||(n.discounts[1]=s),s}),b("ngModelChange",function(){return n.calculateDiscountCalculator()}),a(),r(41,"span"),m(42," %"),a(),r(43,"span",18),m(44,"+"),a(),r(45,"input",20),H("ngModelChange",function(s){return Q(n.discounts[2],s)||(n.discounts[2]=s),s}),b("ngModelChange",function(){return n.calculateDiscountCalculator()}),a(),r(46,"span"),m(47," %"),a()()()(),W(),a()()()()),e&2&&(c("config",n.config),l(11),J("ngModel",n.discountPercentage),l(6),L("Discount ",n.currencySymbol,""),l(2),J("ngModel",n.discountAmount),l(8),c("clearable",!1)("ngModel",n.taxID)("items",n.taxes),l(8),J("ngModel",n.discounts[0]),l(5),J("ngModel",n.discounts[1]),l(5),J("ngModel",n.discounts[2]))},dependencies:[A,Pe,De,se,Me,_t,Ee,we,Oi,wi,Ti,at,rt,bt,vt,Dt,ht]})};var cn=class i{constructor(t){this.matDialog=t}taxes=[];currencySymbol="";discTax;disabled=!1;onChange=t=>{};onTouched=()=>{};writeValue(t){this.discTax=t}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}openModalDiscountAndTax(){this.matDialog.open(sn,{data:{discount:T({},this.discTax.Discount),tax:T({},this.discTax.Tax),taxes:this.taxes,currencySymbol:this.currencySymbol}}).afterClosed().pipe(R(t=>!!t)).subscribe(t=>{this.discTax.Discount=T({},t.Discount),this.discTax.Tax=T({},t.Tax),this.onChange(this.discTax)})}static \u0275fac=function(e){return new(e||i)(f(ie))};static \u0275cmp=N({type:i,selectors:[["POS-discount-and-tax-form"]],inputs:{taxes:"taxes",currencySymbol:"currencySymbol"},standalone:!0,features:[ke([{provide:Ge,multi:!0,useExisting:i}]),F],decls:2,vars:0,consts:[["type","button","matTooltip","Discount / Tax","matTooltipPosition","above",1,"btn","btn-success","fs-5",2,"border-right","0.1px solid #fff",3,"click"],[1,"fa-light","fa-percent"]],template:function(e,n){e&1&&(r(0,"button",0),b("click",function(){return n.openModalDiscountAndTax()}),S(1,"i",1),a())},dependencies:[A,bt,vt,Bt],styles:["button[_ngcontent-%COMP%]{border-right:.1px solid #fff;border-top-right-radius:0;border-bottom-right-radius:0;position:relative;flex:1 1 auto}"]})};var wt=i=>({selected:i}),zo=(i,t)=>({"col-sm-3":i,"col-sm-7":t}),Yo=i=>({"w-100":i});function Xo(i,t){if(i&1){let e=B();r(0,"div",11)(1,"label",12)(2,"input",13),H("ngModelChange",function(o){D(e);let s=d(2);return Q(s.tagID,o)||(s.tagID=o),x(o)}),a(),m(3),a()()}if(i&2){let e=t.$implicit,n=t.index,o=d(2);l(),hn("for","potype-"+n),c("ngClass",re(6,wt,o.tagID==e.ID)),l(),hn("id","potype-"+n),J("ngModel",o.tagID),c("value",e.ID),l(),L(" ",e.Name," ")}}function Zo(i,t){if(i&1&&(U(0),r(1,"div",9),I(2,Xo,4,8,"div",10),a(),W()),i&2){let e=d();l(2),c("ngForOf",e.supplierPOTypes)}}function ea(i,t){if(i&1){let e=B();U(0),r(1,"strong",14),m(2,"Supplier Bill Number"),a(),r(3,"input",15),H("ngModelChange",function(o){D(e);let s=d();return Q(s.invoiceNumber,o)||(s.invoiceNumber=o),x(o)}),a(),W()}if(i&2){let e=d();l(3),J("ngModel",e.invoiceNumber)}}function ta(i,t){if(i&1){let e=B();U(0),r(1,"div",16)(2,"POS-tinymce-editor",17),H("valueChange",function(o){D(e);let s=d();return Q(s.note,o)||(s.note=o),x(o)}),a()(),W()}if(i&2){let e=d();l(2),J("value",e.note)}}function na(i,t){if(i&1){let e=B();r(0,"div",28)(1,"span",29),m(2,"@"),a(),r(3,"input",30),H("ngModelChange",function(o){D(e);let s=d(2);return Q(s.exchangeRate,o)||(s.exchangeRate=o),x(o)}),a()()}if(i&2){let e=d(2);l(3),J("ngModel",e.exchangeRate)}}function ia(i,t){if(i&1){let e=B();U(0),r(1,"div",18)(2,"div",19)(3,"div",20),m(4," Currency : "),a(),r(5,"div",21)(6,"ng-select",22),H("ngModelChange",function(o){D(e);let s=d();return Q(s.currencyID,o)||(s.currencyID=o),x(o)}),a()(),I(7,na,4,1,"div",23),a()(),r(8,"div",24)(9,"div",25),m(10," Term : "),a(),r(11,"div",26)(12,"ng-select",27),H("ngModelChange",function(o){D(e);let s=d();return Q(s.note,o)||(s.note=o),x(o)}),a()()(),W()}if(i&2){let e=d();l(5),c("ngClass",Vt(9,zo,e.currencyID!=e.defaultCurrencyID,e.currencyID==e.defaultCurrencyID)),l(),c("ngClass",re(12,Yo,e.currencyID==e.defaultCurrencyID))("items",e.currencies),J("ngModel",e.currencyID),c("clearable",!1),l(),c("ngIf",e.currencyID!=e.defaultCurrencyID),l(5),c("items",e.predefinedNotes),J("ngModel",e.note),c("clearable",!1)}}var pn=class i{constructor(t,e){this.dialogRef=t;this.config=new Te,this.config.title="Purchase Order Note",this.config.customWidth="700px",this.note=e.note,this.tagID=e.tagID,this.currencyID=e.currencyID,this.exchangeRate=e.currencies.find(n=>n.ID==this.currencyID).ExchangeRate,this.supplierPOTypes=e.supplierPOTypes,this.predefinedNotes=e.predefinedNotes,this.currencies=e.currencies,this.defaultCurrencyID=e.defaultCurrencyID,this.invoiceNumber=e.invoiceNumber,O.IsEmpty(this.tagID)&&(this.tagID=this.supplierPOTypes[0]?.ID)}supplierPOTypes;predefinedNotes;currencies;currencyID;note;tagID;defaultCurrencyID;exchangeRate=0;invoiceNumber;tabState="Note";config;ok(){this.dialogRef.close({Note:this.note,TagID:this.tagID,Currency:$(T({},this.currencies.find(t=>t.ID==this.currencyID)),{ExchangeRate:this.exchangeRate}),InvoiceNumber:this.invoiceNumber})}close(){this.dialogRef.close()}onTabChange(t){this.tabState=t}static \u0275fac=function(e){return new(e||i)(f(Oe),f($e))};static \u0275cmp=N({type:i,selectors:[["POS-modal-note"]],standalone:!0,features:[F],decls:18,vars:17,consts:[[3,"onCancel","onClose","onOk","config"],[1,"container-fluid"],[1,"row","border-bottom"],["data-cy","note",1,"btn","btn-link",3,"click","ngClass"],["data-cy","type",1,"btn","btn-link",3,"click","ngClass"],["data-cy","number",1,"btn","btn-link",3,"click","ngClass"],["data-cy","other",1,"btn","btn-link",3,"click","ngClass"],[1,"row","mt-8"],[4,"ngIf"],[1,"col-12"],["class","rad-btn",4,"ngFor","ngForOf"],[1,"rad-btn"],[3,"for","ngClass"],["type","radio",3,"ngModelChange","ngModel","value","id"],[1,"mb-2","ps-0"],["type","text","placeholder","Same as Purchase Order Number when blank",1,"form-control","w-50",3,"ngModelChange","ngModel"],[1,"col-12","tinymce"],[3,"valueChange","value"],[1,"col-7","pe-0"],[1,"row"],[1,"col-sm-3","d-flex","align-items-center"],[1,"ps-0",3,"ngClass"],["bindLabel","Name","bindValue","ID","placeholder","Outlet","appendTo","body",2,"width","80px",3,"ngModelChange","ngClass","items","ngModel","clearable"],["class","col-sm-4 d-flex",4,"ngIf"],[1,"col-5","d-flex","align-items-center","ps-0"],[1,"col-sm-2"],[1,"col-sm-10"],["bindLabel","Label","bindValue","Description","placeholder","Term","appendTo","body",3,"ngModelChange","items","ngModel","clearable"],[1,"col-sm-4","d-flex"],[1,"pt-4"],["type","text","autoNum","",1,"border","border-light",2,"width","100px",3,"ngModelChange","ngModel"]],template:function(e,n){e&1&&(r(0,"modal-material",0),b("onCancel",function(){return n.close()})("onClose",function(){return n.close()})("onOk",function(){return n.ok()}),r(1,"content")(2,"div",1)(3,"div",2)(4,"div")(5,"a",3),b("click",function(){return n.onTabChange("Note")}),m(6," Note "),a(),r(7,"a",4),b("click",function(){return n.onTabChange("Tag")}),m(8," Tag "),a(),r(9,"a",5),b("click",function(){return n.onTabChange("Number")}),m(10," Number "),a(),r(11,"a",6),b("click",function(){return n.onTabChange("Other")}),m(12," Other "),a()()(),r(13,"div",7),I(14,Zo,3,1,"ng-container",8)(15,ea,4,1,"ng-container",8)(16,ta,3,1,"ng-container",8)(17,ia,13,14,"ng-container",8),a()()()()),e&2&&(c("config",n.config),l(5),c("ngClass",re(9,wt,n.tabState=="Note")),l(2),c("ngClass",re(11,wt,n.tabState=="Tag")),l(2),c("ngClass",re(13,wt,n.tabState=="Number")),l(2),c("ngClass",re(15,wt,n.tabState=="Other")),l(3),c("ngIf",n.tabState=="Tag"),l(),c("ngIf",n.tabState=="Number"),l(),c("ngIf",n.tabState=="Note"),l(),c("ngIf",n.tabState=="Other"))},dependencies:[A,it,He,pe,Pe,De,ei,se,Me,_t,Dt,ht,Jt,Wt,at,rt,Ee,we],styles:[".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}content[_ngcontent-%COMP%] > div.container-fluid[_ngcontent-%COMP%]{min-height:200px}.tinymce[_ngcontent-%COMP%] a[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{z-index:2;position:absolute;right:15px;bottom:19px}.tinymce[_ngcontent-%COMP%] editor[_ngcontent-%COMP%]{height:max-content;z-index:1}.rad-btn[_ngcontent-%COMP%]{position:relative;display:inline-block}.rad-btn[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{border:1px solid #dddddd;border-radius:3px;margin-right:10px;cursor:pointer;padding:10px;margin-bottom:10px;color:#000}.rad-btn[_ngcontent-%COMP%] input[type=radio][_ngcontent-%COMP%]{visibility:hidden;position:absolute;left:0;top:0}.rad-btn[_ngcontent-%COMP%] label.selected[_ngcontent-%COMP%]{background:#dcdcdc;border:1px solid #dcdcdc}.btn-link[_ngcontent-%COMP%]{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.selected[_ngcontent-%COMP%]{color:#3b3b3b;border-bottom:4px solid #07a519}a.btn.btn-link[_ngcontent-%COMP%]{color:inherit}"]})};var mn=class i{constructor(t){this.matDialog=t}supplierPOTypes;predefinedNotes;defaultCurrencyID;currencies;note;disabled=!1;onChange=t=>{};onTouched=()=>{};writeValue(t){this.note=t}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}openModalNote(){this.matDialog.open(pn,{data:{note:this.note.Note,tagID:this.note.TagID,exchangeRate:this.note.Currency.ExchangeRate,currencyID:this.note.Currency.ID,supplierPOTypes:this.supplierPOTypes,predefinedNotes:this.predefinedNotes,currencies:this.currencies,defaultCurrencyID:this.defaultCurrencyID,invoiceNumber:this.note.InvoiceNumber}}).afterClosed().pipe(R(t=>!!t)).subscribe(t=>{this.note=t,this.onChange(t)})}static \u0275fac=function(e){return new(e||i)(f(ie))};static \u0275cmp=N({type:i,selectors:[["POS-note-form"]],inputs:{supplierPOTypes:"supplierPOTypes",predefinedNotes:"predefinedNotes",defaultCurrencyID:"defaultCurrencyID",currencies:"currencies"},standalone:!0,features:[ke([{provide:Ge,multi:!0,useExisting:i}]),F],decls:2,vars:0,consts:[["type","button",1,"btn","btn-gray","w-100","h-100","fs-3","px-0","py-6","headings-font-family",3,"click"],[1,"fa-regular","fa-note-sticky","fa-xl"]],template:function(e,n){e&1&&(r(0,"button",0),b("click",function(){return n.openModalNote()}),S(1,"i",1),a())},dependencies:[A],styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}"]})};function oa(i,t){if(i&1){let e=B();U(0),r(1,"div",12)(2,"div",13)(3,"h5"),m(4,"Add inventory to outlet"),a()(),r(5,"div",14)(6,"ng-select",15),H("ngModelChange",function(o){D(e);let s=d();return Q(s.deliveryEntityID,o)||(s.deliveryEntityID=o),x(o)}),a()()(),W()}if(i&2){let e=d();l(6),c("clearable",!1),J("ngModel",e.deliveryEntityID),c("items",e.outlets)("disabled",e.isEdit)}}function aa(i,t){i&1&&(r(0,"div",16)(1,"div",17)(2,"h5",18),m(3," Unfulfilled order, product inventory is awaiting "),a()()())}var dn=class i{constructor(t,e,n){this.dialogRef=t;this.datePipe=e;this.config=new Te,this.config.title="Purchase Order Fulfillment",this.config.customWidth="590px",this.isEdit=n.isEdit,this.deliveryEntityID=n.deliveryEntityID,this.outlets=n.outlets,this.fulfillmentDate=n.fulfillmentDate,this.appConfigJSON=n.appConfigJSON,O.IsNotEmpty(this.deliveryEntityID)?this.tabState="Now":this.tabState="Later"}isEdit=!1;outlets;deliveryEntityID;tabState="Now";config;fulfillmentDate;fulfillmentTime;fulfillmentDateTime;shippingDateLabel="Fulfillment Date";appConfigJSON;ok(){this.tabState=="Later"&&this.setCustomDateField(),this.dialogRef.close(this.deliveryEntityID)}close(){this.dialogRef.close()}setCustomDateField(){this.fulfillmentDate=this.fulfillmentDate?this.fulfillmentDate:new Date;let t=this.fulfillmentTime?this.datePipe.transform(this.fulfillmentTime,"HH:mm"):"00:00",e=this.datePipe.transform(this.fulfillmentDate,"d MMM y");this.fulfillmentDateTime=`${e} ${t}`}onChangeTab(t){t=="Now"?(this.fulfillmentDate=null,this.deliveryEntityID=this.outlets[0]?.ID):(this.deliveryEntityID=O.GuidEmpty,this.fulfillmentDate=new Date)}static \u0275fac=function(e){return new(e||i)(f(Oe),f(Hn),f($e))};static \u0275cmp=N({type:i,selectors:[["POS-modal-fulfillment"]],standalone:!0,features:[F],decls:21,vars:4,consts:[["LATER",""],[3,"onOk","onCancel","onClose","config"],[1,"container"],[1,"row","align-items-start","py-2","my-2"],[1,"col"],["name","fontStyle","aria-label","Font Style",1,"fulfillment-tab",3,"ngModelChange","change","ngModel"],["data-cy","Now","value","Now"],[1,"p-7","me-2"],[1,"text-body-secondary","tabDesc"],["data-cy","Later","value","Later"],[1,"p-7"],[4,"ngIf","ngIfElse"],[1,"row","align-items-center","mt-5"],[1,"col-auto"],[1,"col","d-flex","justify-content-end"],["appendTo","body","bindLabel","Name","bindValue","ID","placeholder","Outlet","data-cy","DeductInventory",1,"tall","auto-grow",2,"width","250px",3,"ngModelChange","clearable","ngModel","items","disabled"],[1,"row","mt-8"],[1,"col-12","pe-0"],[1,"bg-gradient-warning","text-center","py-7","rounded-3","border","mb-7"]],template:function(e,n){if(e&1){let o=B();r(0,"modal-material",1),b("onOk",function(){return D(o),x(n.ok())})("onCancel",function(){return D(o),x(n.close())})("onClose",function(){return D(o),x(n.close())}),r(1,"content")(2,"div",2)(3,"div",3)(4,"div",4)(5,"mat-button-toggle-group",5),H("ngModelChange",function(P){return D(o),Q(n.tabState,P)||(n.tabState=P),x(P)}),b("change",function(P){return D(o),x(n.onChangeTab(P.value))}),r(6,"mat-button-toggle",6)(7,"h3",7),m(8," Now "),r(9,"small",8)(10,"em"),m(11,"(in store purchase)"),a()()()(),r(12,"mat-button-toggle",9)(13,"h3",10),m(14," Later "),r(15,"small",8)(16,"em"),m(17,"(shipped to customer address)"),a()()()()()()(),I(18,oa,7,4,"ng-container",11)(19,aa,4,0,"ng-template",null,0,ve),a()()()}if(e&2){let o=ue(20);c("config",n.config),l(5),J("ngModel",n.tabState),l(13),c("ngIf",n.tabState=="Now")("ngIfElse",o)}},dependencies:[A,pe,Ee,we,Dt,ht,si,ri,li,Pe,se,Me,Lt,_i],styles:[".container[_ngcontent-%COMP%]{min-height:150px} .p-datepicker.p-component.p-datepicker-timeonly{z-index:99999!important}.tabDesc[_ngcontent-%COMP%]{font-size:80%;font-weight:400} mat-button-toggle-group.fulfillment-tab mat-pseudo-checkbox{display:none}"]})};var un=class i{constructor(t){this.matDialog=t}outlets;outletID;appConfigJSON;isEdit;deliveryEntityID;disabled=!1;onChange=t=>{};onTouched=()=>{};writeValue(t){this.deliveryEntityID=t}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this.disabled=t}openModalFulfillment(){this.matDialog.open(dn,{data:{deliveryEntityID:this.deliveryEntityID,outlets:this.outlets,appConfigJSON:this.appConfigJSON,isEdit:this.isEdit}}).afterClosed().pipe(R(t=>!!t)).subscribe(t=>{this.deliveryEntityID=t,this.onChange(t)})}isDeliveryEntityIDEmpty(){return O.IsEmpty(this.deliveryEntityID)&&O.IsNotEmpty(this.outletID)}static \u0275fac=function(e){return new(e||i)(f(ie))};static \u0275cmp=N({type:i,selectors:[["POS-fulfillment-form"]],inputs:{outlets:"outlets",outletID:"outletID",appConfigJSON:"appConfigJSON",isEdit:"isEdit"},standalone:!0,features:[ke([{provide:Ge,multi:!0,useExisting:i}]),F],decls:4,vars:2,consts:[["type","button",1,"btn","btn-gray","w-100","h-100","fs-3","px-0","py-6","headings-font-family",3,"click"],[1,"fa-solid","fa-dolly","me-3"]],template:function(e,n){e&1&&(r(0,"button",0),b("click",function(){return n.openModalFulfillment()}),S(1,"i",1),r(2,"span"),m(3,"Fulfillment"),a()()),e&2&&Ct("bg-gradient-warning",n.isDeliveryEntityIDEmpty())},dependencies:[A],styles:[".btn-gray[_ngcontent-%COMP%]{border:1px solid #d6d6d6;color:#545454!important;background:linear-gradient(to bottom,#fff,#eee)}"]})};var Ki=i=>({selected:i}),ra=i=>({active:i});function la(i,t){if(i&1){let e=B();r(0,"a",5),b("click",function(){D(e);let o=d();return x(o.isPayNow=!1)}),m(1," Later "),r(2,"span",9),m(3,"Take Credit"),a()()}if(i&2){let e=d();c("ngClass",re(1,Ki,!e.isPayNow))}}function sa(i,t){if(i&1){let e=B();r(0,"div",21)(1,"a",22),b("click",function(){let o=D(e).$implicit,s=d(3);return x(s.inputAmount=o)}),m(2),g(3,"number"),a()()}if(i&2){let e=t.$implicit,n=d(3);l(),c("ngClass",re(5,ra,n.paymentMethodID==n.cashPaymentID&&n.inputAmount==e)),l(),Je("",n.currencySymbol," ",y(3,3,e),"")}}function ca(i,t){if(i&1&&(r(0,"div",25),m(1),g(2,"number"),a()),i&2){let e=d(4);c("ngClass",e.inputAmount>e.amountToPay?"success":"danger"),l(),Je(" ",e.currencySymbol," ",y(2,3,e.inputAmount-e.amountToPay)," ")}}function pa(i,t){if(i&1){let e=B();U(0),r(1,"input",23),H("ngModelChange",function(o){D(e);let s=d(3);return Q(s.inputAmount,o)||(s.inputAmount=o),x(o)}),b("click",function(){D(e);let o=d(3);return o.paymentMethodID=o.cashPaymentID,o.paymentMethodState="Cash",x(o.paymentMethodName="Cash")}),a(),I(2,ca,3,5,"div",24),W()}if(i&2){let e=d(3);l(),J("ngModel",e.inputAmount),l(),c("ngIf",e.inputAmount!=e.amountToPay)}}function ma(i,t){if(i&1){let e=B();r(0,"div",26),b("click",function(){D(e);let o=d(3);return o.paymentMethodID=o.cashPaymentID,x(o.paymentMethodState="Cash")}),S(1,"input",27),a()}if(i&2){let e=d(3);l(),c("value",e.currencySymbol+" -")}}function da(i,t){if(i&1&&(r(0,"div",12)(1,"div",13),S(2,"i",14),m(3," Cash "),a(),r(4,"div",15)(5,"div",16)(6,"div",17),I(7,sa,4,7,"div",18),a(),r(8,"div",19),I(9,pa,3,2,"ng-container",20)(10,ma,2,1,"ng-template",null,0,ve),a()()()()),i&2){let e=ue(11),n=d(2);l(7),c("ngForOf",n.suggestedCash),l(2),c("ngIf",n.role.product.Cost)("ngIfElse",e)}}function ua(i,t){if(i&1){let e=B();r(0,"div",31)(1,"a",32),b("click",function(){let o=D(e).$implicit,s=d(3);return x(s.onSelectPaymentMethod(o.ID,"Card",o.Name))}),r(2,"span",33),S(3,"img",34),a(),r(4,"span",33),m(5),g(6,"limitText"),a()()()}if(i&2){let e=t.$implicit,n=d(3);l(),c("ngClass",n.paymentMethodID===e.ID?"active":""),l(),c("hidden",e.ImageUrl==null),l(),c("src",e.ImageUrl,nt),l(),c("hidden",e.ImageUrl!=null),l(),L(" ",Dn(6,5,e.Name,20)," ")}}function fa(i,t){if(i&1){let e=B();r(0,"div",35)(1,"div",36)(2,"input",37),H("ngModelChange",function(o){D(e);let s=d(3);return Q(s.paymentNote,o)||(s.paymentNote=o),x(o)}),a(),r(3,"input",38),H("ngModelChange",function(o){D(e);let s=d(3);return Q(s.paymentCode,o)||(s.paymentCode=o),x(o)}),a()()()}if(i&2){let e=d(3);l(2),J("ngModel",e.paymentNote),l(),J("ngModel",e.paymentCode)}}function ga(i,t){if(i&1&&(r(0,"div",12)(1,"div",13),S(2,"i",28),m(3," Card "),a(),r(4,"div",15)(5,"div",16),I(6,ua,7,8,"div",29),a(),I(7,fa,4,2,"div",30),a()()),i&2){let e=d(2);l(6),c("ngForOf",e.cardPayments),l(),c("ngIf",e.paymentMethodState=="Card")}}function ya(i,t){if(i&1){let e=B();r(0,"div",31)(1,"a",32),b("click",function(){let o=D(e).$implicit,s=d(3);return x(s.onSelectPaymentMethod(o.ID,"Other",o.Name))}),m(2),g(3,"limitText"),a()()}if(i&2){let e=t.$implicit,n=d(3);l(),c("ngClass",n.paymentMethodID===e.ID?"active":""),l(),L(" ",Dn(3,2,e.Name,20)," ")}}function Ca(i,t){if(i&1){let e=B();r(0,"div",35)(1,"div",36)(2,"input",37),H("ngModelChange",function(o){D(e);let s=d(3);return Q(s.paymentNote,o)||(s.paymentNote=o),x(o)}),a(),r(3,"input",38),H("ngModelChange",function(o){D(e);let s=d(3);return Q(s.paymentCode,o)||(s.paymentCode=o),x(o)}),a()()()}if(i&2){let e=d(3);l(2),J("ngModel",e.paymentNote),l(),J("ngModel",e.paymentCode)}}function va(i,t){if(i&1&&(r(0,"div",39)(1,"div",13),m(2,"Others"),a(),r(3,"div",15)(4,"div",16),I(5,ya,4,5,"div",29),a(),I(6,Ca,4,2,"div",30),a()()),i&2){let e=d(2);l(5),c("ngForOf",e.otherPayments),l(),c("ngIf",e.paymentMethodState=="Other")}}function ba(i,t){if(i&1&&(r(0,"div"),I(1,da,12,3,"div",10)(2,ga,8,2,"div",10)(3,va,7,2,"div",11),a()),i&2){let e=d();l(),c("ngIf",e.isCashSuspended),l(),c("ngIf",e.cardPayments.length>0),l(),c("ngIf",e.otherPayments.length>0)}}function _a(i,t){if(i&1){let e=B();r(0,"div",40)(1,"div",41)(2,"h5",42),m(3,"Due"),a(),r(4,"datepicker",43),H("dateChange",function(o){D(e);let s=d();return Q(s.dueDate,o)||(s.dueDate=o),x(o)}),b("dateChange",function(){D(e);let o=d();return x(o.onChangeDueDate())}),a()(),r(5,"div",44)(6,"h5",42),m(7,"Days Due"),a(),r(8,"div",15)(9,"input",45),H("ngModelChange",function(o){D(e);let s=d();return Q(s.dueDays,o)||(s.dueDays=o),x(o)}),b("ngModelChange",function(){D(e);let o=d();return x(o.onChangeDueDay())}),a()()()()}if(i&2){let e=d();l(4),c("displayToggle",!1),J("date",e.dueDate),l(5),J("ngModel",e.dueDays)}}var fn=class i{constructor(t,e,n){this.dialogRef=t;this.role=n;this.isDefaultTabPayLater=e.payDefaultState==!1,this.config=new Te,this.config.title="Amount to Pay:",this.config.customWidth="650px",this.amountToPay=e.displayedAmountToPay,this.inputAmount=this.amountToPay,this.currencySymbol=e.currencySymbol,this.dueDate=e.dueDate,this.invoiceDate=e.invoiceDate,this.cashPaymentID=e.cashPaymentMethodID,this.cardPayments=e.cardPayments,this.otherPayments=e.otherPayments,this.paymentMethodID=e.paymentMethodID;let o=this.cardPayments.find(P=>P.ID==this.paymentMethodID);O.IsNotEmpty(o)&&(this.paymentMethodState="Card",this.paymentMethodName=o.Name);let s=this.otherPayments.find(P=>P.ID==this.paymentMethodID);O.IsNotEmpty(s)&&(this.paymentMethodState="Other",this.paymentMethodName=s.Name),this.paymentNote=e.paymentNote,this.paymentCode=e.paymentCode,this.isPayNow=e.payDefaultState,e.isEdit&&(this.isPayNow=!e.isUnpaidOnEdit),this.onChangeDueDate(),this.dueDays=e.dueDays,this.isCashSuspended=e.isCashSuspended,this.denomination=e.denomination,this.suggestedCash[0]=this.inputAmount,this.denomination.filter(P=>P>this.inputAmount).forEach(P=>{this.suggestedCash.length<3&&this.suggestedCash.push(P)}),console.log(this.suggestedCash)}config;isPayNow=!0;paymentMethodName="Cash";amountToPay=0;inputAmount=0;currencySymbol="";dueDate;dueDays;invoiceDate;cardPayments;otherPayments;cashPaymentID;paymentMethodID;paymentMethodState="Cash";paymentNote;paymentCode;displayedAmountToPay;denomination;suggestedCash=[];isCashSuspended;isDefaultTabPayLater=!1;ok(){let t={paymentMethodName:this.paymentMethodName};this.isPayNow?(t.amount=this.inputAmount,t.paymentMethodID=this.paymentMethodID,t.paymentNote=this.paymentNote,t.paymentCode=this.paymentCode,t.payState="Now"):(t.dueDate=this.dueDate,t.payState="Later"),this.dialogRef.close(t)}close(){this.dialogRef.close()}onSelectPaymentMethod(t,e,n){this.paymentMethodName=n,this.paymentMethodID==t?(this.paymentMethodID=this.cashPaymentID,this.paymentMethodState="Cash"):(this.paymentMethodID=t,this.paymentMethodState=e)}onChangeDueDay(){let t=new Date(O.cloneObject(this.invoiceDate));t.setDate(t.getDate()+this.dueDays),t.setHours(0,0,0,0),this.dueDate=t}onChangeDueDate(){this.dueDays=O.differentInDays(typeof this.invoiceDate=="string"?new Date(this.invoiceDate):this.invoiceDate,typeof this.dueDate=="string"?new Date(this.dueDate):this.dueDate)+1}static \u0275fac=function(e){return new(e||i)(f(Oe),f($e),f(xe))};static \u0275cmp=N({type:i,selectors:[["POS-modal-pay"]],standalone:!0,features:[F],decls:14,vars:10,consts:[["HIDDENCOST",""],[3,"onOk","onCancel","onClose","config"],[1,"mt-1","ms-2"],[1,"container","w-100","h-100"],[1,"row","border-bottom"],[1,"btn","btn-link",3,"click","ngClass"],[1,"btn","btn-link",3,"ngClass"],[4,"ngIf"],["class","py-4",4,"ngIf"],[1,"fst-italic",2,"font-size","10px"],["class","row border-bottom py-5",4,"ngIf"],["class","row py-5",4,"ngIf"],[1,"row","border-bottom","py-5"],[1,"col-3","h5","pt-5"],[1,"fa-solid","fa-money-bill-wave"],[1,"col-9"],[1,"row"],[1,"row","mb-5"],["class","col-4 pe-0 ps-4",4,"ngFor","ngForOf"],[1,"col","pe-0","me-10","position-relative"],[4,"ngIf","ngIfElse"],[1,"col-4","pe-0","ps-4"],[1,"btn","btn-outline-info","px-1","py-6","w-100",3,"click","ngClass"],["id","cashInput","type","text","placeholder","Custom Cash Amount","autoNum","",1,"form-control","form-control-lg","py-3","mb-3","px-6",3,"ngModelChange","click","ngModel"],["class","change",3,"ngClass",4,"ngIf"],[1,"change",3,"ngClass"],[3,"click"],["id","cashInput","type","text","placeholder","Custom Cash Amount","disabled","",1,"form-control","form-control-lg","py-3","mb-3","px-6",3,"value"],[1,"fa-regular","fa-credit-card"],["class","col-auto pe-0",4,"ngFor","ngForOf"],["class","position-relative row",4,"ngIf"],[1,"col-auto","pe-0"],[1,"btn","btn-outline-info","mb-3","px-6",3,"click","ngClass"],[3,"hidden"],[2,"width","40px",3,"src"],[1,"position-relative","row"],[1,"paymentNote","col","row","g-0","pt-2","ms-6"],["type","text","placeholder","Payment Note",1,"form-control","w-50","border-end-0","py-6","col-6",3,"ngModelChange","ngModel"],["type","text","placeholder","Payment Code",1,"form-control","w-50","border-start-0","py-6","paymentCode","col-6",3,"ngModelChange","ngModel"],[1,"row","py-5"],[1,"py-4"],[1,"row","d-flex","align-items-center","g-0","later-payment"],[1,"col-3","fw-normal"],["appearance","fill","readOnly","true","name","orderDate",1,"col-9",3,"dateChange","displayToggle","date"],[1,"row","d-flex","align-items-center","g-0","later-payment","mt-10"],["type","text","autofocus","","autoNum","",1,"py-8","ps-8","form-control",3,"ngModelChange","ngModel"]],template:function(e,n){e&1&&(r(0,"modal-material",1),b("onOk",function(){return n.ok()})("onCancel",function(){return n.close()})("onClose",function(){return n.close()}),r(1,"header")(2,"div",2),m(3),g(4,"number"),a()(),r(5,"content")(6,"div",3)(7,"div",4)(8,"div")(9,"a",5),b("click",function(){return n.isPayNow=!0}),m(10," Now "),a(),I(11,la,4,3,"a",6),a()()(),I(12,ba,4,3,"div",7)(13,_a,10,3,"div",8),a()()),e&2&&(c("config",n.config),l(3),L(" ",n.currencySymbol+" "+y(4,6,n.amountToPay)," "),l(6),c("ngClass",re(8,Ki,n.isPayNow)),l(2),dt(n.amountToPay!=0||n.isDefaultTabPayLater?11:-1),l(),c("ngIf",n.isPayNow),l(),c("ngIf",!n.isPayNow))},dependencies:[A,it,He,pe,Re,Pe,De,se,Me,Lt,bi,Ee,we,ai,at,rt],styles:['.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}.change[_ngcontent-%COMP%]{position:absolute;top:0;height:40px;background:#89b03e;color:#fff;right:0;padding:0 10px;line-height:40px;font-size:16px}.change[_ngcontent-%COMP%]:before{content:"\\a";border-style:solid;border-width:40px 24px 0 0;border-color:transparent #89b03e transparent transparent;position:absolute;left:-24px}.change.danger[_ngcontent-%COMP%]{background:#c9302c}.change.danger[_ngcontent-%COMP%]:before{border-color:transparent #c9302c transparent transparent}.paymentNote[_ngcontent-%COMP%]:before{z-index:10;content:"";position:absolute;top:4px;left:calc(50% - 10px);height:90%;width:10px;background-color:inherit;border-right:1px solid lightgray;-webkit-transform:skewX(-10deg);-moz-transform:skewX(-10deg);-ms-transform:skewX(-10deg);transform:skew(-10deg)}.btn-link[_ngcontent-%COMP%]{padding-top:0;color:#868686;padding-bottom:8px;border-radius:unset;font-family:Roboto Slab,serif}.btn-link.selected[_ngcontent-%COMP%]{color:#3b3b3b;border-bottom:4px solid #07a519} .later-payment.date-picker .mat-mdc-form-field{font-size:4px}.ng-select.ng-select-width[_ngcontent-%COMP%] .ng-select-container{width:160px;max-width:160px}input[type=text][_ngcontent-%COMP%]:disabled{background:#dadada}.later-payment[_ngcontent-%COMP%] strong{font-size:20px}.later-payment[_ngcontent-%COMP%] input{font-size:20px}.later-payment[_ngcontent-%COMP%] .mat-mdc-form-field{width:100%;font-size:20px;border:1px solid #c8d3df}.later-payment[_ngcontent-%COMP%] .mat-mdc-form-field .mat-mdc-icon-button, .later-payment[_ngcontent-%COMP%] .mat-mdc-form-field .mat-mdc-button-persistent-ripple, .later-payment[_ngcontent-%COMP%] .mat-mdc-form-field .mat-mdc-form-field-icon-suffix{outline:none!important}']})};var Ye=class i{constructor(t,e){this.form=e;let n=e.discountAndTaxForm.valueChanges;this.currency$=e.noteForm.valueChanges.pipe(u(_=>_.Currency),te(1),ee()),this.currencySymbol$=this.currency$.pipe(u(_=>_.Symbol),ee());let o=t.cart$.pipe(E(console.log),u(_=>_.map(j=>j.Total)),u(_=>_.reduce((j,z)=>j+z,0)),te(1),ee()),s=t.cart$.pipe(u(_=>_.filter(j=>j.Taxable).map(j=>j.Total)),u(_=>_.reduce((j,z)=>j+z,0)),te(1),ee());this.displayedAmount$=o,this.displayedDiscountPercentage$=Ie(this.displayedAmount$,n.pipe(u(_=>_.Discount.Percentage))).pipe(u(([_,j])=>({label:`Discount ${j}%`,value:_*(j/100)})),pt({label:"",value:0}),te(1),ee()),this.displayedDiscountAmount$=Ie(this.currencySymbol$,n.pipe(u(_=>_.Discount.Amount))).pipe(u(([_,j])=>({label:`Discount ${_}`,value:j})),pt({label:"",value:0}),te(1),ee()),this.displayedTax$=Ie(s,this.displayedDiscountPercentage$.pipe(u(_=>_.value)),this.displayedDiscountAmount$.pipe(u(_=>_.value)),n.pipe(u(_=>_.Tax))).pipe(R(([,,,_])=>!!_.Label),u(([_,j,z,h])=>({amountAfterDiscount:_-j-z,tax:h})),u(_=>{let j=_.amountAfterDiscount,z=_.tax;return{label:z.Label,tax:{id:z.ID,value:z.CalculationTypeName=="Add"?j*(z.Rate/100):z.Rate/(100+z.Rate)*j,type:z.CalculationTypeName,rate:z.Rate}}}),E(_=>e.setTaxAmount(_.tax.value)),pt({label:"",tax:{id:"",value:0,type:"",rate:0}}),te(1),ee());let P=t.totalVariantOrdered$;this.amountAfterDiscountAndTax$=Ie(this.displayedAmount$,this.displayedDiscountPercentage$.pipe(u(_=>_.value)),this.displayedDiscountAmount$.pipe(u(_=>_.value)),this.displayedTax$.pipe(u(_=>_.tax)),t.cart$.pipe(u(_=>_.length))).pipe(u(([_,j,z,h,k])=>k?_-j-z+(h.type=="Add"?h.value:0):0),ee()).pipe(te(1)),this.amountAfterDiscountAndTax$.subscribe()}paymentMethodName=mt("Cash");displayedAmount$;displayedDiscountPercentage$;displayedDiscountAmount$;displayedTax$;currency$;currencySymbol$;amountAfterDiscountAndTax$;get amountToPay(){return this.form.buyForm.controls.Payment.controls.Amount.value}get methodID(){return this.form.buyForm.controls.Payment.controls.MethodID.value}get code(){return this.form.buyForm.controls.Payment.controls.Code.value}get note(){return this.form.buyForm.controls.Payment.controls.Note.value}static \u0275fac=function(e){return new(e||i)(K(oe),K(q))};static \u0275prov=ae({token:i,factory:i.\u0275fac,providedIn:"root"})};function ha(i,t){if(i&1&&(r(0,"div"),m(1),g(2,"number"),a()),i&2){let e=d();l(),L(" ",y(2,1,e.amountToPayRounded)," ")}}function Da(i,t){i&1&&m(0," - ")}var gn=class i{constructor(t,e,n,o,s,P,_,j,z,h,k){this.matDialog=t;this.toastr=e;this.form=n;this.cart=o;this.http=s;this.complete=P;this.role=_;this.load=j;this.posMath=z;this.math=h;this.paymentService=k}cartLength;amountToPay;currencySymbol;dueDate;cashPayments;cardPayments;otherPayments;paymentMethodID;paymentNote;paymentCode;defaultDueDays;invoiceDate;dueDays;appConfigJSON;isUnpaidOnEdit;isEditBuyForm;totalVariantOrdered;isCashSuspended;denomination;pay(){if(this.cartLength==0){this.toastr.info("You must have at least one item",Ne.Info);return}if(this.form.discountAndTaxForm.value.Tax.Discontinue){this.toastr.info(`Cannot find the ${this.form.discountAndTaxForm.value.Tax.Label}, Set the tax discontinue status to \u201CNo\u201D to use tax or choose another tax type`,Ne.Info);return}let t=O.IsEmpty(this.form.buyForm.controls.Order.controls.SupplierID.value);if(this.appConfigJSON.ModuleBuy.Header.SupplierRequired&&t){this.toastr.info("Supplier is required",Ne.Info);return}this.matDialog.open(fn,{data:{displayedAmountToPay:this.posMath.Round(this.amountToPay,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.RoundAlgorithm),amountToPay:this.posMath.Round(this.form.buyForm.controls.Payment.controls.Amount.value,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.RoundAlgorithm),currencySymbol:this.currencySymbol,dueDate:O.cloneObject(this.dueDate),dueDays:O.cloneObject(this.dueDays),cardPayments:this.cardPayments,otherPayments:this.otherPayments,cashPaymentMethodID:this.cashPayments[0]?.ID,paymentMethodID:this.paymentMethodID,paymentNote:this.paymentNote,paymentCode:this.paymentCode,invoiceDate:this.invoiceDate,payDefaultState:this.appConfigJSON.ModuleBuy.PaymentDialog.DefaultOption!=1,isUnpaidOnEdit:this.isUnpaidOnEdit,isEdit:this.isEditBuyForm,isCashSuspended:this.isCashSuspended,denomination:this.denomination}}).afterClosed().pipe(R(s=>!!s),u(s=>s)).pipe(E(s=>this.paymentService.paymentMethodName.set(s.paymentMethodName)),de(this.cart.cart$),u(([s,P])=>$(T({},s),{cart:P})),de(this.load.entities$),u(([s,P])=>$(T({},s),{entities:P})),de(this.load.supplierPOTypes$),u(([s,P])=>$(T({},s),{supplierPOTypes:P})),ne(s=>{O.IsEmpty(this.form.noteForm.value.TagID)&&this.form.setBulkNoteForm($(T({},this.form.noteForm.value),{TagID:s.supplierPOTypes[0]?.ID}));let P=this.form.buyForm.controls,_=P.Invoice.controls,j=P.Payment.controls,z=this.form.outlet.value,h=P.Order.controls,k=this.form.noteForm.value,p=this.form.discountAndTaxForm.value,M=j.Amount.value,G=this.form.deliveryEntityID.value,X={ID:_.ID.value,Due:s.payState=="Now"?void 0:_.Due.value,Tax:_.Tax.value,Sales:M??0,PaymentStateID:s.payState=="Now"?3:1,Number:k.InvoiceNumber?k.InvoiceNumber:h.Number.value},C=s.cart.map(w=>$(T({},w),{VariantID:O.IsEmpty(w.VariantID)?w.ID:w.VariantID}));this.isEditBuyForm&&(C=C.map(w=>$(T({},w),{QtyRequested:w.Quantity})));let v={EntityID:z.ID,SupplierID:h.SupplierID.value,Date:h.Date.value,CurrencyID:k.Currency.ID,CurrencyRate:k.Currency.ExchangeRate,Discount:p.Discount.Percentage,DiscountAmount:p.Discount.Amount,Note:k.Note,Att:h.Att.value,TaxTypeID:p.Tax.ID,TypeID:k.TagID,Number:h.Number.value,ID:h.ID.value};if(s.payState=="Now"){let w={MethodID:s.paymentMethodID,Code:s.paymentCode??"",Note:s.paymentNote??"",Amount:this.posMath.Round(s.amount,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingPurchaseDigit.RoundAlgorithm),Date:v.Date};s.amount<M?X.PaymentStateID=2:s.amount>M&&(X.PaymentStateID=5);let V={DeliveryEntityID:G,NewOrderID:this.isEditBuyForm?null:O.Guid_NewGuid(),Invoice:X,Order:v,Items:C,Payment:w};return this.http.post("/API/Buy/SubmitOrder2",V,1e4,!0).pipe(u(be=>$(T({},be),{differentNumber:be.InvoiceNumber!=v.Number})),he(be=>{throw be.error&&this.toastr.error(be.error.Message,"Order Submission Failed"),new Error(be)}))}else{let w={DeliveryEntityID:G,NewOrderID:this.isEditBuyForm?null:O.Guid_NewGuid(),Invoice:$(T({},X),{Due:s.dueDate}),Order:v,Items:C};return this.http.post("/API/Buy/SubmitOrder2",w,1e4,!0).pipe(u(V=>$(T({},V),{differentNumber:V.InvoiceNumber!=v.Number})),he(V=>{throw V.error&&this.toastr.error(V.error.Message,"Order Submission Failed"),new Error(V)}))}})).subscribe(s=>{this.complete.paymentComplete(s),s.differentNumber&&this.toastr.info(`Bill number has been changed to ${s.InvoiceNumber}`,"Bill Number Changed!")})}get amountToPayRounded(){return this.posMath.Round(this.amountToPay,this.appConfigJSON?.ApplicationMath?.RoundingPurchaseDigit?.DecimalPlaceValue,this.appConfigJSON?.ApplicationMath?.RoundingPurchaseDigit.RoundAlgorithm)}static \u0275fac=function(e){return new(e||i)(f(ie),f(ot),f(q),f(oe),f(ce),f(Qe),f(xe),f(ge),f(xn),f(xn),f(Ye))};static \u0275cmp=N({type:i,selectors:[["POS-pay-button"]],inputs:{cartLength:"cartLength",amountToPay:"amountToPay",currencySymbol:"currencySymbol",dueDate:"dueDate",cashPayments:"cashPayments",cardPayments:"cardPayments",otherPayments:"otherPayments",paymentMethodID:"paymentMethodID",paymentNote:"paymentNote",paymentCode:"paymentCode",defaultDueDays:"defaultDueDays",invoiceDate:"invoiceDate",dueDays:"dueDays",appConfigJSON:"appConfigJSON",isUnpaidOnEdit:"isUnpaidOnEdit",isEditBuyForm:"isEditBuyForm",totalVariantOrdered:"totalVariantOrdered",isCashSuspended:"isCashSuspended",denomination:"denomination"},standalone:!0,features:[F],decls:12,vars:8,consts:[["HIDDENCOST",""],["type","button",1,"btn","btn-success","fs-1","py-4",2,"border-left","0.1px solid #fff",3,"click"],[1,"d-flex","align-items-center","justify-content-between"],[1,"fs-6"],[4,"ngIf","ngIfElse"]],template:function(e,n){if(e&1){let o=B();r(0,"button",1),b("click",function(){return D(o),x(n.pay())}),r(1,"div",2)(2,"div")(3,"span"),m(4,"Pay"),a(),r(5,"small",3),m(6),g(7,"number"),g(8,"quantityFraction"),a()(),I(9,ha,3,3,"div",4)(10,Da,1,0,"ng-template",null,0,ve),a()()}if(e&2){let o=ue(11);l(6),Je(" (",y(7,4,n.cartLength)," Items & ",y(8,6,n.totalVariantOrdered)," Qty) "),l(3),c("ngIf",n.role.product.Cost)("ngIfElse",o)}},dependencies:[A,pe,Re,jt],styles:["button[_ngcontent-%COMP%]{border-right:.1px solid #fff;margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0;position:relative;flex:1 1 auto}"]})};var It=class i{noteForm;constructor(t){this.noteForm=t.noteForm}static \u0275fac=function(e){return new(e||i)(K(q))};static \u0275prov=ae({token:i,factory:i.\u0275fac,providedIn:"root"})};var Mt=class i{deliveryEntityID;constructor(t){this.deliveryEntityID=t.deliveryEntityID}static \u0275fac=function(e){return new(e||i)(K(q))};static \u0275prov=ae({token:i,factory:i.\u0275fac,providedIn:"root"})};var Pt=class i{dueDate$;dueDays$;constructor(t){let e=t.buyForm.controls.Invoice.controls.Due.valueChanges;this.dueDays$=t.dueDays.valueChanges,t.buyForm.controls.Order.controls.Date.valueChanges.pipe(de(this.dueDays$),E(([s,P])=>t.setDueDateBasedOnDaysDue(P))).subscribe(),this.dueDate$=e}static \u0275fac=function(e){return new(e||i)(K(q))};static \u0275prov=ae({token:i,factory:i.\u0275fac,providedIn:"root"})};function Ma(i,t){if(i&1&&(r(0,"tr")(1,"th",13),m(2,"Amount"),a(),r(3,"td",14),m(4),g(5,"number"),a()()),i&2){let e=d().ngIf;l(4),Z(y(5,1,e.displayedAmount))}}function Pa(i,t){if(i&1&&(r(0,"td",16),m(1),g(2,"number"),a()),i&2){let e=d(3).ngIf;l(),L(" ",y(2,1,e.displayedDiscountPercentage.value*-1),"")}}function Oa(i,t){if(i&1&&(r(0,"tr")(1,"th",13),m(2),a(),I(3,Pa,3,3,"td",15),a()),i&2){let e=d(2).ngIf,n=d();l(2),Z(e.displayedDiscountPercentage.label),l(),c("ngIf",n.role.product.Cost)}}function Ta(i,t){if(i&1&&(r(0,"td",16),m(1),g(2,"number"),a()),i&2){let e=d(3).ngIf;l(),Z(y(2,1,e.displayedDiscountAmount.value*-1))}}function wa(i,t){if(i&1&&(r(0,"tr")(1,"th",13),m(2),a(),I(3,Ta,3,3,"td",15),a()),i&2){let e=d(2).ngIf,n=d();l(2),Z(e.displayedDiscountAmount.label),l(),c("ngIf",n.role.product.Cost)}}function Ea(i,t){if(i&1&&(r(0,"td",14),m(1),g(2,"number"),a()),i&2){let e=d(3).ngIf;l(),Z(y(2,1,e.displayedTax.tax.value))}}function Na(i,t){if(i&1&&(r(0,"tr")(1,"th",13),m(2),a(),I(3,Ea,3,3,"td",17),a()),i&2){let e=d(2).ngIf,n=d();l(2),Z(e.displayedTax.label),l(),c("ngIf",n.role.product.Cost)}}function Fa(i,t){if(i&1&&(U(0),I(1,Oa,4,2,"tr",12)(2,wa,4,2,"tr",12)(3,Na,4,2,"tr",12),W()),i&2){let e=d().ngIf;l(),c("ngIf",e.displayedDiscountPercentage.value!=0),l(),c("ngIf",e.displayedDiscountAmount.value!=0),l(),c("ngIf",e.displayedTax.tax.value!=0)}}function Aa(i,t){if(i&1&&(r(0,"div",9)(1,"div",10)(2,"table",11),I(3,Ma,6,3,"tr",12)(4,Fa,4,3,"ng-container",12),g(5,"async"),a()()()),i&2){let e=t.ngIf,n=d();l(3),c("ngIf",n.showAmountWhenDiscountOrTaxIsApplied(e)&&e.displayedAmount&&n.role.product.Cost),l(),c("ngIf",y(5,2,n.cartLength$))}}var yn=class i{constructor(t,e,n,o,s,P,_,j,z,h){this.payment=t;this.form=o;this.role=j;this.taxes$=n.taxes$,this.defaultCurrencyID$=n.appConfigJSON$.pipe(u(X=>X.CoreDefaults.CurrencyID)),this.totalVariantOrdered$=e.totalVariantOrdered$,this.cartLength$=e.cart$.pipe(u(X=>X.length)),this.amountAfterDiscountAndTax$=t.amountAfterDiscountAndTax$,this.discountAndTaxForm=o.discountAndTaxForm;let k=t.displayedAmount$,p=t.displayedDiscountPercentage$,M=t.displayedDiscountAmount$,G=t.displayedTax$;this.displayedDiscountAndTax$=Ie({displayedAmount:k,displayedDiscountPercentage:p,displayedDiscountAmount:M,displayedTax:G}),this.deliveryEntityID=P.deliveryEntityID,this.noteForm=s.noteForm,this.currencies$=n.currencies$,this.currencySymbol$=t.currencySymbol$,this.supplierPOTypes$=n.supplierPOTypes$,this.predefinedNotes$=n.predefinedNotes$,this.outlets$=n.entities$,this.cashPayments$=h.cashPayments$,this.cardPayments$=h.cardPayments$,this.otherPayments$=h.otherPayments$,this.defaultDueDays$=n.defaultDueDays$,this.dueDate$=_.dueDate$,this.dueDays$=_.dueDays$,this.appConfigJSON$=n.appConfigJSON$,this.isUnpaidOnEdit$=Ie(z.isEdit$,z.isUnpaid$).pipe(u(([X,C])=>X&&C)),this.isEdit$=z.isEdit$,this.outlet=o.outlet,this.isCashSuspended$=h.isCashSuspended$,this.denomination$=n.denomination$}taxes$;totalVariantOrdered$;displayedDiscountAndTax$;discountAndTaxForm;deliveryEntityID;noteForm;amountAfterDiscountAndTax$;currencies$;currencySymbol$;supplierPOTypes$;predefinedNotes$;defaultCurrencyID$;outlets$;cashPayments$;cardPayments$;otherPayments$;defaultDueDays$;dueDate$;dueDays$;appConfigJSON$;isUnpaidOnEdit$;isEdit$;isCashSuspended$;outlet;cartLength$;denomination$;get amountToPay(){return this.payment.amountToPay}get invoiceDate(){return this.form.invoiceDate}get paymentMethodID(){return this.payment.methodID}get paymentNote(){return this.payment.note}get paymentCode(){return this.payment.code}showAmountWhenDiscountOrTaxIsApplied(t){return t.displayedDiscountPercentage.value!=0||t.displayedDiscountAmount.value!=0||t.displayedTax.tax.value!=0}static \u0275fac=function(e){return new(e||i)(f(Ye),f(oe),f(ge),f(q),f(It),f(Mt),f(Pt),f(xe),f(Le),f(ze))};static \u0275cmp=N({type:i,selectors:[["POS-cart-footer"]],standalone:!0,features:[F],decls:34,vars:83,consts:[["class","row g-0 px-5 justify-content-end",4,"ngIf"],[1,"row","g-0","pb-6","px-5"],[1,"col-5","d-flex","justify-content-between","pe-5",2,"column-gap","12px"],[2,"flex-grow","1",3,"supplierPOTypes","predefinedNotes","defaultCurrencyID","currencies","formControl"],[2,"flex-grow","3",3,"outlets","formControl","appConfigJSON","outletID","isEdit"],[1,"col-7"],[1,"btn-group","w-100"],[2,"display","inline-flex",3,"taxes","currencySymbol","formControl"],[1,"w-100",2,"display","inline-flex",3,"amountToPay","currencySymbol","dueDate","dueDays","cardPayments","otherPayments","paymentMethodID","paymentCode","paymentNote","defaultDueDays","invoiceDate","appConfigJSON","cashPayments","isUnpaidOnEdit","isEditBuyForm","cartLength","totalVariantOrdered","isCashSuspended","denomination"],[1,"row","g-0","px-5","justify-content-end"],[1,"col-6",2,"padding-right","15px"],[1,"table","table-borderless"],[4,"ngIf"],[1,"text-start"],[1,"text-end","fs-5"],["class","text-end fs-5 text-danger",4,"ngIf"],[1,"text-end","fs-5","text-danger"],["class","text-end fs-5",4,"ngIf"]],template:function(e,n){e&1&&(I(0,Aa,6,4,"div",0),g(1,"async"),r(2,"div",1)(3,"div",2),S(4,"POS-note-form",3),g(5,"async"),g(6,"async"),g(7,"async"),g(8,"async"),S(9,"POS-fulfillment-form",4),g(10,"async"),g(11,"async"),g(12,"async"),a(),r(13,"div",5)(14,"div",6),S(15,"POS-discount-and-tax-form",7),g(16,"async"),g(17,"async"),S(18,"POS-pay-button",8),g(19,"async"),g(20,"async"),g(21,"async"),g(22,"async"),g(23,"async"),g(24,"async"),g(25,"async"),g(26,"async"),g(27,"async"),g(28,"async"),g(29,"async"),g(30,"async"),g(31,"async"),g(32,"async"),g(33,"async"),a()()()),e&2&&(c("ngIf",y(1,33,n.displayedDiscountAndTax$)),l(4),c("supplierPOTypes",y(5,35,n.supplierPOTypes$))("predefinedNotes",y(6,37,n.predefinedNotes$))("defaultCurrencyID",y(7,39,n.defaultCurrencyID$))("currencies",y(8,41,n.currencies$))("formControl",n.noteForm),l(5),c("outlets",y(10,43,n.outlets$))("formControl",n.deliveryEntityID)("appConfigJSON",y(11,45,n.appConfigJSON$))("outletID",n.outlet.value.ID)("isEdit",y(12,47,n.isEdit$)),l(6),c("taxes",y(16,49,n.taxes$))("currencySymbol",y(17,51,n.currencySymbol$))("formControl",n.discountAndTaxForm),l(3),c("amountToPay",y(19,53,n.amountAfterDiscountAndTax$))("currencySymbol",y(20,55,n.currencySymbol$))("dueDate",y(21,57,n.dueDate$))("dueDays",y(22,59,n.dueDays$))("cardPayments",y(23,61,n.cardPayments$))("otherPayments",y(24,63,n.otherPayments$))("paymentMethodID",n.paymentMethodID)("paymentCode",n.paymentCode)("paymentNote",n.paymentNote)("defaultDueDays",y(25,65,n.defaultDueDays$))("invoiceDate",n.invoiceDate)("appConfigJSON",y(26,67,n.appConfigJSON$))("cashPayments",y(27,69,n.cashPayments$))("isUnpaidOnEdit",y(28,71,n.isUnpaidOnEdit$))("isEditBuyForm",y(29,73,n.isEdit$))("cartLength",y(30,75,n.cartLength$))("totalVariantOrdered",y(31,77,n.totalVariantOrdered$))("isCashSuspended",y(32,79,n.isCashSuspended$))("denomination",y(33,81,n.denomination$)))},dependencies:[A,pe,Ve,Re,cn,qe,se,Ke,mn,un,gn]})};var ka=i=>({"date-warning":i}),Va=()=>["/menu/Orders/Orders/Supplier_Bill/Info"],Ra=i=>({ID:i});function $a(i,t){if(i&1&&(U(0),m(1),g(2,"async"),g(3,"number"),W()),i&2){let e=d().$implicit,n=d();l(),Je(" ",y(2,2,n.currencySymbol$)," ",y(3,4,e.Total)," ")}}function Ba(i,t){i&1&&m(0," - ")}function ja(i,t){if(i&1&&(r(0,"div",28)(1,"div",29),m(2),a(),r(3,"div",30),I(4,$a,4,6,"ng-container",31)(5,Ba,1,0,"ng-template",null,0,ve),a()()),i&2){let e=t.$implicit,n=ue(6),o=d();l(2),Z(e.Name),l(2),c("ngIf",o.role.product.Cost)("ngIfElse",n)}}function La(i,t){if(i&1&&(U(0),r(1,"td",36),m(2),a(),r(3,"td",37),m(4),g(5,"async"),a(),r(6,"td",36),m(7),g(8,"number"),a(),W()),i&2){let e=d().ngIf,n=d(2);l(2),Z(e.label),l(2),L(" ",y(5,3,n.currencySymbol$)," "),l(3),Z(y(8,5,e.value))}}function Qa(i,t){if(i&1&&(r(0,"tr"),I(1,La,9,7,"ng-container",38),a()),i&2){let e=t.ngIf;l(),c("ngIf",e.value>0)}}function Ua(i,t){if(i&1&&(U(0),r(1,"td",36),m(2,"Discount:"),a(),r(3,"td",37),m(4),g(5,"async"),a(),r(6,"td",36),m(7),g(8,"number"),a(),W()),i&2){let e=d().ngIf,n=d(2);l(4),L(" ",y(5,2,n.currencySymbol$)," "),l(3),Z(y(8,4,e.value))}}function Wa(i,t){if(i&1&&(r(0,"tr"),I(1,Ua,9,6,"ng-container",38),a()),i&2){let e=t.ngIf;l(),c("ngIf",e.value>0)}}function Ja(i,t){if(i&1&&(U(0),r(1,"td",36),m(2),a(),r(3,"td",37),m(4),g(5,"async"),a(),r(6,"td",36),m(7),g(8,"number"),a(),W()),i&2){let e=d().ngIf,n=d(2);l(2),Z(e.label),l(2),L(" ",y(5,3,n.currencySymbol$)," "),l(3),Z(y(8,5,e.tax.value))}}function Ha(i,t){if(i&1&&(r(0,"tr"),I(1,Ja,9,7,"ng-container",38),a()),i&2){let e=t.ngIf;l(),c("ngIf",e.tax.value>0)}}function Ga(i,t){if(i&1&&(r(0,"div",32)(1,"div",33)(2,"table",34)(3,"tbody")(4,"tr",35)(5,"td",36),m(6,"Amount:"),a(),r(7,"td",37),m(8),g(9,"async"),a(),r(10,"td",36),m(11),g(12,"async"),g(13,"number"),a()(),I(14,Qa,2,1,"tr",38),g(15,"async"),I(16,Wa,2,1,"tr",38),g(17,"async"),I(18,Ha,2,1,"tr",38),g(19,"async"),r(20,"tr")(21,"td",36),m(22),a(),r(23,"td",37),m(24),g(25,"async"),a(),r(26,"td",36),m(27),g(28,"async"),g(29,"number"),a()()()()()()),i&2){let e=d();l(8),Z(y(9,8,e.currencySymbol$)),l(3),L(" ",y(13,12,y(12,10,e.displayedAmount$))," "),l(3),c("ngIf",y(15,14,e.displayedDiscountPercentage$)),l(2),c("ngIf",y(17,16,e.displayedDiscountAmount$)),l(2),c("ngIf",y(19,18,e.displayedTax$)),l(4),L(" ",e.payment.paymentMethodName(),": "),l(2),Z(y(25,20,e.currencySymbol$)),l(3),L(" ",y(29,24,y(28,22,e.displayedAmount$))," ")}}var Cn=class i{constructor(t,e,n,o,s,P,_,j){this.payment=t;this.form=e;this.cart=n;this.complete=o;this.load=s;this.router=P;this.outletInfo=_;this.role=j;this.displayedAmount$=t.displayedAmount$,this.displayedDiscountPercentage$=t.displayedDiscountPercentage$,this.displayedDiscountAmount$=t.displayedDiscountAmount$,this.displayedTax$=t.displayedTax$}data;displayedAmount$;displayedDiscountPercentage$;displayedDiscountAmount$;displayedTax$;currencySymbol$;createNewTransaction(){this.clearCart(),this.resetBuyForm(),this.updateDueDays(),this.updateTax(),this.updatePaymentMethodID(),this.complete.paymentComplete(null),this.complete.createNewTransaction(),this.router.navigate([],{queryParams:{ID:null}})}get amountToPay(){return this.payment.amountToPay}resetBuyForm(){this.form.resetNoteForm(),this.form.resetDiscountAndTaxForm(),this.form.resetDueDaysForm(),this.form.resetBuyForm()}clearCart(){this.cart.clearCart()}updateDueDays(){this.load.updateDueDays()}updateTax(){this.outletInfo.updateTax()}updatePaymentMethodID(){this.outletInfo.updatePaymentMethodID()}static \u0275fac=function(e){return new(e||i)(f(Ye),f(q),f(oe),f(Qe),f(ge),f(qn),f(ze),f(xe))};static \u0275cmp=N({type:i,selectors:[["POS-complete"]],inputs:{data:[0,"paymentComplete","data"]},standalone:!0,features:[F],decls:37,vars:16,consts:[["PRICE_HIDE",""],[1,"pt-7",2,"border-bottom","1px solid rgba(0, 0, 0, 0.1)"],[1,"ps-7","fw-normal","pb-7"],[1,"buy-complete"],[1,"container-fluid","pt-8"],[1,"row"],[1,"col-md-8"],[1,"card"],[1,"card-header"],[1,"d-flex","justify-content-between"],[1,"fa-solid","fa-check","me-1"],[1,"fst-italic"],[1,"card-body"],[1,"container"],[1,"row","mt-9","justify-content-center","g-0","mb-9"],[1,"col-9","text-center"],["type","button",1,"btn","btn-success","btn-lg","w-100","fs-2",3,"click"],[1,"card-footer","bg-light-gray"],[1,"row","justify-content-between","py-5"],[1,"col-auto"],["target","_blank",1,"btn","btn-light-gray",3,"href"],[1,"fa-solid","fa-print","me-2"],[1,"col-md-4"],[1,"card-header","bg-light-gray"],[1,"text-dark"],["target","_blank",1,"text-dark","fst-italic",3,"routerLink","queryParams"],["class","row my-1 p-5",4,"ngFor","ngForOf"],["class","card-footer pe-0 bg-white",4,"ngIf"],[1,"row","my-1","p-5"],[1,"col-8"],[1,"col-4","text-end"],[4,"ngIf","ngIfElse"],[1,"card-footer","pe-0","bg-white"],[1,"ms-auto"],[1,"table","table-borderless","mb-0","table-sm"],[2,"border-bottom","1px solid rgba(0, 0, 0, 0.1)"],[1,"text-end"],[1,"text-start"],[4,"ngIf"]],template:function(e,n){e&1&&(r(0,"div",1)(1,"h1",2),m(2,"New Purchase Order"),a()(),r(3,"section",3)(4,"div")(5,"div",4)(6,"div",5)(7,"div",6)(8,"div",7)(9,"div",8)(10,"div",9)(11,"h2"),S(12,"i",10),m(13," Purchase Complete "),r(14,"small",11),m(15),a()()()(),r(16,"div",12)(17,"div",13)(18,"div",14)(19,"div",15)(20,"button",16),b("click",function(){return n.createNewTransaction()}),m(21," New Purchase (F8) "),a()()()()(),r(22,"div",17)(23,"div",18)(24,"div",19)(25,"a",20),S(26,"i",21),m(27,"Print Receipt "),a()()()()()(),r(28,"div",22)(29,"div",7)(30,"div",23)(31,"h3",24)(32,"a",25),m(33),a()()(),I(34,ja,7,3,"div",26),g(35,"async"),I(36,Ga,30,26,"div",27),a()()()()()()),e&2&&(l(9),Qn(re(11,ka,n.data.PaymentStateID<3)),l(6),L(" (",n.data.PaymentStateLabel,") "),l(10),c("href",n.data.Message,nt),l(7),c("routerLink",kt(13,Va))("queryParams",re(14,Ra,n.data.InvoiceID)),l(),L(" Supplier Bill #",n.data.InvoiceNumber," "),l(),c("ngForOf",y(35,9,n.cart.cart$)),l(2),c("ngIf",n.role.product.Cost))},dependencies:[A,He,pe,Ve,Re,$t,Rt],styles:[".print_containers[_ngcontent-%COMP%]{display:none}@media print{.print_containers[_ngcontent-%COMP%]{display:block;text-align:left}.buy-complete[_ngcontent-%COMP%]{display:none}}.table-sm[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .table-sm[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:10px!important}.buy-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-header[_ngcontent-%COMP%]{border-bottom:1px solid rgba(0,0,0,.125);padding-bottom:.9375rem}.buy-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-header[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{font-size:2rem}.buy-complete[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] .card-body[_ngcontent-%COMP%] .container[_ngcontent-%COMP%]{max-width:500px;margin-top:30px;margin-bottom:30px}.table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{vertical-align:middle;line-height:15px!important}"]})};var Ka=["cartDisplayRef"];function qa(i,t){if(i&1&&(U(0),S(1,"POS-complete",3),W()),i&2){let e=t.ngIf;l(),c("paymentComplete",e)}}function za(i,t){if(i&1){let e=B();r(0,"div",4)(1,"div",5)(2,"div",6)(3,"div",7),S(4,"POS-select-outlet-form",8),g(5,"async"),g(6,"async"),g(7,"async"),S(8,"POS-invoice-number-form",9),g(9,"async"),S(10,"POS-invoice-date",10),a()(),r(11,"div",11)(12,"div",12)(13,"div",13),S(14,"POS-more-actions",14),g(15,"async"),g(16,"async"),a(),r(17,"div",15)(18,"div",16),S(19,"i",17)(20,"input",18),a()(),r(21,"div",19)(22,"div",20)(23,"button",21),g(24,"async"),b("click",function(){D(e);let o=d();return x(o.collapseSidebar())}),S(25,"span",22)(26,"span",22)(27,"span",22),a()()()()()(),r(28,"div",23)(29,"div",6),S(30,"POS-quick-key",24),g(31,"async"),a(),r(32,"div",25)(33,"div",26)(34,"div",27),S(35,"POS-variant-autocomplete",28),a(),r(36,"div",15),S(37,"POS-supplier-autocomplete",29),g(38,"async"),g(39,"async"),a()(),S(40,"POS-cart-display",30,1),g(42,"async"),g(43,"async"),g(44,"async"),S(45,"POS-cart-footer"),a()()()}if(i&2){let e=d();l(4),c("outlets",y(5,30,e.outlets$))("isOpenAfterLoad",y(6,32,e.isOpenDialogOutlet$))("formControl",e.outlet)("disabled",y(7,34,e.isEdit$)),l(4),c("formControl",e.poNumber)("isEdit",y(9,36,e.isEdit$)),l(2),c("formControl",e.date)("tooltip",e.role.global!=null&&e.role.global.Date?"":"Date role is required"),l(4),c("returnInvoiceNumber",e.returnInvoiceNumber)("appConfigJSON",y(15,38,e.appConfigJSON$))("isEditBuyForm",y(16,40,e.isEdit$))("outletID",e.outlet.value.ID)("outletName",e.outlet.value.Name),l(6),c("formControl",e.attention),l(3),Ct("change",y(24,42,e.toggleState$)),l(7),c("quickKey",y(31,44,e.quickKeyPack$))("outletID",e.outlet.value.ID)("formControl",e.variantQuickKey),l(5),c("formControl",e.variantAutocomplete)("autocompleteEndpoint",e.variantAutocompleteEndpoint)("outletID",e.outlet.value.ID),l(2),c("formControl",e.supplierID)("supplierPOTypes",y(38,46,e.supplierPOTypes$))("appConfigJSON",y(39,48,e.appConfigJSON$)),l(3),c("cart",y(42,50,e.cart$))("appConfigJSON",y(43,52,e.appConfigJSON$))("isEdit",y(44,54,e.isEdit$))("outletID",e.outlet.value.ID)("outletName",e.outlet.value.Name)}}var qi=class i extends ui{constructor(e,n,o,s,P,_,j,z,h,k,p,M,G){Jn(()=>{this.cartDisplayRef()&&(s.cartDisplayRef=this.cartDisplayRef())});super(M);this.intercom=_;this.role=h;this.toggle=k;this.lowOnStock=p;this.menuData$.subscribe();let X=n.buyForm.controls.Order.controls;this.outlets$=e.entities$,this.outlet=n.outlet,this.isEdit$=j.isEdit$.pipe(E(C=>C?this.outlet.disable():this.outlet.enable())),this.date=X.Date,h.global.Date==!1&&this.date.disable(),this.supplierID=X.SupplierID,this.attention=X.Att,this.poNumber=n.buyForm.controls.Order.controls.Number,this.role?.sell?.Number||this.poNumber.disable(),this.quickKeyPack$=o.quickKeyPack$,this.variantAutocomplete=s.variantAutocomplete,this.variantQuickKey=s.variantQuickKey,this.returnInvoiceNumber=P.returnInvoiceNumber,this.cart$=s.cart$,this.appConfigJSON$=e.appConfigJSON$,this.isOpenDialogOutlet$=p.selectedLowOnStockData.length==0?this.isEdit$.pipe(ne(C=>z.createNewTransaction$.pipe(u(v=>v||C))),u(C=>!C)):Ze(!1),p.selectedLowOnStockData.length&&(n.setOutletForm({ID:p.selectedLowOnStockData[0].EntityID,Name:p.selectedLowOnStockData[0].Outlet}),G.post("/API/catalog/variant/GetVariantByListID",{ListID:p.selectedLowOnStockData.map(C=>C.ID),EntityID:p.selectedLowOnStockData[0].EntityID}).pipe(u(C=>C.map(v=>this.setUnitPrice(v)).map(v=>({VariantID:v.ID,UnitPrice:v.UnitPrice})))).subscribe(C=>{n.setDeliveryEntityID(p.selectedLowOnStockData[0].EntityID);let v=p.selectedLowOnStockData.map(w=>({Quantity:w.Quantity,UnitQuantity:w.UnitQuantity,UnitPrice:C.find(V=>V.VariantID==w.VariantID).UnitPrice,Code:w.Code,Name:w.Product,DiscountAmount:w.DiscountAmount,Discount:w.Discount,Total:w.Total*C.find(V=>V.VariantID==w.VariantID).UnitPrice,VariantID:w.VariantID}));s.editForm(v)})),this.paymentComplete$=z.paymentComplete$,this.supplierPOTypes$=e.supplierPOTypes$,this.toggleState$=k.toggleState$}cartDisplayRef=jn("cartDisplayRef",{read:_n});variantAutocompleteEndpoint=Be.GetVariantSuggestionsByEntityID;sf=Ce(Tt);outlets$;quickKeyPack$;outlet;poNumber;date;supplierID;variantAutocomplete=new me;variantQuickKey=new me;returnInvoiceNumber;cart$;appConfigJSON$;attention;isEdit$;paymentComplete$;supplierPOTypes$;isOpenDialogOutlet$;toggleState$;setUnitPrice(e){let n=T({},e);return O.IsNotEmpty(e.OrderPrice)?n.UnitPrice=e.OrderPrice:n.UnitPrice=e.UnitCost,n}ngOnDestroy(){this.lowOnStock.selectedLowOnStockData=[],this.intercom.showLauncher()}ngAfterViewInit(){this.intercom.hideLauncher()}collapseSidebar(){this.toggle.toggleSidebar()}static \u0275fac=function(n){return new(n||i)(f(ge),f(q),f(ze),f(oe),f(lt),f(ni),f(Le),f(Qe),f(xe),f(ii),f(Qt),f(fi),f(ce))};static \u0275cmp=N({type:i,selectors:[["POS-buy-v2"]],viewQuery:function(n,o){n&1&&Un(o.cartDisplayRef,Ka,5,_n),n&2&&Wn()},standalone:!0,features:[ke([oe,Qe,Pt,Le,q,Mt,ge,It,ze,Ye,lt,Tt]),Ln,F],decls:4,vars:4,consts:[["ISNOTCOMPLETE",""],["cartDisplayRef",""],[4,"ngIf","ngIfElse"],[3,"paymentComplete"],[1,"container-fluid"],[1,"row","header","border-bottom"],[1,"col-5","border-end"],[1,"left-toolbar-container","h-100","d-flex","align-items-center","justify-content-between"],[3,"outlets","isOpenAfterLoad","formControl","disabled"],["transactionType","Purchase Order",3,"formControl","isEdit"],[3,"formControl","tooltip"],[1,"col-7","d-flex","align-items-center"],[1,"row","flex-grow-1"],[1,"col-lg-7","col-5","d-flex","align-items-center"],[3,"returnInvoiceNumber","appConfigJSON","isEditBuyForm","outletID","outletName"],[1,"col-5","ps-0"],[1,"d-flex","align-items-center","position-relative"],[1,"fa-light","fa-id-badge","position-absolute"],["type","text","placeholder","Assign Attention",1,"border-bottom-0",3,"formControl"],[1,"col-2"],[1,"navbar","mobile-button","border-bottom-0"],["type","button","aria-controls","navigation-index","aria-expanded","false","aria-label","Toggle navigation",1,"navbar-toggler","navbar-toggler-right","float-end","toggle-menu","ps-2","pe-0","border-0",2,"width","max-content","height","max-content",3,"click"],[1,"navbar-toggler-bar","burger-lines"],[1,"row","content"],[3,"quickKey","outletID","formControl"],[1,"col-7","pt-5","px-0","d-flex","flex-column"],[1,"row","w-100","ms-0"],[1,"col-7","px-0"],["amountProperty","VariantCost",3,"formControl","autocompleteEndpoint","outletID"],[3,"formControl","supplierPOTypes","appConfigJSON"],[1,"cart-display",3,"cart","appConfigJSON","isEdit","outletID","outletName"]],template:function(n,o){if(n&1&&(I(0,qa,2,1,"ng-container",2),g(1,"async"),I(2,za,46,56,"ng-template",null,0,ve)),n&2){let s=ue(3);c("ngIf",y(1,2,o.paymentComplete$))("ngIfElse",s)}},dependencies:[A,pe,Ve,qe,De,se,Ke,Fi,Ai,Di,Kt,Ht,ki,zt,ln,yn,Cn],styles:[".left-toolbar-container[_ngcontent-%COMP%]{position:relative}.left-toolbar-container[_ngcontent-%COMP%] POS-invoice-number-form[_ngcontent-%COMP%]{position:absolute;top:34px;left:28px}.header[_ngcontent-%COMP%]{min-height:60px}.content[_ngcontent-%COMP%]{min-height:calc(100vh - 60px)}.supplier-more-menu[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.cart-display[_ngcontent-%COMP%]{flex-grow:1;height:0px;overflow-y:auto}input[_ngcontent-%COMP%]{width:100%;height:38px!important;border:0;border-bottom:1px solid #ced4da;padding-left:32px}input[_ngcontent-%COMP%]::placeholder{color:#ced4da}i[_ngcontent-%COMP%]{font-size:16px;top:10.6px;left:13px}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]{transition:.4s}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(1){-webkit-transform:rotate(-45deg) translate(-8px,4px);transform:rotate(-45deg) translate(-8px,4px)}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(2){opacity:0}.change[_ngcontent-%COMP%] .burger-lines[_ngcontent-%COMP%]:nth-child(3){-webkit-transform:rotate(45deg) translate(-5px,0px);transform:rotate(45deg) translate(-5px)}.mobile-button[_ngcontent-%COMP%]{display:none}@media (max-width: 990px){.mobile-button[_ngcontent-%COMP%]{display:block}}.navbar-toggler[_ngcontent-%COMP%]:focus{box-shadow:none!important}.more-actions[_ngcontent-%COMP%] div.d-flex[_ngcontent-%COMP%]{width:30rem}"]})};export{qi as BuyV2Component};
@@ -0,0 +1 @@
1
+ import{a as F,h as O,n}from"./chunk-LHWN2J4H.js";import{Aa as f,Ab as k,Bb as M,Fa as g,Fc as A,Ia as C,La as v,Lb as E,Mb as j,Mc as T,Va as o,_a as y,dd as x,eb as I,fb as D,gc as l,ia as m,lb as L,pa as a,qa as p,qb as w,ra as h,ya as u,zb as b}from"./chunk-H55AJAX5.js";var H=["*"],S=(()=>{class i{label;spin=!1;styleClass;role;ariaLabel;ariaHidden;ngOnInit(){this.getAttributes()}getAttributes(){let e=F.isEmpty(this.label);this.role=e?void 0:"img",this.ariaLabel=e?void 0:this.label,this.ariaHidden=e}getClassNames(){return`p-icon ${this.styleClass?this.styleClass+" ":""}${this.spin?"p-icon-spin":""}`}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=a({type:i,selectors:[["ng-component"]],hostAttrs:[1,"p-element","p-icon-wrapper"],inputs:{label:"label",spin:[2,"spin","spin",A],styleClass:"styleClass"},standalone:!0,features:[D,l],ngContentSelectors:H,decls:1,vars:0,template:function(t,s){t&1&&(E(),j(0))},encapsulation:2,changeDetection:0})}return i})();var Z=(()=>{class i extends S{static \u0275fac=(()=>{let e;return function(s){return(e||(e=f(i)))(s||i)}})();static \u0275cmp=a({type:i,selectors:[["TimesIcon"]],standalone:!0,features:[I,l],decls:2,vars:5,consts:[["width","14","height","14","viewBox","0 0 14 14","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M8.01186 7.00933L12.27 2.75116C12.341 2.68501 12.398 2.60524 12.4375 2.51661C12.4769 2.42798 12.4982 2.3323 12.4999 2.23529C12.5016 2.13827 12.4838 2.0419 12.4474 1.95194C12.4111 1.86197 12.357 1.78024 12.2884 1.71163C12.2198 1.64302 12.138 1.58893 12.0481 1.55259C11.9581 1.51625 11.8617 1.4984 11.7647 1.50011C11.6677 1.50182 11.572 1.52306 11.4834 1.56255C11.3948 1.60204 11.315 1.65898 11.2488 1.72997L6.99067 5.98814L2.7325 1.72997C2.59553 1.60234 2.41437 1.53286 2.22718 1.53616C2.03999 1.53946 1.8614 1.61529 1.72901 1.74767C1.59663 1.88006 1.5208 2.05865 1.5175 2.24584C1.5142 2.43303 1.58368 2.61419 1.71131 2.75116L5.96948 7.00933L1.71131 11.2675C1.576 11.403 1.5 11.5866 1.5 11.7781C1.5 11.9696 1.576 12.1532 1.71131 12.2887C1.84679 12.424 2.03043 12.5 2.2219 12.5C2.41338 12.5 2.59702 12.424 2.7325 12.2887L6.99067 8.03052L11.2488 12.2887C11.3843 12.424 11.568 12.5 11.7594 12.5C11.9509 12.5 12.1346 12.424 12.27 12.2887C12.4053 12.1532 12.4813 11.9696 12.4813 11.7781C12.4813 11.5866 12.4053 11.403 12.27 11.2675L8.01186 7.00933Z","fill","currentColor"]],template:function(t,s){t&1&&(u(),b(0,"svg",0),M(1,"path",1),k()),t&2&&(w(s.getClassNames()),L("aria-label",s.ariaLabel)("aria-hidden",s.ariaHidden)("role",s.role))},encapsulation:2})}return i})();var te=(()=>{class i{document;platformId;renderer;el;zone;config;constructor(e,t,s,d,c,r){this.document=e,this.platformId=t,this.renderer=s,this.el=d,this.zone=c,this.config=r}animationListener;mouseDownListener;timeout;ngAfterViewInit(){x(this.platformId)&&this.config&&this.config.ripple&&this.zone.runOutsideAngular(()=>{this.create(),this.mouseDownListener=this.renderer.listen(this.el.nativeElement,"mousedown",this.onMouseDown.bind(this))})}onMouseDown(e){let t=this.getInk();if(!t||this.document.defaultView?.getComputedStyle(t,null).display==="none")return;if(n.removeClass(t,"p-ink-active"),!n.getHeight(t)&&!n.getWidth(t)){let r=Math.max(n.getOuterWidth(this.el.nativeElement),n.getOuterHeight(this.el.nativeElement));t.style.height=r+"px",t.style.width=r+"px"}let s=n.getOffset(this.el.nativeElement),d=e.pageX-s.left+this.document.body.scrollTop-n.getWidth(t)/2,c=e.pageY-s.top+this.document.body.scrollLeft-n.getHeight(t)/2;this.renderer.setStyle(t,"top",c+"px"),this.renderer.setStyle(t,"left",d+"px"),n.addClass(t,"p-ink-active"),this.timeout=setTimeout(()=>{let r=this.getInk();r&&n.removeClass(r,"p-ink-active")},401)}getInk(){let e=this.el.nativeElement.children;for(let t=0;t<e.length;t++)if(typeof e[t].className=="string"&&e[t].className.indexOf("p-ink")!==-1)return e[t];return null}resetInk(){let e=this.getInk();e&&n.removeClass(e,"p-ink-active")}onAnimationEnd(e){this.timeout&&clearTimeout(this.timeout),n.removeClass(e.currentTarget,"p-ink-active")}create(){let e=this.renderer.createElement("span");this.renderer.addClass(e,"p-ink"),this.renderer.appendChild(this.el.nativeElement,e),this.renderer.setAttribute(e,"aria-hidden","true"),this.renderer.setAttribute(e,"role","presentation"),this.animationListener||(this.animationListener=this.renderer.listen(e,"animationend",this.onAnimationEnd.bind(this)))}remove(){let e=this.getInk();e&&(this.mouseDownListener&&this.mouseDownListener(),this.animationListener&&this.animationListener(),this.mouseDownListener=null,this.animationListener=null,n.removeElement(e))}ngOnDestroy(){this.config&&this.config.ripple&&this.remove()}static \u0275fac=function(t){return new(t||i)(o(T),o(v),o(y),o(C),o(g),o(O,8))};static \u0275dir=h({type:i,selectors:[["","pRipple",""]],hostAttrs:[1,"p-ripple","p-element"],standalone:!0})}return i})(),ie=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275mod=p({type:i});static \u0275inj=m({})}return i})();export{S as a,Z as b,te as c,ie as d};
@@ -0,0 +1 @@
1
+ import{a as p}from"./chunk-VPAQFQA7.js";import{Aa as r,Ab as d,Bb as f,eb as l,gc as m,lb as s,pa as i,qb as C,ya as o,zb as c}from"./chunk-H55AJAX5.js";var v=(()=>{class t extends p{static \u0275fac=(()=>{let n;return function(e){return(n||(n=r(t)))(e||t)}})();static \u0275cmp=i({type:t,selectors:[["ChevronLeftIcon"]],standalone:!0,features:[l,m],decls:2,vars:5,consts:[["width","14","height","14","viewBox","0 0 14 14","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M9.61296 13C9.50997 13.0005 9.40792 12.9804 9.3128 12.9409C9.21767 12.9014 9.13139 12.8433 9.05902 12.7701L3.83313 7.54416C3.68634 7.39718 3.60388 7.19795 3.60388 6.99022C3.60388 6.78249 3.68634 6.58325 3.83313 6.43628L9.05902 1.21039C9.20762 1.07192 9.40416 0.996539 9.60724 1.00012C9.81032 1.00371 10.0041 1.08597 10.1477 1.22959C10.2913 1.37322 10.3736 1.56698 10.3772 1.77005C10.3808 1.97313 10.3054 2.16968 10.1669 2.31827L5.49496 6.99022L10.1669 11.6622C10.3137 11.8091 10.3962 12.0084 10.3962 12.2161C10.3962 12.4238 10.3137 12.6231 10.1669 12.7701C10.0945 12.8433 10.0083 12.9014 9.91313 12.9409C9.81801 12.9804 9.71596 13.0005 9.61296 13Z","fill","currentColor"]],template:function(a,e){a&1&&(o(),c(0,"svg",0),f(1,"path",1),d()),a&2&&(C(e.getClassNames()),s("aria-label",e.ariaLabel)("aria-hidden",e.ariaHidden)("role",e.role))},encapsulation:2})}return t})();export{v as a};
@@ -0,0 +1 @@
1
+ import{C as m,a as G,h as $,n as Z}from"./chunk-4G26RHGA.js";import{A as C,Ab as T,Dc as z,E as M,Ea as e,Fa as U,Ia as A,Ib as k,La as B,R as D,Va as a,W as P,_ as R,ba as w,cd as u,d as E,dd as L,e as b,eb as F,fc as x,ga as _,gc as K,ia as d,ja as I,jc as V,mb as N,pa as l,qa as c,ra as O,t as S,zb as j}from"./chunk-H55AJAX5.js";import{a as y,b as v}from"./chunk-KW4B7WMB.js";var h=()=>{let n=typeof window<"u"?window:void 0;return n&&n.tinymce?n.tinymce:null},oe=(()=>{class n{onBeforePaste=new e;onBlur=new e;onClick=new e;onCompositionEnd=new e;onCompositionStart=new e;onCompositionUpdate=new e;onContextMenu=new e;onCopy=new e;onCut=new e;onDblclick=new e;onDrag=new e;onDragDrop=new e;onDragEnd=new e;onDragGesture=new e;onDragOver=new e;onDrop=new e;onFocus=new e;onFocusIn=new e;onFocusOut=new e;onKeyDown=new e;onKeyPress=new e;onKeyUp=new e;onMouseDown=new e;onMouseEnter=new e;onMouseLeave=new e;onMouseMove=new e;onMouseOut=new e;onMouseOver=new e;onMouseUp=new e;onPaste=new e;onSelectionChange=new e;onActivate=new e;onAddUndo=new e;onBeforeAddUndo=new e;onBeforeExecCommand=new e;onBeforeGetContent=new e;onBeforeRenderUI=new e;onBeforeSetContent=new e;onChange=new e;onClearUndos=new e;onDeactivate=new e;onDirty=new e;onExecCommand=new e;onGetContent=new e;onHide=new e;onInit=new e;onInput=new e;onInitNgModel=new e;onLoadContent=new e;onNodeChange=new e;onPostProcess=new e;onPostRender=new e;onPreInit=new e;onPreProcess=new e;onProgressState=new e;onRedo=new e;onRemove=new e;onReset=new e;onResizeEditor=new e;onSaveContent=new e;onSetAttrib=new e;onObjectResizeStart=new e;onObjectResized=new e;onObjectSelected=new e;onSetContent=new e;onShow=new e;onSubmit=new e;onUndo=new e;onVisualAid=new e;static \u0275fac=function(o){return new(o||n)};static \u0275dir=O({type:n,outputs:{onBeforePaste:"onBeforePaste",onBlur:"onBlur",onClick:"onClick",onCompositionEnd:"onCompositionEnd",onCompositionStart:"onCompositionStart",onCompositionUpdate:"onCompositionUpdate",onContextMenu:"onContextMenu",onCopy:"onCopy",onCut:"onCut",onDblclick:"onDblclick",onDrag:"onDrag",onDragDrop:"onDragDrop",onDragEnd:"onDragEnd",onDragGesture:"onDragGesture",onDragOver:"onDragOver",onDrop:"onDrop",onFocus:"onFocus",onFocusIn:"onFocusIn",onFocusOut:"onFocusOut",onKeyDown:"onKeyDown",onKeyPress:"onKeyPress",onKeyUp:"onKeyUp",onMouseDown:"onMouseDown",onMouseEnter:"onMouseEnter",onMouseLeave:"onMouseLeave",onMouseMove:"onMouseMove",onMouseOut:"onMouseOut",onMouseOver:"onMouseOver",onMouseUp:"onMouseUp",onPaste:"onPaste",onSelectionChange:"onSelectionChange",onActivate:"onActivate",onAddUndo:"onAddUndo",onBeforeAddUndo:"onBeforeAddUndo",onBeforeExecCommand:"onBeforeExecCommand",onBeforeGetContent:"onBeforeGetContent",onBeforeRenderUI:"onBeforeRenderUI",onBeforeSetContent:"onBeforeSetContent",onChange:"onChange",onClearUndos:"onClearUndos",onDeactivate:"onDeactivate",onDirty:"onDirty",onExecCommand:"onExecCommand",onGetContent:"onGetContent",onHide:"onHide",onInit:"onInit",onInput:"onInput",onInitNgModel:"onInitNgModel",onLoadContent:"onLoadContent",onNodeChange:"onNodeChange",onPostProcess:"onPostProcess",onPostRender:"onPostRender",onPreInit:"onPreInit",onPreProcess:"onPreProcess",onProgressState:"onProgressState",onRedo:"onRedo",onRemove:"onRemove",onReset:"onReset",onResizeEditor:"onResizeEditor",onSaveContent:"onSaveContent",onSetAttrib:"onSetAttrib",onObjectResizeStart:"onObjectResizeStart",onObjectResized:"onObjectResized",onObjectSelected:"onObjectSelected",onSetContent:"onSetContent",onShow:"onShow",onSubmit:"onSubmit",onUndo:"onUndo",onVisualAid:"onVisualAid"}})}return n})(),H=["onActivate","onAddUndo","onBeforeAddUndo","onBeforeExecCommand","onBeforeGetContent","onBeforeRenderUI","onBeforeSetContent","onBeforePaste","onBlur","onChange","onClearUndos","onClick","onCompositionEnd","onCompositionStart","onCompositionUpdate","onContextMenu","onCopy","onCut","onDblclick","onDeactivate","onDirty","onDrag","onDragDrop","onDragEnd","onDragGesture","onDragOver","onDrop","onExecCommand","onFocus","onFocusIn","onFocusOut","onGetContent","onHide","onInit","onInput","onKeyDown","onKeyPress","onKeyUp","onLoadContent","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onNodeChange","onObjectResizeStart","onObjectResized","onObjectSelected","onPaste","onPostProcess","onPostRender","onPreProcess","onProgressState","onRedo","onRemove","onReset","onResizeEditor","onSaveContent","onSelectionChange","onSetAttrib","onSetContent","onShow","onSubmit","onUndo","onVisualAid"],p=(n,i,t)=>C(n,i).pipe(w(t)),ie=(n,i,t)=>{se(n).forEach(s=>{let r=n[s];p(i,s.substring(2),t).subscribe(f=>{le(r)&&n.ngZone.run(()=>r.emit({event:f,editor:i}))})})},se=n=>{let i=Y(n.ignoreEvents,[]);return Y(n.allowedEvents,H).filter(o=>H.includes(o)&&!i.includes(o))},Y=(n,i)=>typeof n=="string"?n.split(",").map(t=>t.trim()):Array.isArray(n)?n:i,q=0,re=n=>{let t=new Date().getTime(),o=Math.floor(Math.random()*1e9);return q++,n+"_"+o+q+String(t)},J=n=>typeof n<"u"&&n.tagName.toLowerCase()==="textarea",Q=n=>typeof n>"u"||n===""?[]:Array.isArray(n)?n:n.split(" "),ae=(n,i)=>Q(n).concat(Q(i)),de=()=>{},W=n=>n==null,le=n=>n.observed||n.observers?.length>0,ce=()=>n=>n.pipe(D(),S(()=>{})),ue=()=>{let n=new b(null),i=n.pipe(M(Boolean),R(([t,o])=>{let s=t.createElement("script");return s.referrerPolicy="origin",s.type="application/javascript",s.src=o,t.head.appendChild(s),C(s,"load").pipe(ce())}),P({bufferSize:1,refCount:!0}));return{load:(...t)=>(n.getValue()||n.next(t),i),reinitialize:()=>{n.next(null)}}},me=ue(),he=new I("TINYMCE_SCRIPT_SRC"),pe={provide:G,useExisting:_(()=>g),multi:!0},g=(()=>{class n extends oe{cdRef;platformId;tinymceScriptSrc;cloudChannel="7";apiKey="no-api-key";licenseKey;init;id="";initialValue;outputFormat;inline;tagName;plugins;toolbar;modelEvents="change input undo redo";allowedEvents;ignoreEvents;set disabled(t){this._disabled=t,this._editor&&this._editor.initialized&&(typeof this._editor.mode?.set=="function"?this._editor.mode.set(t?"readonly":"design"):this._editor.setMode(t?"readonly":"design"))}get disabled(){return this._disabled}get editor(){return this._editor}ngZone;_elementRef;_element;_disabled;_editor;onTouchedCallback=de;onChangeCallback;destroy$=new E;constructor(t,o,s,r,f){super(),this.cdRef=s,this.platformId=r,this.tinymceScriptSrc=f,this._elementRef=t,this.ngZone=o}writeValue(t){this._editor&&this._editor.initialized?this._editor.setContent(W(t)?"":t):this.initialValue=t===null?void 0:t}registerOnChange(t){this.onChangeCallback=t}registerOnTouched(t){this.onTouchedCallback=t}setDisabledState(t){this.disabled=t}ngAfterViewInit(){L(this.platformId)&&(this.id=this.id||re("tiny-angular"),this.inline=this.inline!==void 0?this.inline!==!1:!!this.init?.inline,this.createElement(),h()!==null?this.initialise():this._element&&this._element.ownerDocument&&me.load(this._element.ownerDocument,this.getScriptSrc()).pipe(w(this.destroy$)).subscribe(this.initialise))}ngOnDestroy(){this.destroy$.next(),h()!==null&&h().remove(this._editor)}createElement(){let t=typeof this.tagName=="string"?this.tagName:"div";if(this._element=document.createElement(this.inline?t:"textarea"),this._element){let o=document.getElementById(this.id);o&&o!==this._elementRef.nativeElement&&console.warn(`TinyMCE-Angular: an element with id [${this.id}] already exists. Editors with duplicate Id will not be able to mount`),this._element.id=this.id,J(this._element)&&(this._element.style.visibility="hidden"),this._elementRef.nativeElement.appendChild(this._element)}}initialise=()=>{let t=v(y({},this.init),{selector:void 0,target:this._element,inline:this.inline,readonly:this.disabled,license_key:this.licenseKey,plugins:ae(this.init&&this.init.plugins,this.plugins),toolbar:this.toolbar||this.init&&this.init.toolbar,setup:o=>{this._editor=o,p(o,"init",this.destroy$).subscribe(()=>{this.initEditor(o)}),ie(this,o,this.destroy$),this.init&&typeof this.init.setup=="function"&&this.init.setup(o)}});J(this._element)&&(this._element.style.visibility=""),this.ngZone.runOutsideAngular(()=>{h().init(t)})};getScriptSrc(){return W(this.tinymceScriptSrc)?`https://cdn.tiny.cloud/1/${this.apiKey}/tinymce/${this.cloudChannel}/tinymce.min.js`:this.tinymceScriptSrc}initEditor(t){p(t,"blur",this.destroy$).subscribe(()=>{this.cdRef.markForCheck(),this.ngZone.run(()=>this.onTouchedCallback())}),p(t,this.modelEvents,this.destroy$).subscribe(()=>{this.cdRef.markForCheck(),this.ngZone.run(()=>this.emitOnChange(t))}),typeof this.initialValue=="string"&&this.ngZone.run(()=>{t.setContent(this.initialValue),t.getContent()!==this.initialValue&&this.emitOnChange(t),this.onInitNgModel!==void 0&&this.onInitNgModel.emit(t)})}emitOnChange(t){this.onChangeCallback&&this.onChangeCallback(t.getContent({format:this.outputFormat}))}static \u0275fac=function(o){return new(o||n)(a(A),a(U),a(z),a(B),a(he,8))};static \u0275cmp=l({type:n,selectors:[["editor"]],inputs:{cloudChannel:"cloudChannel",apiKey:"apiKey",licenseKey:"licenseKey",init:"init",id:"id",initialValue:"initialValue",outputFormat:"outputFormat",inline:"inline",tagName:"tagName",plugins:"plugins",toolbar:"toolbar",modelEvents:"modelEvents",allowedEvents:"allowedEvents",ignoreEvents:"ignoreEvents",disabled:"disabled"},standalone:!0,features:[x([pe]),F,K],decls:0,vars:0,template:function(o,s){},dependencies:[u,m],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}return n})(),X=(()=>{class n{static \u0275fac=function(o){return new(o||n)};static \u0275mod=c({type:n});static \u0275inj=d({imports:[g]})}return n})();var fe=(n,i)=>({forced_root_block:"div",height:n,menubar:!1,branding:!1,placeholder:i,paste_as_text:!0,toolbar:"bold italic | bullist numlist | outdent indent | alignleft aligncenter alignright alignjustify | table "}),ee=class n{placeholder;height="250px";value;disabled=!1;valueChange=new e;plugins=localStorage.getItem("TinyMCEPlugins")??"";onChangeValue(i){this.value=i,this.valueChange.emit(this.value)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=l({type:n,selectors:[["POS-tinymce-editor"]],inputs:{placeholder:"placeholder",height:"height",value:"value",disabled:"disabled"},outputs:{valueChange:"valueChange"},decls:1,vars:6,consts:[[1,"form-control","p-0","border-0",3,"ngModelChange","init","plugins","ngModel"]],template:function(t,o){t&1&&(j(0,"editor",0),k("ngModelChange",function(r){return o.onChangeValue(r)}),T()),t&2&&N("init",V(3,fe,o.height,o.placeholder))("plugins",o.plugins)("ngModel",o.value)},dependencies:[g,$,Z]})},ne=class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=c({type:n});static \u0275inj=d({imports:[u,X,m]})};export{ee as a,ne as b};
@@ -0,0 +1 @@
1
+ import{c as f}from"./chunk-R7NR3M2Q.js";import{a as m}from"./chunk-WG6PV6VL.js";import{a as u}from"./chunk-RRKCUSBB.js";import{I as c,Sd as v,gd as h,ha as s,k as n,ka as e,kd as l}from"./chunk-H55AJAX5.js";var d=class o{constructor(t,r,p,i){this.httpService=t;this.authService=r;this.httpClientService=p;this.toastr=i}port=window.location.href.split("localhost:")[1]?.split("/")[0];hostURL=t=>m.production?t:`https://localhost:${this.port}${t}`;configure2FA(t){return this.httpService.post("/api/Authentication/Setup_2FA",t)}validateCode(t,r){let p=this.authService.loginResponse?.Token,i=new h({"Content-Type":"application/json","Cache-Control":"no-cache"});i=i.append("Authorization","Bearer "+p);let S={ValidationCode:t,UserID:r};return this.httpClientService.post(this.hostURL("/api/Login/Validate_2FA "),S,{headers:i}).pipe(c(a=>(this.toastr.error(a?.error?.Message,"Error - "+a.status),n)))}disableTwoFactorAuthentication(){let t={enabled:!1};return this.httpService.post("/api/Authentication/Setup_2FA",t)}static \u0275fac=function(r){return new(r||o)(e(u),e(f),e(l),e(v))};static \u0275prov=s({token:o,factory:o.\u0275fac,providedIn:"root"})};export{d as a};
@@ -0,0 +1 @@
1
+ import{a as te,b as ie,c as oe}from"./chunk-QZWOQRAM.js";import{a as se,b as de}from"./chunk-FBR7TAEJ.js";import{k as ne,l as re,o as me,p as ge,q as ce}from"./chunk-V4RKZMUB.js";import{Aa as Z,Ba as ee}from"./chunk-2FKYC63K.js";import{a as ae,e as le,f as pe}from"./chunk-WK4T26FX.js";import{C as Y,c as q,h as K,n as Q}from"./chunk-4G26RHGA.js";import{a as T}from"./chunk-RRKCUSBB.js";import{$b as X,$c as $,Ab as l,Bb as u,Cb as y,Db as M,Fb as S,Ib as C,Kb as g,Rc as B,Sc as G,Ua as p,Va as h,W as L,Xc as W,Zb as m,_ as P,_b as N,ac as H,cc as O,cd as U,d as F,da as R,dc as I,ec as D,gb as x,gc as z,ha as V,ka as k,mb as s,pa as j,qb as J,qc as v,rc as E,t as b,wa as f,xa as _,zb as a}from"./chunk-H55AJAX5.js";import{a as c,b as d}from"./chunk-KW4B7WMB.js";var w=class r{constructor(t){this.http=t}exportCSV(t,e){let i=d(c({},e),{Export:!0,FormatType:0});this.downloadFile(t,i)}exportCustom(t,e,i){let o=d(c({},e),{Export:!0,FormatType:i});this.downloadFile(t,o)}exportCSVIds(t,e){this.downloadFile(t,e)}exportXlsx(t,e){let i=d(c({},e),{FormatType:1});this.downloadFile(t,i)}downloadFile(t,e){this.http.postFile(`/api/${t}`,e).subscribe(i=>{let o=window.URL.createObjectURL(i.file),n=document.createElement("a");n.download=this.getFilenameFromContentDisposition(i.title),n.href=o,n.click(),URL.revokeObjectURL(o),n.remove()})}getFilenameFromContentDisposition(t){let i=/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(t);return i!=null&&i[1]?i[1].replace(/['"]/g,""):""}exportJSON(t,e,i){this.http.post(`/api/${t}`,i).subscribe(o=>{var n=JSON.stringify(o,null," ");this.downloadJSON(n,e+".json")})}downloadJSON(t,e){var i=new Blob([t],{type:"data:application/json;charset=utf-8"}),o=document.createElement("a");o.setAttribute("href",window.URL.createObjectURL(i)),o.setAttribute("download",e),document.body.appendChild(o),o.click(),document.body.removeChild(o)}static \u0275fac=function(e){return new(e||r)(k(T))};static \u0275prov=V({token:r,factory:r.\u0275fac,providedIn:"root"})};function he(r,t){if(r&1&&(a(0,"div",17),m(1),l()),r&2){let e=t.item;s("matTooltip",e.Tooltip),p(),X(" ",e.Value," ")}}function Ce(r,t){if(r&1){let e=S();y(0),a(1,"div",13),m(2," Columns "),l(),a(3,"div",14)(4,"ng-select",15),D("ngModelChange",function(o){f(e);let n=g();return I(n.exportType,o)||(n.exportType=o),_(o)}),C("change",function(){f(e);let o=g();return o.calledApiCount=!1,o.displayedMaxRangeRow=o.pageSize,_(o.displayedMinRangeRow=o.pageNumber)}),x(5,he,2,2,"ng-template",16),l()(),M()}if(r&2){let e=g();p(4),s("items",e.exportTypes),O("ngModel",e.exportType)}}function be(r,t){if(r&1&&(a(0,"mat-button-toggle",19),u(1,"i",20),m(2),l()),r&2){let e=g().$implicit;s("value",e.value),p(),J(e.icon),p(),N(e.label)}}function ye(r,t){if(r&1&&(y(0),x(1,be,3,4,"mat-button-toggle",18),M()),r&2){let e=t.$implicit,i=g();p(),s("ngIf",e.inclusiveToAPI===i.exportType)}}function Me(r,t){r&1&&(a(0,"mat-button-toggle",21),u(1,"i",22),m(2,"JSON"),l())}function Se(r,t){if(r&1){let e=S();a(0,"i",30),C("click",function(){f(e);let o=g(3);return _(o.onGetAllDataLength())}),l()}}function ve(r,t){if(r&1&&(a(0,"span"),m(1,"of "),x(2,Se,1,0,"i",28),a(3,"span",29),m(4),v(5,"async"),l(),m(6," page(s)"),l()),r&2){let e=g(2);p(2),s("ngIf",!e.calledApiCount),p(2),N(e.calledApiCount?E(5,2,e.allDataLength$):"")}}function Ee(r,t){if(r&1){let e=S();y(0),a(1,"div",4),m(2," Page "),l(),a(3,"div",23)(4,"input",24),C("ngModelChange",function(o){f(e);let n=g();return _(n.pageNumber=o)}),l(),x(5,ve,7,4,"span",3),l(),a(6,"div",25)(7,"div",26),u(8,"i",27),m(9),v(10,"number"),v(11,"number"),l()(),M()}if(r&2){let e=g();p(4),s("ngModel",e.pageNumber),p(),s("ngIf",e.getAllDataLengthAPI),p(4),H(" Exporting data from ",E(10,4,e.displayedMinRangeRow)," - ",e.exportFormat=="JSON"?"1,000":E(11,6,e.displayedMaxRangeRow)," ")}}var xe=class r{constructor(t,e,i,o){this.data=t;this.dialogRef=e;this.exportHandler=o;this.config.title=`Export ${t.title}`,this.config.hideCancel=!0,this.config.customWidth="450px",this.exportTypes=t.exportTypes,this.exportType=this.exportTypes[0].ID,this.filterExport=t.filterExport,this.pagination=t.pagination,this.getAllDataLengthAPI=t.getAllDataLengthAPI,this.extraExportTypesOptions=t.extraExportTypesOptions,this.allDataLength$=this.onGetAllDataLength$.pipe(b(()=>this.exportTypes.find(n=>n.ID==this.exportType)?.Count??this.getAllDataLengthAPI),P(n=>i.post("/API/"+n,this.filterExport)),b(n=>typeof n=="number"?n:n.Count),R(n=>{n<this.displayedMaxRangeRow&&this.setMinMaxRangeDisplayedRow(n),this.calledApiCount=!0}),b(n=>{let A=this.exportFormat=="JSON"?1e3:this.pageSize;return Math.floor(n/A)+(n%A>0?1:0)}),L(1),R(console.log)),this.allDataLength$.subscribe()}pageNumber=1;pageSize=1e4;config=new me;exportTypes=[];exportType;exportFormat="CSV";_onGetAllDataLength=new F;onGetAllDataLength$=this._onGetAllDataLength.asObservable();allDataLength$;calledApiCount=!1;filterExport;displayedMaxRangeRow=this.pageSize;displayedMinRangeRow=this.pageNumber;pagination;getAllDataLengthAPI="";extraExportTypesOptions=[];onOk(){this.filterExport=d(c({},this.filterExport),{Export:!0}),this.pagination&&(this.filterExport=d(c({},this.filterExport),{ExportPageNumber:this.pageNumber,ExportRowCount:this.pageSize})),this.exportFormat=="CSV"?this.exportHandler.exportCSV(this.exportType,this.filterExport):this.exportFormat=="XLSX"?this.exportHandler.exportXlsx(this.exportType,this.filterExport):this.exportFormat=="JSON"?this.exportHandler.exportJSON(this.data.JSONAPI,this.data.JSONFileName,d(c({},this.filterExport),{ExportRowCount:1e3})):this.exportHandler.exportCustom(this.exportType,this.filterExport,2),this.dialogRef.close()}onGetAllDataLength(){this._onGetAllDataLength.next()}onChangePageNumber(){this.setDisplayedMinMaxRangeRow()}setMinMaxRangeDisplayedRow(t){for(;this.displayedMaxRangeRow>t&&this.pageNumber>1;)this.pageNumber-=1,this.setDisplayedMinMaxRangeRow();this.displayedMaxRangeRow=t}setDisplayedMinMaxRangeRow(){this.displayedMinRangeRow=this.pageNumber*this.pageSize-this.pageSize+1,this.displayedMaxRangeRow=this.pageNumber*this.pageSize}static \u0275fac=function(e){return new(e||r)(h(re),h(ne),h(T),h(w))};static \u0275cmp=j({type:r,selectors:[["POS-modal-complex-export"]],standalone:!0,features:[z],decls:18,vars:6,consts:[[3,"onCancel","onClose","onOk","config"],[1,"container-fluid"],[1,"row"],[4,"ngIf"],[1,"col-3","fw-bold","mt-8",2,"display","flex","align-items","center"],[1,"col-9","mt-8"],[3,"ngModelChange","ngModel"],["value","CSV"],[1,"fa-solid","fa-file-csv","me-3","mb-1"],["value","XLSX"],[1,"fa-solid","fa-file-excel","me-3","mb-1"],[4,"ngFor","ngForOf"],["value","JSON",4,"ngIf"],[1,"col-3","fw-bold",2,"display","flex","align-items","center"],[1,"col-9"],["appendTo","body","bindLabel","Value","bindValue","ID",3,"ngModelChange","change","items","ngModel"],["ng-option-tmp",""],["matTooltipPosition","right",3,"matTooltip"],[3,"value",4,"ngIf"],[3,"value"],[1,"me-3","mb-1"],["value","JSON"],[1,"fa-solid","fa-brackets-curly","me-3","mb-1"],[1,"col-9","mt-8",2,"display","flex","align-items","center","column-gap","10px"],["type","text","autoNum","","name","pageNumber","id","pageNumber",1,"form-control","text-center",2,"width","50px",3,"ngModelChange","ngModel"],[1,"col-12","mt-8"],[1,"p-3",2,"background-color","#add8e6","border-radius","4px"],[1,"fa-solid","fa-circle-exclamation","mx-3"],["class","fa-solid fa-circle-question mx-3",3,"click",4,"ngIf"],[1,"fw-bold"],[1,"fa-solid","fa-circle-question","mx-3",3,"click"]],template:function(e,i){e&1&&(a(0,"modal-material",0),C("onCancel",function(){return i.dialogRef.close()})("onClose",function(){return i.dialogRef.close()})("onOk",function(){return i.onOk()}),a(1,"content")(2,"div",1)(3,"div",2),x(4,Ce,6,2,"ng-container",3),a(5,"div",4),m(6," Format "),l(),a(7,"div",5)(8,"mat-button-toggle-group",6),D("ngModelChange",function(n){return I(i.exportFormat,n)||(i.exportFormat=n),n}),a(9,"mat-button-toggle",7),u(10,"i",8),m(11,"CSV"),l(),a(12,"mat-button-toggle",9),u(13,"i",10),m(14,"XLSX"),l(),x(15,ye,2,1,"ng-container",11)(16,Me,3,0,"mat-button-toggle",12),l()(),x(17,Ee,12,8,"ng-container",3),l()()()()),e&2&&(s("config",i.config),p(4),s("ngIf",i.exportTypes.length>1),p(4),O("ngModel",i.exportFormat),p(7),s("ngForOf",i.extraExportTypesOptions),p(),s("ngIf",i.data.JSONAPI),p(),s("ngIf",i.pagination))},dependencies:[ce,ge,pe,le,ae,Y,q,K,Q,U,B,G,W,$,se,de,oe,te,ie,ee,Z],styles:[".general[_ngcontent-%COMP%], .page[_ngcontent-%COMP%]{border:1px solid #dcdcdc;border-radius:3px;padding:10px 8px;position:relative}.general[_ngcontent-%COMP%]{margin-bottom:15px}.floating-title[_ngcontent-%COMP%]{position:absolute;top:-10.5px;background:#fff;color:gray;font-size:14px}.select-header[_ngcontent-%COMP%]{line-height:36px}.input-header[_ngcontent-%COMP%]{line-height:36.6px}.form-control[_ngcontent-%COMP%]{height:max-content!important;padding:.375rem .75rem!important}"]})};export{w as a,xe as b};
@@ -0,0 +1,4 @@
1
+ var e={production:!0,firebaseConfig:{apiKey:"AIzaSyDnnitFXpM8TglWKNpzu4ChgF98n25Rgvw",authDomain:"auth.dealpos.com",projectId:"devops-signin",storageBucket:"devops-signin.appspot.com",messagingSenderId:"412465165194",appId:"1:412465165194:web:03d806f6b6ab6f8b460e73",measurementId:"G-MNDBRJ5XZD"},pos:{indexedDBVersion:3,submitOrderTimeout:2e4,fileSizeLimit:9e5},version:"12671",outletMaximumSubscription:10,midtransClientKey:"Mid-client-rdi5ridKhHfeIvTj",ngHttpLoaderDebounceDelay:175,news:"https://changelog.dealpos.app/umbraco/delivery/api/v2/content?fetch=children:web&sort=sortOrder:asc",changelog:[],uppy:{invoicePayment:25e5,receiptTemplate:25e5},intercom:{appId:"xv1oomgl"},whatsappTemplateMessage:`Thank you for shopping at {Brand}
2
+ Here is the receipt for your purchase {Number} - {Currency} {Amount}
3
+ {ReceiptLink}
4
+ Please let us know about your shopping experience using the receipt link.`,FALLBACK_PRODUCT_IMAGE_URL:"https://res.cloudinary.com/pos/image/upload/w_40/POS/Images/Icon/products_thumb.png"};export{e as a};