dealpos 25.31.2 → 25.31.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/browser/{chunk-IPTLWEIL.js → chunk-2272UHVJ.js} +1 -1
  2. package/browser/{chunk-J6RZLLDH.js → chunk-26WIZL6M.js} +1 -1
  3. package/browser/{chunk-DMSBV63C.js → chunk-2OQ5CGDZ.js} +1 -1
  4. package/browser/{chunk-JALOTTYL.js → chunk-2Y7RQ5GK.js} +1 -1
  5. package/browser/{chunk-LOHRG6CW.js → chunk-2ZRIS5SY.js} +1 -1
  6. package/browser/{chunk-XETIOXLN.js → chunk-324YW32W.js} +1 -1
  7. package/browser/{chunk-W5PF5BAF.js → chunk-3ESJIRJI.js} +1 -1
  8. package/browser/{chunk-NARPOKGG.js → chunk-3HZQ2MWE.js} +1 -1
  9. package/browser/{chunk-356IV4ZE.js → chunk-4LCG2U7W.js} +1 -1
  10. package/browser/{chunk-5233FXFY.js → chunk-4NCDQTGK.js} +1 -1
  11. package/browser/{chunk-AWUM3KMS.js → chunk-67AKWIMD.js} +1 -1
  12. package/browser/{chunk-NRY2MTXW.js → chunk-6IWEI2S7.js} +1 -1
  13. package/browser/{chunk-4GNV76N3.js → chunk-6W2MNUMT.js} +1 -1
  14. package/browser/{chunk-RVEF5C4M.js → chunk-A4WFJLPW.js} +1 -1
  15. package/browser/{chunk-MGZYE4DB.js → chunk-ACQ5WGFA.js} +1 -1
  16. package/browser/{chunk-6BSPRF7M.js → chunk-AYNFEJS7.js} +1 -1
  17. package/browser/{chunk-NCR5B5Y4.js → chunk-BNP5MTYZ.js} +2 -2
  18. package/browser/{chunk-4KJRE3GP.js → chunk-BU6O2DK4.js} +1 -1
  19. package/browser/{chunk-OBZMOT6W.js → chunk-C6XGSCT2.js} +1 -1
  20. package/browser/{chunk-L27WHOBJ.js → chunk-CC72HMXK.js} +1 -1
  21. package/browser/{chunk-ZOSMCW2A.js → chunk-CQR6IIYD.js} +1 -1
  22. package/browser/{chunk-TU4O6KBQ.js → chunk-DI72TVEV.js} +1 -1
  23. package/browser/{chunk-K4YULPNU.js → chunk-EBBLJUWQ.js} +2 -2
  24. package/browser/{chunk-SMHJ3JIG.js → chunk-FETPS43Y.js} +2 -2
  25. package/browser/{chunk-UHGOF24M.js → chunk-GYGWAZRQ.js} +1 -1
  26. package/browser/{chunk-RGM2KZ5L.js → chunk-GYU26T5D.js} +1 -1
  27. package/browser/{chunk-6HUVTRYH.js → chunk-HVMYNIC7.js} +1 -1
  28. package/browser/{chunk-2BIGSZO5.js → chunk-I3DTU2HT.js} +1 -1
  29. package/browser/{chunk-YUROCGY4.js → chunk-J7DAVGHL.js} +1 -1
  30. package/browser/{chunk-VIYE2OFI.js → chunk-JDV2UBEW.js} +1 -1
  31. package/browser/{chunk-N27F227W.js → chunk-JVBQVJGY.js} +1 -1
  32. package/browser/{chunk-LWQAPXWM.js → chunk-JVDAP5PW.js} +1 -1
  33. package/browser/{chunk-J4GCFDIV.js → chunk-KFKCXJAT.js} +1 -1
  34. package/browser/{chunk-XHBIIXPS.js → chunk-KKTDFA34.js} +1 -1
  35. package/browser/{chunk-SDGA5WRP.js → chunk-L3UTRSNX.js} +1 -1
  36. package/browser/{chunk-ZESJJFN2.js → chunk-LNQFPG7E.js} +1 -1
  37. package/browser/{chunk-4PC6PQ7Q.js → chunk-M5L4RIM5.js} +1 -1
  38. package/browser/{chunk-4TP7S3U3.js → chunk-MNFGMEQY.js} +1 -1
  39. package/browser/{chunk-SJHBFLM7.js → chunk-MZPCKRS4.js} +1 -1
  40. package/browser/{chunk-A2QB6KDW.js → chunk-NJ2M4SPG.js} +2 -2
  41. package/browser/{chunk-6EI3EXE7.js → chunk-NYXJPCQQ.js} +1 -1
  42. package/browser/{chunk-6IFNMT72.js → chunk-OUSV72N6.js} +1 -1
  43. package/browser/{chunk-YU32SBPB.js → chunk-QGOX7DS2.js} +1 -1
  44. package/browser/{chunk-Y5HNNIJE.js → chunk-QLHKMGW3.js} +1 -1
  45. package/browser/{chunk-4F5WEZVF.js → chunk-QWGD3H2A.js} +1 -1
  46. package/browser/{chunk-B7DKFLLG.js → chunk-QYHR4HH4.js} +1 -1
  47. package/browser/{chunk-CY4FO26Z.js → chunk-ROCCL6ZZ.js} +1 -1
  48. package/browser/{chunk-MAFIFJSJ.js → chunk-RUK3LROA.js} +1 -1
  49. package/browser/{chunk-74ZM5NHT.js → chunk-S376SJCF.js} +1 -1
  50. package/browser/{chunk-JK75ENMS.js → chunk-S4LIME7D.js} +1 -1
  51. package/browser/{chunk-AHKKBRLR.js → chunk-SGBQHIZU.js} +1 -1
  52. package/browser/{chunk-ZAJCD6I2.js → chunk-SV4FKYKZ.js} +1 -1
  53. package/browser/{chunk-2VRY7O77.js → chunk-SYJVFU7L.js} +1 -1
  54. package/browser/{chunk-6K77FOTH.js → chunk-TB76PPLM.js} +1 -1
  55. package/browser/{chunk-SGTPMFH6.js → chunk-TOYMRMYW.js} +1 -1
  56. package/browser/{chunk-UD4WWZOI.js → chunk-TTNKBC6N.js} +1 -1
  57. package/browser/{chunk-7MB4HURG.js → chunk-UKS3DBYD.js} +1 -1
  58. package/browser/{chunk-HIUH7JJU.js → chunk-UN3S23DX.js} +1 -1
  59. package/browser/{chunk-MLQCCNEW.js → chunk-UNSEWD4O.js} +2 -2
  60. package/browser/{chunk-EWLYV6PD.js → chunk-VK7PYTOE.js} +2 -2
  61. package/browser/{chunk-Q2ITLIW2.js → chunk-VO66LJVM.js} +1 -1
  62. package/browser/{chunk-ZSUZVVVK.js → chunk-VXJJ2WHN.js} +1 -1
  63. package/browser/{chunk-HR5WLTC4.js → chunk-WZV65ZPB.js} +1 -1
  64. package/browser/{chunk-PXKTG2K3.js → chunk-X5TDTRYL.js} +1 -1
  65. package/browser/{chunk-S2MC4OUN.js → chunk-XBVJ7UUC.js} +1 -1
  66. package/browser/{chunk-5WBNHRSF.js → chunk-XME4MZYW.js} +1 -1
  67. package/browser/{chunk-OPOZFMCV.js → chunk-XN3D4O7F.js} +1 -1
  68. package/browser/{chunk-DX2NQ3TK.js → chunk-YI6KEE7Q.js} +1 -1
  69. package/browser/index.html +2 -2
  70. package/browser/{main-2NK4AXEX.js → main-GCKOWN2G.js} +2 -2
  71. package/package.json +1 -1
@@ -1 +1 @@
1
- import{a as ae,b as oe}from"./chunk-TFCJMTMN.js";import"./chunk-7FWWTBUM.js";import"./chunk-4E6VHPVL.js";import{a as re}from"./chunk-6ICMOVBF.js";import"./chunk-5P4BOCQJ.js";import"./chunk-TQFSVWIT.js";import{d as ie,e as ne}from"./chunk-L6LENOKK.js";import"./chunk-UKGYIFR2.js";import"./chunk-JKMM7DWN.js";import"./chunk-I5NNQWTT.js";import"./chunk-3RK6DDJD.js";import"./chunk-736IGW3M.js";import"./chunk-ZMWGK26F.js";import"./chunk-DCBD5TOU.js";import"./chunk-QOFLU7G4.js";import"./chunk-GXRCWDD7.js";import{a as K}from"./chunk-SGTPMFH6.js";import"./chunk-B7DKFLLG.js";import{e as ee}from"./chunk-JVLCOYIS.js";import"./chunk-5Y3O4QKE.js";import"./chunk-VBPW7TJ3.js";import"./chunk-SZQE7PE4.js";import"./chunk-2QMJPLEB.js";import"./chunk-JZDKPV7H.js";import"./chunk-ASYK5WSN.js";import"./chunk-SRTWXKQO.js";import{a as te}from"./chunk-RZNX7JQX.js";import{a as J,h as Z,i as $}from"./chunk-6IFNMT72.js";import"./chunk-4KJRE3GP.js";import{b as X}from"./chunk-5233FXFY.js";import"./chunk-YQGBGJ5U.js";import"./chunk-XUP2FY5D.js";import"./chunk-5UTBAGIS.js";import"./chunk-JLOQTYOI.js";import{P as Y}from"./chunk-YJVLRBSS.js";import"./chunk-UM35BDBC.js";import"./chunk-GIKR6Y2K.js";import{d as Q}from"./chunk-XOSCYHF7.js";import"./chunk-B4243VJD.js";import"./chunk-7I6FDVVN.js";import"./chunk-7COMDF6M.js";import{a as z}from"./chunk-2FWFPV5I.js";import"./chunk-NEEN2JO2.js";import{D as U,h as j,o as G}from"./chunk-LNLGRZBB.js";import"./chunk-DMSBV63C.js";import"./chunk-MAFIFJSJ.js";import"./chunk-MP62IGYR.js";import"./chunk-J6RZLLDH.js";import{$a as c,Db as A,Dc as O,Eb as E,Gb as V,Hb as W,Ib as n,Jb as a,Kb as S,Lb as D,Mb as v,Ob as T,Qb as y,Rb as s,Td as H,Wd as q,Xc as L,Y as k,ad as N,db as h,ec as u,fa as I,hd as R,jc as g,kb as P,kc as _,lc as f,na as B,ob as M,qb as C,va as p,vb as l,wa as m,xc as b,yc as x}from"./chunk-EDB2BAIG.js";import"./chunk-7DCB7DB2.js";function pe(o,d){if(o&1){let t=T();n(0,"button",7),y("click",function(){p(t);let e=s();return m(e.onPrint())}),S(1,"i",8),n(2,"span"),u(3,"Print"),a()()}}function me(o,d){if(o&1){let t=T();n(0,"div",9)(1,"h6"),u(2,"Outlet"),a(),n(3,"outlet-selector",10),f("ngModelChange",function(e){p(t);let i=s();return _(i.pageData.Filter.EntityID,e)||(i.pageData.Filter.EntityID=e),m(e)}),a(),n(4,"h6"),u(5,"Sales Order Tag"),a(),n(6,"ng-select",11),f("ngModelChange",function(e){p(t);let i=s();return _(i.pageData.Filter.SalesOrderTagID,e)||(i.pageData.Filter.SalesOrderTagID=e),m(e)}),a(),n(7,"h6"),u(8,"From"),a(),n(9,"div",12)(10,"div",13)(11,"datepicker",14),f("dateChange",function(e){p(t);let i=s();return _(i.pageData.Filter.From,e)||(i.pageData.Filter.From=e),m(e)}),a()(),n(12,"div",13)(13,"app-timepicker",15),f("timeChange",function(e){p(t);let i=s();return _(i.pageData.Filter.StartTime,e)||(i.pageData.Filter.StartTime=e),m(e)}),a()()(),n(14,"h6"),u(15,"To"),a(),n(16,"div",12)(17,"div",13)(18,"datepicker",16),f("dateChange",function(e){p(t);let i=s();return _(i.pageData.Filter.To,e)||(i.pageData.Filter.To=e),m(e)}),a()(),n(19,"div",13)(20,"app-timepicker",15),f("timeChange",function(e){p(t);let i=s();return _(i.pageData.Filter.EndTime,e)||(i.pageData.Filter.EndTime=e),m(e)}),a()()()()}if(o&2){let t=s();c(3),l("accessType",2),g("ngModel",t.pageData.Filter.EntityID),c(3),l("items",t.pageData==null||t.pageData.Options==null?null:t.pageData.Options.SalesOrderTags),g("ngModel",t.pageData.Filter.SalesOrderTagID),c(5),l("isFloatingLabel",!1),g("date",t.pageData.Filter.From),l("hidelClearBtn",!0),c(2),g("time",t.pageData.Filter.StartTime),l("fullWidth",!0),c(5),l("isFloatingLabel",!1)("hidelClearBtn",!0),g("date",t.pageData.Filter.To),c(2),g("time",t.pageData.Filter.EndTime),l("fullWidth",!0)}}function ce(o,d){o&1&&(D(0),n(1,"div",20),u(2,"\xA0"),a(),v())}function se(o,d){if(o&1&&(S(0,"pos-receipt-a4",17),n(1,"div",18),S(2,"div",19),a(),C(3,ce,3,0,"ng-container",6)),o&2){let t=d.$implicit,r=d.$index,e=s().ngIf,i=s();l("data",t)("printTemplate",i.printTemplates==null?null:i.printTemplates.get(t.PrintTemplateID))("config",e.AppConfig)("workOrderMode",!1)("fullMode",!0)("stylesheet",e.StylesSheet),c(3),l("ngIf",r!==(e.Data==null?null:e.Data.length)-1)}}function de(o,d){if(o&1&&(D(0),V(1,se,4,7,null,null,E),v()),o&2){let t=d.ngIf;c(),W(t.Data)}}var le=class o extends K{constructor(t,r,e){super(t,r,"Tool/GetBulkPrintLoader","Tool/GetBulkPrintLoader",e,null,!0);this.httpService=r}dialogFilter=B(J);receipts$;printTemplates;preInitList(){this.pageData.Filter.From=new Date,this.pageData.Filter.To=new Date,this.pageData.Filter.StartTime="00:00",this.pageData.Filter.EndTime="23:59"}onFilter(){this.receipts$=this.httpService.post(Y.GetBulkPrintA4,this.pageData.Filter).pipe(I(t=>{t?.Data?.length==0?this.toastrService.info("There are no transaction",z.Info):this.generatePrintTemplate(t.PrintTemplates)}),k(1))}generatePrintTemplate(t=[]){this.printTemplates=new Map(t.map(r=>[r.ID,r]))}onNewPrint(){this.dialogFilter.openDialog()}onPrint(){window.setTimeout(function(){window.print()},500)}static \u0275fac=function(r){return new(r||o)(h(X),h(q),h(H))};static \u0275cmp=P({type:o,selectors:[["bulk-invoice-A4"]],features:[M],decls:13,vars:10,consts:[["pageFilterTemplate",""],[3,"textChange","onSubmit","pageData","hideSearchBox","text","hideSearchDropdown"],[1,"btn","btn-outline-secondary","me-3"],[1,"btn","btn-success",3,"click"],["filters",""],[1,"container-fluid","mt-5"],[4,"ngIf"],[1,"btn","btn-outline-secondary","me-3",3,"click"],[1,"fa","fa-print","me-3"],[1,"dialog-filter"],["placeholder","Choose an Outlet",3,"ngModelChange","accessType","ngModel"],["bindLabel","Name","bindValue","ID","placeholder","Choose Sales Order Tag",3,"ngModelChange","items","ngModel"],[1,"d-flex","align-items-center","gap-5"],[1,"w-100"],["placeholder","From","appearance","outline","name","From",1,"me-4",3,"dateChange","isFloatingLabel","date","hidelClearBtn"],[3,"timeChange","time","fullWidth"],["placeholder","To","appearance","outline","name","To",1,"me-4",3,"dateChange","isFloatingLabel","hidelClearBtn","date"],[3,"data","printTemplate","config","workOrderMode","fullMode","stylesheet"],[1,"d-print-none","mt-8"],[2,"border-top-style","dotted","margin-bottom","5px"],[1,"page-break"]],template:function(r,e){if(r&1){let i=T();n(0,"mainpanel-cmp",1),f("textChange",function(w){return p(i),_(e.pageData.Filter.Number,w)||(e.pageData.Filter.Number=w),m(w)}),y("onSubmit",function(){return p(i),m(e.onFilter())}),n(1,"actions"),C(2,pe,4,0,"button",2),b(3,"async"),n(4,"button",3),y("click",function(){return p(i),m(e.onNewPrint())}),u(5,"New"),a()(),n(6,"div",4),C(7,me,21,14,"ng-template",null,0,O),a(),n(9,"content")(10,"div",5),C(11,de,3,0,"ng-container",6),b(12,"async"),a()()()}if(r&2){let i;l("pageData",e.menuData)("hideSearchBox",!0),g("text",e.pageData.Filter.Number),l("hideSearchDropdown",!0),c(2),A(((i=x(3,6,e.receipts$))==null||i.Data==null?null:i.Data.length)>0?2:-1),c(9),l("ngIf",x(12,8,e.printTemplates&&e.receipts$))}},dependencies:[R,L,N,oe,ae,$,Z,te,Q,ne,ie,ee,U,j,G,re],styles:["input.p-inputtext{height:46.63px;border-color:#0000001f!important} input.p-inputtext :hover{border-color:#0000001f!important}@media print{.page-break[_ngcontent-%COMP%]{page-break-after:always}}"]})};export{le as BulkInvoiceA4Component};
1
+ import{a as ae,b as oe}from"./chunk-TFCJMTMN.js";import"./chunk-7FWWTBUM.js";import"./chunk-4E6VHPVL.js";import{a as re}from"./chunk-6ICMOVBF.js";import"./chunk-5P4BOCQJ.js";import"./chunk-TQFSVWIT.js";import{d as ie,e as ne}from"./chunk-L6LENOKK.js";import"./chunk-UKGYIFR2.js";import"./chunk-JKMM7DWN.js";import"./chunk-I5NNQWTT.js";import"./chunk-3RK6DDJD.js";import"./chunk-736IGW3M.js";import"./chunk-ZMWGK26F.js";import"./chunk-DCBD5TOU.js";import"./chunk-QOFLU7G4.js";import"./chunk-GXRCWDD7.js";import{a as K}from"./chunk-TOYMRMYW.js";import"./chunk-QYHR4HH4.js";import{e as ee}from"./chunk-JVLCOYIS.js";import"./chunk-5Y3O4QKE.js";import"./chunk-VBPW7TJ3.js";import"./chunk-SZQE7PE4.js";import"./chunk-2QMJPLEB.js";import"./chunk-JZDKPV7H.js";import"./chunk-ASYK5WSN.js";import"./chunk-SRTWXKQO.js";import{a as te}from"./chunk-RZNX7JQX.js";import{a as J,h as Z,i as $}from"./chunk-OUSV72N6.js";import"./chunk-BU6O2DK4.js";import{b as X}from"./chunk-4NCDQTGK.js";import"./chunk-YQGBGJ5U.js";import"./chunk-XUP2FY5D.js";import"./chunk-5UTBAGIS.js";import"./chunk-JLOQTYOI.js";import{P as Y}from"./chunk-YJVLRBSS.js";import"./chunk-UM35BDBC.js";import"./chunk-GIKR6Y2K.js";import{d as Q}from"./chunk-XOSCYHF7.js";import"./chunk-B4243VJD.js";import"./chunk-7I6FDVVN.js";import"./chunk-7COMDF6M.js";import{a as z}from"./chunk-2FWFPV5I.js";import"./chunk-NEEN2JO2.js";import{D as U,h as j,o as G}from"./chunk-LNLGRZBB.js";import"./chunk-2OQ5CGDZ.js";import"./chunk-RUK3LROA.js";import"./chunk-MP62IGYR.js";import"./chunk-26WIZL6M.js";import{$a as c,Db as A,Dc as O,Eb as E,Gb as V,Hb as W,Ib as n,Jb as a,Kb as S,Lb as D,Mb as v,Ob as T,Qb as y,Rb as s,Td as H,Wd as q,Xc as L,Y as k,ad as N,db as h,ec as u,fa as I,hd as R,jc as g,kb as P,kc as _,lc as f,na as B,ob as M,qb as C,va as p,vb as l,wa as m,xc as b,yc as x}from"./chunk-EDB2BAIG.js";import"./chunk-7DCB7DB2.js";function pe(o,d){if(o&1){let t=T();n(0,"button",7),y("click",function(){p(t);let e=s();return m(e.onPrint())}),S(1,"i",8),n(2,"span"),u(3,"Print"),a()()}}function me(o,d){if(o&1){let t=T();n(0,"div",9)(1,"h6"),u(2,"Outlet"),a(),n(3,"outlet-selector",10),f("ngModelChange",function(e){p(t);let i=s();return _(i.pageData.Filter.EntityID,e)||(i.pageData.Filter.EntityID=e),m(e)}),a(),n(4,"h6"),u(5,"Sales Order Tag"),a(),n(6,"ng-select",11),f("ngModelChange",function(e){p(t);let i=s();return _(i.pageData.Filter.SalesOrderTagID,e)||(i.pageData.Filter.SalesOrderTagID=e),m(e)}),a(),n(7,"h6"),u(8,"From"),a(),n(9,"div",12)(10,"div",13)(11,"datepicker",14),f("dateChange",function(e){p(t);let i=s();return _(i.pageData.Filter.From,e)||(i.pageData.Filter.From=e),m(e)}),a()(),n(12,"div",13)(13,"app-timepicker",15),f("timeChange",function(e){p(t);let i=s();return _(i.pageData.Filter.StartTime,e)||(i.pageData.Filter.StartTime=e),m(e)}),a()()(),n(14,"h6"),u(15,"To"),a(),n(16,"div",12)(17,"div",13)(18,"datepicker",16),f("dateChange",function(e){p(t);let i=s();return _(i.pageData.Filter.To,e)||(i.pageData.Filter.To=e),m(e)}),a()(),n(19,"div",13)(20,"app-timepicker",15),f("timeChange",function(e){p(t);let i=s();return _(i.pageData.Filter.EndTime,e)||(i.pageData.Filter.EndTime=e),m(e)}),a()()()()}if(o&2){let t=s();c(3),l("accessType",2),g("ngModel",t.pageData.Filter.EntityID),c(3),l("items",t.pageData==null||t.pageData.Options==null?null:t.pageData.Options.SalesOrderTags),g("ngModel",t.pageData.Filter.SalesOrderTagID),c(5),l("isFloatingLabel",!1),g("date",t.pageData.Filter.From),l("hidelClearBtn",!0),c(2),g("time",t.pageData.Filter.StartTime),l("fullWidth",!0),c(5),l("isFloatingLabel",!1)("hidelClearBtn",!0),g("date",t.pageData.Filter.To),c(2),g("time",t.pageData.Filter.EndTime),l("fullWidth",!0)}}function ce(o,d){o&1&&(D(0),n(1,"div",20),u(2,"\xA0"),a(),v())}function se(o,d){if(o&1&&(S(0,"pos-receipt-a4",17),n(1,"div",18),S(2,"div",19),a(),C(3,ce,3,0,"ng-container",6)),o&2){let t=d.$implicit,r=d.$index,e=s().ngIf,i=s();l("data",t)("printTemplate",i.printTemplates==null?null:i.printTemplates.get(t.PrintTemplateID))("config",e.AppConfig)("workOrderMode",!1)("fullMode",!0)("stylesheet",e.StylesSheet),c(3),l("ngIf",r!==(e.Data==null?null:e.Data.length)-1)}}function de(o,d){if(o&1&&(D(0),V(1,se,4,7,null,null,E),v()),o&2){let t=d.ngIf;c(),W(t.Data)}}var le=class o extends K{constructor(t,r,e){super(t,r,"Tool/GetBulkPrintLoader","Tool/GetBulkPrintLoader",e,null,!0);this.httpService=r}dialogFilter=B(J);receipts$;printTemplates;preInitList(){this.pageData.Filter.From=new Date,this.pageData.Filter.To=new Date,this.pageData.Filter.StartTime="00:00",this.pageData.Filter.EndTime="23:59"}onFilter(){this.receipts$=this.httpService.post(Y.GetBulkPrintA4,this.pageData.Filter).pipe(I(t=>{t?.Data?.length==0?this.toastrService.info("There are no transaction",z.Info):this.generatePrintTemplate(t.PrintTemplates)}),k(1))}generatePrintTemplate(t=[]){this.printTemplates=new Map(t.map(r=>[r.ID,r]))}onNewPrint(){this.dialogFilter.openDialog()}onPrint(){window.setTimeout(function(){window.print()},500)}static \u0275fac=function(r){return new(r||o)(h(X),h(q),h(H))};static \u0275cmp=P({type:o,selectors:[["bulk-invoice-A4"]],features:[M],decls:13,vars:10,consts:[["pageFilterTemplate",""],[3,"textChange","onSubmit","pageData","hideSearchBox","text","hideSearchDropdown"],[1,"btn","btn-outline-secondary","me-3"],[1,"btn","btn-success",3,"click"],["filters",""],[1,"container-fluid","mt-5"],[4,"ngIf"],[1,"btn","btn-outline-secondary","me-3",3,"click"],[1,"fa","fa-print","me-3"],[1,"dialog-filter"],["placeholder","Choose an Outlet",3,"ngModelChange","accessType","ngModel"],["bindLabel","Name","bindValue","ID","placeholder","Choose Sales Order Tag",3,"ngModelChange","items","ngModel"],[1,"d-flex","align-items-center","gap-5"],[1,"w-100"],["placeholder","From","appearance","outline","name","From",1,"me-4",3,"dateChange","isFloatingLabel","date","hidelClearBtn"],[3,"timeChange","time","fullWidth"],["placeholder","To","appearance","outline","name","To",1,"me-4",3,"dateChange","isFloatingLabel","hidelClearBtn","date"],[3,"data","printTemplate","config","workOrderMode","fullMode","stylesheet"],[1,"d-print-none","mt-8"],[2,"border-top-style","dotted","margin-bottom","5px"],[1,"page-break"]],template:function(r,e){if(r&1){let i=T();n(0,"mainpanel-cmp",1),f("textChange",function(w){return p(i),_(e.pageData.Filter.Number,w)||(e.pageData.Filter.Number=w),m(w)}),y("onSubmit",function(){return p(i),m(e.onFilter())}),n(1,"actions"),C(2,pe,4,0,"button",2),b(3,"async"),n(4,"button",3),y("click",function(){return p(i),m(e.onNewPrint())}),u(5,"New"),a()(),n(6,"div",4),C(7,me,21,14,"ng-template",null,0,O),a(),n(9,"content")(10,"div",5),C(11,de,3,0,"ng-container",6),b(12,"async"),a()()()}if(r&2){let i;l("pageData",e.menuData)("hideSearchBox",!0),g("text",e.pageData.Filter.Number),l("hideSearchDropdown",!0),c(2),A(((i=x(3,6,e.receipts$))==null||i.Data==null?null:i.Data.length)>0?2:-1),c(9),l("ngIf",x(12,8,e.printTemplates&&e.receipts$))}},dependencies:[R,L,N,oe,ae,$,Z,te,Q,ne,ie,ee,U,j,G,re],styles:["input.p-inputtext{height:46.63px;border-color:#0000001f!important} input.p-inputtext :hover{border-color:#0000001f!important}@media print{.page-break[_ngcontent-%COMP%]{page-break-after:always}}"]})};export{le as BulkInvoiceA4Component};
@@ -1,4 +1,4 @@
1
- import{a as mo}from"./chunk-TK5H65DN.js";import{a as gi,b as Ht}from"./chunk-F6GAPEFT.js";import{a as fi}from"./chunk-6L6CIH5M.js";import{a as Po}from"./chunk-NENKJMEE.js";import{e as fo}from"./chunk-YJ6B4M6K.js";import{b as _o}from"./chunk-XHQEBHKJ.js";import{d as vo}from"./chunk-XZP4NVQ2.js";import{a as Co}from"./chunk-7FWWTBUM.js";import{a as po}from"./chunk-QZL2N7RS.js";import{a as me,b as xe,e as So}from"./chunk-GJBRFK6B.js";import{a as lo,b as yo,c as bo}from"./chunk-NZ5FHQC2.js";import{a as co}from"./chunk-QIFUG6DJ.js";import{a as Do}from"./chunk-DZEEABI4.js";import{b as pn,c as so}from"./chunk-LPQK2QMJ.js";import{b as ro}from"./chunk-SOEYA75P.js";import{a as $n}from"./chunk-63P7EQO4.js";import{a as St,b as hi,c as Ci,d as vi}from"./chunk-YE5MVXZP.js";import{a as uo}from"./chunk-AVTNS5RR.js";import{b as go}from"./chunk-EDVO723W.js";import{g as ao}from"./chunk-QHABVTRX.js";import{a as ho}from"./chunk-4E6VHPVL.js";import{a as Oo}from"./chunk-FCHZ7VUL.js";import{a as $e}from"./chunk-3PXI2XBC.js";import{a as ui,b as Me}from"./chunk-EI4HJP6K.js";import{a as cn,b as Lt,c as mn}from"./chunk-KVJLJDFI.js";import{d as di}from"./chunk-L6LENOKK.js";import{p as zn}from"./chunk-ZMWGK26F.js";import{d as Jn}from"./chunk-QOFLU7G4.js";import{a as tt,b as st,c as we}from"./chunk-HT35KHLT.js";import{h as Yn}from"./chunk-SRTWXKQO.js";import{a as Zn,b as yt}from"./chunk-5P2LSOX6.js";import{C as K,D as Z,E as _t,J as no,K as X,L as ve,O as oo,u as Y,v as ce,w as De}from"./chunk-5UTBAGIS.js";import{ga as ci,ha as Ft}from"./chunk-JLOQTYOI.js";import{G as bt,O as pi,P as Q,g as Xn,n as mi,o as eo,q as to,u as io}from"./chunk-YJVLRBSS.js";import{a as et}from"./chunk-UM35BDBC.js";import{a as Vn,c as Fn}from"./chunk-GIKR6Y2K.js";import{d as vt,e as Kn}from"./chunk-XOSCYHF7.js";import{a as _e,b as qn}from"./chunk-B4243VJD.js";import{a as se}from"./chunk-2FWFPV5I.js";import{D as si,c as Se,e as ai,h as Ce,i as Ln,k as Hn,l as ze,n as Bn,o as Pe,p as jn,s as Ct,v as Qn,w as Un,y as Wn,z as Gn}from"./chunk-LNLGRZBB.js";import{a as h,d as li}from"./chunk-MP62IGYR.js";import{a as kn}from"./chunk-J6RZLLDH.js";import{$ as Zt,$a as l,$b as Vt,$c as Tn,Ac as ht,Db as E,Dc as be,E as re,Eb as ut,Gb as gt,Hb as ft,I as Ze,Ia as ei,Ib as a,Ja as ln,Jb as s,Kb as _,Lb as B,M as pt,Ma as ne,Mb as j,N as He,Nb as oi,Nc as Ge,Ob as x,Od as Rn,Pd as Nn,Q as Ae,Qb as b,Rb as d,Rd as An,Td as H,Uc as Ve,Va as We,Wa as dt,Wc as he,Wd as Oe,Xa as Sn,Xc as oe,Y as ke,Yc as Mn,Zb as At,Zc as xn,_b as kt,_c as In,aa as z,ad as qe,b as zt,cd as Xe,d as Ne,da as ye,db as S,dc as U,e as fe,ec as m,ed as J,fa as ae,fc as D,gc as P,hc as ri,hd as le,ib as ti,ic as On,ja as I,jc as k,k as ct,ka as Xt,kb as R,kc as N,lb as ii,lc as V,ma as g,n as yn,na as w,o as Ee,p as mt,pc as F,q as Yt,qb as f,qc as Be,r as Kt,rd as En,sc as Dn,t as q,u as Ue,ub as Pn,v as bn,va as C,vb as p,vd as wn,wa as v,xc as y,yc as M,zb as ni,zc as te}from"./chunk-EDB2BAIG.js";import{a as _n,h as Ke}from"./chunk-7DCB7DB2.js";var it=class{constructor(e){this.roleService=e;e&&this.setRole()}_Retrieve;_DateEditor;_NumberEditor;_PriceVisible;_UnitPriceEditor;_PricebookSelector;_Cost;_Return;_Discount;_SalesPerson;_PriceMinimum;_Payment;_CreditSalesLock;_CustomerInputLock;_PaymentCodeLock;_Shipping;_Tax;_DeleteItem;_BundlingPrice;_EmailRestriction;_ParkedDeletionAuthorized;_SellEditor;_ContactCreate;_PrepaidPackageCreate;_Order;_Reprint;_Contacts;_ContactsCreate;_InventoryView;_DebtView;_ClearCart;_SellDelete;_DeliveryEditor;_CouponInputLock;_Park;_Commission;setRole(){this._Retrieve=this.roleService.sell.RetrieveR,this._DateEditor=this.roleService.global.Date,this._NumberEditor=this.roleService.sell.Number,this._PriceVisible=this.roleService.sell.PriceVisible,this._SalesPerson=this.roleService.sell.SalesPerson,this._UnitPriceEditor=this.roleService.sell.UnitPriceEditor,this._PricebookSelector=this.roleService.sell.PricebookSelector,this._Cost=this.roleService.product.Cost,this._Return=this.roleService.sell.Return,this._Discount=this.roleService.sell.Discount,this._PriceMinimum=this.roleService.sell.PriceMinimum,this._Payment=this.roleService.sell.Payment,this._CreditSalesLock=this.roleService.sell.CreditSalesLock,this._CustomerInputLock=this.roleService.sell.CustomerInputLock,this._PaymentCodeLock=this.roleService.sell.PaymentCodeLock,this._Shipping=this.roleService.sell.Shipping,this._Tax=this.roleService.sell.Tax,this._DeleteItem=this.roleService.sell.DeleteItem,this._BundlingPrice=this.roleService.sell.BundlingPrice,this._EmailRestriction=this.roleService.sell.Email,this._SellEditor=this.roleService.sell.Edit,this._ContactCreate=this.roleService.contact.Create,this._PrepaidPackageCreate=this.roleService.prepaidPackage.Create,this._Order=this.roleService.order.View,this._Contacts=this.roleService.contact.View,this._ContactsCreate=this.roleService.contact.Create,this._InventoryView=this.roleService.inventory.View,this._DebtView=this.roleService.debt.View,this._ClearCart=this.roleService.sell.DeleteItem,this._SellDelete=this.roleService.sell.Delete,this._DeliveryEditor=this.roleService.logistic.Edit,this._Reprint=this.roleService.order.Print,this._CouponInputLock=this.roleService.sell.CouponInputLock,this._Park=this.roleService.sell.Park,this._Commission=this.roleService.product.CommissionView}get Park(){return this._Park}get CouponInputLock(){return this._CouponInputLock}set CouponInputLock(e){this._CouponInputLock=e}get Retrieve(){return this._Retrieve}get DateEditor(){return this._DateEditor}set DateEditor(e){this._DateEditor=e}get NumberEditor(){return this._NumberEditor}set NumberEditor(e){this._NumberEditor=e}get PriceVisible(){return this._PriceVisible}get UnitPriceEditor(){return this._UnitPriceEditor}set UnitPriceEditor(e){this._UnitPriceEditor=e}get PricebookSelector(){return this._PricebookSelector}set PricebookSelector(e){this._PricebookSelector=e}get Cost(){return this._Cost}get Return(){return this._Return}set Return(e){this._Return=e}get Discount(){return this._Discount}set Discount(e){this._Discount=e}get SalesPerson(){return this._SalesPerson}get PriceMinimum(){return this._PriceMinimum}get Payment(){return this._Payment}get CreditSalesLock(){return this._CreditSalesLock}get CustomerInputLock(){return this._CustomerInputLock}get PaymentCodeLock(){return this._PaymentCodeLock}get Shipping(){return this._Shipping}get Tax(){return this._Tax}set Tax(e){this._Tax=e}get DeleteItem(){return this._DeleteItem}get BundlingPrice(){return this._BundlingPrice}get Email(){return this._EmailRestriction}get ParkedDeletionAuthorized(){return this._ParkedDeletionAuthorized}set ParkedDeletionAuthorized(e){this._ParkedDeletionAuthorized=e}get SellEditor(){return this._SellEditor}get PrepaidPackageCreate(){return this._PrepaidPackageCreate}get Order(){return this._Order}get Reprint(){return this._Reprint}get Contacts(){return this._Contacts}get ContactsCreate(){return this._ContactsCreate}get InventoryView(){return this._InventoryView}get DebtView(){return this._DebtView}get ClearCartRestriction(){return this._ClearCart}get SellDelete(){return this._SellDelete}get DeliveryEditor(){return this._DeliveryEditor}get Commission(){return this._Commission}};var Bt=class{DeliveryEntityID;Type;NewOrderID;constructor(){this.DeliveryEntityID="",this.Type=3}};var G=class{Order;Invoice;Shipping;Action;Payments;Items;CartItems;ContactName;SplitParkLabel;get cartQuantity(){let e=0;for(let t of this.CartItems)e+=t.Quantity;return e}constructor(){this.Order=new pn,this.Invoice=new Lt,this.Shipping=new mn,this.Action=new Bt,this.Payments=Array(),this.Items=Array(),this.CartItems=Array(),this.ContactName=""}get TotalPaidAmount(){let e=0;return this.Payments.forEach(t=>{e+=t.PaidAmount}),e}get RedeemableAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID!=1);return this.GetAmountByCart(e)}get TotalQuantity(){let e=0;return this.CartItems.forEach(t=>{t.PromotionGift||(e+=t.Quantity)}),e}get CashOnlyAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID==1);return this.GetAmountByCart(e)}get PointOnlyAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID==2);return this.GetAmountByCart(e)}get PrepaidPackageItem(){return this.CartItems.filter(t=>t.Variant.TypeID==10)}GetAmountByCart(e){let t=0;return e.forEach(i=>{t+=i.Total}),t=t*(100-this.Order.Discount)/100,t=t*(100-this.Order.Discount2)/100,t}getRewards(){return this.CartItems.filter(t=>t.PromotionGift)}};Ke([tt(()=>pn)],G.prototype,"Order",2),Ke([tt(()=>Lt)],G.prototype,"Invoice",2),Ke([tt(()=>mn)],G.prototype,"Shipping",2),Ke([tt(()=>Bt)],G.prototype,"Action",2),Ke([tt(()=>$e)],G.prototype,"Payments",2),Ke([tt(()=>ui)],G.prototype,"Items",2),Ke([tt(()=>Me)],G.prototype,"CartItems",2);var _i=class{Success;Message;message;ObjectID;SalesOrderID;OutDeliveryID;Contact;LoyaltyPoint;InvoiceNumber;Creator;OrderTimeString;PrintMode;PaymentStateID;PaymentStateLabel;Final;constructor(){this.Success=!0,this.Message="",this.ObjectID="",this.SalesOrderID="",this.OutDeliveryID="",this.Contact=null,this.LoyaltyPoint="",this.InvoiceNumber="",this.Creator="",this.OrderTimeString="",this.PrintMode=0,this.PaymentStateID=0,this.PaymentStateLabel="",this.Final=0}};var Pt=class o{constructor(e,t,i,n){this.httpService=e;this._localDataService=t;this._onlineStatusService=i;this._toastrService=n;this._onlineStatusService.getOnlineStatus$().subscribe(r=>{this.isOnline=r})}_Data=new fe(null);Data$=this._Data.pipe(Ae(),re(e=>e!==null));isOnline;get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}getSalesOrderPrint(e){return this.httpService.post("/API/POS/GetSalesOrderPrint",{TemplateID:e})}submitOrder(e,t){let i=this.generatePOSDataForSubmission(e,this.isOnline);if(this.isOnline)return this.submitOnline(i).pipe(this.handleTimeOutError(i));if(t.ModuleSell.EnableOfflineTransaction)return this._localDataService.syncOrder(i).pipe(q(()=>this.generateCompleteData(i)));this._toastrService.warning("Offline order is not Supported!","Info!")}uploadOfflineOrder(e){return this._localDataService.uploadSingleOrder(e).pipe(Ze(t=>t?.message?.includes("objectStore does not exists")?this.submitOnline(e):mt(()=>t)))}submitOnline(e){return this.httpService.post(Q.SubmitOrder,e,kn.pos.submitOrderTimeout)}handleTimeOutError(e){return zt(Ze(t=>{if(t instanceof Kt||t?.name=="TimeoutError"){let i=this.generateCompleteData(e);this.pushNewValue(i)}throw t}))}generatePOSDataForSubmission(e,t=!0){let i=Object.assign(new G,e);i.Items=[],i.Order.CustomerID==null&&(i.Order.CustomerID=h.GuidEmpty),i.Order.SalesID==null&&(i.Order.SalesID=h.GuidEmpty);let n=1;i.Payments=i.Payments.map(c=>(c.Date=i.Order.Date,c.Index=n,n++,delete c.TypeID,c));let r=1;for(let c of i.CartItems){let u=new ui;u.ID=c.ID,u.VariantID=c.VariantID,u.Quantity=c.Quantity,u.Cost=c.Cost,u.Price=c.Price,u.Discount=c.Discount,u.DiscountAmount=c.DiscountAmount,u.Note=c.Note,u.Taxable=c.Variant.Taxable,u.LoyaltyPoint=c.LoyaltyPoint,u.UnitCost=c.Cost,u.UnitPrice=c.Price,u.UnitPriceOriginal=c.UnitPriceOriginal,u.UnitExpense=c.UnitExpense,u.EntityID=c.EntityID,u.Index=r,u.UnitQuantity=c.UnitQuantity,u.PriceTypeID=c.PriceTypeID,u.PriceNote=c.PriceNote,u.Splited=c.SplitQuantity>0,u.SplitQuantity=c.SplitQuantity,u.InventoryTypeID=c.Variant.TypeID,u.SalesID="",u.Serial=c.Serial,c.SalesID&&(u.SalesID=c.SalesID),delete c.CouponDiscount,i.Items.push(u),r++}return t?(delete i.CartItems,delete i.Order.ClientTimestamp):i.Order.ClientTimestamp=new Date,i}generateCompleteData(e){let t=new _i;return t.InvoiceNumber=e.Order.Number,t.OrderTimeString=new Date().toString(),t.PaymentStateID=e.Action?.Type,t.PaymentStateLabel="Offline",t.Success=!0,t.OutDeliveryID=e.Action.DeliveryEntityID,t}GetReturnInvoice(e,t){return this.httpService.get(Q.ReturInvoice,[{key:"EntityID",value:t},{key:"Number",value:e}])}GetInvoiceBySoID(e){return this.httpService.get(Q.GetPOSDataByID,[{key:"ID",value:e}])}UploadCSV(e,t){let i={CartItems:e,EntityID:t};return this.httpService.post(Q.UploadCsv,i)}sendEmail(e,t){return new Promise((i,n)=>{this._localDataService.isProductFromServer().subscribe(r=>{if(r){let c={invoiceID:t,email:e};this.httpService.post(Q.SendInvoiceEmail,c).subscribe({next:u=>{i(u)},error:u=>{n(u)}})}else n(X.wrongOfflineAction)})})}sendWhatsaap(e,t){let i={InvoiceID:e,PhoneNumber:t};return this.httpService.post(Q.SendInvoiceWhatsapp,i)}createCustomerByInvoice(e,t){let i={InvoiceID:e,Mobile:t};return this.httpService.post(Q.CreateCustomerInvoice,i)}saveCommission(e,t){let i={SOID:e,commission:t};return this.httpService.POSText("/API/Transaction/SetCommission",i)}generateReceiptA4(e){let t={ID:e};return this.httpService.post(Q.InvoiceA4,t)}getVacant(e){return this.httpService.get(Q.GetVacant,[{key:"EntityID",value:e}])}static \u0275fac=function(t){return new(t||o)(g(Oe),g(ve),g(me),g(H))};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};var $=class o{constructor(e,t,i){this._localDataService=e;this._onlineStatusService=t;this._httpService=i;this._onlineStatusService.getOnlineStatus$().subscribe(n=>{this.isOnline=n})}_Data=new fe(null);Data$=this._Data.asObservable().pipe(re(e=>e!==null),Ae());isOnline;get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}requestObservable(){return this.isOnline?this._httpService.get(Q.GetPOSStorage).pipe(q(e=>({data:e,type:"Online"}))):this._localDataService.getPOSStorage().pipe(re(e=>e!=null),q(e=>({data:e,type:"Offline"})))}getOutletName(e){return this.Data.Entities.find(i=>i.ID==e)?.Name}static \u0275fac=function(t){return new(t||o)(g(ve),g(me),g(Oe))};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};var Le=class o{constructor(e){this.roleService=e;this.pushNewValue(new it(e))}_Data=new fe(new it(null));get Data(){return this._Data.value}Data$=this._Data.asObservable();pushNewValue(e){this._Data.next(e)}static \u0275fac=function(t){return new(t||o)(g(li))};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};var Wt=class{ID;Code;EntityID;Name;Description;Start;StartDisplay;State;Open;CashierID;OpeningCash;EntityName;LoginID;Active;CustomerDisplayEnabled;OvoConfigurationID;CustomerDisplayID;ListImage;Suspended};var jo=o=>({active:o}),Qo=o=>({gray:o});function Uo(o,e){if(o&1){let t=x();a(0,"span",17),b("click",function(n){C(t);let r=d().$implicit;return d().closeRegister(r),v(n.stopPropagation())}),s()}}function Wo(o,e){o&1&&(a(0,"div")(1,"span",18),m(2,"VACANT"),s()())}function Go(o,e){if(o&1&&(a(0,"div")(1,"span",19),_(2,"i",20),a(3,"font"),m(4),s()(),a(5,"span",21),_(6,"i",22),a(7,"font"),m(8),s()()()),o&2){let t=d().$implicit;l(4),D(t.LoginID),l(4),P("",t.StartDisplay.split(" ")[3]," - Now")}}function qo(o,e){if(o&1){let t=x();a(0,"div",9)(1,"div",10)(2,"div",11)(3,"h5",12),b("click",function(){let n=C(t).$implicit,r=d();return v(r.select(n))}),a(4,"span"),_(5,"i",13),m(6),y(7,"limitTo"),s(),f(8,Uo,1,0,"span",14),s(),a(9,"div",15),b("click",function(){let n=C(t).$implicit,r=d();return v(r.select(n))}),f(10,Wo,3,0,"div",16)(11,Go,9,2,"div",16),s()()()()}if(o&2){let t=e.$implicit,i=d();l(),p("ngClass",t.Active?"active":""),l(),p("ngClass",F(11,jo,(t==null?null:t.ID)==(i.selectedRegister==null?null:i.selectedRegister.ID))),l(),p("ngClass",F(13,Qo,t!=i.selectedRegister)),l(3),D(te(7,8,t.Name,15)),l(2),p("ngIf",t.State!="Close"),l(),p("ngSwitch",t.State),l(),p("ngSwitchCase","Close"),l(),p("ngSwitchCase","Open")}}var yi=class o{constructor(e,t,i,n,r){this._dialogRef=e;this._outletService=t;this._posService=i;this._userRoleService=n;this.router=r}registers;searchInput="";selectedRegister=new Wt;modalConfig=new K;role;get AppConfigJSON(){return this._posService.Data.AppConfigJSON}destroy$=new Ne;ngOnInit(){this.subscribeToObsChanges(),this.initModalConfig()}subscribeToObsChanges(){this._posService.Data$.pipe(ye(this.destroy$)).subscribe(e=>{this.registers=e.Registers}),this._outletService.Data$.pipe(ye(this.destroy$)).subscribe(e=>{this.selectedRegister=this.findOutletRegisterById(e.RegisterID)}),this._userRoleService.Data$.pipe(ye(this.destroy$)).subscribe(e=>{this.role=e})}findOutletRegisterById(e){let t=this.registers.find(i=>i.ID===e);return t||new Wt}initModalConfig(){this.modalConfig.hideClose=!1,this.modalConfig.hideCancel=!1,this.modalConfig.bodyScrollable=!0,this.modalConfig.title="Choose an outlet"}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}close(){this._dialogRef.close()}onOk(){if(this.selectedRegister.ID==null){alert("Please select a register first!");return}this._outletService.pushNewRegister(this.selectedRegister),this._dialogRef.close(this.selectedRegister)}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 mo}from"./chunk-TK5H65DN.js";import{a as gi,b as Ht}from"./chunk-F6GAPEFT.js";import{a as fi}from"./chunk-6L6CIH5M.js";import{a as Po}from"./chunk-NENKJMEE.js";import{e as fo}from"./chunk-YJ6B4M6K.js";import{b as _o}from"./chunk-XHQEBHKJ.js";import{d as vo}from"./chunk-XZP4NVQ2.js";import{a as Co}from"./chunk-7FWWTBUM.js";import{a as po}from"./chunk-QZL2N7RS.js";import{a as me,b as xe,e as So}from"./chunk-GJBRFK6B.js";import{a as lo,b as yo,c as bo}from"./chunk-NZ5FHQC2.js";import{a as co}from"./chunk-QIFUG6DJ.js";import{a as Do}from"./chunk-DZEEABI4.js";import{b as pn,c as so}from"./chunk-LPQK2QMJ.js";import{b as ro}from"./chunk-SOEYA75P.js";import{a as $n}from"./chunk-63P7EQO4.js";import{a as St,b as hi,c as Ci,d as vi}from"./chunk-YE5MVXZP.js";import{a as uo}from"./chunk-AVTNS5RR.js";import{b as go}from"./chunk-EDVO723W.js";import{g as ao}from"./chunk-QHABVTRX.js";import{a as ho}from"./chunk-4E6VHPVL.js";import{a as Oo}from"./chunk-FCHZ7VUL.js";import{a as $e}from"./chunk-3PXI2XBC.js";import{a as ui,b as Me}from"./chunk-EI4HJP6K.js";import{a as cn,b as Lt,c as mn}from"./chunk-KVJLJDFI.js";import{d as di}from"./chunk-L6LENOKK.js";import{p as zn}from"./chunk-ZMWGK26F.js";import{d as Jn}from"./chunk-QOFLU7G4.js";import{a as tt,b as st,c as we}from"./chunk-HT35KHLT.js";import{h as Yn}from"./chunk-SRTWXKQO.js";import{a as Zn,b as yt}from"./chunk-5P2LSOX6.js";import{C as K,D as Z,E as _t,J as no,K as X,L as ve,O as oo,u as Y,v as ce,w as De}from"./chunk-5UTBAGIS.js";import{ga as ci,ha as Ft}from"./chunk-JLOQTYOI.js";import{G as bt,O as pi,P as Q,g as Xn,n as mi,o as eo,q as to,u as io}from"./chunk-YJVLRBSS.js";import{a as et}from"./chunk-UM35BDBC.js";import{a as Vn,c as Fn}from"./chunk-GIKR6Y2K.js";import{d as vt,e as Kn}from"./chunk-XOSCYHF7.js";import{a as _e,b as qn}from"./chunk-B4243VJD.js";import{a as se}from"./chunk-2FWFPV5I.js";import{D as si,c as Se,e as ai,h as Ce,i as Ln,k as Hn,l as ze,n as Bn,o as Pe,p as jn,s as Ct,v as Qn,w as Un,y as Wn,z as Gn}from"./chunk-LNLGRZBB.js";import{a as h,d as li}from"./chunk-MP62IGYR.js";import{a as kn}from"./chunk-26WIZL6M.js";import{$ as Zt,$a as l,$b as Vt,$c as Tn,Ac as ht,Db as E,Dc as be,E as re,Eb as ut,Gb as gt,Hb as ft,I as Ze,Ia as ei,Ib as a,Ja as ln,Jb as s,Kb as _,Lb as B,M as pt,Ma as ne,Mb as j,N as He,Nb as oi,Nc as Ge,Ob as x,Od as Rn,Pd as Nn,Q as Ae,Qb as b,Rb as d,Rd as An,Td as H,Uc as Ve,Va as We,Wa as dt,Wc as he,Wd as Oe,Xa as Sn,Xc as oe,Y as ke,Yc as Mn,Zb as At,Zc as xn,_b as kt,_c as In,aa as z,ad as qe,b as zt,cd as Xe,d as Ne,da as ye,db as S,dc as U,e as fe,ec as m,ed as J,fa as ae,fc as D,gc as P,hc as ri,hd as le,ib as ti,ic as On,ja as I,jc as k,k as ct,ka as Xt,kb as R,kc as N,lb as ii,lc as V,ma as g,n as yn,na as w,o as Ee,p as mt,pc as F,q as Yt,qb as f,qc as Be,r as Kt,rd as En,sc as Dn,t as q,u as Ue,ub as Pn,v as bn,va as C,vb as p,vd as wn,wa as v,xc as y,yc as M,zb as ni,zc as te}from"./chunk-EDB2BAIG.js";import{a as _n,h as Ke}from"./chunk-7DCB7DB2.js";var it=class{constructor(e){this.roleService=e;e&&this.setRole()}_Retrieve;_DateEditor;_NumberEditor;_PriceVisible;_UnitPriceEditor;_PricebookSelector;_Cost;_Return;_Discount;_SalesPerson;_PriceMinimum;_Payment;_CreditSalesLock;_CustomerInputLock;_PaymentCodeLock;_Shipping;_Tax;_DeleteItem;_BundlingPrice;_EmailRestriction;_ParkedDeletionAuthorized;_SellEditor;_ContactCreate;_PrepaidPackageCreate;_Order;_Reprint;_Contacts;_ContactsCreate;_InventoryView;_DebtView;_ClearCart;_SellDelete;_DeliveryEditor;_CouponInputLock;_Park;_Commission;setRole(){this._Retrieve=this.roleService.sell.RetrieveR,this._DateEditor=this.roleService.global.Date,this._NumberEditor=this.roleService.sell.Number,this._PriceVisible=this.roleService.sell.PriceVisible,this._SalesPerson=this.roleService.sell.SalesPerson,this._UnitPriceEditor=this.roleService.sell.UnitPriceEditor,this._PricebookSelector=this.roleService.sell.PricebookSelector,this._Cost=this.roleService.product.Cost,this._Return=this.roleService.sell.Return,this._Discount=this.roleService.sell.Discount,this._PriceMinimum=this.roleService.sell.PriceMinimum,this._Payment=this.roleService.sell.Payment,this._CreditSalesLock=this.roleService.sell.CreditSalesLock,this._CustomerInputLock=this.roleService.sell.CustomerInputLock,this._PaymentCodeLock=this.roleService.sell.PaymentCodeLock,this._Shipping=this.roleService.sell.Shipping,this._Tax=this.roleService.sell.Tax,this._DeleteItem=this.roleService.sell.DeleteItem,this._BundlingPrice=this.roleService.sell.BundlingPrice,this._EmailRestriction=this.roleService.sell.Email,this._SellEditor=this.roleService.sell.Edit,this._ContactCreate=this.roleService.contact.Create,this._PrepaidPackageCreate=this.roleService.prepaidPackage.Create,this._Order=this.roleService.order.View,this._Contacts=this.roleService.contact.View,this._ContactsCreate=this.roleService.contact.Create,this._InventoryView=this.roleService.inventory.View,this._DebtView=this.roleService.debt.View,this._ClearCart=this.roleService.sell.DeleteItem,this._SellDelete=this.roleService.sell.Delete,this._DeliveryEditor=this.roleService.logistic.Edit,this._Reprint=this.roleService.order.Print,this._CouponInputLock=this.roleService.sell.CouponInputLock,this._Park=this.roleService.sell.Park,this._Commission=this.roleService.product.CommissionView}get Park(){return this._Park}get CouponInputLock(){return this._CouponInputLock}set CouponInputLock(e){this._CouponInputLock=e}get Retrieve(){return this._Retrieve}get DateEditor(){return this._DateEditor}set DateEditor(e){this._DateEditor=e}get NumberEditor(){return this._NumberEditor}set NumberEditor(e){this._NumberEditor=e}get PriceVisible(){return this._PriceVisible}get UnitPriceEditor(){return this._UnitPriceEditor}set UnitPriceEditor(e){this._UnitPriceEditor=e}get PricebookSelector(){return this._PricebookSelector}set PricebookSelector(e){this._PricebookSelector=e}get Cost(){return this._Cost}get Return(){return this._Return}set Return(e){this._Return=e}get Discount(){return this._Discount}set Discount(e){this._Discount=e}get SalesPerson(){return this._SalesPerson}get PriceMinimum(){return this._PriceMinimum}get Payment(){return this._Payment}get CreditSalesLock(){return this._CreditSalesLock}get CustomerInputLock(){return this._CustomerInputLock}get PaymentCodeLock(){return this._PaymentCodeLock}get Shipping(){return this._Shipping}get Tax(){return this._Tax}set Tax(e){this._Tax=e}get DeleteItem(){return this._DeleteItem}get BundlingPrice(){return this._BundlingPrice}get Email(){return this._EmailRestriction}get ParkedDeletionAuthorized(){return this._ParkedDeletionAuthorized}set ParkedDeletionAuthorized(e){this._ParkedDeletionAuthorized=e}get SellEditor(){return this._SellEditor}get PrepaidPackageCreate(){return this._PrepaidPackageCreate}get Order(){return this._Order}get Reprint(){return this._Reprint}get Contacts(){return this._Contacts}get ContactsCreate(){return this._ContactsCreate}get InventoryView(){return this._InventoryView}get DebtView(){return this._DebtView}get ClearCartRestriction(){return this._ClearCart}get SellDelete(){return this._SellDelete}get DeliveryEditor(){return this._DeliveryEditor}get Commission(){return this._Commission}};var Bt=class{DeliveryEntityID;Type;NewOrderID;constructor(){this.DeliveryEntityID="",this.Type=3}};var G=class{Order;Invoice;Shipping;Action;Payments;Items;CartItems;ContactName;SplitParkLabel;get cartQuantity(){let e=0;for(let t of this.CartItems)e+=t.Quantity;return e}constructor(){this.Order=new pn,this.Invoice=new Lt,this.Shipping=new mn,this.Action=new Bt,this.Payments=Array(),this.Items=Array(),this.CartItems=Array(),this.ContactName=""}get TotalPaidAmount(){let e=0;return this.Payments.forEach(t=>{e+=t.PaidAmount}),e}get RedeemableAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID!=1);return this.GetAmountByCart(e)}get TotalQuantity(){let e=0;return this.CartItems.forEach(t=>{t.PromotionGift||(e+=t.Quantity)}),e}get CashOnlyAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID==1);return this.GetAmountByCart(e)}get PointOnlyAmount(){let e=this.CartItems.filter(t=>t.Variant.PaymentTypeID==2);return this.GetAmountByCart(e)}get PrepaidPackageItem(){return this.CartItems.filter(t=>t.Variant.TypeID==10)}GetAmountByCart(e){let t=0;return e.forEach(i=>{t+=i.Total}),t=t*(100-this.Order.Discount)/100,t=t*(100-this.Order.Discount2)/100,t}getRewards(){return this.CartItems.filter(t=>t.PromotionGift)}};Ke([tt(()=>pn)],G.prototype,"Order",2),Ke([tt(()=>Lt)],G.prototype,"Invoice",2),Ke([tt(()=>mn)],G.prototype,"Shipping",2),Ke([tt(()=>Bt)],G.prototype,"Action",2),Ke([tt(()=>$e)],G.prototype,"Payments",2),Ke([tt(()=>ui)],G.prototype,"Items",2),Ke([tt(()=>Me)],G.prototype,"CartItems",2);var _i=class{Success;Message;message;ObjectID;SalesOrderID;OutDeliveryID;Contact;LoyaltyPoint;InvoiceNumber;Creator;OrderTimeString;PrintMode;PaymentStateID;PaymentStateLabel;Final;constructor(){this.Success=!0,this.Message="",this.ObjectID="",this.SalesOrderID="",this.OutDeliveryID="",this.Contact=null,this.LoyaltyPoint="",this.InvoiceNumber="",this.Creator="",this.OrderTimeString="",this.PrintMode=0,this.PaymentStateID=0,this.PaymentStateLabel="",this.Final=0}};var Pt=class o{constructor(e,t,i,n){this.httpService=e;this._localDataService=t;this._onlineStatusService=i;this._toastrService=n;this._onlineStatusService.getOnlineStatus$().subscribe(r=>{this.isOnline=r})}_Data=new fe(null);Data$=this._Data.pipe(Ae(),re(e=>e!==null));isOnline;get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}getSalesOrderPrint(e){return this.httpService.post("/API/POS/GetSalesOrderPrint",{TemplateID:e})}submitOrder(e,t){let i=this.generatePOSDataForSubmission(e,this.isOnline);if(this.isOnline)return this.submitOnline(i).pipe(this.handleTimeOutError(i));if(t.ModuleSell.EnableOfflineTransaction)return this._localDataService.syncOrder(i).pipe(q(()=>this.generateCompleteData(i)));this._toastrService.warning("Offline order is not Supported!","Info!")}uploadOfflineOrder(e){return this._localDataService.uploadSingleOrder(e).pipe(Ze(t=>t?.message?.includes("objectStore does not exists")?this.submitOnline(e):mt(()=>t)))}submitOnline(e){return this.httpService.post(Q.SubmitOrder,e,kn.pos.submitOrderTimeout)}handleTimeOutError(e){return zt(Ze(t=>{if(t instanceof Kt||t?.name=="TimeoutError"){let i=this.generateCompleteData(e);this.pushNewValue(i)}throw t}))}generatePOSDataForSubmission(e,t=!0){let i=Object.assign(new G,e);i.Items=[],i.Order.CustomerID==null&&(i.Order.CustomerID=h.GuidEmpty),i.Order.SalesID==null&&(i.Order.SalesID=h.GuidEmpty);let n=1;i.Payments=i.Payments.map(c=>(c.Date=i.Order.Date,c.Index=n,n++,delete c.TypeID,c));let r=1;for(let c of i.CartItems){let u=new ui;u.ID=c.ID,u.VariantID=c.VariantID,u.Quantity=c.Quantity,u.Cost=c.Cost,u.Price=c.Price,u.Discount=c.Discount,u.DiscountAmount=c.DiscountAmount,u.Note=c.Note,u.Taxable=c.Variant.Taxable,u.LoyaltyPoint=c.LoyaltyPoint,u.UnitCost=c.Cost,u.UnitPrice=c.Price,u.UnitPriceOriginal=c.UnitPriceOriginal,u.UnitExpense=c.UnitExpense,u.EntityID=c.EntityID,u.Index=r,u.UnitQuantity=c.UnitQuantity,u.PriceTypeID=c.PriceTypeID,u.PriceNote=c.PriceNote,u.Splited=c.SplitQuantity>0,u.SplitQuantity=c.SplitQuantity,u.InventoryTypeID=c.Variant.TypeID,u.SalesID="",u.Serial=c.Serial,c.SalesID&&(u.SalesID=c.SalesID),delete c.CouponDiscount,i.Items.push(u),r++}return t?(delete i.CartItems,delete i.Order.ClientTimestamp):i.Order.ClientTimestamp=new Date,i}generateCompleteData(e){let t=new _i;return t.InvoiceNumber=e.Order.Number,t.OrderTimeString=new Date().toString(),t.PaymentStateID=e.Action?.Type,t.PaymentStateLabel="Offline",t.Success=!0,t.OutDeliveryID=e.Action.DeliveryEntityID,t}GetReturnInvoice(e,t){return this.httpService.get(Q.ReturInvoice,[{key:"EntityID",value:t},{key:"Number",value:e}])}GetInvoiceBySoID(e){return this.httpService.get(Q.GetPOSDataByID,[{key:"ID",value:e}])}UploadCSV(e,t){let i={CartItems:e,EntityID:t};return this.httpService.post(Q.UploadCsv,i)}sendEmail(e,t){return new Promise((i,n)=>{this._localDataService.isProductFromServer().subscribe(r=>{if(r){let c={invoiceID:t,email:e};this.httpService.post(Q.SendInvoiceEmail,c).subscribe({next:u=>{i(u)},error:u=>{n(u)}})}else n(X.wrongOfflineAction)})})}sendWhatsaap(e,t){let i={InvoiceID:e,PhoneNumber:t};return this.httpService.post(Q.SendInvoiceWhatsapp,i)}createCustomerByInvoice(e,t){let i={InvoiceID:e,Mobile:t};return this.httpService.post(Q.CreateCustomerInvoice,i)}saveCommission(e,t){let i={SOID:e,commission:t};return this.httpService.POSText("/API/Transaction/SetCommission",i)}generateReceiptA4(e){let t={ID:e};return this.httpService.post(Q.InvoiceA4,t)}getVacant(e){return this.httpService.get(Q.GetVacant,[{key:"EntityID",value:e}])}static \u0275fac=function(t){return new(t||o)(g(Oe),g(ve),g(me),g(H))};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};var $=class o{constructor(e,t,i){this._localDataService=e;this._onlineStatusService=t;this._httpService=i;this._onlineStatusService.getOnlineStatus$().subscribe(n=>{this.isOnline=n})}_Data=new fe(null);Data$=this._Data.asObservable().pipe(re(e=>e!==null),Ae());isOnline;get Data(){return this._Data.value}pushNewValue(e){this._Data.next(e)}requestObservable(){return this.isOnline?this._httpService.get(Q.GetPOSStorage).pipe(q(e=>({data:e,type:"Online"}))):this._localDataService.getPOSStorage().pipe(re(e=>e!=null),q(e=>({data:e,type:"Offline"})))}getOutletName(e){return this.Data.Entities.find(i=>i.ID==e)?.Name}static \u0275fac=function(t){return new(t||o)(g(ve),g(me),g(Oe))};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};var Le=class o{constructor(e){this.roleService=e;this.pushNewValue(new it(e))}_Data=new fe(new it(null));get Data(){return this._Data.value}Data$=this._Data.asObservable();pushNewValue(e){this._Data.next(e)}static \u0275fac=function(t){return new(t||o)(g(li))};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};var Wt=class{ID;Code;EntityID;Name;Description;Start;StartDisplay;State;Open;CashierID;OpeningCash;EntityName;LoginID;Active;CustomerDisplayEnabled;OvoConfigurationID;CustomerDisplayID;ListImage;Suspended};var jo=o=>({active:o}),Qo=o=>({gray:o});function Uo(o,e){if(o&1){let t=x();a(0,"span",17),b("click",function(n){C(t);let r=d().$implicit;return d().closeRegister(r),v(n.stopPropagation())}),s()}}function Wo(o,e){o&1&&(a(0,"div")(1,"span",18),m(2,"VACANT"),s()())}function Go(o,e){if(o&1&&(a(0,"div")(1,"span",19),_(2,"i",20),a(3,"font"),m(4),s()(),a(5,"span",21),_(6,"i",22),a(7,"font"),m(8),s()()()),o&2){let t=d().$implicit;l(4),D(t.LoginID),l(4),P("",t.StartDisplay.split(" ")[3]," - Now")}}function qo(o,e){if(o&1){let t=x();a(0,"div",9)(1,"div",10)(2,"div",11)(3,"h5",12),b("click",function(){let n=C(t).$implicit,r=d();return v(r.select(n))}),a(4,"span"),_(5,"i",13),m(6),y(7,"limitTo"),s(),f(8,Uo,1,0,"span",14),s(),a(9,"div",15),b("click",function(){let n=C(t).$implicit,r=d();return v(r.select(n))}),f(10,Wo,3,0,"div",16)(11,Go,9,2,"div",16),s()()()()}if(o&2){let t=e.$implicit,i=d();l(),p("ngClass",t.Active?"active":""),l(),p("ngClass",F(11,jo,(t==null?null:t.ID)==(i.selectedRegister==null?null:i.selectedRegister.ID))),l(),p("ngClass",F(13,Qo,t!=i.selectedRegister)),l(3),D(te(7,8,t.Name,15)),l(2),p("ngIf",t.State!="Close"),l(),p("ngSwitch",t.State),l(),p("ngSwitchCase","Close"),l(),p("ngSwitchCase","Open")}}var yi=class o{constructor(e,t,i,n,r){this._dialogRef=e;this._outletService=t;this._posService=i;this._userRoleService=n;this.router=r}registers;searchInput="";selectedRegister=new Wt;modalConfig=new K;role;get AppConfigJSON(){return this._posService.Data.AppConfigJSON}destroy$=new Ne;ngOnInit(){this.subscribeToObsChanges(),this.initModalConfig()}subscribeToObsChanges(){this._posService.Data$.pipe(ye(this.destroy$)).subscribe(e=>{this.registers=e.Registers}),this._outletService.Data$.pipe(ye(this.destroy$)).subscribe(e=>{this.selectedRegister=this.findOutletRegisterById(e.RegisterID)}),this._userRoleService.Data$.pipe(ye(this.destroy$)).subscribe(e=>{this.role=e})}findOutletRegisterById(e){let t=this.registers.find(i=>i.ID===e);return t||new Wt}initModalConfig(){this.modalConfig.hideClose=!1,this.modalConfig.hideCancel=!1,this.modalConfig.bodyScrollable=!0,this.modalConfig.title="Choose an outlet"}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}close(){this._dialogRef.close()}onOk(){if(this.selectedRegister.ID==null){alert("Please select a register first!");return}this._outletService.pushNewRegister(this.selectedRegister),this._dialogRef.close(this.selectedRegister)}select(e){if(this.AppConfigJSON.ModuleShift.Closure.Enabled)if(this.selectedRegister.ID!=null&&this.selectedRegister.Open&&e.CashierID==null)confirm("You already have an active register with "+this.selectedRegister.Name+`!
2
2
  Do you want to end your session?`)&&(this.close(),this.router.navigate(["menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}}));else if(!e.Open||this.selectedRegister.ID==e.ID)this.selectedRegister=e;else{if(this.role.SellEditor==!1){alert("You cannot end shift for Register "+e.Name+" - Unauthorized Access");return}alert("This Register has already active register, Are you sure you want to end this register?"),this.close(),this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}})}else this.selectedRegister=e}closeRegister(e){let t=this.selectedRegister.ID;if(this.role.SellEditor==!1){alert("You cannot end shift for Register "+e.Name+" - Unauthorized Access");return}t==e.ID?this.router.navigate(["/menu/Shift/Main/My_Shift"]):this.router.navigate(["/menu/Shift/Main/My_Shift"],{queryParams:{RegisterID:e.ID}}),this.close()}static \u0275fac=function(t){return new(t||o)(S(Y),S(ee),S($),S(Le),S(Rn))};static \u0275cmp=R({type:o,selectors:[["pos-modal-register"]],standalone:!1,decls:12,vars:7,consts:[[3,"onOk","onCancel","onClose","config"],[1,"ms-0","mb-8",2,"width","200px",3,"hidden"],[1,"input-group","mb-3"],[1,"input-group-text","txtFilter"],["aria-hidden","true",1,"fa","fa-magnifying-glass"],["data-cy","SearchOutlet","type","text","placeholder","Filter by Name","aria-label","Search",1,"txtFilter","form-control","border-start-0",3,"ngModelChange","ngModel"],[1,"container"],[1,"row",2,"width","600px"],["class","col-4","data-cy","registers",4,"ngFor","ngForOf"],["data-cy","registers",1,"col-4"],[1,"card","border-0",3,"ngClass"],[1,"card-body","p-0",3,"ngClass"],[1,"card-title","mb-0",3,"click","ngClass"],[1,"fa-solid","fa-house","pe-1","fs-6"],["class","fa fa-xmark-circle fa-lg position-absolute","style","text-shadow: 0 1px 0 #afafaf; right: 5px; top: 16px;",3,"click",4,"ngIf"],[1,"card-text","px-0","py-2",3,"click","ngSwitch"],[4,"ngSwitchCase"],[1,"fa","fa-xmark-circle","fa-lg","position-absolute",2,"text-shadow","0 1px 0 #afafaf","right","5px","top","16px",3,"click"],[1,"idle"],[1,"cashier"],["aria-hidden","true",1,"fa","fa-user","pe-2"],[1,"open"],["aria-hidden","true",1,"fa-regular","fa-clock","pe-2"]],template:function(t,i){t&1&&(a(0,"modal-material",0),b("onOk",function(){return i.onOk()})("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),a(1,"content")(2,"div",1)(3,"div",2)(4,"span",3),_(5,"i",4),s(),a(6,"input",5),V("ngModelChange",function(r){return N(i.searchInput,r)||(i.searchInput=r),r}),s()()(),a(7,"div",6)(8,"div",7),f(9,qo,12,15,"div",8),y(10,"FilterByName"),s()()(),_(11,"footer"),s()),t&2&&(p("config",i.modalConfig),l(2),p("hidden",i.registers.length<=6),l(4),k("ngModel",i.searchInput),l(3),p("ngForOf",te(10,4,i.registers,i.searchInput)))},dependencies:[Ve,he,oe,Mn,xn,Se,Ce,Pe,Z,mi,io],styles:[".text-warning[_ngcontent-%COMP%]{color:var(--bs-warning)!important}.bg-light-gray[_ngcontent-%COMP%]{background-color:var(--bs-light-gray);--bs-bg-opacity: .15 !important}.bg-gradient-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}.bg-gradient-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.bg-gradient-warning[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important}.bg-light-orange[_ngcontent-%COMP%]{background-color:var(--bs-light-orange);--bs-bg-opacity: .15 !important}.text-danger[_ngcontent-%COMP%]{color:#fb404b!important}.text-dark[_ngcontent-%COMP%]{color:#5e5e5e!important}.text-success[_ngcontent-%COMP%]{color:#87cb16!important}.text-black[_ngcontent-%COMP%]{color:#000!important}.text-white[_ngcontent-%COMP%]{color:var(--bs-white)!important}.btn-light-blue[_ngcontent-%COMP%]{color:#212529;background-color:#dfeffc!important;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:hover{color:#212529;background-color:#bcdef9;border-color:#b0d8f8}.btn-light-blue[_ngcontent-%COMP%]:focus, .btn-light-blue.focus[_ngcontent-%COMP%]{color:#212529;background-color:#bcdef9;border-color:#b0d8f8;box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-blue.disabled[_ngcontent-%COMP%], .btn-light-blue[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#dfeffc;border-color:#dfeffc}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#b0d8f8;border-color:#a5d2f7}.btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-blue[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-blue.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #c3d1dc80}.btn-light-danger[_ngcontent-%COMP%]{color:#212529;background-color:#f8d7da!important;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:hover{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5}.btn-light-danger[_ngcontent-%COMP%]:focus, .btn-light-danger.focus[_ngcontent-%COMP%]{color:#212529;background-color:#f5c2c7;border-color:#f1aeb5;box-shadow:0 0 0 .2rem #dc354540}.btn-light-danger.disabled[_ngcontent-%COMP%], .btn-light-danger[_ngcontent-%COMP%]:disabled{color:#212529;background-color:#f8d7da;border-color:#f8d7da}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]{color:#212529;background-color:#f1aeb5;border-color:#ea868f}.btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled):active:focus, .btn-light-danger[_ngcontent-%COMP%]:not(:disabled):not(.disabled).active:focus, .show[_ngcontent-%COMP%] > .btn-light-danger.dropdown-toggle[_ngcontent-%COMP%]:focus{box-shadow:0 0 0 .2rem #dc354540}.col-4[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%]{width:180px;min-height:95px;margin-right:17px;margin-bottom:17px;position:relative}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]{display:block;outline:0;border:1px solid #B1AAAA;border-radius:5px;cursor:pointer}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{height:30px;border-radius:4px;padding:5px 10px;color:#fff;background:#b1aaaa;overflow:hidden}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] h5[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{margin-right:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover, .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%]{background:#ffffe1;border:1px solid #89b03e}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%]:hover > h5[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.active[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.vacant[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%]{background:#89b03e}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover{border:1px solid #c9302c}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%], .col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover > h6[_ngcontent-%COMP%]{background:#c9302c!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#c9302c}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.occupied[_ngcontent-%COMP%]:hover{background:#fff}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]{border:1px solid #f6a828}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%]{background:#f6a828!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover{border:1px solid #f6a828;background:#fff}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%]:hover > strong[_ngcontent-%COMP%]{background:#f6a828!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{background:#f6a828}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body.preparing[_ngcontent-%COMP%] div[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.75rem!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%]{height:80px;padding:15px 10px;position:relative}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{display:block;font-weight:400;font-size:.875rem;width:100%;margin-bottom:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:first-child{margin-top:-10px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span[_ngcontent-%COMP%]:last-child{margin-bottom:0}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.alias[_ngcontent-%COMP%]{text-align:center;position:absolute;bottom:0;right:0;width:auto;background-color:#b1aaaa;border-radius:3px;padding:2px 5px;color:#fff;display:none!important}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > .card-body[_ngcontent-%COMP%] div[_ngcontent-%COMP%] span.idle[_ngcontent-%COMP%]{display:block;font-size:1.25rem;text-align:center}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{position:absolute;width:27px;height:28px;cursor:pointer;top:5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#000}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:last-of-type{right:-5px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:nth-last-of-type(2){right:15px}.col-4[_ngcontent-%COMP%] .card[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{bottom:20px;right:5px;position:absolute}.col-4[_ngcontent-%COMP%] .duration[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{border:1px solid!important;position:absolute;bottom:-3px;left:58px;background:#fff;border-radius:5px}"]})};var $o=["inputCash"],bi=class o{constructor(e,t){this.dialogRef=e;this.data=t;this.generateModalTitle$.subscribe()}registerService=w(ee);loadPOSService=w($);register=this.registerService.Data;username=this.loadPOSService?.Data?.UserName;amount=ne(0);config=new K;currentRegisterName;generateModalTitle$=this.registerService.Data$.pipe(re(e=>h.IsNotEmpty(e)),ae(()=>{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}),_e());today=new Date;inputCashEl;ngOnInit(){this.config.customWidth="350px",this.config.hideCancel=!0}ngAfterViewInit(){this.inputCashEl?.nativeElement?.focus()}onOk(){this.dialogRef.close({amount:this.amount()})}static \u0275fac=function(t){return new(t||o)(S(Y),S(ce))};static \u0275cmp=R({type:o,selectors:[["POS-modal-opening-cash"]],viewQuery:function(t,i){if(t&1&&At($o,5),t&2){let n;kt(n=Vt())&&(i.inputCashEl=n.first)}},standalone:!1,decls:25,vars:8,consts:[["inputCash",""],[3,"onOk","onCancel","onClose","config"],[1,"table","fs-5","text"],[1,"py-3"],[1,"text-end","pe-3"],[1,"py-4"],[1,"text-end"],["data-cy","InputCash","autoNum","",1,"border","form-control-lg","text-end","w-100",3,"ngModelChange","ngModel"]],template:function(t,i){if(t&1){let n=x();a(0,"modal-material",1),b("onOk",function(){return C(n),v(i.onOk())})("onCancel",function(){return C(n),v(i.dialogRef.close())})("onClose",function(){return C(n),v(i.dialogRef.close())}),a(1,"content")(2,"table",2)(3,"tr")(4,"td",3),m(5,"Outlet Register"),s(),a(6,"td",4),m(7),s()(),a(8,"tr")(9,"td",5),m(10,"Current User"),s(),a(11,"td",4),m(12),s()(),a(13,"tr")(14,"td",5),m(15,"Starting Time"),s(),a(16,"td",4),m(17),y(18,"date"),s()(),a(19,"tr")(20,"td",3),m(21,"Starting Cash"),s(),a(22,"td",6)(23,"input",7,0),V("ngModelChange",function(c){return C(n),N(i.amount,c)||(i.amount=c),v(c)}),s()()()()()()}t&2&&(p("config",i.config),l(7),D(i.currentRegisterName),l(5),D(i.username),l(5),D(te(18,5,i.today,"EEEE, HH:mm")),l(6),k("ngModel",i.amount))},dependencies:[Se,Ce,Pe,Z,yt,Xe],styles:[".table-title-width[_ngcontent-%COMP%]{width:120px}"]})};var Si=class{OrderNumberElement;InvoiceNumberElement;NewOrderID};var Ot=class o{constructor(e,t,i){this._httpService=e;this._onlineStatusService=t;this._localDataService=i;this._onlineStatusService.getOnlineStatus$().subscribe(n=>{this.isOnline=n})}isOnline;GenerateNumber(e,t){if(this.isOnline)return this._httpService.get(Q.GenerateNumber,[{key:"EntityID",value:e},{key:"TypeID",value:1}]);{let i=new Si;return h.IsNotEmpty(t.NumberElement)&&(t.NumberElement.Seed+=1),h.IsNotEmpty(t.InvoiceNumberElement)&&(t.InvoiceNumberElement.Seed+=1),i.InvoiceNumberElement=t.InvoiceNumberElement,i.OrderNumberElement=t.NumberElement,i.NewOrderID=h.Guid_NewGuid(),Ee(i)}}findRegisterById(e){return new Promise(t=>{this._localDataService.isConfigFromServer().subscribe(i=>{i?this._httpService.get(Q.GetRegisterInfo,[{key:"RegisterID",value:e}]).subscribe(n=>{t(n)}):this._localDataService.findRegisterByID(e).subscribe(n=>{t(n)})})})}recordOpeningCash(e){return Yt(this._httpService.post("/API/POS/RecordOpeningCash",e))}static \u0275fac=function(t){return new(t||o)(g(Oe),g(me),g(ve))};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};var ee=class o{constructor(e,t,i,n,r){this._signalRClientService=e;this._matDialog=t;this._posHttpResponseService=i;this._CoreHttpService=n;this._toastrService=r}_Data=new fe(null);Data$=this._Data.asObservable().pipe(re(e=>e!==null),Ae());get Data(){return this._Data.value}getSalesname(e){return this.Data&&this.Data.ListSales?this._Data.value.ListSales.find(t=>t.ID==e)?.Name:""}setActiveRegisterFromOptions(e,t){let n=this._posHttpResponseService.Data.AppConfigJSON.ModuleShift.Closure.Enabled;if(e.length>1){let r=e.find(c=>c.LoginID==t);if(r)this.pushNewRegister(r);else{let c=this.Data?this.Data.RegisterID:null;h.IsEmpty(c)?this.openChooseRegisterModal():n&&this.openChooseRegisterModal()}}e.length==1&&(this.pushNewRegister(e[0]),h.IsEmpty(e[0].LoginID)&&h.IsEmpty(e[0].CashierID)&&this.openOpeningCashModal(e[0].ID)),e.length==0&&this._toastrService.warning("You do not have access to any OUTLET","Warning")}openChooseRegisterModal(){this._matDialog.open(yi,{id:"registerModal",disableClose:!0}).afterClosed().pipe(re(e=>h.IsNotEmpty(e))).subscribe(e=>{e&&this.openOpeningCashModal(e.ID)})}openOpeningCashModal(e){this._posHttpResponseService.Data.AppConfigJSON.ModuleShift.Closure.Enabled&&this._matDialog.open(bi,{disableClose:!0}).afterClosed().pipe(re(n=>h.IsNotEmpty(n))).subscribe(n=>{let r={RegisterID:e,OpAmount:n.amount};this._CoreHttpService.recordOpeningCash(r)})}pushNewRegister(e){let t=this._Data.value,i=t?t.RegisterID:null;i!=e.ID&&this._CoreHttpService.findRegisterById(e.ID).then(n=>{n.RegisterCode=e.Code,n.DefaultPrintTemplate=n.PrintTemplate,this._signalRClientService.SubscribeGroup(n.RegisterID,i),this.pushNewValue(n)})}getOutletRegister(){let e=this.Data.RegisterID;return this._posHttpResponseService.Data.Registers.find(n=>n.ID==e)}pushNewValue(e){this._Data.next(e)}findOutletRegisterById(e){return this._posHttpResponseService.Data.Registers.find(n=>n.ID===e)}static \u0275fac=function(t){return new(t||o)(g(et),g(De),g($),g(Ot),g(H))};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};var Pi=class{RegisterID;Number;Amount;TransactionID};var Dt=class{GroupID;Method;Data};var Oi=class{Status;InvoiceID;LoyaltyPoint;diff};var Di=class{GopayQr};var qt=(r=>(r[r.cash=1]="cash",r[r.card=2]="card",r[r.emoney=3]="emoney",r[r.other=4]="other",r[r.ECR=99]="ECR",r))(qt||{});var L=class o{constructor(e,t,i){this._OrderHttpService=e;this._customerHttpService=t;this._toastrService=i}_Data=new fe(new G);transaction_id;Data$=this._Data.asObservable();get Data(){return this._Data.value}pushNewValue(e){if(e)this._Data.next(e);else{let t=this.Data;this._Data.next(t)}}submitOrder(e){return new Promise((t,i)=>{this.checkTransactionId(),this._OrderHttpService.submitOrder(this.Data,e).subscribe({next:n=>{t(n)},error:n=>{this.Data.Items=[],i(n)}})})}uploadOfflineOrder(){return this.checkTransactionId(),this._OrderHttpService.uploadOfflineOrder(this.Data)}checkTransactionId(){let t=this.Data.Payments.find(i=>i.TypeID==3);h.IsNotEmpty(t)&&h.IsEmpty(this.transaction_id)&&this._toastrService.warning("Midtrans transaction_id is empty. Please verify manually!","Mobile Payment Failure")}updateCustomerID(e){return this.Data.Order.CustomerID=e,this.pushNewValue(this.Data),new Promise((t,i)=>{this._customerHttpService.GetPrivilegeByID(e,this.Data.Order.EntityID).subscribe({next:n=>{this._customerHttpService.Data=n,this.pushNewValue(this.Data),t(n)},error:n=>{this.Data.Order.CustomerID=null,this.Data.ContactName=null;let r=n.error?.Message;n.status==409?this._toastrService.warning(r,"Warning"):this._toastrService.error(r,`API Error - ${n.status}`),i(n)}})})}static \u0275fac=function(t){return new(t||o)(g(Pt),g(xe),g(H))};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};var Mi=class{Name;Quantity;Discount;DiscountAmount;Price;UnitQuantity};var xi=class{Items;AmountSummary;GopayQr;Number;Customer;SalesName;CurrencySymbol;FinalAmount};var Ii=class o{_state=ne(this.initCustomerDisplayState());isEnabled=Ge(()=>this._state()?.enabled);connect(){let t={enabled:!0,timestamp:new Date().toDateString()};localStorage.setItem("customerDisplay",JSON.stringify(t)),this._state.set(t)}initCustomerDisplayState(){let e=localStorage.getItem("customerDisplay"),t={enabled:!1,timestamp:""};return h.IsNotEmpty(e)&&(t=JSON.parse(e)),t}disconnect(){let t={enabled:!1,timestamp:new Date().toDateString()};localStorage.setItem("customerDisplay",JSON.stringify(t)),this._state.set(t)}static \u0275fac=function(t){return new(t||o)};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};var ue=class{Amount;CurrencySymbol;Label;Type;constructor(e,t,i,n){this.Amount=e,this.CurrencySymbol=t,this.Label=i,this.Type=n}};var ot=class{ModuleSell;ApplicationLoyalty;ApplicationMath;CoreDefaults;ModuleDelivery;ApplicationParkAndRetrieve;ApplicationRegisterClosure;PaymentConfigGopay;PaymentConfigLink;PrintConfigInvoice;CorePrint;PaymentConfigEmpatKali;ApplicationSettings;PrintConfigGeneral;ModuleProducts;ModuleContact;ApplicationTransactionNumbering;ModuleOrders;ModuleShift;ModuleBuy;ModuleAdjustment;TadaCouponVisible;CouponRedemptionType;ProviderOption};var ie=class o{constructor(e,t,i,n){this._orderDataService=e;this._posService=t;this.POSMATH=i;this.decimalPipe=n;this._orderDataService.Data$.pipe(z(r=>this._posService.Data$.pipe(q(c=>({appConfig:c.AppConfigJSON,salesOrder:r}))))).subscribe(r=>{this.salesOrderData=r.salesOrder,this.appConfigJSON=r.appConfig,this.calculateDiscountAmount(),this.pushNewValue(this.grandTotal)})}_Data=new fe(0);Data$=this._Data.asObservable().pipe(Ae());tax=new mo;discountAfterTax=0;currencySymbol="Rp";get Data(){return this._Data.value}salesOrderData=new G;appConfigJSON=new ot;pushNewValue(e){this._Data.next(e)}get grandTotal(){let e=this.TotalAfterSurcharge;return isNaN(e)?0:e}setDecimalDigit(e){let t=this.decimalPipe.transform(e,"1.0-4");return e=parseFloat(t.split(",").join("")),e}get TotalAfterTax(){let e=this.TaxAmount,t=this.TotalBeforeTax+e;return t=this.POSMATH.Round(t,this.appConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm),t}get TotalBeforeTax(){let e=this.tax?.CalculationTypeID===1,t=0;return e?t=this.DiscountTotal-this.TaxAmount:t=this.DiscountTotal,t}get TotalAfterSurcharge(){let e=this.TotalAfterTax+this.SurchargeAmount;return this.POSMATH.Round(e,this.appConfigJSON.ApplicationMath.RoundingDigit.DecimalPlaceValue,this.appConfigJSON.ApplicationMath.RoundingDigit.RoundAlgorithm)}get TotalAfterDiscountTaxable(){return this.GrossTotalTaxable-this.DiscountTotal}get TaxAmount(){if(this.tax!=null){let e=0,t=this.appConfigJSON.ApplicationMath.RoundingTaxDigit.DecimalPlaceValue,i=this.appConfigJSON.ApplicationMath.RoundingTaxDigit.RoundAlgorithm,n=this.GrossTotalTaxable;return this.tax.CalculationTypeID==1?e=this.tax.Rate/(100+this.tax.Rate)*n:e=this.tax.Rate/100*n,e=this.POSMATH.Round(e,t,i),e}else return 0}get SurchargeAmount(){return this.TotalAfterTax*this.salesOrderData.Invoice.SurchargePcg/100}get Discount1Amount(){return this.GrossTotal*this.salesOrderData.Order.Discount/100}get AfterDiscount1Amount(){return this.GrossTotal-this.Discount1Amount}get Discount2Amount(){return this.AfterDiscount1Amount*this.salesOrderData.Order.Discount2/100}get AfterDiscount2Amount(){return this.AfterDiscount1Amount-this.Discount2Amount}get DiscountTotal(){return this.AfterDiscount2Amount-this.salesOrderData.Order.DiscountAmount}calculateDiscountAmount(){let e=this.salesOrderData.Order.DiscountAmount,t=0;this.AfterDiscount2Amount>=0&&e>0&&e>this.AfterDiscount2Amount&&(t=this.AfterDiscount2Amount),t!==0&&t<=e&&this.GrossTotal!==0&&(e=t),this.salesOrderData.Order.DiscountAmount=e}get GrossTotal(){return this.sum(this.salesOrderData.CartItems,"Total")}get GrossTotalTaxable(){let e=this.salesOrderData.CartItems.filter(i=>i.Taxable),t=this.sum(e,"Total");if(e.length!==0){let i=this.calculateDiscountTaxableItem(e);t=t*(100-this.salesOrderData.Order.Discount)/100,t=t*(100-this.salesOrderData.Order.Discount2)/100,t=t-i}return t}calculateDiscountTaxableItem(e){let t=this.GrossTotal,i=this.salesOrderData.Order.DiscountAmount,n=0,r=0,c=0,u=0;for(let O of e)n=O.getItemAfterDiscount/t,r=n*i,u=r*O.Quantity,c+=u;return c}get GrossTotalNonTaxable(){let e=this.salesOrderData.CartItems.filter(i=>i.Taxable==!1),t=this.sum(e,"Total");return t=t*(100-this.salesOrderData.Order.Discount)/100,t=t*(100-this.salesOrderData.Order.Discount2)/100,t=t-this.salesOrderData.Order.DiscountAmount,t}sum(e,t){let i=e.reduce((n,r)=>n+r[t],0);return i=this.setDecimalDigit(i),i}GetPointOnlyAmount(){let e=this.salesOrderData.CartItems.filter(t=>t.Variant.PaymentTypeID==2);return this.GetAmountByCart(e)}GetCashOnlyAmount(){let e=this.salesOrderData.CartItems.filter(t=>t.Variant.PaymentTypeID==1);return this.GetAmountByCart(e)}GetCashAndPointAmountCart(){let e=this.salesOrderData.CartItems.filter(t=>t.Variant.PaymentTypeID!=1);return this.GetAmountByCart(e)}GetAmountByCart(e){let t=this.sum(e,"Total");return t=t*(100-this.salesOrderData.Order.Discount)/100,t=t*(100-this.salesOrderData.Order.Discount2)/100,t}calculateGrossTotal(e){return this.sum(e,"Total")}static \u0275fac=function(t){return new(t||o)(g(L),g($),g(po),g(J))};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};var Ti=class o{constructor(e,t,i,n){this._invoiceCalculatorService=e;this._decimalPipe=t;this._poshttpResponseService=i;this._orderService=n;this._poshttpResponseService.Data$.pipe(_e()).subscribe(r=>{this.appConfig=r.AppConfigJSON})}appConfig=new ot;generateAmountSummary(){let e=[];this.isUseTax()?e=this.generateSummaryTax():e=this.generateSummaryNonTax();let t=this.generateSurchargeSummary();return t&&e.push(...t),e}generateSummaryTax(){let e=this._invoiceCalculatorService.tax?.CalculationTypeID,t=[];return e==1?t=this.generateSummaryTaxInclude():t=this.generateSummaryTaxExclude(),t}generateSummaryNonTax(){let e=[],t=this.generateCartItemAmount();if(e.push(t),this.isDiscounted()){let i=this.generateDiscountSummary(),n=this.generateAmountTotal("Total");e.push(...i,n)}return e}generateSummaryTaxInclude(){let e=[];return this.isTaxReserveSequence()?e=this.generateTaxIncludeReserveSequence():e=this.generateTaxIncludeNormalSequence(),e}generateTaxIncludeReserveSequence(){let e=[];if(this.isTaxDetailVisible()==!1){let r=this._invoiceCalculatorService.TotalBeforeTax,c=this.isDiscounted()?"Amount":"Before Tax",u=this.isDiscounted()?this._invoiceCalculatorService.GrossTotal:r,O=new ue(u,this.currencySymbol,c,2);e.push(O)}if(this.isDiscounted()){let r=this.generateDiscountSummary(),c=this.generateBeforeTaxSummary();e.push(...r,c)}let i=this.generateTax(),n=this.generateAmountTotal();return e.push(...i,n),e}generateTaxIncludeNormalSequence(){let e=[],t=this.generateCartItemAmount();if(e.push(t),this.isDiscounted()){let n=this.generateDiscountSummary(),r=this.generateSummarySubTotal();e.push(...n,r)}let i=this.generateTax();if(e.push(...i),this.isTaxDetailVisible()==!1){let n=this.generateBeforeTaxSummary();e.push(n)}return e}generateSummaryTaxExclude(){let e=[],t=this.generateCartItemAmount(!0);if(e.push(t),this.isDiscounted()){let c=this.generateDiscountSummary(),u=this.generateSummarySubTotal();e.push(...c,u)}let i=this.generateTax(),n=this._invoiceCalculatorService.TotalAfterTax,r=new ue(n,this.currencySymbol,"Total",1);return e.push(...i,r),e}generateAmountTotal(e="Total Amount"){let t=this._invoiceCalculatorService.Data;return new ue(t,this.currencySymbol,e,1)}generateSummarySubTotal(){let e=this._invoiceCalculatorService.TotalAfterTax;return new ue(e,this.currencySymbol,"SubTotal",1)}generateBeforeTaxSummary(){let e=this._invoiceCalculatorService.TotalBeforeTax;return new ue(e,this.currencySymbol,"Before Tax",2)}isTaxDetailVisible(){return this.appConfig.PrintConfigInvoice?.Footer?.TaxDetailVisible}isUseTax(){let e=this._invoiceCalculatorService.tax;return e?.PrintVisible&&e?.Rate!=0}generateTax(){let e=[],t=this.isTaxDetailVisible(),i=t?2:1,n=this._invoiceCalculatorService.tax;if(t){let r=this.appConfig.PrintConfigInvoice.Footer.TaxableSales,c=this.calculateTaxableSales(),u=new ue(c,this.currencySymbol,r,i);e.push(u)}if(n.TypeID==2){let r=this.generateTaxTypeMultiple();e.push(...r)}else{let r=this.generateSingleTaxSummary(n.Label,this._invoiceCalculatorService.TaxAmount,i);e.push(r)}if(t){let r=this.appConfig.PrintConfigInvoice.Footer.TaxExemptSales,c=this._invoiceCalculatorService.GrossTotalNonTaxable,u=new ue(c,this.currencySymbol,r,i);e.push(u);let O=this.appConfig.PrintConfigInvoice.Footer.LabelWithZeroAmount;if(O){let A=new ue(0,this.currencySymbol,O,i);e.push(A)}}return e}generateCartItemAmount(e=!1){let t=this.isDiscounted()||e?this._invoiceCalculatorService.GrossTotal:this._invoiceCalculatorService.TotalAfterTax;return new ue(t,this.currencySymbol,"Amount",1)}get currencySymbol(){return this._invoiceCalculatorService.currencySymbol}generateDiscountSummary(){let e=[];if(this._invoiceCalculatorService.Discount1Amount!=0){let t=this._decimalPipe.transform(this._orderService.Data.Order.Discount),n=this.checkDiscountIgnoreDecimal(t)?"{0}":"{0} ({1}%)";e.push(new ue(this._invoiceCalculatorService.Discount1Amount*-1,this._invoiceCalculatorService.currencySymbol,h.StringFormat(n,this.appConfig.CorePrint.Alias.Discount1,t),1))}if(this._invoiceCalculatorService.Discount2Amount!=0){let t=this._decimalPipe.transform(this._orderService.Data.Order.Discount2),n=this.checkDiscountIgnoreDecimal(t)?"{0}":"{0} ({1}%)";e.push(new ue(this._invoiceCalculatorService.Discount2Amount*-1,this._invoiceCalculatorService.currencySymbol,h.StringFormat(n,this.appConfig.CorePrint.Alias.Discount2,t),1))}return this._orderService.Data.Order.DiscountAmount!=0&&this.appConfig.PrintConfigInvoice.ItemsFooter.DiscountAmountVisible&&e.push(new ue(this._orderService.Data.Order.DiscountAmount*-1,this._invoiceCalculatorService.currencySymbol,"Discount ("+this._invoiceCalculatorService.currencySymbol+")",1)),e}calculateTaxableSales(){let e=this._invoiceCalculatorService.tax,t=this._invoiceCalculatorService.TaxAmount,i=this._invoiceCalculatorService.GrossTotalTaxable;return e.Rate==0?0:e.CalculationTypeID==1?i-t:i}generateTaxTypeMultiple(){let e=this.appConfig.PrintConfigInvoice.Footer.TaxDetailVisible?2:1,t=[],i=this._invoiceCalculatorService.tax;var n=this._invoiceCalculatorService.TaxAmount;if(i.TypeID==2){let r=i?.Components?i?.Components:[],c=this._invoiceCalculatorService.GrossTotalTaxable,u=this.calculateTotalRate(r);r.forEach(O=>{if(i.CalculationTypeID==0){let A=O.Rate/100*c;t=[...t,this.generateSingleTaxSummary(O.Label,A,e)],i.MultipleTaxTypeID==1&&(c+=A)}else{let A=O.Rate/u*n;t=[...t,this.generateSingleTaxSummary(O.Label,A,e)]}})}else t=[...t,this.generateSingleTaxSummary(i.Label,n,e)];return t}calculateTotalRate(e){let t=0;return e&&e.length>0&&(t=e.map(i=>i.Rate).reduce((i,n)=>i+n)),t}generateSingleTaxSummary(e,t,i){let n=this._invoiceCalculatorService.currencySymbol;return new ue(t,n,e,i)}generateSurchargeSummary(){if(this._invoiceCalculatorService.SurchargeAmount==0)return;let e=[],t=this.appConfig.CorePrint,i=t&&t.Alias.SurchargePcg?t.Alias.SurchargePcg:"Surcharge";e.push(new ue(this._invoiceCalculatorService.SurchargeAmount,this._invoiceCalculatorService.currencySymbol,h.StringFormat("{0} ({1}%)",i,this._decimalPipe.transform(this._orderService.Data?.Invoice.SurchargePcg)),1));let n=this.generateAmountTotal();return e.push(n),e}checkDiscountIgnoreDecimal(e){let i=this.appConfig.PrintConfigInvoice.Footer.DiscountIgnoredDecimal,n=parseFloat(e)%1,r=!1;return n!==0&&i&&(r=!0),r}isDiscounted(){let e=this._invoiceCalculatorService.Discount1Amount,t=this._invoiceCalculatorService.Discount2Amount,i=this._orderService.Data.Order.DiscountAmount,n=!1;return(e!=0||t!=0||i!=0)&&(n=!0),n}isTaxReserveSequence(){let e=this._invoiceCalculatorService.tax,t=!!e,i=t?e.CalculationTypeID:null,n=this.appConfig.PrintConfigInvoice.ItemsFooter.TaxIncludeBeforeTotalAmount;return t&&i===1&&n}static \u0275fac=function(t){return new(t||o)(g(ie),g(J),g($),g(L))};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};var rt=class o{constructor(e,t,i,n){this._receiptCalculatorService=e;this._cashierCalculatorService=t;this._signal=i;this._customerHttpService=n;this.broadcastOrderUpdate$.subscribe()}_salesOrderDataModelService=w(L);_outletService=w(ee);displayService=w(Ii);localdata=w(ve);orderDataModel;broadcastOrderUpdate$=Ue([this._salesOrderDataModelService.Data$,this.localdata.isStoreOrderInServer(),qn(this.displayService.isEnabled)]).pipe(bn(([e,t,i])=>{let n=this._outletService?.Data?.RegisterID;if(t&&i&&n){this.orderDataModel=e;let r=this.ConstructCartModelForCustomerDisplay(),c=new Dt;return c.GroupID=n+"_Subscriber",c.Method="POSCartAmountUpdated",c.Data=r,this._signal.broadcast(c).pipe(Ze(u=>(console.log(u),ct)))}else return ct}),Ze(e=>(console.log(e),ct)),_e());ConstructCartModelForCustomerDisplay(){let e=this._customerHttpService.Data,t=new xi;t.Number=this.orderDataModel.Order.Number,t.Items=Array();for(let i of this.orderDataModel.CartItems){let n=new Mi;n.Name=i.Variant.Name,n.Discount=i.Discount,n.DiscountAmount=i.DiscountAmount,n.Price=i.Price,n.Quantity=i.Quantity,n.UnitQuantity=i.UnitQuantity,t.Items.push(n)}return h.IsNotEmpty(this.orderDataModel.Order.SalesID)?t.SalesName=this._outletService.getSalesname(this.orderDataModel.Order.SalesID):t.SalesName="",h.IsNotEmpty(this.orderDataModel.Order.CustomerID)&&h.IsNotEmpty(e)&&(t.Customer=new St,t.Customer.Email=e.Email,t.Customer.Mobile=e.Mobile,t.Customer.Name=this.orderDataModel.ContactName),t.CurrencySymbol=this._cashierCalculatorService.currencySymbol,t.FinalAmount=this._cashierCalculatorService.Data,t.AmountSummary=this._receiptCalculatorService.generateAmountSummary(),t}BroadcastStateToCustomerDisplay(e,t="",i="",n=0){let r=new Oi;r.Status=e,r.InvoiceID=t,r.LoyaltyPoint=i,r.diff=n;let c=new Dt;return c.GroupID=this._outletService.Data.RegisterID+"_Subscriber",c.Method="POSStateUpdated",c.Data=r,this.displayService.isEnabled()?this.localdata.isStoreOrderInServer().pipe(z(u=>u?this._signal.broadcast(c):Ee(X.offlineMode))):ct}BroadcastQRToCustomerDisplay(e){let t=new Di;t.GopayQr=e;let i=new Dt;return i.GroupID=this._outletService.Data.RegisterID+"_Subscriber",i.Method="POSQRPaymentActivated",i.Data=t,this.displayService.isEnabled()?this.localdata.isStoreOrderInServer().pipe(z(n=>n?this._signal.broadcast(i):Ee(X.offlineMode))):ct}static \u0275fac=function(t){return new(t||o)(g(Ti),g(ie),g(et),g(xe))};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};var Ei=class o{constructor(e){this.httpService=e}VerifyPayment(e,t){let i=this.getVerifyPaymentUrl(t);return this.httpService.post(i,e)}getVerifyPaymentUrl(e){let t;switch(e){case 0:t=Q.GopayVerifyPayment;break;case 1:t=Q.BcaVerifyPayment;break}return t}generateLink(e){return this.httpService.post(Q.GenerateLink,e)}generateQRCode(e,t){return this.httpService.post(e,t)}static \u0275fac=function(t){return new(t||o)(g(Oe))};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};var Mt=class o{constructor(e,t,i,n,r){this._posHubService=e;this._orderDataService=t;this._PaymentHttpService=i;this._InvoicecashierCalculatorService=n;this._toastrService=r}transactionId;qrPaymentMethodID;QRCodeHttpResponse;_paymentMethod;get paymentMethod(){return this._paymentMethod}resetPaymentMethod(){this._paymentMethod=null}onQRPaymentComplete(e,t){return new Promise((i,n)=>{if(e.transaction_id!==this.transactionId){let c=`transaction_id: ${e.transaction_id} / gross_amount: ${e.gross_amount}`;n({header:"Invalid QR Payment",message:c});return}if(e.gross_amount!==this._InvoicecashierCalculatorService.Data){let c=`paid_amount: ${e.gross_amount} vs invoice_amount: ${this._InvoicecashierCalculatorService.Data}`;n({header:"Invalid QR Payment",message:c});return}let r=this._orderDataService.Data.Order.Number;if(e.order_id.includes(r)==!1){let c=`Order ID: ${e.order_id} vs Order Number: ${r}`;n({header:"Invalid QR Payment",message:c});return}if(e.transaction_status!=="settlement"){let c=`Transaction status is ${e.transaction_status}`;n({header:"Invalid QR Payment",message:c});return}this.validateEMoneyPayment(t).subscribe(c=>{i(c)})})}generateNewPayment(e,t){let i=this._orderDataService.Data;h.IsEmpty(this.qrPaymentMethodID)&&alert("QR PaymentMethod.ID is not available!");let n=new $e;return n.PaidAmount=t,n.Amount=t,n.Date=i.Order.Date,n.MethodID=this.qrPaymentMethodID,n.Code=e,h.IsEmpty(e)&&this._toastrService.warning("Midtrans transaction_id is empty. Please verify manually!","Mobile Payment Failure"),n}sendStateCompleteToCustomerDisplay(e){this._posHubService.BroadcastStateToCustomerDisplay(1,e.ObjectID,e.LoyaltyPoint,0).subscribe()}generateQR(e,t){this._paymentMethod=t,this.qrPaymentMethodID=t.ID;let i=this.getServiceUrl(t.EMoneyTypeID);return this._PaymentHttpService.generateQRCode(i,e).pipe(q(c=>(c=this.manipulateBCAQrisImg(c,t.EMoneyTypeID),this.transactionId=c.Transaction_id,this.QRCodeHttpResponse=c,this._orderDataService.transaction_id=c.Transaction_id,this.sendQRToCustomerDisplay(c.Url),c)))}sendQRToCustomerDisplay(e){this._posHubService.BroadcastQRToCustomerDisplay(e).subscribe()}validateEMoneyPayment(e){if(h.IsNotEmpty(this.transactionId)){let t=this._InvoicecashierCalculatorService.Data,i=this._paymentMethod?.EMoneyTypeID,n=this.generatePaymentVerificationData(t,i);return this._PaymentHttpService.VerifyPayment(n,i).pipe(z(r=>(this.updatePosDataForSubmission(t),yn(this._orderDataService.submitOrder(e)).pipe(ae(c=>{this.sendStateCompleteToCustomerDisplay(c)})))))}else{let t=new Error("Transaction ID is Empty");throw mt(()=>t)}}generatePaymentVerificationData(e,t){let i=this._orderDataService.Data,n=new Pi;return n.Number=i.Order.Number,n.Amount=e,n.TransactionID=this.transactionId,n.RegisterID=i.Order.RegisterID,t==1&&(n.Number=this.QRCodeHttpResponse.Number),n}updatePosDataForSubmission(e){let t=this._orderDataService.Data,i=this.generateNewPayment(this.transactionId,e),n=[];n.push(i),t.Invoice.Due=null,t.Action.Type=3,t.Order.InvoicedStateID=3,t.Payments=n,this._orderDataService.pushNewValue(t)}getServiceUrl(e){let t;switch(e){case 0:t=Q.GenerateGopayQrCode;break;case 1:t=Q.GenerateBcaQrCode;break}return t}manipulateBCAQrisImg(e,t){return t==1&&(e.Url=`data:image/png;base64, ${e.Url}`),e}clearTransactionID(){this.transactionId=null,this._orderDataService.transaction_id=null,this.QRCodeHttpResponse=null}getTransactionId(){return this.transactionId}static \u0275fac=function(t){return new(t||o)(g(rt),g(L),g(Ei),g(ie),g(H))};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};var xt=class{CommissionID;ReturNumber;parkTemporaryItem;posState;InputTextValue;constructor(){this.posState=0,this.CommissionID="",this.ReturNumber="",this.parkTemporaryItem=[],this.InputTextValue=""}};var wi=class o{constructor(e,t,i){this._promotionEventService=e;this._dialogRef=t;this.data=i;this.modalConfig=new K,this.modalConfig.hideCancel=!0,this.modalConfig.hideClose=!0,this.modalConfig.headerType=se.Warning,this.modalConfig.title="Promotion Requirement unfulfilled!",this.modalConfig.customWidth="350px",this.modalConfig.okText="Ok",this.selectedPromotion=e.selectedPromotion}modalConfig;selectedPromotion;onOk(){this._promotionEventService.restoreOrder(),this._dialogRef.close()}static \u0275fac=function(t){return new(t||o)(S(Te),S(Y),S(ce))};static \u0275cmp=R({type:o,selectors:[["POS-modal-promotion-confirm"]],standalone:!1,decls:9,vars:4,consts:[[3,"onOk","config"],[1,"fst-italic","text-danger","mb-3"],[1,"mb-0"]],template:function(t,i){t&1&&(a(0,"modal-material",0),b("onOk",function(){return i.onOk()}),a(1,"content")(2,"div")(3,"h5"),m(4),s(),a(5,"p",1),m(6),s(),a(7,"p",2),m(8),s()()()()),t&2&&(p("config",i.modalConfig),l(4),D(i.selectedPromotion==null?null:i.selectedPromotion.Name),l(2),D(i.selectedPromotion==null?null:i.selectedPromotion.Description),l(2),D(i.data==null?null:i.data.message))},dependencies:[Z],encapsulation:2})};var Ri=class extends Me{};function Xo(o,e){if(o&1&&(a(0,"span",8),m(1),y(2,"number"),s()),o&2){let t=d(2);l(),P("-",M(2,1,t.coupon.Amount),"%")}}function er(o,e){if(o&1&&(a(0,"span",8),m(1),y(2,"number"),s()),o&2){let t=d(2);l(),P(" -",M(2,1,t.coupon.Amount)," ")}}function tr(o,e){if(o&1){let t=x();a(0,"button",12),b("click",function(){C(t);let n=d().$implicit,r=d();return v(r.onRemoveCouponDiscount(n))}),m(1," Remove "),s()}}function ir(o,e){if(o&1){let t=x();a(0,"button",13),b("click",function(){C(t);let n=d().$implicit,r=d();return v(r.onApplyCouponDiscount(n))}),m(1," Apply "),s()}if(o&2){let t=d(2);p("disabled",t.hasAppliedCouponDiscount())}}function nr(o,e){if(o&1&&(a(0,"tr")(1,"td"),m(2),s(),a(3,"td"),m(4),s(),a(5,"td",7),m(6),y(7,"number"),s(),a(8,"td",7),f(9,Xo,3,3,"span",8)(10,er,3,3,"span",8),s(),a(11,"td",9),f(12,tr,2,0,"button",10)(13,ir,2,1,"button",11),s()()),o&2){let t=e.$implicit,i=d();l(2),D(t==null||t.Variant==null?null:t.Variant.Name),l(2),D(t==null||t.Variant==null?null:t.Variant.Code),l(2),D(M(7,5,t.UnitPrice)),l(3),E((i.coupon==null||i.coupon.Requirement==null?null:i.coupon.Requirement.Type)==i.couponType.DiscountPercentage?9:10),l(3),E((t==null?null:t.CouponDiscount)>0?12:13)}}var Ni=class o{constructor(e){this.data=e;this.coupon=this.data.coupon,this.initModalConfig(),this.initEligibleItems()}dialogRef=w(Y);config;eligibleItems=ne([]);coupon;couponType=gi;hasAppliedCouponDiscount=ne(!1);initModalConfig(){this.config=new K,this.config.title="Choose Item to Apply Discount",this.config.hideFooter=!0}initEligibleItems(){let e=this.data.coupon?.ApplyToProduct.map(t=>t.ID);e&&(this.eligibleItems.update(()=>this.data.cartItems.filter(i=>e.includes(i.VariantID))),this.hasAppliedCouponDiscount.update(()=>this.eligibleItems().some(t=>t.CouponDiscount>0)))}onApplyCouponDiscount(e){let t=[e];this.hasAppliedCouponDiscount.update(()=>!0),this.dialogRef.close(t)}onRemoveCouponDiscount(e){this.eligibleItems.update(t=>{let i=t.findIndex(n=>n.VariantID===e.VariantID);return i>-1&&(t[i].Discount=0,t[i].CouponDiscount=0),t}),this.hasAppliedCouponDiscount.update(()=>!1)}onClose(){this.dialogRef.close()}static \u0275fac=function(t){return new(t||o)(S(ce))};static \u0275cmp=R({type:o,selectors:[["app-modal-coupon-selected-item"]],decls:20,vars:1,consts:[[3,"onCancel","onClose","config"],[1,"container"],[1,"row"],[1,"col-12"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],[1,"text-end"],[1,"text-danger"],[1,"text-center"],[1,"btn","btn-sm","btn-danger"],[1,"btn","btn-sm","btn-success",3,"disabled"],[1,"btn","btn-sm","btn-danger",3,"click"],[1,"btn","btn-sm","btn-success",3,"click","disabled"]],template:function(t,i){t&1&&(a(0,"modal-material",0),b("onCancel",function(){return i.onClose()})("onClose",function(){return i.onClose()}),a(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"table",4)(6,"thead",5)(7,"tr")(8,"th",6),m(9,"Name"),s(),a(10,"th",6),m(11,"Code"),s(),a(12,"th",6),m(13,"Price"),s(),a(14,"th",6),m(15,"Discount"),s(),_(16,"th",6),s()(),a(17,"tbody"),gt(18,nr,14,7,"tr",null,ut),s()()()()()()()),t&2&&(p("config",i.config),l(18),ft(i.eligibleItems()))},dependencies:[le,J,_t,Z],encapsulation:2})};var Ai=class{Code;Provider;EntityID;Customer;ShoppingCart};var ki=class o{salesOrderService=w(L);registerService=w(ee);customerService=w(xe);orderCalculator=w(ie);generateRedeemCouponDto(e,t){let i=new Ai,n=this.registerService.Data?.EntityID;return i.Code=e,i.Provider=t,i.ShoppingCart={Amount:this.orderCalculator.Data,Items:this.generateItems()},i.EntityID=n,i.Customer=this.generateCustomer(t),i}generateItems(){return this.salesOrderService.Data.CartItems.map(i=>({Price:i.Price,Quantity:i.Quantity,VariantID:i.VariantID,Code:i?.Variant?.Code}))}generateCustomer(e){let t=this.customerService.Data,i=this.salesOrderService?.Data?.Order?.CustomerID,n=null;return h.IsNotEmpty(i)&&(n={Phone:t.Mobile,Email:t.Email},e==="Internal"&&(n=_n({ID:i},n))),n}static \u0275fac=function(t){return new(t||o)};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};var Tt=class o{constructor(e,t,i,n,r,c){this._httpService=e;this._orderDataService=t;this._userRoleService=i;this.toastr=n;this._invoiceCalculatorService=r;this.promotionCouponFactoryService=c;this.subscribeToObservable()}dialog=w(De);role;originalRoleData;_coupon;get coupon(){return this._coupon}subscribeToObservable(){this._userRoleService.Data$.subscribe(e=>{this.role=e,h.IsEmpty(this.originalRoleData)&&(this.originalRoleData=we(it,e))})}RedeemCoupon(e,t,i=!0){let n=this.promotionCouponFactoryService.generateRedeemCouponDto(e,"Internal");this._httpService.post(Q.ValidateInternalCoupon,n).subscribe({next:r=>{switch(this._orderDataService.Data.Order.PromotionCoupon=e,this._orderDataService.Data.Order.PromotionNote=t,this._orderDataService.Data.Order.CouponType=1,r.Requirement?.Type){case 1:this.HandleDiscountPercentage(r,i);break;case 2:this.HandleDiscountAmount(r);break;case 3:this.HandleReturn();break;case 4:this.HandleParkedDeletion();break;case 5:this.HandleFullAccess(),i&&this.toastr.success("You now have Full Access for this Order!","Coupon Applied");break}this._coupon=r},error:r=>{this.resetAppliedCoupon(),this.removeAppliedCoupon()}})}resetAppliedCoupon(){if(h.IsNotEmpty(this.coupon))switch(this.coupon.Requirement?.Type){case 2:this.HandleDiscountAmount(this.coupon,!0);break;case 1:this.HandleDiscountPercentage(this.coupon,!1,!0);break;case 5:this.resetRoleAfterAppliedCoupon();break;case 4:this.HandleParkedDeletion(!0);break;case 3:this.HandleReturn(!0);break}}resetAppliedCouponDiscount(){if(this.coupon){switch(this.coupon.Requirement?.Type){case 1:this.HandleDiscountPercentage(this._coupon,!1,!0);break;case 2:this.HandleDiscountAmount(this._coupon,!0);break}this.removeAppliedCoupon()}}HandleDiscountPercentage(e,t,i=!1){e.Amount>0?e.Requirement?.MaximumDiscount>0?this.applyConfigMaxDiscount(e,i):e.Requirement?.FullPriceProductOnly?this.applyFullPriceDisc(e,t,i):this.applyDiscountPercentage(e,t,i):(this.role.Discount=i?this.originalRoleData.Discount:!0,this._userRoleService.pushNewValue(this.role))}applyFullPriceDisc(e,t,i=!1){let n=this._orderDataService.Data,r=this.filterItemWithDisc(n.CartItems),c=this.filterItemWithCouponDisc(n.CartItems);if(i)c.length>0?(n.CartItems=this.resetItemsDisc(n.CartItems),this._orderDataService.pushNewValue()):this.applyDiscountPercentage(e,!1,i);else if(r.length>0){let u=this.filterItemWithoutDisc(n.CartItems);u.length>0?this.applyConfigItemsScope(e,u).subscribe(O=>{let A=this.applyItemsDisc(O,e);n.CartItems=this.updateCartItems(A,e),this._orderDataService.pushNewValue(n),this.showToastr(e)}):(this.removeAppliedCoupon(),t=!1,this._orderDataService.pushNewValue())}else this.applyDiscountPercentage(e,!0,i)}updateCartItems(e,t){let n=this._orderDataService.Data.CartItems.map(r=>{let c=e.find(u=>u.VariantID==r.VariantID);return c||r});return n=this.applyOneOfFirstQuantity(n,t),n}applyOneOfFirstQuantity(e,t){if(t?.Requirement?.RequirementDiscountType==2){let i=e.findIndex(n=>n.CouponDiscount>0);if(e[i].Quantity>1){let n=st(Me,e[i]);n.Quantity=1,e[i].Quantity=e[i].Quantity-1,e[i].CouponDiscount=0,e[i].Discount=0,e[i].DiscountAmount=0,e.push(n)}}return e}filterItemWithDisc(e){return e.filter(i=>i.Discount>0||i.DiscountAmount>0||i.Price!=i?.Variant?.UnitPrice||h.IsNotEmpty(i.PriceBookID)||i.PriceTypeID==2)}filterItemWithoutDisc(e){return e.filter(i=>this.itemConditionFullPriceOnly(i))}filterItemWithCouponDisc(e){return e.filter(i=>i.CouponDiscount>0)}applyDiscountPercentage(e,t,i=!1){let n=this._orderDataService.Data.Order.CustomerDiscountRate,r=e.Amount;if(i){let c=this._orderDataService.Data;this._orderDataService.Data.Order.Discount=0,c.CartItems=this.resetItemsDisc(c.CartItems),this._orderDataService.pushNewValue(c)}else r>=n?e.ApplyToProduct?.length>0?this.applyDiscountRequiredItems(e):(this._orderDataService.Data.Order.Discount=e.Amount,this._orderDataService.pushNewValue(),this.showToastr(e)):(this.toastr.warning("Member discount is applied because member discount is greater than Coupon Discount","Warning"),this.resetAppliedCouponDiscount())}applyDiscountRequiredItems(e){let i=this._orderDataService.Data.CartItems.filter(n=>e.ApplyToProduct.map(r=>r.ID)?.includes(n.VariantID));this.applyConfigItemsScope(e,i).subscribe(n=>{let r=n.map(u=>(u.Discount=e.Amount,u.CouponDiscount=e.Amount,u)),c=this.updateCartItems(r,e);this._orderDataService.Data.CartItems=c,this._orderDataService.pushNewValue(),this.showToastr(e)})}showToastr(e){e.Requirement?.Notify&&this.toastr.success(e.Requirement?.Notify,"Coupon Applied")}applyConfigMaxDiscount(e,t=!1){let i=this._orderDataService.Data.CartItems;e.Requirement?.FullPriceProductOnly&&(i=i.filter(n=>this.itemConditionFullPriceOnly(n))),this.applyConfigItemsScope(e,i).subscribe(n=>{this.applyMaxDiscount(e,n,t)})}applyConfigItemsScope(e,t){let i=e.Requirement?.RequirementDiscountType;return i==1||i==2?this.dialog.open(Ni,{data:{coupon:e,cartItems:t}}).afterClosed().pipe(ae(r=>{let O=this._orderDataService.Data.CartItems.some(A=>A.CouponDiscount>0);!r&&!O&&this.resetAppliedCouponDiscount()}),re(r=>!!r)):Ee(t)}applyMaxDiscount(e,t,i){let n=this._invoiceCalculatorService.calculateGrossTotal(t),r=this._orderDataService.Data,c=n*e.Amount/100,u=e.Requirement?.MaximumDiscount;if(c>=u)r.Order.DiscountAmount=i?0:u;else{r.Order.DiscountAmount==u&&(r.Order.DiscountAmount=0);let O=i?this.resetItemsDisc(t):this.applyItemsDisc(t,e);r.CartItems=this.updateCartItems(O,e)}this._orderDataService.pushNewValue(r)}resetItemsDisc(e){return this.coupon.Requirement.RequirementDiscountType==2?e=this.resetConfigOneOfFirstQuantity(e):e=e.map(t=>(t.CouponDiscount>0&&(t.Discount=0,t.DiscountAmount=0,t.CouponDiscount=0),t)),e}resetConfigOneOfFirstQuantity(e){let t=e.findIndex(i=>i.CouponDiscount>0);if(t!==-1){let i=e.findIndex(n=>n.CouponDiscount==0&&e[t]?.VariantID==n?.VariantID);i!==-1?(e.splice(t,1),e[i].Quantity+=1):(e[t].CouponDiscount=0,e[t].Discount=0,e[t].DiscountAmount=0)}return e}applyItemsDisc(e,t){return t.ApplyToProduct?.length>0?e=this.applyDiscByVariant(e,t):e=e.map(i=>(this.itemConditionFullPriceOnly(i)&&(i.Discount=t.Amount,i.CouponDiscount=t.Amount),i)),e}applyDiscByVariant(e,t){return e=e.map(i=>(t.ApplyToProduct.find(r=>r.ID==i.VariantID)&&this.itemConditionFullPriceOnly(i)&&(i.Discount=t.Amount,i.CouponDiscount=t.Amount),i)),e}itemConditionFullPriceOnly(e){return(e.Discount==0||e.CouponDiscount>0)&&e.DiscountAmount==0&&e.Price==e?.Variant?.UnitPrice&&h.IsEmpty(e.PriceBookID)}HandleDiscountAmount(e,t=!1){e.Amount>0?(e.ApplyToProduct?.length>0?this.applyDiscountInItem(e,t):(t?this._orderDataService.Data.Order.DiscountAmount=0:(this._orderDataService.Data.Order.DiscountAmount=e.Amount,this.toastr.success(e?.Requirement?.Notify,"Coupon Applied")),this._orderDataService.pushNewValue()),this.resetCustomerPoint(t)):(this.role.Discount=t?this.originalRoleData.Discount:!0,this._userRoleService.pushNewValue(this.role))}applyDiscountInItem(e,t=!1){let i=this._orderDataService.Data;if(t)i.CartItems=this.resetItemsDisc(i.CartItems);else{let r=i.CartItems.filter(c=>e.ApplyToProduct.map(u=>u.ID)?.includes(c.VariantID));this.applyConfigItemsScope(e,r).subscribe(c=>{let u=c.map(O=>(O.DiscountAmount=e.Amount,O.CouponDiscount=e.Amount,O));i.CartItems=this.updateCartItems(u,e),this._orderDataService.pushNewValue(i),this.showToastr(e)})}}resetCustomerPoint(e){if(!e){let t=this._orderDataService.Data;t.Order.PointUsed=0}}HandleReturn(e=!1){this.role.Return=e?this.originalRoleData.Return:!0,this._userRoleService.pushNewValue(this.role)}HandleParkedDeletion(e=!1){this.role.ParkedDeletionAuthorized=e?this.originalRoleData.ParkedDeletionAuthorized:!0,this._userRoleService.pushNewValue(this.role),this.toastr.success("You Have Access to delete park and delete item when retrieve!","Coupon Applied")}HandleFullAccess(){this.role.UnitPriceEditor=!0,this.role.Discount=!0,this.role.Return=!0,this.role.Tax=!1,this.role.NumberEditor=!0,this.role.DateEditor=!0,this.role.PricebookSelector=!0,this._userRoleService.pushNewValue(this.role)}resetRoleAfterAppliedCoupon(){let e=we(it,this.originalRoleData);this.role.UnitPriceEditor=e.UnitPriceEditor,this.role.Discount=e.Discount,this.role.Return=e.Return,this.role.Tax=e.Tax,this.role.NumberEditor=e.NumberEditor,this.role.DateEditor=e.DateEditor,this.role.PricebookSelector=e.PricebookSelector,this.role.ParkedDeletionAuthorized=e.ParkedDeletionAuthorized,this._userRoleService.pushNewValue(this.role)}removeAppliedCoupon(){let e=this._orderDataService.Data;e.Order.PromotionCoupon=null,e.Order.PromotionNote=null,this._coupon=null,this._orderDataService.pushNewValue()}static \u0275fac=function(t){return new(t||o)(g(Oe),g(L),g(Le),g(H),g(ie),g(ki))};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};var Et=class o{constructor(e,t,i,n,r,c,u,O,A){this.variantService=e;this._posService=t;this._orderDataService=i;this.toastr=n;this._orderProcessorService=r;this._customerHttpService=c;this.promotionCouponService=u;this.userRoleService=O;this.decimalPipe=A;this.subscribeToObservable()}salesOrderData;appConfigJson;entityID;audio=new Audio;subscribeToObservable(){this._posService.Data$.subscribe(e=>{this.appConfigJson=e.AppConfigJSON}),this._orderDataService.Data$.subscribe(e=>{this.salesOrderData=e,this.entityID=e.Order.EntityID})}addCartItemById(e,t,i=!0){return new Promise((n,r)=>{this.variantService.findVariantByID(e,this.entityID,i).then(c=>{this.createNewCartItem(c,t),n(c)}).catch(c=>{r(c)})})}addCartItemByCode(e){return new Promise((t,i)=>{let n=this.appConfigJson.ModuleSell.DigitalScale;n.Digit>0&&h.IsNotEmpty(n.Regex)&&e.length==n.Digit?this.parseDigitalScaleBarcodeWithRegex(e,n).then(c=>{c||(this.toastr.info("Matching Regex Rule to Barcode","Digital Scale"),this.findVariantByCode(e).then(u=>t(u)).catch(u=>i(u)))}):this.findVariantByCode(e).then(c=>t(c)).catch(c=>i(c))})}findVariantByCode(e){let t=this.appConfigJson.ModuleSell.BarcodeSerialEnabled;return new Promise((i,n)=>{this.variantService.findVariantByCode(e,this.entityID,t).then(r=>{i(r),this.createNewCartItem(r)}).catch(r=>{this.playBellRing(),n(r)})})}addItemBySerial(e){this.variantService.findVariantBySerial(e,this.entityID).subscribe(t=>{let i=this.salesOrderData.CartItems;if(i.length>0){let n,r=[],c=i.findIndex(u=>u.Variant.ID==t.ID);r=[],c!==-1?(n=i[c].Serial?.findIndex(u=>u.Number==e),r=[...i[c].Serial?i[c].Serial:[]],n==-1?(r.push({Number:e,Quantity:1}),i[c].Quantity=r.length):r.length>0?r[n].Quantity+=1:(r=[{Number:e,Quantity:1}],this.addNewSerials(t,e)),i[c].Serial=[...r],i[c].Quantity=i[c].calculateSerialQty(),this.updateCartItem(i[c],c)):this.addNewSerials(t,e)}else this.addNewSerials(t,e)})}addNewSerials(e,t){e.Serial=[{Number:t,Quantity:1}],this.createNewCartItem(e)}playBellRing(){this.audio.src="//res.cloudinary.com/pos/video/upload/v1659947782/POS/Music/bell_ring.mp3",this.audio.load(),this.audio.play()}updateCartItem(e,t){this.salesOrderData.CartItems[t]=e,this._orderDataService.pushNewValue(this.salesOrderData),this.applyCustomerPoint(),this.reApplyPromotionCoupon()}deleteCartItem(e){this.salesOrderData.CartItems=this.salesOrderData.CartItems.filter(t=>t!==e),this._orderDataService.pushNewValue(this.salesOrderData),this.applyCustomerPoint(),this.reApplyPromotionCoupon()}parseDigitalScaleBarcodeWithRegex(e,t){return new Promise(i=>{let n=this.appConfigJson.ModuleSell.BarcodeSerialEnabled,r=new RegExp(t.Regex),c=e.match(r);if(console.log(c),h.IsNotEmpty(c)){let u=c[1],O=parseFloat(c[2]);console.log(O,"productQuantity"),O=O/t.QuantityDivider,this.variantService.findVariantByCode(u,this.entityID,n).then(A=>{this.createNewCartItem(A,null,O),i(!0)}).catch(()=>{i(!1)})}else i(!1)})}createNewCartItem(e,t,i){let n=new Me,r=this.appConfigJson.ModuleSell.ProductNotes.CopyProductDescription,c=this.appConfigJson.ModuleSell.ProductNotes.CopyPromotionName;n.patchByVariant(e,r,c),n=this.applyReward(n,t),h.IsEmpty(t)&&(n=this.applyPriceBook(n)),this.validateCartItem(n)&&(n.Quantity=i||n.Quantity,t?.PromotionType==2?this.handlingPromotionQuantity(n):this.pushNewItemToArray(n,n.PromotionGift),this.applyCustomerPoint()),this.addAvailableComponent(n)}applyCustomerPoint(){let e=this.salesOrderData.Order.CustomerID,t=h.IsEmpty(e);this._orderProcessorService.reedemPointToDiscount(t)}handlingPromotionQuantity(e){let t=we(Me,this.salesOrderData.CartItems),i=t.findIndex(n=>n.VariantID==e.VariantID&&n.PromotionGift);i!==-1?t[i].Quantity+=e.Quantity?e.Quantity:1:t=[...t,e],this.salesOrderData.CartItems=t,this._orderDataService.pushNewValue(this.salesOrderData)}applyPromotionProduct(e){let t=e.Variant.DiscountAmount;return t&&(e.Price=e.UnitPriceOriginal-t),e}applyReward(e,t){if(t){let i=this.appConfigJson.ModuleSell.ProductNotes.CopyPromotionName;e.Discount=t.Discount,e.Price=t.OriginalPrice;let n=t.OriginalPrice-t.UnitPrice;e.Price=e.UnitPriceOriginal-n,e.UnitPrice=e.UnitPriceOriginal-n,e.PromotionGift=!0,e.PromotionID=t.PromotionID,e.Quantity=t.Quantity?t.Quantity:1,e.PriceTypeID=3,e.Cost+=t.ExtraCost,e.UnitCost+=t.ExtraCost,e.PriceNote=t.PromotionName,i&&(e.Note=`${e.Note?e.Note:""} ${t.PromotionName} `)}return e}addAvailableComponent(e){let t=e.Price!=0,i=this.appConfigJson.ModuleSell.SellProductComponentDefaultPrice,n=e.Variant;if(n.Component!=null&&n.Component.length>0)for(let r of n.Component){let c=new Ri;c.patchByVariant(r),c.Quantity=e.Quantity*r.Quantity,t&&!i&&(r.UnitPrice=0),c.Price=r.UnitPrice,this.pushNewItemToArray(c)}}pushNewItemToArray(e,t=!1){let i=this.salesOrderData.CartItems.findIndex(n=>n.VariantID==e.VariantID);if(e=this.applyPromotionProduct(e),i==-1||t)this.salesOrderData.CartItems.push(e);else{let n=this.appConfigJson.ModuleSell.QuickKey.NewRowBehaviour;if(n==2)this.salesOrderData.CartItems.push(e);else if(n==1)this._orderProcessorService.Data.posState==4?this.salesOrderData.CartItems.push(e):this.addingQuantityItem(i,e);else{if(!this.validatePrepaidPackage(e,i)){this.toastr.error("This prepaid package is already in the cart while editing. Please remove it first before adding again.","Cannot Add Item");return}this.addingQuantityItem(i,e)}}this._orderDataService.pushNewValue(this.salesOrderData),this.reApplyPromotionCoupon()}validatePrepaidPackage(e,t){let i=this.salesOrderData.CartItems[t],n=this._orderProcessorService.Data.posState,r=e.Variant.TypeID==10,c=h.IsNotEmpty(i.ID),u=!0;return n==2&&r&&c&&(u=!1),u}reApplyPromotionCoupon(){let e=this.salesOrderData.Order.CouponProvider,t=e=="Internal"||h.IsEmpty(e),i=this.salesOrderData.Order.PromotionCoupon,n=this.salesOrderData.Order.PromotionNote;h.IsNotEmpty(i)&&t&&this.promotionCouponService.RedeemCoupon(i,n,!1)}addingQuantityItem(e,t){let i=this.salesOrderData.CartItems.filter(u=>u.VariantID==t.VariantID),n=i.length,r=i.find(u=>!u.PromotionGift);this.salesOrderData.CartItems[e].PromotionGift&&n==1?this.salesOrderData.CartItems.push(t):(r.Quantity+=t.Quantity,r=this.applyPromotionProduct(r)),r&&(r=this.applyPriceBook(r))}validateCartItem(e){return e.Variant.CategoryTypeID==-1?(this.toastr.info(e.Variant.Name+" cannot be sold, check Category "+e.Variant.CategoryName+" settings","info"),!1):!(!this.validatePriceMinimum(e)||!this.validateSerialItem(e))}validatePriceMinimum(e){let t=!0,i=this.userRoleService.Data.PriceMinimum,n=this.appConfigJson.ModuleSell.ProductDialog.PriceMinimumTypeID;if(i){let r=0;switch(n){case 1:r=e.UnitPrice;break;case 2:r=e.UnitCost;break;case 3:r=e.UnitPriceMinimum;break}if(e.Price<r){t=!1;let c=h.StringFormat("You have no right to sell this item lower than {0}",this.decimalPipe.transform(r));alert(c)}}return t}validateSerialItem(e){let t=!0;if(e?.Serial?.length>0&&e.Variant.TypeID==4&&e.Quantity>0){let i=0;e?.Serial?.forEach(n=>{i+=n.Quantity}),i!=e.Quantity&&(this.toastr.error("Serial must be equal with the quantity","Error"),t=!1)}return t}applyPriceBook(e){let t=e.Variant.PriceBook!=null?e.Variant.PriceBook:[],i=this.findCustomerPricebook(t);if(t&&t.length!==0){let n=t.sort(function(r,c){return c.MinimumQuantity-r.MinimumQuantity}).filter(r=>e.Quantity>=r.MinimumQuantity&&r.MinimumQuantity!=0);n.length>0||h.IsNotEmpty(i)?h.IsNotEmpty(i)?e=this.applyPricebookToItem(e,i):e=this.applyPricebookToItem(e,n[0]):e=this.resetAppliedPricebook(e)}return e}resetAppliedPricebook(e){let t=this.appConfigJson.ModuleSell.ProductNotes,n=(e?.Variant?.PriceBook).find(r=>r.ID==e.PriceBookID);return h.IsNotEmpty(n)&&(e.Discount=e.Variant.PriceDiscount,e.PriceBookID=h.GuidEmpty,e.Price=e.Variant.UnitPrice,e.UnitPrice=e.Variant.UnitPrice,e.PriceTypeID=0,e=this.applyPromotionProduct(e),e=this.removePromotionNote(e)),e}removePromotionNote(e){let t=this.appConfigJson.ModuleSell.ProductNotes;if(this.appConfigJson?.ModuleSell?.Pricebook?.PricebookVisible&&(e.Note=e.Note?.replace(e.PriceNote,""),e.PriceNote=""),t.CopyPromotionName){let n=e.Variant?.PriceNote;e.Note=`${n||""} ${e.Note?e.Note:""}`,e.PriceNote=n}return e}applyPricebookToItem(e,t){return e.Discount=t.PriceDiscount,e.UnitPrice=t.UnitPrice,e.PriceBookID=t.ID,e.Price=t.UnitPrice,e.PriceTypeID=2,e=this.assignItemNote(e,t),e}assignItemNote(e,t){return this.appConfigJson?.ModuleSell?.Pricebook?.PricebookVisible?(e.Note?.includes(e.PriceNote)?e.Note=e.Note?.replace(e.PriceNote,t.Name):e.Note=`${t.Name} ${e.Note?e.Note:""}`,e.PriceNote=t.Name):(e.Note="",e.PriceNote=""),e}findCustomerPricebook(e=[]){let t=this._customerHttpService.Data,i;return t&&(i=e.find(n=>n.ID==t.PricebookID)),i}static \u0275fac=function(t){return new(t||o)(g(co),g($),g(L),g(H),g(Je),g(xe),g(Tt),g(Le),g(J))};static \u0275prov=I({token:o,factory:o.\u0275fac,providedIn:"root"})};function ar(o,e){if(o&1&&(a(0,"div",9)(1,"div",4),_(2,"input",10),s()()),o&2){let t=d();l(2),p("formControl",t.searchControl)}}function sr(o,e){if(o&1){let t=x();a(0,"tr")(1,"td"),m(2),s(),a(3,"td"),m(4),s(),a(5,"td",11),m(6),y(7,"number"),s(),a(8,"td",11),m(9),y(10,"number"),s(),a(11,"td",12)(12,"button",13),b("click",function(){let n=C(t).$implicit,r=d();return v(r.onSelectReward(n))}),m(13,"Apply"),s()()()}if(o&2){let t=e.$implicit;l(2),D(t.VariantName),l(2),D(t.VariantCode),l(2),D(M(7,4,t.OriginalPrice)),l(3),D(M(10,6,t.UnitPrice))}}var Fi=class o{constructor(e,t,i,n,r,c){this._dialogRef=e;this._matDialog=t;this._shoppingCartService=i;this._promotionEventService=n;this._toastr=r;this.data=c;this.selectedPromotion=this._promotionEventService.selectedPromotion}modalConfig=new K;selectedPromotion;rewards$;searchControl=new ze;ngOnInit(){this.modalConfig.title="Select a Reward",this.modalConfig.hideFooter=!0,this.initRewards(!0)}initRewards(e){this.rewards$=this.searchControl.valueChanges.pipe(Zt(""),pt(e?0:500),Ae(),z(t=>{let i;return i=Ee(this.data.rewards).pipe(q(n=>n.filter(r=>this.findKeywordInValue(t,r?.VariantCode)||this.findKeywordInValue(t,r?.VariantName)))),e=!0,i}))}findKeywordInValue(e,t){return t?.toUpperCase()?.indexOf(e?.toUpperCase())>-1}onSelectReward(e){e.PromotionType=this.data.promotion.TypeID,this._shoppingCartService.addCartItemById(e.VariantID,e,!0).then(()=>{this._matDialog.closeAll(),this._promotionEventService.pushNewValue(this._promotionEventService.Data),this.showToastAppliedPromo()})}showToastAppliedPromo(){this._toastr.success("Applied "+this.selectedPromotion.Name+" to order!","Applied successfully!")}close(){this._dialogRef.close()}static \u0275fac=function(t){return new(t||o)(S(Y),S(De),S(Et),S(Te),S(H),S(ce))};static \u0275cmp=R({type:o,selectors:[["POS-modal-select-item"]],standalone:!1,decls:22,vars:9,consts:[[3,"onCancel","onClose","config"],[1,"container"],["class","row mb-3",4,"ngIf"],[1,"row"],[1,"col-12"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],[4,"ngFor","ngForOf"],[1,"row","mb-3"],["type","text","placeholder","Type to filter reward",1,"form-control",3,"formControl"],[1,"text-end"],[1,"text-center"],[1,"btn","btn-sm","btn-success",3,"click"]],template:function(t,i){t&1&&(a(0,"modal-material",0),b("onCancel",function(){return i.close()})("onClose",function(){return i.close()}),a(1,"content")(2,"div",1),f(3,ar,3,1,"div",2),a(4,"div",3)(5,"div",4)(6,"table",5)(7,"thead",6)(8,"tr")(9,"th",7),m(10,"Name"),s(),a(11,"th",7),m(12,"Code"),s(),a(13,"th",7),m(14,"Price"),s(),a(15,"th",7),m(16,"Promo"),s(),_(17,"th",7),s()(),a(18,"tbody"),f(19,sr,14,8,"tr",8),y(20,"async"),y(21,"sortBy"),s()()()()()()()),t&2&&(p("config",i.modalConfig),l(3),p("ngIf",(i.data==null||i.data.rewards==null?null:i.data.rewards.length)>5),l(16),p("ngForOf",ht(21,5,M(20,3,i.rewards$),"desc","VariantCode")))},dependencies:[he,oe,Se,Ce,Ct,Z,qe,J,bt],styles:[".table-scroll[_ngcontent-%COMP%]{max-height:400px;overflow-y:auto}table[_ngcontent-%COMP%]{max-width:600px!important;overflow-x:hidden}"]})};function lr(o,e){if(o&1&&(B(0),a(1,"div",13)(2,"div",7),_(3,"input",14),s()(),j()),o&2){let t=d();l(3),p("formControl",t.searchCtrl)}}function cr(o,e){o&1&&(B(0),a(1,"th",15),m(2,"Qty"),s(),j())}function mr(o,e){o&1&&_(0,"th",10)}function pr(o,e){if(o&1){let t=x();B(0),a(1,"td")(2,"input",17),V("ngModelChange",function(n){C(t);let r=d().$implicit;return N(r.Quantity,n)||(r.Quantity=n),v(n)}),s()(),j()}if(o&2){let t=d().$implicit;l(2),k("ngModel",t.Quantity)}}function dr(o,e){if(o&1){let t=x();a(0,"td",18)(1,"button",19),b("click",function(){C(t);let n=d().$implicit,r=d();return v(r.onApplyReward(n))}),m(2,"Apply"),s()()}}function ur(o,e){if(o&1&&(a(0,"tr")(1,"td"),m(2),s(),a(3,"td"),m(4),s(),a(5,"td",16),m(6),y(7,"number"),s(),a(8,"td",16),m(9),y(10,"number"),s(),f(11,pr,3,1,"ng-container",11)(12,dr,3,0,"ng-template",null,1,be),s()),o&2){let t=e.$implicit,i=U(13),n=d();l(2),D(t.VariantName),l(2),D(t.VariantCode),l(2),D(M(7,6,t.OriginalPrice)),l(3),D(M(10,8,t.UnitPrice)),l(2),p("ngIf",n.rewardQuantity>1)("ngIfElse",i)}}var Li=class o{constructor(e,t,i,n,r,c){this.data=e;this.shoppingCartService=t;this.promotionEventService=i;this.dialogRef=n;this.matDialog=r;this.toastr=c;this.searchCtrl=new ze,this.rewardQuantity=e.rewardQuantity,this.sourceRewards=[...e.rewards]}modalConfig;rewards$;rewardQuantity;rewards;sourceRewards=[];searchCtrl;ngOnInit(){this.initModalConfig(),this.initSearchCtrl(!0)}initModalConfig(){this.modalConfig=new K,this.modalConfig.title="Select a Reward",this.rewardQuantity<2&&(this.modalConfig.hideFooter=!0)}initSearchCtrl(e){this.rewards$=this.searchCtrl.valueChanges.pipe(Zt(""),pt(e?0:500),Ae(),z(t=>{let i;return i=Ee(this.sourceRewards).pipe(q(n=>(n.length===1&&(n[0].Quantity=this.rewardQuantity),n)),q(n=>n.filter(r=>this.findKeywordInValue(t,r?.VariantCode)||this.findKeywordInValue(t,r?.VariantName)))),e=!1,i}),ae(t=>{this.rewards=t}))}findKeywordInValue(e,t){return t?.toUpperCase()?.indexOf(e.toUpperCase())>-1}onApplyReward(e){this.addRewardToShoppingCart(e)}onClose(){this.dialogRef.close()}onOk(){this.calculateRewardQty()>this.rewardQuantity?this.toastr.warning("Product reward exceeds the maximum amount earned","Warning"):[...this.rewards].filter(i=>i.Quantity>0).forEach(i=>{this.addRewardToShoppingCart(i)})}calculateRewardQty(){let e=0;return this.rewards.forEach(t=>{e+=t.Quantity?t.Quantity:0}),e}addRewardToShoppingCart(e){e.PromotionType=this.data.promotion.TypeID,this.shoppingCartService.addCartItemById(e.VariantID,e,!0).then(()=>{this.matDialog.closeAll(),this.promotionEventService.pushNewValue(this.promotionEventService.Data)})}static \u0275fac=function(t){return new(t||o)(S(ce),S(Et),S(Te),S(Y),S(De),S(H))};static \u0275cmp=R({type:o,selectors:[["app-modal-quantity-reward"]],standalone:!1,decls:27,vars:12,consts:[["APPLY",""],["APPLY_BUTTON",""],[3,"onCancel","onOk","onClose","config"],[1,"ms-3"],[1,"container"],[4,"ngIf"],[1,"row","table-scroll"],[1,"col-12"],[1,"table","table-bordered"],[1,"thead-light"],["scope","col"],[4,"ngIf","ngIfElse"],[4,"ngFor","ngForOf"],[1,"row","mb-3"],["type","text","placeholder","Type to filter reward",1,"form-control",3,"formControl"],["scope","col",2,"width","66px"],[1,"text-end"],["type","text","autoNum","","min","0",1,"form-control",3,"ngModelChange","ngModel"],[1,"text-center"],[1,"btn","btn-sm","btn-success",3,"click"]],template:function(t,i){if(t&1){let n=x();a(0,"modal-material",2),b("onCancel",function(){return C(n),v(i.onClose())})("onOk",function(){return C(n),v(i.onOk())})("onClose",function(){return C(n),v(i.onClose())}),a(1,"header")(2,"small",3),m(3),s()(),a(4,"content")(5,"div",4),f(6,lr,4,1,"ng-container",5),a(7,"div",6)(8,"div",7)(9,"table",8)(10,"thead",9)(11,"tr")(12,"th",10),m(13,"Name"),s(),a(14,"th",10),m(15,"Code"),s(),a(16,"th",10),m(17,"Price"),s(),a(18,"th",10),m(19,"Promo"),s(),f(20,cr,3,0,"ng-container",11)(21,mr,1,0,"ng-template",null,0,be),s()(),a(23,"tbody"),f(24,ur,14,10,"tr",12),y(25,"async"),y(26,"sortBy"),s()()()()()()()}if(t&2){let n=U(22);p("config",i.modalConfig),l(3),P(" ( ",i.rewardQuantity," products reward ) "),l(3),p("ngIf",(i.sourceRewards==null?null:i.sourceRewards.length)>5),l(14),p("ngIf",i.rewardQuantity>1)("ngIfElse",n),l(4),p("ngForOf",ht(26,8,M(25,6,i.rewards$),"desc","VariantCode"))}},dependencies:[he,oe,Se,Ce,Pe,Ct,Z,yt,qe,J,bt],encapsulation:2})};var Te=class o{constructor(e,t,i,n,r,c,u,O,A){this._orderDataService=e;this._outletService=t;this._invoiceCalculatorService=i;this._dialog=n;this._httpService=r;this._posService=c;this._toastr=u;this._signalrService=O;this.decimalPipe=A;this.previousQuantity=0,this.previousTotalEligible=0,this.subscribeNotification(),this._posService.Data$.subscribe(W=>{this.taxes=W.Taxes}),this._outletService.Data$.subscribe(W=>{this.loadPromotions(W.Promotion)}),this._orderDataService.Data$.pipe(re(W=>{this.salesOrderData=W;let ge=this.calculateOrderReward(W.getRewards()),rn=this.calculateOrderReward(this.previousRewards);return this.previousQuantity!=W.TotalQuantity||rn<ge||this.isRestroreOrder}),pt(100)).subscribe(W=>{this.isRestroreOrder=!1,this.checkQtyPromotion(),this.applyQuantityPromotion(),this.previousRewards=[...W.getRewards()]}),this._invoiceCalculatorService.Data$.subscribe(W=>{this.checkEligiblePromotionWithMinSpend()})}_Data=new fe([]);get Data(){return this._Data.getValue()}Data$=this._Data.asObservable();selectedPromotion=null;onClickToastPromo=new Ne;previousQuantity;salesOrderData;orderDataBeforePromotion;taxes=[];previousTotalEligible;previousRewards=[];isRestroreOrder=!1;calculateOrderReward(e){let t=0;return e.length>0&&(t=e.map(i=>i.Quantity).reduce((i,n)=>i+n)),t}checkQtyPromotion(){let e=this._orderDataService.Data;this.checkEligibleQtyPromotion(e.CartItems),this.checkEligibleTierPromotion(e.CartItems),this.previousQuantity=e.TotalQuantity}subscribeNotification(){this._signalrService.OnPromotionEventChange.pipe(_e(),z(()=>{let e=this._outletService.Data?.RegisterID;return this.getPromotions(e)})).subscribe(()=>{this._toastr.info("Promotion Event Updated","Promotion Update")})}getPromotions(e){return this._httpService.get(Q.GetListPromotion,[{key:"RegisterID",value:e}]).pipe(ae(t=>{this.loadPromotions(t)}))}loadPromotions(e){let t=this.getPromotionDesc(e);this.pushNewValue(t),this.checkQtyPromotion(),this.checkEligiblePromotionWithMinSpend()}pushNewValue(e){this.showToastEligiblePromotion(),this._Data.next(e)}checkSelectedPromotionRequirement(e){this.selectedPromotion!=null&&this.selectedPromotion.TypeID==e&&this.Data.find(i=>i.ID===this.selectedPromotion.ID)?.Eligible===!1&&(this._dialog.open(wi,{id:"modal-promotion-confirm",data:{message:"Order will be restored to before the promotion is applied"},disableClose:!0}),this.isRestroreOrder=!0)}restoreOrder(){this._orderDataService.pushNewValue(this.orderDataBeforePromotion),this.selectedPromotion=null}getPromotionDesc(e=[]){return e?.map(i=>(i.Description=this.generatePromotionDesc(i),i))}checkEligiblePromotionWithMinSpend(){let e=this._invoiceCalculatorService.Data,t=this.Data?.filter(n=>(n.TypeID===1||n.TypeID==3)&&!this.checkExpiredPromotion(n)).map(n=>(e>=n.MinimumAmount?n.Eligible=!0:n.Eligible=!1,n)),i=this.mappingEligiblePromotion(t);this.pushNewValue(i),this.checkSelectedPromotionRequirement(1),this.checkSelectedPromotionRequirement(3)}checkEligibleQtyPromotion(e){let t=0,i=this.Data?.filter(r=>r.TypeID===2&&!this.checkExpiredPromotion(r)).map(r=>(r.Eligible=!1,r.ListVariant.length>0?(t=this.getQuantityByRequirementType(e,"variant",r.ListVariant),t>=r.MinimumAmount&&(r.Eligible=!0)):r.ListCategory.length>0?(t=this.getQuantityByRequirementType(e,"category",r.ListCategory),t>=r.MinimumAmount&&(r.Eligible=!0)):this.salesOrderData.TotalQuantity>=r.MinimumAmount&&(r.Eligible=!0),r)),n=this.mappingEligiblePromotion(i);this.pushNewValue(n)}checkEligibleTierPromotion(e){let t,i=this.Data?.filter(r=>r.TypeID===5&&!this.checkExpiredPromotion(r)).map(r=>(r.Eligible=!1,r.ListVariant.length>0?t=this.getQuantityByRequirementType(e,"variant",r.ListVariant):r.ListCategory.length>0?t=this.getQuantityByRequirementType(e,"category",r.ListCategory):t=this.salesOrderData.TotalQuantity,r.PromotionTieredQuantity.forEach(c=>{t>=c.Quantity&&(r.Eligible=!0)}),r)),n=this.mappingEligiblePromotion(i);this.pushNewValue(n)}getQuantityByRequirementType(e,t,i){let n=0,r;return t=="variant"?e.forEach(c=>{r=i.findIndex(u=>u.ID===c.VariantID),r!==-1&&(n+=c.Quantity)}):e.forEach(c=>{c.Variant&&(r=i.findIndex(u=>u.ID===c.Variant.CategoryID),r!==-1&&(n+=c.Quantity))}),n}mappingEligiblePromotion(e=[]){let t=this.Data;if(e?.length>0){let i;t=this.Data?.map(n=>(i=e.findIndex(r=>r.ID==n.ID),i!==-1&&(n=e[i]),n))}return t}checkExpiredPromotion(e){let t=new Date,i=new Date(e.StartDate),r=(h.IsEmpty(e.StartTime)?"00:00:00":e.StartTime).split(":").map(A=>parseInt(A));i.setHours(r[0],r[1],r[2]);let c=new Date(e.ExpirationDate),O=(h.IsEmpty(e.EndTime)?"23:59:59":e.EndTime).split(":").map(A=>parseInt(A));return c.setHours(O[0],O[1],O[2]),!(t.getTime()>=i.getTime()&&t.getTime()<=c.getTime())}showToastEligiblePromotion(){let e=this.getTotalEligiblePromotion(),t=h.IsNotEmpty(this.salesOrderData.Order.ID);this.previousTotalEligible!==e&&e>0&&!t&&this._toastr.info(e+" promotion(s) can be applied!","Promo available!",{timeOut:2e4}).onTap.pipe(He(1)).subscribe(()=>{this.onClickToastPromo.next(!0)}),this.previousTotalEligible=e}getTotalEligiblePromotion(){return this.Data?.filter(t=>t.Eligible).length}generatePromotionDesc(e){let t="";switch(e.TypeID){case 2:t+="Minimum "+this.decimalPipe.transform(e.MinimumAmount)+" ",e.ListVariant.length>0?(t=t+" piece of ",t+=this.generateItemListDescription(e.ListVariant)):e.ListCategory.length>0?(t+="from category ",t+=this.generateItemListDescription(e.ListCategory)):t+="items";break;case 1:t+="Minimum spend Rp. "+this.decimalPipe.transform(e.MinimumAmount);break;case 3:t+=`Apply
3
3
  ${e.Discount1!==0?"discount1 = "+e.Discount1+"%":""}
4
4
  ${e.Discount1!==0&&e.Discount2!==0?" and ":""}
@@ -1 +1 @@
1
- import{a}from"./chunk-5233FXFY.js";import{K as o}from"./chunk-EDB2BAIG.js";var s=class extends a{constructor(t,e,r,n){super(t);this.httpService=e;this.formDataAPI=r;this.route=n;let p=this.route.snapshot.queryParams;this.menuData$.pipe(o(()=>this.httpService.post(`/api/${this.formDataAPI}`,p))).subscribe(i=>{this.data=i,this.postBindForm(i)})}data={};get formData(){return this.data.Form}set formData(t){this.data.Form=t}get options(){return this.data.Options?this.data.Options:{}}get Roles(){return this.data.Roles?this.data.Roles:{}}postBindForm(t){}onSubmit(t,e=!1){this.preSubmitForm(),this.httpService.post(`/api/${t}`,this.formData).subscribe({next:r=>{this.onSubmitSuccess(r)},error:r=>{this.onSubmitError(r)}})}compare(t,e,r){return(t<e?-1:1)*(r?1:-1)}preSubmitForm(){}onSubmitSuccess(t){}onSubmitError(t){}};export{s as a};
1
+ import{a}from"./chunk-4NCDQTGK.js";import{K as o}from"./chunk-EDB2BAIG.js";var s=class extends a{constructor(t,e,r,n){super(t);this.httpService=e;this.formDataAPI=r;this.route=n;let p=this.route.snapshot.queryParams;this.menuData$.pipe(o(()=>this.httpService.post(`/api/${this.formDataAPI}`,p))).subscribe(i=>{this.data=i,this.postBindForm(i)})}data={};get formData(){return this.data.Form}set formData(t){this.data.Form=t}get options(){return this.data.Options?this.data.Options:{}}get Roles(){return this.data.Roles?this.data.Roles:{}}postBindForm(t){}onSubmit(t,e=!1){this.preSubmitForm(),this.httpService.post(`/api/${t}`,this.formData).subscribe({next:r=>{this.onSubmitSuccess(r)},error:r=>{this.onSubmitError(r)}})}compare(t,e,r){return(t<e?-1:1)*(r?1:-1)}preSubmitForm(){}onSubmitSuccess(t){}onSubmitError(t){}};export{s as a};
@@ -1 +1 @@
1
- import{a as Ce}from"./chunk-JK75ENMS.js";import{a as Me}from"./chunk-63P7EQO4.js";import{a as Pe}from"./chunk-B7DKFLLG.js";import{a as ve}from"./chunk-XUP2FY5D.js";import{ga as be,ha as Se}from"./chunk-JLOQTYOI.js";import{a as ue}from"./chunk-UM35BDBC.js";import"./chunk-GIKR6Y2K.js";import{D as he,b as de,h as me,o as fe}from"./chunk-LNLGRZBB.js";import{a as T,c as h}from"./chunk-DMSBV63C.js";import{a as ge}from"./chunk-MAFIFJSJ.js";import{a as M,d as I}from"./chunk-MP62IGYR.js";import{a as ce}from"./chunk-J6RZLLDH.js";import{$ as H,$a as c,E,Ib as o,Jb as s,Kb as p,Ld as oe,Nd as ae,Od as b,Pd as se,Qb as C,Qd as le,Rb as Q,Rd as B,Td as pe,Uc as ie,Vb as Z,Wa as J,Wc as ne,d as G,da as D,db as v,ec as m,fc as V,gc as $,hd as re,ja as d,ka as y,kb as q,lb as x,ma as _,na as l,pc as K,qb as j,qc as X,ub as Y,vb as f,xb as W,xc as ee,zb as F,zc as te}from"./chunk-EDB2BAIG.js";import"./chunk-7DCB7DB2.js";var r=class e{constructor(i,t){this.authService=i;this.router=t}canLoad(i,t){return this.authService.isTokenExpired()?(this.authService.returnUrl=this.getUrlRedirect(t),this.router.navigate(["/"]),!1):!0}getUrlRedirect(i){let t="/menu";i.forEach(a=>t+=`/${a.path}`);let n=this.router.getCurrentNavigation().extractedUrl.queryParams;return Object.keys(n).forEach((a,g)=>{g==0?t=`${t}?${a}=${n[a]}`:t=`${t}&${a}=${n[a]}`}),t}static \u0275fac=function(t){return new(t||e)(_(h),_(b))};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var w=class e{constructor(i){this.toastrService=i;this.initPermissionToastr=!1}isPermissionGranted;initPermissionToastr;initPermission(){try{this.initPermissionToastr||Notification.requestPermission().then(t=>{this.isPermissionGranted=!1,t=="granted"&&(this.isPermissionGranted=!0),this.initPermissionToastr=!0})}catch(i){console.error(i)}}showAlert(i,t,n,u){let a=6e4;if(this.isPermissionGranted)try{let g=new Notification(t,{body:i,icon:u});g.onerror=R=>{this.toastrService.info(this.setBody(i,n),t,{timeOut:a,enableHtml:this.hasUrl(n)})}}catch(g){console.error(g)}else this.toastrService.info(this.setBody(i,n),t,{timeOut:a,enableHtml:this.hasUrl(n)})}setBody(i,t){return this.hasUrl(t)&&(i=`<a href="${t}" target="_blank" class="ps-0">${i}</a>`),i}hasUrl(i){return!!(i&&i.length!==0)}static \u0275fac=function(t){return new(t||e)(_(pe))};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var _e=[{T:"Dashboard",U:"/menu/Dashboard",I:"fa-solid fa-chart-pie"},{T:"Products",U:"/menu/Products",I:"fa-solid fa-tag"},{T:"Estimate",U:"/menu/Estimate",I:"fa-solid fa-clipboard"},{T:"Sell",U:"/menu/Sell",I:"fa-solid fa-cart-shopping"},{T:"Shift",U:"/menu/Shift/",I:"fa-solid fa-user-clock"},{T:"Reports",U:"/menu/Reports",I:"fa-solid fa-chart-area"},{T:"Contacts",U:"/menu/Contacts",I:"fas fa-address-book"},{T:"Orders",U:"/menu/Orders",I:"fas fa-file-invoice"},{T:"Payment",U:"/menu/Payment",I:"fas fa-money-bill-alt"},{T:"Debt",U:"/menu/Debt",I:"fas fa-dollar-sign"},{T:"Inventory",U:"/menu/Inventory",I:"fas fa-archive"},{T:"Adjustment",U:"/menu/Adjustment",I:"fas fa-scanner-gun"},{T:"Buy",U:"/menu/Buy",I:"fa-solid fa-cart-arrow-down"},{T:"Logistics",U:"/menu/Logistics",I:"fas fa-truck"},{T:"Fulfillment",U:"/menu/Fulfillment",I:"fas fa-dolly"},{T:"Manufacture",U:"/menu/Manufacture",I:"fas fa-industry"},{T:"Prepaid Package",U:"/menu/Prepaid_Package",I:"fa-solid fa-id-card"},{T:"Promotion",U:"/menu/Promotion",I:"fas fa-bullhorn"},{T:"Users",U:"/menu/Users",I:"fas fa-user"},{T:"Outlets",U:"/menu/Outlets",I:"fas fa-map-marker-alt"},{T:"Setup",U:"/menu/Setup",I:"fas fa-gear"},{T:"Developer",U:"/menu/Developer",I:"fas fa-code"}];var k=class e{role=l(I);authService=l(h);menu=_e;filteredMenu=[];initFilteredMenu(){this.filteredMenu=this.menu.filter(i=>i.T==="Dashboard"?this.role.dashboard.View:i.T==="Products"?this.role.product.View:i.T==="Estimate"?this.role.estimate.Create:i.T==="Sell"?this.role.sell.Create:i.T==="Shift"?this.role.sell.Create:i.T==="Reports"?this.role.report.View:i.T==="Contacts"?this.role.contact.View:i.T==="Orders"?this.role.order.View:i.T==="Payment"?this.role.payment.View:i.T==="Debt"?this.role.debt.View:i.T==="Inventory"?this.role.inventory.View:i.T==="Adjustment"?this.role.adjustment.View:i.T==="Buy"?this.role.buy.Create:i.T==="Logistics"?this.role.logistic.View:i.T==="Manufacture"?this.role.manufacture.View:i.T==="Fulfillment"?this.role.fulfillment.View:i.T==="Prepaid Package"?this.role.prepaidPackage.View:i.T==="Promotion"?this.role.promotion.View:i.T==="Users"?this.role.users.View:i.T==="Outlets"?this.role.outlets.View:i.T==="Setup"?this.role.setup.View:i.T==="Developer"?this.role.developer.View:!0),this.filterBySubscriptionStatus()}filterBySubscriptionStatus(){let i=this.authService.getSubscriptionStatus();this.filteredMenu=this.filteredMenu.filter(t=>{switch(i){case 2:return t.T=="Sell"||t.T=="Shift";case 3:return!1;default:return!0}})}static \u0275fac=function(t){return new(t||e)};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var Oe=[{T:"My Profile",U:"Profile/Main/My_Profile",I:"fas fa-user"},{T:"My Subscription",U:"Profile/Main/My_Subscription",I:"fa-solid fa-credit-card"},{T:"Notification",U:"Profile/Notification/Push",I:"fas fa-bell"},{T:"My Sales",U:"Profile/Main/My_Sales",I:"fas fa-history"}];var A=class e{role=l(I);authService=l(h);filteredMenu=[];initFilteredMenu(){let i=this.authService.getSubscriptionStatus();this.filteredMenu=Oe.filter(t=>t.T=="My Profile"?this.role.profile.View:t.T=="My Subscription"?this.role.profile.Subscription:t.T=="Notification"?this.role.profile.Notification&&i!=2&&i!=3:t.T=="My Sales"?i!=2&&i!=3:!0)}static \u0275fac=function(t){return new(t||e)};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var Le=(e,i)=>({"full-container":e,"subscription-bar-visible":i}),Ue=e=>[e];function Ne(e,i){if(e&1&&(o(0,"a",35),p(1,"i",36),o(2,"span"),m(3),s()()),e&2){let t=i.$implicit;f("routerLink",t==null?null:t.U),c(),F((t==null?null:t.I)+" me-2"),c(2),V(t==null?null:t.T)}}function Re(e,i){if(e&1&&(o(0,"li",37,0)(2,"a",38),p(3,"i"),o(4,"p"),m(5),s()()()),e&2){let t=i.$implicit,n=Q();f("routerLinkActiveOptions",n.isActiveMatchOptions),Y("data-cy",t==null?null:t.T),c(2),f("matTooltip",n.toggleSideMenu?t==null?null:t.T:"")("routerLink",K(7,Ue,t==null?null:t.U)),c(),F(t==null?null:t.I),c(2),V(t==null?null:t.T)}}var P=class e{constructor(i,t,n,u,a,g,R,z){this.toggleSidebar=i;this.signalRClientService=t;this.notificationAlertService=n;this.router=u;this.authService=a;this.intercomService=g;R.initFilteredMenu(),z.initFilteredMenu(),this.leftSidebarMenu=R.filteredMenu,this.topMenu=z.filteredMenu,this.accountInfo=JSON.parse(localStorage.getItem("AccountInfo")),this.toggleSidebar.toggleState$.subscribe(xe=>this.isNavOpen=xe),this.destroy$=new G,this.initNotificationPermission()}isActiveMatchOptions={matrixParams:"subset",queryParams:"subset",paths:"subset",fragment:"exact"};toggleSideMenu=!1;isNavOpen;destroy$;activeMenu;appVersion=ce.version;currentSubStatus;subsStatusEnum=T;isFullContainer=!1;isHideIntercomLauncher;leftSidebarMenu;topMenu;accountInfo;ngOnInit(){this.subscribeToPushNotification(),this.getCurrentSubscriptionStatus(),this.initFullContainer()}initFullContainer(){this.router.events.pipe(E(i=>i instanceof oe),H(null),D(this.destroy$)).subscribe(i=>{this.isFullContainer=!1,(this.router.url.includes("Sell")&&!this.router.url.includes("v2")&&!this.router.url.includes("Offline")||this.router.url.includes("Buy")||this.router.url.includes("menu/Estimate")||this.router.url.includes("Transfer_Order/Form")||this.router.url.includes("Adjustment/Archive/Form")||this.router.url.includes("Job_Order/Archive/Form")||this.router.url.includes("/menu/Debt/Debt/Join_Invoice/Form")||this.router.url.includes("/menu/Debt/Debt/Join_Bill/New_Join_Bill"))&&(this.isFullContainer=!0)})}initNotificationPermission(){this.notificationAlertService.initPermission()}getCurrentSubscriptionStatus(){this.currentSubStatus=this.authService.getSubscriptionStatus()}subscribeToPushNotification(){let i=localStorage.getItem("NotificationOutletID");M.IsNotEmpty(i)&&M.isGuid(i)?this.signalRClientService.SubscribeGroup(i):this.signalRClientService.startConnection(),this.signalRClientService.OnReceivePushNotification.pipe(D(this.destroy$),E(t=>M.IsNotEmpty(t))).subscribe(t=>{if(M.IsNotEmpty(t)){let n=JSON.parse(t),u="//res.cloudinary.com/pos/image/upload/v1657006791/icons/info-new.png";M.IsNotEmpty(n.Icon)&&(u=n.Icon),this.notificationAlertService.showAlert(n.Body,n.Header,n.URL,u)}})}ngAfterViewInit(){this.intercomService.inititalizeIntercom()}toggleMenu(){this.toggleSideMenu=!this.toggleSideMenu}logout(){this.authService.logout()}isNotEmpty(i){return M.IsNotEmpty(i)}onShowDropdown(){this.isHideIntercomLauncher=this.intercomService.isHideLauncher()}chatToggleChange(){this.isHideIntercomLauncher==!1?this.intercomService.hideLauncher():this.intercomService.showLauncher(),this.onShowDropdown()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(t){return new(t||e)(v(ve),v(ue),v(w),v(b),v(h),v(ge),v(k),v(A))};static \u0275cmp=q({type:e,selectors:[["POS-menu-master"]],standalone:!1,decls:52,vars:19,consts:[["rla","routerLinkActive"],[1,"wrapper"],["data-color","blue",1,"sidebar",3,"ngClass"],[1,"btn-minimize","d-lg-block","d-none","p-0","border-0","bg-white",3,"click"],[1,"fa-solid",3,"ngClass"],[1,"logo"],[1,"navbar","dropdown","bg-transparent","border-0"],["data-cy","companyName","data-bs-toggle","dropdown","aria-expanded","false","matTooltipPosition","above",1,"simple-text","text-start","dropdown-toggle","d-flex","align-items-center","justify-content-center",2,"cursor","pointer",3,"click","matTooltip"],[1,"dropdown-menu"],[1,"dropdown-header","text-dark","border-bottom"],[1,"divider","m-0"],["class","dropdown-item h5",3,"routerLink",4,"ngFor","ngForOf"],[1,"dropdown-item","h5",2,"cursor","pointer"],[1,"d-flex","align-items-center","justify-content-between"],[1,"fa-solid","fa-comment-dots","me-2"],[1,"checkbox_toggle","ms-3",3,"click"],["type","checkbox","id","chatToggle","name","ChatToggle",3,"ngModelChange","ngModel"],["for","chatToggle",1,"position-relative","rounded-pill","pointer"],[1,"dropdown-item","h5",2,"cursor","pointer",3,"click"],["aria-hidden","true",1,"fa-solid","fa-sign-out-alt","me-2"],[1,"divider"],[1,"dropdown-header","border-top"],["target","_blank",1,"dropdown-item","h5","changelog",3,"href"],["aria-hidden","true",1,"fa-solid","fa-sparkles","me-2"],[1,"fa-solid","fa-circle-exclamation","ms-2",2,"font-size","16px"],["target","_blank","href","http://support.dealpos.com",1,"dropdown-item","h5"],["aria-hidden","true",1,"fa-solid","fa-book","me-2"],["target","_blank","href","https://www.dealpos.app/",1,"dropdown-item","h5"],["aria-hidden","true",1,"fa-solid","fa-table-cells-large","me-2"],["target","_blank","href","http://blog.dealpos.com",1,"dropdown-item","h5"],["aria-hidden","true",1,"fa-brands","fa-blogger","me-2"],[1,"sidebar-wrapper"],[1,"nav"],["routerLinkActive","active",3,"routerLinkActiveOptions",4,"ngFor","ngForOf"],["id","full-container",1,"main-panel",3,"ngClass"],[1,"dropdown-item","h5",3,"routerLink"],["aria-hidden","true"],["routerLinkActive","active",3,"routerLinkActiveOptions"],["matTooltipPosition","above",1,"nav-link","position-relative","d-block",3,"matTooltip","routerLink"]],template:function(t,n){t&1&&(o(0,"div",1)(1,"div",2)(2,"button",3),C("click",function(){return n.toggleMenu()}),p(3,"i",4),s(),o(4,"div",5)(5,"div",6)(6,"a",7),C("click",function(){return n.onShowDropdown()}),m(7),ee(8,"limitText"),s(),o(9,"div",8)(10,"div",9),m(11),s(),p(12,"div",10),j(13,Ne,4,4,"a",11),o(14,"a",12)(15,"div",13)(16,"div"),p(17,"i",14),o(18,"span"),m(19,"Chat Support"),s()(),o(20,"div",15),C("click",function(a){return a.stopPropagation()}),o(21,"input",16),C("ngModelChange",function(){return n.chatToggleChange()}),s(),p(22,"label",17),s()()(),o(23,"a",18),C("click",function(){return n.logout()}),p(24,"i",19),o(25,"span"),m(26,"Log Out"),s()(),p(27,"div",20),o(28,"div",21),m(29," Links "),s(),o(30,"a",22),p(31,"i",23),o(32,"span"),m(33,"What's New"),p(34,"i",24),s()(),o(35,"a",25),p(36,"i",26),o(37,"span"),m(38,"Help Center"),s()(),o(39,"a",27),p(40,"i",28),o(41,"span"),m(42,"App Store"),s()(),o(43,"a",29),p(44,"i",30),o(45,"span"),m(46,"Company Blog"),s()()()()(),o(47,"div",31)(48,"ul",32),j(49,Re,6,9,"li",33),s()()(),o(50,"div",34),p(51,"router-outlet"),s()()),t&2&&(W("nav-open",n.isNavOpen),c(),f("ngClass",n.toggleSideMenu?"collapses":""),c(2),f("ngClass",n.toggleSideMenu?"fa-angle-left cursor":"fa-angle-right cursor"),c(3),f("matTooltip",n.accountInfo==null?null:n.accountInfo.BrandName),c(),$(" ",te(8,13,n.accountInfo==null?null:n.accountInfo.BrandName,12)," "),c(4),$("",n.accountInfo==null?null:n.accountInfo.UserName," "),c(2),f("ngForOf",n.topMenu),c(8),f("ngModel",!n.isHideIntercomLauncher),c(9),Z("href","https://changelog.dealpos.com/?categories=cat_gAZdRhBYU7QVl&view=complete&v=",n.appVersion,"",J),c(19),f("ngForOf",n.leftSidebarMenu),c(),f("ngClass",X(16,Le,n.isFullContainer,n.isNotEmpty(n.currentSubStatus)&&n.currentSubStatus!==n.subsStatusEnum.PAID)))},dependencies:[be,ae,se,le,de,me,fe,ie,ne,Me],styles:['.sidebar[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .nav-link[_ngcontent-%COMP%], body[_ngcontent-%COMP%] > .navbar-collapse[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .nav-link[_ngcontent-%COMP%]{padding:10px 0 10px 10px!important}.sidebar-wrapper[_ngcontent-%COMP%]{max-height:calc(100% - 61px)!important;min-height:calc(100% - 61px)!important}@media (max-width: 991px){.sidebar-wrapper[_ngcontent-%COMP%]{overflow-y:scroll!important}}@media (pointer: coarse){.sidebar-wrapper[_ngcontent-%COMP%]{overflow-y:scroll!important}}@media (max-width: 468px){.navbar[_ngcontent-%COMP%] .navbar-brand[_ngcontent-%COMP%]{white-space:nowrap;max-width:7em;overflow:hidden;text-overflow:ellipsis}}@media only screen and (min-width: 992px){.sidebar[_ngcontent-%COMP%]{z-index:1050!important;transition:all .3s}.sidebar[_ngcontent-%COMP%] .sidebar-wrapper[_ngcontent-%COMP%]{transition:all .3s}.sidebar[_ngcontent-%COMP%] + .main-panel[_ngcontent-%COMP%]{transition:all .3s}.sidebar[_ngcontent-%COMP%] + .main-panel[_ngcontent-%COMP%] .navbar.fixed-top[_ngcontent-%COMP%]{transition:all .3s}.sidebar.collapses[_ngcontent-%COMP%], .sidebar.collapses[_ngcontent-%COMP%] .sidebar-wrapper[_ngcontent-%COMP%]{width:70px;transition:all .3s}.sidebar.collapses[_ngcontent-%COMP%] .logo[_ngcontent-%COMP%] .simple-text[_ngcontent-%COMP%]{background-color:#ffffff3b;border-radius:20px;height:40px;width:40px}.sidebar.collapses[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .nav-link[_ngcontent-%COMP%]{padding:10px 0 10px 10px!important;height:50px;text-align:center;margin:10px}.sidebar.collapses[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .nav-link[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{display:none}.sidebar.collapses[_ngcontent-%COMP%] + .main-panel[_ngcontent-%COMP%]{padding-left:70px}.sidebar.collapses[_ngcontent-%COMP%] + .main-panel[_ngcontent-%COMP%] .navbar.fixed-top[_ngcontent-%COMP%]{left:70px!important;transition:all .3s}.sidebar[_ngcontent-%COMP%] .btn-minimize[_ngcontent-%COMP%]{position:absolute;top:17px;right:-20px;z-index:7;-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);border-radius:50%;box-shadow:0 0 0 1px #091e4214,0 2px 4px 1px #091e4214;color:#000;cursor:pointer;height:24px;opacity:0;outline:0;width:24px;-webkit-transform-origin:7px;-ms-transform-origin:7px;transform-origin:7px;transition:opacity .5s;-webkit-transition:opacity .5s}.sidebar[_ngcontent-%COMP%] .btn-minimize[_ngcontent-%COMP%]:hover{color:#2996cc}.sidebar[_ngcontent-%COMP%]:hover .btn-minimize[_ngcontent-%COMP%]{opacity:1;background-color:#fff;position:absolute;top:17px;right:-20px;z-index:7;-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);border:0;border-radius:50%;box-shadow:0 0 0 1px #091e4214,0 2px 4px 1px #091e4214;color:#000;cursor:pointer;height:24px;opacity:0;outline:0;padding:0;width:24px;-webkit-transform-origin:7px;-ms-transform-origin:7px;transform-origin:7px;transition:opacity .5s;-webkit-transition:opacity .5s}.sidebar[_ngcontent-%COMP%]:hover .btn-minimize[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{cursor:pointer}.sidebar[_ngcontent-%COMP%]:hover .btn-minimize[_ngcontent-%COMP%]:hover{color:#2996cc}.sidebar[_ngcontent-%COMP%]:hover:hover .btn-minimize[_ngcontent-%COMP%]{opacity:1}}.full-container[_ngcontent-%COMP%]{padding-top:0!important}.changelog[_ngcontent-%COMP%]{color:#0006b1!important}.changelog[_ngcontent-%COMP%]:visited{color:#2e2e2e!important}.changelog[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{position:relative}.changelog[_ngcontent-%COMP%] span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#fe3a00!important;position:absolute;top:-4px;right:-18px}.changelog[_ngcontent-%COMP%]:visited span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#fff!important;position:absolute;top:-4px;right:-18px}.changelog[_ngcontent-%COMP%]:visited:hover span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#e9ecef!important;position:absolute;top:-4px;right:-18px}.subscription-bar-visible[_ngcontent-%COMP%]{padding-top:98px}.checkbox_toggle[_ngcontent-%COMP%]{position:relative}.checkbox_toggle[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{color:#868686;display:inline-block;padding-right:38px}.checkbox_toggle[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{width:23px;height:14px;background-color:#ccc;top:2.2px;right:0}.checkbox_toggle[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{display:none}.checkbox_toggle[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background-color:#1f77d0}.checkbox_toggle[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]:after{left:10px}.checkbox_toggle[_ngcontent-%COMP%] label[_ngcontent-%COMP%]:after{content:"";width:12px;height:12px;border-radius:50%;position:absolute;top:.8px;left:1px;transition:all .1s;background-color:#fff}']})};function Ee(e){let i=l(b),t="/menu";e.forEach(a=>t+=`/${a.path}`);let n=i.getCurrentNavigation().extractedUrl.queryParams;return Object.keys(n).forEach((a,g)=>{g==0?t=`${t}?${a}=${n[a]}`:t=`${t}&${a}=${n[a]}`}),t}var O=(e,i)=>{let t=l(h),n=t.isTokenExpired(),u=l(b);return n?(t.returnUrl=Ee(i),u.navigate(["/"]),!1):e.path=="Dashboard"?De():!0};function De(){let e=l(b),i=l(h),t=!1,n=i.getRedirectUrl();return t=n.includes("Dashboard"),t==!1&&e.navigate([n]),t}var L=class e{paymentStorageService=l(Ce);canActivate(i,t){return this.paymentStorageService.clear(),!0}static \u0275fac=function(t){return new(t||e)};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var U=class e{reportService=l(Pe);canActivate(i,t){return this.reportService.resetFilter(),!0}static \u0275fac=function(t){return new(t||e)};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var je=[{path:"",component:P,children:[{path:"Inventory",loadChildren:()=>import("./chunk-JALOTTYL.js").then(e=>e.InventoryModule),canLoad:[r]},{path:"Reports",loadChildren:()=>import("./chunk-5WBNHRSF.js").then(e=>e.ReportsModule),canLoad:[r],canActivate:[U]},{path:"Sell",loadChildren:()=>import("./chunk-NCR5B5Y4.js").then(e=>e.routes),canLoad:[r]},{path:"Print",loadChildren:()=>import("./chunk-JZEWRW27.js").then(e=>e.PrintModule),canLoad:[r]},{path:"Buy",loadComponent:()=>import("./chunk-MGZYE4DB.js").then(e=>e.BuyV2Component),canMatch:[O]},{path:"Sell/V2",loadComponent:()=>import("./chunk-XETIOXLN.js").then(e=>e.SellV2Component),canMatch:[O]},{path:"Dashboard",loadComponent:()=>import("./chunk-OBZMOT6W.js").then(e=>e.DashboardV2Component),canMatch:[O]},{path:"Products",loadChildren:()=>import("./chunk-N27F227W.js").then(e=>e.ProductModule),canLoad:[r]},{path:"Shift",loadChildren:()=>import("./chunk-W5PF5BAF.js").then(e=>e.ShiftModule),canLoad:[r]},{path:"Debt",loadChildren:()=>import("./chunk-VIYE2OFI.js").then(e=>e.DebtModule),canLoad:[r]},{path:"Logistics",loadChildren:()=>import("./chunk-AHKKBRLR.js").then(e=>e.DeliveryModule),canLoad:[r]},{path:"Users",loadChildren:()=>import("./chunk-LWQAPXWM.js").then(e=>e.UsersModule),canLoad:[r]},{path:"Setup",loadChildren:()=>import("./chunk-K4YULPNU.js").then(e=>e.SetupModule),canLoad:[r]},{path:"Developer",loadChildren:()=>import("./chunk-4F5WEZVF.js").then(e=>e.DeveloperModule),canLoad:[r]},{path:"Contacts",loadChildren:()=>import("./chunk-7MB4HURG.js").then(e=>e.ContactsModule),canLoad:[r]},{path:"Outlets",loadChildren:()=>import("./chunk-EWLYV6PD.js").then(e=>e.OutletsModule),canLoad:[r]},{path:"Orders",loadChildren:()=>import("./chunk-MLQCCNEW.js").then(e=>e.OrdersModule),canLoad:[r]},{path:"Profile",loadChildren:()=>import("./chunk-Y5HNNIJE.js").then(e=>e.ProfileModule),canLoad:[r]},{path:"Estimate",loadComponent:()=>import("./chunk-2BIGSZO5.js").then(e=>e.EstimateV2Component),canMatch:[O]},{path:"Adjustment",loadChildren:()=>import("./chunk-IPTLWEIL.js").then(e=>e.AdjustmentModule),canLoad:[r]},{path:"Payment",loadChildren:()=>import("./chunk-SDGA5WRP.js").then(e=>e.PaymentModule),canLoad:[r],canActivate:[L]},{path:"Promotion",loadChildren:()=>import("./chunk-SMHJ3JIG.js").then(e=>e.PromotionModule),canLoad:[r]},{path:"Manufacture",loadChildren:()=>import("./chunk-A2QB6KDW.js").then(e=>e.ManufactureModule),canLoad:[r]},{path:"Prepaid_Package",loadChildren:()=>import("./chunk-NARPOKGG.js").then(e=>e.PrepaidPackageModule),canLoad:[r]},{path:"Fulfillment",loadChildren:()=>import("./chunk-4TP7S3U3.js").then(e=>e.FulfillmentModule),canLoad:[r]},{path:"Unauthorized",loadChildren:()=>import("./chunk-4PC6PQ7Q.js").then(e=>e.UnauthorizedModule),canLoad:[r]},{path:"Not_Found",loadChildren:()=>import("./chunk-356IV4ZE.js").then(e=>e.NotFoundModule),canLoad:[r]},{path:"",redirectTo:"/menu/Dashboard",pathMatch:"full"},{path:"**",redirectTo:"Not_Found"}]}],N=class e{static \u0275fac=function(t){return new(t||e)};static \u0275mod=x({type:e});static \u0275inj=y({imports:[B.forChild(je),B]})};var ye=class e{constructor(){}static \u0275fac=function(t){return new(t||e)};static \u0275mod=x({type:e,bootstrap:[P]});static \u0275inj=y({imports:[Se,N,he,re]})};export{ye as MenuMasterModule};
1
+ import{a as Ce}from"./chunk-S4LIME7D.js";import{a as Me}from"./chunk-63P7EQO4.js";import{a as Pe}from"./chunk-QYHR4HH4.js";import{a as ve}from"./chunk-XUP2FY5D.js";import{ga as be,ha as Se}from"./chunk-JLOQTYOI.js";import{a as ue}from"./chunk-UM35BDBC.js";import"./chunk-GIKR6Y2K.js";import{D as he,b as de,h as me,o as fe}from"./chunk-LNLGRZBB.js";import{a as T,c as h}from"./chunk-2OQ5CGDZ.js";import{a as ge}from"./chunk-RUK3LROA.js";import{a as M,d as I}from"./chunk-MP62IGYR.js";import{a as ce}from"./chunk-26WIZL6M.js";import{$ as H,$a as c,E,Ib as o,Jb as s,Kb as p,Ld as oe,Nd as ae,Od as b,Pd as se,Qb as C,Qd as le,Rb as Q,Rd as B,Td as pe,Uc as ie,Vb as Z,Wa as J,Wc as ne,d as G,da as D,db as v,ec as m,fc as V,gc as $,hd as re,ja as d,ka as y,kb as q,lb as x,ma as _,na as l,pc as K,qb as j,qc as X,ub as Y,vb as f,xb as W,xc as ee,zb as F,zc as te}from"./chunk-EDB2BAIG.js";import"./chunk-7DCB7DB2.js";var r=class e{constructor(i,t){this.authService=i;this.router=t}canLoad(i,t){return this.authService.isTokenExpired()?(this.authService.returnUrl=this.getUrlRedirect(t),this.router.navigate(["/"]),!1):!0}getUrlRedirect(i){let t="/menu";i.forEach(a=>t+=`/${a.path}`);let n=this.router.getCurrentNavigation().extractedUrl.queryParams;return Object.keys(n).forEach((a,g)=>{g==0?t=`${t}?${a}=${n[a]}`:t=`${t}&${a}=${n[a]}`}),t}static \u0275fac=function(t){return new(t||e)(_(h),_(b))};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var w=class e{constructor(i){this.toastrService=i;this.initPermissionToastr=!1}isPermissionGranted;initPermissionToastr;initPermission(){try{this.initPermissionToastr||Notification.requestPermission().then(t=>{this.isPermissionGranted=!1,t=="granted"&&(this.isPermissionGranted=!0),this.initPermissionToastr=!0})}catch(i){console.error(i)}}showAlert(i,t,n,u){let a=6e4;if(this.isPermissionGranted)try{let g=new Notification(t,{body:i,icon:u});g.onerror=R=>{this.toastrService.info(this.setBody(i,n),t,{timeOut:a,enableHtml:this.hasUrl(n)})}}catch(g){console.error(g)}else this.toastrService.info(this.setBody(i,n),t,{timeOut:a,enableHtml:this.hasUrl(n)})}setBody(i,t){return this.hasUrl(t)&&(i=`<a href="${t}" target="_blank" class="ps-0">${i}</a>`),i}hasUrl(i){return!!(i&&i.length!==0)}static \u0275fac=function(t){return new(t||e)(_(pe))};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var _e=[{T:"Dashboard",U:"/menu/Dashboard",I:"fa-solid fa-chart-pie"},{T:"Products",U:"/menu/Products",I:"fa-solid fa-tag"},{T:"Estimate",U:"/menu/Estimate",I:"fa-solid fa-clipboard"},{T:"Sell",U:"/menu/Sell",I:"fa-solid fa-cart-shopping"},{T:"Shift",U:"/menu/Shift/",I:"fa-solid fa-user-clock"},{T:"Reports",U:"/menu/Reports",I:"fa-solid fa-chart-area"},{T:"Contacts",U:"/menu/Contacts",I:"fas fa-address-book"},{T:"Orders",U:"/menu/Orders",I:"fas fa-file-invoice"},{T:"Payment",U:"/menu/Payment",I:"fas fa-money-bill-alt"},{T:"Debt",U:"/menu/Debt",I:"fas fa-dollar-sign"},{T:"Inventory",U:"/menu/Inventory",I:"fas fa-archive"},{T:"Adjustment",U:"/menu/Adjustment",I:"fas fa-scanner-gun"},{T:"Buy",U:"/menu/Buy",I:"fa-solid fa-cart-arrow-down"},{T:"Logistics",U:"/menu/Logistics",I:"fas fa-truck"},{T:"Fulfillment",U:"/menu/Fulfillment",I:"fas fa-dolly"},{T:"Manufacture",U:"/menu/Manufacture",I:"fas fa-industry"},{T:"Prepaid Package",U:"/menu/Prepaid_Package",I:"fa-solid fa-id-card"},{T:"Promotion",U:"/menu/Promotion",I:"fas fa-bullhorn"},{T:"Users",U:"/menu/Users",I:"fas fa-user"},{T:"Outlets",U:"/menu/Outlets",I:"fas fa-map-marker-alt"},{T:"Setup",U:"/menu/Setup",I:"fas fa-gear"},{T:"Developer",U:"/menu/Developer",I:"fas fa-code"}];var k=class e{role=l(I);authService=l(h);menu=_e;filteredMenu=[];initFilteredMenu(){this.filteredMenu=this.menu.filter(i=>i.T==="Dashboard"?this.role.dashboard.View:i.T==="Products"?this.role.product.View:i.T==="Estimate"?this.role.estimate.Create:i.T==="Sell"?this.role.sell.Create:i.T==="Shift"?this.role.sell.Create:i.T==="Reports"?this.role.report.View:i.T==="Contacts"?this.role.contact.View:i.T==="Orders"?this.role.order.View:i.T==="Payment"?this.role.payment.View:i.T==="Debt"?this.role.debt.View:i.T==="Inventory"?this.role.inventory.View:i.T==="Adjustment"?this.role.adjustment.View:i.T==="Buy"?this.role.buy.Create:i.T==="Logistics"?this.role.logistic.View:i.T==="Manufacture"?this.role.manufacture.View:i.T==="Fulfillment"?this.role.fulfillment.View:i.T==="Prepaid Package"?this.role.prepaidPackage.View:i.T==="Promotion"?this.role.promotion.View:i.T==="Users"?this.role.users.View:i.T==="Outlets"?this.role.outlets.View:i.T==="Setup"?this.role.setup.View:i.T==="Developer"?this.role.developer.View:!0),this.filterBySubscriptionStatus()}filterBySubscriptionStatus(){let i=this.authService.getSubscriptionStatus();this.filteredMenu=this.filteredMenu.filter(t=>{switch(i){case 2:return t.T=="Sell"||t.T=="Shift";case 3:return!1;default:return!0}})}static \u0275fac=function(t){return new(t||e)};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var Oe=[{T:"My Profile",U:"Profile/Main/My_Profile",I:"fas fa-user"},{T:"My Subscription",U:"Profile/Main/My_Subscription",I:"fa-solid fa-credit-card"},{T:"Notification",U:"Profile/Notification/Push",I:"fas fa-bell"},{T:"My Sales",U:"Profile/Main/My_Sales",I:"fas fa-history"}];var A=class e{role=l(I);authService=l(h);filteredMenu=[];initFilteredMenu(){let i=this.authService.getSubscriptionStatus();this.filteredMenu=Oe.filter(t=>t.T=="My Profile"?this.role.profile.View:t.T=="My Subscription"?this.role.profile.Subscription:t.T=="Notification"?this.role.profile.Notification&&i!=2&&i!=3:t.T=="My Sales"?i!=2&&i!=3:!0)}static \u0275fac=function(t){return new(t||e)};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var Le=(e,i)=>({"full-container":e,"subscription-bar-visible":i}),Ue=e=>[e];function Ne(e,i){if(e&1&&(o(0,"a",35),p(1,"i",36),o(2,"span"),m(3),s()()),e&2){let t=i.$implicit;f("routerLink",t==null?null:t.U),c(),F((t==null?null:t.I)+" me-2"),c(2),V(t==null?null:t.T)}}function Re(e,i){if(e&1&&(o(0,"li",37,0)(2,"a",38),p(3,"i"),o(4,"p"),m(5),s()()()),e&2){let t=i.$implicit,n=Q();f("routerLinkActiveOptions",n.isActiveMatchOptions),Y("data-cy",t==null?null:t.T),c(2),f("matTooltip",n.toggleSideMenu?t==null?null:t.T:"")("routerLink",K(7,Ue,t==null?null:t.U)),c(),F(t==null?null:t.I),c(2),V(t==null?null:t.T)}}var P=class e{constructor(i,t,n,u,a,g,R,z){this.toggleSidebar=i;this.signalRClientService=t;this.notificationAlertService=n;this.router=u;this.authService=a;this.intercomService=g;R.initFilteredMenu(),z.initFilteredMenu(),this.leftSidebarMenu=R.filteredMenu,this.topMenu=z.filteredMenu,this.accountInfo=JSON.parse(localStorage.getItem("AccountInfo")),this.toggleSidebar.toggleState$.subscribe(xe=>this.isNavOpen=xe),this.destroy$=new G,this.initNotificationPermission()}isActiveMatchOptions={matrixParams:"subset",queryParams:"subset",paths:"subset",fragment:"exact"};toggleSideMenu=!1;isNavOpen;destroy$;activeMenu;appVersion=ce.version;currentSubStatus;subsStatusEnum=T;isFullContainer=!1;isHideIntercomLauncher;leftSidebarMenu;topMenu;accountInfo;ngOnInit(){this.subscribeToPushNotification(),this.getCurrentSubscriptionStatus(),this.initFullContainer()}initFullContainer(){this.router.events.pipe(E(i=>i instanceof oe),H(null),D(this.destroy$)).subscribe(i=>{this.isFullContainer=!1,(this.router.url.includes("Sell")&&!this.router.url.includes("v2")&&!this.router.url.includes("Offline")||this.router.url.includes("Buy")||this.router.url.includes("menu/Estimate")||this.router.url.includes("Transfer_Order/Form")||this.router.url.includes("Adjustment/Archive/Form")||this.router.url.includes("Job_Order/Archive/Form")||this.router.url.includes("/menu/Debt/Debt/Join_Invoice/Form")||this.router.url.includes("/menu/Debt/Debt/Join_Bill/New_Join_Bill"))&&(this.isFullContainer=!0)})}initNotificationPermission(){this.notificationAlertService.initPermission()}getCurrentSubscriptionStatus(){this.currentSubStatus=this.authService.getSubscriptionStatus()}subscribeToPushNotification(){let i=localStorage.getItem("NotificationOutletID");M.IsNotEmpty(i)&&M.isGuid(i)?this.signalRClientService.SubscribeGroup(i):this.signalRClientService.startConnection(),this.signalRClientService.OnReceivePushNotification.pipe(D(this.destroy$),E(t=>M.IsNotEmpty(t))).subscribe(t=>{if(M.IsNotEmpty(t)){let n=JSON.parse(t),u="//res.cloudinary.com/pos/image/upload/v1657006791/icons/info-new.png";M.IsNotEmpty(n.Icon)&&(u=n.Icon),this.notificationAlertService.showAlert(n.Body,n.Header,n.URL,u)}})}ngAfterViewInit(){this.intercomService.inititalizeIntercom()}toggleMenu(){this.toggleSideMenu=!this.toggleSideMenu}logout(){this.authService.logout()}isNotEmpty(i){return M.IsNotEmpty(i)}onShowDropdown(){this.isHideIntercomLauncher=this.intercomService.isHideLauncher()}chatToggleChange(){this.isHideIntercomLauncher==!1?this.intercomService.hideLauncher():this.intercomService.showLauncher(),this.onShowDropdown()}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}static \u0275fac=function(t){return new(t||e)(v(ve),v(ue),v(w),v(b),v(h),v(ge),v(k),v(A))};static \u0275cmp=q({type:e,selectors:[["POS-menu-master"]],standalone:!1,decls:52,vars:19,consts:[["rla","routerLinkActive"],[1,"wrapper"],["data-color","blue",1,"sidebar",3,"ngClass"],[1,"btn-minimize","d-lg-block","d-none","p-0","border-0","bg-white",3,"click"],[1,"fa-solid",3,"ngClass"],[1,"logo"],[1,"navbar","dropdown","bg-transparent","border-0"],["data-cy","companyName","data-bs-toggle","dropdown","aria-expanded","false","matTooltipPosition","above",1,"simple-text","text-start","dropdown-toggle","d-flex","align-items-center","justify-content-center",2,"cursor","pointer",3,"click","matTooltip"],[1,"dropdown-menu"],[1,"dropdown-header","text-dark","border-bottom"],[1,"divider","m-0"],["class","dropdown-item h5",3,"routerLink",4,"ngFor","ngForOf"],[1,"dropdown-item","h5",2,"cursor","pointer"],[1,"d-flex","align-items-center","justify-content-between"],[1,"fa-solid","fa-comment-dots","me-2"],[1,"checkbox_toggle","ms-3",3,"click"],["type","checkbox","id","chatToggle","name","ChatToggle",3,"ngModelChange","ngModel"],["for","chatToggle",1,"position-relative","rounded-pill","pointer"],[1,"dropdown-item","h5",2,"cursor","pointer",3,"click"],["aria-hidden","true",1,"fa-solid","fa-sign-out-alt","me-2"],[1,"divider"],[1,"dropdown-header","border-top"],["target","_blank",1,"dropdown-item","h5","changelog",3,"href"],["aria-hidden","true",1,"fa-solid","fa-sparkles","me-2"],[1,"fa-solid","fa-circle-exclamation","ms-2",2,"font-size","16px"],["target","_blank","href","http://support.dealpos.com",1,"dropdown-item","h5"],["aria-hidden","true",1,"fa-solid","fa-book","me-2"],["target","_blank","href","https://www.dealpos.app/",1,"dropdown-item","h5"],["aria-hidden","true",1,"fa-solid","fa-table-cells-large","me-2"],["target","_blank","href","http://blog.dealpos.com",1,"dropdown-item","h5"],["aria-hidden","true",1,"fa-brands","fa-blogger","me-2"],[1,"sidebar-wrapper"],[1,"nav"],["routerLinkActive","active",3,"routerLinkActiveOptions",4,"ngFor","ngForOf"],["id","full-container",1,"main-panel",3,"ngClass"],[1,"dropdown-item","h5",3,"routerLink"],["aria-hidden","true"],["routerLinkActive","active",3,"routerLinkActiveOptions"],["matTooltipPosition","above",1,"nav-link","position-relative","d-block",3,"matTooltip","routerLink"]],template:function(t,n){t&1&&(o(0,"div",1)(1,"div",2)(2,"button",3),C("click",function(){return n.toggleMenu()}),p(3,"i",4),s(),o(4,"div",5)(5,"div",6)(6,"a",7),C("click",function(){return n.onShowDropdown()}),m(7),ee(8,"limitText"),s(),o(9,"div",8)(10,"div",9),m(11),s(),p(12,"div",10),j(13,Ne,4,4,"a",11),o(14,"a",12)(15,"div",13)(16,"div"),p(17,"i",14),o(18,"span"),m(19,"Chat Support"),s()(),o(20,"div",15),C("click",function(a){return a.stopPropagation()}),o(21,"input",16),C("ngModelChange",function(){return n.chatToggleChange()}),s(),p(22,"label",17),s()()(),o(23,"a",18),C("click",function(){return n.logout()}),p(24,"i",19),o(25,"span"),m(26,"Log Out"),s()(),p(27,"div",20),o(28,"div",21),m(29," Links "),s(),o(30,"a",22),p(31,"i",23),o(32,"span"),m(33,"What's New"),p(34,"i",24),s()(),o(35,"a",25),p(36,"i",26),o(37,"span"),m(38,"Help Center"),s()(),o(39,"a",27),p(40,"i",28),o(41,"span"),m(42,"App Store"),s()(),o(43,"a",29),p(44,"i",30),o(45,"span"),m(46,"Company Blog"),s()()()()(),o(47,"div",31)(48,"ul",32),j(49,Re,6,9,"li",33),s()()(),o(50,"div",34),p(51,"router-outlet"),s()()),t&2&&(W("nav-open",n.isNavOpen),c(),f("ngClass",n.toggleSideMenu?"collapses":""),c(2),f("ngClass",n.toggleSideMenu?"fa-angle-left cursor":"fa-angle-right cursor"),c(3),f("matTooltip",n.accountInfo==null?null:n.accountInfo.BrandName),c(),$(" ",te(8,13,n.accountInfo==null?null:n.accountInfo.BrandName,12)," "),c(4),$("",n.accountInfo==null?null:n.accountInfo.UserName," "),c(2),f("ngForOf",n.topMenu),c(8),f("ngModel",!n.isHideIntercomLauncher),c(9),Z("href","https://changelog.dealpos.com/?categories=cat_gAZdRhBYU7QVl&view=complete&v=",n.appVersion,"",J),c(19),f("ngForOf",n.leftSidebarMenu),c(),f("ngClass",X(16,Le,n.isFullContainer,n.isNotEmpty(n.currentSubStatus)&&n.currentSubStatus!==n.subsStatusEnum.PAID)))},dependencies:[be,ae,se,le,de,me,fe,ie,ne,Me],styles:['.sidebar[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .nav-link[_ngcontent-%COMP%], body[_ngcontent-%COMP%] > .navbar-collapse[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .nav-link[_ngcontent-%COMP%]{padding:10px 0 10px 10px!important}.sidebar-wrapper[_ngcontent-%COMP%]{max-height:calc(100% - 61px)!important;min-height:calc(100% - 61px)!important}@media (max-width: 991px){.sidebar-wrapper[_ngcontent-%COMP%]{overflow-y:scroll!important}}@media (pointer: coarse){.sidebar-wrapper[_ngcontent-%COMP%]{overflow-y:scroll!important}}@media (max-width: 468px){.navbar[_ngcontent-%COMP%] .navbar-brand[_ngcontent-%COMP%]{white-space:nowrap;max-width:7em;overflow:hidden;text-overflow:ellipsis}}@media only screen and (min-width: 992px){.sidebar[_ngcontent-%COMP%]{z-index:1050!important;transition:all .3s}.sidebar[_ngcontent-%COMP%] .sidebar-wrapper[_ngcontent-%COMP%]{transition:all .3s}.sidebar[_ngcontent-%COMP%] + .main-panel[_ngcontent-%COMP%]{transition:all .3s}.sidebar[_ngcontent-%COMP%] + .main-panel[_ngcontent-%COMP%] .navbar.fixed-top[_ngcontent-%COMP%]{transition:all .3s}.sidebar.collapses[_ngcontent-%COMP%], .sidebar.collapses[_ngcontent-%COMP%] .sidebar-wrapper[_ngcontent-%COMP%]{width:70px;transition:all .3s}.sidebar.collapses[_ngcontent-%COMP%] .logo[_ngcontent-%COMP%] .simple-text[_ngcontent-%COMP%]{background-color:#ffffff3b;border-radius:20px;height:40px;width:40px}.sidebar.collapses[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .nav-link[_ngcontent-%COMP%]{padding:10px 0 10px 10px!important;height:50px;text-align:center;margin:10px}.sidebar.collapses[_ngcontent-%COMP%] .nav[_ngcontent-%COMP%] li[_ngcontent-%COMP%] .nav-link[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{display:none}.sidebar.collapses[_ngcontent-%COMP%] + .main-panel[_ngcontent-%COMP%]{padding-left:70px}.sidebar.collapses[_ngcontent-%COMP%] + .main-panel[_ngcontent-%COMP%] .navbar.fixed-top[_ngcontent-%COMP%]{left:70px!important;transition:all .3s}.sidebar[_ngcontent-%COMP%] .btn-minimize[_ngcontent-%COMP%]{position:absolute;top:17px;right:-20px;z-index:7;-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);border-radius:50%;box-shadow:0 0 0 1px #091e4214,0 2px 4px 1px #091e4214;color:#000;cursor:pointer;height:24px;opacity:0;outline:0;width:24px;-webkit-transform-origin:7px;-ms-transform-origin:7px;transform-origin:7px;transition:opacity .5s;-webkit-transition:opacity .5s}.sidebar[_ngcontent-%COMP%] .btn-minimize[_ngcontent-%COMP%]:hover{color:#2996cc}.sidebar[_ngcontent-%COMP%]:hover .btn-minimize[_ngcontent-%COMP%]{opacity:1;background-color:#fff;position:absolute;top:17px;right:-20px;z-index:7;-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg);border:0;border-radius:50%;box-shadow:0 0 0 1px #091e4214,0 2px 4px 1px #091e4214;color:#000;cursor:pointer;height:24px;opacity:0;outline:0;padding:0;width:24px;-webkit-transform-origin:7px;-ms-transform-origin:7px;transform-origin:7px;transition:opacity .5s;-webkit-transition:opacity .5s}.sidebar[_ngcontent-%COMP%]:hover .btn-minimize[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{cursor:pointer}.sidebar[_ngcontent-%COMP%]:hover .btn-minimize[_ngcontent-%COMP%]:hover{color:#2996cc}.sidebar[_ngcontent-%COMP%]:hover:hover .btn-minimize[_ngcontent-%COMP%]{opacity:1}}.full-container[_ngcontent-%COMP%]{padding-top:0!important}.changelog[_ngcontent-%COMP%]{color:#0006b1!important}.changelog[_ngcontent-%COMP%]:visited{color:#2e2e2e!important}.changelog[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{position:relative}.changelog[_ngcontent-%COMP%] span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#fe3a00!important;position:absolute;top:-4px;right:-18px}.changelog[_ngcontent-%COMP%]:visited span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#fff!important;position:absolute;top:-4px;right:-18px}.changelog[_ngcontent-%COMP%]:visited:hover span[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{color:#e9ecef!important;position:absolute;top:-4px;right:-18px}.subscription-bar-visible[_ngcontent-%COMP%]{padding-top:98px}.checkbox_toggle[_ngcontent-%COMP%]{position:relative}.checkbox_toggle[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{color:#868686;display:inline-block;padding-right:38px}.checkbox_toggle[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{width:23px;height:14px;background-color:#ccc;top:2.2px;right:0}.checkbox_toggle[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]{display:none}.checkbox_toggle[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]{background-color:#1f77d0}.checkbox_toggle[_ngcontent-%COMP%] input[type=checkbox][_ngcontent-%COMP%]:checked + label[_ngcontent-%COMP%]:after{left:10px}.checkbox_toggle[_ngcontent-%COMP%] label[_ngcontent-%COMP%]:after{content:"";width:12px;height:12px;border-radius:50%;position:absolute;top:.8px;left:1px;transition:all .1s;background-color:#fff}']})};function Ee(e){let i=l(b),t="/menu";e.forEach(a=>t+=`/${a.path}`);let n=i.getCurrentNavigation().extractedUrl.queryParams;return Object.keys(n).forEach((a,g)=>{g==0?t=`${t}?${a}=${n[a]}`:t=`${t}&${a}=${n[a]}`}),t}var O=(e,i)=>{let t=l(h),n=t.isTokenExpired(),u=l(b);return n?(t.returnUrl=Ee(i),u.navigate(["/"]),!1):e.path=="Dashboard"?De():!0};function De(){let e=l(b),i=l(h),t=!1,n=i.getRedirectUrl();return t=n.includes("Dashboard"),t==!1&&e.navigate([n]),t}var L=class e{paymentStorageService=l(Ce);canActivate(i,t){return this.paymentStorageService.clear(),!0}static \u0275fac=function(t){return new(t||e)};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var U=class e{reportService=l(Pe);canActivate(i,t){return this.reportService.resetFilter(),!0}static \u0275fac=function(t){return new(t||e)};static \u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})};var je=[{path:"",component:P,children:[{path:"Inventory",loadChildren:()=>import("./chunk-2Y7RQ5GK.js").then(e=>e.InventoryModule),canLoad:[r]},{path:"Reports",loadChildren:()=>import("./chunk-XME4MZYW.js").then(e=>e.ReportsModule),canLoad:[r],canActivate:[U]},{path:"Sell",loadChildren:()=>import("./chunk-BNP5MTYZ.js").then(e=>e.routes),canLoad:[r]},{path:"Print",loadChildren:()=>import("./chunk-JZEWRW27.js").then(e=>e.PrintModule),canLoad:[r]},{path:"Buy",loadComponent:()=>import("./chunk-ACQ5WGFA.js").then(e=>e.BuyV2Component),canMatch:[O]},{path:"Sell/V2",loadComponent:()=>import("./chunk-324YW32W.js").then(e=>e.SellV2Component),canMatch:[O]},{path:"Dashboard",loadComponent:()=>import("./chunk-C6XGSCT2.js").then(e=>e.DashboardV2Component),canMatch:[O]},{path:"Products",loadChildren:()=>import("./chunk-JVBQVJGY.js").then(e=>e.ProductModule),canLoad:[r]},{path:"Shift",loadChildren:()=>import("./chunk-3ESJIRJI.js").then(e=>e.ShiftModule),canLoad:[r]},{path:"Debt",loadChildren:()=>import("./chunk-JDV2UBEW.js").then(e=>e.DebtModule),canLoad:[r]},{path:"Logistics",loadChildren:()=>import("./chunk-SGBQHIZU.js").then(e=>e.DeliveryModule),canLoad:[r]},{path:"Users",loadChildren:()=>import("./chunk-JVDAP5PW.js").then(e=>e.UsersModule),canLoad:[r]},{path:"Setup",loadChildren:()=>import("./chunk-EBBLJUWQ.js").then(e=>e.SetupModule),canLoad:[r]},{path:"Developer",loadChildren:()=>import("./chunk-QWGD3H2A.js").then(e=>e.DeveloperModule),canLoad:[r]},{path:"Contacts",loadChildren:()=>import("./chunk-UKS3DBYD.js").then(e=>e.ContactsModule),canLoad:[r]},{path:"Outlets",loadChildren:()=>import("./chunk-VK7PYTOE.js").then(e=>e.OutletsModule),canLoad:[r]},{path:"Orders",loadChildren:()=>import("./chunk-UNSEWD4O.js").then(e=>e.OrdersModule),canLoad:[r]},{path:"Profile",loadChildren:()=>import("./chunk-QLHKMGW3.js").then(e=>e.ProfileModule),canLoad:[r]},{path:"Estimate",loadComponent:()=>import("./chunk-I3DTU2HT.js").then(e=>e.EstimateV2Component),canMatch:[O]},{path:"Adjustment",loadChildren:()=>import("./chunk-2272UHVJ.js").then(e=>e.AdjustmentModule),canLoad:[r]},{path:"Payment",loadChildren:()=>import("./chunk-L3UTRSNX.js").then(e=>e.PaymentModule),canLoad:[r],canActivate:[L]},{path:"Promotion",loadChildren:()=>import("./chunk-FETPS43Y.js").then(e=>e.PromotionModule),canLoad:[r]},{path:"Manufacture",loadChildren:()=>import("./chunk-NJ2M4SPG.js").then(e=>e.ManufactureModule),canLoad:[r]},{path:"Prepaid_Package",loadChildren:()=>import("./chunk-3HZQ2MWE.js").then(e=>e.PrepaidPackageModule),canLoad:[r]},{path:"Fulfillment",loadChildren:()=>import("./chunk-MNFGMEQY.js").then(e=>e.FulfillmentModule),canLoad:[r]},{path:"Unauthorized",loadChildren:()=>import("./chunk-M5L4RIM5.js").then(e=>e.UnauthorizedModule),canLoad:[r]},{path:"Not_Found",loadChildren:()=>import("./chunk-4LCG2U7W.js").then(e=>e.NotFoundModule),canLoad:[r]},{path:"",redirectTo:"/menu/Dashboard",pathMatch:"full"},{path:"**",redirectTo:"Not_Found"}]}],N=class e{static \u0275fac=function(t){return new(t||e)};static \u0275mod=x({type:e});static \u0275inj=y({imports:[B.forChild(je),B]})};var ye=class e{constructor(){}static \u0275fac=function(t){return new(t||e)};static \u0275mod=x({type:e,bootstrap:[P]});static \u0275inj=y({imports:[Se,N,he,re]})};export{ye as MenuMasterModule};
@@ -1 +1 @@
1
- import{a as ve}from"./chunk-CXYH2IZT.js";import{a as Ce}from"./chunk-HR5WLTC4.js";import{a as fe}from"./chunk-FCHZ7VUL.js";import"./chunk-BYXBJQAS.js";import{h as se,i as ce}from"./chunk-6IFNMT72.js";import"./chunk-4KJRE3GP.js";import{b as ue}from"./chunk-5233FXFY.js";import"./chunk-YQGBGJ5U.js";import"./chunk-XUP2FY5D.js";import{C as de,D as pe,E as me,u as re,v as ae,w as le}from"./chunk-5UTBAGIS.js";import"./chunk-JLOQTYOI.js";import{P as F}from"./chunk-YJVLRBSS.js";import"./chunk-B4243VJD.js";import"./chunk-7COMDF6M.js";import"./chunk-2FWFPV5I.js";import"./chunk-NEEN2JO2.js";import{C as ee,D as oe,E as te,c as z,e as _,h as J,i as Y,p as X,t as Q,u as Z}from"./chunk-LNLGRZBB.js";import"./chunk-DMSBV63C.js";import"./chunk-MAFIFJSJ.js";import{a as w,d as ie}from"./chunk-MP62IGYR.js";import"./chunk-J6RZLLDH.js";import{$a as l,$c as L,Db as f,Dc as q,E as N,Eb as A,Gb as O,Hb as U,Ib as n,Jb as i,Kb as s,Ma as D,Md as B,Nb as H,Nc as K,Ob as T,Qb as v,Rb as h,Td as W,Uc as R,Wd as ne,db as c,dc as $,ec as a,fc as G,gc as I,hd as M,kb as E,na as g,ob as V,pc as b,qb as u,qc as j,t as k,va as P,vb as m,wa as y}from"./chunk-EDB2BAIG.js";import"./chunk-7DCB7DB2.js";var x=r=>({"is-invalid":r});function Pe(r,d){r&1&&(n(0,"div",16),a(1," Provider Name is required "),i())}function ye(r,d){r&1&&(n(0,"div",20),a(1," Validate Coupon URL is required "),i())}function Ee(r,d){r&1&&(n(0,"div",20),a(1," Redeem Coupon URL is required "),i())}function Ge(r,d){r&1&&(n(0,"div",20),a(1,"Key is required"),i())}var S=class r{constructor(d){this.data=d;this.config=new de,this.config.title="Register Provider",this.config.customWidth="600px",this.initForm()}dialogRef=g(re);config;fb=g(ee);formGroup;initForm(){this.formGroup=this.fb.group({name:[this.data?.name||"",[_.required]],validateCoupon:[this.data?.validateCoupon||"",[_.required]],redeemCoupon:[this.data?.redeemCoupon||"",[_.required]],enabled:[this.data?.enabled!==void 0?this.data.enabled:!0],header:[this.data?.header,[_.required]]})}onClose(){this.dialogRef.close()}onOk(){this.formGroup.markAllAsTouched(),!this.formGroup.invalid&&this.dialogRef.close(this.formGroup.value)}static \u0275fac=function(e){return new(e||r)(c(ae))};static \u0275cmp=E({type:r,selectors:[["app-modal-register-provider"]],decls:35,vars:18,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container-fluid","pt-4"],[1,"row"],[1,"col-12"],[3,"formGroup"],[1,"mb-8"],[1,"d-flex","align-items-center"],[1,"flex-grow-1","me-3"],[1,"form-floating-outline","mb-0"],["type","text","placeholder","Provider Name","id","name","name","name","formControlName","name",1,"form-control","bg-white",3,"ngClass"],["for","name"],[2,"width","75px"],[1,"form-check-floating"],[1,"d-flex","justify-content-center","pt-7","pb-4"],["formControlName","enabled"],[1,"labelFilledInput","text-center"],[1,"invalid-feedback","mt-2",2,"display","block"],[1,"form-floating-outline","mb-8"],["type","text","id","validateCoupon","name","validateCoupon","placeholder","Validate Coupon","formControlName","validateCoupon",1,"form-control","bg-white",3,"ngClass"],["for","validateCoupon"],[1,"invalid-feedback"],["type","text","id","redeemCoupon","placeholder","Redeem Coupon","name","redeemCoupon","formControlName","redeemCoupon",1,"form-control","bg-white",3,"ngClass"],["for","redeemCoupon"],[1,"form-floating-outline","mb-3"],["type","text","id","key","name","key","placeholder","Key: E.g. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9","formControlName","header","rows","4",1,"form-control","bg-white",3,"ngClass"],["for","key"]],template:function(e,o){e&1&&(n(0,"modal-material",0),v("onOk",function(){return o.onOk()})("onCancel",function(){return o.onClose()})("onClose",function(){return o.onClose()}),n(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"form",4)(6,"div",5)(7,"div",6)(8,"div",7)(9,"div",8),s(10,"input",9),n(11,"label",10),a(12,"Coupon Provider"),i()()(),n(13,"div",11)(14,"div",12)(15,"div",13),s(16,"app-customize-toggle",14),i(),n(17,"label",15),a(18,"Enabled"),i()()()(),u(19,Pe,2,0,"div",16),i(),n(20,"div",17),s(21,"input",18),n(22,"label",19),a(23,"Validate Coupon URL"),i(),u(24,ye,2,0,"div",20),i(),n(25,"div",17),s(26,"input",21),n(27,"label",22),a(28,"Redeem Coupon URL"),i(),u(29,Ee,2,0,"div",20),i(),n(30,"div",23),s(31,"textarea",24),n(32,"label",25),a(33,"Request Header (Key: value)"),i(),u(34,Ge,2,0,"div",20),i()()()()()()()),e&2&&(m("config",o.config),l(5),m("formGroup",o.formGroup),l(5),m("ngClass",b(10,x,(o.formGroup.controls.name==null?null:o.formGroup.controls.name.invalid)&&((o.formGroup.controls.name==null?null:o.formGroup.controls.name.dirty)||(o.formGroup.controls.name==null?null:o.formGroup.controls.name.touched)))),l(9),f(o.formGroup.controls.name.invalid&&(o.formGroup.controls.name.dirty||o.formGroup.controls.name.touched)?19:-1),l(2),m("ngClass",b(12,x,(o.formGroup.controls.validateCoupon==null?null:o.formGroup.controls.validateCoupon.invalid)&&((o.formGroup.controls.validateCoupon==null?null:o.formGroup.controls.validateCoupon.dirty)||(o.formGroup.controls.validateCoupon==null?null:o.formGroup.controls.validateCoupon.touched)))),l(3),f(o.formGroup.controls.validateCoupon.invalid&&(o.formGroup.controls.validateCoupon.dirty||o.formGroup.controls.validateCoupon.touched)?24:-1),l(2),m("ngClass",b(14,x,(o.formGroup.controls.redeemCoupon==null?null:o.formGroup.controls.redeemCoupon.invalid)&&((o.formGroup.controls.redeemCoupon==null?null:o.formGroup.controls.redeemCoupon.dirty)||(o.formGroup.controls.redeemCoupon==null?null:o.formGroup.controls.redeemCoupon.touched)))),l(3),f(o.formGroup.controls.redeemCoupon.invalid&&(o.formGroup.controls.redeemCoupon.dirty||o.formGroup.controls.redeemCoupon.touched)?29:-1),l(2),m("ngClass",b(16,x,(o.formGroup.controls.header==null?null:o.formGroup.controls.header.invalid)&&((o.formGroup.controls.header==null?null:o.formGroup.controls.header.dirty)||(o.formGroup.controls.header==null?null:o.formGroup.controls.header.touched)))),l(3),f(o.formGroup.controls.header.invalid&&(o.formGroup.controls.header.dirty||o.formGroup.controls.header.touched)?34:-1))},dependencies:[M,R,te,X,z,J,Y,Q,Z,me,pe,ve],styles:["div.form-check-floating[_ngcontent-%COMP%]{border:1px solid #ced4da;position:relative;border-radius:.25rem!important}.labelFilledInput[_ngcontent-%COMP%]{position:absolute;top:-10px;left:10px;background:#fff;padding-left:4px;padding-right:4px;font-size:.75rem!important;color:#9da2a6}"]})};var Re=(r,d)=>({"bg-success-subtle text-success-emphasis":r,"bg-danger-subtle text-danger-emphasis":d});function Me(r,d){if(r&1){let e=T();n(0,"tr")(1,"td",10)(2,"i",11),v("click",function(){let t=P(e).$index,p=h(2);return y(p.onDeleteProvider(t))}),i()(),n(3,"td")(4,"a",12),v("click",function(){let t=P(e),p=t.$implicit,C=t.$index,he=h(2);return y(he.onUpdateProvider(p,C))}),a(5),i()(),n(6,"td"),a(7),i(),n(8,"td"),a(9),i(),n(10,"td"),a(11),i(),n(12,"td")(13,"span",13),a(14),i()()()}if(r&2){let e=d.$implicit;l(5),I(" ",e.Name," "),l(2),G(e.ValidateCoupon),l(2),G(e.RedeemCoupon),l(2),G(e.KeyUI),l(2),m("ngClass",j(6,Re,e.Enabled,!e.Enabled)),l(),I(" ",e.Enabled?"Enabled":"Disabled"," ")}}function xe(r,d){if(r&1&&O(0,Me,15,9,"tr",null,A),r&2){let e=h();U(e.listProviders())}}function Ne(r,d){r&1&&H(0)}function Te(r,d){if(r&1&&u(0,Ne,1,0,"ng-container",14),r&2){h();let e=$(26);m("ngTemplateOutlet",e)}}function Ie(r,d){r&1&&(n(0,"tr",15)(1,"td",16),s(2,"empty-state-table"),i()())}var ge=class r extends Ce{constructor(e,o,t,p,C){super(e,o,F.WebhookCouponProviderLoader,t);this.activatedRoute=t;this.role=p;this.dialog=C}toastr=g(W);couponProviders=D([]);listProviders=K(()=>this.couponProviders().map(e=>(e.KeyUI=this.generateKeyUI(e.Header),e)));generateKeyUI(e){if(!e||e.length<=25)return e||"";let o=e.substring(0,10),t=e.substring(e.length-10);return`${o}...${t}`}postBindForm(e){this.couponProviders.update(()=>e.Form.CouponProviders.map(t=>({FetchMemberPoint:t.FetchMemberPoint,Enabled:t.Enabled,Name:t.Name,RedeemCoupon:t.RedeemCoupon,ValidateCoupon:t.ValidateCoupon,Header:t.Header})))}addNewCouponProvider(){this.dialog.open(S).afterClosed().pipe(N(e=>w.IsNotEmpty(e)),k(e=>{let o={Name:e.name,ValidateCoupon:e.validateCoupon,RedeemCoupon:e.redeemCoupon,Enabled:e.enabled,Header:e.header};return[...this.couponProviders(),o]})).subscribe(e=>{this.couponProviders.update(()=>e),this.saveCouponProviders(`Coupon provider "${e[e.length-1].Name}" has been successfully added.`)})}onUpdateProvider(e,o){this.dialog.open(S,{data:{name:e.Name,validateCoupon:e.ValidateCoupon,redeemCoupon:e.RedeemCoupon,enabled:e.Enabled,header:e.Header}}).afterClosed().pipe(N(t=>w.IsNotEmpty(t))).subscribe(t=>{let p={Name:t.name,ValidateCoupon:t.validateCoupon,RedeemCoupon:t.redeemCoupon,Enabled:t.enabled,Header:t.header};this.couponProviders.update(C=>(C[o]=p,[...C])),this.saveCouponProviders(`Coupon provider "${t.name}" has been successfully updated.`)})}onDeleteProvider(e){if(confirm("Are you sure you want to delete this coupon provider?")){let o=this.couponProviders()[e]?.Name||"provider";this.couponProviders.update(t=>(t.splice(e,1),[...t])),this.saveCouponProviders(`Coupon provider "${o}" has been successfully deleted.`)}}saveCouponProviders(e){this.httpService.post(F.WebhookCouponProviderSave,this.couponProviders()).subscribe(()=>{this.toastr.success(e||"Coupon provider has been successfully updated.","Success")})}static \u0275fac=function(o){return new(o||r)(c(ue),c(ne),c(B),c(ie),c(le))};static \u0275cmp=E({type:r,selectors:[["app-coupon-configuration"]],features:[V],decls:27,vars:4,consts:[["EMPTY_STATE",""],[3,"pageData","hideSearchDropdown","hideSearchBox"],["type","button",1,"btn","btn-success",3,"click"],[1,"container-fluid","mt-6"],[1,"row"],[1,"col-12"],[1,"table","table-stripped","custom-table"],[1,"thead-light","sticky-top-thead"],[1,"text-center",2,"width","10px"],[2,"width","220px"],[1,"text-center"],["title","Delete provider",1,"fa","fa-xmark","text-danger",2,"cursor","pointer",3,"click"],["role","button",1,"link-primary","cursor-pointer",3,"click"],[1,"p-3","rounded-2",3,"ngClass"],[4,"ngTemplateOutlet"],[1,"table-border-bottom-0"],["colspan","7"]],template:function(o,t){if(o&1){let p=T();n(0,"mainpanel-cmp",1)(1,"actions")(2,"button",2),v("click",function(){return P(p),y(t.addNewCouponProvider())}),a(3," Add "),i()(),n(4,"content")(5,"div",3)(6,"div",4)(7,"div",5)(8,"table",6)(9,"thead",7)(10,"tr"),s(11,"th",8),n(12,"th",9),a(13,"Name"),i(),n(14,"th"),a(15,"Validate Coupon"),i(),n(16,"th"),a(17,"Redeem Coupon"),i(),n(18,"th"),a(19,"Value"),i(),n(20,"th"),a(21,"Status"),i()()(),n(22,"tbody"),u(23,xe,2,0)(24,Te,1,1,"ng-container"),i()()()()(),u(25,Ie,3,0,"ng-template",null,0,q),i()()}if(o&2){let p;m("pageData",t.menuData)("hideSearchDropdown",!0)("hideSearchBox",!0),l(23),f(((p=t.listProviders())==null?null:p.length)>0?23:24)}},dependencies:[M,R,L,ce,se,oe,fe],encapsulation:2})};export{ge as CouponConfigurationComponent};
1
+ import{a as ve}from"./chunk-CXYH2IZT.js";import{a as Ce}from"./chunk-WZV65ZPB.js";import{a as fe}from"./chunk-FCHZ7VUL.js";import"./chunk-BYXBJQAS.js";import{h as se,i as ce}from"./chunk-OUSV72N6.js";import"./chunk-BU6O2DK4.js";import{b as ue}from"./chunk-4NCDQTGK.js";import"./chunk-YQGBGJ5U.js";import"./chunk-XUP2FY5D.js";import{C as de,D as pe,E as me,u as re,v as ae,w as le}from"./chunk-5UTBAGIS.js";import"./chunk-JLOQTYOI.js";import{P as F}from"./chunk-YJVLRBSS.js";import"./chunk-B4243VJD.js";import"./chunk-7COMDF6M.js";import"./chunk-2FWFPV5I.js";import"./chunk-NEEN2JO2.js";import{C as ee,D as oe,E as te,c as z,e as _,h as J,i as Y,p as X,t as Q,u as Z}from"./chunk-LNLGRZBB.js";import"./chunk-2OQ5CGDZ.js";import"./chunk-RUK3LROA.js";import{a as w,d as ie}from"./chunk-MP62IGYR.js";import"./chunk-26WIZL6M.js";import{$a as l,$c as L,Db as f,Dc as q,E as N,Eb as A,Gb as O,Hb as U,Ib as n,Jb as i,Kb as s,Ma as D,Md as B,Nb as H,Nc as K,Ob as T,Qb as v,Rb as h,Td as W,Uc as R,Wd as ne,db as c,dc as $,ec as a,fc as G,gc as I,hd as M,kb as E,na as g,ob as V,pc as b,qb as u,qc as j,t as k,va as P,vb as m,wa as y}from"./chunk-EDB2BAIG.js";import"./chunk-7DCB7DB2.js";var x=r=>({"is-invalid":r});function Pe(r,d){r&1&&(n(0,"div",16),a(1," Provider Name is required "),i())}function ye(r,d){r&1&&(n(0,"div",20),a(1," Validate Coupon URL is required "),i())}function Ee(r,d){r&1&&(n(0,"div",20),a(1," Redeem Coupon URL is required "),i())}function Ge(r,d){r&1&&(n(0,"div",20),a(1,"Key is required"),i())}var S=class r{constructor(d){this.data=d;this.config=new de,this.config.title="Register Provider",this.config.customWidth="600px",this.initForm()}dialogRef=g(re);config;fb=g(ee);formGroup;initForm(){this.formGroup=this.fb.group({name:[this.data?.name||"",[_.required]],validateCoupon:[this.data?.validateCoupon||"",[_.required]],redeemCoupon:[this.data?.redeemCoupon||"",[_.required]],enabled:[this.data?.enabled!==void 0?this.data.enabled:!0],header:[this.data?.header,[_.required]]})}onClose(){this.dialogRef.close()}onOk(){this.formGroup.markAllAsTouched(),!this.formGroup.invalid&&this.dialogRef.close(this.formGroup.value)}static \u0275fac=function(e){return new(e||r)(c(ae))};static \u0275cmp=E({type:r,selectors:[["app-modal-register-provider"]],decls:35,vars:18,consts:[[3,"onOk","onCancel","onClose","config"],[1,"container-fluid","pt-4"],[1,"row"],[1,"col-12"],[3,"formGroup"],[1,"mb-8"],[1,"d-flex","align-items-center"],[1,"flex-grow-1","me-3"],[1,"form-floating-outline","mb-0"],["type","text","placeholder","Provider Name","id","name","name","name","formControlName","name",1,"form-control","bg-white",3,"ngClass"],["for","name"],[2,"width","75px"],[1,"form-check-floating"],[1,"d-flex","justify-content-center","pt-7","pb-4"],["formControlName","enabled"],[1,"labelFilledInput","text-center"],[1,"invalid-feedback","mt-2",2,"display","block"],[1,"form-floating-outline","mb-8"],["type","text","id","validateCoupon","name","validateCoupon","placeholder","Validate Coupon","formControlName","validateCoupon",1,"form-control","bg-white",3,"ngClass"],["for","validateCoupon"],[1,"invalid-feedback"],["type","text","id","redeemCoupon","placeholder","Redeem Coupon","name","redeemCoupon","formControlName","redeemCoupon",1,"form-control","bg-white",3,"ngClass"],["for","redeemCoupon"],[1,"form-floating-outline","mb-3"],["type","text","id","key","name","key","placeholder","Key: E.g. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9","formControlName","header","rows","4",1,"form-control","bg-white",3,"ngClass"],["for","key"]],template:function(e,o){e&1&&(n(0,"modal-material",0),v("onOk",function(){return o.onOk()})("onCancel",function(){return o.onClose()})("onClose",function(){return o.onClose()}),n(1,"content")(2,"div",1)(3,"div",2)(4,"div",3)(5,"form",4)(6,"div",5)(7,"div",6)(8,"div",7)(9,"div",8),s(10,"input",9),n(11,"label",10),a(12,"Coupon Provider"),i()()(),n(13,"div",11)(14,"div",12)(15,"div",13),s(16,"app-customize-toggle",14),i(),n(17,"label",15),a(18,"Enabled"),i()()()(),u(19,Pe,2,0,"div",16),i(),n(20,"div",17),s(21,"input",18),n(22,"label",19),a(23,"Validate Coupon URL"),i(),u(24,ye,2,0,"div",20),i(),n(25,"div",17),s(26,"input",21),n(27,"label",22),a(28,"Redeem Coupon URL"),i(),u(29,Ee,2,0,"div",20),i(),n(30,"div",23),s(31,"textarea",24),n(32,"label",25),a(33,"Request Header (Key: value)"),i(),u(34,Ge,2,0,"div",20),i()()()()()()()),e&2&&(m("config",o.config),l(5),m("formGroup",o.formGroup),l(5),m("ngClass",b(10,x,(o.formGroup.controls.name==null?null:o.formGroup.controls.name.invalid)&&((o.formGroup.controls.name==null?null:o.formGroup.controls.name.dirty)||(o.formGroup.controls.name==null?null:o.formGroup.controls.name.touched)))),l(9),f(o.formGroup.controls.name.invalid&&(o.formGroup.controls.name.dirty||o.formGroup.controls.name.touched)?19:-1),l(2),m("ngClass",b(12,x,(o.formGroup.controls.validateCoupon==null?null:o.formGroup.controls.validateCoupon.invalid)&&((o.formGroup.controls.validateCoupon==null?null:o.formGroup.controls.validateCoupon.dirty)||(o.formGroup.controls.validateCoupon==null?null:o.formGroup.controls.validateCoupon.touched)))),l(3),f(o.formGroup.controls.validateCoupon.invalid&&(o.formGroup.controls.validateCoupon.dirty||o.formGroup.controls.validateCoupon.touched)?24:-1),l(2),m("ngClass",b(14,x,(o.formGroup.controls.redeemCoupon==null?null:o.formGroup.controls.redeemCoupon.invalid)&&((o.formGroup.controls.redeemCoupon==null?null:o.formGroup.controls.redeemCoupon.dirty)||(o.formGroup.controls.redeemCoupon==null?null:o.formGroup.controls.redeemCoupon.touched)))),l(3),f(o.formGroup.controls.redeemCoupon.invalid&&(o.formGroup.controls.redeemCoupon.dirty||o.formGroup.controls.redeemCoupon.touched)?29:-1),l(2),m("ngClass",b(16,x,(o.formGroup.controls.header==null?null:o.formGroup.controls.header.invalid)&&((o.formGroup.controls.header==null?null:o.formGroup.controls.header.dirty)||(o.formGroup.controls.header==null?null:o.formGroup.controls.header.touched)))),l(3),f(o.formGroup.controls.header.invalid&&(o.formGroup.controls.header.dirty||o.formGroup.controls.header.touched)?34:-1))},dependencies:[M,R,te,X,z,J,Y,Q,Z,me,pe,ve],styles:["div.form-check-floating[_ngcontent-%COMP%]{border:1px solid #ced4da;position:relative;border-radius:.25rem!important}.labelFilledInput[_ngcontent-%COMP%]{position:absolute;top:-10px;left:10px;background:#fff;padding-left:4px;padding-right:4px;font-size:.75rem!important;color:#9da2a6}"]})};var Re=(r,d)=>({"bg-success-subtle text-success-emphasis":r,"bg-danger-subtle text-danger-emphasis":d});function Me(r,d){if(r&1){let e=T();n(0,"tr")(1,"td",10)(2,"i",11),v("click",function(){let t=P(e).$index,p=h(2);return y(p.onDeleteProvider(t))}),i()(),n(3,"td")(4,"a",12),v("click",function(){let t=P(e),p=t.$implicit,C=t.$index,he=h(2);return y(he.onUpdateProvider(p,C))}),a(5),i()(),n(6,"td"),a(7),i(),n(8,"td"),a(9),i(),n(10,"td"),a(11),i(),n(12,"td")(13,"span",13),a(14),i()()()}if(r&2){let e=d.$implicit;l(5),I(" ",e.Name," "),l(2),G(e.ValidateCoupon),l(2),G(e.RedeemCoupon),l(2),G(e.KeyUI),l(2),m("ngClass",j(6,Re,e.Enabled,!e.Enabled)),l(),I(" ",e.Enabled?"Enabled":"Disabled"," ")}}function xe(r,d){if(r&1&&O(0,Me,15,9,"tr",null,A),r&2){let e=h();U(e.listProviders())}}function Ne(r,d){r&1&&H(0)}function Te(r,d){if(r&1&&u(0,Ne,1,0,"ng-container",14),r&2){h();let e=$(26);m("ngTemplateOutlet",e)}}function Ie(r,d){r&1&&(n(0,"tr",15)(1,"td",16),s(2,"empty-state-table"),i()())}var ge=class r extends Ce{constructor(e,o,t,p,C){super(e,o,F.WebhookCouponProviderLoader,t);this.activatedRoute=t;this.role=p;this.dialog=C}toastr=g(W);couponProviders=D([]);listProviders=K(()=>this.couponProviders().map(e=>(e.KeyUI=this.generateKeyUI(e.Header),e)));generateKeyUI(e){if(!e||e.length<=25)return e||"";let o=e.substring(0,10),t=e.substring(e.length-10);return`${o}...${t}`}postBindForm(e){this.couponProviders.update(()=>e.Form.CouponProviders.map(t=>({FetchMemberPoint:t.FetchMemberPoint,Enabled:t.Enabled,Name:t.Name,RedeemCoupon:t.RedeemCoupon,ValidateCoupon:t.ValidateCoupon,Header:t.Header})))}addNewCouponProvider(){this.dialog.open(S).afterClosed().pipe(N(e=>w.IsNotEmpty(e)),k(e=>{let o={Name:e.name,ValidateCoupon:e.validateCoupon,RedeemCoupon:e.redeemCoupon,Enabled:e.enabled,Header:e.header};return[...this.couponProviders(),o]})).subscribe(e=>{this.couponProviders.update(()=>e),this.saveCouponProviders(`Coupon provider "${e[e.length-1].Name}" has been successfully added.`)})}onUpdateProvider(e,o){this.dialog.open(S,{data:{name:e.Name,validateCoupon:e.ValidateCoupon,redeemCoupon:e.RedeemCoupon,enabled:e.Enabled,header:e.Header}}).afterClosed().pipe(N(t=>w.IsNotEmpty(t))).subscribe(t=>{let p={Name:t.name,ValidateCoupon:t.validateCoupon,RedeemCoupon:t.redeemCoupon,Enabled:t.enabled,Header:t.header};this.couponProviders.update(C=>(C[o]=p,[...C])),this.saveCouponProviders(`Coupon provider "${t.name}" has been successfully updated.`)})}onDeleteProvider(e){if(confirm("Are you sure you want to delete this coupon provider?")){let o=this.couponProviders()[e]?.Name||"provider";this.couponProviders.update(t=>(t.splice(e,1),[...t])),this.saveCouponProviders(`Coupon provider "${o}" has been successfully deleted.`)}}saveCouponProviders(e){this.httpService.post(F.WebhookCouponProviderSave,this.couponProviders()).subscribe(()=>{this.toastr.success(e||"Coupon provider has been successfully updated.","Success")})}static \u0275fac=function(o){return new(o||r)(c(ue),c(ne),c(B),c(ie),c(le))};static \u0275cmp=E({type:r,selectors:[["app-coupon-configuration"]],features:[V],decls:27,vars:4,consts:[["EMPTY_STATE",""],[3,"pageData","hideSearchDropdown","hideSearchBox"],["type","button",1,"btn","btn-success",3,"click"],[1,"container-fluid","mt-6"],[1,"row"],[1,"col-12"],[1,"table","table-stripped","custom-table"],[1,"thead-light","sticky-top-thead"],[1,"text-center",2,"width","10px"],[2,"width","220px"],[1,"text-center"],["title","Delete provider",1,"fa","fa-xmark","text-danger",2,"cursor","pointer",3,"click"],["role","button",1,"link-primary","cursor-pointer",3,"click"],[1,"p-3","rounded-2",3,"ngClass"],[4,"ngTemplateOutlet"],[1,"table-border-bottom-0"],["colspan","7"]],template:function(o,t){if(o&1){let p=T();n(0,"mainpanel-cmp",1)(1,"actions")(2,"button",2),v("click",function(){return P(p),y(t.addNewCouponProvider())}),a(3," Add "),i()(),n(4,"content")(5,"div",3)(6,"div",4)(7,"div",5)(8,"table",6)(9,"thead",7)(10,"tr"),s(11,"th",8),n(12,"th",9),a(13,"Name"),i(),n(14,"th"),a(15,"Validate Coupon"),i(),n(16,"th"),a(17,"Redeem Coupon"),i(),n(18,"th"),a(19,"Value"),i(),n(20,"th"),a(21,"Status"),i()()(),n(22,"tbody"),u(23,xe,2,0)(24,Te,1,1,"ng-container"),i()()()()(),u(25,Ie,3,0,"ng-template",null,0,q),i()()}if(o&2){let p;m("pageData",t.menuData)("hideSearchDropdown",!0)("hideSearchBox",!0),l(23),f(((p=t.listProviders())==null?null:p.length)>0?23:24)}},dependencies:[M,R,L,ce,se,oe,fe],encapsulation:2})};export{ge as CouponConfigurationComponent};