dealpos 26.25.1 → 26.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/browser/{chunk-SEGLL7EZ.js → chunk-22UIWSC3.js} +1 -1
  2. package/browser/{chunk-DF3NY4GQ.js → chunk-2DV4RVI2.js} +1 -1
  3. package/browser/{chunk-QTC47BGO.js → chunk-2ZEGTT5F.js} +1 -1
  4. package/browser/{chunk-VLOWJLNB.js → chunk-3V5T7HQJ.js} +1 -1
  5. package/browser/{chunk-PL37ZZ72.js → chunk-47TURW64.js} +1 -1
  6. package/browser/{chunk-BPE7ZYRC.js → chunk-4BLILYCJ.js} +1 -1
  7. package/browser/{chunk-DDMC7AOB.js → chunk-4LX46O22.js} +1 -1
  8. package/browser/chunk-5246YTD5.js +1 -0
  9. package/browser/{chunk-BMJCTNKZ.js → chunk-56AVTQ3P.js} +1 -1
  10. package/browser/{chunk-6KIUVSTQ.js → chunk-5G3YPGSF.js} +1 -1
  11. package/browser/{chunk-6SVBKUJ3.js → chunk-5WQNXUBA.js} +1 -1
  12. package/browser/{chunk-C3IYCV3F.js → chunk-6OWKTC66.js} +2 -2
  13. package/browser/{chunk-YM43LYDR.js → chunk-7LWMRLP2.js} +1 -1
  14. package/browser/{chunk-LJPX6SHH.js → chunk-7OJI22YU.js} +1 -1
  15. package/browser/{chunk-LAMXMPYX.js → chunk-7QWIOKDZ.js} +3 -3
  16. package/browser/{chunk-CNMBO3IL.js → chunk-7UWZHAV4.js} +1 -1
  17. package/browser/{chunk-PBKKKRUF.js → chunk-AFKZ7IKN.js} +1 -1
  18. package/browser/{chunk-2OOUX4VH.js → chunk-AIFSIPUL.js} +1 -1
  19. package/browser/{chunk-Y4UM4FQS.js → chunk-AKGJE2OQ.js} +1 -1
  20. package/browser/{chunk-NXBUQOL5.js → chunk-AWQDW45U.js} +1 -1
  21. package/browser/{chunk-DQCK6CYJ.js → chunk-B6Q5HROX.js} +1 -1
  22. package/browser/{chunk-HFN6YYWJ.js → chunk-BD73UNOT.js} +1 -1
  23. package/browser/{chunk-GIV23HVE.js → chunk-BFRSQNU4.js} +1 -1
  24. package/browser/{chunk-VO4MYC7J.js → chunk-BWQ2GCSR.js} +1 -1
  25. package/browser/{chunk-WD7LJ2J6.js → chunk-BYHCKVZ5.js} +1 -1
  26. package/browser/{chunk-UES6LF2O.js → chunk-C3VTH6HS.js} +1 -1
  27. package/browser/{chunk-IFZ7WOA2.js → chunk-C6Z4KJ2K.js} +1 -1
  28. package/browser/{chunk-T6FAFIQ4.js → chunk-CCWG3VJR.js} +1 -1
  29. package/browser/{chunk-R7WCM6CE.js → chunk-CEJ5QMJQ.js} +1 -1
  30. package/browser/{chunk-KQDF3D5E.js → chunk-CHQJK3LC.js} +1 -1
  31. package/browser/{chunk-R6DRTAOG.js → chunk-CLPOSWWA.js} +1 -1
  32. package/browser/{chunk-FMQF5BA7.js → chunk-CN3AWSJT.js} +1 -1
  33. package/browser/{chunk-H6EYEKOE.js → chunk-CTXPUQDX.js} +2 -2
  34. package/browser/{chunk-ZQYFN477.js → chunk-CVDL2RGU.js} +1 -1
  35. package/browser/{chunk-GANAS6N2.js → chunk-DG4CDYAK.js} +1 -1
  36. package/browser/{chunk-W4FRNPWJ.js → chunk-E7MTCHYN.js} +1 -1
  37. package/browser/{chunk-UZYR5CTN.js → chunk-ESDFR45B.js} +1 -1
  38. package/browser/chunk-FBI7ISS4.js +1 -0
  39. package/browser/{chunk-O6D2KFSX.js → chunk-FDGIABSG.js} +1 -1
  40. package/browser/{chunk-NWGOOAC4.js → chunk-GCGZ44O4.js} +1 -1
  41. package/browser/{chunk-WPFT7KMA.js → chunk-GPWB6SPF.js} +1 -1
  42. package/browser/{chunk-DQDZZVXO.js → chunk-HDDKMK2R.js} +1 -1
  43. package/browser/chunk-HVB3CC4J.js +1 -0
  44. package/browser/{chunk-ZXM4VRJU.js → chunk-HVQKUVTE.js} +1 -1
  45. package/browser/{chunk-3QL4K3P3.js → chunk-HWKNQBB4.js} +1 -1
  46. package/browser/{chunk-B4XCVHU7.js → chunk-IEORJVG3.js} +1 -1
  47. package/browser/{chunk-ORRERWFF.js → chunk-IJY44A3U.js} +1 -1
  48. package/browser/{chunk-DKYRDLPT.js → chunk-INRW2HMM.js} +1 -1
  49. package/browser/{chunk-HVU57OBO.js → chunk-IRZKBO3R.js} +1 -1
  50. package/browser/{chunk-QEQYG6NP.js → chunk-J7MEV3SC.js} +1 -1
  51. package/browser/{chunk-ZOUNYIXS.js → chunk-K36EZU7B.js} +1 -1
  52. package/browser/{chunk-EJWTPTAG.js → chunk-K7XDWKE4.js} +1 -1
  53. package/browser/{chunk-Z6C6LGTE.js → chunk-KD4QOECI.js} +1 -1
  54. package/browser/{chunk-2JF7K2Z6.js → chunk-KU36VLPV.js} +1 -1
  55. package/browser/{chunk-7MKOZEW3.js → chunk-KYKEPIQL.js} +1 -1
  56. package/browser/chunk-L3IUCWEG.js +1 -0
  57. package/browser/{chunk-6N4HOPDO.js → chunk-LI5O5W5U.js} +1 -1
  58. package/browser/{chunk-7GZ53SMA.js → chunk-LOLFRAYE.js} +1 -1
  59. package/browser/{chunk-NGFV2GOG.js → chunk-LOPMIU43.js} +1 -1
  60. package/browser/{chunk-BCJQMPSN.js → chunk-M223YYM7.js} +1 -1
  61. package/browser/{chunk-S5PL4GGK.js → chunk-M7PFWRYP.js} +1 -1
  62. package/browser/{chunk-IVON2WY7.js → chunk-MC5GFFBH.js} +1 -1
  63. package/browser/{chunk-KKRMERO6.js → chunk-N4UHDV2I.js} +1 -1
  64. package/browser/{chunk-DDNUMYIX.js → chunk-NDU4XEZ3.js} +1 -1
  65. package/browser/{chunk-22YK2QZC.js → chunk-NEF5K4QD.js} +1 -1
  66. package/browser/{chunk-53Z4RCWC.js → chunk-NIF3FKND.js} +1 -1
  67. package/browser/{chunk-ZGPWXTMJ.js → chunk-NRF2VT56.js} +1 -1
  68. package/browser/{chunk-66GUDVNB.js → chunk-NUV6BLG5.js} +2 -2
  69. package/browser/{chunk-MSYP5HON.js → chunk-O6DG2DFQ.js} +1 -1
  70. package/browser/{chunk-WXF6EXR3.js → chunk-OD4PKNSO.js} +1 -1
  71. package/browser/{chunk-R3O6RQV4.js → chunk-OG5CVJHJ.js} +1 -1
  72. package/browser/{chunk-JU625FM7.js → chunk-OQODH2AI.js} +1 -1
  73. package/browser/{chunk-HFOJOYW6.js → chunk-OWTLPHOE.js} +1 -1
  74. package/browser/{chunk-ZKAKTOW6.js → chunk-PBNQVFG2.js} +1 -1
  75. package/browser/{chunk-ZBIIJFHE.js → chunk-PSEMY4WU.js} +1 -1
  76. package/browser/chunk-R52G6U5F.js +11 -0
  77. package/browser/{chunk-XNGQDM7G.js → chunk-RDFUIZY6.js} +1 -1
  78. package/browser/{chunk-J23RT7UR.js → chunk-U2S2WVBG.js} +1 -1
  79. package/browser/{chunk-QRY3QKUL.js → chunk-UBKQZQBP.js} +1 -1
  80. package/browser/{chunk-DWFJEAUI.js → chunk-UG7OOHLY.js} +2 -2
  81. package/browser/{chunk-7EDEQHUN.js → chunk-UVKUHTJT.js} +1 -1
  82. package/browser/{chunk-FDTORORN.js → chunk-V3EUVBWD.js} +1 -1
  83. package/browser/{chunk-4GLDB3ML.js → chunk-V6DHTTJK.js} +1 -1
  84. package/browser/{chunk-XV7XMINZ.js → chunk-V7EGQJML.js} +2 -2
  85. package/browser/{chunk-R6L4VV45.js → chunk-VALWFDKG.js} +1 -1
  86. package/browser/chunk-VT4EM3QO.js +1 -0
  87. package/browser/{chunk-QMHATS7H.js → chunk-VVM6YTQD.js} +1 -1
  88. package/browser/{chunk-6DL2HFI2.js → chunk-VVOZFTTD.js} +1 -1
  89. package/browser/{chunk-DWWMASAN.js → chunk-W6SALZTK.js} +1 -1
  90. package/browser/{chunk-P5ZKZTQA.js → chunk-WBSYV5NH.js} +1 -1
  91. package/browser/{chunk-EPC6IUFK.js → chunk-WJWQRYP7.js} +1 -1
  92. package/browser/{chunk-DS2LKTCE.js → chunk-WK2QV2CH.js} +1 -1
  93. package/browser/{chunk-GHEC3H7W.js → chunk-WSNRK3WX.js} +1 -1
  94. package/browser/{chunk-5NGXUBZE.js → chunk-WZC6CPRN.js} +1 -1
  95. package/browser/{chunk-MF7PSD2B.js → chunk-X3Q3I5LF.js} +2 -2
  96. package/browser/{chunk-UI2QG4LA.js → chunk-XHLD53KC.js} +1 -1
  97. package/browser/{chunk-GO2OEK5G.js → chunk-Y6IU4WDT.js} +1 -1
  98. package/browser/{chunk-5BRWI7R4.js → chunk-ZIE7Q4W2.js} +1 -1
  99. package/browser/{chunk-IZHJL7WM.js → chunk-ZOK2GCYG.js} +1 -1
  100. package/browser/index.html +2 -2
  101. package/browser/{main-O6OEY4B7.js → main-O5MF7O5N.js} +1 -1
  102. package/package.json +1 -1
  103. package/browser/chunk-33Z5X5WD.js +0 -11
  104. package/browser/chunk-4NSVX6Y4.js +0 -1
  105. package/browser/chunk-DUT3VDMA.js +0 -1
  106. package/browser/chunk-OPP6QU6P.js +0 -1
  107. package/browser/chunk-VL3KFQEF.js +0 -1
  108. package/browser/chunk-Z6F2N6Y5.js +0 -1
@@ -1 +1 @@
1
- import{a as $}from"./chunk-4JLTTWPU.js";import{d as ae}from"./chunk-U32TNGSA.js";import{a as ee}from"./chunk-ZOJ2SXZQ.js";import"./chunk-L7GZIOUH.js";import{a as le,b as pe,c as me,e as ce,f as de,g as _e}from"./chunk-PHMY5YYO.js";import{a as re}from"./chunk-3JF6BHHX.js";import"./chunk-BKZQ7DWL.js";import"./chunk-FDDRNTSU.js";import"./chunk-2OMOLCWE.js";import"./chunk-GVCG6GZY.js";import"./chunk-FM4TOF43.js";import{a as X}from"./chunk-DUT3VDMA.js";import{b as Z}from"./chunk-TATP2XII.js";import"./chunk-X2BF4P6B.js";import"./chunk-DS2LKTCE.js";import"./chunk-4GLDB3ML.js";import"./chunk-DLFAOP72.js";import"./chunk-26OH33CP.js";import{a as ie}from"./chunk-5AKPII6Z.js";import{g as ne,h as oe}from"./chunk-J23RT7UR.js";import"./chunk-WGCOKLXJ.js";import"./chunk-S75O6CLV.js";import"./chunk-7NZ4EUXR.js";import"./chunk-AE4VC5SW.js";import"./chunk-ZBD75MNM.js";import"./chunk-EP2JPVGQ.js";import"./chunk-ZIFDXGAA.js";import"./chunk-RDPIGDPR.js";import"./chunk-5MFMEZN7.js";import"./chunk-REKKC3GE.js";import"./chunk-BM6BALOR.js";import"./chunk-PZV2OPOG.js";import"./chunk-JGFMZR43.js";import"./chunk-JCSUMYGG.js";import"./chunk-P2ZVNLRQ.js";import"./chunk-6K6JOBI3.js";import"./chunk-QMHATS7H.js";import{a as te}from"./chunk-MSYP5HON.js";import"./chunk-YBYU2NPK.js";import"./chunk-Y6PUTPXJ.js";import"./chunk-IVON2WY7.js";import"./chunk-NKXJK5OA.js";import"./chunk-YCVG7SEH.js";import"./chunk-P2FAKIKL.js";import"./chunk-IJDHU46P.js";import"./chunk-IQFUVZ6Y.js";import"./chunk-MQW2LRVQ.js";import{a as K,b as U}from"./chunk-ZFSMBBTC.js";import"./chunk-YNQPX5G6.js";import"./chunk-HL4M3UN2.js";import"./chunk-QSEKGLC7.js";import"./chunk-DCS4THVW.js";import"./chunk-CVRHFTCA.js";import"./chunk-BMJCTNKZ.js";import{c as Y}from"./chunk-7HKIQJO2.js";import"./chunk-GXXXD7U4.js";import"./chunk-TECQKS2T.js";import"./chunk-HMY7DJXX.js";import"./chunk-HGTO3QEP.js";import"./chunk-5YJ3RTH6.js";import"./chunk-WOETHOGU.js";import"./chunk-ZIR7IDMB.js";import"./chunk-ONJ4E7DL.js";import"./chunk-IIFF2GRQ.js";import"./chunk-UNE3K3SG.js";import{va as J}from"./chunk-PDGCWLMX.js";import{E as q,c as N,h as k,o as Q,q as j}from"./chunk-TG23CQGV.js";import"./chunk-QTC47BGO.js";import"./chunk-WD7LJ2J6.js";import"./chunk-PRQZ2TZC.js";import{b as z}from"./chunk-CORTGR3V.js";import"./chunk-PTRS3UA6.js";import"./chunk-IFZ7WOA2.js";import{q as G}from"./chunk-FWVQ6CFL.js";import{Ab as u,Bb as a,Cb as o,Cc as d,Db as f,Dc as g,Ec as h,Gd as R,Ic as O,Mb as D,Nd as W,Pb as B,Pd as A,Ra as r,Rb as p,Ya as v,ab as P,ec as l,fb as E,fc as M,gb as w,gc as y,jc as S,kc as b,lc as T,pa as C,pc as V,pd as L,qa as x,sd as H,tb as _,uc as I,vb as s,vc as F}from"./chunk-KYVLS64M.js";import"./chunk-KMHZKFQS.js";var ge=()=>({"min-width":"50rem","font-family":"Roboto, sans-serif"}),ye=()=>["/menu/Products/Catalog/Products"],se=t=>({CategoryID:t}),Ce=()=>["/menu/Inventory/Quantity/Valuation"];function xe(t,m){if(t&1){let e=D();a(0,"button",10),B("click",function(){C(e);let n=p(2);return x(n.openExportModal())}),f(1,"i",11),l(2," Export "),o()}}function fe(t,m){if(t&1){let e=D();a(0,"div",12)(1,"h6"),l(2,"Outlet"),o(),a(3,"outlet-selector",13),T("ngModelChange",function(n){C(e);let c=p(2);return b(c.pageData().Filter.ListIDs,n)||(c.pageData().Filter.ListIDs=n),x(n)}),o(),a(4,"h6"),l(5,"Quantity From - To"),o(),a(6,"div",14)(7,"input",15),T("ngModelChange",function(n){C(e);let c=p(2);return b(c.pageData().Filter.QuantityFrom,n)||(c.pageData().Filter.QuantityFrom=n),x(n)}),o(),a(8,"span",16),l(9,"-"),o(),a(10,"input",17),T("ngModelChange",function(n){C(e);let c=p(2);return b(c.pageData().Filter.QuantityTo,n)||(c.pageData().Filter.QuantityTo=n),x(n)}),o()(),a(11,"h6"),l(12,"Discontinued"),o(),a(13,"radio-options",18),T("modelChange",function(n){C(e);let c=p(2);return b(c.pageData().Filter.Discontinued,n)||(c.pageData().Filter.Discontinued=n),x(n)}),o()()}if(t&2){let e=p(2);r(3),u("multiple",!0)("accessType",2),S("ngModel",e.pageData().Filter.ListIDs),r(4),S("ngModel",e.pageData().Filter.QuantityFrom),r(3),S("ngModel",e.pageData().Filter.QuantityTo),r(3),S("model",e.pageData().Filter.Discontinued),u("options",e.pageData().Options.Discontinued)}}function ve(t,m){t&1&&(a(0,"th",24),l(1," Cost "),f(2,"p-treeTableSortIcon",27),o())}function Se(t,m){t&1&&(a(0,"th",25),l(1," Price "),f(2,"p-treeTableSortIcon",28),o())}function be(t,m){t&1&&(a(0,"th",26),l(1," % "),f(2,"p-treeTableSortIcon",29),o())}function Te(t,m){if(t&1&&(a(0,"tr",19)(1,"th",20),l(2," Category "),f(3,"p-treeTableSortIcon",21),o(),a(4,"th",22),l(5," On Hand "),f(6,"p-treeTableSortIcon",23),o(),_(7,ve,3,0,"th",24),_(8,Se,3,0,"th",25),_(9,be,3,0,"th",26),o()),t&2){let e=p(2);r(7),s(e.roleService.product.Cost?7:-1),r(),s(e.roleService.product.Price?8:-1),r(),s(e.roleService.product.Cost&&e.roleService.product.Price?9:-1)}}function De(t,m){if(t&1&&(a(0,"td"),l(1),d(2,"amountFraction"),o()),t&2){let e=p().rowData;r(),y(" ",g(2,1,e.DisplayedCost)," ")}}function Ie(t,m){if(t&1&&(a(0,"td"),l(1),d(2,"amountFraction"),o()),t&2){let e=p().rowData;r(),y(" ",g(2,1,e.DisplayedPrice)," ")}}function he(t,m){if(t&1&&(a(0,"td")(1,"span",34),d(2,"number"),l(3),d(4,"number"),o()()),t&2){let e=p().rowData;r(),u("matTooltip",h(2,2,e.DisplayedPercentage,"1.0-5")+"%"),r(2),y(" ",h(4,5,e.DisplayedPercentage,"1.0-0"),"% ")}}function we(t,m){if(t&1&&(a(0,"tr",30)(1,"td"),f(2,"p-treeTableToggler",31),a(3,"a",32),l(4),o()(),a(5,"td")(6,"a",33),d(7,"number"),d(8,"number"),d(9,"number"),l(10),d(11,"quantityFraction"),o()(),_(12,De,3,3,"td"),_(13,Ie,3,3,"td"),_(14,he,5,8,"td"),o()),t&2){let e=m.$implicit,i=m.rowData,n=p(2);u("ttRow",e),r(2),u("rowNode",e),r(),u("routerLink",I(21,ye))("queryParams",F(22,se,i.ID)),r(),M(i.Name),r(2),u("matTooltip",V(i.OnHandIndirect&&i.OnHand?"Direct ("+g(7,13,i.OnHand)+") Indirect ("+g(8,15,i.OnHandIndirect)+")":i.OnHandIndirect?"Indirect ("+g(9,17,i.OnHandIndirect)+")":""))("routerLink",I(24,Ce))("queryParams",F(25,se,i.ID)),r(4),y("",g(11,19,i.DisplayedOnHand)," "),r(2),s(n.roleService.product.Cost?12:-1),r(),s(n.roleService.product.Price?13:-1),r(),s(n.roleService.product.Cost&&n.roleService.product.Price?14:-1)}}function Be(t,m){if(t&1&&(a(0,"td",36),l(1),d(2,"amountFraction"),o()),t&2){let e,i=p(3);r(),y(" ",g(2,1,(e=i.data())==null||e.Aggregate==null?null:e.Aggregate.TotalCost)," ")}}function Fe(t,m){if(t&1&&(a(0,"td",36),l(1),d(2,"amountFraction"),o()),t&2){let e,i=p(3);r(),y(" ",g(2,1,(e=i.data())==null||e.Aggregate==null?null:e.Aggregate.TotalPrice)," ")}}function Pe(t,m){if(t&1&&(a(0,"td",36),l(1),d(2,"number"),o()),t&2){let e,i=p(3);r(),y(" ",h(2,1,(e=i.data())==null||e.Aggregate==null?null:e.Aggregate.TotalPercentage,"1.0-0"),"% ")}}function Ee(t,m){if(t&1&&(a(0,"tr",35)(1,"td",36),l(2,"Total:"),o(),a(3,"td",36),l(4),d(5,"quantityFraction"),o(),_(6,Be,3,3,"td",36),_(7,Fe,3,3,"td",36),_(8,Pe,3,4,"td",36),o()),t&2){let e,i=p(2);r(4),y(" ",g(5,4,(e=i.data())==null||e.Aggregate==null?null:e.Aggregate.TotalOnHand)," "),r(2),s(i.roleService.product.Cost?6:-1),r(),s(i.roleService.product.Price?7:-1),r(),s(i.roleService.product.Cost&&i.roleService.product.Price?8:-1)}}function Me(t,m){if(t&1){let e=D();a(0,"mainpanel-cmp",2),B("onSubmit",function(){C(e);let n=p();return x(n.searchFromPageOne())}),T("filterChange",function(n){C(e);let c=p();return b(c.pageData().Filter,n)||(c.pageData().Filter=n),x(n)}),a(1,"actions"),_(2,xe,3,0,"button",3),o(),a(3,"div",4),w(4,fe,14,7,"ng-template",null,0,O),o(),a(6,"content")(7,"div",5)(8,"p-treeTable",6),w(9,Te,10,3,"ng-template",7)(10,we,15,27,"ng-template",8)(11,Ee,9,6,"ng-template",9),o()()()()}if(t&2){let e=p();u("pageData",e.menuData())("hideSearchBox",!0)("isFilterOnDropdown",!1),S("filter",e.pageData().Filter),r(2),s(e.roleService.global.Export?2:-1),r(6),u("value",e.data().data)("scrollable",!0)("scrollable",!0)("tableStyle",I(9,ge))}}var ue=class t extends X{constructor(e,i,n,c,Ve,Oe){super(e,i,"Inventory/GetByCategory","InventoryLoader/GetByCategory");this.httpService=i;this.csvConverter=n;this.pageTitle=c;this.roleService=Ve;this.dialog=Oe}openExportModal(){this.dialog.open(Z,{data:{title:"Inventory By Category",exportTypes:[{ID:"inventoryexport/GetExportInventoryByCategory",Value:"Default",FileName:"Inventory By Category"}],filterExport:this.pageData().Filter,getAllDataLengthAPI:"",pagination:!1}})}static \u0275fac=function(i){return new(i||t)(v(te),v(G),v(ie),v(R),v(z),v(Y))};static \u0275cmp=P({type:t,selectors:[["app-inventory-by-category"]],features:[E],decls:1,vars:1,consts:[["pageFilterTemplate",""],[3,"pageData","hideSearchBox","isFilterOnDropdown","filter"],[3,"onSubmit","filterChange","pageData","hideSearchBox","isFilterOnDropdown","filter"],[1,"btn","btn-outline-secondary","me-3"],["filters",""],[1,"container-fluid","mt-3"],[3,"value","scrollable","tableStyle"],["pTemplate","header"],["pTemplate","body"],["pTemplate","footer"],[1,"btn","btn-outline-secondary","me-3",3,"click"],["aria-hidden","true",1,"fa-solid","fa-upload"],[1,"dialog-filter"],["placeholder","Choose Outlet",1,"ng-select-multiple",3,"ngModelChange","multiple","accessType","ngModel"],[1,"d-flex","align-items-center"],["type","number","placeholder","From",1,"form-control",3,"ngModelChange","ngModel"],[1,"mx-3"],["type","number","placeholder","To",1,"form-control",3,"ngModelChange","ngModel"],[3,"modelChange","model","options"],[1,"custom-header"],["ttSortableColumn","Name",1,"text-uppercase"],["field","Name"],["ttSortableColumn","DisplayedOnHand",1,"text-uppercase"],["field","DisplayedOnHand"],["ttSortableColumn","DisplayedCost",1,"text-uppercase"],["ttSortableColumn","DisplayedPrice",1,"text-uppercase"],["ttSortableColumn","DisplayedPercentage",1,"text-uppercase"],["field","DisplayedCost"],["field","DisplayedPrice"],["field","DisplayedPercentage"],[3,"ttRow"],[3,"rowNode"],["target","_blank",3,"routerLink","queryParams"],["matTooltipPosition","above",3,"routerLink","queryParams","matTooltip"],["matTooltipPosition","above",3,"matTooltip"],[1,"table-footer"],[1,"text-end"]],template:function(i,n){i&1&&_(0,Me,12,10,"mainpanel-cmp",1),i&2&&s(n.data()?0:-1)},dependencies:[H,oe,ne,A,W,_e,le,J,de,pe,me,ce,re,ae,q,N,j,k,Q,U,K,L,$,ee],styles:[".p-treetable-scrollable-header-box{padding-right:0!important} .p-treetable .p-treetable-thead>tr>th:not(:first-child){text-align:right!important} .p-treetable .p-treetable-tbody>tr>td:not(:first-child){text-align:right!important} .p-treetable-scrollable-footer-box{padding-right:0!important} .table-header-styles, .p-treetable-tfoot td, .p-treetable-thead th{background:#f6f6f6!important;color:#3b3b3b!important;text-transform:uppercase!important;font-weight:700!important;line-height:25px!important;font-size:12px!important;font-family:Roboto,sans-serif!important} .p-component.p-iconwrapper>svg{height:11px!important} .p-treetable .p-treetable-tbody>tr>td{border-bottom-width:1px;border-color:#dee2e6}"],changeDetection:0})};export{ue as InventoryByCategoryComponent};
1
+ import{a as $}from"./chunk-4JLTTWPU.js";import{d as ae}from"./chunk-U32TNGSA.js";import{a as ee}from"./chunk-ZOJ2SXZQ.js";import"./chunk-L7GZIOUH.js";import{a as le,b as pe,c as me,e as ce,f as de,g as _e}from"./chunk-PHMY5YYO.js";import{a as re}from"./chunk-3JF6BHHX.js";import"./chunk-BKZQ7DWL.js";import"./chunk-FDDRNTSU.js";import"./chunk-2OMOLCWE.js";import"./chunk-GVCG6GZY.js";import"./chunk-FM4TOF43.js";import{a as X}from"./chunk-FBI7ISS4.js";import{b as Z}from"./chunk-TATP2XII.js";import"./chunk-X2BF4P6B.js";import"./chunk-WK2QV2CH.js";import"./chunk-V6DHTTJK.js";import"./chunk-DLFAOP72.js";import"./chunk-26OH33CP.js";import{a as ie}from"./chunk-5AKPII6Z.js";import{g as ne,h as oe}from"./chunk-U2S2WVBG.js";import"./chunk-WGCOKLXJ.js";import"./chunk-S75O6CLV.js";import"./chunk-7NZ4EUXR.js";import"./chunk-AE4VC5SW.js";import"./chunk-ZBD75MNM.js";import"./chunk-EP2JPVGQ.js";import"./chunk-ZIFDXGAA.js";import"./chunk-RDPIGDPR.js";import"./chunk-5MFMEZN7.js";import"./chunk-REKKC3GE.js";import"./chunk-BM6BALOR.js";import"./chunk-PZV2OPOG.js";import"./chunk-JGFMZR43.js";import"./chunk-JCSUMYGG.js";import"./chunk-P2ZVNLRQ.js";import"./chunk-6K6JOBI3.js";import"./chunk-VVM6YTQD.js";import{a as te}from"./chunk-O6DG2DFQ.js";import"./chunk-YBYU2NPK.js";import"./chunk-Y6PUTPXJ.js";import"./chunk-MC5GFFBH.js";import"./chunk-NKXJK5OA.js";import"./chunk-YCVG7SEH.js";import"./chunk-P2FAKIKL.js";import"./chunk-IJDHU46P.js";import"./chunk-IQFUVZ6Y.js";import"./chunk-MQW2LRVQ.js";import{a as K,b as U}from"./chunk-ZFSMBBTC.js";import"./chunk-YNQPX5G6.js";import"./chunk-HL4M3UN2.js";import"./chunk-QSEKGLC7.js";import"./chunk-DCS4THVW.js";import"./chunk-CVRHFTCA.js";import"./chunk-56AVTQ3P.js";import{c as Y}from"./chunk-7HKIQJO2.js";import"./chunk-GXXXD7U4.js";import"./chunk-TECQKS2T.js";import"./chunk-HMY7DJXX.js";import"./chunk-HGTO3QEP.js";import"./chunk-5YJ3RTH6.js";import"./chunk-WOETHOGU.js";import"./chunk-ZIR7IDMB.js";import"./chunk-ONJ4E7DL.js";import"./chunk-IIFF2GRQ.js";import"./chunk-UNE3K3SG.js";import{va as J}from"./chunk-PDGCWLMX.js";import{E as q,c as N,h as k,o as Q,q as j}from"./chunk-TG23CQGV.js";import"./chunk-2ZEGTT5F.js";import"./chunk-BYHCKVZ5.js";import"./chunk-PRQZ2TZC.js";import{b as z}from"./chunk-CORTGR3V.js";import"./chunk-PTRS3UA6.js";import"./chunk-C6Z4KJ2K.js";import{q as G}from"./chunk-FWVQ6CFL.js";import{Ab as u,Bb as a,Cb as o,Cc as d,Db as f,Dc as g,Ec as h,Gd as R,Ic as O,Mb as D,Nd as W,Pb as B,Pd as A,Ra as r,Rb as p,Ya as v,ab as P,ec as l,fb as E,fc as M,gb as w,gc as y,jc as S,kc as b,lc as T,pa as C,pc as V,pd as L,qa as x,sd as H,tb as _,uc as I,vb as s,vc as F}from"./chunk-KYVLS64M.js";import"./chunk-KMHZKFQS.js";var ge=()=>({"min-width":"50rem","font-family":"Roboto, sans-serif"}),ye=()=>["/menu/Products/Catalog/Products"],se=t=>({CategoryID:t}),Ce=()=>["/menu/Inventory/Quantity/Valuation"];function xe(t,m){if(t&1){let e=D();a(0,"button",10),B("click",function(){C(e);let n=p(2);return x(n.openExportModal())}),f(1,"i",11),l(2," Export "),o()}}function fe(t,m){if(t&1){let e=D();a(0,"div",12)(1,"h6"),l(2,"Outlet"),o(),a(3,"outlet-selector",13),T("ngModelChange",function(n){C(e);let c=p(2);return b(c.pageData().Filter.ListIDs,n)||(c.pageData().Filter.ListIDs=n),x(n)}),o(),a(4,"h6"),l(5,"Quantity From - To"),o(),a(6,"div",14)(7,"input",15),T("ngModelChange",function(n){C(e);let c=p(2);return b(c.pageData().Filter.QuantityFrom,n)||(c.pageData().Filter.QuantityFrom=n),x(n)}),o(),a(8,"span",16),l(9,"-"),o(),a(10,"input",17),T("ngModelChange",function(n){C(e);let c=p(2);return b(c.pageData().Filter.QuantityTo,n)||(c.pageData().Filter.QuantityTo=n),x(n)}),o()(),a(11,"h6"),l(12,"Discontinued"),o(),a(13,"radio-options",18),T("modelChange",function(n){C(e);let c=p(2);return b(c.pageData().Filter.Discontinued,n)||(c.pageData().Filter.Discontinued=n),x(n)}),o()()}if(t&2){let e=p(2);r(3),u("multiple",!0)("accessType",2),S("ngModel",e.pageData().Filter.ListIDs),r(4),S("ngModel",e.pageData().Filter.QuantityFrom),r(3),S("ngModel",e.pageData().Filter.QuantityTo),r(3),S("model",e.pageData().Filter.Discontinued),u("options",e.pageData().Options.Discontinued)}}function ve(t,m){t&1&&(a(0,"th",24),l(1," Cost "),f(2,"p-treeTableSortIcon",27),o())}function Se(t,m){t&1&&(a(0,"th",25),l(1," Price "),f(2,"p-treeTableSortIcon",28),o())}function be(t,m){t&1&&(a(0,"th",26),l(1," % "),f(2,"p-treeTableSortIcon",29),o())}function Te(t,m){if(t&1&&(a(0,"tr",19)(1,"th",20),l(2," Category "),f(3,"p-treeTableSortIcon",21),o(),a(4,"th",22),l(5," On Hand "),f(6,"p-treeTableSortIcon",23),o(),_(7,ve,3,0,"th",24),_(8,Se,3,0,"th",25),_(9,be,3,0,"th",26),o()),t&2){let e=p(2);r(7),s(e.roleService.product.Cost?7:-1),r(),s(e.roleService.product.Price?8:-1),r(),s(e.roleService.product.Cost&&e.roleService.product.Price?9:-1)}}function De(t,m){if(t&1&&(a(0,"td"),l(1),d(2,"amountFraction"),o()),t&2){let e=p().rowData;r(),y(" ",g(2,1,e.DisplayedCost)," ")}}function Ie(t,m){if(t&1&&(a(0,"td"),l(1),d(2,"amountFraction"),o()),t&2){let e=p().rowData;r(),y(" ",g(2,1,e.DisplayedPrice)," ")}}function he(t,m){if(t&1&&(a(0,"td")(1,"span",34),d(2,"number"),l(3),d(4,"number"),o()()),t&2){let e=p().rowData;r(),u("matTooltip",h(2,2,e.DisplayedPercentage,"1.0-5")+"%"),r(2),y(" ",h(4,5,e.DisplayedPercentage,"1.0-0"),"% ")}}function we(t,m){if(t&1&&(a(0,"tr",30)(1,"td"),f(2,"p-treeTableToggler",31),a(3,"a",32),l(4),o()(),a(5,"td")(6,"a",33),d(7,"number"),d(8,"number"),d(9,"number"),l(10),d(11,"quantityFraction"),o()(),_(12,De,3,3,"td"),_(13,Ie,3,3,"td"),_(14,he,5,8,"td"),o()),t&2){let e=m.$implicit,i=m.rowData,n=p(2);u("ttRow",e),r(2),u("rowNode",e),r(),u("routerLink",I(21,ye))("queryParams",F(22,se,i.ID)),r(),M(i.Name),r(2),u("matTooltip",V(i.OnHandIndirect&&i.OnHand?"Direct ("+g(7,13,i.OnHand)+") Indirect ("+g(8,15,i.OnHandIndirect)+")":i.OnHandIndirect?"Indirect ("+g(9,17,i.OnHandIndirect)+")":""))("routerLink",I(24,Ce))("queryParams",F(25,se,i.ID)),r(4),y("",g(11,19,i.DisplayedOnHand)," "),r(2),s(n.roleService.product.Cost?12:-1),r(),s(n.roleService.product.Price?13:-1),r(),s(n.roleService.product.Cost&&n.roleService.product.Price?14:-1)}}function Be(t,m){if(t&1&&(a(0,"td",36),l(1),d(2,"amountFraction"),o()),t&2){let e,i=p(3);r(),y(" ",g(2,1,(e=i.data())==null||e.Aggregate==null?null:e.Aggregate.TotalCost)," ")}}function Fe(t,m){if(t&1&&(a(0,"td",36),l(1),d(2,"amountFraction"),o()),t&2){let e,i=p(3);r(),y(" ",g(2,1,(e=i.data())==null||e.Aggregate==null?null:e.Aggregate.TotalPrice)," ")}}function Pe(t,m){if(t&1&&(a(0,"td",36),l(1),d(2,"number"),o()),t&2){let e,i=p(3);r(),y(" ",h(2,1,(e=i.data())==null||e.Aggregate==null?null:e.Aggregate.TotalPercentage,"1.0-0"),"% ")}}function Ee(t,m){if(t&1&&(a(0,"tr",35)(1,"td",36),l(2,"Total:"),o(),a(3,"td",36),l(4),d(5,"quantityFraction"),o(),_(6,Be,3,3,"td",36),_(7,Fe,3,3,"td",36),_(8,Pe,3,4,"td",36),o()),t&2){let e,i=p(2);r(4),y(" ",g(5,4,(e=i.data())==null||e.Aggregate==null?null:e.Aggregate.TotalOnHand)," "),r(2),s(i.roleService.product.Cost?6:-1),r(),s(i.roleService.product.Price?7:-1),r(),s(i.roleService.product.Cost&&i.roleService.product.Price?8:-1)}}function Me(t,m){if(t&1){let e=D();a(0,"mainpanel-cmp",2),B("onSubmit",function(){C(e);let n=p();return x(n.searchFromPageOne())}),T("filterChange",function(n){C(e);let c=p();return b(c.pageData().Filter,n)||(c.pageData().Filter=n),x(n)}),a(1,"actions"),_(2,xe,3,0,"button",3),o(),a(3,"div",4),w(4,fe,14,7,"ng-template",null,0,O),o(),a(6,"content")(7,"div",5)(8,"p-treeTable",6),w(9,Te,10,3,"ng-template",7)(10,we,15,27,"ng-template",8)(11,Ee,9,6,"ng-template",9),o()()()()}if(t&2){let e=p();u("pageData",e.menuData())("hideSearchBox",!0)("isFilterOnDropdown",!1),S("filter",e.pageData().Filter),r(2),s(e.roleService.global.Export?2:-1),r(6),u("value",e.data().data)("scrollable",!0)("scrollable",!0)("tableStyle",I(9,ge))}}var ue=class t extends X{constructor(e,i,n,c,Ve,Oe){super(e,i,"Inventory/GetByCategory","InventoryLoader/GetByCategory");this.httpService=i;this.csvConverter=n;this.pageTitle=c;this.roleService=Ve;this.dialog=Oe}openExportModal(){this.dialog.open(Z,{data:{title:"Inventory By Category",exportTypes:[{ID:"inventoryexport/GetExportInventoryByCategory",Value:"Default",FileName:"Inventory By Category"}],filterExport:this.pageData().Filter,getAllDataLengthAPI:"",pagination:!1}})}static \u0275fac=function(i){return new(i||t)(v(te),v(G),v(ie),v(R),v(z),v(Y))};static \u0275cmp=P({type:t,selectors:[["app-inventory-by-category"]],features:[E],decls:1,vars:1,consts:[["pageFilterTemplate",""],[3,"pageData","hideSearchBox","isFilterOnDropdown","filter"],[3,"onSubmit","filterChange","pageData","hideSearchBox","isFilterOnDropdown","filter"],[1,"btn","btn-outline-secondary","me-3"],["filters",""],[1,"container-fluid","mt-3"],[3,"value","scrollable","tableStyle"],["pTemplate","header"],["pTemplate","body"],["pTemplate","footer"],[1,"btn","btn-outline-secondary","me-3",3,"click"],["aria-hidden","true",1,"fa-solid","fa-upload"],[1,"dialog-filter"],["placeholder","Choose Outlet",1,"ng-select-multiple",3,"ngModelChange","multiple","accessType","ngModel"],[1,"d-flex","align-items-center"],["type","number","placeholder","From",1,"form-control",3,"ngModelChange","ngModel"],[1,"mx-3"],["type","number","placeholder","To",1,"form-control",3,"ngModelChange","ngModel"],[3,"modelChange","model","options"],[1,"custom-header"],["ttSortableColumn","Name",1,"text-uppercase"],["field","Name"],["ttSortableColumn","DisplayedOnHand",1,"text-uppercase"],["field","DisplayedOnHand"],["ttSortableColumn","DisplayedCost",1,"text-uppercase"],["ttSortableColumn","DisplayedPrice",1,"text-uppercase"],["ttSortableColumn","DisplayedPercentage",1,"text-uppercase"],["field","DisplayedCost"],["field","DisplayedPrice"],["field","DisplayedPercentage"],[3,"ttRow"],[3,"rowNode"],["target","_blank",3,"routerLink","queryParams"],["matTooltipPosition","above",3,"routerLink","queryParams","matTooltip"],["matTooltipPosition","above",3,"matTooltip"],[1,"table-footer"],[1,"text-end"]],template:function(i,n){i&1&&_(0,Me,12,10,"mainpanel-cmp",1),i&2&&s(n.data()?0:-1)},dependencies:[H,oe,ne,A,W,_e,le,J,de,pe,me,ce,re,ae,q,N,j,k,Q,U,K,L,$,ee],styles:[".p-treetable-scrollable-header-box{padding-right:0!important} .p-treetable .p-treetable-thead>tr>th:not(:first-child){text-align:right!important} .p-treetable .p-treetable-tbody>tr>td:not(:first-child){text-align:right!important} .p-treetable-scrollable-footer-box{padding-right:0!important} .table-header-styles, .p-treetable-tfoot td, .p-treetable-thead th{background:#f6f6f6!important;color:#3b3b3b!important;text-transform:uppercase!important;font-weight:700!important;line-height:25px!important;font-size:12px!important;font-family:Roboto,sans-serif!important} .p-component.p-iconwrapper>svg{height:11px!important} .p-treetable .p-treetable-tbody>tr>td{border-bottom-width:1px;border-color:#dee2e6}"],changeDetection:0})};export{ue as InventoryByCategoryComponent};
@@ -1 +1 @@
1
- import{c as u}from"./chunk-QTC47BGO.js";import{b as s}from"./chunk-CORTGR3V.js";import{Md as a,la as e}from"./chunk-KYVLS64M.js";var g=(t,c)=>{let r=e(a),i=e(u);if(i.isTokenExpired())return i.returnUrl=c.url,r.navigate(["/"]),!1;let d=e(s),o=t.data?.roles;if(o){let n=t.data?.unauthorizedRedirect;if(!o.some(l=>d.isUserHasRole(l)))return n?r.navigate([n]):r.navigate(["menu/Unauthorized/Main/Unauthorized"]),!1}return!0};export{g as a};
1
+ import{c as u}from"./chunk-2ZEGTT5F.js";import{b as s}from"./chunk-CORTGR3V.js";import{Md as a,la as e}from"./chunk-KYVLS64M.js";var g=(t,c)=>{let r=e(a),i=e(u);if(i.isTokenExpired())return i.returnUrl=c.url,r.navigate(["/"]),!1;let d=e(s),o=t.data?.roles;if(o){let n=t.data?.unauthorizedRedirect;if(!o.some(l=>d.isUserHasRole(l)))return n?r.navigate([n]):r.navigate(["menu/Unauthorized/Main/Unauthorized"]),!1}return!0};export{g as a};
@@ -1 +1 @@
1
- import{a as C}from"./chunk-WD7LJ2J6.js";import{a as N}from"./chunk-PRQZ2TZC.js";import{b as R}from"./chunk-CORTGR3V.js";import{a as u}from"./chunk-PTRS3UA6.js";import{q as U}from"./chunk-FWVQ6CFL.js";import{Ga as T,Md as v,ca as S,ha as p,ka as m,la as g,td as d,ua as h}from"./chunk-KYVLS64M.js";var k=(o=>(o[o.PAID=0]="PAID",o[o.OVERDUE=1]="OVERDUE",o[o.SELL_ONLY=2]="SELL_ONLY",o[o.SUSPENDED=3]="SUSPENDED",o))(k||{});var b=(()=>{class n{constructor(){this.document=g(h),this.platformId=g(T),this.documentIsAccessible=d(this.platformId)}static getCookieRegExp(e){let i=e.replace(/([[\]{}()|=;+?,.*^$\\])/gi,"\\$1");return new RegExp("(?:^"+i+"|;\\s*"+i+")=(.*?)(?:;|$)","g")}static safeDecodeURIComponent(e){try{return decodeURIComponent(e)}catch(i){return e}}check(e){return this.documentIsAccessible?(e=encodeURIComponent(e),n.getCookieRegExp(e).test(this.document.cookie)):!1}get(e){if(this.check(e)){e=encodeURIComponent(e);let o=n.getCookieRegExp(e).exec(this.document.cookie);return o?.[1]?n.safeDecodeURIComponent(o[1]):""}else return""}getAll(){if(!this.documentIsAccessible)return{};let e={},i=this.document;return i.cookie&&i.cookie!==""&&i.cookie.split(";").forEach(o=>{let[c,s]=o.split("=");e[n.safeDecodeURIComponent(c.replace(/^ /,""))]=n.safeDecodeURIComponent(s)}),e}set(e,i,o,c,s,l,I,L){if(!this.documentIsAccessible)return;if(typeof o=="number"||o instanceof Date||c||s||l||I){let f={expires:o,path:c,domain:s,secure:l,sameSite:I||"Lax",partitioned:L};this.set(e,i,f);return}let a=encodeURIComponent(e)+"="+encodeURIComponent(i)+";",r=o||{};if(r.expires)if(typeof r.expires=="number"){let f=new Date(new Date().getTime()+r.expires*1e3*60*60*24);a+="expires="+f.toUTCString()+";"}else a+="expires="+r.expires.toUTCString()+";";r.path&&(a+="path="+r.path+";"),r.domain&&(a+="domain="+r.domain+";"),r.secure===!1&&r.sameSite==="None"&&(r.secure=!0,console.warn(`[ngx-cookie-service] Cookie ${e} was forced with secure flag because sameSite=None.More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130`)),r.secure&&(a+="secure;"),r.sameSite||(r.sameSite="Lax"),a+="sameSite="+r.sameSite+";",r.partitioned&&(a+="Partitioned;"),this.document.cookie=a}delete(e,i,o,c,s="Lax"){if(!this.documentIsAccessible)return;let l=new Date("Thu, 01 Jan 1970 00:00:01 GMT");this.set(e,"",{expires:l,path:i,domain:o,secure:c,sameSite:s})}deleteAll(e,i,o,c="Lax"){if(!this.documentIsAccessible)return;let s=this.getAll();for(let l in s)s.hasOwnProperty(l)&&this.delete(l,e,i,o,c)}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275prov=p({token:n,factory:n.\u0275fac,providedIn:"root"})}}return n})();var A=class n{constructor(t,e,i,o,c,s){this.httpService=t;this.cookieService=e;this.router=i;this.roleService=o;this.intercomService=c;this.fraction=s}role=[];_returnUrl;_loginResponse;_jwtToken;set returnUrl(t){this._returnUrl=t}get returnUrl(){return this._returnUrl}login(t){return this.httpService.post("/api/Login/Web",t).pipe(S(e=>{this._loginResponse=e,e.Type=="geo"||e.Type=="totp"||this.saveLoginConfigToStorage(e)}))}loginLoader(){return this.httpService.get("/api/login/Loader")}getRedirectUrl(){let t=this.getSubscriptionStatus(),e=this.getRedirectUrlByRole();return(t==2||t==3)&&(e="/menu/Profile/Main/My_Subscription"),e}getRedirectUrlByRole(){let t,e=this.roleService;return e.dashboard.View?t="/menu/Dashboard":e.product.View?t="/menu/Products":t="/menu/Sell",t}logout(){localStorage.removeItem("ConfigData"),localStorage.removeItem("Token"),localStorage.removeItem("Roles"),localStorage.removeItem("AccountInfo"),localStorage.removeItem("CloudinaryConfig"),localStorage.removeItem("SubscriptionStatus"),this.cookieService.delete("ReportFilter","/"),this.intercomService.shutdown(),this._jwtToken=null,this.roleService.resetRoles(),this.router.navigate(["/"])}refreshToken(){this.httpService.post("/API/Authentication/RefreshToken",{}).subscribe(t=>{localStorage.removeItem("Token"),localStorage.setItem("Token",t.Token),this._jwtToken=null,this.roleService.resetRoles(),this.roleService.parseJWTRoles()})}isTokenExpired(){let t=localStorage.getItem("Token");if(t){let e=u.parseJwt(t),i=this.convertUnixTimesTamp(e.exp),o=new Date;if(i.getTime()-o.getTime()>0)return!1}return!0}isInRole(t){t.forEach(e=>e(this.role))}convertUnixTimesTamp(t){return new Date(t*1e3)}saveLoginConfigToStorage(t){localStorage.setItem("quantityFraction",JSON.stringify(t.UIConfig.Fraction.Quantity)),localStorage.setItem("amountFraction",JSON.stringify(t.UIConfig.Fraction.Amount)),this.fraction.setAmountFraction(t.UIConfig.Fraction.Amount.Minimum,t.UIConfig.Fraction.Amount.Maximum),this.fraction.setQuantityFraction(t.UIConfig.Fraction.Quantity.Minimum,t.UIConfig.Fraction.Quantity.Maximum),localStorage.setItem("AccountInfo",JSON.stringify(t?.AccountInfo)),localStorage.setItem("Token",t?.Token),localStorage.setItem("TinyMCEPlugins",t?.UIConfig.TinyMCE),this.intercomService.updateLocalStorage(t?.Intercom),localStorage.setItem("CloudinaryConfig",t?.UIConfig.CloudinaryConfig),localStorage.setItem("DataDaysRange",t?.UIConfig.DataDaysRange),localStorage.setItem("SubscriptionStatus",JSON.stringify(t?.SubscriptionStatus));let e=this.getParseToken();u.IsNotEmpty(e?.NotificationOutletID)&&localStorage.setItem("NotificationOutletID",e?.NotificationOutletID),this.roleService.parseJWTRoles(),this._loginResponse=null}getParseToken(){let t=localStorage.getItem("Token");return t&&!this._jwtToken&&(this._jwtToken=u.parseJwt(t)),this._jwtToken}get loginResponse(){return this._loginResponse}getSubscriptionStatus(){let t=localStorage.getItem("SubscriptionStatus");return t?parseInt(t):null}static \u0275fac=function(e){return new(e||n)(m(U),m(b),m(v),m(R),m(C),m(N))};static \u0275prov=p({token:n,factory:n.\u0275fac,providedIn:"root"})};export{k as a,b,A as c};
1
+ import{a as C}from"./chunk-BYHCKVZ5.js";import{a as N}from"./chunk-PRQZ2TZC.js";import{b as R}from"./chunk-CORTGR3V.js";import{a as u}from"./chunk-PTRS3UA6.js";import{q as U}from"./chunk-FWVQ6CFL.js";import{Ga as T,Md as v,ca as S,ha as p,ka as m,la as g,td as d,ua as h}from"./chunk-KYVLS64M.js";var k=(o=>(o[o.PAID=0]="PAID",o[o.OVERDUE=1]="OVERDUE",o[o.SELL_ONLY=2]="SELL_ONLY",o[o.SUSPENDED=3]="SUSPENDED",o))(k||{});var b=(()=>{class n{constructor(){this.document=g(h),this.platformId=g(T),this.documentIsAccessible=d(this.platformId)}static getCookieRegExp(e){let i=e.replace(/([[\]{}()|=;+?,.*^$\\])/gi,"\\$1");return new RegExp("(?:^"+i+"|;\\s*"+i+")=(.*?)(?:;|$)","g")}static safeDecodeURIComponent(e){try{return decodeURIComponent(e)}catch(i){return e}}check(e){return this.documentIsAccessible?(e=encodeURIComponent(e),n.getCookieRegExp(e).test(this.document.cookie)):!1}get(e){if(this.check(e)){e=encodeURIComponent(e);let o=n.getCookieRegExp(e).exec(this.document.cookie);return o?.[1]?n.safeDecodeURIComponent(o[1]):""}else return""}getAll(){if(!this.documentIsAccessible)return{};let e={},i=this.document;return i.cookie&&i.cookie!==""&&i.cookie.split(";").forEach(o=>{let[c,s]=o.split("=");e[n.safeDecodeURIComponent(c.replace(/^ /,""))]=n.safeDecodeURIComponent(s)}),e}set(e,i,o,c,s,l,I,L){if(!this.documentIsAccessible)return;if(typeof o=="number"||o instanceof Date||c||s||l||I){let f={expires:o,path:c,domain:s,secure:l,sameSite:I||"Lax",partitioned:L};this.set(e,i,f);return}let a=encodeURIComponent(e)+"="+encodeURIComponent(i)+";",r=o||{};if(r.expires)if(typeof r.expires=="number"){let f=new Date(new Date().getTime()+r.expires*1e3*60*60*24);a+="expires="+f.toUTCString()+";"}else a+="expires="+r.expires.toUTCString()+";";r.path&&(a+="path="+r.path+";"),r.domain&&(a+="domain="+r.domain+";"),r.secure===!1&&r.sameSite==="None"&&(r.secure=!0,console.warn(`[ngx-cookie-service] Cookie ${e} was forced with secure flag because sameSite=None.More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130`)),r.secure&&(a+="secure;"),r.sameSite||(r.sameSite="Lax"),a+="sameSite="+r.sameSite+";",r.partitioned&&(a+="Partitioned;"),this.document.cookie=a}delete(e,i,o,c,s="Lax"){if(!this.documentIsAccessible)return;let l=new Date("Thu, 01 Jan 1970 00:00:01 GMT");this.set(e,"",{expires:l,path:i,domain:o,secure:c,sameSite:s})}deleteAll(e,i,o,c="Lax"){if(!this.documentIsAccessible)return;let s=this.getAll();for(let l in s)s.hasOwnProperty(l)&&this.delete(l,e,i,o,c)}static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275prov=p({token:n,factory:n.\u0275fac,providedIn:"root"})}}return n})();var A=class n{constructor(t,e,i,o,c,s){this.httpService=t;this.cookieService=e;this.router=i;this.roleService=o;this.intercomService=c;this.fraction=s}role=[];_returnUrl;_loginResponse;_jwtToken;set returnUrl(t){this._returnUrl=t}get returnUrl(){return this._returnUrl}login(t){return this.httpService.post("/api/Login/Web",t).pipe(S(e=>{this._loginResponse=e,e.Type=="geo"||e.Type=="totp"||this.saveLoginConfigToStorage(e)}))}loginLoader(){return this.httpService.get("/api/login/Loader")}getRedirectUrl(){let t=this.getSubscriptionStatus(),e=this.getRedirectUrlByRole();return(t==2||t==3)&&(e="/menu/Profile/Main/My_Subscription"),e}getRedirectUrlByRole(){let t,e=this.roleService;return e.dashboard.View?t="/menu/Dashboard":e.product.View?t="/menu/Products":t="/menu/Sell",t}logout(){localStorage.removeItem("ConfigData"),localStorage.removeItem("Token"),localStorage.removeItem("Roles"),localStorage.removeItem("AccountInfo"),localStorage.removeItem("CloudinaryConfig"),localStorage.removeItem("SubscriptionStatus"),this.cookieService.delete("ReportFilter","/"),this.intercomService.shutdown(),this._jwtToken=null,this.roleService.resetRoles(),this.router.navigate(["/"])}refreshToken(){this.httpService.post("/API/Authentication/RefreshToken",{}).subscribe(t=>{localStorage.removeItem("Token"),localStorage.setItem("Token",t.Token),this._jwtToken=null,this.roleService.resetRoles(),this.roleService.parseJWTRoles()})}isTokenExpired(){let t=localStorage.getItem("Token");if(t){let e=u.parseJwt(t),i=this.convertUnixTimesTamp(e.exp),o=new Date;if(i.getTime()-o.getTime()>0)return!1}return!0}isInRole(t){t.forEach(e=>e(this.role))}convertUnixTimesTamp(t){return new Date(t*1e3)}saveLoginConfigToStorage(t){localStorage.setItem("quantityFraction",JSON.stringify(t.UIConfig.Fraction.Quantity)),localStorage.setItem("amountFraction",JSON.stringify(t.UIConfig.Fraction.Amount)),this.fraction.setAmountFraction(t.UIConfig.Fraction.Amount.Minimum,t.UIConfig.Fraction.Amount.Maximum),this.fraction.setQuantityFraction(t.UIConfig.Fraction.Quantity.Minimum,t.UIConfig.Fraction.Quantity.Maximum),localStorage.setItem("AccountInfo",JSON.stringify(t?.AccountInfo)),localStorage.setItem("Token",t?.Token),localStorage.setItem("TinyMCEPlugins",t?.UIConfig.TinyMCE),this.intercomService.updateLocalStorage(t?.Intercom),localStorage.setItem("CloudinaryConfig",t?.UIConfig.CloudinaryConfig),localStorage.setItem("DataDaysRange",t?.UIConfig.DataDaysRange),localStorage.setItem("SubscriptionStatus",JSON.stringify(t?.SubscriptionStatus));let e=this.getParseToken();u.IsNotEmpty(e?.NotificationOutletID)&&localStorage.setItem("NotificationOutletID",e?.NotificationOutletID),this.roleService.parseJWTRoles(),this._loginResponse=null}getParseToken(){let t=localStorage.getItem("Token");return t&&!this._jwtToken&&(this._jwtToken=u.parseJwt(t)),this._jwtToken}get loginResponse(){return this._loginResponse}getSubscriptionStatus(){let t=localStorage.getItem("SubscriptionStatus");return t?parseInt(t):null}static \u0275fac=function(e){return new(e||n)(m(U),m(b),m(v),m(R),m(C),m(N))};static \u0275prov=p({token:n,factory:n.\u0275fac,providedIn:"root"})};export{k as a,b,A as c};
@@ -1 +1 @@
1
- import{b as a}from"./chunk-WXF6EXR3.js";import"./chunk-3QL4K3P3.js";import"./chunk-22YK2QZC.js";import"./chunk-SN62YIZQ.js";import"./chunk-RUZO3Q5R.js";import"./chunk-OSNRQGZT.js";import"./chunk-4AAO7U7M.js";import"./chunk-ORRERWFF.js";import"./chunk-UI2QG4LA.js";import"./chunk-AW2DQQHL.js";import"./chunk-PM2FPEAY.js";import"./chunk-KJZ5YPHJ.js";import"./chunk-YBGXDESJ.js";import"./chunk-H4XC2S5C.js";import"./chunk-GLLJMDIK.js";import"./chunk-YCIBEAU3.js";import"./chunk-4EHRFK7R.js";import"./chunk-DF3NY4GQ.js";import"./chunk-C2BX6GFQ.js";import"./chunk-T7Z6HBXB.js";import"./chunk-ZZK3V7DR.js";import"./chunk-P3KIIKY4.js";import"./chunk-QF7JKDQT.js";import"./chunk-IGDSG57U.js";import"./chunk-QHCR6G3R.js";import"./chunk-RZ2MAOIO.js";import"./chunk-BYXBJQAS.js";import"./chunk-OCFT4T6N.js";import"./chunk-UNZM26ZC.js";import"./chunk-R7FZYIVK.js";import"./chunk-Q6FAFWIG.js";import"./chunk-H3FZHPK5.js";import"./chunk-JBDSWIIY.js";import"./chunk-K2CJU7UP.js";import"./chunk-7LOWDE4S.js";import"./chunk-4PEL7SJR.js";import"./chunk-55RTV2I3.js";import"./chunk-YTSYQGYH.js";import"./chunk-U32TNGSA.js";import"./chunk-L7GZIOUH.js";import"./chunk-PY7UTEHG.js";import"./chunk-RJXSWOYZ.js";import"./chunk-AZV7B5J6.js";import"./chunk-ANAX3HA6.js";import"./chunk-3JF6BHHX.js";import"./chunk-BKZQ7DWL.js";import"./chunk-DUT3VDMA.js";import"./chunk-TATP2XII.js";import"./chunk-X2BF4P6B.js";import"./chunk-DS2LKTCE.js";import"./chunk-4GLDB3ML.js";import"./chunk-DLFAOP72.js";import"./chunk-26OH33CP.js";import"./chunk-5AKPII6Z.js";import"./chunk-J23RT7UR.js";import"./chunk-WGCOKLXJ.js";import"./chunk-S75O6CLV.js";import"./chunk-7NZ4EUXR.js";import"./chunk-AE4VC5SW.js";import"./chunk-ZBD75MNM.js";import"./chunk-EP2JPVGQ.js";import"./chunk-ZIFDXGAA.js";import"./chunk-RDPIGDPR.js";import"./chunk-5MFMEZN7.js";import"./chunk-REKKC3GE.js";import"./chunk-BM6BALOR.js";import"./chunk-PZV2OPOG.js";import"./chunk-JGFMZR43.js";import"./chunk-JCSUMYGG.js";import"./chunk-P2ZVNLRQ.js";import"./chunk-6K6JOBI3.js";import"./chunk-QMHATS7H.js";import"./chunk-MSYP5HON.js";import"./chunk-YBYU2NPK.js";import"./chunk-Y6PUTPXJ.js";import"./chunk-IVON2WY7.js";import"./chunk-NKXJK5OA.js";import"./chunk-YCVG7SEH.js";import"./chunk-P2FAKIKL.js";import"./chunk-IJDHU46P.js";import"./chunk-IQFUVZ6Y.js";import"./chunk-MQW2LRVQ.js";import"./chunk-ZFSMBBTC.js";import"./chunk-YNQPX5G6.js";import"./chunk-HL4M3UN2.js";import"./chunk-QSEKGLC7.js";import"./chunk-DCS4THVW.js";import"./chunk-CVRHFTCA.js";import"./chunk-BMJCTNKZ.js";import"./chunk-7HKIQJO2.js";import"./chunk-GXXXD7U4.js";import"./chunk-TECQKS2T.js";import"./chunk-HMY7DJXX.js";import"./chunk-HGTO3QEP.js";import"./chunk-5YJ3RTH6.js";import"./chunk-WOETHOGU.js";import"./chunk-ZIR7IDMB.js";import"./chunk-ONJ4E7DL.js";import"./chunk-IIFF2GRQ.js";import"./chunk-UNE3K3SG.js";import"./chunk-PDGCWLMX.js";import"./chunk-TG23CQGV.js";import"./chunk-QTC47BGO.js";import"./chunk-WD7LJ2J6.js";import"./chunk-PRQZ2TZC.js";import"./chunk-CORTGR3V.js";import"./chunk-PTRS3UA6.js";import"./chunk-IFZ7WOA2.js";import"./chunk-FWVQ6CFL.js";import"./chunk-KYVLS64M.js";import"./chunk-KMHZKFQS.js";export{a as ContactsModule};
1
+ import{b as a}from"./chunk-OD4PKNSO.js";import"./chunk-HWKNQBB4.js";import"./chunk-NEF5K4QD.js";import"./chunk-SN62YIZQ.js";import"./chunk-RUZO3Q5R.js";import"./chunk-OSNRQGZT.js";import"./chunk-4AAO7U7M.js";import"./chunk-IJY44A3U.js";import"./chunk-XHLD53KC.js";import"./chunk-AW2DQQHL.js";import"./chunk-PM2FPEAY.js";import"./chunk-KJZ5YPHJ.js";import"./chunk-YBGXDESJ.js";import"./chunk-H4XC2S5C.js";import"./chunk-GLLJMDIK.js";import"./chunk-YCIBEAU3.js";import"./chunk-4EHRFK7R.js";import"./chunk-2DV4RVI2.js";import"./chunk-C2BX6GFQ.js";import"./chunk-T7Z6HBXB.js";import"./chunk-ZZK3V7DR.js";import"./chunk-P3KIIKY4.js";import"./chunk-QF7JKDQT.js";import"./chunk-IGDSG57U.js";import"./chunk-QHCR6G3R.js";import"./chunk-RZ2MAOIO.js";import"./chunk-BYXBJQAS.js";import"./chunk-OCFT4T6N.js";import"./chunk-UNZM26ZC.js";import"./chunk-R7FZYIVK.js";import"./chunk-Q6FAFWIG.js";import"./chunk-H3FZHPK5.js";import"./chunk-JBDSWIIY.js";import"./chunk-K2CJU7UP.js";import"./chunk-7LOWDE4S.js";import"./chunk-4PEL7SJR.js";import"./chunk-55RTV2I3.js";import"./chunk-YTSYQGYH.js";import"./chunk-U32TNGSA.js";import"./chunk-L7GZIOUH.js";import"./chunk-PY7UTEHG.js";import"./chunk-RJXSWOYZ.js";import"./chunk-AZV7B5J6.js";import"./chunk-ANAX3HA6.js";import"./chunk-3JF6BHHX.js";import"./chunk-BKZQ7DWL.js";import"./chunk-FBI7ISS4.js";import"./chunk-TATP2XII.js";import"./chunk-X2BF4P6B.js";import"./chunk-WK2QV2CH.js";import"./chunk-V6DHTTJK.js";import"./chunk-DLFAOP72.js";import"./chunk-26OH33CP.js";import"./chunk-5AKPII6Z.js";import"./chunk-U2S2WVBG.js";import"./chunk-WGCOKLXJ.js";import"./chunk-S75O6CLV.js";import"./chunk-7NZ4EUXR.js";import"./chunk-AE4VC5SW.js";import"./chunk-ZBD75MNM.js";import"./chunk-EP2JPVGQ.js";import"./chunk-ZIFDXGAA.js";import"./chunk-RDPIGDPR.js";import"./chunk-5MFMEZN7.js";import"./chunk-REKKC3GE.js";import"./chunk-BM6BALOR.js";import"./chunk-PZV2OPOG.js";import"./chunk-JGFMZR43.js";import"./chunk-JCSUMYGG.js";import"./chunk-P2ZVNLRQ.js";import"./chunk-6K6JOBI3.js";import"./chunk-VVM6YTQD.js";import"./chunk-O6DG2DFQ.js";import"./chunk-YBYU2NPK.js";import"./chunk-Y6PUTPXJ.js";import"./chunk-MC5GFFBH.js";import"./chunk-NKXJK5OA.js";import"./chunk-YCVG7SEH.js";import"./chunk-P2FAKIKL.js";import"./chunk-IJDHU46P.js";import"./chunk-IQFUVZ6Y.js";import"./chunk-MQW2LRVQ.js";import"./chunk-ZFSMBBTC.js";import"./chunk-YNQPX5G6.js";import"./chunk-HL4M3UN2.js";import"./chunk-QSEKGLC7.js";import"./chunk-DCS4THVW.js";import"./chunk-CVRHFTCA.js";import"./chunk-56AVTQ3P.js";import"./chunk-7HKIQJO2.js";import"./chunk-GXXXD7U4.js";import"./chunk-TECQKS2T.js";import"./chunk-HMY7DJXX.js";import"./chunk-HGTO3QEP.js";import"./chunk-5YJ3RTH6.js";import"./chunk-WOETHOGU.js";import"./chunk-ZIR7IDMB.js";import"./chunk-ONJ4E7DL.js";import"./chunk-IIFF2GRQ.js";import"./chunk-UNE3K3SG.js";import"./chunk-PDGCWLMX.js";import"./chunk-TG23CQGV.js";import"./chunk-2ZEGTT5F.js";import"./chunk-BYHCKVZ5.js";import"./chunk-PRQZ2TZC.js";import"./chunk-CORTGR3V.js";import"./chunk-PTRS3UA6.js";import"./chunk-C6Z4KJ2K.js";import"./chunk-FWVQ6CFL.js";import"./chunk-KYVLS64M.js";import"./chunk-KMHZKFQS.js";export{a as ContactsModule};
@@ -1 +1 @@
1
- import{b as $}from"./chunk-S77FVPQM.js";import{a as T,b as Q}from"./chunk-NH6IWUZH.js";import{a as h}from"./chunk-NZXJPRXS.js";import{a as W}from"./chunk-Z7IRMXUP.js";import{a as A,c as q}from"./chunk-GHEC3H7W.js";import{b as J,c as P}from"./chunk-IVON2WY7.js";import{a as c}from"./chunk-HMY7DJXX.js";import{a as l}from"./chunk-PTRS3UA6.js";import{a as F}from"./chunk-IFZ7WOA2.js";import{n as I,q as C}from"./chunk-FWVQ6CFL.js";import{C as b,G,O as f,_ as U,b as B,e as D,ha as d,ka as u,m as V,p as L,pd as k,r as S}from"./chunk-KYVLS64M.js";import{h as p}from"./chunk-KMHZKFQS.js";var O=class{ID;Number;Due;Date;CustomDateField;TimeCustom;SurchargePcg;TempSurchargePcg;ToP;Note;ReferenceInvoiceID;PaymentStateID;Sales;DateCustom;constructor(){this.ID=l.GuidEmpty,this.SurchargePcg=0,this.TempSurchargePcg=0,this.Due=null}};var K=(i=>(i[i.Unsent=0]="Unsent",i[i.AwaitingCollection=1]="AwaitingCollection",i[i.Partial=2]="Partial",i[i.Sent=3]="Sent",i))(K||{});var g=class{ID;EntityID;RegisterID;TypeID;Date;Number;CustomerID;SalesID;Discount=0;Discount2=0;DiscountAmount=0;CustomerDiscountRate=0;Note="";DeliveryOutletID;TaxTypeID;CurrencyID;CurrencyRate;PointUsed;InvoicedStateID;ReferenceNumber="";LogisticsServiceID;ParkLabel="";NumberOfPerson;ClientTimestamp;Created;PromotionCoupon="";CouponType=1;PromotionNote="";DeliveryStateID;CouponProvider="Internal";CurrencySymbol;constructor(){this.ID=l.GuidEmpty,this.EntityID=l.GuidEmpty,this.RegisterID=l.GuidEmpty,this.Number="",this.CustomerID=null,this.SalesID=null,this.Discount=0,this.Discount2=0,this.DiscountAmount=0,this.Note="",this.TaxTypeID=l.GuidEmpty,this.CurrencyID=1,this.CurrencyRate=1,this.DeliveryStateID=3,this.PointUsed=0,this.NumberOfPerson=1,this.Date=new Date}removeEnterNote(){this.Note&&(this.Note=this.Note.replace(/\n/g,""))}};var x=class{MethodID;Amount=0;Note;Index;Date;PaidAmount;Code;MethodName;InvoiceID;ID;TypeID;constructor(t,e,r,i){this.MethodID=t||0,this.Amount=e||0,this.PaidAmount=r||0,this.Date=i}};var v=class{Name;Phone;Address;City;constructor(){this.Name="",this.Phone="",this.Address="",this.City=""}};var y=class{DeliveryEntityID;Type;NewOrderID;constructor(){this.DeliveryEntityID="",this.Type=3}};var R=class{Amount;ApplyToProduct;Code;Type;TypeDescription;Coupon;Notification;MaxDiscount;Note};var m=class{Order;Invoice;Shipping;Action;Payments;Items;CartItems;Promotion;ContactName;SplitParkLabel;get cartQuantity(){let t=0;for(let e of this.CartItems)t+=e.Quantity;return t}constructor(){this.Order=new g,this.Invoice=new O,this.Shipping=new v,this.Action=new y,this.Payments=Array(),this.Items=Array(),this.CartItems=Array(),this.ContactName=""}get TotalPaidAmount(){let t=0;return this.Payments.forEach(e=>{t+=e.PaidAmount}),t}get RedeemableAmount(){let t=this.CartItems.filter(e=>e.Variant.PaymentTypeID!=1);return this.GetAmountByCart(t)}get TotalQuantity(){let t=0;return this.CartItems.forEach(e=>{e.PromotionGift||(t+=e.Quantity)}),t}get CashOnlyAmount(){let t=this.CartItems.filter(e=>e.Variant.PaymentTypeID==1);return this.GetAmountByCart(t)}get PointOnlyAmount(){let t=this.CartItems.filter(e=>e.Variant.PaymentTypeID==2);return this.GetAmountByCart(t)}get PrepaidPackageItem(){return this.CartItems.filter(e=>e.Variant.TypeID==10)}GetAmountByCart(t){let e=0;return t.forEach(r=>{e+=r.Total}),e=e*(100-this.Order.Discount)/100,e=e*(100-this.Order.Discount2)/100,e}getRewards(){return this.CartItems.filter(e=>e.PromotionGift)}};p([h(()=>g)],m.prototype,"Order",2),p([h(()=>O)],m.prototype,"Invoice",2),p([h(()=>v)],m.prototype,"Shipping",2),p([h(()=>y)],m.prototype,"Action",2),p([h(()=>x)],m.prototype,"Payments",2),p([h(()=>T)],m.prototype,"Items",2),p([h(()=>Q)],m.prototype,"CartItems",2),p([h(()=>R)],m.prototype,"Promotion",2);var N=class{Success;Message;message;ObjectID;SalesOrderID;OutDeliveryID;Contact;LoyaltyPoint;InvoiceNumber;Creator;OrderTimeString;PrintMode;PaymentStateID;PaymentStateLabel;Final;InvoiceNumberResult;constructor(){this.Success=!0,this.Message="",this.ObjectID="",this.SalesOrderID="",this.OutDeliveryID="",this.Contact=null,this.LoyaltyPoint="",this.InvoiceNumber="",this.Creator="",this.OrderTimeString="",this.PrintMode=0,this.PaymentStateID=0,this.PaymentStateLabel="",this.Final=0}};var M=class s{constructor(t,e,r,i){this.httpService=t;this._localDataService=e;this._onlineStatusService=r;this._toastrService=i;this._onlineStatusService.getOnlineStatus$().subscribe(o=>{this.isOnline=o})}_Data=new D(null);Data$=this._Data.pipe(f(),b(t=>t!==null));isOnline;get Data(){return this._Data.value}pushNewValue(t){this._Data.next(t)}getSalesOrderPrint(t){return this.httpService.post("/API/POS/GetSalesOrderPrint",{TemplateID:t})}submitOrder(t,e){let r=this.generatePOSDataForSubmission(t,this.isOnline);if(this.isOnline)return this.submitOnline(r).pipe(this.handleTimeOutError(r));if(e.ModuleSell.EnableOfflineTransaction)return this._localDataService.syncOrder(r).pipe(S(()=>this.generateCompleteData(r)));this._toastrService.warning("Offline order is not Supported!","Info!")}uploadOfflineOrder(t){return this._localDataService.uploadSingleOrder(t).pipe(G(e=>e?.message?.includes("objectStore does not exists")?this.submitOnline(t):V(()=>e)))}submitOnline(t){return this.httpService.post(c.SubmitOrder,t,F.pos.submitOrderTimeout)}handleTimeOutError(t){return B(G(e=>{if(e instanceof L||e?.name=="TimeoutError"){let r=this.generateCompleteData(t);this.pushNewValue(r)}throw e}))}generatePOSDataForSubmission(t,e=!0){let r=Object.assign(new m,t);r.Items=[],r.Order.CustomerID==null&&(r.Order.CustomerID=l.GuidEmpty),r.Order.SalesID==null&&(r.Order.SalesID=l.GuidEmpty);let i=1;r.Payments=r.Payments.map(a=>(a.Date=r.Order.Date,a.Index=i,i++,delete a.TypeID,a));let o=1;for(let a of r.CartItems){let n=new T;n.ID=a.ID,n.VariantID=a.VariantID,n.Quantity=a.Quantity,n.Cost=a.Cost,n.Price=a.Price,n.Discount=a.Discount,n.DiscountAmount=a.DiscountAmount,n.Note=a.Note,n.Taxable=a.Variant.Taxable,n.LoyaltyPoint=a.LoyaltyPoint,n.UnitCost=a.Cost,n.UnitPrice=a.Price,n.UnitPriceOriginal=a.UnitPriceOriginal,n.UnitExpense=a.UnitExpense,n.EntityID=a.EntityID,n.Index=o,n.UnitQuantity=a.UnitQuantity,n.PriceTypeID=a.PriceTypeID,n.PriceNote=a.PriceNote,n.Splited=a.SplitQuantity>0,n.SplitQuantity=a.SplitQuantity,n.InventoryTypeID=a.Variant.TypeID,n.SalesID="",n.Serial=a.Serial,a.SalesID&&(n.SalesID=a.SalesID),delete a.CouponDiscount,r.Items.push(n),o++}return e?(delete r.CartItems,delete r.Order.ClientTimestamp):r.Order.ClientTimestamp=new Date,r}generateCompleteData(t){let e=new N;return e.InvoiceNumber=t.Order.Number,e.OrderTimeString=new Date().toString(),e.PaymentStateID=t.Action?.Type,e.PaymentStateLabel="Offline",e.Success=!0,e.OutDeliveryID=t.Action.DeliveryEntityID,e}GetReturnInvoice(t,e){return this.httpService.get(c.ReturnInvoiceV2,[{key:"EntityID",value:e},{key:"Number",value:t}])}GetInvoiceBySoID(t){return this.httpService.get(c.GetPOSDataByID,[{key:"ID",value:t}])}UploadCSV(t,e){let r={CartItems:t,EntityID:e};return this.httpService.post(c.UploadCsv,r)}sendEmail(t,e){return new Promise((r,i)=>{this._localDataService.isProductFromServer().subscribe(o=>{if(o){let a={invoiceID:e,email:t};this.httpService.post(c.SendInvoiceEmail,a).subscribe({next:n=>{r(n)},error:n=>{i(n)}})}else i(J.wrongOfflineAction)})})}sendWhatsaap(t,e){let r={InvoiceID:t,PhoneNumber:e};return this.httpService.post(c.SendInvoiceWhatsapp,r)}createCustomerByInvoice(t,e){let r={InvoiceID:t,Mobile:e};return this.httpService.post(c.CreateCustomerInvoice,r)}saveCommission(t,e){let r={SOID:t,commission:e};return this.httpService.POSText("/API/Transaction/SetCommission",r)}generateReceiptA4(t){let e={ID:t};return this.httpService.post(c.InvoiceA4,e)}getVacant(t){return this.httpService.get(c.GetVacant,[{key:"EntityID",value:t}])}static \u0275fac=function(e){return new(e||s)(u(C),u(P),u(A),u(I))};static \u0275prov=d({token:s,factory:s.\u0275fac,providedIn:"root"})};var z=(o=>(o[o.cash=1]="cash",o[o.card=2]="card",o[o.emoney=3]="emoney",o[o.other=4]="other",o[o.ECR=99]="ECR",o))(z||{});var E=class s{constructor(t,e,r){this._OrderHttpService=t;this._customerHttpService=e;this._toastrService=r}_Data=new D(new m);transaction_id;Data$=this._Data.asObservable();get Data(){return this._Data.value}pushNewValue(t){if(t)this._Data.next(t);else{let e=this.Data;this._Data.next(e)}}submitOrder(t){return new Promise((e,r)=>{this.checkTransactionId(),this._OrderHttpService.submitOrder(this.Data,t).subscribe({next:i=>{e(i)},error:i=>{this.Data.Items=[],r(i)}})})}uploadOfflineOrder(){return this.checkTransactionId(),this._OrderHttpService.uploadOfflineOrder(this.Data)}checkTransactionId(){let e=this.Data.Payments.find(r=>r.TypeID==3);l.IsNotEmpty(e)&&l.IsEmpty(this.transaction_id)&&this._toastrService.warning("Midtrans transaction_id is empty. Please verify manually!","Mobile Payment Failure")}updateCustomerID(t){return this.Data.Order.CustomerID=t,this.pushNewValue(this.Data),new Promise((e,r)=>{this._customerHttpService.GetPrivilegeByID(t,this.Data.Order.EntityID).subscribe({next:i=>{this._customerHttpService.Data=i,this.pushNewValue(this.Data),e(i)},error:i=>{this.Data.Order.CustomerID=null,this.Data.ContactName=null;let o=i.error?.Message;i.status==409?this._toastrService.warning(o,"Warning"):this._toastrService.error(o,`API Error - ${i.status}`),r(i)}})})}static \u0275fac=function(e){return new(e||s)(u(M),u(q),u(I))};static \u0275prov=d({token:s,factory:s.\u0275fac,providedIn:"root"})};var w=class s{constructor(t,e,r){this._localDataService=t;this._onlineStatusService=e;this._httpService=r;this._onlineStatusService.getOnlineStatus$().subscribe(i=>{this.isOnline=i})}_Data=new D(null);Data$=this._Data.asObservable().pipe(b(t=>t!==null),f());isOnline;get Data(){return this._Data.value}pushNewValue(t){this._Data.next(t)}requestObservable(){return this.isOnline?this._httpService.get(c.GetPOSStorage).pipe(S(t=>({data:t,type:"Online"}))):this._localDataService.getPOSStorage().pipe(b(t=>t!=null),S(t=>({data:t,type:"Offline"})))}getOutletName(t){return this.Data.Entities.find(r=>r.ID==t)?.Name}static \u0275fac=function(e){return new(e||s)(u(P),u(A),u(C))};static \u0275prov=d({token:s,factory:s.\u0275fac,providedIn:"root"})};var X=class{Prefix;Seed;Digit;constructor(){this.Prefix=null,this.Seed=null,this.Digit=null}static Generate(t){let e="";if(t.Seed){let r=t.Seed+"";for(;r.length<t.Digit;)r="0"+r;e=l.StringFormat(t.Prefix,r)}return e}};var H=class{ModuleSell;ApplicationLoyalty;ApplicationMath;CoreDefaults;ModuleDelivery;ApplicationParkAndRetrieve;ApplicationRegisterClosure;PaymentConfigGopay;PaymentConfigLink;PrintConfigInvoice;CorePrint;PaymentConfigEmpatKali;ApplicationSettings;PrintConfigGeneral;ModuleProducts;ModuleContact;ApplicationTransactionNumbering;ModuleOrders;ModuleShift;ModuleBuy;ModuleAdjustment;TadaCouponVisible;CouponRedemptionType;ProviderOption};var Y=class s{constructor(t,e,r,i){this._orderDataService=t;this._posService=e;this.POSMATH=r;this.decimalPipe=i;this._orderDataService.Data$.pipe(U(o=>this._posService.Data$.pipe(S(a=>({appConfig:a.AppConfigJSON,salesOrder:o}))))).subscribe(o=>{this.salesOrderData=o.salesOrder,this.appConfigJSON=o.appConfig,this.calculateDiscountAmount(),this.pushNewValue(this.grandTotal)})}_Data=new D(0);Data$=this._Data.asObservable().pipe(f());tax=new $;discountAfterTax=0;currencySymbol="Rp";get Data(){return this._Data.value}salesOrderData=new m;appConfigJSON=new H;pushNewValue(t){this._Data.next(t)}get grandTotal(){let t=this.TotalAfterSurcharge;return isNaN(t)?0:t}setDecimalDigit(t){let e=this.decimalPipe.transform(t,"1.0-4");return t=parseFloat(e.split(",").join("")),t}get TotalAfterTax(){let t=this.TaxAmount,e=this.TotalBeforeTax+t;return e=this.POSMATH.Round(e,this.appConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm),e}get TotalBeforeTax(){let t=this.tax?.CalculationTypeID===1,e=0;return t?e=this.DiscountTotal-this.TaxAmount:e=this.DiscountTotal,e}get TotalAfterSurcharge(){let t=this.TotalAfterTax+this.SurchargeAmount;return this.POSMATH.Round(t,this.appConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm)}get TotalAfterDiscountTaxable(){return this.GrossTotalTaxable-this.DiscountTotal}get TaxAmount(){if(this.tax!=null){let t=0,e=this.appConfigJSON.ApplicationMath.RoundingTaxDigit.DecimalPlaceValue,r=this.appConfigJSON.ApplicationMath.RoundingTaxDigit.RoundAlgorithm,i=this.GrossTotalTaxable;return this.tax.CalculationTypeID==1?t=this.tax.Rate/(100+this.tax.Rate)*i:t=this.tax.Rate/100*i,t=this.POSMATH.Round(t,e,r),t}else return 0}get SurchargeAmount(){return this.TotalAfterTax*this.salesOrderData.Invoice.SurchargePcg/100}get Discount1Amount(){return this.GrossTotal*this.salesOrderData.Order.Discount/100}get AfterDiscount1Amount(){return this.GrossTotal-this.Discount1Amount}get Discount2Amount(){return this.AfterDiscount1Amount*this.salesOrderData.Order.Discount2/100}get AfterDiscount2Amount(){return this.AfterDiscount1Amount-this.Discount2Amount}get DiscountTotal(){return this.AfterDiscount2Amount-this.salesOrderData.Order.DiscountAmount}calculateDiscountAmount(){let t=this.salesOrderData.Order.DiscountAmount,e=0;this.AfterDiscount2Amount>=0&&t>0&&t>this.AfterDiscount2Amount&&(e=this.AfterDiscount2Amount),e!==0&&e<=t&&this.GrossTotal!==0&&(t=e),this.salesOrderData.Order.DiscountAmount=t}get GrossTotal(){return this.sum(this.salesOrderData.CartItems,"Total")}get GrossTotalTaxable(){let t=this.salesOrderData.CartItems.filter(r=>r.Taxable),e=this.sum(t,"Total");if(t.length!==0){let r=this.calculateDiscountTaxableItem(t);e=e*(100-this.salesOrderData.Order.Discount)/100,e=e*(100-this.salesOrderData.Order.Discount2)/100,e=e-r}return e}calculateDiscountTaxableItem(t){let e=this.GrossTotal,r=this.salesOrderData.Order.DiscountAmount,i=0,o=0,a=0,n=0;for(let j of t)i=j.getItemAfterDiscount/e,o=i*r,n=o*j.Quantity,a+=n;return a}get GrossTotalNonTaxable(){let t=this.salesOrderData.CartItems.filter(r=>r.Taxable==!1),e=this.sum(t,"Total");return e=e*(100-this.salesOrderData.Order.Discount)/100,e=e*(100-this.salesOrderData.Order.Discount2)/100,e=e-this.salesOrderData.Order.DiscountAmount,e}sum(t,e){let r=t.reduce((i,o)=>i+o[e],0);return r=this.setDecimalDigit(r),r}GetPointOnlyAmount(){let t=this.salesOrderData.CartItems.filter(e=>e.Variant.PaymentTypeID==2);return this.GetAmountByCart(t)}GetCashOnlyAmount(){let t=this.salesOrderData.CartItems.filter(e=>e.Variant.PaymentTypeID==1);return this.GetAmountByCart(t)}GetCashAndPointAmountCart(){let t=this.salesOrderData.CartItems.filter(e=>e.Variant.PaymentTypeID!=1);return this.GetAmountByCart(t)}GetAmountByCart(t){let e=this.sum(t,"Total");return e=e*(100-this.salesOrderData.Order.Discount)/100,e=e*(100-this.salesOrderData.Order.Discount2)/100,e}calculateGrossTotal(t){return this.sum(t,"Total")}static \u0275fac=function(e){return new(e||s)(u(E),u(w),u(W),u(k))};static \u0275prov=d({token:s,factory:s.\u0275fac,providedIn:"root"})};export{X as a,O as b,v as c,x as d,H as e,K as f,m as g,z as h,N as i,M as j,E as k,w as l,Y as m};
1
+ import{b as $}from"./chunk-S77FVPQM.js";import{a as T,b as Q}from"./chunk-NH6IWUZH.js";import{a as h}from"./chunk-NZXJPRXS.js";import{a as W}from"./chunk-Z7IRMXUP.js";import{a as A,c as q}from"./chunk-WSNRK3WX.js";import{b as J,c as P}from"./chunk-MC5GFFBH.js";import{a as c}from"./chunk-HMY7DJXX.js";import{a as l}from"./chunk-PTRS3UA6.js";import{a as F}from"./chunk-C6Z4KJ2K.js";import{n as I,q as C}from"./chunk-FWVQ6CFL.js";import{C as b,G,O as f,_ as U,b as B,e as D,ha as d,ka as u,m as V,p as L,pd as k,r as S}from"./chunk-KYVLS64M.js";import{h as p}from"./chunk-KMHZKFQS.js";var O=class{ID;Number;Due;Date;CustomDateField;TimeCustom;SurchargePcg;TempSurchargePcg;ToP;Note;ReferenceInvoiceID;PaymentStateID;Sales;DateCustom;constructor(){this.ID=l.GuidEmpty,this.SurchargePcg=0,this.TempSurchargePcg=0,this.Due=null}};var K=(i=>(i[i.Unsent=0]="Unsent",i[i.AwaitingCollection=1]="AwaitingCollection",i[i.Partial=2]="Partial",i[i.Sent=3]="Sent",i))(K||{});var g=class{ID;EntityID;RegisterID;TypeID;Date;Number;CustomerID;SalesID;Discount=0;Discount2=0;DiscountAmount=0;CustomerDiscountRate=0;Note="";DeliveryOutletID;TaxTypeID;CurrencyID;CurrencyRate;PointUsed;InvoicedStateID;ReferenceNumber="";LogisticsServiceID;ParkLabel="";NumberOfPerson;ClientTimestamp;Created;PromotionCoupon="";CouponType=1;PromotionNote="";DeliveryStateID;CouponProvider="Internal";CurrencySymbol;constructor(){this.ID=l.GuidEmpty,this.EntityID=l.GuidEmpty,this.RegisterID=l.GuidEmpty,this.Number="",this.CustomerID=null,this.SalesID=null,this.Discount=0,this.Discount2=0,this.DiscountAmount=0,this.Note="",this.TaxTypeID=l.GuidEmpty,this.CurrencyID=1,this.CurrencyRate=1,this.DeliveryStateID=3,this.PointUsed=0,this.NumberOfPerson=1,this.Date=new Date}removeEnterNote(){this.Note&&(this.Note=this.Note.replace(/\n/g,""))}};var x=class{MethodID;Amount=0;Note;Index;Date;PaidAmount;Code;MethodName;InvoiceID;ID;TypeID;constructor(t,e,r,i){this.MethodID=t||0,this.Amount=e||0,this.PaidAmount=r||0,this.Date=i}};var v=class{Name;Phone;Address;City;constructor(){this.Name="",this.Phone="",this.Address="",this.City=""}};var y=class{DeliveryEntityID;Type;NewOrderID;constructor(){this.DeliveryEntityID="",this.Type=3}};var R=class{Amount;ApplyToProduct;Code;Type;TypeDescription;Coupon;Notification;MaxDiscount;Note};var m=class{Order;Invoice;Shipping;Action;Payments;Items;CartItems;Promotion;ContactName;SplitParkLabel;get cartQuantity(){let t=0;for(let e of this.CartItems)t+=e.Quantity;return t}constructor(){this.Order=new g,this.Invoice=new O,this.Shipping=new v,this.Action=new y,this.Payments=Array(),this.Items=Array(),this.CartItems=Array(),this.ContactName=""}get TotalPaidAmount(){let t=0;return this.Payments.forEach(e=>{t+=e.PaidAmount}),t}get RedeemableAmount(){let t=this.CartItems.filter(e=>e.Variant.PaymentTypeID!=1);return this.GetAmountByCart(t)}get TotalQuantity(){let t=0;return this.CartItems.forEach(e=>{e.PromotionGift||(t+=e.Quantity)}),t}get CashOnlyAmount(){let t=this.CartItems.filter(e=>e.Variant.PaymentTypeID==1);return this.GetAmountByCart(t)}get PointOnlyAmount(){let t=this.CartItems.filter(e=>e.Variant.PaymentTypeID==2);return this.GetAmountByCart(t)}get PrepaidPackageItem(){return this.CartItems.filter(e=>e.Variant.TypeID==10)}GetAmountByCart(t){let e=0;return t.forEach(r=>{e+=r.Total}),e=e*(100-this.Order.Discount)/100,e=e*(100-this.Order.Discount2)/100,e}getRewards(){return this.CartItems.filter(e=>e.PromotionGift)}};p([h(()=>g)],m.prototype,"Order",2),p([h(()=>O)],m.prototype,"Invoice",2),p([h(()=>v)],m.prototype,"Shipping",2),p([h(()=>y)],m.prototype,"Action",2),p([h(()=>x)],m.prototype,"Payments",2),p([h(()=>T)],m.prototype,"Items",2),p([h(()=>Q)],m.prototype,"CartItems",2),p([h(()=>R)],m.prototype,"Promotion",2);var N=class{Success;Message;message;ObjectID;SalesOrderID;OutDeliveryID;Contact;LoyaltyPoint;InvoiceNumber;Creator;OrderTimeString;PrintMode;PaymentStateID;PaymentStateLabel;Final;InvoiceNumberResult;constructor(){this.Success=!0,this.Message="",this.ObjectID="",this.SalesOrderID="",this.OutDeliveryID="",this.Contact=null,this.LoyaltyPoint="",this.InvoiceNumber="",this.Creator="",this.OrderTimeString="",this.PrintMode=0,this.PaymentStateID=0,this.PaymentStateLabel="",this.Final=0}};var M=class s{constructor(t,e,r,i){this.httpService=t;this._localDataService=e;this._onlineStatusService=r;this._toastrService=i;this._onlineStatusService.getOnlineStatus$().subscribe(o=>{this.isOnline=o})}_Data=new D(null);Data$=this._Data.pipe(f(),b(t=>t!==null));isOnline;get Data(){return this._Data.value}pushNewValue(t){this._Data.next(t)}getSalesOrderPrint(t){return this.httpService.post("/API/POS/GetSalesOrderPrint",{TemplateID:t})}submitOrder(t,e){let r=this.generatePOSDataForSubmission(t,this.isOnline);if(this.isOnline)return this.submitOnline(r).pipe(this.handleTimeOutError(r));if(e.ModuleSell.EnableOfflineTransaction)return this._localDataService.syncOrder(r).pipe(S(()=>this.generateCompleteData(r)));this._toastrService.warning("Offline order is not Supported!","Info!")}uploadOfflineOrder(t){return this._localDataService.uploadSingleOrder(t).pipe(G(e=>e?.message?.includes("objectStore does not exists")?this.submitOnline(t):V(()=>e)))}submitOnline(t){return this.httpService.post(c.SubmitOrder,t,F.pos.submitOrderTimeout)}handleTimeOutError(t){return B(G(e=>{if(e instanceof L||e?.name=="TimeoutError"){let r=this.generateCompleteData(t);this.pushNewValue(r)}throw e}))}generatePOSDataForSubmission(t,e=!0){let r=Object.assign(new m,t);r.Items=[],r.Order.CustomerID==null&&(r.Order.CustomerID=l.GuidEmpty),r.Order.SalesID==null&&(r.Order.SalesID=l.GuidEmpty);let i=1;r.Payments=r.Payments.map(a=>(a.Date=r.Order.Date,a.Index=i,i++,delete a.TypeID,a));let o=1;for(let a of r.CartItems){let n=new T;n.ID=a.ID,n.VariantID=a.VariantID,n.Quantity=a.Quantity,n.Cost=a.Cost,n.Price=a.Price,n.Discount=a.Discount,n.DiscountAmount=a.DiscountAmount,n.Note=a.Note,n.Taxable=a.Variant.Taxable,n.LoyaltyPoint=a.LoyaltyPoint,n.UnitCost=a.Cost,n.UnitPrice=a.Price,n.UnitPriceOriginal=a.UnitPriceOriginal,n.UnitExpense=a.UnitExpense,n.EntityID=a.EntityID,n.Index=o,n.UnitQuantity=a.UnitQuantity,n.PriceTypeID=a.PriceTypeID,n.PriceNote=a.PriceNote,n.Splited=a.SplitQuantity>0,n.SplitQuantity=a.SplitQuantity,n.InventoryTypeID=a.Variant.TypeID,n.SalesID="",n.Serial=a.Serial,a.SalesID&&(n.SalesID=a.SalesID),delete a.CouponDiscount,r.Items.push(n),o++}return e?(delete r.CartItems,delete r.Order.ClientTimestamp):r.Order.ClientTimestamp=new Date,r}generateCompleteData(t){let e=new N;return e.InvoiceNumber=t.Order.Number,e.OrderTimeString=new Date().toString(),e.PaymentStateID=t.Action?.Type,e.PaymentStateLabel="Offline",e.Success=!0,e.OutDeliveryID=t.Action.DeliveryEntityID,e}GetReturnInvoice(t,e){return this.httpService.get(c.ReturnInvoiceV2,[{key:"EntityID",value:e},{key:"Number",value:t}])}GetInvoiceBySoID(t){return this.httpService.get(c.GetPOSDataByID,[{key:"ID",value:t}])}UploadCSV(t,e){let r={CartItems:t,EntityID:e};return this.httpService.post(c.UploadCsv,r)}sendEmail(t,e){return new Promise((r,i)=>{this._localDataService.isProductFromServer().subscribe(o=>{if(o){let a={invoiceID:e,email:t};this.httpService.post(c.SendInvoiceEmail,a).subscribe({next:n=>{r(n)},error:n=>{i(n)}})}else i(J.wrongOfflineAction)})})}sendWhatsaap(t,e){let r={InvoiceID:t,PhoneNumber:e};return this.httpService.post(c.SendInvoiceWhatsapp,r)}createCustomerByInvoice(t,e){let r={InvoiceID:t,Mobile:e};return this.httpService.post(c.CreateCustomerInvoice,r)}saveCommission(t,e){let r={SOID:t,commission:e};return this.httpService.POSText("/API/Transaction/SetCommission",r)}generateReceiptA4(t){let e={ID:t};return this.httpService.post(c.InvoiceA4,e)}getVacant(t){return this.httpService.get(c.GetVacant,[{key:"EntityID",value:t}])}static \u0275fac=function(e){return new(e||s)(u(C),u(P),u(A),u(I))};static \u0275prov=d({token:s,factory:s.\u0275fac,providedIn:"root"})};var z=(o=>(o[o.cash=1]="cash",o[o.card=2]="card",o[o.emoney=3]="emoney",o[o.other=4]="other",o[o.ECR=99]="ECR",o))(z||{});var E=class s{constructor(t,e,r){this._OrderHttpService=t;this._customerHttpService=e;this._toastrService=r}_Data=new D(new m);transaction_id;Data$=this._Data.asObservable();get Data(){return this._Data.value}pushNewValue(t){if(t)this._Data.next(t);else{let e=this.Data;this._Data.next(e)}}submitOrder(t){return new Promise((e,r)=>{this.checkTransactionId(),this._OrderHttpService.submitOrder(this.Data,t).subscribe({next:i=>{e(i)},error:i=>{this.Data.Items=[],r(i)}})})}uploadOfflineOrder(){return this.checkTransactionId(),this._OrderHttpService.uploadOfflineOrder(this.Data)}checkTransactionId(){let e=this.Data.Payments.find(r=>r.TypeID==3);l.IsNotEmpty(e)&&l.IsEmpty(this.transaction_id)&&this._toastrService.warning("Midtrans transaction_id is empty. Please verify manually!","Mobile Payment Failure")}updateCustomerID(t){return this.Data.Order.CustomerID=t,this.pushNewValue(this.Data),new Promise((e,r)=>{this._customerHttpService.GetPrivilegeByID(t,this.Data.Order.EntityID).subscribe({next:i=>{this._customerHttpService.Data=i,this.pushNewValue(this.Data),e(i)},error:i=>{this.Data.Order.CustomerID=null,this.Data.ContactName=null;let o=i.error?.Message;i.status==409?this._toastrService.warning(o,"Warning"):this._toastrService.error(o,`API Error - ${i.status}`),r(i)}})})}static \u0275fac=function(e){return new(e||s)(u(M),u(q),u(I))};static \u0275prov=d({token:s,factory:s.\u0275fac,providedIn:"root"})};var w=class s{constructor(t,e,r){this._localDataService=t;this._onlineStatusService=e;this._httpService=r;this._onlineStatusService.getOnlineStatus$().subscribe(i=>{this.isOnline=i})}_Data=new D(null);Data$=this._Data.asObservable().pipe(b(t=>t!==null),f());isOnline;get Data(){return this._Data.value}pushNewValue(t){this._Data.next(t)}requestObservable(){return this.isOnline?this._httpService.get(c.GetPOSStorage).pipe(S(t=>({data:t,type:"Online"}))):this._localDataService.getPOSStorage().pipe(b(t=>t!=null),S(t=>({data:t,type:"Offline"})))}getOutletName(t){return this.Data.Entities.find(r=>r.ID==t)?.Name}static \u0275fac=function(e){return new(e||s)(u(P),u(A),u(C))};static \u0275prov=d({token:s,factory:s.\u0275fac,providedIn:"root"})};var X=class{Prefix;Seed;Digit;constructor(){this.Prefix=null,this.Seed=null,this.Digit=null}static Generate(t){let e="";if(t.Seed){let r=t.Seed+"";for(;r.length<t.Digit;)r="0"+r;e=l.StringFormat(t.Prefix,r)}return e}};var H=class{ModuleSell;ApplicationLoyalty;ApplicationMath;CoreDefaults;ModuleDelivery;ApplicationParkAndRetrieve;ApplicationRegisterClosure;PaymentConfigGopay;PaymentConfigLink;PrintConfigInvoice;CorePrint;PaymentConfigEmpatKali;ApplicationSettings;PrintConfigGeneral;ModuleProducts;ModuleContact;ApplicationTransactionNumbering;ModuleOrders;ModuleShift;ModuleBuy;ModuleAdjustment;TadaCouponVisible;CouponRedemptionType;ProviderOption};var Y=class s{constructor(t,e,r,i){this._orderDataService=t;this._posService=e;this.POSMATH=r;this.decimalPipe=i;this._orderDataService.Data$.pipe(U(o=>this._posService.Data$.pipe(S(a=>({appConfig:a.AppConfigJSON,salesOrder:o}))))).subscribe(o=>{this.salesOrderData=o.salesOrder,this.appConfigJSON=o.appConfig,this.calculateDiscountAmount(),this.pushNewValue(this.grandTotal)})}_Data=new D(0);Data$=this._Data.asObservable().pipe(f());tax=new $;discountAfterTax=0;currencySymbol="Rp";get Data(){return this._Data.value}salesOrderData=new m;appConfigJSON=new H;pushNewValue(t){this._Data.next(t)}get grandTotal(){let t=this.TotalAfterSurcharge;return isNaN(t)?0:t}setDecimalDigit(t){let e=this.decimalPipe.transform(t,"1.0-4");return t=parseFloat(e.split(",").join("")),t}get TotalAfterTax(){let t=this.TaxAmount,e=this.TotalBeforeTax+t;return e=this.POSMATH.Round(e,this.appConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm),e}get TotalBeforeTax(){let t=this.tax?.CalculationTypeID===1,e=0;return t?e=this.DiscountTotal-this.TaxAmount:e=this.DiscountTotal,e}get TotalAfterSurcharge(){let t=this.TotalAfterTax+this.SurchargeAmount;return this.POSMATH.Round(t,this.appConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm)}get TotalAfterDiscountTaxable(){return this.GrossTotalTaxable-this.DiscountTotal}get TaxAmount(){if(this.tax!=null){let t=0,e=this.appConfigJSON.ApplicationMath.RoundingTaxDigit.DecimalPlaceValue,r=this.appConfigJSON.ApplicationMath.RoundingTaxDigit.RoundAlgorithm,i=this.GrossTotalTaxable;return this.tax.CalculationTypeID==1?t=this.tax.Rate/(100+this.tax.Rate)*i:t=this.tax.Rate/100*i,t=this.POSMATH.Round(t,e,r),t}else return 0}get SurchargeAmount(){return this.TotalAfterTax*this.salesOrderData.Invoice.SurchargePcg/100}get Discount1Amount(){return this.GrossTotal*this.salesOrderData.Order.Discount/100}get AfterDiscount1Amount(){return this.GrossTotal-this.Discount1Amount}get Discount2Amount(){return this.AfterDiscount1Amount*this.salesOrderData.Order.Discount2/100}get AfterDiscount2Amount(){return this.AfterDiscount1Amount-this.Discount2Amount}get DiscountTotal(){return this.AfterDiscount2Amount-this.salesOrderData.Order.DiscountAmount}calculateDiscountAmount(){let t=this.salesOrderData.Order.DiscountAmount,e=0;this.AfterDiscount2Amount>=0&&t>0&&t>this.AfterDiscount2Amount&&(e=this.AfterDiscount2Amount),e!==0&&e<=t&&this.GrossTotal!==0&&(t=e),this.salesOrderData.Order.DiscountAmount=t}get GrossTotal(){return this.sum(this.salesOrderData.CartItems,"Total")}get GrossTotalTaxable(){let t=this.salesOrderData.CartItems.filter(r=>r.Taxable),e=this.sum(t,"Total");if(t.length!==0){let r=this.calculateDiscountTaxableItem(t);e=e*(100-this.salesOrderData.Order.Discount)/100,e=e*(100-this.salesOrderData.Order.Discount2)/100,e=e-r}return e}calculateDiscountTaxableItem(t){let e=this.GrossTotal,r=this.salesOrderData.Order.DiscountAmount,i=0,o=0,a=0,n=0;for(let j of t)i=j.getItemAfterDiscount/e,o=i*r,n=o*j.Quantity,a+=n;return a}get GrossTotalNonTaxable(){let t=this.salesOrderData.CartItems.filter(r=>r.Taxable==!1),e=this.sum(t,"Total");return e=e*(100-this.salesOrderData.Order.Discount)/100,e=e*(100-this.salesOrderData.Order.Discount2)/100,e=e-this.salesOrderData.Order.DiscountAmount,e}sum(t,e){let r=t.reduce((i,o)=>i+o[e],0);return r=this.setDecimalDigit(r),r}GetPointOnlyAmount(){let t=this.salesOrderData.CartItems.filter(e=>e.Variant.PaymentTypeID==2);return this.GetAmountByCart(t)}GetCashOnlyAmount(){let t=this.salesOrderData.CartItems.filter(e=>e.Variant.PaymentTypeID==1);return this.GetAmountByCart(t)}GetCashAndPointAmountCart(){let t=this.salesOrderData.CartItems.filter(e=>e.Variant.PaymentTypeID!=1);return this.GetAmountByCart(t)}GetAmountByCart(t){let e=this.sum(t,"Total");return e=e*(100-this.salesOrderData.Order.Discount)/100,e=e*(100-this.salesOrderData.Order.Discount2)/100,e}calculateGrossTotal(t){return this.sum(t,"Total")}static \u0275fac=function(e){return new(e||s)(u(E),u(w),u(W),u(k))};static \u0275prov=d({token:s,factory:s.\u0275fac,providedIn:"root"})};export{X as a,O as b,v as c,x as d,H as e,K as f,m as g,z as h,N as i,M as j,E as k,w as l,Y as m};
@@ -1 +1 @@
1
- import{a}from"./chunk-JU625FM7.js";import"./chunk-GLLJMDIK.js";import"./chunk-YCIBEAU3.js";import"./chunk-H3FZHPK5.js";import"./chunk-JBDSWIIY.js";import"./chunk-K2CJU7UP.js";import"./chunk-7LOWDE4S.js";import"./chunk-4PEL7SJR.js";import"./chunk-55RTV2I3.js";import"./chunk-YTSYQGYH.js";import"./chunk-L7GZIOUH.js";import"./chunk-DS2LKTCE.js";import"./chunk-4GLDB3ML.js";import"./chunk-J23RT7UR.js";import"./chunk-S75O6CLV.js";import"./chunk-7NZ4EUXR.js";import"./chunk-P2ZVNLRQ.js";import"./chunk-6K6JOBI3.js";import"./chunk-QMHATS7H.js";import"./chunk-MSYP5HON.js";import"./chunk-YBYU2NPK.js";import"./chunk-Y6PUTPXJ.js";import"./chunk-IVON2WY7.js";import"./chunk-NKXJK5OA.js";import"./chunk-YCVG7SEH.js";import"./chunk-P2FAKIKL.js";import"./chunk-IJDHU46P.js";import"./chunk-IQFUVZ6Y.js";import"./chunk-MQW2LRVQ.js";import"./chunk-ZFSMBBTC.js";import"./chunk-YNQPX5G6.js";import"./chunk-HL4M3UN2.js";import"./chunk-CVRHFTCA.js";import"./chunk-BMJCTNKZ.js";import"./chunk-7HKIQJO2.js";import"./chunk-GXXXD7U4.js";import"./chunk-TECQKS2T.js";import"./chunk-HMY7DJXX.js";import"./chunk-ZIR7IDMB.js";import"./chunk-ONJ4E7DL.js";import"./chunk-IIFF2GRQ.js";import"./chunk-UNE3K3SG.js";import"./chunk-PDGCWLMX.js";import"./chunk-TG23CQGV.js";import"./chunk-QTC47BGO.js";import"./chunk-WD7LJ2J6.js";import"./chunk-PRQZ2TZC.js";import"./chunk-CORTGR3V.js";import"./chunk-PTRS3UA6.js";import"./chunk-IFZ7WOA2.js";import"./chunk-FWVQ6CFL.js";import"./chunk-KYVLS64M.js";import"./chunk-KMHZKFQS.js";export{a as WebhookJobLogsComponent};
1
+ import{a}from"./chunk-OQODH2AI.js";import"./chunk-GLLJMDIK.js";import"./chunk-YCIBEAU3.js";import"./chunk-H3FZHPK5.js";import"./chunk-JBDSWIIY.js";import"./chunk-K2CJU7UP.js";import"./chunk-7LOWDE4S.js";import"./chunk-4PEL7SJR.js";import"./chunk-55RTV2I3.js";import"./chunk-YTSYQGYH.js";import"./chunk-L7GZIOUH.js";import"./chunk-WK2QV2CH.js";import"./chunk-V6DHTTJK.js";import"./chunk-U2S2WVBG.js";import"./chunk-S75O6CLV.js";import"./chunk-7NZ4EUXR.js";import"./chunk-P2ZVNLRQ.js";import"./chunk-6K6JOBI3.js";import"./chunk-VVM6YTQD.js";import"./chunk-O6DG2DFQ.js";import"./chunk-YBYU2NPK.js";import"./chunk-Y6PUTPXJ.js";import"./chunk-MC5GFFBH.js";import"./chunk-NKXJK5OA.js";import"./chunk-YCVG7SEH.js";import"./chunk-P2FAKIKL.js";import"./chunk-IJDHU46P.js";import"./chunk-IQFUVZ6Y.js";import"./chunk-MQW2LRVQ.js";import"./chunk-ZFSMBBTC.js";import"./chunk-YNQPX5G6.js";import"./chunk-HL4M3UN2.js";import"./chunk-CVRHFTCA.js";import"./chunk-56AVTQ3P.js";import"./chunk-7HKIQJO2.js";import"./chunk-GXXXD7U4.js";import"./chunk-TECQKS2T.js";import"./chunk-HMY7DJXX.js";import"./chunk-ZIR7IDMB.js";import"./chunk-ONJ4E7DL.js";import"./chunk-IIFF2GRQ.js";import"./chunk-UNE3K3SG.js";import"./chunk-PDGCWLMX.js";import"./chunk-TG23CQGV.js";import"./chunk-2ZEGTT5F.js";import"./chunk-BYHCKVZ5.js";import"./chunk-PRQZ2TZC.js";import"./chunk-CORTGR3V.js";import"./chunk-PTRS3UA6.js";import"./chunk-C6Z4KJ2K.js";import"./chunk-FWVQ6CFL.js";import"./chunk-KYVLS64M.js";import"./chunk-KMHZKFQS.js";export{a as WebhookJobLogsComponent};
@@ -1,4 +1,4 @@
1
- import{a as je,b as ue}from"./chunk-VZU26OC6.js";import{a as Et}from"./chunk-RN23PFKE.js";import{a as $i}from"./chunk-Y4UM4FQS.js";import{a as Ui}from"./chunk-JNLCCDNH.js";import{a as Be,b as Bi,d as xt,e as ji,g as ce,j as Fi,k as E,l as F,m as G}from"./chunk-PL37ZZ72.js";import{b as te}from"./chunk-NH6IWUZH.js";import{b as ot,c as $}from"./chunk-NZXJPRXS.js";import{a as Tt,b as wt,c as Pe}from"./chunk-GHEC3H7W.js";import{a as Li}from"./chunk-Q6FAFWIG.js";import{l as Ni,p as Hi}from"./chunk-H3FZHPK5.js";import{d as Ai}from"./chunk-JBDSWIIY.js";import{a as It}from"./chunk-AE4VC5SW.js";import{b as li,c as Rt,h as Qi}from"./chunk-IVON2WY7.js";import{F as Mt,n as ki,t as Vi}from"./chunk-HL4M3UN2.js";import{a as be}from"./chunk-QSEKGLC7.js";import{a as _t,b as Mi,c as Ot}from"./chunk-DCS4THVW.js";import{a as X,b as de,c as Y}from"./chunk-7HKIQJO2.js";import{a as j,b as Ii}from"./chunk-GXXXD7U4.js";import{o as Ei}from"./chunk-TECQKS2T.js";import{a as H}from"./chunk-HMY7DJXX.js";import{a as He,b as Z,c as ae}from"./chunk-ZIR7IDMB.js";import{E as Ti,F as wi,c as oe,e as Ri,h as re,l as Ve,o as De,q as xi,s as Qe}from"./chunk-TG23CQGV.js";import{a as p}from"./chunk-PTRS3UA6.js";import{n as w,q as ne}from"./chunk-FWVQ6CFL.js";import{Ab as _,Bb as s,C as J,Cb as l,Cc as P,Db as Q,Dc as N,Dd as _i,Eb as O,Ec as tt,Fb as M,Fc as St,G as Xe,Gb as ft,K as we,L as yi,Lc as A,Mb as q,Md as Oi,N as Si,O as Ee,Pb as T,Pc as Pi,Qc as it,Ra as m,Rb as C,Uc as bt,Vb as vt,Wb as Ct,Xb as yt,Ya as D,Z as ut,_ as ee,aa as ht,ab as U,ac as Di,ca as z,d as se,dc as et,e as xe,ec as c,fc as y,fd as Dt,gc as ve,ha as v,hc as si,i as Te,jc as Ce,k as fi,ka as d,kc as ye,l as fe,la as g,lc as Se,ld as Ae,m as pt,mc as ci,n as mt,nd as Pt,p as vi,pa as k,pb as bi,pd as B,qa as V,r as L,s as dt,sd as ke,t as Ci,tb as R,vb as x,vc as ie,wb as gt,xb as Ne,yb as pe,za as S,zb as me}from"./chunk-KYVLS64M.js";import{a as ct,j as lt}from"./chunk-KMHZKFQS.js";var Me=(f=>(f[f.IsNew=0]="IsNew",f[f.IsComplete=1]="IsComplete",f[f.IsEdit=2]="IsEdit",f[f.isPark=3]="isPark",f[f.IsRetrieve=4]="IsRetrieve",f[f.IsSplit=5]="IsSplit",f[f.IsBill=6]="IsBill",f[f.IsReturn=7]="IsReturn",f[f.IsUndo=8]="IsUndo",f[f.UploadOrderFail=9]="UploadOrderFail",f))(Me||{});var rt=class{ID;Code;EntityID;Name;Description;Start;StartDisplay;State;Open;CashierID;OpeningCash;EntityName;LoginID;Active;CustomerDisplayEnabled;OvoConfigurationID;CustomerDisplayID;ListImage;Suspended};var Nt=class n{odsConfigType=S(0);setODSConfig(e){this.odsConfigType.set(e)}isEnabled(){return this.odsConfigType()>0}static \u0275fac=function(t){return new(t||n)};static \u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"})};var mo=["searchInputRef"],uo=n=>({active:n}),ho=n=>({gray:n});function go(n,e){if(n&1){let t=q();s(0,"span",16),T("click",function(o){k(t);let r=C().$implicit;return C().closeRegister(r),V(o.stopPropagation())}),l()}}function fo(n,e){n&1&&(s(0,"div")(1,"span",17),c(2,"VACANT"),l()())}function vo(n,e){if(n&1&&(s(0,"div")(1,"span",18),Q(2,"i",19),s(3,"span",20),c(4),l()(),s(5,"span",21),Q(6,"i",22),s(7,"span",20),c(8),l()()()),n&2){let t=C().$implicit;m(4),y(t.LoginID),m(4),ve("",t.StartDisplay.split(" ")[3]," - Now")}}function Co(n,e){if(n&1){let t=q();s(0,"div",9)(1,"div",10)(2,"div",11)(3,"h5",12),T("click",function(){let o=k(t).$implicit,r=C();return V(r.select(o))}),s(4,"span"),Q(5,"i",13),c(6),P(7,"limitTo"),l(),R(8,go,1,0,"span",14),l(),s(9,"div",15),T("click",function(){let o=k(t).$implicit,r=C();return V(r.select(o))}),R(10,fo,3,0,"div")(11,vo,9,2,"div"),l()()()()}if(n&2){let t,i=e.$implicit,o=C();m(),_("ngClass",i.Active?"active":""),m(),_("ngClass",ie(9,uo,(i==null?null:i.ID)==(o.selectedRegister==null?null:o.selectedRegister.ID))),m(),_("ngClass",ie(11,ho,i!=o.selectedRegister)),m(3),y(tt(7,6,i.Name,15)),m(2),x(i.State!="Close"?8:-1),m(2),x((t=i.State)==="Close"?10:t==="Open"?11:-1)}}var At=class n{constructor(e,t,i,o,r,a,u){this._dialogRef=e;this._outletService=t;this._posService=i;this._userRoleService=o;this.router=r;this.httpService=a;this._odsService=u}searchInputRef;originalSelectedRegister=null;registers;searchInput="";selectedRegister=new rt;modalConfig=S(new Z);role;get AppConfigJSON(){return this._posService.Data.AppConfigJSON}destroy$=new se;ngOnInit(){this.initModalConfig(),this.subscribeToObsChanges()}ngAfterViewInit(){this.searchInputRef&&this._dialogRef.afterOpened().subscribe(()=>{setTimeout(()=>{this.searchInputRef.nativeElement.focus()},200)})}subscribeToObsChanges(){this._posService.Data$.pipe(ht(this.destroy$)).subscribe(e=>{this.registers=e.Registers}),this._outletService.Data$.pipe(ht(this.destroy$)).subscribe(e=>{this.selectedRegister=this.findOutletRegisterById(e.RegisterID),this.originalSelectedRegister=this.selectedRegister?ct({},this.selectedRegister):null,this.initModalConfig(!1)}),this._userRoleService.Data$.pipe(ht(this.destroy$)).subscribe(e=>{this.role=e})}findOutletRegisterById(e){let t=this.registers.find(i=>i.ID===e);return t||new rt}initModalConfig(e=!0){this.modalConfig.update(t=>(t.hideFooter=!0,t.hideScrollbar=!0,t.hideClose=e,t.title="Choose an outlet",t))}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}onClose(){this._dialogRef.close()}select(e){if(this.AppConfigJSON.ModuleShift.Closure.Enabled)if(this.selectedRegister.ID!=null&&this.selectedRegister.Open&&e.CashierID==null)confirm("You already have an active register with "+this.selectedRegister.Name+`!
1
+ import{a as je,b as ue}from"./chunk-VZU26OC6.js";import{a as Et}from"./chunk-RN23PFKE.js";import{a as $i}from"./chunk-AKGJE2OQ.js";import{a as Ui}from"./chunk-JNLCCDNH.js";import{a as Be,b as Bi,d as xt,e as ji,g as ce,j as Fi,k as E,l as F,m as G}from"./chunk-47TURW64.js";import{b as te}from"./chunk-NH6IWUZH.js";import{b as ot,c as $}from"./chunk-NZXJPRXS.js";import{a as Tt,b as wt,c as Pe}from"./chunk-WSNRK3WX.js";import{a as Li}from"./chunk-Q6FAFWIG.js";import{l as Ni,p as Hi}from"./chunk-H3FZHPK5.js";import{d as Ai}from"./chunk-JBDSWIIY.js";import{a as It}from"./chunk-AE4VC5SW.js";import{b as li,c as Rt,h as Qi}from"./chunk-MC5GFFBH.js";import{F as Mt,n as ki,t as Vi}from"./chunk-HL4M3UN2.js";import{a as be}from"./chunk-QSEKGLC7.js";import{a as _t,b as Mi,c as Ot}from"./chunk-DCS4THVW.js";import{a as X,b as de,c as Y}from"./chunk-7HKIQJO2.js";import{a as j,b as Ii}from"./chunk-GXXXD7U4.js";import{o as Ei}from"./chunk-TECQKS2T.js";import{a as H}from"./chunk-HMY7DJXX.js";import{a as He,b as Z,c as ae}from"./chunk-ZIR7IDMB.js";import{E as Ti,F as wi,c as oe,e as Ri,h as re,l as Ve,o as De,q as xi,s as Qe}from"./chunk-TG23CQGV.js";import{a as p}from"./chunk-PTRS3UA6.js";import{n as w,q as ne}from"./chunk-FWVQ6CFL.js";import{Ab as _,Bb as s,C as J,Cb as l,Cc as P,Db as Q,Dc as N,Dd as _i,Eb as O,Ec as tt,Fb as M,Fc as St,G as Xe,Gb as ft,K as we,L as yi,Lc as A,Mb as q,Md as Oi,N as Si,O as Ee,Pb as T,Pc as Pi,Qc as it,Ra as m,Rb as C,Uc as bt,Vb as vt,Wb as Ct,Xb as yt,Ya as D,Z as ut,_ as ee,aa as ht,ab as U,ac as Di,ca as z,d as se,dc as et,e as xe,ec as c,fc as y,fd as Dt,gc as ve,ha as v,hc as si,i as Te,jc as Ce,k as fi,ka as d,kc as ye,l as fe,la as g,lc as Se,ld as Ae,m as pt,mc as ci,n as mt,nd as Pt,p as vi,pa as k,pb as bi,pd as B,qa as V,r as L,s as dt,sd as ke,t as Ci,tb as R,vb as x,vc as ie,wb as gt,xb as Ne,yb as pe,za as S,zb as me}from"./chunk-KYVLS64M.js";import{a as ct,j as lt}from"./chunk-KMHZKFQS.js";var Me=(f=>(f[f.IsNew=0]="IsNew",f[f.IsComplete=1]="IsComplete",f[f.IsEdit=2]="IsEdit",f[f.isPark=3]="isPark",f[f.IsRetrieve=4]="IsRetrieve",f[f.IsSplit=5]="IsSplit",f[f.IsBill=6]="IsBill",f[f.IsReturn=7]="IsReturn",f[f.IsUndo=8]="IsUndo",f[f.UploadOrderFail=9]="UploadOrderFail",f))(Me||{});var rt=class{ID;Code;EntityID;Name;Description;Start;StartDisplay;State;Open;CashierID;OpeningCash;EntityName;LoginID;Active;CustomerDisplayEnabled;OvoConfigurationID;CustomerDisplayID;ListImage;Suspended};var Nt=class n{odsConfigType=S(0);setODSConfig(e){this.odsConfigType.set(e)}isEnabled(){return this.odsConfigType()>0}static \u0275fac=function(t){return new(t||n)};static \u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"})};var mo=["searchInputRef"],uo=n=>({active:n}),ho=n=>({gray:n});function go(n,e){if(n&1){let t=q();s(0,"span",16),T("click",function(o){k(t);let r=C().$implicit;return C().closeRegister(r),V(o.stopPropagation())}),l()}}function fo(n,e){n&1&&(s(0,"div")(1,"span",17),c(2,"VACANT"),l()())}function vo(n,e){if(n&1&&(s(0,"div")(1,"span",18),Q(2,"i",19),s(3,"span",20),c(4),l()(),s(5,"span",21),Q(6,"i",22),s(7,"span",20),c(8),l()()()),n&2){let t=C().$implicit;m(4),y(t.LoginID),m(4),ve("",t.StartDisplay.split(" ")[3]," - Now")}}function Co(n,e){if(n&1){let t=q();s(0,"div",9)(1,"div",10)(2,"div",11)(3,"h5",12),T("click",function(){let o=k(t).$implicit,r=C();return V(r.select(o))}),s(4,"span"),Q(5,"i",13),c(6),P(7,"limitTo"),l(),R(8,go,1,0,"span",14),l(),s(9,"div",15),T("click",function(){let o=k(t).$implicit,r=C();return V(r.select(o))}),R(10,fo,3,0,"div")(11,vo,9,2,"div"),l()()()()}if(n&2){let t,i=e.$implicit,o=C();m(),_("ngClass",i.Active?"active":""),m(),_("ngClass",ie(9,uo,(i==null?null:i.ID)==(o.selectedRegister==null?null:o.selectedRegister.ID))),m(),_("ngClass",ie(11,ho,i!=o.selectedRegister)),m(3),y(tt(7,6,i.Name,15)),m(2),x(i.State!="Close"?8:-1),m(2),x((t=i.State)==="Close"?10:t==="Open"?11:-1)}}var At=class n{constructor(e,t,i,o,r,a,u){this._dialogRef=e;this._outletService=t;this._posService=i;this._userRoleService=o;this.router=r;this.httpService=a;this._odsService=u}searchInputRef;originalSelectedRegister=null;registers;searchInput="";selectedRegister=new rt;modalConfig=S(new Z);role;get AppConfigJSON(){return this._posService.Data.AppConfigJSON}destroy$=new se;ngOnInit(){this.initModalConfig(),this.subscribeToObsChanges()}ngAfterViewInit(){this.searchInputRef&&this._dialogRef.afterOpened().subscribe(()=>{setTimeout(()=>{this.searchInputRef.nativeElement.focus()},200)})}subscribeToObsChanges(){this._posService.Data$.pipe(ht(this.destroy$)).subscribe(e=>{this.registers=e.Registers}),this._outletService.Data$.pipe(ht(this.destroy$)).subscribe(e=>{this.selectedRegister=this.findOutletRegisterById(e.RegisterID),this.originalSelectedRegister=this.selectedRegister?ct({},this.selectedRegister):null,this.initModalConfig(!1)}),this._userRoleService.Data$.pipe(ht(this.destroy$)).subscribe(e=>{this.role=e})}findOutletRegisterById(e){let t=this.registers.find(i=>i.ID===e);return t||new rt}initModalConfig(e=!0){this.modalConfig.update(t=>(t.hideFooter=!0,t.hideScrollbar=!0,t.hideClose=e,t.title="Choose an outlet",t))}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}onClose(){this._dialogRef.close()}select(e){if(this.AppConfigJSON.ModuleShift.Closure.Enabled)if(this.selectedRegister.ID!=null&&this.selectedRegister.Open&&e.CashierID==null)confirm("You already have an active register with "+this.selectedRegister.Name+`!
2
2
  Do you want to end your session?`)&&(this.onClose(),this.router.navigate(["menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}}));else if(!e.Open||this.selectedRegister.ID==e.ID)this.selectedRegister=e,this.onSubmitSelectedRegister();else{if(this.role.SellEditor==!1){alert("You cannot end shift for Register "+e.Name+" - Unauthorized Access");return}alert("This Register has already active register, Are you sure you want to end this register?"),this.onClose(),this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}})}else this.selectedRegister=e,this.onSubmitSelectedRegister()}onSubmitSelectedRegister(){if(this.selectedRegister.ID==null){alert("Please select a register first!");return}this._outletService.pushNewRegister(this.selectedRegister),this.loadOdsConfig(this.selectedRegister.EntityID),this._dialogRef.close({selectedRegister:this.selectedRegister,openStartingCashDialog:this.selectedRegister.ID!=this.originalSelectedRegister?.ID})}closeRegister(e){let t=this.selectedRegister.ID;if(this.role.SellEditor==!1){alert("You cannot end shift for Register "+e.Name+" - Unauthorized Access");return}t==e.ID?this.router.navigate(["/menu/Shift/Main/My_Shift"]):this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}}),this.onClose()}loadOdsConfig(e){this.httpService.get(`/api/outlet/GetOrderDisplayBroadcastMode?EntityID=${e}`).pipe(z(t=>{this._odsService.setODSConfig(t.form.OrderDisplayBroadcastMode)})).subscribe()}static \u0275fac=function(t){return new(t||n)(D(X),D(K),D(F),D(ue),D(Oi),D(ne),D(Nt))};static \u0275cmp=U({type:n,selectors:[["pos-modal-register"]],viewQuery:function(t,i){if(t&1&&vt(mo,5),t&2){let o;Ct(o=yt())&&(i.searchInputRef=o.first)}},standalone:!1,decls:13,vars:6,consts:[["searchInputRef",""],[3,"onClose","config"],[1,"ms-0","mb-8","search-container",3,"hidden"],[1,"input-group","mb-3","rounded-start-1"],[1,"input-group-text","txtFilter","rounded-end-0"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["data-cy","SearchOutlet","type","text","placeholder","Filter by Name","aria-label","Search",1,"txtFilter","form-control","border-start-0","rounded-1","rounded-start-0",3,"ngModelChange","ngModel"],[1,"container","custom-scroll"],[1,"row",2,"width","600px"],["data-cy","registers",1,"col-4"],[1,"card","border-0",3,"ngClass"],[1,"card-body","p-0",3,"ngClass"],[1,"card-title","mb-0",3,"click","ngClass"],[1,"fa-solid","fa-house","pe-1","fs-6"],[1,"fa","fa-xmark-circle","fa-lg","position-absolute",2,"text-shadow","0 1px 0 #afafaf","right","5px","top","16px"],[1,"card-text","px-0","py-2",3,"click"],[1,"fa","fa-xmark-circle","fa-lg","position-absolute",2,"text-shadow","0 1px 0 #afafaf","right","5px","top","16px",3,"click"],[1,"idle"],[1,"cashier"],["aria-hidden","true",1,"fa","fa-user","pe-2"],[1,"d-inline"],[1,"open"],["aria-hidden","true",1,"fa-regular","fa-clock","pe-2"]],template:function(t,i){if(t&1){let o=q();s(0,"modal-material",1),T("onClose",function(){return i.onClose()}),s(1,"content")(2,"div",2)(3,"div",3)(4,"span",4),Q(5,"i",5),l(),s(6,"input",6,0),Se("ngModelChange",function(a){return k(o),ye(i.searchInput,a)||(i.searchInput=a),V(a)}),l()()(),s(8,"div",7)(9,"div",8),pe(10,Co,12,13,"div",9,Ne),P(12,"FilterByName"),l()()()()}t&2&&(_("config",i.modalConfig()),m(2),_("hidden",i.registers.length<=6),m(4),Ce("ngModel",i.searchInput),m(4),me(tt(12,3,i.registers,i.searchInput)))},dependencies:[Dt,oe,re,De,ae,ki,Vi],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.search-container[_ngcontent-%COMP%]{transition:all .3s ease;width:97%}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]{position:relative;transition:all .3s ease;height:2.3rem}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover, .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e4d,0 0 8px 4px #89b03e33;border-radius:4px}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]{transition:all .3s ease;border-left:none!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .txtFilter.form-control[_ngcontent-%COMP%]:focus{box-shadow:none!important;border-color:#ced4da!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .input-group-text[_ngcontent-%COMP%]{transition:all .3s ease;background-color:#fff;border-right:none!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .input-group-text[_ngcontent-%COMP%], .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .input-group-text[_ngcontent-%COMP%]{background-color:#89b03e1a;border-color:#84cc16!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%] .fa-magnifying-glass[_ngcontent-%COMP%]{transition:all .3s ease}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:hover .fa-magnifying-glass[_ngcontent-%COMP%], .search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within .fa-magnifying-glass[_ngcontent-%COMP%]{color:#84cc16!important}.search-container[_ngcontent-%COMP%] .input-group[_ngcontent-%COMP%]:focus-within{box-shadow:0 0 0 2px #89b03e66,0 0 12px 6px #89b03e40!important}.custom-scroll[_ngcontent-%COMP%]::-webkit-scrollbar{width:6px}.custom-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:#f1f1f1;border-radius:3px}.custom-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#89b03e;border-radius:3px}.custom-scroll[_ngcontent-%COMP%]::-webkit-scrollbar-thumb:hover{background:#7a9e37}.container[_ngcontent-%COMP%]{overflow-y:auto;overflow-x:hidden;max-height:260px;min-height:150px}.col-4[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]{width:180px;min-height:95px;margin-right:17px;margin-bottom:17px;position:relative}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]{display:block;outline:0;border:1px solid #B1AAAA;border-radius:5px;cursor:pointer}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{height:30px;border-radius:4px;padding:5px 10px;color:#fff;background:#b1aaaa;overflow:hidden}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{margin-right:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover, .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%]{background:#ffffe1;border:1px solid #89b03e}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover > h5[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%]{background:#89b03e}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover{border:1px solid #c9302c}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover > h6[_ngcontent-%COMP%]{background:#c9302c!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#c9302c}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover{background:#fff}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]{border:1px solid #f6a828}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%]{background:#f6a828!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover{border:1px solid #f6a828;background:#fff}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover > strong[_ngcontent-%COMP%]{background:#f6a828!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#f6a828}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] div[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.75rem!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{height:80px;padding:15px 10px;position:relative}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;font-weight:400;font-size:.875rem;width:100%;margin-bottom:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:first-child{margin-top:-10px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:last-child{margin-bottom:0}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{text-align:center;position:absolute;bottom:0;right:0;width:auto;background-color:#b1aaaa;border-radius:3px;padding:2px 5px;color:#fff;display:none!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.idle[_ngcontent-%COMP%]{display:block;font-size:1.25rem;text-align:center}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{position:absolute;width:27px;height:28px;cursor:pointer;top:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#000}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:last-of-type{right:-5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:nth-last-of-type(2){right:15px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{bottom:20px;right:5px;position:absolute}.col-4[_ngcontent-%COMP%] .duration[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{border:1px solid!important;position:absolute;bottom:-3px;left:58px;background:#fff;border-radius:5px}"]})};var So=["inputCash"],Qt=class n{constructor(e,t,i){this.dialogRef=e;this.data=t;this.focusMonitor=i;this.generateModalTitle$.subscribe()}registerService=g(K);loadPOSService=g(F);register=this.registerService.Data;username=this.loadPOSService?.Data?.UserName;amount=S(0);config=new Z;currentRegisterName;generateModalTitle$=this.registerService.Data$.pipe(J(e=>p.IsNotEmpty(e)),z(()=>{let e=this.registerService.getOutletRegister(),t=e?.Name?.length>18?`${e?.Name?.substring(0,18)}...`:e?.Name;this.config.title="Open Shift",this.currentRegisterName=t}),j());today=new Date;inputCashEl;ngOnInit(){this.config.customWidth="350px",this.config.hideCancel=!0}ngAfterViewInit(){this.focusInput(),this.dialogRef.afterOpened().subscribe(()=>{this.focusInput()})}focusInput(){let e=this.inputCashEl?.nativeElement;e&&(this.focusMonitor.focusVia(e,"program"),e.addEventListener("blur",()=>{this.dialogRef.getState()===0&&this.focusMonitor.focusVia(e,"program")}))}onOk(){this.dialogRef.close({amount:this.amount()})}static \u0275fac=function(t){return new(t||n)(D(X),D(de),D(Ei))};static \u0275cmp=U({type:n,selectors:[["POS-modal-opening-cash"]],viewQuery:function(t,i){if(t&1&&vt(So,5),t&2){let o;Ct(o=yt())&&(i.inputCashEl=o.first)}},standalone:!1,decls:25,vars:8,consts:[["inputCash",""],[3,"onOk","onCancel","onClose","config"],[1,"table","fs-5","text"],[1,"py-3"],[1,"text-end","pe-3"],[1,"py-4"],[1,"text-end"],["data-cy","InputCash","autoNum","",1,"border","form-control-lg","text-end","w-100",3,"ngModelChange","ngModel"]],template:function(t,i){if(t&1){let o=q();s(0,"modal-material",1),T("onOk",function(){return i.onOk()})("onCancel",function(){return i.dialogRef.close()})("onClose",function(){return i.dialogRef.close()}),s(1,"content")(2,"table",2)(3,"tr")(4,"td",3),c(5,"Outlet Register"),l(),s(6,"td",4),c(7),l()(),s(8,"tr")(9,"td",5),c(10,"Current User"),l(),s(11,"td",4),c(12),l()(),s(13,"tr")(14,"td",5),c(15,"Starting Time"),l(),s(16,"td",4),c(17),P(18,"date"),l()(),s(19,"tr")(20,"td",3),c(21,"Starting Cash"),l(),s(22,"td",6)(23,"input",7,0),Se("ngModelChange",function(a){return k(o),ye(i.amount,a)||(i.amount=a),V(a)}),l()()()()()()}t&2&&(_("config",i.config),m(7),y(i.currentRegisterName),m(5),y(i.username),m(5),y(tt(18,5,i.today,"EEEE, HH:mm")),m(6),Ce("ngModel",i.amount))},dependencies:[oe,re,De,ae,It,Pt],styles:[".table-title-width[_ngcontent-%COMP%]{width:120px}"]})};var Ht=class{OrderNumberElement;InvoiceNumberElement;NewOrderID};var Le=class n{constructor(e,t,i){this._httpService=e;this._onlineStatusService=t;this._localDataService=i;this._onlineStatusService.getOnlineStatus$().subscribe(o=>{this.isOnline=o})}isOnline;GenerateNumber(e,t){if(this.isOnline)return this._httpService.get(H.GenerateNumber,[{key:"EntityID",value:e},{key:"TypeID",value:1}]);{let i=new Ht;return p.IsNotEmpty(t.NumberElement)&&(t.NumberElement.Seed+=1),p.IsNotEmpty(t.InvoiceNumberElement)&&(t.InvoiceNumberElement.Seed+=1),i.InvoiceNumberElement=t.InvoiceNumberElement,i.OrderNumberElement=t.NumberElement,i.NewOrderID=p.Guid_NewGuid(),fe(i)}}findRegisterById(e){return new Promise(t=>{this._localDataService.isConfigFromServer().subscribe(i=>{i?this._httpService.get(H.GetRegisterInfo,[{key:"RegisterID",value:e}]).subscribe(o=>{t(o)}):this._localDataService.findRegisterByID(e).subscribe(o=>{t(o)})})})}recordOpeningCash(e){return mt(this._httpService.post("/API/POS/RecordOpeningCash",e))}static \u0275fac=function(t){return new(t||n)(d(ne),d(Tt),d(Rt))};static \u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"})};var K=class n{constructor(e,t,i,o,r,a){this._signalRClientService=e;this._matDialog=t;this._posHttpResponseService=i;this._CoreHttpService=o;this._toastrService=r;this._roleService=a}datePipe=g(Pt);_Data=new xe(null);Data$=this._Data.asObservable().pipe(J(e=>e!==null),Ee());get Data(){return this._Data.value}getSalesname(e){return this.Data&&this.Data.ListSales?this._Data.value.ListSales.find(t=>t.ID==e)?.Name:""}setActiveRegisterFromOptions(e,t){let o=this._posHttpResponseService.Data.AppConfigJSON.ModuleShift.Closure.Enabled;if(e.length>1){let r=e.find(a=>a.LoginID==t);if(r)this.pushNewRegister(r);else{let a=this.getOutletRegisterFromLocalStorage(),u=this.Data?.RegisterID?this.Data.RegisterID:a?.ID;e.some(b=>b.ID==u)?o?this.openChooseRegisterModal():this.initRegisterFromLocalStorage():this.openChooseRegisterModal()}}e.length==1&&(this.pushNewRegister(e[0]),p.IsEmpty(e[0].LoginID)&&p.IsEmpty(e[0].CashierID)&&this.openOpeningCashModal(e[0].ID)),e.length==0&&this._toastrService.warning("You do not have access to any OUTLET","Warning")}openChooseRegisterModal(){this._matDialog.open(At,{id:"registerModal",disableClose:!0}).afterClosed().pipe(J(e=>p.IsNotEmpty(e?.selectedRegister))).subscribe(e=>{e.selectedRegister&&this.openOpeningCashModal(e.selectedRegister.ID)})}openOpeningCashModal(e){this._posHttpResponseService.Data.AppConfigJSON.ModuleShift.Closure.Enabled&&this._matDialog.open(Qt,{disableClose:!0,id:"openingCashModal"}).afterClosed().pipe(J(o=>p.IsNotEmpty(o))).subscribe(o=>{let r={RegisterID:e,OpAmount:o.amount};this._CoreHttpService.recordOpeningCash(r).then(()=>{this.updateRegisterList(r),this.initCursorFocus(e)})})}updateRegisterList(e){let i=this._posHttpResponseService.Data.Registers.map(r=>r.ID==e.RegisterID?this.mapRegisterAsActiveRegister(r,e):r),o=this._posHttpResponseService.Data;o.Registers=i,this._posHttpResponseService.pushNewValue(o)}mapRegisterAsActiveRegister(e,t){let i=localStorage.getItem("AccountInfo");if(i){let r=JSON.parse(i);e.LoginID=r.UserName}e.OpeningCash=t.OpAmount,e.Open=!0,e.State="Open";let o=this.datePipe.transform(new Date,"dd MM yyyy HH:mm");return e.StartDisplay=o,e}initRegisterFromLocalStorage(){if(this._roleService.Data.DeleteItem==!1){let t=this.getOutletRegisterFromLocalStorage();t&&this.pushNewRegister(t)}}pushNewRegister(e){let t=this._Data.value,i=t?t.RegisterID:null;i!=e.ID&&this._CoreHttpService.findRegisterById(e.ID).then(o=>{o.RegisterCode=e.Code,o.DefaultPrintTemplate=o.PrintTemplate,o.SplitPaymentEnabled=this.findSplitPaymentConfig(o.EntityID),this._signalRClientService.SubscribeGroup(o.RegisterID,i),this.saveOutletRegisterToLocalStorage(e),this.pushNewValue(o)})}getOutletRegister(){let e=this.Data.RegisterID;return this._posHttpResponseService.Data.Registers.find(o=>o.ID==e)}pushNewValue(e){this._Data.next(e)}saveOutletRegisterToLocalStorage(e){if(this._roleService.Data.DeleteItem==!1){let i=JSON.stringify(e);localStorage.setItem("outlet_register",i)}}getOutletRegisterFromLocalStorage(){let e=this._roleService.Data.DeleteItem,t=localStorage.getItem("outlet_register"),i=null;return t&&(e?localStorage.removeItem("outlet_register"):i=JSON.parse(t)),i}findOutletRegisterById(e){return this._posHttpResponseService.Data.Registers.find(o=>o.ID===e)}findSplitPaymentConfig(e){let i=this._posHttpResponseService.Data.Entities.find(o=>o.ID===e);return i?i.SplitPaymentEnabled:!1}initCursorFocus(e){let t=document.getElementById("product");t&&p.IsNotEmpty(e)&&t.focus()}static \u0275fac=function(t){return new(t||n)(d(be),d(Y),d(F),d(Le),d(w),d(ue))};static \u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"})};var Ue=class{CommissionID;ReturNumber;parkTemporaryItem;posState;InputTextValue;constructor(){this.posState=0,this.CommissionID="",this.ReturNumber="",this.parkTemporaryItem=[],this.InputTextValue=""}};var Bt=class{RegisterID;RegisterCode;EntityID;EntityName;NumberElement;InvoiceNumberElement;ListSales;QuickKeyPack;PrintTemplate;DefaultSalesOrderTag;DefaultTaxType;DefaultWarehouse;MemberPoint;ParkLayoutPack;Promotion;DefaultPrintTemplate;NewOrderID;Payments;SplitPaymentEnabled;constructor(){this.RegisterID=null,this.RegisterCode=null,this.EntityID=null,this.EntityName=null,this.NumberElement=new Be,this.InvoiceNumberElement=new Be,this.Promotion=[],this.SplitPaymentEnabled=!0}};var $e=(a=>(a.Amount="Amount",a.Percentage="Percentage",a.Return="Return",a.ParkedDeletion="ParkedDeletion",a.DeleteItem="DeleteItem",a.FullAccess="FullAccess",a))($e||{});var jt=class n{constructor(e,t,i){this._promotionEventService=e;this._dialogRef=t;this.data=i;this.modalConfig=new Z,this.modalConfig.hideCancel=!0,this.modalConfig.hideClose=!0,this.modalConfig.headerType=He.Warning,this.modalConfig.title="Promotion Requirement unfulfilled!",this.modalConfig.customWidth="350px",this.modalConfig.okText="Ok",this.selectedPromotion=e.selectedPromotion}modalConfig;selectedPromotion;onOk(){this._promotionEventService.restoreOrder(),this._dialogRef.close()}static \u0275fac=function(t){return new(t||n)(D(ge),D(X),D(de))};static \u0275cmp=U({type:n,selectors:[["POS-modal-promotion-confirm"]],standalone:!1,decls:9,vars:4,consts:[[3,"onOk","config"],[1,"fst-italic","text-danger","mb-3"],[1,"mb-0"]],template:function(t,i){t&1&&(s(0,"modal-material",0),T("onOk",function(){return i.onOk()}),s(1,"content")(2,"div")(3,"h5"),c(4),l(),s(5,"p",1),c(6),l(),s(7,"p",2),c(8),l()()()()),t&2&&(_("config",i.modalConfig),m(4),y(i.selectedPromotion==null?null:i.selectedPromotion.Name),m(2),y(i.selectedPromotion==null?null:i.selectedPromotion.Description),m(2),y(i.data==null?null:i.data.message))},dependencies:[ae],encapsulation:2})};var Lt=class extends te{};var Ut=class{Code;Provider;OutletID;Customer;ShoppingCart};var Ge=class n{salesOrderService=g(E);registerService=g(K);customerService=g(Pe);orderCalculator=g(G);generateRedeemCouponDto(e,t){let i=new Ut,o=this.registerService.Data?.EntityID;return i.Code=e,i.Provider=t,i.ShoppingCart={Amount:this.orderCalculator.Data,Items:this.generateItems()},i.OutletID=o,i.Customer=this.generateCustomer(t),i}generateItems(){return this.salesOrderService.Data.CartItems.map(i=>({ItemTemporaryID:i.ItemTemporaryID,Price:i.Price,Quantity:i.Quantity,VariantID:i.VariantID,Code:i?.Variant?.Code,Discount:i.Discount,DiscountAmount:i.DiscountAmount,PriceBookID:i.PriceBookID,UnitPriceOriginal:i.UnitPriceOriginal,UnitPrice:i.UnitPrice,CategoryID:i?.Variant?.CategoryID}))}generateCustomer(e){let t=this.customerService.Data,i=this.salesOrderService?.Data?.Order?.CustomerID,o=null;return p.IsNotEmpty(i)&&(o={Phone:t.Mobile,Email:t.Email},e==="Internal"&&(o=ct({ID:i},o))),o}static \u0275fac=function(t){return new(t||n)};static \u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"})};function Do(n,e){if(n&1&&(s(0,"span",5),c(1),P(2,"number"),l()),n&2){let t=C().$implicit;m(),ve("",N(2,1,t.Amount),"%")}}function Po(n,e){if(n&1&&(s(0,"span",5),c(1),P(2,"number"),l()),n&2){let t=C().$implicit;m(),ve(" -",N(2,1,t.Amount)," ")}}function _o(n,e){}function Oo(n,e){if(n&1){let t=q();s(0,"button",8),T("click",function(){k(t);let o=C().$implicit,r=C();return V(r.onApplyCouponDiscount(o))}),c(1," Apply "),l()}}function Io(n,e){if(n&1&&(s(0,"tr")(1,"td"),c(2),l(),s(3,"td"),c(4),l(),s(5,"td",4),c(6),P(7,"number"),l(),s(8,"td",4),R(9,Do,3,3,"span",5)(10,Po,3,3,"span",5),l(),s(11,"td",6),R(12,_o,0,0)(13,Oo,2,0,"button",7),l()()),n&2){let t=e.$implicit,i=C();m(2),y(t==null?null:t.Name),m(2),y(t==null?null:t.Code),m(2),y(N(7,5,t==null?null:t.Price)),m(3),x((i.coupon==null?null:i.coupon.Type)==i.couponType.Percentage?9:10),m(3),x((t==null?null:t.CouponDiscount)>0?12:13)}}var $t=class n{dialogRef=g(X);coupon=g(de);salesOrderModelService=g(E);config;couponType=$e;itemsOptions=A(()=>{let e=this.salesOrderModelService?.Data?.CartItems,t=this.coupon?.ApplyToProduct??[];return t=t.filter(o=>o.UserOption),t.map(o=>{let r=e.find(a=>a.Variant.ID===o.ID);return r&&(o.Name=r.Variant?.Name,o.Price=r.Variant?.UnitPrice),o})});ngOnInit(){this.initModalConfig()}initModalConfig(){this.config=new Z,this.config.title="Choose Item to Apply Discount",this.config.hideFooter=!0}onApplyCouponDiscount(e){this.dialogRef.close(e)}onClose(){this.dialogRef.close()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=U({type:n,selectors:[["app-modal-selected-coupon-item-v2"]],decls:17,vars:1,consts:[[3,"onCancel","onClose","config"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],[1,"text-end"],[1,"text-danger"],[1,"text-center"],[1,"btn","btn-sm","btn-success"],[1,"btn","btn-sm","btn-success",3,"click"]],template:function(t,i){t&1&&(s(0,"modal-material",0),T("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()}),s(1,"content")(2,"table",1)(3,"thead",2)(4,"tr")(5,"th",3),c(6,"Name"),l(),s(7,"th",3),c(8,"Code"),l(),s(9,"th",3),c(10,"Price"),l(),s(11,"th",3),c(12,"Discount"),l(),Q(13,"th",3),l()(),s(14,"tbody"),pe(15,Io,14,7,"tr",null,gt),l()()()()),t&2&&(_("config",i.config),m(15),me(i.itemsOptions()))},dependencies:[ke,Qi,B],encapsulation:2})};var qe=class n{httpService=g(ne);promotionCouponFactoryService=g(Ge);salesOrderService=g(E);userRoleService=g(ue);dialog=g(Y);posConfig=g(F);calculatorService=g(G);toastr=g(w);separateQuantityToNewRow=A(()=>this.posConfig.Data?.AppConfigJSON?.ModuleSell?.PromotionCouponSeparateQuantityToNewRow);_appliedCoupon=S(null);appliedCoupon=A(()=>this._appliedCoupon());salesOrderBeforePromotion=S(null);originalRoleData=A(()=>$(je,this.userRoleService.Data));redeemCoupon(e,t){e=this.trimInputCoupon(e);let i=this.promotionCouponFactoryService.generateRedeemCouponDto(e,"Internal");return this.httpService.post(H.ValidateInternalCouponV2,i).pipe(z(o=>{o.Note=t||"",o.Code=e,this.copyOriginalSalesOrder(),this.applyCoupon(o)}))}trimInputCoupon(e){return p.IsNotEmpty(e)&&(e=e.trim()),e}applyCoupon(e){switch(e.Type){case"Percentage":this.applyDiscountPercentage(e);break;case"Amount":this.applyDiscountAmount(e);break;case"Return":this.handleCouponReturnAccess(e);break;case"DeleteItem":this.handleDeleteItemAccess(e);break;case"ParkedDeletion":this.handleCouponParkedDeletionAccess(e);break;case"FullAccess":this.handleFullAccess(e);break}this._appliedCoupon.set(e)}applyDiscountPercentage(e){let t=e.ApplyToProduct??[];t.some(o=>p.IsNotEmpty(o.UserOption))?this.openDialogSelectItem(e):t.length>0?this.applyDiscountToProduct(e,t):this.applyDiscountToOrder(e)}applyDiscountAmount(e){let t=e.ApplyToProduct??[];t.some(o=>p.IsNotEmpty(o.UserOption))?this.openDialogSelectItem(e):t.length>0?this.applyDiscountToProduct(e,t):this.applyDiscountToOrder(e)}openDialogSelectItem(e){this.dialog.open($t,{data:e}).afterClosed().pipe(J(t=>p.IsNotEmpty(t))).subscribe(t=>{this.applyDiscountToSelectedItem(e,t)})}applyDiscountToSelectedItem(e,t){this._appliedCoupon.update(i=>(i.ApplyToProduct=i.ApplyToProduct.map(o=>(t.ID==o.ID&&(o.SelectedItem=!0),o)),i)),this.applyDiscountToProduct(e,[t])}applyDiscountToOrder(e){let t=this.salesOrderService.Data;switch(e.Type){case"Amount":t.Order.DiscountAmount=e.Amount;break;case"Percentage":let i=this.calculateMaxDiscountInvoice(e);i.type=="amount"?t.Order.DiscountAmount=i.discount:t.Order.Discount=i.discount;break}t.Order.PromotionCoupon=e.Code,t.Order.PromotionNote=e.Note,t.Order.CouponType=1,this.salesOrderService.pushNewValue(t),this.showToastrAppliedCoupon(e)}calculateMaxDiscountInvoice(e){if(e.MaxDiscount>0){let t=e.Amount;return this.calculatorService.Data*t/100>e.MaxDiscount?{discount:e.MaxDiscount,type:"amount"}:{discount:e.Amount,type:"percentage"}}else return{discount:e.Amount,type:"percentage"}}applyDiscountToProduct(e,t){let i=this.salesOrderService.Data,o=i.CartItems,r=[];o=o.map(a=>{let u=this.findPromotionItemByVariantID(a,t);if(u.isMatch){let h=t[u.index];if(this.separateQuantityToNewRow()&&a.Quantity>1&&h.OneFirstOption){let b=this.separateItemQuantityToNewRow(h,a,e);a=b.originalItem,b.separatedItem&&r.push(b.separatedItem)}else{let b=this.calculateOneOfFirstDisc(h,a.Quantity);h.Amount=b,a=this.applyDiscountToItem(a,h,e)}}return a}),o=o.concat(r),i.CartItems=o,i.Order.PromotionCoupon=e.Code,i.Order.PromotionNote=e.Note,i.Order.CouponType=1,this.salesOrderService.pushNewValue(i),this.showToastrAppliedCoupon(e)}separateItemQuantityToNewRow(e,t,i){let o=t.Quantity,r=$(te,t);return o>1?(t.Quantity=o-1,r.Quantity=1,r=this.applyDiscountToItem(r,e,i)):t=this.applyDiscountToItem(t,e,i),{originalItem:t,separatedItem:r}}calculateOneOfFirstDisc(e,t){let i=e.Amount;return e.OneFirstOption&&(i=e.Amount/t),i}applyDiscountToItem(e,t,i){switch(i.Type){case"Amount":e.DiscountAmount=t.Amount;break;case"Percentage":if(i.MaxDiscount>0)if(this.calculateDiscountItem(e,t.Amount)>i.MaxDiscount){let r=i.MaxDiscount/e.Quantity;e.DiscountAmount=r}else e.Discount=t.Amount;else e.Discount=t.Amount;break}return e}calculateDiscountItem(e,t){return e.Price*e.Quantity*t/100}findPromotionItemByVariantID(e,t){let i=t.findIndex(o=>o.ID==e.VariantID&&o.ItemTemporaryID==e.ItemTemporaryID);return{isMatch:i>-1,index:i}}handleCouponReturnAccess(e){let t=$(je,this.originalRoleData());t.Return=!0,this.userRoleService.pushNewValue(t),this.applyCouponToSalesOrder(e)}handleDeleteItemAccess(e){let t=$(je,this.originalRoleData());t.DeleteItem=!0,this.userRoleService.pushNewValue(t),this.applyCouponToSalesOrder(e)}handleCouponParkedDeletionAccess(e){let t=$(je,this.originalRoleData());t.ParkedDeletionAuthorized=!0,this.userRoleService.pushNewValue(t),this.applyCouponToSalesOrder(e)}handleFullAccess(e){let t=$(je,this.originalRoleData());t.UnitPriceEditor=!0,t.Discount=!0,t.Return=!0,t.Tax=!0,t.NumberEditor=!0,t.DateEditor=!0,t.PricebookSelector=!0,t.DeleteItem=!0,t.ParkedDeletionAuthorized=!0,this.userRoleService.pushNewValue(t),this.applyCouponToSalesOrder(e)}resetCouponOnNewTransaction(){this.userRoleService.pushNewValue(this.originalRoleData()),this._appliedCoupon.set(null)}setCouponOnEdit(e){e&&p.IsNotEmpty(e?.Type)&&(this._appliedCoupon.set(e),this.generateOriginalSalesOrderOnEdit())}generateOriginalSalesOrderOnEdit(){let e=$(ce,this.salesOrderService.Data);e.Order.PromotionCoupon=null,e.Order.PromotionNote=null,e.Order.Discount=0,e.Order.DiscountAmount=0,this.salesOrderBeforePromotion.set(e)}removeAppliedCoupon(){this.salesOrderService.pushNewValue(this.salesOrderBeforePromotion()),this.appliedCoupon().Type!="Amount"&&this.appliedCoupon().Type!="Percentage"&&this.userRoleService.pushNewValue(this.originalRoleData()),this._appliedCoupon.set(null),this.salesOrderBeforePromotion.set(null)}copyOriginalSalesOrder(){let e=$(ce,this.salesOrderService.Data);this.salesOrderBeforePromotion.set(e)}applyCouponToSalesOrder(e){let t=this.salesOrderService.Data;t.Order.PromotionCoupon=e.Code,t.Order.PromotionNote=e.Note,t.Order.CouponType=1,this.salesOrderService.pushNewValue(t),this.showToastrAppliedCoupon(e)}showToastrAppliedCoupon(e){e.Notification?this.toastr.success(e.Notification,"Coupon Applied"):this.toastr.success("Coupon applied successfully!","Coupon Applied")}static \u0275fac=function(t){return new(t||n)};static \u0275prov=v({token:n,factory:n.\u0275fac,providedIn:"root"})};var We=class n{constructor(e,t,i,o,r,a,u,h,b,f){this.variantService=e;this._posService=t;this._orderDataService=i;this.toastr=o;this._orderProcessorService=r;this._customerHttpService=a;this.promotionCouponServiceV2=u;this.promotionCouponExternalService=h;this.userRoleService=b;this.decimalPipe=f;this.subscribeToObservable()}dialog=g(Y);salesOrderData;appConfigJson;entityID;audio=new Audio;priceMinimumRestrictionWarning=S("");subscribeToObservable(){this._posService.Data$.pipe(j()).subscribe(e=>{this.appConfigJson=e.AppConfigJSON}),this._orderDataService.Data$.pipe(j()).subscribe(e=>{this.salesOrderData=e,this.entityID=e.Order.EntityID}),this._orderProcessorService.Data$.pipe(j()).subscribe(e=>{e.posState==3&&this.clearCartItemsInLocalStorage()})}addCartItemById(e,t,i=!0){return new Promise((o,r)=>{this.variantService.findVariantByID(e,this.entityID,i).then(a=>{this.isShoppingCartLockedByPromotionCoupon()==!1&&this.createNewCartItem(a,t),o(a)}).catch(a=>{r(a)})})}addCartItemByCode(e){return new Promise((t,i)=>{let o=this.appConfigJson.ModuleSell.DigitalScale;o.Digit>0&&p.IsNotEmpty(o.Regex)&&e.length==o.Digit?this.parseDigitalScaleBarcodeWithRegex(e,o).then(a=>{a||(this.toastr.info("Matching Regex Rule to Barcode","Digital Scale"),this.findVariantByCode(e).then(u=>t(u)).catch(u=>i(u)))}):this.findVariantByCode(e).then(a=>t(a)).catch(a=>i(a))})}findVariantByCode(e){let t=this.appConfigJson.ModuleSell.BarcodeSerialEnabled;return new Promise((i,o)=>{this.variantService.findVariantByCode(e,this.entityID,t).then(r=>{i(r),this.isShoppingCartLockedByPromotionCoupon()==!1&&this.createNewCartItem(r)}).catch(r=>{this.playBellRing(),o(r)})})}addItemBySerial(e){this.variantService.findVariantBySerial(e,this.entityID).subscribe(t=>{let i=this.salesOrderData.CartItems;if(i.length>0){let o,r=[],a=i.findIndex(u=>u.Variant.ID==t.ID);r=[],a!==-1?(o=i[a].Serial?.findIndex(u=>u.Number==e),r=[...i[a].Serial?i[a].Serial:[]],o==-1?(r.push({Number:e,Quantity:1}),i[a].Quantity=r.length):r.length>0?r[o].Quantity+=1:(r=[{Number:e,Quantity:1}],this.addNewSerials(t,e)),i[a].Serial=[...r],i[a].Quantity=i[a].calculateSerialQty(),this.updateCartItem(i[a],a)):this.addNewSerials(t,e)}else this.addNewSerials(t,e)})}addNewSerials(e,t){e.Serial=[{Number:t,Quantity:1}],this.createNewCartItem(e)}playBellRing(){this.audio.src="https://cdn.dealpos.xyz/web-audio/bell_ring.mp3",this.audio.load(),this.audio.play()}updateCartItem(e,t){this.isShoppingCartLockedByPromotionCoupon()==!1&&(this.salesOrderData.CartItems[t]=e,this._orderDataService.pushNewValue(this.salesOrderData),this.applyCustomerPoint(),this.saveItemsToLocalStorage())}deleteCartItem(e){this.isShoppingCartLockedByPromotionCoupon()==!1&&(this.salesOrderData.CartItems=this.salesOrderData.CartItems.filter(t=>t!==e),this._orderDataService.pushNewValue(this.salesOrderData),this.applyCustomerPoint())}parseDigitalScaleBarcodeWithRegex(e,t){return new Promise(i=>{let o=this.appConfigJson.ModuleSell.BarcodeSerialEnabled,r=new RegExp(t.Regex),a=e.match(r);if(console.log(a),p.IsNotEmpty(a)){let u=a[1],h=parseFloat(a[2]);console.log(h,"productQuantity"),h=h/t.QuantityDivider,this.variantService.findVariantByCode(u,this.entityID,o).then(b=>{this.createNewCartItem(b,null,h),i(!0)}).catch(()=>{i(!1)})}else i(!1)})}createNewCartItem(e,t,i){let o=new te,r=this.appConfigJson.ModuleSell.ProductNotes.CopyProductDescription,a=this.appConfigJson.ModuleSell.ProductNotes.CopyPromotionName;o.patchByVariant(e,r,a),o=this.applyReward(o,t),p.IsEmpty(t)&&(o=this.applyPriceBook(o)),this.validateCartItem(o)&&(o.Quantity=i||o.Quantity,t?.PromotionType==2?this.handlingPromotionQuantity(o):this.pushNewItemToArray(o,o.PromotionGift),this.applyCustomerPoint()),this.addAvailableComponent(o)}applyCustomerPoint(){let e=this.salesOrderData.Order.CustomerID,t=p.IsEmpty(e);this._orderProcessorService.reedemPointToDiscount(t)}handlingPromotionQuantity(e){let t=$(te,this.salesOrderData.CartItems),i=t.findIndex(o=>o.VariantID==e.VariantID&&o.PromotionGift);i!==-1?t[i].Quantity+=e.Quantity?e.Quantity:1:t=[...t,e],this.salesOrderData.CartItems=t,this._orderDataService.pushNewValue(this.salesOrderData)}applyPromotionProduct(e){let t=e.Variant.DiscountAmount;return t&&(e.Price=e.UnitPriceOriginal-t),e}applyReward(e,t){if(t){let i=this.appConfigJson.ModuleSell.ProductNotes.CopyPromotionName;e.Discount=t.Discount,e.Price=t.OriginalPrice;let o=t.OriginalPrice-t.UnitPrice;e.Price=e.UnitPriceOriginal-o,e.UnitPrice=e.UnitPriceOriginal-o,e.PromotionGift=!0,e.PromotionID=t.PromotionID,e.Quantity=t.Quantity?t.Quantity:1,e.PriceTypeID=3,e.Cost+=t.ExtraCost,e.UnitCost+=t.ExtraCost,e.PriceNote=t.PromotionName,i&&(e.Note=`${e.Note?e.Note:""} ${t.PromotionName} `)}return e}addAvailableComponent(e){let t=e.Price!=0,i=this.appConfigJson.ModuleSell.SellProductComponentDefaultPrice,o=e.Variant;if(o.Component!=null&&o.Component.length>0)for(let r of o.Component){let a=new Lt;a.patchByVariant(r),a.Quantity=e.Quantity*r.Quantity,t&&!i&&(r.UnitPrice=0),a.Price=r.UnitPrice,this.pushNewItemToArray(a)}}pushNewItemToArray(e,t=!1){if(this.isShoppingCartLockedByPromotionCoupon()==!1){let i=this.salesOrderData.CartItems.findIndex(o=>o.VariantID==e.VariantID);if(e=this.applyPromotionProduct(e),i==-1||t){let o=this.salesOrderData.CartItems.length;e.ItemTemporaryID=o,this.salesOrderData.CartItems.push(e)}else{let o=this.appConfigJson.ModuleSell.QuickKey.NewRowBehaviour;if(o==2){let r=this.salesOrderData.CartItems.length;e.ItemTemporaryID=r,this.salesOrderData.CartItems.push(e)}else if(o==1)this._orderProcessorService.Data.posState==4?this.salesOrderData.CartItems.push(e):this.addingQuantityItem(i,e);else{if(!this.validatePrepaidPackage(e,i)){this.toastr.error("This prepaid package is already in the cart while editing. Please remove it first before adding again.","Cannot Add Item");return}this.addingQuantityItem(i,e)}}this._orderDataService.pushNewValue(this.salesOrderData),this.saveItemsToLocalStorage()}}saveItemsToLocalStorage(){let e=this.userRoleService.Data.DeleteItem,t=this._orderProcessorService.Data?.posState;if(!e&&t!==4){let i=this._orderDataService.Data,o=i?.Order?.Number,r=i.CartItems,a={Number:o,CartItems:r};try{localStorage.setItem("cart_items",JSON.stringify(a))}catch(u){console.error("Error saving cart items to localStorage:",u)}}}clearCartItemsInLocalStorage(){localStorage.getItem("cart_items")&&(this.userRoleService.Data?.DeleteItem?this.clearCartItemsBasedOnCoupon():this.clearCartItemsStorage())}clearCartItemsBasedOnCoupon(){let e=this.promotionCouponServiceV2?.appliedCoupon();e&&(e?.Type=="FullAccess"||e?.Type=="DeleteItem")&&this.clearCartItemsStorage()}clearCartItemsStorage(){try{localStorage.removeItem("cart_items")}catch(e){console.error("Error clearing cart items from localStorage:",e)}}validatePrepaidPackage(e,t){let i=this.salesOrderData.CartItems[t],o=this._orderProcessorService.Data.posState,r=e.Variant.TypeID==10,a=p.IsNotEmpty(i.ID),u=!0;return o==2&&r&&a&&(u=!1),u}addingQuantityItem(e,t){let i=this.salesOrderData.CartItems.filter(u=>u.VariantID==t.VariantID),o=i.length,r=i.find(u=>!u.PromotionGift);this.salesOrderData.CartItems[e].PromotionGift&&o==1?this.salesOrderData.CartItems.push(t):(r.Quantity+=t.Quantity,r=this.applyPromotionProduct(r)),r&&(r=this.applyPriceBook(r))}validateCartItem(e){return e.Variant.CategoryTypeID==-1?(this.toastr.info(e.Variant.Name+" cannot be sold, check Category "+e.Variant.CategoryName+" settings","info"),!1):!!this.validateSerialItem(e)}validatePriceMinimum(e){let t=this.checkPriceMinimumRestriction(e);if(t)this.priceMinimumRestrictionWarning.set("");else{let i=this.appConfigJson.ModuleSell?.ProductDialog?.MinimumPriceIncludeDiscount,o=this.getPriceMinimum(e),r=this.generateMinimumPriceWarningMessage(i,o,e);this.priceMinimumRestrictionWarning.set(r)}return t}checkPriceMinimumRestriction(e){let t=!0,i=this.userRoleService.Data.PriceMinimum,r=this.appConfigJson.ModuleSell?.ProductDialog?.MinimumPriceIncludeDiscount?e.TotalAfterDiscountPerQuantity:e.Price;if(i){let a=this.getPriceMinimum(e);r<a?t=!1:t=!0}return t}getPriceMinimum(e){let t=this.appConfigJson.ModuleSell.ProductDialog?.PriceMinimumTypeID,i=0;switch(t){case 1:i=e.Variant?.UnitPrice;break;case 2:i=e.Variant?.UnitCost;break;case 3:i=e.Variant?.UnitPriceMinimum;break}return i}generateMinimumPriceWarningMessage(e,t,i){let o="",r=i.Discount,a=i.DiscountAmount;return e&&(r>0||a>0)?o=p.StringFormat(`<span><i class='fa-solid fa-triangle-exclamation me-2 d-inline'></i>Item net price is <h5 class='d-inline m-0'>{0}</h5></span>
3
3
  after item discount, you cannot sell lower than <h5 class='d-inline m-0'>{1}</h5></span>`,this.decimalPipe.transform(i.TotalAfterDiscountPerQuantity),this.decimalPipe.transform(t)):o=p.StringFormat("<span><i class='fa-solid fa-triangle-exclamation me-2 d-inline'></i>Cannot sell lower than <h5 class='d-inline m-0'>{0}</h5></span>",this.decimalPipe.transform(t)),o}validateSerialItem(e){let t=!0;if(e?.Serial?.length>0&&e.Variant.TypeID==4&&e.Quantity>0){let i=0;e?.Serial?.forEach(o=>{i+=o.Quantity}),i!=e.Quantity&&(this.toastr.error("Serial must be equal with the quantity","Error"),t=!1)}return t}isShoppingCartLockedByPromotionCoupon(){let e=this.promotionCouponServiceV2.appliedCoupon(),t=this.promotionCouponExternalService.coupon,i=!1;if((p.IsNotEmpty(e)||p.IsNotEmpty(t))&&this.isNonAuthorizedCouponType){i=!0;let r=this._orderDataService.Data.Order.PromotionCoupon;this.dialog.open(Et,{id:"ShoppingCartLocked",data:{title:"Shopping Cart Locked",message:`
4
4
  <div class="d-flex justify-content-center my-4">
@@ -0,0 +1 @@
1
+ import{Cc as m,Dc as c,Eb as r,Fb as l,Gb as b,Kb as C,Lb as x,Lc as T,Mb as _,Pc as D,Qb as f,Qc as n,Ra as o,Rb as d,ab as E,ec as s,fc as w,gc as P,hc as N,pa as p,pd as R,qa as u,tb as g,vb as h}from"./chunk-KYVLS64M.js";function S(e,v){if(e&1){let i=_();r(0,"span",5),f("click",function(){p(i);let t=d();return u(t.onFetchTotalData())}),r(1,"i",6),s(2,"?"),l()()}}function M(e,v){if(e&1&&(C(0),r(1,"span"),s(2),m(3,"number"),l(),x()),e&2){let i=d();o(2),w(c(3,1,i.totalData()))}}function L(e,v){if(e&1){let i=_();r(0,"div",4)(1,"a",7),f("click",function(){p(i);let t=d();return u(t.onNextPage())}),b(2,"i",8),s(3," Next "),l(),r(4,"a",9),f("click",function(){p(i);let t=d();return u(t.onConcatAllData())}),b(5,"i",10),s(6," Show All "),l()()}}var V=(()=>{class e{constructor(){this.fetchTotalData=D(),this.nextPage=D(),this.concatAllData=D(),this.nextPageDisabled=n(!1),this.pageNumber=n(1),this.totalData=n(0),this.pageSize=n(20),this.totalCurrentRow=n(0),this.isFetchTotalData=n(!1),this.goToLast=n(!1),this.startRecord=T(()=>!this.totalCurrentRow()||this.totalCurrentRow()<=0?0:this.goToLast()?this.totalData()&&this.totalData()>0?1:0:Math.max(0,this.pageNumber()-1)*this.pageSize()+1),this.endRecord=T(()=>!this.totalCurrentRow()||this.totalCurrentRow()<=0?0:this.goToLast()?this.totalData()&&this.totalData()>0?this.totalData():this.totalCurrentRow():Math.max(0,this.pageNumber()-1)*this.pageSize()+this.totalCurrentRow())}onFetchTotalData(){this.fetchTotalData.emit()}onNextPage(){this.nextPage.emit()}onConcatAllData(){this.concatAllData.emit()}static{this.\u0275fac=function(a){return new(a||e)}}static{this.\u0275cmp=E({type:e,selectors:[["infinite-pagination"]],inputs:{nextPageDisabled:[1,"nextPageDisabled"],pageNumber:[1,"pageNumber"],totalData:[1,"totalData"],pageSize:[1,"pageSize"],totalCurrentRow:[1,"totalCurrentRow"],isFetchTotalData:[1,"isFetchTotalData"],goToLast:[1,"goToLast"]},outputs:{fetchTotalData:"fetchTotalData",nextPage:"nextPage",concatAllData:"concatAllData"},decls:12,vars:12,consts:[[1,"d-flex","justify-content-between","mt-5"],[1,"me-auto","d-sm-block","collapse","mt-3"],[1,"fw-bold","fst-italic","hidden-xxs"],[2,"cursor","pointer"],[1,"btn-group"],[2,"cursor","pointer",3,"click"],["matTooltipPosition","above","matTooltip","Retrieve rows count",1,"border","p-3"],["role","button","matTooltipPosition","above","matTooltip","Load next page",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fa-solid","fa-arrow-right"],["role","button","matTooltipPosition","above","matTooltip","Load all products",1,"btn","btn-outline-secondary","btn-sm","text-primary",3,"click"],[1,"fa-solid","fa-share"]],template:function(a,t){a&1&&(r(0,"div",0)(1,"div",1)(2,"div",2),s(3),m(4,"number"),m(5,"number"),C(6),g(7,S,3,0,"span",3),x(),g(8,M,4,3,"ng-container"),s(9),m(10,"number"),l()(),g(11,L,7,0,"div",4),l()),a&2&&(o(3),N(" Showing ",c(4,6,t.startRecord())," - ",c(5,8,t.endRecord())," of "),o(4),h(t.isFetchTotalData()?-1:7),o(),h(t.isFetchTotalData()?8:-1),o(),P(" records ~ ",c(10,10,t.pageNumber())," Page "),o(2),h(!t.nextPageDisabled()&&!t.goToLast()?11:-1))},dependencies:[R],encapsulation:2})}}return e})();export{V as a};
@@ -1,4 +1,4 @@
1
- import{a as _}from"./chunk-IFZ7WOA2.js";import{Ga as F,L as B,P as A,Wc as L,bb as $,c as f,ha as M,ia as K,j as y,ja as b,k as v,ka as w,la as P,oa as R,s as U,td as N,ua as V}from"./chunk-KYVLS64M.js";import{j as S}from"./chunk-KMHZKFQS.js";var ie={name:"pos-offline",version:_.pos.indexedDBVersion,objectStoresMeta:[{store:"Order",storeConfig:{keyPath:"id",autoIncrement:!0},storeSchema:[{name:"Action",options:{unique:!1},keypath:"Action"},{name:"Items",options:{unique:!1},keypath:"Items"},{name:"CartItems",options:{unique:!1},keypath:"CartItems"},{name:"Invoice",options:{unique:!1},keypath:"Invoice"},{name:"Order",options:{unique:!1},keypath:"Order"},{name:"Payments",options:{unique:!1},keypath:"Payments"},{name:"Shipping",options:{unique:!1},keypath:"Shipping"},{name:"ContactName",options:{unique:!1},keypath:"ContactName"}]},{store:"Outlet",storeConfig:{keyPath:"RegisterID",autoIncrement:!1},storeSchema:[{name:"DefaultSalesOrderTag",options:{unique:!1},keypath:"DefaultSalesOrderTag"},{name:"DefaultTaxType",options:{unique:!1},keypath:"DefaultTaxType"},{name:"DefaultWarehouse",options:{unique:!1},keypath:"DefaultWarehouse"},{name:"EntityID",options:{unique:!1},keypath:"EntityID"},{name:"EntityName",options:{unique:!1},keypath:"EntityName"},{name:"InvoiceNumberElement",options:{unique:!1},keypath:"InvoiceNumberElement"},{name:"ListSales",options:{unique:!1},keypath:"ListSales"},{name:"MemberPoint",options:{unique:!1},keypath:"MemberPoint"},{name:"NewOrderID",options:{unique:!1},keypath:"NewOrderID"},{name:"NumberElement",options:{unique:!1},keypath:"NumberElement"},{name:"ParkLayoutPack",options:{unique:!1},keypath:"ParkLayoutPack"},{name:"PrintTemplate",options:{unique:!1},keypath:"PrintTemplate"},{name:"QuickKeyPack",options:{unique:!1},keypath:"QuickKeyPack"},{name:"RegisterID",options:{unique:!1},keypath:"RegisterID"},{name:"ShippingDefault",options:{unique:!1},keypath:"ShippingDefault"}]},{store:"OutletPrice",storeConfig:{keyPath:"id",autoIncrement:!0},storeSchema:[{name:"EntityID",options:{unique:!1},keypath:"EntityID"},{name:"ExtraCost",options:{unique:!1},keypath:"ExtraCost"},{name:"PriceDiscount",options:{unique:!1},keypath:"PriceDiscount"},{name:"UnitCost",options:{unique:!1},keypath:"UnitCost"},{name:"UnitPrice",options:{unique:!1},keypath:"UnitPrice"},{name:"VariantID",options:{unique:!1},keypath:"VariantID"}]},{store:"POSStorage",storeConfig:{keyPath:"id",autoIncrement:!1},storeSchema:[{name:"AppConfigJSON",options:{unique:!1},keypath:"AppConfigJSON"},{name:"BINS",options:{unique:!1},keypath:"BINS"},{name:"Currencies",options:{unique:!1},keypath:"Currencies"},{name:"CustomerOptions",options:{unique:!1},keypath:"CustomerOptions"},{name:"Denomination",options:{unique:!1},keypath:"Denomination"},{name:"Entities",options:{unique:!1},keypath:"Entities"},{name:"PaymentTypes",options:{unique:!1},keypath:"PaymentTypes"},{name:"Payments",options:{unique:!1},keypath:"Payments"},{name:"PoTypes",options:{unique:!1},keypath:"PoTypes"},{name:"ProductCount",options:{unique:!1},keypath:"ProductCount"},{name:"Registers",options:{unique:!1},keypath:"Registers"},{name:"Restriction",options:{unique:!1},keypath:"Restriction"},{name:"Roles",options:{unique:!1},keypath:"Roles"},{name:"SalesID",options:{unique:!1},keypath:"SalesID"},{name:"ServerDateString",options:{unique:!1},keypath:"ServerDateString"},{name:"ServerTime",options:{unique:!1},keypath:"ServerTime"},{name:"Taxes",options:{unique:!1},keypath:"Taxes"},{name:"UserID",options:{unique:!1},keypath:"UserID"},{name:"UserName",options:{unique:!1},keypath:"UserName"},{name:"Version",options:{unique:!1},keypath:"Version"}]},{store:"Product",storeConfig:{keyPath:"ID",autoIncrement:!1},storeSchema:[{name:"BrandName",options:{unique:!1},keypath:"BrandName"},{name:"CategoryName",options:{unique:!1},keypath:"CategoryName"},{name:"CategoryTypeID",options:{unique:!1},keypath:"CategoryTypeID"},{name:"Code",options:{unique:!1},keypath:"Code"},{name:"Component",options:{unique:!1},keypath:"Component"},{name:"Created",options:{unique:!1},keypath:"Created"},{name:"Description",options:{unique:!1},keypath:"Description"},{name:"ExtraCost",options:{unique:!1},keypath:"ExtraCost"},{name:"ID",options:{unique:!1},keypath:"ID"},{name:"ImageUrl",options:{unique:!1},keypath:"ImageUrl"},{name:"LoyaltyPoint",options:{unique:!1},keypath:"LoyaltyPoint"},{name:"Name",options:{unique:!1},keypath:"Name"},{name:"OrderPrice",options:{unique:!1},keypath:"OrderPrice"},{name:"OrderPriceDiscount",options:{unique:!1},keypath:"OrderPriceDiscount"},{name:"Ordered",options:{unique:!1},keypath:"Ordered"},{name:"PaymentTypeID",options:{unique:!1},keypath:"PaymentTypeID"},{name:"PriceBook",options:{unique:!1},keypath:"PriceBook"},{name:"PriceDiscount",options:{unique:!1},keypath:"PriceDiscount"},{name:"PriceNote",options:{unique:!1},keypath:"PriceNote"},{name:"PriceTypeID",options:{unique:!1},keypath:"PriceTypeID"},{name:"ProductID",options:{unique:!1},keypath:"ProductID"},{name:"Taxable",options:{unique:!1},keypath:"Taxable"},{name:"ThumbnailUrl",options:{unique:!1},keypath:"ThumbnailUrl"},{name:"TypeID",options:{unique:!1},keypath:"TypeID"},{name:"UOM",options:{unique:!1},keypath:"UOM"},{name:"UnitCost",options:{unique:!1},keypath:"UnitCost"},{name:"UnitExpense",options:{unique:!1},keypath:"UnitExpense"},{name:"UnitPrice",options:{unique:!1},keypath:"UnitPrice"},{name:"UnitPriceOriginal",options:{unique:!1},keypath:"UnitPriceOriginal"},{name:"UnitQuantity",options:{unique:!1},keypath:"UnitQuantity"},{name:"OnHand",options:{unique:!1},keypath:"OnHand"}]},{store:"SyncTime",storeConfig:{keyPath:"id",autoIncrement:!1},storeSchema:[{name:"time",keypath:"time",options:{unique:!0}}]},{store:"FailedOrder",storeConfig:{keyPath:"id",autoIncrement:!0},storeSchema:[{name:"Action",options:{unique:!1},keypath:"Action"},{name:"Items",options:{unique:!1},keypath:"Items"},{name:"CartItems",options:{unique:!1},keypath:"CartItems"},{name:"Invoice",options:{unique:!1},keypath:"Invoice"},{name:"Order",options:{unique:!1},keypath:"Order"},{name:"Payments",options:{unique:!1},keypath:"Payments"},{name:"Shipping",options:{unique:!1},keypath:"Shipping"}]},{store:"SuccessOrder",storeConfig:{keyPath:"id",autoIncrement:!0},storeSchema:[{name:"Number",options:{unique:!1},keypath:"Order.Number"}]}]};var k=(function(s){return s.readonly="readonly",s.readwrite="readwrite",s})(k||{}),G=new b(null),Q=new b("Indexed DB"),H=new b("Server Indexed DB");function J(s,d){return s.objectStoreNames.contains(d)}function C(s,d,e){if(!s){e("You need to use the openDatabase function to create a database before you query it!");return}J(s,d)||e(`objectStore does not exists: ${d}`)}function x(s,d){let e=s.transaction(d.storeName,d.dbMode);return e.onerror=d.error,e.onabort=d.abort,e}function q(s,d,e,n){return{storeName:d,dbMode:s,error:t=>{e(t)},abort:t=>{e(t)}}}var E=[];function g(s,d,e,n){return new Promise((t,o)=>{s||o("IndexedDB not available");let r=s.open(d,e),a;r.onsuccess=()=>{a=r.result,E.push(a),t(a)},r.onerror=()=>{o(`IndexedDB error: ${r.error}`)},typeof n=="function"&&(r.onupgradeneeded=i=>{n(i,a)})})}function O(s,d,e,n,t){return S(this,null,function*(){return new Promise((o,r)=>{if(!s)return;let a=s.open(d,e);a.onupgradeneeded=i=>S(null,null,function*(){let c=i.target.result,h=n.map(p=>S(null,null,function*(){if(!c.objectStoreNames.contains(p.store)){let l=c.createObjectStore(p.store,p.storeConfig);for(let m of p.storeSchema)l.createIndex(m.name,m.keypath,m.options)}}));yield Promise.all(h);let u=t&&t();if(u){let p=Object.keys(u).map(l=>parseInt(l,10)).filter(l=>l>i.oldVersion).sort((l,m)=>l-m);for(let l of p)u[l](c,a.transaction)}c.close(),o()}),a.onsuccess=i=>{i.target.result.close(),o()},a.onerror=i=>{r(i)}})})}function W(s,d,e){if(!s||!d||!e)throw Error('Params: "dbName", "version", "storeName" are mandatory.');return new f(n=>{try{let t=d+1,o=indexedDB.open(s,t);o.onupgradeneeded=r=>{let a=r.target.result;a.deleteObjectStore(e),a.close(),console.log("onupgradeneeded"),n.next(),n.complete()},o.onerror=r=>n.error(r)}catch(t){n.error(t)}})}function X(s){return new Promise((d,e)=>{if(!s){e(new Error("No database to close"));return}try{s.close(),d()}catch(n){e(`Error closing database: ${n}`)}})}function D(){return function(s,d,e){let n=e.value;return e.value=function(...t){let o=n.apply(this,t);return o instanceof f?o.pipe(A(()=>S(this,null,function*(){let r=E.map(a=>S(this,null,function*(){yield X(a)}));yield Promise.all(r),E.length=0}))):o},e}}var Z=(()=>{class s{constructor(e,n){this.dbConfigs=e,this.indexedDB=n,this.defaultDatabaseName=null,Object.values(this.dbConfigs).forEach((t,o,r)=>this.instanciateConfig(t,r.length===1))}instanciateConfig(e,n){return S(this,null,function*(){if(!e.name)throw new Error("NgxIndexedDB: Please, provide the dbName in the configuration");if((e.isDefault??!1)&&this.defaultDatabaseName)throw new Error("NgxIndexedDB: Only one database can be set as default");((e.isDefault??!1)&&!this.defaultDatabaseName||n)&&(this.defaultDatabaseName=e.name,this.selectedDb=e.name),yield O(this.indexedDB,e.name,e.version,e.objectStoresMeta,e.migrationFactory),g(this.indexedDB,e.name).then(t=>{t.version!==e.version&&(L()&&(console.warn(`
1
+ import{a as _}from"./chunk-C6Z4KJ2K.js";import{Ga as F,L as B,P as A,Wc as L,bb as $,c as f,ha as M,ia as K,j as y,ja as b,k as v,ka as w,la as P,oa as R,s as U,td as N,ua as V}from"./chunk-KYVLS64M.js";import{j as S}from"./chunk-KMHZKFQS.js";var ie={name:"pos-offline",version:_.pos.indexedDBVersion,objectStoresMeta:[{store:"Order",storeConfig:{keyPath:"id",autoIncrement:!0},storeSchema:[{name:"Action",options:{unique:!1},keypath:"Action"},{name:"Items",options:{unique:!1},keypath:"Items"},{name:"CartItems",options:{unique:!1},keypath:"CartItems"},{name:"Invoice",options:{unique:!1},keypath:"Invoice"},{name:"Order",options:{unique:!1},keypath:"Order"},{name:"Payments",options:{unique:!1},keypath:"Payments"},{name:"Shipping",options:{unique:!1},keypath:"Shipping"},{name:"ContactName",options:{unique:!1},keypath:"ContactName"}]},{store:"Outlet",storeConfig:{keyPath:"RegisterID",autoIncrement:!1},storeSchema:[{name:"DefaultSalesOrderTag",options:{unique:!1},keypath:"DefaultSalesOrderTag"},{name:"DefaultTaxType",options:{unique:!1},keypath:"DefaultTaxType"},{name:"DefaultWarehouse",options:{unique:!1},keypath:"DefaultWarehouse"},{name:"EntityID",options:{unique:!1},keypath:"EntityID"},{name:"EntityName",options:{unique:!1},keypath:"EntityName"},{name:"InvoiceNumberElement",options:{unique:!1},keypath:"InvoiceNumberElement"},{name:"ListSales",options:{unique:!1},keypath:"ListSales"},{name:"MemberPoint",options:{unique:!1},keypath:"MemberPoint"},{name:"NewOrderID",options:{unique:!1},keypath:"NewOrderID"},{name:"NumberElement",options:{unique:!1},keypath:"NumberElement"},{name:"ParkLayoutPack",options:{unique:!1},keypath:"ParkLayoutPack"},{name:"PrintTemplate",options:{unique:!1},keypath:"PrintTemplate"},{name:"QuickKeyPack",options:{unique:!1},keypath:"QuickKeyPack"},{name:"RegisterID",options:{unique:!1},keypath:"RegisterID"},{name:"ShippingDefault",options:{unique:!1},keypath:"ShippingDefault"}]},{store:"OutletPrice",storeConfig:{keyPath:"id",autoIncrement:!0},storeSchema:[{name:"EntityID",options:{unique:!1},keypath:"EntityID"},{name:"ExtraCost",options:{unique:!1},keypath:"ExtraCost"},{name:"PriceDiscount",options:{unique:!1},keypath:"PriceDiscount"},{name:"UnitCost",options:{unique:!1},keypath:"UnitCost"},{name:"UnitPrice",options:{unique:!1},keypath:"UnitPrice"},{name:"VariantID",options:{unique:!1},keypath:"VariantID"}]},{store:"POSStorage",storeConfig:{keyPath:"id",autoIncrement:!1},storeSchema:[{name:"AppConfigJSON",options:{unique:!1},keypath:"AppConfigJSON"},{name:"BINS",options:{unique:!1},keypath:"BINS"},{name:"Currencies",options:{unique:!1},keypath:"Currencies"},{name:"CustomerOptions",options:{unique:!1},keypath:"CustomerOptions"},{name:"Denomination",options:{unique:!1},keypath:"Denomination"},{name:"Entities",options:{unique:!1},keypath:"Entities"},{name:"PaymentTypes",options:{unique:!1},keypath:"PaymentTypes"},{name:"Payments",options:{unique:!1},keypath:"Payments"},{name:"PoTypes",options:{unique:!1},keypath:"PoTypes"},{name:"ProductCount",options:{unique:!1},keypath:"ProductCount"},{name:"Registers",options:{unique:!1},keypath:"Registers"},{name:"Restriction",options:{unique:!1},keypath:"Restriction"},{name:"Roles",options:{unique:!1},keypath:"Roles"},{name:"SalesID",options:{unique:!1},keypath:"SalesID"},{name:"ServerDateString",options:{unique:!1},keypath:"ServerDateString"},{name:"ServerTime",options:{unique:!1},keypath:"ServerTime"},{name:"Taxes",options:{unique:!1},keypath:"Taxes"},{name:"UserID",options:{unique:!1},keypath:"UserID"},{name:"UserName",options:{unique:!1},keypath:"UserName"},{name:"Version",options:{unique:!1},keypath:"Version"}]},{store:"Product",storeConfig:{keyPath:"ID",autoIncrement:!1},storeSchema:[{name:"BrandName",options:{unique:!1},keypath:"BrandName"},{name:"CategoryName",options:{unique:!1},keypath:"CategoryName"},{name:"CategoryTypeID",options:{unique:!1},keypath:"CategoryTypeID"},{name:"Code",options:{unique:!1},keypath:"Code"},{name:"Component",options:{unique:!1},keypath:"Component"},{name:"Created",options:{unique:!1},keypath:"Created"},{name:"Description",options:{unique:!1},keypath:"Description"},{name:"ExtraCost",options:{unique:!1},keypath:"ExtraCost"},{name:"ID",options:{unique:!1},keypath:"ID"},{name:"ImageUrl",options:{unique:!1},keypath:"ImageUrl"},{name:"LoyaltyPoint",options:{unique:!1},keypath:"LoyaltyPoint"},{name:"Name",options:{unique:!1},keypath:"Name"},{name:"OrderPrice",options:{unique:!1},keypath:"OrderPrice"},{name:"OrderPriceDiscount",options:{unique:!1},keypath:"OrderPriceDiscount"},{name:"Ordered",options:{unique:!1},keypath:"Ordered"},{name:"PaymentTypeID",options:{unique:!1},keypath:"PaymentTypeID"},{name:"PriceBook",options:{unique:!1},keypath:"PriceBook"},{name:"PriceDiscount",options:{unique:!1},keypath:"PriceDiscount"},{name:"PriceNote",options:{unique:!1},keypath:"PriceNote"},{name:"PriceTypeID",options:{unique:!1},keypath:"PriceTypeID"},{name:"ProductID",options:{unique:!1},keypath:"ProductID"},{name:"Taxable",options:{unique:!1},keypath:"Taxable"},{name:"ThumbnailUrl",options:{unique:!1},keypath:"ThumbnailUrl"},{name:"TypeID",options:{unique:!1},keypath:"TypeID"},{name:"UOM",options:{unique:!1},keypath:"UOM"},{name:"UnitCost",options:{unique:!1},keypath:"UnitCost"},{name:"UnitExpense",options:{unique:!1},keypath:"UnitExpense"},{name:"UnitPrice",options:{unique:!1},keypath:"UnitPrice"},{name:"UnitPriceOriginal",options:{unique:!1},keypath:"UnitPriceOriginal"},{name:"UnitQuantity",options:{unique:!1},keypath:"UnitQuantity"},{name:"OnHand",options:{unique:!1},keypath:"OnHand"}]},{store:"SyncTime",storeConfig:{keyPath:"id",autoIncrement:!1},storeSchema:[{name:"time",keypath:"time",options:{unique:!0}}]},{store:"FailedOrder",storeConfig:{keyPath:"id",autoIncrement:!0},storeSchema:[{name:"Action",options:{unique:!1},keypath:"Action"},{name:"Items",options:{unique:!1},keypath:"Items"},{name:"CartItems",options:{unique:!1},keypath:"CartItems"},{name:"Invoice",options:{unique:!1},keypath:"Invoice"},{name:"Order",options:{unique:!1},keypath:"Order"},{name:"Payments",options:{unique:!1},keypath:"Payments"},{name:"Shipping",options:{unique:!1},keypath:"Shipping"}]},{store:"SuccessOrder",storeConfig:{keyPath:"id",autoIncrement:!0},storeSchema:[{name:"Number",options:{unique:!1},keypath:"Order.Number"}]}]};var k=(function(s){return s.readonly="readonly",s.readwrite="readwrite",s})(k||{}),G=new b(null),Q=new b("Indexed DB"),H=new b("Server Indexed DB");function J(s,d){return s.objectStoreNames.contains(d)}function C(s,d,e){if(!s){e("You need to use the openDatabase function to create a database before you query it!");return}J(s,d)||e(`objectStore does not exists: ${d}`)}function x(s,d){let e=s.transaction(d.storeName,d.dbMode);return e.onerror=d.error,e.onabort=d.abort,e}function q(s,d,e,n){return{storeName:d,dbMode:s,error:t=>{e(t)},abort:t=>{e(t)}}}var E=[];function g(s,d,e,n){return new Promise((t,o)=>{s||o("IndexedDB not available");let r=s.open(d,e),a;r.onsuccess=()=>{a=r.result,E.push(a),t(a)},r.onerror=()=>{o(`IndexedDB error: ${r.error}`)},typeof n=="function"&&(r.onupgradeneeded=i=>{n(i,a)})})}function O(s,d,e,n,t){return S(this,null,function*(){return new Promise((o,r)=>{if(!s)return;let a=s.open(d,e);a.onupgradeneeded=i=>S(null,null,function*(){let c=i.target.result,h=n.map(p=>S(null,null,function*(){if(!c.objectStoreNames.contains(p.store)){let l=c.createObjectStore(p.store,p.storeConfig);for(let m of p.storeSchema)l.createIndex(m.name,m.keypath,m.options)}}));yield Promise.all(h);let u=t&&t();if(u){let p=Object.keys(u).map(l=>parseInt(l,10)).filter(l=>l>i.oldVersion).sort((l,m)=>l-m);for(let l of p)u[l](c,a.transaction)}c.close(),o()}),a.onsuccess=i=>{i.target.result.close(),o()},a.onerror=i=>{r(i)}})})}function W(s,d,e){if(!s||!d||!e)throw Error('Params: "dbName", "version", "storeName" are mandatory.');return new f(n=>{try{let t=d+1,o=indexedDB.open(s,t);o.onupgradeneeded=r=>{let a=r.target.result;a.deleteObjectStore(e),a.close(),console.log("onupgradeneeded"),n.next(),n.complete()},o.onerror=r=>n.error(r)}catch(t){n.error(t)}})}function X(s){return new Promise((d,e)=>{if(!s){e(new Error("No database to close"));return}try{s.close(),d()}catch(n){e(`Error closing database: ${n}`)}})}function D(){return function(s,d,e){let n=e.value;return e.value=function(...t){let o=n.apply(this,t);return o instanceof f?o.pipe(A(()=>S(this,null,function*(){let r=E.map(a=>S(this,null,function*(){yield X(a)}));yield Promise.all(r),E.length=0}))):o},e}}var Z=(()=>{class s{constructor(e,n){this.dbConfigs=e,this.indexedDB=n,this.defaultDatabaseName=null,Object.values(this.dbConfigs).forEach((t,o,r)=>this.instanciateConfig(t,r.length===1))}instanciateConfig(e,n){return S(this,null,function*(){if(!e.name)throw new Error("NgxIndexedDB: Please, provide the dbName in the configuration");if((e.isDefault??!1)&&this.defaultDatabaseName)throw new Error("NgxIndexedDB: Only one database can be set as default");((e.isDefault??!1)&&!this.defaultDatabaseName||n)&&(this.defaultDatabaseName=e.name,this.selectedDb=e.name),yield O(this.indexedDB,e.name,e.version,e.objectStoresMeta,e.migrationFactory),g(this.indexedDB,e.name).then(t=>{t.version!==e.version&&(L()&&(console.warn(`
2
2
  Your DB Config doesn't match the most recent version of the DB with name ${e.name}, please update it
3
3
  DB current version: ${t.version};
4
4
  Your configuration: ${e.version};
@@ -1 +1 @@
1
- import{b as P}from"./chunk-QF7JKDQT.js";import{a as D}from"./chunk-QHCR6G3R.js";import{e as f}from"./chunk-R7FZYIVK.js";import{c as d,d as I}from"./chunk-U32TNGSA.js";import{d as g}from"./chunk-PY7UTEHG.js";import{c as e}from"./chunk-ZIFDXGAA.js";import{f as y}from"./chunk-IVON2WY7.js";import{b as l}from"./chunk-ZFSMBBTC.js";import{N as M}from"./chunk-HL4M3UN2.js";import{d as C}from"./chunk-CVRHFTCA.js";import{h as b}from"./chunk-7HKIQJO2.js";import{c}from"./chunk-ZIR7IDMB.js";import{E as s}from"./chunk-TG23CQGV.js";import{q as u}from"./chunk-FWVQ6CFL.js";import{bb as a,ha as n,ia as i,la as m,sd as p}from"./chunk-KYVLS64M.js";var v=class t{http=m(u);constructor(){}getProductSuggestionByCodeName(r){let o=[{key:"Prefix",value:r},{key:"Count",value:100}];return this.http.get("/API/AC/GetProductSuggestionByCodeNName",o)}deleteImage(r){let o={ID:r};return this.http.post("/api/catalog/variant/DeleteImage",o)}updateImage(r,o){let F={ID:r,ImageURL:o};return this.http.post("/api/catalog/variant/UpdateVariantImage",F)}static \u0275fac=function(o){return new(o||t)};static \u0275prov=n({token:t,factory:t.\u0275fac,providedIn:"root"})};var T=class{ID;Code;CostCurrencyID=1;Discontinued=!1;LoyaltyPoint=!0;Model;Name;OrderPriceDiscount;PackSize=1;PaymentTypeID=0;PriceCurrencyID=1;PriceDiscount;ProductID;SalesCommission;Taxable=!0;TypeID;UOM;UnitCost;UnitPrice=0;Weight;ComponentID;UOMName;Description;UnitQuantity;ProductIndex;UOMQ;MeasurementID;Image;OrderPrice;PaymentTypeString;SellPriceTypeString;UnitExpense;UnitPriceMinimum;MaxOrderPrice;CostCurrencySymbol;VariantType};var N=class{ParentName;ParentID;Ratio},S=class{BaseUnitID;Code;ID;Model;ProductName;Ratio};var O=class t{static \u0275fac=function(o){return new(o||t)};static \u0275mod=a({type:t});static \u0275inj=i({imports:[p,s,f,l,g,b,d,P,C,I,D,e,M,e,c,y]})};export{v as a,T as b,N as c,S as d,O as e};
1
+ import{b as P}from"./chunk-QF7JKDQT.js";import{a as D}from"./chunk-QHCR6G3R.js";import{e as f}from"./chunk-R7FZYIVK.js";import{c as d,d as I}from"./chunk-U32TNGSA.js";import{d as g}from"./chunk-PY7UTEHG.js";import{c as e}from"./chunk-ZIFDXGAA.js";import{f as y}from"./chunk-MC5GFFBH.js";import{b as l}from"./chunk-ZFSMBBTC.js";import{N as M}from"./chunk-HL4M3UN2.js";import{d as C}from"./chunk-CVRHFTCA.js";import{h as b}from"./chunk-7HKIQJO2.js";import{c}from"./chunk-ZIR7IDMB.js";import{E as s}from"./chunk-TG23CQGV.js";import{q as u}from"./chunk-FWVQ6CFL.js";import{bb as a,ha as n,ia as i,la as m,sd as p}from"./chunk-KYVLS64M.js";var v=class t{http=m(u);constructor(){}getProductSuggestionByCodeName(r){let o=[{key:"Prefix",value:r},{key:"Count",value:100}];return this.http.get("/API/AC/GetProductSuggestionByCodeNName",o)}deleteImage(r){let o={ID:r};return this.http.post("/api/catalog/variant/DeleteImage",o)}updateImage(r,o){let F={ID:r,ImageURL:o};return this.http.post("/api/catalog/variant/UpdateVariantImage",F)}static \u0275fac=function(o){return new(o||t)};static \u0275prov=n({token:t,factory:t.\u0275fac,providedIn:"root"})};var T=class{ID;Code;CostCurrencyID=1;Discontinued=!1;LoyaltyPoint=!0;Model;Name;OrderPriceDiscount;PackSize=1;PaymentTypeID=0;PriceCurrencyID=1;PriceDiscount;ProductID;SalesCommission;Taxable=!0;TypeID;UOM;UnitCost;UnitPrice=0;Weight;ComponentID;UOMName;Description;UnitQuantity;ProductIndex;UOMQ;MeasurementID;Image;OrderPrice;PaymentTypeString;SellPriceTypeString;UnitExpense;UnitPriceMinimum;MaxOrderPrice;CostCurrencySymbol;VariantType};var N=class{ParentName;ParentID;Ratio},S=class{BaseUnitID;Code;ID;Model;ProductName;Ratio};var O=class t{static \u0275fac=function(o){return new(o||t)};static \u0275mod=a({type:t});static \u0275inj=i({imports:[p,s,f,l,g,b,d,P,C,I,D,e,M,e,c,y]})};export{v as a,T as b,N as c,S as d,O as e};