dealposbooks 5.44.6 → 5.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/3rdpartylicenses.txt +26 -26
  2. package/chunk-27TIOMYM.js +1 -0
  3. package/{chunk-JUCJGYST.js → chunk-2AAVNIG7.js} +1 -1
  4. package/{chunk-UKBDY33R.js → chunk-2D2YD753.js} +1 -1
  5. package/{chunk-ZDTMCWOO.js → chunk-2MKKFLNJ.js} +1 -1
  6. package/{chunk-5JV52UYK.js → chunk-2XUSZCQL.js} +1 -1
  7. package/{chunk-TARMA6TN.js → chunk-35MXFTDN.js} +1 -1
  8. package/{chunk-2LQVI4EI.js → chunk-36OX4S7M.js} +1 -1
  9. package/{chunk-NHZLS6JU.js → chunk-3A4BFUGD.js} +1 -1
  10. package/{chunk-LV6YHYS7.js → chunk-3FDVZDYS.js} +1 -1
  11. package/{chunk-SPKOXGSS.js → chunk-3GGXPPQT.js} +1 -1
  12. package/chunk-3OMEVXSG.js +1 -0
  13. package/{chunk-BJV3MSHK.js → chunk-4ETCCLMI.js} +1 -1
  14. package/chunk-4MZNOMUN.js +1 -0
  15. package/{chunk-RJTHFDGC.js → chunk-4PUT2IIE.js} +1 -1
  16. package/{chunk-AF357XP4.js → chunk-5CZNOXPC.js} +1 -1
  17. package/{chunk-HK76OJ3U.js → chunk-5EJXAYSX.js} +1 -1
  18. package/{chunk-N4BTKSCQ.js → chunk-66D4GMNG.js} +1 -1
  19. package/{chunk-I7ILLTFH.js → chunk-6A2KUPOG.js} +1 -1
  20. package/{chunk-IGVRGJ3L.js → chunk-6D4IGQVY.js} +1 -1
  21. package/{chunk-ATJ55H5D.js → chunk-6GN3MGBY.js} +1 -1
  22. package/{chunk-MZGGLVOX.js → chunk-6HX55BLY.js} +1 -1
  23. package/{chunk-MZAFOBGT.js → chunk-6NX36ZC2.js} +1 -1
  24. package/{chunk-MAID3JDN.js → chunk-6PNHT5U7.js} +1 -1
  25. package/{chunk-CNXEJBY5.js → chunk-7DYACF4D.js} +1 -1
  26. package/{chunk-W3PCANAM.js → chunk-7FFVGWUP.js} +1 -1
  27. package/{chunk-WK4BTEU4.js → chunk-7XL26PM3.js} +1 -1
  28. package/{chunk-EFDD6Q3K.js → chunk-AOOG6YOT.js} +1 -1
  29. package/{chunk-ARXP327B.js → chunk-ARH3WEEF.js} +1 -1
  30. package/chunk-AUYM5P42.js +202 -0
  31. package/{chunk-IYO6P6XI.js → chunk-B54PFCWI.js} +1 -1
  32. package/{chunk-JDWPD3PQ.js → chunk-BJWQQABR.js} +2 -2
  33. package/{chunk-BUYRVZ5Z.js → chunk-BLR3HBYP.js} +1 -1
  34. package/{chunk-UDIFKJ7M.js → chunk-BXEGWIR3.js} +1 -1
  35. package/{chunk-AL647DUL.js → chunk-CNXYBR45.js} +1 -1
  36. package/{chunk-EJBBENFA.js → chunk-CSDQYXOM.js} +1 -1
  37. package/{chunk-SVHOGUGR.js → chunk-CVL3S2HY.js} +1 -1
  38. package/chunk-DLIPUA4K.js +1 -0
  39. package/{chunk-NBBH4QTN.js → chunk-DX2A6LIU.js} +1 -1
  40. package/{chunk-M5PA3FZY.js → chunk-EB6NEJHF.js} +1 -1
  41. package/chunk-EERQ53V7.js +1 -0
  42. package/{chunk-3LESCZJU.js → chunk-EG4A3G2F.js} +1 -1
  43. package/{chunk-VPQDUC77.js → chunk-EL5BUFMO.js} +1 -1
  44. package/{chunk-76LPTGLX.js → chunk-EQ4PLHI4.js} +1 -1
  45. package/{chunk-EHM2KHSR.js → chunk-FPI32FQH.js} +1 -1
  46. package/{chunk-UIO722AZ.js → chunk-G2DQX336.js} +1 -1
  47. package/{chunk-2BZH24YX.js → chunk-GIQOPGQF.js} +1 -1
  48. package/{chunk-RLUIUJY3.js → chunk-GX5CQNX3.js} +1 -1
  49. package/{chunk-O4APZZ3M.js → chunk-H3BFDSSJ.js} +3 -3
  50. package/{chunk-7FFMPB6T.js → chunk-H6HNANYB.js} +1 -1
  51. package/{chunk-CWHL7PNC.js → chunk-H7Q35Y7G.js} +1 -1
  52. package/{chunk-6XT4TD5A.js → chunk-HAQ36ZI6.js} +1 -1
  53. package/{chunk-MPHY6FVN.js → chunk-HG5MKVNR.js} +1 -1
  54. package/{chunk-NPVJGHTO.js → chunk-HPITHIZA.js} +1 -1
  55. package/{chunk-3GMNUULJ.js → chunk-IFQIZ5KJ.js} +1 -1
  56. package/{chunk-7COI2POD.js → chunk-IGWIRCAS.js} +1 -1
  57. package/{chunk-ODRV6XWO.js → chunk-IHZ55QSI.js} +1 -1
  58. package/chunk-ITBP232X.js +129 -0
  59. package/{chunk-7ZYLIEUZ.js → chunk-IYBQ7NLP.js} +1 -1
  60. package/{chunk-K4P3JOA6.js → chunk-JRVYSBUZ.js} +1 -1
  61. package/{chunk-Z6ETOFZG.js → chunk-K5U6AQ75.js} +1 -1
  62. package/{chunk-ZEWON3MW.js → chunk-KGQGMXW6.js} +1 -1
  63. package/{chunk-MS6WBVQX.js → chunk-KIBBRAL5.js} +1 -1
  64. package/{chunk-WXT6EZ2V.js → chunk-KJ2WX3FC.js} +1 -1
  65. package/{chunk-LHA7OCPB.js → chunk-KW4A377H.js} +1 -1
  66. package/{chunk-6O5EWYT7.js → chunk-LFZCMZAP.js} +1 -1
  67. package/{chunk-65IKFGTF.js → chunk-LSK6C72D.js} +1 -1
  68. package/{chunk-3KWAJ7F2.js → chunk-M6LSMNSQ.js} +1 -1
  69. package/{chunk-IJTQE2H4.js → chunk-MFK5RQPJ.js} +1 -1
  70. package/{chunk-PPKCZMH4.js → chunk-N4JIPI53.js} +1 -1
  71. package/{chunk-VKADRKJU.js → chunk-N75VYDTF.js} +1 -1
  72. package/{chunk-E3ZGQRZ3.js → chunk-NCDT6JPP.js} +1 -1
  73. package/{chunk-6K5LNQ4J.js → chunk-NMCKMUY4.js} +3 -3
  74. package/{chunk-NMSYINDE.js → chunk-NZN6QJR3.js} +1 -1
  75. package/chunk-O2QIO42B.js +7 -0
  76. package/chunk-OBZRC7DX.js +1 -0
  77. package/{chunk-72LNXEXV.js → chunk-OIBDX2CA.js} +1 -1
  78. package/{chunk-3HZX655H.js → chunk-OTMBGB3T.js} +1 -1
  79. package/{chunk-REF7WUSQ.js → chunk-OTO7ELZ2.js} +1 -1
  80. package/{chunk-XLPFLHKU.js → chunk-OVAQBQEJ.js} +1 -1
  81. package/{chunk-RHH3CU5D.js → chunk-PJDNYCLD.js} +1 -1
  82. package/{chunk-AGB5OXUF.js → chunk-PPJQN2WS.js} +1 -1
  83. package/{chunk-AJZ7YLT4.js → chunk-Q24GCSGD.js} +1 -1
  84. package/{chunk-3KYU6FI2.js → chunk-Q5CVMJZC.js} +1 -1
  85. package/chunk-QF4D5YPK.js +1 -0
  86. package/chunk-QVIFRW2H.js +160 -0
  87. package/{chunk-GX55DZY5.js → chunk-R6TARUG2.js} +1 -1
  88. package/{chunk-VRKBMD72.js → chunk-R7N6BWL5.js} +1 -1
  89. package/{chunk-MJ6ZJF3H.js → chunk-RZFXAB7W.js} +1 -1
  90. package/{chunk-JXEIGOVF.js → chunk-S5O44AS7.js} +1 -1
  91. package/{chunk-WT4Z2QBS.js → chunk-T6B4BOOB.js} +1 -1
  92. package/chunk-T7VJORKB.js +1 -0
  93. package/{chunk-MWFWXJG3.js → chunk-U5XXKH2H.js} +1 -1
  94. package/{chunk-A4X33OU3.js → chunk-U7BSQJHQ.js} +1 -1
  95. package/{chunk-6V36DOK2.js → chunk-UP67MADL.js} +1 -1
  96. package/{chunk-L3PZS6EL.js → chunk-VGNJD35F.js} +1 -1
  97. package/{chunk-E3QNEH3B.js → chunk-VJ3IBUVO.js} +1 -1
  98. package/{chunk-JYNY6F6D.js → chunk-VXTZNZMH.js} +1 -1
  99. package/{chunk-SB5MSLCX.js → chunk-VZ5CMS5O.js} +1 -1
  100. package/{chunk-T2JZ7FIJ.js → chunk-W5ER7276.js} +1 -1
  101. package/{chunk-OB46Z7ZH.js → chunk-XD7VHCRC.js} +1 -1
  102. package/{chunk-B6HWQE7D.js → chunk-Y6YUTTA4.js} +1 -1
  103. package/{chunk-FLYLFPA3.js → chunk-YOMVOFLB.js} +1 -1
  104. package/{chunk-ACTRMWEI.js → chunk-YV2QJ63P.js} +1 -1
  105. package/{chunk-2CF6W3MQ.js → chunk-ZRCCGUC4.js} +1 -1
  106. package/{chunk-OH3DUGUZ.js → chunk-ZZCT6WNV.js} +1 -1
  107. package/index.html +2 -2
  108. package/{main-SIOXXMKG.js → main-SLMY35VH.js} +1 -1
  109. package/package.json +1 -1
  110. package/chunk-56NDKVXE.js +0 -1
  111. package/chunk-BZBA3AI5.js +0 -160
  112. package/chunk-EKSLKPSH.js +0 -1
  113. package/chunk-GYLR4MM5.js +0 -7
  114. package/chunk-IKAVDQZY.js +0 -202
  115. package/chunk-KXE3J4PK.js +0 -1
  116. package/chunk-QBRO5YKE.js +0 -129
  117. package/chunk-XURZEJ5V.js +0 -1
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"dealposbooks","version":"5.44.6"}
1
+ {"name":"dealposbooks","version":"5.45.0"}
package/chunk-56NDKVXE.js DELETED
@@ -1 +0,0 @@
1
- import{a}from"./chunk-GX55DZY5.js";import"./chunk-WT4Z2QBS.js";import"./chunk-7COI2POD.js";import"./chunk-EFDD6Q3K.js";import"./chunk-3KWAJ7F2.js";import"./chunk-ZDTMCWOO.js";import"./chunk-F2X3VGZZ.js";import"./chunk-SB5MSLCX.js";import"./chunk-6K5LNQ4J.js";import"./chunk-YQFG5XE2.js";var o=[{path:"",canActivate:[a],children:[{path:"",loadComponent:()=>import("./chunk-MZGGLVOX.js").then(t=>t.Dashboard1Component),data:{title:"Dashboard",headerTemplate:"header"}}]}];export{o as DashboardRoutes};
package/chunk-BZBA3AI5.js DELETED
@@ -1,160 +0,0 @@
1
- import{a as dt,b as ut}from"./chunk-ZEWON3MW.js";import{a as ft}from"./chunk-MS6WBVQX.js";import{a as $n,b as Ee,c as Pe,d as Kn}from"./chunk-IYO6P6XI.js";import{a as Rn,b as Bn}from"./chunk-PPKCZMH4.js";import"./chunk-CNXEJBY5.js";import{a as qn,b as zn}from"./chunk-M5PA3FZY.js";import{a as Gn}from"./chunk-XKI7WLHE.js";import{a as Dn}from"./chunk-MPHY6FVN.js";import"./chunk-NMSYINDE.js";import{a as we}from"./chunk-AF357XP4.js";import"./chunk-7COI2POD.js";import{a as at,b as lt}from"./chunk-NHZLS6JU.js";import{a as mt,b as pt,c as On,d as Fn,i as Nn,j as Ln,k as Vn}from"./chunk-VPQDUC77.js";import"./chunk-76LPTGLX.js";import"./chunk-CWHL7PNC.js";import"./chunk-VRKBMD72.js";import{a as X}from"./chunk-NBBH4QTN.js";import{a as V}from"./chunk-KXE3J4PK.js";import{b as Sn}from"./chunk-E3QNEH3B.js";import{a as bn}from"./chunk-JUCJGYST.js";import{a as st,b as ct}from"./chunk-6O5EWYT7.js";import"./chunk-I7ILLTFH.js";import"./chunk-2LQVI4EI.js";import"./chunk-SPKOXGSS.js";import"./chunk-3KYU6FI2.js";import"./chunk-IJTQE2H4.js";import{a as rt,b as K}from"./chunk-WXT6EZ2V.js";import"./chunk-AJZ7YLT4.js";import"./chunk-ATJ55H5D.js";import{f as Mn,h as $}from"./chunk-O4APZZ3M.js";import{b as ot,c as _e}from"./chunk-L3PZS6EL.js";import{a as se,b as ce}from"./chunk-5JV52UYK.js";import{a as J,b as An,c as wn,e as En,f as Pn,g as kn}from"./chunk-ACTRMWEI.js";import{c as Je,d as ln,f as sn}from"./chunk-ARXP327B.js";import{a as At,f as wt,n as nt,o as it,p as vn,t as Tn,u as Et,w as ae,x as le}from"./chunk-7FFMPB6T.js";import"./chunk-UKBDY33R.js";import{Aa as hn,D as It,Da as xn,I as cn,Ia as Cn,K as mn,La as Ae,M as pn,Ma as De,Oa as yn,Q as et,R as tt,Ua as In,W as dn,X as bt,_ as un,b as oe,c as fe,da as fn,e as Y,f as ye,g as rn,ga as _n,i as L,j as Xe,k as an,ka as gn,l as Ie,na as vt,o as be,qa as re,u as ve,va as St,w as Se,wa as Tt,x as Te}from"./chunk-72LNXEXV.js";import{b as ne,d as ie,e as B,l as N}from"./chunk-EFDD6Q3K.js";import{a as on}from"./chunk-3KWAJ7F2.js";import"./chunk-ZDTMCWOO.js";import{c as Ct,d as yt,f as Le,h as Ve}from"./chunk-F2X3VGZZ.js";import{h as z,j as We,k as O,l as xt,m as tn,p as nn,q as Ye,s as F,t as Ne}from"./chunk-SB5MSLCX.js";import{$b as w,$c as Ce,Aa as ee,Bb as Oe,Cc as he,D as Ke,Db as u,Dc as R,Ec as T,Fc as Xt,Ha as v,J as qe,Kb as P,L as Kt,Lb as l,Nc as de,Ob as He,Oc as xe,P as qt,Pb as Fe,Pc as Jt,Qb as jt,Rb as Zt,Rc as I,Tb as Qt,Ub as Wt,Vb as a,Wb as r,Xb as h,Y as D,Yb as H,Zb as U,_ as A,_c as ue,ba as zt,bd as W,c as $e,ca as ze,cb as Me,cd as en,da as Gt,db as Ht,ec as S,fc as m,hb as c,ia as x,kc as Ue,lc as pe,mc as j,nb as ht,nc as Z,qa as _,qc as te,ra as g,rc as p,s as G,sc as E,t as $t,tc as Q,ua as Ge,vc as Yt,wc as je,xb as M,xc as Ze,yb as Ut,yc as Qe}from"./chunk-6K5LNQ4J.js";import{a as C,b as y}from"./chunk-YQFG5XE2.js";var ii=["class","page"],oi=t=>({id:t}),ri=()=>({"overflow-x":"auto"}),ai=t=>({"table-borderless":t}),li=t=>["fa-solid",t],si=t=>["/pages/journal/journal-entry/",t];function ci(t,s){t&1&&h(0,"p-button",8)}function mi(t,s){if(t&1){let e=w();a(0,"p-button",9),S("onClick",function(){_(e);let i=m(2);return g(i.onDelete())}),r()}}function pi(t,s){if(t&1&&(a(0,"div",4)(1,"p-button-group"),u(2,ci,1,0,"p-button",5)(3,mi,1,0,"p-button",6),r(),a(4,"a",7),p(5,"Ledger"),r()()),t&2){let e,n=m();c(2),l("ngIf",n.roleService.coa().edit),c(),l("ngIf",n.roleService.coa().delete),c(),l("queryParams",T(3,oi,(e=n.COAInfo())==null?null:e.id))}}function di(t,s){if(t&1&&h(0,"i",25),t&2){let e=s.checked;l("ngClass",T(1,li,e?"fa-check":"fa-xmark"))}}function ui(t,s){if(t&1&&(H(0),p(1),de(2,"number"),U()),t&2){let e=m().$implicit;c(),Q(" ",xe(2,1,e.creditAmount)," ")}}function fi(t,s){if(t&1&&(H(0),p(1),de(2,"number"),U()),t&2){let e=m().$implicit;c(),Q(" ",xe(2,1,e.debitAmount)," ")}}function _i(t,s){if(t&1&&(a(0,"tr")(1,"td"),p(2),de(3,"date"),r(),a(4,"td")(5,"div",26)(6,"a",27),p(7),r()()(),a(8,"td",28),u(9,ui,3,3,"ng-container",29),r(),a(10,"td",30),u(11,fi,3,3,"ng-container",29),r(),a(12,"td",31),p(13),de(14,"number"),r()()),t&2){let e=s.$implicit;c(2),E(Jt(3,6,e.date,"dd MMM yyyy")),c(4),l("routerLink",T(11,si,e.id)),c(),E(e.number),c(2),l("ngIf",e.creditAmount!==0),c(2),l("ngIf",e.debitAmount!==0),c(2),Q(" ",xe(14,9,e.balance)," ")}}function gi(t,s){t&1&&(a(0,"tr")(1,"td",32)(2,"div",33),h(3,"img",34),a(4,"div",26)(5,"span",35),p(6,"No Data Available"),r(),a(7,"span",35),p(8,"Your data will be shown here once it's available"),r()()()()())}function hi(t,s){if(t&1){let e=w();a(0,"div",12)(1,"div",13)(2,"p-card",14)(3,"div",15)(4,"div",16)(5,"div",17),p(6,"Name"),r(),a(7,"div",18),p(8),r()(),a(9,"div",16)(10,"div",17),p(11,"Code"),r(),a(12,"div",18),p(13),r()(),a(14,"div",16)(15,"div",17),p(16,"Category"),r(),a(17,"div",18),p(18),r()(),a(19,"div",16)(20,"div",17),p(21,"Note"),r(),a(22,"div",18),p(23),r()(),a(24,"div",16)(25,"div",17),p(26,"Outlet"),r(),a(27,"div",18),p(28),r()(),a(29,"div",16)(30,"div",17),p(31,"Discontinued"),r(),a(32,"div",18)(33,"p-toggleswitch",19),S("onChange",function(i){_(e);let o=m(2);return g(o.onDiscontinued(i))}),u(34,di,1,3,"ng-template",null,2,I),r()()(),a(36,"div",16)(37,"div",17),p(38,"Access Type"),r(),a(39,"div",18),p(40),r()()()()(),a(41,"div",20)(42,"p-card",21)(43,"table",22)(44,"thead")(45,"tr")(46,"th",23),p(47,"Date"),r(),a(48,"th",23),p(49,"Number"),r(),a(50,"th",24),p(51,"Credit"),r(),a(52,"th",24),p(53,"Debit"),r(),a(54,"th",24),p(55,"Balance"),r()()(),a(56,"tbody"),Qt(57,_i,15,13,"tr",null,Zt),u(59,gi,9,0,"tr"),r()()()()()}if(t&2){let e,n,i,o,d,f,b=m(2);c(8),E((e=b.COAInfo().name)!==null&&e!==void 0?e:"-"),c(5),E((n=b.COAInfo().code)!==null&&n!==void 0?n:"-"),c(5),E((i=b.COAInfo().category)!==null&&i!==void 0?i:"-"),c(5),E((o=b.COAInfo().note)!==null&&o!==void 0?o:"-"),c(5),E((d=b.COAInfo().outletName)!==null&&d!==void 0?d:"-"),c(5),l("ngModel",b.COAInfo().bin),c(7),E((f=b.COAInfo().accessType)!==null&&f!==void 0?f:"-"),c(2),He(R(11,ri)),c(),l("ngClass",T(12,ai,b.COAInfo().transactions.length===0)),c(14),Wt(b.COAInfo().transactions),c(2),jt(b.COAInfo().transactions.length===0?59:-1)}}function xi(t,s){if(t&1&&(a(0,"div",10),u(1,hi,60,14,"div",11),r()),t&2){let e=m();c(),l("ngIf",e.COAInfo())}}var Hn=(()=>{class t{constructor(){this.#e=x(X),this.#t=x(ne),this.router=x(ie),this.COAInfo=v(null),this.checked=v(!1),this.roleService=x(we)}#e;#t;ngOnInit(){this.#t.paramMap.pipe(V("params"),D(e=>this.#e.getChartAccountById(e.get("id"))),A(e=>this.COAInfo.set(e)),V("response")).subscribe()}onDelete(){if(!confirm("Are you sure you want to delete this Chart of Accounts?"))return;let n=[this.#t.snapshot.paramMap.get("id")];this.#e.deleteChartAccount(n).pipe(A(()=>{this.router.navigate(["/pages/chart-of-account/account"])})).subscribe()}onDiscontinued(e){this.#e.discountedChartAccounts(this.#t.snapshot.paramMap.get("id"),{Discontinued:e.checked}).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=M({type:t,selectors:[["app-coa-account-info",8,"page"]],attrs:ii,decls:5,vars:1,consts:[["actionButton",""],["content",""],["handle",""],["pageTitle","Chart of Account Details",3,"overflowScroll"],[1,"d-flex","gap-2"],["routerLink","edit","severity","secondary","outlined","","label","Edit","icon","fa-solid fa-pen-to-square",4,"ngIf"],["severity","secondary","outlined","","label","Delete","icon","fa-solid fa-trash",3,"onClick",4,"ngIf"],["routerLink","/pages/report/general-ledger",1,"p-button",3,"queryParams"],["routerLink","edit","severity","secondary","outlined","","label","Edit","icon","fa-solid fa-pen-to-square"],["severity","secondary","outlined","","label","Delete","icon","fa-solid fa-trash",3,"onClick"],[1,"container-fluid"],["class","row justify-content-center mt-3 px-2",4,"ngIf"],[1,"row","justify-content-center","mt-3","px-2"],[1,"col","col-lg-5"],["styleClass","h-100"],[1,"d-flex","flex-column","row-gap-4"],[1,"row"],[1,"col","col-lg-4"],[1,"col"],[3,"onChange","ngModel"],[1,"col","col-lg-7"],["styleClass","h-100",1,"right-panel","h-100"],[1,"table",3,"ngClass"],["scope","col"],["scope","col",1,"text-end"],[3,"ngClass"],[1,"d-flex","flex-column"],["target","_blank",1,"link","link-primary",3,"routerLink"],[1,"text-danger","text-end"],[4,"ngIf"],[1,"text-success","text-end"],[1,"text-end"],["colspan","5",1,"text-center"],[1,"d-flex","flex-column","align-items-center","gap-2"],["src","https://res.cloudinary.com/pos/image/upload/v1705388070/POS/Images/Cashier/globalnodata.svg","alt","No Data"],[1,"text-secondary","text-opacity-75"]],template:function(n,i){n&1&&(a(0,"app-main-panel",3),u(1,pi,6,5,"ng-template",null,0,I)(3,xi,2,1,"ng-template",null,1,I),r()),n&2&&l("overflowScroll",!0)},dependencies:[F,z,O,Ye,nn,Se,Y,Xe,Je,N,B,$,K,rt,le,ae,ut,dt,On,Dn],styles:[".table>thead>tr>th{background-color:#f6f6f6!important;color:#000!important;font-weight:500!important}"],changeDetection:0})}}return t})();var me=(()=>{class t{constructor(){this.httpService=x(on)}fetchCOACategories(){return this.httpService.get("","api/ChartOfAccount/Category")}getCOACategoryByID(e){let n={params:e};return this.httpService.get("","api/ChartOfAccount/CategoryInfo",n)}renameCategory(e,n){return this.httpService.put("",`api/ChartOfAccount/RenameCategory/${e}`,n)}updateParentCategory(e,n){return this.httpService.put("",`api/ChartOfAccount/UpdateParentCategory/${e}`,n).pipe()}deleteCategory(e){return this.httpService.delete("",`api/ChartOfAccount/Category/${e}`)}submitCategory(e,n={}){return this.httpService.post("","api/ChartOfAccount/SubmitCategory",e,n)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=ze({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var kt=t=>t?t.reduce((s,e)=>(s.push({label:e.label,data:e.data,key:e.key}),e.children&&e.children.length?s.push(...kt(e.children)):s.push({label:`${e.label} (no children)`,data:e.data,key:`${e.key}-no-children`}),s),[]):[];var Mt=(t,s,e)=>{let n=Math.ceil(e/s),i=(t-1)*s+1,o=Math.min(t*s,e);return{start:i,end:o,totalRecords:e,totalPages:n}};var Ci={filter:{PageSize:20,PageNumber:1,CategoryID:"",Text:"",listOutletID:[],Discontinued:2,AccessLevel:-1},options:{entities:[],categories:[],accessLevels:[]},data:[],count:0,perPages:[{key:20,value:"20 per page"},{key:40,value:"40 per page"},{key:60,value:"60 per page"},{key:80,value:"80 per page"},{key:100,value:"100 per page"}]},Ot=An(Pn(Ci),kn("ChartOfAccount"),wn(t=>({isAllChecked:W(()=>t.data().every(s=>s.checked)),checkedItems:W(()=>t.data().filter(s=>s.checked)),IDsChecked:W(()=>t.data().filter(s=>s.checked).map(s=>s.id)),categories:W(()=>kt(t.options.categories())),first:W(()=>{let{start:s}=Mt(t.filter().PageNumber,t.filter().PageSize,t.count());return s}),last:W(()=>{let{end:s}=Mt(t.filter().PageNumber,t.filter().PageSize,t.count());return s})})),En(t=>{let s=x(X),e=x(me),n={updateFilter(i){J(t,{filter:C({},i)})},checkedItem(i){if(Array.isArray(i))i.forEach(o=>{let d=t.data().map(f=>f.id===o.id?y(C({},f),{checked:!o.checked}):f);J(t,{data:d})});else{let o=i,d=t.data().map(f=>f.id===o.id?y(C({},f),{checked:!o.checked}):f);J(t,{data:d})}},checkAllCheckbox(){let i=t.data().map(o=>y(C({},o),{checked:!o.checked}));J(t,{data:i})},fetchChartOfAccount:at($e(Ke(()=>!!t.filter()),Kt(300),qt(),D(i=>s.getPaginatedChartAccounts(i).pipe(G(o=>y(C({},o),{data:o.data.map(d=>y(C({},d),{checked:!1}))})),lt({next:o=>J(t,{data:o.data,count:o.count}),error:o=>{J(t,{data:[],count:0}),console.error(o)}}))))),fetchLoader:at($e(D(()=>s.getChartOfAccountLoader().pipe(lt({next:i=>{J(t,{filter:y(C({},t.filter()),{PageSize:i.filter.pageSize,PageNumber:1,CategoryID:i.filter.categoryID||null,Text:"",listOutletID:[]}),options:i.options}),n.fetchChartOfAccount(t.filter)},error:i=>{console.error(i)}}))))),getCategories:at($e(qe(()=>e.fetchCOACategories().pipe(lt({next:i=>{J(t,{options:y(C({},t.options()),{entities:t.options.entities(),categories:i})})},error:i=>{console.error(i)}})))))};return n}));var vi=["class","page"],Si=t=>["../account/",t],Ti=t=>({"text-decoration-line-through":t}),Ai=()=>["/pages/report/general-ledger"],wi=t=>({id:t});function Ei(t,s){if(t&1){let e=w();a(0,"p-button",13),S("onClick",function(){_(e);let i=m(2);return g(i.deleteCOA())}),r()}}function Pi(t,s){t&1&&h(0,"p-button",14)}function ki(t,s){if(t&1){let e=w();a(0,"p-button",15),S("onClick",function(){_(e);let i=m(2);return g(i.onExport())}),r()}}function Mi(t,s){t&1&&(a(0,"a",16),h(1,"i",17),p(2," Add"),r())}function Oi(t,s){if(t&1&&(a(0,"div",8),u(1,Ei,1,0,"p-button",9),a(2,"p-button-group"),u(3,Pi,1,0,"p-button",10)(4,ki,1,0,"p-button",11),r(),u(5,Mi,3,0,"a",12),r()),t&2){let e=m();c(),l("ngIf",e.store.checkedItems().length&&e.roleService.coa().delete),c(2),l("ngIf",e.roleService.coa().create),c(),l("ngIf",e.roleService.global().export),c(),l("ngIf",e.roleService.coa().create)}}function Fi(t,s){t&1&&(a(0,"th",21),h(1,"p-tableHeaderCheckbox"),r())}function Ni(t,s){if(t&1&&(a(0,"tr"),u(1,Fi,2,0,"th",19),a(2,"th"),p(3,"Code"),r(),a(4,"th"),p(5,"Name"),r(),a(6,"th"),p(7,"Category"),r(),a(8,"th"),p(9,"Outlet"),r(),a(10,"th",20),p(11,"Balance"),r()()),t&2){let e=m(2);c(),l("ngIf",e.roleService.coa().delete)}}function Li(t,s){if(t&1&&(a(0,"td"),h(1,"p-tableCheckbox",25),r()),t&2){let e=m().$implicit;c(),l("value",e)}}function Vi(t,s){if(t&1&&(a(0,"tr"),u(1,Li,2,1,"td",22),a(2,"td"),p(3),r(),a(4,"td")(5,"a",23),p(6),r()(),a(7,"td"),p(8),r(),a(9,"td"),p(10),r(),a(11,"td",20)(12,"a",24),p(13),de(14,"number"),r()()()),t&2){let e,n=s.$implicit,i=m(2);c(),l("ngIf",i.roleService.coa().delete),c(2),E(n.code),c(2),l("routerLink",T(12,Si,n.id))("ngClass",T(14,Ti,n.bin)),c(),E(n.name),c(2),E(n.category),c(2),E(n.outletName),c(2),l("routerLink",R(16,Ai))("queryParams",T(17,wi,n.id)),c(),E(xe(14,10,(e=n.balance)!==null&&e!==void 0?e:0))}}function Di(t,s){if(t&1&&p(0),t&2){let e=m(2);Yt(" Showing ",e.store.first()," to ",e.store.last()," of ",e.store.count()," entries ")}}function Ri(t,s){t&1&&(a(0,"tr")(1,"td",26)(2,"span"),p(3,"No records found."),r()()())}function Bi(t,s){if(t&1){let e=w();a(0,"p-panel")(1,"p-table",18),S("onLazyLoad",function(i){_(e);let o=m();return g(o.loadData(i))})("onRowSelect",function(i){_(e);let o=m();return g(o.onRowSelect(i))})("onRowUnselect",function(i){_(e);let o=m();return g(o.onRowUnselect(i))})("onHeaderCheckboxToggle",function(i){_(e);let o=m();return g(o.onSelectAll(i))})("onPage",function(i){_(e);let o=m();return g(o.onPageChange(i))}),u(2,Ni,12,1,"ng-template",null,3,I)(4,Vi,15,19,"ng-template",null,4,I)(6,Di,1,3,"ng-template",null,5,I)(8,Ri,4,0,"ng-template",null,6,I),r()()}if(t&2){let e=m();c(),l("lazy",!0)("value",e.store.data())("paginator",!0)("rows",e.store.filter().PageSize)("totalRecords",e.store.count())}}function $i(t,s){if(t&1){let e=w();a(0,"form",28)(1,"div",29)(2,"label",30),p(3,"Outlet"),r(),h(4,"p-multiselect",31),r(),a(5,"div",29)(6,"label",30),p(7,"Category"),r(),a(8,"p-treeselect",32),S("onFocus",function(){_(e);let i=m(2);return g(i.onCategoryFocus())}),r()(),a(9,"div",29)(10,"label",30),p(11,"Access Level"),r(),h(12,"p-select",33),r(),a(13,"div",34)(14,"label",30),p(15,"Page Size"),r(),h(16,"input",35),r(),a(17,"div",34)(18,"label",30),p(19,"Discontinued"),r(),a(20,"div",36)(21,"div",37),h(22,"p-radiobutton",38),a(23,"label",39),p(24,"No"),r()(),a(25,"div",37),h(26,"p-radiobutton",40),a(27,"label",41),p(28,"Yes"),r()(),a(29,"div",37),h(30,"p-radiobutton",40),a(31,"label",41),p(32,"All"),r()()()()()}if(t&2){let e=m(2);l("formGroup",e.formFilter),c(4),l("showClear",!0)("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.options().entities),c(4),l("fluid",!0)("showClear",!0)("options",e.categoryNodes()),c(4),l("showClear",!0)("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.options().accessLevels),c(10),l("value",0),c(4),l("value",1),c(4),l("value",2)}}function Ki(t,s){if(t&1&&u(0,$i,33,15,"form",27),t&2){let e=m();l("ngIf",e.formFilter)}}var jn=(()=>{class t{ngOnInit(){this.store.fetchLoader(),console.log(this.store.filter().PageSize),this.generateFilterForm()}#e;constructor(){this.routeInfo=Zn,this.store=x(Ot),this.#e=x(X),this.modalService=x(ln),this.roleService=x(we),this.dialogVisible=v(!1),this.categoryNodes=v([]),this.fb=x(ve),this.isDialogFilterVisible=v(!1),this.generateFilterForm()}generateFilterForm(){this.formFilter=this.fb.group({outletID:this.fb.control([]),categoryID:this.fb.control(null),pageSize:this.fb.control(this.store.filter().PageSize),discontinued:this.fb.control(2),accessLevel:this.fb.control(this.store.filter().AccessLevel)})}onPageChange(e){console.log("Page changed to: ",e),this.store.updateFilter(y(C({},this.store.filter()),{PageNumber:e.first/e.rows+1}))}onCategoryFocus(){this.#e.getCachedCategoriesOptions().pipe(A(e=>this.categoryNodes.set(e))).subscribe()}onRowSelect(e){console.log("Row select event: ",e),this.store.checkedItem(e.data)}onRowUnselect(e){console.log("Row unselect event: ",e),this.store.checkedItem(e.data)}onSelectAll(e){console.log("Select all event: ",e),this.store.checkAllCheckbox()}loadData(e){console.log("Lazy load event: ",e)}onSearch(e){console.log("Search text: ",e),this.store.updateFilter(y(C({},this.store.filter()),{Text:e}))}updateFilter(e,n){this.store.updateFilter(y(C({},this.store.filter()),{[e]:n}))}checkAllCheckBox(){this.store.checkAllCheckbox()}checkedItem(e){this.store.checkedItem(e)}deleteCOA(){confirm("Are you sure you want to delete selected Chart of Accounts?")&&this.#e.deleteChartAccount(this.store.IDsChecked()).pipe(V("response"),A(e=>{console.log("Delete COA Response: ",e),this.store.updateFilter(C({},this.store.filter()))})).subscribe()}onSearchEvent(e){this.store.updateFilter(y(C({},this.store.filter()),{PageNumber:1,Text:e.trim()}))}onFilterEvent(){this.dialogVisible.update(e=>!e)}onFilterOKEvent(){let{categoryID:e,pageSize:n,outletID:i,discontinued:o,accessLevel:d}=this.formFilter.value;this.store.updateFilter(y(C({},this.store.filter()),{listOutletID:i,CategoryID:e?e.key:"",PageSize:+n,Discontinued:o,AccessLevel:d})),this.isDialogFilterVisible.update(f=>!f)}onExport(){let e=y(C({},this.store.filter()),{ExportPageNumber:1,ExportPageSize:1e4});this.#e.exportChartOfAccounts(e).pipe(A(n=>{let i=n.headers;console.log("All headers:",i.keys());let o=i.get("Content-Disposition"),d=i.get("content-disposition"),f=o??d,b="download.csv";if(f){let q=f.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);q&&q[1]&&(b=decodeURIComponent(q[1].replace(/"/g,"")))}let k=n.body;Kn(k,b,k.type)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=M({type:t,selectors:[["app-cash-of-account",8,"page"]],features:[he([Ot])],attrs:vi,decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["pageTitle","Chart of Account",3,"search","isDialogFilterVisibleChange","filterEmitted","filterConfirmed","isSearchableInput","isDialogFilterVisible","isFilterable","scrollable"],[1,"d-flex","gap-2"],["icon","fa-solid fa-trash","label","Delete","severity","danger",3,"onClick",4,"ngIf"],["routerLink","import","severity","secondary","outlined","","label","Import","icon","fa-solid fa-download",4,"ngIf"],["outlined","","severity","secondary","label","Export","icon","fa-solid fa-upload",3,"onClick",4,"ngIf"],["class","p-button","routerLink","add",4,"ngIf"],["icon","fa-solid fa-trash","label","Delete","severity","danger",3,"onClick"],["routerLink","import","severity","secondary","outlined","","label","Import","icon","fa-solid fa-download"],["outlined","","severity","secondary","label","Export","icon","fa-solid fa-upload",3,"onClick"],["routerLink","add",1,"p-button"],[1,"fa-solid","fa-plus"],["dataKey","id","styleClass","d-flex flex-column justify-content-between h-100",1,"",3,"onLazyLoad","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","onPage","lazy","value","paginator","rows","totalRecords"],["style","width: 1rem",4,"ngIf"],[1,"text-end"],[2,"width","1rem"],[4,"ngIf"],[1,"link-primary",3,"routerLink","ngClass"],[1,"link","link-primary",3,"routerLink","queryParams"],[3,"value"],["colspan","6"],["class","d-flex flex-column row-gap-3",3,"formGroup",4,"ngIf"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column","position-relative"],["for",""],["appendTo","body","formControlName","outletID","optionLabel","name","optionValue","id","placeholder","Select an Outlet",3,"showClear","virtualScroll","virtualScrollItemSize","options"],["scrollHeight","300px","filter","","filterBy","label","appendTo","body","formControlName","categoryID","optionLabel","label","optionValue","key","placeholder","Select a Category",3,"onFocus","fluid","showClear","options"],["appendTo","body","formControlName","accessLevel","optionLabel","value","optionValue","key","placeholder","Select an Access Level",3,"showClear","virtualScroll","virtualScrollItemSize","options"],[1,"d-flex","flex-column"],["formControlName","pageSize","type","text","pInputText",""],[1,"d-flex","flex-wrap","gap-4"],[1,"d-flex","align-items-center","gap-2"],["name","discontinued","formControlName","discontinued","inputId","ingredient1",3,"value"],["for","ingredient1",1,"m-0"],["name","discontinued","formControlName","discontinued","inputId","ingredient2",3,"value"],["for","ingredient2",1,"m-0"]],template:function(n,i){if(n&1){let o=w();a(0,"app-main-panel",7),S("search",function(f){return _(o),g(i.onSearchEvent(f))}),Qe("isDialogFilterVisibleChange",function(f){return _(o),Ze(i.isDialogFilterVisible,f)||(i.isDialogFilterVisible=f),g(f)}),S("filterEmitted",function(){return _(o),g(i.onFilterEvent())})("filterConfirmed",function(){return _(o),g(i.onFilterOKEvent())}),u(1,Oi,6,4,"ng-template",null,0,I)(3,Bi,10,5,"ng-template",null,1,I)(5,Ki,1,1,"ng-template",null,2,I),r()}n&2&&(l("isSearchableInput",!0),je("isDialogFilterVisible",i.isDialogFilterVisible),l("isFilterable",!0)("scrollable",!0))},dependencies:[F,z,O,Ye,$,sn,ut,dt,ft,Se,an,oe,Y,ye,N,B,Te,Ie,be,Je,Vn,Fn,Nn,Ln,K,Mn,le,ae,ct,st,it,nt,_e,Bn,Rn,Pe,Ee,ce,se,pt,mt],styles:[".p-card{height:100%} .p-card .p-card-body{height:inherit} .p-card .p-card-body .p-card-content{height:inherit}"],changeDetection:0})}}return t})();var zi=["class","page"],Gi=()=>["../../"],Nt=t=>({"ng-invalid ng-dirty":t}),Hi=t=>({"ng-dirty ng-invalid":t});function Ui(t,s){if(t&1){let e=w();a(0,"div",5)(1,"a",6),p(2,"Cancel"),r(),a(3,"p-button",7),S("onClick",function(){_(e);let i=m();return g(i.onSubmit())}),r()()}t&2&&(c(),l("routerLink",R(1,Gi)))}function ji(t,s){t&1&&(a(0,"div",34),p(1," Name is required "),r())}function Zi(t,s){if(t&1&&(a(0,"div"),u(1,ji,2,0,"div",33),r()),t&2){let e=m(2);c(),l("ngIf",e.form.controls.Name.errors.required)}}function Qi(t,s){t&1&&(a(0,"div",35)(1,"p"),p(2," If you assign an outlet for this account, it is only visible for users who has access to that outlet. "),r()())}function Wi(t,s){if(t&1&&(a(0,"span",36),p(1),r()),t&2){let e=s.$implicit;l("pTooltip",e.name),c(),Q(" ",e.name," ")}}function Yi(t,s){t&1&&(a(0,"div",34),p(1," Code is required "),r())}function Xi(t,s){if(t&1&&(a(0,"div"),u(1,Yi,2,0,"div",33),r()),t&2){let e=m(2);c(),l("ngIf",e.form.controls.Code.errors.required)}}function Ji(t,s){t&1&&(a(0,"div",34),p(1," Note is required "),r())}function eo(t,s){if(t&1&&(a(0,"div"),u(1,Ji,2,0,"div",33),r()),t&2){let e=m(2);c(),l("ngIf",e.form.controls.Note.errors.required)}}function to(t,s){if(t&1&&p(0),t&2){let e=s.$implicit;Q(" ",(e==null?null:e.fullLabel)||(e==null?null:e.label)||"Select a category"," ")}}function no(t,s){t&1&&(a(0,"div",34),p(1," Category is required "),r())}function io(t,s){if(t&1&&(a(0,"div"),u(1,no,2,0,"div",33),r()),t&2){let e=m(2);c(),l("ngIf",e.form.controls.Category.errors.required)}}function oo(t,s){t&1&&(a(0,"div",34),p(1," Note is required "),r())}function ro(t,s){if(t&1&&(a(0,"div"),u(1,oo,2,0,"div",33),r()),t&2){let e=m(2);c(),l("ngIf",e.form.controls.Note.errors.required)}}function ao(t,s){t&1&&(a(0,"div",34),p(1," Note is required "),r())}function lo(t,s){if(t&1&&(a(0,"div"),u(1,ao,2,0,"div",33),r()),t&2){let e=m(2);c(),l("ngIf",e.form.controls.Note.errors.required)}}function so(t,s){if(t&1&&(a(0,"p-panel",8)(1,"div",9)(2,"div",10)(3,"div",11)(4,"div",12)(5,"label",13),p(6,"Name"),r(),h(7,"input",14),u(8,Zi,2,1,"div",15),r()(),a(9,"div",11)(10,"div",16)(11,"label",13),p(12,"Outlet"),r(),a(13,"span",17),h(14,"i",18),r(),u(15,Qi,3,0,"ng-template",null,2,I),r(),a(17,"p-select",19),u(18,Wi,2,2,"ng-template",null,3,I),r()()(),a(20,"div",10)(21,"div",11)(22,"div",12)(23,"label",13),p(24,"Code"),r(),h(25,"input",20),u(26,Xi,2,1,"div",15),r()(),a(27,"div",11)(28,"div",12)(29,"label",13),p(30,"Discontinued"),r(),a(31,"div",10)(32,"div",21),h(33,"p-radiobutton",22),a(34,"label",23),p(35,"No"),r()(),a(36,"div",24),h(37,"p-radiobutton",25),a(38,"label",26),p(39,"Yes"),r()()(),u(40,eo,2,1,"div",15),r()()(),a(41,"div",10)(42,"div",11)(43,"div",27)(44,"label",13),p(45,"Category"),r(),a(46,"p-treeselect",28),u(47,to,1,1,"ng-template",29),r(),u(48,io,2,1,"div",15),r()(),a(49,"div",11)(50,"div",12)(51,"label",13),p(52,"Access Type"),r(),a(53,"div",10)(54,"div",30),h(55,"p-select",31),r()(),u(56,ro,2,1,"div",15),r()()(),a(57,"div",10)(58,"div",11)(59,"div",12)(60,"label",13),p(61,"Note"),r(),h(62,"textarea",32),u(63,lo,2,1,"div",15),r()(),h(64,"div",11),r()()()),t&2){let e=te(16),n=m();l("formGroup",n.form),c(7),l("ngClass",T(21,Nt,n.form.controls.Name.invalid&&(n.form.controls.Name.dirty||n.form.controls.Name.touched))),c(),l("ngIf",n.form.controls.Name.invalid&&(n.form.controls.Name.dirty||n.form.controls.Name.touched)),c(5),l("pTooltip",e),c(4),l("fluid",!0)("options",n.outlets()),c(8),l("ngClass",T(23,Nt,n.form.controls.Code.invalid&&(n.form.controls.Code.dirty||n.form.controls.Code.touched))),c(),l("ngIf",n.form.controls.Code.invalid&&(n.form.controls.Code.dirty||n.form.controls.Code.touched)),c(7),l("value",!1),c(4),l("value",!0),c(3),l("ngIf",n.form.controls.Note.errors),c(6),l("fluid",!0)("options",n.categoryOptions())("ngClass",T(25,Hi,n.form.controls.Category.invalid&&(n.form.controls.Category.dirty||n.form.controls.Category.touched))),c(2),l("ngIf",n.form.controls.Category.invalid&&(n.form.controls.Category.dirty||n.form.controls.Category.touched)),c(7),l("options",n.accessTypes())("fluid",!0),c(),l("ngIf",n.form.controls.Note.errors),c(6),l("ngClass",T(27,Nt,n.form.controls.Note.invalid&&(n.form.controls.Note.dirty||n.form.controls.Note.touched)))("autoResize",!0),c(),l("ngIf",n.form.controls.Note.errors)}}var Lt=(()=>{class t{constructor(){this.route=x(ne),this.coa_service=x(X),this.coa_info=v(null),this.fb=x(ve),this.isEdit=v(!1),this.categoryOptions=v([]),this.router=x(ie),this.outlets=W(()=>this.coa_info()?this.coa_info().options.entities:[]),this.accessTypes=W(()=>{let e=["This Chart of Account can be viewed by all users.","Restricted access, only visible to users with the private role"];return this.coa_info()?this.coa_info().options.coaAccessType.map((n,i)=>y(C({},n),{description:e[i]})):[]})}findParenChilds(e,n){function i(o,d=null){for(let f of o){if(f.key===n)return{parent:d,child:f};if(f.children){let b=i(f.children,f);if(b)return b}}return null}return i(e)}generateForm(e){this.form=this.fb.group({ID:new L(e.id||""),Name:new L(e.name||"",[fe.required]),Code:new L(e.code||"",[fe.required]),Note:new L(e.note||"",[]),Balance:new L(e.balance||0),Outlet:new L(e.outletID||""),AccessType:new L(e.accessTypeID||0),Category:new L(null,[fe.required]),Bin:new L(e.bin||!1)})}ngOnInit(){this.generateForm({id:"",name:"",code:"",note:"",balance:0,outletID:"",accessTypeID:0,categoryID:null,bin:!1}),this.fetchLoader(),this.fetchCategoryOptions()}fetchLoader(){this.route.paramMap.pipe(qe(e=>{if(e.has("id")){this.isEdit.set(!0);let n=e.get("id");return this.coa_service.getChartAccountFormById(n)}else return this.coa_service.getChartAccountForm()}),V("response"),G(e=>y(C({},e),{form:y(C({},e.form),{categoryID:e.form.categoryID==="00000000-0000-0000-0000-000000000000"?"":e.form.categoryID})})),A(e=>{this.coa_info.set(e),this.generateForm(e.form)})).subscribe()}get hasIdParam(){return this.route.snapshot.paramMap.has("id")}onSubmit(){if(this.form.invalid){this.form.markAllAsTouched();return}let{AccessType:e,Balance:n,Category:i,Code:o,Name:d,Note:f,Outlet:b}=this.form.value,k;this.hasIdParam?k={id:this.coa_info().form.id,categoryID:i.key,name:d,bin:this.form.value.Bin||!1,code:o,note:f,outletID:b||null,balance:n,accessTypeID:e}:k={id:this.coa_info().form.id,categoryID:i.key,bin:this.form.value.Bin||!1,name:d,code:o,note:f,outletID:b||null,balance:n,accessTypeID:e},this.hasIdParam?this.coa_service.submitChartAccount(k).pipe(V("submitChartAccount"),A(()=>{this.form.reset(),this.router.navigate(["/pages/chart-of-account/account"])})).subscribe():this.coa_service.submitChartAccount(k).pipe(V("submitChartAccount"),A(()=>{this.form.reset(),this.router.navigate(["/pages/chart-of-account/account"])})).subscribe()}fetchCategoryOptions(){this.coa_service.fetchCategoryOptions().pipe(V("response"),A(e=>{this.categoryOptions.set(e);let n=this.findParenChilds(this.categoryOptions(),this.coa_info()?.form?.categoryID);this.form.controls.Category.setValue(n?.child)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=M({type:t,selectors:[["app-coa-account-form",8,"page"]],attrs:zi,decls:5,vars:1,consts:[["actionButton",""],["content",""],["tooltipContent",""],["item",""],["pageTitle","Chart Of Account Form",3,"hasMainWrapperPadding"],[1,"d-flex","gap-2"],["type","button",1,"p-button","p-button-secondary","p-button-outlined",3,"routerLink"],["label","Submit",3,"onClick"],["styleClass","rounded-2",3,"formGroup"],[1,"d-flex","flex-column","gap-2"],[1,"row"],[1,"col-6"],[1,"d-flex","flex-column"],["for",""],["size","small","formControlName","Name","type","text","pInputText","",3,"ngClass"],[4,"ngIf"],[1,"d-flex","align-items-baseline","gap-2"],[3,"pTooltip"],[1,"fa-solid","fa-circle-info"],["appendTo","body","formControlName","Outlet","optionLabel","name","optionValue","id","placeholder","Select Outlet",3,"fluid","options"],["size","small","formControlName","Code","type","text","pInputText","",3,"ngClass"],[1,"col-3","d-flex","align-items-center","gap-2"],["name","Bin","formControlName","Bin","inputId","ingredient1",3,"value"],["for","ingredient1",1,"m-0"],[1,"col","d-flex","align-items-center","gap-2"],["name","Bin","formControlName","Bin","inputId","ingredient2",3,"value"],["for","ingredient2",1,"m-0"],[1,"form-group","d-flex","flex-column"],["formControlName","Category","containerStyleClass","w-full","placeholder","Select a Category",1,"w-full",3,"fluid","options","ngClass"],["pTemplate","value"],[1,"col"],["optionLabel","value","optionValue","key","formControlName","AccessType","placeholder","Select Access Type",3,"options","fluid"],["pSize","small","rows","5","cols","30","pTextarea","","formControlName","Note",3,"ngClass","autoResize"],["class","invalid-feedback text-danger d-block",4,"ngIf"],[1,"invalid-feedback","text-danger","d-block"],[1,"flex","items-center"],[1,"d-inline-block","text-truncate",2,"max-width","200px",3,"pTooltip"]],template:function(n,i){n&1&&(a(0,"app-main-panel",4),u(1,Ui,4,2,"ng-template",null,0,I)(3,so,65,29,"ng-template",null,1,I),r()),n&2&&l("hasMainWrapperPadding",!0)},dependencies:[$,Te,oe,Y,ye,Ie,be,ft,F,z,O,N,B,Pe,Ee,Ae,K,it,nt,zn,qn,ct,st,_e,ot,le,ae,ce,se,pt,mt],styles:["[_nghost-%COMP%]{display:block}[_nghost-%COMP%] .p-treeselect{width:100%!important}"],changeDetection:0})}}return t})();var co=["sublist"],mo=(t,s)=>({"p-contextmenu-submenu":t,"p-contextmenu-root-list":s}),po=()=>({"p-contextmenu-item-link":!0}),Yn=()=>({class:"p-contextmenu-submenu-icon"}),uo=()=>({exact:!1}),fo=t=>({"p-contextmenu-item-link":!0,"p-disabled":t}),_o=t=>({$implicit:t});function go(t,s){if(t&1&&h(0,"li",8),t&2){let e=m().$implicit,n=m(2);He(n.getItemProp(e,"style")),l("ngClass",n.getSeparatorItemClass(e)),P("id",n.getItemId(e))("data-pc-section","separator")}}function ho(t,s){if(t&1&&h(0,"span",19),t&2){let e=m(4).$implicit,n=m(2);l("ngClass",n.getItemProp(e,"icon"))("ngStyle",n.getItemProp(e,"iconStyle")),P("data-pc-section","icon")("aria-hidden",!0)("tabindex",-1)}}function xo(t,s){if(t&1&&(a(0,"span",20),p(1),r()),t&2){let e=m(4).$implicit,n=m(2);P("data-pc-section","label"),c(),Q(" ",n.getItemLabel(e)," ")}}function Co(t,s){if(t&1&&h(0,"span",21),t&2){let e=m(4).$implicit,n=m(2);l("innerHTML",n.getItemLabel(e),Me),P("data-pc-section","label")}}function yo(t,s){if(t&1&&h(0,"p-badge",22),t&2){let e=m(4).$implicit,n=m(2);l("styleClass",n.getItemProp(e,"badgeStyleClass"))("value",n.getItemProp(e,"badge"))}}function Io(t,s){t&1&&h(0,"AngleRightIcon"),t&2&&(Fe("p-contextmenu-submenu-icon"),P("data-pc-section","submenuicon")("aria-hidden",!0))}function bo(t,s){}function vo(t,s){t&1&&u(0,bo,0,0,"ng-template",25),t&2&&l("data-pc-section","submenuicon")("aria-hidden",!0)}function So(t,s){if(t&1&&(H(0),u(1,Io,1,4,"AngleRightIcon",23)(2,vo,1,2,null,24),U()),t&2){let e=m(6);c(),l("ngIf",!e.contextMenu.submenuIconTemplate&&!e.contextMenu._submenuIconTemplate),c(),l("ngTemplateOutlet",e.contextMenu.submenuIconTemplate||e.contextMenu._submenuIconTemplate)("ngTemplateOutletContext",R(3,Yn))}}function To(t,s){if(t&1&&(a(0,"a",15),u(1,ho,1,5,"span",16)(2,xo,2,2,"span",17)(3,Co,1,2,"ng-template",null,2,I)(5,yo,1,2,"p-badge",18)(6,So,3,4,"ng-container",11),r()),t&2){let e=te(4),n=m(3).$implicit,i=m(2);l("target",i.getItemProp(n,"target"))("ngClass",R(12,po)),P("href",i.getItemProp(n,"url"),Ht)("aria-hidden",!0)("data-automationid",i.getItemProp(n,"automationId"))("data-pc-section","action")("tabindex",-1),c(),l("ngIf",i.getItemProp(n,"icon")),c(),l("ngIf",i.getItemProp(n,"escape"))("ngIfElse",e),c(3),l("ngIf",i.getItemProp(n,"badge")),c(),l("ngIf",i.isItemGroup(n))}}function Ao(t,s){if(t&1&&h(0,"span",19),t&2){let e=m(4).$implicit,n=m(2);l("ngClass",n.getItemProp(e,"icon"))("ngStyle",n.getItemProp(e,"iconStyle")),P("data-pc-section","icon")("aria-hidden",!0)("tabindex",-1)}}function wo(t,s){if(t&1&&(a(0,"span",20),p(1),r()),t&2){let e=m(4).$implicit,n=m(2);P("data-pc-section","label"),c(),Q(" ",n.getItemLabel(e)," ")}}function Eo(t,s){if(t&1&&h(0,"span",21),t&2){let e=m(4).$implicit,n=m(2);l("innerHTML",n.getItemLabel(e),Me),P("data-pc-section","label")}}function Po(t,s){if(t&1&&h(0,"p-badge",22),t&2){let e=m(4).$implicit,n=m(2);l("styleClass",n.getItemProp(e,"badgeStyleClass"))("value",n.getItemProp(e,"badge"))}}function ko(t,s){t&1&&h(0,"AngleRightIcon"),t&2&&(Fe("p-contextmenu-submenu-icon"),P("data-pc-section","submenuicon")("aria-hidden",!0))}function Mo(t,s){}function Oo(t,s){t&1&&u(0,Mo,0,0,"ng-template",25),t&2&&l("data-pc-section","submenuicon")("aria-hidden",!0)}function Fo(t,s){if(t&1&&(H(0),u(1,ko,1,4,"AngleRightIcon",23)(2,Oo,1,2,null,24),U()),t&2){let e=m(6);c(),l("ngIf",!e.contextMenu.submenuIconTemplate&&!e.contextMenu._submenuIconTemplate),c(),l("ngTemplateOutlet",!e.contextMenu.submenuIconTemplate||!e.contextMenu._submenuIconTemplate)("ngTemplateOutletContext",R(3,Yn))}}function No(t,s){if(t&1&&(a(0,"a",26),u(1,Ao,1,5,"span",16)(2,wo,2,2,"span",17)(3,Eo,1,2,"ng-template",null,2,I)(5,Po,1,2,"p-badge",18)(6,Fo,3,4,"ng-container",11),r()),t&2){let e=te(4),n=m(3).$implicit,i=m(2);l("routerLink",i.getItemProp(n,"routerLink"))("queryParams",i.getItemProp(n,"queryParams"))("routerLinkActiveOptions",i.getItemProp(n,"routerLinkActiveOptions")||R(20,uo))("target",i.getItemProp(n,"target"))("ngClass",T(21,fo,i.getItemProp(n,"disabled")))("fragment",i.getItemProp(n,"fragment"))("queryParamsHandling",i.getItemProp(n,"queryParamsHandling"))("preserveFragment",i.getItemProp(n,"preserveFragment"))("skipLocationChange",i.getItemProp(n,"skipLocationChange"))("replaceUrl",i.getItemProp(n,"replaceUrl"))("state",i.getItemProp(n,"state")),P("data-automationid",i.getItemProp(n,"automationId"))("tabindex",-1)("aria-hidden",!0)("data-pc-section","action"),c(),l("ngIf",i.getItemProp(n,"icon")),c(),l("ngIf",i.getItemProp(n,"escape"))("ngIfElse",e),c(3),l("ngIf",i.getItemProp(n,"badge")),c(),l("ngIf",i.isItemGroup(n))}}function Lo(t,s){if(t&1&&(H(0),u(1,To,7,13,"a",13)(2,No,7,23,"a",14),U()),t&2){let e=m(2).$implicit,n=m(2);c(),l("ngIf",!n.getItemProp(e,"routerLink")),c(),l("ngIf",n.getItemProp(e,"routerLink"))}}function Vo(t,s){}function Do(t,s){t&1&&u(0,Vo,0,0,"ng-template")}function Ro(t,s){if(t&1&&(H(0),u(1,Do,1,0,null,24),U()),t&2){let e=m(2).$implicit,n=m(2);c(),l("ngTemplateOutlet",n.itemTemplate)("ngTemplateOutletContext",T(2,_o,e.item))}}function Bo(t,s){if(t&1){let e=w();a(0,"p-contextmenu-sub",27),S("itemClick",function(i){_(e);let o=m(4);return g(o.itemClick.emit(i))})("itemMouseEnter",function(i){_(e);let o=m(4);return g(o.onItemMouseEnter(i))}),r()}if(t&2){let e=m(2).$implicit,n=m(2);l("items",e.items)("itemTemplate",n.itemTemplate)("menuId",n.menuId)("visible",n.isItemActive(e)&&n.isItemGroup(e))("activeItemPath",n.activeItemPath)("focusedItemId",n.focusedItemId)("level",n.level+1)}}function $o(t,s){if(t&1){let e=w();a(0,"li",9,1)(2,"div",10),S("click",function(i){_(e);let o=m().$implicit,d=m(2);return g(d.onItemClick(i,o))})("mouseenter",function(i){_(e);let o=m().$implicit,d=m(2);return g(d.onItemMouseEnter({$event:i,processedItem:o}))}),u(3,Lo,3,2,"ng-container",11)(4,Ro,2,4,"ng-container",11),r(),u(5,Bo,1,7,"p-contextmenu-sub",12),r()}if(t&2){let e=m(),n=e.$implicit,i=e.index,o=m(2);Fe(o.getItemProp(n,"styleClass")),l("ngStyle",o.getItemProp(n,"style"))("ngClass",o.getItemClass(n))("tooltipOptions",o.getItemProp(n,"tooltipOptions")),P("id",o.getItemId(n))("data-pc-section","menuitem")("data-p-highlight",o.isItemActive(n))("data-p-focused",o.isItemFocused(n))("data-p-disabled",o.isItemDisabled(n))("aria-label",o.getItemLabel(n))("aria-disabled",o.isItemDisabled(n)||void 0)("aria-haspopup",o.isItemGroup(n)&&!o.getItemProp(n,"to")?"menu":void 0)("aria-expanded",o.isItemGroup(n)?o.isItemActive(n):void 0)("aria-level",o.level+1)("aria-setsize",o.getAriaSetSize())("aria-posinset",o.getAriaPosInset(i)),c(2),P("data-pc-section","content"),c(),l("ngIf",!o.itemTemplate),c(),l("ngIf",o.itemTemplate),c(),l("ngIf",o.isItemVisible(n)&&o.isItemGroup(n))}}function Ko(t,s){if(t&1&&u(0,go,1,5,"li",6)(1,$o,6,21,"li",7),t&2){let e=s.$implicit,n=m(2);l("ngIf",n.isItemVisible(e)&&n.getItemProp(e,"separator")),c(),l("ngIf",n.isItemVisible(e)&&!n.getItemProp(e,"separator"))}}function qo(t,s){if(t&1){let e=w();a(0,"ul",4,0),S("@overlayAnimation.start",function(i){_(e);let o=te(1),d=m();return g(d.onEnter(i,o))})("keydown",function(i){_(e);let o=m();return g(o.menuKeydown.emit(i))})("focus",function(i){_(e);let o=m();return g(o.menuFocus.emit(i))})("blur",function(i){_(e);let o=m();return g(o.menuBlur.emit(i))}),u(2,Ko,2,2,"ng-template",5),r()}if(t&2){let e=m();l("ngClass",Xt(10,mo,!e.root,e.root))("@overlayAnimation",e.visible)("tabindex",e.tabindex),P("id",e.menuId+"_list")("aria-label",e.ariaLabel)("aria-labelledBy",e.ariaLabelledBy)("aria-activedescendant",e.focusedItemId)("aria-orientation","vertical")("data-pc-section","menu"),c(2),l("ngForOf",e.items)}}var zo=["item"],Go=["submenuicon"],Ho=["rootmenu"],Uo=["container"],jo=t=>({"p-contextmenu p-component":!0,"p-contextmenu-mobile":t}),Zo=()=>({value:"visible"});function Qo(t,s){if(t&1){let e=w();a(0,"div",3,0),S("@overlayAnimation.start",function(i){_(e);let o=m();return g(o.onOverlayAnimationStart(i))})("@overlayAnimation.done",function(i){_(e);let o=m();return g(o.onOverlayAnimationEnd(i))}),a(2,"p-contextmenu-sub",4,1),S("itemClick",function(i){_(e);let o=m();return g(o.onItemClick(i))})("menuFocus",function(i){_(e);let o=m();return g(o.onMenuFocus(i))})("menuBlur",function(i){_(e);let o=m();return g(o.onMenuBlur(i))})("menuKeydown",function(i){_(e);let o=m();return g(o.onKeyDown(i))})("itemMouseEnter",function(i){_(e);let o=m();return g(o.onItemMouseEnter(i))}),r()()}if(t&2){let e=m();Fe(e.styleClass),l("ngClass",T(20,jo,e.queryMatches))("ngStyle",e.style)("@overlayAnimation",R(22,Zo)),P("data-pc-section","root")("data-pc-name","contextmenu")("id",e.id),c(2),l("root",!0)("items",e.processedItems)("itemTemplate",e.itemTemplate||e._itemTemplate)("menuId",e.id)("tabindex",e.disabled?-1:e.tabindex)("ariaLabel",e.ariaLabel)("ariaLabelledBy",e.ariaLabelledBy)("baseZIndex",e.baseZIndex)("autoZIndex",e.autoZIndex)("visible",e.submenuVisible())("focusedItemId",e.focused?e.focusedItemId:void 0)("activeItemPath",e.activeItemPath())}}var Wo=({dt:t})=>`
2
- .p-contextmenu {
3
- position: absolute;
4
- background: ${t("contextmenu.background")};
5
- color: ${t("contextmenu.color")};
6
- border: 1px solid ${t("contextmenu.border.color")};
7
- border-radius: ${t("contextmenu.border.radius")};
8
- box-shadow: ${t("contextmenu.shadow")};
9
- min-width: 12.5rem;
10
- }
11
-
12
- .p-contextmenu-root-list,
13
- .p-contextmenu-submenu {
14
- margin: 0;
15
- padding: ${t("contextmenu.list.padding")};
16
- list-style: none;
17
- outline: 0 none;
18
- display: flex;
19
- flex-direction: column;
20
- gap: ${t("contextmenu.list.gap")};
21
- }
22
-
23
- .p-contextmenu-submenu {
24
- position: absolute;
25
- display: flex;
26
- flex-direction: column;
27
- min-width: 100%;
28
- z-index: 1;
29
- background: ${t("contextmenu.background")};
30
- color: ${t("contextmenu.color")};
31
- border: 1px solid ${t("contextmenu.border.color")};
32
- border-radius: ${t("contextmenu.border.radius")};
33
- box-shadow: ${t("contextmenu.shadow")};
34
- }
35
-
36
- .p-contextmenu-item {
37
- position: relative;
38
- }
39
-
40
- .p-contextmenu-item-content {
41
- transition: background ${t("contextmenu.transition.duration")}, color ${t("contextmenu.transition.duration")};
42
- border-radius: ${t("contextmenu.item.border.radius")};
43
- color: ${t("contextmenu.item.color")};
44
- }
45
-
46
- .p-contextmenu-item-link {
47
- cursor: pointer;
48
- display: flex;
49
- align-items: center;
50
- text-decoration: none;
51
- overflow: hidden;
52
- position: relative;
53
- color: inherit;
54
- padding: ${t("contextmenu.item.padding")};
55
- gap: ${t("contextmenu.item.gap")};
56
- user-select: none;
57
- }
58
-
59
- .p-contextmenu-item-label {
60
- line-height: 1;
61
- }
62
-
63
- .p-contextmenu-item-icon {
64
- color: ${t("contextmenu.item.icon.color")};
65
- }
66
-
67
- .p-contextmenu-submenu-icon {
68
- color: ${t("contextmenu.submenu.icon.color")};
69
- margin-left: auto;
70
- font-size: ${t("contextmenu.submenu.icon.size")};
71
- width: ${t("contextmenu.submenu.icon.size")};
72
- height: ${t("contextmenu.submenu.icon.size")};
73
- }
74
-
75
- .p-contextmenu-submenu-icon:dir(rtl) {
76
- margin-left: 0;
77
- margin-right: auto;
78
- }
79
-
80
- .p-contextmenu-item.p-focus > .p-contextmenu-item-content {
81
- color: ${t("contextmenu.item.focus.color")};
82
- background: ${t("contextmenu.item.focus.background")};
83
- }
84
-
85
- .p-contextmenu-item.p-focus > .p-contextmenu-item-content .p-contextmenu-item-icon {
86
- color: ${t("contextmenu.item.icon.focus.color")};
87
- }
88
-
89
- .p-contextmenu-item.p-focus > .p-contextmenu-item-content .p-contextmenu-submenu-icon {
90
- color: ${t("contextmenu.submenu.icon.focus.color")};
91
- }
92
-
93
- .p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover {
94
- color: ${t("contextmenu.item.focus.color")};
95
- background: ${t("contextmenu.item.focus.background")};
96
- }
97
-
98
- .p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover .p-contextmenu-item-icon {
99
- color: ${t("contextmenu.item.icon.focus.color")};
100
- }
101
-
102
- .p-contextmenu-item:not(.p-disabled) > .p-contextmenu-item-content:hover .p-contextmenu-submenu-icon {
103
- color: ${t("contextmenu.submenu.icon.focus.color")};
104
- }
105
-
106
- .p-contextmenu-item-active > .p-contextmenu-item-content {
107
- color: ${t("contextmenu.item.active.color")};
108
- background: ${t("contextmenu.item.active.background")};
109
- }
110
-
111
- .p-contextmenu-item-active > .p-contextmenu-item-content .p-contextmenu-item-icon {
112
- color: ${t("contextmenu.item.icon.active.color")};
113
- }
114
-
115
- .p-contextmenu-item-active > .p-contextmenu-item-content .p-contextmenu-submenu-icon {
116
- color: ${t("contextmenu.submenu.icon.active.color")};
117
- }
118
-
119
- .p-contextmenu-separator {
120
- border-top: 1px solid ${t("contextmenu.separator.border.color")};
121
- }
122
-
123
- .p-contextmenu-enter-from,
124
- .p-contextmenu-leave-active {
125
- opacity: 0;
126
- }
127
-
128
- .p-contextmenu-enter-active {
129
- transition: opacity 250ms;
130
- }
131
-
132
- .p-contextmenu-mobile .p-contextmenu-submenu {
133
- position: static;
134
- box-shadow: none;
135
- border: 0 none;
136
- padding-left: ${t("tieredmenu.submenu.mobile.indent")};
137
- padding-right: 0;
138
- }
139
-
140
- .p-contextmenu-mobile .p-contextmenu-submenu-icon {
141
- transition: transform 0.2s;
142
- transform: rotate(90deg);
143
- }
144
-
145
- .p-contextmenu-mobile .p-contextmenu-item-active > .p-contextmenu-item-content .p-contextmenu-submenu-icon {
146
- transform: rotate(-90deg);
147
- }
148
-
149
- /* For PrimeNG */
150
- .p-contextmenu-submenu-icon.p-iconwrapper {
151
- margin-left: auto;
152
- }
153
-
154
- .p-contextmenu-submenu-icon.p-iconwrapper:dir(rtl) {
155
- margin-left: 0;
156
- margin-right: auto;
157
- }
158
- `,Yo={root:"p-contextmenu p-component",rootList:"p-contextmenu-root-list",item:({instance:t,processedItem:s})=>["p-contextmenu-item",{"p-contextmenu-item-active":t.isItemActive(s),"p-focus":t.isItemFocused(s),"p-disabled":t.isItemDisabled(s)}],itemContent:"p-contextmenu-item-content",itemLink:"p-contextmenu-item-link",itemIcon:"p-contextmenu-item-icon",itemLabel:"p-contextmenu-item-label",submenuIcon:"p-contextmenu-submenu-icon",submenu:"p-contextmenu-submenu",separator:"p-contextmenu-separator"},Wn=(()=>{class t extends In{name="contextmenu";theme=Wo;classes=Yo;static \u0275fac=(()=>{let e;return function(i){return(e||(e=Ge(t)))(i||t)}})();static \u0275prov=ze({token:t,factory:t.\u0275fac})}return t})();var Xo=(()=>{class t extends At{contextMenu;visible=!1;items;itemTemplate;root=!1;autoZIndex=!0;baseZIndex=0;popup;menuId;ariaLabel;ariaLabelledBy;level=0;focusedItemId;activeItemPath;tabindex=0;itemClick=new ee;itemMouseEnter=new ee;menuFocus=new ee;menuBlur=new ee;menuKeydown=new ee;sublistViewChild;constructor(e){super(),this.contextMenu=e}getItemProp(e,n,i=null){return e&&e.item?Tt(e.item[n],i):void 0}getItemId(e){return e.item&&e.item?.id?e.item.id:`${this.menuId}_${e.key}`}getItemKey(e){return this.getItemId(e)}getItemClass(e){return y(C({},this.getItemProp(e,"class")),{"p-contextmenu-item":!0,"p-contextmenu-item-active":this.isItemActive(e),"p-focus":this.isItemFocused(e),"p-disabled":this.isItemDisabled(e)})}getItemLabel(e){return this.getItemProp(e,"label")}getSeparatorItemClass(e){return y(C({},this.getItemProp(e,"class")),{"p-contextmenu-separator":!0})}getAriaSetSize(){return this.items.filter(e=>this.isItemVisible(e)&&!this.getItemProp(e,"separator")).length}getAriaPosInset(e){return e-this.items.slice(0,e).filter(n=>this.isItemVisible(n)&&this.getItemProp(n,"separator")).length+1}isItemVisible(e){return this.getItemProp(e,"visible")!==!1}isItemActive(e){if(this.activeItemPath)return this.activeItemPath.some(n=>n.key===e.key)}isItemDisabled(e){return this.getItemProp(e,"disabled")}isItemFocused(e){return this.focusedItemId===this.getItemId(e)}isItemGroup(e){return re(e.items)}onItemMouseEnter(e){let{event:n,processedItem:i}=e;this.itemMouseEnter.emit({originalEvent:n,processedItem:i})}onItemClick(e,n){this.getItemProp(n,"command",{originalEvent:e,item:n.item}),this.itemClick.emit({originalEvent:e,processedItem:n,isFocus:!0})}onEnter(e,n){if(e.fromState==="void"&&e.toState){let i=e.element;this.position(i)}}position(e){let n=e.parentElement.parentElement,i=un(e.parentElement.parentElement),o=It(),d=e.offsetParent?e.offsetWidth:bt(e),f=cn(n.children[0]);e.style.top="0px",parseInt(i.left,10)+f+d>o.width-pn()?e.style.left=-1*d+"px":e.style.left=f+"px"}static \u0275fac=function(n){return new(n||t)(ht(zt(()=>gt)))};static \u0275cmp=M({type:t,selectors:[["p-contextMenuSub"],["p-contextmenu-sub"]],viewQuery:function(n,i){if(n&1&&pe(co,5),n&2){let o;j(o=Z())&&(i.sublistViewChild=o.first)}},inputs:{visible:[2,"visible","visible",ue],items:"items",itemTemplate:"itemTemplate",root:[2,"root","root",ue],autoZIndex:[2,"autoZIndex","autoZIndex",ue],baseZIndex:[2,"baseZIndex","baseZIndex",Ce],popup:[2,"popup","popup",ue],menuId:"menuId",ariaLabel:"ariaLabel",ariaLabelledBy:"ariaLabelledBy",level:[2,"level","level",Ce],focusedItemId:"focusedItemId",activeItemPath:"activeItemPath",tabindex:[2,"tabindex","tabindex",Ce]},outputs:{itemClick:"itemClick",itemMouseEnter:"itemMouseEnter",menuFocus:"menuFocus",menuBlur:"menuBlur",menuKeydown:"menuKeydown"},features:[Oe],decls:1,vars:1,consts:[["sublist",""],["listItem",""],["htmlLabel",""],["role","menu",3,"ngClass","tabindex","keydown","focus","blur",4,"ngIf"],["role","menu",3,"keydown","focus","blur","ngClass","tabindex"],["ngFor","",3,"ngForOf"],["role","separator",3,"style","ngClass",4,"ngIf"],["role","menuitem","pTooltip","",3,"ngStyle","ngClass","class","tooltipOptions",4,"ngIf"],["role","separator",3,"ngClass"],["role","menuitem","pTooltip","",3,"ngStyle","ngClass","tooltipOptions"],[1,"p-contextmenu-item-content",3,"click","mouseenter"],[4,"ngIf"],[3,"items","itemTemplate","menuId","visible","activeItemPath","focusedItemId","level","itemClick","itemMouseEnter",4,"ngIf"],["pRipple","",3,"target","ngClass",4,"ngIf"],["pRipple","",3,"routerLink","queryParams","routerLinkActiveOptions","target","ngClass","fragment","queryParamsHandling","preserveFragment","skipLocationChange","replaceUrl","state",4,"ngIf"],["pRipple","",3,"target","ngClass"],["class","p-contextmenu-item-icon",3,"ngClass","ngStyle",4,"ngIf"],["class","p-contextmenu-item-label",4,"ngIf","ngIfElse"],[3,"styleClass","value",4,"ngIf"],[1,"p-contextmenu-item-icon",3,"ngClass","ngStyle"],[1,"p-contextmenu-item-label"],[1,"p-contextmenu-item-label",3,"innerHTML"],[3,"styleClass","value"],[3,"class",4,"ngIf"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"data-pc-section","aria-hidden"],["pRipple","",3,"routerLink","queryParams","routerLinkActiveOptions","target","ngClass","fragment","queryParamsHandling","preserveFragment","skipLocationChange","replaceUrl","state"],[3,"itemClick","itemMouseEnter","items","itemTemplate","menuId","visible","activeItemPath","focusedItemId","level"]],template:function(n,i){n&1&&u(0,qo,3,13,"ul",3),n&2&&l("ngIf",i.root?!0:i.visible)},dependencies:[t,F,z,We,O,tn,xt,N,B,vn,_e,ot,bn,Et,Tn,De],encapsulation:2,data:{animation:[Ct("overlayAnimation",[Ve(":enter",[Le({opacity:0})]),Ve(":leave",[Le({opacity:0})])])]}})}return t})(),gt=(()=>{class t extends At{overlayService;set model(e){this._model=e,this._processedItems=this.createProcessedItems(this._model||[])}get model(){return this._model}triggerEvent="contextmenu";target;global;style;styleClass;appendTo;autoZIndex=!0;baseZIndex=0;id;breakpoint="960px";ariaLabel;ariaLabelledBy;pressDelay=500;onShow=new ee;onHide=new ee;rootmenu;containerViewChild;container;outsideClickListener;resizeListener;triggerEventListener;documentClickListener;documentTriggerListener;touchEndListener;pageX;pageY;visible=v(!1);relativeAlign;window;focused=!1;activeItemPath=v([]);focusedItemInfo=v({index:-1,level:0,parentKey:"",item:null});submenuVisible=v(!1);searchValue="";searchTimeout;_processedItems;_model;pressTimer;matchMediaListener;query;queryMatches;_componentStyle=x(Wn);get visibleItems(){let e=this.activeItemPath().find(n=>n.key===this.focusedItemInfo().parentKey);return e?e.items:this.processedItems}get processedItems(){return(!this._processedItems||!this._processedItems.length)&&(this._processedItems=this.createProcessedItems(this.model||[])),this._processedItems}get focusedItemId(){let e=this.focusedItemInfo();return e.item&&e.item?.id?e.item.id:e.index!==-1?`${this.id}${re(e.parentKey)?"_"+e.parentKey:""}_${e.index}`:null}constructor(e){super(),this.overlayService=e,en(()=>{let n=this.activeItemPath();re(n)?this.bindGlobalListeners():this.visible()||this.unbindGlobalListeners()})}ngOnInit(){super.ngOnInit(),this.id=this.id||xn("pn_id_"),this.bindMatchMediaListener(),this.bindTriggerEventListener()}isMobile(){return _n()||fn()}bindTriggerEventListener(){Ne(this.platformId)&&(this.triggerEventListener||(this.isMobile()?this.global?(this.triggerEventListener=this.renderer.listen(this.document,"touchstart",this.onTouchStart.bind(this)),this.touchEndListener=this.renderer.listen(this.document,"touchend",this.onTouchEnd.bind(this))):this.target&&(this.triggerEventListener=this.renderer.listen(this.target,"touchstart",this.onTouchStart.bind(this)),this.touchEndListener=this.renderer.listen(this.target,"touchend",this.onTouchEnd.bind(this))):this.global?this.triggerEventListener=this.renderer.listen(this.document,this.triggerEvent,e=>{this.show(e)}):this.target&&(this.triggerEventListener=this.renderer.listen(this.target,this.triggerEvent,e=>{this.show(e)}))))}bindGlobalListeners(){if(Ne(this.platformId)){if(!this.documentClickListener){let e=this.el?this.el.nativeElement.ownerDocument:"document";this.documentClickListener=this.renderer.listen(e,"click",n=>{this.containerViewChild.nativeElement.offsetParent&&this.isOutsideClicked(n)&&!n.ctrlKey&&n.button!==2&&this.triggerEvent!=="click"&&this.hide()}),this.documentTriggerListener=this.renderer.listen(e,this.triggerEvent,n=>{this.containerViewChild.nativeElement.offsetParent&&this.isOutsideClicked(n)&&this.hide()})}this.resizeListener||(this.resizeListener=this.renderer.listen(this.document.defaultView,"resize",e=>{this.hide()}))}}itemTemplate;submenuIconTemplate;templates;_submenuIconTemplate;_itemTemplate;ngAfterContentInit(){this.templates?.forEach(e=>{switch(e.getType()){case"submenuicon":this._submenuIconTemplate=e.template;break;case"item":this._itemTemplate=e.template;break;default:this._itemTemplate=e.template;break}})}createProcessedItems(e,n=0,i={},o=""){let d=[];return e&&e.forEach((f,b)=>{let k=(o!==""?o+"_":"")+b,q={item:f,index:b,level:n,key:k,parent:i,parentKey:o};q.items=this.createProcessedItems(f.items,n+1,q,k),d.push(q)}),d}bindMatchMediaListener(){if(Ne(this.platformId)&&!this.matchMediaListener){let e=window.matchMedia(`(max-width: ${this.breakpoint})`);this.query=e,this.queryMatches=e.matches,this.matchMediaListener=()=>{this.queryMatches=e.matches},e.addEventListener("change",this.matchMediaListener)}}unbindMatchMediaListener(){this.matchMediaListener&&(this.query.removeEventListener("change",this.matchMediaListener),this.matchMediaListener=null)}getItemProp(e,n){return e?Tt(e[n]):void 0}getProccessedItemLabel(e){return e?this.getItemLabel(e.item):void 0}getItemLabel(e){return this.getItemProp(e,"label")}isProcessedItemGroup(e){return e&&re(e.items)}isSelected(e){return this.activeItemPath().some(n=>n.key===e.key)}isValidSelectedItem(e){return this.isValidItem(e)&&this.isSelected(e)}isValidItem(e){return!!e&&!this.isItemDisabled(e.item)&&!this.isItemSeparator(e.item)}isItemDisabled(e){return this.getItemProp(e,"disabled")}isItemSeparator(e){return this.getItemProp(e,"separator")}isItemMatched(e){return this.isValidItem(e)&&this.getProccessedItemLabel(e).toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase())}isProccessedItemGroup(e){return e&&re(e.items)}onItemClick(e){let{processedItem:n}=e,i=this.isProcessedItemGroup(n);if(this.isSelected(n)){let{index:d,key:f,level:b,parentKey:k,item:q}=n;this.activeItemPath.set(this.activeItemPath().filter(Be=>f!==Be.key&&f.startsWith(Be.key))),this.focusedItemInfo.set({index:d,level:b,parentKey:k,item:q}),tt(this.rootmenu.sublistViewChild.nativeElement)}else i?this.onItemChange(e):this.hide()}onItemMouseEnter(e){this.onItemChange(e,"hover")}onKeyDown(e){let n=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":this.onArrowLeftKey(e);break;case"ArrowRight":this.onArrowRightKey(e);break;case"Home":this.onHomeKey(e);break;case"End":this.onEndKey(e);break;case"Space":this.onSpaceKey(e);break;case"Enter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"PageDown":case"PageUp":case"Backspace":case"ShiftLeft":case"ShiftRight":break;default:!n&&hn(e.key)&&this.searchItems(e,e.key);break}}onArrowDownKey(e){let n=this.focusedItemInfo().index!==-1?this.findNextItemIndex(this.focusedItemInfo().index):this.findFirstFocusedItemIndex();this.changeFocusedItemIndex(e,n),e.preventDefault()}onArrowRightKey(e){let n=this.visibleItems[this.focusedItemInfo().index];this.isProccessedItemGroup(n)&&(this.onItemChange({originalEvent:e,processedItem:n}),this.focusedItemInfo.set({index:-1,parentKey:n.key,item:n.item}),this.searchValue="",this.onArrowDownKey(e)),e.preventDefault()}onArrowUpKey(e){if(e.altKey){if(this.focusedItemInfo().index!==-1){let n=this.visibleItems[this.focusedItemInfo().index];!this.isProccessedItemGroup(n)&&this.onItemChange({originalEvent:e,processedItem:n})}this.hide(),e.preventDefault()}else{let n=this.focusedItemInfo().index!==-1?this.findPrevItemIndex(this.focusedItemInfo().index):this.findLastFocusedItemIndex();this.changeFocusedItemIndex(e,n),e.preventDefault()}}onArrowLeftKey(e){let n=this.visibleItems[this.focusedItemInfo().index],i=this.activeItemPath().find(f=>f.key===n.parentKey);vt(n.parent)||(this.focusedItemInfo.set({index:-1,parentKey:i?i.parentKey:"",item:n.item}),this.searchValue="",this.onArrowDownKey(e));let d=this.activeItemPath().filter(f=>f.parentKey!==this.focusedItemInfo().parentKey);this.activeItemPath.set(d),e.preventDefault()}onHomeKey(e){this.changeFocusedItemIndex(e,this.findFirstItemIndex()),e.preventDefault()}onEndKey(e){this.changeFocusedItemIndex(e,this.findLastItemIndex()),e.preventDefault()}onSpaceKey(e){this.onEnterKey(e)}onEscapeKey(e){this.hide();let n=this.findVisibleItem(this.findFirstFocusedItemIndex()),i=this.focusedItemInfo();this.focusedItemInfo.set(y(C({},i),{index:this.findFirstFocusedItemIndex(),item:n.item})),e.preventDefault()}onTabKey(e){if(this.focusedItemInfo().index!==-1){let n=this.visibleItems[this.focusedItemInfo().index];!this.isProccessedItemGroup(n)&&this.onItemChange({originalEvent:e,processedItem:n})}this.hide()}onEnterKey(e){if(this.focusedItemInfo().index!==-1){let n=et(this.rootmenu.el.nativeElement,`li[id="${`${this.focusedItemId}`}"]`),i=n&&et(n,'a[data-pc-section="action"]');i?i.click():n&&n.click();let o=this.visibleItems[this.focusedItemInfo().index];if(!this.isProccessedItemGroup(o)){let f=this.focusedItemInfo();this.focusedItemInfo.set(y(C({},f),{index:this.findFirstFocusedItemIndex()}))}}e.preventDefault()}onItemChange(e,n){let{processedItem:i,isFocus:o}=e;if(vt(i))return;let{index:d,key:f,level:b,parentKey:k,items:q}=i,Be=re(q),Rt=this.activeItemPath().filter(Bt=>Bt.parentKey!==k&&Bt.parentKey!==f);Be&&(Rt.push(i),this.submenuVisible.set(!0)),this.focusedItemInfo.set({index:d,level:b,parentKey:k,item:i.item}),o&&tt(this.rootmenu.sublistViewChild.nativeElement),!(n==="hover"&&this.queryMatches)&&this.activeItemPath.set(Rt)}onMenuFocus(e){this.focused=!0;let n=this.focusedItemInfo().index!==-1?this.focusedItemInfo():{index:-1,level:0,parentKey:"",item:null};this.focusedItemInfo.set(n)}onMenuBlur(e){this.focused=!1,this.focusedItemInfo.set({index:-1,level:0,parentKey:"",item:null}),this.searchValue=""}onOverlayAnimationStart(e){switch(e.toState){case"visible":this.container=e.element,this.position(),this.moveOnTop(),this.appendOverlay(),this.bindGlobalListeners(),tt(this.rootmenu.sublistViewChild.nativeElement);break}}onOverlayAnimationEnd(e){switch(e.toState){case"void":this.onOverlayHide();break}}appendOverlay(){this.appendTo&&(this.appendTo==="body"?this.renderer.appendChild(this.document.body,this.containerViewChild.nativeElement):mn(this.appendTo,this.containerViewChild.nativeElement))}moveOnTop(){this.autoZIndex&&this.containerViewChild&&wt.set("menu",this.containerViewChild.nativeElement,this.baseZIndex+this.config.zIndex.menu)}onOverlayHide(){this.unbindGlobalListeners(),this.cd.destroyed||(this.target=null),this.container&&this.autoZIndex&&wt.clear(this.container),this.container=null}onTouchStart(e){this.pressTimer=setTimeout(()=>{this.show(e)},this.pressDelay)}onTouchEnd(){clearTimeout(this.pressTimer)}hide(){this.visible.set(!1),this.onHide.emit(),this.activeItemPath.set([]),this.focusedItemInfo.set({index:-1,level:0,parentKey:"",item:null})}toggle(e){this.visible()?this.hide():this.show(e)}show(e){this.activeItemPath.set([]),this.focusedItemInfo.set({index:-1,level:0,parentKey:"",item:null}),this.pageX=e.pageX,this.pageY=e.pageY,this.onShow.emit(),this.visible()?this.position():this.visible.set(!0),e.stopPropagation(),e.preventDefault()}position(){let e=this.pageX+1,n=this.pageY+1,i=this.containerViewChild.nativeElement.offsetParent?this.containerViewChild.nativeElement.offsetWidth:bt(this.containerViewChild.nativeElement),o=this.containerViewChild.nativeElement.offsetParent?this.containerViewChild.nativeElement.offsetHeight:dn(this.containerViewChild.nativeElement),d=It();e+i-this.document.scrollingElement.scrollLeft>d.width&&(e-=i),n+o-this.document.scrollingElement.scrollTop>d.height&&(n-=o),e<this.document.scrollingElement.scrollLeft&&(e=this.document.scrollingElement.scrollLeft),n<this.document.scrollingElement.scrollTop&&(n=this.document.scrollingElement.scrollTop),this.containerViewChild.nativeElement.style.left=e+"px",this.containerViewChild.nativeElement.style.top=n+"px"}searchItems(e,n){this.searchValue=(this.searchValue||"")+n;let i=-1,o=!1;return this.focusedItemInfo().index!==-1?(i=this.visibleItems.slice(this.focusedItemInfo().index).findIndex(d=>this.isItemMatched(d)),i=i===-1?this.visibleItems.slice(0,this.focusedItemInfo().index).findIndex(d=>this.isItemMatched(d)):i+this.focusedItemInfo().index):i=this.visibleItems.findIndex(d=>this.isItemMatched(d)),i!==-1&&(o=!0),i===-1&&this.focusedItemInfo().index===-1&&(i=this.findFirstFocusedItemIndex()),i!==-1&&this.changeFocusedItemIndex(e,i),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout(()=>{this.searchValue="",this.searchTimeout=null},500),o}findVisibleItem(e){return re(this.visibleItems)?this.visibleItems[e]:null}findLastFocusedItemIndex(){let e=this.findSelectedItemIndex();return e<0?this.findLastItemIndex():e}findLastItemIndex(){return St(this.visibleItems,e=>this.isValidItem(e))}findPrevItemIndex(e){let n=e>0?St(this.visibleItems.slice(0,e),i=>this.isValidItem(i)):-1;return n>-1?n:e}findNextItemIndex(e){let n=e<this.visibleItems.length-1?this.visibleItems.slice(e+1).findIndex(i=>this.isValidItem(i)):-1;return n>-1?n+e+1:e}findFirstFocusedItemIndex(){let e=this.findSelectedItemIndex();return e<0?this.findFirstItemIndex():e}findFirstItemIndex(){return this.visibleItems.findIndex(e=>this.isValidItem(e))}findSelectedItemIndex(){return this.visibleItems.findIndex(e=>this.isValidSelectedItem(e))}changeFocusedItemIndex(e,n){let i=this.findVisibleItem(n),o=this.focusedItemInfo();o.index!==n&&(this.focusedItemInfo.set(y(C({},o),{index:n,item:i.item})),this.scrollInView())}scrollInView(e=-1){let n=e!==-1?`${this.id}_${e}`:this.focusedItemId,i=et(this.rootmenu.el.nativeElement,`li[id="${n}"]`);i&&i.scrollIntoView&&i.scrollIntoView({block:"nearest",inline:"nearest"})}bindResizeListener(){Ne(this.platformId)&&(this.resizeListener||(this.resizeListener=this.renderer.listen(this.document.defaultView,"resize",e=>{this.hide()})))}isOutsideClicked(e){return!(this.containerViewChild.nativeElement.isSameNode(e.target)||this.containerViewChild.nativeElement.contains(e.target))}unbindResizeListener(){this.resizeListener&&(this.resizeListener(),this.resizeListener=null)}unbindGlobalListeners(){this.documentClickListener&&(this.documentClickListener(),this.documentClickListener=null),this.documentTriggerListener&&(this.documentTriggerListener(),this.documentTriggerListener=null),this.resizeListener&&(this.resizeListener(),this.resizeListener=null),this.touchEndListener&&(this.touchEndListener(),this.touchEndListener=null)}unbindTriggerEventListener(){this.triggerEventListener&&(this.triggerEventListener(),this.triggerEventListener=null)}removeAppendedElements(){this.appendTo&&this.containerViewChild&&(this.appendTo==="body"?this.renderer.removeChild(this.document.body,this.containerViewChild.nativeElement):gn(this.containerViewChild.nativeElement,this.appendTo))}ngOnDestroy(){this.unbindGlobalListeners(),this.unbindTriggerEventListener(),this.unbindMatchMediaListener(),this.removeAppendedElements(),super.ngOnDestroy()}static \u0275fac=function(n){return new(n||t)(ht(Cn))};static \u0275cmp=M({type:t,selectors:[["p-contextMenu"],["p-contextmenu"],["p-context-menu"]],contentQueries:function(n,i,o){if(n&1&&(Ue(o,zo,4),Ue(o,Go,4),Ue(o,Ae,4)),n&2){let d;j(d=Z())&&(i.itemTemplate=d.first),j(d=Z())&&(i.submenuIconTemplate=d.first),j(d=Z())&&(i.templates=d)}},viewQuery:function(n,i){if(n&1&&(pe(Ho,5),pe(Uo,5)),n&2){let o;j(o=Z())&&(i.rootmenu=o.first),j(o=Z())&&(i.containerViewChild=o.first)}},inputs:{model:"model",triggerEvent:"triggerEvent",target:"target",global:[2,"global","global",ue],style:"style",styleClass:"styleClass",appendTo:"appendTo",autoZIndex:[2,"autoZIndex","autoZIndex",ue],baseZIndex:[2,"baseZIndex","baseZIndex",Ce],id:"id",breakpoint:"breakpoint",ariaLabel:"ariaLabel",ariaLabelledBy:"ariaLabelledBy",pressDelay:[2,"pressDelay","pressDelay",Ce]},outputs:{onShow:"onShow",onHide:"onHide"},features:[he([Wn]),Oe],decls:1,vars:1,consts:[["container",""],["rootmenu",""],[3,"ngClass","class","ngStyle",4,"ngIf"],[3,"ngClass","ngStyle"],[3,"itemClick","menuFocus","menuBlur","menuKeydown","itemMouseEnter","root","items","itemTemplate","menuId","tabindex","ariaLabel","ariaLabelledBy","baseZIndex","autoZIndex","visible","focusedItemId","activeItemPath"]],template:function(n,i){n&1&&u(0,Qo,4,23,"div",2),n&2&&l("ngIf",i.visible())},dependencies:[F,z,O,xt,Xo,N,_e,Et,De],encapsulation:2,data:{animation:[Ct("overlayAnimation",[Ve(":enter",[Le({opacity:0}),yt("250ms")]),Ve(":leave",[yt(".1s linear",Le({opacity:0}))])])]},changeDetection:0})}return t})(),Xn=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=Ut({type:t});static \u0275inj=Gt({imports:[gt,De,De]})}return t})();var er=["editInput"],tr=["tree"],nr=["class","page"];function ir(t,s){t&1&&(a(0,"a",7),h(1,"i",8),p(2," Add"),r())}function or(t,s){if(t&1&&u(0,ir,3,0,"a",6),t&2){let e=m();l("ngIf",e.roleService.coa().create)}}function rr(t,s){if(t&1){let e=w();a(0,"input",15,4),Qe("ngModelChange",function(i){let o=_(e).$implicit;return Ze(o.label,i)||(o.label=i),g(i)}),S("keydown",function(i){_(e);let o=m(2);return g(o.handleEditKeydown(i))})("blur",function(i){_(e);let o=m(2);return g(o.onNodeEditBlur(i))}),r()}if(t&2){let e=s.$implicit;je("ngModel",e.label)}}function ar(t,s){if(t&1){let e=w();a(0,"div",9)(1,"div",10)(2,"p-panel",11)(3,"p-tree",12,2),S("onNodeContextMenuSelect",function(i){_(e);let o=m();return g(o.onNodeContextMenuSelect(i))})("onNodeSelect",function(i){_(e);let o=m();return g(o.onNodeSelect(i))})("onNodeUnselect",function(i){_(e);let o=m();return g(o.onNodeUnselect(i))})("onNodeDrop",function(i){_(e);let o=m();return g(o.onNodeDrop(i))}),u(5,rr,2,1,"ng-template",13),r(),h(6,"p-contextmenu",14,3),r()()()}if(t&2){let e=te(7),n=m();c(2),l("showHeader",!1),c(),l("value",n.categoryTree())("contextMenu",e)("selection",n.selectedCategory)("draggableNodes",!0)("droppableNodes",!0)("propagateSelectionUp",!1)("propagateSelectionDown",!1),c(3),l("model",n.contextMenuItems())}}var Jn=(()=>{class t{constructor(){this._coaTypesService=x(me),this._router=x(ie),this.roleService=x(we),this.contextMenuItems=v([]),this.categoryTree=v([]),this.selectedCategory=null,this._shouldAutoFocus=v(!1)}ngOnInit(){this._loadCategories().subscribe(),this._initializeContextMenuItems(),this.expandAllNodes()}ngAfterViewChecked(){this.selectedCategory&&!this._shouldAutoFocus()&&this.editInputRef&&(this.editInputRef.nativeElement.focus(),this.editInputRef.nativeElement.select(),this._shouldAutoFocus.set(!0))}_loadCategories(){return this._coaTypesService.fetchCOACategories().pipe(A(e=>{this.categoryTree.set(e),this.expandAllNodes()}))}_assignTreeIcons(e){return e.map(n=>{let i=!!n.children?.length;return y(C({},n),{icon:void 0,expandedIcon:i?"fa-solid fa-folder-open":void 0,collapsedIcon:i?"fa-solid fa-folder":"fa-solid fa-file",children:i?this._assignTreeIcons(n.children):[]})})}_initializeContextMenuItems(){this.contextMenuItems.set([{label:"Add",icon:"fa-light fa-plus",disabled:!1,command:()=>this._createChildCategory()},{label:"Edit",icon:"fa-light fa-pen-to-square",disabled:!1,command:()=>this._setSelectedNodeToEditMode()},{label:"Delete",icon:"fa-light fa-trash",disabled:!1,command:()=>this._deleteSelectedCategory()},{label:"Properties",icon:"fa-light fa-file",disabled:!1,command:()=>{this._router.navigate(["/pages/chart-of-account/coa-types/info"],{queryParams:{ID:this.selectedCategory?.key}})}}])}_findNodeByKey(e){return this.treeComponent.getNodeWithKey(e,this.categoryTree())??null}_setSelectedNodeToEditMode(){let e=this._findNodeByKey(this.selectedCategory?.key);e&&(this.selectedCategory=e,e.type="edit")}_createChildCategory(){this._coaTypesService.submitCategory({Name:"New Child Node",ParentID:this.selectedCategory.key,Code:"",Note:""}).pipe(D(e=>this._loadCategories().pipe(G(()=>e))),A(e=>{let n=this._findNodeByKey(e.id);n&&(this.selectedCategory=n,this._shouldAutoFocus.set(!1),n.type="edit")})).subscribe()}_deleteSelectedCategory(){this.selectedCategory?.key&&this._coaTypesService.deleteCategory(this.selectedCategory.key).pipe(D(()=>this._loadCategories())).subscribe()}renameNode(e,n=this.selectedCategory){this._coaTypesService.renameCategory(n.key,{Name:e}).pipe(D(()=>this._loadCategories())).subscribe()}onNodeSelect(e){this.selectedCategory=e.node,this._shouldAutoFocus.set(!1),e.node.children?.length&&(e.node.icon="fa-solid fa-folder-open")}onNodeUnselect(e){e.node.children?.length&&(e.node.icon="fa-solid fa-folder")}onNodeContextMenuSelect(e){this.selectedCategory=e.node,["Asset","Liability","Equity","Revenue","Expense"].includes(e.node.label)?this.contextMenuItems.set(this.contextMenuItems().map(i=>["Edit","Delete"].includes(i.label)?y(C({},i),{disabled:!0}):y(C({},i),{disabled:!1}))):this.contextMenuItems.set(this.contextMenuItems().map(i=>i.label==="Add"?y(C({},i),{disabled:!this.roleService.coa().create}):i.label==="Edit"?y(C({},i),{disabled:!this.roleService.coa().edit}):i.label==="Delete"?y(C({},i),{disabled:!this.roleService.coa().delete}):y(C({},i),{disabled:!1})))}onNodeDrop(e){let{dragNode:n,dropNode:i}=e;this._coaTypesService.updateParentCategory(n.key,{ParentID:i.key}).pipe(A(()=>this._loadCategories())).subscribe()}onNodeEditBlur(e){let n=e.target;this.renameNode(n.value);let i=this._findNodeByKey(this.selectedCategory?.key);i&&delete i.type}handleEditKeydown(e){let n=e.target;if([" ","Enter"].includes(e.key)&&e.stopPropagation(),e.key==="Enter"){this.renameNode(n.value);let i=this._findNodeByKey(this.selectedCategory?.key);i&&(delete i.type,this.treeComponent.updateSerializedValue?.())}}expandAllNodes(){this.categoryTree().forEach(e=>this._expandRecursive(e,!0))}collapseAllNodes(){this.categoryTree().forEach(e=>this._expandRecursive(e,!1))}_expandRecursive(e,n){e.expanded=n,e.children?.forEach(i=>this._expandRecursive(i,n))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=M({type:t,selectors:[["app-coa-type",8,"page"]],viewQuery:function(n,i){if(n&1&&(pe(er,5),pe(tr,5)),n&2){let o;j(o=Z())&&(i.editInputRef=o.first),j(o=Z())&&(i.treeComponent=o.first)}},features:[he([yn])],attrs:nr,decls:5,vars:1,consts:[["actionButton",""],["content",""],["tree",""],["cm",""],["editInput",""],["pageTitle",`Chart of Accounts Category
159
- `,3,"scrollable"],["class","p-button","routerLink","add",4,"ngIf"],["routerLink","add",1,"p-button"],[1,"fa-solid","fa-plus"],[1,"row","justify-content-center","m-0"],[1,"col","p-0"],[3,"showHeader"],["selectionMode","single","draggableScope","self","droppableScope","self",1,"custom-tree-spacing",3,"onNodeContextMenuSelect","onNodeSelect","onNodeUnselect","onNodeDrop","value","contextMenu","selection","draggableNodes","droppableNodes","propagateSelectionUp","propagateSelectionDown"],["pTemplate","edit"],["appendTo","body",3,"model"],["type","text",1,"form-control",3,"ngModelChange","keydown","blur","ngModel"]],template:function(n,i){n&1&&(a(0,"app-main-panel",5),u(1,or,1,1,"ng-template",null,0,I)(3,ar,8,9,"ng-template",null,1,I),r()),n&2&&l("scrollable",!0)},dependencies:[$,$n,N,B,Xn,gt,Ae,F,O,Se,oe,Y,Xe,K,Sn,ce,se],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var lr=["class","page"],Vt=t=>({"is-invalid":t}),sr=t=>({"ng-invalid ng-dirty":t});function cr(t,s){if(t&1){let e=w();a(0,"div",3)(1,"p-button",4),S("onClick",function(){_(e);let i=m();return g(i.goBack())}),r(),a(2,"p-button",5),S("onClick",function(){_(e);let i=m();return g(i.onSubmit())}),r()()}}function mr(t,s){t&1&&(a(0,"div",20),p(1," Name is required "),r())}function pr(t,s){t&1&&(a(0,"div",20),p(1," Code is required "),r())}function dr(t,s){t&1&&(a(0,"div",20),p(1," Note is required "),r())}function ur(t,s){if(t&1&&(a(0,"div")(1,"span",22),p(2),r()()),t&2){let e=s.$implicit;c(2),E(e)}}function fr(t,s){if(t&1&&(a(0,"div"),u(1,ur,3,1,"div",21),r()),t&2){let e=m(2);c(),l("ngForOf",e.getErrors("Category"))}}function _r(t,s){if(t&1){let e=w();a(0,"p-panel")(1,"div",6)(2,"div",7)(3,"div",8)(4,"div",9)(5,"div",10)(6,"label",11),p(7,"Name"),r(),h(8,"input",12),u(9,mr,2,0,"div",13),r()(),a(10,"div",14)(11,"div",10)(12,"label",11),p(13,"Code"),r(),h(14,"input",15),u(15,pr,2,0,"div",13),r()(),a(16,"div",9)(17,"div",10)(18,"label",11),p(19,"Note"),r(),h(20,"textarea",16),u(21,dr,2,0,"div",13),r()(),a(22,"div",9)(23,"div",17)(24,"label",11),p(25,"Category"),r(),a(26,"p-treeselect",18),S("onFocus",function(){_(e);let i=m();return g(i.loadCategories())}),r(),u(27,fr,2,1,"div",19),r()()()()()()}if(t&2){let e=m();c(3),l("formGroup",e.form),c(5),l("ngClass",T(10,Vt,e.form.controls.Name.invalid&&(e.form.controls.Name.dirty||e.form.controls.Name.touched))),c(),l("ngIf",e.form.controls.Name.errors==null?null:e.form.controls.Name.errors.required),c(5),l("ngClass",T(12,Vt,e.form.controls.Code.invalid&&(e.form.controls.Code.dirty||e.form.controls.Code.touched))),c(),l("ngIf",e.form.controls.Code==null||e.form.controls.Code.errors==null?null:e.form.controls.Code.errors.required),c(5),l("ngClass",T(14,Vt,e.form.controls.Note.invalid&&(e.form.controls.Note.dirty||e.form.controls.Note.touched))),c(),l("ngIf",e.form.controls.Note.errors==null?null:e.form.controls.Note.errors.required),c(5),l("ngClass",T(16,sr,e.isInvalid("Category")))("options",e.categories()),c(),l("ngIf",e.isInvalid("Category"))}}var Dt=(()=>{class t extends Gn{constructor(){super(...arguments),this.categories=v([]),this.COATypeService=x(me),this.COAService=x(X),this.info=v(null),this.route=x(ne),this.router=x(ie),this.fb=x(ve)}goBack(){this.router.navigate(["/pages/chart-of-account/coa-types"])}ngOnInit(){this.generateForm(),$t([this.route.paramMap.pipe(G(e=>e.get("id")),Ke(e=>!!e)),this.COATypeService.fetchCOACategories()]).pipe(V("fetchCOACategories"),D(([e,n])=>{let i=this.findNodeByKeyInArray(n,e);return this.categories.set(n),this.COATypeService.getCOACategoryByID({ID:e}).pipe(A(o=>{this.form.patchValue({Name:o.name,Code:o.code,Note:o.note,Category:i.parent}),["Asset","Liability","Equity","Revenue","Expense"].includes(o.name)&&this.form.controls.Category.disable()}))})).subscribe()}loadCategories(){this.COAService.getCachedCategoriesOptions().pipe(A(e=>this.categories.set(e))).subscribe()}generateForm(){this.form=new rn({Name:new L("",[fe.required]),Code:new L("",[]),Category:new L(null,[fe.required]),Note:new L("",[])})}findNodeByKeyInArray(e,n){for(let i of e){let o=this.findNodeByKey(i,n);if(o)return o}return null}findNodeByKey(e,n,i=null){if(e.key===n||e.label===n)return i&&(e.parent=i),e;if(e.children&&e.children.length>0)for(let o of e.children){let d=this.findNodeByKey(o,n,e);if(d)return d}return null}onSubmit(){let{Name:e,Code:n,Note:i,Category:o}=this.form.value,d=null,f=null;if(this.form.invalid){this.form.markAllAsTouched();return}this.route.snapshot.params.id?(d=this.findNodeByKeyInArray(this.categories(),this.route.snapshot.params.id),f={Name:e,Code:n,ParentID:d&&d.parent?d.parent.key:d.key,Note:i,ID:this.route.snapshot.params.id||null}):(d=this.findNodeByKeyInArray(this.categories(),o.key),f={Name:e,Code:n,ParentID:d&&d.parent?d.parent.key:d.key,Note:i}),this.COATypeService.submitCategory(f,{observe:"response"}).pipe(V("response"),A(()=>{this.router.navigate(["/pages/chart-of-account/coa-types"])})).subscribe()}static{this.\u0275fac=(()=>{let e;return function(i){return(e||(e=Ge(t)))(i||t)}})()}static{this.\u0275cmp=M({type:t,selectors:[["app-coa-type-form",8,"page"]],features:[Oe],attrs:lr,decls:5,vars:1,consts:[["actionButton",""],["content",""],["pageTitle","Chart of Account Category Form",3,"hasMainWrapperPadding"],[1,"d-flex","gap-2"],["label","Cancel","variant","outlined","severity","secondary",3,"onClick"],["label","Submit",3,"onClick"],[1,"row","justify-content-center"],[1,"col"],[1,"row","row-gap-2",3,"formGroup"],[1,"ol-12","col-md-6","col-lg-6"],[1,"form-group","has-validation"],["for",""],["formControlName","Name",1,"form-control",3,"ngClass"],["id","validationServer03Feedback","class","invalid-feedback",4,"ngIf"],[1,"col-12","col-md-6","col-lg-6"],["formControlName","Code",1,"form-control",3,"ngClass"],["formControlName","Note","placeholder","Enter a description for this COA category","id","floatingTextarea2",1,"form-control",2,"height","100px",3,"ngClass"],[1,"form-group","has-validation","d-flex","flex-column"],["showClear","","placeholder","Select a Category","formControlName","Category",1,"ng-invalid","ng-dirty",3,"onFocus","ngClass","options"],[4,"ngIf"],["id","validationServer03Feedback",1,"invalid-feedback"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(n,i){n&1&&(a(0,"app-main-panel",2),u(1,cr,3,0,"ng-template",null,0,I)(3,_r,28,18,"ng-template",null,1,I),r()),n&2&&l("hasMainWrapperPadding",!0)},dependencies:[$,N,Pe,Ee,Te,oe,Y,ye,Ie,be,F,z,We,O,K,le,ae,ce,se],styles:["[_nghost-%COMP%]{display:block} .p-treeselect{width:100%}"],changeDetection:0})}}return t})();var gr=t=>[t];function hr(t,s){if(t&1&&(a(0,"a",4),h(1,"i",5),a(2,"span"),p(3,"Edit"),r()()),t&2){let e=m(2);l("routerLink",T(1,gr,"/pages/chart-of-account/coa-types/"+e.info().id+"/edit"))}}function xr(t,s){if(t&1&&(a(0,"div",6)(1,"div",7)(2,"p-card")(3,"div",8)(4,"div",9)(5,"div",10),p(6,"Name"),r(),a(7,"div",11),p(8),r()(),a(9,"div",9)(10,"div",10),p(11,"Code"),r(),a(12,"div",11),p(13),r()(),a(14,"div",9)(15,"div",10),p(16,"Category"),r(),a(17,"div",11),p(18),r()(),a(19,"div",9)(20,"div",10),p(21,"Note"),r(),a(22,"div",11),h(23,"div",12),r()()()()()()),t&2){let e=m(2);c(8),E(e.info().name),c(5),E(e.info().code),c(5),E(e.info().parentName),c(5),l("innerHTML",e.info().note,Me)}}function Cr(t,s){t&1&&(H(0),a(1,"app-main-panel",3),u(2,hr,4,3,"ng-template",null,0,I)(4,xr,24,4,"ng-template",null,1,I),r(),U())}var ei=(()=>{class t{constructor(){this.COATypeService=x(me),this.route=x(ne),this.info=v(null)}ngOnInit(){this.route.queryParamMap.pipe(G(e=>e.get("ID")),D(e=>this.COATypeService.getCOACategoryByID({ID:e})),V("getCOACategoryByID"),A(e=>this.info.set(e))).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=M({type:t,selectors:[["app-coa-type-info"]],decls:1,vars:1,consts:[["actionButton",""],["content",""],[4,"ngIf"],["pageTitle",`Type of Account Info
160
- `],["type","button",1,"p-button","p-button-success",3,"routerLink"],[1,"fa-solid","fa-pen-to-square"],[1,"row","justify-content-center","mt-3"],[1,"col-12","col-lg-8"],[1,"d-flex","flex-column","gap-3"],[1,"d-flex"],[1,"col-3"],[1,"col"],[3,"innerHTML"]],template:function(n,i){n&1&&u(0,Cr,6,0,"ng-container",2),n&2&&l("ngIf",i.info())},dependencies:[F,O,$,K,rt,N,B],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Es=[{path:"",redirectTo:"account",pathMatch:"full"},{path:"",children:[{path:"account",component:jn},{path:"account/add",component:Lt},{path:"account/import",loadComponent:()=>import("./chunk-IGVRGJ3L.js").then(t=>t.CoaImportComponent)},{path:"account/:id",component:Hn},{path:"account/:id/edit",component:Lt},{path:"coa-types",component:Jn},{path:"coa-types/add",component:Dt},{path:"coa-types/info",component:ei},{path:"coa-types/:id/edit",component:Dt}]}],Zn={path:"cash-of-account",title:"COA",iconName:"fa fa-calculator",class:"",label:"",labelClass:"",extralink:!1,submenu:[{path:"account",title:"Ticket List",iconName:"solar:stop-circle-line-duotone",class:"",label:"",labelClass:"",extralink:!1,submenu:[]},{path:"coa-types",title:"Ticket Details",iconName:"solar:stop-circle-line-duotone",class:"",label:"",labelClass:"",extralink:!1,submenu:[]}]};export{Es as CHART_OF_ACCOUNT_ROUTES,Zn as CHART_OF_ACCOUNT_ROUTE_PAGE};
package/chunk-EKSLKPSH.js DELETED
@@ -1 +0,0 @@
1
- import"./chunk-YQFG5XE2.js";var t=[{path:"",redirectTo:"tax-account",pathMatch:"full"},{path:"tax-account",loadComponent:()=>import("./chunk-N4BTKSCQ.js").then(o=>o.TaxAccountComponent)},{path:"chart-of-account",loadComponent:()=>import("./chunk-TARMA6TN.js").then(o=>o.ChartOfAccountComponent)},{path:"manual-journal",loadComponent:()=>import("./chunk-AGB5OXUF.js").then(o=>o.ManualJournalComponent)},{path:"payment-account",loadComponent:()=>import("./chunk-JXEIGOVF.js").then(o=>o.PaymentAccountComponent)},{path:"writeoff-outlet",loadComponent:()=>import("./chunk-EHM2KHSR.js").then(o=>o.WriteOffOutletComponent)},{path:"expense-account",loadComponent:()=>import("./chunk-3HZX655H.js").then(o=>o.ExpenseAccountComponent)},{path:"coa-configuration",loadComponent:()=>import("./chunk-BJV3MSHK.js").then(o=>o.CoaConfigurationComponent)},{path:"coa-category",loadComponent:()=>import("./chunk-LV6YHYS7.js").then(o=>o.CoaCategoryComponent)},{path:"outlet-account",loadComponent:()=>import("./chunk-3LESCZJU.js").then(o=>o.OutletAccountComponent)}];export{t as MIGRATE_ROUTES};
package/chunk-GYLR4MM5.js DELETED
@@ -1,7 +0,0 @@
1
- import{a as st}from"./chunk-FQRRGJBE.js";import{a as we,b as De}from"./chunk-BUYRVZ5Z.js";import{a as Se}from"./chunk-WT4Z2QBS.js";import{a as qt,b as ae}from"./chunk-W3PCANAM.js";import{b as Ut,c as pt,d as mt}from"./chunk-IYO6P6XI.js";import{a as se,b as ce}from"./chunk-PPKCZMH4.js";import"./chunk-CNXEJBY5.js";import{b as at}from"./chunk-MPHY6FVN.js";import"./chunk-NMSYINDE.js";import{a as ie}from"./chunk-AF357XP4.js";import"./chunk-7COI2POD.js";import{a as Ee,b as Ie}from"./chunk-NHZLS6JU.js";import{a as ot,b as rt,d as pe,k as me}from"./chunk-VPQDUC77.js";import{a as re,b as le}from"./chunk-76LPTGLX.js";import"./chunk-CWHL7PNC.js";import"./chunk-VRKBMD72.js";import{a as lt}from"./chunk-NBBH4QTN.js";import{a as ke}from"./chunk-KXE3J4PK.js";import{b as ye}from"./chunk-E3QNEH3B.js";import"./chunk-JUCJGYST.js";import{a as Ht,b as Te}from"./chunk-6O5EWYT7.js";import"./chunk-I7ILLTFH.js";import"./chunk-2LQVI4EI.js";import"./chunk-SPKOXGSS.js";import{d as $e}from"./chunk-3KYU6FI2.js";import"./chunk-IJTQE2H4.js";import{b as oe}from"./chunk-WXT6EZ2V.js";import"./chunk-AJZ7YLT4.js";import"./chunk-ATJ55H5D.js";import{e as it,f as nt,h as ne}from"./chunk-O4APZZ3M.js";import{b as jt,c as zt}from"./chunk-L3PZS6EL.js";import{a as Xe,b as te}from"./chunk-5JV52UYK.js";import{a as O,b as Je,c as Qe,d as Ze,e as et,f as tt}from"./chunk-ACTRMWEI.js";import"./chunk-ARXP327B.js";import{n as Ke,o as Ye,w as Z,x as ee}from"./chunk-7FFMPB6T.js";import{b as ve}from"./chunk-UKBDY33R.js";import{b as We,c as Pt,e as K,f as Y,g as Ot,i as dt,k as $,l as X,o as J,u as Ce,x as Q}from"./chunk-72LNXEXV.js";import{b as He,e as U,l as W}from"./chunk-EFDD6Q3K.js";import{a as Gt,b as be}from"./chunk-3KWAJ7F2.js";import{a as Ue}from"./chunk-ZDTMCWOO.js";import"./chunk-F2X3VGZZ.js";import{h as ze,k as z,p as qe,q,s as H,y as Bt,z as At}from"./chunk-SB5MSLCX.js";import{$b as D,Ac as ct,Bc as de,Cc as Oe,D as Be,Db as x,Dc as F,Ec as V,Fc as Nt,Gc as je,Ha as E,Lb as s,Nc as C,Ob as Ae,Oc as y,Pc as Me,Qb as M,Rb as Re,Rc as _,Tb as Fe,Ub as Ve,Vb as o,W as Ft,Wb as r,X as Vt,Xb as T,Y as xe,Yb as Ge,Zb as Pe,_ as L,bd as R,c as ge,ca as Lt,cb as j,cd as ue,db as he,ec as I,fc as c,hb as p,ia as S,ic as Mt,qa as h,ra as b,rc as l,s as Ne,sc as f,tc as w,uc as Le,wc as A,xb as N,xc as B,yc as P,zc as kt}from"./chunk-6K5LNQ4J.js";import{a as g,b as v,c as fe,e as Rt}from"./chunk-YQFG5XE2.js";var G=(()=>{class t{constructor(){this.httpService=S(Gt),this.authService=S(Se)}fetchGeneralLedgerLoader(e="single",n={}){return this.httpService.get(void 0,`api/GeneralLedgerLoader/${e==="single"?"GetFilterSingle":"GetFilter"}`,{params:n})}getGLCount(e){return this.httpService.post(void 0,"api/GeneralLedger/GetSingleCount",e)}fetchGeneralLedgerReport(e,n="single"){return this.httpService.post(void 0,`api/GeneralLedger/${n==="single"?"GetSingle":"Get"}`,e)}exportGeneralLedger(e,n={}){let i=g({responseType:"blob"},n);return this.httpService.post(void 0,"/api/GeneralLedgerExport/GetGeneralLedgerExport",e,i)}getCustomerSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/API/AC/GetCustomerSuggestion",{params:n})}getSupplierSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/API/AC/GetSupplierSuggestion",{params:n})}getCashierSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/api/ac/GetUserSuggestion",{params:n})}getBalanceSheetLoader(){return this.httpService.get(void 0,"/api/BalanceSheetLoader/GetBalanceSheet")}getBalanceSheet(e,n={}){let i=new At({fromObject:Object.fromEntries(Object.entries(e).map(([d,k])=>[d,String(k)]))}),a=new Bt({"X-Timeout":"50000","X-Retry":"3","X-Retry-Delay":"2000","X-Exponential-Backoff":"true","X-Retry-On-500":"true","X-Retry-On-500-Message":"timeout expired"}),u=g({params:i,headers:a},n);return this.httpService.get(void 0,"/api/BalanceSheet",u)}getIncomeStatementLoader(){return this.httpService.get(void 0,"api/IncomeStatementLoader/Filter")}getIncomeStatement(e,n={}){return this.httpService.post(void 0,"api/IncomeStatement/List",g({},e),n)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=Lt({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var ri=()=>({width:"30vw"}),li=()=>({"1199px":"75vw","575px":"90vw"}),ai=t=>({"ng-dirty ng-invalid":t}),pi=t=>["/pages/journal/journal-entry/",t],mi=t=>({"text-success":t}),si=t=>({"text-danger":t});function ci(t,m){if(t&1&&(o(0,"div",33)(1,"div",34)(2,"span",35),l(3),r()(),o(4,"div")(5,"span"),l(6,"-"),r()(),o(7,"div",34)(8,"span",36),l(9),r()()()),t&2){let e=m.$implicit;p(3),w("(",e.code,")"),p(6),f(e.name)}}function di(t,m){if(t&1&&(o(0,"div",33)(1,"div",34)(2,"span",35),l(3),r()(),o(4,"div")(5,"span"),l(6,"-"),r()(),o(7,"div",34)(8,"span",36),l(9),r()()()),t&2){let e=m.$implicit;p(3),w("(",e.code,")"),p(6),f(e.name)}}function ui(t,m){t&1&&(o(0,"div",37),l(1," Account is required. "),r())}function _i(t,m){if(t&1&&(o(0,"div",38)(1,"div"),l(2),r()()),t&2){let e=m.$implicit;p(2),f(e.value)}}function fi(t,m){if(t&1&&(o(0,"div",26)(1,"div",27),T(2,"p-radiobutton",39),o(3,"label",40),l(4),r()()()),t&2){let e=m.$implicit;p(2),s("value",e.key)("inputId",e.key),p(),s("for",e.key),p(),f(e.value)}}function gi(t,m){if(t&1){let e=D();o(0,"div",16)(1,"label",17),l(2,"Customer"),r(),o(3,"p-autocomplete",41),I("completeMethod",function(i){h(e);let a=c(3);return b(a.searchCustomer(i))}),r()()}if(t&2){let e=c(3);p(3),s("suggestions",e.customerSuggestions())}}function xi(t,m){if(t&1){let e=D();o(0,"div",16)(1,"label",17),l(2,"Supplier"),r(),o(3,"p-autocomplete",42),I("completeMethod",function(i){h(e);let a=c(3);return b(a.searchSupplier(i))}),r()()}if(t&2){let e=c(3);p(3),s("suggestions",e.supplierSuggestions())}}function hi(t,m){if(t&1){let e=D();o(0,"div",16)(1,"label",17),l(2,"Customer"),r(),o(3,"p-autocomplete",41),I("completeMethod",function(i){h(e);let a=c(3);return b(a.searchCustomer(i))}),r()()}if(t&2){let e=c(3);p(3),s("suggestions",e.customerSuggestions())}}function bi(t,m){if(t&1&&(o(0,"form",15)(1,"div",16)(2,"label",17),l(3,"Accounts"),r(),o(4,"p-select",18),x(5,ci,10,2,"ng-template",null,5,_)(7,di,10,2,"ng-template",null,6,_),r(),x(9,ui,2,0,"div",19),r(),o(10,"div",16)(11,"label",17),l(12,"From"),r(),o(13,"div",20),T(14,"p-datepicker",21)(15,"p-datepicker",22),r()(),o(16,"div",16)(17,"label",17),l(18,"Outlets"),r(),o(19,"p-multiselect",23),x(20,_i,3,1,"ng-template",null,6,_),r()(),o(22,"div",16)(23,"label",24),l(24,"Contact Type"),r(),o(25,"div",25),Fe(26,fi,5,4,"div",26,Re),r()(),x(28,gi,4,1,"div",16)(29,xi,4,1,"div",16)(30,hi,4,1,"div",16),o(31,"div",16)(32,"label",24),l(33,"Sort order"),r(),o(34,"div",25)(35,"div",26)(36,"div",27),T(37,"p-radiobutton",28),o(38,"label",29),l(39,"Asc"),r()()(),o(40,"div",30)(41,"div",27),T(42,"p-radiobutton",31),o(43,"label",32),l(44,"Desc"),r()()()()()()),t&2){let e,n,i,a=c(2);s("formGroup",a.form),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",a.loaderMetadata().options.accounts)("ngClass",V(14,ai,((e=a.form.get("accountID"))==null?null:e.invalid)&&(((e=a.form.get("accountID"))==null?null:e.touched)||((e=a.form.get("accountID"))==null?null:e.dirty)))),p(5),s("ngIf",((n=a.form.get("accountID"))==null?null:n.invalid)&&(((n=a.form.get("accountID"))==null?null:n.touched)||((n=a.form.get("accountID"))==null?null:n.dirty))),p(5),s("showIcon",!0),p(),s("showIcon",!0),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",a.loaderMetadata().options.outlets),p(7),Ve(a.loaderMetadata().options.contactTypeOptions),p(2),M((i=a.form.controls.contactType.value)===1?28:i===2?29:30),p(9),s("value",!0),p(5),s("value",!1)}}function Si(t,m){if(t&1&&x(0,bi,45,16,"form",14),t&2){let e=c();s("ngIf",e.loaderMetadata())}}function Ci(t,m){if(t&1){let e=D();o(0,"p-button",45),I("onClick",function(){h(e);let i=c(2);return b(i.onToggleExportDialog())}),r()}}function vi(t,m){if(t&1&&(o(0,"div",33)(1,"a",43),l(2,"Return to Accounts"),r(),x(3,Ci,1,0,"p-button",44),r()),t&2){let e=c();p(3),s("ngIf",e.roleService.global().export)}}function yi(t,m){t&1&&T(0,"div",52)}function Ei(t,m){t&1&&(o(0,"tr")(1,"th",53),l(2,"Outlet"),r(),o(3,"th",53),l(4,"No."),r(),o(5,"th",53),l(6,"Date"),r(),o(7,"th"),l(8,"Contact / Note"),r(),o(9,"th",54),l(10,"Debit"),r(),o(11,"th",54),l(12,"Credit"),r(),o(13,"th",55),l(14,"Balance"),r()())}function Ii(t,m){if(t&1&&(o(0,"div",16)(1,"a",59),l(2),r(),T(3,"div",63),o(4,"span",64),l(5),r()()),t&2){let e=c().$implicit,n=c(3);p(),s("href",n.authService.getTenantExternalURL()+n.buildReferenceUrl(e),he),p(),f(e.referenceText),p(),s("innerHTML",e.journalNote,j),p(2),w("",e.note," ")}}function Ti(t,m){if(t&1&&(o(0,"div",16),T(1,"span",63)(2,"div",63),o(3,"span",65),l(4),r()()),t&2){let e=c().$implicit;p(),s("innerHTML",e.referenceText,j),p(),s("innerHTML",e.journalNote,j),p(2),w("",e.note," ")}}function wi(t,m){if(t&1&&(Ge(0),l(1),C(2,"number"),Pe()),t&2){let e=c().$implicit;p(),w(" ",y(2,1,e.debitAmount)," ")}}function Di(t,m){if(t&1&&(Ge(0),l(1),C(2,"number"),Pe()),t&2){let e=c().$implicit;p(),w(" ",y(2,1,e.creditAmount)," ")}}function Ri(t,m){if(t&1&&(Ge(0),l(1),C(2,"number"),Pe()),t&2){let e=c().$implicit;p(),w(" ",y(2,1,e.balance)," ")}}function Fi(t,m){if(t&1&&(o(0,"tr")(1,"td",56),l(2),r(),o(3,"td",56)(4,"a",57),l(5),r()(),o(6,"td",56)(7,"span",58),C(8,"date"),l(9),C(10,"date"),r()(),o(11,"td",56)(12,"div",16)(13,"a",59),l(14),r(),x(15,Ii,6,4,"div",16)(16,Ti,5,3,"div",16),r()(),o(17,"td",60),x(18,wi,3,3,"ng-container",61),r(),o(19,"td",60),x(20,Di,3,3,"ng-container",61),r(),o(21,"td",62),x(22,Ri,3,3,"ng-container",61),r()()),t&2){let e=m.$implicit,n=c(3);p(2),f(e.outletName),p(2),s("routerLink",V(19,pi,e.id)),p(),f(e.number),p(2),s("pTooltip",Me(8,13,e.date,"dd MMM y")),p(2),w(" ",Me(10,16,e.date,"dd MMM y")," "),p(4),s("href",n.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.contactID,he),p(),f(e.contactName),p(),M(n.buildReferenceUrl(e)?15:16),p(2),s("ngClass",V(21,mi,e.debitAmount!==0)),p(),s("ngIf",e.debitAmount!==0),p(),s("ngClass",V(23,si,e.creditAmount!==0)),p(),s("ngIf",e.creditAmount!==0),p(2),s("ngIf",e.balance!==0)}}function Vi(t,m){if(t&1&&(o(0,"tr"),T(1,"td",66),o(2,"td",67),l(3,"Total"),r(),o(4,"td",68),l(5),C(6,"number"),r(),o(7,"td",69),l(8),C(9,"number"),r(),T(10,"td"),r()),t&2){let e=c(3);p(5),w(" ",y(6,2,e.debitSubTotal())," "),p(3),w(" ",y(9,4,e.creditSubTotal())," ")}}function Li(t,m){t&1&&(o(0,"tr")(1,"td",70)(2,"span"),l(3,"No records found."),r()()())}function Mi(t,m){if(t&1){let e=D();o(0,"button",71),I("click",function(){h(e);let i=c(3);return b(i.getGLCount())})("keyup.enter",function(){h(e);let i=c(3);return b(i.getGLCount())}),r()}}function ki(t,m){if(t&1&&l(0),t&2){let e=c(3);w(" ",e.count()," ")}}function Ni(t,m){if(t&1){let e=D();o(0,"p-button",72),I("onClick",function(){h(e);let i=c(3);return b(i.onNextPage())}),r()}}function Bi(t,m){if(t&1&&(o(0,"div",47)(1,"p-table",48),x(2,yi,1,0,"ng-template",null,7,_)(4,Ei,15,0,"ng-template",null,8,_)(6,Fi,23,25,"ng-template",null,9,_)(8,Vi,11,6,"ng-template",null,4,_)(10,Li,4,0,"ng-template",null,10,_),r(),o(12,"div",49)(13,"div"),l(14),x(15,Mi,1,0,"button",50)(16,ki,1,1),l(17," entries "),r(),o(18,"div",33),x(19,Ni,1,0,"p-button",51),r()()()),t&2){let e=c(2);p(),s("value",e.items().data.data),p(13),Le(" Showing ",e.pagination().first," to ",e.pagination().end," of "),p(),M(e.totalRecords()===-1?15:16),p(4),M(e.pagination().hasNext?19:-1)}}function Ai(t,m){if(t&1&&x(0,Bi,20,5,"div",46),t&2){let e=c();s("ngIf",e.items()&&e.items().data)}}function Gi(t,m){if(t&1&&(o(0,"div",73)(1,"div",74)(2,"div",75)(3,"div",25)(4,"div",76)(5,"label",24),l(6,"Page"),r()(),o(7,"div",76),T(8,"input",77),r()()()(),o(9,"div",78)(10,"div",27),T(11,"i",79),o(12,"span",80),l(13),C(14,"number"),C(15,"number"),r()()()()),t&2){let e=c();p(),s("formGroup",e.form),p(12),Le("Exporting data from ",y(14,3,e.filter().exportPageNumber)," - ",y(15,5,e.filter().exportPageSize),"")}}function Pi(t,m){if(t&1){let e=D();o(0,"p-button",81),I("onClick",function(){h(e);let i=c();return b(i.onToggleExportDialog())}),r()}t&2&&s("rounded",!0)("text",!0)}function Oi(t,m){if(t&1){let e=D();o(0,"p-button",82),I("click",function(){h(e);let i=c();return b(i.onToggleExportDialog())}),r(),o(1,"p-button",83),I("click",function(){h(e);let i=c();return b(i.onExport())}),r()}}var Kt=(()=>{class t{getGLCount(){this.reportService.getGLCount(this.filter()).pipe(L(({count:e})=>{this.totalRecords.set(e)})).subscribe()}onToggleExportDialog(){this.isDialogExportVisible.update(e=>!e)}get pageTitle(){return this.items()&&this.items().pageTitle?this.items().pageTitle:"General Ledger"}constructor(){this.reportService=S(G),this.route=S(He),this.roleService=S(ie),this.authService=S(Se),this.fb=S(Ce),this.coaService=S(lt),this.toastr=S(Ue),this.dayjsService=S(ae),this.metadata=E(null),this.items=E(null),this.totalRecords=E(-1),this.dialogFilterVisible=E(!0),this.initDialogVisible=E(!1),this.isDialogExportVisible=E(!1),this.customerSuggestions=E([]),this.supplierSuggestions=E([]),this.categoriesOptions=E([]),this.localFilter=E({}),this.count=R(()=>this.totalRecords()<0?1/0:this.totalRecords()),this.lastGetDataLength=E(0),this.pagination=R(()=>{let e=this.filter(),n=this.totalRecords()!=null&&this.totalRecords()>=0?this.totalRecords():1/0,i=this.items()?.data?.data?.length||0,a=i==n||this.lastGetDataLength()<e.pageSize;return{first:1,end:e.pageSize>0?i:0,total:n,page:e.pageNumber,pageSize:e.pageSize,hasPrev:e.pageNumber>1,hasNext:!a}}),this.queryFilter=ve(this.route.queryParamMap.pipe(Ne(e=>{let n=e.get("from")?this.dayjsService.format(new Date(e.get("from"))):null,i=e.get("to")?this.dayjsService.format(new Date(e.get("to"))):null,a={},u=e.get("id");return be.IsNotEmpty(u)&&(a=v(g({},a),{accountID:u})),be.IsNotEmpty(n)&&be.IsNotEmpty(i)&&(a=v(g({},a),{from:n,to:i})),a})),{initialValue:null}),this.loaderMetadata=ve(this.reportService.fetchGeneralLedgerLoader("single",this.queryFilter()),{initialValue:null}),this.baseFilter=R(()=>{let e=this.loaderMetadata();return e?e.filter:null}),this.exportFileTypes=E([{key:0,value:"CSV"},{key:1,value:"Excel"}]),this.filter=R(()=>{let e=this.baseFilter(),n=this.localFilter();return e?g(g({},e),n):null}),this.creditSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.creditAmount)||0),0)),this.debitSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.debitAmount)||0),0)),this.initializeForm(),ue(()=>{let e=this.filter();e&&(be.IsEmpty(this.form.value.accountID)||this.form.value.accountID!==e.accountID)&&this.form.patchValue(this.transformFilterToFormValue(e),{emitEvent:!1})}),ue(()=>{let e=this.filter(),n=this.form.value.accountID;!e||be.IsEmpty(n)||this.reportService.fetchGeneralLedgerReport(e).subscribe(i=>{this.lastGetDataLength.set(i.data?.data?.length),this.items.update(a=>e.pageNumber===1?i:v(g({},i),{data:v(g({},i.data),{data:[...a?.data.data??[],...i.data.data]})}))})})}buildReferenceUrl(e){return st(e)}ngOnInit(){this.route.queryParamMap.pipe(Be(e=>e.keys.length>0)).subscribe({next:()=>this.initDialogVisible.set(!0)})}initializeForm(){this.form=this.fb.group({accountID:this.fb.control(null,[Pt.required]),from:this.fb.control(null),to:this.fb.control(new Date),contactType:this.fb.control(null),contactID:this.fb.control(""),listOutletID:this.fb.control([]),pageNumber:this.fb.control(1),pageSize:this.fb.control(50),sortAscending:this.fb.control(!0),listAccountID:this.fb.control([]),export:this.fb.control(!1),exportPageNumber:this.fb.control(1),exportPageSize:this.fb.control(0)})}findNodeByKey(e,n){for(let i of e){if(i.key===n)return i;if(i.children){let a=this.findNodeByKey(i.children,n);if(a)return a}}return null}transformFilterToFormValue(e){return Object.entries(e).reduce((n,[i,a])=>{switch(i){case"from":n[i]=a&&(typeof a=="string"||typeof a=="number"||a instanceof Date)?this.dayjsService.from(a)?.toDate():null;break;case"to":n[i]=a&&(typeof a=="string"||typeof a=="number"||a instanceof Date)?this.dayjsService.from(a)?.toDate():this.dayjsService.now.toDate();break;case"listCategoryID":Array.isArray(a)?n[i]=a.map(u=>this.findNodeByKey(this.categoriesOptions(),u)).filter(u=>!!u):n[i]=[];break;case"listOutletID":case"listAccountID":n[i]=Array.isArray(a)?a:[];break;case"pageNumber":case"pageSize":case"exportPageNumber":case"exportPageSize":n[i]=a!=null?Number(a):0;break;case"sortAscending":case"export":n[i]=!!a;break;case"contactType":n[i]=a!=null?Number(a):null;break;default:n[i]=a}return n},{})}clearContactValueOnContactTypeChange(){this.form.get("contactType")?.valueChanges.subscribe(()=>this.form.get("contactID")?.setValue(""))}isEmpty(e){return e==null||typeof e=="string"&&e.trim().length===0}onCategoryFocus(){this.coaService.getCachedCategoriesOptions().pipe(L(e=>this.categoriesOptions.set(e))).subscribe()}searchCustomer(e){this.reportService.getCustomerSuggestions(e.query).pipe(L(n=>this.customerSuggestions.set(n))).subscribe()}searchSupplier(e){this.reportService.getSupplierSuggestions(e.query).pipe(L(n=>this.supplierSuggestions.set(n))).subscribe()}onAccountChange(e){Array.isArray(e.value)&&e.value.length>=1&&this.toastr.warning("Please select at least 1 accounts for the general ledger report.","Warning")}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched(),this.dialogFilterVisible.set(!0);return}let e=this.buildFilterBody();this.dialogFilterVisible.set(!1),this.localFilter.set(e),this.totalRecords()!==-1&&this.getGLCount()}buildFilterBody(){let a=this.form.getRawValue(),{from:e,to:n}=a,i=fe(a,["from","to"]);return v(g({},this.filter()),{pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType})}onExport(){let e=this.buildExportBody();this.performExport(e)}performExport(e){this.reportService.exportGeneralLedger(e,{responseType:"blob",observe:"response"}).pipe(L(n=>this.handleExportResponse(n))).subscribe()}handleExportResponse(e){let n=e.headers,i=n.get("Content-Disposition")??n.get("content-disposition"),a="download.csv";if(i){let d=i.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);d?.[1]&&(a=decodeURIComponent(d[1].replace(/"/g,"")))}let u=e.body;mt(u,a,u.type)}buildExportBody(){let a=this.form.value,{from:e,to:n}=a,i=fe(a,["from","to"]);return v(g({},this.filter()),{exportPageNumber:+i.exportPageNumber,pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType,export:!0})}onNextPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(g({},e),{pageNumber:n+1,balance:this.items().data.data[this.items().data.data.length-1]?.balance??0})})}onPrevPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(g({},e),{pageNumber:Math.max(1,n-1)})})}goToPage(e){this.localFilter.update(n=>v(g({},n),{pageNumber:e}))}goToLastPage(){let e=this.filter();if(!e)return;let n=this.totalRecords();if(n===-1||!isFinite(n)){this.toastr.info("Please load total records before going to the last page","Info");return}let i=Math.ceil(n/e.pageSize);if(e.pageNumber>=i){this.toastr.warning("You are already on the last page","Warning");return}this.localFilter.update(a=>v(g({},a),{pageNumber:i}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-general-ledger"]],decls:13,vars:13,consts:[["filters",""],["actionButton",""],["content",""],["closeIconTemplate",""],["footer",""],["selectedItem",""],["item",""],["caption",""],["header",""],["body",""],["emptymessage",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isDialogFilterVisible","isFilterable","isInitDialogFilterVisible","scrollable"],["header","Export Journal Entry",3,"visibleChange","modal","visible","breakpoints"],["class","d-flex flex-column gap-3",4,"ngIf"],["class","d-flex flex-column row-gap-3",3,"formGroup",4,"ngIf"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["showClear","","filter","","filterBy","code,name","display","chip","formControlName","accountID","appendTo","body","optionLabel","name","optionValue","id","placeholder","Select Accounts",3,"virtualScroll","virtualScrollItemSize","options","ngClass"],["class","text-danger",4,"ngIf"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","iconDisplay","input","inputId","icondisplay",3,"showIcon"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","iconDisplay","input","inputId","icondisplay",3,"showIcon"],["showClear","","display","chip","formControlName","listOutletID","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select Outlets",3,"virtualScroll","virtualScrollItemSize","options"],["for",""],[1,"row"],[1,"col-4"],[1,"d-flex","align-items-center","gap-2"],["name","sortAscending","formControlName","sortAscending","inputId","asc",3,"value"],["for","asc",1,"m-0"],[1,"col-3"],["name","sortAscending","formControlName","sortAscending","inputId","desc",3,"value"],["for","desc",1,"m-0"],[1,"d-flex","gap-2"],[1,""],[1,"h-full","align-middle"],[1,"text-truncate","d-inline-block","h-full","align-middle"],[1,"text-danger"],[1,"flex","items-center","gap-2"],["name","contactType","formControlName","contactType",3,"value","inputId"],[1,"m-0",3,"for"],["formControlName","contactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["formControlName","ContactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["routerLink","/pages/chart-of-account/account",1,"p-button","p-button-secondary","p-button-outlined","fs-3"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],["class","px-3 h-100 bg-white border-top",4,"ngIf"],[1,"px-3","h-100","bg-white","border-top"],[3,"value"],[1,"d-flex","justify-content-between","align-items-center","my-2"],["type","button","aria-label","Get journal entry count","tabindex","0",1,"fa-solid","fa-circle-question","cursor-pointer","p-0","border-0","bg-transparent"],["variant","outlined","severity","secondary","icon","fa-solid fa-angle-right","size","small","label","next"],[1,"d-flex","gap-1"],[2,"width","120px"],[1,"text-end",2,"width","120px"],[1,"text-end",2,"width","140px"],[1,"text-break"],["target","_blank",1,"link","link-primary",3,"routerLink"],["tooltipPosition","top",3,"pTooltip"],["target","_blank",1,"link","link-primary",3,"href"],[1,"text-end","text-break",3,"ngClass"],[4,"ngIf"],[1,"text-end","text-break"],[3,"innerHTML"],[2,"width","300px","white-space","normal","word-break","break-word"],[2,"white-space","normal","word-break","break-word"],["colspan","3"],[1,"text-end","fw-semibold"],[1,"text-end","fw-semibold","text-success"],[1,"text-end","fw-semibold","text-danger"],["colspan","8"],["type","button","aria-label","Get journal entry count","tabindex","0",1,"fa-solid","fa-circle-question","cursor-pointer","p-0","border-0","bg-transparent",3,"click","keyup.enter"],["variant","outlined","severity","secondary","icon","fa-solid fa-angle-right","size","small","label","next",3,"onClick"],[1,"d-flex","flex-column","gap-3"],[1,"row",3,"formGroup"],[1,"col-8"],[1,"col"],["type","text","formControlName","exportPageNumber","fluid","","pInputText","","pSize","small"],["role","alert",1,"alert","alert-primary","m-0","p-2"],[1,"fa-solid","fa-circle-info"],[1,"fs-2","text-dark","fw-semibold"],["severity","secondary","variant","outlined","icon","fa-solid fa-xmark",3,"onClick","rounded","text"],["label","Cancel","severity","secondary","variant","outlined",3,"click"],["label","OK (F2)",3,"click"]],template:function(n,i){if(n&1){let a=D();o(0,"app-main-panel",11),P("isDialogFilterVisibleChange",function(d){return h(a),B(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),b(d)})("isInitDialogFilterVisibleChange",function(d){return h(a),B(i.initDialogVisible,d)||(i.initDialogVisible=d),b(d)}),I("filterConfirmed",function(){return h(a),b(i.onFilterOKEvent())}),x(1,Si,1,1,"ng-template",null,0,_)(3,vi,4,1,"ng-template",null,1,_)(5,Ai,1,1,"ng-template",null,2,_),r(),o(7,"p-dialog",12),P("visibleChange",function(d){return h(a),B(i.isDialogExportVisible,d)||(i.isDialogExportVisible=d),b(d)}),x(8,Gi,16,7,"div",13)(9,Pi,1,2,"ng-template",null,3,_)(11,Oi,2,0,"ng-template",null,4,_),r()}n&2&&(s("pageTitle",i.pageTitle),A("isDialogFilterVisible",i.dialogFilterVisible),s("isFilterable",!0),A("isInitDialogFilterVisible",i.initDialogVisible),s("scrollable",!0),p(7),Ae(F(11,ri)),s("modal",!0),A("visible",i.isDialogExportVisible),s("breakpoints",F(12,li)),p(),s("ngIf",i.form&&i.filter()))},dependencies:[ne,H,ze,z,q,qe,oe,me,pe,nt,it,ee,Z,Te,Ht,le,re,De,we,Q,$,We,K,Y,X,J,ce,se,ye,$e,pt,at,te,W,U,rt,ot,zt,jt,Ye,Ke],styles:["[_nghost-%COMP%] .p-datatable .p-datatable-header{padding:.75rem 1rem .75rem 0}"],changeDetection:0})}}return t})();var ji={data:{},filter:{EntityID:[],CashierID:null,Text:null,from:null,to:null},isLoading:!0,loader:{options:{outlets:[]},filter:{from:"",to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}}},St=Je(tt(ji),Qe(t=>{let m={totalCOGS:R(()=>{let e=t.data()?.data?.cogs;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),totalRevenue:R(()=>{let e=t.data()?.data?.revenue;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),totalExpense:R(()=>{let e=t.data()?.data?.expense;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),grossProfit:R(()=>Array.isArray(t.data()?.data?.cogs)&&Array.isArray(t.data()?.data?.revenue)?m.totalRevenue()-m.totalCOGS():0),profitOrLoss:R(()=>m.totalRevenue()-m.totalCOGS()-m.totalExpense()),isDataEmpty:R(()=>Object.keys(t.data()?.data??{}).length===0)};return m}),et(t=>{let m=S(G),e=S(ae),n={updateFilter(i){O(t,a=>v(g({},a),{filter:g(g({},a.filter),i)}))},getLoader:Ee(ge(xe(()=>m.getIncomeStatementLoader().pipe(Ie({next:i=>{O(t,a=>v(g({},a),{loader:i,filter:v(g({},a.filter),{from:e.from(i.filter.from).format(),to:e.from(i.filter.to).format()})})),n.getIncomeStatement(t.filter)},error:i=>{console.error(i)}}))))),getIncomeStatement:Ee(ge(xe(i=>m.getIncomeStatement(i).pipe(Vt(()=>O(t,a=>v(g({},a),{isLoading:!0}))),Ie({next:a=>{O(t,u=>v(g({},u),{data:a,isLoading:!1}))},error:a=>{console.error(a)}})))))};return n}),Ze({onInit:t=>{t.getLoader()}}));var Ct=()=>({}),vt=t=>["/pages/chart-of-account/account/",t],yt=()=>["/pages/report/general-ledger"],Et=(t,m,e)=>({id:t,from:m,to:e});function qi(t,m){if(t&1){let e=D();o(0,"p-button",10),I("onClick",function(){h(e);let i=c(2);return b(i.onExport())}),r()}}function Hi(t,m){if(t&1&&(o(0,"div",8),x(1,qi,1,0,"p-button",9),r()),t&2){let e=c();p(),s("ngIf",e.roleService.global().export)}}function Ui(t,m){t&1&&(o(0,"tr")(1,"th",14),l(2,"Code"),r(),o(3,"th",15),l(4,"Name"),r(),o(5,"th",16),l(6,"Total"),r()())}function Wi(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",17),l(5),r()(),o(6,"td",16)(7,"a",18),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=de(0),i=de(1);p(2),f(e.code),p(2),s("routerLink",V(8,vt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,yt))("queryParams",je(11,Et,e.accountID,n,i)),p(),f(y(9,6,e.amount))}}function Ki(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),l(4,"Total Revenue :"),r(),o(5,"span",22),l(6),C(7,"number"),r()()()()),t&2){let e=c(3);p(6),f(y(7,1,e.store.totalRevenue()))}}function Yi(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No revenue records available"),r()()())}function $i(t,m){if(t&1&&(o(0,"h6",12),l(1,"Revenue"),r(),o(2,"p-table",13),x(3,Ui,7,0,"ng-template",null,3,_)(5,Wi,10,15,"ng-template",null,4,_)(7,Ki,8,3,"ng-template",null,5,_)(9,Yi,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);p(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.revenue)}}function Xi(t,m){t&1&&(o(0,"tr")(1,"th",14),l(2,"Code"),r(),o(3,"th",15),l(4,"Name"),r(),o(5,"th",24),l(6,"Total"),r()())}function Ji(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",17),l(5),r()(),o(6,"td",16)(7,"a",18),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=de(0),i=de(1);p(2),f(e.code),p(2),s("routerLink",V(8,vt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,yt))("queryParams",je(11,Et,e.accountID,n,i)),p(),f(y(9,6,e.amount))}}function Qi(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),l(4,"Total COGS :"),r(),o(5,"span",22),l(6),C(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),l(12,"Gross Profit :"),r(),o(13,"span",22),l(14),C(15,"number"),r()()()()),t&2){let e=c(3);p(6),f(y(7,2,e.store.totalCOGS())),p(8),f(y(15,4,e.store.grossProfit()))}}function Zi(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No COGS records available"),r()()())}function en(t,m){if(t&1&&(o(0,"h4",12),l(1,"COGS"),r(),o(2,"p-table",13),x(3,Xi,7,0,"ng-template",null,3,_)(5,Ji,10,15,"ng-template",null,4,_)(7,Qi,16,6,"ng-template",null,5,_)(9,Zi,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);p(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.cogs)}}function tn(t,m){t&1&&(o(0,"tr")(1,"th",14),l(2,"Code"),r(),o(3,"th",15),l(4,"Name"),r(),o(5,"th",16),l(6,"Total"),r()())}function nn(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",17),l(5),r()(),o(6,"td",16)(7,"a",18),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=de(0),i=de(1);p(2),f(e.code),p(2),s("routerLink",V(8,vt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,yt))("queryParams",je(11,Et,e.accountID,n,i)),p(),f(y(9,6,e.amount))}}function on(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),l(4,"Total Expense :"),r(),o(5,"span",22),l(6),C(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),l(12,"Profit / Loss :"),r(),o(13,"span",22),l(14),C(15,"number"),r()()()()),t&2){let e=c(3);p(6),f(y(7,2,e.store.totalExpense())),p(8),f(y(15,4,e.store.profitOrLoss()))}}function rn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No expense records available"),r()()())}function ln(t,m){if(t&1&&(o(0,"h4",12),l(1,"Expense"),r(),o(2,"p-table",13),x(3,tn,7,0,"ng-template",null,3,_)(5,nn,10,15,"ng-template",null,4,_)(7,on,16,6,"ng-template",null,5,_)(9,rn,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);p(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.expense)}}function an(t,m){if(t&1&&(kt(0)(1),o(2,"p-panel")(3,"div",11),x(4,$i,11,1)(5,en,11,1)(6,ln,11,1),r()()),t&2){let e,n,i,a,u,d=c();ct((e=d.store.filter())!=null&&e.from?d.store.filter().from:null),p(),ct((n=d.store.filter())!=null&&n.to?d.store.filter().to:null),p(3),M(d.Object.keys((i=d.store.data().data)!==null&&i!==void 0?i:F(5,Ct)).length>0?4:-1),p(),M(d.Object.keys((a=(a=d.store.data().data)==null?null:a.cogs)!==null&&a!==void 0?a:F(6,Ct)).length>0?5:-1),p(),M(d.Object.keys((u=(u=d.store.data().data)==null?null:u.expense)!==null&&u!==void 0?u:F(7,Ct)).length>0?6:-1)}}function pn(t,m){if(t&1){let e=D();o(0,"form",25)(1,"div",26)(2,"label",27),l(3,"Outlet"),r(),T(4,"p-multiselect",28),r(),o(5,"div",26)(6,"label",27),l(7,"Cashier"),r(),o(8,"p-autocomplete",29),I("completeMethod",function(i){h(e);let a=c();return b(a.onCashierSearch(i))})("onSelect",function(i){h(e);let a=c();return b(a.onCashierSelect(i))}),r()(),o(9,"div",26)(10,"label",30),l(11,"From - To"),r(),o(12,"div",31),T(13,"p-datepicker",32)(14,"p-datepicker",33),r()()()}if(t&2){let e=c();s("formGroup",e.formFilter),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.loader().options.outlets)("showClear",!0),p(4),s("showClear",!0)("suggestions",e.cashierSuggestions())("showClear",!0),p(5),s("iconDisplay","input")("showIcon",!0),p(),s("iconDisplay","input")("showIcon",!0)}}var Yt=(()=>{class t{constructor(){this.dayjsService=S(ae),this.store=S(St),this.fb=S(Ce),this.reportService=S(G),this.roleService=S(ie),this.isInitDialogFilterVisible=E(!1),this.dialogFilterVisible=E(!1),this.cashierSuggestions=E([]),this.cashierHashMap=new Map,this.Object=Object,ue(()=>{this.store.filter()&&this.initForm()})}ngOnInit(){this.initForm(),console.log(this.cashierHashMap.entries())}onSearch(e){this.store.updateFilter(v(g({},this.store.filter()),{Text:e}))}onCashierSearch(e){this.reportService.getCashierSuggestions(e.query).pipe(ke("Cashier Suggestions"),L(n=>this.cashierSuggestions.set(n))).subscribe()}initForm(){let e=this.store.filter();console.log("initForm",this.cashierHashMap.get(e.CashierID)),this.formFilter=this.fb.group({EntityID:this.fb.control(e.EntityID??[]),CashierID:this.fb.control(this.cashierHashMap.get(e.CashierID)??""),Text:this.fb.control(e.Text??""),from:this.fb.control(e.from?this.dayjsService.from(e.from).toDate():null),to:this.fb.control(e.to?this.dayjsService.from(e.to).toDate():null)})}onFilterOK(){let e=this.formFilter.getRawValue(),n=Object.entries(e).reduce((i,[a,u])=>(a==="from"||a==="to"?u instanceof Date&&(i[a]=this.dayjsService.from(u).format()):i[a]=u||null,i),{});this.store.updateFilter(g(g({},this.store.filter()),n)),this.dialogFilterVisible.update(i=>!i),console.log("body",e)}onCashierSelect(e){console.log("Cashier selected:",e),!this.cashierHashMap.has(e.value.Key)&&(this.cashierHashMap.set(e.value.Key,e.value.Value),console.log("Cashier HashMap:",this.cashierHashMap))}onExport(){let e=v(g({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.reportService.getIncomeStatement(e,{responseType:"blob"}).pipe(ke("Export Profit & Loss"),L(n=>{let i=n.type,a=[n],u=document.createElement("a");u.href=window.URL.createObjectURL(new Blob(a,{type:i}));let d=`profit-and-loss.${i.split("/")[1]}`;u.setAttribute("download",d),document.body.appendChild(u),u.click(),document.body.removeChild(u)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-income-statement"]],features:[Oe([St])],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","isFilterable","pageTitle","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],[1,"d-flex","gap-2"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],[1,"d-flex","flex-column","gap-3"],[1,"fs-5","fw-semibold"],[3,"value"],[2,"width","20%"],[2,"width","30%"],[1,"text-end"],["target","_blank",1,"link","link-primary",3,"routerLink"],["target","_blank",1,"link","link-primary",3,"routerLink","queryParams"],["colspan","3",1,"text-end","fw-semibold"],[1,"row"],[1,"col"],[1,"col-1","col-lg-2"],["colspan","3",1,""],[1,"text-end",2,"min-width","10%"],[1,"d-flex","flex-column","gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for",""],["formControlName","EntityID","filterBy","value","appendTo","body","display","chip","optionLabel","value","optionValue","key","placeholder","Select an Outlet",3,"virtualScroll","virtualScrollItemSize","options","showClear"],["appendTo","body","formControlName","CashierID","optionLabel","Value","optionValue","Key","styleClass","w-100","inputStyleClass","w-100","field","Value","placeholder","Search a cashier",3,"completeMethod","onSelect","showClear","suggestions"],["for","outlet"],[1,"d-flex","flex-column","gap-2"],["formControlName","from","styleClass","w-100 mb-0","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],["formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"]],template:function(n,i){if(n&1){let a=D();o(0,"app-main-panel",7),P("isDialogFilterVisibleChange",function(d){return h(a),B(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),b(d)})("isInitDialogFilterVisibleChange",function(d){return h(a),B(i.isInitDialogFilterVisible,d)||(i.isInitDialogFilterVisible=d),b(d)}),I("filterConfirmed",function(){return h(a),b(i.onFilterOK())}),x(1,Hi,2,1,"ng-template",null,0,_)(3,an,7,8,"ng-template",null,1,_)(5,pn,15,12,"ng-template",null,2,_),r()}n&2&&(s("isFilterable",!0)("pageTitle",i.store.data().pageTitle),A("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[ne,H,z,q,Te,le,re,Q,$,K,Y,X,J,ce,se,oe,me,pe,te,Xe,W,U,De,we,ee,Z],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var It=Rt(qt());var mn={metadata:{options:{outlets:[]},filter:{to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}},data:{asset:[],liability:[],equity:[],pageTitle:""},filter:{date:(0,It.default)().format("YYYY-MM-DD"),listOutletParam:[]}},Tt=Je(tt(mn),Qe(t=>({totalAsset:R(()=>t.data().asset.reduce((m,e)=>m+ +e.amount,0)),totalLiability:R(()=>t.data().liability.reduce((m,e)=>m+ +e.counterAmount,0)),totalEquity:R(()=>t.data().equity.reduce((m,e)=>m+ +e.counterAmount,0))})),et(t=>{let m=S(G),e={updateFilter:n=>{O(t,i=>v(g({},i),{filter:n}))},fetchBalanceSheet:Ee(ge(Be(()=>{let n=t.filter();return Object.entries(n).every(([i,a])=>a!=null&&a!=="")}),xe(n=>m.getBalanceSheet(n).pipe(Ie({next:i=>{O(t,a=>v(g({},a),{data:i}))},error:i=>{console.error(i)}}))),Ft(1))),fetchLoader:Ee(ge(xe(()=>m.getBalanceSheetLoader().pipe(Ie({next:n=>{O(t,i=>v(g({},i),{metadata:n,filter:{date:(0,It.default)(n.filter.to).format("YYYY-MM-DD")}})),e.fetchBalanceSheet(t.filter)},error:n=>{console.error(n)}})))))};return e}),Ze(t=>({onInit:()=>{t.fetchLoader()}})));var $t=Rt(qt());var wt=t=>["/pages/chart-of-account/account/",t],Dt=()=>["/pages/report/general-ledger"],sn=(t,m)=>({id:t,to:m}),Xt=t=>({id:t});function cn(t,m){if(t&1){let e=D();o(0,"p-button",11),I("onClick",function(){h(e);let i=c(2);return b(i.onExport())}),r()}}function dn(t,m){if(t&1&&(o(0,"div",9),x(1,cn,1,0,"p-button",10),r()),t&2){let e=c();p(),s("ngIf",e.roleService.global().export)}}function un(t,m){t&1&&(o(0,"tr")(1,"th",16),l(2,"Code"),r(),o(3,"th"),l(4,"Asset"),r(),o(5,"th",17),l(6,"Total"),r()())}function _n(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",18),l(5),r()(),o(6,"td",19)(7,"a",20),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit,n=c(3);p(2),f(e.code),p(2),s("routerLink",V(8,wt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,Dt))("queryParams",Nt(11,sn,e.accountID,n.store.filter().date)),p(),f(y(9,6,e.amount))}}function fn(t,m){if(t&1&&(o(0,"tr")(1,"td",21),l(2,"Total Asset"),r(),o(3,"td",22),l(4),C(5,"number"),r()()),t&2){let e=c(3);p(4),w(" ",y(5,1,e.store.totalAsset())," ")}}function gn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No asset records found."),r()()())}function xn(t,m){if(t&1&&(o(0,"h4",14),l(1,"Asset"),r(),o(2,"p-table",15),x(3,un,7,0,"ng-template",null,3,_)(5,_n,10,14,"ng-template",null,4,_)(7,fn,6,3,"ng-template",null,5,_)(9,gn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);p(2),s("value",e.store.data().asset)}}function hn(t,m){t&1&&(o(0,"tr")(1,"th",16),l(2,"Code"),r(),o(3,"th"),l(4,"Liability"),r(),o(5,"th",17),l(6,"Total"),r()())}function bn(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",25),l(5),r()(),o(6,"td",19)(7,"a",20),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit;p(2),f(e.code),p(2),s("routerLink",V(8,wt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,Dt))("queryParams",V(11,Xt,e.accountID)),p(),f(y(9,6,e.counterAmount))}}function Sn(t,m){if(t&1&&(o(0,"tr")(1,"td",21),l(2," Total Liability "),r(),o(3,"td",22),l(4),C(5,"number"),r()()),t&2){let e=c(3);p(4),w(" ",y(5,1,e.store.totalLiability())," ")}}function Cn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No liability records found."),r()()())}function vn(t,m){if(t&1&&(o(0,"h4",24),l(1,"Liability"),r(),o(2,"p-table",15),x(3,hn,7,0,"ng-template",null,3,_)(5,bn,10,13,"ng-template",null,4,_)(7,Sn,6,3,"ng-template",null,5,_)(9,Cn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);p(2),s("value",e.store.data().liability)}}function yn(t,m){t&1&&(o(0,"tr")(1,"th",16),l(2,"Code"),r(),o(3,"th"),l(4,"Equity"),r(),o(5,"th",17),l(6,"Total"),r()())}function En(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",18),l(5),r()(),o(6,"td",19)(7,"a",20),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit;p(2),f(e.code),p(2),s("routerLink",V(8,wt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,Dt))("queryParams",V(11,Xt,e.accountID)),p(),f(y(9,6,e.counterAmount))}}function In(t,m){if(t&1&&(o(0,"tr")(1,"td",21),l(2,"Total Equity"),r(),o(3,"td",22),l(4),C(5,"number"),r()(),o(6,"tr")(7,"td",21),l(8," Total Liability + Equity "),r(),o(9,"td",22),l(10),C(11,"number"),r()()),t&2){let e=c(3);p(4),w(" ",y(5,2,e.store.totalEquity())," "),p(6),w(" ",y(11,4,e.store.totalLiability()+e.store.totalEquity())," ")}}function Tn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No equity records found."),r()()())}function wn(t,m){if(t&1&&(o(0,"h4",24),l(1,"Equity"),r(),o(2,"p-table",15),x(3,yn,7,0,"ng-template",null,3,_)(5,En,10,13,"ng-template",null,4,_),l(7," <"),x(8,In,12,6,"ng-template",null,5,_)(10,Tn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);p(2),s("value",e.store.data().equity)}}function Dn(t,m){if(t&1&&(o(0,"p-panel",12)(1,"div",13),x(2,xn,11,1)(3,vn,11,1)(4,wn,12,1),r()()),t&2){let e=c();s("showHeader",!1),p(2),M(e.Object.keys(e.store.data().asset).length>0?2:-1),p(),M(e.Object.keys(e.store.data().liability).length>0?3:-1),p(),M(e.Object.keys(e.store.data().equity).length>0?4:-1)}}function Rn(t,m){if(t&1&&(o(0,"div",31)(1,"div"),l(2),r()()),t&2){let e=m.$implicit;p(2),f(e.value)}}function Fn(t,m){if(t&1&&(o(0,"form",26)(1,"div",27)(2,"label",28),l(3,"Outlet"),r(),o(4,"p-multiselect",29),x(5,Rn,3,1,"ng-template",null,7,_),r()(),o(7,"div",27)(8,"label",28),l(9,"From"),r(),T(10,"p-datepicker",30),r()()),t&2){let e=c();s("formGroup",e.filterForm),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.metadata().options.outlets)("showClear",!0),p(6),s("iconDisplay","input")("showIcon",!0)}}var Jt=(()=>{class t{constructor(){this.store=S(Tt),this.ReportServiceStore=S(G),this.dialogFilterVisible=E(!1),this.isInitDialogFilterVisible=E(!1),this.roleService=S(ie),this.Object=Object}ngOnInit(){this.generateFilterForm()}generateFilterForm(){this.filterForm=new Ot({date:new dt(new Date),outletID:new dt([])})}onFilterOKEvent(){let{date:e,outletID:n}=this.filterForm.value;this.store.updateFilter({date:(0,$t.default)(e).format("YYYY-MM-DD"),listOutletParam:n}),this.dialogFilterVisible.update(i=>!i)}onExport(){let e=v(g({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.ReportServiceStore.getBalanceSheet(e,{responseType:"blob"}).pipe(ke("Export Balance Sheet"),L(n=>{let i=n.type,a=[n],u=document.createElement("a");u.href=window.URL.createObjectURL(new Blob(a,{type:i}));let d=`balance-sheet.${i.split("/")[1]}`;u.setAttribute("download",d),document.body.appendChild(u),u.click(),document.body.removeChild(u)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-balance-sheet"]],features:[Oe([Tt])],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],["item",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],[1,"d-flex","gap-2"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],[3,"showHeader"],[1,"d-flex","flex-column","gap-3"],[1,"fs-5","fw-semibold","mt-3"],[3,"value"],[2,"width","20%"],[1,"text-end",2,"width","5%"],["target","_blank",1,"link","link-primary",3,"routerLink"],[1,"text-end"],["target","_blank",1,"link","link-primary",3,"routerLink","queryParams"],["colspan","2",1,"fw-semibold","text-end"],[1,"text-end","fw-semibold"],["colspan","3",1,""],[1,"fs-5","fw-semibold"],["target","_blank",1,"link","link-primary","d-flex","align-items-center",3,"routerLink"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["formControlName","outletID","display","chip","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select Outlet",3,"virtualScroll","virtualScrollItemSize","options","showClear"],["formControlName","date","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],[1,"flex","items-center","gap-2"]],template:function(n,i){if(n&1){let a=D();o(0,"app-main-panel",8),P("isDialogFilterVisibleChange",function(d){return h(a),B(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),b(d)})("isInitDialogFilterVisibleChange",function(d){return h(a),B(i.isInitDialogFilterVisible,d)||(i.isInitDialogFilterVisible=d),b(d)}),I("filterConfirmed",function(){return h(a),b(i.onFilterOKEvent())}),x(1,dn,2,1,"ng-template",null,0,_)(3,Dn,5,4,"ng-template",null,1,_)(5,Fn,11,7,"ng-template",null,2,_),r()}n&2&&(s("pageTitle",i.store.data().pageTitle)("isFilterable",!0),A("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[ne,H,z,q,me,pe,oe,ee,Z,Q,$,K,Y,X,J,ce,se,le,re,ye,te,Xe,W,U],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Qt=(()=>{class t{static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-comparative-balance"]],decls:3,vars:0,template:function(n,i){n&1&&(o(0,"p"),l(1,"report-comparative-balance works!"),r(),l(2,`
2
- ,
3
- `))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Zt=(()=>{class t{static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-cash-flow"]],decls:3,vars:0,template:function(n,i){n&1&&(o(0,"p"),l(1,"report-cash-flow works!"),r(),l(2,`
4
- ,
5
- `))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var ei=(()=>{class t{static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-trial-balance"]],decls:3,vars:0,template:function(n,i){n&1&&(o(0,"p"),l(1,"report-trial-balance works!"),r(),l(2,`
6
- ,
7
- `))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Vn=()=>({width:"30vw"}),Ln=()=>({"1199px":"75vw","575px":"90vw"}),Mn=t=>["/pages/journal/journal-entry/",t],kn=t=>({"ng-dirty ng-invalid":t}),Nn=()=>({scrollHeight:"250px"});function Bn(t,m){if(t&1){let e=D();o(0,"p-button",27),I("onClick",function(){h(e);let i=c(2);return b(i.onToggleExportDialog())}),r()}}function An(t,m){if(t&1&&(o(0,"div",24)(1,"a",25),l(2,"Return to Accounts"),r(),x(3,Bn,1,0,"p-button",26),r()),t&2){let e=c();p(3),s("ngIf",e.roleService.global().export)}}function Gn(t,m){if(t&1&&(o(0,"div",24)(1,"span",31)(2,"h2",32),l(3),r()(),o(4,"span",31)(5,"h2",32),l(6),r()()()),t&2){let e=c().$implicit;p(3),f(e.name),p(3),w(" (",e.chartOfAccountCode,") ")}}function Pn(t,m){t&1&&(o(0,"tr")(1,"th",33),l(2,"Outlet"),r(),o(3,"th",33),l(4,"No."),r(),o(5,"th",33),l(6,"Date"),r(),o(7,"th"),l(8,"Contact / Note"),r(),o(9,"th",34),l(10,"Debit"),r(),o(11,"th",35),l(12,"Credit"),r(),o(13,"th",35),l(14,"Balance"),r()())}function On(t,m){if(t&1&&(o(0,"div",38)(1,"a",39),l(2),r(),T(3,"div",41),o(4,"span",42),l(5),r()()),t&2){let e=c().$implicit,n=c(4);p(),s("href",n.authService.getTenantExternalURL()+n.buildReferenceUrl(e),he),p(),f(e.referenceText),p(),s("innerHTML",e.journalNote,j),p(2),w("",e.note," ")}}function jn(t,m){if(t&1&&(o(0,"div",38),T(1,"span",41)(2,"div",41),o(3,"span",42),l(4),r()()),t&2){let e=c().$implicit;p(),s("innerHTML",e.referenceText,j),p(),s("innerHTML",e.journalNote,j),p(2),w("",e.note," ")}}function zn(t,m){if(t&1&&(o(0,"tr")(1,"td",36),l(2),r(),o(3,"td",36)(4,"a",37),l(5),r()(),o(6,"td",36),l(7),C(8,"date"),r(),o(9,"td",36)(10,"div",38)(11,"a",39),l(12),r(),x(13,On,6,4,"div",38)(14,jn,5,3,"div",38),r()(),o(15,"td",40),l(16),C(17,"number"),r(),o(18,"td",40),l(19),C(20,"number"),r(),o(21,"td",40),l(22),C(23,"number"),r()()),t&2){let e=m.$implicit,n=c(4);p(2),f(e.outletName),p(2),s("routerLink",V(19,Mn,e.id)),p(),f(e.number),p(2),f(Me(8,10,e.date,"dd MMM yyyy")),p(4),s("href",n.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.contactID,he),p(),f(e.contactName),p(),M(n.buildReferenceUrl(e)?13:14),p(3),w(" ",y(17,13,e.debitAmount)," "),p(3),w(" ",y(20,15,e.creditAmount)," "),p(3),f(y(23,17,e.balance))}}function qn(t,m){if(t&1&&(o(0,"tr"),T(1,"td",43),o(2,"td",44),l(3,"Total"),r(),o(4,"td",44),l(5),C(6,"number"),r(),o(7,"td",44),l(8),C(9,"number"),r(),T(10,"td"),r()),t&2){let e=c().$index,n=c(3);p(5),w(" ",y(6,2,n.items().data[e].debitTotal)," "),p(3),w(" ",y(9,4,n.items().data[e].creditTotal)," ")}}function Hn(t,m){t&1&&(o(0,"tr")(1,"td",45)(2,"span"),l(3,"No records found."),r()()())}function Un(t,m){if(t&1&&(o(0,"p-table",30),x(1,Gn,7,2,"ng-template",null,5,_)(3,Pn,15,0,"ng-template",null,6,_)(5,zn,24,21,"ng-template",null,7,_)(7,qn,11,6,"ng-template",null,4,_)(9,Hn,4,0,"ng-template",null,8,_),r()),t&2){let e=m.$implicit;s("value",e.data)}}function Wn(t,m){if(t&1&&(o(0,"div",29),Fe(1,Un,11,1,"p-table",30,Re),r()),t&2){let e=c(2);p(),Ve(e.items().data)}}function Kn(t,m){if(t&1&&x(0,Wn,3,0,"div",28),t&2){let e=c();s("ngIf",e.items()&&e.items().data)}}function Yn(t,m){if(t&1&&(o(0,"div",24)(1,"div",31)(2,"span",61),l(3),r()(),o(4,"div")(5,"span"),l(6,"-"),r()(),o(7,"div",31)(8,"span",62),l(9),r()()()),t&2){let e=m.$implicit;p(3),w("(",e.code,")"),p(6),f(e.name)}}function $n(t,m){if(t&1&&(o(0,"div",24)(1,"div",31)(2,"span",61),l(3),r()(),o(4,"div")(5,"span"),l(6,"-"),r()(),o(7,"div",31)(8,"span",62),l(9),r()()()),t&2){let e=m.$implicit;p(3),w("(",e.code,")"),p(6),f(e.name)}}function Xn(t,m){t&1&&(o(0,"div",63),l(1," Account is required. "),r())}function Jn(t,m){if(t&1&&(o(0,"div",64)(1,"div"),l(2),r()()),t&2){let e=m.$implicit;p(2),f(e.value)}}function Qn(t,m){if(t&1&&(o(0,"div",55)(1,"div",21),T(2,"p-radiobutton",65),o(3,"label",66),l(4),r()()()),t&2){let e=m.$implicit;p(2),s("value",e.key)("inputId",e.key),p(),Mt("for",e.key),p(),f(e.value)}}function Zn(t,m){if(t&1){let e=D();o(0,"div",38)(1,"label",47),l(2,"Customer"),r(),o(3,"p-autocomplete",67),I("completeMethod",function(i){h(e);let a=c(2);return b(a.searchCustomer(i))}),r()()}if(t&2){let e=c(2);p(3),s("suggestions",e.customerSuggestions())}}function eo(t,m){if(t&1){let e=D();o(0,"div",38)(1,"label",47),l(2,"Supplier"),r(),o(3,"p-autocomplete",68),I("completeMethod",function(i){h(e);let a=c(2);return b(a.searchSupplier(i))}),r()()}if(t&2){let e=c(2);p(3),s("suggestions",e.supplierSuggestions())}}function to(t,m){if(t&1){let e=D();o(0,"div",38)(1,"label",47),l(2,"Customer"),r(),o(3,"p-autocomplete",67),I("completeMethod",function(i){h(e);let a=c(2);return b(a.searchCustomer(i))}),r()()}if(t&2){let e=c(2);p(3),s("suggestions",e.customerSuggestions())}}function io(t,m){if(t&1){let e=D();o(0,"form",46)(1,"div",38)(2,"label",47),l(3,"Accounts"),r(),o(4,"p-multiselect",48),I("onChange",function(i){h(e);let a=c();return b(a.onAccountChange(i))}),x(5,Yn,10,2,"ng-template",null,9,_)(7,$n,10,2,"ng-template",null,10,_),r(),x(9,Xn,2,0,"div",49),r(),o(10,"div",38)(11,"label",47),l(12,"From"),r(),o(13,"div",50),T(14,"p-datepicker",51)(15,"p-datepicker",52),r()(),o(16,"div",38)(17,"label",47),l(18,"Outlets"),r(),o(19,"p-multiselect",53),x(20,Jn,3,1,"ng-template",null,10,_),r()(),o(22,"div",38)(23,"label",47),l(24,"Category"),r(),o(25,"p-treeselect",54),I("onFocus",function(){h(e);let i=c();return b(i.onCategoryFocus())}),r()(),o(26,"div",38)(27,"label",18),l(28,"Contact Type"),r(),o(29,"div",16),Fe(30,Qn,5,4,"div",55,Re),r()(),o(32,"div",38)(33,"label",18),l(34,"Sort order"),r(),o(35,"div",16)(36,"div",55)(37,"div",21),T(38,"p-radiobutton",56),o(39,"label",57),l(40,"Asc"),r()()(),o(41,"div",58)(42,"div",21),T(43,"p-radiobutton",59),o(44,"label",60),l(45,"Desc"),r()()()()(),x(46,Zn,4,1,"div",38)(47,eo,4,1,"div",38)(48,to,4,1,"div",38),r()}if(t&2){let e,n,i,a,u,d,k=c();s("formGroup",k.form),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",(e=k.loaderMetadata())==null||e.options==null?null:e.options.accounts)("selectionLimit",5)("ngClass",V(22,kn,((n=k.form.get("listAccountID"))==null?null:n.invalid)&&(((n=k.form.get("listAccountID"))==null?null:n.touched)||((n=k.form.get("listAccountID"))==null?null:n.dirty)))),p(5),s("ngIf",((i=k.form.get("listAccountID"))==null?null:i.invalid)&&(((i=k.form.get("listAccountID"))==null?null:i.touched)||((i=k.form.get("listAccountID"))==null?null:i.dirty))),p(5),s("iconDisplay","input")("showIcon",!0),p(),s("iconDisplay","input")("showIcon",!0),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",(a=k.loaderMetadata())==null||a.options==null?null:a.options.outlets),p(6),s("metaKeySelection",!1)("virtualScroll",!0)("virtualScrollItemSize",50)("virtualScrollOptions",F(24,Nn))("options",k.categoriesOptions()),p(5),Ve((u=k.loaderMetadata())==null||u.options==null?null:u.options.contactTypeOptions),p(8),s("value",!0),p(5),s("value",!1),p(3),M((d=k.form.controls.contactType.value)===1?46:d===2?47:48)}}function no(t,m){if(t&1){let e=D();o(0,"p-button",69),I("onClick",function(){h(e);let i=c();return b(i.onToggleExportDialog())}),r()}t&2&&s("rounded",!0)("text",!0)}function oo(t,m){if(t&1){let e=D();o(0,"p-button",70),I("click",function(){h(e);let i=c();return b(i.onToggleExportDialog())}),r(),o(1,"p-button",71),I("click",function(){h(e);let i=c();return b(i.onExport())}),r()}}var ti=(()=>{class t{buildReferenceUrl(e){return st(e)}getGLCount(){this.reportService.getGLCount(this.filter()).pipe(L(({count:e})=>{this.totalRecords.set(e)})).subscribe()}onToggleExportDialog(){this.isDialogExportVisible.update(e=>!e)}get pageTitle(){return this.items()&&this.items().pageTitle?this.items().pageTitle:"General Ledger"}constructor(){this.reportService=S(G),this.route=S(He),this.roleService=S(ie),this.authService=S(Se),this.fb=S(Ce),this.coaService=S(lt),this.toastr=S(Ue),this.dayjsService=S(ae),this.infinity=1/0,this.metadata=E(null),this.items=E(null),this.totalRecords=E(-1),this.dialogFilterVisible=E(!0),this.initDialogVisible=E(!1),this.isDialogExportVisible=E(!1),this.customerSuggestions=E([]),this.supplierSuggestions=E([]),this.categoriesOptions=E([]),this.localFilter=E({}),this.count=R(()=>this.totalRecords()<0?1/0:this.totalRecords()),this.pagination=R(()=>{let e=this.filter(),n=this.totalRecords()!=null&&this.totalRecords()>=0?this.totalRecords():1/0,i=Math.min(e.pageNumber*e.pageSize,isFinite(n)?n:e.pageNumber*e.pageSize);return{first:1,end:e.pageSize>0?i:0,total:n,page:e.pageNumber,pageSize:e.pageSize,hasPrev:e.pageNumber>1,hasNext:isFinite(n)?e.pageNumber*e.pageSize<n:!0}}),this.loaderMetadata=ve(this.reportService.fetchGeneralLedgerLoader("multiple"),{initialValue:null}),this.baseFilter=R(()=>{let e=this.loaderMetadata();return e?e.filter:null}),this.exportFileTypes=E([{key:0,value:"CSV"},{key:1,value:"Excel"}]),this.queryFilter=ve(this.route.queryParamMap.pipe(Ne(e=>({accountID:e.get("id"),to:e.get("to")}))),{initialValue:null}),this.filter=R(()=>{let e=this.baseFilter(),n=this.queryFilter(),i=this.localFilter();return e?g(g(g({},e),n??{}),i):null}),this.creditSubTotal=R(()=>0),this.debitSubTotal=R(()=>0),this.initializeForm(),ue(()=>{let e=this.filter();e&&(e.listAccountID.length>0||e.listCategoryID.length>0)&&(this.form.patchValue(this.transformFilterToFormValue(e),{emitEvent:!1}),this.reportService.fetchGeneralLedgerReport(e,"multiple").pipe().subscribe(n=>{this.items.set(n)}))})}initializeForm(){this.form=this.fb.group({accountID:this.fb.control(null),from:this.fb.control(null),to:this.fb.control(null),contactType:this.fb.control(null),contactID:this.fb.control(""),listOutletID:this.fb.control([]),pageNumber:this.fb.control(1),pageSize:this.fb.control(50),sortAscending:this.fb.control(!0),listCategoryID:this.fb.control([]),listAccountID:this.fb.control([]),export:this.fb.control(!1),exportPageNumber:this.fb.control(1),exportPageSize:this.fb.control(0)})}findNodeByKey(e,n){for(let i of e){if(i.key===n)return i;if(i.children){let a=this.findNodeByKey(i.children,n);if(a)return a}}return null}transformFilterToFormValue(e){return Object.entries(e).reduce((n,[i,a])=>{switch(i){case"from":break;case"to":n[i]=a&&(typeof a=="string"||typeof a=="number"||a instanceof Date)?this.dayjsService.from(a)?.toDate():this.dayjsService.now.toDate();break;case"listCategoryID":Array.isArray(a)?n[i]=a.map(u=>this.findNodeByKey(this.categoriesOptions(),u)).filter(u=>!!u):n[i]=[];break;case"listOutletID":case"listAccountID":n[i]=Array.isArray(a)?a:[];break;case"pageNumber":case"pageSize":case"exportPageNumber":case"exportPageSize":n[i]=a!=null?Number(a):0;break;case"sortAscending":case"export":n[i]=!!a;break;case"contactType":n[i]=a!=null?Number(a):null;break;default:n[i]=a}return n},{})}clearContactValueOnContactTypeChange(){this.form.get("contactType")?.valueChanges.subscribe(()=>this.form.get("contactID")?.setValue(""))}onFormValueChange(){let e=this.form.controls.listAccountID.value,n=this.form.controls.listCategoryID.value;e.length<=0&&n.length<=0?(this.form.controls.listAccountID.enable({emitEvent:!1}),this.form.controls.listCategoryID.enable({emitEvent:!1})):e.length>0?(this.form.controls.listAccountID.enable({emitEvent:!1}),this.form.controls.listCategoryID.disable({emitEvent:!1})):n.length>0&&(this.form.controls.listAccountID.disable({emitEvent:!1}),this.form.controls.listCategoryID.enable({emitEvent:!1}))}isEmpty(e){return e==null||typeof e=="string"&&e.trim().length===0}onCategoryFocus(){this.coaService.getCachedCategoriesOptions().pipe(L(e=>this.categoriesOptions.set(e))).subscribe()}searchCustomer(e){this.reportService.getCustomerSuggestions(e.query).pipe(L(n=>this.customerSuggestions.set(n))).subscribe()}searchSupplier(e){this.reportService.getSupplierSuggestions(e.query).pipe(L(n=>this.supplierSuggestions.set(n))).subscribe()}onAccountChange(e){Array.isArray(e.value)&&e.value.length>5&&this.toastr.warning("Please select at most 5 accounts for the general ledger report.","Warning")}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched(),this.dialogFilterVisible.set(!0);return}let e=this.buildFilterBody();this.dialogFilterVisible.set(!1),this.localFilter.set(e)}buildFilterBody(){let a=this.form.value,{from:e,to:n}=a,i=fe(a,["from","to"]);return v(g({},this.filter()),{pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,listCategoryID:i.listCategoryID?.map(u=>u.key)??[],contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType})}onExport(){let e=this.buildExportBody();this.performExport(e)}performExport(e){this.reportService.exportGeneralLedger(e,{responseType:"blob",observe:"response"}).pipe(L(n=>this.handleExportResponse(n))).subscribe()}handleExportResponse(e){let n=e.headers,i=n.get("Content-Disposition")??n.get("content-disposition"),a="download.csv";if(i){let d=i.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);d?.[1]&&(a=decodeURIComponent(d[1].replace(/"/g,"")))}let u=e.body;mt(u,a,u.type)}buildExportBody(){let a=this.form.value,{from:e,to:n}=a,i=fe(a,["from","to"]);return v(g({},this.filter()),{exportPageNumber:+i.exportPageNumber,pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,listCategoryID:i.listCategoryID?.map(u=>u.key)??[],contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType,export:!0})}onNextPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(g({},e),{pageNumber:n+1})})}onPrevPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(g({},e),{pageNumber:Math.max(1,n-1)})})}goToPage(e){this.localFilter.update(n=>v(g({},n),{pageNumber:e}))}goToLastPage(){let e=this.filter();if(!e)return;let n=this.totalRecords();if(n===-1||!isFinite(n)){this.toastr.info("Please load total records before going to the last page","Info");return}let i=Math.ceil(n/e.pageSize);if(e.pageNumber>=i){this.toastr.warning("You are already on the last page","Warning");return}this.localFilter.update(a=>v(g({},a),{pageNumber:i}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-multiple-ledger"]],decls:28,vars:19,consts:[["actionButton",""],["content",""],["filters",""],["closeIconTemplate",""],["footer",""],["caption",""],["header",""],["body",""],["emptymessage",""],["selectedItem",""],["item",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isDialogFilterVisible","isFilterable","isInitDialogFilterVisible","scrollable"],["header","Export Journal Entry",3,"visibleChange","modal","visible","breakpoints"],[1,"d-flex","flex-column","gap-3"],[1,"row",3,"formGroup"],[1,"col-8"],[1,"row"],[1,"col"],["for",""],["type","text","formControlName","exportPageNumber","fluid","","pInputText","","pSize","small"],["role","alert",1,"alert","alert-primary","m-0","p-2"],[1,"d-flex","align-items-center","gap-2"],[1,"fa-solid","fa-circle-info"],[1,"fs-2","text-dark","fw-semibold"],[1,"d-flex","gap-2"],["routerLink","/pages/chart-of-account/account",1,"p-button","p-button-secondary","p-button-outlined","fs-3"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],["class","px-3 h-100 bg-white border-top",4,"ngIf"],[1,"px-3","h-100","bg-white","border-top"],[3,"value"],[1,""],[1,"fs-5","fw-semibold"],[2,"width","10%"],[1,"text-end",2,"width","10%"],[1,"text-end",2,"width","20%"],[1,"text-break"],["target","_blank",1,"link","link-primary",3,"routerLink"],[1,"d-flex","flex-column"],["target","_blank",1,"link","link-primary",3,"href"],[1,"text-end","text-break"],[3,"innerHTML"],[2,"width","300px","white-space","normal","word-break","break-word"],["colspan","3"],[1,"text-end","fw-semibold"],["colspan","8"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],["for","outlet"],["showClear","","filter","","filterBy","code,name","display","chip","formControlName","listAccountID","appendTo","body","optionLabel","name","optionValue","id","placeholder","Select Accounts",3,"onChange","virtualScroll","virtualScrollItemSize","options","selectionLimit","ngClass"],["class","text-danger",4,"ngIf"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],["showClear","","display","chip","formControlName","listOutletID","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select Outlets",3,"virtualScroll","virtualScrollItemSize","options"],["showClear","","display","chip","selectionMode","multiple","filter","","filterBy","label","formControlName","listCategoryID","appendTo","body","containerStyleClass","w-100","optionLabel","label","optionValue","key","placeholder","Select Category",3,"onFocus","metaKeySelection","virtualScroll","virtualScrollItemSize","virtualScrollOptions","options"],[1,"col-4"],["name","sortAscending","formControlName","sortAscending","inputId","asc",3,"value"],["for","asc",1,"m-0"],[1,"col-3"],["name","sortAscending","formControlName","sortAscending","inputId","desc",3,"value"],["for","desc",1,"m-0"],[1,"h-full","align-middle"],[1,"text-truncate","d-inline-block","h-full","align-middle"],[1,"text-danger"],[1,"flex","items-center","gap-2"],["name","contactType","formControlName","contactType",3,"value","inputId"],[1,"m-0",3,"for"],["formControlName","contactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["formControlName","ContactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["severity","secondary","variant","outlined","icon","fa-solid fa-xmark",3,"onClick","rounded","text"],["label","Cancel","severity","secondary","variant","outlined",3,"click"],["label","OK (F2)",3,"click"]],template:function(n,i){if(n&1){let a=D();o(0,"app-main-panel",11),P("isDialogFilterVisibleChange",function(d){return h(a),B(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),b(d)})("isInitDialogFilterVisibleChange",function(d){return h(a),B(i.initDialogVisible,d)||(i.initDialogVisible=d),b(d)}),I("filterConfirmed",function(){return h(a),b(i.onFilterOKEvent())}),x(1,An,4,1,"ng-template",null,0,_)(3,Kn,1,1,"ng-template",null,1,_)(5,io,49,25,"ng-template",null,2,_),r(),o(7,"p-dialog",12),P("visibleChange",function(d){return h(a),B(i.isDialogExportVisible,d)||(i.isDialogExportVisible=d),b(d)}),o(8,"div",13)(9,"div",14)(10,"div",15)(11,"div",16)(12,"div",17)(13,"label",18),l(14,"Page"),r()(),o(15,"div",17),T(16,"input",19),r()()()(),o(17,"div",20)(18,"div",21),T(19,"i",22),o(20,"span",23),l(21),C(22,"number"),C(23,"number"),r()()()(),x(24,no,1,2,"ng-template",null,3,_)(26,oo,2,0,"ng-template",null,4,_),r()}if(n&2){let a;s("pageTitle",i.pageTitle),A("isDialogFilterVisible",i.dialogFilterVisible),s("isFilterable",!0),A("isInitDialogFilterVisible",i.initDialogVisible),s("scrollable",!0),p(7),Ae(F(17,Vn)),s("modal",!0),A("visible",i.isDialogExportVisible),s("breakpoints",F(18,Ln)),p(2),s("formGroup",i.form),p(12),Le("Exporting data from ",y(22,13,(a=i.filter())==null?null:a.exportPageNumber)," - ",y(23,15,(a=i.filter())==null?null:a.exportPageSize),"")}},dependencies:[ne,H,ze,z,q,qe,oe,me,pe,nt,it,ee,Z,Te,le,re,De,we,Q,$,We,K,Y,X,J,ce,se,ye,$e,pt,Ut,at,te,W,U,rt,ot,Ye,Ke],styles:["[_nghost-%COMP%]{display:block} .p-datatable .p-datatable-header{padding-left:0!important}"],changeDetection:0})}}return t})();var $l=[{path:"",redirectTo:"general-ledger",pathMatch:"full"},{path:"",children:[{path:"general-ledger",component:Kt},{path:"multiple-general-ledger",component:ti},{path:"profit-loss",component:Yt},{path:"balance-sheet",component:Jt},{path:"comparative-balance",component:Qt},{path:"trial-balance",component:ei},{path:"cash-flow",component:Zt}]}];export{$l as REPORTS_ROUTES};