dealposbooks 5.45.2 → 5.46.1
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.
- package/3rdpartylicenses.txt +5 -23
- package/assets/scss/components/_tables.scss +29 -3
- package/assets/scss/style.scss +4 -0
- package/{chunk-QY6YO5GR.js → chunk-325YO3CB.js} +1 -1
- package/{chunk-OZG2M6UV.js → chunk-53W5RLOG.js} +4 -4
- package/{chunk-W325ZFGZ.js → chunk-56N6E5N3.js} +1 -1
- package/{chunk-WO62II7E.js → chunk-6HNKPNHQ.js} +1 -1
- package/{chunk-26UQWFZL.js → chunk-7UGQCTEO.js} +1 -1
- package/{chunk-WZQ3ORPU.js → chunk-A3XYHEBB.js} +1 -1
- package/chunk-AS6FT6H3.js +1 -0
- package/{chunk-FXATM6DM.js → chunk-BPBHYTKN.js} +1 -1
- package/{chunk-MLC5Q3HL.js → chunk-BPZ7LLVJ.js} +1 -1
- package/{chunk-AJUXGEAH.js → chunk-C2KFSD3V.js} +1 -1
- package/chunk-CRRQQY3W.js +1 -0
- package/{chunk-DWCZUCH4.js → chunk-DAUF3TQ2.js} +1 -1
- package/{chunk-66OMKKIW.js → chunk-FXWKWGGZ.js} +1 -1
- package/{chunk-GZYN6L4H.js → chunk-FYFSBGP3.js} +1 -1
- package/chunk-G25NFEKL.js +1 -0
- package/chunk-GKXIOXWW.js +8 -0
- package/{chunk-NMNIOSPK.js → chunk-HXXN64RL.js} +1 -1
- package/chunk-ICH2UTRM.js +1 -0
- package/{chunk-QTPVRMTB.js → chunk-IZCYMXSH.js} +1 -1
- package/chunk-JGRTH5OW.js +1 -0
- package/{chunk-GNLE4WCA.js → chunk-JYEZYL2U.js} +1 -1
- package/{chunk-BSDEDT6G.js → chunk-KGTXHU4K.js} +1 -1
- package/{chunk-JTUKNSIL.js → chunk-KYQ3HOYB.js} +1 -1
- package/{chunk-CDM64DTS.js → chunk-LLPR22QN.js} +1 -1
- package/{chunk-BXJSXLQV.js → chunk-LWIIL6RI.js} +1 -1
- package/{chunk-PYQLVU3L.js → chunk-ME7O3OZS.js} +1 -1
- package/chunk-MOUK63TZ.js +4 -0
- package/{chunk-FPBO6QHG.js → chunk-MYE27TEJ.js} +1 -1
- package/{chunk-HWYLSS7R.js → chunk-NID2PW3N.js} +1 -1
- package/{chunk-Y4NMBCL7.js → chunk-NLRLM4WP.js} +1 -1
- package/{chunk-HSCJP74Q.js → chunk-O4TXGGHF.js} +1 -1
- package/chunk-OBX4APL6.js +1 -0
- package/chunk-OKX4P7HR.js +1 -0
- package/{chunk-SZPSOPM4.js → chunk-PQB7CIVB.js} +1 -1
- package/chunk-PRW2K6L4.js +129 -0
- package/{chunk-4LXFEAO3.js → chunk-QKRPHDSG.js} +1 -1
- package/{chunk-JOKE4TMJ.js → chunk-QXZZJ543.js} +1 -1
- package/{chunk-4TTCPL3N.js → chunk-R7TX5W65.js} +1 -1
- package/{chunk-XBIY3I5H.js → chunk-SBAIX6FL.js} +1 -1
- package/{chunk-3KUSIKRO.js → chunk-SLUPHKW6.js} +1 -1
- package/{chunk-KUECUVZ7.js → chunk-SPFVPLUI.js} +1 -1
- package/{chunk-OX6CAMTK.js → chunk-SZUKKFRX.js} +1 -1
- package/{chunk-MMQTWRG5.js → chunk-TOSO7HJJ.js} +1 -1
- package/chunk-TYVIEINK.js +1 -0
- package/{chunk-GJJEUBYR.js → chunk-VBCL4G4V.js} +1 -1
- package/{chunk-UP4DWDNE.js → chunk-W4HYYYPX.js} +1 -1
- package/{chunk-OQD4ZKBU.js → chunk-XILZA7G5.js} +1 -1
- package/{chunk-Y7P7BGVH.js → chunk-Y2PXP5OT.js} +2 -2
- package/{chunk-2CZSVC7E.js → chunk-Y3UB475V.js} +1 -1
- package/chunk-YM5BXLAN.js +1 -0
- package/{chunk-AOJUTF6L.js → chunk-YUNKEY4N.js} +1 -1
- package/{chunk-YDFJ65ST.js → chunk-Z2ADGCWR.js} +1 -1
- package/{chunk-A2PK5UDL.js → chunk-ZYDAEVQY.js} +1 -1
- package/index.html +2 -2
- package/{main-TUODCJBC.js → main-7RGHX2IL.js} +1 -1
- package/package.json +1 -1
- package/{styles-TEWF6HBI.css → styles-4HAX3IDP.css} +1 -1
- package/chunk-3HOFEEIL.js +0 -1
- package/chunk-5M4DFZYR.js +0 -8
- package/chunk-BTVPGIVW.js +0 -1
- package/chunk-DHA762N3.js +0 -1
- package/chunk-JRVYSBUZ.js +0 -5
- package/chunk-KQGEEF2E.js +0 -129
- package/chunk-N4CQ65FU.js +0 -1
- package/chunk-OVHHHUDY.js +0 -1
- package/chunk-P63CD72K.js +0 -1
- package/chunk-QUL4J2CF.js +0 -1
- package/chunk-VEALQLJ2.js +0 -1
- package/chunk-YVO6JHL7.js +0 -1
package/3rdpartylicenses.txt
CHANGED
|
@@ -152,32 +152,14 @@ The above copyright notice and this permission notice shall be included in all c
|
|
|
152
152
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
153
153
|
|
|
154
154
|
--------------------------------------------------------------------------------
|
|
155
|
-
Package:
|
|
156
|
-
License: "
|
|
157
|
-
|
|
158
|
-
Copyright 2009 Robert J. Knothe <bob@decorplanit.com> and contributors
|
|
159
|
-
|
|
155
|
+
Package: @maskito/core
|
|
156
|
+
License: "Apache-2.0"
|
|
160
157
|
|
|
161
|
-
Permission is hereby granted, free of charge, to any person
|
|
162
|
-
obtaining a copy of this software and associated documentation
|
|
163
|
-
files (the "Software"), to deal in the Software without
|
|
164
|
-
restriction, including without limitation the rights to use,
|
|
165
|
-
copy, modify, merge, publish, distribute, sub license, and/or sell
|
|
166
|
-
copies of the Software, and to permit persons to whom the
|
|
167
|
-
Software is furnished to do so, subject to the following
|
|
168
|
-
conditions:
|
|
169
158
|
|
|
170
|
-
|
|
171
|
-
|
|
159
|
+
--------------------------------------------------------------------------------
|
|
160
|
+
Package: @maskito/kit
|
|
161
|
+
License: "Apache-2.0"
|
|
172
162
|
|
|
173
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
174
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
175
|
-
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
176
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
177
|
-
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
178
|
-
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
179
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
180
|
-
OTHER DEALINGS IN THE SOFTWARE.
|
|
181
163
|
|
|
182
164
|
--------------------------------------------------------------------------------
|
|
183
165
|
Package: @angular/platform-browser
|
|
@@ -58,9 +58,35 @@ table.dataTable {
|
|
|
58
58
|
box-shadow: none !important;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
.
|
|
61
|
+
.p-datatable-wrapper {
|
|
62
|
+
position: relative;
|
|
63
|
+
overflow: auto;
|
|
64
|
+
max-height: 600px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.p-datatable-table {
|
|
68
|
+
border-collapse: separate;
|
|
69
|
+
border-spacing: 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.p-datatable thead {
|
|
62
73
|
position: sticky;
|
|
63
74
|
top: 70px;
|
|
64
|
-
z-index:
|
|
65
|
-
|
|
75
|
+
z-index: 100;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.p-datatable thead th {
|
|
79
|
+
position: sticky;
|
|
80
|
+
top: 0; /* or 70px if you have top navbar */
|
|
81
|
+
z-index: 10;
|
|
82
|
+
background: #fff;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.p-datatable tbody {
|
|
86
|
+
position: relative;
|
|
87
|
+
z-index: 1;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.p-datatable tbody tr td {
|
|
91
|
+
background-color: inherit; /* Inherit dari row */
|
|
66
92
|
}
|
package/assets/scss/style.scss
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,b as L}from"./chunk-
|
|
1
|
+
import{a as C,b as L}from"./chunk-QKRPHDSG.js";import"./chunk-JYEZYL2U.js";import{a as E,b as V}from"./chunk-VJ3IBUVO.js";import"./chunk-KJ2WX3FC.js";import{h as H}from"./chunk-Y2PXP5OT.js";import{b as N,c as G}from"./chunk-VGNJD35F.js";import{a as R,b as D}from"./chunk-2XUSZCQL.js";import"./chunk-YV2QJ63P.js";import"./chunk-ARH3WEEF.js";import{w as j,x as O}from"./chunk-H6HNANYB.js";import"./chunk-2D2YD753.js";import"./chunk-OIBDX2CA.js";import"./chunk-R7TX5W65.js";import{a as I}from"./chunk-2MKKFLNJ.js";import{n as $,s as F}from"./chunk-VZ5CMS5O.js";import"./chunk-F2X3VGZZ.js";import{$b as P,Cc as w,Db as A,Dc as _,Lb as p,Nc as c,Ob as x,Oc as l,Rc as T,Vb as n,W as y,Wb as o,Xb as m,Y as M,_ as S,ec as h,fc as s,h as v,hb as a,ia as f,qa as g,ra as d,s as u,sa as b,ta as k,xb as B}from"./chunk-NMCKMUY4.js";import"./chunk-YQFG5XE2.js";var q=()=>({height:"calc(100vh - 100px)"});function J(i,z){if(i&1){let e=P();n(0,"div",3)(1,"p-button",4),h("onClick",function(){g(e);let r=s();return d(r.onFormat())}),o(),n(2,"p-button",5),c(3,"async"),c(4,"async"),h("onClick",function(){g(e);let r=s();return d(r.onMigrate())}),o()()}if(i&2){let e=s();a(2),p("disabled",l(3,2,e.countInBooks$)!==0)("pTooltip",l(4,4,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function K(i,z){if(i&1&&(n(0,"p-scroll-panel")(1,"p-panel")(2,"div",6),m(3,"app-migration-cards",7),c(4,"async"),b(),n(5,"svg",8),m(6,"path",9),o(),k(),m(7,"app-migration-cards",10),c(8,"async"),o()()()),i&2){let e=s();x(_(12,q)),a(),x(_(13,q)),a(2),p("migrationCount",l(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),a(4),p("migrationCount",l(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var ue=(()=>{class i{constructor(){this.migrateService=f(C),this.toastr=f(I),this.refresh$=new v(void 0),this.pageTitle="Tax Account"}ngOnInit(){let e=this.refresh$.pipe(M(()=>this.migrateService.getTaxAccountCount()),S(t=>console.log("API response:",t)),y(1));this.countInPOS$=e.pipe(u(t=>Number(t.pos))),this.countInBooks$=e.pipe(u(t=>Number(t.books)))}onMigrate(){this.migrateService.migrateTaxAccount().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormat(){confirm("Are you sure you want to format?")&&this.migrateService.formatTaxAccount().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Format Successful")})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=B({type:i,selectors:[["app-tax-account"]],features:[w([C])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger",3,"onClick"],["label","Migrate","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(t,r){t&1&&(n(0,"app-main-panel",2),A(1,J,5,6,"ng-template",null,0,T)(3,K,9,14,"ng-template",null,1,T),o()),t&2&&p("pageTitle",r.pageTitle)},dependencies:[H,F,$,V,E,D,R,G,N,L,O,j],encapsulation:2})}}return i})();export{ue as TaxAccountComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as _t}from"./chunk-KIBBRAL5.js";import{a as Gi}from"./chunk-XKI7WLHE.js";import{a as Di}from"./chunk-HG5MKVNR.js";import{a as $i,b as Ee,c as Pe,d as Ki}from"./chunk-B54PFCWI.js";import{a as Ri,b as Bi}from"./chunk-N4JIPI53.js";import"./chunk-7DYACF4D.js";import"./chunk-NZN6QJR3.js";import{a as ut,b as ft}from"./chunk-KGQGMXW6.js";import{a as qi,b as zi}from"./chunk-EB6NEJHF.js";import{a as we}from"./chunk-5CZNOXPC.js";import"./chunk-IGWIRCAS.js";import{a as lt,b as st}from"./chunk-3A4BFUGD.js";import{a as pt,b as dt,c as Oi,d as Fi,i as Li,j as Ni,k as Vi}from"./chunk-EL5BUFMO.js";import"./chunk-EQ4PLHI4.js";import"./chunk-H7Q35Y7G.js";import"./chunk-R7N6BWL5.js";import{a as X}from"./chunk-WZQ3ORPU.js";import{a as V}from"./chunk-QF4D5YPK.js";import{b as Si}from"./chunk-VJ3IBUVO.js";import{a as vi}from"./chunk-2AAVNIG7.js";import{a as ct,b as mt}from"./chunk-LFZCMZAP.js";import"./chunk-6A2KUPOG.js";import"./chunk-36OX4S7M.js";import"./chunk-Q5CVMJZC.js";import"./chunk-3GGXPPQT.js";import"./chunk-MFK5RQPJ.js";import{a as at,b as K}from"./chunk-KJ2WX3FC.js";import"./chunk-6GN3MGBY.js";import"./chunk-Q24GCSGD.js";import{f as Mi,h as $}from"./chunk-Y7P7BGVH.js";import{b as rt,c as _e}from"./chunk-VGNJD35F.js";import{a as se,b as ce}from"./chunk-2XUSZCQL.js";import{a as J,b as Ai,c as wi,e as Ei,f as Pi,g as ki}from"./chunk-YV2QJ63P.js";import{c as et,d as li,f as si}from"./chunk-ARH3WEEF.js";import{a as wt,f as Et,n as nt,o as ot,p as bi,t as Ti,u as Pt,w as ae,x as le}from"./chunk-H6HNANYB.js";import"./chunk-2D2YD753.js";import{Aa as hi,D as vt,Da as xi,I as ci,Ia as Ci,K as mi,La as Ae,M as pi,Ma as De,Oa as Ii,Q as tt,R as it,Ua as yi,W as di,X as bt,_ as ui,b as oe,c as fe,da as fi,e as Y,f as Ie,g as ri,ga as _i,i as N,j as Je,k as ai,ka as gi,l as ye,na as St,o as ve,qa as re,u as be,va as Tt,w as Se,wa as At,x as Te}from"./chunk-OIBDX2CA.js";import{b as ie,d as ne,e as B,l as L}from"./chunk-AOOG6YOT.js";import{a as oi}from"./chunk-4TTCPL3N.js";import"./chunk-2MKKFLNJ.js";import{h as z,j as Ye,k as O,l as Ct,m as ii,p as ni,q as Xe,s as F,t as Le}from"./chunk-VZ5CMS5O.js";import{c as It,d as yt,f as Ne,h as Ve}from"./chunk-F2X3VGZZ.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 ei,Ha as b,J as qe,Kb as P,L as qt,Lb as l,Nc as de,Ob as He,Oc as xe,P as zt,Pb as Fe,Pc as ti,Qb as Qt,Rb as Wt,Rc as y,Tb as Yt,Ub as Xt,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 Gt,bd as W,c as $e,ca as ze,cb as Me,cd as We,da as Ht,db as jt,ec as S,fc as m,hb as c,ia as x,kc as Ue,lc as pe,mc as j,nb as xt,nc as Z,qa as _,qc as te,ra as g,rc as p,s as G,sc as E,t as Kt,tc as Q,ua as Ge,vc as Jt,wa as Ut,wc as je,xb as M,xc as Ze,yb as Zt,yc as Qe}from"./chunk-NMCKMUY4.js";import{a as C,b as I}from"./chunk-YQFG5XE2.js";var on=["class","page"],rn=t=>({id:t}),an=()=>({"overflow-x":"auto"}),ln=t=>({"table-borderless":t}),sn=t=>["fa-solid",t],cn=t=>["/pages/journal/journal-entry/",t];function mn(t,s){t&1&&h(0,"p-button",8)}function pn(t,s){if(t&1){let e=w();a(0,"p-button",9),S("onClick",function(){_(e);let n=m(2);return g(n.onDelete())}),r()}}function dn(t,s){if(t&1&&(a(0,"div",4)(1,"p-button-group"),u(2,mn,1,0,"p-button",5)(3,pn,1,0,"p-button",6),r(),a(4,"a",7),p(5,"Ledger"),r()()),t&2){let e,i=m();c(2),l("ngIf",i.roleService.coa().edit),c(),l("ngIf",i.roleService.coa().delete),c(),l("queryParams",T(3,rn,(e=i.COAInfo())==null?null:e.id))}}function un(t,s){if(t&1&&h(0,"i",25),t&2){let e=s.checked;l("ngClass",T(1,sn,e?"fa-check":"fa-xmark"))}}function fn(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 _n(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 gn(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,fn,3,3,"ng-container",29),r(),a(10,"td",30),u(11,_n,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(ti(3,6,e.date,"dd MMM yyyy")),c(4),l("routerLink",T(11,cn,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 hn(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 xn(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(n){_(e);let o=m(2);return g(o.onDiscontinued(n))}),u(34,un,1,3,"ng-template",null,2,y),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"),Yt(57,gn,15,13,"tr",null,Wt),u(59,hn,9,0,"tr"),r()()()()()}if(t&2){let e,i,n,o,d,f,v=m(2);c(8),E((e=v.COAInfo().name)!==null&&e!==void 0?e:"-"),c(5),E((i=v.COAInfo().code)!==null&&i!==void 0?i:"-"),c(5),E((n=v.COAInfo().category)!==null&&n!==void 0?n:"-"),c(5),E((o=v.COAInfo().note)!==null&&o!==void 0?o:"-"),c(5),E((d=v.COAInfo().outletName)!==null&&d!==void 0?d:"-"),c(5),l("ngModel",v.COAInfo().bin),c(7),E((f=v.COAInfo().accessType)!==null&&f!==void 0?f:"-"),c(2),He(R(11,an)),c(),l("ngClass",T(12,ln,v.COAInfo().transactions.length===0)),c(14),Xt(v.COAInfo().transactions),c(2),Qt(v.COAInfo().transactions.length===0?59:-1)}}function Cn(t,s){if(t&1&&(a(0,"div",10),u(1,xn,60,14,"div",11),r()),t&2){let e=m();c(),l("ngIf",e.COAInfo())}}var Hi=(()=>{class t{constructor(){this.#e=x(X),this.#t=x(ie),this.router=x(ne),this.COAInfo=b(null),this.checked=b(!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 i=[this.#t.snapshot.paramMap.get("id")];this.#e.deleteChartAccount(i).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(i){return new(i||t)}}static{this.\u0275cmp=M({type:t,selectors:[["app-coa-account-info",8,"page"]],attrs:on,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(i,n){i&1&&(a(0,"app-main-panel",3),u(1,dn,6,5,"ng-template",null,0,y)(3,Cn,2,1,"ng-template",null,1,y),r()),i&2&&l("overflowScroll",!0)},dependencies:[F,z,O,Xe,ni,Se,Y,Je,et,L,B,$,K,at,le,ae,ft,ut,Oi,Di],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(oi)}fetchCOACategories(){return this.httpService.get("","api/ChartOfAccount/Category")}getCOACategoryByID(e){let i={params:e};return this.httpService.get("","api/ChartOfAccount/CategoryInfo",i)}renameCategory(e,i){return this.httpService.put("",`api/ChartOfAccount/RenameCategory/${e}`,i)}updateParentCategory(e,i){return this.httpService.put("",`api/ChartOfAccount/UpdateParentCategory/${e}`,i).pipe()}deleteCategory(e){return this.httpService.delete("",`api/ChartOfAccount/Category/${e}`)}submitCategory(e,i={}){return this.httpService.post("","api/ChartOfAccount/SubmitCategory",e,i)}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275prov=ze({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Mt=t=>t?t.reduce((s,e)=>(s.push({label:e.label,data:e.data,key:e.key}),e.children&&e.children.length?s.push(...Mt(e.children)):s.push({label:`${e.label} (no children)`,data:e.data,key:`${e.key}-no-children`}),s),[]):[];var Ot=(t,s,e)=>{let i=Math.ceil(e/s),n=(t-1)*s+1,o=Math.min(t*s,e);return{start:n,end:o,totalRecords:e,totalPages:i}};var In={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"}]},Ft=Ai(Pi(In),ki("ChartOfAccount"),wi(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(()=>Mt(t.options.categories())),first:W(()=>{let{start:s}=Ot(t.filter().PageNumber,t.filter().PageSize,t.count());return s}),last:W(()=>{let{end:s}=Ot(t.filter().PageNumber,t.filter().PageSize,t.count());return s})})),Ei(t=>{let s=x(X),e=x(me),i={updateFilter(n){J(t,{filter:C({},n)})},checkedItem(n){if(Array.isArray(n))n.forEach(o=>{let d=t.data().map(f=>f.id===o.id?I(C({},f),{checked:!o.checked}):f);J(t,{data:d})});else{let o=n,d=t.data().map(f=>f.id===o.id?I(C({},f),{checked:!o.checked}):f);J(t,{data:d})}},checkAllCheckbox(){let n=t.data().map(o=>I(C({},o),{checked:!o.checked}));J(t,{data:n})},fetchChartOfAccount:lt($e(Ke(()=>!!t.filter()),qt(300),zt(),D(n=>s.getPaginatedChartAccounts(n).pipe(G(o=>I(C({},o),{data:o.data.map(d=>I(C({},d),{checked:!1}))})),st({next:o=>J(t,{data:o.data,count:o.count}),error:o=>{J(t,{data:[],count:0}),console.error(o)}}))))),fetchLoader:lt($e(D(()=>s.getChartOfAccountLoader().pipe(st({next:n=>{J(t,{filter:I(C({},t.filter()),{PageSize:n.filter.pageSize,PageNumber:1,CategoryID:n.filter.categoryID||null,Text:"",listOutletID:[],AccessLevel:n.filter.accessLevel!==void 0?n.filter.accessLevel:t.filter().AccessLevel}),options:n.options}),i.fetchChartOfAccount(t.filter)},error:n=>{console.error(n)}}))))),getCategories:lt($e(qe(()=>e.fetchCOACategories().pipe(st({next:n=>{J(t,{options:I(C({},t.options()),{entities:t.options.entities(),categories:n})})},error:n=>{console.error(n)}})))))};return i}));var Sn=["class","page"],Tn=t=>["../account/",t],An=t=>({"text-decoration-line-through":t}),wn=()=>["/pages/report/general-ledger"],En=t=>({id:t});function Pn(t,s){if(t&1){let e=w();a(0,"p-button",13),S("onClick",function(){_(e);let n=m(2);return g(n.deleteCOA())}),r()}}function kn(t,s){t&1&&h(0,"p-button",14)}function Mn(t,s){if(t&1){let e=w();a(0,"p-button",15),S("onClick",function(){_(e);let n=m(2);return g(n.onExport())}),r()}}function On(t,s){t&1&&(a(0,"a",16),h(1,"i",17),p(2," Add"),r())}function Fn(t,s){if(t&1&&(a(0,"div",8),u(1,Pn,1,0,"p-button",9),a(2,"p-button-group"),u(3,kn,1,0,"p-button",10)(4,Mn,1,0,"p-button",11),r(),u(5,On,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 Ln(t,s){t&1&&(a(0,"th",21),h(1,"p-tableHeaderCheckbox"),r())}function Nn(t,s){if(t&1&&(a(0,"tr"),u(1,Ln,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 Vn(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 Dn(t,s){if(t&1&&(a(0,"tr"),u(1,Vn,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,i=s.$implicit,n=m(2);c(),l("ngIf",n.roleService.coa().delete),c(2),E(i.code),c(2),l("routerLink",T(12,Tn,i.id))("ngClass",T(14,An,i.bin)),c(),E(i.name),c(2),E(i.category),c(2),E(i.outletName),c(2),l("routerLink",R(16,wn))("queryParams",T(17,En,i.id)),c(),E(xe(14,10,(e=i.balance)!==null&&e!==void 0?e:0))}}function Rn(t,s){if(t&1&&p(0),t&2){let e=m(2);Jt(" Showing ",e.store.first()," to ",e.store.last()," of ",e.store.count()," entries ")}}function Bn(t,s){t&1&&(a(0,"tr")(1,"td",26)(2,"span"),p(3,"No records found."),r()()())}function $n(t,s){if(t&1){let e=w();a(0,"p-panel")(1,"p-table",18),S("onLazyLoad",function(n){_(e);let o=m();return g(o.loadData(n))})("onRowSelect",function(n){_(e);let o=m();return g(o.onRowSelect(n))})("onRowUnselect",function(n){_(e);let o=m();return g(o.onRowUnselect(n))})("onHeaderCheckboxToggle",function(n){_(e);let o=m();return g(o.onSelectAll(n))})("onPage",function(n){_(e);let o=m();return g(o.onPageChange(n))}),u(2,Nn,12,1,"ng-template",null,3,y)(4,Dn,15,19,"ng-template",null,4,y)(6,Rn,1,3,"ng-template",null,5,y)(8,Bn,4,0,"ng-template",null,6,y),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 Kn(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 n=m(2);return g(n.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 qn(t,s){if(t&1&&u(0,Kn,33,15,"form",27),t&2){let e=m();l("ngIf",e.formFilter)}}var ji=(()=>{class t{ngOnInit(){this.initializeFilterEffect(),this.store.fetchLoader()}#e;constructor(){this.routeInfo=Zi,this.store=x(Ft),this.#e=x(X),this.modalService=x(li),this.roleService=x(we),this.dialogVisible=b(!1),this.categoryNodes=b([]),this.fb=x(be),this.injector=x(Ut),this.isDialogFilterVisible=b(!1)}initializeFilterEffect(){We(()=>{this.store.filter()&&this.generateFilterForm()},{injector:this.injector})}generateFilterForm(){let e=this.store.filter();this.formFilter=this.fb.group({outletID:this.fb.control(e.listOutletID||[]),categoryID:this.fb.control(null),pageSize:this.fb.control(e.PageSize),discontinued:this.fb.control(e.Discontinued),accessLevel:this.fb.control(e.AccessLevel)})}onPageChange(e){console.log("Page changed to: ",e),this.store.updateFilter(I(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(I(C({},this.store.filter()),{Text:e}))}updateFilter(e,i){this.store.updateFilter(I(C({},this.store.filter()),{[e]:i}))}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(I(C({},this.store.filter()),{PageNumber:1,Text:e.trim()}))}onFilterEvent(){this.dialogVisible.update(e=>!e)}onFilterOKEvent(){let{categoryID:e,pageSize:i,outletID:n,discontinued:o,accessLevel:d}=this.formFilter.value;this.store.updateFilter(I(C({},this.store.filter()),{listOutletID:n,CategoryID:e?e.key:"",PageSize:+i,Discontinued:o,AccessLevel:d})),this.isDialogFilterVisible.update(f=>!f)}onExport(){let e=I(C({},this.store.filter()),{ExportPageNumber:1,ExportPageSize:1e4});this.#e.exportChartOfAccounts(e).pipe(A(i=>{let n=i.headers;console.log("All headers:",n.keys());let o=n.get("Content-Disposition"),d=n.get("content-disposition"),f=o??d,v="download.csv";if(f){let q=f.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);q&&q[1]&&(v=decodeURIComponent(q[1].replace(/"/g,"")))}let k=i.body;Ki(k,v,k.type)})).subscribe()}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=M({type:t,selectors:[["app-cash-of-account",8,"page"]],features:[he([Ft])],attrs:Sn,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(i,n){if(i&1){let o=w();a(0,"app-main-panel",7),S("search",function(f){return _(o),g(n.onSearchEvent(f))}),Qe("isDialogFilterVisibleChange",function(f){return _(o),Ze(n.isDialogFilterVisible,f)||(n.isDialogFilterVisible=f),g(f)}),S("filterEmitted",function(){return _(o),g(n.onFilterEvent())})("filterConfirmed",function(){return _(o),g(n.onFilterOKEvent())}),u(1,Fn,6,4,"ng-template",null,0,y)(3,$n,10,5,"ng-template",null,1,y)(5,qn,1,1,"ng-template",null,2,y),r()}i&2&&(l("isSearchableInput",!0),je("isDialogFilterVisible",n.isDialogFilterVisible),l("isFilterable",!0)("scrollable",!0))},dependencies:[F,z,O,Xe,$,si,ft,ut,_t,Se,ai,oe,Y,Ie,L,B,Te,ye,ve,et,Vi,Fi,Li,Ni,K,Mi,le,ae,mt,ct,ot,nt,_e,Bi,Ri,Pe,Ee,ce,se,dt,pt],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 Gn=["class","page"],Hn=()=>["../../"],Nt=t=>({"ng-invalid ng-dirty":t}),Un=t=>({"ng-dirty ng-invalid":t});function jn(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 n=m();return g(n.onSubmit())}),r()()}t&2&&(c(),l("routerLink",R(1,Hn)))}function Zn(t,s){t&1&&(a(0,"div",34),p(1," Name is required "),r())}function Qn(t,s){if(t&1&&(a(0,"div"),u(1,Zn,2,0,"div",33),r()),t&2){let e=m(2);c(),l("ngIf",e.form.controls.Name.errors.required)}}function Wn(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 Yn(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 Xn(t,s){t&1&&(a(0,"div",34),p(1," Code is required "),r())}function Jn(t,s){if(t&1&&(a(0,"div"),u(1,Xn,2,0,"div",33),r()),t&2){let e=m(2);c(),l("ngIf",e.form.controls.Code.errors.required)}}function eo(t,s){t&1&&(a(0,"div",34),p(1," Note is required "),r())}function to(t,s){if(t&1&&(a(0,"div"),u(1,eo,2,0,"div",33),r()),t&2){let e=m(2);c(),l("ngIf",e.form.controls.Note.errors.required)}}function io(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 oo(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 ro(t,s){t&1&&(a(0,"div",34),p(1," Note is required "),r())}function ao(t,s){if(t&1&&(a(0,"div"),u(1,ro,2,0,"div",33),r()),t&2){let e=m(2);c(),l("ngIf",e.form.controls.Note.errors.required)}}function lo(t,s){t&1&&(a(0,"div",34),p(1," Note is required "),r())}function so(t,s){if(t&1&&(a(0,"div"),u(1,lo,2,0,"div",33),r()),t&2){let e=m(2);c(),l("ngIf",e.form.controls.Note.errors.required)}}function co(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,Qn,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,Wn,3,0,"ng-template",null,2,y),r(),a(17,"p-select",19),u(18,Yn,2,2,"ng-template",null,3,y),r()()(),a(20,"div",10)(21,"div",11)(22,"div",12)(23,"label",13),p(24,"Code"),r(),h(25,"input",20),u(26,Jn,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,to,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,io,1,1,"ng-template",29),r(),u(48,oo,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,ao,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,so,2,1,"div",15),r()(),h(64,"div",11),r()()()),t&2){let e=te(16),i=m();l("formGroup",i.form),c(7),l("ngClass",T(21,Nt,i.form.controls.Name.invalid&&(i.form.controls.Name.dirty||i.form.controls.Name.touched))),c(),l("ngIf",i.form.controls.Name.invalid&&(i.form.controls.Name.dirty||i.form.controls.Name.touched)),c(5),l("pTooltip",e),c(4),l("fluid",!0)("options",i.outlets()),c(8),l("ngClass",T(23,Nt,i.form.controls.Code.invalid&&(i.form.controls.Code.dirty||i.form.controls.Code.touched))),c(),l("ngIf",i.form.controls.Code.invalid&&(i.form.controls.Code.dirty||i.form.controls.Code.touched)),c(7),l("value",!1),c(4),l("value",!0),c(3),l("ngIf",i.form.controls.Note.errors),c(6),l("fluid",!0)("options",i.categoryOptions())("ngClass",T(25,Un,i.form.controls.Category.invalid&&(i.form.controls.Category.dirty||i.form.controls.Category.touched))),c(2),l("ngIf",i.form.controls.Category.invalid&&(i.form.controls.Category.dirty||i.form.controls.Category.touched)),c(7),l("options",i.accessTypes())("fluid",!0),c(),l("ngIf",i.form.controls.Note.errors),c(6),l("ngClass",T(27,Nt,i.form.controls.Note.invalid&&(i.form.controls.Note.dirty||i.form.controls.Note.touched)))("autoResize",!0),c(),l("ngIf",i.form.controls.Note.errors)}}var Vt=(()=>{class t{constructor(){this.route=x(ie),this.coa_service=x(X),this.coa_info=b(null),this.fb=x(be),this.isEdit=b(!1),this.categoryOptions=b([]),this.router=x(ne),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((i,n)=>I(C({},i),{description:e[n]})):[]})}findParenChilds(e,i){function n(o,d=null){for(let f of o){if(f.key===i)return{parent:d,child:f};if(f.children){let v=n(f.children,f);if(v)return v}}return null}return n(e)}generateForm(e){this.form=this.fb.group({ID:new N(e.id||""),Name:new N(e.name||"",[fe.required]),Code:new N(e.code||"",[fe.required]),Note:new N(e.note||"",[]),Balance:new N(e.balance||0),Outlet:new N(e.outletID||""),AccessType:new N(e.accessTypeID||0),Category:new N(null,[fe.required]),Bin:new N(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 i=e.get("id");return this.coa_service.getChartAccountFormById(i)}else return this.coa_service.getChartAccountForm()}),V("response"),G(e=>I(C({},e),{form:I(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:i,Category:n,Code:o,Name:d,Note:f,Outlet:v}=this.form.value,k;this.hasIdParam?k={id:this.coa_info().form.id,categoryID:n.key,name:d,bin:this.form.value.Bin||!1,code:o,note:f,outletID:v||null,balance:i,accessTypeID:e}:k={id:this.coa_info().form.id,categoryID:n.key,bin:this.form.value.Bin||!1,name:d,code:o,note:f,outletID:v||null,balance:i,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 i=this.findParenChilds(this.categoryOptions(),this.coa_info()?.form?.categoryID);this.form.controls.Category.setValue(i?.child)})).subscribe()}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=M({type:t,selectors:[["app-coa-account-form",8,"page"]],attrs:Gn,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(i,n){i&1&&(a(0,"app-main-panel",4),u(1,jn,4,2,"ng-template",null,0,y)(3,co,65,29,"ng-template",null,1,y),r()),i&2&&l("hasMainWrapperPadding",!0)},dependencies:[$,Te,oe,Y,Ie,ye,ve,_t,F,z,O,L,B,Pe,Ee,Ae,K,ot,nt,zi,qi,mt,ct,_e,rt,le,ae,ce,se,dt,pt],styles:["[_nghost-%COMP%]{display:block}[_nghost-%COMP%] .p-treeselect{width:100%!important}"],changeDetection:0})}}return t})();var mo=["sublist"],po=(t,s)=>({"p-contextmenu-submenu":t,"p-contextmenu-root-list":s}),uo=()=>({"p-contextmenu-item-link":!0}),Yi=()=>({class:"p-contextmenu-submenu-icon"}),fo=()=>({exact:!1}),_o=t=>({"p-contextmenu-item-link":!0,"p-disabled":t}),go=t=>({$implicit:t});function ho(t,s){if(t&1&&h(0,"li",8),t&2){let e=m().$implicit,i=m(2);He(i.getItemProp(e,"style")),l("ngClass",i.getSeparatorItemClass(e)),P("id",i.getItemId(e))("data-pc-section","separator")}}function xo(t,s){if(t&1&&h(0,"span",19),t&2){let e=m(4).$implicit,i=m(2);l("ngClass",i.getItemProp(e,"icon"))("ngStyle",i.getItemProp(e,"iconStyle")),P("data-pc-section","icon")("aria-hidden",!0)("tabindex",-1)}}function Co(t,s){if(t&1&&(a(0,"span",20),p(1),r()),t&2){let e=m(4).$implicit,i=m(2);P("data-pc-section","label"),c(),Q(" ",i.getItemLabel(e)," ")}}function Io(t,s){if(t&1&&h(0,"span",21),t&2){let e=m(4).$implicit,i=m(2);l("innerHTML",i.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,i=m(2);l("styleClass",i.getItemProp(e,"badgeStyleClass"))("value",i.getItemProp(e,"badge"))}}function vo(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 So(t,s){t&1&&u(0,bo,0,0,"ng-template",25),t&2&&l("data-pc-section","submenuicon")("aria-hidden",!0)}function To(t,s){if(t&1&&(H(0),u(1,vo,1,4,"AngleRightIcon",23)(2,So,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,Yi))}}function Ao(t,s){if(t&1&&(a(0,"a",15),u(1,xo,1,5,"span",16)(2,Co,2,2,"span",17)(3,Io,1,2,"ng-template",null,2,y)(5,yo,1,2,"p-badge",18)(6,To,3,4,"ng-container",11),r()),t&2){let e=te(4),i=m(3).$implicit,n=m(2);l("target",n.getItemProp(i,"target"))("ngClass",R(12,uo)),P("href",n.getItemProp(i,"url"),jt)("aria-hidden",!0)("data-automationid",n.getItemProp(i,"automationId"))("data-pc-section","action")("tabindex",-1),c(),l("ngIf",n.getItemProp(i,"icon")),c(),l("ngIf",n.getItemProp(i,"escape"))("ngIfElse",e),c(3),l("ngIf",n.getItemProp(i,"badge")),c(),l("ngIf",n.isItemGroup(i))}}function wo(t,s){if(t&1&&h(0,"span",19),t&2){let e=m(4).$implicit,i=m(2);l("ngClass",i.getItemProp(e,"icon"))("ngStyle",i.getItemProp(e,"iconStyle")),P("data-pc-section","icon")("aria-hidden",!0)("tabindex",-1)}}function Eo(t,s){if(t&1&&(a(0,"span",20),p(1),r()),t&2){let e=m(4).$implicit,i=m(2);P("data-pc-section","label"),c(),Q(" ",i.getItemLabel(e)," ")}}function Po(t,s){if(t&1&&h(0,"span",21),t&2){let e=m(4).$implicit,i=m(2);l("innerHTML",i.getItemLabel(e),Me),P("data-pc-section","label")}}function ko(t,s){if(t&1&&h(0,"p-badge",22),t&2){let e=m(4).$implicit,i=m(2);l("styleClass",i.getItemProp(e,"badgeStyleClass"))("value",i.getItemProp(e,"badge"))}}function Mo(t,s){t&1&&h(0,"AngleRightIcon"),t&2&&(Fe("p-contextmenu-submenu-icon"),P("data-pc-section","submenuicon")("aria-hidden",!0))}function Oo(t,s){}function Fo(t,s){t&1&&u(0,Oo,0,0,"ng-template",25),t&2&&l("data-pc-section","submenuicon")("aria-hidden",!0)}function Lo(t,s){if(t&1&&(H(0),u(1,Mo,1,4,"AngleRightIcon",23)(2,Fo,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,Yi))}}function No(t,s){if(t&1&&(a(0,"a",26),u(1,wo,1,5,"span",16)(2,Eo,2,2,"span",17)(3,Po,1,2,"ng-template",null,2,y)(5,ko,1,2,"p-badge",18)(6,Lo,3,4,"ng-container",11),r()),t&2){let e=te(4),i=m(3).$implicit,n=m(2);l("routerLink",n.getItemProp(i,"routerLink"))("queryParams",n.getItemProp(i,"queryParams"))("routerLinkActiveOptions",n.getItemProp(i,"routerLinkActiveOptions")||R(20,fo))("target",n.getItemProp(i,"target"))("ngClass",T(21,_o,n.getItemProp(i,"disabled")))("fragment",n.getItemProp(i,"fragment"))("queryParamsHandling",n.getItemProp(i,"queryParamsHandling"))("preserveFragment",n.getItemProp(i,"preserveFragment"))("skipLocationChange",n.getItemProp(i,"skipLocationChange"))("replaceUrl",n.getItemProp(i,"replaceUrl"))("state",n.getItemProp(i,"state")),P("data-automationid",n.getItemProp(i,"automationId"))("tabindex",-1)("aria-hidden",!0)("data-pc-section","action"),c(),l("ngIf",n.getItemProp(i,"icon")),c(),l("ngIf",n.getItemProp(i,"escape"))("ngIfElse",e),c(3),l("ngIf",n.getItemProp(i,"badge")),c(),l("ngIf",n.isItemGroup(i))}}function Vo(t,s){if(t&1&&(H(0),u(1,Ao,7,13,"a",13)(2,No,7,23,"a",14),U()),t&2){let e=m(2).$implicit,i=m(2);c(),l("ngIf",!i.getItemProp(e,"routerLink")),c(),l("ngIf",i.getItemProp(e,"routerLink"))}}function Do(t,s){}function Ro(t,s){t&1&&u(0,Do,0,0,"ng-template")}function Bo(t,s){if(t&1&&(H(0),u(1,Ro,1,0,null,24),U()),t&2){let e=m(2).$implicit,i=m(2);c(),l("ngTemplateOutlet",i.itemTemplate)("ngTemplateOutletContext",T(2,go,e.item))}}function $o(t,s){if(t&1){let e=w();a(0,"p-contextmenu-sub",27),S("itemClick",function(n){_(e);let o=m(4);return g(o.itemClick.emit(n))})("itemMouseEnter",function(n){_(e);let o=m(4);return g(o.onItemMouseEnter(n))}),r()}if(t&2){let e=m(2).$implicit,i=m(2);l("items",e.items)("itemTemplate",i.itemTemplate)("menuId",i.menuId)("visible",i.isItemActive(e)&&i.isItemGroup(e))("activeItemPath",i.activeItemPath)("focusedItemId",i.focusedItemId)("level",i.level+1)}}function Ko(t,s){if(t&1){let e=w();a(0,"li",9,1)(2,"div",10),S("click",function(n){_(e);let o=m().$implicit,d=m(2);return g(d.onItemClick(n,o))})("mouseenter",function(n){_(e);let o=m().$implicit,d=m(2);return g(d.onItemMouseEnter({$event:n,processedItem:o}))}),u(3,Vo,3,2,"ng-container",11)(4,Bo,2,4,"ng-container",11),r(),u(5,$o,1,7,"p-contextmenu-sub",12),r()}if(t&2){let e=m(),i=e.$implicit,n=e.index,o=m(2);Fe(o.getItemProp(i,"styleClass")),l("ngStyle",o.getItemProp(i,"style"))("ngClass",o.getItemClass(i))("tooltipOptions",o.getItemProp(i,"tooltipOptions")),P("id",o.getItemId(i))("data-pc-section","menuitem")("data-p-highlight",o.isItemActive(i))("data-p-focused",o.isItemFocused(i))("data-p-disabled",o.isItemDisabled(i))("aria-label",o.getItemLabel(i))("aria-disabled",o.isItemDisabled(i)||void 0)("aria-haspopup",o.isItemGroup(i)&&!o.getItemProp(i,"to")?"menu":void 0)("aria-expanded",o.isItemGroup(i)?o.isItemActive(i):void 0)("aria-level",o.level+1)("aria-setsize",o.getAriaSetSize())("aria-posinset",o.getAriaPosInset(n)),c(2),P("data-pc-section","content"),c(),l("ngIf",!o.itemTemplate),c(),l("ngIf",o.itemTemplate),c(),l("ngIf",o.isItemVisible(i)&&o.isItemGroup(i))}}function qo(t,s){if(t&1&&u(0,ho,1,5,"li",6)(1,Ko,6,21,"li",7),t&2){let e=s.$implicit,i=m(2);l("ngIf",i.isItemVisible(e)&&i.getItemProp(e,"separator")),c(),l("ngIf",i.isItemVisible(e)&&!i.getItemProp(e,"separator"))}}function zo(t,s){if(t&1){let e=w();a(0,"ul",4,0),S("@overlayAnimation.start",function(n){_(e);let o=te(1),d=m();return g(d.onEnter(n,o))})("keydown",function(n){_(e);let o=m();return g(o.menuKeydown.emit(n))})("focus",function(n){_(e);let o=m();return g(o.menuFocus.emit(n))})("blur",function(n){_(e);let o=m();return g(o.menuBlur.emit(n))}),u(2,qo,2,2,"ng-template",5),r()}if(t&2){let e=m();l("ngClass",ei(10,po,!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 Go=["item"],Ho=["submenuicon"],Uo=["rootmenu"],jo=["container"],Zo=t=>({"p-contextmenu p-component":!0,"p-contextmenu-mobile":t}),Qo=()=>({value:"visible"});function Wo(t,s){if(t&1){let e=w();a(0,"div",3,0),S("@overlayAnimation.start",function(n){_(e);let o=m();return g(o.onOverlayAnimationStart(n))})("@overlayAnimation.done",function(n){_(e);let o=m();return g(o.onOverlayAnimationEnd(n))}),a(2,"p-contextmenu-sub",4,1),S("itemClick",function(n){_(e);let o=m();return g(o.onItemClick(n))})("menuFocus",function(n){_(e);let o=m();return g(o.onMenuFocus(n))})("menuBlur",function(n){_(e);let o=m();return g(o.onMenuBlur(n))})("menuKeydown",function(n){_(e);let o=m();return g(o.onKeyDown(n))})("itemMouseEnter",function(n){_(e);let o=m();return g(o.onItemMouseEnter(n))}),r()()}if(t&2){let e=m();Fe(e.styleClass),l("ngClass",T(20,Zo,e.queryMatches))("ngStyle",e.style)("@overlayAnimation",R(22,Qo)),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 Yo=({dt:t})=>`
|
|
1
|
+
import{a as _t}from"./chunk-KIBBRAL5.js";import{a as Gi}from"./chunk-XKI7WLHE.js";import{a as Di}from"./chunk-HG5MKVNR.js";import{a as $i,b as Ee,c as Pe,d as Ki}from"./chunk-B54PFCWI.js";import{a as Ri,b as Bi}from"./chunk-N4JIPI53.js";import"./chunk-7DYACF4D.js";import"./chunk-NZN6QJR3.js";import{a as ut,b as ft}from"./chunk-KGQGMXW6.js";import{a as qi,b as zi}from"./chunk-EB6NEJHF.js";import{a as we}from"./chunk-5CZNOXPC.js";import"./chunk-IGWIRCAS.js";import{a as lt,b as st}from"./chunk-3A4BFUGD.js";import{a as pt,b as dt,c as Oi,d as Fi,i as Li,j as Ni,k as Vi}from"./chunk-EL5BUFMO.js";import"./chunk-EQ4PLHI4.js";import"./chunk-H7Q35Y7G.js";import"./chunk-R7N6BWL5.js";import{a as X}from"./chunk-A3XYHEBB.js";import{a as V}from"./chunk-QF4D5YPK.js";import{b as Si}from"./chunk-VJ3IBUVO.js";import{a as bi}from"./chunk-2AAVNIG7.js";import{a as ct,b as mt}from"./chunk-LFZCMZAP.js";import"./chunk-6A2KUPOG.js";import"./chunk-36OX4S7M.js";import"./chunk-Q5CVMJZC.js";import"./chunk-3GGXPPQT.js";import"./chunk-MFK5RQPJ.js";import{a as at,b as K}from"./chunk-KJ2WX3FC.js";import"./chunk-6GN3MGBY.js";import"./chunk-Q24GCSGD.js";import{f as Mi,h as $}from"./chunk-Y2PXP5OT.js";import{b as rt,c as _e}from"./chunk-VGNJD35F.js";import{a as se,b as ce}from"./chunk-2XUSZCQL.js";import{a as J,b as Ai,c as wi,e as Ei,f as Pi,g as ki}from"./chunk-YV2QJ63P.js";import{c as et,d as li,f as si}from"./chunk-ARH3WEEF.js";import{a as wt,f as Et,n as nt,o as ot,p as vi,t as Ti,u as Pt,w as ae,x as le}from"./chunk-H6HNANYB.js";import"./chunk-2D2YD753.js";import{Aa as hi,D as bt,Da as xi,I as ci,Ia as Ci,K as mi,La as Ae,M as pi,Ma as De,Oa as yi,Q as tt,R as it,Ua as Ii,W as di,X as vt,_ as ui,b as oe,c as fe,da as fi,e as Y,f as ye,g as ri,ga as _i,i as N,j as Je,k as ai,ka as gi,l as Ie,na as St,o as be,qa as re,u as ve,va as Tt,w as Se,wa as At,x as Te}from"./chunk-OIBDX2CA.js";import{b as ie,d as ne,e as B,l as L}from"./chunk-AOOG6YOT.js";import{a as oi}from"./chunk-R7TX5W65.js";import"./chunk-2MKKFLNJ.js";import{h as z,j as Ye,k as O,l as Ct,m as ii,p as ni,q as Xe,s as F,t as Le}from"./chunk-VZ5CMS5O.js";import{c as yt,d as It,f as Ne,h as Ve}from"./chunk-F2X3VGZZ.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 ei,Ha as v,J as qe,Kb as P,L as qt,Lb as l,Nc as de,Ob as He,Oc as xe,P as zt,Pb as Fe,Pc as ti,Qb as Qt,Rb as Wt,Rc as I,Tb as Yt,Ub as Xt,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 Gt,bd as W,c as $e,ca as ze,cb as Me,cd as We,da as Ht,db as jt,ec as S,fc as m,hb as c,ia as x,kc as Ue,lc as pe,mc as j,nb as xt,nc as Z,qa as _,qc as te,ra as g,rc as p,s as G,sc as E,t as Kt,tc as Q,ua as Ge,vc as Jt,wa as Ut,wc as je,xb as M,xc as Ze,yb as Zt,yc as Qe}from"./chunk-NMCKMUY4.js";import{a as C,b as y}from"./chunk-YQFG5XE2.js";var on=["class","page"],rn=t=>({id:t}),an=()=>({"overflow-x":"auto"}),ln=t=>({"table-borderless":t}),sn=t=>["fa-solid",t],cn=t=>["/pages/journal/journal-entry/",t];function mn(t,s){t&1&&h(0,"p-button",8)}function pn(t,s){if(t&1){let e=w();a(0,"p-button",9),S("onClick",function(){_(e);let n=m(2);return g(n.onDelete())}),r()}}function dn(t,s){if(t&1&&(a(0,"div",4)(1,"p-button-group"),u(2,mn,1,0,"p-button",5)(3,pn,1,0,"p-button",6),r(),a(4,"a",7),p(5,"Ledger"),r()()),t&2){let e,i=m();c(2),l("ngIf",i.roleService.coa().edit),c(),l("ngIf",i.roleService.coa().delete),c(),l("queryParams",T(3,rn,(e=i.COAInfo())==null?null:e.id))}}function un(t,s){if(t&1&&h(0,"i",25),t&2){let e=s.checked;l("ngClass",T(1,sn,e?"fa-check":"fa-xmark"))}}function fn(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 _n(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 gn(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,fn,3,3,"ng-container",29),r(),a(10,"td",30),u(11,_n,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(ti(3,6,e.date,"dd MMM yyyy")),c(4),l("routerLink",T(11,cn,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 hn(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 xn(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(n){_(e);let o=m(2);return g(o.onDiscontinued(n))}),u(34,un,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"),Yt(57,gn,15,13,"tr",null,Wt),u(59,hn,9,0,"tr"),r()()()()()}if(t&2){let e,i,n,o,d,f,b=m(2);c(8),E((e=b.COAInfo().name)!==null&&e!==void 0?e:"-"),c(5),E((i=b.COAInfo().code)!==null&&i!==void 0?i:"-"),c(5),E((n=b.COAInfo().category)!==null&&n!==void 0?n:"-"),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,an)),c(),l("ngClass",T(12,ln,b.COAInfo().transactions.length===0)),c(14),Xt(b.COAInfo().transactions),c(2),Qt(b.COAInfo().transactions.length===0?59:-1)}}function Cn(t,s){if(t&1&&(a(0,"div",10),u(1,xn,60,14,"div",11),r()),t&2){let e=m();c(),l("ngIf",e.COAInfo())}}var Hi=(()=>{class t{constructor(){this.#e=x(X),this.#t=x(ie),this.router=x(ne),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 i=[this.#t.snapshot.paramMap.get("id")];this.#e.deleteChartAccount(i).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(i){return new(i||t)}}static{this.\u0275cmp=M({type:t,selectors:[["app-coa-account-info",8,"page"]],attrs:on,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(i,n){i&1&&(a(0,"app-main-panel",3),u(1,dn,6,5,"ng-template",null,0,I)(3,Cn,2,1,"ng-template",null,1,I),r()),i&2&&l("overflowScroll",!0)},dependencies:[F,z,O,Xe,ni,Se,Y,Je,et,L,B,$,K,at,le,ae,ft,ut,Oi,Di],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(oi)}fetchCOACategories(){return this.httpService.get("","api/ChartOfAccount/Category")}getCOACategoryByID(e){let i={params:e};return this.httpService.get("","api/ChartOfAccount/CategoryInfo",i)}renameCategory(e,i){return this.httpService.put("",`api/ChartOfAccount/RenameCategory/${e}`,i)}updateParentCategory(e,i){return this.httpService.put("",`api/ChartOfAccount/UpdateParentCategory/${e}`,i).pipe()}deleteCategory(e){return this.httpService.delete("",`api/ChartOfAccount/Category/${e}`)}submitCategory(e,i={}){return this.httpService.post("","api/ChartOfAccount/SubmitCategory",e,i)}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275prov=ze({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Mt=t=>t?t.reduce((s,e)=>(s.push({label:e.label,data:e.data,key:e.key}),e.children&&e.children.length?s.push(...Mt(e.children)):s.push({label:`${e.label} (no children)`,data:e.data,key:`${e.key}-no-children`}),s),[]):[];var Ot=(t,s,e)=>{let i=Math.ceil(e/s),n=(t-1)*s+1,o=Math.min(t*s,e);return{start:n,end:o,totalRecords:e,totalPages:i}};var yn={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"}]},Ft=Ai(Pi(yn),ki("ChartOfAccount"),wi(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(()=>Mt(t.options.categories())),first:W(()=>{let{start:s}=Ot(t.filter().PageNumber,t.filter().PageSize,t.count());return s}),last:W(()=>{let{end:s}=Ot(t.filter().PageNumber,t.filter().PageSize,t.count());return s})})),Ei(t=>{let s=x(X),e=x(me),i={updateFilter(n){J(t,{filter:C({},n)})},checkedItem(n){if(Array.isArray(n))n.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=n,d=t.data().map(f=>f.id===o.id?y(C({},f),{checked:!o.checked}):f);J(t,{data:d})}},checkAllCheckbox(){let n=t.data().map(o=>y(C({},o),{checked:!o.checked}));J(t,{data:n})},fetchChartOfAccount:lt($e(Ke(()=>!!t.filter()),qt(300),zt(),D(n=>s.getPaginatedChartAccounts(n).pipe(G(o=>y(C({},o),{data:o.data.map(d=>y(C({},d),{checked:!1}))})),st({next:o=>J(t,{data:o.data,count:o.count}),error:o=>{J(t,{data:[],count:0}),console.error(o)}}))))),fetchLoader:lt($e(D(()=>s.getChartOfAccountLoader().pipe(st({next:n=>{J(t,{filter:y(C({},t.filter()),{PageSize:n.filter.pageSize,PageNumber:1,CategoryID:n.filter.categoryID||null,Text:"",listOutletID:[],AccessLevel:n.filter.accessLevel!==void 0?n.filter.accessLevel:t.filter().AccessLevel}),options:n.options}),i.fetchChartOfAccount(t.filter)},error:n=>{console.error(n)}}))))),getCategories:lt($e(qe(()=>e.fetchCOACategories().pipe(st({next:n=>{J(t,{options:y(C({},t.options()),{entities:t.options.entities(),categories:n})})},error:n=>{console.error(n)}})))))};return i}));var Sn=["class","page"],Tn=t=>["../account/",t],An=t=>({"text-decoration-line-through":t}),wn=()=>["/pages/report/general-ledger"],En=t=>({id:t});function Pn(t,s){if(t&1){let e=w();a(0,"p-button",13),S("onClick",function(){_(e);let n=m(2);return g(n.deleteCOA())}),r()}}function kn(t,s){t&1&&h(0,"p-button",14)}function Mn(t,s){if(t&1){let e=w();a(0,"p-button",15),S("onClick",function(){_(e);let n=m(2);return g(n.onExport())}),r()}}function On(t,s){t&1&&(a(0,"a",16),h(1,"i",17),p(2," Add"),r())}function Fn(t,s){if(t&1&&(a(0,"div",8),u(1,Pn,1,0,"p-button",9),a(2,"p-button-group"),u(3,kn,1,0,"p-button",10)(4,Mn,1,0,"p-button",11),r(),u(5,On,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 Ln(t,s){t&1&&(a(0,"th",21),h(1,"p-tableHeaderCheckbox"),r())}function Nn(t,s){if(t&1&&(a(0,"tr"),u(1,Ln,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 Vn(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 Dn(t,s){if(t&1&&(a(0,"tr"),u(1,Vn,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,i=s.$implicit,n=m(2);c(),l("ngIf",n.roleService.coa().delete),c(2),E(i.code),c(2),l("routerLink",T(12,Tn,i.id))("ngClass",T(14,An,i.bin)),c(),E(i.name),c(2),E(i.category),c(2),E(i.outletName),c(2),l("routerLink",R(16,wn))("queryParams",T(17,En,i.id)),c(),E(xe(14,10,(e=i.balance)!==null&&e!==void 0?e:0))}}function Rn(t,s){if(t&1&&p(0),t&2){let e=m(2);Jt(" Showing ",e.store.first()," to ",e.store.last()," of ",e.store.count()," entries ")}}function Bn(t,s){t&1&&(a(0,"tr")(1,"td",26)(2,"span"),p(3,"No records found."),r()()())}function $n(t,s){if(t&1){let e=w();a(0,"p-panel")(1,"p-table",18),S("onLazyLoad",function(n){_(e);let o=m();return g(o.loadData(n))})("onRowSelect",function(n){_(e);let o=m();return g(o.onRowSelect(n))})("onRowUnselect",function(n){_(e);let o=m();return g(o.onRowUnselect(n))})("onHeaderCheckboxToggle",function(n){_(e);let o=m();return g(o.onSelectAll(n))})("onPage",function(n){_(e);let o=m();return g(o.onPageChange(n))}),u(2,Nn,12,1,"ng-template",null,3,I)(4,Dn,15,19,"ng-template",null,4,I)(6,Rn,1,3,"ng-template",null,5,I)(8,Bn,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 Kn(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 n=m(2);return g(n.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)("options",e.store.options().accessLevels),c(10),l("value",0),c(4),l("value",1),c(4),l("value",2)}}function qn(t,s){if(t&1&&u(0,Kn,33,13,"form",27),t&2){let e=m();l("ngIf",e.formFilter)}}var ji=(()=>{class t{ngOnInit(){this.initializeFilterEffect(),this.store.fetchLoader()}#e;constructor(){this.routeInfo=Zi,this.store=x(Ft),this.#e=x(X),this.modalService=x(li),this.roleService=x(we),this.dialogVisible=v(!1),this.categoryNodes=v([]),this.fb=x(ve),this.injector=x(Ut),this.isDialogFilterVisible=v(!1)}initializeFilterEffect(){We(()=>{this.store.filter()&&this.generateFilterForm()},{injector:this.injector})}generateFilterForm(){let e=this.store.filter();this.formFilter=this.fb.group({outletID:this.fb.control(e.listOutletID||[]),categoryID:this.fb.control(null),pageSize:this.fb.control(e.PageSize),discontinued:this.fb.control(e.Discontinued),accessLevel:this.fb.control(e.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,i){this.store.updateFilter(y(C({},this.store.filter()),{[e]:i}))}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:i,outletID:n,discontinued:o,accessLevel:d}=this.formFilter.value;this.store.updateFilter(y(C({},this.store.filter()),{listOutletID:n,CategoryID:e?e.key:"",PageSize:+i,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(i=>{let n=i.headers;console.log("All headers:",n.keys());let o=n.get("Content-Disposition"),d=n.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=i.body;Ki(k,b,k.type)})).subscribe()}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=M({type:t,selectors:[["app-cash-of-account",8,"page"]],features:[he([Ft])],attrs:Sn,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","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(i,n){if(i&1){let o=w();a(0,"app-main-panel",7),S("search",function(f){return _(o),g(n.onSearchEvent(f))}),Qe("isDialogFilterVisibleChange",function(f){return _(o),Ze(n.isDialogFilterVisible,f)||(n.isDialogFilterVisible=f),g(f)}),S("filterEmitted",function(){return _(o),g(n.onFilterEvent())})("filterConfirmed",function(){return _(o),g(n.onFilterOKEvent())}),u(1,Fn,6,4,"ng-template",null,0,I)(3,$n,10,5,"ng-template",null,1,I)(5,qn,1,1,"ng-template",null,2,I),r()}i&2&&(l("isSearchableInput",!0),je("isDialogFilterVisible",n.isDialogFilterVisible),l("isFilterable",!0)("scrollable",!0))},dependencies:[F,z,O,Xe,$,si,ft,ut,_t,Se,ai,oe,Y,ye,L,B,Te,Ie,be,et,Vi,Fi,Li,Ni,K,Mi,le,ae,mt,ct,ot,nt,_e,Bi,Ri,Pe,Ee,ce,se,dt,pt],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 Gn=["class","page"],Hn=()=>["../../"],Nt=t=>({"ng-invalid ng-dirty":t}),Un=t=>({"ng-dirty ng-invalid":t});function jn(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 n=m();return g(n.onSubmit())}),r()()}t&2&&(c(),l("routerLink",R(1,Hn)))}function Zn(t,s){t&1&&(a(0,"div",34),p(1," Name is required "),r())}function Qn(t,s){if(t&1&&(a(0,"div"),u(1,Zn,2,0,"div",33),r()),t&2){let e=m(2);c(),l("ngIf",e.form.controls.Name.errors.required)}}function Wn(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 Yn(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 Xn(t,s){t&1&&(a(0,"div",34),p(1," Code is required "),r())}function Jn(t,s){if(t&1&&(a(0,"div"),u(1,Xn,2,0,"div",33),r()),t&2){let e=m(2);c(),l("ngIf",e.form.controls.Code.errors.required)}}function eo(t,s){t&1&&(a(0,"div",34),p(1," Note is required "),r())}function to(t,s){if(t&1&&(a(0,"div"),u(1,eo,2,0,"div",33),r()),t&2){let e=m(2);c(),l("ngIf",e.form.controls.Note.errors.required)}}function io(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 oo(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 ro(t,s){t&1&&(a(0,"div",34),p(1," Note is required "),r())}function ao(t,s){if(t&1&&(a(0,"div"),u(1,ro,2,0,"div",33),r()),t&2){let e=m(2);c(),l("ngIf",e.form.controls.Note.errors.required)}}function lo(t,s){t&1&&(a(0,"div",34),p(1," Note is required "),r())}function so(t,s){if(t&1&&(a(0,"div"),u(1,lo,2,0,"div",33),r()),t&2){let e=m(2);c(),l("ngIf",e.form.controls.Note.errors.required)}}function co(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,Qn,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,Wn,3,0,"ng-template",null,2,I),r(),a(17,"p-select",19),u(18,Yn,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,Jn,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,to,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,io,1,1,"ng-template",29),r(),u(48,oo,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,ao,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,so,2,1,"div",15),r()(),h(64,"div",11),r()()()),t&2){let e=te(16),i=m();l("formGroup",i.form),c(7),l("ngClass",T(21,Nt,i.form.controls.Name.invalid&&(i.form.controls.Name.dirty||i.form.controls.Name.touched))),c(),l("ngIf",i.form.controls.Name.invalid&&(i.form.controls.Name.dirty||i.form.controls.Name.touched)),c(5),l("pTooltip",e),c(4),l("fluid",!0)("options",i.outlets()),c(8),l("ngClass",T(23,Nt,i.form.controls.Code.invalid&&(i.form.controls.Code.dirty||i.form.controls.Code.touched))),c(),l("ngIf",i.form.controls.Code.invalid&&(i.form.controls.Code.dirty||i.form.controls.Code.touched)),c(7),l("value",!1),c(4),l("value",!0),c(3),l("ngIf",i.form.controls.Note.errors),c(6),l("fluid",!0)("options",i.categoryOptions())("ngClass",T(25,Un,i.form.controls.Category.invalid&&(i.form.controls.Category.dirty||i.form.controls.Category.touched))),c(2),l("ngIf",i.form.controls.Category.invalid&&(i.form.controls.Category.dirty||i.form.controls.Category.touched)),c(7),l("options",i.accessTypes())("fluid",!0),c(),l("ngIf",i.form.controls.Note.errors),c(6),l("ngClass",T(27,Nt,i.form.controls.Note.invalid&&(i.form.controls.Note.dirty||i.form.controls.Note.touched)))("autoResize",!0),c(),l("ngIf",i.form.controls.Note.errors)}}var Vt=(()=>{class t{constructor(){this.route=x(ie),this.coa_service=x(X),this.coa_info=v(null),this.fb=x(ve),this.isEdit=v(!1),this.categoryOptions=v([]),this.router=x(ne),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((i,n)=>y(C({},i),{description:e[n]})):[]})}findParenChilds(e,i){function n(o,d=null){for(let f of o){if(f.key===i)return{parent:d,child:f};if(f.children){let b=n(f.children,f);if(b)return b}}return null}return n(e)}generateForm(e){this.form=this.fb.group({ID:new N(e.id||""),Name:new N(e.name||"",[fe.required]),Code:new N(e.code||"",[fe.required]),Note:new N(e.note||"",[]),Balance:new N(e.balance||0),Outlet:new N(e.outletID||""),AccessType:new N(e.accessTypeID||0),Category:new N(null,[fe.required]),Bin:new N(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 i=e.get("id");return this.coa_service.getChartAccountFormById(i)}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:i,Category:n,Code:o,Name:d,Note:f,Outlet:b}=this.form.value,k;this.hasIdParam?k={id:this.coa_info().form.id,categoryID:n.key,name:d,bin:this.form.value.Bin||!1,code:o,note:f,outletID:b||null,balance:i,accessTypeID:e}:k={id:this.coa_info().form.id,categoryID:n.key,bin:this.form.value.Bin||!1,name:d,code:o,note:f,outletID:b||null,balance:i,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 i=this.findParenChilds(this.categoryOptions(),this.coa_info()?.form?.categoryID);this.form.controls.Category.setValue(i?.child)})).subscribe()}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=M({type:t,selectors:[["app-coa-account-form",8,"page"]],attrs:Gn,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(i,n){i&1&&(a(0,"app-main-panel",4),u(1,jn,4,2,"ng-template",null,0,I)(3,co,65,29,"ng-template",null,1,I),r()),i&2&&l("hasMainWrapperPadding",!0)},dependencies:[$,Te,oe,Y,ye,Ie,be,_t,F,z,O,L,B,Pe,Ee,Ae,K,ot,nt,zi,qi,mt,ct,_e,rt,le,ae,ce,se,dt,pt],styles:["[_nghost-%COMP%]{display:block}[_nghost-%COMP%] .p-treeselect{width:100%!important}"],changeDetection:0})}}return t})();var mo=["sublist"],po=(t,s)=>({"p-contextmenu-submenu":t,"p-contextmenu-root-list":s}),uo=()=>({"p-contextmenu-item-link":!0}),Yi=()=>({class:"p-contextmenu-submenu-icon"}),fo=()=>({exact:!1}),_o=t=>({"p-contextmenu-item-link":!0,"p-disabled":t}),go=t=>({$implicit:t});function ho(t,s){if(t&1&&h(0,"li",8),t&2){let e=m().$implicit,i=m(2);He(i.getItemProp(e,"style")),l("ngClass",i.getSeparatorItemClass(e)),P("id",i.getItemId(e))("data-pc-section","separator")}}function xo(t,s){if(t&1&&h(0,"span",19),t&2){let e=m(4).$implicit,i=m(2);l("ngClass",i.getItemProp(e,"icon"))("ngStyle",i.getItemProp(e,"iconStyle")),P("data-pc-section","icon")("aria-hidden",!0)("tabindex",-1)}}function Co(t,s){if(t&1&&(a(0,"span",20),p(1),r()),t&2){let e=m(4).$implicit,i=m(2);P("data-pc-section","label"),c(),Q(" ",i.getItemLabel(e)," ")}}function yo(t,s){if(t&1&&h(0,"span",21),t&2){let e=m(4).$implicit,i=m(2);l("innerHTML",i.getItemLabel(e),Me),P("data-pc-section","label")}}function Io(t,s){if(t&1&&h(0,"p-badge",22),t&2){let e=m(4).$implicit,i=m(2);l("styleClass",i.getItemProp(e,"badgeStyleClass"))("value",i.getItemProp(e,"badge"))}}function bo(t,s){t&1&&h(0,"AngleRightIcon"),t&2&&(Fe("p-contextmenu-submenu-icon"),P("data-pc-section","submenuicon")("aria-hidden",!0))}function vo(t,s){}function So(t,s){t&1&&u(0,vo,0,0,"ng-template",25),t&2&&l("data-pc-section","submenuicon")("aria-hidden",!0)}function To(t,s){if(t&1&&(H(0),u(1,bo,1,4,"AngleRightIcon",23)(2,So,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,Yi))}}function Ao(t,s){if(t&1&&(a(0,"a",15),u(1,xo,1,5,"span",16)(2,Co,2,2,"span",17)(3,yo,1,2,"ng-template",null,2,I)(5,Io,1,2,"p-badge",18)(6,To,3,4,"ng-container",11),r()),t&2){let e=te(4),i=m(3).$implicit,n=m(2);l("target",n.getItemProp(i,"target"))("ngClass",R(12,uo)),P("href",n.getItemProp(i,"url"),jt)("aria-hidden",!0)("data-automationid",n.getItemProp(i,"automationId"))("data-pc-section","action")("tabindex",-1),c(),l("ngIf",n.getItemProp(i,"icon")),c(),l("ngIf",n.getItemProp(i,"escape"))("ngIfElse",e),c(3),l("ngIf",n.getItemProp(i,"badge")),c(),l("ngIf",n.isItemGroup(i))}}function wo(t,s){if(t&1&&h(0,"span",19),t&2){let e=m(4).$implicit,i=m(2);l("ngClass",i.getItemProp(e,"icon"))("ngStyle",i.getItemProp(e,"iconStyle")),P("data-pc-section","icon")("aria-hidden",!0)("tabindex",-1)}}function Eo(t,s){if(t&1&&(a(0,"span",20),p(1),r()),t&2){let e=m(4).$implicit,i=m(2);P("data-pc-section","label"),c(),Q(" ",i.getItemLabel(e)," ")}}function Po(t,s){if(t&1&&h(0,"span",21),t&2){let e=m(4).$implicit,i=m(2);l("innerHTML",i.getItemLabel(e),Me),P("data-pc-section","label")}}function ko(t,s){if(t&1&&h(0,"p-badge",22),t&2){let e=m(4).$implicit,i=m(2);l("styleClass",i.getItemProp(e,"badgeStyleClass"))("value",i.getItemProp(e,"badge"))}}function Mo(t,s){t&1&&h(0,"AngleRightIcon"),t&2&&(Fe("p-contextmenu-submenu-icon"),P("data-pc-section","submenuicon")("aria-hidden",!0))}function Oo(t,s){}function Fo(t,s){t&1&&u(0,Oo,0,0,"ng-template",25),t&2&&l("data-pc-section","submenuicon")("aria-hidden",!0)}function Lo(t,s){if(t&1&&(H(0),u(1,Mo,1,4,"AngleRightIcon",23)(2,Fo,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,Yi))}}function No(t,s){if(t&1&&(a(0,"a",26),u(1,wo,1,5,"span",16)(2,Eo,2,2,"span",17)(3,Po,1,2,"ng-template",null,2,I)(5,ko,1,2,"p-badge",18)(6,Lo,3,4,"ng-container",11),r()),t&2){let e=te(4),i=m(3).$implicit,n=m(2);l("routerLink",n.getItemProp(i,"routerLink"))("queryParams",n.getItemProp(i,"queryParams"))("routerLinkActiveOptions",n.getItemProp(i,"routerLinkActiveOptions")||R(20,fo))("target",n.getItemProp(i,"target"))("ngClass",T(21,_o,n.getItemProp(i,"disabled")))("fragment",n.getItemProp(i,"fragment"))("queryParamsHandling",n.getItemProp(i,"queryParamsHandling"))("preserveFragment",n.getItemProp(i,"preserveFragment"))("skipLocationChange",n.getItemProp(i,"skipLocationChange"))("replaceUrl",n.getItemProp(i,"replaceUrl"))("state",n.getItemProp(i,"state")),P("data-automationid",n.getItemProp(i,"automationId"))("tabindex",-1)("aria-hidden",!0)("data-pc-section","action"),c(),l("ngIf",n.getItemProp(i,"icon")),c(),l("ngIf",n.getItemProp(i,"escape"))("ngIfElse",e),c(3),l("ngIf",n.getItemProp(i,"badge")),c(),l("ngIf",n.isItemGroup(i))}}function Vo(t,s){if(t&1&&(H(0),u(1,Ao,7,13,"a",13)(2,No,7,23,"a",14),U()),t&2){let e=m(2).$implicit,i=m(2);c(),l("ngIf",!i.getItemProp(e,"routerLink")),c(),l("ngIf",i.getItemProp(e,"routerLink"))}}function Do(t,s){}function Ro(t,s){t&1&&u(0,Do,0,0,"ng-template")}function Bo(t,s){if(t&1&&(H(0),u(1,Ro,1,0,null,24),U()),t&2){let e=m(2).$implicit,i=m(2);c(),l("ngTemplateOutlet",i.itemTemplate)("ngTemplateOutletContext",T(2,go,e.item))}}function $o(t,s){if(t&1){let e=w();a(0,"p-contextmenu-sub",27),S("itemClick",function(n){_(e);let o=m(4);return g(o.itemClick.emit(n))})("itemMouseEnter",function(n){_(e);let o=m(4);return g(o.onItemMouseEnter(n))}),r()}if(t&2){let e=m(2).$implicit,i=m(2);l("items",e.items)("itemTemplate",i.itemTemplate)("menuId",i.menuId)("visible",i.isItemActive(e)&&i.isItemGroup(e))("activeItemPath",i.activeItemPath)("focusedItemId",i.focusedItemId)("level",i.level+1)}}function Ko(t,s){if(t&1){let e=w();a(0,"li",9,1)(2,"div",10),S("click",function(n){_(e);let o=m().$implicit,d=m(2);return g(d.onItemClick(n,o))})("mouseenter",function(n){_(e);let o=m().$implicit,d=m(2);return g(d.onItemMouseEnter({$event:n,processedItem:o}))}),u(3,Vo,3,2,"ng-container",11)(4,Bo,2,4,"ng-container",11),r(),u(5,$o,1,7,"p-contextmenu-sub",12),r()}if(t&2){let e=m(),i=e.$implicit,n=e.index,o=m(2);Fe(o.getItemProp(i,"styleClass")),l("ngStyle",o.getItemProp(i,"style"))("ngClass",o.getItemClass(i))("tooltipOptions",o.getItemProp(i,"tooltipOptions")),P("id",o.getItemId(i))("data-pc-section","menuitem")("data-p-highlight",o.isItemActive(i))("data-p-focused",o.isItemFocused(i))("data-p-disabled",o.isItemDisabled(i))("aria-label",o.getItemLabel(i))("aria-disabled",o.isItemDisabled(i)||void 0)("aria-haspopup",o.isItemGroup(i)&&!o.getItemProp(i,"to")?"menu":void 0)("aria-expanded",o.isItemGroup(i)?o.isItemActive(i):void 0)("aria-level",o.level+1)("aria-setsize",o.getAriaSetSize())("aria-posinset",o.getAriaPosInset(n)),c(2),P("data-pc-section","content"),c(),l("ngIf",!o.itemTemplate),c(),l("ngIf",o.itemTemplate),c(),l("ngIf",o.isItemVisible(i)&&o.isItemGroup(i))}}function qo(t,s){if(t&1&&u(0,ho,1,5,"li",6)(1,Ko,6,21,"li",7),t&2){let e=s.$implicit,i=m(2);l("ngIf",i.isItemVisible(e)&&i.getItemProp(e,"separator")),c(),l("ngIf",i.isItemVisible(e)&&!i.getItemProp(e,"separator"))}}function zo(t,s){if(t&1){let e=w();a(0,"ul",4,0),S("@overlayAnimation.start",function(n){_(e);let o=te(1),d=m();return g(d.onEnter(n,o))})("keydown",function(n){_(e);let o=m();return g(o.menuKeydown.emit(n))})("focus",function(n){_(e);let o=m();return g(o.menuFocus.emit(n))})("blur",function(n){_(e);let o=m();return g(o.menuBlur.emit(n))}),u(2,qo,2,2,"ng-template",5),r()}if(t&2){let e=m();l("ngClass",ei(10,po,!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 Go=["item"],Ho=["submenuicon"],Uo=["rootmenu"],jo=["container"],Zo=t=>({"p-contextmenu p-component":!0,"p-contextmenu-mobile":t}),Qo=()=>({value:"visible"});function Wo(t,s){if(t&1){let e=w();a(0,"div",3,0),S("@overlayAnimation.start",function(n){_(e);let o=m();return g(o.onOverlayAnimationStart(n))})("@overlayAnimation.done",function(n){_(e);let o=m();return g(o.onOverlayAnimationEnd(n))}),a(2,"p-contextmenu-sub",4,1),S("itemClick",function(n){_(e);let o=m();return g(o.onItemClick(n))})("menuFocus",function(n){_(e);let o=m();return g(o.onMenuFocus(n))})("menuBlur",function(n){_(e);let o=m();return g(o.onMenuBlur(n))})("menuKeydown",function(n){_(e);let o=m();return g(o.onKeyDown(n))})("itemMouseEnter",function(n){_(e);let o=m();return g(o.onItemMouseEnter(n))}),r()()}if(t&2){let e=m();Fe(e.styleClass),l("ngClass",T(20,Zo,e.queryMatches))("ngStyle",e.style)("@overlayAnimation",R(22,Qo)),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 Yo=({dt:t})=>`
|
|
2
2
|
.p-contextmenu {
|
|
3
3
|
position: absolute;
|
|
4
4
|
background: ${t("contextmenu.background")};
|
|
@@ -155,6 +155,6 @@ import{a as _t}from"./chunk-KIBBRAL5.js";import{a as Gi}from"./chunk-XKI7WLHE.js
|
|
|
155
155
|
margin-left: 0;
|
|
156
156
|
margin-right: auto;
|
|
157
157
|
}
|
|
158
|
-
`,Xo={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"},Wi=(()=>{class t extends yi{name="contextmenu";theme=Yo;classes=Xo;static \u0275fac=(()=>{let e;return function(n){return(e||(e=Ge(t)))(n||t)}})();static \u0275prov=ze({token:t,factory:t.\u0275fac})}return t})();var Jo=(()=>{class t extends wt{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,i,n=null){return e&&e.item?At(e.item[i],n):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 I(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 I(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(i=>this.isItemVisible(i)&&this.getItemProp(i,"separator")).length+1}isItemVisible(e){return this.getItemProp(e,"visible")!==!1}isItemActive(e){if(this.activeItemPath)return this.activeItemPath.some(i=>i.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:i,processedItem:n}=e;this.itemMouseEnter.emit({originalEvent:i,processedItem:n})}onItemClick(e,i){this.getItemProp(i,"command",{originalEvent:e,item:i.item}),this.itemClick.emit({originalEvent:e,processedItem:i,isFocus:!0})}onEnter(e,i){if(e.fromState==="void"&&e.toState){let n=e.element;this.position(n)}}position(e){let i=e.parentElement.parentElement,n=ui(e.parentElement.parentElement),o=vt(),d=e.offsetParent?e.offsetWidth:bt(e),f=ci(i.children[0]);e.style.top="0px",parseInt(n.left,10)+f+d>o.width-pi()?e.style.left=-1*d+"px":e.style.left=f+"px"}static \u0275fac=function(i){return new(i||t)(xt(Gt(()=>ht)))};static \u0275cmp=M({type:t,selectors:[["p-contextMenuSub"],["p-contextmenu-sub"]],viewQuery:function(i,n){if(i&1&&pe(mo,5),i&2){let o;j(o=Z())&&(n.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(i,n){i&1&&u(0,zo,3,13,"ul",3),i&2&&l("ngIf",n.root?!0:n.visible)},dependencies:[t,F,z,Ye,O,ii,Ct,L,B,bi,_e,rt,vi,Pt,Ti,De],encapsulation:2,data:{animation:[It("overlayAnimation",[Ve(":enter",[Ne({opacity:0})]),Ve(":leave",[Ne({opacity:0})])])]}})}return t})(),ht=(()=>{class t extends wt{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=b(!1);relativeAlign;window;focused=!1;activeItemPath=b([]);focusedItemInfo=b({index:-1,level:0,parentKey:"",item:null});submenuVisible=b(!1);searchValue="";searchTimeout;_processedItems;_model;pressTimer;matchMediaListener;query;queryMatches;_componentStyle=x(Wi);get visibleItems(){let e=this.activeItemPath().find(i=>i.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,We(()=>{let i=this.activeItemPath();re(i)?this.bindGlobalListeners():this.visible()||this.unbindGlobalListeners()})}ngOnInit(){super.ngOnInit(),this.id=this.id||xi("pn_id_"),this.bindMatchMediaListener(),this.bindTriggerEventListener()}isMobile(){return _i()||fi()}bindTriggerEventListener(){Le(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(Le(this.platformId)){if(!this.documentClickListener){let e=this.el?this.el.nativeElement.ownerDocument:"document";this.documentClickListener=this.renderer.listen(e,"click",i=>{this.containerViewChild.nativeElement.offsetParent&&this.isOutsideClicked(i)&&!i.ctrlKey&&i.button!==2&&this.triggerEvent!=="click"&&this.hide()}),this.documentTriggerListener=this.renderer.listen(e,this.triggerEvent,i=>{this.containerViewChild.nativeElement.offsetParent&&this.isOutsideClicked(i)&&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,i=0,n={},o=""){let d=[];return e&&e.forEach((f,v)=>{let k=(o!==""?o+"_":"")+v,q={item:f,index:v,level:i,key:k,parent:n,parentKey:o};q.items=this.createProcessedItems(f.items,i+1,q,k),d.push(q)}),d}bindMatchMediaListener(){if(Le(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,i){return e?At(e[i]):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(i=>i.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:i}=e,n=this.isProcessedItemGroup(i);if(this.isSelected(i)){let{index:d,key:f,level:v,parentKey:k,item:q}=i;this.activeItemPath.set(this.activeItemPath().filter(Be=>f!==Be.key&&f.startsWith(Be.key))),this.focusedItemInfo.set({index:d,level:v,parentKey:k,item:q}),it(this.rootmenu.sublistViewChild.nativeElement)}else n?this.onItemChange(e):this.hide()}onItemMouseEnter(e){this.onItemChange(e,"hover")}onKeyDown(e){let i=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:!i&&hi(e.key)&&this.searchItems(e,e.key);break}}onArrowDownKey(e){let i=this.focusedItemInfo().index!==-1?this.findNextItemIndex(this.focusedItemInfo().index):this.findFirstFocusedItemIndex();this.changeFocusedItemIndex(e,i),e.preventDefault()}onArrowRightKey(e){let i=this.visibleItems[this.focusedItemInfo().index];this.isProccessedItemGroup(i)&&(this.onItemChange({originalEvent:e,processedItem:i}),this.focusedItemInfo.set({index:-1,parentKey:i.key,item:i.item}),this.searchValue="",this.onArrowDownKey(e)),e.preventDefault()}onArrowUpKey(e){if(e.altKey){if(this.focusedItemInfo().index!==-1){let i=this.visibleItems[this.focusedItemInfo().index];!this.isProccessedItemGroup(i)&&this.onItemChange({originalEvent:e,processedItem:i})}this.hide(),e.preventDefault()}else{let i=this.focusedItemInfo().index!==-1?this.findPrevItemIndex(this.focusedItemInfo().index):this.findLastFocusedItemIndex();this.changeFocusedItemIndex(e,i),e.preventDefault()}}onArrowLeftKey(e){let i=this.visibleItems[this.focusedItemInfo().index],n=this.activeItemPath().find(f=>f.key===i.parentKey);St(i.parent)||(this.focusedItemInfo.set({index:-1,parentKey:n?n.parentKey:"",item:i.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 i=this.findVisibleItem(this.findFirstFocusedItemIndex()),n=this.focusedItemInfo();this.focusedItemInfo.set(I(C({},n),{index:this.findFirstFocusedItemIndex(),item:i.item})),e.preventDefault()}onTabKey(e){if(this.focusedItemInfo().index!==-1){let i=this.visibleItems[this.focusedItemInfo().index];!this.isProccessedItemGroup(i)&&this.onItemChange({originalEvent:e,processedItem:i})}this.hide()}onEnterKey(e){if(this.focusedItemInfo().index!==-1){let i=tt(this.rootmenu.el.nativeElement,`li[id="${`${this.focusedItemId}`}"]`),n=i&&tt(i,'a[data-pc-section="action"]');n?n.click():i&&i.click();let o=this.visibleItems[this.focusedItemInfo().index];if(!this.isProccessedItemGroup(o)){let f=this.focusedItemInfo();this.focusedItemInfo.set(I(C({},f),{index:this.findFirstFocusedItemIndex()}))}}e.preventDefault()}onItemChange(e,i){let{processedItem:n,isFocus:o}=e;if(St(n))return;let{index:d,key:f,level:v,parentKey:k,items:q}=n,Be=re(q),Bt=this.activeItemPath().filter($t=>$t.parentKey!==k&&$t.parentKey!==f);Be&&(Bt.push(n),this.submenuVisible.set(!0)),this.focusedItemInfo.set({index:d,level:v,parentKey:k,item:n.item}),o&&it(this.rootmenu.sublistViewChild.nativeElement),!(i==="hover"&&this.queryMatches)&&this.activeItemPath.set(Bt)}onMenuFocus(e){this.focused=!0;let i=this.focusedItemInfo().index!==-1?this.focusedItemInfo():{index:-1,level:0,parentKey:"",item:null};this.focusedItemInfo.set(i)}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(),it(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):mi(this.appendTo,this.containerViewChild.nativeElement))}moveOnTop(){this.autoZIndex&&this.containerViewChild&&Et.set("menu",this.containerViewChild.nativeElement,this.baseZIndex+this.config.zIndex.menu)}onOverlayHide(){this.unbindGlobalListeners(),this.cd.destroyed||(this.target=null),this.container&&this.autoZIndex&&Et.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,i=this.pageY+1,n=this.containerViewChild.nativeElement.offsetParent?this.containerViewChild.nativeElement.offsetWidth:bt(this.containerViewChild.nativeElement),o=this.containerViewChild.nativeElement.offsetParent?this.containerViewChild.nativeElement.offsetHeight:di(this.containerViewChild.nativeElement),d=vt();e+n-this.document.scrollingElement.scrollLeft>d.width&&(e-=n),i+o-this.document.scrollingElement.scrollTop>d.height&&(i-=o),e<this.document.scrollingElement.scrollLeft&&(e=this.document.scrollingElement.scrollLeft),i<this.document.scrollingElement.scrollTop&&(i=this.document.scrollingElement.scrollTop),this.containerViewChild.nativeElement.style.left=e+"px",this.containerViewChild.nativeElement.style.top=i+"px"}searchItems(e,i){this.searchValue=(this.searchValue||"")+i;let n=-1,o=!1;return this.focusedItemInfo().index!==-1?(n=this.visibleItems.slice(this.focusedItemInfo().index).findIndex(d=>this.isItemMatched(d)),n=n===-1?this.visibleItems.slice(0,this.focusedItemInfo().index).findIndex(d=>this.isItemMatched(d)):n+this.focusedItemInfo().index):n=this.visibleItems.findIndex(d=>this.isItemMatched(d)),n!==-1&&(o=!0),n===-1&&this.focusedItemInfo().index===-1&&(n=this.findFirstFocusedItemIndex()),n!==-1&&this.changeFocusedItemIndex(e,n),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 Tt(this.visibleItems,e=>this.isValidItem(e))}findPrevItemIndex(e){let i=e>0?Tt(this.visibleItems.slice(0,e),n=>this.isValidItem(n)):-1;return i>-1?i:e}findNextItemIndex(e){let i=e<this.visibleItems.length-1?this.visibleItems.slice(e+1).findIndex(n=>this.isValidItem(n)):-1;return i>-1?i+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,i){let n=this.findVisibleItem(i),o=this.focusedItemInfo();o.index!==i&&(this.focusedItemInfo.set(I(C({},o),{index:i,item:n.item})),this.scrollInView())}scrollInView(e=-1){let i=e!==-1?`${this.id}_${e}`:this.focusedItemId,n=tt(this.rootmenu.el.nativeElement,`li[id="${i}"]`);n&&n.scrollIntoView&&n.scrollIntoView({block:"nearest",inline:"nearest"})}bindResizeListener(){Le(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):gi(this.containerViewChild.nativeElement,this.appendTo))}ngOnDestroy(){this.unbindGlobalListeners(),this.unbindTriggerEventListener(),this.unbindMatchMediaListener(),this.removeAppendedElements(),super.ngOnDestroy()}static \u0275fac=function(i){return new(i||t)(xt(Ci))};static \u0275cmp=M({type:t,selectors:[["p-contextMenu"],["p-contextmenu"],["p-context-menu"]],contentQueries:function(i,n,o){if(i&1&&(Ue(o,Go,4),Ue(o,Ho,4),Ue(o,Ae,4)),i&2){let d;j(d=Z())&&(n.itemTemplate=d.first),j(d=Z())&&(n.submenuIconTemplate=d.first),j(d=Z())&&(n.templates=d)}},viewQuery:function(i,n){if(i&1&&(pe(Uo,5),pe(jo,5)),i&2){let o;j(o=Z())&&(n.rootmenu=o.first),j(o=Z())&&(n.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([Wi]),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(i,n){i&1&&u(0,Wo,4,23,"div",2),i&2&&l("ngIf",n.visible())},dependencies:[F,z,O,Ct,Jo,L,_e,Pt,De],encapsulation:2,data:{animation:[It("overlayAnimation",[Ve(":enter",[Ne({opacity:0}),yt("250ms")]),Ve(":leave",[yt(".1s linear",Ne({opacity:0}))])])]},changeDetection:0})}return t})(),Xi=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=Zt({type:t});static \u0275inj=Ht({imports:[ht,De,De]})}return t})();var tr=["editInput"],ir=["tree"],nr=["class","page"];function or(t,s){t&1&&(a(0,"a",7),h(1,"i",8),p(2," Add"),r())}function rr(t,s){if(t&1&&u(0,or,3,0,"a",6),t&2){let e=m();l("ngIf",e.roleService.coa().create)}}function ar(t,s){if(t&1){let e=w();a(0,"input",15,4),Qe("ngModelChange",function(n){let o=_(e).$implicit;return Ze(o.label,n)||(o.label=n),g(n)}),S("keydown",function(n){_(e);let o=m(2);return g(o.handleEditKeydown(n))})("blur",function(n){_(e);let o=m(2);return g(o.onNodeEditBlur(n))}),r()}if(t&2){let e=s.$implicit;je("ngModel",e.label)}}function lr(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(n){_(e);let o=m();return g(o.onNodeContextMenuSelect(n))})("onNodeSelect",function(n){_(e);let o=m();return g(o.onNodeSelect(n))})("onNodeUnselect",function(n){_(e);let o=m();return g(o.onNodeUnselect(n))})("onNodeDrop",function(n){_(e);let o=m();return g(o.onNodeDrop(n))}),u(5,ar,2,1,"ng-template",13),r(),h(6,"p-contextmenu",14,3),r()()()}if(t&2){let e=te(7),i=m();c(2),l("showHeader",!1),c(),l("value",i.categoryTree())("contextMenu",e)("selection",i.selectedCategory)("draggableNodes",!0)("droppableNodes",!0)("propagateSelectionUp",!1)("propagateSelectionDown",!1),c(3),l("model",i.contextMenuItems())}}var Ji=(()=>{class t{constructor(){this._coaTypesService=x(me),this._router=x(ne),this.roleService=x(we),this.contextMenuItems=b([]),this.categoryTree=b([]),this.selectedCategory=null,this._shouldAutoFocus=b(!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(i=>{let n=!!i.children?.length;return I(C({},i),{icon:void 0,expandedIcon:n?"fa-solid fa-folder-open":void 0,collapsedIcon:n?"fa-solid fa-folder":"fa-solid fa-file",children:n?this._assignTreeIcons(i.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 i=this._findNodeByKey(e.id);i&&(this.selectedCategory=i,this._shouldAutoFocus.set(!1),i.type="edit")})).subscribe()}_deleteSelectedCategory(){this.selectedCategory?.key&&this._coaTypesService.deleteCategory(this.selectedCategory.key).pipe(D(()=>this._loadCategories())).subscribe()}renameNode(e,i=this.selectedCategory){this._coaTypesService.renameCategory(i.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(n=>["Edit","Delete"].includes(n.label)?I(C({},n),{disabled:!0}):I(C({},n),{disabled:!1}))):this.contextMenuItems.set(this.contextMenuItems().map(n=>n.label==="Add"?I(C({},n),{disabled:!this.roleService.coa().create}):n.label==="Edit"?I(C({},n),{disabled:!this.roleService.coa().edit}):n.label==="Delete"?I(C({},n),{disabled:!this.roleService.coa().delete}):I(C({},n),{disabled:!1})))}onNodeDrop(e){let{dragNode:i,dropNode:n}=e;this._coaTypesService.updateParentCategory(i.key,{ParentID:n.key}).pipe(A(()=>this._loadCategories())).subscribe()}onNodeEditBlur(e){let i=e.target;this.renameNode(i.value);let n=this._findNodeByKey(this.selectedCategory?.key);n&&delete n.type}handleEditKeydown(e){let i=e.target;if([" ","Enter"].includes(e.key)&&e.stopPropagation(),e.key==="Enter"){this.renameNode(i.value);let n=this._findNodeByKey(this.selectedCategory?.key);n&&(delete n.type,this.treeComponent.updateSerializedValue?.())}}expandAllNodes(){this.categoryTree().forEach(e=>this._expandRecursive(e,!0))}collapseAllNodes(){this.categoryTree().forEach(e=>this._expandRecursive(e,!1))}_expandRecursive(e,i){e.expanded=i,e.children?.forEach(n=>this._expandRecursive(n,i))}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=M({type:t,selectors:[["app-coa-type",8,"page"]],viewQuery:function(i,n){if(i&1&&(pe(tr,5),pe(ir,5)),i&2){let o;j(o=Z())&&(n.editInputRef=o.first),j(o=Z())&&(n.treeComponent=o.first)}},features:[he([Ii])],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(i,n){i&1&&(a(0,"app-main-panel",5),u(1,rr,1,1,"ng-template",null,0,
|
|
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(i,n){i&1&&u(0,
|
|
158
|
+
`,Xo={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"},Wi=(()=>{class t extends Ii{name="contextmenu";theme=Yo;classes=Xo;static \u0275fac=(()=>{let e;return function(n){return(e||(e=Ge(t)))(n||t)}})();static \u0275prov=ze({token:t,factory:t.\u0275fac})}return t})();var Jo=(()=>{class t extends wt{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,i,n=null){return e&&e.item?At(e.item[i],n):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(i=>this.isItemVisible(i)&&this.getItemProp(i,"separator")).length+1}isItemVisible(e){return this.getItemProp(e,"visible")!==!1}isItemActive(e){if(this.activeItemPath)return this.activeItemPath.some(i=>i.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:i,processedItem:n}=e;this.itemMouseEnter.emit({originalEvent:i,processedItem:n})}onItemClick(e,i){this.getItemProp(i,"command",{originalEvent:e,item:i.item}),this.itemClick.emit({originalEvent:e,processedItem:i,isFocus:!0})}onEnter(e,i){if(e.fromState==="void"&&e.toState){let n=e.element;this.position(n)}}position(e){let i=e.parentElement.parentElement,n=ui(e.parentElement.parentElement),o=bt(),d=e.offsetParent?e.offsetWidth:vt(e),f=ci(i.children[0]);e.style.top="0px",parseInt(n.left,10)+f+d>o.width-pi()?e.style.left=-1*d+"px":e.style.left=f+"px"}static \u0275fac=function(i){return new(i||t)(xt(Gt(()=>ht)))};static \u0275cmp=M({type:t,selectors:[["p-contextMenuSub"],["p-contextmenu-sub"]],viewQuery:function(i,n){if(i&1&&pe(mo,5),i&2){let o;j(o=Z())&&(n.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(i,n){i&1&&u(0,zo,3,13,"ul",3),i&2&&l("ngIf",n.root?!0:n.visible)},dependencies:[t,F,z,Ye,O,ii,Ct,L,B,vi,_e,rt,bi,Pt,Ti,De],encapsulation:2,data:{animation:[yt("overlayAnimation",[Ve(":enter",[Ne({opacity:0})]),Ve(":leave",[Ne({opacity:0})])])]}})}return t})(),ht=(()=>{class t extends wt{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(Wi);get visibleItems(){let e=this.activeItemPath().find(i=>i.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,We(()=>{let i=this.activeItemPath();re(i)?this.bindGlobalListeners():this.visible()||this.unbindGlobalListeners()})}ngOnInit(){super.ngOnInit(),this.id=this.id||xi("pn_id_"),this.bindMatchMediaListener(),this.bindTriggerEventListener()}isMobile(){return _i()||fi()}bindTriggerEventListener(){Le(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(Le(this.platformId)){if(!this.documentClickListener){let e=this.el?this.el.nativeElement.ownerDocument:"document";this.documentClickListener=this.renderer.listen(e,"click",i=>{this.containerViewChild.nativeElement.offsetParent&&this.isOutsideClicked(i)&&!i.ctrlKey&&i.button!==2&&this.triggerEvent!=="click"&&this.hide()}),this.documentTriggerListener=this.renderer.listen(e,this.triggerEvent,i=>{this.containerViewChild.nativeElement.offsetParent&&this.isOutsideClicked(i)&&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,i=0,n={},o=""){let d=[];return e&&e.forEach((f,b)=>{let k=(o!==""?o+"_":"")+b,q={item:f,index:b,level:i,key:k,parent:n,parentKey:o};q.items=this.createProcessedItems(f.items,i+1,q,k),d.push(q)}),d}bindMatchMediaListener(){if(Le(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,i){return e?At(e[i]):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(i=>i.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:i}=e,n=this.isProcessedItemGroup(i);if(this.isSelected(i)){let{index:d,key:f,level:b,parentKey:k,item:q}=i;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}),it(this.rootmenu.sublistViewChild.nativeElement)}else n?this.onItemChange(e):this.hide()}onItemMouseEnter(e){this.onItemChange(e,"hover")}onKeyDown(e){let i=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:!i&&hi(e.key)&&this.searchItems(e,e.key);break}}onArrowDownKey(e){let i=this.focusedItemInfo().index!==-1?this.findNextItemIndex(this.focusedItemInfo().index):this.findFirstFocusedItemIndex();this.changeFocusedItemIndex(e,i),e.preventDefault()}onArrowRightKey(e){let i=this.visibleItems[this.focusedItemInfo().index];this.isProccessedItemGroup(i)&&(this.onItemChange({originalEvent:e,processedItem:i}),this.focusedItemInfo.set({index:-1,parentKey:i.key,item:i.item}),this.searchValue="",this.onArrowDownKey(e)),e.preventDefault()}onArrowUpKey(e){if(e.altKey){if(this.focusedItemInfo().index!==-1){let i=this.visibleItems[this.focusedItemInfo().index];!this.isProccessedItemGroup(i)&&this.onItemChange({originalEvent:e,processedItem:i})}this.hide(),e.preventDefault()}else{let i=this.focusedItemInfo().index!==-1?this.findPrevItemIndex(this.focusedItemInfo().index):this.findLastFocusedItemIndex();this.changeFocusedItemIndex(e,i),e.preventDefault()}}onArrowLeftKey(e){let i=this.visibleItems[this.focusedItemInfo().index],n=this.activeItemPath().find(f=>f.key===i.parentKey);St(i.parent)||(this.focusedItemInfo.set({index:-1,parentKey:n?n.parentKey:"",item:i.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 i=this.findVisibleItem(this.findFirstFocusedItemIndex()),n=this.focusedItemInfo();this.focusedItemInfo.set(y(C({},n),{index:this.findFirstFocusedItemIndex(),item:i.item})),e.preventDefault()}onTabKey(e){if(this.focusedItemInfo().index!==-1){let i=this.visibleItems[this.focusedItemInfo().index];!this.isProccessedItemGroup(i)&&this.onItemChange({originalEvent:e,processedItem:i})}this.hide()}onEnterKey(e){if(this.focusedItemInfo().index!==-1){let i=tt(this.rootmenu.el.nativeElement,`li[id="${`${this.focusedItemId}`}"]`),n=i&&tt(i,'a[data-pc-section="action"]');n?n.click():i&&i.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,i){let{processedItem:n,isFocus:o}=e;if(St(n))return;let{index:d,key:f,level:b,parentKey:k,items:q}=n,Be=re(q),Bt=this.activeItemPath().filter($t=>$t.parentKey!==k&&$t.parentKey!==f);Be&&(Bt.push(n),this.submenuVisible.set(!0)),this.focusedItemInfo.set({index:d,level:b,parentKey:k,item:n.item}),o&&it(this.rootmenu.sublistViewChild.nativeElement),!(i==="hover"&&this.queryMatches)&&this.activeItemPath.set(Bt)}onMenuFocus(e){this.focused=!0;let i=this.focusedItemInfo().index!==-1?this.focusedItemInfo():{index:-1,level:0,parentKey:"",item:null};this.focusedItemInfo.set(i)}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(),it(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):mi(this.appendTo,this.containerViewChild.nativeElement))}moveOnTop(){this.autoZIndex&&this.containerViewChild&&Et.set("menu",this.containerViewChild.nativeElement,this.baseZIndex+this.config.zIndex.menu)}onOverlayHide(){this.unbindGlobalListeners(),this.cd.destroyed||(this.target=null),this.container&&this.autoZIndex&&Et.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,i=this.pageY+1,n=this.containerViewChild.nativeElement.offsetParent?this.containerViewChild.nativeElement.offsetWidth:vt(this.containerViewChild.nativeElement),o=this.containerViewChild.nativeElement.offsetParent?this.containerViewChild.nativeElement.offsetHeight:di(this.containerViewChild.nativeElement),d=bt();e+n-this.document.scrollingElement.scrollLeft>d.width&&(e-=n),i+o-this.document.scrollingElement.scrollTop>d.height&&(i-=o),e<this.document.scrollingElement.scrollLeft&&(e=this.document.scrollingElement.scrollLeft),i<this.document.scrollingElement.scrollTop&&(i=this.document.scrollingElement.scrollTop),this.containerViewChild.nativeElement.style.left=e+"px",this.containerViewChild.nativeElement.style.top=i+"px"}searchItems(e,i){this.searchValue=(this.searchValue||"")+i;let n=-1,o=!1;return this.focusedItemInfo().index!==-1?(n=this.visibleItems.slice(this.focusedItemInfo().index).findIndex(d=>this.isItemMatched(d)),n=n===-1?this.visibleItems.slice(0,this.focusedItemInfo().index).findIndex(d=>this.isItemMatched(d)):n+this.focusedItemInfo().index):n=this.visibleItems.findIndex(d=>this.isItemMatched(d)),n!==-1&&(o=!0),n===-1&&this.focusedItemInfo().index===-1&&(n=this.findFirstFocusedItemIndex()),n!==-1&&this.changeFocusedItemIndex(e,n),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 Tt(this.visibleItems,e=>this.isValidItem(e))}findPrevItemIndex(e){let i=e>0?Tt(this.visibleItems.slice(0,e),n=>this.isValidItem(n)):-1;return i>-1?i:e}findNextItemIndex(e){let i=e<this.visibleItems.length-1?this.visibleItems.slice(e+1).findIndex(n=>this.isValidItem(n)):-1;return i>-1?i+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,i){let n=this.findVisibleItem(i),o=this.focusedItemInfo();o.index!==i&&(this.focusedItemInfo.set(y(C({},o),{index:i,item:n.item})),this.scrollInView())}scrollInView(e=-1){let i=e!==-1?`${this.id}_${e}`:this.focusedItemId,n=tt(this.rootmenu.el.nativeElement,`li[id="${i}"]`);n&&n.scrollIntoView&&n.scrollIntoView({block:"nearest",inline:"nearest"})}bindResizeListener(){Le(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):gi(this.containerViewChild.nativeElement,this.appendTo))}ngOnDestroy(){this.unbindGlobalListeners(),this.unbindTriggerEventListener(),this.unbindMatchMediaListener(),this.removeAppendedElements(),super.ngOnDestroy()}static \u0275fac=function(i){return new(i||t)(xt(Ci))};static \u0275cmp=M({type:t,selectors:[["p-contextMenu"],["p-contextmenu"],["p-context-menu"]],contentQueries:function(i,n,o){if(i&1&&(Ue(o,Go,4),Ue(o,Ho,4),Ue(o,Ae,4)),i&2){let d;j(d=Z())&&(n.itemTemplate=d.first),j(d=Z())&&(n.submenuIconTemplate=d.first),j(d=Z())&&(n.templates=d)}},viewQuery:function(i,n){if(i&1&&(pe(Uo,5),pe(jo,5)),i&2){let o;j(o=Z())&&(n.rootmenu=o.first),j(o=Z())&&(n.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([Wi]),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(i,n){i&1&&u(0,Wo,4,23,"div",2),i&2&&l("ngIf",n.visible())},dependencies:[F,z,O,Ct,Jo,L,_e,Pt,De],encapsulation:2,data:{animation:[yt("overlayAnimation",[Ve(":enter",[Ne({opacity:0}),It("250ms")]),Ve(":leave",[It(".1s linear",Ne({opacity:0}))])])]},changeDetection:0})}return t})(),Xi=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=Zt({type:t});static \u0275inj=Ht({imports:[ht,De,De]})}return t})();var tr=["editInput"],ir=["tree"],nr=["class","page"];function or(t,s){t&1&&(a(0,"a",7),h(1,"i",8),p(2," Add"),r())}function rr(t,s){if(t&1&&u(0,or,3,0,"a",6),t&2){let e=m();l("ngIf",e.roleService.coa().create)}}function ar(t,s){if(t&1){let e=w();a(0,"input",15,4),Qe("ngModelChange",function(n){let o=_(e).$implicit;return Ze(o.label,n)||(o.label=n),g(n)}),S("keydown",function(n){_(e);let o=m(2);return g(o.handleEditKeydown(n))})("blur",function(n){_(e);let o=m(2);return g(o.onNodeEditBlur(n))}),r()}if(t&2){let e=s.$implicit;je("ngModel",e.label)}}function lr(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(n){_(e);let o=m();return g(o.onNodeContextMenuSelect(n))})("onNodeSelect",function(n){_(e);let o=m();return g(o.onNodeSelect(n))})("onNodeUnselect",function(n){_(e);let o=m();return g(o.onNodeUnselect(n))})("onNodeDrop",function(n){_(e);let o=m();return g(o.onNodeDrop(n))}),u(5,ar,2,1,"ng-template",13),r(),h(6,"p-contextmenu",14,3),r()()()}if(t&2){let e=te(7),i=m();c(2),l("showHeader",!1),c(),l("value",i.categoryTree())("contextMenu",e)("selection",i.selectedCategory)("draggableNodes",!0)("droppableNodes",!0)("propagateSelectionUp",!1)("propagateSelectionDown",!1),c(3),l("model",i.contextMenuItems())}}var Ji=(()=>{class t{constructor(){this._coaTypesService=x(me),this._router=x(ne),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(i=>{let n=!!i.children?.length;return y(C({},i),{icon:void 0,expandedIcon:n?"fa-solid fa-folder-open":void 0,collapsedIcon:n?"fa-solid fa-folder":"fa-solid fa-file",children:n?this._assignTreeIcons(i.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 i=this._findNodeByKey(e.id);i&&(this.selectedCategory=i,this._shouldAutoFocus.set(!1),i.type="edit")})).subscribe()}_deleteSelectedCategory(){this.selectedCategory?.key&&this._coaTypesService.deleteCategory(this.selectedCategory.key).pipe(D(()=>this._loadCategories())).subscribe()}renameNode(e,i=this.selectedCategory){this._coaTypesService.renameCategory(i.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(n=>["Edit","Delete"].includes(n.label)?y(C({},n),{disabled:!0}):y(C({},n),{disabled:!1}))):this.contextMenuItems.set(this.contextMenuItems().map(n=>n.label==="Add"?y(C({},n),{disabled:!this.roleService.coa().create}):n.label==="Edit"?y(C({},n),{disabled:!this.roleService.coa().edit}):n.label==="Delete"?y(C({},n),{disabled:!this.roleService.coa().delete}):y(C({},n),{disabled:!1})))}onNodeDrop(e){let{dragNode:i,dropNode:n}=e;this._coaTypesService.updateParentCategory(i.key,{ParentID:n.key}).pipe(A(()=>this._loadCategories())).subscribe()}onNodeEditBlur(e){let i=e.target;this.renameNode(i.value);let n=this._findNodeByKey(this.selectedCategory?.key);n&&delete n.type}handleEditKeydown(e){let i=e.target;if([" ","Enter"].includes(e.key)&&e.stopPropagation(),e.key==="Enter"){this.renameNode(i.value);let n=this._findNodeByKey(this.selectedCategory?.key);n&&(delete n.type,this.treeComponent.updateSerializedValue?.())}}expandAllNodes(){this.categoryTree().forEach(e=>this._expandRecursive(e,!0))}collapseAllNodes(){this.categoryTree().forEach(e=>this._expandRecursive(e,!1))}_expandRecursive(e,i){e.expanded=i,e.children?.forEach(n=>this._expandRecursive(n,i))}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=M({type:t,selectors:[["app-coa-type",8,"page"]],viewQuery:function(i,n){if(i&1&&(pe(tr,5),pe(ir,5)),i&2){let o;j(o=Z())&&(n.editInputRef=o.first),j(o=Z())&&(n.treeComponent=o.first)}},features:[he([yi])],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(i,n){i&1&&(a(0,"app-main-panel",5),u(1,rr,1,1,"ng-template",null,0,I)(3,lr,8,9,"ng-template",null,1,I),r()),i&2&&l("scrollable",!0)},dependencies:[$,$i,L,B,Xi,ht,Ae,F,O,Se,oe,Y,Je,K,Si,ce,se],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var sr=["class","page"],Dt=t=>({"is-invalid":t}),cr=t=>({"ng-invalid ng-dirty":t});function mr(t,s){if(t&1){let e=w();a(0,"div",3)(1,"p-button",4),S("onClick",function(){_(e);let n=m();return g(n.goBack())}),r(),a(2,"p-button",5),S("onClick",function(){_(e);let n=m();return g(n.onSubmit())}),r()()}}function pr(t,s){t&1&&(a(0,"div",20),p(1," Name is required "),r())}function dr(t,s){t&1&&(a(0,"div",20),p(1," Code is required "),r())}function ur(t,s){t&1&&(a(0,"div",20),p(1," Note is required "),r())}function fr(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 _r(t,s){if(t&1&&(a(0,"div"),u(1,fr,3,1,"div",21),r()),t&2){let e=m(2);c(),l("ngForOf",e.getErrors("Category"))}}function gr(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,pr,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,dr,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,ur,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 n=m();return g(n.loadCategories())}),r(),u(27,_r,2,1,"div",19),r()()()()()()}if(t&2){let e=m();c(3),l("formGroup",e.form),c(5),l("ngClass",T(10,Dt,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,Dt,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,Dt,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,cr,e.isInvalid("Category")))("options",e.categories()),c(),l("ngIf",e.isInvalid("Category"))}}var Rt=(()=>{class t extends Gi{constructor(){super(...arguments),this.categories=v([]),this.COATypeService=x(me),this.COAService=x(X),this.info=v(null),this.route=x(ie),this.router=x(ne),this.fb=x(ve)}goBack(){this.router.navigate(["/pages/chart-of-account/coa-types"])}ngOnInit(){this.generateForm(),Kt([this.route.paramMap.pipe(G(e=>e.get("id")),Ke(e=>!!e)),this.COATypeService.fetchCOACategories()]).pipe(V("fetchCOACategories"),D(([e,i])=>{let n=this.findNodeByKeyInArray(i,e);return this.categories.set(i),this.COATypeService.getCOACategoryByID({ID:e}).pipe(A(o=>{this.form.patchValue({Name:o.name,Code:o.code,Note:o.note,Category:n.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 ri({Name:new N("",[fe.required]),Code:new N("",[]),Category:new N(null,[fe.required]),Note:new N("",[])})}findNodeByKeyInArray(e,i){for(let n of e){let o=this.findNodeByKey(n,i);if(o)return o}return null}findNodeByKey(e,i,n=null){if(e.key===i||e.label===i)return n&&(e.parent=n),e;if(e.children&&e.children.length>0)for(let o of e.children){let d=this.findNodeByKey(o,i,e);if(d)return d}return null}onSubmit(){let{Name:e,Code:i,Note:n,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:i,ParentID:d&&d.parent?d.parent.key:d.key,Note:n,ID:this.route.snapshot.params.id||null}):(d=this.findNodeByKeyInArray(this.categories(),o.key),f={Name:e,Code:i,ParentID:d&&d.parent?d.parent.key:d.key,Note:n}),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(n){return(e||(e=Ge(t)))(n||t)}})()}static{this.\u0275cmp=M({type:t,selectors:[["app-coa-type-form",8,"page"]],features:[Oe],attrs:sr,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(i,n){i&1&&(a(0,"app-main-panel",2),u(1,mr,3,0,"ng-template",null,0,I)(3,gr,28,18,"ng-template",null,1,I),r()),i&2&&l("hasMainWrapperPadding",!0)},dependencies:[$,L,Pe,Ee,Te,oe,Y,ye,Ie,be,F,z,Ye,O,K,le,ae,ce,se],styles:["[_nghost-%COMP%]{display:block} .p-treeselect{width:100%}"],changeDetection:0})}}return t})();var hr=t=>[t];function xr(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,hr,"/pages/chart-of-account/coa-types/"+e.info().id+"/edit"))}}function Cr(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 yr(t,s){t&1&&(H(0),a(1,"app-main-panel",3),u(2,xr,4,3,"ng-template",null,0,I)(4,Cr,24,4,"ng-template",null,1,I),r(),U())}var en=(()=>{class t{constructor(){this.COATypeService=x(me),this.route=x(ie),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(i){return new(i||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(i,n){i&1&&u(0,yr,6,0,"ng-container",2),i&2&&l("ngIf",n.info())},dependencies:[F,O,$,K,at,L,B],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Ps=[{path:"",redirectTo:"account",pathMatch:"full"},{path:"",children:[{path:"account",component:ji},{path:"account/add",component:Vt},{path:"account/import",loadComponent:()=>import("./chunk-O4TXGGHF.js").then(t=>t.CoaImportComponent)},{path:"account/:id",component:Hi},{path:"account/:id/edit",component:Vt},{path:"coa-types",component:Ji},{path:"coa-types/add",component:Rt},{path:"coa-types/info",component:en},{path:"coa-types/:id/edit",component:Rt}]}],Zi={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{Ps as CHART_OF_ACCOUNT_ROUTES,Zi as CHART_OF_ACCOUNT_ROUTE_PAGE};
|