dealposbooks 5.51.1 → 5.51.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 (56) hide show
  1. package/{chunk-OW6NHTGL.js → chunk-2NSZXE7A.js} +1 -1
  2. package/{chunk-HR6W3DC4.js → chunk-2PW2KI76.js} +1 -1
  3. package/{chunk-N3AQU3B6.js → chunk-2WVFFG26.js} +1 -1
  4. package/{chunk-EO32GXB6.js → chunk-3WP4K427.js} +1 -1
  5. package/{chunk-VANY33VH.js → chunk-45277TJC.js} +1 -1
  6. package/{chunk-LZCLNB3T.js → chunk-53XLJS5G.js} +1 -1
  7. package/{chunk-OZYL2K6P.js → chunk-5M4HQSDE.js} +1 -1
  8. package/{chunk-7XSFPN5T.js → chunk-66XTNHB6.js} +1 -1
  9. package/{chunk-RCHTOR4U.js → chunk-6C5IVTNB.js} +1 -1
  10. package/{chunk-4BAARBYV.js → chunk-AHS622Q3.js} +1 -1
  11. package/{chunk-Y4SHAFGQ.js → chunk-AKHZNBCJ.js} +1 -1
  12. package/{chunk-UNKPZO2B.js → chunk-BAN4BZ4V.js} +1 -1
  13. package/{chunk-IYV5JRCZ.js → chunk-BDIQKQLH.js} +1 -1
  14. package/{chunk-MGEVP222.js → chunk-BXCI7FLO.js} +1 -1
  15. package/{chunk-6JWBYLFX.js → chunk-C4HVS55R.js} +1 -1
  16. package/{chunk-5SDFH3ZF.js → chunk-CP4OMA5A.js} +1 -1
  17. package/{chunk-YZ76QE4R.js → chunk-DD3C4ZJK.js} +1 -1
  18. package/{chunk-YI5IYWUO.js → chunk-EXPUB774.js} +1 -1
  19. package/{chunk-KU3G54A2.js → chunk-F2AUOYRQ.js} +2 -2
  20. package/{chunk-KPSZN2UI.js → chunk-FLSC37KK.js} +1 -1
  21. package/{chunk-IWB6L5HR.js → chunk-FWCM3R4Q.js} +1 -1
  22. package/chunk-FYFGO4SH.js +1 -0
  23. package/{chunk-PXAENMFN.js → chunk-GKPEHY4C.js} +1 -1
  24. package/{chunk-PZCAY2XI.js → chunk-GXWFHDPQ.js} +1 -1
  25. package/{chunk-FUYYSJF7.js → chunk-H3AE3LK2.js} +1 -1
  26. package/{chunk-EZXX3QNG.js → chunk-H7RIXTPZ.js} +1 -1
  27. package/{chunk-FJM77N3D.js → chunk-HIBQ7GQQ.js} +1 -1
  28. package/{chunk-U52NCHP2.js → chunk-IOUEWZQZ.js} +1 -1
  29. package/{chunk-BBR4SZ4S.js → chunk-JC7ZPT6F.js} +1 -1
  30. package/{chunk-VZHZFGQ2.js → chunk-JUDAFNFD.js} +1 -1
  31. package/{chunk-2Z3VSENH.js → chunk-LM3PSBXX.js} +1 -1
  32. package/{chunk-JNPTKMYO.js → chunk-LME6HR4A.js} +1 -1
  33. package/{chunk-G25BIGG3.js → chunk-MYDWRF4X.js} +1 -1
  34. package/{chunk-E2PHUSPH.js → chunk-N3KDIJIC.js} +1 -1
  35. package/{chunk-U7I6X4QJ.js → chunk-N6QZPVZI.js} +2 -2
  36. package/{chunk-3IOJJMQE.js → chunk-NFJAMS74.js} +1 -1
  37. package/{chunk-RA2HD63W.js → chunk-OO2FDGBF.js} +1 -1
  38. package/{chunk-LP4UYVTQ.js → chunk-P5ND3ICW.js} +2 -2
  39. package/{chunk-PQ2NDMDD.js → chunk-PROCZGHH.js} +1 -1
  40. package/{chunk-RNMAINY3.js → chunk-QBBXI37N.js} +1 -1
  41. package/{chunk-JRHKJYE2.js → chunk-QCJYNI45.js} +1 -1
  42. package/{chunk-MDE76CBT.js → chunk-RJDZR2TQ.js} +1 -1
  43. package/{chunk-X7I6QMMX.js → chunk-RRWAF23G.js} +1 -1
  44. package/{chunk-5MLCIFDJ.js → chunk-TBMRVRBG.js} +1 -1
  45. package/{chunk-Z2MDQN57.js → chunk-TPVWARR4.js} +1 -1
  46. package/{chunk-2UDDXT3B.js → chunk-UMXCHIQ6.js} +1 -1
  47. package/{chunk-VYR5D7SO.js → chunk-VF3GNEJQ.js} +1 -1
  48. package/{chunk-3PM6I5JR.js → chunk-VJVH5N44.js} +1 -1
  49. package/{chunk-ZM7C3PCP.js → chunk-W23IXSWP.js} +1 -1
  50. package/{chunk-I3DG6HPA.js → chunk-W2RBWHBT.js} +1 -1
  51. package/{chunk-QSZKELXB.js → chunk-XPKM4HTA.js} +1 -1
  52. package/{chunk-WNEAYP2J.js → chunk-ZBRAMWLM.js} +1 -1
  53. package/index.html +2 -2
  54. package/{main-ARGVLXJ4.js → main-AK3IBIXE.js} +1 -1
  55. package/package.json +1 -1
  56. package/chunk-UMDFA3TV.js +0 -1
@@ -1 +1 @@
1
- import{a as y,b as z}from"./chunk-UNKPZO2B.js";import"./chunk-Y4SHAFGQ.js";import{m as V}from"./chunk-Q4XWXOWE.js";import"./chunk-WL6ZZCYW.js";import{a as j,b as R}from"./chunk-5U7KZJ3H.js";import"./chunk-FHJOSHI3.js";import{i as q}from"./chunk-YI5IYWUO.js";import"./chunk-VM56C6ZV.js";import{a as N,b as G}from"./chunk-ISIYG4D5.js";import"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{w as O,x as D,y as H,z as L}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import"./chunk-MGIEURA2.js";import"./chunk-YZ76QE4R.js";import"./chunk-G3BJCT7T.js";import{a as I}from"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import{p as $,u as F}from"./chunk-DM2JLWKE.js";import{Dc as P,Eb as x,Ec as b,Mb as s,Oc as c,Pb as C,Pc as l,Rb as h,Sc as S,W as M,Wb as n,Xb as o,Y as k,Yb as u,ac as v,fc as T,gc as a,h as E,ia as m,ib as r,qa as g,ra as _,s as f,sa as w,ta as A,yb as B}from"./chunk-6QJHEOXN.js";import"./chunk-YQFG5XE2.js";var J=()=>({height:"calc(100vh - 100px)"});function K(t,d){if(t&1){let e=v();n(0,"p-button",6),T("onClick",function(){g(e);let p=a(2);return _(p.onFormat())}),o()}}function Q(t,d){if(t&1){let e=v();n(0,"p-button",7),c(1,"async"),c(2,"async"),T("onClick",function(){g(e);let p=a(2);return _(p.onMigrate())}),o()}if(t&2){let e=a(2);s("disabled",l(1,2,e.countInBooks$)!==0)("pTooltip",l(2,4,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function U(t,d){if(t&1&&(n(0,"div",3),x(1,K,1,0,"p-button",4)(2,Q,3,6,"p-button",5),o()),t&2){let e=a();r(),h(e.roleService.permissions().migrate.delete?1:-1),r(),h(e.roleService.permissions().migrate.create?2:-1)}}function W(t,d){if(t&1&&(n(0,"p-scroll-panel")(1,"p-panel")(2,"div",8),u(3,"app-migration-cards",9),c(4,"async"),w(),n(5,"svg",10),u(6,"path",11),o(),A(),u(7,"app-migration-cards",12),c(8,"async"),o()()()),t&2){let e=a();C(b(12,J)),r(),C(b(13,J)),r(2),s("migrationCount",l(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),r(4),s("migrationCount",l(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var _e=(()=>{class t{constructor(){this.migrateService=m(y),this.toastr=m(I),this.refresh$=new E(void 0),this.pageTitle="Expense Account",this.roleService=m(V)}ngOnInit(){let e=this.refresh$.pipe(k(()=>this.migrateService.getExpenseAccountCount()),M(1));this.countInPOS$=e.pipe(f(i=>Number(i.pos))),this.countInBooks$=e.pipe(f(i=>Number(i.books)))}onMigrate(){this.migrateService.migrateExpenseAccount().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormat(){window.confirm("Are you sure you want to format this data? This action cannot be undone.")&&this.migrateService.formatExpenseAccount().subscribe(i=>{this.refresh$.next(),this.toastr.success(i.message,"Format Successful")})}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=B({type:t,selectors:[["app-expense-account"]],features:[P([y])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger"],["label","Create","tooltipPosition","left",3,"disabled","pTooltip"],["label","Format","severity","danger",3,"onClick"],["label","Create","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(i,p){i&1&&(n(0,"app-main-panel",2),x(1,U,3,2,"ng-template",null,0,S)(3,W,9,14,"ng-template",null,1,S),o()),i&2&&s("pageTitle",p.pageTitle)},dependencies:[q,F,$,R,j,G,N,L,H,z,D,O],encapsulation:2})}}return t})();export{_e as ExpenseAccountComponent};
1
+ import{a as y,b as z}from"./chunk-BAN4BZ4V.js";import"./chunk-AKHZNBCJ.js";import{m as V}from"./chunk-Q4XWXOWE.js";import"./chunk-WL6ZZCYW.js";import{a as j,b as R}from"./chunk-5U7KZJ3H.js";import"./chunk-FHJOSHI3.js";import{i as q}from"./chunk-EXPUB774.js";import"./chunk-VM56C6ZV.js";import{a as N,b as G}from"./chunk-ISIYG4D5.js";import"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{w as O,x as D,y as H,z as L}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import"./chunk-MGIEURA2.js";import"./chunk-DD3C4ZJK.js";import"./chunk-G3BJCT7T.js";import{a as I}from"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import{p as $,u as F}from"./chunk-DM2JLWKE.js";import{Dc as P,Eb as x,Ec as b,Mb as s,Oc as c,Pb as C,Pc as l,Rb as h,Sc as S,W as M,Wb as n,Xb as o,Y as k,Yb as u,ac as v,fc as T,gc as a,h as E,ia as m,ib as r,qa as g,ra as _,s as f,sa as w,ta as A,yb as B}from"./chunk-6QJHEOXN.js";import"./chunk-YQFG5XE2.js";var J=()=>({height:"calc(100vh - 100px)"});function K(t,d){if(t&1){let e=v();n(0,"p-button",6),T("onClick",function(){g(e);let p=a(2);return _(p.onFormat())}),o()}}function Q(t,d){if(t&1){let e=v();n(0,"p-button",7),c(1,"async"),c(2,"async"),T("onClick",function(){g(e);let p=a(2);return _(p.onMigrate())}),o()}if(t&2){let e=a(2);s("disabled",l(1,2,e.countInBooks$)!==0)("pTooltip",l(2,4,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function U(t,d){if(t&1&&(n(0,"div",3),x(1,K,1,0,"p-button",4)(2,Q,3,6,"p-button",5),o()),t&2){let e=a();r(),h(e.roleService.permissions().migrate.delete?1:-1),r(),h(e.roleService.permissions().migrate.create?2:-1)}}function W(t,d){if(t&1&&(n(0,"p-scroll-panel")(1,"p-panel")(2,"div",8),u(3,"app-migration-cards",9),c(4,"async"),w(),n(5,"svg",10),u(6,"path",11),o(),A(),u(7,"app-migration-cards",12),c(8,"async"),o()()()),t&2){let e=a();C(b(12,J)),r(),C(b(13,J)),r(2),s("migrationCount",l(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),r(4),s("migrationCount",l(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var _e=(()=>{class t{constructor(){this.migrateService=m(y),this.toastr=m(I),this.refresh$=new E(void 0),this.pageTitle="Expense Account",this.roleService=m(V)}ngOnInit(){let e=this.refresh$.pipe(k(()=>this.migrateService.getExpenseAccountCount()),M(1));this.countInPOS$=e.pipe(f(i=>Number(i.pos))),this.countInBooks$=e.pipe(f(i=>Number(i.books)))}onMigrate(){this.migrateService.migrateExpenseAccount().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormat(){window.confirm("Are you sure you want to format this data? This action cannot be undone.")&&this.migrateService.formatExpenseAccount().subscribe(i=>{this.refresh$.next(),this.toastr.success(i.message,"Format Successful")})}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=B({type:t,selectors:[["app-expense-account"]],features:[P([y])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger"],["label","Create","tooltipPosition","left",3,"disabled","pTooltip"],["label","Format","severity","danger",3,"onClick"],["label","Create","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(i,p){i&1&&(n(0,"app-main-panel",2),x(1,U,3,2,"ng-template",null,0,S)(3,W,9,14,"ng-template",null,1,S),o()),i&2&&s("pageTitle",p.pageTitle)},dependencies:[q,F,$,R,j,G,N,L,H,z,D,O],encapsulation:2})}}return t})();export{_e as ExpenseAccountComponent};
@@ -1 +1 @@
1
- import{a as S,b as z}from"./chunk-UNKPZO2B.js";import"./chunk-Y4SHAFGQ.js";import{m as V}from"./chunk-Q4XWXOWE.js";import"./chunk-WL6ZZCYW.js";import{a as A,b as j}from"./chunk-5U7KZJ3H.js";import"./chunk-FHJOSHI3.js";import{i as q}from"./chunk-YI5IYWUO.js";import"./chunk-VM56C6ZV.js";import{a as N,b as G}from"./chunk-ISIYG4D5.js";import"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{w as R,x as D,y as H,z as L}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import"./chunk-MGIEURA2.js";import"./chunk-YZ76QE4R.js";import"./chunk-G3BJCT7T.js";import{a as E}from"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import{p as F,u as I}from"./chunk-DM2JLWKE.js";import{Dc as $,Eb as _,Ec as x,Mb as l,Oc as s,Pb as h,Pc as m,Rb as W,Sc as O,W as b,Wb as o,Xb as r,Y as k,Yb as f,_ as M,ac as C,fc as v,gc as p,h as T,ia as c,ib as n,qa as g,ra as d,s as u,sa as w,ta as B,yb as P}from"./chunk-6QJHEOXN.js";import"./chunk-YQFG5XE2.js";var J=()=>({height:"calc(100vh - 100px)"});function K(t,y){if(t&1){let e=C();o(0,"p-button",6),v("onClick",function(){g(e);let a=p(2);return d(a.onFormat())}),r()}}function Q(t,y){if(t&1){let e=C();o(0,"div",3),_(1,K,1,0,"p-button",4),o(2,"p-button",5),s(3,"async"),s(4,"async"),v("onClick",function(){g(e);let a=p();return d(a.migrateWriteoffOutlet())}),r()()}if(t&2){let e=p();n(),W(e.roleService.permissions().migrate.delete?1:-1),n(),l("disabled",m(3,3,e.countInBooks$)!==0)("pTooltip",m(4,5,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function U(t,y){if(t&1&&(o(0,"p-scroll-panel")(1,"p-panel")(2,"div",7),f(3,"app-migration-cards",8),s(4,"async"),w(),o(5,"svg",9),f(6,"path",10),r(),B(),f(7,"app-migration-cards",11),s(8,"async"),r()()()),t&2){let e=p();h(x(12,J)),n(),h(x(13,J)),n(2),l("migrationCount",m(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),n(4),l("migrationCount",m(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var _e=(()=>{class t{constructor(){this.migrateService=c(S),this.toastr=c(E),this.refresh$=new T(void 0),this.pageTitle="Write-Off Outlet",this.roleService=c(V)}ngOnInit(){let e=this.refresh$.pipe(k(()=>this.migrateService.getWriteOffOutletAccountCount()),M(i=>console.log("API response:",i)),b(1));this.countInPOS$=e.pipe(u(i=>Number(i.pos))),this.countInBooks$=e.pipe(u(i=>Number(i.books)))}migrateWriteoffOutlet(){this.migrateService.migrateWriteOffOutlet().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormat(){confirm("Are you sure you want to format?")&&this.migrateService.formatWriteOff().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Format Successful")})}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=P({type:t,selectors:[["app-writeoff-outlet"]],features:[$([S])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger"],["label","Migrate","tooltipPosition","left",3,"onClick","disabled","pTooltip"],["label","Format","severity","danger",3,"onClick"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(i,a){i&1&&(o(0,"app-main-panel",2),_(1,Q,5,7,"ng-template",null,0,O)(3,U,9,14,"ng-template",null,1,O),r()),i&2&&l("pageTitle",a.pageTitle)},dependencies:[q,I,F,j,A,G,N,L,H,z,D,R],encapsulation:2})}}return t})();export{_e as WriteOffOutletComponent};
1
+ import{a as S,b as z}from"./chunk-BAN4BZ4V.js";import"./chunk-AKHZNBCJ.js";import{m as V}from"./chunk-Q4XWXOWE.js";import"./chunk-WL6ZZCYW.js";import{a as A,b as j}from"./chunk-5U7KZJ3H.js";import"./chunk-FHJOSHI3.js";import{i as q}from"./chunk-EXPUB774.js";import"./chunk-VM56C6ZV.js";import{a as N,b as G}from"./chunk-ISIYG4D5.js";import"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{w as R,x as D,y as H,z as L}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import"./chunk-MGIEURA2.js";import"./chunk-DD3C4ZJK.js";import"./chunk-G3BJCT7T.js";import{a as E}from"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import{p as F,u as I}from"./chunk-DM2JLWKE.js";import{Dc as $,Eb as _,Ec as x,Mb as l,Oc as s,Pb as h,Pc as m,Rb as W,Sc as O,W as b,Wb as o,Xb as r,Y as k,Yb as f,_ as M,ac as C,fc as v,gc as p,h as T,ia as c,ib as n,qa as g,ra as d,s as u,sa as w,ta as B,yb as P}from"./chunk-6QJHEOXN.js";import"./chunk-YQFG5XE2.js";var J=()=>({height:"calc(100vh - 100px)"});function K(t,y){if(t&1){let e=C();o(0,"p-button",6),v("onClick",function(){g(e);let a=p(2);return d(a.onFormat())}),r()}}function Q(t,y){if(t&1){let e=C();o(0,"div",3),_(1,K,1,0,"p-button",4),o(2,"p-button",5),s(3,"async"),s(4,"async"),v("onClick",function(){g(e);let a=p();return d(a.migrateWriteoffOutlet())}),r()()}if(t&2){let e=p();n(),W(e.roleService.permissions().migrate.delete?1:-1),n(),l("disabled",m(3,3,e.countInBooks$)!==0)("pTooltip",m(4,5,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function U(t,y){if(t&1&&(o(0,"p-scroll-panel")(1,"p-panel")(2,"div",7),f(3,"app-migration-cards",8),s(4,"async"),w(),o(5,"svg",9),f(6,"path",10),r(),B(),f(7,"app-migration-cards",11),s(8,"async"),r()()()),t&2){let e=p();h(x(12,J)),n(),h(x(13,J)),n(2),l("migrationCount",m(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),n(4),l("migrationCount",m(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var _e=(()=>{class t{constructor(){this.migrateService=c(S),this.toastr=c(E),this.refresh$=new T(void 0),this.pageTitle="Write-Off Outlet",this.roleService=c(V)}ngOnInit(){let e=this.refresh$.pipe(k(()=>this.migrateService.getWriteOffOutletAccountCount()),M(i=>console.log("API response:",i)),b(1));this.countInPOS$=e.pipe(u(i=>Number(i.pos))),this.countInBooks$=e.pipe(u(i=>Number(i.books)))}migrateWriteoffOutlet(){this.migrateService.migrateWriteOffOutlet().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormat(){confirm("Are you sure you want to format?")&&this.migrateService.formatWriteOff().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Format Successful")})}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=P({type:t,selectors:[["app-writeoff-outlet"]],features:[$([S])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger"],["label","Migrate","tooltipPosition","left",3,"onClick","disabled","pTooltip"],["label","Format","severity","danger",3,"onClick"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(i,a){i&1&&(o(0,"app-main-panel",2),_(1,Q,5,7,"ng-template",null,0,O)(3,U,9,14,"ng-template",null,1,O),r()),i&2&&l("pageTitle",a.pageTitle)},dependencies:[q,I,F,j,A,G,N,L,H,z,D,R],encapsulation:2})}}return t})();export{_e as WriteOffOutletComponent};
@@ -1 +1 @@
1
- import{a as Ze,b as et,c as tt,d as nt,e as ot,f as it}from"./chunk-TAN6GLIH.js";import{a as Xe}from"./chunk-YHLRDTIS.js";import{m as Y}from"./chunk-Q4XWXOWE.js";import"./chunk-WL6ZZCYW.js";import{a as fe,b as ge}from"./chunk-3VQUNDVT.js";import{b as se,c as Ke,g as qe,h as Qe,i as ie}from"./chunk-52EMI2TW.js";import"./chunk-AAKZYXG3.js";import"./chunk-BME4Z6DH.js";import"./chunk-VSDW2RJ5.js";import"./chunk-7L5IAWG2.js";import{a as Ne}from"./chunk-BT7Y4ADP.js";import{a as le,b as me}from"./chunk-5U7KZJ3H.js";import"./chunk-MJGBBYIO.js";import"./chunk-CN6AT4LE.js";import{a as j,b as U}from"./chunk-OW2ND5HU.js";import"./chunk-JWNGZMSE.js";import"./chunk-II7KELI4.js";import"./chunk-FTBQKOYS.js";import"./chunk-L4ENW4RK.js";import{a as Re,b as q}from"./chunk-FHJOSHI3.js";import"./chunk-KONCSTVQ.js";import"./chunk-FMAG3RQL.js";import{i as M}from"./chunk-YI5IYWUO.js";import"./chunk-VM56C6ZV.js";import{a as K,b as W}from"./chunk-ISIYG4D5.js";import{b as Z,c as Te,d as we,e as Me,f as De,g as Ae,h as Je}from"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{o as Ye,w as N,x as G}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import{e as $,f as Pe,j as oe,k as be,m as Oe,n as Ee,o as He,p as Ie,v as Fe,x as J,y as pe}from"./chunk-MGIEURA2.js";import{b as re,d as ze,e as D,l as A}from"./chunk-DZCJWJUG.js";import"./chunk-YZ76QE4R.js";import{a as ye}from"./chunk-G3BJCT7T.js";import"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import{m as V,q as Ue,u as w}from"./chunk-DM2JLWKE.js";import{Dc as ve,Eb as f,Ec as H,Fc as ae,Ha as E,Mb as c,Oc as $e,Pb as X,Pc as We,Rb as B,Sb as P,Sc as u,Ub as b,Vb as O,Wb as r,Xb as a,Y as z,Yb as te,_ as F,ac as v,bd as ne,c as _e,ca as Se,cd as je,fc as y,gc as s,ia as C,ib as p,qa as h,ra as S,s as ee,sc as m,tc as g,uc as I,wc as Ve,yb as T}from"./chunk-6QJHEOXN.js";import{a as _,b as x}from"./chunk-YQFG5XE2.js";var R=(()=>{class t{constructor(){this.httpService=C(ye)}getGlobalConfiguration(){return this.httpService.get(void 0,"/api/setup/GlobalConfiguration")}saveGlobalConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitGlobalConfiguration",e)}fetchPOSOutletConfiguration(e){return this.httpService.get(void 0,"/api/Setup/OutletConfiguration",{params:e})}fetchPOSOutletFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"/api/Setup/OutletConfigurationForm",n)}updatePOSOutletConfiguration(e){return this.httpService.post(void 0,"/api/Setup/SubmitOutletConfiguration",e)}fetchPOSPaymentConfiguration(e){return this.httpService.get(void 0,"/api/Setup/PaymentConfiguration",{params:e})}fetchPOSPaymentFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"api/Setup/PaymentConfigurationForm",n)}updatePOSPaymentConfiguration(e){return this.httpService.post(void 0,"/api/Setup/SubmitPaymentConfiguration",e)}fetchPOSTaxConfiguration(){return this.httpService.get(void 0,"/api/setup/TaxConfigurationForm")}updatePOSTaxConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitTaxConfiguration",e)}fetchPOSWriteOffConfiguration(){return this.httpService.get(void 0,"/api/setup/WriteOffConfigurationList")}fetchPOSWriteOffFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"/api/setup/WriteOffConfigurationForm",n)}updatePOSWriteOffConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitWriteOffConfiguration",e)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=Se({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var k=function(t){return t.POSGLOBAL_SELL="Sell",t.POSGLOBAL_BUY="Buy",t.POSGLOBAL_ADJUSTMENT="Adjustment",t.POSGLOBAL_PREPAID="Prepaid",t.POSGLOBAL_RETURN="Return",t.POSGLOBAL_DEBT="Debt",t.POSGLOBAL_PAYMENTFEE="Payment Fee",t.POSGLOBAL_MANUFACTURING="Manufacturing",t.POSGLOBAL_ADVANCE="Advance",t}(k||{});var at={[k.POSGLOBAL_SELL]:[{typeID:2,side:"debit",label:"Account Receivable"},{typeID:1,side:"credit",label:"Sales"},{typeID:4,side:"debit",label:"COGS"},{typeID:3,side:"credit",label:"Sold Inventory"},{typeID:10,side:"debit",label:"Sales Discount"},{typeID:31,side:"credit",label:"Sold Non-Inventory"}],[k.POSGLOBAL_BUY]:[{typeID:27,side:"debit",label:"Pending Paid Inventory"},{typeID:5,side:"credit",label:"Account Payable"},{typeID:28,side:"debit",label:"Inventory Bought"},{typeID:27,side:"credit",label:"Pending Paid Inventory"},{typeID:11,side:"credit",label:"Purchase Discount"}],[k.POSGLOBAL_ADJUSTMENT]:[{typeID:26,side:"debit",label:"Adjustment Asset"},{typeID:21,side:"credit",label:"Adjustment Expense"}],[k.POSGLOBAL_PREPAID]:[{typeID:29,side:"debit",label:"Accounting for Prepaid"},{typeID:30,side:"debit",label:"Sales For Prepaid"}],[k.POSGLOBAL_RETURN]:[{typeID:8,side:"debit",label:"Sales Return"},{typeID:3,side:"debit",label:"Inventory"},{typeID:4,side:"credit",label:"COGS"},{typeID:9,side:"credit",label:"Purchase Return"}],[k.POSGLOBAL_DEBT]:[{typeID:17,side:"debit",label:"Consignment Payable"}],[k.POSGLOBAL_PAYMENTFEE]:[{typeID:19,side:"debit",label:"Payment Fee"},{typeID:20,side:"credit",label:"Surcharge"}],[k.POSGLOBAL_MANUFACTURING]:[{typeID:24,side:"debit",label:"Finished Goods"},{typeID:23,side:"credit",label:"Raw Material"},{typeID:25,side:"credit",label:"Production Expenses"}],[k.POSGLOBAL_ADVANCE]:[{typeID:15,side:"debit",label:"Crossing Account"},{typeID:16,side:"debit",label:"Retained Earnings"},{typeID:18,side:"debit",label:"Current Earnings"}]};function gt(t,i){if(t&1){let e=v();r(0,"p-button",7),y("onClick",function(){h(e);let o=s(2);return S(o.onSubmit())}),a()}}function xt(t,i){if(t&1&&(r(0,"div",5),f(1,gt,1,0,"p-button",6),a()),t&2){let e=s();p(),B(e.roleService.permissions().posSetup.edit?1:-1)}}function Ct(t,i){if(t&1&&(r(0,"p-tab",11),m(1),a()),t&2){let e=i.$implicit;c("value",e.value),p(),g(e.label)}}function ht(t,i){if(t&1&&(r(0,"div",20)(1,"div")(2,"span"),m(3),a()(),r(4,"div")(5,"span"),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function St(t,i){if(t&1&&(r(0,"div",20)(1,"div")(2,"span"),m(3),a()(),r(4,"div")(5,"span"),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function vt(t,i){if(t&1&&(r(0,"div",15)(1,"div",16)(2,"div",5)(3,"label",17),m(4),a(),r(5,"span",18),m(6),a()(),r(7,"p-select",19),f(8,ht,7,2,"ng-template",null,2,u)(10,St,7,2,"ng-template",null,3,u),a()()()),t&2){let e=i.$implicit,n=s(4);c("formGroupName",e.index),p(4),g(e.entry.value.label),p(2),g(e.entry.value.side),p(),c("options",n.posIntegration().options.accounts)}}function yt(t,i){if(t&1&&(r(0,"div",20)(1,"div")(2,"span"),m(3),a()(),r(4,"div")(5,"span"),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function Pt(t,i){if(t&1&&(r(0,"div",20)(1,"div")(2,"span"),m(3),a()(),r(4,"div")(5,"span"),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function bt(t,i){if(t&1&&(r(0,"div",15)(1,"div",16)(2,"div",5)(3,"label",17),m(4),a(),r(5,"span",21),m(6),a()(),r(7,"p-select",19),f(8,yt,7,2,"ng-template",null,2,u)(10,Pt,7,2,"ng-template",null,3,u),a()()()),t&2){let e=i.$implicit,n=s(4);c("formGroupName",e.index),p(4),g(e.entry.value.label),p(2),g(e.entry.value.side),p(),c("options",n.posIntegration().options.accounts)}}function Ot(t,i){if(t&1&&(r(0,"p-tabpanel",11)(1,"div",12)(2,"div",13)(3,"div",14),b(4,vt,12,4,"div",15,P),a()(),r(6,"div",13)(7,"div",14),b(8,bt,12,4,"div",15,P),a()()()()),t&2){let e=i.$implicit,n=s(3);c("value",e.value),p(),c("formGroupName",e.value),p(3),O(n.getDebitEntries(e.value)),p(4),O(n.getCreditEntries(e.value))}}function Et(t,i){if(t&1){let e=v();r(0,"form",9),y("ngSubmit",function(){h(e);let o=s(2);return S(o.onSubmit())}),r(1,"p-tabs",10)(2,"p-tablist"),b(3,Ct,2,2,"p-tab",11,P),a(),r(5,"p-tabpanels"),b(6,Ot,10,2,"p-tabpanel",11,P),a()()()}if(t&2){let e=s(2);c("formGroup",e.accountForm),p(),c("value",e.tab())("lazy",!0),p(2),O(e.tabs()),p(3),O(e.tabs())}}function It(t,i){if(t&1&&f(0,Et,8,3,"form",8),t&2){let e=s();c("ngIf",e.posIntegration()&&e.accountForm)}}var rt=(()=>{class t{constructor(){this.posConfigService=C(R),this.fb=C(Fe),this.roleService=C(Y),this.tab=E(k.POSGLOBAL_SELL),this.tabs=E(Object.values(k).map(e=>({label:e,value:e}))),this.posIntegration=E(null),this.form=E([]),this.descriptionsMap=new Map,this.objectKeys=Object.keys,this.posGlobalTabEnum=k}ngOnInit(){this.posConfigService.getGlobalConfiguration().pipe(F(e=>{this.posIntegration.set(e),this.form.set(e.form),this.descriptionsMap=new Map(e.descriptions.map(n=>[+n.id,n.name])),this.initializeForm()})).subscribe()}initializeForm(){let e={};this.tabs().forEach(n=>{let o=this.getEntriesForTab(n.value);console.log(`Entries for ${n.value}:`,o),e[n.value]=this.fb.array(o.map(l=>this.createEntryFormGroup(l)))}),this.accountForm=this.fb.group(e)}createEntryFormGroup(e){let n=this.fb.group({typeID:[e.typeID],label:[e.label],side:[e.side],accountID:[this.getAccountIDByTypeID(e.typeID)]});return n.get("accountID").valueChanges.subscribe(o=>{this.syncAccountIDs(e.typeID,o,n)}),n}getAccountIDByTypeID(e){return this.form().find(o=>o.typeID===e)?.accountID||""}getEntriesForTab(e){return at[e]||[]}getTabEntries(e){return this.accountForm.get(e)}onSubmit(){let e=this.accountForm.getRawValue(),n=[],o=new Set;for(let l of Object.values(e))for(let{typeID:d,accountID:L}of l){let de=`${d}_${L}`;o.has(de)||(o.add(de),n.push({typeID:d,accountID:L||Xe}))}console.log("Form submitted with value:",n),this.posConfigService.saveGlobalConfiguration({form:n}).subscribe({next:()=>console.log("Save successful"),error:l=>console.error("Save failed",l)})}getDebitEntries(e){return this.getTabEntries(e).controls.map((n,o)=>({entry:n,index:o})).filter(n=>n.entry.value.side==="debit")}getCreditEntries(e){return this.getTabEntries(e).controls.map((n,o)=>({entry:n,index:o})).filter(n=>n.entry.value.side==="credit")}syncAccountIDs(e,n,o){Object.values(this.accountForm.controls).forEach(l=>{l.controls.forEach(d=>{d!==o&&d.get("typeID")?.value===e&&d.get("accountID")?.value!==n&&d.get("accountID")?.setValue(n,{emitEvent:!1})})})}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-global"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],["pageTitle","POS Integration"],[1,"d-flex","gap-2"],["label","Submit"],["label","Submit",3,"onClick"],[3,"formGroup","ngSubmit",4,"ngIf"],[3,"ngSubmit","formGroup"],[1,"border-top",3,"value","lazy"],[3,"value"],[1,"row",3,"formGroupName"],[1,"col"],[1,"row","gap-3"],[1,"col-12",3,"formGroupName"],[1,"form-group","d-flex","flex-column"],["for","",1,"fs-3"],[1,"text-success","fs-3"],["filter","","filterBy","code,name","formControlName","accountID","optionLabel","name","optionValue","id",3,"options"],[1,"d-flex","align-items-center","gap-2"],[1,"text-danger","fs-3"]],template:function(n,o){n&1&&(r(0,"app-main-panel",4),f(1,xt,2,1,"ng-template",null,0,u)(3,It,1,1,"ng-template",null,1,u),a())},dependencies:[M,it,ot,nt,tt,Ze,et,Ye,U,j,J,be,$,Pe,w,V,A,G,N,pe,Oe,Ie,Ee],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Ft=t=>[t];function Tt(t,i){if(t&1&&(r(0,"th",7),m(1),a()),t&2){let e=i.$implicit;p(),g(e.name.slice(0,10))}}function wt(t,i){if(t&1&&(r(0,"tr")(1,"th",6),m(2,"Method"),a()(),r(3,"tr"),b(4,Tt,2,1,"th",7,P),a()),t&2){let e=s(3);p(4),O(e.paymentConfiguration().outlets)}}function Mt(t,i){if(t&1&&(r(0,"td"),m(1),a()),t&2){let e=i.$implicit;p(),g(e.accountName)}}function Dt(t,i){if(t&1&&(r(0,"tr")(1,"td",8)(2,"a",9),m(3),a()(),b(4,Mt,2,1,"td",null,P),a()),t&2){let e=i.$implicit;p(2),c("routerLink",ae(2,Ft,e.id)),p(),g(e.name),p(),O(e.accounts)}}function At(t,i){if(t&1&&(r(0,"p-table",5),f(1,wt,6,0,"ng-template",null,1,u)(3,Dt,6,4,"ng-template",null,2,u),a()),t&2){let e=s(2);c("value",e.paymentConfiguration().payment)}}function Rt(t,i){if(t&1){let e=v();r(0,"app-main-panel",4),y("search",function(o){h(e);let l=s();return S(l.onSearch(o))}),f(1,At,5,1,"ng-template",null,0,u),a()}t&2&&c("isSearchableInput",!0)("scrollable",!0)}var lt=(()=>{class t{constructor(){this.POSSetupService=C(R),this.paymentConfiguration=E(null)}ngOnInit(){this.POSSetupService.fetchPOSPaymentConfiguration({}).pipe(F(e=>{this.paymentConfiguration.set(e)})).subscribe()}onSearch(e){this.POSSetupService.fetchPOSPaymentConfiguration({Search:e}).pipe(F(n=>{this.paymentConfiguration.set(n)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-payment"]],decls:1,vars:1,consts:[["content",""],["header",""],["body",""],["pageTitle","Payment Method Accounting",3,"isSearchableInput","scrollable","search",4,"ngIf"],["pageTitle","Payment Method Accounting",3,"search","isSearchableInput","scrollable"],[3,"value"],["rowspan","3",2,"min-width","300px"],[2,"min-width","200px"],["pFrozenColumn",""],[1,"link-primary",3,"routerLink"]],template:function(n,o){n&1&&f(0,Rt,3,2,"app-main-panel",3),n&2&&c("ngIf",o.paymentConfiguration())},dependencies:[M,ie,se,Ke,w,V,A,D],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var kt={data:{listOutletAccount:[],listCOAType:[],pageNumber:1,pageSize:20,totalCount:0,totalPages:0},filter:{PageNumber:1,PageSize:20,Search:""}},Ge=Te(Ae(kt),we(t=>({first:ne(()=>(t.filter().PageNumber-1)*t.filter().PageSize+1),end:ne(()=>Math.min(t.filter().PageNumber*t.filter().PageSize,t.data().totalCount))})),De(t=>{let i=C(R);return{updateFilter:n=>{Z(t,o=>x(_({},o),{filter:_(_({},o.filter),n)}))},getPOSOutlets:fe(_e(z(n=>i.fetchPOSOutletConfiguration(n).pipe(ge({next:o=>{Z(t,l=>x(_({},l),{data:o}))},error:o=>{console.error("Error fetching POS outlets:",o)}})))))}}),Me(t=>({onInit:()=>{t.getPOSOutlets(t.filter)}})));var Lt=t=>[t];function Nt(t,i){if(t&1&&(r(0,"th"),m(1),a()),t&2){let e=i.$implicit;p(),g(e.value)}}function Gt(t,i){if(t&1&&(r(0,"tr")(1,"th"),m(2,"Name"),a(),b(3,Nt,2,1,"th",null,P),a()),t&2){let e=s(2);p(3),O(e.store.data().listCOAType)}}function Bt(t,i){if(t&1&&(r(0,"td"),m(1),a()),t&2){let e=i.$implicit;p(),g(e)}}function Vt(t,i){if(t&1&&(r(0,"tr")(1,"td")(2,"a",7),m(3),a()(),b(4,Bt,2,1,"td",null,P),a()),t&2){let e=i.$implicit;p(2),c("routerLink",ae(2,Lt,e.OutletID)),p(),I(" ",e.OutletName,""),p(),O(e.Accounts)}}function $t(t,i){if(t&1&&m(0),t&2){let e=s(2);Ve(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Wt(t,i){t&1&&(r(0,"tr")(1,"td",8)(2,"span"),m(3," No journal entries found. "),a()()())}function jt(t,i){if(t&1){let e=v();r(0,"p-panel")(1,"p-table",6),y("onPage",function(o){h(e);let l=s();return S(l.onPage(o))}),f(2,Gt,5,0,"ng-template",null,1,u)(4,Vt,6,4,"ng-template",null,2,u)(6,$t,1,3,"ng-template",null,3,u)(8,Wt,4,0,"ng-template",null,4,u),a()()}if(t&2){let e=s();p(),c("value",e.store.data().listOutletAccount)("paginator",!0)("rows",e.store.filter().PageSize)("lazy",!0)("totalRecords",e.store.data().totalCount)}}var mt=(()=>{class t{constructor(){this.store=C(Ge)}onSearch(e){this.store.updateFilter({PageNumber:1,PageSize:20,Search:e})}onPage(e){let n=e.first/e.rows+1;this.store.updateFilter(x(_({},this.store.filter()),{PageSize:e.rows,PageNumber:n}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-outlet"]],features:[ve([Ge])],decls:3,vars:2,consts:[["content",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["pageTitle","Outlet Account",3,"search","isSearchableInput","scrollable"],["styleClass","d-flex flex-column justify-content-between h-100",3,"onPage","value","paginator","rows","lazy","totalRecords"],[1,"link","link-primary",3,"routerLink"],["colspan","8"]],template:function(n,o){if(n&1){let l=v();r(0,"app-main-panel",5),y("search",function(L){return h(l),S(o.onSearch(L))}),f(1,jt,10,5,"ng-template",null,0,u),a()}n&2&&c("isSearchableInput",!0)("scrollable",!0)},dependencies:[M,w,q,ie,se,A,D,W,K],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Ut=()=>({height:"calc(100vh - 100px)"}),zt=()=>({height:"calc(100vh - 150px)"});function Ht(t,i){if(t&1){let e=v();r(0,"p-button",7),y("onClick",function(){h(e);let o=s(2);return S(o.updatePOsOutletConfiguration())}),a()}}function Yt(t,i){if(t&1&&(r(0,"a",5),m(1,"Cancel"),a(),f(2,Ht,1,0,"p-button",6)),t&2){let e=s();p(2),B(e.roleService.permissions().posSetup.edit?2:-1)}}function Jt(t,i){if(t&1&&(r(0,"div",17)(1,"div",18)(2,"span"),m(3),a()(),r(4,"div",18)(5,"span",18),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function Kt(t,i){if(t&1&&(r(0,"div",17)(1,"div",18)(2,"span"),m(3),a()(),r(4,"div",19)(5,"span",18),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function qt(t,i){if(t&1&&(r(0,"div",13)(1,"span",15),m(2),a(),r(3,"p-select",16),f(4,Jt,7,2,"ng-template",null,2,u)(6,Kt,7,2,"ng-template",null,3,u),a()()),t&2){let e,n=i.$implicit,o=i.$index,l=s(3);c("formGroupName",o),p(2),g((e=n.get("TypeName"))==null?null:e.value),p(),c("options",l.options.accounts)}}function Qt(t,i){t&1&&te(0,"hr")}function Xt(t,i){if(t&1&&(r(0,"div",10)(1,"h3",11),m(2),$e(3,"titlecase"),a(),r(4,"div",12),b(5,qt,8,3,"div",13,P),a()(),f(7,Qt,1,0,"hr",14)),t&2){let e,n=i.$implicit,o=i.$index,l=i.$index,d=i.$count,L=s(2);c("formGroupName",o),p(2),I(" ",We(3,3,(e=n.get("groupName"))==null?null:e.value)," "),p(3),O(L.getAccountsFormArray(l).controls),p(2),c("ngIf",l!==d-1)}}function Zt(t,i){if(t&1&&(r(0,"p-panel")(1,"p-scroll-panel")(2,"form",8)(3,"div",9),b(4,Xt,8,5,null,null,P),a()()()()),t&2){let e=s();X(H(5,Ut)),p(),X(H(6,zt)),p(),c("formGroup",e.accountsForm),p(2),O(e.accountGroupsArray.controls)}}var st=(()=>{class t{constructor(){this.allAccounts=[],this.options=null,this.outletName="",this.accountGroups=[{name:"sell",typeIds:[1,2,10],accounts:[]},{name:"delivery",typeIds:[3,4],accounts:[]},{name:"buy",typeIds:[27,11,28],accounts:[]},{name:"purchase return",typeIds:[9],accounts:[]},{name:"sales return",typeIds:[8],accounts:[]},{name:"adjustment",typeIds:[21,26],accounts:[]}],this.outletForm=E(null),this.roleService=C(Y),this.route=C(re),this.POSSetupService=C(R),this.fb=C(Fe)}get accountGroupsArray(){return this.accountsForm.get("accountGroups")}ngOnInit(){this.accountsForm=this.fb.group({accountGroups:this.fb.array([])}),this.route.paramMap.pipe(ee(e=>e.get("id")),z(e=>this.POSSetupService.fetchPOSOutletFormConfiguration({outletID:e})),F(e=>{this.allAccounts=e.form,this.options=e.options,this.outletName=e.form[0].OutletName,this.accountGroups.forEach(o=>{o.accounts=this.allAccounts.filter(l=>o.typeIds.includes(l.TypeID))});let n=this.accountsForm.get("accountGroups");this.accountGroups.forEach(o=>{n.push(this.createAccountGroupControl(o))})})).subscribe()}getAccountsFormArray(e){return this.accountGroupsArray.at(e).get("accounts")}updatePOsOutletConfiguration(){let{accountGroups:e}=this.accountsForm.value,n={form:e.flatMap(o=>o.accounts.map(l=>({AccountID:l.AccountID,TypeID:l.TypeID,TypeName:l.TypeName,OutletID:l.OutletID,OutletName:l.OutletName})))};this.POSSetupService.updatePOSOutletConfiguration(n).pipe().subscribe()}createAccountGroupControl(e){return this.fb.group({groupName:[e.name],accounts:this.fb.array(e.accounts.map(n=>this.createAccountControl(n)))})}createAccountControl(e){return this.fb.group({AccountID:[e.AccountID],TypeID:[e.TypeID],TypeName:[e.TypeName],OutletID:[e.OutletID],OutletName:[e.OutletName]})}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-outlet-form"]],decls:5,vars:2,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"hasMainWrapperPadding","pageTitle"],["routerLink","/pages/pos-setup/outlets",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit"],["label","Submit",3,"onClick"],[1,"",3,"formGroup"],["formArrayName","accountGroups",1,"d-flex","flex-column","gap-2"],[1,"row",3,"formGroupName"],[1,"fs-4","fw-semibold"],["formArrayName","accounts",1,"row","row-gap-3"],[1,"col-6",3,"formGroupName"],[4,"ngIf"],[1,"fs-3"],["filter","","filterBy","code,name","formControlName","AccountID","optionLabel","name","optionValue","id","placeholder","Select an account",1,"w-100",3,"options"],[1,"d-flex","gap-2"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&(r(0,"app-main-panel",4),f(1,Yt,3,1,"ng-template",null,0,u)(3,Zt,6,7,"ng-template",null,1,u),a()),n&2&&c("hasMainWrapperPadding",!0)("pageTitle","Edit "+o.outletName)},dependencies:[M,w,V,Ue,q,pe,be,$,Pe,Oe,Ie,Ee,He,U,j,W,K,le,G,N,A,D],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var nn=()=>({height:"calc(100vh - 100px)"}),on=()=>({width:"100%",height:"calc(100vh - 150px)"}),an=()=>({width:"100%"});function rn(t,i){if(t&1){let e=v();r(0,"p-button",8),y("onClick",function(){h(e);let o=s(4);return S(o.updatePOSOutletConfiguration())}),a()}}function pn(t,i){if(t&1&&(r(0,"a",6),m(1,"Cancel"),a(),f(2,rn,1,0,"p-button",7)),t&2){let e=s(3);p(2),B(e.roleService.permissions().posSetup.edit?2:-1)}}function ln(t,i){if(t&1&&(r(0,"div",17)(1,"div",18)(2,"span"),m(3),a()(),r(4,"div",18)(5,"span",18),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function mn(t,i){if(t&1&&(r(0,"div",17)(1,"div",18)(2,"span"),m(3),a()(),r(4,"div",19)(5,"span",18),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function sn(t,i){if(t&1){let e=v();r(0,"div",10)(1,"div",11)(2,"div",12)(3,"label",13),m(4),a()(),te(5,"div",14),r(6,"div",15)(7,"p-select",16),y("ngModelChange",function(o){let l=h(e).$index,d=s(4);return S(d.updateAccountById(o,l))}),f(8,ln,7,2,"ng-template",null,2,u)(10,mn,7,2,"ng-template",null,3,u),a()()()()}if(t&2){let e=i.$implicit,n=i.$index,o=s(4);p(4),g(e.outletName.slice(0,15)),p(3),X(H(7,an)),c("ngModel",o.paymentForm().form.accounts[n].accountID)("options",o.paymentForm().options.chartOfAccount)("virtualScrollItemSize",50)("virtualScroll",!0)}}function cn(t,i){if(t&1&&(r(0,"p-card")(1,"p-scrollpanel")(2,"div",9),b(3,sn,12,8,"div",10,P),a()()()),t&2){let e=s(3);X(H(4,nn)),p(),X(H(5,on)),p(2),O(e.paymentForm().form.accounts)}}function un(t,i){if(t&1&&(r(0,"app-main-panel",4),f(1,pn,3,1,"ng-template",null,0,u)(3,cn,5,6,"ng-template",null,1,u),a()),t&2){let e=s(2);c("hasMainWrapperPadding",!0)("pageTitle",e.paymentForm().form.paymentMethod.name+" Form Accounting")}}function dn(t,i){if(t&1&&f(0,un,5,2,"app-main-panel",5),t&2){let e=s();c("ngIf",e.paymentForm())}}var ct=(()=>{class t{constructor(){this.paymentForm=E(null),this.roleService=C(Y),this.route=C(re),this.POSSetupService=C(R),this.router=C(ze)}ngOnInit(){this.route.paramMap.pipe(ee(e=>+e.get("id")),z(e=>this.POSSetupService.fetchPOSPaymentFormConfiguration({ID:e})),F(e=>{this.paymentForm.set(e)}),Ne("response")).subscribe()}updateAccountById(e,n){let o=this.paymentForm().form.accounts,l=x(_({},this.paymentForm()),{form:x(_({},this.paymentForm().form),{accounts:o.map((d,L)=>L===n?x(_({},d),{accountID:e}):d)})});this.paymentForm.set(l)}updatePOSOutletConfiguration(){let e={form:[...this.paymentForm().form.accounts]};this.POSSetupService.updatePOSPaymentConfiguration(e).pipe(Ne("response"),F(()=>{this.router.navigate(["/pages/pos-setup/payments"])})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-payment-form"]],decls:1,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"hasMainWrapperPadding","pageTitle"],[3,"hasMainWrapperPadding","pageTitle",4,"ngIf"],["routerLink","/pages/pos-setup/payments",1,"p-button","p-button-outlined","p-button-secondary"],["label","Submit"],["label","Submit",3,"onClick"],[1,"row","row-gap-3"],[1,"col-6","d-flex","flex-column","gap-2"],[1,"row","row-gap-4"],[1,"col-2"],["for",""],[1,"col-3"],[1,"col-7"],["filter","","filterBy","name,code","optionLabel","name","optionValue","id","placeholder","Select an account",1,"w-full",3,"ngModelChange","ngModel","options","virtualScrollItemSize","virtualScroll"],[1,"d-flex","gap-2"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&f(0,dn,1,1,"app-main-panel",4),n&2&&B(o.paymentForm()?0:-1)},dependencies:[q,Re,M,w,V,me,le,U,j,J,$,oe,A,D,G,N,W],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();function _n(t,i){if(t&1){let e=v();r(0,"p-button",8),y("onClick",function(){h(e);let o=s(2);return S(o.updatePOSTaxConfiguration())}),a()}}function fn(t,i){if(t&1&&(r(0,"div",5)(1,"a",6),m(2,"Cancel"),a(),f(3,_n,1,0,"p-button",7),a()),t&2){let e=s();p(3),B(e.roleService.permissions().posSetup.edit?3:-1)}}function gn(t,i){if(t&1&&(r(0,"div",5)(1,"div",16)(2,"span"),m(3),a()(),r(4,"div",16)(5,"span",16),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function xn(t,i){if(t&1&&(r(0,"div",5)(1,"div",16)(2,"span"),m(3),a()(),r(4,"div",17)(5,"span",16),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function Cn(t,i){if(t&1){let e=v();r(0,"div",12)(1,"div",13)(2,"label",14),m(3),a(),r(4,"p-select",15),y("ngModelChange",function(o){let l=h(e).$index,d=s(2);return S(d.updateAccountID(o,l))}),f(5,gn,7,2,"ng-template",null,2,u)(7,xn,7,2,"ng-template",null,3,u),a()()()}if(t&2){let e=i.$implicit,n=i.$index,o=s(2);p(3),g(e.name),p(),c("ngModel",o.taxForm().form[n].accountID)("options",o.taxForm().options.chartOfAccount)}}function hn(t,i){if(t&1&&(r(0,"p-panel")(1,"div",9)(2,"div",10)(3,"div",11),b(4,Cn,9,3,"div",12,P),a()()()()),t&2){let e=s();p(4),O(e.taxForm().form)}}var ut=(()=>{class t{constructor(){this.taxForm=E(null),this.roleService=C(Y),this.POSSetupService=C(R)}ngOnInit(){this.POSSetupService.fetchPOSTaxConfiguration().pipe(F(e=>{this.taxForm.set(e)})).subscribe()}updateAccountID(e,n){let o=this.taxForm().form,l=x(_({},this.taxForm()),{form:o.map((d,L)=>L===n?x(_({},d),{accountID:e}):d)});this.taxForm.set(l)}updatePOSTaxConfiguration(){let e={form:[...this.taxForm().form]};this.POSSetupService.updatePOSTaxConfiguration(e).pipe(F(n=>console.log(n))).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-tax"]],decls:5,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],["pageTitle","Tax Setup",3,"scrollable"],[1,"d-flex","gap-2"],["routerLink","..",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit"],["label","Submit",3,"onClick"],[1,"row"],[1,"col-4"],[1,"row","row-gap-3"],[1,"col-12"],[1,"d-flex","flex-column"],["for",""],["filter","","filterBy","name,code","optionLabel","name","optionValue","id","placeholder","Select an Account",3,"ngModelChange","ngModel","options"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&(r(0,"app-main-panel",4),f(1,fn,4,1,"ng-template",null,0,u)(3,hn,6,0,"ng-template",null,1,u),a()),n&2&&c("scrollable",!0)},dependencies:[M,q,w,U,j,me,J,$,oe,A,D,G,N,W,K],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Sn=()=>({"min-width":"50rem"}),vn=t=>[t];function yn(t,i){t&1&&te(0,"p-button",6)}function Pn(t,i){if(t&1&&f(0,yn,1,0,"p-button",5),t&2){let e=s();c("ngIf",e.hasCheckedItems())}}function bn(t,i){t&1&&(r(0,"tr")(1,"th",8),te(2,"p-tableHeaderCheckbox"),a(),r(3,"th"),m(4,"Name"),a(),r(5,"th"),m(6,"Description"),a()())}function On(t,i){if(t&1&&(r(0,"tr")(1,"td"),te(2,"p-tableCheckbox",9),a(),r(3,"td")(4,"a",10),m(5),a()(),r(6,"td"),m(7),a()()),t&2){let e=i.$implicit;p(2),c("value",e),p(2),c("routerLink",ae(4,vn,e.id)),p(),g(e.name),p(2),g(e.description)}}function En(t,i){if(t&1){let e=v();r(0,"p-panel")(1,"p-table",7),y("onRowSelect",function(o){h(e);let l=s();return S(l.onRowSelect(o))})("onRowUnselect",function(o){h(e);let l=s();return S(l.onRowSelect(o))})("onHeaderCheckboxToggle",function(o){h(e);let l=s();return S(l.onSelectAll(o))}),f(2,bn,7,0,"ng-template",null,2,u)(4,On,8,6,"ng-template",null,3,u),a()()}if(t&2){let e=s();p(),c("value",e.writeoffList().data)("tableStyle",H(2,Sn))}}var dt=(()=>{class t{constructor(){this.POSSetupService=C(R),this.writeoffList=E(null),this.hasCheckedItems=ne(()=>{let e=this.writeoffList();return!e||!e.data||!Array.isArray(e.data)?!1:e.data.some(n=>n&&n.checked===!0)})}ngOnInit(){this.POSSetupService.fetchPOSWriteOffConfiguration().pipe(ee(e=>x(_({},e),{data:e.data.map(n=>x(_({},n),{checked:!1}))})),F(e=>{this.writeoffList.set(e)})).subscribe()}onRowSelect(e){console.log("Selected Row:",e.data);let n=this.writeoffList();if(!n||!n.data)return;let o=n.data.findIndex(l=>l.id===e.data.id);if(o!==-1){let l=[...n.data];l[o]=x(_({},l[o]),{checked:!l[o].checked}),this.writeoffList.set(x(_({},n),{data:l}))}}onSelectAll(e){let n=this.writeoffList();if(!n?.data)return;let o=n.data.map(l=>x(_({},l),{checked:e.checked}));this.writeoffList.set(x(_({},n),{data:o}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-writeoff"]],decls:5,vars:1,consts:[["actionButton",""],["content",""],["header",""],["body",""],["pageTitle","Write Off",3,"scrollable"],["severity","danger","label","Delete","icon","fa-solid fa-trash",4,"ngIf"],["severity","danger","label","Delete","icon","fa-solid fa-trash"],["dataKey","id",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value","tableStyle"],[2,"width","1rem"],[3,"value"],[1,"link-primary",3,"routerLink"]],template:function(n,o){n&1&&(r(0,"app-main-panel",4),f(1,Pn,1,1,"ng-template",null,0,u)(3,En,6,3,"ng-template",null,1,u),a()),n&2&&c("scrollable",!0)},dependencies:[M,w,V,ie,se,qe,Qe,A,D,G,N,W,K],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var In=()=>({witdh:"100%",height:"calc(100vh - 150px)"});function Fn(t,i){if(t&1){let e=v();r(0,"div",6)(1,"a",7),m(2,"Cancel"),a(),r(3,"p-button",8),y("onClick",function(){h(e);let o=s(2);return S(o.updateWriteOffConfiguration())}),a()()}}function Tn(t,i){if(t&1&&(r(0,"div",6)(1,"span",16),m(2),a(),r(3,"span",16),m(4),a()()),t&2){let e=i.$implicit;p(2),I("(",e.code,")"),p(2),g(e.name)}}function wn(t,i){if(t&1&&(r(0,"div",6)(1,"span",16),m(2),a(),r(3,"span",16),m(4),a()()),t&2){let e=i.$implicit;p(2),I("(",e.code,")"),p(2),g(e.name)}}function Mn(t,i){if(t&1){let e=v();r(0,"div",12)(1,"div",13)(2,"label",14),m(3),a(),r(4,"p-select",15),y("ngModelChange",function(o){let l=h(e).$index,d=s(3);return S(d.updateAccountById(o,l))}),f(5,Tn,5,2,"ng-template",null,2,u)(7,wn,5,2,"ng-template",null,3,u),a()()()}if(t&2){let e=i.$implicit,n=s(3);p(3),g(e.name),p(),c("ngModel",e.accountID)("options",n.writeOffForm().options.account)("virtualScroll",!0)("virtualScrollItemSize",50)}}function Dn(t,i){if(t&1&&(r(0,"p-card")(1,"p-scroll-panel")(2,"div",9)(3,"div",10)(4,"div",11),b(5,Mn,9,5,"div",12,P),a()()()()()),t&2){let e=s(2);p(),X(H(2,In)),p(4),O(e.writeOffForm().form)}}function An(t,i){if(t&1&&(r(0,"app-main-panel",5),f(1,Fn,4,0,"ng-template",null,0,u)(3,Dn,7,3,"ng-template",null,1,u),a()),t&2){let e=s();c("pageTitle","Write Off Form "+e.writeOffForm().info.name)("hasMainWrapperPadding",!0)}}var _t=(()=>{class t{constructor(){this.POSSetupService=C(R),this.route=C(re),this.writeOffForm=E(null)}ngOnInit(){this.route.paramMap.pipe(ee(e=>e.get("id")),z(e=>this.POSSetupService.fetchPOSWriteOffFormConfiguration({ID:e})),F(e=>this.writeOffForm.set(e))).subscribe()}updateAccountById(e,n){let o=this.writeOffForm().form,l=x(_({},this.writeOffForm()),{form:o.map((d,L)=>L===n?x(_({},d),{accountID:e}):d)});this.writeOffForm.set(l)}updateWriteOffConfiguration(){let e={form:this.writeOffForm().form};this.POSSetupService.updatePOSWriteOffConfiguration(e).pipe().subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-writeoff-form"]],decls:1,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"pageTitle","hasMainWrapperPadding",4,"ngIf"],[3,"pageTitle","hasMainWrapperPadding"],[1,"d-flex","gap-2"],["routerLink","/pages/pos-setup/writeoff",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"onClick"],[1,"row"],[1,"col"],[1,"row","row-gap-3"],[1,"col-3"],[1,"d-flex","flex-column"],["for","",1,"d-inline-block","text-truncate",2,"max-width","300px"],["filter","","filterBy","name,code","optionLabel","name","filter","","filterBy","name,code","optionValue","id","placeholder","Select an account",3,"ngModelChange","ngModel","options","virtualScroll","virtualScrollItemSize"],[1,""]],template:function(n,o){n&1&&f(0,An,5,2,"app-main-panel",4),n&2&&c("ngIf",o.writeOffForm())},dependencies:[M,w,V,q,Re,me,le,U,j,J,$,oe,A,D,G,N],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Le=(()=>{class t{constructor(){this.httpService=C(ye)}getExpenseOptions(){return this.httpService.get(void 0,"/api/SetupExpenseOption/GetExpenseOptions")}getExpenseOptionsLoader(){return this.httpService.get(void 0,"/api/SetupExpenseOptionLoader/GetExpenseOptions")}updatePOSExpenseOptionConfiguration(e){return this.httpService.put(void 0,"/api/SetupExpenseOption/UpdateExpenseAccount",e)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=Se({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Rn={data:{expenseOptions:[],options:{chartOfAccountOptions:[]}}},Be=Te(Ae(Rn),Je("POSExpenseOptionStore"),we(t=>({hasCheckedRows:ne(()=>t.data().expenseOptions.some(i=>i.checked)),checkedInvoice:ne(()=>t.data().expenseOptions.filter(i=>i.checked).map(i=>i.id))})),De(t=>{let i=C(Le);return{onRowSelect(n){Z(t,o=>{let l=o.data.expenseOptions.map(d=>d.id===n.id?x(_({},d),{checked:!0}):d);return x(_({},o),{data:x(_({},o.data),{expenseOptions:l})})})},onRowUnselect(n){Z(t,o=>{let l=o.data.expenseOptions.map(d=>d.id===n.id?x(_({},d),{checked:!1}):d);return x(_({},o),{data:x(_({},o.data),{expenseOptions:l})})})},onHeaderCheckboxToggle(n){Z(t,o=>{let l=o.data.expenseOptions.map(d=>x(_({},d),{checked:n}));return x(_({},o),{data:x(_({},o.data),{expenseOptions:l})})})},getExpenseOptions:fe(_e(z(()=>i.getExpenseOptions().pipe(ge({next:n=>{Z(t,o=>x(_({},o),{data:x(_({},o.data),{expenseOptions:n.expenseOptions.map(l=>x(_({},l),{checked:!1}))})}))},error:n=>{console.error("Error fetching expense options:",n)}}))))),getExpenseOptionsLoader:fe(_e(z(()=>i.getExpenseOptionsLoader().pipe(ge({next:n=>{Z(t,o=>x(_({},o),{data:x(_({},o.data),{options:{chartOfAccountOptions:n.options.chartOfAccountOptions}})}))},error:n=>{console.error("Error fetching expense options:",n)}})))))}}),Me({onInit:t=>{t.getExpenseOptions(),t.getExpenseOptionsLoader()}}));function kn(t,i){if(t&1){let e=v();r(0,"p-button",8),y("onClick",function(){h(e);let o=s(2);return S(o.updatePOSExpenseOptionConfiguration())}),a()}}function Ln(t,i){if(t&1&&(r(0,"div",5)(1,"a",6),m(2,"Cancel"),a(),f(3,kn,1,0,"p-button",7),a()),t&2){let e=s();p(3),B(e.roleService.permissions().posSetup.edit?3:-1)}}function Nn(t,i){if(t&1&&(r(0,"div",5)(1,"div",15)(2,"span",15),m(3),a()()()),t&2){let e=i.$implicit;p(3),g(e.value)}}function Gn(t,i){if(t&1&&(r(0,"div",5)(1,"div",16)(2,"span",15),m(3),a()()()),t&2){let e=i.$implicit;p(3),g(e.value)}}function Bn(t,i){if(t&1){let e=v();r(0,"div",11)(1,"div",12)(2,"label",13),m(3),a(),r(4,"p-select",14),y("ngModelChange",function(o){let l=h(e).$index,d=s(3);return S(d.updateData(o,l))}),f(5,Nn,4,1,"ng-template",null,2,u)(7,Gn,4,1,"ng-template",null,3,u),a()()()}if(t&2){let e,n=i.$implicit,o=i.$index,l=s(3);p(3),g(n.name),p(),c("ngModel",((e=l.expenseOptForm().ListData[o])==null?null:e.AccountID)||"")("options",l.store.data().options.chartOfAccountOptions)}}function Vn(t,i){if(t&1&&b(0,Bn,9,3,"div",11,P),t&2){let e=s(2);O(e.store.data().expenseOptions)}}function $n(t,i){t&1&&(r(0,"div",10)(1,"p"),m(2,"No expense options available."),a()())}function Wn(t,i){if(t&1&&(r(0,"p-panel")(1,"div",9)(2,"div",10)(3,"div",9),f(4,Vn,2,0)(5,$n,3,0,"div",10),a()()()()),t&2){let e=s();p(4),B(e.store.data().expenseOptions&&e.store.data().expenseOptions.length?4:5)}}var ft=(()=>{class t{constructor(){this.store=C(Be),this.roleService=C(Y),this.expenseOptForm=E({ListData:[]}),this.expenseOptService=C(Le),this.originalData=E([]),je(()=>{let e=this.store.data().expenseOptions;if(e&&e.length>0){let n=e.map(o=>({ID:o.id,AccountID:o.accountID||""}));this.expenseOptForm.set({ListData:n}),this.originalData.set([...n])}})}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){Array.isArray(e.data)?e.data.forEach(n=>{this.store.onRowUnselect(n)}):this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}updatePOSExpenseOptionConfiguration(){let e=this.expenseOptForm().ListData,n=this.originalData(),o=e.filter((d,L)=>{let de=n[L];return de&&d.AccountID!==de.AccountID});if(o.length===0)return;let l={ListData:o};this.expenseOptService.updatePOSExpenseOptionConfiguration(l).pipe(F(d=>{console.log("Update response:",d),this.originalData.set([...e])})).subscribe()}updateData(e,n){let l=[...this.expenseOptForm().ListData];l[n]&&(l[n]=x(_({},l[n]),{AccountID:e}),this.expenseOptForm.set({ListData:l}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-expense-option"]],features:[ve([Be])],decls:5,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],["pageTitle","Expense Option",3,"scrollable"],[1,"d-flex","gap-2"],["routerLink","..",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit"],["label","Submit",3,"onClick"],[1,"row"],[1,"col-12"],[1,"col-4"],[1,"d-flex","flex-column","card","rounded-3","p-3","border"],["for",""],["filter","","filterBy","key,value","optionLabel","value","optionValue","key","placeholder","Select COA",3,"ngModelChange","ngModel","options"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&(r(0,"app-main-panel",4),f(1,Ln,4,1,"ng-template",null,0,u)(3,Wn,6,1,"ng-template",null,1,u),a()),n&2&&c("scrollable",!0)},dependencies:[M,ie,W,K,G,N,w,D,U,j,pe,$,J,oe],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var nr=[{path:"",redirectTo:"global",pathMatch:"full"},{path:"",children:[{path:"global",component:rt},{path:"outlets",component:mt},{path:"outlets/:id",component:st},{path:"payments",component:lt},{path:"payments/:id",component:ct},{path:"taxs",component:ut},{path:"writeoff",component:dt},{path:"writeoff/:id",component:_t},{path:"expense-option",component:ft}]}];export{nr as POS_SETUP_ROUTES};
1
+ import{a as Ze,b as et,c as tt,d as nt,e as ot,f as it}from"./chunk-TAN6GLIH.js";import{a as Xe}from"./chunk-YHLRDTIS.js";import{m as Y}from"./chunk-Q4XWXOWE.js";import"./chunk-WL6ZZCYW.js";import{a as fe,b as ge}from"./chunk-3VQUNDVT.js";import{b as se,c as Ke,g as qe,h as Qe,i as ie}from"./chunk-52EMI2TW.js";import"./chunk-AAKZYXG3.js";import"./chunk-BME4Z6DH.js";import"./chunk-VSDW2RJ5.js";import"./chunk-7L5IAWG2.js";import{a as Ne}from"./chunk-BT7Y4ADP.js";import{a as le,b as me}from"./chunk-5U7KZJ3H.js";import"./chunk-MJGBBYIO.js";import"./chunk-CN6AT4LE.js";import{a as j,b as U}from"./chunk-OW2ND5HU.js";import"./chunk-JWNGZMSE.js";import"./chunk-II7KELI4.js";import"./chunk-FTBQKOYS.js";import"./chunk-L4ENW4RK.js";import{a as Re,b as q}from"./chunk-FHJOSHI3.js";import"./chunk-KONCSTVQ.js";import"./chunk-FMAG3RQL.js";import{i as M}from"./chunk-EXPUB774.js";import"./chunk-VM56C6ZV.js";import{a as K,b as W}from"./chunk-ISIYG4D5.js";import{b as Z,c as Te,d as we,e as Me,f as De,g as Ae,h as Je}from"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{o as Ye,w as N,x as G}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import{e as $,f as Pe,j as oe,k as be,m as Oe,n as Ee,o as He,p as Ie,v as Fe,x as J,y as pe}from"./chunk-MGIEURA2.js";import{b as re,d as ze,e as D,l as A}from"./chunk-DZCJWJUG.js";import"./chunk-DD3C4ZJK.js";import{a as ye}from"./chunk-G3BJCT7T.js";import"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import{m as V,q as Ue,u as w}from"./chunk-DM2JLWKE.js";import{Dc as ve,Eb as f,Ec as H,Fc as ae,Ha as E,Mb as c,Oc as $e,Pb as X,Pc as We,Rb as B,Sb as P,Sc as u,Ub as b,Vb as O,Wb as r,Xb as a,Y as z,Yb as te,_ as F,ac as v,bd as ne,c as _e,ca as Se,cd as je,fc as y,gc as s,ia as C,ib as p,qa as h,ra as S,s as ee,sc as m,tc as g,uc as I,wc as Ve,yb as T}from"./chunk-6QJHEOXN.js";import{a as _,b as x}from"./chunk-YQFG5XE2.js";var R=(()=>{class t{constructor(){this.httpService=C(ye)}getGlobalConfiguration(){return this.httpService.get(void 0,"/api/setup/GlobalConfiguration")}saveGlobalConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitGlobalConfiguration",e)}fetchPOSOutletConfiguration(e){return this.httpService.get(void 0,"/api/Setup/OutletConfiguration",{params:e})}fetchPOSOutletFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"/api/Setup/OutletConfigurationForm",n)}updatePOSOutletConfiguration(e){return this.httpService.post(void 0,"/api/Setup/SubmitOutletConfiguration",e)}fetchPOSPaymentConfiguration(e){return this.httpService.get(void 0,"/api/Setup/PaymentConfiguration",{params:e})}fetchPOSPaymentFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"api/Setup/PaymentConfigurationForm",n)}updatePOSPaymentConfiguration(e){return this.httpService.post(void 0,"/api/Setup/SubmitPaymentConfiguration",e)}fetchPOSTaxConfiguration(){return this.httpService.get(void 0,"/api/setup/TaxConfigurationForm")}updatePOSTaxConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitTaxConfiguration",e)}fetchPOSWriteOffConfiguration(){return this.httpService.get(void 0,"/api/setup/WriteOffConfigurationList")}fetchPOSWriteOffFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"/api/setup/WriteOffConfigurationForm",n)}updatePOSWriteOffConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitWriteOffConfiguration",e)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=Se({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var k=function(t){return t.POSGLOBAL_SELL="Sell",t.POSGLOBAL_BUY="Buy",t.POSGLOBAL_ADJUSTMENT="Adjustment",t.POSGLOBAL_PREPAID="Prepaid",t.POSGLOBAL_RETURN="Return",t.POSGLOBAL_DEBT="Debt",t.POSGLOBAL_PAYMENTFEE="Payment Fee",t.POSGLOBAL_MANUFACTURING="Manufacturing",t.POSGLOBAL_ADVANCE="Advance",t}(k||{});var at={[k.POSGLOBAL_SELL]:[{typeID:2,side:"debit",label:"Account Receivable"},{typeID:1,side:"credit",label:"Sales"},{typeID:4,side:"debit",label:"COGS"},{typeID:3,side:"credit",label:"Sold Inventory"},{typeID:10,side:"debit",label:"Sales Discount"},{typeID:31,side:"credit",label:"Sold Non-Inventory"}],[k.POSGLOBAL_BUY]:[{typeID:27,side:"debit",label:"Pending Paid Inventory"},{typeID:5,side:"credit",label:"Account Payable"},{typeID:28,side:"debit",label:"Inventory Bought"},{typeID:27,side:"credit",label:"Pending Paid Inventory"},{typeID:11,side:"credit",label:"Purchase Discount"}],[k.POSGLOBAL_ADJUSTMENT]:[{typeID:26,side:"debit",label:"Adjustment Asset"},{typeID:21,side:"credit",label:"Adjustment Expense"}],[k.POSGLOBAL_PREPAID]:[{typeID:29,side:"debit",label:"Accounting for Prepaid"},{typeID:30,side:"debit",label:"Sales For Prepaid"}],[k.POSGLOBAL_RETURN]:[{typeID:8,side:"debit",label:"Sales Return"},{typeID:3,side:"debit",label:"Inventory"},{typeID:4,side:"credit",label:"COGS"},{typeID:9,side:"credit",label:"Purchase Return"}],[k.POSGLOBAL_DEBT]:[{typeID:17,side:"debit",label:"Consignment Payable"}],[k.POSGLOBAL_PAYMENTFEE]:[{typeID:19,side:"debit",label:"Payment Fee"},{typeID:20,side:"credit",label:"Surcharge"}],[k.POSGLOBAL_MANUFACTURING]:[{typeID:24,side:"debit",label:"Finished Goods"},{typeID:23,side:"credit",label:"Raw Material"},{typeID:25,side:"credit",label:"Production Expenses"}],[k.POSGLOBAL_ADVANCE]:[{typeID:15,side:"debit",label:"Crossing Account"},{typeID:16,side:"debit",label:"Retained Earnings"},{typeID:18,side:"debit",label:"Current Earnings"}]};function gt(t,i){if(t&1){let e=v();r(0,"p-button",7),y("onClick",function(){h(e);let o=s(2);return S(o.onSubmit())}),a()}}function xt(t,i){if(t&1&&(r(0,"div",5),f(1,gt,1,0,"p-button",6),a()),t&2){let e=s();p(),B(e.roleService.permissions().posSetup.edit?1:-1)}}function Ct(t,i){if(t&1&&(r(0,"p-tab",11),m(1),a()),t&2){let e=i.$implicit;c("value",e.value),p(),g(e.label)}}function ht(t,i){if(t&1&&(r(0,"div",20)(1,"div")(2,"span"),m(3),a()(),r(4,"div")(5,"span"),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function St(t,i){if(t&1&&(r(0,"div",20)(1,"div")(2,"span"),m(3),a()(),r(4,"div")(5,"span"),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function vt(t,i){if(t&1&&(r(0,"div",15)(1,"div",16)(2,"div",5)(3,"label",17),m(4),a(),r(5,"span",18),m(6),a()(),r(7,"p-select",19),f(8,ht,7,2,"ng-template",null,2,u)(10,St,7,2,"ng-template",null,3,u),a()()()),t&2){let e=i.$implicit,n=s(4);c("formGroupName",e.index),p(4),g(e.entry.value.label),p(2),g(e.entry.value.side),p(),c("options",n.posIntegration().options.accounts)}}function yt(t,i){if(t&1&&(r(0,"div",20)(1,"div")(2,"span"),m(3),a()(),r(4,"div")(5,"span"),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function Pt(t,i){if(t&1&&(r(0,"div",20)(1,"div")(2,"span"),m(3),a()(),r(4,"div")(5,"span"),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function bt(t,i){if(t&1&&(r(0,"div",15)(1,"div",16)(2,"div",5)(3,"label",17),m(4),a(),r(5,"span",21),m(6),a()(),r(7,"p-select",19),f(8,yt,7,2,"ng-template",null,2,u)(10,Pt,7,2,"ng-template",null,3,u),a()()()),t&2){let e=i.$implicit,n=s(4);c("formGroupName",e.index),p(4),g(e.entry.value.label),p(2),g(e.entry.value.side),p(),c("options",n.posIntegration().options.accounts)}}function Ot(t,i){if(t&1&&(r(0,"p-tabpanel",11)(1,"div",12)(2,"div",13)(3,"div",14),b(4,vt,12,4,"div",15,P),a()(),r(6,"div",13)(7,"div",14),b(8,bt,12,4,"div",15,P),a()()()()),t&2){let e=i.$implicit,n=s(3);c("value",e.value),p(),c("formGroupName",e.value),p(3),O(n.getDebitEntries(e.value)),p(4),O(n.getCreditEntries(e.value))}}function Et(t,i){if(t&1){let e=v();r(0,"form",9),y("ngSubmit",function(){h(e);let o=s(2);return S(o.onSubmit())}),r(1,"p-tabs",10)(2,"p-tablist"),b(3,Ct,2,2,"p-tab",11,P),a(),r(5,"p-tabpanels"),b(6,Ot,10,2,"p-tabpanel",11,P),a()()()}if(t&2){let e=s(2);c("formGroup",e.accountForm),p(),c("value",e.tab())("lazy",!0),p(2),O(e.tabs()),p(3),O(e.tabs())}}function It(t,i){if(t&1&&f(0,Et,8,3,"form",8),t&2){let e=s();c("ngIf",e.posIntegration()&&e.accountForm)}}var rt=(()=>{class t{constructor(){this.posConfigService=C(R),this.fb=C(Fe),this.roleService=C(Y),this.tab=E(k.POSGLOBAL_SELL),this.tabs=E(Object.values(k).map(e=>({label:e,value:e}))),this.posIntegration=E(null),this.form=E([]),this.descriptionsMap=new Map,this.objectKeys=Object.keys,this.posGlobalTabEnum=k}ngOnInit(){this.posConfigService.getGlobalConfiguration().pipe(F(e=>{this.posIntegration.set(e),this.form.set(e.form),this.descriptionsMap=new Map(e.descriptions.map(n=>[+n.id,n.name])),this.initializeForm()})).subscribe()}initializeForm(){let e={};this.tabs().forEach(n=>{let o=this.getEntriesForTab(n.value);console.log(`Entries for ${n.value}:`,o),e[n.value]=this.fb.array(o.map(l=>this.createEntryFormGroup(l)))}),this.accountForm=this.fb.group(e)}createEntryFormGroup(e){let n=this.fb.group({typeID:[e.typeID],label:[e.label],side:[e.side],accountID:[this.getAccountIDByTypeID(e.typeID)]});return n.get("accountID").valueChanges.subscribe(o=>{this.syncAccountIDs(e.typeID,o,n)}),n}getAccountIDByTypeID(e){return this.form().find(o=>o.typeID===e)?.accountID||""}getEntriesForTab(e){return at[e]||[]}getTabEntries(e){return this.accountForm.get(e)}onSubmit(){let e=this.accountForm.getRawValue(),n=[],o=new Set;for(let l of Object.values(e))for(let{typeID:d,accountID:L}of l){let de=`${d}_${L}`;o.has(de)||(o.add(de),n.push({typeID:d,accountID:L||Xe}))}console.log("Form submitted with value:",n),this.posConfigService.saveGlobalConfiguration({form:n}).subscribe({next:()=>console.log("Save successful"),error:l=>console.error("Save failed",l)})}getDebitEntries(e){return this.getTabEntries(e).controls.map((n,o)=>({entry:n,index:o})).filter(n=>n.entry.value.side==="debit")}getCreditEntries(e){return this.getTabEntries(e).controls.map((n,o)=>({entry:n,index:o})).filter(n=>n.entry.value.side==="credit")}syncAccountIDs(e,n,o){Object.values(this.accountForm.controls).forEach(l=>{l.controls.forEach(d=>{d!==o&&d.get("typeID")?.value===e&&d.get("accountID")?.value!==n&&d.get("accountID")?.setValue(n,{emitEvent:!1})})})}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-global"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],["pageTitle","POS Integration"],[1,"d-flex","gap-2"],["label","Submit"],["label","Submit",3,"onClick"],[3,"formGroup","ngSubmit",4,"ngIf"],[3,"ngSubmit","formGroup"],[1,"border-top",3,"value","lazy"],[3,"value"],[1,"row",3,"formGroupName"],[1,"col"],[1,"row","gap-3"],[1,"col-12",3,"formGroupName"],[1,"form-group","d-flex","flex-column"],["for","",1,"fs-3"],[1,"text-success","fs-3"],["filter","","filterBy","code,name","formControlName","accountID","optionLabel","name","optionValue","id",3,"options"],[1,"d-flex","align-items-center","gap-2"],[1,"text-danger","fs-3"]],template:function(n,o){n&1&&(r(0,"app-main-panel",4),f(1,xt,2,1,"ng-template",null,0,u)(3,It,1,1,"ng-template",null,1,u),a())},dependencies:[M,it,ot,nt,tt,Ze,et,Ye,U,j,J,be,$,Pe,w,V,A,G,N,pe,Oe,Ie,Ee],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Ft=t=>[t];function Tt(t,i){if(t&1&&(r(0,"th",7),m(1),a()),t&2){let e=i.$implicit;p(),g(e.name.slice(0,10))}}function wt(t,i){if(t&1&&(r(0,"tr")(1,"th",6),m(2,"Method"),a()(),r(3,"tr"),b(4,Tt,2,1,"th",7,P),a()),t&2){let e=s(3);p(4),O(e.paymentConfiguration().outlets)}}function Mt(t,i){if(t&1&&(r(0,"td"),m(1),a()),t&2){let e=i.$implicit;p(),g(e.accountName)}}function Dt(t,i){if(t&1&&(r(0,"tr")(1,"td",8)(2,"a",9),m(3),a()(),b(4,Mt,2,1,"td",null,P),a()),t&2){let e=i.$implicit;p(2),c("routerLink",ae(2,Ft,e.id)),p(),g(e.name),p(),O(e.accounts)}}function At(t,i){if(t&1&&(r(0,"p-table",5),f(1,wt,6,0,"ng-template",null,1,u)(3,Dt,6,4,"ng-template",null,2,u),a()),t&2){let e=s(2);c("value",e.paymentConfiguration().payment)}}function Rt(t,i){if(t&1){let e=v();r(0,"app-main-panel",4),y("search",function(o){h(e);let l=s();return S(l.onSearch(o))}),f(1,At,5,1,"ng-template",null,0,u),a()}t&2&&c("isSearchableInput",!0)("scrollable",!0)}var lt=(()=>{class t{constructor(){this.POSSetupService=C(R),this.paymentConfiguration=E(null)}ngOnInit(){this.POSSetupService.fetchPOSPaymentConfiguration({}).pipe(F(e=>{this.paymentConfiguration.set(e)})).subscribe()}onSearch(e){this.POSSetupService.fetchPOSPaymentConfiguration({Search:e}).pipe(F(n=>{this.paymentConfiguration.set(n)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-payment"]],decls:1,vars:1,consts:[["content",""],["header",""],["body",""],["pageTitle","Payment Method Accounting",3,"isSearchableInput","scrollable","search",4,"ngIf"],["pageTitle","Payment Method Accounting",3,"search","isSearchableInput","scrollable"],[3,"value"],["rowspan","3",2,"min-width","300px"],[2,"min-width","200px"],["pFrozenColumn",""],[1,"link-primary",3,"routerLink"]],template:function(n,o){n&1&&f(0,Rt,3,2,"app-main-panel",3),n&2&&c("ngIf",o.paymentConfiguration())},dependencies:[M,ie,se,Ke,w,V,A,D],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var kt={data:{listOutletAccount:[],listCOAType:[],pageNumber:1,pageSize:20,totalCount:0,totalPages:0},filter:{PageNumber:1,PageSize:20,Search:""}},Ge=Te(Ae(kt),we(t=>({first:ne(()=>(t.filter().PageNumber-1)*t.filter().PageSize+1),end:ne(()=>Math.min(t.filter().PageNumber*t.filter().PageSize,t.data().totalCount))})),De(t=>{let i=C(R);return{updateFilter:n=>{Z(t,o=>x(_({},o),{filter:_(_({},o.filter),n)}))},getPOSOutlets:fe(_e(z(n=>i.fetchPOSOutletConfiguration(n).pipe(ge({next:o=>{Z(t,l=>x(_({},l),{data:o}))},error:o=>{console.error("Error fetching POS outlets:",o)}})))))}}),Me(t=>({onInit:()=>{t.getPOSOutlets(t.filter)}})));var Lt=t=>[t];function Nt(t,i){if(t&1&&(r(0,"th"),m(1),a()),t&2){let e=i.$implicit;p(),g(e.value)}}function Gt(t,i){if(t&1&&(r(0,"tr")(1,"th"),m(2,"Name"),a(),b(3,Nt,2,1,"th",null,P),a()),t&2){let e=s(2);p(3),O(e.store.data().listCOAType)}}function Bt(t,i){if(t&1&&(r(0,"td"),m(1),a()),t&2){let e=i.$implicit;p(),g(e)}}function Vt(t,i){if(t&1&&(r(0,"tr")(1,"td")(2,"a",7),m(3),a()(),b(4,Bt,2,1,"td",null,P),a()),t&2){let e=i.$implicit;p(2),c("routerLink",ae(2,Lt,e.OutletID)),p(),I(" ",e.OutletName,""),p(),O(e.Accounts)}}function $t(t,i){if(t&1&&m(0),t&2){let e=s(2);Ve(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Wt(t,i){t&1&&(r(0,"tr")(1,"td",8)(2,"span"),m(3," No journal entries found. "),a()()())}function jt(t,i){if(t&1){let e=v();r(0,"p-panel")(1,"p-table",6),y("onPage",function(o){h(e);let l=s();return S(l.onPage(o))}),f(2,Gt,5,0,"ng-template",null,1,u)(4,Vt,6,4,"ng-template",null,2,u)(6,$t,1,3,"ng-template",null,3,u)(8,Wt,4,0,"ng-template",null,4,u),a()()}if(t&2){let e=s();p(),c("value",e.store.data().listOutletAccount)("paginator",!0)("rows",e.store.filter().PageSize)("lazy",!0)("totalRecords",e.store.data().totalCount)}}var mt=(()=>{class t{constructor(){this.store=C(Ge)}onSearch(e){this.store.updateFilter({PageNumber:1,PageSize:20,Search:e})}onPage(e){let n=e.first/e.rows+1;this.store.updateFilter(x(_({},this.store.filter()),{PageSize:e.rows,PageNumber:n}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-outlet"]],features:[ve([Ge])],decls:3,vars:2,consts:[["content",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["pageTitle","Outlet Account",3,"search","isSearchableInput","scrollable"],["styleClass","d-flex flex-column justify-content-between h-100",3,"onPage","value","paginator","rows","lazy","totalRecords"],[1,"link","link-primary",3,"routerLink"],["colspan","8"]],template:function(n,o){if(n&1){let l=v();r(0,"app-main-panel",5),y("search",function(L){return h(l),S(o.onSearch(L))}),f(1,jt,10,5,"ng-template",null,0,u),a()}n&2&&c("isSearchableInput",!0)("scrollable",!0)},dependencies:[M,w,q,ie,se,A,D,W,K],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Ut=()=>({height:"calc(100vh - 100px)"}),zt=()=>({height:"calc(100vh - 150px)"});function Ht(t,i){if(t&1){let e=v();r(0,"p-button",7),y("onClick",function(){h(e);let o=s(2);return S(o.updatePOsOutletConfiguration())}),a()}}function Yt(t,i){if(t&1&&(r(0,"a",5),m(1,"Cancel"),a(),f(2,Ht,1,0,"p-button",6)),t&2){let e=s();p(2),B(e.roleService.permissions().posSetup.edit?2:-1)}}function Jt(t,i){if(t&1&&(r(0,"div",17)(1,"div",18)(2,"span"),m(3),a()(),r(4,"div",18)(5,"span",18),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function Kt(t,i){if(t&1&&(r(0,"div",17)(1,"div",18)(2,"span"),m(3),a()(),r(4,"div",19)(5,"span",18),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function qt(t,i){if(t&1&&(r(0,"div",13)(1,"span",15),m(2),a(),r(3,"p-select",16),f(4,Jt,7,2,"ng-template",null,2,u)(6,Kt,7,2,"ng-template",null,3,u),a()()),t&2){let e,n=i.$implicit,o=i.$index,l=s(3);c("formGroupName",o),p(2),g((e=n.get("TypeName"))==null?null:e.value),p(),c("options",l.options.accounts)}}function Qt(t,i){t&1&&te(0,"hr")}function Xt(t,i){if(t&1&&(r(0,"div",10)(1,"h3",11),m(2),$e(3,"titlecase"),a(),r(4,"div",12),b(5,qt,8,3,"div",13,P),a()(),f(7,Qt,1,0,"hr",14)),t&2){let e,n=i.$implicit,o=i.$index,l=i.$index,d=i.$count,L=s(2);c("formGroupName",o),p(2),I(" ",We(3,3,(e=n.get("groupName"))==null?null:e.value)," "),p(3),O(L.getAccountsFormArray(l).controls),p(2),c("ngIf",l!==d-1)}}function Zt(t,i){if(t&1&&(r(0,"p-panel")(1,"p-scroll-panel")(2,"form",8)(3,"div",9),b(4,Xt,8,5,null,null,P),a()()()()),t&2){let e=s();X(H(5,Ut)),p(),X(H(6,zt)),p(),c("formGroup",e.accountsForm),p(2),O(e.accountGroupsArray.controls)}}var st=(()=>{class t{constructor(){this.allAccounts=[],this.options=null,this.outletName="",this.accountGroups=[{name:"sell",typeIds:[1,2,10],accounts:[]},{name:"delivery",typeIds:[3,4],accounts:[]},{name:"buy",typeIds:[27,11,28],accounts:[]},{name:"purchase return",typeIds:[9],accounts:[]},{name:"sales return",typeIds:[8],accounts:[]},{name:"adjustment",typeIds:[21,26],accounts:[]}],this.outletForm=E(null),this.roleService=C(Y),this.route=C(re),this.POSSetupService=C(R),this.fb=C(Fe)}get accountGroupsArray(){return this.accountsForm.get("accountGroups")}ngOnInit(){this.accountsForm=this.fb.group({accountGroups:this.fb.array([])}),this.route.paramMap.pipe(ee(e=>e.get("id")),z(e=>this.POSSetupService.fetchPOSOutletFormConfiguration({outletID:e})),F(e=>{this.allAccounts=e.form,this.options=e.options,this.outletName=e.form[0].OutletName,this.accountGroups.forEach(o=>{o.accounts=this.allAccounts.filter(l=>o.typeIds.includes(l.TypeID))});let n=this.accountsForm.get("accountGroups");this.accountGroups.forEach(o=>{n.push(this.createAccountGroupControl(o))})})).subscribe()}getAccountsFormArray(e){return this.accountGroupsArray.at(e).get("accounts")}updatePOsOutletConfiguration(){let{accountGroups:e}=this.accountsForm.value,n={form:e.flatMap(o=>o.accounts.map(l=>({AccountID:l.AccountID,TypeID:l.TypeID,TypeName:l.TypeName,OutletID:l.OutletID,OutletName:l.OutletName})))};this.POSSetupService.updatePOSOutletConfiguration(n).pipe().subscribe()}createAccountGroupControl(e){return this.fb.group({groupName:[e.name],accounts:this.fb.array(e.accounts.map(n=>this.createAccountControl(n)))})}createAccountControl(e){return this.fb.group({AccountID:[e.AccountID],TypeID:[e.TypeID],TypeName:[e.TypeName],OutletID:[e.OutletID],OutletName:[e.OutletName]})}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-outlet-form"]],decls:5,vars:2,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"hasMainWrapperPadding","pageTitle"],["routerLink","/pages/pos-setup/outlets",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit"],["label","Submit",3,"onClick"],[1,"",3,"formGroup"],["formArrayName","accountGroups",1,"d-flex","flex-column","gap-2"],[1,"row",3,"formGroupName"],[1,"fs-4","fw-semibold"],["formArrayName","accounts",1,"row","row-gap-3"],[1,"col-6",3,"formGroupName"],[4,"ngIf"],[1,"fs-3"],["filter","","filterBy","code,name","formControlName","AccountID","optionLabel","name","optionValue","id","placeholder","Select an account",1,"w-100",3,"options"],[1,"d-flex","gap-2"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&(r(0,"app-main-panel",4),f(1,Yt,3,1,"ng-template",null,0,u)(3,Zt,6,7,"ng-template",null,1,u),a()),n&2&&c("hasMainWrapperPadding",!0)("pageTitle","Edit "+o.outletName)},dependencies:[M,w,V,Ue,q,pe,be,$,Pe,Oe,Ie,Ee,He,U,j,W,K,le,G,N,A,D],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var nn=()=>({height:"calc(100vh - 100px)"}),on=()=>({width:"100%",height:"calc(100vh - 150px)"}),an=()=>({width:"100%"});function rn(t,i){if(t&1){let e=v();r(0,"p-button",8),y("onClick",function(){h(e);let o=s(4);return S(o.updatePOSOutletConfiguration())}),a()}}function pn(t,i){if(t&1&&(r(0,"a",6),m(1,"Cancel"),a(),f(2,rn,1,0,"p-button",7)),t&2){let e=s(3);p(2),B(e.roleService.permissions().posSetup.edit?2:-1)}}function ln(t,i){if(t&1&&(r(0,"div",17)(1,"div",18)(2,"span"),m(3),a()(),r(4,"div",18)(5,"span",18),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function mn(t,i){if(t&1&&(r(0,"div",17)(1,"div",18)(2,"span"),m(3),a()(),r(4,"div",19)(5,"span",18),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function sn(t,i){if(t&1){let e=v();r(0,"div",10)(1,"div",11)(2,"div",12)(3,"label",13),m(4),a()(),te(5,"div",14),r(6,"div",15)(7,"p-select",16),y("ngModelChange",function(o){let l=h(e).$index,d=s(4);return S(d.updateAccountById(o,l))}),f(8,ln,7,2,"ng-template",null,2,u)(10,mn,7,2,"ng-template",null,3,u),a()()()()}if(t&2){let e=i.$implicit,n=i.$index,o=s(4);p(4),g(e.outletName.slice(0,15)),p(3),X(H(7,an)),c("ngModel",o.paymentForm().form.accounts[n].accountID)("options",o.paymentForm().options.chartOfAccount)("virtualScrollItemSize",50)("virtualScroll",!0)}}function cn(t,i){if(t&1&&(r(0,"p-card")(1,"p-scrollpanel")(2,"div",9),b(3,sn,12,8,"div",10,P),a()()()),t&2){let e=s(3);X(H(4,nn)),p(),X(H(5,on)),p(2),O(e.paymentForm().form.accounts)}}function un(t,i){if(t&1&&(r(0,"app-main-panel",4),f(1,pn,3,1,"ng-template",null,0,u)(3,cn,5,6,"ng-template",null,1,u),a()),t&2){let e=s(2);c("hasMainWrapperPadding",!0)("pageTitle",e.paymentForm().form.paymentMethod.name+" Form Accounting")}}function dn(t,i){if(t&1&&f(0,un,5,2,"app-main-panel",5),t&2){let e=s();c("ngIf",e.paymentForm())}}var ct=(()=>{class t{constructor(){this.paymentForm=E(null),this.roleService=C(Y),this.route=C(re),this.POSSetupService=C(R),this.router=C(ze)}ngOnInit(){this.route.paramMap.pipe(ee(e=>+e.get("id")),z(e=>this.POSSetupService.fetchPOSPaymentFormConfiguration({ID:e})),F(e=>{this.paymentForm.set(e)}),Ne("response")).subscribe()}updateAccountById(e,n){let o=this.paymentForm().form.accounts,l=x(_({},this.paymentForm()),{form:x(_({},this.paymentForm().form),{accounts:o.map((d,L)=>L===n?x(_({},d),{accountID:e}):d)})});this.paymentForm.set(l)}updatePOSOutletConfiguration(){let e={form:[...this.paymentForm().form.accounts]};this.POSSetupService.updatePOSPaymentConfiguration(e).pipe(Ne("response"),F(()=>{this.router.navigate(["/pages/pos-setup/payments"])})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-payment-form"]],decls:1,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"hasMainWrapperPadding","pageTitle"],[3,"hasMainWrapperPadding","pageTitle",4,"ngIf"],["routerLink","/pages/pos-setup/payments",1,"p-button","p-button-outlined","p-button-secondary"],["label","Submit"],["label","Submit",3,"onClick"],[1,"row","row-gap-3"],[1,"col-6","d-flex","flex-column","gap-2"],[1,"row","row-gap-4"],[1,"col-2"],["for",""],[1,"col-3"],[1,"col-7"],["filter","","filterBy","name,code","optionLabel","name","optionValue","id","placeholder","Select an account",1,"w-full",3,"ngModelChange","ngModel","options","virtualScrollItemSize","virtualScroll"],[1,"d-flex","gap-2"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&f(0,dn,1,1,"app-main-panel",4),n&2&&B(o.paymentForm()?0:-1)},dependencies:[q,Re,M,w,V,me,le,U,j,J,$,oe,A,D,G,N,W],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();function _n(t,i){if(t&1){let e=v();r(0,"p-button",8),y("onClick",function(){h(e);let o=s(2);return S(o.updatePOSTaxConfiguration())}),a()}}function fn(t,i){if(t&1&&(r(0,"div",5)(1,"a",6),m(2,"Cancel"),a(),f(3,_n,1,0,"p-button",7),a()),t&2){let e=s();p(3),B(e.roleService.permissions().posSetup.edit?3:-1)}}function gn(t,i){if(t&1&&(r(0,"div",5)(1,"div",16)(2,"span"),m(3),a()(),r(4,"div",16)(5,"span",16),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function xn(t,i){if(t&1&&(r(0,"div",5)(1,"div",16)(2,"span"),m(3),a()(),r(4,"div",17)(5,"span",16),m(6),a()()()),t&2){let e=i.$implicit;p(3),I("(",e.code,")"),p(3),g(e.name)}}function Cn(t,i){if(t&1){let e=v();r(0,"div",12)(1,"div",13)(2,"label",14),m(3),a(),r(4,"p-select",15),y("ngModelChange",function(o){let l=h(e).$index,d=s(2);return S(d.updateAccountID(o,l))}),f(5,gn,7,2,"ng-template",null,2,u)(7,xn,7,2,"ng-template",null,3,u),a()()()}if(t&2){let e=i.$implicit,n=i.$index,o=s(2);p(3),g(e.name),p(),c("ngModel",o.taxForm().form[n].accountID)("options",o.taxForm().options.chartOfAccount)}}function hn(t,i){if(t&1&&(r(0,"p-panel")(1,"div",9)(2,"div",10)(3,"div",11),b(4,Cn,9,3,"div",12,P),a()()()()),t&2){let e=s();p(4),O(e.taxForm().form)}}var ut=(()=>{class t{constructor(){this.taxForm=E(null),this.roleService=C(Y),this.POSSetupService=C(R)}ngOnInit(){this.POSSetupService.fetchPOSTaxConfiguration().pipe(F(e=>{this.taxForm.set(e)})).subscribe()}updateAccountID(e,n){let o=this.taxForm().form,l=x(_({},this.taxForm()),{form:o.map((d,L)=>L===n?x(_({},d),{accountID:e}):d)});this.taxForm.set(l)}updatePOSTaxConfiguration(){let e={form:[...this.taxForm().form]};this.POSSetupService.updatePOSTaxConfiguration(e).pipe(F(n=>console.log(n))).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-tax"]],decls:5,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],["pageTitle","Tax Setup",3,"scrollable"],[1,"d-flex","gap-2"],["routerLink","..",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit"],["label","Submit",3,"onClick"],[1,"row"],[1,"col-4"],[1,"row","row-gap-3"],[1,"col-12"],[1,"d-flex","flex-column"],["for",""],["filter","","filterBy","name,code","optionLabel","name","optionValue","id","placeholder","Select an Account",3,"ngModelChange","ngModel","options"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&(r(0,"app-main-panel",4),f(1,fn,4,1,"ng-template",null,0,u)(3,hn,6,0,"ng-template",null,1,u),a()),n&2&&c("scrollable",!0)},dependencies:[M,q,w,U,j,me,J,$,oe,A,D,G,N,W,K],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Sn=()=>({"min-width":"50rem"}),vn=t=>[t];function yn(t,i){t&1&&te(0,"p-button",6)}function Pn(t,i){if(t&1&&f(0,yn,1,0,"p-button",5),t&2){let e=s();c("ngIf",e.hasCheckedItems())}}function bn(t,i){t&1&&(r(0,"tr")(1,"th",8),te(2,"p-tableHeaderCheckbox"),a(),r(3,"th"),m(4,"Name"),a(),r(5,"th"),m(6,"Description"),a()())}function On(t,i){if(t&1&&(r(0,"tr")(1,"td"),te(2,"p-tableCheckbox",9),a(),r(3,"td")(4,"a",10),m(5),a()(),r(6,"td"),m(7),a()()),t&2){let e=i.$implicit;p(2),c("value",e),p(2),c("routerLink",ae(4,vn,e.id)),p(),g(e.name),p(2),g(e.description)}}function En(t,i){if(t&1){let e=v();r(0,"p-panel")(1,"p-table",7),y("onRowSelect",function(o){h(e);let l=s();return S(l.onRowSelect(o))})("onRowUnselect",function(o){h(e);let l=s();return S(l.onRowSelect(o))})("onHeaderCheckboxToggle",function(o){h(e);let l=s();return S(l.onSelectAll(o))}),f(2,bn,7,0,"ng-template",null,2,u)(4,On,8,6,"ng-template",null,3,u),a()()}if(t&2){let e=s();p(),c("value",e.writeoffList().data)("tableStyle",H(2,Sn))}}var dt=(()=>{class t{constructor(){this.POSSetupService=C(R),this.writeoffList=E(null),this.hasCheckedItems=ne(()=>{let e=this.writeoffList();return!e||!e.data||!Array.isArray(e.data)?!1:e.data.some(n=>n&&n.checked===!0)})}ngOnInit(){this.POSSetupService.fetchPOSWriteOffConfiguration().pipe(ee(e=>x(_({},e),{data:e.data.map(n=>x(_({},n),{checked:!1}))})),F(e=>{this.writeoffList.set(e)})).subscribe()}onRowSelect(e){console.log("Selected Row:",e.data);let n=this.writeoffList();if(!n||!n.data)return;let o=n.data.findIndex(l=>l.id===e.data.id);if(o!==-1){let l=[...n.data];l[o]=x(_({},l[o]),{checked:!l[o].checked}),this.writeoffList.set(x(_({},n),{data:l}))}}onSelectAll(e){let n=this.writeoffList();if(!n?.data)return;let o=n.data.map(l=>x(_({},l),{checked:e.checked}));this.writeoffList.set(x(_({},n),{data:o}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-writeoff"]],decls:5,vars:1,consts:[["actionButton",""],["content",""],["header",""],["body",""],["pageTitle","Write Off",3,"scrollable"],["severity","danger","label","Delete","icon","fa-solid fa-trash",4,"ngIf"],["severity","danger","label","Delete","icon","fa-solid fa-trash"],["dataKey","id",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value","tableStyle"],[2,"width","1rem"],[3,"value"],[1,"link-primary",3,"routerLink"]],template:function(n,o){n&1&&(r(0,"app-main-panel",4),f(1,Pn,1,1,"ng-template",null,0,u)(3,En,6,3,"ng-template",null,1,u),a()),n&2&&c("scrollable",!0)},dependencies:[M,w,V,ie,se,qe,Qe,A,D,G,N,W,K],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var In=()=>({witdh:"100%",height:"calc(100vh - 150px)"});function Fn(t,i){if(t&1){let e=v();r(0,"div",6)(1,"a",7),m(2,"Cancel"),a(),r(3,"p-button",8),y("onClick",function(){h(e);let o=s(2);return S(o.updateWriteOffConfiguration())}),a()()}}function Tn(t,i){if(t&1&&(r(0,"div",6)(1,"span",16),m(2),a(),r(3,"span",16),m(4),a()()),t&2){let e=i.$implicit;p(2),I("(",e.code,")"),p(2),g(e.name)}}function wn(t,i){if(t&1&&(r(0,"div",6)(1,"span",16),m(2),a(),r(3,"span",16),m(4),a()()),t&2){let e=i.$implicit;p(2),I("(",e.code,")"),p(2),g(e.name)}}function Mn(t,i){if(t&1){let e=v();r(0,"div",12)(1,"div",13)(2,"label",14),m(3),a(),r(4,"p-select",15),y("ngModelChange",function(o){let l=h(e).$index,d=s(3);return S(d.updateAccountById(o,l))}),f(5,Tn,5,2,"ng-template",null,2,u)(7,wn,5,2,"ng-template",null,3,u),a()()()}if(t&2){let e=i.$implicit,n=s(3);p(3),g(e.name),p(),c("ngModel",e.accountID)("options",n.writeOffForm().options.account)("virtualScroll",!0)("virtualScrollItemSize",50)}}function Dn(t,i){if(t&1&&(r(0,"p-card")(1,"p-scroll-panel")(2,"div",9)(3,"div",10)(4,"div",11),b(5,Mn,9,5,"div",12,P),a()()()()()),t&2){let e=s(2);p(),X(H(2,In)),p(4),O(e.writeOffForm().form)}}function An(t,i){if(t&1&&(r(0,"app-main-panel",5),f(1,Fn,4,0,"ng-template",null,0,u)(3,Dn,7,3,"ng-template",null,1,u),a()),t&2){let e=s();c("pageTitle","Write Off Form "+e.writeOffForm().info.name)("hasMainWrapperPadding",!0)}}var _t=(()=>{class t{constructor(){this.POSSetupService=C(R),this.route=C(re),this.writeOffForm=E(null)}ngOnInit(){this.route.paramMap.pipe(ee(e=>e.get("id")),z(e=>this.POSSetupService.fetchPOSWriteOffFormConfiguration({ID:e})),F(e=>this.writeOffForm.set(e))).subscribe()}updateAccountById(e,n){let o=this.writeOffForm().form,l=x(_({},this.writeOffForm()),{form:o.map((d,L)=>L===n?x(_({},d),{accountID:e}):d)});this.writeOffForm.set(l)}updateWriteOffConfiguration(){let e={form:this.writeOffForm().form};this.POSSetupService.updatePOSWriteOffConfiguration(e).pipe().subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-writeoff-form"]],decls:1,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"pageTitle","hasMainWrapperPadding",4,"ngIf"],[3,"pageTitle","hasMainWrapperPadding"],[1,"d-flex","gap-2"],["routerLink","/pages/pos-setup/writeoff",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"onClick"],[1,"row"],[1,"col"],[1,"row","row-gap-3"],[1,"col-3"],[1,"d-flex","flex-column"],["for","",1,"d-inline-block","text-truncate",2,"max-width","300px"],["filter","","filterBy","name,code","optionLabel","name","filter","","filterBy","name,code","optionValue","id","placeholder","Select an account",3,"ngModelChange","ngModel","options","virtualScroll","virtualScrollItemSize"],[1,""]],template:function(n,o){n&1&&f(0,An,5,2,"app-main-panel",4),n&2&&c("ngIf",o.writeOffForm())},dependencies:[M,w,V,q,Re,me,le,U,j,J,$,oe,A,D,G,N],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Le=(()=>{class t{constructor(){this.httpService=C(ye)}getExpenseOptions(){return this.httpService.get(void 0,"/api/SetupExpenseOption/GetExpenseOptions")}getExpenseOptionsLoader(){return this.httpService.get(void 0,"/api/SetupExpenseOptionLoader/GetExpenseOptions")}updatePOSExpenseOptionConfiguration(e){return this.httpService.put(void 0,"/api/SetupExpenseOption/UpdateExpenseAccount",e)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=Se({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Rn={data:{expenseOptions:[],options:{chartOfAccountOptions:[]}}},Be=Te(Ae(Rn),Je("POSExpenseOptionStore"),we(t=>({hasCheckedRows:ne(()=>t.data().expenseOptions.some(i=>i.checked)),checkedInvoice:ne(()=>t.data().expenseOptions.filter(i=>i.checked).map(i=>i.id))})),De(t=>{let i=C(Le);return{onRowSelect(n){Z(t,o=>{let l=o.data.expenseOptions.map(d=>d.id===n.id?x(_({},d),{checked:!0}):d);return x(_({},o),{data:x(_({},o.data),{expenseOptions:l})})})},onRowUnselect(n){Z(t,o=>{let l=o.data.expenseOptions.map(d=>d.id===n.id?x(_({},d),{checked:!1}):d);return x(_({},o),{data:x(_({},o.data),{expenseOptions:l})})})},onHeaderCheckboxToggle(n){Z(t,o=>{let l=o.data.expenseOptions.map(d=>x(_({},d),{checked:n}));return x(_({},o),{data:x(_({},o.data),{expenseOptions:l})})})},getExpenseOptions:fe(_e(z(()=>i.getExpenseOptions().pipe(ge({next:n=>{Z(t,o=>x(_({},o),{data:x(_({},o.data),{expenseOptions:n.expenseOptions.map(l=>x(_({},l),{checked:!1}))})}))},error:n=>{console.error("Error fetching expense options:",n)}}))))),getExpenseOptionsLoader:fe(_e(z(()=>i.getExpenseOptionsLoader().pipe(ge({next:n=>{Z(t,o=>x(_({},o),{data:x(_({},o.data),{options:{chartOfAccountOptions:n.options.chartOfAccountOptions}})}))},error:n=>{console.error("Error fetching expense options:",n)}})))))}}),Me({onInit:t=>{t.getExpenseOptions(),t.getExpenseOptionsLoader()}}));function kn(t,i){if(t&1){let e=v();r(0,"p-button",8),y("onClick",function(){h(e);let o=s(2);return S(o.updatePOSExpenseOptionConfiguration())}),a()}}function Ln(t,i){if(t&1&&(r(0,"div",5)(1,"a",6),m(2,"Cancel"),a(),f(3,kn,1,0,"p-button",7),a()),t&2){let e=s();p(3),B(e.roleService.permissions().posSetup.edit?3:-1)}}function Nn(t,i){if(t&1&&(r(0,"div",5)(1,"div",15)(2,"span",15),m(3),a()()()),t&2){let e=i.$implicit;p(3),g(e.value)}}function Gn(t,i){if(t&1&&(r(0,"div",5)(1,"div",16)(2,"span",15),m(3),a()()()),t&2){let e=i.$implicit;p(3),g(e.value)}}function Bn(t,i){if(t&1){let e=v();r(0,"div",11)(1,"div",12)(2,"label",13),m(3),a(),r(4,"p-select",14),y("ngModelChange",function(o){let l=h(e).$index,d=s(3);return S(d.updateData(o,l))}),f(5,Nn,4,1,"ng-template",null,2,u)(7,Gn,4,1,"ng-template",null,3,u),a()()()}if(t&2){let e,n=i.$implicit,o=i.$index,l=s(3);p(3),g(n.name),p(),c("ngModel",((e=l.expenseOptForm().ListData[o])==null?null:e.AccountID)||"")("options",l.store.data().options.chartOfAccountOptions)}}function Vn(t,i){if(t&1&&b(0,Bn,9,3,"div",11,P),t&2){let e=s(2);O(e.store.data().expenseOptions)}}function $n(t,i){t&1&&(r(0,"div",10)(1,"p"),m(2,"No expense options available."),a()())}function Wn(t,i){if(t&1&&(r(0,"p-panel")(1,"div",9)(2,"div",10)(3,"div",9),f(4,Vn,2,0)(5,$n,3,0,"div",10),a()()()()),t&2){let e=s();p(4),B(e.store.data().expenseOptions&&e.store.data().expenseOptions.length?4:5)}}var ft=(()=>{class t{constructor(){this.store=C(Be),this.roleService=C(Y),this.expenseOptForm=E({ListData:[]}),this.expenseOptService=C(Le),this.originalData=E([]),je(()=>{let e=this.store.data().expenseOptions;if(e&&e.length>0){let n=e.map(o=>({ID:o.id,AccountID:o.accountID||""}));this.expenseOptForm.set({ListData:n}),this.originalData.set([...n])}})}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){Array.isArray(e.data)?e.data.forEach(n=>{this.store.onRowUnselect(n)}):this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}updatePOSExpenseOptionConfiguration(){let e=this.expenseOptForm().ListData,n=this.originalData(),o=e.filter((d,L)=>{let de=n[L];return de&&d.AccountID!==de.AccountID});if(o.length===0)return;let l={ListData:o};this.expenseOptService.updatePOSExpenseOptionConfiguration(l).pipe(F(d=>{console.log("Update response:",d),this.originalData.set([...e])})).subscribe()}updateData(e,n){let l=[...this.expenseOptForm().ListData];l[n]&&(l[n]=x(_({},l[n]),{AccountID:e}),this.expenseOptForm.set({ListData:l}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-expense-option"]],features:[ve([Be])],decls:5,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],["pageTitle","Expense Option",3,"scrollable"],[1,"d-flex","gap-2"],["routerLink","..",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit"],["label","Submit",3,"onClick"],[1,"row"],[1,"col-12"],[1,"col-4"],[1,"d-flex","flex-column","card","rounded-3","p-3","border"],["for",""],["filter","","filterBy","key,value","optionLabel","value","optionValue","key","placeholder","Select COA",3,"ngModelChange","ngModel","options"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&(r(0,"app-main-panel",4),f(1,Ln,4,1,"ng-template",null,0,u)(3,Wn,6,1,"ng-template",null,1,u),a()),n&2&&c("scrollable",!0)},dependencies:[M,ie,W,K,G,N,w,D,U,j,pe,$,J,oe],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var nr=[{path:"",redirectTo:"global",pathMatch:"full"},{path:"",children:[{path:"global",component:rt},{path:"outlets",component:mt},{path:"outlets/:id",component:st},{path:"payments",component:lt},{path:"payments/:id",component:ct},{path:"taxs",component:ut},{path:"writeoff",component:dt},{path:"writeoff/:id",component:_t},{path:"expense-option",component:ft}]}];export{nr as POS_SETUP_ROUTES};
@@ -1 +1 @@
1
- import{a as Z}from"./chunk-52PEVPZN.js";import{a as X,b as Y}from"./chunk-AAKZYXG3.js";import{a as v}from"./chunk-BT7Y4ADP.js";import{a as U,b as W}from"./chunk-OW2ND5HU.js";import"./chunk-JWNGZMSE.js";import"./chunk-FTBQKOYS.js";import"./chunk-L4ENW4RK.js";import"./chunk-FMAG3RQL.js";import{i as Q}from"./chunk-YI5IYWUO.js";import"./chunk-VM56C6ZV.js";import{a as H,b as K}from"./chunk-ISIYG4D5.js";import"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{n as A,o as $,w as q,x as z}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import{b as w,e as B,f as V,k as O,m as D,p as G,v as L,y as j}from"./chunk-MGIEURA2.js";import"./chunk-YZ76QE4R.js";import"./chunk-G3BJCT7T.js";import"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import"./chunk-DM2JLWKE.js";import{Eb as d,Ec as M,Ha as N,Mb as u,Pb as E,Rb as _,Sb as F,Sc as x,Ub as T,Vb as J,Wb as o,Xb as n,Yb as p,_ as C,ac as I,bd as R,fc as k,gc as s,ia as g,ib as m,qa as y,ra as h,sc as i,tc as P,yb as S}from"./chunk-6QJHEOXN.js";import{a as c,b as f}from"./chunk-YQFG5XE2.js";var ie=()=>({height:"40px"});function re(t,r){if(t&1){let e=I();o(0,"p-button",4),k("onClick",function(){y(e);let l=s();return h(l.onSubmit())}),n()}}function ae(t,r){t&1&&(o(0,"div",6)(1,"div",7)(2,"h3",8),i(3,"Journal Number Generator"),n(),o(4,"p",9),i(5," Configure numbering format and rule for journal "),n()()())}function le(t,r){if(t&1&&(o(0,"div",7)(1,"div",24),p(2,"p-radiobutton",25),o(3,"label",26),i(4),n()()()),t&2){let e=r.$implicit;m(2),u("inputId","resetPeriod"+e.key)("value",e.key),m(),u("for","resetPeriod"+e.key),m(),P(e.value)}}function me(t,r){t&1&&(o(0,"span",15),i(1,"Format"),n())}function pe(t,r){t&1&&(o(0,"span",15),i(1,"Format"),n())}function ue(t,r){if(t&1&&p(0,"p-select",16),t&2){let e=s(3);u("fluid",!0)("options",e.loader().options.dayResetPeriodFormat)}}function se(t,r){if(t&1&&p(0,"p-select",17),t&2){let e=s(3);u("fluid",!0)("options",e.loader().options.monthlyResetPeriodFormat)}}function de(t,r){if(t&1&&(o(0,"form",5)(1,"div",10)(2,"div",11)(3,"div",12)(4,"div",7)(5,"div",13)(6,"div",14)(7,"span",15),i(8,"Journal Number Reset Range"),n()(),o(9,"div",7)(10,"div",13),T(11,le,5,4,"div",7,F),n()()()(),o(13,"div",7)(14,"div",13)(15,"div",14),d(16,me,2,0,"span",15)(17,pe,2,0,"span",15),n(),o(18,"div",7),d(19,ue,1,2,"p-select",16)(20,se,1,2,"p-select",17),n()()()(),o(21,"div",10)(22,"div",18)(23,"div",19)(24,"span",15),i(25,"Prefix"),n(),p(26,"input",20),n()(),o(27,"div",18)(28,"div",19)(29,"span",15),i(30,"Separator"),n(),p(31,"input",21),n()(),o(32,"div",18)(33,"div",19)(34,"span",15),i(35,"Digit Behind Number"),n(),p(36,"input",22),n()(),o(37,"div",18)(38,"div",19)(39,"span",15),i(40,"Last Number"),n(),p(41,"input",23),n()()()()()()),t&2){let e,a,l=s(2);u("formGroup",l.form),m(9),E(M(5,ie)),m(2),J(l.resetPeriodOptions()),m(5),_((e=l.form.controls.resetEvery.value)===0?16:e===1?17:-1),m(3),_((a=l.form.controls.resetEvery.value)===0?19:a===1?20:-1)}}function ce(t,r){if(t&1&&(o(0,"p-panel"),d(1,ae,6,0,"ng-template",null,2,x)(3,de,42,6,"form",5),n()),t&2){let e=s();m(3),_(e.loader()?3:-1)}}var Re=(()=>{class t{constructor(){this.loader=N(null),this.resetPeriodOptions=R(()=>this.loader()?.options?.resetPeriods??[]),this.accountingSetupService=g(Z),this.fb=g(L)}generateForm(e){this.form=this.fb.group({resetEvery:this.fb.control(e.formatting.resetEvery),monthlyFormat:this.fb.control(e.formatting.monthlyFormat),dailyFormat:this.fb.control(e.formatting.dailyFormat),lastNumber:this.fb.control(e.number.lastNumber),prefix:this.fb.control(e.formatting.prefix),separator:this.fb.control(e.formatting.separator),digit:this.fb.control(e.formatting.digit)})}ngOnInit(){this.accountingSetupService.fetchLoaderConfiguration().pipe(v("Loader Configuration"),C(e=>{this.loader.set(e),this.generateForm(e.form)})).subscribe()}onSubmit(){let{lastNumber:e,prefix:a,separator:l,dailyFormat:ee,monthlyFormat:te,resetEvery:ne,digit:oe}=this.form.value,b=f(c({},this.loader().form),{formatting:f(c({},this.loader().form.formatting),{digit:+oe,separator:l,resetEvery:+ne,monthlyFormat:+te,prefix:a,dailyFormat:+ee}),number:f(c({},this.loader().form.number),{lastNumber:e})});console.log(b),this.accountingSetupService.updateAccountingIntegrationConfiguration(b).pipe(v("response")).subscribe()}static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275cmp=S({type:t,selectors:[["app-journal-number"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","Journal Number"],["icon","fa-solid fa-floppy-disk","label","Save",3,"onClick"],[3,"formGroup"],[1,"row","px-2"],[1,"col"],[1,"fs-4","m-0"],[1,"fs-3","text-secondary"],[1,"row"],[1,"col-10","col-xl-8","d-flex","flex-column","gap-4"],[1,"row","gap-4"],[1,"row","h-100"],[1,"col-12"],[1,"fs-3","text-black","fw-normal"],["formControlName","dailyFormat","inputId","monthlyReset","optionLabel","value","optionValue","key",3,"fluid","options"],["formControlName","monthlyFormat","inputId","monthlyReset","optionLabel","value","optionValue","key",3,"fluid","options"],[1,"col-3"],[1,"d-flex","flex-column"],["formControlName","prefix","pInputText","","type","text"],["formControlName","separator","pInputText","","type","text"],["formControlName","digit","pInputText","","type","text"],["formControlName","lastNumber","pInputText","","type","text"],[1,"d-flex","align-items-center","gap-2","h-100"],["formControlName","resetEvery","name","resetEvery",3,"inputId","value"],[1,"m-0",3,"for"]],template:function(a,l){a&1&&(o(0,"app-main-panel",3),d(1,re,1,0,"ng-template",null,0,x)(3,ce,4,1,"ng-template",null,1,x),n())},dependencies:[Q,K,H,$,A,Y,X,j,O,w,B,V,D,G,W,U,z,q],styles:["fieldset[_ngcontent-%COMP%]{background-color:#eee}legend[_ngcontent-%COMP%]{background-color:gray;color:#fff;padding:5px 10px}"]})}}return t})();export{Re as JournalNumberComponent};
1
+ import{a as Z}from"./chunk-52PEVPZN.js";import{a as X,b as Y}from"./chunk-AAKZYXG3.js";import{a as v}from"./chunk-BT7Y4ADP.js";import{a as U,b as W}from"./chunk-OW2ND5HU.js";import"./chunk-JWNGZMSE.js";import"./chunk-FTBQKOYS.js";import"./chunk-L4ENW4RK.js";import"./chunk-FMAG3RQL.js";import{i as Q}from"./chunk-EXPUB774.js";import"./chunk-VM56C6ZV.js";import{a as H,b as K}from"./chunk-ISIYG4D5.js";import"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{n as A,o as $,w as q,x as z}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import{b as w,e as B,f as V,k as O,m as D,p as G,v as L,y as j}from"./chunk-MGIEURA2.js";import"./chunk-DD3C4ZJK.js";import"./chunk-G3BJCT7T.js";import"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import"./chunk-DM2JLWKE.js";import{Eb as d,Ec as M,Ha as N,Mb as u,Pb as E,Rb as _,Sb as F,Sc as x,Ub as T,Vb as J,Wb as o,Xb as n,Yb as p,_ as C,ac as I,bd as R,fc as k,gc as s,ia as g,ib as m,qa as y,ra as h,sc as i,tc as P,yb as S}from"./chunk-6QJHEOXN.js";import{a as c,b as f}from"./chunk-YQFG5XE2.js";var ie=()=>({height:"40px"});function re(t,r){if(t&1){let e=I();o(0,"p-button",4),k("onClick",function(){y(e);let l=s();return h(l.onSubmit())}),n()}}function ae(t,r){t&1&&(o(0,"div",6)(1,"div",7)(2,"h3",8),i(3,"Journal Number Generator"),n(),o(4,"p",9),i(5," Configure numbering format and rule for journal "),n()()())}function le(t,r){if(t&1&&(o(0,"div",7)(1,"div",24),p(2,"p-radiobutton",25),o(3,"label",26),i(4),n()()()),t&2){let e=r.$implicit;m(2),u("inputId","resetPeriod"+e.key)("value",e.key),m(),u("for","resetPeriod"+e.key),m(),P(e.value)}}function me(t,r){t&1&&(o(0,"span",15),i(1,"Format"),n())}function pe(t,r){t&1&&(o(0,"span",15),i(1,"Format"),n())}function ue(t,r){if(t&1&&p(0,"p-select",16),t&2){let e=s(3);u("fluid",!0)("options",e.loader().options.dayResetPeriodFormat)}}function se(t,r){if(t&1&&p(0,"p-select",17),t&2){let e=s(3);u("fluid",!0)("options",e.loader().options.monthlyResetPeriodFormat)}}function de(t,r){if(t&1&&(o(0,"form",5)(1,"div",10)(2,"div",11)(3,"div",12)(4,"div",7)(5,"div",13)(6,"div",14)(7,"span",15),i(8,"Journal Number Reset Range"),n()(),o(9,"div",7)(10,"div",13),T(11,le,5,4,"div",7,F),n()()()(),o(13,"div",7)(14,"div",13)(15,"div",14),d(16,me,2,0,"span",15)(17,pe,2,0,"span",15),n(),o(18,"div",7),d(19,ue,1,2,"p-select",16)(20,se,1,2,"p-select",17),n()()()(),o(21,"div",10)(22,"div",18)(23,"div",19)(24,"span",15),i(25,"Prefix"),n(),p(26,"input",20),n()(),o(27,"div",18)(28,"div",19)(29,"span",15),i(30,"Separator"),n(),p(31,"input",21),n()(),o(32,"div",18)(33,"div",19)(34,"span",15),i(35,"Digit Behind Number"),n(),p(36,"input",22),n()(),o(37,"div",18)(38,"div",19)(39,"span",15),i(40,"Last Number"),n(),p(41,"input",23),n()()()()()()),t&2){let e,a,l=s(2);u("formGroup",l.form),m(9),E(M(5,ie)),m(2),J(l.resetPeriodOptions()),m(5),_((e=l.form.controls.resetEvery.value)===0?16:e===1?17:-1),m(3),_((a=l.form.controls.resetEvery.value)===0?19:a===1?20:-1)}}function ce(t,r){if(t&1&&(o(0,"p-panel"),d(1,ae,6,0,"ng-template",null,2,x)(3,de,42,6,"form",5),n()),t&2){let e=s();m(3),_(e.loader()?3:-1)}}var Re=(()=>{class t{constructor(){this.loader=N(null),this.resetPeriodOptions=R(()=>this.loader()?.options?.resetPeriods??[]),this.accountingSetupService=g(Z),this.fb=g(L)}generateForm(e){this.form=this.fb.group({resetEvery:this.fb.control(e.formatting.resetEvery),monthlyFormat:this.fb.control(e.formatting.monthlyFormat),dailyFormat:this.fb.control(e.formatting.dailyFormat),lastNumber:this.fb.control(e.number.lastNumber),prefix:this.fb.control(e.formatting.prefix),separator:this.fb.control(e.formatting.separator),digit:this.fb.control(e.formatting.digit)})}ngOnInit(){this.accountingSetupService.fetchLoaderConfiguration().pipe(v("Loader Configuration"),C(e=>{this.loader.set(e),this.generateForm(e.form)})).subscribe()}onSubmit(){let{lastNumber:e,prefix:a,separator:l,dailyFormat:ee,monthlyFormat:te,resetEvery:ne,digit:oe}=this.form.value,b=f(c({},this.loader().form),{formatting:f(c({},this.loader().form.formatting),{digit:+oe,separator:l,resetEvery:+ne,monthlyFormat:+te,prefix:a,dailyFormat:+ee}),number:f(c({},this.loader().form.number),{lastNumber:e})});console.log(b),this.accountingSetupService.updateAccountingIntegrationConfiguration(b).pipe(v("response")).subscribe()}static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275cmp=S({type:t,selectors:[["app-journal-number"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","Journal Number"],["icon","fa-solid fa-floppy-disk","label","Save",3,"onClick"],[3,"formGroup"],[1,"row","px-2"],[1,"col"],[1,"fs-4","m-0"],[1,"fs-3","text-secondary"],[1,"row"],[1,"col-10","col-xl-8","d-flex","flex-column","gap-4"],[1,"row","gap-4"],[1,"row","h-100"],[1,"col-12"],[1,"fs-3","text-black","fw-normal"],["formControlName","dailyFormat","inputId","monthlyReset","optionLabel","value","optionValue","key",3,"fluid","options"],["formControlName","monthlyFormat","inputId","monthlyReset","optionLabel","value","optionValue","key",3,"fluid","options"],[1,"col-3"],[1,"d-flex","flex-column"],["formControlName","prefix","pInputText","","type","text"],["formControlName","separator","pInputText","","type","text"],["formControlName","digit","pInputText","","type","text"],["formControlName","lastNumber","pInputText","","type","text"],[1,"d-flex","align-items-center","gap-2","h-100"],["formControlName","resetEvery","name","resetEvery",3,"inputId","value"],[1,"m-0",3,"for"]],template:function(a,l){a&1&&(o(0,"app-main-panel",3),d(1,re,1,0,"ng-template",null,0,x)(3,ce,4,1,"ng-template",null,1,x),n())},dependencies:[Q,K,H,$,A,Y,X,j,O,w,B,V,D,G,W,U,z,q],styles:["fieldset[_ngcontent-%COMP%]{background-color:#eee}legend[_ngcontent-%COMP%]{background-color:gray;color:#fff;padding:5px 10px}"]})}}return t})();export{Re as JournalNumberComponent};
@@ -1 +1 @@
1
- import{a as y,b as J}from"./chunk-UNKPZO2B.js";import"./chunk-Y4SHAFGQ.js";import{m as V}from"./chunk-Q4XWXOWE.js";import"./chunk-WL6ZZCYW.js";import{a as j,b as R}from"./chunk-5U7KZJ3H.js";import"./chunk-FHJOSHI3.js";import{i as z}from"./chunk-YI5IYWUO.js";import"./chunk-VM56C6ZV.js";import{a as G,b as H}from"./chunk-ISIYG4D5.js";import"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{w as D,x as N,y as L,z as q}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import"./chunk-MGIEURA2.js";import"./chunk-YZ76QE4R.js";import"./chunk-G3BJCT7T.js";import{a as O}from"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import{p as E,u as I}from"./chunk-DM2JLWKE.js";import{Dc as F,Eb as _,Ec as b,Mb as l,Oc as s,Pb as h,Pc as m,Rb as x,Sc as S,W as k,Wb as o,Xb as n,Y as w,Yb as u,_ as B,ac as v,fc as T,gc as a,h as M,ia as c,ib as r,qa as C,ra as d,s as g,sa as P,ta as $,yb as A}from"./chunk-6QJHEOXN.js";import"./chunk-YQFG5XE2.js";var K=()=>({height:"calc(100vh - 100px)"});function Q(t,f){if(t&1){let e=v();o(0,"p-button",6),T("onClick",function(){C(e);let p=a(2);return d(p.onFormatCOAConfig())}),n()}}function U(t,f){if(t&1){let e=v();o(0,"p-button",7),s(1,"async"),s(2,"async"),T("onClick",function(){C(e);let p=a(2);return d(p.onMigrateCoaConfig())}),n()}if(t&2){let e=a(2);l("disabled",m(1,2,e.countInBooks$)!==0)("pTooltip",m(2,4,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function W(t,f){if(t&1&&(o(0,"div",3),_(1,Q,1,0,"p-button",4)(2,U,3,6,"p-button",5),n()),t&2){let e=a();r(),x(e.roleService.permissions().migrate.delete?1:-1),r(),x(e.roleService.permissions().migrate.create?2:-1)}}function X(t,f){if(t&1&&(o(0,"p-scroll-panel")(1,"p-panel")(2,"div",8),u(3,"app-migration-cards",9),s(4,"async"),P(),o(5,"svg",10),u(6,"path",11),n(),$(),u(7,"app-migration-cards",12),s(8,"async"),n()()()),t&2){let e=a();h(b(12,K)),r(),h(b(13,K)),r(2),l("migrationCount",m(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),r(4),l("migrationCount",m(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var xe=(()=>{class t{constructor(){this.migrateService=c(y),this.toastr=c(O),this.refresh$=new M(void 0),this.pageTitle="Chart of Account Configuration",this.roleService=c(V)}ngOnInit(){let e=this.refresh$.pipe(w(()=>this.migrateService.getCOAConfigurationCount()),B(i=>console.log("API response:",i)),k(1));this.countInPOS$=e.pipe(g(i=>Number(i.pos))),this.countInBooks$=e.pipe(g(i=>Number(i.books)))}onMigrateCoaConfig(){this.migrateService.migrateCoaConfig().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormatCOAConfig(){window.confirm("Are you sure you want to format this data? This action cannot be undone.")&&this.migrateService.formatManualCOAConfig().subscribe(i=>{this.refresh$.next(),this.toastr.success(i.message,"Format Successful")})}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=A({type:t,selectors:[["app-coa-configuration"]],features:[F([y])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger"],["label","Create","tooltipPosition","left",3,"disabled","pTooltip"],["label","Format","severity","danger",3,"onClick"],["label","Create","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(i,p){i&1&&(o(0,"app-main-panel",2),_(1,W,3,2,"ng-template",null,0,S)(3,X,9,14,"ng-template",null,1,S),n()),i&2&&l("pageTitle",p.pageTitle)},dependencies:[z,I,E,N,D,R,j,H,G,q,L,J],encapsulation:2})}}return t})();export{xe as CoaConfigurationComponent};
1
+ import{a as y,b as J}from"./chunk-BAN4BZ4V.js";import"./chunk-AKHZNBCJ.js";import{m as V}from"./chunk-Q4XWXOWE.js";import"./chunk-WL6ZZCYW.js";import{a as j,b as R}from"./chunk-5U7KZJ3H.js";import"./chunk-FHJOSHI3.js";import{i as z}from"./chunk-EXPUB774.js";import"./chunk-VM56C6ZV.js";import{a as G,b as H}from"./chunk-ISIYG4D5.js";import"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{w as D,x as N,y as L,z as q}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import"./chunk-MGIEURA2.js";import"./chunk-DD3C4ZJK.js";import"./chunk-G3BJCT7T.js";import{a as O}from"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import{p as E,u as I}from"./chunk-DM2JLWKE.js";import{Dc as F,Eb as _,Ec as b,Mb as l,Oc as s,Pb as h,Pc as m,Rb as x,Sc as S,W as k,Wb as o,Xb as n,Y as w,Yb as u,_ as B,ac as v,fc as T,gc as a,h as M,ia as c,ib as r,qa as C,ra as d,s as g,sa as P,ta as $,yb as A}from"./chunk-6QJHEOXN.js";import"./chunk-YQFG5XE2.js";var K=()=>({height:"calc(100vh - 100px)"});function Q(t,f){if(t&1){let e=v();o(0,"p-button",6),T("onClick",function(){C(e);let p=a(2);return d(p.onFormatCOAConfig())}),n()}}function U(t,f){if(t&1){let e=v();o(0,"p-button",7),s(1,"async"),s(2,"async"),T("onClick",function(){C(e);let p=a(2);return d(p.onMigrateCoaConfig())}),n()}if(t&2){let e=a(2);l("disabled",m(1,2,e.countInBooks$)!==0)("pTooltip",m(2,4,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function W(t,f){if(t&1&&(o(0,"div",3),_(1,Q,1,0,"p-button",4)(2,U,3,6,"p-button",5),n()),t&2){let e=a();r(),x(e.roleService.permissions().migrate.delete?1:-1),r(),x(e.roleService.permissions().migrate.create?2:-1)}}function X(t,f){if(t&1&&(o(0,"p-scroll-panel")(1,"p-panel")(2,"div",8),u(3,"app-migration-cards",9),s(4,"async"),P(),o(5,"svg",10),u(6,"path",11),n(),$(),u(7,"app-migration-cards",12),s(8,"async"),n()()()),t&2){let e=a();h(b(12,K)),r(),h(b(13,K)),r(2),l("migrationCount",m(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),r(4),l("migrationCount",m(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var xe=(()=>{class t{constructor(){this.migrateService=c(y),this.toastr=c(O),this.refresh$=new M(void 0),this.pageTitle="Chart of Account Configuration",this.roleService=c(V)}ngOnInit(){let e=this.refresh$.pipe(w(()=>this.migrateService.getCOAConfigurationCount()),B(i=>console.log("API response:",i)),k(1));this.countInPOS$=e.pipe(g(i=>Number(i.pos))),this.countInBooks$=e.pipe(g(i=>Number(i.books)))}onMigrateCoaConfig(){this.migrateService.migrateCoaConfig().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormatCOAConfig(){window.confirm("Are you sure you want to format this data? This action cannot be undone.")&&this.migrateService.formatManualCOAConfig().subscribe(i=>{this.refresh$.next(),this.toastr.success(i.message,"Format Successful")})}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=A({type:t,selectors:[["app-coa-configuration"]],features:[F([y])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger"],["label","Create","tooltipPosition","left",3,"disabled","pTooltip"],["label","Format","severity","danger",3,"onClick"],["label","Create","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(i,p){i&1&&(o(0,"app-main-panel",2),_(1,W,3,2,"ng-template",null,0,S)(3,X,9,14,"ng-template",null,1,S),n()),i&2&&l("pageTitle",p.pageTitle)},dependencies:[z,I,E,N,D,R,j,H,G,q,L,J],encapsulation:2})}}return t})();export{xe as CoaConfigurationComponent};
@@ -1 +1 @@
1
- import{a as i,b as T}from"./chunk-WL6ZZCYW.js";import{d as s}from"./chunk-DZCJWJUG.js";import{c as m}from"./chunk-YZ76QE4R.js";import{a as l}from"./chunk-G3BJCT7T.js";import{_ as a,ca as c,ia as r}from"./chunk-6QJHEOXN.js";var h=(()=>{class o{constructor(){this.httpService=r(l),this.router=r(s),this.intercomService=r(m),this.tokenService=r(T),this.autoLogout()}login(e){return this.httpService.post("","api/Authentication/login",e).pipe(a(t=>{let n=e.SubDomain;localStorage.setItem("AUTH_TOKEN",t.access_token),localStorage.setItem("AUTH_POS_TOKEN",t.pos.access_token),localStorage.setItem("AUTH_TOKEN_TYPE",t.token_type),localStorage.setItem("AUTH_EXPIRES_AT",t.expiredAt),localStorage.setItem("AUTH_DOMAIN",n.substring(n.indexOf("."))),localStorage.setItem("AUTH_SUB_DOMAIN",e.SubDomain.split(".")[0]),localStorage.setItem("AUTH_USERNAME",e.Username),this.storeIntercom(t),this.storeTenantId(t.pos.access_token),this.storeRoles(t.access_token),this.tokenService.setToken(t.access_token),this.autoLogout()}))}storeIntercom(e){let t=e.intercomWidget?JSON.stringify(e.intercomWidget):null;t&&localStorage.setItem("INTERCOM",t)}isAuthenticated(){return!!localStorage.getItem("AUTH_TOKEN")}getToken(){return localStorage.getItem("AUTH_TOKEN")}getTokenType(){return localStorage.getItem("AUTH_TOKEN_TYPE")}isTokenExpired(){let e=localStorage.getItem("AUTH_EXPIRES_AT");return e?new Date(e).getTime()<Date.now():!0}autoLogout(){clearTimeout(this.logoutTimer);let e=localStorage.getItem("AUTH_EXPIRES_AT");if(!e)return;let t=new Date(e).getTime()-Date.now();t>0?this.logoutTimer=setTimeout(()=>this.logout(),t):this.logout()}getTenantExternalURL(){let e=localStorage.getItem("AUTH_SUB_DOMAIN")||"",t=localStorage.getItem("AUTH_DOMAIN")||"";return e&&t?`https://${e}${t}`:""}getTanantToken(){return localStorage.getItem("AUTH_POS_TOKEN")}logout(){this.intercomService.shutdown(),localStorage.removeItem("AUTH_TOKEN"),localStorage.removeItem("AUTH_TOKEN_TYPE"),localStorage.removeItem("AUTH_EXPIRES_AT"),localStorage.removeItem("INTERCOM"),clearTimeout(this.logoutTimer),this.router.navigate([""])}getFullDomain(){let e=localStorage.getItem("AUTH_SUB_DOMAIN"),t=localStorage.getItem("AUTH_DOMAIN");return!e||!t?(console.error("Subdomain or domain is missing in local storage."),null):`${e}${t}`}storeTenantId(e){let t=i(e);console.log("Decoded Token:",t),t&&(localStorage.setItem("AC_TENANT_BRAND",t.Brand),localStorage.setItem("AC_TENANT_LID",t.LID))}storeRoles(e){let t=i(e);console.log("Decoded Token:",t),t&&localStorage.setItem("AUTH_ROLES",JSON.stringify(t["http://schemas.microsoft.com/ws/2008/06/identity/claims/role"]))}checkAuthKeysExists(){return["AC_TENANT_BRAND","AC_TENANT_LID","AUTH_DOMAIN","AUTH_EXPIRES_AT","AUTH_POS_TOKEN","AUTH_SUB_DOMAIN","AUTH_TOKEN","AUTH_TOKEN_TYPE","AUTH_USERNAME","AUTH_ROLES"].every(t=>!!localStorage.getItem(t))}static{this.\u0275fac=function(t){return new(t||o)}}static{this.\u0275prov=c({token:o,factory:o.\u0275fac,providedIn:"root"})}}return o})();export{h as a};
1
+ import{a as i,b as T}from"./chunk-WL6ZZCYW.js";import{d as s}from"./chunk-DZCJWJUG.js";import{c as m}from"./chunk-DD3C4ZJK.js";import{a as l}from"./chunk-G3BJCT7T.js";import{_ as a,ca as c,ia as r}from"./chunk-6QJHEOXN.js";var h=(()=>{class o{constructor(){this.httpService=r(l),this.router=r(s),this.intercomService=r(m),this.tokenService=r(T),this.autoLogout()}login(e){return this.httpService.post("","api/Authentication/login",e).pipe(a(t=>{let n=e.SubDomain;localStorage.setItem("AUTH_TOKEN",t.access_token),localStorage.setItem("AUTH_POS_TOKEN",t.pos.access_token),localStorage.setItem("AUTH_TOKEN_TYPE",t.token_type),localStorage.setItem("AUTH_EXPIRES_AT",t.expiredAt),localStorage.setItem("AUTH_DOMAIN",n.substring(n.indexOf("."))),localStorage.setItem("AUTH_SUB_DOMAIN",e.SubDomain.split(".")[0]),localStorage.setItem("AUTH_USERNAME",e.Username),this.storeIntercom(t),this.storeTenantId(t.pos.access_token),this.storeRoles(t.access_token),this.tokenService.setToken(t.access_token),this.autoLogout()}))}storeIntercom(e){let t=e.intercomWidget?JSON.stringify(e.intercomWidget):null;t&&localStorage.setItem("INTERCOM",t)}isAuthenticated(){return!!localStorage.getItem("AUTH_TOKEN")}getToken(){return localStorage.getItem("AUTH_TOKEN")}getTokenType(){return localStorage.getItem("AUTH_TOKEN_TYPE")}isTokenExpired(){let e=localStorage.getItem("AUTH_EXPIRES_AT");return e?new Date(e).getTime()<Date.now():!0}autoLogout(){clearTimeout(this.logoutTimer);let e=localStorage.getItem("AUTH_EXPIRES_AT");if(!e)return;let t=new Date(e).getTime()-Date.now();t>0?this.logoutTimer=setTimeout(()=>this.logout(),t):this.logout()}getTenantExternalURL(){let e=localStorage.getItem("AUTH_SUB_DOMAIN")||"",t=localStorage.getItem("AUTH_DOMAIN")||"";return e&&t?`https://${e}${t}`:""}getTanantToken(){return localStorage.getItem("AUTH_POS_TOKEN")}logout(){this.intercomService.shutdown(),localStorage.removeItem("AUTH_TOKEN"),localStorage.removeItem("AUTH_TOKEN_TYPE"),localStorage.removeItem("AUTH_EXPIRES_AT"),localStorage.removeItem("INTERCOM"),clearTimeout(this.logoutTimer),this.router.navigate([""])}getFullDomain(){let e=localStorage.getItem("AUTH_SUB_DOMAIN"),t=localStorage.getItem("AUTH_DOMAIN");return!e||!t?(console.error("Subdomain or domain is missing in local storage."),null):`${e}${t}`}storeTenantId(e){let t=i(e);console.log("Decoded Token:",t),t&&(localStorage.setItem("AC_TENANT_BRAND",t.Brand),localStorage.setItem("AC_TENANT_LID",t.LID))}storeRoles(e){let t=i(e);console.log("Decoded Token:",t),t&&localStorage.setItem("AUTH_ROLES",JSON.stringify(t["http://schemas.microsoft.com/ws/2008/06/identity/claims/role"]))}checkAuthKeysExists(){return["AC_TENANT_BRAND","AC_TENANT_LID","AUTH_DOMAIN","AUTH_EXPIRES_AT","AUTH_POS_TOKEN","AUTH_SUB_DOMAIN","AUTH_TOKEN","AUTH_TOKEN_TYPE","AUTH_USERNAME","AUTH_ROLES"].every(t=>!!localStorage.getItem(t))}static{this.\u0275fac=function(t){return new(t||o)}}static{this.\u0275prov=c({token:o,factory:o.\u0275fac,providedIn:"root"})}}return o})();export{h as a};
@@ -1 +1 @@
1
- import{a as Le,b as Ne}from"./chunk-GIRWHO6Q.js";import{b as Me}from"./chunk-Y4SHAFGQ.js";import{a as Ae}from"./chunk-XKI7WLHE.js";import{a as je,b as Ve}from"./chunk-2ABEICLB.js";import"./chunk-KQZMRRMA.js";import"./chunk-ZC7ZENN7.js";import{m as pe}from"./chunk-Q4XWXOWE.js";import"./chunk-WL6ZZCYW.js";import{a as H,b as O}from"./chunk-3VQUNDVT.js";import{b as ke,g as Ie,h as Te,i as Fe}from"./chunk-52EMI2TW.js";import"./chunk-AAKZYXG3.js";import{a as De,b as ye}from"./chunk-BME4Z6DH.js";import"./chunk-VSDW2RJ5.js";import"./chunk-7L5IAWG2.js";import{a as y}from"./chunk-BT7Y4ADP.js";import"./chunk-MJGBBYIO.js";import"./chunk-CN6AT4LE.js";import"./chunk-OW2ND5HU.js";import"./chunk-JWNGZMSE.js";import"./chunk-II7KELI4.js";import"./chunk-FTBQKOYS.js";import"./chunk-L4ENW4RK.js";import"./chunk-KONCSTVQ.js";import"./chunk-FMAG3RQL.js";import{i as we}from"./chunk-YI5IYWUO.js";import"./chunk-VM56C6ZV.js";import{a as he,b as Ee}from"./chunk-ISIYG4D5.js";import{b as h,c as Re,d as be,e as Se,f as Ce,g as ve,h as Pe}from"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{w as xe,x as _e}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import{c as N,e as ce,f as me,m as de,p as ue,v as fe,y as ge}from"./chunk-MGIEURA2.js";import{e as ae,l as se}from"./chunk-DZCJWJUG.js";import"./chunk-YZ76QE4R.js";import{a as le}from"./chunk-G3BJCT7T.js";import"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import{j as ee,l as te,m as ie,r as ne,s as re,u as oe}from"./chunk-DM2JLWKE.js";import{Cb as z,D as B,Dc as W,Eb as _,Ec as X,Fc as V,L as G,Mb as x,Oc as A,P as $,Pb as J,Pc as Y,Qc as Z,Rb as D,Sc as b,Wb as o,Xb as a,Y as T,Yb as E,_ as F,ac as M,bd as L,c as I,ca as q,fc as j,gc as f,ia as g,ib as m,qa as P,ra as w,s as v,sc as d,tc as R,uc as Q,yb as K}from"./chunk-6QJHEOXN.js";import{a as l,b as c}from"./chunk-YQFG5XE2.js";var k=(()=>{class e{constructor(){this.httpService=g(le)}getPostRecurringExpenseLoader(){return this.httpService.get(void 0,"api/RecurringExpenseLoader/RecurringExpensesGenerate")}previewPostRecurringExpense(t){return this.httpService.post(void 0,"api/RecurringExpense/RecurringExpensesGeneratePreview",t)}submitPostRecurringExpense(t){return this.httpService.post(void 0,"api/RecurringExpense/RecurringExpensesGenerate",t)}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275prov=q({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();var Oe={data:{data:[]},meta:{options:{expenses:[]},form:{date:"",number:"",listIDs:[]}},filter:{date:"",number:"",listIDs:[]}},U=Re(ve(Oe),Pe("PostRecurringExpenseStore"),be(e=>({hasCheckedRows:L(()=>e.data().data.some(s=>s.checked)),checkedPRE:L(()=>e.data().data.filter(s=>s.checked))})),Ce(e=>{let s=g(k);return{updateFilter:i=>{h(e,n=>c(l({},n),{filter:l(l({},n.filter),i)}))},emptyData(){h(e,i=>c(l({},i),{data:{data:[],totalCount:0}}))},onRowSelect(i){h(e,n=>{let r=n.data.data.map(p=>p.lastExpenseDate===i.lastExpenseDate?c(l({},p),{checked:!0}):p);return c(l({},n),{data:c(l({},n.data),{data:r})})})},onRowUnselect(i){h(e,n=>{let r=n.data.data.map(p=>p.lastExpenseDate===i.lastExpenseDate?c(l({},p),{checked:!1}):p);return c(l({},n),{data:c(l({},n.data),{data:r})})})},onHeaderCheckboxToggle(i){h(e,n=>{let r=n.data.data.map(p=>c(l({},p),{checked:i}));return c(l({},n),{data:c(l({},n.data),{data:r})})})},getPRELoader:H(I(T(()=>s.getPostRecurringExpenseLoader().pipe(O({next:i=>{h(e,n=>c(l({},n),{meta:i}))},error:i=>{console.error("Error fetching PRE Loader:",i)}}))))),getPREPreview:H(I(B(i=>i.date&&i.listIDs.length>0),v(i=>({Date:i.date,Number:i.number,ListIDs:i.listIDs})),T(i=>s.previewPostRecurringExpense(i).pipe(v(n=>c(l({},n),{data:n.data.map(r=>c(l({},r),{checked:!1}))})),O({next:n=>{h(e,r=>c(l({},r),{data:n}))},error:n=>{console.error("Error fetching PRE Preview:",n)}})))))}}),Se(e=>({onInit:()=>{e.getPRELoader(),e.getPREPreview(e.filter)}})));var Ue=()=>({height:"calc(100vh - 70px)"}),Be=e=>({"ng-invalid ng-dirty":e}),Ge=e=>["/pages/recurring/recurring-expense/details/",e];function $e(e,s){if(e&1){let t=M();o(0,"p-button",8),j("onClick",function(){P(t);let n=f(3);return w(n.onSubmitPRE())}),a()}}function qe(e,s){if(e&1&&_(0,$e,1,0,"p-button",7),e&2){let t=f(2);x("ngIf",t.store.hasCheckedRows())}}function Ke(e,s){if(e&1&&_(0,qe,1,1,"p-button",6),e&2){let t=f();D(t.roleService.permissions().recurring.create?0:-1)}}function ze(e,s){if(e&1&&(o(0,"div")(1,"span",20),d(2),a()()),e&2){let t=s.$implicit;m(2),R(t)}}function Je(e,s){if(e&1&&(o(0,"div"),_(1,ze,3,1,"div",19),a()),e&2){let t=f(2);m(),x("ngForOf",t.getErrors("listIDs"))}}function Qe(e,s){e&1&&(o(0,"th",21),E(1,"p-tableHeaderCheckbox"),a())}function We(e,s){if(e&1&&(o(0,"tr"),_(1,Qe,2,0,"th",21),o(2,"th"),d(3,"Name"),a(),o(4,"th"),d(5,"Date"),a(),o(6,"th"),d(7,"Asset Account"),a(),o(8,"th"),d(9,"Expense Account"),a(),o(10,"th",22),d(11,"Amount"),a()()),e&2){let t=f(2);m(),D(t.roleService.permissions().recurring.create?1:-1)}}function Xe(e,s){if(e&1&&(o(0,"td"),E(1,"p-tableCheckbox",24),a()),e&2){let t=f().$implicit;m(),x("value",t)}}function Ye(e,s){if(e&1&&(o(0,"tr"),_(1,Xe,2,1,"td"),o(2,"td")(3,"a",23),d(4),a()(),o(5,"td"),d(6),A(7,"date"),a(),o(8,"td"),d(9),a(),o(10,"td"),d(11),a(),o(12,"td",22),d(13),A(14,"number"),a()()),e&2){let t=s.$implicit,i=f(2);m(),D(i.roleService.permissions().recurring.create?1:-1),m(2),x("routerLink",V(12,Ge,t.id)),m(),Q(" ",t.name," "),m(2),R(Z(7,7,t.nextExpenseDate,"d MMM y")),m(3),R(t.paymentName),m(2),R(t.expenseName),m(2),R(Y(14,10,t.amount))}}function Ze(e,s){e&1&&(o(0,"tr")(1,"td",25)(2,"span"),d(3,"No records found."),a()()())}function et(e,s){if(e&1){let t=M();o(0,"p-panel")(1,"div",9)(2,"div",10)(3,"div",11)(4,"div",12)(5,"div",13)(6,"label",14),d(7,"Date"),a(),E(8,"p-datepicker",15),a()(),o(9,"div",12)(10,"div",13)(11,"label",14),d(12,"Recurring Expense"),a(),E(13,"p-multiselect",16),_(14,Je,2,1,"div",17),a()()()()(),E(15,"p-divider"),o(16,"p-table",18),j("onHeaderCheckboxToggle",function(n){P(t);let r=f();return w(r.onHeaderCheckboxToggle(n))})("onRowSelect",function(n){P(t);let r=f();return w(r.onRowSelect(n))})("onRowUnselect",function(n){P(t);let r=f();return w(r.onRowUnselect(n))}),_(17,We,12,1,"ng-template",null,2,b)(19,Ye,15,14,"ng-template",null,3,b)(21,Ze,4,0,"ng-template",null,4,b),a()()}if(e&2){let t=f();J(X(7,Ue)),m(),x("formGroup",t.form),m(12),x("ngClass",V(8,Be,t.isInvalid("listIDs")))("options",t.store.meta().options.expenses),m(),x("ngIf",t.isInvalid("listIDs")),m(2),x("value",t.store.data().data)}}var Gt=(()=>{class e extends Ae{constructor(){super(),this.store=g(U),this.fb=g(fe),this.dayjsService=g(Me),this.PREService=g(k),this.roleService=g(pe)}ngOnInit(){this.initForm(),this.form.valueChanges.pipe(G(300),$(),y("Form Value Changes"),v(t=>Object.entries(t).reduce((i,[n,r])=>{switch(n){case"date":typeof r=="object"&&r!==null&&!Array.isArray(r)?i[n]=this.dayjsService.from(r)?this.dayjsService.format(r):null:(typeof r=="string"||typeof r=="number"||r instanceof Date)&&!Array.isArray(r)?i[n]=r!=null?String(r):null:i[n]=null;break;default:i[n]=r===null?"":r;break}return i},{})),y("Mapped Form Value"),F(t=>{(!t.listIDs||t.listIDs.length===0)&&this.store.emptyData(),this.store.updateFilter(t)})).subscribe()}initForm(){let{date:t,listIDs:i,number:n}=this.store.filter();this.form=this.fb.group({date:this.fb.control(this.dayjsService.from(t)?this.dayjsService.from(t).toDate():this.dayjsService.now.toDate(),[N.required]),number:this.fb.control(n||""),listIDs:this.fb.control(i,[N.required])})}onRowSelect(t){this.store.onRowSelect(t.data)}onRowUnselect(t){if(Array.isArray(t.data)){t.data.forEach(i=>{this.store.onRowUnselect(i)});return}else this.store.onRowUnselect(t.data)}onHeaderCheckboxToggle(t){this.store.onHeaderCheckboxToggle(t.checked)}onSubmitPRE(){console.log(this.store.checkedPRE());let i=this.store.checkedPRE().reduce((r,p)=>(r[p.id]||(r[p.id]={ID:p.id,ListDate:[]}),r[p.id].ListDate.push(p.lastExpenseDate),r),{}),n=Object.values(i);console.log("Submitting PRE with body:",n),this.PREService.submitPostRecurringExpense(n).pipe(y("Submit Post Recurring Expense"),F(()=>{let r=this.form.getRawValue(),p=Object.entries(r).reduce((S,[C,u])=>{switch(C){case"date":typeof u=="object"&&u!==null&&!Array.isArray(u)?S[C]=this.dayjsService.from(u)?this.dayjsService.format(u):null:(typeof u=="string"||typeof u=="number"||u instanceof Date)&&!Array.isArray(u)?S[C]=u!=null?String(u):null:S[C]=null;break;default:S[C]=u===null?"":u;break}return S},{});this.store.updateFilter(p)})).subscribe()}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=K({type:e,selectors:[["app-post-recurring-expense"]],features:[W([U]),z],decls:5,vars:1,consts:[["actionButton",""],["content",""],["header",""],["body",""],["emptymessage",""],["pageTitle","Post Recurring Expense",3,"scrollable"],["label","Submit"],["label","Submit",3,"onClick",4,"ngIf"],["label","Submit",3,"onClick"],[1,"row",3,"formGroup"],[1,"col-6"],[1,"row"],[1,"col"],[1,"d-flex","flex-column"],["for",""],["fluid","","formControlName","date"],["display","chip","fluid","","formControlName","listIDs","optionLabel","name","optionValue","id","placeholder","Select Recurring Expenses",3,"ngClass","options"],[4,"ngIf"],["dataKey","lastExpenseDate",3,"onHeaderCheckboxToggle","onRowSelect","onRowUnselect","value"],[4,"ngFor","ngForOf"],[1,"text-danger"],[2,"width","1rem"],[1,"text-end"],["target","_blank",1,"link","link-primary",3,"routerLink"],[3,"value"],["colspan","6"]],template:function(i,n){i&1&&(o(0,"app-main-panel",5),_(1,Ke,1,1,"ng-template",null,0,b)(3,et,23,10,"ng-template",null,1,b),a()),i&2&&x("scrollable",!0)},dependencies:[we,oe,ee,te,ie,re,ne,Ee,he,Ne,Le,ye,De,Ve,je,ge,ce,me,de,ue,Fe,ke,Ie,Te,_e,xe,se,ae],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return e})();export{Gt as PostRecurringExpenseComponent};
1
+ import{a as Le,b as Ne}from"./chunk-GIRWHO6Q.js";import{b as Me}from"./chunk-AKHZNBCJ.js";import{a as Ae}from"./chunk-XKI7WLHE.js";import{a as je,b as Ve}from"./chunk-2ABEICLB.js";import"./chunk-KQZMRRMA.js";import"./chunk-ZC7ZENN7.js";import{m as pe}from"./chunk-Q4XWXOWE.js";import"./chunk-WL6ZZCYW.js";import{a as H,b as O}from"./chunk-3VQUNDVT.js";import{b as ke,g as Ie,h as Te,i as Fe}from"./chunk-52EMI2TW.js";import"./chunk-AAKZYXG3.js";import{a as De,b as ye}from"./chunk-BME4Z6DH.js";import"./chunk-VSDW2RJ5.js";import"./chunk-7L5IAWG2.js";import{a as y}from"./chunk-BT7Y4ADP.js";import"./chunk-MJGBBYIO.js";import"./chunk-CN6AT4LE.js";import"./chunk-OW2ND5HU.js";import"./chunk-JWNGZMSE.js";import"./chunk-II7KELI4.js";import"./chunk-FTBQKOYS.js";import"./chunk-L4ENW4RK.js";import"./chunk-KONCSTVQ.js";import"./chunk-FMAG3RQL.js";import{i as we}from"./chunk-EXPUB774.js";import"./chunk-VM56C6ZV.js";import{a as he,b as Ee}from"./chunk-ISIYG4D5.js";import{b as h,c as Re,d as be,e as Se,f as Ce,g as ve,h as Pe}from"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{w as xe,x as _e}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import{c as N,e as ce,f as me,m as de,p as ue,v as fe,y as ge}from"./chunk-MGIEURA2.js";import{e as ae,l as se}from"./chunk-DZCJWJUG.js";import"./chunk-DD3C4ZJK.js";import{a as le}from"./chunk-G3BJCT7T.js";import"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import{j as ee,l as te,m as ie,r as ne,s as re,u as oe}from"./chunk-DM2JLWKE.js";import{Cb as z,D as B,Dc as W,Eb as _,Ec as X,Fc as V,L as G,Mb as x,Oc as A,P as $,Pb as J,Pc as Y,Qc as Z,Rb as D,Sc as b,Wb as o,Xb as a,Y as T,Yb as E,_ as F,ac as M,bd as L,c as I,ca as q,fc as j,gc as f,ia as g,ib as m,qa as P,ra as w,s as v,sc as d,tc as R,uc as Q,yb as K}from"./chunk-6QJHEOXN.js";import{a as l,b as c}from"./chunk-YQFG5XE2.js";var k=(()=>{class e{constructor(){this.httpService=g(le)}getPostRecurringExpenseLoader(){return this.httpService.get(void 0,"api/RecurringExpenseLoader/RecurringExpensesGenerate")}previewPostRecurringExpense(t){return this.httpService.post(void 0,"api/RecurringExpense/RecurringExpensesGeneratePreview",t)}submitPostRecurringExpense(t){return this.httpService.post(void 0,"api/RecurringExpense/RecurringExpensesGenerate",t)}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275prov=q({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();var Oe={data:{data:[]},meta:{options:{expenses:[]},form:{date:"",number:"",listIDs:[]}},filter:{date:"",number:"",listIDs:[]}},U=Re(ve(Oe),Pe("PostRecurringExpenseStore"),be(e=>({hasCheckedRows:L(()=>e.data().data.some(s=>s.checked)),checkedPRE:L(()=>e.data().data.filter(s=>s.checked))})),Ce(e=>{let s=g(k);return{updateFilter:i=>{h(e,n=>c(l({},n),{filter:l(l({},n.filter),i)}))},emptyData(){h(e,i=>c(l({},i),{data:{data:[],totalCount:0}}))},onRowSelect(i){h(e,n=>{let r=n.data.data.map(p=>p.lastExpenseDate===i.lastExpenseDate?c(l({},p),{checked:!0}):p);return c(l({},n),{data:c(l({},n.data),{data:r})})})},onRowUnselect(i){h(e,n=>{let r=n.data.data.map(p=>p.lastExpenseDate===i.lastExpenseDate?c(l({},p),{checked:!1}):p);return c(l({},n),{data:c(l({},n.data),{data:r})})})},onHeaderCheckboxToggle(i){h(e,n=>{let r=n.data.data.map(p=>c(l({},p),{checked:i}));return c(l({},n),{data:c(l({},n.data),{data:r})})})},getPRELoader:H(I(T(()=>s.getPostRecurringExpenseLoader().pipe(O({next:i=>{h(e,n=>c(l({},n),{meta:i}))},error:i=>{console.error("Error fetching PRE Loader:",i)}}))))),getPREPreview:H(I(B(i=>i.date&&i.listIDs.length>0),v(i=>({Date:i.date,Number:i.number,ListIDs:i.listIDs})),T(i=>s.previewPostRecurringExpense(i).pipe(v(n=>c(l({},n),{data:n.data.map(r=>c(l({},r),{checked:!1}))})),O({next:n=>{h(e,r=>c(l({},r),{data:n}))},error:n=>{console.error("Error fetching PRE Preview:",n)}})))))}}),Se(e=>({onInit:()=>{e.getPRELoader(),e.getPREPreview(e.filter)}})));var Ue=()=>({height:"calc(100vh - 70px)"}),Be=e=>({"ng-invalid ng-dirty":e}),Ge=e=>["/pages/recurring/recurring-expense/details/",e];function $e(e,s){if(e&1){let t=M();o(0,"p-button",8),j("onClick",function(){P(t);let n=f(3);return w(n.onSubmitPRE())}),a()}}function qe(e,s){if(e&1&&_(0,$e,1,0,"p-button",7),e&2){let t=f(2);x("ngIf",t.store.hasCheckedRows())}}function Ke(e,s){if(e&1&&_(0,qe,1,1,"p-button",6),e&2){let t=f();D(t.roleService.permissions().recurring.create?0:-1)}}function ze(e,s){if(e&1&&(o(0,"div")(1,"span",20),d(2),a()()),e&2){let t=s.$implicit;m(2),R(t)}}function Je(e,s){if(e&1&&(o(0,"div"),_(1,ze,3,1,"div",19),a()),e&2){let t=f(2);m(),x("ngForOf",t.getErrors("listIDs"))}}function Qe(e,s){e&1&&(o(0,"th",21),E(1,"p-tableHeaderCheckbox"),a())}function We(e,s){if(e&1&&(o(0,"tr"),_(1,Qe,2,0,"th",21),o(2,"th"),d(3,"Name"),a(),o(4,"th"),d(5,"Date"),a(),o(6,"th"),d(7,"Asset Account"),a(),o(8,"th"),d(9,"Expense Account"),a(),o(10,"th",22),d(11,"Amount"),a()()),e&2){let t=f(2);m(),D(t.roleService.permissions().recurring.create?1:-1)}}function Xe(e,s){if(e&1&&(o(0,"td"),E(1,"p-tableCheckbox",24),a()),e&2){let t=f().$implicit;m(),x("value",t)}}function Ye(e,s){if(e&1&&(o(0,"tr"),_(1,Xe,2,1,"td"),o(2,"td")(3,"a",23),d(4),a()(),o(5,"td"),d(6),A(7,"date"),a(),o(8,"td"),d(9),a(),o(10,"td"),d(11),a(),o(12,"td",22),d(13),A(14,"number"),a()()),e&2){let t=s.$implicit,i=f(2);m(),D(i.roleService.permissions().recurring.create?1:-1),m(2),x("routerLink",V(12,Ge,t.id)),m(),Q(" ",t.name," "),m(2),R(Z(7,7,t.nextExpenseDate,"d MMM y")),m(3),R(t.paymentName),m(2),R(t.expenseName),m(2),R(Y(14,10,t.amount))}}function Ze(e,s){e&1&&(o(0,"tr")(1,"td",25)(2,"span"),d(3,"No records found."),a()()())}function et(e,s){if(e&1){let t=M();o(0,"p-panel")(1,"div",9)(2,"div",10)(3,"div",11)(4,"div",12)(5,"div",13)(6,"label",14),d(7,"Date"),a(),E(8,"p-datepicker",15),a()(),o(9,"div",12)(10,"div",13)(11,"label",14),d(12,"Recurring Expense"),a(),E(13,"p-multiselect",16),_(14,Je,2,1,"div",17),a()()()()(),E(15,"p-divider"),o(16,"p-table",18),j("onHeaderCheckboxToggle",function(n){P(t);let r=f();return w(r.onHeaderCheckboxToggle(n))})("onRowSelect",function(n){P(t);let r=f();return w(r.onRowSelect(n))})("onRowUnselect",function(n){P(t);let r=f();return w(r.onRowUnselect(n))}),_(17,We,12,1,"ng-template",null,2,b)(19,Ye,15,14,"ng-template",null,3,b)(21,Ze,4,0,"ng-template",null,4,b),a()()}if(e&2){let t=f();J(X(7,Ue)),m(),x("formGroup",t.form),m(12),x("ngClass",V(8,Be,t.isInvalid("listIDs")))("options",t.store.meta().options.expenses),m(),x("ngIf",t.isInvalid("listIDs")),m(2),x("value",t.store.data().data)}}var Gt=(()=>{class e extends Ae{constructor(){super(),this.store=g(U),this.fb=g(fe),this.dayjsService=g(Me),this.PREService=g(k),this.roleService=g(pe)}ngOnInit(){this.initForm(),this.form.valueChanges.pipe(G(300),$(),y("Form Value Changes"),v(t=>Object.entries(t).reduce((i,[n,r])=>{switch(n){case"date":typeof r=="object"&&r!==null&&!Array.isArray(r)?i[n]=this.dayjsService.from(r)?this.dayjsService.format(r):null:(typeof r=="string"||typeof r=="number"||r instanceof Date)&&!Array.isArray(r)?i[n]=r!=null?String(r):null:i[n]=null;break;default:i[n]=r===null?"":r;break}return i},{})),y("Mapped Form Value"),F(t=>{(!t.listIDs||t.listIDs.length===0)&&this.store.emptyData(),this.store.updateFilter(t)})).subscribe()}initForm(){let{date:t,listIDs:i,number:n}=this.store.filter();this.form=this.fb.group({date:this.fb.control(this.dayjsService.from(t)?this.dayjsService.from(t).toDate():this.dayjsService.now.toDate(),[N.required]),number:this.fb.control(n||""),listIDs:this.fb.control(i,[N.required])})}onRowSelect(t){this.store.onRowSelect(t.data)}onRowUnselect(t){if(Array.isArray(t.data)){t.data.forEach(i=>{this.store.onRowUnselect(i)});return}else this.store.onRowUnselect(t.data)}onHeaderCheckboxToggle(t){this.store.onHeaderCheckboxToggle(t.checked)}onSubmitPRE(){console.log(this.store.checkedPRE());let i=this.store.checkedPRE().reduce((r,p)=>(r[p.id]||(r[p.id]={ID:p.id,ListDate:[]}),r[p.id].ListDate.push(p.lastExpenseDate),r),{}),n=Object.values(i);console.log("Submitting PRE with body:",n),this.PREService.submitPostRecurringExpense(n).pipe(y("Submit Post Recurring Expense"),F(()=>{let r=this.form.getRawValue(),p=Object.entries(r).reduce((S,[C,u])=>{switch(C){case"date":typeof u=="object"&&u!==null&&!Array.isArray(u)?S[C]=this.dayjsService.from(u)?this.dayjsService.format(u):null:(typeof u=="string"||typeof u=="number"||u instanceof Date)&&!Array.isArray(u)?S[C]=u!=null?String(u):null:S[C]=null;break;default:S[C]=u===null?"":u;break}return S},{});this.store.updateFilter(p)})).subscribe()}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=K({type:e,selectors:[["app-post-recurring-expense"]],features:[W([U]),z],decls:5,vars:1,consts:[["actionButton",""],["content",""],["header",""],["body",""],["emptymessage",""],["pageTitle","Post Recurring Expense",3,"scrollable"],["label","Submit"],["label","Submit",3,"onClick",4,"ngIf"],["label","Submit",3,"onClick"],[1,"row",3,"formGroup"],[1,"col-6"],[1,"row"],[1,"col"],[1,"d-flex","flex-column"],["for",""],["fluid","","formControlName","date"],["display","chip","fluid","","formControlName","listIDs","optionLabel","name","optionValue","id","placeholder","Select Recurring Expenses",3,"ngClass","options"],[4,"ngIf"],["dataKey","lastExpenseDate",3,"onHeaderCheckboxToggle","onRowSelect","onRowUnselect","value"],[4,"ngFor","ngForOf"],[1,"text-danger"],[2,"width","1rem"],[1,"text-end"],["target","_blank",1,"link","link-primary",3,"routerLink"],[3,"value"],["colspan","6"]],template:function(i,n){i&1&&(o(0,"app-main-panel",5),_(1,Ke,1,1,"ng-template",null,0,b)(3,et,23,10,"ng-template",null,1,b),a()),i&2&&x("scrollable",!0)},dependencies:[we,oe,ee,te,ie,re,ne,Ee,he,Ne,Le,ye,De,Ve,je,ge,ce,me,de,ue,Fe,ke,Ie,Te,_e,xe,se,ae],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return e})();export{Gt as PostRecurringExpenseComponent};