dealposbooks 5.45.1 → 5.45.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/{chunk-55PBPTNF.js → chunk-26UQWFZL.js} +1 -1
  2. package/{chunk-AYBSWMQT.js → chunk-2CZSVC7E.js} +1 -1
  3. package/{chunk-VW47RJKF.js → chunk-3HOFEEIL.js} +1 -1
  4. package/{chunk-FBAUSUGQ.js → chunk-3KUSIKRO.js} +1 -1
  5. package/{chunk-XYDMR5UH.js → chunk-4LXFEAO3.js} +1 -1
  6. package/{chunk-PPSWJ3KZ.js → chunk-4TTCPL3N.js} +1 -1
  7. package/{chunk-OVSN4E2D.js → chunk-5M4DFZYR.js} +2 -2
  8. package/{chunk-B5ICLX2M.js → chunk-66OMKKIW.js} +1 -1
  9. package/{chunk-34AG6ZRL.js → chunk-A2PK5UDL.js} +1 -1
  10. package/{chunk-3YP5GGRN.js → chunk-AJUXGEAH.js} +1 -1
  11. package/{chunk-4SJCTDC5.js → chunk-AOJUTF6L.js} +1 -1
  12. package/{chunk-4LUDLDRM.js → chunk-BSDEDT6G.js} +1 -1
  13. package/{chunk-IYWJ4NQV.js → chunk-BTVPGIVW.js} +1 -1
  14. package/{chunk-GVDMC4IX.js → chunk-BXJSXLQV.js} +1 -1
  15. package/{chunk-NVB5C5WN.js → chunk-CDM64DTS.js} +1 -1
  16. package/{chunk-F7JURLD3.js → chunk-DHA762N3.js} +1 -1
  17. package/{chunk-VCNN5RVA.js → chunk-DWCZUCH4.js} +1 -1
  18. package/{chunk-KYNEAC2L.js → chunk-FPBO6QHG.js} +1 -1
  19. package/{chunk-B6BFJFA6.js → chunk-FXATM6DM.js} +1 -1
  20. package/{chunk-3E76NHYR.js → chunk-GJJEUBYR.js} +1 -1
  21. package/{chunk-ULJ2Y7SG.js → chunk-GNLE4WCA.js} +1 -1
  22. package/{chunk-ADIJSTCG.js → chunk-GZYN6L4H.js} +1 -1
  23. package/{chunk-4EASZOWM.js → chunk-HSCJP74Q.js} +1 -1
  24. package/{chunk-3O7PYVJB.js → chunk-HWYLSS7R.js} +1 -1
  25. package/{chunk-NKCNDLCN.js → chunk-JOKE4TMJ.js} +1 -1
  26. package/{chunk-5UQN26GG.js → chunk-JTUKNSIL.js} +1 -1
  27. package/{chunk-QR5KD37B.js → chunk-KQGEEF2E.js} +2 -2
  28. package/{chunk-M675R5IO.js → chunk-KUECUVZ7.js} +1 -1
  29. package/{chunk-34WPW5D2.js → chunk-MLC5Q3HL.js} +1 -1
  30. package/{chunk-F5QD3IJY.js → chunk-MMQTWRG5.js} +1 -1
  31. package/{chunk-X7UDCQV2.js → chunk-N4CQ65FU.js} +1 -1
  32. package/{chunk-IWHPWZIL.js → chunk-NMNIOSPK.js} +1 -1
  33. package/{chunk-4OROB43Y.js → chunk-OQD4ZKBU.js} +1 -1
  34. package/{chunk-L2MQOC56.js → chunk-OVHHHUDY.js} +1 -1
  35. package/{chunk-V4XZTIO4.js → chunk-OX6CAMTK.js} +1 -1
  36. package/{chunk-ZFZPBYHM.js → chunk-OZG2M6UV.js} +2 -2
  37. package/{chunk-Q5K47PTK.js → chunk-P63CD72K.js} +1 -1
  38. package/chunk-PYQLVU3L.js +7 -0
  39. package/{chunk-WQLQI7VC.js → chunk-QTPVRMTB.js} +1 -1
  40. package/{chunk-KQEKK7SJ.js → chunk-QUL4J2CF.js} +1 -1
  41. package/{chunk-EK3VPTHC.js → chunk-QY6YO5GR.js} +1 -1
  42. package/{chunk-MAZVUNNB.js → chunk-SZPSOPM4.js} +1 -1
  43. package/{chunk-CBAJ6F64.js → chunk-UP4DWDNE.js} +1 -1
  44. package/{chunk-7X6D62QP.js → chunk-VEALQLJ2.js} +1 -1
  45. package/{chunk-BCRBHPPF.js → chunk-W325ZFGZ.js} +1 -1
  46. package/{chunk-RIEXBPQ3.js → chunk-WO62II7E.js} +1 -1
  47. package/{chunk-GBBQUUCQ.js → chunk-WZQ3ORPU.js} +1 -1
  48. package/{chunk-QMVQ67BR.js → chunk-XBIY3I5H.js} +1 -1
  49. package/{chunk-KV6EPP4J.js → chunk-Y4NMBCL7.js} +1 -1
  50. package/{chunk-YN2HKWAW.js → chunk-Y7P7BGVH.js} +1 -1
  51. package/{chunk-F4ZNQXWG.js → chunk-YDFJ65ST.js} +1 -1
  52. package/chunk-YVO6JHL7.js +1 -0
  53. package/index.html +2 -2
  54. package/{main-VBAUVWYV.js → main-TUODCJBC.js} +1 -1
  55. package/package.json +1 -1
  56. package/chunk-7EJY6C3Q.js +0 -7
  57. package/chunk-PUGHX4BL.js +0 -1
@@ -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-GBBQUUCQ.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-YN2HKWAW.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-PPSWJ3KZ.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-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})=>`
2
2
  .p-contextmenu {
3
3
  position: absolute;
4
4
  background: ${t("contextmenu.background")};
@@ -157,4 +157,4 @@ import{a as _t}from"./chunk-KIBBRAL5.js";import{a as Gi}from"./chunk-XKI7WLHE.js
157
157
  }
158
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
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,y)(3,lr,8,9,"ng-template",null,1,y),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=b([]),this.COATypeService=x(me),this.COAService=x(X),this.info=b(null),this.route=x(ie),this.router=x(ne),this.fb=x(be)}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,y)(3,gr,28,18,"ng-template",null,1,y),r()),i&2&&l("hasMainWrapperPadding",!0)},dependencies:[$,L,Pe,Ee,Te,oe,Y,Ie,ye,ve,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 Ir(t,s){t&1&&(H(0),a(1,"app-main-panel",3),u(2,xr,4,3,"ng-template",null,0,y)(4,Cr,24,4,"ng-template",null,1,y),r(),U())}var en=(()=>{class t{constructor(){this.COATypeService=x(me),this.route=x(ie),this.info=b(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,Ir,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-4EASZOWM.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};
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,Ir,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-HSCJP74Q.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};
@@ -1 +1 @@
1
- import{a as D}from"./chunk-B6BFJFA6.js";import{a as je}from"./chunk-G4XX7EU2.js";import{a as Oe}from"./chunk-JRVYSBUZ.js";import{a as Be,b as He}from"./chunk-BLR3HBYP.js";import{a as re}from"./chunk-ADIJSTCG.js";import{b as A}from"./chunk-ULJ2Y7SG.js";import{a as ze}from"./chunk-XKI7WLHE.js";import"./chunk-7DYACF4D.js";import"./chunk-NZN6QJR3.js";import"./chunk-IGWIRCAS.js";import{a as z,b as j}from"./chunk-3A4BFUGD.js";import{d as Ne,i as ke,j as Me,k as Pe}from"./chunk-EL5BUFMO.js";import{a as Ae,b as De}from"./chunk-EQ4PLHI4.js";import"./chunk-H7Q35Y7G.js";import"./chunk-R7N6BWL5.js";import"./chunk-2AAVNIG7.js";import{a as Fe,b as Je}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"./chunk-6GN3MGBY.js";import"./chunk-Q24GCSGD.js";import{g as Ee,h as Ve}from"./chunk-YN2HKWAW.js";import{b as Ie,c as Te}from"./chunk-VGNJD35F.js";import{a as Ce,b as be}from"./chunk-2XUSZCQL.js";import{a as y,b as Se,c as ve,d as ye,e as we,f as Re}from"./chunk-YV2QJ63P.js";import"./chunk-ARH3WEEF.js";import{n as _e,o as ge,w as he,x as xe}from"./chunk-H6HNANYB.js";import"./chunk-2D2YD753.js";import{b as ae,c as le,e as me,f as pe,k as se,l as ce,o as de,u as ue,x as fe}from"./chunk-OIBDX2CA.js";import"./chunk-AOOG6YOT.js";import"./chunk-PPSWJ3KZ.js";import"./chunk-2MKKFLNJ.js";import{h as Z,j as ee,k as te,n as ie,p as ne,s as oe}from"./chunk-VZ5CMS5O.js";import"./chunk-F2X3VGZZ.js";import{$b as w,Bb as K,Cc as Q,Db as g,Dc as X,Ec as E,Ha as k,Lb as c,Nc as I,Oc as Y,Pc as V,Rc as v,Vb as r,Wb as o,Xb as b,Y as N,_ as H,bd as T,c as F,cb as U,db as L,ec as R,fc as _,hb as m,ia as C,qa as h,ra as x,rc as s,s as J,sc as S,tc as M,vc as W,wc as $,xb as G,xc as P,yc as q}from"./chunk-NMCKMUY4.js";import{a as d,b as f}from"./chunk-YQFG5XE2.js";var $e={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,customerID:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,paymentState:0}},filter:{number:null,outletName:null,from:null,to:null,customerID:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,paymentState:0}},O=Se(Re($e),ve(t=>({first:T(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:T(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:T(()=>t.data().data.some(a=>a.checked)),checkedARCollection:T(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),we(t=>{let a=C(D),e=C(A);return{updateFilter(n){y(t,i=>f(d({},i),{filter:d(d({},i.filter),n)}))},onRowSelect(n){y(t,i=>{let u=i.data.data.map(p=>p.id===n.id?f(d({},p),{checked:!0}):p);return f(d({},i),{data:f(d({},i.data),{data:u})})})},onRowUnselect(n){y(t,i=>{let u=i.data.data.map(p=>p.id===n.id?f(d({},p),{checked:!1}):p);return f(d({},i),{data:f(d({},i.data),{data:u})})})},onHeaderCheckboxToggle(n){y(t,i=>{let u=i.data.data.map(p=>f(d({},p),{checked:n}));return f(d({},i),{data:f(d({},i.data),{data:u})})})},getARLoader:z(F(N(()=>a.getARJournalLoader().pipe(j({next:n=>{y(t,i=>f(d({},i),{meta:n}))},error:n=>{console.error("Error fetching AR collection loader:",n)}}))))),getARCollection:z(F(J(n=>Object.entries(n).reduce((i,[u,p])=>(p!=null&&(i[u]=p),i),{})),N(n=>a.getARJournal(n).pipe(J(i=>f(d({},i),{data:i.data.map(u=>f(d({},u),{due:e.from(u.due)?e.from(u.due).format():null,checked:!1}))})),j({next:i=>{y(t,u=>f(d({},u),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),ye(t=>({onInit:()=>{t.getARLoader(),t.getARCollection(t.filter)}})));var B=t=>({"ng-invalid ng-dirty":t}),qe=()=>({});function Qe(t,a){if(t&1){let e=w();r(0,"p-button",10),R("onClick",function(){h(e);let n=_(2);return x(n.onCreateJournal())}),o()}}function Xe(t,a){if(t&1&&g(0,Qe,1,0,"p-button",9),t&2){let e=_();c("ngIf",e.store.hasCheckedRows())}}function Ye(t,a){t&1&&(r(0,"tr")(1,"th",12),b(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),s(4,"Outlet"),o(),r(5,"th",14),s(6,"Number"),o(),r(7,"th",15),s(8,"Customer"),o(),r(9,"th",16),s(10,"Date"),o(),r(11,"th",16),s(12,"Due"),o(),r(13,"th",15),s(14,"Note"),o(),r(15,"th",17),s(16,"Payment"),o(),b(17,"th",18),o())}function Ze(t,a){if(t&1&&(r(0,"tr")(1,"td"),b(2,"p-tableCheckbox",19),o(),r(3,"td"),s(4),o(),r(5,"td")(6,"a",20),s(7),o()(),r(8,"td"),s(9),o(),r(10,"td"),s(11),I(12,"date"),o(),r(13,"td"),s(14),I(15,"date"),o(),r(16,"td"),b(17,"div",21),o(),r(18,"td"),s(19),o(),r(20,"td"),b(21,"p-button",22),o()()),t&2){let e=a.$implicit,l=_(2);m(2),c("value",e),m(2),S(e.outlet),m(2),c("href",l.authService.getTenantExternalURL()+"/menu/Debt/Debt/Join_Invoice/New_Join_Invoice/Info?ID="+e.id,L),m(),M(" ",e.number," "),m(2),S(e.customer),m(2),S(V(12,12,e.date,"d MMM y")),m(3),S(e.due?V(15,15,e.due,"d MMM y hh:mm"):"-"),m(3),c("innerHTML",e.note,U),m(2),S(e.payment),m(2),c("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function et(t,a){if(t&1&&s(0),t&2){let e=_(2);W(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function tt(t,a){t&1&&(r(0,"tr")(1,"td",23)(2,"span"),s(3,"No records found."),o()()())}function it(t,a){if(t&1){let e=w();r(0,"p-panel")(1,"p-table",11),R("onPage",function(n){h(e);let i=_();return x(i.onPageChange(n))})("onHeaderCheckboxToggle",function(n){h(e);let i=_();return x(i.onHeaderCheckboxToggle(n))})("onRowSelect",function(n){h(e);let i=_();return x(i.onRowSelect(n))})("onRowUnselect",function(n){h(e);let i=_();return x(i.onRowUnselect(n))}),g(2,Ye,18,0,"ng-template",null,3,v)(4,Ze,22,18,"ng-template",null,4,v)(6,et,1,3,"ng-template",null,5,v)(8,tt,4,0,"ng-template",null,6,v),o()()}if(t&2){let e=_();m(),c("value",e.store.data().data)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function nt(t,a){if(t&1&&(r(0,"span",34),s(1),I(2,"truncate"),o()),t&2){let e=a.$implicit;c("pTooltip",e.name),m(),M(" ",V(2,2,e.name,30)," ")}}function ot(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function rt(t,a){if(t&1&&(r(0,"div"),g(1,ot,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("from"))}}function at(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function lt(t,a){if(t&1&&(r(0,"div"),g(1,at,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("to"))}}function mt(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function pt(t,a){if(t&1&&(r(0,"div"),g(1,mt,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("pageSize"))}}function st(t,a){if(t&1){let e=w();r(0,"form",24)(1,"div",25)(2,"label",26),s(3,"Outlet"),o(),r(4,"p-select",27),g(5,nt,3,5,"ng-template",null,7,v),o()(),r(7,"div",25)(8,"label",26),s(9,"From - To"),o(),r(10,"div",28),b(11,"p-datepicker",29),g(12,rt,2,1,"div",30),b(13,"p-datepicker",31),g(14,lt,2,1,"div",30),o()(),r(15,"div",25)(16,"label",26),s(17,"Customer"),o(),r(18,"p-autocomplete",32),I(19,"async"),R("completeMethod",function(n){h(e);let i=_();return x(i.onSearchContact(n))}),o()(),r(20,"div",25)(21,"label",26),s(22,"Page Size"),o(),b(23,"input",33),g(24,pt,2,1,"div",30),o()()}if(t&2){let e=_();c("formGroup",e.form),m(4),c("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),m(7),c("iconDisplay","input")("showIcon",!0)("ngClass",E(17,B,e.isInvalid("from"))),m(),c("ngIf",e.isInvalid("from")),m(),c("iconDisplay","input")("showIcon",!0)("ngClass",E(19,B,e.isInvalid("to"))),m(),c("ngIf",e.isInvalid("to")),m(4),c("suggestions",Y(19,15,e.customerSuggestions$)),m(5),c("autoNumeric",X(21,qe))("ngClass",E(22,B,e.isInvalid("pageSize"))),m(),c("ngIf",e.isInvalid("pageSize"))}}var ei=(()=>{class t extends ze{constructor(){super(),this.store=C(O),this.generateJournalService=C(D),this.authService=C(re),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=C(ue),this.dayjsService=C(A)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:l,to:n,pageNumber:i,pageSize:u,export:p,exportPageNumber:Ue,exportPageSize:Le,outletName:Ge,customerID:Ke,paymentState:We}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),from:this.fb.control(this.dayjsService.from(l)?this.dayjsService.from(l).toDate():null),to:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),pageNumber:this.fb.control(i),pageSize:this.fb.control(u,[le.required]),export:this.fb.control(p),exportPageNumber:this.fb.control(Ue),exportPageSize:this.fb.control(Le),outletName:this.fb.control(Ge),customerID:this.fb.control(Ke),paymentState:this.fb.control(We)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((l,[n,i])=>{switch(n){case"customerID":i||(l[n]=je);break;case"from":typeof i=="object"?l[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:l[n]=i!=null?String(i):null;break;case"to":typeof i=="object"?l[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:l[n]=i!=null?String(i):null;break;default:l[n]=i===null?"":i;break}return l},{});console.log("Filter Body:",e),this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}onSearchContact(e){this.customerSuggestions$=this.generateJournalService.getCustomerSuggestions(e.query)}onSearch(e){this.store.updateFilter(f(d({},this.store.filter()),{number:e,pageNumber:1})),this.store.getARCollection(this.store.filter())}onPageChange(e){let l=e.first/e.rows;this.store.updateFilter(f(d({},this.store.filter()),{pageNumber:l+1}))}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(l=>{this.store.onRowUnselect(l)});return}else this.store.onRowUnselect(e.data)}onCreateJournal(){this.generateJournalService.createARJournal(this.store.checkedARCollection()).pipe(H(()=>this.store.getARCollection(this.store.filter))).subscribe()}static{this.\u0275fac=function(l){return new(l||t)}}static{this.\u0275cmp=G({type:t,selectors:[["app-ar-journal"]],features:[Q([O]),K],decls:8,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","AR Collection",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onHeaderCheckboxToggle","onRowSelect","onRowUnselect","value","paginator","rows","totalRecords","lazy"],[2,"width","1rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[2,"width","4rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"innerHTML"],[3,"icon","severity","text"],["colspan","9"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["virtualScroll","","showClear","","filter","","filterBy","name","formControlName","outletName","appendTo","body","optionLabel","name","optionValue","name","placeholder","Select an Outlet",3,"virtualScrollItemSize","options"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["showClear","","formControlName","customerID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(l,n){if(l&1){let i=w();r(0,"app-main-panel",8),q("isDialogFilterVisibleChange",function(p){return h(i),P(n.isDialogFilterVisible,p)||(n.isDialogFilterVisible=p),x(p)})("isInitDialogFilterVisibleChange",function(p){return h(i),P(n.isInitDialogFilterVisible,p)||(n.isInitDialogFilterVisible=p),x(p)}),R("filterConfirmed",function(){return h(i),x(n.onFilterOKEvent())})("search",function(p){return h(i),x(n.onSearch(p))}),g(1,Xe,1,1,"ng-template",null,0,v)(3,it,10,5,"ng-template",null,1,v),s(5," <"),g(6,st,25,24,"ng-template",null,2,v),o()}l&2&&(c("isSearchableInput",!0)("isFilterable",!0),$("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible),c("scrollable",!0))},dependencies:[Ve,oe,Z,ee,te,ie,ne,Pe,Ne,ke,Me,xe,he,be,Ce,fe,se,ae,me,pe,ce,de,Je,Fe,De,Ae,He,Be,ge,_e,Ee,Te,Ie,Oe],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{ei as ARJournalComponent};
1
+ import{a as D}from"./chunk-FXATM6DM.js";import{a as je}from"./chunk-G4XX7EU2.js";import{a as Oe}from"./chunk-JRVYSBUZ.js";import{a as Be,b as He}from"./chunk-BLR3HBYP.js";import{a as re}from"./chunk-GZYN6L4H.js";import{b as A}from"./chunk-GNLE4WCA.js";import{a as ze}from"./chunk-XKI7WLHE.js";import"./chunk-7DYACF4D.js";import"./chunk-NZN6QJR3.js";import"./chunk-IGWIRCAS.js";import{a as z,b as j}from"./chunk-3A4BFUGD.js";import{d as Ne,i as ke,j as Me,k as Pe}from"./chunk-EL5BUFMO.js";import{a as Ae,b as De}from"./chunk-EQ4PLHI4.js";import"./chunk-H7Q35Y7G.js";import"./chunk-R7N6BWL5.js";import"./chunk-2AAVNIG7.js";import{a as Fe,b as Je}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"./chunk-6GN3MGBY.js";import"./chunk-Q24GCSGD.js";import{g as Ee,h as Ve}from"./chunk-Y7P7BGVH.js";import{b as Ie,c as Te}from"./chunk-VGNJD35F.js";import{a as Ce,b as be}from"./chunk-2XUSZCQL.js";import{a as y,b as Se,c as ve,d as ye,e as we,f as Re}from"./chunk-YV2QJ63P.js";import"./chunk-ARH3WEEF.js";import{n as _e,o as ge,w as he,x as xe}from"./chunk-H6HNANYB.js";import"./chunk-2D2YD753.js";import{b as ae,c as le,e as me,f as pe,k as se,l as ce,o as de,u as ue,x as fe}from"./chunk-OIBDX2CA.js";import"./chunk-AOOG6YOT.js";import"./chunk-4TTCPL3N.js";import"./chunk-2MKKFLNJ.js";import{h as Z,j as ee,k as te,n as ie,p as ne,s as oe}from"./chunk-VZ5CMS5O.js";import"./chunk-F2X3VGZZ.js";import{$b as w,Bb as K,Cc as Q,Db as g,Dc as X,Ec as E,Ha as k,Lb as c,Nc as I,Oc as Y,Pc as V,Rc as v,Vb as r,Wb as o,Xb as b,Y as N,_ as H,bd as T,c as F,cb as U,db as L,ec as R,fc as _,hb as m,ia as C,qa as h,ra as x,rc as s,s as J,sc as S,tc as M,vc as W,wc as $,xb as G,xc as P,yc as q}from"./chunk-NMCKMUY4.js";import{a as d,b as f}from"./chunk-YQFG5XE2.js";var $e={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,customerID:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,paymentState:0}},filter:{number:null,outletName:null,from:null,to:null,customerID:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,paymentState:0}},O=Se(Re($e),ve(t=>({first:T(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:T(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:T(()=>t.data().data.some(a=>a.checked)),checkedARCollection:T(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),we(t=>{let a=C(D),e=C(A);return{updateFilter(n){y(t,i=>f(d({},i),{filter:d(d({},i.filter),n)}))},onRowSelect(n){y(t,i=>{let u=i.data.data.map(p=>p.id===n.id?f(d({},p),{checked:!0}):p);return f(d({},i),{data:f(d({},i.data),{data:u})})})},onRowUnselect(n){y(t,i=>{let u=i.data.data.map(p=>p.id===n.id?f(d({},p),{checked:!1}):p);return f(d({},i),{data:f(d({},i.data),{data:u})})})},onHeaderCheckboxToggle(n){y(t,i=>{let u=i.data.data.map(p=>f(d({},p),{checked:n}));return f(d({},i),{data:f(d({},i.data),{data:u})})})},getARLoader:z(F(N(()=>a.getARJournalLoader().pipe(j({next:n=>{y(t,i=>f(d({},i),{meta:n}))},error:n=>{console.error("Error fetching AR collection loader:",n)}}))))),getARCollection:z(F(J(n=>Object.entries(n).reduce((i,[u,p])=>(p!=null&&(i[u]=p),i),{})),N(n=>a.getARJournal(n).pipe(J(i=>f(d({},i),{data:i.data.map(u=>f(d({},u),{due:e.from(u.due)?e.from(u.due).format():null,checked:!1}))})),j({next:i=>{y(t,u=>f(d({},u),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),ye(t=>({onInit:()=>{t.getARLoader(),t.getARCollection(t.filter)}})));var B=t=>({"ng-invalid ng-dirty":t}),qe=()=>({});function Qe(t,a){if(t&1){let e=w();r(0,"p-button",10),R("onClick",function(){h(e);let n=_(2);return x(n.onCreateJournal())}),o()}}function Xe(t,a){if(t&1&&g(0,Qe,1,0,"p-button",9),t&2){let e=_();c("ngIf",e.store.hasCheckedRows())}}function Ye(t,a){t&1&&(r(0,"tr")(1,"th",12),b(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),s(4,"Outlet"),o(),r(5,"th",14),s(6,"Number"),o(),r(7,"th",15),s(8,"Customer"),o(),r(9,"th",16),s(10,"Date"),o(),r(11,"th",16),s(12,"Due"),o(),r(13,"th",15),s(14,"Note"),o(),r(15,"th",17),s(16,"Payment"),o(),b(17,"th",18),o())}function Ze(t,a){if(t&1&&(r(0,"tr")(1,"td"),b(2,"p-tableCheckbox",19),o(),r(3,"td"),s(4),o(),r(5,"td")(6,"a",20),s(7),o()(),r(8,"td"),s(9),o(),r(10,"td"),s(11),I(12,"date"),o(),r(13,"td"),s(14),I(15,"date"),o(),r(16,"td"),b(17,"div",21),o(),r(18,"td"),s(19),o(),r(20,"td"),b(21,"p-button",22),o()()),t&2){let e=a.$implicit,l=_(2);m(2),c("value",e),m(2),S(e.outlet),m(2),c("href",l.authService.getTenantExternalURL()+"/menu/Debt/Debt/Join_Invoice/New_Join_Invoice/Info?ID="+e.id,L),m(),M(" ",e.number," "),m(2),S(e.customer),m(2),S(V(12,12,e.date,"d MMM y")),m(3),S(e.due?V(15,15,e.due,"d MMM y hh:mm"):"-"),m(3),c("innerHTML",e.note,U),m(2),S(e.payment),m(2),c("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function et(t,a){if(t&1&&s(0),t&2){let e=_(2);W(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function tt(t,a){t&1&&(r(0,"tr")(1,"td",23)(2,"span"),s(3,"No records found."),o()()())}function it(t,a){if(t&1){let e=w();r(0,"p-panel")(1,"p-table",11),R("onPage",function(n){h(e);let i=_();return x(i.onPageChange(n))})("onHeaderCheckboxToggle",function(n){h(e);let i=_();return x(i.onHeaderCheckboxToggle(n))})("onRowSelect",function(n){h(e);let i=_();return x(i.onRowSelect(n))})("onRowUnselect",function(n){h(e);let i=_();return x(i.onRowUnselect(n))}),g(2,Ye,18,0,"ng-template",null,3,v)(4,Ze,22,18,"ng-template",null,4,v)(6,et,1,3,"ng-template",null,5,v)(8,tt,4,0,"ng-template",null,6,v),o()()}if(t&2){let e=_();m(),c("value",e.store.data().data)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function nt(t,a){if(t&1&&(r(0,"span",34),s(1),I(2,"truncate"),o()),t&2){let e=a.$implicit;c("pTooltip",e.name),m(),M(" ",V(2,2,e.name,30)," ")}}function ot(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function rt(t,a){if(t&1&&(r(0,"div"),g(1,ot,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("from"))}}function at(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function lt(t,a){if(t&1&&(r(0,"div"),g(1,at,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("to"))}}function mt(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function pt(t,a){if(t&1&&(r(0,"div"),g(1,mt,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("pageSize"))}}function st(t,a){if(t&1){let e=w();r(0,"form",24)(1,"div",25)(2,"label",26),s(3,"Outlet"),o(),r(4,"p-select",27),g(5,nt,3,5,"ng-template",null,7,v),o()(),r(7,"div",25)(8,"label",26),s(9,"From - To"),o(),r(10,"div",28),b(11,"p-datepicker",29),g(12,rt,2,1,"div",30),b(13,"p-datepicker",31),g(14,lt,2,1,"div",30),o()(),r(15,"div",25)(16,"label",26),s(17,"Customer"),o(),r(18,"p-autocomplete",32),I(19,"async"),R("completeMethod",function(n){h(e);let i=_();return x(i.onSearchContact(n))}),o()(),r(20,"div",25)(21,"label",26),s(22,"Page Size"),o(),b(23,"input",33),g(24,pt,2,1,"div",30),o()()}if(t&2){let e=_();c("formGroup",e.form),m(4),c("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),m(7),c("iconDisplay","input")("showIcon",!0)("ngClass",E(17,B,e.isInvalid("from"))),m(),c("ngIf",e.isInvalid("from")),m(),c("iconDisplay","input")("showIcon",!0)("ngClass",E(19,B,e.isInvalid("to"))),m(),c("ngIf",e.isInvalid("to")),m(4),c("suggestions",Y(19,15,e.customerSuggestions$)),m(5),c("autoNumeric",X(21,qe))("ngClass",E(22,B,e.isInvalid("pageSize"))),m(),c("ngIf",e.isInvalid("pageSize"))}}var ei=(()=>{class t extends ze{constructor(){super(),this.store=C(O),this.generateJournalService=C(D),this.authService=C(re),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=C(ue),this.dayjsService=C(A)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:l,to:n,pageNumber:i,pageSize:u,export:p,exportPageNumber:Ue,exportPageSize:Le,outletName:Ge,customerID:Ke,paymentState:We}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),from:this.fb.control(this.dayjsService.from(l)?this.dayjsService.from(l).toDate():null),to:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),pageNumber:this.fb.control(i),pageSize:this.fb.control(u,[le.required]),export:this.fb.control(p),exportPageNumber:this.fb.control(Ue),exportPageSize:this.fb.control(Le),outletName:this.fb.control(Ge),customerID:this.fb.control(Ke),paymentState:this.fb.control(We)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((l,[n,i])=>{switch(n){case"customerID":i||(l[n]=je);break;case"from":typeof i=="object"?l[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:l[n]=i!=null?String(i):null;break;case"to":typeof i=="object"?l[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:l[n]=i!=null?String(i):null;break;default:l[n]=i===null?"":i;break}return l},{});console.log("Filter Body:",e),this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}onSearchContact(e){this.customerSuggestions$=this.generateJournalService.getCustomerSuggestions(e.query)}onSearch(e){this.store.updateFilter(f(d({},this.store.filter()),{number:e,pageNumber:1})),this.store.getARCollection(this.store.filter())}onPageChange(e){let l=e.first/e.rows;this.store.updateFilter(f(d({},this.store.filter()),{pageNumber:l+1}))}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(l=>{this.store.onRowUnselect(l)});return}else this.store.onRowUnselect(e.data)}onCreateJournal(){this.generateJournalService.createARJournal(this.store.checkedARCollection()).pipe(H(()=>this.store.getARCollection(this.store.filter))).subscribe()}static{this.\u0275fac=function(l){return new(l||t)}}static{this.\u0275cmp=G({type:t,selectors:[["app-ar-journal"]],features:[Q([O]),K],decls:8,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","AR Collection",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onHeaderCheckboxToggle","onRowSelect","onRowUnselect","value","paginator","rows","totalRecords","lazy"],[2,"width","1rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[2,"width","4rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"innerHTML"],[3,"icon","severity","text"],["colspan","9"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["virtualScroll","","showClear","","filter","","filterBy","name","formControlName","outletName","appendTo","body","optionLabel","name","optionValue","name","placeholder","Select an Outlet",3,"virtualScrollItemSize","options"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["showClear","","formControlName","customerID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(l,n){if(l&1){let i=w();r(0,"app-main-panel",8),q("isDialogFilterVisibleChange",function(p){return h(i),P(n.isDialogFilterVisible,p)||(n.isDialogFilterVisible=p),x(p)})("isInitDialogFilterVisibleChange",function(p){return h(i),P(n.isInitDialogFilterVisible,p)||(n.isInitDialogFilterVisible=p),x(p)}),R("filterConfirmed",function(){return h(i),x(n.onFilterOKEvent())})("search",function(p){return h(i),x(n.onSearch(p))}),g(1,Xe,1,1,"ng-template",null,0,v)(3,it,10,5,"ng-template",null,1,v),s(5," <"),g(6,st,25,24,"ng-template",null,2,v),o()}l&2&&(c("isSearchableInput",!0)("isFilterable",!0),$("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible),c("scrollable",!0))},dependencies:[Ve,oe,Z,ee,te,ie,ne,Pe,Ne,ke,Me,xe,he,be,Ce,fe,se,ae,me,pe,ce,de,Je,Fe,De,Ae,He,Be,ge,_e,Ee,Te,Ie,Oe],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{ei as ARJournalComponent};