dealposbooks 5.41.0 → 5.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chunk-242HAH3I.js +1 -0
- package/{chunk-6XPCPRHF.js → chunk-2GE6IJDH.js} +1 -1
- package/{chunk-4TW5N3R5.js → chunk-2LQVI4EI.js} +1 -1
- package/{chunk-WDQXDERR.js → chunk-34OIHS3O.js} +1 -1
- package/chunk-3DX5CNAC.js +129 -0
- package/{chunk-ZXXBWTY6.js → chunk-3KVSQTYU.js} +1 -1
- package/{chunk-UVIJU7TM.js → chunk-3KYU6FI2.js} +1 -1
- package/{chunk-MO4YK4HT.js → chunk-46ZIN2SL.js} +1 -1
- package/{chunk-H4KAOKJR.js → chunk-4FPYSVLT.js} +1 -1
- package/{chunk-IIW75XWJ.js → chunk-4IUATLDH.js} +1 -1
- package/{chunk-4ZDV2QVO.js → chunk-5DWE547V.js} +1 -1
- package/{chunk-MUFRLGLG.js → chunk-5JV52UYK.js} +1 -1
- package/{chunk-AOOR6RAK.js → chunk-6GMA5NUD.js} +1 -1
- package/chunk-6K5LNQ4J.js +7 -0
- package/{chunk-C4LGY75Z.js → chunk-6LDKZMHR.js} +12 -12
- package/{chunk-5YZ63KSK.js → chunk-6V36DOK2.js} +1 -1
- package/{chunk-IFNPFJH5.js → chunk-6WJFHQYD.js} +1 -1
- package/chunk-72LNXEXV.js +193 -0
- package/chunk-75PF5HO6.js +1 -0
- package/{chunk-N5W3C4LG.js → chunk-76LPTGLX.js} +1 -1
- package/{chunk-MDNCQKUT.js → chunk-7FFMPB6T.js} +1 -1
- package/{chunk-B5RBLDGE.js → chunk-ACTRMWEI.js} +1 -1
- package/{chunk-EGS6BIKL.js → chunk-AGWRTDO7.js} +1 -1
- package/{chunk-NTCCFR6P.js → chunk-AJZ7YLT4.js} +1 -1
- package/{chunk-PTEBSIFB.js → chunk-AL647DUL.js} +1 -1
- package/{chunk-76QGHXHT.js → chunk-ARXP327B.js} +1 -1
- package/{chunk-W6IKDXXT.js → chunk-ATJ55H5D.js} +1 -1
- package/{chunk-TKBMWC2X.js → chunk-BJ4RON42.js} +1 -1
- package/{chunk-XZIY7XVI.js → chunk-BTMQCF6U.js} +1 -1
- package/{chunk-64ODJHGP.js → chunk-CNXEJBY5.js} +1 -1
- package/{chunk-BSFKUGYO.js → chunk-CWHL7PNC.js} +1 -1
- package/{chunk-S2Q6V4IV.js → chunk-CX3TZ3F3.js} +1 -1
- package/{chunk-Y7NHB6MD.js → chunk-D5ADAY3I.js} +1 -1
- package/{chunk-XOEBC23H.js → chunk-DCSJM3I3.js} +1 -1
- package/{chunk-3267XKO5.js → chunk-DUPO34WD.js} +1 -1
- package/{chunk-CDXFHUDN.js → chunk-E3QNEH3B.js} +1 -1
- package/{chunk-DUEYD2IO.js → chunk-E3ZGQRZ3.js} +1 -1
- package/chunk-EFDD6Q3K.js +1 -0
- package/{chunk-NI4XE6XQ.js → chunk-EOT2WEXN.js} +1 -1
- package/{chunk-OCFTAJHS.js → chunk-EPLCCBQT.js} +1 -1
- package/{chunk-IANH6F5O.js → chunk-H32TBMJG.js} +1 -1
- package/{chunk-4XLWJIA4.js → chunk-HBYPFYO2.js} +1 -1
- package/{chunk-7UB4B7A7.js → chunk-HEX727RH.js} +1 -1
- package/{chunk-QC7LTJLT.js → chunk-HGTQEDZZ.js} +1 -1
- package/{chunk-A7LRQMLA.js → chunk-I7ILLTFH.js} +1 -1
- package/{chunk-EALZUKSJ.js → chunk-IJTQE2H4.js} +1 -1
- package/chunk-JI5CHNB7.js +7 -0
- package/{chunk-T4TFJFL4.js → chunk-K4P3JOA6.js} +1 -1
- package/{chunk-RB3MCWL5.js → chunk-KD7RTUDM.js} +1 -1
- package/{chunk-BRCJWPEZ.js → chunk-KLKIEREL.js} +1 -1
- package/chunk-KXE3J4PK.js +1 -0
- package/{chunk-WNA57NZF.js → chunk-L3PZS6EL.js} +1 -1
- package/{chunk-BWBNGOLL.js → chunk-LSS5QMZU.js} +1 -1
- package/{chunk-V6VS3FMZ.js → chunk-M5PA3FZY.js} +1 -1
- package/{chunk-I4WD74I3.js → chunk-MAID3JDN.js} +1 -1
- package/chunk-MJ6ZJF3H.js +1 -0
- package/{chunk-UTG7WNU7.js → chunk-MPHY6FVN.js} +1 -1
- package/{chunk-4R64ZVCC.js → chunk-MR2SA2JX.js} +1 -1
- package/{chunk-Y52DQWVS.js → chunk-MS6WBVQX.js} +1 -1
- package/{chunk-X3JXYOSR.js → chunk-MWFWXJG3.js} +1 -1
- package/{chunk-VDXMHX3J.js → chunk-MZAFOBGT.js} +1 -1
- package/{chunk-RNPNKSFR.js → chunk-NHZLS6JU.js} +1 -1
- package/{chunk-GLOECGB7.js → chunk-NMSYINDE.js} +1 -1
- package/{chunk-IIS3WYGB.js → chunk-NY7ETA6V.js} +1 -1
- package/chunk-O5K5EPK7.js +1 -0
- package/{chunk-5AD3KAHO.js → chunk-OB46Z7ZH.js} +1 -1
- package/{chunk-P6CXZZTO.js → chunk-ODRV6XWO.js} +1 -1
- package/{chunk-YTNI3IAH.js → chunk-OIMJHXJV.js} +1 -1
- package/{chunk-YS5U5SXP.js → chunk-ORLKNWW4.js} +1 -1
- package/{chunk-4IEK5V2S.js → chunk-PGHK6GXT.js} +1 -1
- package/{chunk-K5CHFPJQ.js → chunk-QE4CQXCC.js} +1 -1
- package/chunk-SB5MSLCX.js +2 -0
- package/{chunk-5B3BG43K.js → chunk-SPKOXGSS.js} +1 -1
- package/{chunk-FOCWONCO.js → chunk-SSAF54X3.js} +1 -1
- package/{chunk-QFOKESND.js → chunk-TLAUXEMR.js} +1 -1
- package/{chunk-E2R6VN7Z.js → chunk-TLGQR5YK.js} +1 -1
- package/{chunk-CCBBIKGU.js → chunk-TVIJHSEG.js} +1 -1
- package/{chunk-KIFK2NRF.js → chunk-UDIFKJ7M.js} +1 -1
- package/chunk-UKBDY33R.js +1 -0
- package/{chunk-VHKZXNG3.js → chunk-ULK67XHG.js} +1 -1
- package/{chunk-T5LNS6MU.js → chunk-ULNWFQ5X.js} +1 -1
- package/{chunk-WZWAFKRU.js → chunk-VEIICIKO.js} +1 -1
- package/{chunk-A25JUSCO.js → chunk-VENJDQOT.js} +1 -1
- package/chunk-VOIH4XOQ.js +1 -0
- package/{chunk-OUIY2TC7.js → chunk-VPQ6B3ID.js} +2 -2
- package/{chunk-MASZROSE.js → chunk-VRKBMD72.js} +1 -1
- package/{chunk-4WAIBWB3.js → chunk-W6XE64JK.js} +1 -1
- package/{chunk-KKZF4RQM.js → chunk-WLKS6LBU.js} +1 -1
- package/{chunk-AE7ZMPUT.js → chunk-WPQGYVNT.js} +1 -1
- package/{chunk-PS4MFIBX.js → chunk-WXT6EZ2V.js} +1 -1
- package/{chunk-RZI2OI6V.js → chunk-X4KTMWVO.js} +1 -1
- package/{chunk-O2725QPF.js → chunk-XCIAUU4G.js} +2 -2
- package/{chunk-ZEVIDUTH.js → chunk-XL33YQXU.js} +1 -1
- package/{chunk-UA264VBG.js → chunk-XLPFLHKU.js} +1 -1
- package/chunk-XZ4KHRLK.js +1 -0
- package/{chunk-2JNTUTNL.js → chunk-YARSQDTX.js} +1 -1
- package/{chunk-YIAUCENA.js → chunk-YMGWRELP.js} +1 -1
- package/{chunk-5PDLMIPF.js → chunk-YYMZW726.js} +2 -2
- package/{chunk-R3JWL2J6.js → chunk-ZDTMCWOO.js} +1 -1
- package/{chunk-LNN3TWH2.js → chunk-ZEWON3MW.js} +1 -1
- package/{chunk-HBNGOJIS.js → chunk-ZOCDX3DT.js} +1 -1
- package/index.html +2 -2
- package/main-WZTRI4K4.js +1 -0
- package/package.json +1 -1
- package/chunk-4V6IW37R.js +0 -1
- package/chunk-7CUSFSFC.js +0 -1
- package/chunk-7IC4BZ6J.js +0 -7
- package/chunk-DOKG43W6.js +0 -1
- package/chunk-HWZKSQ5E.js +0 -1
- package/chunk-JGPCJCYI.js +0 -1
- package/chunk-JO34HDB4.js +0 -129
- package/chunk-KUHLDSNT.js +0 -1
- package/chunk-NHXCR55X.js +0 -193
- package/chunk-NM7Z2FA7.js +0 -1
- package/chunk-TEEBLB6T.js +0 -7
- package/chunk-VU532YE3.js +0 -2
- package/chunk-ZVRETQOI.js +0 -1
- package/chunk-ZW6ONWWO.js +0 -1
- package/main-ILDJZYPX.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as pt,b as dt}from"./chunk-LNN3TWH2.js";import{a as ut}from"./chunk-Y52DQWVS.js";import{a as $n,b as Ee,c as Pe,d as Kn}from"./chunk-7UB4B7A7.js";import{a as Rn,b as Bn}from"./chunk-TKBMWC2X.js";import"./chunk-64ODJHGP.js";import{a as qn,b as zn}from"./chunk-V6VS3FMZ.js";import{a as Gn}from"./chunk-XKI7WLHE.js";import{a as Dn}from"./chunk-UTG7WNU7.js";import"./chunk-GLOECGB7.js";import{a as we}from"./chunk-YS5U5SXP.js";import"./chunk-KKZF4RQM.js";import{a as at,b as lt}from"./chunk-RNPNKSFR.js";import{a as ct,b as mt,c as On,d as Fn,i as Nn,j as Vn,k as Ln}from"./chunk-BRCJWPEZ.js";import"./chunk-N5W3C4LG.js";import"./chunk-BSFKUGYO.js";import"./chunk-MASZROSE.js";import{a as X}from"./chunk-K5CHFPJQ.js";import{a as P}from"./chunk-7CUSFSFC.js";import{b as vn}from"./chunk-CDXFHUDN.js";import{a as In}from"./chunk-NI4XE6XQ.js";import{a as Mn,b as st}from"./chunk-RZI2OI6V.js";import"./chunk-A7LRQMLA.js";import"./chunk-4TW5N3R5.js";import"./chunk-NTCCFR6P.js";import"./chunk-W6IKDXXT.js";import"./chunk-5B3BG43K.js";import"./chunk-UVIJU7TM.js";import"./chunk-EALZUKSJ.js";import{a as rt,b as K}from"./chunk-PS4MFIBX.js";import{f as kn,h as $}from"./chunk-4IEK5V2S.js";import{b as ot,c as _e}from"./chunk-WNA57NZF.js";import{a as se,b as ce}from"./chunk-MUFRLGLG.js";import{a as J,b as Tn,c as An,e as wn,f as En,g as Pn}from"./chunk-B5RBLDGE.js";import{c as Je,d as an,f as ln}from"./chunk-76QGHXHT.js";import{a as Tt,f as At,n as nt,o as it,p as bn,t as Sn,u as wt,w as ae,x as le}from"./chunk-MDNCQKUT.js";import"./chunk-4V6IW37R.js";import{Aa as gn,D as yt,Da as hn,I as sn,Ia as xn,K as cn,La as Ae,M as mn,Ma as De,Oa as Cn,Q as et,R as tt,Ua as yn,W as pn,X as It,_ as dn,b as oe,c as fe,da as un,e as Y,f as ye,g as on,ga as fn,i as L,j as Xe,k as rn,ka as _n,l as Ie,na as bt,o as be,qa as re,u as ve,va as vt,w as Se,wa as St,x as Te}from"./chunk-NHXCR55X.js";import{b as ne,d as ie,e as B,l as V}from"./chunk-DOKG43W6.js";import{a as nn}from"./chunk-A25JUSCO.js";import"./chunk-R3JWL2J6.js";import{c as xt,d as Ct,f as Ve,h as Le}from"./chunk-F2X3VGZZ.js";import{h as z,j as We,k as F,l as ht,m as en,p as tn,q as Ye,s as N,t as Ne}from"./chunk-VU532YE3.js";import{Ab as Oe,Bc as he,Cb as u,Cc as R,D as Ke,Dc as T,Ec as Yt,Ga as v,J as qe,Jb as k,Kb as s,L as $t,Mc as de,Nb as He,Nc as xe,O as Kt,Ob as Fe,Oc as Xt,Pb as Ut,Qb as jt,Qc as I,Sb as Zt,Tb as Qt,Ub as a,Vb as r,Wb as h,X as D,Xb as H,Yb as U,Z as A,Zc as ue,_b as w,_c as Ce,aa as qt,ad as W,ba as ze,bb as Me,bd as Jt,c as $e,ca as zt,cb as Gt,dc as S,ec as m,gb as c,ha as x,jc as Ue,kc as pe,lc as j,mb as gt,mc as Z,pa as _,pc as te,qa as g,qc as p,rc as E,s as G,sc as Q,t as Bt,ta as Ge,uc as Wt,vc as je,wb as O,wc as Ze,xb as Ht,xc as Qe,za as ee}from"./chunk-7IC4BZ6J.js";import{a as C,b as y}from"./chunk-YQFG5XE2.js";var ii=["class","page"],oi=t=>({id:t}),ri=()=>({"overflow-x":"auto"}),ai=t=>({"table-borderless":t}),li=t=>["fa-solid",t],si=t=>["/pages/journal/journal-entry/",t];function ci(t,l){t&1&&h(0,"p-button",8)}function mi(t,l){if(t&1){let e=w();a(0,"p-button",9),S("onClick",function(){_(e);let i=m(2);return g(i.onDelete())}),r()}}function pi(t,l){if(t&1&&(a(0,"div",4)(1,"p-button-group"),u(2,ci,1,0,"p-button",5)(3,mi,1,0,"p-button",6),r(),a(4,"a",7),p(5,"Ledger"),r()()),t&2){let e,n=m();c(2),s("ngIf",n.roleService.coa.edit),c(),s("ngIf",n.roleService.coa.delete),c(),s("queryParams",T(3,oi,(e=n.COAInfo())==null?null:e.id))}}function di(t,l){if(t&1&&h(0,"i",25),t&2){let e=l.checked;s("ngClass",T(1,li,e?"fa-check":"fa-xmark"))}}function ui(t,l){if(t&1&&(H(0),p(1),de(2,"number"),U()),t&2){let e=m().$implicit;c(),Q(" ",xe(2,1,e.creditAmount)," ")}}function fi(t,l){if(t&1&&(H(0),p(1),de(2,"number"),U()),t&2){let e=m().$implicit;c(),Q(" ",xe(2,1,e.debitAmount)," ")}}function _i(t,l){if(t&1&&(a(0,"tr")(1,"td"),p(2),de(3,"date"),r(),a(4,"td")(5,"div",26)(6,"a",27),p(7),r()()(),a(8,"td",28),u(9,ui,3,3,"ng-container",29),r(),a(10,"td",30),u(11,fi,3,3,"ng-container",29),r(),a(12,"td",31),p(13),de(14,"number"),r()()),t&2){let e=l.$implicit;c(2),E(Xt(3,6,e.date,"dd MMM yyyy")),c(4),s("routerLink",T(11,si,e.id)),c(),E(e.number),c(2),s("ngIf",e.creditAmount!==0),c(2),s("ngIf",e.debitAmount!==0),c(2),Q(" ",xe(14,9,e.balance)," ")}}function gi(t,l){t&1&&(a(0,"tr")(1,"td",32)(2,"div",33),h(3,"img",34),a(4,"div",26)(5,"span",35),p(6,"No Data Available"),r(),a(7,"span",35),p(8,"Your data will be shown here once it's available"),r()()()()())}function hi(t,l){if(t&1){let e=w();a(0,"div",12)(1,"div",13)(2,"p-card",14)(3,"div",15)(4,"div",16)(5,"div",17),p(6,"Name"),r(),a(7,"div",18),p(8),r()(),a(9,"div",16)(10,"div",17),p(11,"Code"),r(),a(12,"div",18),p(13),r()(),a(14,"div",16)(15,"div",17),p(16,"Category"),r(),a(17,"div",18),p(18),r()(),a(19,"div",16)(20,"div",17),p(21,"Note"),r(),a(22,"div",18),p(23),r()(),a(24,"div",16)(25,"div",17),p(26,"Outlet"),r(),a(27,"div",18),p(28),r()(),a(29,"div",16)(30,"div",17),p(31,"Discontinued"),r(),a(32,"div",18)(33,"p-toggleswitch",19),S("onChange",function(i){_(e);let o=m(2);return g(o.onDiscontinued(i))}),u(34,di,1,3,"ng-template",null,2,I),r()()(),a(36,"div",16)(37,"div",17),p(38,"Access Type"),r(),a(39,"div",18),p(40),r()()()()(),a(41,"div",20)(42,"p-card",21)(43,"table",22)(44,"thead")(45,"tr")(46,"th",23),p(47,"Date"),r(),a(48,"th",23),p(49,"Number"),r(),a(50,"th",24),p(51,"Credit"),r(),a(52,"th",24),p(53,"Debit"),r(),a(54,"th",24),p(55,"Balance"),r()()(),a(56,"tbody"),Zt(57,_i,15,13,"tr",null,jt),u(59,gi,9,0,"tr"),r()()()()()}if(t&2){let e,n,i,o,d,f,b=m(2);c(8),E((e=b.COAInfo().name)!==null&&e!==void 0?e:"-"),c(5),E((n=b.COAInfo().code)!==null&&n!==void 0?n:"-"),c(5),E((i=b.COAInfo().category)!==null&&i!==void 0?i:"-"),c(5),E((o=b.COAInfo().note)!==null&&o!==void 0?o:"-"),c(5),E((d=b.COAInfo().outletName)!==null&&d!==void 0?d:"-"),c(5),s("ngModel",b.COAInfo().bin),c(7),E((f=b.COAInfo().accessType)!==null&&f!==void 0?f:"-"),c(2),He(R(11,ri)),c(),s("ngClass",T(12,ai,b.COAInfo().transactions.length===0)),c(14),Qt(b.COAInfo().transactions),c(2),Ut(b.COAInfo().transactions.length===0?59:-1)}}function xi(t,l){if(t&1&&(a(0,"div",10),u(1,hi,60,14,"div",11),r()),t&2){let e=m();c(),s("ngIf",e.COAInfo())}}var Hn=(()=>{class t{constructor(){this.#e=x(X),this.#t=x(ne),this.router=x(ie),this.COAInfo=v(null),this.checked=v(!1),this.roleService=x(we)}#e;#t;ngOnInit(){this.#t.paramMap.pipe(P("params"),D(e=>this.#e.getChartAccountById(e.get("id"))),A(e=>this.COAInfo.set(e)),P("response")).subscribe()}onDelete(){if(!confirm("Are you sure you want to delete this Chart of Accounts?"))return;let n=[this.#t.snapshot.paramMap.get("id")];this.#e.deleteChartAccount(n).pipe(A(()=>{this.router.navigate(["/pages/chart-of-account/account"])})).subscribe()}onDiscontinued(e){this.#e.discountedChartAccounts(this.#t.snapshot.paramMap.get("id"),{Discontinued:e.checked}).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=O({type:t,selectors:[["app-coa-account-info",8,"page"]],attrs:ii,decls:5,vars:1,consts:[["actionButton",""],["content",""],["handle",""],["pageTitle","Chart of Account Details",3,"overflowScroll"],[1,"d-flex","gap-2"],["routerLink","edit","severity","secondary","outlined","","label","Edit","icon","fa-solid fa-pen-to-square",4,"ngIf"],["severity","secondary","outlined","","label","Delete","icon","fa-solid fa-trash",3,"onClick",4,"ngIf"],["routerLink","/pages/report/general-ledger",1,"p-button",3,"queryParams"],["routerLink","edit","severity","secondary","outlined","","label","Edit","icon","fa-solid fa-pen-to-square"],["severity","secondary","outlined","","label","Delete","icon","fa-solid fa-trash",3,"onClick"],[1,"container-fluid"],["class","row justify-content-center mt-3 px-2",4,"ngIf"],[1,"row","justify-content-center","mt-3","px-2"],[1,"col","col-lg-5"],["styleClass","h-100"],[1,"d-flex","flex-column","row-gap-4"],[1,"row"],[1,"col","col-lg-4"],[1,"col"],[3,"onChange","ngModel"],[1,"col","col-lg-7"],["styleClass","h-100",1,"right-panel","h-100"],[1,"table",3,"ngClass"],["scope","col"],["scope","col",1,"text-end"],[3,"ngClass"],[1,"d-flex","flex-column"],["target","_blank",1,"link","link-primary",3,"routerLink"],[1,"text-danger","text-end"],[4,"ngIf"],[1,"text-success","text-end"],[1,"text-end"],["colspan","5",1,"text-center"],[1,"d-flex","flex-column","align-items-center","gap-2"],["src","https://res.cloudinary.com/pos/image/upload/v1705388070/POS/Images/Cashier/globalnodata.svg","alt","No Data"],[1,"text-secondary","text-opacity-75"]],template:function(n,i){n&1&&(a(0,"app-main-panel",3),u(1,pi,6,5,"ng-template",null,0,I)(3,xi,2,1,"ng-template",null,1,I),r()),n&2&&s("overflowScroll",!0)},dependencies:[N,z,F,Ye,tn,Se,Y,Xe,Je,V,B,$,K,rt,le,ae,dt,pt,On,Dn],styles:[".table>thead>tr>th{background-color:#f6f6f6!important;color:#000!important;font-weight:500!important}"],changeDetection:0})}}return t})();var me=(()=>{class t{constructor(){this.httpService=x(nn)}fetchCOACategories(){return this.httpService.get("","api/ChartOfAccount/Category")}getCOACategoryByID(e){let n={params:e};return this.httpService.get("","api/ChartOfAccount/CategoryInfo",n)}renameCategory(e,n){return this.httpService.put("",`api/ChartOfAccount/RenameCategory/${e}`,n)}updateParentCategory(e,n){return this.httpService.put("",`api/ChartOfAccount/UpdateParentCategory/${e}`,n).pipe()}deleteCategory(e){return this.httpService.delete("",`api/ChartOfAccount/Category/${e}`)}submitCategory(e,n={}){return this.httpService.post("","api/ChartOfAccount/SubmitCategory",e,n)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=ze({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Pt=t=>t?t.reduce((l,e)=>(l.push({label:e.label,data:e.data,key:e.key}),e.children&&e.children.length?l.push(...Pt(e.children)):l.push({label:`${e.label} (no children)`,data:e.data,key:`${e.key}-no-children`}),l),[]):[];var kt=(t,l,e)=>{let n=Math.ceil(e/l),i=(t-1)*l+1,o=Math.min(t*l,e);return{start:i,end:o,totalRecords:e,totalPages:n}};var Ci={filter:{PageSize:20,PageNumber:1,CategoryID:"",Text:"",listOutletID:[],Discontinued:2},options:{entities:[],categories:[]},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"}]},Mt=Tn(En(Ci),Pn("ChartOfAccount"),An(t=>({isAllChecked:W(()=>t.data().every(l=>l.checked)),checkedItems:W(()=>t.data().filter(l=>l.checked)),IDsChecked:W(()=>t.data().filter(l=>l.checked).map(l=>l.id)),categories:W(()=>Pt(t.options.categories())),first:W(()=>{let{start:l}=kt(t.filter().PageNumber,t.filter().PageSize,t.count());return l}),last:W(()=>{let{end:l}=kt(t.filter().PageNumber,t.filter().PageSize,t.count());return l})})),wn(t=>{let l=x(X),e=x(me),n={updateFilter(i){J(t,{filter:C({},i)})},checkedItem(i){if(Array.isArray(i))i.forEach(o=>{let d=t.data().map(f=>f.id===o.id?y(C({},f),{checked:!o.checked}):f);J(t,{data:d})});else{let o=i,d=t.data().map(f=>f.id===o.id?y(C({},f),{checked:!o.checked}):f);J(t,{data:d})}},checkAllCheckbox(){let i=t.data().map(o=>y(C({},o),{checked:!o.checked}));J(t,{data:i})},fetchChartOfAccount:at($e(Ke(()=>!!t.filter()),$t(300),Kt(),D(i=>l.getPaginatedChartAccounts(i).pipe(G(o=>y(C({},o),{data:o.data.map(d=>y(C({},d),{checked:!1}))})),lt({next:o=>J(t,{data:o.data,count:o.count}),error:o=>{J(t,{data:[],count:0}),console.error(o)}}))))),fetchLoader:at($e(D(()=>l.getChartOfAccountLoader().pipe(lt({next:i=>{J(t,{filter:y(C({},t.filter()),{PageSize:i.filter.pageSize,PageNumber:1,CategoryID:i.filter.categoryID||null,Text:"",listOutletID:[]}),options:i.options}),n.fetchChartOfAccount(t.filter)},error:i=>{console.error(i)}}))))),getCategories:at($e(qe(()=>e.fetchCOACategories().pipe(lt({next:i=>{J(t,{options:{entities:t.options.entities(),categories:i}})},error:i=>{console.error(i)}})))))};return n}));var bi=["class","page"],vi=t=>["../account/",t],Si=t=>({"text-decoration-line-through":t}),Ti=()=>["/pages/report/general-ledger"],Ai=t=>({id:t});function wi(t,l){if(t&1){let e=w();a(0,"p-button",13),S("onClick",function(){_(e);let i=m(2);return g(i.deleteCOA())}),r()}}function Ei(t,l){t&1&&h(0,"p-button",14)}function Pi(t,l){if(t&1){let e=w();a(0,"p-button",15),S("onClick",function(){_(e);let i=m(2);return g(i.onExport())}),r()}}function ki(t,l){t&1&&(a(0,"a",16),h(1,"i",17),p(2," Add"),r())}function Mi(t,l){if(t&1&&(a(0,"div",8),u(1,wi,1,0,"p-button",9),a(2,"p-button-group"),u(3,Ei,1,0,"p-button",10)(4,Pi,1,0,"p-button",11),r(),u(5,ki,3,0,"a",12),r()),t&2){let e=m();c(),s("ngIf",e.store.checkedItems().length&&e.roleService.coa.delete),c(2),s("ngIf",e.roleService.coa.create),c(),s("ngIf",e.roleService.global.export),c(),s("ngIf",e.roleService.coa.create)}}function Oi(t,l){t&1&&(a(0,"th",21),h(1,"p-tableHeaderCheckbox"),r())}function Fi(t,l){if(t&1&&(a(0,"tr"),u(1,Oi,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(),s("ngIf",e.roleService.coa.delete)}}function Ni(t,l){if(t&1&&(a(0,"td"),h(1,"p-tableCheckbox",25),r()),t&2){let e=m().$implicit;c(),s("value",e)}}function Vi(t,l){if(t&1&&(a(0,"tr"),u(1,Ni,2,1,"td",22),a(2,"td"),p(3),r(),a(4,"td")(5,"a",23),p(6),r()(),a(7,"td"),p(8),r(),a(9,"td"),p(10),r(),a(11,"td",20)(12,"a",24),p(13),de(14,"number"),r()()()),t&2){let e,n=l.$implicit,i=m(2);c(),s("ngIf",i.roleService.coa.delete),c(2),E(n.code),c(2),s("routerLink",T(12,vi,n.id))("ngClass",T(14,Si,n.bin)),c(),E(n.name),c(2),E(n.category),c(2),E(n.outletName),c(2),s("routerLink",R(16,Ti))("queryParams",T(17,Ai,n.id)),c(),E(xe(14,10,(e=n.balance)!==null&&e!==void 0?e:0))}}function Li(t,l){if(t&1&&p(0),t&2){let e=m(2);Wt(" Showing ",e.store.first()," to ",e.store.last()," of ",e.store.count()," entries ")}}function Di(t,l){t&1&&(a(0,"tr")(1,"td",26)(2,"span"),p(3,"No records found."),r()()())}function Ri(t,l){if(t&1){let e=w();a(0,"p-panel")(1,"p-table",18),S("onLazyLoad",function(i){_(e);let o=m();return g(o.loadData(i))})("onRowSelect",function(i){_(e);let o=m();return g(o.onRowSelect(i))})("onRowUnselect",function(i){_(e);let o=m();return g(o.onRowUnselect(i))})("onHeaderCheckboxToggle",function(i){_(e);let o=m();return g(o.onSelectAll(i))})("onPage",function(i){_(e);let o=m();return g(o.onPageChange(i))}),u(2,Fi,12,1,"ng-template",null,3,I)(4,Vi,15,19,"ng-template",null,4,I)(6,Li,1,3,"ng-template",null,5,I)(8,Di,4,0,"ng-template",null,6,I),r()()}if(t&2){let e=m();c(),s("lazy",!0)("value",e.store.data())("paginator",!0)("rows",e.store.filter().PageSize)("totalRecords",e.store.count())}}function Bi(t,l){if(t&1){let e=w();a(0,"form",28)(1,"div",29)(2,"label",30),p(3,"Outlet"),r(),h(4,"p-multiselect",31),r(),a(5,"div",29)(6,"label",30),p(7,"Category"),r(),a(8,"p-treeselect",32),S("onFocus",function(){_(e);let i=m(2);return g(i.onCategoryFocus())}),r()(),a(9,"div",33)(10,"label",30),p(11,"Page Size"),r(),h(12,"input",34),r(),a(13,"div",33)(14,"label",30),p(15,"Discontinued"),r(),a(16,"div",35)(17,"div",36),h(18,"p-radiobutton",37),a(19,"label",38),p(20,"No"),r()(),a(21,"div",36),h(22,"p-radiobutton",39),a(23,"label",40),p(24,"Yes"),r()(),a(25,"div",36),h(26,"p-radiobutton",39),a(27,"label",40),p(28,"All"),r()()()()()}if(t&2){let e=m(2);s("formGroup",e.formFilter),c(4),s("showClear",!0)("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.options().entities),c(4),s("fluid",!0)("showClear",!0)("options",e.categoryNodes()),c(10),s("value",0),c(4),s("value",1),c(4),s("value",2)}}function $i(t,l){if(t&1&&u(0,Bi,29,11,"form",27),t&2){let e=m();s("ngIf",e.formFilter)}}var jn=(()=>{class t{ngOnInit(){this.store.fetchLoader(),console.log(this.store.filter().PageSize),this.generateFilterForm()}#e;constructor(){this.routeInfo=Zn,this.store=x(Mt),this.#e=x(X),this.modalService=x(an),this.roleService=x(we),this.dialogVisible=v(!1),this.categoryNodes=v([]),this.fb=x(ve),this.isDialogFilterVisible=v(!1),this.generateFilterForm()}generateFilterForm(){this.formFilter=this.fb.group({outletID:this.fb.control([]),categoryID:this.fb.control(null),pageSize:this.fb.control(this.store.filter().PageSize),discontinued:this.fb.control(2)})}onPageChange(e){console.log("Page changed to: ",e),this.store.updateFilter(y(C({},this.store.filter()),{PageNumber:e.first/e.rows+1}))}onCategoryFocus(){this.#e.getCachedCategoriesOptions().pipe(A(e=>this.categoryNodes.set(e))).subscribe()}onRowSelect(e){console.log("Row select event: ",e),this.store.checkedItem(e.data)}onRowUnselect(e){console.log("Row unselect event: ",e),this.store.checkedItem(e.data)}onSelectAll(e){console.log("Select all event: ",e),this.store.checkAllCheckbox()}loadData(e){console.log("Lazy load event: ",e)}onSearch(e){console.log("Search text: ",e),this.store.updateFilter(y(C({},this.store.filter()),{Text:e}))}updateFilter(e,n){this.store.updateFilter(y(C({},this.store.filter()),{[e]:n}))}checkAllCheckBox(){this.store.checkAllCheckbox()}checkedItem(e){this.store.checkedItem(e)}deleteCOA(){confirm("Are you sure you want to delete selected Chart of Accounts?")&&this.#e.deleteChartAccount(this.store.IDsChecked()).pipe(P("response"),A(e=>{console.log("Delete COA Response: ",e),this.store.updateFilter(C({},this.store.filter()))})).subscribe()}onSearchEvent(e){this.store.updateFilter(y(C({},this.store.filter()),{PageNumber:1,Text:e.trim()}))}onFilterEvent(){this.dialogVisible.update(e=>!e)}onFilterOKEvent(){let{categoryID:e,pageSize:n,outletID:i,discontinued:o}=this.formFilter.value;this.store.updateFilter(y(C({},this.store.filter()),{listOutletID:i,CategoryID:e?e.key:"",PageSize:+n,Discontinued:o})),this.isDialogFilterVisible.update(d=>!d)}onExport(){let e=y(C({},this.store.filter()),{ExportPageNumber:1,ExportPageSize:1e4});this.#e.exportChartOfAccounts(e).pipe(A(n=>{let i=n.headers;console.log("All headers:",i.keys());let o=i.get("Content-Disposition"),d=i.get("content-disposition"),f=o??d,b="download.csv";if(f){let q=f.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);q&&q[1]&&(b=decodeURIComponent(q[1].replace(/"/g,"")))}let M=n.body;Kn(M,b,M.type)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=O({type:t,selectors:[["app-cash-of-account",8,"page"]],features:[he([Mt])],attrs:bi,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"],[1,"d-flex","flex-column"],["formControlName","pageSize","type","text","pInputText",""],[1,"d-flex","flex-wrap","gap-4"],[1,"d-flex","align-items-center","gap-2"],["name","discontinued","formControlName","discontinued","inputId","ingredient1",3,"value"],["for","ingredient1",1,"m-0"],["name","discontinued","formControlName","discontinued","inputId","ingredient2",3,"value"],["for","ingredient2",1,"m-0"]],template:function(n,i){if(n&1){let o=w();a(0,"app-main-panel",7),S("search",function(f){return _(o),g(i.onSearchEvent(f))}),Qe("isDialogFilterVisibleChange",function(f){return _(o),Ze(i.isDialogFilterVisible,f)||(i.isDialogFilterVisible=f),g(f)}),S("filterEmitted",function(){return _(o),g(i.onFilterEvent())})("filterConfirmed",function(){return _(o),g(i.onFilterOKEvent())}),u(1,Mi,6,4,"ng-template",null,0,I)(3,Ri,10,5,"ng-template",null,1,I)(5,$i,1,1,"ng-template",null,2,I),r()}n&2&&(s("isSearchableInput",!0),je("isDialogFilterVisible",i.isDialogFilterVisible),s("isFilterable",!0)("scrollable",!0))},dependencies:[N,z,F,Ye,$,ln,dt,pt,ut,Se,rn,oe,Y,ye,V,B,Te,Ie,be,Je,Ln,Fn,Nn,Vn,K,kn,le,ae,st,it,nt,_e,Bn,Rn,Pe,Ee,ce,se,mt,ct],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 qi=["class","page"],zi=()=>["../../"],Ft=t=>({"ng-invalid ng-dirty":t}),Gi=t=>({"ng-dirty ng-invalid":t});function Hi(t,l){if(t&1){let e=w();a(0,"div",5)(1,"a",6),p(2,"Cancel"),r(),a(3,"p-button",7),S("onClick",function(){_(e);let i=m();return g(i.onSubmit())}),r()()}t&2&&(c(),s("routerLink",R(1,zi)))}function Ui(t,l){t&1&&(a(0,"div",34),p(1," Name is required "),r())}function ji(t,l){if(t&1&&(a(0,"div"),u(1,Ui,2,0,"div",33),r()),t&2){let e=m(2);c(),s("ngIf",e.form.controls.Name.errors.required)}}function Zi(t,l){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 Qi(t,l){if(t&1&&(a(0,"span",36),p(1),r()),t&2){let e=l.$implicit;s("pTooltip",e.name),c(),Q(" ",e.name," ")}}function Wi(t,l){t&1&&(a(0,"div",34),p(1," Code is required "),r())}function Yi(t,l){if(t&1&&(a(0,"div"),u(1,Wi,2,0,"div",33),r()),t&2){let e=m(2);c(),s("ngIf",e.form.controls.Code.errors.required)}}function Xi(t,l){t&1&&(a(0,"div",34),p(1," Note is required "),r())}function Ji(t,l){if(t&1&&(a(0,"div"),u(1,Xi,2,0,"div",33),r()),t&2){let e=m(2);c(),s("ngIf",e.form.controls.Note.errors.required)}}function eo(t,l){if(t&1&&p(0),t&2){let e=l.$implicit;Q(" ",(e==null?null:e.fullLabel)||(e==null?null:e.label)||"Select a category"," ")}}function to(t,l){t&1&&(a(0,"div",34),p(1," Category is required "),r())}function no(t,l){if(t&1&&(a(0,"div"),u(1,to,2,0,"div",33),r()),t&2){let e=m(2);c(),s("ngIf",e.form.controls.Category.errors.required)}}function io(t,l){t&1&&(a(0,"div",34),p(1," Note is required "),r())}function oo(t,l){if(t&1&&(a(0,"div"),u(1,io,2,0,"div",33),r()),t&2){let e=m(2);c(),s("ngIf",e.form.controls.Note.errors.required)}}function ro(t,l){t&1&&(a(0,"div",34),p(1," Note is required "),r())}function ao(t,l){if(t&1&&(a(0,"div"),u(1,ro,2,0,"div",33),r()),t&2){let e=m(2);c(),s("ngIf",e.form.controls.Note.errors.required)}}function lo(t,l){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,ji,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,Zi,3,0,"ng-template",null,2,I),r(),a(17,"p-select",19),u(18,Qi,2,2,"ng-template",null,3,I),r()()(),a(20,"div",10)(21,"div",11)(22,"div",12)(23,"label",13),p(24,"Code"),r(),h(25,"input",20),u(26,Yi,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,Ji,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,eo,1,1,"ng-template",29),r(),u(48,no,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,oo,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,ao,2,1,"div",15),r()(),h(64,"div",11),r()()()),t&2){let e=te(16),n=m();s("formGroup",n.form),c(7),s("ngClass",T(21,Ft,n.form.controls.Name.invalid&&(n.form.controls.Name.dirty||n.form.controls.Name.touched))),c(),s("ngIf",n.form.controls.Name.invalid&&(n.form.controls.Name.dirty||n.form.controls.Name.touched)),c(5),s("pTooltip",e),c(4),s("fluid",!0)("options",n.outlets()),c(8),s("ngClass",T(23,Ft,n.form.controls.Code.invalid&&(n.form.controls.Code.dirty||n.form.controls.Code.touched))),c(),s("ngIf",n.form.controls.Code.invalid&&(n.form.controls.Code.dirty||n.form.controls.Code.touched)),c(7),s("value",!1),c(4),s("value",!0),c(3),s("ngIf",n.form.controls.Note.errors),c(6),s("fluid",!0)("options",n.categoryOptions())("ngClass",T(25,Gi,n.form.controls.Category.invalid&&(n.form.controls.Category.dirty||n.form.controls.Category.touched))),c(2),s("ngIf",n.form.controls.Category.invalid&&(n.form.controls.Category.dirty||n.form.controls.Category.touched)),c(7),s("options",n.accessTypes())("fluid",!0),c(),s("ngIf",n.form.controls.Note.errors),c(6),s("ngClass",T(27,Ft,n.form.controls.Note.invalid&&(n.form.controls.Note.dirty||n.form.controls.Note.touched)))("autoResize",!0),c(),s("ngIf",n.form.controls.Note.errors)}}var Nt=(()=>{class t{constructor(){this.route=x(ne),this.coa_service=x(X),this.coa_info=v(null),this.fb=x(ve),this.isEdit=v(!1),this.categoryOptions=v([]),this.router=x(ie),this.outlets=W(()=>this.coa_info()?this.coa_info().options.entities:[]),this.accessTypes=W(()=>{let e=["This Chart of Account can be viewed by all users.","Restricted access, only visible to users with the private role"];return this.coa_info()?this.coa_info().options.coaAccessType.map((n,i)=>y(C({},n),{description:e[i]})):[]})}findParenChilds(e,n){function i(o,d=null){for(let f of o){if(f.key===n)return{parent:d,child:f};if(f.children){let b=i(f.children,f);if(b)return b}}return null}return i(e)}generateForm(e){this.form=this.fb.group({ID:new L(e.id||""),Name:new L(e.name||"",[fe.required]),Code:new L(e.code||"",[fe.required]),Note:new L(e.note||"",[]),Balance:new L(e.balance||0),Outlet:new L(e.outletID||""),AccessType:new L(e.accessTypeID||0),Category:new L(null,[fe.required]),Bin:new L(e.bin||!1)})}ngOnInit(){this.generateForm({id:"",name:"",code:"",note:"",balance:0,outletID:"",accessTypeID:0,categoryID:null,bin:!1}),this.fetchLoader(),this.fetchCategoryOptions()}fetchLoader(){this.route.paramMap.pipe(qe(e=>{if(e.has("id")){this.isEdit.set(!0);let n=e.get("id");return this.coa_service.getChartAccountFormById(n)}else return this.coa_service.getChartAccountForm()}),P("response"),G(e=>y(C({},e),{form:y(C({},e.form),{categoryID:e.form.categoryID==="00000000-0000-0000-0000-000000000000"?"":e.form.categoryID})})),A(e=>{this.coa_info.set(e),this.generateForm(e.form)})).subscribe()}get hasIdParam(){return this.route.snapshot.paramMap.has("id")}onSubmit(){if(this.form.invalid){this.form.markAllAsTouched();return}let{AccessType:e,Balance:n,Category:i,Code:o,Name:d,Note:f,Outlet:b}=this.form.value,M;this.hasIdParam?M={id:this.coa_info().form.id,categoryID:i.key,name:d,bin:this.form.value.Bin||!1,code:o,note:f,outletID:b||null,balance:n,accessTypeID:e}:M={id:this.coa_info().form.id,categoryID:i.key,bin:this.form.value.Bin||!1,name:d,code:o,note:f,outletID:b||null,balance:n,accessTypeID:e},this.hasIdParam?this.coa_service.submitChartAccount(M).pipe(P("submitChartAccount"),A(()=>{this.form.reset(),this.router.navigate(["/pages/chart-of-account/account"])})).subscribe():this.coa_service.submitChartAccount(M).pipe(P("submitChartAccount"),A(()=>{this.form.reset(),this.router.navigate(["/pages/chart-of-account/account"])})).subscribe()}fetchCategoryOptions(){this.coa_service.fetchCategoryOptions().pipe(P("response"),A(e=>{this.categoryOptions.set(e);let n=this.findParenChilds(this.categoryOptions(),this.coa_info()?.form?.categoryID);this.form.controls.Category.setValue(n?.child)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=O({type:t,selectors:[["app-coa-account-form",8,"page"]],attrs:qi,decls:5,vars:1,consts:[["actionButton",""],["content",""],["tooltipContent",""],["item",""],["pageTitle","Chart Of Account Form",3,"hasMainWrapperPadding"],[1,"d-flex","gap-2"],["type","button",1,"p-button","p-button-secondary","p-button-outlined",3,"routerLink"],["label","Submit",3,"onClick"],["styleClass","rounded-2",3,"formGroup"],[1,"d-flex","flex-column","gap-2"],[1,"row"],[1,"col-6"],[1,"d-flex","flex-column"],["for",""],["size","small","formControlName","Name","type","text","pInputText","",3,"ngClass"],[4,"ngIf"],[1,"d-flex","align-items-baseline","gap-2"],[3,"pTooltip"],[1,"fa-solid","fa-circle-info"],["appendTo","body","formControlName","Outlet","optionLabel","name","optionValue","id","placeholder","Select Outlet",3,"fluid","options"],["size","small","formControlName","Code","type","text","pInputText","",3,"ngClass"],[1,"col-3","d-flex","align-items-center","gap-2"],["name","Bin","formControlName","Bin","inputId","ingredient1",3,"value"],["for","ingredient1",1,"m-0"],[1,"col","d-flex","align-items-center","gap-2"],["name","Bin","formControlName","Bin","inputId","ingredient2",3,"value"],["for","ingredient2",1,"m-0"],[1,"form-group","d-flex","flex-column"],["formControlName","Category","containerStyleClass","w-full","placeholder","Select a Category",1,"w-full",3,"fluid","options","ngClass"],["pTemplate","value"],[1,"col"],["optionLabel","value","optionValue","key","formControlName","AccessType","placeholder","Select Access Type",3,"options","fluid"],["pSize","small","rows","5","cols","30","pTextarea","","formControlName","Note",3,"ngClass","autoResize"],["class","invalid-feedback text-danger d-block",4,"ngIf"],[1,"invalid-feedback","text-danger","d-block"],[1,"flex","items-center"],[1,"d-inline-block","text-truncate",2,"max-width","200px",3,"pTooltip"]],template:function(n,i){n&1&&(a(0,"app-main-panel",4),u(1,Hi,4,2,"ng-template",null,0,I)(3,lo,65,29,"ng-template",null,1,I),r()),n&2&&s("hasMainWrapperPadding",!0)},dependencies:[$,Te,oe,Y,ye,Ie,be,ut,N,z,F,V,B,Pe,Ee,Ae,K,it,nt,zn,qn,st,Mn,_e,ot,le,ae,ce,se,mt,ct],styles:["[_nghost-%COMP%]{display:block}[_nghost-%COMP%] .p-treeselect{width:100%!important}"],changeDetection:0})}}return t})();var so=["sublist"],co=(t,l)=>({"p-contextmenu-submenu":t,"p-contextmenu-root-list":l}),mo=()=>({"p-contextmenu-item-link":!0}),Yn=()=>({class:"p-contextmenu-submenu-icon"}),po=()=>({exact:!1}),uo=t=>({"p-contextmenu-item-link":!0,"p-disabled":t}),fo=t=>({$implicit:t});function _o(t,l){if(t&1&&h(0,"li",8),t&2){let e=m().$implicit,n=m(2);He(n.getItemProp(e,"style")),s("ngClass",n.getSeparatorItemClass(e)),k("id",n.getItemId(e))("data-pc-section","separator")}}function go(t,l){if(t&1&&h(0,"span",19),t&2){let e=m(4).$implicit,n=m(2);s("ngClass",n.getItemProp(e,"icon"))("ngStyle",n.getItemProp(e,"iconStyle")),k("data-pc-section","icon")("aria-hidden",!0)("tabindex",-1)}}function ho(t,l){if(t&1&&(a(0,"span",20),p(1),r()),t&2){let e=m(4).$implicit,n=m(2);k("data-pc-section","label"),c(),Q(" ",n.getItemLabel(e)," ")}}function xo(t,l){if(t&1&&h(0,"span",21),t&2){let e=m(4).$implicit,n=m(2);s("innerHTML",n.getItemLabel(e),Me),k("data-pc-section","label")}}function Co(t,l){if(t&1&&h(0,"p-badge",22),t&2){let e=m(4).$implicit,n=m(2);s("styleClass",n.getItemProp(e,"badgeStyleClass"))("value",n.getItemProp(e,"badge"))}}function yo(t,l){t&1&&h(0,"AngleRightIcon"),t&2&&(Fe("p-contextmenu-submenu-icon"),k("data-pc-section","submenuicon")("aria-hidden",!0))}function Io(t,l){}function bo(t,l){t&1&&u(0,Io,0,0,"ng-template",25),t&2&&s("data-pc-section","submenuicon")("aria-hidden",!0)}function vo(t,l){if(t&1&&(H(0),u(1,yo,1,4,"AngleRightIcon",23)(2,bo,1,2,null,24),U()),t&2){let e=m(6);c(),s("ngIf",!e.contextMenu.submenuIconTemplate&&!e.contextMenu._submenuIconTemplate),c(),s("ngTemplateOutlet",e.contextMenu.submenuIconTemplate||e.contextMenu._submenuIconTemplate)("ngTemplateOutletContext",R(3,Yn))}}function So(t,l){if(t&1&&(a(0,"a",15),u(1,go,1,5,"span",16)(2,ho,2,2,"span",17)(3,xo,1,2,"ng-template",null,2,I)(5,Co,1,2,"p-badge",18)(6,vo,3,4,"ng-container",11),r()),t&2){let e=te(4),n=m(3).$implicit,i=m(2);s("target",i.getItemProp(n,"target"))("ngClass",R(12,mo)),k("href",i.getItemProp(n,"url"),Gt)("aria-hidden",!0)("data-automationid",i.getItemProp(n,"automationId"))("data-pc-section","action")("tabindex",-1),c(),s("ngIf",i.getItemProp(n,"icon")),c(),s("ngIf",i.getItemProp(n,"escape"))("ngIfElse",e),c(3),s("ngIf",i.getItemProp(n,"badge")),c(),s("ngIf",i.isItemGroup(n))}}function To(t,l){if(t&1&&h(0,"span",19),t&2){let e=m(4).$implicit,n=m(2);s("ngClass",n.getItemProp(e,"icon"))("ngStyle",n.getItemProp(e,"iconStyle")),k("data-pc-section","icon")("aria-hidden",!0)("tabindex",-1)}}function Ao(t,l){if(t&1&&(a(0,"span",20),p(1),r()),t&2){let e=m(4).$implicit,n=m(2);k("data-pc-section","label"),c(),Q(" ",n.getItemLabel(e)," ")}}function wo(t,l){if(t&1&&h(0,"span",21),t&2){let e=m(4).$implicit,n=m(2);s("innerHTML",n.getItemLabel(e),Me),k("data-pc-section","label")}}function Eo(t,l){if(t&1&&h(0,"p-badge",22),t&2){let e=m(4).$implicit,n=m(2);s("styleClass",n.getItemProp(e,"badgeStyleClass"))("value",n.getItemProp(e,"badge"))}}function Po(t,l){t&1&&h(0,"AngleRightIcon"),t&2&&(Fe("p-contextmenu-submenu-icon"),k("data-pc-section","submenuicon")("aria-hidden",!0))}function ko(t,l){}function Mo(t,l){t&1&&u(0,ko,0,0,"ng-template",25),t&2&&s("data-pc-section","submenuicon")("aria-hidden",!0)}function Oo(t,l){if(t&1&&(H(0),u(1,Po,1,4,"AngleRightIcon",23)(2,Mo,1,2,null,24),U()),t&2){let e=m(6);c(),s("ngIf",!e.contextMenu.submenuIconTemplate&&!e.contextMenu._submenuIconTemplate),c(),s("ngTemplateOutlet",!e.contextMenu.submenuIconTemplate||!e.contextMenu._submenuIconTemplate)("ngTemplateOutletContext",R(3,Yn))}}function Fo(t,l){if(t&1&&(a(0,"a",26),u(1,To,1,5,"span",16)(2,Ao,2,2,"span",17)(3,wo,1,2,"ng-template",null,2,I)(5,Eo,1,2,"p-badge",18)(6,Oo,3,4,"ng-container",11),r()),t&2){let e=te(4),n=m(3).$implicit,i=m(2);s("routerLink",i.getItemProp(n,"routerLink"))("queryParams",i.getItemProp(n,"queryParams"))("routerLinkActiveOptions",i.getItemProp(n,"routerLinkActiveOptions")||R(20,po))("target",i.getItemProp(n,"target"))("ngClass",T(21,uo,i.getItemProp(n,"disabled")))("fragment",i.getItemProp(n,"fragment"))("queryParamsHandling",i.getItemProp(n,"queryParamsHandling"))("preserveFragment",i.getItemProp(n,"preserveFragment"))("skipLocationChange",i.getItemProp(n,"skipLocationChange"))("replaceUrl",i.getItemProp(n,"replaceUrl"))("state",i.getItemProp(n,"state")),k("data-automationid",i.getItemProp(n,"automationId"))("tabindex",-1)("aria-hidden",!0)("data-pc-section","action"),c(),s("ngIf",i.getItemProp(n,"icon")),c(),s("ngIf",i.getItemProp(n,"escape"))("ngIfElse",e),c(3),s("ngIf",i.getItemProp(n,"badge")),c(),s("ngIf",i.isItemGroup(n))}}function No(t,l){if(t&1&&(H(0),u(1,So,7,13,"a",13)(2,Fo,7,23,"a",14),U()),t&2){let e=m(2).$implicit,n=m(2);c(),s("ngIf",!n.getItemProp(e,"routerLink")),c(),s("ngIf",n.getItemProp(e,"routerLink"))}}function Vo(t,l){}function Lo(t,l){t&1&&u(0,Vo,0,0,"ng-template")}function Do(t,l){if(t&1&&(H(0),u(1,Lo,1,0,null,24),U()),t&2){let e=m(2).$implicit,n=m(2);c(),s("ngTemplateOutlet",n.itemTemplate)("ngTemplateOutletContext",T(2,fo,e.item))}}function Ro(t,l){if(t&1){let e=w();a(0,"p-contextmenu-sub",27),S("itemClick",function(i){_(e);let o=m(4);return g(o.itemClick.emit(i))})("itemMouseEnter",function(i){_(e);let o=m(4);return g(o.onItemMouseEnter(i))}),r()}if(t&2){let e=m(2).$implicit,n=m(2);s("items",e.items)("itemTemplate",n.itemTemplate)("menuId",n.menuId)("visible",n.isItemActive(e)&&n.isItemGroup(e))("activeItemPath",n.activeItemPath)("focusedItemId",n.focusedItemId)("level",n.level+1)}}function Bo(t,l){if(t&1){let e=w();a(0,"li",9,1)(2,"div",10),S("click",function(i){_(e);let o=m().$implicit,d=m(2);return g(d.onItemClick(i,o))})("mouseenter",function(i){_(e);let o=m().$implicit,d=m(2);return g(d.onItemMouseEnter({$event:i,processedItem:o}))}),u(3,No,3,2,"ng-container",11)(4,Do,2,4,"ng-container",11),r(),u(5,Ro,1,7,"p-contextmenu-sub",12),r()}if(t&2){let e=m(),n=e.$implicit,i=e.index,o=m(2);Fe(o.getItemProp(n,"styleClass")),s("ngStyle",o.getItemProp(n,"style"))("ngClass",o.getItemClass(n))("tooltipOptions",o.getItemProp(n,"tooltipOptions")),k("id",o.getItemId(n))("data-pc-section","menuitem")("data-p-highlight",o.isItemActive(n))("data-p-focused",o.isItemFocused(n))("data-p-disabled",o.isItemDisabled(n))("aria-label",o.getItemLabel(n))("aria-disabled",o.isItemDisabled(n)||void 0)("aria-haspopup",o.isItemGroup(n)&&!o.getItemProp(n,"to")?"menu":void 0)("aria-expanded",o.isItemGroup(n)?o.isItemActive(n):void 0)("aria-level",o.level+1)("aria-setsize",o.getAriaSetSize())("aria-posinset",o.getAriaPosInset(i)),c(2),k("data-pc-section","content"),c(),s("ngIf",!o.itemTemplate),c(),s("ngIf",o.itemTemplate),c(),s("ngIf",o.isItemVisible(n)&&o.isItemGroup(n))}}function $o(t,l){if(t&1&&u(0,_o,1,5,"li",6)(1,Bo,6,21,"li",7),t&2){let e=l.$implicit,n=m(2);s("ngIf",n.isItemVisible(e)&&n.getItemProp(e,"separator")),c(),s("ngIf",n.isItemVisible(e)&&!n.getItemProp(e,"separator"))}}function Ko(t,l){if(t&1){let e=w();a(0,"ul",4,0),S("@overlayAnimation.start",function(i){_(e);let o=te(1),d=m();return g(d.onEnter(i,o))})("keydown",function(i){_(e);let o=m();return g(o.menuKeydown.emit(i))})("focus",function(i){_(e);let o=m();return g(o.menuFocus.emit(i))})("blur",function(i){_(e);let o=m();return g(o.menuBlur.emit(i))}),u(2,$o,2,2,"ng-template",5),r()}if(t&2){let e=m();s("ngClass",Yt(10,co,!e.root,e.root))("@overlayAnimation",e.visible)("tabindex",e.tabindex),k("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),s("ngForOf",e.items)}}var qo=["item"],zo=["submenuicon"],Go=["rootmenu"],Ho=["container"],Uo=t=>({"p-contextmenu p-component":!0,"p-contextmenu-mobile":t}),jo=()=>({value:"visible"});function Zo(t,l){if(t&1){let e=w();a(0,"div",3,0),S("@overlayAnimation.start",function(i){_(e);let o=m();return g(o.onOverlayAnimationStart(i))})("@overlayAnimation.done",function(i){_(e);let o=m();return g(o.onOverlayAnimationEnd(i))}),a(2,"p-contextmenu-sub",4,1),S("itemClick",function(i){_(e);let o=m();return g(o.onItemClick(i))})("menuFocus",function(i){_(e);let o=m();return g(o.onMenuFocus(i))})("menuBlur",function(i){_(e);let o=m();return g(o.onMenuBlur(i))})("menuKeydown",function(i){_(e);let o=m();return g(o.onKeyDown(i))})("itemMouseEnter",function(i){_(e);let o=m();return g(o.onItemMouseEnter(i))}),r()()}if(t&2){let e=m();Fe(e.styleClass),s("ngClass",T(20,Uo,e.queryMatches))("ngStyle",e.style)("@overlayAnimation",R(22,jo)),k("data-pc-section","root")("data-pc-name","contextmenu")("id",e.id),c(2),s("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 Qo=({dt:t})=>`
|
|
1
|
+
import{a as pt,b as dt}from"./chunk-ZEWON3MW.js";import{a as ut}from"./chunk-MS6WBVQX.js";import{a as $n,b as Ee,c as Pe,d as Kn}from"./chunk-HEX727RH.js";import{a as Rn,b as Bn}from"./chunk-BJ4RON42.js";import"./chunk-CNXEJBY5.js";import{a as qn,b as zn}from"./chunk-M5PA3FZY.js";import{a as Gn}from"./chunk-XKI7WLHE.js";import{a as Dn}from"./chunk-MPHY6FVN.js";import"./chunk-NMSYINDE.js";import{a as we}from"./chunk-ORLKNWW4.js";import"./chunk-WLKS6LBU.js";import{a as at,b as lt}from"./chunk-NHZLS6JU.js";import{a as ct,b as mt,c as On,d as Fn,i as Nn,j as Vn,k as Ln}from"./chunk-KLKIEREL.js";import"./chunk-76LPTGLX.js";import"./chunk-CWHL7PNC.js";import"./chunk-VRKBMD72.js";import{a as X}from"./chunk-QE4CQXCC.js";import{a as P}from"./chunk-KXE3J4PK.js";import{b as vn}from"./chunk-E3QNEH3B.js";import{a as In}from"./chunk-EOT2WEXN.js";import{a as Mn,b as st}from"./chunk-X4KTMWVO.js";import"./chunk-I7ILLTFH.js";import"./chunk-2LQVI4EI.js";import"./chunk-AJZ7YLT4.js";import"./chunk-ATJ55H5D.js";import"./chunk-SPKOXGSS.js";import"./chunk-3KYU6FI2.js";import"./chunk-IJTQE2H4.js";import{a as rt,b as K}from"./chunk-WXT6EZ2V.js";import{f as kn,h as $}from"./chunk-PGHK6GXT.js";import{b as ot,c as _e}from"./chunk-L3PZS6EL.js";import{a as se,b as ce}from"./chunk-5JV52UYK.js";import{a as J,b as Tn,c as An,e as wn,f as En,g as Pn}from"./chunk-ACTRMWEI.js";import{c as Je,d as an,f as ln}from"./chunk-ARXP327B.js";import{a as Tt,f as At,n as nt,o as it,p as bn,t as Sn,u as wt,w as ae,x as le}from"./chunk-7FFMPB6T.js";import"./chunk-UKBDY33R.js";import{Aa as gn,D as yt,Da as hn,I as sn,Ia as xn,K as cn,La as Ae,M as mn,Ma as De,Oa as Cn,Q as et,R as tt,Ua as yn,W as pn,X as It,_ as dn,b as oe,c as fe,da as un,e as Y,f as ye,g as on,ga as fn,i as L,j as Xe,k as rn,ka as _n,l as Ie,na as bt,o as be,qa as re,u as ve,va as vt,w as Se,wa as St,x as Te}from"./chunk-72LNXEXV.js";import{b as ne,d as ie,e as B,l as V}from"./chunk-EFDD6Q3K.js";import{a as nn}from"./chunk-VENJDQOT.js";import"./chunk-ZDTMCWOO.js";import{c as xt,d as Ct,f as Ve,h as Le}from"./chunk-F2X3VGZZ.js";import{h as z,j as We,k as F,l as ht,m as en,p as tn,q as Ye,s as N,t as Ne}from"./chunk-SB5MSLCX.js";import{$b as w,$c as Ce,Aa as ee,Bb as Oe,Cc as he,D as Ke,Db as u,Dc as R,Ec as T,Fc as Yt,Ha as v,J as qe,Kb as k,L as $t,Lb as s,Nc as de,Ob as He,Oc as xe,P as Kt,Pb as Fe,Pc as Xt,Qb as Ut,Rb as jt,Rc as I,Tb as Zt,Ub as Qt,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 qt,bd as W,c as $e,ca as ze,cb as Me,cd as Jt,da as zt,db as Gt,ec as S,fc as m,hb as c,ia as x,kc as Ue,lc as pe,mc as j,nb as gt,nc as Z,qa as _,qc as te,ra as g,rc as p,s as G,sc as E,t as Bt,tc as Q,ua as Ge,vc as Wt,wc as je,xb as O,xc as Ze,yb as Ht,yc as Qe}from"./chunk-6K5LNQ4J.js";import{a as C,b as y}from"./chunk-YQFG5XE2.js";var ii=["class","page"],oi=t=>({id:t}),ri=()=>({"overflow-x":"auto"}),ai=t=>({"table-borderless":t}),li=t=>["fa-solid",t],si=t=>["/pages/journal/journal-entry/",t];function ci(t,l){t&1&&h(0,"p-button",8)}function mi(t,l){if(t&1){let e=w();a(0,"p-button",9),S("onClick",function(){_(e);let i=m(2);return g(i.onDelete())}),r()}}function pi(t,l){if(t&1&&(a(0,"div",4)(1,"p-button-group"),u(2,ci,1,0,"p-button",5)(3,mi,1,0,"p-button",6),r(),a(4,"a",7),p(5,"Ledger"),r()()),t&2){let e,n=m();c(2),s("ngIf",n.roleService.coa.edit),c(),s("ngIf",n.roleService.coa.delete),c(),s("queryParams",T(3,oi,(e=n.COAInfo())==null?null:e.id))}}function di(t,l){if(t&1&&h(0,"i",25),t&2){let e=l.checked;s("ngClass",T(1,li,e?"fa-check":"fa-xmark"))}}function ui(t,l){if(t&1&&(H(0),p(1),de(2,"number"),U()),t&2){let e=m().$implicit;c(),Q(" ",xe(2,1,e.creditAmount)," ")}}function fi(t,l){if(t&1&&(H(0),p(1),de(2,"number"),U()),t&2){let e=m().$implicit;c(),Q(" ",xe(2,1,e.debitAmount)," ")}}function _i(t,l){if(t&1&&(a(0,"tr")(1,"td"),p(2),de(3,"date"),r(),a(4,"td")(5,"div",26)(6,"a",27),p(7),r()()(),a(8,"td",28),u(9,ui,3,3,"ng-container",29),r(),a(10,"td",30),u(11,fi,3,3,"ng-container",29),r(),a(12,"td",31),p(13),de(14,"number"),r()()),t&2){let e=l.$implicit;c(2),E(Xt(3,6,e.date,"dd MMM yyyy")),c(4),s("routerLink",T(11,si,e.id)),c(),E(e.number),c(2),s("ngIf",e.creditAmount!==0),c(2),s("ngIf",e.debitAmount!==0),c(2),Q(" ",xe(14,9,e.balance)," ")}}function gi(t,l){t&1&&(a(0,"tr")(1,"td",32)(2,"div",33),h(3,"img",34),a(4,"div",26)(5,"span",35),p(6,"No Data Available"),r(),a(7,"span",35),p(8,"Your data will be shown here once it's available"),r()()()()())}function hi(t,l){if(t&1){let e=w();a(0,"div",12)(1,"div",13)(2,"p-card",14)(3,"div",15)(4,"div",16)(5,"div",17),p(6,"Name"),r(),a(7,"div",18),p(8),r()(),a(9,"div",16)(10,"div",17),p(11,"Code"),r(),a(12,"div",18),p(13),r()(),a(14,"div",16)(15,"div",17),p(16,"Category"),r(),a(17,"div",18),p(18),r()(),a(19,"div",16)(20,"div",17),p(21,"Note"),r(),a(22,"div",18),p(23),r()(),a(24,"div",16)(25,"div",17),p(26,"Outlet"),r(),a(27,"div",18),p(28),r()(),a(29,"div",16)(30,"div",17),p(31,"Discontinued"),r(),a(32,"div",18)(33,"p-toggleswitch",19),S("onChange",function(i){_(e);let o=m(2);return g(o.onDiscontinued(i))}),u(34,di,1,3,"ng-template",null,2,I),r()()(),a(36,"div",16)(37,"div",17),p(38,"Access Type"),r(),a(39,"div",18),p(40),r()()()()(),a(41,"div",20)(42,"p-card",21)(43,"table",22)(44,"thead")(45,"tr")(46,"th",23),p(47,"Date"),r(),a(48,"th",23),p(49,"Number"),r(),a(50,"th",24),p(51,"Credit"),r(),a(52,"th",24),p(53,"Debit"),r(),a(54,"th",24),p(55,"Balance"),r()()(),a(56,"tbody"),Zt(57,_i,15,13,"tr",null,jt),u(59,gi,9,0,"tr"),r()()()()()}if(t&2){let e,n,i,o,d,f,b=m(2);c(8),E((e=b.COAInfo().name)!==null&&e!==void 0?e:"-"),c(5),E((n=b.COAInfo().code)!==null&&n!==void 0?n:"-"),c(5),E((i=b.COAInfo().category)!==null&&i!==void 0?i:"-"),c(5),E((o=b.COAInfo().note)!==null&&o!==void 0?o:"-"),c(5),E((d=b.COAInfo().outletName)!==null&&d!==void 0?d:"-"),c(5),s("ngModel",b.COAInfo().bin),c(7),E((f=b.COAInfo().accessType)!==null&&f!==void 0?f:"-"),c(2),He(R(11,ri)),c(),s("ngClass",T(12,ai,b.COAInfo().transactions.length===0)),c(14),Qt(b.COAInfo().transactions),c(2),Ut(b.COAInfo().transactions.length===0?59:-1)}}function xi(t,l){if(t&1&&(a(0,"div",10),u(1,hi,60,14,"div",11),r()),t&2){let e=m();c(),s("ngIf",e.COAInfo())}}var Hn=(()=>{class t{constructor(){this.#e=x(X),this.#t=x(ne),this.router=x(ie),this.COAInfo=v(null),this.checked=v(!1),this.roleService=x(we)}#e;#t;ngOnInit(){this.#t.paramMap.pipe(P("params"),D(e=>this.#e.getChartAccountById(e.get("id"))),A(e=>this.COAInfo.set(e)),P("response")).subscribe()}onDelete(){if(!confirm("Are you sure you want to delete this Chart of Accounts?"))return;let n=[this.#t.snapshot.paramMap.get("id")];this.#e.deleteChartAccount(n).pipe(A(()=>{this.router.navigate(["/pages/chart-of-account/account"])})).subscribe()}onDiscontinued(e){this.#e.discountedChartAccounts(this.#t.snapshot.paramMap.get("id"),{Discontinued:e.checked}).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=O({type:t,selectors:[["app-coa-account-info",8,"page"]],attrs:ii,decls:5,vars:1,consts:[["actionButton",""],["content",""],["handle",""],["pageTitle","Chart of Account Details",3,"overflowScroll"],[1,"d-flex","gap-2"],["routerLink","edit","severity","secondary","outlined","","label","Edit","icon","fa-solid fa-pen-to-square",4,"ngIf"],["severity","secondary","outlined","","label","Delete","icon","fa-solid fa-trash",3,"onClick",4,"ngIf"],["routerLink","/pages/report/general-ledger",1,"p-button",3,"queryParams"],["routerLink","edit","severity","secondary","outlined","","label","Edit","icon","fa-solid fa-pen-to-square"],["severity","secondary","outlined","","label","Delete","icon","fa-solid fa-trash",3,"onClick"],[1,"container-fluid"],["class","row justify-content-center mt-3 px-2",4,"ngIf"],[1,"row","justify-content-center","mt-3","px-2"],[1,"col","col-lg-5"],["styleClass","h-100"],[1,"d-flex","flex-column","row-gap-4"],[1,"row"],[1,"col","col-lg-4"],[1,"col"],[3,"onChange","ngModel"],[1,"col","col-lg-7"],["styleClass","h-100",1,"right-panel","h-100"],[1,"table",3,"ngClass"],["scope","col"],["scope","col",1,"text-end"],[3,"ngClass"],[1,"d-flex","flex-column"],["target","_blank",1,"link","link-primary",3,"routerLink"],[1,"text-danger","text-end"],[4,"ngIf"],[1,"text-success","text-end"],[1,"text-end"],["colspan","5",1,"text-center"],[1,"d-flex","flex-column","align-items-center","gap-2"],["src","https://res.cloudinary.com/pos/image/upload/v1705388070/POS/Images/Cashier/globalnodata.svg","alt","No Data"],[1,"text-secondary","text-opacity-75"]],template:function(n,i){n&1&&(a(0,"app-main-panel",3),u(1,pi,6,5,"ng-template",null,0,I)(3,xi,2,1,"ng-template",null,1,I),r()),n&2&&s("overflowScroll",!0)},dependencies:[N,z,F,Ye,tn,Se,Y,Xe,Je,V,B,$,K,rt,le,ae,dt,pt,On,Dn],styles:[".table>thead>tr>th{background-color:#f6f6f6!important;color:#000!important;font-weight:500!important}"],changeDetection:0})}}return t})();var me=(()=>{class t{constructor(){this.httpService=x(nn)}fetchCOACategories(){return this.httpService.get("","api/ChartOfAccount/Category")}getCOACategoryByID(e){let n={params:e};return this.httpService.get("","api/ChartOfAccount/CategoryInfo",n)}renameCategory(e,n){return this.httpService.put("",`api/ChartOfAccount/RenameCategory/${e}`,n)}updateParentCategory(e,n){return this.httpService.put("",`api/ChartOfAccount/UpdateParentCategory/${e}`,n).pipe()}deleteCategory(e){return this.httpService.delete("",`api/ChartOfAccount/Category/${e}`)}submitCategory(e,n={}){return this.httpService.post("","api/ChartOfAccount/SubmitCategory",e,n)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=ze({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Pt=t=>t?t.reduce((l,e)=>(l.push({label:e.label,data:e.data,key:e.key}),e.children&&e.children.length?l.push(...Pt(e.children)):l.push({label:`${e.label} (no children)`,data:e.data,key:`${e.key}-no-children`}),l),[]):[];var kt=(t,l,e)=>{let n=Math.ceil(e/l),i=(t-1)*l+1,o=Math.min(t*l,e);return{start:i,end:o,totalRecords:e,totalPages:n}};var Ci={filter:{PageSize:20,PageNumber:1,CategoryID:"",Text:"",listOutletID:[],Discontinued:2},options:{entities:[],categories:[]},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"}]},Mt=Tn(En(Ci),Pn("ChartOfAccount"),An(t=>({isAllChecked:W(()=>t.data().every(l=>l.checked)),checkedItems:W(()=>t.data().filter(l=>l.checked)),IDsChecked:W(()=>t.data().filter(l=>l.checked).map(l=>l.id)),categories:W(()=>Pt(t.options.categories())),first:W(()=>{let{start:l}=kt(t.filter().PageNumber,t.filter().PageSize,t.count());return l}),last:W(()=>{let{end:l}=kt(t.filter().PageNumber,t.filter().PageSize,t.count());return l})})),wn(t=>{let l=x(X),e=x(me),n={updateFilter(i){J(t,{filter:C({},i)})},checkedItem(i){if(Array.isArray(i))i.forEach(o=>{let d=t.data().map(f=>f.id===o.id?y(C({},f),{checked:!o.checked}):f);J(t,{data:d})});else{let o=i,d=t.data().map(f=>f.id===o.id?y(C({},f),{checked:!o.checked}):f);J(t,{data:d})}},checkAllCheckbox(){let i=t.data().map(o=>y(C({},o),{checked:!o.checked}));J(t,{data:i})},fetchChartOfAccount:at($e(Ke(()=>!!t.filter()),$t(300),Kt(),D(i=>l.getPaginatedChartAccounts(i).pipe(G(o=>y(C({},o),{data:o.data.map(d=>y(C({},d),{checked:!1}))})),lt({next:o=>J(t,{data:o.data,count:o.count}),error:o=>{J(t,{data:[],count:0}),console.error(o)}}))))),fetchLoader:at($e(D(()=>l.getChartOfAccountLoader().pipe(lt({next:i=>{J(t,{filter:y(C({},t.filter()),{PageSize:i.filter.pageSize,PageNumber:1,CategoryID:i.filter.categoryID||null,Text:"",listOutletID:[]}),options:i.options}),n.fetchChartOfAccount(t.filter)},error:i=>{console.error(i)}}))))),getCategories:at($e(qe(()=>e.fetchCOACategories().pipe(lt({next:i=>{J(t,{options:{entities:t.options.entities(),categories:i}})},error:i=>{console.error(i)}})))))};return n}));var bi=["class","page"],vi=t=>["../account/",t],Si=t=>({"text-decoration-line-through":t}),Ti=()=>["/pages/report/general-ledger"],Ai=t=>({id:t});function wi(t,l){if(t&1){let e=w();a(0,"p-button",13),S("onClick",function(){_(e);let i=m(2);return g(i.deleteCOA())}),r()}}function Ei(t,l){t&1&&h(0,"p-button",14)}function Pi(t,l){if(t&1){let e=w();a(0,"p-button",15),S("onClick",function(){_(e);let i=m(2);return g(i.onExport())}),r()}}function ki(t,l){t&1&&(a(0,"a",16),h(1,"i",17),p(2," Add"),r())}function Mi(t,l){if(t&1&&(a(0,"div",8),u(1,wi,1,0,"p-button",9),a(2,"p-button-group"),u(3,Ei,1,0,"p-button",10)(4,Pi,1,0,"p-button",11),r(),u(5,ki,3,0,"a",12),r()),t&2){let e=m();c(),s("ngIf",e.store.checkedItems().length&&e.roleService.coa.delete),c(2),s("ngIf",e.roleService.coa.create),c(),s("ngIf",e.roleService.global.export),c(),s("ngIf",e.roleService.coa.create)}}function Oi(t,l){t&1&&(a(0,"th",21),h(1,"p-tableHeaderCheckbox"),r())}function Fi(t,l){if(t&1&&(a(0,"tr"),u(1,Oi,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(),s("ngIf",e.roleService.coa.delete)}}function Ni(t,l){if(t&1&&(a(0,"td"),h(1,"p-tableCheckbox",25),r()),t&2){let e=m().$implicit;c(),s("value",e)}}function Vi(t,l){if(t&1&&(a(0,"tr"),u(1,Ni,2,1,"td",22),a(2,"td"),p(3),r(),a(4,"td")(5,"a",23),p(6),r()(),a(7,"td"),p(8),r(),a(9,"td"),p(10),r(),a(11,"td",20)(12,"a",24),p(13),de(14,"number"),r()()()),t&2){let e,n=l.$implicit,i=m(2);c(),s("ngIf",i.roleService.coa.delete),c(2),E(n.code),c(2),s("routerLink",T(12,vi,n.id))("ngClass",T(14,Si,n.bin)),c(),E(n.name),c(2),E(n.category),c(2),E(n.outletName),c(2),s("routerLink",R(16,Ti))("queryParams",T(17,Ai,n.id)),c(),E(xe(14,10,(e=n.balance)!==null&&e!==void 0?e:0))}}function Li(t,l){if(t&1&&p(0),t&2){let e=m(2);Wt(" Showing ",e.store.first()," to ",e.store.last()," of ",e.store.count()," entries ")}}function Di(t,l){t&1&&(a(0,"tr")(1,"td",26)(2,"span"),p(3,"No records found."),r()()())}function Ri(t,l){if(t&1){let e=w();a(0,"p-panel")(1,"p-table",18),S("onLazyLoad",function(i){_(e);let o=m();return g(o.loadData(i))})("onRowSelect",function(i){_(e);let o=m();return g(o.onRowSelect(i))})("onRowUnselect",function(i){_(e);let o=m();return g(o.onRowUnselect(i))})("onHeaderCheckboxToggle",function(i){_(e);let o=m();return g(o.onSelectAll(i))})("onPage",function(i){_(e);let o=m();return g(o.onPageChange(i))}),u(2,Fi,12,1,"ng-template",null,3,I)(4,Vi,15,19,"ng-template",null,4,I)(6,Li,1,3,"ng-template",null,5,I)(8,Di,4,0,"ng-template",null,6,I),r()()}if(t&2){let e=m();c(),s("lazy",!0)("value",e.store.data())("paginator",!0)("rows",e.store.filter().PageSize)("totalRecords",e.store.count())}}function Bi(t,l){if(t&1){let e=w();a(0,"form",28)(1,"div",29)(2,"label",30),p(3,"Outlet"),r(),h(4,"p-multiselect",31),r(),a(5,"div",29)(6,"label",30),p(7,"Category"),r(),a(8,"p-treeselect",32),S("onFocus",function(){_(e);let i=m(2);return g(i.onCategoryFocus())}),r()(),a(9,"div",33)(10,"label",30),p(11,"Page Size"),r(),h(12,"input",34),r(),a(13,"div",33)(14,"label",30),p(15,"Discontinued"),r(),a(16,"div",35)(17,"div",36),h(18,"p-radiobutton",37),a(19,"label",38),p(20,"No"),r()(),a(21,"div",36),h(22,"p-radiobutton",39),a(23,"label",40),p(24,"Yes"),r()(),a(25,"div",36),h(26,"p-radiobutton",39),a(27,"label",40),p(28,"All"),r()()()()()}if(t&2){let e=m(2);s("formGroup",e.formFilter),c(4),s("showClear",!0)("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.options().entities),c(4),s("fluid",!0)("showClear",!0)("options",e.categoryNodes()),c(10),s("value",0),c(4),s("value",1),c(4),s("value",2)}}function $i(t,l){if(t&1&&u(0,Bi,29,11,"form",27),t&2){let e=m();s("ngIf",e.formFilter)}}var jn=(()=>{class t{ngOnInit(){this.store.fetchLoader(),console.log(this.store.filter().PageSize),this.generateFilterForm()}#e;constructor(){this.routeInfo=Zn,this.store=x(Mt),this.#e=x(X),this.modalService=x(an),this.roleService=x(we),this.dialogVisible=v(!1),this.categoryNodes=v([]),this.fb=x(ve),this.isDialogFilterVisible=v(!1),this.generateFilterForm()}generateFilterForm(){this.formFilter=this.fb.group({outletID:this.fb.control([]),categoryID:this.fb.control(null),pageSize:this.fb.control(this.store.filter().PageSize),discontinued:this.fb.control(2)})}onPageChange(e){console.log("Page changed to: ",e),this.store.updateFilter(y(C({},this.store.filter()),{PageNumber:e.first/e.rows+1}))}onCategoryFocus(){this.#e.getCachedCategoriesOptions().pipe(A(e=>this.categoryNodes.set(e))).subscribe()}onRowSelect(e){console.log("Row select event: ",e),this.store.checkedItem(e.data)}onRowUnselect(e){console.log("Row unselect event: ",e),this.store.checkedItem(e.data)}onSelectAll(e){console.log("Select all event: ",e),this.store.checkAllCheckbox()}loadData(e){console.log("Lazy load event: ",e)}onSearch(e){console.log("Search text: ",e),this.store.updateFilter(y(C({},this.store.filter()),{Text:e}))}updateFilter(e,n){this.store.updateFilter(y(C({},this.store.filter()),{[e]:n}))}checkAllCheckBox(){this.store.checkAllCheckbox()}checkedItem(e){this.store.checkedItem(e)}deleteCOA(){confirm("Are you sure you want to delete selected Chart of Accounts?")&&this.#e.deleteChartAccount(this.store.IDsChecked()).pipe(P("response"),A(e=>{console.log("Delete COA Response: ",e),this.store.updateFilter(C({},this.store.filter()))})).subscribe()}onSearchEvent(e){this.store.updateFilter(y(C({},this.store.filter()),{PageNumber:1,Text:e.trim()}))}onFilterEvent(){this.dialogVisible.update(e=>!e)}onFilterOKEvent(){let{categoryID:e,pageSize:n,outletID:i,discontinued:o}=this.formFilter.value;this.store.updateFilter(y(C({},this.store.filter()),{listOutletID:i,CategoryID:e?e.key:"",PageSize:+n,Discontinued:o})),this.isDialogFilterVisible.update(d=>!d)}onExport(){let e=y(C({},this.store.filter()),{ExportPageNumber:1,ExportPageSize:1e4});this.#e.exportChartOfAccounts(e).pipe(A(n=>{let i=n.headers;console.log("All headers:",i.keys());let o=i.get("Content-Disposition"),d=i.get("content-disposition"),f=o??d,b="download.csv";if(f){let q=f.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);q&&q[1]&&(b=decodeURIComponent(q[1].replace(/"/g,"")))}let M=n.body;Kn(M,b,M.type)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=O({type:t,selectors:[["app-cash-of-account",8,"page"]],features:[he([Mt])],attrs:bi,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"],[1,"d-flex","flex-column"],["formControlName","pageSize","type","text","pInputText",""],[1,"d-flex","flex-wrap","gap-4"],[1,"d-flex","align-items-center","gap-2"],["name","discontinued","formControlName","discontinued","inputId","ingredient1",3,"value"],["for","ingredient1",1,"m-0"],["name","discontinued","formControlName","discontinued","inputId","ingredient2",3,"value"],["for","ingredient2",1,"m-0"]],template:function(n,i){if(n&1){let o=w();a(0,"app-main-panel",7),S("search",function(f){return _(o),g(i.onSearchEvent(f))}),Qe("isDialogFilterVisibleChange",function(f){return _(o),Ze(i.isDialogFilterVisible,f)||(i.isDialogFilterVisible=f),g(f)}),S("filterEmitted",function(){return _(o),g(i.onFilterEvent())})("filterConfirmed",function(){return _(o),g(i.onFilterOKEvent())}),u(1,Mi,6,4,"ng-template",null,0,I)(3,Ri,10,5,"ng-template",null,1,I)(5,$i,1,1,"ng-template",null,2,I),r()}n&2&&(s("isSearchableInput",!0),je("isDialogFilterVisible",i.isDialogFilterVisible),s("isFilterable",!0)("scrollable",!0))},dependencies:[N,z,F,Ye,$,ln,dt,pt,ut,Se,rn,oe,Y,ye,V,B,Te,Ie,be,Je,Ln,Fn,Nn,Vn,K,kn,le,ae,st,it,nt,_e,Bn,Rn,Pe,Ee,ce,se,mt,ct],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 qi=["class","page"],zi=()=>["../../"],Ft=t=>({"ng-invalid ng-dirty":t}),Gi=t=>({"ng-dirty ng-invalid":t});function Hi(t,l){if(t&1){let e=w();a(0,"div",5)(1,"a",6),p(2,"Cancel"),r(),a(3,"p-button",7),S("onClick",function(){_(e);let i=m();return g(i.onSubmit())}),r()()}t&2&&(c(),s("routerLink",R(1,zi)))}function Ui(t,l){t&1&&(a(0,"div",34),p(1," Name is required "),r())}function ji(t,l){if(t&1&&(a(0,"div"),u(1,Ui,2,0,"div",33),r()),t&2){let e=m(2);c(),s("ngIf",e.form.controls.Name.errors.required)}}function Zi(t,l){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 Qi(t,l){if(t&1&&(a(0,"span",36),p(1),r()),t&2){let e=l.$implicit;s("pTooltip",e.name),c(),Q(" ",e.name," ")}}function Wi(t,l){t&1&&(a(0,"div",34),p(1," Code is required "),r())}function Yi(t,l){if(t&1&&(a(0,"div"),u(1,Wi,2,0,"div",33),r()),t&2){let e=m(2);c(),s("ngIf",e.form.controls.Code.errors.required)}}function Xi(t,l){t&1&&(a(0,"div",34),p(1," Note is required "),r())}function Ji(t,l){if(t&1&&(a(0,"div"),u(1,Xi,2,0,"div",33),r()),t&2){let e=m(2);c(),s("ngIf",e.form.controls.Note.errors.required)}}function eo(t,l){if(t&1&&p(0),t&2){let e=l.$implicit;Q(" ",(e==null?null:e.fullLabel)||(e==null?null:e.label)||"Select a category"," ")}}function to(t,l){t&1&&(a(0,"div",34),p(1," Category is required "),r())}function no(t,l){if(t&1&&(a(0,"div"),u(1,to,2,0,"div",33),r()),t&2){let e=m(2);c(),s("ngIf",e.form.controls.Category.errors.required)}}function io(t,l){t&1&&(a(0,"div",34),p(1," Note is required "),r())}function oo(t,l){if(t&1&&(a(0,"div"),u(1,io,2,0,"div",33),r()),t&2){let e=m(2);c(),s("ngIf",e.form.controls.Note.errors.required)}}function ro(t,l){t&1&&(a(0,"div",34),p(1," Note is required "),r())}function ao(t,l){if(t&1&&(a(0,"div"),u(1,ro,2,0,"div",33),r()),t&2){let e=m(2);c(),s("ngIf",e.form.controls.Note.errors.required)}}function lo(t,l){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,ji,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,Zi,3,0,"ng-template",null,2,I),r(),a(17,"p-select",19),u(18,Qi,2,2,"ng-template",null,3,I),r()()(),a(20,"div",10)(21,"div",11)(22,"div",12)(23,"label",13),p(24,"Code"),r(),h(25,"input",20),u(26,Yi,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,Ji,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,eo,1,1,"ng-template",29),r(),u(48,no,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,oo,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,ao,2,1,"div",15),r()(),h(64,"div",11),r()()()),t&2){let e=te(16),n=m();s("formGroup",n.form),c(7),s("ngClass",T(21,Ft,n.form.controls.Name.invalid&&(n.form.controls.Name.dirty||n.form.controls.Name.touched))),c(),s("ngIf",n.form.controls.Name.invalid&&(n.form.controls.Name.dirty||n.form.controls.Name.touched)),c(5),s("pTooltip",e),c(4),s("fluid",!0)("options",n.outlets()),c(8),s("ngClass",T(23,Ft,n.form.controls.Code.invalid&&(n.form.controls.Code.dirty||n.form.controls.Code.touched))),c(),s("ngIf",n.form.controls.Code.invalid&&(n.form.controls.Code.dirty||n.form.controls.Code.touched)),c(7),s("value",!1),c(4),s("value",!0),c(3),s("ngIf",n.form.controls.Note.errors),c(6),s("fluid",!0)("options",n.categoryOptions())("ngClass",T(25,Gi,n.form.controls.Category.invalid&&(n.form.controls.Category.dirty||n.form.controls.Category.touched))),c(2),s("ngIf",n.form.controls.Category.invalid&&(n.form.controls.Category.dirty||n.form.controls.Category.touched)),c(7),s("options",n.accessTypes())("fluid",!0),c(),s("ngIf",n.form.controls.Note.errors),c(6),s("ngClass",T(27,Ft,n.form.controls.Note.invalid&&(n.form.controls.Note.dirty||n.form.controls.Note.touched)))("autoResize",!0),c(),s("ngIf",n.form.controls.Note.errors)}}var Nt=(()=>{class t{constructor(){this.route=x(ne),this.coa_service=x(X),this.coa_info=v(null),this.fb=x(ve),this.isEdit=v(!1),this.categoryOptions=v([]),this.router=x(ie),this.outlets=W(()=>this.coa_info()?this.coa_info().options.entities:[]),this.accessTypes=W(()=>{let e=["This Chart of Account can be viewed by all users.","Restricted access, only visible to users with the private role"];return this.coa_info()?this.coa_info().options.coaAccessType.map((n,i)=>y(C({},n),{description:e[i]})):[]})}findParenChilds(e,n){function i(o,d=null){for(let f of o){if(f.key===n)return{parent:d,child:f};if(f.children){let b=i(f.children,f);if(b)return b}}return null}return i(e)}generateForm(e){this.form=this.fb.group({ID:new L(e.id||""),Name:new L(e.name||"",[fe.required]),Code:new L(e.code||"",[fe.required]),Note:new L(e.note||"",[]),Balance:new L(e.balance||0),Outlet:new L(e.outletID||""),AccessType:new L(e.accessTypeID||0),Category:new L(null,[fe.required]),Bin:new L(e.bin||!1)})}ngOnInit(){this.generateForm({id:"",name:"",code:"",note:"",balance:0,outletID:"",accessTypeID:0,categoryID:null,bin:!1}),this.fetchLoader(),this.fetchCategoryOptions()}fetchLoader(){this.route.paramMap.pipe(qe(e=>{if(e.has("id")){this.isEdit.set(!0);let n=e.get("id");return this.coa_service.getChartAccountFormById(n)}else return this.coa_service.getChartAccountForm()}),P("response"),G(e=>y(C({},e),{form:y(C({},e.form),{categoryID:e.form.categoryID==="00000000-0000-0000-0000-000000000000"?"":e.form.categoryID})})),A(e=>{this.coa_info.set(e),this.generateForm(e.form)})).subscribe()}get hasIdParam(){return this.route.snapshot.paramMap.has("id")}onSubmit(){if(this.form.invalid){this.form.markAllAsTouched();return}let{AccessType:e,Balance:n,Category:i,Code:o,Name:d,Note:f,Outlet:b}=this.form.value,M;this.hasIdParam?M={id:this.coa_info().form.id,categoryID:i.key,name:d,bin:this.form.value.Bin||!1,code:o,note:f,outletID:b||null,balance:n,accessTypeID:e}:M={id:this.coa_info().form.id,categoryID:i.key,bin:this.form.value.Bin||!1,name:d,code:o,note:f,outletID:b||null,balance:n,accessTypeID:e},this.hasIdParam?this.coa_service.submitChartAccount(M).pipe(P("submitChartAccount"),A(()=>{this.form.reset(),this.router.navigate(["/pages/chart-of-account/account"])})).subscribe():this.coa_service.submitChartAccount(M).pipe(P("submitChartAccount"),A(()=>{this.form.reset(),this.router.navigate(["/pages/chart-of-account/account"])})).subscribe()}fetchCategoryOptions(){this.coa_service.fetchCategoryOptions().pipe(P("response"),A(e=>{this.categoryOptions.set(e);let n=this.findParenChilds(this.categoryOptions(),this.coa_info()?.form?.categoryID);this.form.controls.Category.setValue(n?.child)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=O({type:t,selectors:[["app-coa-account-form",8,"page"]],attrs:qi,decls:5,vars:1,consts:[["actionButton",""],["content",""],["tooltipContent",""],["item",""],["pageTitle","Chart Of Account Form",3,"hasMainWrapperPadding"],[1,"d-flex","gap-2"],["type","button",1,"p-button","p-button-secondary","p-button-outlined",3,"routerLink"],["label","Submit",3,"onClick"],["styleClass","rounded-2",3,"formGroup"],[1,"d-flex","flex-column","gap-2"],[1,"row"],[1,"col-6"],[1,"d-flex","flex-column"],["for",""],["size","small","formControlName","Name","type","text","pInputText","",3,"ngClass"],[4,"ngIf"],[1,"d-flex","align-items-baseline","gap-2"],[3,"pTooltip"],[1,"fa-solid","fa-circle-info"],["appendTo","body","formControlName","Outlet","optionLabel","name","optionValue","id","placeholder","Select Outlet",3,"fluid","options"],["size","small","formControlName","Code","type","text","pInputText","",3,"ngClass"],[1,"col-3","d-flex","align-items-center","gap-2"],["name","Bin","formControlName","Bin","inputId","ingredient1",3,"value"],["for","ingredient1",1,"m-0"],[1,"col","d-flex","align-items-center","gap-2"],["name","Bin","formControlName","Bin","inputId","ingredient2",3,"value"],["for","ingredient2",1,"m-0"],[1,"form-group","d-flex","flex-column"],["formControlName","Category","containerStyleClass","w-full","placeholder","Select a Category",1,"w-full",3,"fluid","options","ngClass"],["pTemplate","value"],[1,"col"],["optionLabel","value","optionValue","key","formControlName","AccessType","placeholder","Select Access Type",3,"options","fluid"],["pSize","small","rows","5","cols","30","pTextarea","","formControlName","Note",3,"ngClass","autoResize"],["class","invalid-feedback text-danger d-block",4,"ngIf"],[1,"invalid-feedback","text-danger","d-block"],[1,"flex","items-center"],[1,"d-inline-block","text-truncate",2,"max-width","200px",3,"pTooltip"]],template:function(n,i){n&1&&(a(0,"app-main-panel",4),u(1,Hi,4,2,"ng-template",null,0,I)(3,lo,65,29,"ng-template",null,1,I),r()),n&2&&s("hasMainWrapperPadding",!0)},dependencies:[$,Te,oe,Y,ye,Ie,be,ut,N,z,F,V,B,Pe,Ee,Ae,K,it,nt,zn,qn,st,Mn,_e,ot,le,ae,ce,se,mt,ct],styles:["[_nghost-%COMP%]{display:block}[_nghost-%COMP%] .p-treeselect{width:100%!important}"],changeDetection:0})}}return t})();var so=["sublist"],co=(t,l)=>({"p-contextmenu-submenu":t,"p-contextmenu-root-list":l}),mo=()=>({"p-contextmenu-item-link":!0}),Yn=()=>({class:"p-contextmenu-submenu-icon"}),po=()=>({exact:!1}),uo=t=>({"p-contextmenu-item-link":!0,"p-disabled":t}),fo=t=>({$implicit:t});function _o(t,l){if(t&1&&h(0,"li",8),t&2){let e=m().$implicit,n=m(2);He(n.getItemProp(e,"style")),s("ngClass",n.getSeparatorItemClass(e)),k("id",n.getItemId(e))("data-pc-section","separator")}}function go(t,l){if(t&1&&h(0,"span",19),t&2){let e=m(4).$implicit,n=m(2);s("ngClass",n.getItemProp(e,"icon"))("ngStyle",n.getItemProp(e,"iconStyle")),k("data-pc-section","icon")("aria-hidden",!0)("tabindex",-1)}}function ho(t,l){if(t&1&&(a(0,"span",20),p(1),r()),t&2){let e=m(4).$implicit,n=m(2);k("data-pc-section","label"),c(),Q(" ",n.getItemLabel(e)," ")}}function xo(t,l){if(t&1&&h(0,"span",21),t&2){let e=m(4).$implicit,n=m(2);s("innerHTML",n.getItemLabel(e),Me),k("data-pc-section","label")}}function Co(t,l){if(t&1&&h(0,"p-badge",22),t&2){let e=m(4).$implicit,n=m(2);s("styleClass",n.getItemProp(e,"badgeStyleClass"))("value",n.getItemProp(e,"badge"))}}function yo(t,l){t&1&&h(0,"AngleRightIcon"),t&2&&(Fe("p-contextmenu-submenu-icon"),k("data-pc-section","submenuicon")("aria-hidden",!0))}function Io(t,l){}function bo(t,l){t&1&&u(0,Io,0,0,"ng-template",25),t&2&&s("data-pc-section","submenuicon")("aria-hidden",!0)}function vo(t,l){if(t&1&&(H(0),u(1,yo,1,4,"AngleRightIcon",23)(2,bo,1,2,null,24),U()),t&2){let e=m(6);c(),s("ngIf",!e.contextMenu.submenuIconTemplate&&!e.contextMenu._submenuIconTemplate),c(),s("ngTemplateOutlet",e.contextMenu.submenuIconTemplate||e.contextMenu._submenuIconTemplate)("ngTemplateOutletContext",R(3,Yn))}}function So(t,l){if(t&1&&(a(0,"a",15),u(1,go,1,5,"span",16)(2,ho,2,2,"span",17)(3,xo,1,2,"ng-template",null,2,I)(5,Co,1,2,"p-badge",18)(6,vo,3,4,"ng-container",11),r()),t&2){let e=te(4),n=m(3).$implicit,i=m(2);s("target",i.getItemProp(n,"target"))("ngClass",R(12,mo)),k("href",i.getItemProp(n,"url"),Gt)("aria-hidden",!0)("data-automationid",i.getItemProp(n,"automationId"))("data-pc-section","action")("tabindex",-1),c(),s("ngIf",i.getItemProp(n,"icon")),c(),s("ngIf",i.getItemProp(n,"escape"))("ngIfElse",e),c(3),s("ngIf",i.getItemProp(n,"badge")),c(),s("ngIf",i.isItemGroup(n))}}function To(t,l){if(t&1&&h(0,"span",19),t&2){let e=m(4).$implicit,n=m(2);s("ngClass",n.getItemProp(e,"icon"))("ngStyle",n.getItemProp(e,"iconStyle")),k("data-pc-section","icon")("aria-hidden",!0)("tabindex",-1)}}function Ao(t,l){if(t&1&&(a(0,"span",20),p(1),r()),t&2){let e=m(4).$implicit,n=m(2);k("data-pc-section","label"),c(),Q(" ",n.getItemLabel(e)," ")}}function wo(t,l){if(t&1&&h(0,"span",21),t&2){let e=m(4).$implicit,n=m(2);s("innerHTML",n.getItemLabel(e),Me),k("data-pc-section","label")}}function Eo(t,l){if(t&1&&h(0,"p-badge",22),t&2){let e=m(4).$implicit,n=m(2);s("styleClass",n.getItemProp(e,"badgeStyleClass"))("value",n.getItemProp(e,"badge"))}}function Po(t,l){t&1&&h(0,"AngleRightIcon"),t&2&&(Fe("p-contextmenu-submenu-icon"),k("data-pc-section","submenuicon")("aria-hidden",!0))}function ko(t,l){}function Mo(t,l){t&1&&u(0,ko,0,0,"ng-template",25),t&2&&s("data-pc-section","submenuicon")("aria-hidden",!0)}function Oo(t,l){if(t&1&&(H(0),u(1,Po,1,4,"AngleRightIcon",23)(2,Mo,1,2,null,24),U()),t&2){let e=m(6);c(),s("ngIf",!e.contextMenu.submenuIconTemplate&&!e.contextMenu._submenuIconTemplate),c(),s("ngTemplateOutlet",!e.contextMenu.submenuIconTemplate||!e.contextMenu._submenuIconTemplate)("ngTemplateOutletContext",R(3,Yn))}}function Fo(t,l){if(t&1&&(a(0,"a",26),u(1,To,1,5,"span",16)(2,Ao,2,2,"span",17)(3,wo,1,2,"ng-template",null,2,I)(5,Eo,1,2,"p-badge",18)(6,Oo,3,4,"ng-container",11),r()),t&2){let e=te(4),n=m(3).$implicit,i=m(2);s("routerLink",i.getItemProp(n,"routerLink"))("queryParams",i.getItemProp(n,"queryParams"))("routerLinkActiveOptions",i.getItemProp(n,"routerLinkActiveOptions")||R(20,po))("target",i.getItemProp(n,"target"))("ngClass",T(21,uo,i.getItemProp(n,"disabled")))("fragment",i.getItemProp(n,"fragment"))("queryParamsHandling",i.getItemProp(n,"queryParamsHandling"))("preserveFragment",i.getItemProp(n,"preserveFragment"))("skipLocationChange",i.getItemProp(n,"skipLocationChange"))("replaceUrl",i.getItemProp(n,"replaceUrl"))("state",i.getItemProp(n,"state")),k("data-automationid",i.getItemProp(n,"automationId"))("tabindex",-1)("aria-hidden",!0)("data-pc-section","action"),c(),s("ngIf",i.getItemProp(n,"icon")),c(),s("ngIf",i.getItemProp(n,"escape"))("ngIfElse",e),c(3),s("ngIf",i.getItemProp(n,"badge")),c(),s("ngIf",i.isItemGroup(n))}}function No(t,l){if(t&1&&(H(0),u(1,So,7,13,"a",13)(2,Fo,7,23,"a",14),U()),t&2){let e=m(2).$implicit,n=m(2);c(),s("ngIf",!n.getItemProp(e,"routerLink")),c(),s("ngIf",n.getItemProp(e,"routerLink"))}}function Vo(t,l){}function Lo(t,l){t&1&&u(0,Vo,0,0,"ng-template")}function Do(t,l){if(t&1&&(H(0),u(1,Lo,1,0,null,24),U()),t&2){let e=m(2).$implicit,n=m(2);c(),s("ngTemplateOutlet",n.itemTemplate)("ngTemplateOutletContext",T(2,fo,e.item))}}function Ro(t,l){if(t&1){let e=w();a(0,"p-contextmenu-sub",27),S("itemClick",function(i){_(e);let o=m(4);return g(o.itemClick.emit(i))})("itemMouseEnter",function(i){_(e);let o=m(4);return g(o.onItemMouseEnter(i))}),r()}if(t&2){let e=m(2).$implicit,n=m(2);s("items",e.items)("itemTemplate",n.itemTemplate)("menuId",n.menuId)("visible",n.isItemActive(e)&&n.isItemGroup(e))("activeItemPath",n.activeItemPath)("focusedItemId",n.focusedItemId)("level",n.level+1)}}function Bo(t,l){if(t&1){let e=w();a(0,"li",9,1)(2,"div",10),S("click",function(i){_(e);let o=m().$implicit,d=m(2);return g(d.onItemClick(i,o))})("mouseenter",function(i){_(e);let o=m().$implicit,d=m(2);return g(d.onItemMouseEnter({$event:i,processedItem:o}))}),u(3,No,3,2,"ng-container",11)(4,Do,2,4,"ng-container",11),r(),u(5,Ro,1,7,"p-contextmenu-sub",12),r()}if(t&2){let e=m(),n=e.$implicit,i=e.index,o=m(2);Fe(o.getItemProp(n,"styleClass")),s("ngStyle",o.getItemProp(n,"style"))("ngClass",o.getItemClass(n))("tooltipOptions",o.getItemProp(n,"tooltipOptions")),k("id",o.getItemId(n))("data-pc-section","menuitem")("data-p-highlight",o.isItemActive(n))("data-p-focused",o.isItemFocused(n))("data-p-disabled",o.isItemDisabled(n))("aria-label",o.getItemLabel(n))("aria-disabled",o.isItemDisabled(n)||void 0)("aria-haspopup",o.isItemGroup(n)&&!o.getItemProp(n,"to")?"menu":void 0)("aria-expanded",o.isItemGroup(n)?o.isItemActive(n):void 0)("aria-level",o.level+1)("aria-setsize",o.getAriaSetSize())("aria-posinset",o.getAriaPosInset(i)),c(2),k("data-pc-section","content"),c(),s("ngIf",!o.itemTemplate),c(),s("ngIf",o.itemTemplate),c(),s("ngIf",o.isItemVisible(n)&&o.isItemGroup(n))}}function $o(t,l){if(t&1&&u(0,_o,1,5,"li",6)(1,Bo,6,21,"li",7),t&2){let e=l.$implicit,n=m(2);s("ngIf",n.isItemVisible(e)&&n.getItemProp(e,"separator")),c(),s("ngIf",n.isItemVisible(e)&&!n.getItemProp(e,"separator"))}}function Ko(t,l){if(t&1){let e=w();a(0,"ul",4,0),S("@overlayAnimation.start",function(i){_(e);let o=te(1),d=m();return g(d.onEnter(i,o))})("keydown",function(i){_(e);let o=m();return g(o.menuKeydown.emit(i))})("focus",function(i){_(e);let o=m();return g(o.menuFocus.emit(i))})("blur",function(i){_(e);let o=m();return g(o.menuBlur.emit(i))}),u(2,$o,2,2,"ng-template",5),r()}if(t&2){let e=m();s("ngClass",Yt(10,co,!e.root,e.root))("@overlayAnimation",e.visible)("tabindex",e.tabindex),k("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),s("ngForOf",e.items)}}var qo=["item"],zo=["submenuicon"],Go=["rootmenu"],Ho=["container"],Uo=t=>({"p-contextmenu p-component":!0,"p-contextmenu-mobile":t}),jo=()=>({value:"visible"});function Zo(t,l){if(t&1){let e=w();a(0,"div",3,0),S("@overlayAnimation.start",function(i){_(e);let o=m();return g(o.onOverlayAnimationStart(i))})("@overlayAnimation.done",function(i){_(e);let o=m();return g(o.onOverlayAnimationEnd(i))}),a(2,"p-contextmenu-sub",4,1),S("itemClick",function(i){_(e);let o=m();return g(o.onItemClick(i))})("menuFocus",function(i){_(e);let o=m();return g(o.onMenuFocus(i))})("menuBlur",function(i){_(e);let o=m();return g(o.onMenuBlur(i))})("menuKeydown",function(i){_(e);let o=m();return g(o.onKeyDown(i))})("itemMouseEnter",function(i){_(e);let o=m();return g(o.onItemMouseEnter(i))}),r()()}if(t&2){let e=m();Fe(e.styleClass),s("ngClass",T(20,Uo,e.queryMatches))("ngStyle",e.style)("@overlayAnimation",R(22,jo)),k("data-pc-section","root")("data-pc-name","contextmenu")("id",e.id),c(2),s("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 Qo=({dt:t})=>`
|
|
2
2
|
.p-contextmenu {
|
|
3
3
|
position: absolute;
|
|
4
4
|
background: ${t("contextmenu.background")};
|
|
@@ -157,4 +157,4 @@ import{a as pt,b as dt}from"./chunk-LNN3TWH2.js";import{a as ut}from"./chunk-Y52
|
|
|
157
157
|
}
|
|
158
158
|
`,Wo={root:"p-contextmenu p-component",rootList:"p-contextmenu-root-list",item:({instance:t,processedItem:l})=>["p-contextmenu-item",{"p-contextmenu-item-active":t.isItemActive(l),"p-focus":t.isItemFocused(l),"p-disabled":t.isItemDisabled(l)}],itemContent:"p-contextmenu-item-content",itemLink:"p-contextmenu-item-link",itemIcon:"p-contextmenu-item-icon",itemLabel:"p-contextmenu-item-label",submenuIcon:"p-contextmenu-submenu-icon",submenu:"p-contextmenu-submenu",separator:"p-contextmenu-separator"},Wn=(()=>{class t extends yn{name="contextmenu";theme=Qo;classes=Wo;static \u0275fac=(()=>{let e;return function(i){return(e||(e=Ge(t)))(i||t)}})();static \u0275prov=ze({token:t,factory:t.\u0275fac})}return t})();var Yo=(()=>{class t extends Tt{contextMenu;visible=!1;items;itemTemplate;root=!1;autoZIndex=!0;baseZIndex=0;popup;menuId;ariaLabel;ariaLabelledBy;level=0;focusedItemId;activeItemPath;tabindex=0;itemClick=new ee;itemMouseEnter=new ee;menuFocus=new ee;menuBlur=new ee;menuKeydown=new ee;sublistViewChild;constructor(e){super(),this.contextMenu=e}getItemProp(e,n,i=null){return e&&e.item?St(e.item[n],i):void 0}getItemId(e){return e.item&&e.item?.id?e.item.id:`${this.menuId}_${e.key}`}getItemKey(e){return this.getItemId(e)}getItemClass(e){return y(C({},this.getItemProp(e,"class")),{"p-contextmenu-item":!0,"p-contextmenu-item-active":this.isItemActive(e),"p-focus":this.isItemFocused(e),"p-disabled":this.isItemDisabled(e)})}getItemLabel(e){return this.getItemProp(e,"label")}getSeparatorItemClass(e){return y(C({},this.getItemProp(e,"class")),{"p-contextmenu-separator":!0})}getAriaSetSize(){return this.items.filter(e=>this.isItemVisible(e)&&!this.getItemProp(e,"separator")).length}getAriaPosInset(e){return e-this.items.slice(0,e).filter(n=>this.isItemVisible(n)&&this.getItemProp(n,"separator")).length+1}isItemVisible(e){return this.getItemProp(e,"visible")!==!1}isItemActive(e){if(this.activeItemPath)return this.activeItemPath.some(n=>n.key===e.key)}isItemDisabled(e){return this.getItemProp(e,"disabled")}isItemFocused(e){return this.focusedItemId===this.getItemId(e)}isItemGroup(e){return re(e.items)}onItemMouseEnter(e){let{event:n,processedItem:i}=e;this.itemMouseEnter.emit({originalEvent:n,processedItem:i})}onItemClick(e,n){this.getItemProp(n,"command",{originalEvent:e,item:n.item}),this.itemClick.emit({originalEvent:e,processedItem:n,isFocus:!0})}onEnter(e,n){if(e.fromState==="void"&&e.toState){let i=e.element;this.position(i)}}position(e){let n=e.parentElement.parentElement,i=dn(e.parentElement.parentElement),o=yt(),d=e.offsetParent?e.offsetWidth:It(e),f=sn(n.children[0]);e.style.top="0px",parseInt(i.left,10)+f+d>o.width-mn()?e.style.left=-1*d+"px":e.style.left=f+"px"}static \u0275fac=function(n){return new(n||t)(gt(qt(()=>_t)))};static \u0275cmp=O({type:t,selectors:[["p-contextMenuSub"],["p-contextmenu-sub"]],viewQuery:function(n,i){if(n&1&&pe(so,5),n&2){let o;j(o=Z())&&(i.sublistViewChild=o.first)}},inputs:{visible:[2,"visible","visible",ue],items:"items",itemTemplate:"itemTemplate",root:[2,"root","root",ue],autoZIndex:[2,"autoZIndex","autoZIndex",ue],baseZIndex:[2,"baseZIndex","baseZIndex",Ce],popup:[2,"popup","popup",ue],menuId:"menuId",ariaLabel:"ariaLabel",ariaLabelledBy:"ariaLabelledBy",level:[2,"level","level",Ce],focusedItemId:"focusedItemId",activeItemPath:"activeItemPath",tabindex:[2,"tabindex","tabindex",Ce]},outputs:{itemClick:"itemClick",itemMouseEnter:"itemMouseEnter",menuFocus:"menuFocus",menuBlur:"menuBlur",menuKeydown:"menuKeydown"},features:[Oe],decls:1,vars:1,consts:[["sublist",""],["listItem",""],["htmlLabel",""],["role","menu",3,"ngClass","tabindex","keydown","focus","blur",4,"ngIf"],["role","menu",3,"keydown","focus","blur","ngClass","tabindex"],["ngFor","",3,"ngForOf"],["role","separator",3,"style","ngClass",4,"ngIf"],["role","menuitem","pTooltip","",3,"ngStyle","ngClass","class","tooltipOptions",4,"ngIf"],["role","separator",3,"ngClass"],["role","menuitem","pTooltip","",3,"ngStyle","ngClass","tooltipOptions"],[1,"p-contextmenu-item-content",3,"click","mouseenter"],[4,"ngIf"],[3,"items","itemTemplate","menuId","visible","activeItemPath","focusedItemId","level","itemClick","itemMouseEnter",4,"ngIf"],["pRipple","",3,"target","ngClass",4,"ngIf"],["pRipple","",3,"routerLink","queryParams","routerLinkActiveOptions","target","ngClass","fragment","queryParamsHandling","preserveFragment","skipLocationChange","replaceUrl","state",4,"ngIf"],["pRipple","",3,"target","ngClass"],["class","p-contextmenu-item-icon",3,"ngClass","ngStyle",4,"ngIf"],["class","p-contextmenu-item-label",4,"ngIf","ngIfElse"],[3,"styleClass","value",4,"ngIf"],[1,"p-contextmenu-item-icon",3,"ngClass","ngStyle"],[1,"p-contextmenu-item-label"],[1,"p-contextmenu-item-label",3,"innerHTML"],[3,"styleClass","value"],[3,"class",4,"ngIf"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"data-pc-section","aria-hidden"],["pRipple","",3,"routerLink","queryParams","routerLinkActiveOptions","target","ngClass","fragment","queryParamsHandling","preserveFragment","skipLocationChange","replaceUrl","state"],[3,"itemClick","itemMouseEnter","items","itemTemplate","menuId","visible","activeItemPath","focusedItemId","level"]],template:function(n,i){n&1&&u(0,Ko,3,13,"ul",3),n&2&&s("ngIf",i.root?!0:i.visible)},dependencies:[t,N,z,We,F,en,ht,V,B,bn,_e,ot,In,wt,Sn,De],encapsulation:2,data:{animation:[xt("overlayAnimation",[Le(":enter",[Ve({opacity:0})]),Le(":leave",[Ve({opacity:0})])])]}})}return t})(),_t=(()=>{class t extends Tt{overlayService;set model(e){this._model=e,this._processedItems=this.createProcessedItems(this._model||[])}get model(){return this._model}triggerEvent="contextmenu";target;global;style;styleClass;appendTo;autoZIndex=!0;baseZIndex=0;id;breakpoint="960px";ariaLabel;ariaLabelledBy;pressDelay=500;onShow=new ee;onHide=new ee;rootmenu;containerViewChild;container;outsideClickListener;resizeListener;triggerEventListener;documentClickListener;documentTriggerListener;touchEndListener;pageX;pageY;visible=v(!1);relativeAlign;window;focused=!1;activeItemPath=v([]);focusedItemInfo=v({index:-1,level:0,parentKey:"",item:null});submenuVisible=v(!1);searchValue="";searchTimeout;_processedItems;_model;pressTimer;matchMediaListener;query;queryMatches;_componentStyle=x(Wn);get visibleItems(){let e=this.activeItemPath().find(n=>n.key===this.focusedItemInfo().parentKey);return e?e.items:this.processedItems}get processedItems(){return(!this._processedItems||!this._processedItems.length)&&(this._processedItems=this.createProcessedItems(this.model||[])),this._processedItems}get focusedItemId(){let e=this.focusedItemInfo();return e.item&&e.item?.id?e.item.id:e.index!==-1?`${this.id}${re(e.parentKey)?"_"+e.parentKey:""}_${e.index}`:null}constructor(e){super(),this.overlayService=e,Jt(()=>{let n=this.activeItemPath();re(n)?this.bindGlobalListeners():this.visible()||this.unbindGlobalListeners()})}ngOnInit(){super.ngOnInit(),this.id=this.id||hn("pn_id_"),this.bindMatchMediaListener(),this.bindTriggerEventListener()}isMobile(){return fn()||un()}bindTriggerEventListener(){Ne(this.platformId)&&(this.triggerEventListener||(this.isMobile()?this.global?(this.triggerEventListener=this.renderer.listen(this.document,"touchstart",this.onTouchStart.bind(this)),this.touchEndListener=this.renderer.listen(this.document,"touchend",this.onTouchEnd.bind(this))):this.target&&(this.triggerEventListener=this.renderer.listen(this.target,"touchstart",this.onTouchStart.bind(this)),this.touchEndListener=this.renderer.listen(this.target,"touchend",this.onTouchEnd.bind(this))):this.global?this.triggerEventListener=this.renderer.listen(this.document,this.triggerEvent,e=>{this.show(e)}):this.target&&(this.triggerEventListener=this.renderer.listen(this.target,this.triggerEvent,e=>{this.show(e)}))))}bindGlobalListeners(){if(Ne(this.platformId)){if(!this.documentClickListener){let e=this.el?this.el.nativeElement.ownerDocument:"document";this.documentClickListener=this.renderer.listen(e,"click",n=>{this.containerViewChild.nativeElement.offsetParent&&this.isOutsideClicked(n)&&!n.ctrlKey&&n.button!==2&&this.triggerEvent!=="click"&&this.hide()}),this.documentTriggerListener=this.renderer.listen(e,this.triggerEvent,n=>{this.containerViewChild.nativeElement.offsetParent&&this.isOutsideClicked(n)&&this.hide()})}this.resizeListener||(this.resizeListener=this.renderer.listen(this.document.defaultView,"resize",e=>{this.hide()}))}}itemTemplate;submenuIconTemplate;templates;_submenuIconTemplate;_itemTemplate;ngAfterContentInit(){this.templates?.forEach(e=>{switch(e.getType()){case"submenuicon":this._submenuIconTemplate=e.template;break;case"item":this._itemTemplate=e.template;break;default:this._itemTemplate=e.template;break}})}createProcessedItems(e,n=0,i={},o=""){let d=[];return e&&e.forEach((f,b)=>{let M=(o!==""?o+"_":"")+b,q={item:f,index:b,level:n,key:M,parent:i,parentKey:o};q.items=this.createProcessedItems(f.items,n+1,q,M),d.push(q)}),d}bindMatchMediaListener(){if(Ne(this.platformId)&&!this.matchMediaListener){let e=window.matchMedia(`(max-width: ${this.breakpoint})`);this.query=e,this.queryMatches=e.matches,this.matchMediaListener=()=>{this.queryMatches=e.matches},e.addEventListener("change",this.matchMediaListener)}}unbindMatchMediaListener(){this.matchMediaListener&&(this.query.removeEventListener("change",this.matchMediaListener),this.matchMediaListener=null)}getItemProp(e,n){return e?St(e[n]):void 0}getProccessedItemLabel(e){return e?this.getItemLabel(e.item):void 0}getItemLabel(e){return this.getItemProp(e,"label")}isProcessedItemGroup(e){return e&&re(e.items)}isSelected(e){return this.activeItemPath().some(n=>n.key===e.key)}isValidSelectedItem(e){return this.isValidItem(e)&&this.isSelected(e)}isValidItem(e){return!!e&&!this.isItemDisabled(e.item)&&!this.isItemSeparator(e.item)}isItemDisabled(e){return this.getItemProp(e,"disabled")}isItemSeparator(e){return this.getItemProp(e,"separator")}isItemMatched(e){return this.isValidItem(e)&&this.getProccessedItemLabel(e).toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase())}isProccessedItemGroup(e){return e&&re(e.items)}onItemClick(e){let{processedItem:n}=e,i=this.isProcessedItemGroup(n);if(this.isSelected(n)){let{index:d,key:f,level:b,parentKey:M,item:q}=n;this.activeItemPath.set(this.activeItemPath().filter(Be=>f!==Be.key&&f.startsWith(Be.key))),this.focusedItemInfo.set({index:d,level:b,parentKey:M,item:q}),tt(this.rootmenu.sublistViewChild.nativeElement)}else i?this.onItemChange(e):this.hide()}onItemMouseEnter(e){this.onItemChange(e,"hover")}onKeyDown(e){let n=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":this.onArrowLeftKey(e);break;case"ArrowRight":this.onArrowRightKey(e);break;case"Home":this.onHomeKey(e);break;case"End":this.onEndKey(e);break;case"Space":this.onSpaceKey(e);break;case"Enter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"PageDown":case"PageUp":case"Backspace":case"ShiftLeft":case"ShiftRight":break;default:!n&&gn(e.key)&&this.searchItems(e,e.key);break}}onArrowDownKey(e){let n=this.focusedItemInfo().index!==-1?this.findNextItemIndex(this.focusedItemInfo().index):this.findFirstFocusedItemIndex();this.changeFocusedItemIndex(e,n),e.preventDefault()}onArrowRightKey(e){let n=this.visibleItems[this.focusedItemInfo().index];this.isProccessedItemGroup(n)&&(this.onItemChange({originalEvent:e,processedItem:n}),this.focusedItemInfo.set({index:-1,parentKey:n.key,item:n.item}),this.searchValue="",this.onArrowDownKey(e)),e.preventDefault()}onArrowUpKey(e){if(e.altKey){if(this.focusedItemInfo().index!==-1){let n=this.visibleItems[this.focusedItemInfo().index];!this.isProccessedItemGroup(n)&&this.onItemChange({originalEvent:e,processedItem:n})}this.hide(),e.preventDefault()}else{let n=this.focusedItemInfo().index!==-1?this.findPrevItemIndex(this.focusedItemInfo().index):this.findLastFocusedItemIndex();this.changeFocusedItemIndex(e,n),e.preventDefault()}}onArrowLeftKey(e){let n=this.visibleItems[this.focusedItemInfo().index],i=this.activeItemPath().find(f=>f.key===n.parentKey);bt(n.parent)||(this.focusedItemInfo.set({index:-1,parentKey:i?i.parentKey:"",item:n.item}),this.searchValue="",this.onArrowDownKey(e));let d=this.activeItemPath().filter(f=>f.parentKey!==this.focusedItemInfo().parentKey);this.activeItemPath.set(d),e.preventDefault()}onHomeKey(e){this.changeFocusedItemIndex(e,this.findFirstItemIndex()),e.preventDefault()}onEndKey(e){this.changeFocusedItemIndex(e,this.findLastItemIndex()),e.preventDefault()}onSpaceKey(e){this.onEnterKey(e)}onEscapeKey(e){this.hide();let n=this.findVisibleItem(this.findFirstFocusedItemIndex()),i=this.focusedItemInfo();this.focusedItemInfo.set(y(C({},i),{index:this.findFirstFocusedItemIndex(),item:n.item})),e.preventDefault()}onTabKey(e){if(this.focusedItemInfo().index!==-1){let n=this.visibleItems[this.focusedItemInfo().index];!this.isProccessedItemGroup(n)&&this.onItemChange({originalEvent:e,processedItem:n})}this.hide()}onEnterKey(e){if(this.focusedItemInfo().index!==-1){let n=et(this.rootmenu.el.nativeElement,`li[id="${`${this.focusedItemId}`}"]`),i=n&&et(n,'a[data-pc-section="action"]');i?i.click():n&&n.click();let o=this.visibleItems[this.focusedItemInfo().index];if(!this.isProccessedItemGroup(o)){let f=this.focusedItemInfo();this.focusedItemInfo.set(y(C({},f),{index:this.findFirstFocusedItemIndex()}))}}e.preventDefault()}onItemChange(e,n){let{processedItem:i,isFocus:o}=e;if(bt(i))return;let{index:d,key:f,level:b,parentKey:M,items:q}=i,Be=re(q),Dt=this.activeItemPath().filter(Rt=>Rt.parentKey!==M&&Rt.parentKey!==f);Be&&(Dt.push(i),this.submenuVisible.set(!0)),this.focusedItemInfo.set({index:d,level:b,parentKey:M,item:i.item}),o&&tt(this.rootmenu.sublistViewChild.nativeElement),!(n==="hover"&&this.queryMatches)&&this.activeItemPath.set(Dt)}onMenuFocus(e){this.focused=!0;let n=this.focusedItemInfo().index!==-1?this.focusedItemInfo():{index:-1,level:0,parentKey:"",item:null};this.focusedItemInfo.set(n)}onMenuBlur(e){this.focused=!1,this.focusedItemInfo.set({index:-1,level:0,parentKey:"",item:null}),this.searchValue=""}onOverlayAnimationStart(e){switch(e.toState){case"visible":this.container=e.element,this.position(),this.moveOnTop(),this.appendOverlay(),this.bindGlobalListeners(),tt(this.rootmenu.sublistViewChild.nativeElement);break}}onOverlayAnimationEnd(e){switch(e.toState){case"void":this.onOverlayHide();break}}appendOverlay(){this.appendTo&&(this.appendTo==="body"?this.renderer.appendChild(this.document.body,this.containerViewChild.nativeElement):cn(this.appendTo,this.containerViewChild.nativeElement))}moveOnTop(){this.autoZIndex&&this.containerViewChild&&At.set("menu",this.containerViewChild.nativeElement,this.baseZIndex+this.config.zIndex.menu)}onOverlayHide(){this.unbindGlobalListeners(),this.cd.destroyed||(this.target=null),this.container&&this.autoZIndex&&At.clear(this.container),this.container=null}onTouchStart(e){this.pressTimer=setTimeout(()=>{this.show(e)},this.pressDelay)}onTouchEnd(){clearTimeout(this.pressTimer)}hide(){this.visible.set(!1),this.onHide.emit(),this.activeItemPath.set([]),this.focusedItemInfo.set({index:-1,level:0,parentKey:"",item:null})}toggle(e){this.visible()?this.hide():this.show(e)}show(e){this.activeItemPath.set([]),this.focusedItemInfo.set({index:-1,level:0,parentKey:"",item:null}),this.pageX=e.pageX,this.pageY=e.pageY,this.onShow.emit(),this.visible()?this.position():this.visible.set(!0),e.stopPropagation(),e.preventDefault()}position(){let e=this.pageX+1,n=this.pageY+1,i=this.containerViewChild.nativeElement.offsetParent?this.containerViewChild.nativeElement.offsetWidth:It(this.containerViewChild.nativeElement),o=this.containerViewChild.nativeElement.offsetParent?this.containerViewChild.nativeElement.offsetHeight:pn(this.containerViewChild.nativeElement),d=yt();e+i-this.document.scrollingElement.scrollLeft>d.width&&(e-=i),n+o-this.document.scrollingElement.scrollTop>d.height&&(n-=o),e<this.document.scrollingElement.scrollLeft&&(e=this.document.scrollingElement.scrollLeft),n<this.document.scrollingElement.scrollTop&&(n=this.document.scrollingElement.scrollTop),this.containerViewChild.nativeElement.style.left=e+"px",this.containerViewChild.nativeElement.style.top=n+"px"}searchItems(e,n){this.searchValue=(this.searchValue||"")+n;let i=-1,o=!1;return this.focusedItemInfo().index!==-1?(i=this.visibleItems.slice(this.focusedItemInfo().index).findIndex(d=>this.isItemMatched(d)),i=i===-1?this.visibleItems.slice(0,this.focusedItemInfo().index).findIndex(d=>this.isItemMatched(d)):i+this.focusedItemInfo().index):i=this.visibleItems.findIndex(d=>this.isItemMatched(d)),i!==-1&&(o=!0),i===-1&&this.focusedItemInfo().index===-1&&(i=this.findFirstFocusedItemIndex()),i!==-1&&this.changeFocusedItemIndex(e,i),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout(()=>{this.searchValue="",this.searchTimeout=null},500),o}findVisibleItem(e){return re(this.visibleItems)?this.visibleItems[e]:null}findLastFocusedItemIndex(){let e=this.findSelectedItemIndex();return e<0?this.findLastItemIndex():e}findLastItemIndex(){return vt(this.visibleItems,e=>this.isValidItem(e))}findPrevItemIndex(e){let n=e>0?vt(this.visibleItems.slice(0,e),i=>this.isValidItem(i)):-1;return n>-1?n:e}findNextItemIndex(e){let n=e<this.visibleItems.length-1?this.visibleItems.slice(e+1).findIndex(i=>this.isValidItem(i)):-1;return n>-1?n+e+1:e}findFirstFocusedItemIndex(){let e=this.findSelectedItemIndex();return e<0?this.findFirstItemIndex():e}findFirstItemIndex(){return this.visibleItems.findIndex(e=>this.isValidItem(e))}findSelectedItemIndex(){return this.visibleItems.findIndex(e=>this.isValidSelectedItem(e))}changeFocusedItemIndex(e,n){let i=this.findVisibleItem(n),o=this.focusedItemInfo();o.index!==n&&(this.focusedItemInfo.set(y(C({},o),{index:n,item:i.item})),this.scrollInView())}scrollInView(e=-1){let n=e!==-1?`${this.id}_${e}`:this.focusedItemId,i=et(this.rootmenu.el.nativeElement,`li[id="${n}"]`);i&&i.scrollIntoView&&i.scrollIntoView({block:"nearest",inline:"nearest"})}bindResizeListener(){Ne(this.platformId)&&(this.resizeListener||(this.resizeListener=this.renderer.listen(this.document.defaultView,"resize",e=>{this.hide()})))}isOutsideClicked(e){return!(this.containerViewChild.nativeElement.isSameNode(e.target)||this.containerViewChild.nativeElement.contains(e.target))}unbindResizeListener(){this.resizeListener&&(this.resizeListener(),this.resizeListener=null)}unbindGlobalListeners(){this.documentClickListener&&(this.documentClickListener(),this.documentClickListener=null),this.documentTriggerListener&&(this.documentTriggerListener(),this.documentTriggerListener=null),this.resizeListener&&(this.resizeListener(),this.resizeListener=null),this.touchEndListener&&(this.touchEndListener(),this.touchEndListener=null)}unbindTriggerEventListener(){this.triggerEventListener&&(this.triggerEventListener(),this.triggerEventListener=null)}removeAppendedElements(){this.appendTo&&this.containerViewChild&&(this.appendTo==="body"?this.renderer.removeChild(this.document.body,this.containerViewChild.nativeElement):_n(this.containerViewChild.nativeElement,this.appendTo))}ngOnDestroy(){this.unbindGlobalListeners(),this.unbindTriggerEventListener(),this.unbindMatchMediaListener(),this.removeAppendedElements(),super.ngOnDestroy()}static \u0275fac=function(n){return new(n||t)(gt(xn))};static \u0275cmp=O({type:t,selectors:[["p-contextMenu"],["p-contextmenu"],["p-context-menu"]],contentQueries:function(n,i,o){if(n&1&&(Ue(o,qo,4),Ue(o,zo,4),Ue(o,Ae,4)),n&2){let d;j(d=Z())&&(i.itemTemplate=d.first),j(d=Z())&&(i.submenuIconTemplate=d.first),j(d=Z())&&(i.templates=d)}},viewQuery:function(n,i){if(n&1&&(pe(Go,5),pe(Ho,5)),n&2){let o;j(o=Z())&&(i.rootmenu=o.first),j(o=Z())&&(i.containerViewChild=o.first)}},inputs:{model:"model",triggerEvent:"triggerEvent",target:"target",global:[2,"global","global",ue],style:"style",styleClass:"styleClass",appendTo:"appendTo",autoZIndex:[2,"autoZIndex","autoZIndex",ue],baseZIndex:[2,"baseZIndex","baseZIndex",Ce],id:"id",breakpoint:"breakpoint",ariaLabel:"ariaLabel",ariaLabelledBy:"ariaLabelledBy",pressDelay:[2,"pressDelay","pressDelay",Ce]},outputs:{onShow:"onShow",onHide:"onHide"},features:[he([Wn]),Oe],decls:1,vars:1,consts:[["container",""],["rootmenu",""],[3,"ngClass","class","ngStyle",4,"ngIf"],[3,"ngClass","ngStyle"],[3,"itemClick","menuFocus","menuBlur","menuKeydown","itemMouseEnter","root","items","itemTemplate","menuId","tabindex","ariaLabel","ariaLabelledBy","baseZIndex","autoZIndex","visible","focusedItemId","activeItemPath"]],template:function(n,i){n&1&&u(0,Zo,4,23,"div",2),n&2&&s("ngIf",i.visible())},dependencies:[N,z,F,ht,Yo,V,_e,wt,De],encapsulation:2,data:{animation:[xt("overlayAnimation",[Le(":enter",[Ve({opacity:0}),Ct("250ms")]),Le(":leave",[Ct(".1s linear",Ve({opacity:0}))])])]},changeDetection:0})}return t})(),Xn=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=Ht({type:t});static \u0275inj=zt({imports:[_t,De,De]})}return t})();var Jo=["editInput"],er=["tree"],tr=["class","page"];function nr(t,l){t&1&&(a(0,"a",7),h(1,"i",8),p(2," Add"),r())}function ir(t,l){if(t&1&&u(0,nr,3,0,"a",6),t&2){let e=m();s("ngIf",e.roleService.coa.create)}}function or(t,l){if(t&1){let e=w();a(0,"input",15,4),Qe("ngModelChange",function(i){let o=_(e).$implicit;return Ze(o.label,i)||(o.label=i),g(i)}),S("keydown",function(i){_(e);let o=m(2);return g(o.handleEditKeydown(i))})("blur",function(i){_(e);let o=m(2);return g(o.onNodeEditBlur(i))}),r()}if(t&2){let e=l.$implicit;je("ngModel",e.label)}}function rr(t,l){if(t&1){let e=w();a(0,"div",9)(1,"div",10)(2,"p-panel",11)(3,"p-tree",12,2),S("onNodeContextMenuSelect",function(i){_(e);let o=m();return g(o.onNodeContextMenuSelect(i))})("onNodeSelect",function(i){_(e);let o=m();return g(o.onNodeSelect(i))})("onNodeUnselect",function(i){_(e);let o=m();return g(o.onNodeUnselect(i))})("onNodeDrop",function(i){_(e);let o=m();return g(o.onNodeDrop(i))}),u(5,or,2,1,"ng-template",13),r(),h(6,"p-contextmenu",14,3),r()()()}if(t&2){let e=te(7),n=m();c(2),s("showHeader",!1),c(),s("value",n.categoryTree())("contextMenu",e)("selection",n.selectedCategory)("draggableNodes",!0)("droppableNodes",!0)("propagateSelectionUp",!1)("propagateSelectionDown",!1),c(3),s("model",n.contextMenuItems())}}var Jn=(()=>{class t{constructor(){this._coaTypesService=x(me),this._router=x(ie),this.roleService=x(we),this.contextMenuItems=v([]),this.categoryTree=v([]),this.selectedCategory=null,this._shouldAutoFocus=v(!1)}ngOnInit(){this._loadCategories().subscribe(),this._initializeContextMenuItems(),this.expandAllNodes()}ngAfterViewChecked(){this.selectedCategory&&!this._shouldAutoFocus()&&this.editInputRef&&(this.editInputRef.nativeElement.focus(),this.editInputRef.nativeElement.select(),this._shouldAutoFocus.set(!0))}_loadCategories(){return this._coaTypesService.fetchCOACategories().pipe(P("COA Categories"),A(e=>{this.categoryTree.set(e),this.expandAllNodes()}))}_assignTreeIcons(e){return e.map(n=>{let i=!!n.children?.length;return y(C({},n),{icon:void 0,expandedIcon:i?"fa-solid fa-folder-open":void 0,collapsedIcon:i?"fa-solid fa-folder":"fa-solid fa-file",children:i?this._assignTreeIcons(n.children):[]})})}_initializeContextMenuItems(){this.contextMenuItems.set([{label:"Add",icon:"fa-light fa-plus",disabled:!1,command:()=>this._createChildCategory()},{label:"Edit",icon:"fa-light fa-pen-to-square",disabled:!1,command:()=>this._setSelectedNodeToEditMode()},{label:"Delete",icon:"fa-light fa-trash",disabled:!1,command:()=>this._deleteSelectedCategory()},{label:"Properties",icon:"fa-light fa-file",disabled:!1,command:()=>{this._router.navigate(["/pages/chart-of-account/coa-types/info"],{queryParams:{ID:this.selectedCategory?.key}})}}])}_findNodeByKey(e){return this.treeComponent.getNodeWithKey(e,this.categoryTree())??null}_setSelectedNodeToEditMode(){let e=this._findNodeByKey(this.selectedCategory?.key);e&&(this.selectedCategory=e,e.type="edit")}_createChildCategory(){this._coaTypesService.submitCategory({Name:"New Child Node",ParentID:this.selectedCategory.key,Code:"",Note:""}).pipe(D(e=>this._loadCategories().pipe(G(()=>e))),A(e=>{let n=this._findNodeByKey(e.id);n&&(this.selectedCategory=n,this._shouldAutoFocus.set(!1),n.type="edit")}),P("Created COA Node")).subscribe()}_deleteSelectedCategory(){this.selectedCategory?.key&&this._coaTypesService.deleteCategory(this.selectedCategory.key).pipe(D(()=>this._loadCategories())).subscribe()}renameNode(e,n=this.selectedCategory){this._coaTypesService.renameCategory(n.key,{Name:e}).pipe(D(()=>this._loadCategories())).subscribe()}onNodeSelect(e){this.selectedCategory=e.node,this._shouldAutoFocus.set(!1),e.node.children?.length&&(e.node.icon="fa-solid fa-folder-open")}onNodeUnselect(e){e.node.children?.length&&(e.node.icon="fa-solid fa-folder")}onNodeContextMenuSelect(e){this.selectedCategory=e.node,["Asset","Liability","Equity","Revenue","Expense"].includes(e.node.label)?this.contextMenuItems.set(this.contextMenuItems().map(i=>["Edit","Delete"].includes(i.label)?y(C({},i),{disabled:!0}):y(C({},i),{disabled:!1}))):this.contextMenuItems.set(this.contextMenuItems().map(i=>i.label==="Add"?y(C({},i),{disabled:!this.roleService.coa.create}):i.label==="Edit"?y(C({},i),{disabled:!this.roleService.coa.edit}):i.label==="Delete"?y(C({},i),{disabled:!this.roleService.coa.delete}):y(C({},i),{disabled:!1})))}onNodeDrop(e){let{dragNode:n,dropNode:i}=e;this._coaTypesService.updateParentCategory(n.key,{ParentID:i.key}).pipe(A(()=>this._loadCategories())).subscribe()}onNodeEditBlur(e){let n=e.target;this.renameNode(n.value);let i=this._findNodeByKey(this.selectedCategory?.key);i&&delete i.type}handleEditKeydown(e){let n=e.target;if([" ","Enter"].includes(e.key)&&e.stopPropagation(),e.key==="Enter"){this.renameNode(n.value);let i=this._findNodeByKey(this.selectedCategory?.key);i&&(delete i.type,this.treeComponent.updateSerializedValue?.())}}expandAllNodes(){this.categoryTree().forEach(e=>this._expandRecursive(e,!0))}collapseAllNodes(){this.categoryTree().forEach(e=>this._expandRecursive(e,!1))}_expandRecursive(e,n){e.expanded=n,e.children?.forEach(i=>this._expandRecursive(i,n))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=O({type:t,selectors:[["app-coa-type",8,"page"]],viewQuery:function(n,i){if(n&1&&(pe(Jo,5),pe(er,5)),n&2){let o;j(o=Z())&&(i.editInputRef=o.first),j(o=Z())&&(i.treeComponent=o.first)}},features:[he([Cn])],attrs:tr,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(n,i){n&1&&(a(0,"app-main-panel",5),u(1,ir,1,1,"ng-template",null,0,I)(3,rr,8,9,"ng-template",null,1,I),r()),n&2&&s("scrollable",!0)},dependencies:[$,$n,V,B,Xn,_t,Ae,N,F,Se,oe,Y,Xe,K,vn,ce,se],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var ar=["class","page"],Vt=t=>({"is-invalid":t}),lr=t=>({"ng-invalid ng-dirty":t});function sr(t,l){if(t&1){let e=w();a(0,"div",3)(1,"p-button",4),S("onClick",function(){_(e);let i=m();return g(i.goBack())}),r(),a(2,"p-button",5),S("onClick",function(){_(e);let i=m();return g(i.onSubmit())}),r()()}}function cr(t,l){t&1&&(a(0,"div",20),p(1," Name is required "),r())}function mr(t,l){t&1&&(a(0,"div",20),p(1," Code is required "),r())}function pr(t,l){t&1&&(a(0,"div",20),p(1," Note is required "),r())}function dr(t,l){if(t&1&&(a(0,"div")(1,"span",22),p(2),r()()),t&2){let e=l.$implicit;c(2),E(e)}}function ur(t,l){if(t&1&&(a(0,"div"),u(1,dr,3,1,"div",21),r()),t&2){let e=m(2);c(),s("ngForOf",e.getErrors("Category"))}}function fr(t,l){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,cr,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,mr,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,pr,2,0,"div",13),r()(),a(22,"div",9)(23,"div",17)(24,"label",11),p(25,"Category"),r(),a(26,"p-treeselect",18),S("onFocus",function(){_(e);let i=m();return g(i.loadCategories())}),r(),u(27,ur,2,1,"div",19),r()()()()()()}if(t&2){let e=m();c(3),s("formGroup",e.form),c(5),s("ngClass",T(10,Vt,e.form.controls.Name.invalid&&(e.form.controls.Name.dirty||e.form.controls.Name.touched))),c(),s("ngIf",e.form.controls.Name.errors==null?null:e.form.controls.Name.errors.required),c(5),s("ngClass",T(12,Vt,e.form.controls.Code.invalid&&(e.form.controls.Code.dirty||e.form.controls.Code.touched))),c(),s("ngIf",e.form.controls.Code==null||e.form.controls.Code.errors==null?null:e.form.controls.Code.errors.required),c(5),s("ngClass",T(14,Vt,e.form.controls.Note.invalid&&(e.form.controls.Note.dirty||e.form.controls.Note.touched))),c(),s("ngIf",e.form.controls.Note.errors==null?null:e.form.controls.Note.errors.required),c(5),s("ngClass",T(16,lr,e.isInvalid("Category")))("options",e.categories()),c(),s("ngIf",e.isInvalid("Category"))}}var Lt=(()=>{class t extends Gn{constructor(){super(...arguments),this.categories=v([]),this.COATypeService=x(me),this.COAService=x(X),this.info=v(null),this.route=x(ne),this.router=x(ie),this.fb=x(ve)}goBack(){this.router.navigate(["/pages/chart-of-account/coa-types"])}ngOnInit(){this.generateForm(),Bt([this.route.paramMap.pipe(G(e=>e.get("id")),Ke(e=>!!e)),this.COATypeService.fetchCOACategories()]).pipe(P("fetchCOACategories"),D(([e,n])=>{let i=this.findNodeByKeyInArray(n,e);return this.categories.set(n),this.COATypeService.getCOACategoryByID({ID:e}).pipe(A(o=>{this.form.patchValue({Name:o.name,Code:o.code,Note:o.note,Category:i.parent}),["Asset","Liability","Equity","Revenue","Expense"].includes(o.name)&&this.form.controls.Category.disable()}))})).subscribe()}loadCategories(){this.COAService.getCachedCategoriesOptions().pipe(A(e=>this.categories.set(e))).subscribe()}generateForm(){this.form=new on({Name:new L("",[fe.required]),Code:new L("",[]),Category:new L(null,[fe.required]),Note:new L("",[])})}findNodeByKeyInArray(e,n){for(let i of e){let o=this.findNodeByKey(i,n);if(o)return o}return null}findNodeByKey(e,n,i=null){if(e.key===n||e.label===n)return i&&(e.parent=i),e;if(e.children&&e.children.length>0)for(let o of e.children){let d=this.findNodeByKey(o,n,e);if(d)return d}return null}onSubmit(){let{Name:e,Code:n,Note:i,Category:o}=this.form.value,d=null,f=null;if(this.form.invalid){this.form.markAllAsTouched();return}this.route.snapshot.params.id?(d=this.findNodeByKeyInArray(this.categories(),this.route.snapshot.params.id),f={Name:e,Code:n,ParentID:d&&d.parent?d.parent.key:d.key,Note:i,ID:this.route.snapshot.params.id||null}):(d=this.findNodeByKeyInArray(this.categories(),o.key),f={Name:e,Code:n,ParentID:d&&d.parent?d.parent.key:d.key,Note:i}),this.COATypeService.submitCategory(f,{observe:"response"}).pipe(P("response"),A(()=>{this.router.navigate(["/pages/chart-of-account/coa-types"])})).subscribe()}static{this.\u0275fac=(()=>{let e;return function(i){return(e||(e=Ge(t)))(i||t)}})()}static{this.\u0275cmp=O({type:t,selectors:[["app-coa-type-form",8,"page"]],features:[Oe],attrs:ar,decls:5,vars:1,consts:[["actionButton",""],["content",""],["pageTitle","Chart of Account Category Form",3,"hasMainWrapperPadding"],[1,"d-flex","gap-2"],["label","Cancel","variant","outlined","severity","secondary",3,"onClick"],["label","Submit",3,"onClick"],[1,"row","justify-content-center"],[1,"col"],[1,"row","row-gap-2",3,"formGroup"],[1,"ol-12","col-md-6","col-lg-6"],[1,"form-group","has-validation"],["for",""],["formControlName","Name",1,"form-control",3,"ngClass"],["id","validationServer03Feedback","class","invalid-feedback",4,"ngIf"],[1,"col-12","col-md-6","col-lg-6"],["formControlName","Code",1,"form-control",3,"ngClass"],["formControlName","Note","placeholder","Enter a description for this COA category","id","floatingTextarea2",1,"form-control",2,"height","100px",3,"ngClass"],[1,"form-group","has-validation","d-flex","flex-column"],["showClear","","placeholder","Select a Category","formControlName","Category",1,"ng-invalid","ng-dirty",3,"onFocus","ngClass","options"],[4,"ngIf"],["id","validationServer03Feedback",1,"invalid-feedback"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(n,i){n&1&&(a(0,"app-main-panel",2),u(1,sr,3,0,"ng-template",null,0,I)(3,fr,28,18,"ng-template",null,1,I),r()),n&2&&s("hasMainWrapperPadding",!0)},dependencies:[$,V,Pe,Ee,Te,oe,Y,ye,Ie,be,N,z,We,F,K,le,ae,ce,se],styles:["[_nghost-%COMP%]{display:block} .p-treeselect{width:100%}"],changeDetection:0})}}return t})();var _r=t=>[t];function gr(t,l){if(t&1&&(a(0,"a",4),h(1,"i",5),a(2,"span"),p(3,"Edit"),r()()),t&2){let e=m(2);s("routerLink",T(1,_r,"/pages/chart-of-account/coa-types/"+e.info().id+"/edit"))}}function hr(t,l){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),s("innerHTML",e.info().note,Me)}}function xr(t,l){t&1&&(H(0),a(1,"app-main-panel",3),u(2,gr,4,3,"ng-template",null,0,I)(4,hr,24,4,"ng-template",null,1,I),r(),U())}var ei=(()=>{class t{constructor(){this.COATypeService=x(me),this.route=x(ne),this.info=v(null)}ngOnInit(){this.route.queryParamMap.pipe(G(e=>e.get("ID")),D(e=>this.COATypeService.getCOACategoryByID({ID:e})),P("getCOACategoryByID"),A(e=>this.info.set(e))).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=O({type:t,selectors:[["app-coa-type-info"]],decls:1,vars:1,consts:[["actionButton",""],["content",""],[4,"ngIf"],["pageTitle",`Type of Account Info
|
|
160
|
-
`],["type","button",1,"p-button","p-button-success",3,"routerLink"],[1,"fa-solid","fa-pen-to-square"],[1,"row","justify-content-center","mt-3"],[1,"col-12","col-lg-8"],[1,"d-flex","flex-column","gap-3"],[1,"d-flex"],[1,"col-3"],[1,"col"],[3,"innerHTML"]],template:function(n,i){n&1&&u(0,xr,6,0,"ng-container",2),n&2&&s("ngIf",i.info())},dependencies:[N,F,$,K,rt,V,B],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Ps=[{path:"",redirectTo:"account",pathMatch:"full"},{path:"",children:[{path:"account",component:jn},{path:"account/add",component:Nt},{path:"account/import",loadComponent:()=>import("./chunk-
|
|
160
|
+
`],["type","button",1,"p-button","p-button-success",3,"routerLink"],[1,"fa-solid","fa-pen-to-square"],[1,"row","justify-content-center","mt-3"],[1,"col-12","col-lg-8"],[1,"d-flex","flex-column","gap-3"],[1,"d-flex"],[1,"col-3"],[1,"col"],[3,"innerHTML"]],template:function(n,i){n&1&&u(0,xr,6,0,"ng-container",2),n&2&&s("ngIf",i.info())},dependencies:[N,F,$,K,rt,V,B],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Ps=[{path:"",redirectTo:"account",pathMatch:"full"},{path:"",children:[{path:"account",component:jn},{path:"account/add",component:Nt},{path:"account/import",loadComponent:()=>import("./chunk-46ZIN2SL.js").then(t=>t.CoaImportComponent)},{path:"account/:id",component:Hn},{path:"account/:id/edit",component:Nt},{path:"coa-types",component:Jn},{path:"coa-types/add",component:Lt},{path:"coa-types/info",component:ei},{path:"coa-types/:id/edit",component:Lt}]}],Zn={path:"cash-of-account",title:"COA",iconName:"fa fa-calculator",class:"",label:"",labelClass:"",extralink:!1,submenu:[{path:"account",title:"Ticket List",iconName:"solar:stop-circle-line-duotone",class:"",label:"",labelClass:"",extralink:!1,submenu:[]},{path:"coa-types",title:"Ticket Details",iconName:"solar:stop-circle-line-duotone",class:"",label:"",labelClass:"",extralink:!1,submenu:[]}]};export{Ps as CHART_OF_ACCOUNT_ROUTES,Zn as CHART_OF_ACCOUNT_ROUTE_PAGE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Qe}from"./chunk-G4XX7EU2.js";import{a as Xe,b as Ze,c as et,d as tt,e as nt,f as ot}from"./chunk-5AD3KAHO.js";import{a as Te,b as Fe}from"./chunk-RNPNKSFR.js";import{d as te,e as qe,i as we,j as Me,k as ne}from"./chunk-BRCJWPEZ.js";import"./chunk-N5W3C4LG.js";import"./chunk-BSFKUGYO.js";import"./chunk-MASZROSE.js";import{a as Ae}from"./chunk-7CUSFSFC.js";import{a as re,b as pe}from"./chunk-CDXFHUDN.js";import"./chunk-NI4XE6XQ.js";import{a as Y,b as K}from"./chunk-RZI2OI6V.js";import"./chunk-A7LRQMLA.js";import"./chunk-4TW5N3R5.js";import"./chunk-NTCCFR6P.js";import"./chunk-W6IKDXXT.js";import"./chunk-5B3BG43K.js";import"./chunk-UVIJU7TM.js";import"./chunk-EALZUKSJ.js";import{a as Ee,b as z}from"./chunk-PS4MFIBX.js";import{h as F}from"./chunk-4IEK5V2S.js";import"./chunk-WNA57NZF.js";import{a as H,b as $}from"./chunk-MUFRLGLG.js";import{a as ee,b as ye,c as be,d as Pe,e as Oe,f as Ie,g as Je}from"./chunk-B5RBLDGE.js";import"./chunk-76QGHXHT.js";import{o as Ke,w as G,x as L}from"./chunk-MDNCQKUT.js";import"./chunk-4V6IW37R.js";import{e as j,f as _e,j as ae,k as ge,l as xe,m as he,n as Ye,o as Ce,u as Se,w as Z,x as ve}from"./chunk-NHXCR55X.js";import{b as ie,d as ze,e as N,l as D}from"./chunk-DOKG43W6.js";import{a as fe}from"./chunk-A25JUSCO.js";import"./chunk-R3JWL2J6.js";import"./chunk-F2X3VGZZ.js";import{k as A,o as He,s as T}from"./chunk-VU532YE3.js";import{Bc as de,Cb as _,Cc as W,Dc as oe,Ga as M,Kb as s,Mc as Ue,Nb as q,Nc as je,Pb as $e,Qb as b,Qc as u,Sb as P,Tb as O,Ub as a,Vb as i,Wb as B,X as U,Z as w,_b as v,ad as X,ba as ue,bb as Ve,c as se,dc as y,ec as c,gb as p,ha as h,pa as C,qa as S,qc as m,rc as d,s as Q,sc as I,uc as We,wb as E}from"./chunk-7IC4BZ6J.js";import{a as f,b as x}from"./chunk-YQFG5XE2.js";var R=(()=>{class t{constructor(){this.httpService=h(fe)}getGlobalConfiguration(){return this.httpService.get(void 0,"/api/setup/GlobalConfiguration")}saveGlobalConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitGlobalConfiguration",e)}fetchPOSOutletConfiguration(e){return this.httpService.get(void 0,"/api/Setup/OutletConfiguration",{params:e})}fetchPOSOutletFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"/api/Setup/OutletConfigurationForm",n)}updatePOSOutletConfiguration(e){return this.httpService.post(void 0,"/api/Setup/SubmitOutletConfiguration",e)}fetchPOSPaymentConfiguration(e){return this.httpService.get(void 0,"/api/Setup/PaymentConfiguration",{params:e})}fetchPOSPaymentFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"api/Setup/PaymentConfigurationForm",n)}updatePOSPaymentConfiguration(e){return this.httpService.post(void 0,"/api/Setup/SubmitPaymentConfiguration",e)}fetchPOSTaxConfiguration(){return this.httpService.get(void 0,"/api/setup/TaxConfigurationForm")}updatePOSTaxConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitTaxConfiguration",e)}fetchPOSWriteOffConfiguration(){return this.httpService.get(void 0,"/api/setup/WriteOffConfigurationList")}fetchPOSWriteOffFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"/api/setup/WriteOffConfigurationForm",n)}updatePOSWriteOffConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitWriteOffConfiguration",e)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=ue({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var k=function(t){return t.POSGLOBAL_SELL="Sell",t.POSGLOBAL_BUY="Buy",t.POSGLOBAL_ADJUSTMENT="Adjustment",t.POSGLOBAL_PREPAID="Prepaid",t.POSGLOBAL_RETURN="Return",t.POSGLOBAL_DEBT="Debt",t.POSGLOBAL_PAYMENTFEE="Payment Fee",t.POSGLOBAL_MANUFACTURING="Manufacturing",t.POSGLOBAL_ADVANCE="Advance",t}(k||{});var it={[k.POSGLOBAL_SELL]:[{typeID:2,side:"debit",label:"Account Receivable"},{typeID:1,side:"credit",label:"Sales"},{typeID:4,side:"debit",label:"COGS"},{typeID:3,side:"credit",label:"Sold Inventory"},{typeID:10,side:"debit",label:"Sales Discount"}],[k.POSGLOBAL_BUY]:[{typeID:27,side:"debit",label:"Pending Paid Inventory"},{typeID:5,side:"credit",label:"Account Payable"},{typeID:28,side:"debit",label:"Inventory Bought"},{typeID:27,side:"credit",label:"Pending Paid Inventory"},{typeID:11,side:"credit",label:"Purchase Discount"}],[k.POSGLOBAL_ADJUSTMENT]:[{typeID:26,side:"debit",label:"Adjustment Asset"},{typeID:21,side:"credit",label:"Adjustment Expense"}],[k.POSGLOBAL_PREPAID]:[{typeID:29,side:"debit",label:"Accounting for Prepaid"},{typeID:30,side:"debit",label:"Sales For Prepaid"}],[k.POSGLOBAL_RETURN]:[{typeID:8,side:"debit",label:"Sales Return"},{typeID:27,side:"debit",label:"Inventory"},{typeID:4,side:"credit",label:"COGS"},{typeID:9,side:"credit",label:"Purchase Return"}],[k.POSGLOBAL_DEBT]:[{typeID:17,side:"debit",label:"Consignment Payable"}],[k.POSGLOBAL_PAYMENTFEE]:[{typeID:19,side:"debit",label:"Payment Fee"},{typeID:20,side:"credit",label:"Surcharge"}],[k.POSGLOBAL_MANUFACTURING]:[{typeID:24,side:"debit",label:"Finished Goods"},{typeID:23,side:"credit",label:"Raw Material"},{typeID:25,side:"credit",label:"Production Expenses"}],[k.POSGLOBAL_ADVANCE]:[{typeID:15,side:"debit",label:"Crossing Account"},{typeID:16,side:"debit",label:"Retained Earnings"},{typeID:18,side:"debit",label:"Current Earnings"}]};function _t(t,r){if(t&1){let e=v();a(0,"div",5)(1,"p-button",6),y("onClick",function(){C(e);let o=c();return S(o.onSubmit())}),i()()}}function gt(t,r){if(t&1&&(a(0,"p-tab",10),m(1),i()),t&2){let e=r.$implicit;s("value",e.value),p(),d(e.label)}}function xt(t,r){if(t&1&&(a(0,"div",19)(1,"div")(2,"span"),m(3),i()(),a(4,"div")(5,"span"),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function ht(t,r){if(t&1&&(a(0,"div",19)(1,"div")(2,"span"),m(3),i()(),a(4,"div")(5,"span"),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function Ct(t,r){if(t&1&&(a(0,"div",14)(1,"div",15)(2,"div",5)(3,"label",16),m(4),i(),a(5,"span",17),m(6),i()(),a(7,"p-select",18),_(8,xt,7,2,"ng-template",null,2,u)(10,ht,7,2,"ng-template",null,3,u),i()()()),t&2){let e=r.$implicit,n=c(4);s("formGroupName",e.index),p(4),d(e.entry.value.label),p(2),d(e.entry.value.side),p(),s("options",n.posIntegration().options.accounts)}}function St(t,r){if(t&1&&(a(0,"div",19)(1,"div")(2,"span"),m(3),i()(),a(4,"div")(5,"span"),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function vt(t,r){if(t&1&&(a(0,"div",19)(1,"div")(2,"span"),m(3),i()(),a(4,"div")(5,"span"),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function yt(t,r){if(t&1&&(a(0,"div",14)(1,"div",15)(2,"div",5)(3,"label",16),m(4),i(),a(5,"span",20),m(6),i()(),a(7,"p-select",18),_(8,St,7,2,"ng-template",null,2,u)(10,vt,7,2,"ng-template",null,3,u),i()()()),t&2){let e=r.$implicit,n=c(4);s("formGroupName",e.index),p(4),d(e.entry.value.label),p(2),d(e.entry.value.side),p(),s("options",n.posIntegration().options.accounts)}}function bt(t,r){if(t&1&&(a(0,"p-tabpanel",10)(1,"div",11)(2,"div",12)(3,"div",13),P(4,Ct,12,4,"div",14,b),i()(),a(6,"div",12)(7,"div",13),P(8,yt,12,4,"div",14,b),i()()()()),t&2){let e=r.$implicit,n=c(3);s("value",e.value),p(),s("formGroupName",e.value),p(3),O(n.getDebitEntries(e.value)),p(4),O(n.getCreditEntries(e.value))}}function Pt(t,r){if(t&1){let e=v();a(0,"form",8),y("ngSubmit",function(){C(e);let o=c(2);return S(o.onSubmit())}),a(1,"p-tabs",9)(2,"p-tablist"),P(3,gt,2,2,"p-tab",10,b),i(),a(5,"p-tabpanels"),P(6,bt,10,2,"p-tabpanel",10,b),i()()()}if(t&2){let e=c(2);s("formGroup",e.accountForm),p(),s("value",e.tab())("lazy",!0),p(2),O(e.tabs()),p(3),O(e.tabs())}}function Ot(t,r){if(t&1&&_(0,Pt,8,3,"form",7),t&2){let e=c();s("ngIf",e.posIntegration()&&e.accountForm)}}var at=(()=>{class t{constructor(){this.posConfigService=h(R),this.fb=h(Se),this.tab=M(k.POSGLOBAL_SELL),this.tabs=M(Object.values(k).map(e=>({label:e,value:e}))),this.posIntegration=M(null),this.form=M([]),this.descriptionsMap=new Map,this.objectKeys=Object.keys,this.posGlobalTabEnum=k}ngOnInit(){this.posConfigService.getGlobalConfiguration().pipe(w(e=>{this.posIntegration.set(e),this.form.set(e.form),this.descriptionsMap=new Map(e.descriptions.map(n=>[+n.id,n.name])),this.initializeForm()})).subscribe()}initializeForm(){let e={};this.tabs().forEach(n=>{let o=this.getEntriesForTab(n.value);console.log(`Entries for ${n.value}:`,o),e[n.value]=this.fb.array(o.map(l=>this.createEntryFormGroup(l)))}),this.accountForm=this.fb.group(e)}createEntryFormGroup(e){let n=this.fb.group({typeID:[e.typeID],label:[e.label],side:[e.side],accountID:[this.getAccountIDByTypeID(e.typeID)]});return n.get("accountID").valueChanges.subscribe(o=>{this.syncAccountIDs(e.typeID,o,n)}),n}getAccountIDByTypeID(e){return this.form().find(o=>o.typeID===e)?.accountID||""}getEntriesForTab(e){return it[e]||[]}getTabEntries(e){return this.accountForm.get(e)}onSubmit(){let e=this.accountForm.getRawValue(),n=[],o=new Set;for(let l of Object.values(e))for(let{typeID:g,accountID:V}of l){let Be=`${g}_${V}`;o.has(Be)||(o.add(Be),n.push({typeID:g,accountID:V||Qe}))}console.log("Form submitted with value:",n),this.posConfigService.saveGlobalConfiguration({form:n}).subscribe({next:()=>console.log("Save successful"),error:l=>console.error("Save failed",l)})}getDebitEntries(e){return this.getTabEntries(e).controls.map((n,o)=>({entry:n,index:o})).filter(n=>n.entry.value.side==="debit")}getCreditEntries(e){return this.getTabEntries(e).controls.map((n,o)=>({entry:n,index:o})).filter(n=>n.entry.value.side==="credit")}syncAccountIDs(e,n,o){Object.values(this.accountForm.controls).forEach(l=>{l.controls.forEach(g=>{g!==o&&g.get("typeID")?.value===e&&g.get("accountID")?.value!==n&&g.get("accountID")?.setValue(n,{emitEvent:!1})})})}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-global"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],["pageTitle","POS Integration"],[1,"d-flex","gap-2"],["label","Submit",3,"onClick"],[3,"formGroup","ngSubmit",4,"ngIf"],[3,"ngSubmit","formGroup"],[1,"border-top",3,"value","lazy"],[3,"value"],[1,"row",3,"formGroupName"],[1,"col"],[1,"row","gap-3"],[1,"col-12",3,"formGroupName"],[1,"form-group","d-flex","flex-column"],["for","",1,"fs-3"],[1,"text-success","fs-3"],["filter","","filterBy","code,name","formControlName","accountID","optionLabel","name","optionValue","id",3,"options"],[1,"d-flex","align-items-center","gap-2"],[1,"text-danger","fs-3"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,_t,2,0,"ng-template",null,0,u)(3,Ot,1,1,"ng-template",null,1,u),i())},dependencies:[F,ot,nt,tt,et,Xe,Ze,Ke,K,Y,Z,ge,j,_e,T,A,D,L,G,ve,xe,Ce,he],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var It=t=>[t];function Et(t,r){if(t&1&&(a(0,"th",7),m(1),i()),t&2){let e=r.$implicit;p(),d(e.name.slice(0,10))}}function Tt(t,r){if(t&1&&(a(0,"tr")(1,"th",6),m(2,"Method"),i()(),a(3,"tr"),P(4,Et,2,1,"th",7,b),i()),t&2){let e=c(3);p(4),O(e.paymentConfiguration().outlets)}}function Ft(t,r){if(t&1&&(a(0,"td"),m(1),i()),t&2){let e=r.$implicit;p(),d(e.accountName)}}function wt(t,r){if(t&1&&(a(0,"tr")(1,"td",8)(2,"a",9),m(3),i()(),P(4,Ft,2,1,"td",null,b),i()),t&2){let e=r.$implicit;p(2),s("routerLink",oe(2,It,e.id)),p(),d(e.name),p(),O(e.accounts)}}function Mt(t,r){if(t&1&&(a(0,"p-table",5),_(1,Tt,6,0,"ng-template",null,1,u)(3,wt,6,4,"ng-template",null,2,u),i()),t&2){let e=c(2);s("value",e.paymentConfiguration().payment)}}function Dt(t,r){if(t&1){let e=v();a(0,"app-main-panel",4),y("search",function(o){C(e);let l=c();return S(l.onSearch(o))}),_(1,Mt,5,1,"ng-template",null,0,u),i()}t&2&&s("isSearchableInput",!0)("scrollable",!0)}var rt=(()=>{class t{constructor(){this.POSSetupService=h(R),this.paymentConfiguration=M(null)}ngOnInit(){this.POSSetupService.fetchPOSPaymentConfiguration({}).pipe(w(e=>{this.paymentConfiguration.set(e)})).subscribe()}onSearch(e){this.POSSetupService.fetchPOSPaymentConfiguration({Search:e}).pipe(w(n=>{this.paymentConfiguration.set(n)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-payment"]],decls:1,vars:1,consts:[["content",""],["header",""],["body",""],["pageTitle","Payment Method Accounting",3,"isSearchableInput","scrollable","search",4,"ngIf"],["pageTitle","Payment Method Accounting",3,"search","isSearchableInput","scrollable"],[3,"value"],["rowspan","3",2,"min-width","300px"],[2,"min-width","200px"],["pFrozenColumn",""],[1,"link-primary",3,"routerLink"]],template:function(n,o){n&1&&_(0,Dt,3,2,"app-main-panel",3),n&2&&s("ngIf",o.paymentConfiguration())},dependencies:[F,ne,te,qe,T,A,D,N],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Rt={data:{listOutletAccount:[],listCOAType:[],pageNumber:1,pageSize:20,totalCount:0,totalPages:0},filter:{PageNumber:1,PageSize:20,Search:""}},Ge=ye(Ie(Rt),be(t=>({first:X(()=>(t.filter().PageNumber-1)*t.filter().PageSize+1),end:X(()=>Math.min(t.filter().PageNumber*t.filter().PageSize,t.data().totalCount))})),Oe(t=>{let r=h(R);return{updateFilter:n=>{ee(t,o=>x(f({},o),{filter:f(f({},o.filter),n)}))},getPOSOutlets:Te(se(U(n=>r.fetchPOSOutletConfiguration(n).pipe(Fe({next:o=>{ee(t,l=>x(f({},l),{data:o}))},error:o=>{console.error("Error fetching POS outlets:",o)}})))))}}),Pe(t=>({onInit:()=>{t.getPOSOutlets(t.filter)}})));var kt=t=>[t];function At(t,r){if(t&1&&(a(0,"th"),m(1),i()),t&2){let e=r.$implicit;p(),d(e.value)}}function Nt(t,r){if(t&1&&(a(0,"tr")(1,"th"),m(2,"Name"),i(),P(3,At,2,1,"th",null,b),i()),t&2){let e=c(2);p(3),O(e.store.data().listCOAType)}}function Gt(t,r){if(t&1&&(a(0,"td"),m(1),i()),t&2){let e=r.$implicit;p(),d(e)}}function Lt(t,r){if(t&1&&(a(0,"tr")(1,"td")(2,"a",7),m(3),i()(),P(4,Gt,2,1,"td",null,b),i()),t&2){let e=r.$implicit;p(2),s("routerLink",oe(2,kt,e.OutletID)),p(),I(" ",e.OutletName,""),p(),O(e.Accounts)}}function Bt(t,r){if(t&1&&m(0),t&2){let e=c(2);We(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Vt(t,r){t&1&&(a(0,"tr")(1,"td",8)(2,"span"),m(3," No journal entries found. "),i()()())}function $t(t,r){if(t&1){let e=v();a(0,"p-panel")(1,"p-table",6),y("onPage",function(o){C(e);let l=c();return S(l.onPage(o))}),_(2,Nt,5,0,"ng-template",null,1,u)(4,Lt,6,4,"ng-template",null,2,u)(6,Bt,1,3,"ng-template",null,3,u)(8,Vt,4,0,"ng-template",null,4,u),i()()}if(t&2){let e=c();p(),s("value",e.store.data().listOutletAccount)("paginator",!0)("rows",e.store.filter().PageSize)("lazy",!0)("totalRecords",e.store.data().totalCount)}}var pt=(()=>{class t{constructor(){this.store=h(Ge)}onSearch(e){this.store.updateFilter({PageNumber:1,PageSize:20,Search:e})}onPage(e){let n=e.first/e.rows+1;this.store.updateFilter(x(f({},this.store.filter()),{PageSize:e.rows,PageNumber:n}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-outlet"]],features:[de([Ge])],decls:3,vars:2,consts:[["content",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["pageTitle","Outlet Account",3,"search","isSearchableInput","scrollable"],["styleClass","d-flex flex-column justify-content-between h-100",3,"onPage","value","paginator","rows","lazy","totalRecords"],[1,"link","link-primary",3,"routerLink"],["colspan","8"]],template:function(n,o){if(n&1){let l=v();a(0,"app-main-panel",5),y("search",function(V){return C(l),S(o.onSearch(V))}),_(1,$t,10,5,"ng-template",null,0,u),i()}n&2&&s("isSearchableInput",!0)("scrollable",!0)},dependencies:[F,T,z,ne,te,D,N,$,H],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Wt=()=>({height:"calc(100vh - 100px)"}),Ut=()=>({height:"calc(100vh - 150px)"});function jt(t,r){if(t&1){let e=v();a(0,"a",5),m(1,"Cancel"),i(),a(2,"p-button",6),y("onClick",function(){C(e);let o=c();return S(o.updatePOsOutletConfiguration())}),i()}}function Ht(t,r){if(t&1&&(a(0,"div",16)(1,"div",17)(2,"span"),m(3),i()(),a(4,"div",17)(5,"span",17),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function zt(t,r){if(t&1&&(a(0,"div",16)(1,"div",17)(2,"span"),m(3),i()(),a(4,"div",18)(5,"span",17),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function Yt(t,r){if(t&1&&(a(0,"div",12)(1,"span",14),m(2),i(),a(3,"p-select",15),_(4,Ht,7,2,"ng-template",null,2,u)(6,zt,7,2,"ng-template",null,3,u),i()()),t&2){let e,n=r.$implicit,o=r.$index,l=c(3);s("formGroupName",o),p(2),d((e=n.get("TypeName"))==null?null:e.value),p(),s("options",l.options.accounts)}}function Kt(t,r){t&1&&B(0,"hr")}function Jt(t,r){if(t&1&&(a(0,"div",9)(1,"h3",10),m(2),Ue(3,"titlecase"),i(),a(4,"div",11),P(5,Yt,8,3,"div",12,b),i()(),_(7,Kt,1,0,"hr",13)),t&2){let e,n=r.$implicit,o=r.$index,l=r.$index,g=r.$count,V=c(2);s("formGroupName",o),p(2),I(" ",je(3,3,(e=n.get("groupName"))==null?null:e.value)," "),p(3),O(V.getAccountsFormArray(l).controls),p(2),s("ngIf",l!==g-1)}}function qt(t,r){if(t&1&&(a(0,"p-panel")(1,"p-scroll-panel")(2,"form",7)(3,"div",8),P(4,Jt,8,5,null,null,b),i()()()()),t&2){let e=c();q(W(5,Wt)),p(),q(W(6,Ut)),p(),s("formGroup",e.accountsForm),p(2),O(e.accountGroupsArray.controls)}}var lt=(()=>{class t{constructor(){this.route=h(ie),this.POSSetupService=h(R),this.outletForm=M(null),this.allAccounts=[],this.options=null,this.outletName="",this.accountGroups=[{name:"sell",typeIds:[1,2,10],accounts:[]},{name:"delivery",typeIds:[3,4],accounts:[]},{name:"buy",typeIds:[27,11,28],accounts:[]},{name:"purchase return",typeIds:[9],accounts:[]},{name:"sales return",typeIds:[8],accounts:[]},{name:"adjustment",typeIds:[21,26],accounts:[]}],this.fb=h(Se)}ngOnInit(){this.accountsForm=this.fb.group({accountGroups:this.fb.array([])}),this.route.paramMap.pipe(Q(e=>e.get("id")),U(e=>this.POSSetupService.fetchPOSOutletFormConfiguration({outletID:e})),w(e=>{this.allAccounts=e.form,this.options=e.options,this.outletName=e.form[0].OutletName,this.accountGroups.forEach(o=>{o.accounts=this.allAccounts.filter(l=>o.typeIds.includes(l.TypeID))});let n=this.accountsForm.get("accountGroups");this.accountGroups.forEach(o=>{n.push(this.createAccountGroupControl(o))})})).subscribe()}get accountGroupsArray(){return this.accountsForm.get("accountGroups")}getAccountsFormArray(e){return this.accountGroupsArray.at(e).get("accounts")}createAccountGroupControl(e){return this.fb.group({groupName:[e.name],accounts:this.fb.array(e.accounts.map(n=>this.createAccountControl(n)))})}createAccountControl(e){return this.fb.group({AccountID:[e.AccountID],TypeID:[e.TypeID],TypeName:[e.TypeName],OutletID:[e.OutletID],OutletName:[e.OutletName]})}updatePOsOutletConfiguration(){let{accountGroups:e}=this.accountsForm.value,n={form:e.flatMap(o=>o.accounts.map(l=>({AccountID:l.AccountID,TypeID:l.TypeID,TypeName:l.TypeName,OutletID:l.OutletID,OutletName:l.OutletName})))};this.POSSetupService.updatePOSOutletConfiguration(n).pipe().subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-outlet-form"]],decls:5,vars:2,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"pageTitle","hasMainWrapperPadding"],["routerLink","/pages/pos-setup/outlets",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"onClick"],[1,"",3,"formGroup"],["formArrayName","accountGroups",1,"d-flex","flex-column","gap-2"],[1,"row",3,"formGroupName"],[1,"fs-4","fw-semibold"],["formArrayName","accounts",1,"row","row-gap-3"],[1,"col-6",3,"formGroupName"],[4,"ngIf"],[1,"fs-3"],["formControlName","AccountID","filter","","filterBy","code,name","optionLabel","name","optionValue","id","placeholder","Select an account",1,"w-100",3,"options"],[1,"d-flex","gap-2"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,jt,3,0,"ng-template",null,0,u)(3,qt,6,7,"ng-template",null,1,u),i()),n&2&&s("pageTitle","Edit "+o.outletName)("hasMainWrapperPadding",!0)},dependencies:[F,T,A,He,z,ve,ge,j,_e,xe,Ce,he,Ye,K,Y,$,H,re,L,G,D,N],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Zt=()=>({height:"calc(100vh - 100px)"}),en=()=>({width:"100%",height:"calc(100vh - 150px)"}),tn=()=>({width:"100%"});function nn(t,r){if(t&1){let e=v();a(0,"a",6),m(1,"Cancel"),i(),a(2,"p-button",7),y("onClick",function(){C(e);let o=c(3);return S(o.updatePOSOutletConfiguration())}),i()}}function on(t,r){if(t&1&&(a(0,"div",16)(1,"div",17)(2,"span"),m(3),i()(),a(4,"div",17)(5,"span",17),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function an(t,r){if(t&1&&(a(0,"div",16)(1,"div",17)(2,"span"),m(3),i()(),a(4,"div",18)(5,"span",17),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function rn(t,r){if(t&1){let e=v();a(0,"div",9)(1,"div",10)(2,"div",11)(3,"label",12),m(4),i()(),B(5,"div",13),a(6,"div",14)(7,"p-select",15),y("ngModelChange",function(o){let l=C(e).$index,g=c(4);return S(g.updateAccountById(o,l))}),_(8,on,7,2,"ng-template",null,2,u)(10,an,7,2,"ng-template",null,3,u),i()()()()}if(t&2){let e=r.$implicit,n=r.$index,o=c(4);p(4),d(e.outletName.slice(0,15)),p(3),q(W(7,tn)),s("ngModel",o.paymentForm().form.accounts[n].accountID)("virtualScroll",!0)("virtualScrollItemSize",50)("options",o.paymentForm().options.chartOfAccount)}}function pn(t,r){if(t&1&&(a(0,"p-card")(1,"p-scrollpanel")(2,"div",8),P(3,rn,12,8,"div",9,b),i()()()),t&2){let e=c(3);q(W(4,Zt)),p(),q(W(5,en)),p(2),O(e.paymentForm().form.accounts)}}function ln(t,r){if(t&1&&(a(0,"app-main-panel",4),_(1,nn,3,0,"ng-template",null,0,u)(3,pn,5,6,"ng-template",null,1,u),i()),t&2){let e=c(2);s("pageTitle",e.paymentForm().form.paymentMethod.name+" Form Accounting")("hasMainWrapperPadding",!0)}}function mn(t,r){if(t&1&&_(0,ln,5,2,"app-main-panel",5),t&2){let e=c();s("ngIf",e.paymentForm())}}var mt=(()=>{class t{constructor(){this.route=h(ie),this.POSSetupService=h(R),this.paymentForm=M(null),this.router=h(ze)}ngOnInit(){this.route.paramMap.pipe(Q(e=>+e.get("id")),U(e=>this.POSSetupService.fetchPOSPaymentFormConfiguration({ID:e})),w(e=>{this.paymentForm.set(e)}),Ae("response")).subscribe()}updateAccountById(e,n){let o=this.paymentForm().form.accounts,l=x(f({},this.paymentForm()),{form:x(f({},this.paymentForm().form),{accounts:o.map((g,V)=>V===n?x(f({},g),{accountID:e}):g)})});this.paymentForm.set(l)}updatePOSOutletConfiguration(){let e={form:[...this.paymentForm().form.accounts]};this.POSSetupService.updatePOSPaymentConfiguration(e).pipe(Ae("response"),w(()=>{this.router.navigate(["/pages/pos-setup/payments"])})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-payment-form"]],decls:1,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"pageTitle","hasMainWrapperPadding"],[3,"pageTitle","hasMainWrapperPadding",4,"ngIf"],["routerLink","/pages/pos-setup/payments",1,"p-button","p-button-outlined","p-button-secondary"],["label","Submit",3,"onClick"],[1,"row","row-gap-3"],[1,"col-6","d-flex","flex-column","gap-2"],[1,"row","row-gap-4"],[1,"col-2"],["for",""],[1,"col-3"],[1,"col-7"],["filter","","filterBy","name,code","optionLabel","name","optionValue","id","placeholder","Select an account",1,"w-full",3,"ngModelChange","ngModel","virtualScroll","virtualScrollItemSize","options"],[1,"d-flex","gap-2"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&_(0,mn,1,1,"app-main-panel",4),n&2&&$e(o.paymentForm()?0:-1)},dependencies:[z,Ee,F,T,A,pe,re,K,Y,Z,j,ae,D,N,L,G,$],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();function cn(t,r){if(t&1){let e=v();a(0,"div",5)(1,"a",6),m(2,"Cancel"),i(),a(3,"p-button",7),y("onClick",function(){C(e);let o=c();return S(o.updatePOSTaxConfiguration())}),i()()}}function sn(t,r){if(t&1&&(a(0,"div",5)(1,"div",15)(2,"span"),m(3),i()(),a(4,"div",15)(5,"span",15),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function un(t,r){if(t&1&&(a(0,"div",5)(1,"div",15)(2,"span"),m(3),i()(),a(4,"div",16)(5,"span",15),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function dn(t,r){if(t&1){let e=v();a(0,"div",11)(1,"div",12)(2,"label",13),m(3),i(),a(4,"p-select",14),y("ngModelChange",function(o){let l=C(e).$index,g=c(2);return S(g.updateAccountID(o,l))}),_(5,sn,7,2,"ng-template",null,2,u)(7,un,7,2,"ng-template",null,3,u),i()()()}if(t&2){let e=r.$implicit,n=r.$index,o=c(2);p(3),d(e.name),p(),s("options",o.taxForm().options.chartOfAccount)("ngModel",o.taxForm().form[n].accountID)}}function fn(t,r){if(t&1&&(a(0,"p-panel")(1,"div",8)(2,"div",9)(3,"div",10),P(4,dn,9,3,"div",11,b),i()()()()),t&2){let e=c();p(4),O(e.taxForm().form)}}var ct=(()=>{class t{constructor(){this.POSSetupService=h(R),this.taxForm=M(null)}ngOnInit(){this.POSSetupService.fetchPOSTaxConfiguration().pipe(w(e=>{this.taxForm.set(e)})).subscribe()}updateAccountID(e,n){let o=this.taxForm().form,l=x(f({},this.taxForm()),{form:o.map((g,V)=>V===n?x(f({},g),{accountID:e}):g)});this.taxForm.set(l)}updatePOSTaxConfiguration(){let e={form:[...this.taxForm().form]};this.POSSetupService.updatePOSTaxConfiguration(e).pipe(w(n=>console.log(n))).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-tax"]],decls:5,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],["pageTitle","Tax Setup",3,"scrollable"],[1,"d-flex","gap-2"],["routerLink","..",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"onClick"],[1,"row"],[1,"col-4"],[1,"row","row-gap-3"],[1,"col-12"],[1,"d-flex","flex-column"],["for",""],["filter","","filterBy","name,code","optionLabel","name","optionValue","id","placeholder","Select an Account",3,"ngModelChange","options","ngModel"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,cn,4,0,"ng-template",null,0,u)(3,fn,6,0,"ng-template",null,1,u),i()),n&2&&s("scrollable",!0)},dependencies:[F,z,T,K,Y,pe,Z,j,ae,D,N,L,G,$,H],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var _n=()=>({"min-width":"50rem"}),gn=t=>[t];function xn(t,r){t&1&&B(0,"p-button",6)}function hn(t,r){if(t&1&&_(0,xn,1,0,"p-button",5),t&2){let e=c();s("ngIf",e.hasCheckedItems())}}function Cn(t,r){t&1&&(a(0,"tr")(1,"th",8),B(2,"p-tableHeaderCheckbox"),i(),a(3,"th"),m(4,"Name"),i(),a(5,"th"),m(6,"Description"),i()())}function Sn(t,r){if(t&1&&(a(0,"tr")(1,"td"),B(2,"p-tableCheckbox",9),i(),a(3,"td")(4,"a",10),m(5),i()(),a(6,"td"),m(7),i()()),t&2){let e=r.$implicit;p(2),s("value",e),p(2),s("routerLink",oe(4,gn,e.id)),p(),d(e.name),p(2),d(e.description)}}function vn(t,r){if(t&1){let e=v();a(0,"p-panel")(1,"p-table",7),y("onRowSelect",function(o){C(e);let l=c();return S(l.onRowSelect(o))})("onRowUnselect",function(o){C(e);let l=c();return S(l.onRowSelect(o))})("onHeaderCheckboxToggle",function(o){C(e);let l=c();return S(l.onSelectAll(o))}),_(2,Cn,7,0,"ng-template",null,2,u)(4,Sn,8,6,"ng-template",null,3,u),i()()}if(t&2){let e=c();p(),s("value",e.writeoffList().data)("tableStyle",W(2,_n))}}var st=(()=>{class t{constructor(){this.POSSetupService=h(R),this.writeoffList=M(null),this.hasCheckedItems=X(()=>{let e=this.writeoffList();return!e||!e.data||!Array.isArray(e.data)?!1:e.data.some(n=>n&&n.checked===!0)})}ngOnInit(){this.POSSetupService.fetchPOSWriteOffConfiguration().pipe(Q(e=>x(f({},e),{data:e.data.map(n=>x(f({},n),{checked:!1}))})),w(e=>{this.writeoffList.set(e)})).subscribe()}onRowSelect(e){console.log("Selected Row:",e.data);let n=this.writeoffList();if(!n||!n.data)return;let o=n.data.findIndex(l=>l.id===e.data.id);if(o!==-1){let l=[...n.data];l[o]=x(f({},l[o]),{checked:!l[o].checked}),this.writeoffList.set(x(f({},n),{data:l}))}}onSelectAll(e){let n=this.writeoffList();if(!n?.data)return;let o=n.data.map(l=>x(f({},l),{checked:e.checked}));this.writeoffList.set(x(f({},n),{data:o}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-writeoff"]],decls:5,vars:1,consts:[["actionButton",""],["content",""],["header",""],["body",""],["pageTitle","Write Off",3,"scrollable"],["severity","danger","label","Delete","icon","fa-solid fa-trash",4,"ngIf"],["severity","danger","label","Delete","icon","fa-solid fa-trash"],["dataKey","id",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value","tableStyle"],[2,"width","1rem"],[3,"value"],[1,"link-primary",3,"routerLink"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,hn,1,1,"ng-template",null,0,u)(3,vn,6,3,"ng-template",null,1,u),i()),n&2&&s("scrollable",!0)},dependencies:[F,T,A,ne,te,we,Me,D,N,L,G,$,H],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var yn=()=>({witdh:"100%",height:"calc(100vh - 150px)"});function bn(t,r){if(t&1){let e=v();a(0,"div",6)(1,"a",7),m(2,"Cancel"),i(),a(3,"p-button",8),y("onClick",function(){C(e);let o=c(2);return S(o.updateWriteOffConfiguration())}),i()()}}function Pn(t,r){if(t&1&&(a(0,"div",6)(1,"span",16),m(2),i(),a(3,"span",16),m(4),i()()),t&2){let e=r.$implicit;p(2),I("(",e.code,")"),p(2),d(e.name)}}function On(t,r){if(t&1&&(a(0,"div",6)(1,"span",16),m(2),i(),a(3,"span",16),m(4),i()()),t&2){let e=r.$implicit;p(2),I("(",e.code,")"),p(2),d(e.name)}}function In(t,r){if(t&1){let e=v();a(0,"div",12)(1,"div",13)(2,"label",14),m(3),i(),a(4,"p-select",15),y("ngModelChange",function(o){let l=C(e).$index,g=c(3);return S(g.updateAccountById(o,l))}),_(5,Pn,5,2,"ng-template",null,2,u)(7,On,5,2,"ng-template",null,3,u),i()()()}if(t&2){let e=r.$implicit,n=c(3);p(3),d(e.name),p(),s("ngModel",e.accountID)("options",n.writeOffForm().options.account)("virtualScroll",!0)("virtualScrollItemSize",50)}}function En(t,r){if(t&1&&(a(0,"p-card")(1,"p-scroll-panel")(2,"div",9)(3,"div",10)(4,"div",11),P(5,In,9,5,"div",12,b),i()()()()()),t&2){let e=c(2);p(),q(W(2,yn)),p(4),O(e.writeOffForm().form)}}function Tn(t,r){if(t&1&&(a(0,"app-main-panel",5),_(1,bn,4,0,"ng-template",null,0,u)(3,En,7,3,"ng-template",null,1,u),i()),t&2){let e=c();s("pageTitle","Write Off Form "+e.writeOffForm().info.name)("hasMainWrapperPadding",!0)}}var ut=(()=>{class t{constructor(){this.POSSetupService=h(R),this.route=h(ie),this.writeOffForm=M(null)}ngOnInit(){this.route.paramMap.pipe(Q(e=>e.get("id")),U(e=>this.POSSetupService.fetchPOSWriteOffFormConfiguration({ID:e})),w(e=>this.writeOffForm.set(e))).subscribe()}updateAccountById(e,n){let o=this.writeOffForm().form,l=x(f({},this.writeOffForm()),{form:o.map((g,V)=>V===n?x(f({},g),{accountID:e}):g)});this.writeOffForm.set(l)}updateWriteOffConfiguration(){let e={form:this.writeOffForm().form};this.POSSetupService.updatePOSWriteOffConfiguration(e).pipe().subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-writeoff-form"]],decls:1,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"pageTitle","hasMainWrapperPadding",4,"ngIf"],[3,"pageTitle","hasMainWrapperPadding"],[1,"d-flex","gap-2"],["routerLink","/pages/pos-setup/writeoff",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"onClick"],[1,"row"],[1,"col"],[1,"row","row-gap-3"],[1,"col-3"],[1,"d-flex","flex-column"],["for","",1,"d-inline-block","text-truncate",2,"max-width","300px"],["filter","","filterBy","name,code","optionLabel","name","filter","","filterBy","name,code","optionValue","id","placeholder","Select an account",3,"ngModelChange","ngModel","options","virtualScroll","virtualScrollItemSize"],[1,""]],template:function(n,o){n&1&&_(0,Tn,5,2,"app-main-panel",4),n&2&&s("ngIf",o.writeOffForm())},dependencies:[F,T,A,z,Ee,pe,re,K,Y,Z,j,ae,D,N,L,G],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var dt=(()=>{class t{constructor(){this.httpService=h(fe)}getExpenseOptions(){return this.httpService.get(void 0,"/api/SetupExpenseOption/GetExpenseOptions")}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=ue({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Fn={data:{expenseOptions:[]}},Le=ye(Ie(Fn),Je("POSExpenseOptionStore"),be(t=>({hasCheckedRows:X(()=>t.data().expenseOptions.some(r=>r.checked)),checkedInvoice:X(()=>t.data().expenseOptions.filter(r=>r.checked).map(r=>r.id))})),Oe(t=>{let r=h(dt);return{onRowSelect(n){ee(t,o=>{let l=o.data.expenseOptions.map(g=>g.id===n.id?x(f({},g),{checked:!0}):g);return x(f({},o),{data:x(f({},o.data),{expenseOptions:l})})})},onRowUnselect(n){ee(t,o=>{let l=o.data.expenseOptions.map(g=>g.id===n.id?x(f({},g),{checked:!1}):g);return x(f({},o),{data:x(f({},o.data),{expenseOptions:l})})})},onHeaderCheckboxToggle(n){ee(t,o=>{let l=o.data.expenseOptions.map(g=>x(f({},g),{checked:n}));return x(f({},o),{data:x(f({},o.data),{expenseOptions:l})})})},getExpenseOptions:Te(se(U(()=>r.getExpenseOptions().pipe(Fe({next:n=>{ee(t,o=>x(f({},o),{data:x(f({},o.data),{expenseOptions:n.expenseOptions.map(l=>x(f({},l),{checked:!1}))})}))},error:n=>{console.error("Error fetching expense options:",n)}})))))}}),Pe({onInit:t=>{t.getExpenseOptions()}}));function wn(t,r){t&1&&B(0,"p-button",6)}function Mn(t,r){if(t&1&&_(0,wn,1,0,"p-button",5),t&2){let e=c();s("ngIf",e.store.hasCheckedRows())}}function Dn(t,r){t&1&&(a(0,"tr")(1,"th",8),B(2,"p-tableHeaderCheckbox"),i(),a(3,"th"),m(4,"Name"),i(),a(5,"th"),m(6,"Account"),i(),a(7,"th"),m(8,"Description"),i()())}function Rn(t,r){if(t&1&&(a(0,"tr")(1,"td"),B(2,"p-tableCheckbox",9),i(),a(3,"td"),m(4),i(),a(5,"td"),m(6),i(),a(7,"td"),B(8,"p",10),i()()),t&2){let e=r.$implicit;p(2),s("value",e),p(2),d(e.name),p(2),d(e.accountName),p(2),s("innerHTML",e.description,Ve)}}function kn(t,r){if(t&1){let e=v();a(0,"p-panel")(1,"p-table",7),y("onRowSelect",function(o){C(e);let l=c();return S(l.onRowSelect(o))})("onRowUnselect",function(o){C(e);let l=c();return S(l.onRowUnselect(o))})("onHeaderCheckboxToggle",function(o){C(e);let l=c();return S(l.onHeaderCheckboxToggle(o))}),_(2,Dn,9,0,"ng-template",null,2,u)(4,Rn,9,4,"ng-template",null,3,u),i()()}if(t&2){let e=c();p(),s("value",e.store.data().expenseOptions)}}var ft=(()=>{class t{constructor(){this.store=h(Le)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){Array.isArray(e.data)?e.data.forEach(n=>{this.store.onRowUnselect(n)}):this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-expense-option"]],features:[de([Le])],decls:5,vars:1,consts:[["actionButton",""],["content",""],["header",""],["body",""],["pageTitle","Expense Option",3,"scrollable"],["label","Delete","severity","danger","icon","fa-solid fa-trash",4,"ngIf"],["label","Delete","severity","danger","icon","fa-solid fa-trash"],["dataKey","id",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value"],[2,"width","1rem"],[3,"value"],[3,"innerHTML"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,Mn,1,1,"ng-template",null,0,u)(3,kn,6,1,"ng-template",null,1,u),i()),n&2&&s("scrollable",!0)},dependencies:[F,ne,te,we,Me,$,H,L,G,T,A],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Ga=[{path:"",redirectTo:"global",pathMatch:"full"},{path:"",children:[{path:"global",component:at},{path:"outlets",component:pt},{path:"outlets/:id",component:lt},{path:"payments",component:rt},{path:"payments/:id",component:mt},{path:"taxs",component:ct},{path:"writeoff",component:st},{path:"writeoff/:id",component:ut},{path:"expense-option",component:ft}]}];export{Ga as POS_SETUP_ROUTES};
|
|
1
|
+
import{a as Qe}from"./chunk-G4XX7EU2.js";import{a as Xe,b as Ze,c as et,d as tt,e as nt,f as ot}from"./chunk-OB46Z7ZH.js";import{a as Te,b as Fe}from"./chunk-NHZLS6JU.js";import{d as te,e as qe,i as we,j as Me,k as ne}from"./chunk-KLKIEREL.js";import"./chunk-76LPTGLX.js";import"./chunk-CWHL7PNC.js";import"./chunk-VRKBMD72.js";import{a as Ae}from"./chunk-KXE3J4PK.js";import{a as re,b as pe}from"./chunk-E3QNEH3B.js";import"./chunk-EOT2WEXN.js";import{a as Y,b as K}from"./chunk-X4KTMWVO.js";import"./chunk-I7ILLTFH.js";import"./chunk-2LQVI4EI.js";import"./chunk-AJZ7YLT4.js";import"./chunk-ATJ55H5D.js";import"./chunk-SPKOXGSS.js";import"./chunk-3KYU6FI2.js";import"./chunk-IJTQE2H4.js";import{a as Ee,b as z}from"./chunk-WXT6EZ2V.js";import{h as F}from"./chunk-PGHK6GXT.js";import"./chunk-L3PZS6EL.js";import{a as H,b as $}from"./chunk-5JV52UYK.js";import{a as ee,b as ye,c as be,d as Pe,e as Oe,f as Ie,g as Je}from"./chunk-ACTRMWEI.js";import"./chunk-ARXP327B.js";import{o as Ke,w as G,x as L}from"./chunk-7FFMPB6T.js";import"./chunk-UKBDY33R.js";import{e as j,f as _e,j as ae,k as ge,l as xe,m as he,n as Ye,o as Ce,u as Se,w as Z,x as ve}from"./chunk-72LNXEXV.js";import{b as ie,d as ze,e as N,l as D}from"./chunk-EFDD6Q3K.js";import{a as fe}from"./chunk-VENJDQOT.js";import"./chunk-ZDTMCWOO.js";import"./chunk-F2X3VGZZ.js";import{k as A,o as He,s as T}from"./chunk-SB5MSLCX.js";import{$b as v,Cc as de,Db as _,Dc as W,Ec as oe,Ha as M,Lb as s,Nc as Ue,Ob as q,Oc as je,Qb as $e,Rb as b,Rc as u,Tb as P,Ub as O,Vb as a,Wb as i,Xb as B,Y as U,_ as w,bd as X,c as se,ca as ue,cb as Ve,ec as y,fc as c,hb as p,ia as h,qa as C,ra as S,rc as m,s as Q,sc as d,tc as I,vc as We,xb as E}from"./chunk-6K5LNQ4J.js";import{a as f,b as x}from"./chunk-YQFG5XE2.js";var R=(()=>{class t{constructor(){this.httpService=h(fe)}getGlobalConfiguration(){return this.httpService.get(void 0,"/api/setup/GlobalConfiguration")}saveGlobalConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitGlobalConfiguration",e)}fetchPOSOutletConfiguration(e){return this.httpService.get(void 0,"/api/Setup/OutletConfiguration",{params:e})}fetchPOSOutletFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"/api/Setup/OutletConfigurationForm",n)}updatePOSOutletConfiguration(e){return this.httpService.post(void 0,"/api/Setup/SubmitOutletConfiguration",e)}fetchPOSPaymentConfiguration(e){return this.httpService.get(void 0,"/api/Setup/PaymentConfiguration",{params:e})}fetchPOSPaymentFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"api/Setup/PaymentConfigurationForm",n)}updatePOSPaymentConfiguration(e){return this.httpService.post(void 0,"/api/Setup/SubmitPaymentConfiguration",e)}fetchPOSTaxConfiguration(){return this.httpService.get(void 0,"/api/setup/TaxConfigurationForm")}updatePOSTaxConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitTaxConfiguration",e)}fetchPOSWriteOffConfiguration(){return this.httpService.get(void 0,"/api/setup/WriteOffConfigurationList")}fetchPOSWriteOffFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"/api/setup/WriteOffConfigurationForm",n)}updatePOSWriteOffConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitWriteOffConfiguration",e)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=ue({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var k=function(t){return t.POSGLOBAL_SELL="Sell",t.POSGLOBAL_BUY="Buy",t.POSGLOBAL_ADJUSTMENT="Adjustment",t.POSGLOBAL_PREPAID="Prepaid",t.POSGLOBAL_RETURN="Return",t.POSGLOBAL_DEBT="Debt",t.POSGLOBAL_PAYMENTFEE="Payment Fee",t.POSGLOBAL_MANUFACTURING="Manufacturing",t.POSGLOBAL_ADVANCE="Advance",t}(k||{});var it={[k.POSGLOBAL_SELL]:[{typeID:2,side:"debit",label:"Account Receivable"},{typeID:1,side:"credit",label:"Sales"},{typeID:4,side:"debit",label:"COGS"},{typeID:3,side:"credit",label:"Sold Inventory"},{typeID:10,side:"debit",label:"Sales Discount"}],[k.POSGLOBAL_BUY]:[{typeID:27,side:"debit",label:"Pending Paid Inventory"},{typeID:5,side:"credit",label:"Account Payable"},{typeID:28,side:"debit",label:"Inventory Bought"},{typeID:27,side:"credit",label:"Pending Paid Inventory"},{typeID:11,side:"credit",label:"Purchase Discount"}],[k.POSGLOBAL_ADJUSTMENT]:[{typeID:26,side:"debit",label:"Adjustment Asset"},{typeID:21,side:"credit",label:"Adjustment Expense"}],[k.POSGLOBAL_PREPAID]:[{typeID:29,side:"debit",label:"Accounting for Prepaid"},{typeID:30,side:"debit",label:"Sales For Prepaid"}],[k.POSGLOBAL_RETURN]:[{typeID:8,side:"debit",label:"Sales Return"},{typeID:27,side:"debit",label:"Inventory"},{typeID:4,side:"credit",label:"COGS"},{typeID:9,side:"credit",label:"Purchase Return"}],[k.POSGLOBAL_DEBT]:[{typeID:17,side:"debit",label:"Consignment Payable"}],[k.POSGLOBAL_PAYMENTFEE]:[{typeID:19,side:"debit",label:"Payment Fee"},{typeID:20,side:"credit",label:"Surcharge"}],[k.POSGLOBAL_MANUFACTURING]:[{typeID:24,side:"debit",label:"Finished Goods"},{typeID:23,side:"credit",label:"Raw Material"},{typeID:25,side:"credit",label:"Production Expenses"}],[k.POSGLOBAL_ADVANCE]:[{typeID:15,side:"debit",label:"Crossing Account"},{typeID:16,side:"debit",label:"Retained Earnings"},{typeID:18,side:"debit",label:"Current Earnings"}]};function _t(t,r){if(t&1){let e=v();a(0,"div",5)(1,"p-button",6),y("onClick",function(){C(e);let o=c();return S(o.onSubmit())}),i()()}}function gt(t,r){if(t&1&&(a(0,"p-tab",10),m(1),i()),t&2){let e=r.$implicit;s("value",e.value),p(),d(e.label)}}function xt(t,r){if(t&1&&(a(0,"div",19)(1,"div")(2,"span"),m(3),i()(),a(4,"div")(5,"span"),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function ht(t,r){if(t&1&&(a(0,"div",19)(1,"div")(2,"span"),m(3),i()(),a(4,"div")(5,"span"),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function Ct(t,r){if(t&1&&(a(0,"div",14)(1,"div",15)(2,"div",5)(3,"label",16),m(4),i(),a(5,"span",17),m(6),i()(),a(7,"p-select",18),_(8,xt,7,2,"ng-template",null,2,u)(10,ht,7,2,"ng-template",null,3,u),i()()()),t&2){let e=r.$implicit,n=c(4);s("formGroupName",e.index),p(4),d(e.entry.value.label),p(2),d(e.entry.value.side),p(),s("options",n.posIntegration().options.accounts)}}function St(t,r){if(t&1&&(a(0,"div",19)(1,"div")(2,"span"),m(3),i()(),a(4,"div")(5,"span"),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function vt(t,r){if(t&1&&(a(0,"div",19)(1,"div")(2,"span"),m(3),i()(),a(4,"div")(5,"span"),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function yt(t,r){if(t&1&&(a(0,"div",14)(1,"div",15)(2,"div",5)(3,"label",16),m(4),i(),a(5,"span",20),m(6),i()(),a(7,"p-select",18),_(8,St,7,2,"ng-template",null,2,u)(10,vt,7,2,"ng-template",null,3,u),i()()()),t&2){let e=r.$implicit,n=c(4);s("formGroupName",e.index),p(4),d(e.entry.value.label),p(2),d(e.entry.value.side),p(),s("options",n.posIntegration().options.accounts)}}function bt(t,r){if(t&1&&(a(0,"p-tabpanel",10)(1,"div",11)(2,"div",12)(3,"div",13),P(4,Ct,12,4,"div",14,b),i()(),a(6,"div",12)(7,"div",13),P(8,yt,12,4,"div",14,b),i()()()()),t&2){let e=r.$implicit,n=c(3);s("value",e.value),p(),s("formGroupName",e.value),p(3),O(n.getDebitEntries(e.value)),p(4),O(n.getCreditEntries(e.value))}}function Pt(t,r){if(t&1){let e=v();a(0,"form",8),y("ngSubmit",function(){C(e);let o=c(2);return S(o.onSubmit())}),a(1,"p-tabs",9)(2,"p-tablist"),P(3,gt,2,2,"p-tab",10,b),i(),a(5,"p-tabpanels"),P(6,bt,10,2,"p-tabpanel",10,b),i()()()}if(t&2){let e=c(2);s("formGroup",e.accountForm),p(),s("value",e.tab())("lazy",!0),p(2),O(e.tabs()),p(3),O(e.tabs())}}function Ot(t,r){if(t&1&&_(0,Pt,8,3,"form",7),t&2){let e=c();s("ngIf",e.posIntegration()&&e.accountForm)}}var at=(()=>{class t{constructor(){this.posConfigService=h(R),this.fb=h(Se),this.tab=M(k.POSGLOBAL_SELL),this.tabs=M(Object.values(k).map(e=>({label:e,value:e}))),this.posIntegration=M(null),this.form=M([]),this.descriptionsMap=new Map,this.objectKeys=Object.keys,this.posGlobalTabEnum=k}ngOnInit(){this.posConfigService.getGlobalConfiguration().pipe(w(e=>{this.posIntegration.set(e),this.form.set(e.form),this.descriptionsMap=new Map(e.descriptions.map(n=>[+n.id,n.name])),this.initializeForm()})).subscribe()}initializeForm(){let e={};this.tabs().forEach(n=>{let o=this.getEntriesForTab(n.value);console.log(`Entries for ${n.value}:`,o),e[n.value]=this.fb.array(o.map(l=>this.createEntryFormGroup(l)))}),this.accountForm=this.fb.group(e)}createEntryFormGroup(e){let n=this.fb.group({typeID:[e.typeID],label:[e.label],side:[e.side],accountID:[this.getAccountIDByTypeID(e.typeID)]});return n.get("accountID").valueChanges.subscribe(o=>{this.syncAccountIDs(e.typeID,o,n)}),n}getAccountIDByTypeID(e){return this.form().find(o=>o.typeID===e)?.accountID||""}getEntriesForTab(e){return it[e]||[]}getTabEntries(e){return this.accountForm.get(e)}onSubmit(){let e=this.accountForm.getRawValue(),n=[],o=new Set;for(let l of Object.values(e))for(let{typeID:g,accountID:V}of l){let Be=`${g}_${V}`;o.has(Be)||(o.add(Be),n.push({typeID:g,accountID:V||Qe}))}console.log("Form submitted with value:",n),this.posConfigService.saveGlobalConfiguration({form:n}).subscribe({next:()=>console.log("Save successful"),error:l=>console.error("Save failed",l)})}getDebitEntries(e){return this.getTabEntries(e).controls.map((n,o)=>({entry:n,index:o})).filter(n=>n.entry.value.side==="debit")}getCreditEntries(e){return this.getTabEntries(e).controls.map((n,o)=>({entry:n,index:o})).filter(n=>n.entry.value.side==="credit")}syncAccountIDs(e,n,o){Object.values(this.accountForm.controls).forEach(l=>{l.controls.forEach(g=>{g!==o&&g.get("typeID")?.value===e&&g.get("accountID")?.value!==n&&g.get("accountID")?.setValue(n,{emitEvent:!1})})})}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-global"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],["pageTitle","POS Integration"],[1,"d-flex","gap-2"],["label","Submit",3,"onClick"],[3,"formGroup","ngSubmit",4,"ngIf"],[3,"ngSubmit","formGroup"],[1,"border-top",3,"value","lazy"],[3,"value"],[1,"row",3,"formGroupName"],[1,"col"],[1,"row","gap-3"],[1,"col-12",3,"formGroupName"],[1,"form-group","d-flex","flex-column"],["for","",1,"fs-3"],[1,"text-success","fs-3"],["filter","","filterBy","code,name","formControlName","accountID","optionLabel","name","optionValue","id",3,"options"],[1,"d-flex","align-items-center","gap-2"],[1,"text-danger","fs-3"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,_t,2,0,"ng-template",null,0,u)(3,Ot,1,1,"ng-template",null,1,u),i())},dependencies:[F,ot,nt,tt,et,Xe,Ze,Ke,K,Y,Z,ge,j,_e,T,A,D,L,G,ve,xe,Ce,he],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var It=t=>[t];function Et(t,r){if(t&1&&(a(0,"th",7),m(1),i()),t&2){let e=r.$implicit;p(),d(e.name.slice(0,10))}}function Tt(t,r){if(t&1&&(a(0,"tr")(1,"th",6),m(2,"Method"),i()(),a(3,"tr"),P(4,Et,2,1,"th",7,b),i()),t&2){let e=c(3);p(4),O(e.paymentConfiguration().outlets)}}function Ft(t,r){if(t&1&&(a(0,"td"),m(1),i()),t&2){let e=r.$implicit;p(),d(e.accountName)}}function wt(t,r){if(t&1&&(a(0,"tr")(1,"td",8)(2,"a",9),m(3),i()(),P(4,Ft,2,1,"td",null,b),i()),t&2){let e=r.$implicit;p(2),s("routerLink",oe(2,It,e.id)),p(),d(e.name),p(),O(e.accounts)}}function Mt(t,r){if(t&1&&(a(0,"p-table",5),_(1,Tt,6,0,"ng-template",null,1,u)(3,wt,6,4,"ng-template",null,2,u),i()),t&2){let e=c(2);s("value",e.paymentConfiguration().payment)}}function Dt(t,r){if(t&1){let e=v();a(0,"app-main-panel",4),y("search",function(o){C(e);let l=c();return S(l.onSearch(o))}),_(1,Mt,5,1,"ng-template",null,0,u),i()}t&2&&s("isSearchableInput",!0)("scrollable",!0)}var rt=(()=>{class t{constructor(){this.POSSetupService=h(R),this.paymentConfiguration=M(null)}ngOnInit(){this.POSSetupService.fetchPOSPaymentConfiguration({}).pipe(w(e=>{this.paymentConfiguration.set(e)})).subscribe()}onSearch(e){this.POSSetupService.fetchPOSPaymentConfiguration({Search:e}).pipe(w(n=>{this.paymentConfiguration.set(n)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-payment"]],decls:1,vars:1,consts:[["content",""],["header",""],["body",""],["pageTitle","Payment Method Accounting",3,"isSearchableInput","scrollable","search",4,"ngIf"],["pageTitle","Payment Method Accounting",3,"search","isSearchableInput","scrollable"],[3,"value"],["rowspan","3",2,"min-width","300px"],[2,"min-width","200px"],["pFrozenColumn",""],[1,"link-primary",3,"routerLink"]],template:function(n,o){n&1&&_(0,Dt,3,2,"app-main-panel",3),n&2&&s("ngIf",o.paymentConfiguration())},dependencies:[F,ne,te,qe,T,A,D,N],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Rt={data:{listOutletAccount:[],listCOAType:[],pageNumber:1,pageSize:20,totalCount:0,totalPages:0},filter:{PageNumber:1,PageSize:20,Search:""}},Ge=ye(Ie(Rt),be(t=>({first:X(()=>(t.filter().PageNumber-1)*t.filter().PageSize+1),end:X(()=>Math.min(t.filter().PageNumber*t.filter().PageSize,t.data().totalCount))})),Oe(t=>{let r=h(R);return{updateFilter:n=>{ee(t,o=>x(f({},o),{filter:f(f({},o.filter),n)}))},getPOSOutlets:Te(se(U(n=>r.fetchPOSOutletConfiguration(n).pipe(Fe({next:o=>{ee(t,l=>x(f({},l),{data:o}))},error:o=>{console.error("Error fetching POS outlets:",o)}})))))}}),Pe(t=>({onInit:()=>{t.getPOSOutlets(t.filter)}})));var kt=t=>[t];function At(t,r){if(t&1&&(a(0,"th"),m(1),i()),t&2){let e=r.$implicit;p(),d(e.value)}}function Nt(t,r){if(t&1&&(a(0,"tr")(1,"th"),m(2,"Name"),i(),P(3,At,2,1,"th",null,b),i()),t&2){let e=c(2);p(3),O(e.store.data().listCOAType)}}function Gt(t,r){if(t&1&&(a(0,"td"),m(1),i()),t&2){let e=r.$implicit;p(),d(e)}}function Lt(t,r){if(t&1&&(a(0,"tr")(1,"td")(2,"a",7),m(3),i()(),P(4,Gt,2,1,"td",null,b),i()),t&2){let e=r.$implicit;p(2),s("routerLink",oe(2,kt,e.OutletID)),p(),I(" ",e.OutletName,""),p(),O(e.Accounts)}}function Bt(t,r){if(t&1&&m(0),t&2){let e=c(2);We(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Vt(t,r){t&1&&(a(0,"tr")(1,"td",8)(2,"span"),m(3," No journal entries found. "),i()()())}function $t(t,r){if(t&1){let e=v();a(0,"p-panel")(1,"p-table",6),y("onPage",function(o){C(e);let l=c();return S(l.onPage(o))}),_(2,Nt,5,0,"ng-template",null,1,u)(4,Lt,6,4,"ng-template",null,2,u)(6,Bt,1,3,"ng-template",null,3,u)(8,Vt,4,0,"ng-template",null,4,u),i()()}if(t&2){let e=c();p(),s("value",e.store.data().listOutletAccount)("paginator",!0)("rows",e.store.filter().PageSize)("lazy",!0)("totalRecords",e.store.data().totalCount)}}var pt=(()=>{class t{constructor(){this.store=h(Ge)}onSearch(e){this.store.updateFilter({PageNumber:1,PageSize:20,Search:e})}onPage(e){let n=e.first/e.rows+1;this.store.updateFilter(x(f({},this.store.filter()),{PageSize:e.rows,PageNumber:n}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-outlet"]],features:[de([Ge])],decls:3,vars:2,consts:[["content",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["pageTitle","Outlet Account",3,"search","isSearchableInput","scrollable"],["styleClass","d-flex flex-column justify-content-between h-100",3,"onPage","value","paginator","rows","lazy","totalRecords"],[1,"link","link-primary",3,"routerLink"],["colspan","8"]],template:function(n,o){if(n&1){let l=v();a(0,"app-main-panel",5),y("search",function(V){return C(l),S(o.onSearch(V))}),_(1,$t,10,5,"ng-template",null,0,u),i()}n&2&&s("isSearchableInput",!0)("scrollable",!0)},dependencies:[F,T,z,ne,te,D,N,$,H],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Wt=()=>({height:"calc(100vh - 100px)"}),Ut=()=>({height:"calc(100vh - 150px)"});function jt(t,r){if(t&1){let e=v();a(0,"a",5),m(1,"Cancel"),i(),a(2,"p-button",6),y("onClick",function(){C(e);let o=c();return S(o.updatePOsOutletConfiguration())}),i()}}function Ht(t,r){if(t&1&&(a(0,"div",16)(1,"div",17)(2,"span"),m(3),i()(),a(4,"div",17)(5,"span",17),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function zt(t,r){if(t&1&&(a(0,"div",16)(1,"div",17)(2,"span"),m(3),i()(),a(4,"div",18)(5,"span",17),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function Yt(t,r){if(t&1&&(a(0,"div",12)(1,"span",14),m(2),i(),a(3,"p-select",15),_(4,Ht,7,2,"ng-template",null,2,u)(6,zt,7,2,"ng-template",null,3,u),i()()),t&2){let e,n=r.$implicit,o=r.$index,l=c(3);s("formGroupName",o),p(2),d((e=n.get("TypeName"))==null?null:e.value),p(),s("options",l.options.accounts)}}function Kt(t,r){t&1&&B(0,"hr")}function Jt(t,r){if(t&1&&(a(0,"div",9)(1,"h3",10),m(2),Ue(3,"titlecase"),i(),a(4,"div",11),P(5,Yt,8,3,"div",12,b),i()(),_(7,Kt,1,0,"hr",13)),t&2){let e,n=r.$implicit,o=r.$index,l=r.$index,g=r.$count,V=c(2);s("formGroupName",o),p(2),I(" ",je(3,3,(e=n.get("groupName"))==null?null:e.value)," "),p(3),O(V.getAccountsFormArray(l).controls),p(2),s("ngIf",l!==g-1)}}function qt(t,r){if(t&1&&(a(0,"p-panel")(1,"p-scroll-panel")(2,"form",7)(3,"div",8),P(4,Jt,8,5,null,null,b),i()()()()),t&2){let e=c();q(W(5,Wt)),p(),q(W(6,Ut)),p(),s("formGroup",e.accountsForm),p(2),O(e.accountGroupsArray.controls)}}var lt=(()=>{class t{constructor(){this.route=h(ie),this.POSSetupService=h(R),this.outletForm=M(null),this.allAccounts=[],this.options=null,this.outletName="",this.accountGroups=[{name:"sell",typeIds:[1,2,10],accounts:[]},{name:"delivery",typeIds:[3,4],accounts:[]},{name:"buy",typeIds:[27,11,28],accounts:[]},{name:"purchase return",typeIds:[9],accounts:[]},{name:"sales return",typeIds:[8],accounts:[]},{name:"adjustment",typeIds:[21,26],accounts:[]}],this.fb=h(Se)}ngOnInit(){this.accountsForm=this.fb.group({accountGroups:this.fb.array([])}),this.route.paramMap.pipe(Q(e=>e.get("id")),U(e=>this.POSSetupService.fetchPOSOutletFormConfiguration({outletID:e})),w(e=>{this.allAccounts=e.form,this.options=e.options,this.outletName=e.form[0].OutletName,this.accountGroups.forEach(o=>{o.accounts=this.allAccounts.filter(l=>o.typeIds.includes(l.TypeID))});let n=this.accountsForm.get("accountGroups");this.accountGroups.forEach(o=>{n.push(this.createAccountGroupControl(o))})})).subscribe()}get accountGroupsArray(){return this.accountsForm.get("accountGroups")}getAccountsFormArray(e){return this.accountGroupsArray.at(e).get("accounts")}createAccountGroupControl(e){return this.fb.group({groupName:[e.name],accounts:this.fb.array(e.accounts.map(n=>this.createAccountControl(n)))})}createAccountControl(e){return this.fb.group({AccountID:[e.AccountID],TypeID:[e.TypeID],TypeName:[e.TypeName],OutletID:[e.OutletID],OutletName:[e.OutletName]})}updatePOsOutletConfiguration(){let{accountGroups:e}=this.accountsForm.value,n={form:e.flatMap(o=>o.accounts.map(l=>({AccountID:l.AccountID,TypeID:l.TypeID,TypeName:l.TypeName,OutletID:l.OutletID,OutletName:l.OutletName})))};this.POSSetupService.updatePOSOutletConfiguration(n).pipe().subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-outlet-form"]],decls:5,vars:2,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"pageTitle","hasMainWrapperPadding"],["routerLink","/pages/pos-setup/outlets",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"onClick"],[1,"",3,"formGroup"],["formArrayName","accountGroups",1,"d-flex","flex-column","gap-2"],[1,"row",3,"formGroupName"],[1,"fs-4","fw-semibold"],["formArrayName","accounts",1,"row","row-gap-3"],[1,"col-6",3,"formGroupName"],[4,"ngIf"],[1,"fs-3"],["formControlName","AccountID","filter","","filterBy","code,name","optionLabel","name","optionValue","id","placeholder","Select an account",1,"w-100",3,"options"],[1,"d-flex","gap-2"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,jt,3,0,"ng-template",null,0,u)(3,qt,6,7,"ng-template",null,1,u),i()),n&2&&s("pageTitle","Edit "+o.outletName)("hasMainWrapperPadding",!0)},dependencies:[F,T,A,He,z,ve,ge,j,_e,xe,Ce,he,Ye,K,Y,$,H,re,L,G,D,N],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Zt=()=>({height:"calc(100vh - 100px)"}),en=()=>({width:"100%",height:"calc(100vh - 150px)"}),tn=()=>({width:"100%"});function nn(t,r){if(t&1){let e=v();a(0,"a",6),m(1,"Cancel"),i(),a(2,"p-button",7),y("onClick",function(){C(e);let o=c(3);return S(o.updatePOSOutletConfiguration())}),i()}}function on(t,r){if(t&1&&(a(0,"div",16)(1,"div",17)(2,"span"),m(3),i()(),a(4,"div",17)(5,"span",17),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function an(t,r){if(t&1&&(a(0,"div",16)(1,"div",17)(2,"span"),m(3),i()(),a(4,"div",18)(5,"span",17),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function rn(t,r){if(t&1){let e=v();a(0,"div",9)(1,"div",10)(2,"div",11)(3,"label",12),m(4),i()(),B(5,"div",13),a(6,"div",14)(7,"p-select",15),y("ngModelChange",function(o){let l=C(e).$index,g=c(4);return S(g.updateAccountById(o,l))}),_(8,on,7,2,"ng-template",null,2,u)(10,an,7,2,"ng-template",null,3,u),i()()()()}if(t&2){let e=r.$implicit,n=r.$index,o=c(4);p(4),d(e.outletName.slice(0,15)),p(3),q(W(7,tn)),s("ngModel",o.paymentForm().form.accounts[n].accountID)("virtualScroll",!0)("virtualScrollItemSize",50)("options",o.paymentForm().options.chartOfAccount)}}function pn(t,r){if(t&1&&(a(0,"p-card")(1,"p-scrollpanel")(2,"div",8),P(3,rn,12,8,"div",9,b),i()()()),t&2){let e=c(3);q(W(4,Zt)),p(),q(W(5,en)),p(2),O(e.paymentForm().form.accounts)}}function ln(t,r){if(t&1&&(a(0,"app-main-panel",4),_(1,nn,3,0,"ng-template",null,0,u)(3,pn,5,6,"ng-template",null,1,u),i()),t&2){let e=c(2);s("pageTitle",e.paymentForm().form.paymentMethod.name+" Form Accounting")("hasMainWrapperPadding",!0)}}function mn(t,r){if(t&1&&_(0,ln,5,2,"app-main-panel",5),t&2){let e=c();s("ngIf",e.paymentForm())}}var mt=(()=>{class t{constructor(){this.route=h(ie),this.POSSetupService=h(R),this.paymentForm=M(null),this.router=h(ze)}ngOnInit(){this.route.paramMap.pipe(Q(e=>+e.get("id")),U(e=>this.POSSetupService.fetchPOSPaymentFormConfiguration({ID:e})),w(e=>{this.paymentForm.set(e)}),Ae("response")).subscribe()}updateAccountById(e,n){let o=this.paymentForm().form.accounts,l=x(f({},this.paymentForm()),{form:x(f({},this.paymentForm().form),{accounts:o.map((g,V)=>V===n?x(f({},g),{accountID:e}):g)})});this.paymentForm.set(l)}updatePOSOutletConfiguration(){let e={form:[...this.paymentForm().form.accounts]};this.POSSetupService.updatePOSPaymentConfiguration(e).pipe(Ae("response"),w(()=>{this.router.navigate(["/pages/pos-setup/payments"])})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-payment-form"]],decls:1,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"pageTitle","hasMainWrapperPadding"],[3,"pageTitle","hasMainWrapperPadding",4,"ngIf"],["routerLink","/pages/pos-setup/payments",1,"p-button","p-button-outlined","p-button-secondary"],["label","Submit",3,"onClick"],[1,"row","row-gap-3"],[1,"col-6","d-flex","flex-column","gap-2"],[1,"row","row-gap-4"],[1,"col-2"],["for",""],[1,"col-3"],[1,"col-7"],["filter","","filterBy","name,code","optionLabel","name","optionValue","id","placeholder","Select an account",1,"w-full",3,"ngModelChange","ngModel","virtualScroll","virtualScrollItemSize","options"],[1,"d-flex","gap-2"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&_(0,mn,1,1,"app-main-panel",4),n&2&&$e(o.paymentForm()?0:-1)},dependencies:[z,Ee,F,T,A,pe,re,K,Y,Z,j,ae,D,N,L,G,$],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();function cn(t,r){if(t&1){let e=v();a(0,"div",5)(1,"a",6),m(2,"Cancel"),i(),a(3,"p-button",7),y("onClick",function(){C(e);let o=c();return S(o.updatePOSTaxConfiguration())}),i()()}}function sn(t,r){if(t&1&&(a(0,"div",5)(1,"div",15)(2,"span"),m(3),i()(),a(4,"div",15)(5,"span",15),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function un(t,r){if(t&1&&(a(0,"div",5)(1,"div",15)(2,"span"),m(3),i()(),a(4,"div",16)(5,"span",15),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function dn(t,r){if(t&1){let e=v();a(0,"div",11)(1,"div",12)(2,"label",13),m(3),i(),a(4,"p-select",14),y("ngModelChange",function(o){let l=C(e).$index,g=c(2);return S(g.updateAccountID(o,l))}),_(5,sn,7,2,"ng-template",null,2,u)(7,un,7,2,"ng-template",null,3,u),i()()()}if(t&2){let e=r.$implicit,n=r.$index,o=c(2);p(3),d(e.name),p(),s("options",o.taxForm().options.chartOfAccount)("ngModel",o.taxForm().form[n].accountID)}}function fn(t,r){if(t&1&&(a(0,"p-panel")(1,"div",8)(2,"div",9)(3,"div",10),P(4,dn,9,3,"div",11,b),i()()()()),t&2){let e=c();p(4),O(e.taxForm().form)}}var ct=(()=>{class t{constructor(){this.POSSetupService=h(R),this.taxForm=M(null)}ngOnInit(){this.POSSetupService.fetchPOSTaxConfiguration().pipe(w(e=>{this.taxForm.set(e)})).subscribe()}updateAccountID(e,n){let o=this.taxForm().form,l=x(f({},this.taxForm()),{form:o.map((g,V)=>V===n?x(f({},g),{accountID:e}):g)});this.taxForm.set(l)}updatePOSTaxConfiguration(){let e={form:[...this.taxForm().form]};this.POSSetupService.updatePOSTaxConfiguration(e).pipe(w(n=>console.log(n))).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-tax"]],decls:5,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],["pageTitle","Tax Setup",3,"scrollable"],[1,"d-flex","gap-2"],["routerLink","..",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"onClick"],[1,"row"],[1,"col-4"],[1,"row","row-gap-3"],[1,"col-12"],[1,"d-flex","flex-column"],["for",""],["filter","","filterBy","name,code","optionLabel","name","optionValue","id","placeholder","Select an Account",3,"ngModelChange","options","ngModel"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,cn,4,0,"ng-template",null,0,u)(3,fn,6,0,"ng-template",null,1,u),i()),n&2&&s("scrollable",!0)},dependencies:[F,z,T,K,Y,pe,Z,j,ae,D,N,L,G,$,H],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var _n=()=>({"min-width":"50rem"}),gn=t=>[t];function xn(t,r){t&1&&B(0,"p-button",6)}function hn(t,r){if(t&1&&_(0,xn,1,0,"p-button",5),t&2){let e=c();s("ngIf",e.hasCheckedItems())}}function Cn(t,r){t&1&&(a(0,"tr")(1,"th",8),B(2,"p-tableHeaderCheckbox"),i(),a(3,"th"),m(4,"Name"),i(),a(5,"th"),m(6,"Description"),i()())}function Sn(t,r){if(t&1&&(a(0,"tr")(1,"td"),B(2,"p-tableCheckbox",9),i(),a(3,"td")(4,"a",10),m(5),i()(),a(6,"td"),m(7),i()()),t&2){let e=r.$implicit;p(2),s("value",e),p(2),s("routerLink",oe(4,gn,e.id)),p(),d(e.name),p(2),d(e.description)}}function vn(t,r){if(t&1){let e=v();a(0,"p-panel")(1,"p-table",7),y("onRowSelect",function(o){C(e);let l=c();return S(l.onRowSelect(o))})("onRowUnselect",function(o){C(e);let l=c();return S(l.onRowSelect(o))})("onHeaderCheckboxToggle",function(o){C(e);let l=c();return S(l.onSelectAll(o))}),_(2,Cn,7,0,"ng-template",null,2,u)(4,Sn,8,6,"ng-template",null,3,u),i()()}if(t&2){let e=c();p(),s("value",e.writeoffList().data)("tableStyle",W(2,_n))}}var st=(()=>{class t{constructor(){this.POSSetupService=h(R),this.writeoffList=M(null),this.hasCheckedItems=X(()=>{let e=this.writeoffList();return!e||!e.data||!Array.isArray(e.data)?!1:e.data.some(n=>n&&n.checked===!0)})}ngOnInit(){this.POSSetupService.fetchPOSWriteOffConfiguration().pipe(Q(e=>x(f({},e),{data:e.data.map(n=>x(f({},n),{checked:!1}))})),w(e=>{this.writeoffList.set(e)})).subscribe()}onRowSelect(e){console.log("Selected Row:",e.data);let n=this.writeoffList();if(!n||!n.data)return;let o=n.data.findIndex(l=>l.id===e.data.id);if(o!==-1){let l=[...n.data];l[o]=x(f({},l[o]),{checked:!l[o].checked}),this.writeoffList.set(x(f({},n),{data:l}))}}onSelectAll(e){let n=this.writeoffList();if(!n?.data)return;let o=n.data.map(l=>x(f({},l),{checked:e.checked}));this.writeoffList.set(x(f({},n),{data:o}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-writeoff"]],decls:5,vars:1,consts:[["actionButton",""],["content",""],["header",""],["body",""],["pageTitle","Write Off",3,"scrollable"],["severity","danger","label","Delete","icon","fa-solid fa-trash",4,"ngIf"],["severity","danger","label","Delete","icon","fa-solid fa-trash"],["dataKey","id",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value","tableStyle"],[2,"width","1rem"],[3,"value"],[1,"link-primary",3,"routerLink"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,hn,1,1,"ng-template",null,0,u)(3,vn,6,3,"ng-template",null,1,u),i()),n&2&&s("scrollable",!0)},dependencies:[F,T,A,ne,te,we,Me,D,N,L,G,$,H],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var yn=()=>({witdh:"100%",height:"calc(100vh - 150px)"});function bn(t,r){if(t&1){let e=v();a(0,"div",6)(1,"a",7),m(2,"Cancel"),i(),a(3,"p-button",8),y("onClick",function(){C(e);let o=c(2);return S(o.updateWriteOffConfiguration())}),i()()}}function Pn(t,r){if(t&1&&(a(0,"div",6)(1,"span",16),m(2),i(),a(3,"span",16),m(4),i()()),t&2){let e=r.$implicit;p(2),I("(",e.code,")"),p(2),d(e.name)}}function On(t,r){if(t&1&&(a(0,"div",6)(1,"span",16),m(2),i(),a(3,"span",16),m(4),i()()),t&2){let e=r.$implicit;p(2),I("(",e.code,")"),p(2),d(e.name)}}function In(t,r){if(t&1){let e=v();a(0,"div",12)(1,"div",13)(2,"label",14),m(3),i(),a(4,"p-select",15),y("ngModelChange",function(o){let l=C(e).$index,g=c(3);return S(g.updateAccountById(o,l))}),_(5,Pn,5,2,"ng-template",null,2,u)(7,On,5,2,"ng-template",null,3,u),i()()()}if(t&2){let e=r.$implicit,n=c(3);p(3),d(e.name),p(),s("ngModel",e.accountID)("options",n.writeOffForm().options.account)("virtualScroll",!0)("virtualScrollItemSize",50)}}function En(t,r){if(t&1&&(a(0,"p-card")(1,"p-scroll-panel")(2,"div",9)(3,"div",10)(4,"div",11),P(5,In,9,5,"div",12,b),i()()()()()),t&2){let e=c(2);p(),q(W(2,yn)),p(4),O(e.writeOffForm().form)}}function Tn(t,r){if(t&1&&(a(0,"app-main-panel",5),_(1,bn,4,0,"ng-template",null,0,u)(3,En,7,3,"ng-template",null,1,u),i()),t&2){let e=c();s("pageTitle","Write Off Form "+e.writeOffForm().info.name)("hasMainWrapperPadding",!0)}}var ut=(()=>{class t{constructor(){this.POSSetupService=h(R),this.route=h(ie),this.writeOffForm=M(null)}ngOnInit(){this.route.paramMap.pipe(Q(e=>e.get("id")),U(e=>this.POSSetupService.fetchPOSWriteOffFormConfiguration({ID:e})),w(e=>this.writeOffForm.set(e))).subscribe()}updateAccountById(e,n){let o=this.writeOffForm().form,l=x(f({},this.writeOffForm()),{form:o.map((g,V)=>V===n?x(f({},g),{accountID:e}):g)});this.writeOffForm.set(l)}updateWriteOffConfiguration(){let e={form:this.writeOffForm().form};this.POSSetupService.updatePOSWriteOffConfiguration(e).pipe().subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-writeoff-form"]],decls:1,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"pageTitle","hasMainWrapperPadding",4,"ngIf"],[3,"pageTitle","hasMainWrapperPadding"],[1,"d-flex","gap-2"],["routerLink","/pages/pos-setup/writeoff",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"onClick"],[1,"row"],[1,"col"],[1,"row","row-gap-3"],[1,"col-3"],[1,"d-flex","flex-column"],["for","",1,"d-inline-block","text-truncate",2,"max-width","300px"],["filter","","filterBy","name,code","optionLabel","name","filter","","filterBy","name,code","optionValue","id","placeholder","Select an account",3,"ngModelChange","ngModel","options","virtualScroll","virtualScrollItemSize"],[1,""]],template:function(n,o){n&1&&_(0,Tn,5,2,"app-main-panel",4),n&2&&s("ngIf",o.writeOffForm())},dependencies:[F,T,A,z,Ee,pe,re,K,Y,Z,j,ae,D,N,L,G],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var dt=(()=>{class t{constructor(){this.httpService=h(fe)}getExpenseOptions(){return this.httpService.get(void 0,"/api/SetupExpenseOption/GetExpenseOptions")}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=ue({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Fn={data:{expenseOptions:[]}},Le=ye(Ie(Fn),Je("POSExpenseOptionStore"),be(t=>({hasCheckedRows:X(()=>t.data().expenseOptions.some(r=>r.checked)),checkedInvoice:X(()=>t.data().expenseOptions.filter(r=>r.checked).map(r=>r.id))})),Oe(t=>{let r=h(dt);return{onRowSelect(n){ee(t,o=>{let l=o.data.expenseOptions.map(g=>g.id===n.id?x(f({},g),{checked:!0}):g);return x(f({},o),{data:x(f({},o.data),{expenseOptions:l})})})},onRowUnselect(n){ee(t,o=>{let l=o.data.expenseOptions.map(g=>g.id===n.id?x(f({},g),{checked:!1}):g);return x(f({},o),{data:x(f({},o.data),{expenseOptions:l})})})},onHeaderCheckboxToggle(n){ee(t,o=>{let l=o.data.expenseOptions.map(g=>x(f({},g),{checked:n}));return x(f({},o),{data:x(f({},o.data),{expenseOptions:l})})})},getExpenseOptions:Te(se(U(()=>r.getExpenseOptions().pipe(Fe({next:n=>{ee(t,o=>x(f({},o),{data:x(f({},o.data),{expenseOptions:n.expenseOptions.map(l=>x(f({},l),{checked:!1}))})}))},error:n=>{console.error("Error fetching expense options:",n)}})))))}}),Pe({onInit:t=>{t.getExpenseOptions()}}));function wn(t,r){t&1&&B(0,"p-button",6)}function Mn(t,r){if(t&1&&_(0,wn,1,0,"p-button",5),t&2){let e=c();s("ngIf",e.store.hasCheckedRows())}}function Dn(t,r){t&1&&(a(0,"tr")(1,"th",8),B(2,"p-tableHeaderCheckbox"),i(),a(3,"th"),m(4,"Name"),i(),a(5,"th"),m(6,"Account"),i(),a(7,"th"),m(8,"Description"),i()())}function Rn(t,r){if(t&1&&(a(0,"tr")(1,"td"),B(2,"p-tableCheckbox",9),i(),a(3,"td"),m(4),i(),a(5,"td"),m(6),i(),a(7,"td"),B(8,"p",10),i()()),t&2){let e=r.$implicit;p(2),s("value",e),p(2),d(e.name),p(2),d(e.accountName),p(2),s("innerHTML",e.description,Ve)}}function kn(t,r){if(t&1){let e=v();a(0,"p-panel")(1,"p-table",7),y("onRowSelect",function(o){C(e);let l=c();return S(l.onRowSelect(o))})("onRowUnselect",function(o){C(e);let l=c();return S(l.onRowUnselect(o))})("onHeaderCheckboxToggle",function(o){C(e);let l=c();return S(l.onHeaderCheckboxToggle(o))}),_(2,Dn,9,0,"ng-template",null,2,u)(4,Rn,9,4,"ng-template",null,3,u),i()()}if(t&2){let e=c();p(),s("value",e.store.data().expenseOptions)}}var ft=(()=>{class t{constructor(){this.store=h(Le)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){Array.isArray(e.data)?e.data.forEach(n=>{this.store.onRowUnselect(n)}):this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-pos-expense-option"]],features:[de([Le])],decls:5,vars:1,consts:[["actionButton",""],["content",""],["header",""],["body",""],["pageTitle","Expense Option",3,"scrollable"],["label","Delete","severity","danger","icon","fa-solid fa-trash",4,"ngIf"],["label","Delete","severity","danger","icon","fa-solid fa-trash"],["dataKey","id",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value"],[2,"width","1rem"],[3,"value"],[3,"innerHTML"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,Mn,1,1,"ng-template",null,0,u)(3,kn,6,1,"ng-template",null,1,u),i()),n&2&&s("scrollable",!0)},dependencies:[F,ne,te,we,Me,$,H,L,G,T,A],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Ga=[{path:"",redirectTo:"global",pathMatch:"full"},{path:"",children:[{path:"global",component:at},{path:"outlets",component:pt},{path:"outlets/:id",component:lt},{path:"payments",component:rt},{path:"payments/:id",component:mt},{path:"taxs",component:ct},{path:"writeoff",component:st},{path:"writeoff/:id",component:ut},{path:"expense-option",component:ft}]}];export{Ga as POS_SETUP_ROUTES};
|