dealposbooks 5.32.2 → 5.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/scss/layouts/_sidebar.scss +1 -1
- package/assets/scss/style.scss +52 -6
- package/{chunk-ZM5TVQUU.js → chunk-6ATDYFCA.js} +1 -1
- package/chunk-6VZGWVBI.js +1 -0
- package/{chunk-CR2R5F5T.js → chunk-76K2CYGK.js} +1 -1
- package/{chunk-VJBDOS6M.js → chunk-7Q7GUZQB.js} +1 -1
- package/chunk-AWXT2WGR.js +180 -0
- package/{chunk-V5OZ47U6.js → chunk-BPAXVUBR.js} +1 -1
- package/{chunk-VVGZUJP6.js → chunk-BU5IXVPY.js} +1 -1
- package/{chunk-ICOTZOJJ.js → chunk-CM2QLSCG.js} +5 -5
- package/{chunk-QTALSVSB.js → chunk-FFGCE3TK.js} +1 -1
- package/{chunk-BJ7FEOET.js → chunk-GQWMJTTS.js} +1 -1
- package/{chunk-GK2S4TYF.js → chunk-H4PZGISP.js} +1 -1
- package/{chunk-CJ6UGNBN.js → chunk-JB4UBWDT.js} +1 -1
- package/{chunk-UVXRATHG.js → chunk-JL2CN3ZY.js} +1 -1
- package/{chunk-OQ52MPGS.js → chunk-KBT2GX7L.js} +1 -1
- package/{chunk-ALYAGR32.js → chunk-KINBDQRV.js} +1 -1
- package/{chunk-Y5FQDBGQ.js → chunk-LMNTEWLI.js} +1 -1
- package/{chunk-W4GXLPRM.js → chunk-MNFWDRDS.js} +1 -1
- package/{chunk-ERFXO32T.js → chunk-MPFBVM6S.js} +1 -1
- package/{chunk-MEXKKLEE.js → chunk-MZGANYF3.js} +1 -1
- package/{chunk-NCY25JG4.js → chunk-OD62LD7H.js} +4 -4
- package/{chunk-FSEW3LUP.js → chunk-OFLZMVEN.js} +1 -1
- package/{chunk-FP5LIX5S.js → chunk-P37DL4A6.js} +1 -1
- package/{chunk-MDH73MG3.js → chunk-P7Z64VPC.js} +1 -1
- package/{chunk-5OYK64TO.js → chunk-PBN5IYNX.js} +1 -1
- package/{chunk-SZ3LQIKH.js → chunk-PDFK6YU3.js} +1 -1
- package/{chunk-SASCD5HU.js → chunk-PI5RBOCG.js} +1 -1
- package/{chunk-CMRVHYI7.js → chunk-QAQ2CXF3.js} +2 -2
- package/chunk-QVKOUG4C.js +7 -0
- package/{chunk-RQ4G322O.js → chunk-R2SYW2WU.js} +1 -1
- package/{chunk-7I5R2CUM.js → chunk-SMXZZ5T3.js} +1 -1
- package/{chunk-ZSVULSVG.js → chunk-TB3PSBKG.js} +1 -1
- package/{chunk-B4HCPA6E.js → chunk-TBT7EWUJ.js} +1 -1
- package/{chunk-6UIJBWT6.js → chunk-UP43K7DD.js} +1 -1
- package/{chunk-ZA5U4RYI.js → chunk-UPYOERLM.js} +1 -1
- package/chunk-V3F7SFWL.js +1 -0
- package/{chunk-2QWFLAG5.js → chunk-VLC4IRPH.js} +1 -1
- package/{chunk-JZU6YAPX.js → chunk-W5IDHDT2.js} +1 -1
- package/{chunk-HKQCPLSX.js → chunk-WBPKGJTU.js} +1 -1
- package/{chunk-4EUKDALJ.js → chunk-WJNROQNY.js} +1 -1
- package/{chunk-CACGTOSZ.js → chunk-ZXCNQW44.js} +1 -1
- package/index.html +2 -2
- package/main-RFYAOUOX.js +1 -0
- package/package.json +1 -1
- package/{styles-TTHIY3OR.css → styles-ERZ5377A.css} +1 -1
- package/chunk-B7A5CWPE.js +0 -1
- package/chunk-UYC454VQ.js +0 -180
- package/chunk-YBZSBC7H.js +0 -7
- package/chunk-YGEMHXDD.js +0 -1
- package/main-RAHFUIZB.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-2CSSUKCF.js";import"./chunk-AGLKA7OG.js";import"./chunk-C2GO6SPF.js";import"./chunk-ZGXJEG37.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import"./chunk-B63BKC6F.js";import"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var o=[{path:"",canActivate:[a],children:[{path:"",loadComponent:()=>import("./chunk-
|
|
1
|
+
import{a}from"./chunk-2CSSUKCF.js";import"./chunk-AGLKA7OG.js";import"./chunk-C2GO6SPF.js";import"./chunk-ZGXJEG37.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import"./chunk-B63BKC6F.js";import"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var o=[{path:"",canActivate:[a],children:[{path:"",loadComponent:()=>import("./chunk-JL2CN3ZY.js").then(t=>t.Dashboard1Component),data:{title:"Dashboard",headerTemplate:"header"}}]}];export{o as DashboardRoutes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Se,b as ke}from"./chunk-UEWFM35O.js";import{a as ve,b as be,c as xe,d as ye,e as Ce,f as Fe}from"./chunk-EDCDR4RJ.js";import"./chunk-HHDFSN55.js";import{a as ge,b as he}from"./chunk-TVNXFJII.js";import{a as _e}from"./chunk-XKI7WLHE.js";import{a as ce}from"./chunk-6ACYDH2N.js";import"./chunk-C2GO6SPF.js";import"./chunk-Q33XIUDN.js";import{a as G}from"./chunk-XKCLERWG.js";import"./chunk-253IFSMV.js";import{a as re,b as ie}from"./chunk-FBEBMNVC.js";import"./chunk-YDEVG4CR.js";import{h as fe}from"./chunk-
|
|
1
|
+
import{a as Se,b as ke}from"./chunk-UEWFM35O.js";import{a as ve,b as be,c as xe,d as ye,e as Ce,f as Fe}from"./chunk-EDCDR4RJ.js";import"./chunk-HHDFSN55.js";import{a as ge,b as he}from"./chunk-TVNXFJII.js";import{a as _e}from"./chunk-XKI7WLHE.js";import{a as ce}from"./chunk-6ACYDH2N.js";import"./chunk-C2GO6SPF.js";import"./chunk-Q33XIUDN.js";import{a as G}from"./chunk-XKCLERWG.js";import"./chunk-253IFSMV.js";import{a as re,b as ie}from"./chunk-FBEBMNVC.js";import"./chunk-YDEVG4CR.js";import{h as fe}from"./chunk-AWXT2WGR.js";import{b as ue,c as de}from"./chunk-C7LM5UCK.js";import{a as me,b as se}from"./chunk-J4XRJAME.js";import"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{n as ne,o as ae,w as le,x as pe}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{b as H,c as J,e as K,f as Q,k as W,l as X,m as Y,n as Z,o as ee,v as te,y as oe}from"./chunk-FMVCTBCQ.js";import"./chunk-ZGXJEG37.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{D as U,F as L,c as $,e as j,f as q,m as z}from"./chunk-B63BKC6F.js";import{Ab as P,Ac as b,Cb as f,Ga as D,Kb as a,Mc as I,Nb as _,Ob as C,Qb as F,Qc as B,Sb as S,Tb as k,Ub as i,Vb as n,Wb as g,X as M,Z as y,_b as R,dc as V,ec as u,gb as r,ha as c,pa as E,qa as N,qc as h,rc as T,sc as O,ta as A,wb as w,zc as v}from"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var Me=()=>({height:"calc(100vh - 70px)"}),Ee=t=>({"ng-invalid ng-dirty":t}),Te=t=>({"ps-0":t}),Ie=()=>({display:"flex"});function Ne(t,l){if(t&1){let e=R();i(0,"p-button",4),V("onClick",function(){E(e);let p=u(2);return N(p.onSubmit())}),n()}}function Ae(t,l){if(t&1&&f(0,Ne,1,0,"p-button",3),t&2){let e=u();a("ngIf",e.roleService.user.edit)}}function De(t,l){if(t&1&&(i(0,"div")(1,"span",16),h(2),n()()),t&2){let e=l.$implicit;r(2),T(e)}}function we(t,l){if(t&1&&(i(0,"div"),f(1,De,3,1,"div",15),n()),t&2){let e=u(2);r(),a("ngForOf",e.getErrors("name"))}}function Pe(t,l){if(t&1&&(i(0,"div",25)(1,"div",26),g(2,"p-checkbox",27),i(3,"p",28),h(4),n()()()),t&2){let e=l.$implicit,o=l.$index;a("formGroupName",o)("pTooltip",e.get("description").value),r(2),_(v(6,Ie)),a("binary",!0),r(2),O(" ",e.get("name").value," ")}}function Re(t,l){if(t&1&&(i(0,"div",18)(1,"div",19)(2,"div",20)(3,"span",21),h(4),n()(),g(5,"p-checkbox",22),n(),i(6,"div",23)(7,"div",24),S(8,Pe,5,7,"div",25,F),n()()()),t&2){let e=l.$implicit,o=l.$index,p=u(3);a("formGroupName",o),r(4),T(e.get("groupName").value),r(),_(v(5,Ie)),a("binary",!0),r(3),k(p.getRolesArray(o).controls)}}function Ve(t,l){if(t&1&&(i(0,"div",17),S(1,Re,10,6,"div",18,F),n()),t&2){let e=u(2);r(),k(e.rolesFormArray.controls)}}function Oe(t,l){if(t&1&&(i(0,"p-panel")(1,"div",5),g(2,"app-user-tabs"),i(3,"form",6),g(4,"input",7),f(5,we,2,1,"div",8),n(),i(6,"p-tabs",9)(7,"p-tablist")(8,"p-tab",9),h(9,"Permission"),n(),i(10,"p-tab",10),h(11,"Description"),n()(),i(12,"p-tabpanels",11)(13,"p-tabpanel",9)(14,"form",6),f(15,Ve,3,0,"div",12),n()(),i(16,"p-tabpanel",10)(17,"div",13),g(18,"textarea",14),n()()()()()()),t&2){let e=u();_(v(13,Me)),r(3),a("formGroup",e.form),r(),a("fluid",!0)("ngClass",b(14,Ee,e.isInvalid("name"))),r(),a("ngIf",e.isInvalid("name")),r(3),C(b(16,Te,e.router.url.includes("forms"))),r(2),C(b(18,Te,e.router.url.includes("forms"))),r(4),a("formGroup",e.form),r(),a("ngIf",e.rolesFormArray.length>0),r(2),a("formGroup",e.form)}}var gt=(()=>{class t extends _e{constructor(){super(...arguments),this.service=c(Se),this.fb=c(te),this.cdr=c(B),this.route=c(U),this.router=c(L),this.roleService=c(ce),this.form=this.fb.group({groupID:this.fb.control(""),name:this.fb.control("",[J.required]),description:this.fb.control(""),roles:this.fb.array([])}),this.groupFormMeta=D(null)}ngOnInit(){this.route.queryParamMap.pipe(M(e=>this.service.getGroupFormMeta(e.get("groupID")).pipe(G("Group form meta loaded"),y(o=>{this.groupFormMeta.set(o),this.populateForm(o)})))).subscribe()}populateForm(e){this.form.patchValue({groupID:e.form.groupID,name:e.form.name,description:e.form.description});let o=this.rolesFormArray;o.clear(),e.options.roles.forEach(p=>{let s=this.fb.array(p.roles.map(m=>this.fb.group({id:this.fb.control(m.id),name:this.fb.control(m.name),checked:this.fb.control({value:e.form.rolesID.includes(m.id),disabled:!this.roleService.user.edit}),description:this.fb.control(m.description||"")}))),d=this.fb.group({groupName:this.fb.control(p.name),groupChecked:this.fb.control(!1),roles:s}),Ge=s.controls.every(m=>m.get("checked").value);d.get("groupChecked").setValue(Ge,{emitEvent:!1}),this.roleService.user.edit?d.get("groupChecked").enable():d.get("groupChecked").disable(),d.get("groupChecked").valueChanges.subscribe(m=>{s.controls.forEach(x=>{x.get("checked").setValue(m,{emitEvent:!1})})}),s.valueChanges.subscribe(()=>{let m=s.controls.every(x=>x.get("checked").value);d.get("groupChecked").setValue(m,{emitEvent:!1})}),o.push(d)}),this.cdr.detectChanges()}get rolesFormArray(){return this.form.get("roles")}getRolesArray(e){return this.rolesFormArray.at(e).get("roles")}getSelectedRoleIDs(){let e=[];return this.rolesFormArray.controls.forEach(o=>{o.get("roles").controls.forEach(s=>{s.get("checked").value&&e.push(s.get("id").value)})}),e}onSubmit(){if(this.form.invalid){this.form.markAllAsTouched();return}let e={groupID:this.form.get("groupID").value,name:this.form.get("name").value,rolesID:this.getSelectedRoleIDs(),description:this.form.controls.description.value};this.service.assignGroupRole(e).pipe(G("Group roles assigned successfully"),y(()=>{this.router.navigate(["/pages/users/groups"])})).subscribe(),console.log(e)}static{this.\u0275fac=(()=>{let e;return function(p){return(e||(e=A(t)))(p||t)}})()}static{this.\u0275cmp=w({type:t,selectors:[["app-group-form"]],features:[P],decls:5,vars:1,consts:[["actionButton",""],["content",""],["pageTitle","Group Form",3,"overflowScroll"],["label","Submit",3,"onClick",4,"ngIf"],["label","Submit",3,"onClick"],[1,"d-flex","flex-column","gap-3","py-2"],[1,"d-flex","flex-column","gap-2",3,"formGroup"],["type","text","pInputText","","formControlName","name","placeholder","Group Name",3,"fluid","ngClass"],[4,"ngIf"],["value","0"],["value","1"],[2,"padding-left","0"],["formArrayName","roles","class","container-fluid d-flex flex-column row-gap-3",4,"ngIf"],[3,"formGroup"],["formControlName","description","fluid","","rows","5","cols","30","pTextarea",""],[4,"ngFor","ngForOf"],[1,"text-danger"],["formArrayName","roles",1,"container-fluid","d-flex","flex-column","row-gap-3"],[1,"row",3,"formGroupName"],[1,"col-2","border","d-flex","align-items-center","justify-content-between",2,"height","40px","background","#f6f6f6"],[1,"d-flex","justify-content-center","w-100"],[1,"text-dark","fw-semibold","fs-2"],["size","small","formControlName","groupChecked",3,"binary"],[1,"col"],["formArrayName","roles",1,"row","h-100"],["tooltipPosition","top",1,"col-3","border","p-0","bg-white",3,"formGroupName","pTooltip"],[1,"d-flex","h-100","align-items-center","gap-2","px-2"],["size","small","formControlName","checked",3,"binary"],[1,"fs-2","text-dark","m-0"]],template:function(o,p){o&1&&(i(0,"app-main-panel",2),f(1,Ae,1,1,"ng-template",null,0,I)(3,Oe,19,20,"ng-template",null,1,I),n()),o&2&&a("overflowScroll",!0)},dependencies:[fe,ie,re,oe,W,H,K,Q,X,ee,Y,Z,z,$,j,q,ae,ne,Fe,Ce,ye,xe,ve,be,he,ge,pe,le,ke,se,me,de,ue],styles:["[_nghost-%COMP%]{display:block}[_nghost-%COMP%] .p-checkbox{display:flex!important}[_nghost-%COMP%] .p-tabs .p-tab{padding-left:0!important}[_nghost-%COMP%] .p-panel .p-panel-header{display:none!important}"],changeDetection:0})}}return t})();export{gt as GroupFormComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk-YQFG5XE2.js";var t=[{path:"",redirectTo:"users",pathMatch:"full"},{path:"",children:[{path:"users",loadComponent:()=>import("./chunk-
|
|
1
|
+
import"./chunk-YQFG5XE2.js";var t=[{path:"",redirectTo:"users",pathMatch:"full"},{path:"",children:[{path:"users",loadComponent:()=>import("./chunk-QAQ2CXF3.js").then(o=>o.UserPageComponent)},{path:"groups",loadComponent:()=>import("./chunk-R2SYW2WU.js").then(o=>o.GroupPageComponent)},{path:"groups/forms",loadComponent:()=>import("./chunk-PDFK6YU3.js").then(o=>o.GroupFormComponent)}]}];export{t as USERS_ROUTES};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as J,b as yt}from"./chunk-UEWFM35O.js";import{a as xt}from"./chunk-G4XX7EU2.js";import{f as Ct}from"./chunk-EDCDR4RJ.js";import"./chunk-HHDFSN55.js";import{a as bt}from"./chunk-XKI7WLHE.js";import{a as ot}from"./chunk-6ACYDH2N.js";import"./chunk-C2GO6SPF.js";import{a as W,b as K}from"./chunk-O4QM64EH.js";import{d as ft,i as ht,j as gt,k as wt}from"./chunk-EW3R2HAB.js";import"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import{a as _e}from"./chunk-XKCLERWG.js";import"./chunk-PKN47FQE.js";import{a as ut,b as _t}from"./chunk-LRRVQSMI.js";import"./chunk-42UIGXWH.js";import"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{h as dt}from"./chunk-
|
|
1
|
+
import{a as J,b as yt}from"./chunk-UEWFM35O.js";import{a as xt}from"./chunk-G4XX7EU2.js";import{f as Ct}from"./chunk-EDCDR4RJ.js";import"./chunk-HHDFSN55.js";import{a as bt}from"./chunk-XKI7WLHE.js";import{a as ot}from"./chunk-6ACYDH2N.js";import"./chunk-C2GO6SPF.js";import{a as W,b as K}from"./chunk-O4QM64EH.js";import{d as ft,i as ht,j as gt,k as wt}from"./chunk-EW3R2HAB.js";import"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import{a as _e}from"./chunk-XKCLERWG.js";import"./chunk-PKN47FQE.js";import{a as ut,b as _t}from"./chunk-LRRVQSMI.js";import"./chunk-42UIGXWH.js";import"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{h as dt}from"./chunk-AWXT2WGR.js";import{a as Je}from"./chunk-C7LM5UCK.js";import{a as nt,b as rt}from"./chunk-J4XRJAME.js";import{a as I,b as at,c as st,d as lt,e as pt,f as ct,g as mt}from"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{a as Ke,f as L,k as Xe,m as Ye,o as et,s as tt,w as $,x as it}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{A as ue,B as Ge,D as je,L as qe,Ma as $e,Na as Z,Va as We,c as de,e as Ae,f as Be,l as He,na as Ze,o as Ne,v as Qe,y as ze}from"./chunk-FMVCTBCQ.js";import"./chunk-ZGXJEG37.js";import"./chunk-VFEEFGWW.js";import{c as Oe,d as se,f as le,h as pe,i as ce,k as me}from"./chunk-F2X3VGZZ.js";import{D as Re,F as Le,G as Me,c as G,f as j,h as Pe,m as q}from"./chunk-B63BKC6F.js";import{Ab as H,Ac as V,Bc as Ee,Cb as _,Fc as Ue,Ga as R,Jb as D,Kb as s,Mc as x,Nb as N,Ob as ee,Pb as xe,Qb as te,Sb as ie,Tb as ne,Ub as p,Vb as m,Vc as T,Wb as k,Wc as Fe,X as O,Xb as Ce,Yb as ye,Yc as P,Z as X,Zb as E,Zc as Ve,_b as S,ba as ge,c as M,ca as we,dc as b,ec as l,fc as ve,gb as a,gc as ke,ha as C,jc as U,kc as Q,lc as y,mc as v,pa as d,pc as Se,qa as u,qc as g,rc as F,sc as Te,ta as Y,uc as Ie,vc as re,wb as B,wc as oe,xb as be,xc as ae,yc as z,za as A,zc as De}from"./chunk-JP6RBSB3.js";import{a as f,b as h}from"./chunk-YQFG5XE2.js";var Tt={data:[],count:0,filter:{pagination:1,pageSize:10,groupID:null,text:""},meta:{filter:{pagination:1,pageSize:10,groupID:null,text:""},options:{groups:[]}},metaForm:{form:{id:"",groupID:""},options:{users:[],groups:[]}}},fe=at(mt("UserStore"),ct(Tt),st(t=>({first:P(()=>(t.filter().pagination-1)*t.filter().pageSize+1),end:P(()=>Math.min(t.filter().pagination*t.filter().pageSize,t.count())),hasCheckedRows:P(()=>t.data().some(o=>o.checked)),checkedData:P(()=>t.data().filter(o=>o.checked).map(o=>o.userID)),selectedID:P(()=>t.data().find(o=>o.checked)?.userID||null)})),pt(t=>{let o=C(J);return{setFilter(n){I(t,i=>h(f({},i),{filter:n}))},onRowSelect(n){I(t,i=>{let r=i.data.map(c=>c.userID===n.userID?h(f({},c),{checked:!0}):c);return h(f({},i),{data:r})})},onRowUnselect(n){I(t,i=>{let r=i.data.map(c=>c.userID===n.userID?h(f({},c),{checked:!1}):c);return h(f({},i),{data:r})})},onHeaderCheckboxToggle(n){let i=localStorage.getItem("AUTH_USERNAME");I(t,r=>{let c=r.data.map(w=>w.userName!==i?h(f({},w),{checked:n}):h(f({},w),{checked:!1}));return h(f({},r),{data:c})})},getUserLoader:W(M(O(()=>o.getUserLoaderList().pipe(K({next:n=>{I(t,i=>h(f({},i),{meta:n}))},error:n=>{console.error("Failed to fetch user loader list:",n)}}))))),getUserFormMeta:W(M(O(n=>o.getUserFormMeta(n).pipe(K({next:i=>{I(t,r=>h(f({},r),{metaForm:i}))},error:i=>{console.error("Failed to fetch user form meta:",i)}}))))),getUsers:W(M(O(n=>o.getUsers(n).pipe(K({next:i=>{I(t,r=>h(f({},r),{data:i.data.map(c=>h(f({},c),{checked:!1})),count:i.count}))},error:i=>{console.error("Failed to fetch users:",i)}})))))}}),lt({onInit:t=>{t.getUserLoader(),t.getUsers(t.filter)}}));var Et=["header"],Ut=["footer"],Ft=["content"],Vt=["closeicon"],Pt=["headless"],Rt=["maskRef"],Lt=["container"],Mt=["closeButton"],Ot=["*"],At=(t,o,e,n,i,r)=>({"p-drawer":!0,"p-drawer-active":t,"p-drawer-left":o,"p-drawer-right":e,"p-drawer-top":n,"p-drawer-bottom":i,"p-drawer-full":r}),Bt=(t,o)=>({transform:t,transition:o}),Ht=t=>({value:"visible",params:t});function Nt(t,o){t&1&&E(0)}function Qt(t,o){if(t&1&&_(0,Nt,1,0,"ng-container",4),t&2){let e=l(2);s("ngTemplateOutlet",e.headlessTemplate||e._headlessTemplate)}}function zt(t,o){t&1&&E(0)}function Gt(t,o){if(t&1&&(p(0,"div"),g(1),m()),t&2){let e=l(3);ee(e.cx("title")),a(),F(e.header)}}function jt(t,o){t&1&&k(0,"TimesIcon"),t&2&&D("data-pc-section","closeicon")}function qt(t,o){}function Zt(t,o){t&1&&_(0,qt,0,0,"ng-template")}function $t(t,o){if(t&1&&_(0,jt,1,1,"TimesIcon",8)(1,Zt,1,0,null,4),t&2){let e=l(4);s("ngIf",!e.closeIconTemplate&&!e._closeIconTemplate),a(),s("ngTemplateOutlet",e.closeIconTemplate||e._closeIconTemplate)}}function Wt(t,o){if(t&1){let e=S();p(0,"p-button",9),b("onClick",function(i){d(e);let r=l(3);return u(r.close(i))})("keydown.enter",function(i){d(e);let r=l(3);return u(r.close(i))}),_(1,$t,2,2,"ng-template",null,1,x),m()}if(t&2){let e=l(3);s("ngClass",e.cx("closeButton"))("buttonProps",e.closeButtonProps)("ariaLabel",e.ariaCloseLabel),D("data-pc-section","closebutton")("data-pc-group-section","iconcontainer")}}function Kt(t,o){t&1&&E(0)}function Jt(t,o){t&1&&E(0)}function Xt(t,o){if(t&1&&(Ce(0),p(1,"div",5),_(2,Jt,1,0,"ng-container",4),m(),ye()),t&2){let e=l(3);a(),s("ngClass",e.cx("footer")),D("data-pc-section","footer"),a(),s("ngTemplateOutlet",e.footerTemplate||e._footerTemplate)}}function Yt(t,o){if(t&1&&(p(0,"div",5),_(1,zt,1,0,"ng-container",4)(2,Gt,2,3,"div",6)(3,Wt,3,5,"p-button",7),m(),p(4,"div",5),ke(5),_(6,Kt,1,0,"ng-container",4),m(),_(7,Xt,3,3,"ng-container",8)),t&2){let e=l(2);s("ngClass",e.cx("header")),D("data-pc-section","header"),a(),s("ngTemplateOutlet",e.headerTemplate||e._headerTemplate),a(),s("ngIf",e.header),a(),s("ngIf",e.showCloseIcon&&e.closable),a(),s("ngClass",e.cx("content")),D("data-pc-section","content"),a(2),s("ngTemplateOutlet",e.contentTemplate||e._contentTemplate),a(),s("ngIf",e.footerTemplate||e._footerTemplate)}}function ei(t,o){if(t&1){let e=S();p(0,"div",3,0),b("@panelState.start",function(i){d(e);let r=l();return u(r.onAnimationStart(i))})("@panelState.done",function(i){d(e);let r=l();return u(r.onAnimationEnd(i))})("keydown",function(i){d(e);let r=l();return u(r.onKeyDown(i))}),_(2,Qt,1,1,"ng-container")(3,Yt,8,9),m()}if(t&2){let e=l();N(e.style),ee(e.styleClass),s("ngClass",Ue(9,At,e.visible,e.position==="left"&&!e.fullScreen,e.position==="right"&&!e.fullScreen,e.position==="top"&&!e.fullScreen,e.position==="bottom"&&!e.fullScreen,e.fullScreen||e.position==="full"))("@panelState",V(19,Ht,Ee(16,Bt,e.transformOptions,e.transitionOptions))),D("data-pc-name","sidebar")("data-pc-section","root"),a(2),xe(e.headlessTemplate||e._headlessTemplate?2:3)}}var ti=({dt:t})=>`
|
|
2
2
|
.p-drawer {
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
@@ -199,4 +199,4 @@ import{a as J,b as yt}from"./chunk-UEWFM35O.js";import{a as xt}from"./chunk-G4XX
|
|
|
199
199
|
background-color: transparent;
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
`,ii={mask:({instance:t})=>({position:"fixed",height:"100%",width:"100%",left:0,top:0,display:"flex",flexDirection:"column",alignItems:t.position==="top"?"flex-start":t.position==="bottom"?"flex-end":"center"})},ni={mask:({instance:t})=>({"p-drawer-mask":!0,"p-overlay-mask p-overlay-mask-enter":t.modal,"p-drawer-open":t.containerVisible,"p-drawer-full":t.fullScreen,[`p-drawer-${t.position}`]:!!t.position}),root:({instance:t})=>({"p-drawer p-component":!0,"p-drawer-full":t.fullScreen}),header:"p-drawer-header",title:"p-drawer-title",pcCloseButton:"p-drawer-close-button",content:"p-drawer-content",footer:"p-drawer-footer"},vt=(()=>{class t extends We{name="drawer";theme=ti;classes=ni;inlineStyles=ii;static \u0275fac=(()=>{let e;return function(i){return(e||(e=Y(t)))(i||t)}})();static \u0275prov=ge({token:t,factory:t.\u0275fac})}return t})();var ri=ce([le({transform:"{{transform}}",opacity:0}),se("{{transition}}")]),oi=ce([se("{{transition}}",le({transform:"{{transform}}",opacity:0}))]),he=(()=>{class t extends Ke{appendTo="body";blockScroll=!1;style;styleClass;ariaCloseLabel;autoZIndex=!0;baseZIndex=0;modal=!0;closeButtonProps={severity:"secondary",text:!0,rounded:!0};dismissible=!0;showCloseIcon=!0;closeOnEscape=!0;transitionOptions="150ms cubic-bezier(0, 0, 0.2, 1)";get visible(){return this._visible}set visible(e){this._visible=e}get position(){return this._position}set position(e){if(this._position=e,e==="full"){this.transformOptions="none";return}switch(e){case"left":this.transformOptions="translate3d(-100%, 0px, 0px)";break;case"right":this.transformOptions="translate3d(100%, 0px, 0px)";break;case"bottom":this.transformOptions="translate3d(0px, 100%, 0px)";break;case"top":this.transformOptions="translate3d(0px, -100%, 0px)";break}}get fullScreen(){return this._fullScreen}set fullScreen(e){this._fullScreen=e,e&&(this.transformOptions="none")}header;maskStyle;closable=!0;onShow=new A;onHide=new A;visibleChange=new A;maskRef;containerViewChild;closeButtonViewChild;initialized;_visible;_position="left";_fullScreen=!1;container;transformOptions="translate3d(-100%, 0px, 0px)";mask;maskClickListener;documentEscapeListener;animationEndListener;_componentStyle=C(vt);ngAfterViewInit(){super.ngAfterViewInit(),this.initialized=!0}headerTemplate;footerTemplate;contentTemplate;closeIconTemplate;headlessTemplate;_headerTemplate;_footerTemplate;_contentTemplate;_closeIconTemplate;_headlessTemplate;templates;ngAfterContentInit(){this.templates?.forEach(e=>{switch(e.getType()){case"content":this._contentTemplate=e.template;break;case"header":this._headerTemplate=e.template;break;case"footer":this._footerTemplate=e.template;break;case"closeicon":this._closeIconTemplate=e.template;break;case"headless":this._headlessTemplate=e.template;break;default:this._contentTemplate=e.template;break}})}onKeyDown(e){e.code==="Escape"&&this.hide(!1)}show(){this.container.setAttribute(this.attrSelector,""),this.autoZIndex&&L.set("modal",this.container,this.baseZIndex||this.config.zIndex.modal),this.modal&&this.enableModality(),this.onShow.emit({}),this.visibleChange.emit(!0)}hide(e=!0){e&&this.onHide.emit({}),this.modal&&this.disableModality()}close(e){this.hide(),this.visibleChange.emit(!1),e.preventDefault()}enableModality(){let e=this.document.querySelectorAll(".p-drawer-active"),n=e.length,i=n==1?String(parseInt(this.container.style.zIndex)-1):String(parseInt(e[n-1].style.zIndex)-1);this.mask||(this.mask=this.renderer.createElement("div"),this.renderer.setStyle(this.mask,"zIndex",i),Ze(this.mask,"style",this.maskStyle),ue(this.mask,"p-overlay-mask p-drawer-mask p-overlay-mask-enter"),this.dismissible&&(this.maskClickListener=this.renderer.listen(this.mask,"click",r=>{this.dismissible&&this.close(r)})),this.renderer.appendChild(this.document.body,this.mask),this.blockScroll&&Ge())}disableModality(){this.mask&&(ue(this.mask,"p-overlay-mask-leave"),this.animationEndListener=this.renderer.listen(this.mask,"animationend",this.destroyModal.bind(this)))}destroyModal(){this.unbindMaskClickListener(),this.mask&&this.renderer.removeChild(this.document.body,this.mask),this.blockScroll&&je(),this.unbindAnimationEndListener(),this.mask=null}onAnimationStart(e){switch(e.toState){case"visible":this.container=e.element,this.appendContainer(),this.show(),this.closeOnEscape&&this.bindDocumentEscapeListener();break}}onAnimationEnd(e){switch(e.toState){case"void":this.hide(!1),L.clear(this.container),this.unbindGlobalListeners();break}}appendContainer(){this.appendTo&&(this.appendTo==="body"?this.renderer.appendChild(this.document.body,this.container):qe(this.appendTo,this.container))}bindDocumentEscapeListener(){let e=this.el?this.el.nativeElement.ownerDocument:this.document;this.documentEscapeListener=this.renderer.listen(e,"keydown",n=>{n.which==27&&parseInt(this.container.style.zIndex)===L.get(this.container)&&this.close(n)})}unbindDocumentEscapeListener(){this.documentEscapeListener&&(this.documentEscapeListener(),this.documentEscapeListener=null)}unbindMaskClickListener(){this.maskClickListener&&(this.maskClickListener(),this.maskClickListener=null)}unbindGlobalListeners(){this.unbindMaskClickListener(),this.unbindDocumentEscapeListener()}unbindAnimationEndListener(){this.animationEndListener&&this.mask&&(this.animationEndListener(),this.animationEndListener=null)}ngOnDestroy(){this.initialized=!1,this.visible&&this.modal&&this.destroyModal(),this.appendTo&&this.container&&this.renderer.appendChild(this.el.nativeElement,this.container),this.container&&this.autoZIndex&&L.clear(this.container),this.container=null,this.unbindGlobalListeners(),this.unbindAnimationEndListener()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=Y(t)))(i||t)}})();static \u0275cmp=B({type:t,selectors:[["p-drawer"]],contentQueries:function(n,i,r){if(n&1&&(U(r,Et,4),U(r,Ut,4),U(r,Ft,4),U(r,Vt,4),U(r,Pt,4),U(r,$e,4)),n&2){let c;y(c=v())&&(i.headerTemplate=c.first),y(c=v())&&(i.footerTemplate=c.first),y(c=v())&&(i.contentTemplate=c.first),y(c=v())&&(i.closeIconTemplate=c.first),y(c=v())&&(i.headlessTemplate=c.first),y(c=v())&&(i.templates=c)}},viewQuery:function(n,i){if(n&1&&(Q(Rt,5),Q(Lt,5),Q(Mt,5)),n&2){let r;y(r=v())&&(i.maskRef=r.first),y(r=v())&&(i.containerViewChild=r.first),y(r=v())&&(i.closeButtonViewChild=r.first)}},inputs:{appendTo:"appendTo",blockScroll:[2,"blockScroll","blockScroll",T],style:"style",styleClass:"styleClass",ariaCloseLabel:"ariaCloseLabel",autoZIndex:[2,"autoZIndex","autoZIndex",T],baseZIndex:[2,"baseZIndex","baseZIndex",Fe],modal:[2,"modal","modal",T],closeButtonProps:"closeButtonProps",dismissible:[2,"dismissible","dismissible",T],showCloseIcon:[2,"showCloseIcon","showCloseIcon",T],closeOnEscape:[2,"closeOnEscape","closeOnEscape",T],transitionOptions:"transitionOptions",visible:"visible",position:"position",fullScreen:"fullScreen",header:"header",maskStyle:"maskStyle",closable:[2,"closable","closable",T]},outputs:{onShow:"onShow",onHide:"onHide",visibleChange:"visibleChange"},features:[z([vt]),H],ngContentSelectors:Ot,decls:1,vars:1,consts:[["container",""],["icon",""],["role","complementary",3,"ngClass","style","class","keydown",4,"ngIf"],["role","complementary",3,"keydown","ngClass"],[4,"ngTemplateOutlet"],[3,"ngClass"],[3,"class",4,"ngIf"],[3,"ngClass","buttonProps","ariaLabel","onClick","keydown.enter",4,"ngIf"],[4,"ngIf"],[3,"onClick","keydown.enter","ngClass","buttonProps","ariaLabel"]],template:function(n,i){n&1&&(ve(),_(0,ei,4,21,"div",2)),n&2&&s("ngIf",i.visible)},dependencies:[q,G,j,Pe,$,Je,Z],encapsulation:2,data:{animation:[Oe("panelState",[pe("void => visible",[me(ri)]),pe("visible => void",[me(oi)])])]},changeDetection:0})}return t})(),kt=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=be({type:t});static \u0275inj=we({imports:[he,Z,Z]})}return t})();var si=["class","page"],St=t=>({"ng-invalid ng-dirty":t}),li=()=>({height:"calc(100vh - 70px)"}),pi=t=>({groupID:t});function ci(t,o){if(t&1){let e=S();p(0,"p-button",21),b("onClick",function(){d(e);let i=l(2);return u(i.onDeleteUser())}),m()}}function mi(t,o){if(t&1){let e=S();p(0,"p-button",22),b("onClick",function(){d(e);let i=l(2);return u(i.onHandleDrawer())}),m()}}function di(t,o){if(t&1&&(p(0,"div",18),_(1,ci,1,0,"p-button",19)(2,mi,1,0,"p-button",20),m()),t&2){let e=l();a(),s("ngIf",e.store.hasCheckedRows()),a(),s("ngIf",e.roleService.user.create)}}function ui(t,o){t&1&&(p(0,"th",26),k(1,"p-tableHeaderCheckbox"),m())}function _i(t,o){if(t&1&&(p(0,"tr"),_(1,ui,2,0,"th",25),p(2,"th"),g(3,"LoginID"),m(),p(4,"th"),g(5,"Group"),m()()),t&2){let e=l(2);a(),s("ngIf",e.roleService.user.delete)}}function fi(t,o){t&1&&E(0)}function hi(t,o){if(t&1&&k(0,"p-tableCheckbox",32),t&2){let e=l(3).$implicit;s("value",e)}}function gi(t,o){if(t&1&&_(0,hi,1,1,"p-tableCheckbox",31),t&2){let e=l(4);s("ngIf",e.roleService.user.delete)}}function wi(t,o){if(t&1&&(p(0,"td"),_(1,fi,1,0,"ng-container",30)(2,gi,1,1,"ng-template",null,7,x),m()),t&2){let e=Se(3),n=l().$implicit,i=l(2);a(),s("ngIf",i.roleService.user.delete&&n.userName===i.currentUser())("ngIfElse",e)}}function bi(t,o){if(t&1){let e=S();p(0,"tr"),_(1,wi,4,2,"td",27),p(2,"td")(3,"button",28),b("click",function(){let i=d(e).$implicit,r=l(2);return u(r.onEditUser(i))}),g(4),m()(),p(5,"td")(6,"a",29),g(7),m()()()}if(t&2){let e=o.$implicit,n=l(2);a(),s("ngIf",n.roleService.user.delete),a(2),s("disabled",!n.roleService.user.edit),a(),Te(" ",e.userName," "),a(2),s("queryParams",V(5,pi,e.groupID)),a(),F(e.groupName)}}function xi(t,o){if(t&1&&g(0),t&2){let e=l(2);Ie(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.count()," entries ")}}function Ci(t,o){t&1&&(p(0,"tr")(1,"td",33)(2,"span"),g(3,"No users found. Try adjusting your filters or add a new user."),m()()())}function yi(t,o){if(t&1){let e=S();p(0,"p-panel")(1,"div",23),k(2,"app-user-tabs"),p(3,"p-table",24),b("onPage",function(i){d(e);let r=l();return u(r.onPageChange(i))})("onRowSelect",function(i){d(e);let r=l();return u(r.onRowSelect(i))})("onRowUnselect",function(i){d(e);let r=l();return u(r.onRowUnselect(i))})("onHeaderCheckboxToggle",function(i){d(e);let r=l();return u(r.onHeaderCheckboxToggle(i))}),_(4,_i,6,1,"ng-template",null,3,x)(6,bi,8,7,"ng-template",null,4,x)(8,xi,1,3,"ng-template",null,5,x)(10,Ci,4,0,"ng-template",null,6,x),m()()()}if(t&2){let e=l();N(De(9,li)),a(3),s("value",e.store.data())("lazy",!0)("paginator",!0)("scrollable",!0)("scrollHeight","calc(100vh - 200px)")("rows",e.store.filter().pageSize)("totalRecords",e.store.count())}}function vi(t,o){if(t&1&&(p(0,"div",34)(1,"div",16)(2,"div",35)(3,"label",36),g(4,"Group"),m(),k(5,"p-select",37),m()()()),t&2){let e=l();s("formGroup",e.forms.filterForm),a(5),s("showClear",!0)("options",e.store.meta().options.groups)}}function ki(t,o){if(t&1&&(p(0,"span",38),g(1),m()),t&2){let e=l();a(),F(e.store.hasCheckedRows()?"Edit User":"Invite User")}}function Si(t,o){if(t&1&&(p(0,"small",14),g(1),m()),t&2){let e=o.$implicit;a(),F(e)}}function Ti(t,o){if(t&1&&(p(0,"small",14),g(1),m()),t&2){let e=o.$implicit;a(),F(e)}}var Pn=(()=>{class t extends bt{ngOnInit(){this.generateForm()}constructor(){Ve(()=>{this.store.metaForm()&&this.generateForm()}),super(),this.store=C(fe),this.fb=C(Qe),this.userService=C(J),this.isLoading=R(!1),this.form=null,this.isDrawerOpen=R(!1),this.router=C(Le),this.route=C(Re),this.isDialogFilterVisible=R(!1),this.roleService=C(ot),this.currentUser=R(null),this.tabs=[{route:"/pages/users/users",label:"Users"},{route:"/pages/users/groups",label:"Groups"}]}ngAfterViewInit(){this.currentUser.set(localStorage.getItem("AUTH_USERNAME")||null)}onPageChange(e){this.store.setFilter(h(f({},this.store.filter()),{pagination:e.first/e.rows+1}))}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(n=>{this.store.onRowUnselect(n)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}generateForm(){this.forms={filterForm:this.fb.group({pagination:this.fb.control(1),pageSize:this.fb.control(10),groupID:this.fb.control(null)}),userForm:this.fb.group({id:this.fb.control({value:this.store.metaForm().form.id,disabled:this.store.metaForm().form.id!==xt},[de.required]),groupID:this.fb.control(this.store.metaForm().form.groupID,[de.required])})}}onHandleDrawer(){this.isDrawerOpen.update(e=>!e),this.store.getUserFormMeta(this.route.snapshot.params.id||null)}onInviteUser(){if(this.forms.userForm.invalid){this.forms.userForm.markAllAsTouched();return}let e=null;this.store.hasCheckedRows()?(console.log(this.store.checkedData()),e={id:this.store.checkedData()[0],groupID:this.forms.userForm.value.groupID}):e=this.forms.userForm.getRawValue(),this.userService.inviteUser(e).pipe(_e("User invited successfully"),X(()=>{this.onHandleDrawer(),this.store.setFilter(f({},this.store.filter())),this.forms.userForm.reset()})).subscribe()}onSearch(e){this.store.setFilter(h(f({},this.store.filter()),{text:e,pagination:1}))}onOKFilter(){if(this.forms.filterForm.invalid){this.forms.filterForm.markAllAsTouched();return}let{groupID:e}=this.forms.filterForm.value;this.store.setFilter(h(f({},this.store.filter()),{groupID:e})),this.isDialogFilterVisible.update(n=>!n)}onEditUser(e){this.store.onRowSelect(e),this.store.getUserFormMeta(this.store.selectedID()),this.isDrawerOpen.update(n=>!n)}onHideDrawer(){this.store.onHeaderCheckboxToggle(!1)}onDeleteUser(){let e=this.store.checkedData();this.userService.deleteUser(e).pipe(_e("User(s) deleted successfully"),X(()=>{this.store.setFilter(f({},this.store.filter()))})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=B({type:t,selectors:[["app-user",8,"page"]],features:[z([fe]),H],attrs:si,decls:27,vars:14,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["showCheckbox",""],["pageTitle","User List",3,"search","isDialogFilterVisibleChange","filterConfirmed","isSearchableInput","isFilterable","isDialogFilterVisible"],["position","right",3,"visibleChange","onHide","visible"],[1,"row","py-3","row-gap-3",3,"formGroup"],[1,"col-12"],["for","",1,"m-0"],["fluid","","filter","","filterBy","name","formControlName","id","optionLabel","loginID","optionValue","id","placeholder","Select a User",3,"disabled","options","ngClass"],[1,"text-danger"],["filter","","filterBy","name","formControlName","groupID","optionLabel","name","optionValue","id","placeholder","Select a Group","fluid","",3,"options","ngClass"],[1,"col"],["label","Submit",3,"onClick"],[1,"d-flex","gap-2","flex-wrap"],["severity","danger","label","Delete","icon","fa-solid fa-trash",3,"onClick",4,"ngIf"],["label","Invite",3,"onClick",4,"ngIf"],["severity","danger","label","Delete","icon","fa-solid fa-trash",3,"onClick"],["label","Invite",3,"onClick"],[1,"d-flex","flex-column","gap-3","py-2"],["dataKey","userID",3,"onPage","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value","lazy","paginator","scrollable","scrollHeight","rows","totalRecords"],["style","width: 4rem",4,"ngIf"],[2,"width","4rem"],[4,"ngIf"],[1,"btn","btn-link","fw-light","text-primary","p-0",2,"text-decoration","none",3,"click","disabled"],["routerLink","/pages/users/groups/forms",1,"link","link-primary",3,"queryParams"],[4,"ngIf","ngIfElse"],[3,"value",4,"ngIf"],[3,"value"],["colspan","3"],[1,"row",3,"formGroup"],[1,"d-flex","flex-column"],["for",""],["appendTo","body","formControlName","groupID","optionValue","id","optionLabel","name","placeholder","Select a Group",3,"showClear","options"],[1,"fs-5"]],template:function(n,i){if(n&1){let r=S();p(0,"app-main-panel",8),b("search",function(w){return d(r),u(i.onSearch(w))}),ae("isDialogFilterVisibleChange",function(w){return d(r),oe(i.isDialogFilterVisible,w)||(i.isDialogFilterVisible=w),u(w)}),b("filterConfirmed",function(){return d(r),u(i.onOKFilter())}),_(1,di,3,2,"ng-template",null,0,x)(3,yi,12,10,"ng-template",null,1,x)(5,vi,6,3,"ng-template",null,2,x),m(),p(7,"p-drawer",9),ae("visibleChange",function(w){return d(r),oe(i.isDrawerOpen,w)||(i.isDrawerOpen=w),u(w)}),b("onHide",function(){return d(r),u(i.onHideDrawer())}),_(8,ki,2,1,"ng-template",null,3,x),p(10,"div",10)(11,"div",11)(12,"div")(13,"label",12),g(14,"Users"),m(),k(15,"p-select",13),ie(16,Si,2,1,"small",14,te),m()(),p(18,"div",11)(19,"div")(20,"label",12),g(21,"Groups"),m(),k(22,"p-select",15),ie(23,Ti,2,1,"small",14,te),m()(),p(25,"div",16)(26,"p-button",17),b("onClick",function(){return d(r),u(i.onInviteUser())}),m()()()()}n&2&&(s("isSearchableInput",!0)("isFilterable",!0),re("isDialogFilterVisible",i.isDialogFilterVisible),a(7),re("visible",i.isDrawerOpen),a(3),s("formGroup",i.forms.userForm),a(5),s("disabled",i.store.hasCheckedRows())("options",i.store.metaForm().options.users)("ngClass",V(10,St,i.isInvalid("id","userForm"))),a(),ne(i.getErrors("id","userForm")),a(6),s("options",i.store.metaForm().options.groups)("ngClass",V(12,St,i.isInvalid("groupID","userForm"))),a(),ne(i.getErrors("id","userForm")))},dependencies:[dt,q,G,j,wt,ft,ht,gt,it,$,kt,he,ze,Ae,Be,He,Ne,et,Xe,Ye,tt,_t,ut,Ct,rt,nt,yt,Me],styles:['[_nghost-%COMP%]{display:block} .p-tabs .p-tab{padding:"1rem 1.125rem"!important} .p-panel .p-panel-header{display:none!important}'],changeDetection:0})}}return t})();export{Pn as UserPageComponent};
|
|
202
|
+
`,ii={mask:({instance:t})=>({position:"fixed",height:"100%",width:"100%",left:0,top:0,display:"flex",flexDirection:"column",alignItems:t.position==="top"?"flex-start":t.position==="bottom"?"flex-end":"center"})},ni={mask:({instance:t})=>({"p-drawer-mask":!0,"p-overlay-mask p-overlay-mask-enter":t.modal,"p-drawer-open":t.containerVisible,"p-drawer-full":t.fullScreen,[`p-drawer-${t.position}`]:!!t.position}),root:({instance:t})=>({"p-drawer p-component":!0,"p-drawer-full":t.fullScreen}),header:"p-drawer-header",title:"p-drawer-title",pcCloseButton:"p-drawer-close-button",content:"p-drawer-content",footer:"p-drawer-footer"},vt=(()=>{class t extends We{name="drawer";theme=ti;classes=ni;inlineStyles=ii;static \u0275fac=(()=>{let e;return function(i){return(e||(e=Y(t)))(i||t)}})();static \u0275prov=ge({token:t,factory:t.\u0275fac})}return t})();var ri=ce([le({transform:"{{transform}}",opacity:0}),se("{{transition}}")]),oi=ce([se("{{transition}}",le({transform:"{{transform}}",opacity:0}))]),he=(()=>{class t extends Ke{appendTo="body";blockScroll=!1;style;styleClass;ariaCloseLabel;autoZIndex=!0;baseZIndex=0;modal=!0;closeButtonProps={severity:"secondary",text:!0,rounded:!0};dismissible=!0;showCloseIcon=!0;closeOnEscape=!0;transitionOptions="150ms cubic-bezier(0, 0, 0.2, 1)";get visible(){return this._visible}set visible(e){this._visible=e}get position(){return this._position}set position(e){if(this._position=e,e==="full"){this.transformOptions="none";return}switch(e){case"left":this.transformOptions="translate3d(-100%, 0px, 0px)";break;case"right":this.transformOptions="translate3d(100%, 0px, 0px)";break;case"bottom":this.transformOptions="translate3d(0px, 100%, 0px)";break;case"top":this.transformOptions="translate3d(0px, -100%, 0px)";break}}get fullScreen(){return this._fullScreen}set fullScreen(e){this._fullScreen=e,e&&(this.transformOptions="none")}header;maskStyle;closable=!0;onShow=new A;onHide=new A;visibleChange=new A;maskRef;containerViewChild;closeButtonViewChild;initialized;_visible;_position="left";_fullScreen=!1;container;transformOptions="translate3d(-100%, 0px, 0px)";mask;maskClickListener;documentEscapeListener;animationEndListener;_componentStyle=C(vt);ngAfterViewInit(){super.ngAfterViewInit(),this.initialized=!0}headerTemplate;footerTemplate;contentTemplate;closeIconTemplate;headlessTemplate;_headerTemplate;_footerTemplate;_contentTemplate;_closeIconTemplate;_headlessTemplate;templates;ngAfterContentInit(){this.templates?.forEach(e=>{switch(e.getType()){case"content":this._contentTemplate=e.template;break;case"header":this._headerTemplate=e.template;break;case"footer":this._footerTemplate=e.template;break;case"closeicon":this._closeIconTemplate=e.template;break;case"headless":this._headlessTemplate=e.template;break;default:this._contentTemplate=e.template;break}})}onKeyDown(e){e.code==="Escape"&&this.hide(!1)}show(){this.container.setAttribute(this.attrSelector,""),this.autoZIndex&&L.set("modal",this.container,this.baseZIndex||this.config.zIndex.modal),this.modal&&this.enableModality(),this.onShow.emit({}),this.visibleChange.emit(!0)}hide(e=!0){e&&this.onHide.emit({}),this.modal&&this.disableModality()}close(e){this.hide(),this.visibleChange.emit(!1),e.preventDefault()}enableModality(){let e=this.document.querySelectorAll(".p-drawer-active"),n=e.length,i=n==1?String(parseInt(this.container.style.zIndex)-1):String(parseInt(e[n-1].style.zIndex)-1);this.mask||(this.mask=this.renderer.createElement("div"),this.renderer.setStyle(this.mask,"zIndex",i),Ze(this.mask,"style",this.maskStyle),ue(this.mask,"p-overlay-mask p-drawer-mask p-overlay-mask-enter"),this.dismissible&&(this.maskClickListener=this.renderer.listen(this.mask,"click",r=>{this.dismissible&&this.close(r)})),this.renderer.appendChild(this.document.body,this.mask),this.blockScroll&&Ge())}disableModality(){this.mask&&(ue(this.mask,"p-overlay-mask-leave"),this.animationEndListener=this.renderer.listen(this.mask,"animationend",this.destroyModal.bind(this)))}destroyModal(){this.unbindMaskClickListener(),this.mask&&this.renderer.removeChild(this.document.body,this.mask),this.blockScroll&&je(),this.unbindAnimationEndListener(),this.mask=null}onAnimationStart(e){switch(e.toState){case"visible":this.container=e.element,this.appendContainer(),this.show(),this.closeOnEscape&&this.bindDocumentEscapeListener();break}}onAnimationEnd(e){switch(e.toState){case"void":this.hide(!1),L.clear(this.container),this.unbindGlobalListeners();break}}appendContainer(){this.appendTo&&(this.appendTo==="body"?this.renderer.appendChild(this.document.body,this.container):qe(this.appendTo,this.container))}bindDocumentEscapeListener(){let e=this.el?this.el.nativeElement.ownerDocument:this.document;this.documentEscapeListener=this.renderer.listen(e,"keydown",n=>{n.which==27&&parseInt(this.container.style.zIndex)===L.get(this.container)&&this.close(n)})}unbindDocumentEscapeListener(){this.documentEscapeListener&&(this.documentEscapeListener(),this.documentEscapeListener=null)}unbindMaskClickListener(){this.maskClickListener&&(this.maskClickListener(),this.maskClickListener=null)}unbindGlobalListeners(){this.unbindMaskClickListener(),this.unbindDocumentEscapeListener()}unbindAnimationEndListener(){this.animationEndListener&&this.mask&&(this.animationEndListener(),this.animationEndListener=null)}ngOnDestroy(){this.initialized=!1,this.visible&&this.modal&&this.destroyModal(),this.appendTo&&this.container&&this.renderer.appendChild(this.el.nativeElement,this.container),this.container&&this.autoZIndex&&L.clear(this.container),this.container=null,this.unbindGlobalListeners(),this.unbindAnimationEndListener()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=Y(t)))(i||t)}})();static \u0275cmp=B({type:t,selectors:[["p-drawer"]],contentQueries:function(n,i,r){if(n&1&&(U(r,Et,4),U(r,Ut,4),U(r,Ft,4),U(r,Vt,4),U(r,Pt,4),U(r,$e,4)),n&2){let c;y(c=v())&&(i.headerTemplate=c.first),y(c=v())&&(i.footerTemplate=c.first),y(c=v())&&(i.contentTemplate=c.first),y(c=v())&&(i.closeIconTemplate=c.first),y(c=v())&&(i.headlessTemplate=c.first),y(c=v())&&(i.templates=c)}},viewQuery:function(n,i){if(n&1&&(Q(Rt,5),Q(Lt,5),Q(Mt,5)),n&2){let r;y(r=v())&&(i.maskRef=r.first),y(r=v())&&(i.containerViewChild=r.first),y(r=v())&&(i.closeButtonViewChild=r.first)}},inputs:{appendTo:"appendTo",blockScroll:[2,"blockScroll","blockScroll",T],style:"style",styleClass:"styleClass",ariaCloseLabel:"ariaCloseLabel",autoZIndex:[2,"autoZIndex","autoZIndex",T],baseZIndex:[2,"baseZIndex","baseZIndex",Fe],modal:[2,"modal","modal",T],closeButtonProps:"closeButtonProps",dismissible:[2,"dismissible","dismissible",T],showCloseIcon:[2,"showCloseIcon","showCloseIcon",T],closeOnEscape:[2,"closeOnEscape","closeOnEscape",T],transitionOptions:"transitionOptions",visible:"visible",position:"position",fullScreen:"fullScreen",header:"header",maskStyle:"maskStyle",closable:[2,"closable","closable",T]},outputs:{onShow:"onShow",onHide:"onHide",visibleChange:"visibleChange"},features:[z([vt]),H],ngContentSelectors:Ot,decls:1,vars:1,consts:[["container",""],["icon",""],["role","complementary",3,"ngClass","style","class","keydown",4,"ngIf"],["role","complementary",3,"keydown","ngClass"],[4,"ngTemplateOutlet"],[3,"ngClass"],[3,"class",4,"ngIf"],[3,"ngClass","buttonProps","ariaLabel","onClick","keydown.enter",4,"ngIf"],[4,"ngIf"],[3,"onClick","keydown.enter","ngClass","buttonProps","ariaLabel"]],template:function(n,i){n&1&&(ve(),_(0,ei,4,21,"div",2)),n&2&&s("ngIf",i.visible)},dependencies:[q,G,j,Pe,$,Je,Z],encapsulation:2,data:{animation:[Oe("panelState",[pe("void => visible",[me(ri)]),pe("visible => void",[me(oi)])])]},changeDetection:0})}return t})(),kt=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=be({type:t});static \u0275inj=we({imports:[he,Z,Z]})}return t})();var si=["class","page"],St=t=>({"ng-invalid ng-dirty":t}),li=()=>({height:"calc(100vh - 70px)"}),pi=t=>({groupID:t});function ci(t,o){if(t&1){let e=S();p(0,"p-button",21),b("onClick",function(){d(e);let i=l(2);return u(i.onDeleteUser())}),m()}}function mi(t,o){if(t&1){let e=S();p(0,"p-button",22),b("onClick",function(){d(e);let i=l(2);return u(i.onHandleDrawer())}),m()}}function di(t,o){if(t&1&&(p(0,"div",18),_(1,ci,1,0,"p-button",19)(2,mi,1,0,"p-button",20),m()),t&2){let e=l();a(),s("ngIf",e.store.hasCheckedRows()),a(),s("ngIf",e.roleService.user.create)}}function ui(t,o){t&1&&(p(0,"th",26),k(1,"p-tableHeaderCheckbox"),m())}function _i(t,o){if(t&1&&(p(0,"tr"),_(1,ui,2,0,"th",25),p(2,"th"),g(3,"LoginID"),m(),p(4,"th"),g(5,"Group"),m()()),t&2){let e=l(2);a(),s("ngIf",e.roleService.user.delete)}}function fi(t,o){t&1&&E(0)}function hi(t,o){if(t&1&&k(0,"p-tableCheckbox",32),t&2){let e=l(3).$implicit;s("value",e)}}function gi(t,o){if(t&1&&_(0,hi,1,1,"p-tableCheckbox",31),t&2){let e=l(4);s("ngIf",e.roleService.user.delete)}}function wi(t,o){if(t&1&&(p(0,"td"),_(1,fi,1,0,"ng-container",30)(2,gi,1,1,"ng-template",null,7,x),m()),t&2){let e=Se(3),n=l().$implicit,i=l(2);a(),s("ngIf",i.roleService.user.delete&&n.userName===i.currentUser())("ngIfElse",e)}}function bi(t,o){if(t&1){let e=S();p(0,"tr"),_(1,wi,4,2,"td",27),p(2,"td")(3,"button",28),b("click",function(){let i=d(e).$implicit,r=l(2);return u(r.onEditUser(i))}),g(4),m()(),p(5,"td")(6,"a",29),g(7),m()()()}if(t&2){let e=o.$implicit,n=l(2);a(),s("ngIf",n.roleService.user.delete),a(2),s("disabled",!n.roleService.user.edit),a(),Te(" ",e.userName||e.userID," "),a(2),s("queryParams",V(5,pi,e.groupID)),a(),F(e.groupName)}}function xi(t,o){if(t&1&&g(0),t&2){let e=l(2);Ie(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.count()," entries ")}}function Ci(t,o){t&1&&(p(0,"tr")(1,"td",33)(2,"span"),g(3,"No users found. Try adjusting your filters or add a new user."),m()()())}function yi(t,o){if(t&1){let e=S();p(0,"p-panel")(1,"div",23),k(2,"app-user-tabs"),p(3,"p-table",24),b("onPage",function(i){d(e);let r=l();return u(r.onPageChange(i))})("onRowSelect",function(i){d(e);let r=l();return u(r.onRowSelect(i))})("onRowUnselect",function(i){d(e);let r=l();return u(r.onRowUnselect(i))})("onHeaderCheckboxToggle",function(i){d(e);let r=l();return u(r.onHeaderCheckboxToggle(i))}),_(4,_i,6,1,"ng-template",null,3,x)(6,bi,8,7,"ng-template",null,4,x)(8,xi,1,3,"ng-template",null,5,x)(10,Ci,4,0,"ng-template",null,6,x),m()()()}if(t&2){let e=l();N(De(9,li)),a(3),s("value",e.store.data())("lazy",!0)("paginator",!0)("scrollable",!0)("scrollHeight","calc(100vh - 200px)")("rows",e.store.filter().pageSize)("totalRecords",e.store.count())}}function vi(t,o){if(t&1&&(p(0,"div",34)(1,"div",16)(2,"div",35)(3,"label",36),g(4,"Group"),m(),k(5,"p-select",37),m()()()),t&2){let e=l();s("formGroup",e.forms.filterForm),a(5),s("showClear",!0)("options",e.store.meta().options.groups)}}function ki(t,o){if(t&1&&(p(0,"span",38),g(1),m()),t&2){let e=l();a(),F(e.store.hasCheckedRows()?"Edit User":"Invite User")}}function Si(t,o){if(t&1&&(p(0,"small",14),g(1),m()),t&2){let e=o.$implicit;a(),F(e)}}function Ti(t,o){if(t&1&&(p(0,"small",14),g(1),m()),t&2){let e=o.$implicit;a(),F(e)}}var Pn=(()=>{class t extends bt{ngOnInit(){this.generateForm()}constructor(){Ve(()=>{this.store.metaForm()&&this.generateForm()}),super(),this.store=C(fe),this.fb=C(Qe),this.userService=C(J),this.isLoading=R(!1),this.form=null,this.isDrawerOpen=R(!1),this.router=C(Le),this.route=C(Re),this.isDialogFilterVisible=R(!1),this.roleService=C(ot),this.currentUser=R(null),this.tabs=[{route:"/pages/users/users",label:"Users"},{route:"/pages/users/groups",label:"Groups"}]}ngAfterViewInit(){this.currentUser.set(localStorage.getItem("AUTH_USERNAME")||null)}onPageChange(e){this.store.setFilter(h(f({},this.store.filter()),{pagination:e.first/e.rows+1}))}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(n=>{this.store.onRowUnselect(n)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}generateForm(){this.forms={filterForm:this.fb.group({pagination:this.fb.control(1),pageSize:this.fb.control(10),groupID:this.fb.control(null)}),userForm:this.fb.group({id:this.fb.control({value:this.store.metaForm().form.id,disabled:this.store.metaForm().form.id!==xt},[de.required]),groupID:this.fb.control(this.store.metaForm().form.groupID,[de.required])})}}onHandleDrawer(){this.isDrawerOpen.update(e=>!e),this.store.getUserFormMeta(this.route.snapshot.params.id||null)}onInviteUser(){if(this.forms.userForm.invalid){this.forms.userForm.markAllAsTouched();return}let e=null;this.store.hasCheckedRows()?(console.log(this.store.checkedData()),e={id:this.store.checkedData()[0],groupID:this.forms.userForm.value.groupID}):e=this.forms.userForm.getRawValue(),this.userService.inviteUser(e).pipe(_e("User invited successfully"),X(()=>{this.onHandleDrawer(),this.store.setFilter(f({},this.store.filter())),this.forms.userForm.reset()})).subscribe()}onSearch(e){this.store.setFilter(h(f({},this.store.filter()),{text:e,pagination:1}))}onOKFilter(){if(this.forms.filterForm.invalid){this.forms.filterForm.markAllAsTouched();return}let{groupID:e}=this.forms.filterForm.value;this.store.setFilter(h(f({},this.store.filter()),{groupID:e})),this.isDialogFilterVisible.update(n=>!n)}onEditUser(e){this.store.onRowSelect(e),this.store.getUserFormMeta(this.store.selectedID()),this.isDrawerOpen.update(n=>!n)}onHideDrawer(){this.store.onHeaderCheckboxToggle(!1)}onDeleteUser(){let e=this.store.checkedData();this.userService.deleteUser(e).pipe(_e("User(s) deleted successfully"),X(()=>{this.store.setFilter(f({},this.store.filter()))})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=B({type:t,selectors:[["app-user",8,"page"]],features:[z([fe]),H],attrs:si,decls:27,vars:14,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["showCheckbox",""],["pageTitle","User List",3,"search","isDialogFilterVisibleChange","filterConfirmed","isSearchableInput","isFilterable","isDialogFilterVisible"],["position","right",3,"visibleChange","onHide","visible"],[1,"row","py-3","row-gap-3",3,"formGroup"],[1,"col-12"],["for","",1,"m-0"],["fluid","","filter","","filterBy","name","formControlName","id","optionLabel","loginID","optionValue","id","placeholder","Select a User",3,"disabled","options","ngClass"],[1,"text-danger"],["filter","","filterBy","name","formControlName","groupID","optionLabel","name","optionValue","id","placeholder","Select a Group","fluid","",3,"options","ngClass"],[1,"col"],["label","Submit",3,"onClick"],[1,"d-flex","gap-2","flex-wrap"],["severity","danger","label","Delete","icon","fa-solid fa-trash",3,"onClick",4,"ngIf"],["label","Invite",3,"onClick",4,"ngIf"],["severity","danger","label","Delete","icon","fa-solid fa-trash",3,"onClick"],["label","Invite",3,"onClick"],[1,"d-flex","flex-column","gap-3","py-2"],["dataKey","userID",3,"onPage","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value","lazy","paginator","scrollable","scrollHeight","rows","totalRecords"],["style","width: 4rem",4,"ngIf"],[2,"width","4rem"],[4,"ngIf"],[1,"btn","btn-link","fw-light","text-primary","p-0",2,"text-decoration","none",3,"click","disabled"],["routerLink","/pages/users/groups/forms",1,"link","link-primary",3,"queryParams"],[4,"ngIf","ngIfElse"],[3,"value",4,"ngIf"],[3,"value"],["colspan","3"],[1,"row",3,"formGroup"],[1,"d-flex","flex-column"],["for",""],["appendTo","body","formControlName","groupID","optionValue","id","optionLabel","name","placeholder","Select a Group",3,"showClear","options"],[1,"fs-5"]],template:function(n,i){if(n&1){let r=S();p(0,"app-main-panel",8),b("search",function(w){return d(r),u(i.onSearch(w))}),ae("isDialogFilterVisibleChange",function(w){return d(r),oe(i.isDialogFilterVisible,w)||(i.isDialogFilterVisible=w),u(w)}),b("filterConfirmed",function(){return d(r),u(i.onOKFilter())}),_(1,di,3,2,"ng-template",null,0,x)(3,yi,12,10,"ng-template",null,1,x)(5,vi,6,3,"ng-template",null,2,x),m(),p(7,"p-drawer",9),ae("visibleChange",function(w){return d(r),oe(i.isDrawerOpen,w)||(i.isDrawerOpen=w),u(w)}),b("onHide",function(){return d(r),u(i.onHideDrawer())}),_(8,ki,2,1,"ng-template",null,3,x),p(10,"div",10)(11,"div",11)(12,"div")(13,"label",12),g(14,"Users"),m(),k(15,"p-select",13),ie(16,Si,2,1,"small",14,te),m()(),p(18,"div",11)(19,"div")(20,"label",12),g(21,"Groups"),m(),k(22,"p-select",15),ie(23,Ti,2,1,"small",14,te),m()(),p(25,"div",16)(26,"p-button",17),b("onClick",function(){return d(r),u(i.onInviteUser())}),m()()()()}n&2&&(s("isSearchableInput",!0)("isFilterable",!0),re("isDialogFilterVisible",i.isDialogFilterVisible),a(7),re("visible",i.isDrawerOpen),a(3),s("formGroup",i.forms.userForm),a(5),s("disabled",i.store.hasCheckedRows())("options",i.store.metaForm().options.users)("ngClass",V(10,St,i.isInvalid("id","userForm"))),a(),ne(i.getErrors("id","userForm")),a(6),s("options",i.store.metaForm().options.groups)("ngClass",V(12,St,i.isInvalid("groupID","userForm"))),a(),ne(i.getErrors("id","userForm")))},dependencies:[dt,q,G,j,wt,ft,ht,gt,it,$,kt,he,ze,Ae,Be,He,Ne,et,Xe,Ye,tt,_t,ut,Ct,rt,nt,yt,Me],styles:['[_nghost-%COMP%]{display:block} .p-tabs .p-tab{padding:"1rem 1.125rem"!important} .p-panel .p-panel-header{display:none!important}'],changeDetection:0})}}return t})();export{Pn as UserPageComponent};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{a as Le,b as Ve}from"./chunk-HHJMN4BS.js";import{a as vt,b as be}from"./chunk-MPFBVM6S.js";import"./chunk-6ATDYFCA.js";import{a as Re}from"./chunk-AGLKA7OG.js";import{b as St,c as Ct,d as yt}from"./chunk-KJ6CKUEI.js";import{a as ye,b as ve}from"./chunk-YRCXWYJC.js";import"./chunk-YOUPD27G.js";import{b as xt}from"./chunk-YO23YVSC.js";import"./chunk-AZUQDRJU.js";import{a as me}from"./chunk-6ACYDH2N.js";import"./chunk-C2GO6SPF.js";import{a as q,b as H}from"./chunk-O4QM64EH.js";import{a as ft,b as gt,d as Se,k as Ce}from"./chunk-EW3R2HAB.js";import{a as he,b as xe}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import{a as ht}from"./chunk-RPPLUBX5.js";import{a as Ie}from"./chunk-XKCLERWG.js";import{a as oe,b as we}from"./chunk-4LGDNQMZ.js";import"./chunk-PKN47FQE.js";import{b as Te}from"./chunk-LRRVQSMI.js";import"./chunk-42UIGXWH.js";import"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import{d as dt}from"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{b as ge}from"./chunk-5R3XKSDM.js";import{f as _t,h as fe}from"./chunk-AWXT2WGR.js";import"./chunk-C7LM5UCK.js";import{a as le,b as pe}from"./chunk-J4XRJAME.js";import{a as V,b as ce,c as se,d as de,e as ue,f as _e,g as ut}from"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{w as re,x as ae}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{e as Q,f as Z,g as ct,i as G,k as ee,l as te,o as ie,t as st,v as De,y as ne}from"./chunk-FMVCTBCQ.js";import{a as mt}from"./chunk-ZGXJEG37.js";import{a as pt}from"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{D as lt,G as X,N as J,f as z,k as ot,l as U,m as $,r as rt,s as at}from"./chunk-B63BKC6F.js";import{Ac as I,Cb as x,D as Fe,Ga as T,Jc as S,Kb as c,Kc as C,L as Xe,Lc as it,Mc as s,Nb as j,Pb as O,Qb as ke,Sb as Be,Tb as Oe,Ub as n,V as Je,Vb as i,W as Qe,Wb as L,X as P,Yc as w,Z as M,Zc as nt,_b as R,ba as Ze,c as A,cb as et,dc as F,ec as d,gb as l,ha as g,hc as tt,pa as v,qa as b,qc as a,rc as _,s as $e,sc as D,vc as Y,wb as k,wc as N,xc as W,yc as K,zc as E}from"./chunk-JP6RBSB3.js";import{a as h,b as y,c as Me,e as Ue}from"./chunk-YQFG5XE2.js";var B=(()=>{class t{constructor(){this.httpService=g(mt),this.authService=g(Re)}fetchGeneralLedgerLoader(){return this.httpService.get(void 0,"api/GeneralLedgerLoader/GetFilter")}fetchGeneralLedgerReport(e){return this.httpService.post(void 0,"api/GeneralLedger/Get",e)}exportGeneralLedger(e){let o={responseType:"blob"};return this.httpService.post(void 0,"/api/GeneralLedgerExport/GetGeneralLedgerExport",e,o)}getCustomerSuggestions(e){let o={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/API/AC/GetCustomerSuggestion",{params:o})}getSupplierSuggestions(e){let o={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/API/AC/GetSupplierSuggestion",{params:o})}getCashierSuggestions(e){let o={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/api/ac/GetUserSuggestion",{params:o})}getBalanceSheetLoader(){return this.httpService.get(void 0,"/api/BalanceSheetLoader/GetBalanceSheet")}getBalanceSheet(e,o={}){let r=new at({fromObject:Object.fromEntries(Object.entries(e).map(([u,At])=>[u,String(At)]))}),m=new rt({"X-Timeout":"50000","X-Retry":"3","X-Retry-Delay":"2000","X-Exponential-Backoff":"true","X-Retry-On-500":"true","X-Retry-On-500-Message":"timeout expired"}),f=h({params:r,headers:m},o);return this.httpService.get(void 0,"/api/BalanceSheet",f)}getIncomeStatementLoader(){return this.httpService.get(void 0,"api/IncomeStatementLoader/Filter")}getIncomeStatement(e,o={}){return this.httpService.post(void 0,"api/IncomeStatement/List",h({},e),o)}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275prov=Ze({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Pt={metadata:{filter:{listAccountID:[],from:null,to:null,listOutletID:[],listCategoryID:[],contactType:0,contactID:""},options:{accounts:[],outlets:[],contactTypeOptions:[]},roles:{isInEmptyOutletRole:!1}},items:{data:[],pageTitle:""},filter:{listAccountID:[],from:null,to:null,listOutletID:[],listCategoryID:[],contactType:1,contactID:null}},Ge=ce(_e(Pt),ut("General Ledger Store"),se(t=>({debitTotal:w(()=>t.items.data().reduce((p,e)=>p+e.data.reduce((o,r)=>o+(r.debitAmount||0),0),0)),creditTotal:w(()=>t.items.data().reduce((p,e)=>p+e.data.reduce((o,r)=>o+(r.creditAmount||0),0),0))})),ue(t=>{let p=g(B),e={updateFilter:o=>{V(t,r=>y(h({},r),{filter:o}))},loadList:q(A(Fe(o=>o.listAccountID.length>0),P(o=>p.fetchGeneralLedgerReport(o).pipe(H({next:r=>{V(t,m=>y(h({},m),{items:r}))},error:r=>{console.error(r)}}))))),loadLoader:q(A(P(()=>p.fetchGeneralLedgerLoader().pipe(H({next:o=>{V(t,r=>y(h({},r),{metadata:o,filter:y(h({},r.filter),{listCategoryID:o.filter.listCategoryID})})),e.loadList(t.filter)},error:o=>{console.error(o)}})))))};return e}),de({onInit:t=>{t.loadLoader()}}));var qt=()=>({height:"calc(100vh - 70px)"}),Ht=()=>({height:"calc(100vh - 100px)"}),Yt=t=>["/pages/journal/journal-entry/",t],Wt=()=>({scrollHeight:"250px"});function Kt(t,p){if(t&1){let e=R();n(0,"p-button",14),F("onClick",function(){v(e);let r=d(2);return b(r.onExport())}),i()}}function zt(t,p){if(t&1&&(n(0,"div",11)(1,"a",12),a(2,"Return to Accounts"),i(),x(3,Kt,1,0,"p-button",13),i()),t&2){let e=d();l(3),c("ngIf",e.roleService.global.export)}}function Ut(t,p){if(t&1&&(n(0,"div",11)(1,"span",17)(2,"h2",18),a(3),i()(),n(4,"span",17)(5,"h2",18),a(6),i()()()),t&2){let e=d().$implicit;l(3),_(e.name),l(3),D(" (",e.chartOfAccountCode,") ")}}function $t(t,p){t&1&&(n(0,"tr")(1,"th",19),a(2,"Outlet"),i(),n(3,"th",19),a(4,"No."),i(),n(5,"th",19),a(6,"Date"),i(),n(7,"th",19),a(8,"Name"),i(),n(9,"th",19),a(10,"Description"),i(),n(11,"th",20),a(12,"Debit"),i(),n(13,"th",21),a(14,"Credit"),i(),n(15,"th",21),a(16,"Balance"),i()())}function Xt(t,p){if(t&1&&(n(0,"td",26),a(1,"Starting Balance"),i(),n(2,"td",27),a(3),S(4,"number"),i()),t&2){let e=d(2).$implicit;l(3),D(" ",C(4,1,e.startBalance)," ")}}function Jt(t,p){if(t&1&&(n(0,"tr"),x(1,Xt,5,3),i(),n(2,"tr")(3,"td",22),a(4),i(),n(5,"td",22)(6,"a",23),a(7),i()(),n(8,"td",22),a(9),S(10,"date"),i(),n(11,"td",22)(12,"a",24),a(13),i()(),L(14,"td"),n(15,"td",25),a(16),S(17,"number"),i(),n(18,"td",25),a(19),S(20,"number"),i(),n(21,"td",25),a(22),S(23,"number"),i()()),t&2){let e=p.$implicit,o=p.rowIndex,r=d(4);l(),O(o===0&&r.store.items().data.length>0?1:-1),l(3),_(e.outletName),l(2),c("routerLink",I(19,Yt,e.id)),l(),_(e.number),l(2),_(it(10,10,e.date,"dd MMM yyyy")),l(3),c("href",r.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.contactID,et),l(),_(e.contactName),l(3),D(" ",C(17,13,e.debitAmount)," "),l(3),D(" ",C(20,15,e.creditAmount)," "),l(3),_(C(23,17,e.balance))}}function Qt(t,p){if(t&1&&(n(0,"tr"),L(1,"td",28),n(2,"td",29),a(3,"Total"),i(),n(4,"td",29),a(5),S(6,"number"),i(),n(7,"td",29),a(8),S(9,"number"),i(),L(10,"td"),i()),t&2){let e=d().$index,o=d(3);l(5),D(" ",C(6,2,o.store.items().data[e].debitTotal)," "),l(3),D(" ",C(9,4,o.store.items().data[e].creditTotal)," ")}}function Zt(t,p){t&1&&(n(0,"tr")(1,"td",30)(2,"span"),a(3,"No records found."),i()()())}function ei(t,p){if(t&1&&(n(0,"p-table",16),x(1,Ut,7,2,"ng-template",null,3,s)(3,$t,17,0,"ng-template",null,4,s)(5,Jt,24,21,"ng-template",null,5,s)(7,Qt,11,6,"ng-template",null,6,s)(9,Zt,4,0,"ng-template",null,7,s),i()),t&2){let e=p.$implicit;c("value",e.data)("scrollable",!0)}}function ti(t,p){if(t&1&&(n(0,"p-panel")(1,"p-scroll-panel"),Be(2,ei,11,2,"p-table",16,ke),i()()),t&2){let e=d(2);j(E(4,qt)),l(),j(E(5,Ht)),l(),Oe(e.store.items().data)}}function ii(t,p){if(t&1&&x(0,ti,4,6,"p-panel",15),t&2){let e=d();c("ngIf",e.store.items()&&e.store.items().data.length)}}function ni(t,p){if(t&1&&(n(0,"div",11)(1,"div",17)(2,"span",42),a(3),i()(),n(4,"div")(5,"span"),a(6,"-"),i()(),n(7,"div",17)(8,"span",43),a(9),i()()()),t&2){let e=p.$implicit;l(3),D("(",e.code,")"),l(6),_(e.name)}}function oi(t,p){if(t&1&&(n(0,"div",11)(1,"div",17)(2,"span",42),a(3),i()(),n(4,"div")(5,"span"),a(6,"-"),i()(),n(7,"div",17)(8,"span",43),a(9),i()()()),t&2){let e=p.$implicit;l(3),D("(",e.code,")"),l(6),_(e.name)}}function ri(t,p){if(t&1&&(n(0,"div",44)(1,"div"),a(2),i()()),t&2){let e=p.$implicit;l(2),_(e.value)}}function ai(t,p){if(t&1&&(n(0,"div",41),L(1,"p-radiobutton",45),n(2,"label",46),a(3),i()()),t&2){let e=p.$implicit;l(),c("value",e.key)("inputId",e.key),l(),tt("for",e.key),l(),_(e.value)}}function li(t,p){if(t&1){let e=R();n(0,"div",32)(1,"label",33),a(2,"Customer"),i(),n(3,"p-autocomplete",47),F("completeMethod",function(r){v(e);let m=d(2);return b(m.searchCustomer(r))}),i()()}if(t&2){let e=d(2);l(3),c("suggestions",e.customerSuggestions())}}function pi(t,p){if(t&1){let e=R();n(0,"div",32)(1,"label",33),a(2,"Supplier"),i(),n(3,"p-autocomplete",48),F("completeMethod",function(r){v(e);let m=d(2);return b(m.searchSupplier(r))}),i()()}if(t&2){let e=d(2);l(3),c("suggestions",e.supplierSuggestions())}}function mi(t,p){if(t&1){let e=R();n(0,"div",32)(1,"label",33),a(2,"Customer"),i(),n(3,"p-autocomplete",47),F("completeMethod",function(r){v(e);let m=d(2);return b(m.searchCustomer(r))}),i()()}if(t&2){let e=d(2);l(3),c("suggestions",e.customerSuggestions())}}function ci(t,p){if(t&1){let e=R();n(0,"form",31)(1,"div",32)(2,"label",33),a(3,"Accounts"),i(),n(4,"p-multiselect",34),F("onChange",function(r){v(e);let m=d();return b(m.onAccountChange(r))}),x(5,ni,10,2,"ng-template",null,8,s)(7,oi,10,2,"ng-template",null,9,s),i()(),n(9,"div",32)(10,"label",33),a(11,"From"),i(),L(12,"p-datepicker",35),i(),n(13,"div",32)(14,"label",33),a(15,"To"),i(),L(16,"p-datepicker",36),i(),n(17,"div",32)(18,"label",33),a(19,"Outlets"),i(),n(20,"p-multiselect",37),x(21,ri,3,1,"ng-template",null,9,s),i()(),n(23,"div",32)(24,"label",33),a(25,"Category"),i(),n(26,"p-treeselect",38),F("onFocus",function(){v(e);let r=d();return b(r.onCategoryFocus())}),i()(),n(27,"div",32)(28,"label",39),a(29,"Contact Type"),i(),n(30,"div",40),Be(31,ai,4,4,"div",41,ke),i()(),x(33,li,4,1,"div",32)(34,pi,4,1,"div",32)(35,mi,4,1,"div",32),i()}if(t&2){let e,o=d();c("formGroup",o.generalLedgerFilterForm),l(4),c("virtualScroll",!0)("virtualScrollItemSize",50)("maxlength",5)("options",o.store.metadata().options.accounts),l(8),c("iconDisplay","input")("showIcon",!0),l(4),c("iconDisplay","input")("showIcon",!0),l(4),c("virtualScroll",!0)("virtualScrollItemSize",50)("options",o.store.metadata().options.outlets),l(6),c("metaKeySelection",!1)("virtualScroll",!0)("virtualScrollItemSize",50)("virtualScrollOptions",E(18,Wt))("options",o.categoriesOptions()),l(5),Oe(o.store.metadata().options.contactTypeOptions),l(2),O((e=o.generalLedgerFilterForm.controls.contactType.value)===1?33:e===2?34:35)}}var Lt=(()=>{class t{constructor(){this.dialogFilterVisible=T(!1),this.reportService=g(B),this.coaService=g(ht),this.authService=g(Re),this.store=g(Ge),this.roleService=g(me),this.categoriesOptions=T([]),this.customerSuggestions=T([]),this.supplierSuggestions=T([]),this.route=g(lt),this.dayjsService=g(be),this.initDialogVisible=T(!0),this.fb=g(De),this.toastr=g(pt)}ngOnInit(){this.generateFilterForm(),this.route.queryParamMap.pipe($e(e=>e.get("id")),M(e=>{e&&(this.initDialogVisible.update(o=>!o),this.generalLedgerFilterForm.patchValue({listAccountID:[e]}),this.store.updateFilter(y(h({},this.store.filter()),{listAccountID:[e]})))})).subscribe(),this.clearContactValueOnContactTypeChange(),this.generalLedgerFilterForm.valueChanges.pipe(Xe(500),M(e=>{Array.isArray(e.listAccountID)&&e.listAccountID.length>0?this.generalLedgerFilterForm.controls.listCategoryID.disable():this.generalLedgerFilterForm.controls.listCategoryID.enable(),e.listCategoryID&&e.listCategoryID.filter(o=>o.key).length>0?this.generalLedgerFilterForm.controls.listAccountID.disable():this.generalLedgerFilterForm.controls.listAccountID.enable()})).subscribe()}clearContactValueOnContactTypeChange(){this.generalLedgerFilterForm.get("contactType")?.valueChanges.subscribe(()=>this.generalLedgerFilterForm.get("contactID")?.setValue(""))}onAccountChange(e){Array.isArray(e.value)&&e.value.length>5&&this.toastr.warning("Please select at least 5 accounts for the general ledger report.","Warning")}onCategoryFocus(){this.coaService.getCachedCategoriesOptions().pipe(M(e=>this.categoriesOptions.set(e))).subscribe()}generateFilterForm(){this.generalLedgerFilterForm=this.fb.group({listAccountID:new G([]),listCategoryID:new G([]),listOutletID:new G([]),contactID:new G(""),from:new G(""),to:new G(""),contactType:new G(1)})}onFilterOKEvent(){let f=this.generalLedgerFilterForm.value,{from:e,to:o}=f,r=Me(f,["from","to"]);if(this.generalLedgerFilterForm.invalid){this.generalLedgerFilterForm.markAllAsTouched(),this.dialogFilterVisible.set(!0);return}let m={listCategoryID:r.listCategoryID?r.listCategoryID.map(u=>u.key):[],contactID:r.contactID.length===0?null:r.contactID,listOutletID:r.listOutletID?r.listOutletID:[],listAccountID:r.listAccountID?r.listAccountID:[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(o)?this.dayjsService.format(o):null,contactType:r.contactType};this.dialogFilterVisible.update(u=>!u),this.store.updateFilter(m),this.dialogFilterVisible.set(!1)}searchCustomer(e){this.reportService.getCustomerSuggestions(e.query).pipe(M(o=>this.customerSuggestions.set(o))).subscribe()}searchSupplier(e){this.reportService.getSupplierSuggestions(e.query).pipe(M(o=>this.supplierSuggestions.set(o))).subscribe()}onExport(){let f=this.generalLedgerFilterForm.value,{from:e,to:o}=f,r=Me(f,["from","to"]),m={listCategoryID:r.listCategoryID?r.listCategoryID.map(u=>u.key):[],contactID:r.contactID.length===0?null:r.contactID,listOutletID:r.listOutletID?r.listOutletID:[],listAccountID:r.listAccountID?r.listAccountID:[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(o)?this.dayjsService.format(o):null,contactType:r.contactType};this.reportService.exportGeneralLedger(m).pipe(M(u=>{yt(u,`general-ledger-${this.dayjsService.now.format("D-MM-YYYY")}.${u.type.split("/")[1]}`,u.type)})).subscribe()}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=k({type:t,selectors:[["app-report-general-ledger"]],features:[K([Ge])],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["caption",""],["header",""],["body",""],["footer",""],["emptymessage",""],["selectedItem",""],["item",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isDialogFilterVisible","isFilterable","isInitDialogFilterVisible"],[1,"d-flex","gap-2"],["routerLink","/pages/chart-of-account/account",1,"p-button","p-button-secondary","p-button-outlined","fs-3"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],[3,"style",4,"ngIf"],["scrollHeight","calc(100vh - 150px)",3,"value","scrollable"],[1,""],[1,"fs-5","fw-semibold"],[2,"width","10%"],[1,"text-end",2,"width","10%"],[1,"text-end",2,"width","20%"],[1,"text-break"],["target","_blank",1,"link","link-primary",3,"routerLink"],["target","_blank",1,"link","link-primary",3,"href"],[1,"text-end","text-break"],["colspan","7",1,"text-end"],[1,"text-end"],["colspan","4"],[1,"text-end","fw-semibold"],["colspan","8"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["showClear","","filter","","filterBy","code,name","display","chip","formControlName","listAccountID","appendTo","body","optionLabel","name","optionValue","id","placeholder","Select Accounts",3,"onChange","virtualScroll","virtualScrollItemSize","maxlength","options"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],["showClear","","display","chip","formControlName","listOutletID","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select Outlets",3,"virtualScroll","virtualScrollItemSize","options"],["showClear","","display","chip","selectionMode","multiple","filter","","filterBy","label","formControlName","listCategoryID","appendTo","body","containerStyleClass","w-100","optionLabel","label","optionValue","id","placeholder","Select Category",3,"onFocus","metaKeySelection","virtualScroll","virtualScrollItemSize","virtualScrollOptions","options"],["for",""],[1,"d-flex","gap-3"],[1,"d-flex","align-items-center","gap-2"],[1,"h-full","align-middle"],[1,"text-truncate","d-inline-block","h-full","align-middle"],[1,"flex","items-center","gap-2"],["name","contactType","formControlName","contactType",3,"value","inputId"],[1,"m-0",3,"for"],["formControlName","contactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["formControlName","ContactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"]],template:function(o,r){if(o&1){let m=R();n(0,"app-main-panel",10),W("isDialogFilterVisibleChange",function(u){return v(m),N(r.dialogFilterVisible,u)||(r.dialogFilterVisible=u),b(u)})("isInitDialogFilterVisibleChange",function(u){return v(m),N(r.initDialogVisible,u)||(r.initDialogVisible=u),b(u)}),F("filterConfirmed",function(){return v(m),b(r.onFilterOKEvent())}),x(1,zt,4,1,"ng-template",null,0,s)(3,ii,1,1,"ng-template",null,1,s)(5,ci,36,19,"ng-template",null,2,s),i()}o&2&&(c("pageTitle",r.store.items().pageTitle.length?r.store.items().pageTitle:"General Ledger"),Y("isDialogFilterVisible",r.dialogFilterVisible),c("isFilterable",!0),Y("isInitDialogFilterVisible",r.initDialogVisible))},dependencies:[fe,$,z,U,ot,ge,Ce,Se,_t,ae,re,Te,xe,he,Ve,Le,ne,ee,Q,Z,st,te,ie,ve,ye,we,oe,dt,Ct,St,xt,pe,le,J,X,gt,ft],styles:["[_nghost-%COMP%] .p-datatable .p-datatable-header{padding:.75rem 1rem .75rem 0}"],changeDetection:0})}}return t})();var si={data:{},filter:{EntityID:[],CashierID:null,Text:null,from:null,to:null},isLoading:!0,loader:{options:{outlets:[]},filter:{from:"",to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}}},Ae=ce(_e(si),se(t=>{let p={totalCOGS:w(()=>{let e=t.data()?.data?.cogs;return Array.isArray(e)?e.reduce((o,r)=>o+(r?.amount??0),0):0}),totalRevenue:w(()=>{let e=t.data()?.data?.revenue;return Array.isArray(e)?e.reduce((o,r)=>o+(r?.amount??0),0):0}),totalExpense:w(()=>{let e=t.data()?.data?.expense;return Array.isArray(e)?e.reduce((o,r)=>o+(r?.amount??0),0):0}),grossProfit:w(()=>Array.isArray(t.data()?.data?.cogs)&&Array.isArray(t.data()?.data?.revenue)?p.totalRevenue()-p.totalCOGS():0),profitOrLoss:w(()=>p.totalRevenue()-p.totalCOGS()-p.totalExpense()),isDataEmpty:w(()=>Object.keys(t.data()?.data??{}).length===0)};return p}),ue(t=>{let p=g(B),e=g(be),o={updateFilter(r){V(t,m=>y(h({},m),{filter:h(h({},m.filter),r)}))},getLoader:q(A(P(()=>p.getIncomeStatementLoader().pipe(H({next:r=>{V(t,m=>y(h({},m),{loader:r,filter:y(h({},m.filter),{from:e.from(r.filter.from).format(),to:e.from(r.filter.to).format()})})),o.getIncomeStatement(t.filter)},error:r=>{console.error(r)}}))))),getIncomeStatement:q(A(P(r=>p.getIncomeStatement(r).pipe(Qe(()=>V(t,m=>y(h({},m),{isLoading:!0}))),H({next:m=>{V(t,f=>y(h({},f),{data:m,isLoading:!1}))},error:m=>{console.error(m)}})))))};return o}),de({onInit:t=>{t.getLoader()}}));var di=()=>({height:"calc(100vh - 70px)"}),ui=()=>({height:"calc(100vh - 150px)"}),Pe=()=>({}),je=t=>["/pages/chart-of-account/account/",t],Ne=()=>["/pages/report/general-ledger"],qe=t=>({id:t});function _i(t,p){if(t&1){let e=R();n(0,"p-button",10),F("onClick",function(){v(e);let r=d(2);return b(r.onExport())}),i()}}function fi(t,p){if(t&1&&(n(0,"div",8),x(1,_i,1,0,"p-button",9),i()),t&2){let e=d();l(),c("ngIf",e.roleService.global.export)}}function gi(t,p){t&1&&(n(0,"tr")(1,"th",15),a(2,"Code"),i(),n(3,"th",16),a(4,"Name"),i(),n(5,"th",17),a(6,"Total"),i()())}function hi(t,p){if(t&1&&(n(0,"tr")(1,"td"),a(2),i(),n(3,"td")(4,"a",18),a(5),i()(),n(6,"td",17)(7,"a",19),a(8),S(9,"number"),i()()()),t&2){let e=p.$implicit;l(2),_(e.code),l(2),c("routerLink",I(8,je,e.accountID)),l(),_(e.name),l(2),c("routerLink",E(10,Ne))("queryParams",I(11,qe,e.accountID)),l(),_(C(9,6,e.amount))}}function xi(t,p){if(t&1&&(n(0,"tr")(1,"td",20)(2,"div",21)(3,"span",22),a(4,"Total Revenue :"),i(),n(5,"span",23),a(6),S(7,"number"),i()()()()),t&2){let e=d(4);l(6),_(C(7,1,e.store.totalRevenue()))}}function Si(t,p){t&1&&(n(0,"tr")(1,"td",24)(2,"span"),a(3,"No revenue records available"),i()()())}function Ci(t,p){if(t&1&&(n(0,"h6",13),a(1,"Revenue"),i(),n(2,"p-table",14),x(3,gi,7,0,"ng-template",null,3,s)(5,hi,10,13,"ng-template",null,4,s)(7,xi,8,3,"ng-template",null,5,s)(9,Si,4,0,"ng-template",null,6,s),i()),t&2){let e,o=d(3);l(2),c("value",(e=o.store.data())==null||e.data==null?null:e.data.revenue)}}function yi(t,p){t&1&&(n(0,"tr")(1,"th",15),a(2,"Code"),i(),n(3,"th",16),a(4,"Name"),i(),n(5,"th",25),a(6,"Total"),i()())}function vi(t,p){if(t&1&&(n(0,"tr")(1,"td"),a(2),i(),n(3,"td")(4,"a",18),a(5),i()(),n(6,"td",17)(7,"a",19),a(8),S(9,"number"),i()()()),t&2){let e=p.$implicit;l(2),_(e.code),l(2),c("routerLink",I(8,je,e.accountID)),l(),_(e.name),l(2),c("routerLink",E(10,Ne))("queryParams",I(11,qe,e.AccountID)),l(),_(C(9,6,e.amount))}}function bi(t,p){if(t&1&&(n(0,"tr")(1,"td",20)(2,"div",21)(3,"span",22),a(4,"Total COGS :"),i(),n(5,"span",23),a(6),S(7,"number"),i()()()(),n(8,"tr")(9,"td",20)(10,"div",21)(11,"span",22),a(12,"Gross Profit :"),i(),n(13,"span",23),a(14),S(15,"number"),i()()()()),t&2){let e=d(4);l(6),_(C(7,2,e.store.totalCOGS())),l(8),_(C(15,4,e.store.grossProfit()))}}function Ei(t,p){t&1&&(n(0,"tr")(1,"td",24)(2,"span"),a(3,"No COGS records available"),i()()())}function Ii(t,p){if(t&1&&(n(0,"h4",13),a(1,"COGS"),i(),n(2,"p-table",14),x(3,yi,7,0,"ng-template",null,3,s)(5,vi,10,13,"ng-template",null,4,s)(7,bi,16,6,"ng-template",null,5,s)(9,Ei,4,0,"ng-template",null,6,s),i()),t&2){let e,o=d(3);l(2),c("value",(e=o.store.data())==null||e.data==null?null:e.data.cogs)}}function Fi(t,p){t&1&&(n(0,"tr")(1,"th",15),a(2,"Code"),i(),n(3,"th",16),a(4,"Name"),i(),n(5,"th",17),a(6,"Total"),i()())}function Ri(t,p){if(t&1&&(n(0,"tr")(1,"td"),a(2),i(),n(3,"td")(4,"a",18),a(5),i()(),n(6,"td",17)(7,"a",19),a(8),S(9,"number"),i()()()),t&2){let e=p.$implicit;l(2),_(e.code),l(2),c("routerLink",I(8,je,e.accountID)),l(),_(e.name),l(2),c("routerLink",E(10,Ne))("queryParams",I(11,qe,e.AccountID)),l(),_(C(9,6,e.amount))}}function Di(t,p){if(t&1&&(n(0,"tr")(1,"td",20)(2,"div",21)(3,"span",22),a(4,"Total Expense :"),i(),n(5,"span",23),a(6),S(7,"number"),i()()()(),n(8,"tr")(9,"td",20)(10,"div",21)(11,"span",22),a(12,"Profit / Loss :"),i(),n(13,"span",23),a(14),S(15,"number"),i()()()()),t&2){let e=d(4);l(6),_(C(7,2,e.store.totalExpense())),l(8),_(C(15,4,e.store.profitOrLoss()))}}function wi(t,p){t&1&&(n(0,"tr")(1,"td",24)(2,"span"),a(3,"No expense records available"),i()()())}function Ti(t,p){if(t&1&&(n(0,"h4",13),a(1,"Expense"),i(),n(2,"p-table",14),x(3,Fi,7,0,"ng-template",null,3,s)(5,Ri,10,13,"ng-template",null,4,s)(7,Di,16,6,"ng-template",null,5,s)(9,wi,4,0,"ng-template",null,6,s),i()),t&2){let e,o=d(3);l(2),c("value",(e=o.store.data())==null||e.data==null?null:e.data.expense)}}function Li(t,p){if(t&1&&(n(0,"p-scroll-panel")(1,"div",12),x(2,Ci,11,1)(3,Ii,11,1)(4,Ti,11,1),i()()),t&2){let e,o,r,m=d(2);j(E(5,ui)),l(2),O(m.Object.keys((e=m.store.data().data)!==null&&e!==void 0?e:E(6,Pe)).length>0?2:-1),l(),O(m.Object.keys((o=(o=m.store.data().data)==null?null:o.cogs)!==null&&o!==void 0?o:E(7,Pe)).length>0?3:-1),l(),O(m.Object.keys((r=(r=m.store.data().data)==null?null:r.expense)!==null&&r!==void 0?r:E(8,Pe)).length>0?4:-1)}}function Vi(t,p){if(t&1&&(n(0,"p-panel"),x(1,Li,5,9,"p-scroll-panel",11),i()),t&2){let e=d();j(E(3,di)),l(),c("ngIf",e.store.data())}}function Mi(t,p){if(t&1){let e=R();n(0,"form",26)(1,"div",27)(2,"label",28),a(3,"Outlet"),i(),L(4,"p-multiselect",29),i(),n(5,"div",27)(6,"label",28),a(7,"Cashier"),i(),n(8,"p-autocomplete",30),F("completeMethod",function(r){v(e);let m=d();return b(m.onCashierSearch(r))})("onSelect",function(r){v(e);let m=d();return b(m.onCashierSelect(r))}),i()(),n(9,"div",27)(10,"label",28),a(11,"From"),i(),L(12,"p-datepicker",31),i(),n(13,"div",27)(14,"label",28),a(15,"To"),i(),L(16,"p-datepicker",32),i()()}if(t&2){let e=d();c("formGroup",e.formFilter),l(4),c("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.loader().options.outlets)("showClear",!0),l(4),c("showClear",!0)("suggestions",e.cashierSuggestions())("showClear",!0)}}var Vt=(()=>{class t{constructor(){this.dayjsService=g(be),this.store=g(Ae),this.fb=g(De),this.reportService=g(B),this.roleService=g(me),this.isInitDialogFilterVisible=T(!1),this.dialogFilterVisible=T(!1),this.cashierSuggestions=T([]),this.cashierHashMap=new Map,this.Object=Object,nt(()=>{this.store.filter()&&this.initForm()})}ngOnInit(){this.initForm(),console.log(this.cashierHashMap.entries())}onSearch(e){this.store.updateFilter(y(h({},this.store.filter()),{Text:e}))}onCashierSearch(e){this.reportService.getCashierSuggestions(e.query).pipe(Ie("Cashier Suggestions"),M(o=>this.cashierSuggestions.set(o))).subscribe()}initForm(){let e=this.store.filter();console.log("initForm",this.cashierHashMap.get(e.CashierID)),this.formFilter=this.fb.group({EntityID:this.fb.control(e.EntityID??[]),CashierID:this.fb.control(this.cashierHashMap.get(e.CashierID)??""),Text:this.fb.control(e.Text??""),from:this.fb.control(e.from?this.dayjsService.from(e.from).toDate():null),to:this.fb.control(e.to?this.dayjsService.from(e.to).toDate():null)})}onFilterOK(){let e=this.formFilter.getRawValue(),o=Object.entries(e).reduce((r,[m,f])=>(m==="from"||m==="to"?f instanceof Date&&(r[m]=this.dayjsService.from(f).format()):r[m]=f||null,r),{});this.store.updateFilter(h(h({},this.store.filter()),o)),this.dialogFilterVisible.update(r=>!r),console.log("body",e)}onCashierSelect(e){console.log("Cashier selected:",e),!this.cashierHashMap.has(e.value.Key)&&(this.cashierHashMap.set(e.value.Key,e.value.Value),console.log("Cashier HashMap:",this.cashierHashMap))}onExport(){let e=y(h({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportRowCount:1e4});this.reportService.getIncomeStatement(e,{responseType:"blob"}).pipe(Ie("Export Profit & Loss"),M(o=>{let r=o.type,m=[o],f=document.createElement("a");f.href=window.URL.createObjectURL(new Blob(m,{type:r}));let u=`profit-and-loss.${r.split("/")[1]}`;f.setAttribute("download",u),document.body.appendChild(f),f.click(),document.body.removeChild(f)})).subscribe()}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=k({type:t,selectors:[["app-report-income-statement"]],features:[K([Ae])],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","isFilterable","pageTitle","isDialogFilterVisible","isInitDialogFilterVisible"],[1,"d-flex","gap-2"],["severity","secondary","variant","outlined","icon","fa-solid fa-download","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-download","label","Export",3,"onClick"],[3,"style",4,"ngIf"],[1,"d-flex","flex-column","gap-3"],[1,"fs-5","fw-semibold"],[3,"value"],[2,"width","20%"],[2,"width","30%"],[1,"text-end"],["target","_blank",1,"link","link-primary",3,"routerLink"],["target","_blank",1,"link","link-primary",3,"routerLink","queryParams"],["colspan","3",1,"text-end","fw-semibold"],[1,"row"],[1,"col"],[1,"col-1","col-lg-2"],["colspan","3",1,""],[1,"text-end",2,"min-width","10%"],[1,"d-flex","flex-column","gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for",""],["formControlName","EntityID","filterBy","value","appendTo","body","display","chip","optionLabel","value","optionValue","key","placeholder","Select an Outlet",3,"virtualScroll","virtualScrollItemSize","options","showClear"],["appendTo","body","formControlName","CashierID","optionLabel","Value","optionValue","Key","styleClass","w-100","inputStyleClass","w-100","field","Value","placeholder","Search a cashier",3,"completeMethod","onSelect","showClear","suggestions"],["formControlName","from","styleClass","w-100","appendTo","body"],["formControlName","to","styleClass","w-100","appendTo","body"]],template:function(o,r){if(o&1){let m=R();n(0,"app-main-panel",7),W("isDialogFilterVisibleChange",function(u){return v(m),N(r.dialogFilterVisible,u)||(r.dialogFilterVisible=u),b(u)})("isInitDialogFilterVisibleChange",function(u){return v(m),N(r.isInitDialogFilterVisible,u)||(r.isInitDialogFilterVisible=u),b(u)}),F("filterConfirmed",function(){return v(m),b(r.onFilterOK())}),x(1,fi,2,1,"ng-template",null,0,s)(3,Vi,2,4,"ng-template",null,1,s)(5,Mi,17,8,"ng-template",null,2,s),i()}o&2&&(c("isFilterable",!0)("pageTitle",r.store.data().pageTitle),Y("isDialogFilterVisible",r.dialogFilterVisible)("isInitDialogFilterVisible",r.isInitDialogFilterVisible))},dependencies:[fe,$,z,U,Te,xe,he,ne,ee,Q,Z,te,ie,ve,ye,ge,Ce,Se,pe,le,oe,J,X,Ve,Le,ae,re],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var He=Ue(vt());var ki={metadata:{options:{outlets:[]},filter:{to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}},data:{asset:[],liability:[],equity:[],pageTitle:""},filter:{date:(0,He.default)().format("YYYY-MM-DD"),listOutletParam:[]}},Ye=ce(_e(ki),se(t=>({totalAsset:w(()=>t.data().asset.reduce((p,e)=>p+ +e.amount,0)),totalLiability:w(()=>t.data().liability.reduce((p,e)=>p+ +e.counterAmount,0)),totalEquity:w(()=>t.data().equity.reduce((p,e)=>p+ +e.counterAmount,0))})),ue(t=>{let p=g(B),e={updateFilter:o=>{V(t,r=>y(h({},r),{filter:o}))},fetchBalanceSheet:q(A(Fe(()=>{let o=t.filter();return Object.entries(o).every(([r,m])=>m!=null&&m!=="")}),P(o=>p.getBalanceSheet(o).pipe(H({next:r=>{V(t,m=>y(h({},m),{data:r}))},error:r=>{console.error(r)}}))),Je(1))),fetchLoader:q(A(P(()=>p.getBalanceSheetLoader().pipe(H({next:o=>{V(t,r=>y(h({},r),{metadata:o,filter:{date:(0,He.default)(o.filter.to).format("YYYY-MM-DD")}})),e.fetchBalanceSheet(t.filter)},error:o=>{console.error(o)}})))))};return e}),de(t=>({onInit:()=>{t.fetchLoader()}})));var Mt=Ue(vt());var Bi=()=>({height:"calc(100vh - 70px)"}),Oi=()=>({height:"calc(100vh - 100px)"}),We=t=>["/pages/chart-of-account/account/",t],Ke=()=>["/pages/report/general-ledger"],ze=t=>({id:t});function Gi(t,p){if(t&1){let e=R();n(0,"p-button",11),F("onClick",function(){v(e);let r=d(2);return b(r.onExport())}),i()}}function Ai(t,p){if(t&1&&(n(0,"div",9),x(1,Gi,1,0,"p-button",10),i()),t&2){let e=d();l(),c("ngIf",e.roleService.global.export)}}function Pi(t,p){t&1&&(n(0,"tr")(1,"th",16),a(2,"Code"),i(),n(3,"th"),a(4,"Asset"),i(),n(5,"th",17),a(6,"Total"),i()())}function ji(t,p){if(t&1&&(n(0,"tr")(1,"td"),a(2),i(),n(3,"td")(4,"a",18),a(5),i()(),n(6,"td",19)(7,"a",20),a(8),S(9,"number"),i()()()),t&2){let e=p.$implicit;l(2),_(e.code),l(2),c("routerLink",I(8,We,e.accountID)),l(),_(e.name),l(2),c("routerLink",E(10,Ke))("queryParams",I(11,ze,e.accountID)),l(),_(C(9,6,e.amount))}}function Ni(t,p){if(t&1&&(n(0,"tr")(1,"td",21),a(2,"Total Asset"),i(),n(3,"td",22),a(4),S(5,"number"),i()()),t&2){let e=d(3);l(4),D(" ",C(5,1,e.store.totalAsset())," ")}}function qi(t,p){t&1&&(n(0,"tr")(1,"td",23)(2,"span"),a(3,"No asset records found."),i()()())}function Hi(t,p){if(t&1&&(n(0,"h4",14),a(1,"Asset"),i(),n(2,"p-table",15),x(3,Pi,7,0,"ng-template",null,3,s)(5,ji,10,13,"ng-template",null,4,s)(7,Ni,6,3,"ng-template",null,5,s)(9,qi,4,0,"ng-template",null,6,s),i()),t&2){let e=d(2);l(2),c("value",e.store.data().asset)}}function Yi(t,p){t&1&&(n(0,"tr")(1,"th",16),a(2,"Code"),i(),n(3,"th"),a(4,"Liability"),i(),n(5,"th",17),a(6,"Total"),i()())}function Wi(t,p){if(t&1&&(n(0,"tr")(1,"td"),a(2),i(),n(3,"td")(4,"a",25),a(5),i()(),n(6,"td",19)(7,"a",20),a(8),S(9,"number"),i()()()),t&2){let e=p.$implicit;l(2),_(e.code),l(2),c("routerLink",I(8,We,e.accountID)),l(),_(e.name),l(2),c("routerLink",E(10,Ke))("queryParams",I(11,ze,e.accountID)),l(),_(C(9,6,e.counterAmount))}}function Ki(t,p){if(t&1&&(n(0,"tr")(1,"td",21),a(2," Total Liability "),i(),n(3,"td",22),a(4),S(5,"number"),i()()),t&2){let e=d(3);l(4),D(" ",C(5,1,e.store.totalLiability())," ")}}function zi(t,p){t&1&&(n(0,"tr")(1,"td",23)(2,"span"),a(3,"No liability records found."),i()()())}function Ui(t,p){if(t&1&&(n(0,"h4",24),a(1,"Liability"),i(),n(2,"p-table",15),x(3,Yi,7,0,"ng-template",null,3,s)(5,Wi,10,13,"ng-template",null,4,s)(7,Ki,6,3,"ng-template",null,5,s)(9,zi,4,0,"ng-template",null,6,s),i()),t&2){let e=d(2);l(2),c("value",e.store.data().liability)}}function $i(t,p){t&1&&(n(0,"tr")(1,"th",16),a(2,"Code"),i(),n(3,"th"),a(4,"Equity"),i(),n(5,"th",17),a(6,"Total"),i()())}function Xi(t,p){if(t&1&&(n(0,"tr")(1,"td"),a(2),i(),n(3,"td")(4,"a",18),a(5),i()(),n(6,"td",19)(7,"a",20),a(8),S(9,"number"),i()()()),t&2){let e=p.$implicit;l(2),_(e.code),l(2),c("routerLink",I(8,We,e.accountID)),l(),_(e.name),l(2),c("routerLink",E(10,Ke))("queryParams",I(11,ze,e.accountID)),l(),_(C(9,6,e.counterAmount))}}function Ji(t,p){if(t&1&&(n(0,"tr")(1,"td",21),a(2,"Total Equity"),i(),n(3,"td",22),a(4),S(5,"number"),i()(),n(6,"tr")(7,"td",21),a(8," Total Liability + Equity "),i(),n(9,"td",22),a(10),S(11,"number"),i()()),t&2){let e=d(3);l(4),D(" ",C(5,2,e.store.totalEquity())," "),l(6),D(" ",C(11,4,e.store.totalLiability()+e.store.totalEquity())," ")}}function Qi(t,p){t&1&&(n(0,"tr")(1,"td",23)(2,"span"),a(3,"No equity records found."),i()()())}function Zi(t,p){if(t&1&&(n(0,"h4",24),a(1,"Equity"),i(),n(2,"p-table",15),x(3,$i,7,0,"ng-template",null,3,s)(5,Xi,10,13,"ng-template",null,4,s),a(7," <"),x(8,Ji,12,6,"ng-template",null,5,s)(10,Qi,4,0,"ng-template",null,6,s),i()),t&2){let e=d(2);l(2),c("value",e.store.data().equity)}}function en(t,p){if(t&1&&(n(0,"p-panel",12)(1,"p-scroll-panel")(2,"div",13),x(3,Hi,11,1)(4,Ui,11,1)(5,Zi,12,1),i()()()),t&2){let e=d();j(E(8,Bi)),c("showHeader",!1),l(),j(E(9,Oi)),l(2),O(e.Object.keys(e.store.data().asset).length>0?3:-1),l(),O(e.Object.keys(e.store.data().liability).length>0?4:-1),l(),O(e.Object.keys(e.store.data().equity).length>0?5:-1)}}function tn(t,p){if(t&1&&(n(0,"div",31)(1,"div"),a(2),i()()),t&2){let e=p.$implicit;l(2),_(e.value)}}function nn(t,p){if(t&1&&(n(0,"form",26)(1,"div",27)(2,"label",28),a(3,"Outlet"),i(),n(4,"p-multiselect",29),x(5,tn,3,1,"ng-template",null,7,s),i()(),n(7,"div",27)(8,"label",28),a(9,"From"),i(),L(10,"p-datepicker",30),i()()),t&2){let e=d();c("formGroup",e.filterForm),l(4),c("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.metadata().options.outlets)("showClear",!0),l(6),c("iconDisplay","input")("showIcon",!0)}}var kt=(()=>{class t{constructor(){this.store=g(Ye),this.ReportServiceStore=g(B),this.dialogFilterVisible=T(!1),this.isInitDialogFilterVisible=T(!1),this.roleService=g(me),this.Object=Object}ngOnInit(){this.generateFilterForm()}generateFilterForm(){this.filterForm=new ct({date:new G(new Date),outletID:new G([])})}onFilterOKEvent(){let{date:e,outletID:o}=this.filterForm.value;this.store.updateFilter({date:(0,Mt.default)(e).format("YYYY-MM-DD"),listOutletParam:o}),this.dialogFilterVisible.update(r=>!r)}onExport(){let e=y(h({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportRowCount:1e4});this.ReportServiceStore.getBalanceSheet(e,{responseType:"blob"}).pipe(Ie("Export Balance Sheet"),M(o=>{let r=o.type,m=[o],f=document.createElement("a");f.href=window.URL.createObjectURL(new Blob(m,{type:r}));let u=`balance-sheet.${r.split("/")[1]}`;f.setAttribute("download",u),document.body.appendChild(f),f.click(),document.body.removeChild(f)})).subscribe()}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=k({type:t,selectors:[["app-report-balance-sheet"]],features:[K([Ye])],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],["item",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible"],[1,"d-flex","gap-2"],["severity","secondary","variant","outlined","icon","fa-solid fa-download","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-download","label","Export",3,"onClick"],[3,"showHeader"],[1,"d-flex","flex-column","gap-3"],[1,"fs-5","fw-semibold","mt-3"],[3,"value"],[2,"width","20%"],[1,"text-end",2,"width","5%"],["target","_blank",1,"link","link-primary",3,"routerLink"],[1,"text-end"],["target","_blank",1,"link","link-primary",3,"routerLink","queryParams"],["colspan","2",1,"fw-semibold","text-end"],[1,"text-end","fw-semibold"],["colspan","3",1,""],[1,"fs-5","fw-semibold"],["target","_blank",1,"link","link-primary","d-flex","align-items-center",3,"routerLink"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["formControlName","outletID","display","chip","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select Outlet",3,"virtualScroll","virtualScrollItemSize","options","showClear"],["formControlName","date","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],[1,"flex","items-center","gap-2"]],template:function(o,r){if(o&1){let m=R();n(0,"app-main-panel",8),W("isDialogFilterVisibleChange",function(u){return v(m),N(r.dialogFilterVisible,u)||(r.dialogFilterVisible=u),b(u)})("isInitDialogFilterVisibleChange",function(u){return v(m),N(r.isInitDialogFilterVisible,u)||(r.isInitDialogFilterVisible=u),b(u)}),F("filterConfirmed",function(){return v(m),b(r.onFilterOKEvent())}),x(1,Ai,2,1,"ng-template",null,0,s)(3,en,6,10,"ng-template",null,1,s)(5,nn,11,7,"ng-template",null,2,s),i()}o&2&&(c("pageTitle",r.store.data().pageTitle)("isFilterable",!0),Y("isDialogFilterVisible",r.dialogFilterVisible)("isInitDialogFilterVisible",r.isInitDialogFilterVisible))},dependencies:[fe,$,z,U,Ce,Se,ge,ae,re,ne,ee,Q,Z,te,ie,ve,ye,xe,he,we,oe,pe,le,J,X],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Bt=(()=>{class t{static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=k({type:t,selectors:[["app-report-comparative-balance"]],decls:3,vars:0,template:function(o,r){o&1&&(n(0,"p"),a(1,"report-comparative-balance works!"),i(),a(2,`
|
|
2
|
+
,
|
|
3
|
+
`))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Ot=(()=>{class t{static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=k({type:t,selectors:[["app-report-cash-flow"]],decls:3,vars:0,template:function(o,r){o&1&&(n(0,"p"),a(1,"report-cash-flow works!"),i(),a(2,`
|
|
4
|
+
,
|
|
5
|
+
`))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Gt=(()=>{class t{static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=k({type:t,selectors:[["app-report-trial-balance"]],decls:3,vars:0,template:function(o,r){o&1&&(n(0,"p"),a(1,"report-trial-balance works!"),i(),a(2,`
|
|
6
|
+
,
|
|
7
|
+
`))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var xr=[{path:"",redirectTo:"general-ledger",pathMatch:"full"},{path:"",children:[{path:"general-ledger",component:Lt},{path:"profit-loss",component:Vt},{path:"balance-sheet",component:kt},{path:"comparative-balance",component:Bt},{path:"trial-balance",component:Gt},{path:"cash-flow",component:Ot}]}];export{xr as REPORTS_ROUTES};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as re,b as Tt}from"./chunk-UEWFM35O.js";import{f as It}from"./chunk-EDCDR4RJ.js";import"./chunk-HHDFSN55.js";import{a as ut}from"./chunk-6ACYDH2N.js";import"./chunk-C2GO6SPF.js";import{a as ve,b as Ce}from"./chunk-O4QM64EH.js";import{d as vt,i as Ct,j as wt,k as xt}from"./chunk-EW3R2HAB.js";import"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import{a as nt}from"./chunk-PKN47FQE.js";import"./chunk-LRRVQSMI.js";import{a as Ot}from"./chunk-42UIGXWH.js";import"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import{a as ot}from"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{h as yt}from"./chunk-
|
|
1
|
+
import{a as re,b as Tt}from"./chunk-UEWFM35O.js";import{f as It}from"./chunk-EDCDR4RJ.js";import"./chunk-HHDFSN55.js";import{a as ut}from"./chunk-6ACYDH2N.js";import"./chunk-C2GO6SPF.js";import{a as ve,b as Ce}from"./chunk-O4QM64EH.js";import{d as vt,i as Ct,j as wt,k as xt}from"./chunk-EW3R2HAB.js";import"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import{a as nt}from"./chunk-PKN47FQE.js";import"./chunk-LRRVQSMI.js";import{a as Ot}from"./chunk-42UIGXWH.js";import"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import{a as ot}from"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{h as yt}from"./chunk-AWXT2WGR.js";import{a as at}from"./chunk-C7LM5UCK.js";import{a as pt,b as dt}from"./chunk-J4XRJAME.js";import{a as K,b as ht,c as ft,d as mt,e as gt,f as _t,g as bt}from"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{a as Oe,p as st,r as lt,w as ct,x as rt}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{$ as Xe,Ba as Je,E as Qe,Ea as Ye,J as Ne,Ja as Ze,Ma as et,N as Ue,Na as W,Oa as tt,R as We,S as le,Va as it,Y as je,a as Re,e as Ke,f as Ae,l as Be,o as He,oa as ce,ra as x,sa as M,ta as be,v as ze,wa as ye,y as qe}from"./chunk-FMVCTBCQ.js";import"./chunk-ZGXJEG37.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{F as $e,G as De,c as ge,e as Pe,f as N,g as Ge,h as _e,m as U}from"./chunk-B63BKC6F.js";import{Ab as he,Ac as Q,Bc as Me,Cb as m,Ga as P,Jb as y,Kb as r,Mc as T,Nb as fe,Ob as Z,Ub as d,Vb as u,Vc as V,Wb as F,Wc as me,X as de,Xb as D,Yb as R,Yc as G,Z as xe,Zb as ee,Zc as Le,_b as S,aa as Ie,ba as Te,c as pe,ca as Se,dc as v,ec as p,gb as c,ha as k,jc as E,kc as z,lc as C,mb as ue,mc as w,oa as Ve,pa as h,pc as te,qa as f,qc as b,rc as B,sc as ie,ta as ke,uc as Ee,vc as ne,wb as H,wc as oe,xb as Fe,xc as ae,yc as se,za as I,zc as q}from"./chunk-JP6RBSB3.js";import{a as g,b as _}from"./chunk-YQFG5XE2.js";var kt={data:[],count:0,meta:{filter:{pagination:1,pageSize:10,rolesID:null,text:""},options:{roles:[]}},filter:{pagination:1,pageSize:10,rolesID:null,text:""}},we=ht(_t(kt),bt("GroupStore"),ft(t=>({first:G(()=>(t.filter().pagination-1)*t.filter().pageSize+1),end:G(()=>Math.min(t.filter().pagination*t.filter().pageSize,t.count())),hasCheckedRows:G(()=>t.data().some(s=>s.checked)),checkedData:G(()=>t.data().filter(s=>s.checked).map(s=>s.id))})),gt(t=>{let s=k(re),e={setFilter(n){K(t,i=>_(g({},i),{filter:n}))},onRowSelect(n){K(t,i=>{let o=i.data.map(a=>a.id===n.id?_(g({},a),{checked:!0}):a);return _(g({},i),{data:o})})},onRowUnselect(n){K(t,i=>{let o=i.data.map(a=>a.id===n.id?_(g({},a),{checked:!1}):a);return _(g({},i),{data:o})})},onHeaderCheckboxToggle(n){K(t,i=>{let o=i.data.map(a=>_(g({},a),{checked:n}));return _(g({},i),{data:o})})},getGroupList:ve(pe(de(n=>s.getGroupList(n).pipe(Ce(i=>{K(t,o=>_(g({},o),{data:i.data,count:i.count}))},i=>{console.error("Error fetching group list:",i)}))))),getGroupLoader:ve(pe(de(()=>s.getGroupLoader().pipe(Ce({next:n=>{K(t,i=>_(g({},i),{meta:n,filter:n.filter})),e.getGroupList(t.filter)},error:n=>{console.error("Error fetching group loader:",n)}})))))};return e}),mt(t=>({onInit:()=>{t.getGroupLoader()}})));var Mt=t=>({$implicit:t});function Lt(t,s){t&1&&ee(0)}function Pt(t,s){if(t&1&&(D(0),m(1,Lt,1,0,"ng-container",8),R()),t&2){let e=p().$implicit,n=p();c(),r("ngTemplateOutlet",n.optionTemplate)("ngTemplateOutletContext",Q(2,Mt,e==null?null:e.option))}}function Gt(t,s){if(t&1&&(d(0,"span",9),b(1),u()),t&2){let e=p().$implicit,n=p();y("data-pc-section","text"),c(),B(n.getOptionLabelToRender(e))}}function $t(t,s){t&1&&F(0,"AngleRightIcon")}function Dt(t,s){}function Rt(t,s){t&1&&m(0,Dt,0,0,"ng-template")}function Kt(t,s){if(t&1&&(d(0,"span",10),m(1,$t,1,0,"AngleRightIcon",11)(2,Rt,1,0,null,12),u()),t&2){let e=p(2);y("data-pc-section","groupIcon"),c(),r("ngIf",!e.groupicon),c(),r("ngTemplateOutlet",e.groupicon)}}function At(t,s){if(t&1){let e=S();d(0,"p-cascadeselect-sub",13),v("onChange",function(i){h(e);let o=p(2);return f(o.onChange.emit(i))})("onFocusChange",function(i){h(e);let o=p(2);return f(o.onFocusChange.emit(i))})("onFocusEnterChange",function(i){h(e);let o=p(2);return f(o.onFocusEnterChange.emit(i))}),u()}if(t&2){let e=p().$implicit,n=p();r("role","group")("selectId",n.selectId)("focusedOptionId",n.focusedOptionId)("activeOptionPath",n.activeOptionPath)("options",n.getOptionGroupChildren(e))("optionLabel",n.optionLabel)("optionValue",n.optionValue)("level",n.level+1)("optionGroupLabel",n.optionGroupLabel)("optionGroupChildren",n.optionGroupChildren)("dirty",n.dirty)("optionTemplate",n.optionTemplate)}}function Bt(t,s){if(t&1){let e=S();d(0,"li",3)(1,"div",4),v("click",function(i){let o=h(e).$implicit,a=p();return f(a.onOptionClick(i,o))})("mouseenter",function(i){let o=h(e).$implicit,a=p();return f(a.onOptionMouseEnter(i,o))})("mousemove",function(i){let o=h(e).$implicit,a=p();return f(a.onOptionMouseMove(i,o))}),m(2,Pt,2,4,"ng-container",5)(3,Gt,2,2,"ng-template",null,0,T)(5,Kt,3,3,"span",6),u(),m(6,At,1,12,"p-cascadeselect-sub",7),u()}if(t&2){let e=s.$implicit,n=s.index,i=te(4),o=p();r("ngClass",o.getItemClass(e))("id",o.getOptionId(e)),y("aria-level",o.level+1)("aria-setsize",o.options.length)("data-pc-section","item")("aria-label",o.getOptionLabelToRender(e))("aria-selected",o.isOptionGroup(e)?void 0:o.isOptionSelected(e))("aria-posinset",n+1),c(),y("data-pc-section","content"),c(),r("ngIf",o.optionTemplate)("ngIfElse",i),c(3),r("ngIf",o.isOptionGroup(e)),c(),r("ngIf",o.isOptionGroup(e)&&o.isOptionActive(e))}}var Ht=["value"],zt=["option"],qt=["header"],Qt=["footer"],Nt=["triggericon"],Ut=["loadingicon"],Wt=["optiongroupicon"],jt=["clearicon"],Xt=["focusInput"],Jt=["container"],Yt=["panel"],Zt=["overlay"],ei=(t,s)=>({$implicit:t,placeholder:s}),ti=t=>({"p-cascadeselect-overlay p-component":!0,"p-cascadeselect-mobile-active":t});function ii(t,s){t&1&&ee(0)}function ni(t,s){if(t&1&&(D(0),m(1,ii,1,0,"ng-container",16),R()),t&2){let e=p();c(),r("ngTemplateOutlet",e.valueTemplate||e._valueTemplate)("ngTemplateOutletContext",Me(2,ei,e.value,e.placeholder))}}function oi(t,s){if(t&1&&b(0),t&2){let e=p();ie(" ",e.label()," ")}}function ai(t,s){if(t&1){let e=S();d(0,"TimesIcon",18),v("click",function(i){h(e);let o=p(2);return f(o.clear(i))}),u()}t&2&&y("data-pc-section","clearicon")("aria-hidden",!0)}function si(t,s){}function li(t,s){t&1&&m(0,si,0,0,"ng-template")}function ci(t,s){if(t&1){let e=S();d(0,"span",18),v("click",function(i){h(e);let o=p(2);return f(o.clear(i))}),m(1,li,1,0,null,19),u()}if(t&2){let e=p(2);y("data-pc-section","clearicon")("aria-hidden",!0),c(),r("ngTemplateOutlet",e.clearIconTemplate||e._clearIconTemplate)}}function ri(t,s){if(t&1&&(D(0),m(1,ai,1,2,"TimesIcon",17)(2,ci,2,3,"span",17),R()),t&2){let e=p();c(),r("ngIf",!e.clearIconTemplate&&!e._clearIconTemplate),c(),r("ngIf",e.clearIconTemplate||e._clearIconTemplate)}}function pi(t,s){t&1&&ee(0)}function di(t,s){if(t&1&&(D(0),m(1,pi,1,0,"ng-container",19),R()),t&2){let e=p(2);c(),r("ngTemplateOutlet",e.loadingIconTemplate||e._loadingIconTemplate)}}function ui(t,s){if(t&1&&F(0,"span",22),t&2){let e=p(3);r("ngClass","p-cascadeselect-loading-icon pi-spin "+e.loadingIcon)}}function hi(t,s){t&1&&F(0,"span",23),t&2&&Z("p-cascadeselect-loading-icon pi pi-spinner pi-spin")}function fi(t,s){if(t&1&&(D(0),m(1,ui,1,1,"span",20)(2,hi,1,2,"span",21),R()),t&2){let e=p(2);c(),r("ngIf",e.loadingIcon),c(),r("ngIf",!e.loadingIcon)}}function mi(t,s){if(t&1&&(D(0),m(1,di,2,1,"ng-container",12)(2,fi,3,2,"ng-container",12),R()),t&2){let e=p();c(),r("ngIf",e.loadingIconTemplate||e._loadingIconTemplate),c(),r("ngIf",!e.loadingIconTemplate&&!e._loadingIconTemplate)}}function gi(t,s){t&1&&F(0,"ChevronDownIcon",26),t&2&&r("styleClass","p-cascadeselect-dropdown-icon")}function _i(t,s){}function bi(t,s){t&1&&m(0,_i,0,0,"ng-template")}function yi(t,s){if(t&1&&(d(0,"span",27),m(1,bi,1,0,null,19),u()),t&2){let e=p(2);c(),r("ngTemplateOutlet",e.triggerIconTemplate||e._triggerIconTemplate)}}function Oi(t,s){if(t&1&&m(0,gi,1,1,"ChevronDownIcon",24)(1,yi,2,1,"span",25),t&2){let e=p();r("ngIf",!e.triggerIconTemplate&&!e._triggerIconTemplate),c(),r("ngIf",e.triggerIconTemplate||e._triggerIconTemplate)}}function vi(t,s){}function Ci(t,s){t&1&&m(0,vi,0,0,"ng-template")}function wi(t,s){}function xi(t,s){t&1&&m(0,wi,0,0,"ng-template")}function Ii(t,s){if(t&1){let e=S();d(0,"div",28,6),m(2,Ci,1,0,null,19),d(3,"div",29)(4,"p-cascadeselect-sub",30),v("onChange",function(i){h(e);let o=p();return f(o.onOptionClick(i))})("onFocusChange",function(i){h(e);let o=p();return f(o.onOptionMouseMove(i))})("onFocusEnterChange",function(i){h(e);let o=p();return f(o.onOptionMouseEnter(i))}),u()(),d(5,"span",14),b(6),u(),m(7,xi,1,0,null,19),u()}if(t&2){let e=p();Z(e.panelStyleClass),r("ngClass",Q(24,ti,e.queryMatches()))("ngStyle",e.panelStyle),y("data-pc-section","panel"),c(2),r("ngTemplateOutlet",e.headerTemplate||e._headerTemplate),c(),y("data-pc-section","wrapper"),c(),r("options",e.processedOptions)("selectId",e.id)("focusedOptionId",e.focused?e.focusedOptionId:void 0)("activeOptionPath",e.activeOptionPath())("optionLabel",e.optionLabel)("optionValue",e.optionValue)("level",0)("optionTemplate",e.optionTemplate||e._optionTemplate)("groupicon",e.groupIconTemplate||e.groupIconTemplate)("optionGroupLabel",e.optionGroupLabel)("optionGroupChildren",e.optionGroupChildren)("optionDisabled",e.optionDisabled)("root",!0)("dirty",e.dirty)("role","tree"),c(2),ie(" ",e.selectedMessageText," "),c(),r("ngTemplateOutlet",e.footerTemplate||e._footerTemplate)}}var Ti=({dt:t})=>`
|
|
2
2
|
.p-cascadeselect {
|
|
3
3
|
display: inline-flex;
|
|
4
4
|
cursor: pointer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v,b as H}from"./chunk-
|
|
1
|
+
import{a as v,b as H}from"./chunk-BU5IXVPY.js";import"./chunk-MPFBVM6S.js";import"./chunk-6ATDYFCA.js";import{a as F,b as I}from"./chunk-4LGDNQMZ.js";import"./chunk-5R3XKSDM.js";import{h as G}from"./chunk-AWXT2WGR.js";import{b as D,c as N}from"./chunk-C7LM5UCK.js";import{a as O,b as R}from"./chunk-J4XRJAME.js";import"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{w as V,x as j}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import"./chunk-FMVCTBCQ.js";import"./chunk-ZGXJEG37.js";import{a as $}from"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{i as A,m as P}from"./chunk-B63BKC6F.js";import{Cb as E,Jc as c,Kb as p,Kc as m,Mc as C,Nb as x,Ub as n,V as y,Vb as o,Wb as l,X as b,_b as w,dc as h,ec as s,gb as a,h as T,ha as f,pa as g,qa as d,ra as M,s as u,sa as S,wb as k,yc as B,zc as _}from"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var L=()=>({height:"calc(100vh - 100px)"});function z(i,q){if(i&1){let e=w();n(0,"div",3)(1,"p-button",4),h("onClick",function(){g(e);let r=s();return d(r.onFormat())}),o(),n(2,"p-button",5),c(3,"async"),c(4,"async"),h("onClick",function(){g(e);let r=s();return d(r.onMigrate())}),o()()}if(i&2){let e=s();a(2),p("disabled",m(3,2,e.countInBooks$)!==0)("pTooltip",m(4,4,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function J(i,q){if(i&1&&(n(0,"p-scroll-panel")(1,"p-panel")(2,"div",6),l(3,"app-migration-cards",7),c(4,"async"),M(),n(5,"svg",8),l(6,"path",9),o(),S(),l(7,"app-migration-cards",10),c(8,"async"),o()()()),i&2){let e=s();x(_(12,L)),a(),x(_(13,L)),a(2),p("migrationCount",m(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),a(4),p("migrationCount",m(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var le=(()=>{class i{constructor(){this.migrateService=f(v),this.toastr=f($),this.refresh$=new T(void 0),this.pageTitle="Expense Account"}ngOnInit(){let e=this.refresh$.pipe(b(()=>this.migrateService.getExpenseAccountCount()),y(1));this.countInPOS$=e.pipe(u(t=>Number(t.pos))),this.countInBooks$=e.pipe(u(t=>Number(t.books)))}onMigrate(){this.migrateService.migrateExpenseAccount().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormat(){window.confirm("Are you sure you want to format this data? This action cannot be undone.")&&this.migrateService.formatExpenseAccount().subscribe(t=>{this.refresh$.next(),this.toastr.success(t.message,"Format Successful")})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=k({type:i,selectors:[["app-expense-account"]],features:[B([v])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger",3,"onClick"],["label","Migrate","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(t,r){t&1&&(n(0,"app-main-panel",2),E(1,z,5,6,"ng-template",null,0,C)(3,J,9,14,"ng-template",null,1,C),o()),t&2&&p("pageTitle",r.pageTitle)},dependencies:[G,P,A,I,F,R,O,N,D,H,j,V],encapsulation:2})}}return i})();export{le as ExpenseAccountComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O,b as H}from"./chunk-
|
|
1
|
+
import{a as O,b as H}from"./chunk-BU5IXVPY.js";import"./chunk-MPFBVM6S.js";import"./chunk-6ATDYFCA.js";import{a as I,b as E}from"./chunk-4LGDNQMZ.js";import"./chunk-5R3XKSDM.js";import{h as G}from"./chunk-AWXT2WGR.js";import{b as D,c as N}from"./chunk-C7LM5UCK.js";import{a as j,b as R}from"./chunk-J4XRJAME.js";import"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{w as V,x as A}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import"./chunk-FMVCTBCQ.js";import"./chunk-ZGXJEG37.js";import{a as F}from"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{i as W,m as $}from"./chunk-B63BKC6F.js";import{Cb as B,Jc as s,Kb as p,Kc as m,Mc as x,Nb as h,Ub as o,V as y,Vb as n,Wb as c,X as T,Z as S,_b as w,dc as _,ec as l,gb as a,h as v,ha as u,pa as g,qa as d,ra as b,s as f,sa as k,wb as M,yc as P,zc as C}from"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var L=()=>({height:"calc(100vh - 100px)"});function z(i,q){if(i&1){let e=w();o(0,"div",3)(1,"p-button",4),_("onClick",function(){g(e);let r=l();return d(r.onFormat())}),n(),o(2,"p-button",5),s(3,"async"),s(4,"async"),_("onClick",function(){g(e);let r=l();return d(r.migrateWriteoffOutlet())}),n()()}if(i&2){let e=l();a(2),p("disabled",m(3,2,e.countInBooks$)!==0)("pTooltip",m(4,4,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function J(i,q){if(i&1&&(o(0,"p-scroll-panel")(1,"p-panel")(2,"div",6),c(3,"app-migration-cards",7),s(4,"async"),b(),o(5,"svg",8),c(6,"path",9),n(),k(),c(7,"app-migration-cards",10),s(8,"async"),n()()()),i&2){let e=l();h(C(12,L)),a(),h(C(13,L)),a(2),p("migrationCount",m(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),a(4),p("migrationCount",m(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var fe=(()=>{class i{constructor(){this.migrateService=u(O),this.toastr=u(F),this.refresh$=new v(void 0),this.pageTitle="Write-Off Outlet"}ngOnInit(){let e=this.refresh$.pipe(T(()=>this.migrateService.getWriteOffOutletAccountCount()),S(t=>console.log("API response:",t)),y(1));this.countInPOS$=e.pipe(f(t=>Number(t.pos))),this.countInBooks$=e.pipe(f(t=>Number(t.books)))}migrateWriteoffOutlet(){this.migrateService.migrateWriteOffOutlet().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormat(){confirm("Are you sure you want to format?")&&this.migrateService.formatWriteOff().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Format Successful")})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=M({type:i,selectors:[["app-writeoff-outlet"]],features:[P([O])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger",3,"onClick"],["label","Migrate","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(t,r){t&1&&(o(0,"app-main-panel",2),B(1,z,5,6,"ng-template",null,0,x)(3,J,9,14,"ng-template",null,1,x),n()),t&2&&p("pageTitle",r.pageTitle)},dependencies:[G,$,W,E,I,R,j,N,D,H,A,V],encapsulation:2})}}return i})();export{fe as WriteOffOutletComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as F}from"./chunk-EXGI2AG7.js";import{a as Be,b as Oe}from"./chunk-HHJMN4BS.js";import{a as He}from"./chunk-MDH73MG3.js";import{b as D}from"./chunk-ERFXO32T.js";import"./chunk-ZM5TVQUU.js";import{a as ae}from"./chunk-AGLKA7OG.js";import"./chunk-YOUPD27G.js";import{a as je}from"./chunk-XKI7WLHE.js";import"./chunk-AZUQDRJU.js";import"./chunk-C2GO6SPF.js";import{a as j,b as H}from"./chunk-O4QM64EH.js";import{d as ke,i as Pe,j as Me,k as ze}from"./chunk-EW3R2HAB.js";import{a as Fe,b as Je}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import"./chunk-PKN47FQE.js";import{a as Re,b as Ne}from"./chunk-LRRVQSMI.js";import"./chunk-42UIGXWH.js";import"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{g as Ae,h as De}from"./chunk-UYC454VQ.js";import{b as Te,c as Ve}from"./chunk-C7LM5UCK.js";import{a as Se,b as be}from"./chunk-J4XRJAME.js";import{a as w,b as ve,c as we,d as ye,e as Ee,f as Ie}from"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{n as ge,o as he,w as xe,x as Ce}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{b as le,c as pe,e as me,f as se,k as ce,l as ue,o as de,v as fe,y as _e}from"./chunk-FMVCTBCQ.js";import"./chunk-ZGXJEG37.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{c as ee,e as te,f as ie,i as ne,k as oe,m as re}from"./chunk-B63BKC6F.js";import{Ab as W,Ac as V,Cb as x,Ga as k,Jc as I,Kb as c,Kc as Z,Lc as A,Mc as v,Nb as $,Ub as r,Vb as o,Wb as S,X as N,Yc as T,Z as U,_b as y,bb as L,c as J,cb as G,dc as E,ec as _,gb as l,ha as C,pa as g,qa as h,qc as s,rc as b,s as R,sc as P,uc as q,vc as Q,wb as K,wc as M,xc as X,yc as Y,zc as z}from"./chunk-JP6RBSB3.js";import{a as u,b as f}from"./chunk-YQFG5XE2.js";var qe={data:{data:[],totalCount:0},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0}}},B=ve(Ie(qe),we(t=>({first:T(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:T(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:T(()=>t.data().data.some(a=>a.checked)),checkedAPCollection:T(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),Ee(t=>{let a=C(F),e=C(D);return{updateFilter(n){w(t,i=>f(u({},i),{filter:u(u({},i.filter),n)}))},onRowSelect(n){w(t,i=>{let d=i.data.data.map(m=>m.id===n.id?f(u({},m),{checked:!0}):m);return f(u({},i),{data:f(u({},i.data),{data:d})})})},onRowUnselect(n){w(t,i=>{let d=i.data.data.map(m=>m.id===n.id?f(u({},m),{checked:!1}):m);return f(u({},i),{data:f(u({},i.data),{data:d})})})},onHeaderCheckboxToggle(n){w(t,i=>{let d=i.data.data.map(m=>f(u({},m),{checked:n}));return f(u({},i),{data:f(u({},i.data),{data:d})})})},getAPLoader:j(J(N(()=>a.getAPJournalLoader().pipe(H({next:n=>{w(t,i=>f(u({},i),{meta:n}))},error:n=>{console.error("Error fetching AP journal:",n)}}))))),getARCollection:j(J(R(n=>Object.entries(n).reduce((i,[d,m])=>(m!=null&&(i[d]=m),i),{})),N(n=>a.getAPJournal(n).pipe(R(i=>f(u({},i),{data:i.data.map(d=>f(u({},d),{due:e.from(d.due)?e.from(d.due).format():null,checked:!1}))})),H({next:i=>{w(t,d=>f(u({},d),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),ye(t=>({onInit:()=>{t.getAPLoader(),t.getARCollection(t.filter)}})));var Qe=()=>({height:"calc(100vh - 70px)"}),O=t=>({"ng-invalid ng-dirty":t}),Xe=()=>({});function Ye(t,a){if(t&1){let e=y();r(0,"p-button",10),E("onClick",function(){g(e);let n=_(2);return h(n.onCreateJournal())}),o()}}function Ze(t,a){if(t&1&&x(0,Ye,1,0,"p-button",9),t&2){let e=_();c("ngIf",e.store.hasCheckedRows())}}function et(t,a){t&1&&(r(0,"tr")(1,"th",12),S(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),s(4,"Outlet"),o(),r(5,"th",14),s(6,"Number"),o(),r(7,"th",15),s(8,"Supplier"),o(),r(9,"th",16),s(10,"Date"),o(),r(11,"th",16),s(12,"Due"),o(),r(13,"th",15),s(14,"Note"),o(),r(15,"th",17),s(16,"Payment"),o(),S(17,"th",12),o())}function tt(t,a){if(t&1&&(r(0,"tr")(1,"td"),S(2,"p-tableCheckbox",18),o(),r(3,"td"),s(4),o(),r(5,"td")(6,"a",19),s(7),o()(),r(8,"td"),s(9),o(),r(10,"td"),s(11),I(12,"date"),o(),r(13,"td"),s(14),I(15,"date"),o(),r(16,"td"),S(17,"div",20),o(),r(18,"td"),s(19),o(),r(20,"td"),S(21,"p-button",21),o()()),t&2){let e=a.$implicit,p=_(2);l(2),c("value",e),l(2),b(e.outlet),l(2),c("href",p.authService.getTenantExternalURL()+"/menu/Debt/Debt/Join_Bill/New_Join_Bill/Info?ID="+e.id,G),l(),P(" ",e.number," "),l(2),b(e.customer),l(2),b(A(12,12,e.date,"d MMM y")),l(3),b(e.due?A(15,15,e.due,"d MMM y hh:mm"):"-"),l(3),c("innerHTML",e.note,L),l(2),b(e.payment),l(2),c("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function it(t,a){if(t&1&&s(0),t&2){let e=_(2);q(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function nt(t,a){t&1&&(r(0,"tr")(1,"td",22)(2,"span"),s(3,"No records found."),o()()())}function ot(t,a){if(t&1){let e=y();r(0,"p-panel")(1,"p-table",11),E("onPage",function(n){g(e);let i=_();return h(i.onPageChange(n))})("onHeaderCheckboxToggle",function(n){g(e);let i=_();return h(i.onHeaderCheckboxToggle(n))})("onRowSelect",function(n){g(e);let i=_();return h(i.onRowSelect(n))})("onRowUnselect",function(n){g(e);let i=_();return h(i.onRowUnselect(n))}),x(2,et,18,0,"ng-template",null,3,v)(4,tt,22,18,"ng-template",null,4,v)(6,it,1,3,"ng-template",null,5,v)(8,nt,4,0,"ng-template",null,6,v),o()()}if(t&2){let e=_();$(z(9,Qe)),l(),c("value",e.store.data().data)("scrollable",!0)("scrollHeight","calc(100vh - 142px)")("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function rt(t,a){if(t&1&&(r(0,"span",32),s(1),I(2,"truncate"),o()),t&2){let e=a.$implicit;c("pTooltip",e.name),l(),P(" ",A(2,2,e.name,30)," ")}}function at(t,a){if(t&1&&(r(0,"div")(1,"span",34),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function lt(t,a){if(t&1&&(r(0,"div"),x(1,at,3,1,"div",33),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("from"))}}function pt(t,a){if(t&1&&(r(0,"div")(1,"span",34),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function mt(t,a){if(t&1&&(r(0,"div"),x(1,pt,3,1,"div",33),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("to"))}}function st(t,a){if(t&1&&(r(0,"div")(1,"span",34),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function ct(t,a){if(t&1&&(r(0,"div"),x(1,st,3,1,"div",33),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("pageSize"))}}function ut(t,a){if(t&1){let e=y();r(0,"form",23)(1,"div",24)(2,"label",25),s(3,"Outlet"),o(),r(4,"p-select",26),x(5,rt,3,5,"ng-template",null,7,v),o()(),r(7,"div",24)(8,"label",25),s(9,"From"),o(),S(10,"p-datepicker",27),x(11,lt,2,1,"div",28),o(),r(12,"div",24)(13,"label",25),s(14,"To"),o(),S(15,"p-datepicker",29),x(16,mt,2,1,"div",28),o(),r(17,"div",24)(18,"label",25),s(19,"Supplier"),o(),r(20,"p-autocomplete",30),I(21,"async"),E("completeMethod",function(n){g(e);let i=_();return h(i.onSearchSupplier(n))}),o()(),r(22,"div",24)(23,"label",25),s(24,"Page Size"),o(),S(25,"input",31),x(26,ct,2,1,"div",28),o()()}if(t&2){let e=_();c("formGroup",e.form),l(4),c("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),l(6),c("iconDisplay","input")("showIcon",!0)("ngClass",V(17,O,e.isInvalid("from"))),l(),c("ngIf",e.isInvalid("from")),l(4),c("iconDisplay","input")("showIcon",!0)("ngClass",V(19,O,e.isInvalid("to"))),l(),c("ngIf",e.isInvalid("to")),l(4),c("suggestions",Z(21,15,e.supplierSuggestions$)),l(5),c("autoNumeric",z(21,Xe))("ngClass",V(22,O,e.isInvalid("pageSize"))),l(),c("ngIf",e.isInvalid("pageSize"))}}var ti=(()=>{class t extends je{constructor(){super(),this.store=C(B),this.generateJournalService=C(F),this.authService=C(ae),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=C(fe),this.dayjsService=C(D)}ngOnInit(){this.initform()}initform(){let{outletName:e,number:p,from:n,to:i,paymentState:d,supplierID:m,pageNumber:Ue,rowCount:Le,pageSize:Ge,export:Ke,exportPageNumber:We,exportRowCount:$e}=this.store.filter();this.form=this.fb.group({outletName:this.fb.control(e),number:this.fb.control(p),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),paymentState:this.fb.control(d),supplierID:this.fb.control(m),pageNumber:this.fb.control(Ue),rowCount:this.fb.control(Le),pageSize:this.fb.control(Ge,[pe.required]),export:this.fb.control(Ke),exportPageNumber:this.fb.control(We),exportRowCount:this.fb.control($e)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((p,[n,i])=>(i!=null&&(n==="from"||n==="to"?(typeof i=="string"||typeof i=="number"||i instanceof Date)&&(p[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null):p[n]=i),p),{});this.store.updateFilter(e),this.isDialogFilterVisible.update(p=>!p)}onSearch(e){this.store.updateFilter(f(u({},this.store.filter()),{number:e}))}onSearchSupplier(e){this.supplierSuggestions$=this.generateJournalService.getSupplierSuggestions(e.query).pipe()}onPageChange(e){let p=e.first/e.rows;this.store.updateFilter(f(u({},this.store.filter()),{pageNumber:p+1}))}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(p=>{this.store.onRowUnselect(p)});return}else this.store.onRowUnselect(e.data)}onCreateJournal(){this.generateJournalService.createAPJournal(this.store.checkedAPCollection()).pipe(U(()=>{this.store.getARCollection(this.store.filter)})).subscribe()}static{this.\u0275fac=function(p){return new(p||t)}}static{this.\u0275cmp=K({type:t,selectors:[["app-ap-journal"]],features:[Y([B]),W],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","AP Collection",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onHeaderCheckboxToggle","onRowSelect","onRowUnselect","value","scrollable","scrollHeight","paginator","rows","totalRecords","lazy"],[2,"width","4rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"innerHTML"],[3,"icon","severity","text"],["colspan","9"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["virtualScroll","","showClear","","filter","","filterBy","name","formControlName","outletName","appendTo","body","optionLabel","name","optionValue","name","placeholder","Select an Outlet",3,"virtualScrollItemSize","options"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["showClear","","formControlName","supplierID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(p,n){if(p&1){let i=y();r(0,"app-main-panel",8),X("isDialogFilterVisibleChange",function(m){return g(i),M(n.isDialogFilterVisible,m)||(n.isDialogFilterVisible=m),h(m)})("isInitDialogFilterVisibleChange",function(m){return g(i),M(n.isInitDialogFilterVisible,m)||(n.isInitDialogFilterVisible=m),h(m)}),E("filterConfirmed",function(){return g(i),h(n.onFilterOKEvent())})("search",function(m){return g(i),h(n.onSearch(m))}),x(1,Ze,1,1,"ng-template",null,0,v)(3,ot,10,10,"ng-template",null,1,v)(5,ut,27,24,"ng-template",null,2,v),o()}p&2&&(c("isSearchableInput",!0)("isFilterable",!0),Q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[De,ze,ke,Pe,Me,re,ee,te,ie,ne,oe,Ce,xe,be,Se,_e,ce,le,me,se,ue,de,Ne,Re,Je,Fe,he,ge,Oe,Be,Ve,Te,Ae,He],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{ti as ApJournalComponent};
|
|
1
|
+
import{a as F}from"./chunk-EXGI2AG7.js";import{a as Be,b as Oe}from"./chunk-HHJMN4BS.js";import{a as He}from"./chunk-P7Z64VPC.js";import{b as D}from"./chunk-MPFBVM6S.js";import"./chunk-6ATDYFCA.js";import{a as ae}from"./chunk-AGLKA7OG.js";import"./chunk-YOUPD27G.js";import{a as je}from"./chunk-XKI7WLHE.js";import"./chunk-AZUQDRJU.js";import"./chunk-C2GO6SPF.js";import{a as j,b as H}from"./chunk-O4QM64EH.js";import{d as ke,i as Pe,j as Me,k as ze}from"./chunk-EW3R2HAB.js";import{a as Fe,b as Je}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import"./chunk-PKN47FQE.js";import{a as Re,b as Ne}from"./chunk-LRRVQSMI.js";import"./chunk-42UIGXWH.js";import"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{g as Ae,h as De}from"./chunk-AWXT2WGR.js";import{b as Te,c as Ve}from"./chunk-C7LM5UCK.js";import{a as Se,b as be}from"./chunk-J4XRJAME.js";import{a as w,b as ve,c as we,d as ye,e as Ee,f as Ie}from"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{n as ge,o as he,w as xe,x as Ce}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{b as le,c as pe,e as me,f as se,k as ce,l as ue,o as de,v as fe,y as _e}from"./chunk-FMVCTBCQ.js";import"./chunk-ZGXJEG37.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{c as ee,e as te,f as ie,i as ne,k as oe,m as re}from"./chunk-B63BKC6F.js";import{Ab as W,Ac as V,Cb as x,Ga as k,Jc as I,Kb as c,Kc as Z,Lc as A,Mc as v,Nb as $,Ub as r,Vb as o,Wb as S,X as N,Yc as T,Z as U,_b as y,bb as L,c as J,cb as G,dc as E,ec as _,gb as l,ha as C,pa as g,qa as h,qc as s,rc as b,s as R,sc as P,uc as q,vc as Q,wb as K,wc as M,xc as X,yc as Y,zc as z}from"./chunk-JP6RBSB3.js";import{a as u,b as f}from"./chunk-YQFG5XE2.js";var qe={data:{data:[],totalCount:0},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0}}},B=ve(Ie(qe),we(t=>({first:T(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:T(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:T(()=>t.data().data.some(a=>a.checked)),checkedAPCollection:T(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),Ee(t=>{let a=C(F),e=C(D);return{updateFilter(n){w(t,i=>f(u({},i),{filter:u(u({},i.filter),n)}))},onRowSelect(n){w(t,i=>{let d=i.data.data.map(m=>m.id===n.id?f(u({},m),{checked:!0}):m);return f(u({},i),{data:f(u({},i.data),{data:d})})})},onRowUnselect(n){w(t,i=>{let d=i.data.data.map(m=>m.id===n.id?f(u({},m),{checked:!1}):m);return f(u({},i),{data:f(u({},i.data),{data:d})})})},onHeaderCheckboxToggle(n){w(t,i=>{let d=i.data.data.map(m=>f(u({},m),{checked:n}));return f(u({},i),{data:f(u({},i.data),{data:d})})})},getAPLoader:j(J(N(()=>a.getAPJournalLoader().pipe(H({next:n=>{w(t,i=>f(u({},i),{meta:n}))},error:n=>{console.error("Error fetching AP journal:",n)}}))))),getARCollection:j(J(R(n=>Object.entries(n).reduce((i,[d,m])=>(m!=null&&(i[d]=m),i),{})),N(n=>a.getAPJournal(n).pipe(R(i=>f(u({},i),{data:i.data.map(d=>f(u({},d),{due:e.from(d.due)?e.from(d.due).format():null,checked:!1}))})),H({next:i=>{w(t,d=>f(u({},d),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),ye(t=>({onInit:()=>{t.getAPLoader(),t.getARCollection(t.filter)}})));var Qe=()=>({height:"calc(100vh - 70px)"}),O=t=>({"ng-invalid ng-dirty":t}),Xe=()=>({});function Ye(t,a){if(t&1){let e=y();r(0,"p-button",10),E("onClick",function(){g(e);let n=_(2);return h(n.onCreateJournal())}),o()}}function Ze(t,a){if(t&1&&x(0,Ye,1,0,"p-button",9),t&2){let e=_();c("ngIf",e.store.hasCheckedRows())}}function et(t,a){t&1&&(r(0,"tr")(1,"th",12),S(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),s(4,"Outlet"),o(),r(5,"th",14),s(6,"Number"),o(),r(7,"th",15),s(8,"Supplier"),o(),r(9,"th",16),s(10,"Date"),o(),r(11,"th",16),s(12,"Due"),o(),r(13,"th",15),s(14,"Note"),o(),r(15,"th",17),s(16,"Payment"),o(),S(17,"th",18),o())}function tt(t,a){if(t&1&&(r(0,"tr")(1,"td"),S(2,"p-tableCheckbox",19),o(),r(3,"td"),s(4),o(),r(5,"td")(6,"a",20),s(7),o()(),r(8,"td"),s(9),o(),r(10,"td"),s(11),I(12,"date"),o(),r(13,"td"),s(14),I(15,"date"),o(),r(16,"td"),S(17,"div",21),o(),r(18,"td"),s(19),o(),r(20,"td"),S(21,"p-button",22),o()()),t&2){let e=a.$implicit,p=_(2);l(2),c("value",e),l(2),b(e.outlet),l(2),c("href",p.authService.getTenantExternalURL()+"/menu/Debt/Debt/Join_Bill/New_Join_Bill/Info?ID="+e.id,G),l(),P(" ",e.number," "),l(2),b(e.customer),l(2),b(A(12,12,e.date,"d MMM y")),l(3),b(e.due?A(15,15,e.due,"d MMM y hh:mm"):"-"),l(3),c("innerHTML",e.note,L),l(2),b(e.payment),l(2),c("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function it(t,a){if(t&1&&s(0),t&2){let e=_(2);q(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function nt(t,a){t&1&&(r(0,"tr")(1,"td",23)(2,"span"),s(3,"No records found."),o()()())}function ot(t,a){if(t&1){let e=y();r(0,"p-panel")(1,"p-table",11),E("onPage",function(n){g(e);let i=_();return h(i.onPageChange(n))})("onHeaderCheckboxToggle",function(n){g(e);let i=_();return h(i.onHeaderCheckboxToggle(n))})("onRowSelect",function(n){g(e);let i=_();return h(i.onRowSelect(n))})("onRowUnselect",function(n){g(e);let i=_();return h(i.onRowUnselect(n))}),x(2,et,18,0,"ng-template",null,3,v)(4,tt,22,18,"ng-template",null,4,v)(6,it,1,3,"ng-template",null,5,v)(8,nt,4,0,"ng-template",null,6,v),o()()}if(t&2){let e=_();$(z(9,Qe)),l(),c("value",e.store.data().data)("scrollable",!0)("scrollHeight","calc(100vh - 142px)")("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function rt(t,a){if(t&1&&(r(0,"span",33),s(1),I(2,"truncate"),o()),t&2){let e=a.$implicit;c("pTooltip",e.name),l(),P(" ",A(2,2,e.name,30)," ")}}function at(t,a){if(t&1&&(r(0,"div")(1,"span",35),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function lt(t,a){if(t&1&&(r(0,"div"),x(1,at,3,1,"div",34),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("from"))}}function pt(t,a){if(t&1&&(r(0,"div")(1,"span",35),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function mt(t,a){if(t&1&&(r(0,"div"),x(1,pt,3,1,"div",34),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("to"))}}function st(t,a){if(t&1&&(r(0,"div")(1,"span",35),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function ct(t,a){if(t&1&&(r(0,"div"),x(1,st,3,1,"div",34),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("pageSize"))}}function ut(t,a){if(t&1){let e=y();r(0,"form",24)(1,"div",25)(2,"label",26),s(3,"Outlet"),o(),r(4,"p-select",27),x(5,rt,3,5,"ng-template",null,7,v),o()(),r(7,"div",25)(8,"label",26),s(9,"From"),o(),S(10,"p-datepicker",28),x(11,lt,2,1,"div",29),o(),r(12,"div",25)(13,"label",26),s(14,"To"),o(),S(15,"p-datepicker",30),x(16,mt,2,1,"div",29),o(),r(17,"div",25)(18,"label",26),s(19,"Supplier"),o(),r(20,"p-autocomplete",31),I(21,"async"),E("completeMethod",function(n){g(e);let i=_();return h(i.onSearchSupplier(n))}),o()(),r(22,"div",25)(23,"label",26),s(24,"Page Size"),o(),S(25,"input",32),x(26,ct,2,1,"div",29),o()()}if(t&2){let e=_();c("formGroup",e.form),l(4),c("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),l(6),c("iconDisplay","input")("showIcon",!0)("ngClass",V(17,O,e.isInvalid("from"))),l(),c("ngIf",e.isInvalid("from")),l(4),c("iconDisplay","input")("showIcon",!0)("ngClass",V(19,O,e.isInvalid("to"))),l(),c("ngIf",e.isInvalid("to")),l(4),c("suggestions",Z(21,15,e.supplierSuggestions$)),l(5),c("autoNumeric",z(21,Xe))("ngClass",V(22,O,e.isInvalid("pageSize"))),l(),c("ngIf",e.isInvalid("pageSize"))}}var ti=(()=>{class t extends je{constructor(){super(),this.store=C(B),this.generateJournalService=C(F),this.authService=C(ae),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=C(fe),this.dayjsService=C(D)}ngOnInit(){this.initform()}initform(){let{outletName:e,number:p,from:n,to:i,paymentState:d,supplierID:m,pageNumber:Ue,rowCount:Le,pageSize:Ge,export:Ke,exportPageNumber:We,exportRowCount:$e}=this.store.filter();this.form=this.fb.group({outletName:this.fb.control(e),number:this.fb.control(p),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),paymentState:this.fb.control(d),supplierID:this.fb.control(m),pageNumber:this.fb.control(Ue),rowCount:this.fb.control(Le),pageSize:this.fb.control(Ge,[pe.required]),export:this.fb.control(Ke),exportPageNumber:this.fb.control(We),exportRowCount:this.fb.control($e)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((p,[n,i])=>(i!=null&&(n==="from"||n==="to"?(typeof i=="string"||typeof i=="number"||i instanceof Date)&&(p[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null):p[n]=i),p),{});this.store.updateFilter(e),this.isDialogFilterVisible.update(p=>!p)}onSearch(e){this.store.updateFilter(f(u({},this.store.filter()),{number:e}))}onSearchSupplier(e){this.supplierSuggestions$=this.generateJournalService.getSupplierSuggestions(e.query).pipe()}onPageChange(e){let p=e.first/e.rows;this.store.updateFilter(f(u({},this.store.filter()),{pageNumber:p+1}))}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(p=>{this.store.onRowUnselect(p)});return}else this.store.onRowUnselect(e.data)}onCreateJournal(){this.generateJournalService.createAPJournal(this.store.checkedAPCollection()).pipe(U(()=>{this.store.getARCollection(this.store.filter)})).subscribe()}static{this.\u0275fac=function(p){return new(p||t)}}static{this.\u0275cmp=K({type:t,selectors:[["app-ap-journal"]],features:[Y([B]),W],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","AP Collection",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onHeaderCheckboxToggle","onRowSelect","onRowUnselect","value","scrollable","scrollHeight","paginator","rows","totalRecords","lazy"],[2,"width","1rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[2,"width","4rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"innerHTML"],[3,"icon","severity","text"],["colspan","9"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["virtualScroll","","showClear","","filter","","filterBy","name","formControlName","outletName","appendTo","body","optionLabel","name","optionValue","name","placeholder","Select an Outlet",3,"virtualScrollItemSize","options"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["showClear","","formControlName","supplierID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(p,n){if(p&1){let i=y();r(0,"app-main-panel",8),X("isDialogFilterVisibleChange",function(m){return g(i),M(n.isDialogFilterVisible,m)||(n.isDialogFilterVisible=m),h(m)})("isInitDialogFilterVisibleChange",function(m){return g(i),M(n.isInitDialogFilterVisible,m)||(n.isInitDialogFilterVisible=m),h(m)}),E("filterConfirmed",function(){return g(i),h(n.onFilterOKEvent())})("search",function(m){return g(i),h(n.onSearch(m))}),x(1,Ze,1,1,"ng-template",null,0,v)(3,ot,10,10,"ng-template",null,1,v)(5,ut,27,24,"ng-template",null,2,v),o()}p&2&&(c("isSearchableInput",!0)("isFilterable",!0),Q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[De,ze,ke,Pe,Me,re,ee,te,ie,ne,oe,Ce,xe,be,Se,_e,ce,le,me,se,ue,de,Ne,Re,Je,Fe,he,ge,Oe,Be,Ve,Te,Ae,He],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{ti as ApJournalComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v,b as L}from"./chunk-
|
|
1
|
+
import{a as v,b as L}from"./chunk-BU5IXVPY.js";import"./chunk-MPFBVM6S.js";import"./chunk-6ATDYFCA.js";import{a as I,b as E}from"./chunk-4LGDNQMZ.js";import"./chunk-5R3XKSDM.js";import{h as H}from"./chunk-AWXT2WGR.js";import{b as N,c as G}from"./chunk-C7LM5UCK.js";import{a as R,b as D}from"./chunk-J4XRJAME.js";import"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{w as V,x as j}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import"./chunk-FMVCTBCQ.js";import"./chunk-ZGXJEG37.js";import{a as F}from"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{i as w,m as $}from"./chunk-B63BKC6F.js";import{Cb as B,Jc as c,Kb as p,Kc as s,Mc as x,Nb as h,Ub as n,V as T,Vb as o,Wb as m,X as M,Z as S,_b as O,dc as _,ec as l,gb as a,h as y,ha as f,pa as g,qa as d,ra as b,s as u,sa as k,wb as A,yc as P,zc as C}from"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var q=()=>({height:"calc(100vh - 100px)"});function J(i,z){if(i&1){let t=O();n(0,"div",3)(1,"p-button",4),_("onClick",function(){g(t);let r=l();return d(r.onFormat())}),o(),n(2,"p-button",5),c(3,"async"),c(4,"async"),_("onClick",function(){g(t);let r=l();return d(r.onMigrateOutletAccount())}),o()()}if(i&2){let t=l();a(2),p("disabled",s(3,2,t.countInBooks$)!==0)("pTooltip",s(4,4,t.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function K(i,z){if(i&1&&(n(0,"p-scroll-panel")(1,"p-panel")(2,"div",6),m(3,"app-migration-cards",7),c(4,"async"),b(),n(5,"svg",8),m(6,"path",9),o(),k(),m(7,"app-migration-cards",10),c(8,"async"),o()()()),i&2){let t=l();h(C(12,q)),a(),h(C(13,q)),a(2),p("migrationCount",s(4,8,t.countInPOS$))("migrationTitle",t.pageTitle),a(4),p("migrationCount",s(8,10,t.countInBooks$))("migrationTitle",t.pageTitle)}}var ut=(()=>{class i{constructor(){this.migrateService=f(v),this.toastr=f(F),this.refresh$=new y(void 0),this.pageTitle="Outlet Account"}ngOnInit(){let t=this.refresh$.pipe(M(()=>this.migrateService.getOutletAccountCount()),S(e=>console.log("API response:",e)),T(1));this.countInPOS$=t.pipe(u(e=>Number(e.pos))),this.countInBooks$=t.pipe(u(e=>Number(e.books)))}onMigrateOutletAccount(){this.migrateService.migrateOutletAccount().subscribe(t=>{this.refresh$.next(),this.toastr.success(t.message,"Migration Successful")})}onFormat(){confirm("Are you sure you want to format?")&&this.migrateService.formatOutletAccount().subscribe(t=>{this.refresh$.next(),this.toastr.success(t.message,"Format Successful")})}static{this.\u0275fac=function(e){return new(e||i)}}static{this.\u0275cmp=A({type:i,selectors:[["app-outlet-account"]],features:[P([v])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger",3,"onClick"],["label","Migrate","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(e,r){e&1&&(n(0,"app-main-panel",2),B(1,J,5,6,"ng-template",null,0,x)(3,K,9,14,"ng-template",null,1,x),o()),e&2&&p("pageTitle",r.pageTitle)},dependencies:[H,$,w,j,V,E,I,D,R,G,N,L],encapsulation:2})}}return i})();export{ut as OutletAccountComponent};
|