dealposbooks 5.48.0 → 5.49.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/3rdpartylicenses.txt +5 -5
- package/assets/scss/layouts/_sidebar.scss +2 -1
- package/assets/scss/style.scss +10 -0
- package/chunk-2A5KXVYV.js +129 -0
- package/{chunk-DDM2KWNX.js → chunk-2LNMV22E.js} +1 -1
- package/chunk-2RHKXE62.js +1 -0
- package/chunk-2RKPDCYU.js +1 -0
- package/chunk-4KDA7ZRZ.js +1 -0
- package/chunk-4ZU2FOSO.js +1 -0
- package/chunk-5DRALZZF.js +1 -0
- package/chunk-5M5KVWZB.js +1 -0
- package/{chunk-SFMFIWMX.js → chunk-5YGRLXFR.js} +1 -1
- package/chunk-6RB67IF5.js +1 -0
- package/chunk-7HVUWEG2.js +1 -0
- package/chunk-A5Q65V4N.js +1 -0
- package/{chunk-W63NE6LU.js → chunk-ADODNO5M.js} +4 -4
- package/chunk-AJA5W4PQ.js +1 -0
- package/chunk-AOQH3HTB.js +1 -0
- package/chunk-BRKRIPYY.js +1 -0
- package/{chunk-NNNKDAA2.js → chunk-CAS5GLLU.js} +1 -1
- package/chunk-CLWQ53HX.js +1 -0
- package/{chunk-F6LZM7H5.js → chunk-DGACZ747.js} +1 -1
- package/{chunk-FSB3LHPU.js → chunk-EBEY2MBR.js} +1 -1
- package/{chunk-RXR5DXWS.js → chunk-ELMSU4U7.js} +1 -1
- package/chunk-ER5Y4FMF.js +1 -0
- package/chunk-ERG2YCYC.js +1 -0
- package/{chunk-VW2FJYIZ.js → chunk-ES2YST7G.js} +1 -1
- package/{chunk-LBREDZL5.js → chunk-FWAGEKIF.js} +1 -1
- package/{chunk-LXLOWSN6.js → chunk-HCJK6VTO.js} +1 -1
- package/chunk-HECYO7RI.js +1 -0
- package/chunk-IMQMRA4Y.js +1 -0
- package/chunk-IW7TNRJO.js +1 -0
- package/chunk-J3R2TUSM.js +1 -0
- package/{chunk-NPXVSAMB.js → chunk-JLFNJ2HH.js} +1 -1
- package/chunk-K4IULEBH.js +1 -0
- package/chunk-KSPR5HTA.js +130 -0
- package/chunk-L6PLE5U4.js +1 -0
- package/{chunk-EQTP2O7O.js → chunk-LOLOGGWA.js} +1 -1
- package/chunk-MV52MU2A.js +1 -0
- package/chunk-NMU2YBAB.js +1 -0
- package/{chunk-VKT27VPR.js → chunk-O3XDMCQO.js} +2 -2
- package/chunk-O54WM4PU.js +1 -0
- package/chunk-O7PTQ6FD.js +1 -0
- package/{chunk-2JNXKEYZ.js → chunk-OPSSYJMR.js} +1 -1
- package/chunk-OQRWMLXY.js +1 -0
- package/chunk-OZXIWJFE.js +1 -0
- package/{chunk-BG6BR7KI.js → chunk-PKO36DGM.js} +1 -1
- package/chunk-Q3HB53OC.js +1 -0
- package/{chunk-UEFTMQDF.js → chunk-Q4KG7LH6.js} +1 -1
- package/chunk-QJGYGXL3.js +202 -0
- package/chunk-STBJVKOH.js +7 -0
- package/{chunk-FUCKNGW4.js → chunk-SWU3XDYQ.js} +2 -2
- package/chunk-TFW2HBFA.js +1 -0
- package/chunk-TON77VSP.js +1 -0
- package/chunk-U57VXKUE.js +1 -0
- package/{chunk-CEK7MQW2.js → chunk-UHOHG6YG.js} +1 -1
- package/chunk-ULAE6ZMS.js +1 -0
- package/chunk-VCUOMA7I.js +1 -0
- package/{chunk-T367AQJ2.js → chunk-VKNINE5Q.js} +1 -1
- package/chunk-WDT3X7BX.js +1 -0
- package/chunk-WTU5HM6J.js +8 -0
- package/{chunk-FVYL3BQ7.js → chunk-WUMR7VK2.js} +1 -1
- package/{chunk-YPOBALKC.js → chunk-XLEICBBP.js} +1 -1
- package/chunk-XVAFZB6H.js +1 -0
- package/{chunk-ZQWFATZY.js → chunk-ZIZHSXQM.js} +1 -1
- package/chunk-ZXJEHHMR.js +1 -0
- package/index.html +2 -2
- package/main-P47IKABJ.js +1 -0
- package/package.json +1 -1
- package/{styles-4L5CAR46.css → styles-FYY2LVCE.css} +1 -1
- package/chunk-2H7KQZEC.js +0 -8
- package/chunk-3NWFEFT2.js +0 -1
- package/chunk-4LI7GDDM.js +0 -1
- package/chunk-5FV7K5RQ.js +0 -1
- package/chunk-6GQ4PTPT.js +0 -7
- package/chunk-7OP477BS.js +0 -1
- package/chunk-7WCUKMRG.js +0 -1
- package/chunk-ACDLAA4B.js +0 -1
- package/chunk-B3VZ2ZHJ.js +0 -1
- package/chunk-BNPR5SPH.js +0 -1
- package/chunk-CVDRHTES.js +0 -1
- package/chunk-CZSVRFCL.js +0 -1
- package/chunk-DSZOROE6.js +0 -1
- package/chunk-F3RSX7TC.js +0 -1
- package/chunk-G42V3ZZU.js +0 -1
- package/chunk-H7GQCGCR.js +0 -1
- package/chunk-IDHDHBFV.js +0 -202
- package/chunk-JE4XET33.js +0 -1
- package/chunk-LCKRY7CZ.js +0 -1
- package/chunk-O76TW6JA.js +0 -1
- package/chunk-OVDG3ZBT.js +0 -1
- package/chunk-PQL4GCC5.js +0 -1
- package/chunk-RE5GBQH6.js +0 -1
- package/chunk-S2BFXF7C.js +0 -1
- package/chunk-SUXEBUIX.js +0 -1
- package/chunk-SV6BE4HG.js +0 -130
- package/chunk-TOGXYKTE.js +0 -1
- package/chunk-UI2UMYSE.js +0 -1
- package/chunk-V22QPBAO.js +0 -1
- package/chunk-VVAI7ZGN.js +0 -1
- package/chunk-W5E37PZP.js +0 -1
- package/chunk-WKHQICFW.js +0 -1
- package/chunk-WOYTUHJD.js +0 -1
- package/chunk-WPJGKTVO.js +0 -129
- package/chunk-XCTUTMD3.js +0 -1
- package/chunk-XOSALV7T.js +0 -1
- package/chunk-Y7SF5NXD.js +0 -1
- package/main-XTOQBEFQ.js +0 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import{a as ie,b as kt}from"./chunk-FWAGEKIF.js";import{f as Tt}from"./chunk-RM5HLXNW.js";import"./chunk-E6SW7I4D.js";import{a as vt}from"./chunk-G4XX7EU2.js";import{a as yt}from"./chunk-XKI7WLHE.js";import{a as Ct}from"./chunk-ELMSU4U7.js";import"./chunk-VDXZGF3M.js";import"./chunk-MHRSQRHT.js";import{a as st}from"./chunk-6WWXJJID.js";import"./chunk-U2VDC52W.js";import{a as ee,b as te}from"./chunk-3VQUNDVT.js";import{d as gt,i as wt,j as bt,k as xt}from"./chunk-DGACZ747.js";import"./chunk-EBEY2MBR.js";import"./chunk-AMGBUOC4.js";import"./chunk-UPSNJEHO.js";import"./chunk-VKNINE5Q.js";import"./chunk-E7QWESN4.js";import{a as ft,b as ht}from"./chunk-AN4SAUSA.js";import"./chunk-URH77XNK.js";import"./chunk-PPXXWO4E.js";import"./chunk-3DBSHDAQ.js";import"./chunk-M4SSELXT.js";import"./chunk-QPPFPDWZ.js";import"./chunk-WMZF4DQK.js";import{i as _t}from"./chunk-ADODNO5M.js";import{a as Ye}from"./chunk-S27Z7D3D.js";import{a as ot,b as at}from"./chunk-AD247LWQ.js";import{b as E,c as lt,d as pt,e as ct,f as mt,g as dt,h as ut}from"./chunk-BKTBVFNX.js";import"./chunk-ZFNIPERQ.js";import{a as Xe,f as O,k as et,m as tt,o as it,s as nt,w as Y,x as rt}from"./chunk-ME4ALIS7.js";import"./chunk-DTYVTTET.js";import{A as Ge,C as $e,K as Ze,La as We,Ma as X,Ua as Ke,c as K,e as He,f as Ne,l as Qe,ma as Je,o as ze,u as je,x as qe,z as fe}from"./chunk-VMI3QWC6.js";import{b as Re,d as Ae,e as Oe}from"./chunk-F7PVAVLQ.js";import"./chunk-Q3HB53OC.js";import"./chunk-5DRALZZF.js";import"./chunk-2BI7WNJP.js";import{h as Z,k as J,m as Le,p as Me,s as W}from"./chunk-ZK43JB4A.js";import{c as Be,d as ce,f as me,h as de,i as ue,k as _e}from"./chunk-F2X3VGZZ.js";import{$b as U,$c as Ve,Aa as N,Cb as z,Dc as $,Eb as u,Fc as I,Gc as De,Ha as L,Kc as Ee,Lb as F,Mb as p,Oc as Fe,Pb as Ce,Qb as ae,Qc as Ue,Rb as j,Sb as M,Sc as x,Ub as R,Vb as A,Wb as l,Xb as a,Y as H,Yb as y,Zb as ye,_ as re,_b as ve,_c as D,ac as S,bd as P,c as B,ca as we,cd as Pe,da as be,fc as b,gc as c,hc as Te,ia as C,ib as s,ic as ke,lc as V,mc as q,nc as v,oc as T,qa as _,ra as f,rc as Se,sc as d,tc as k,ua as oe,uc as G,wc as Ie,xc as se,yb as Q,yc as le,zb as xe,zc as pe}from"./chunk-6QJHEOXN.js";import{a as h,b as g}from"./chunk-YQFG5XE2.js";var Dt={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:"",accessTypeID:1,listJournalTagID:[]},options:{users:[],groups:[],accessTypes:[],journalTags:[]}}},he=lt(ut("UserStore"),dt(Dt),pt(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)})),mt(t=>{let o=C(ie);return{setFilter(n){E(t,i=>g(h({},i),{filter:n}))},onRowSelect(n){E(t,i=>{let r=i.data.map(m=>m.userID===n.userID?g(h({},m),{checked:!0}):m);return g(h({},i),{data:r})})},onRowUnselect(n){E(t,i=>{let r=i.data.map(m=>m.userID===n.userID?g(h({},m),{checked:!1}):m);return g(h({},i),{data:r})})},onHeaderCheckboxToggle(n){let i=localStorage.getItem("AUTH_USERNAME");E(t,r=>{let m=r.data.map(w=>w.userName!==i?g(h({},w),{checked:n}):g(h({},w),{checked:!1}));return g(h({},r),{data:m})})},getUserLoader:ee(B(H(()=>o.getUserLoaderList().pipe(te({next:n=>{E(t,i=>g(h({},i),{meta:n}))},error:n=>{console.error("Failed to fetch user loader list:",n)}}))))),getUserFormMeta:ee(B(H(n=>o.getUserFormMeta(n).pipe(te({next:i=>{E(t,r=>g(h({},r),{metaForm:i}))},error:i=>{console.error("Failed to fetch user form meta:",i)}}))))),getUsers:ee(B(H(n=>o.getUsers(n).pipe(te({next:i=>{E(t,r=>g(h({},r),{data:i.data.map(m=>g(h({},m),{checked:!1})),count:i.count}))},error:i=>{console.error("Failed to fetch users:",i)}})))))}}),ct({onInit:t=>{t.getUserLoader(),t.getUsers(t.filter)}}));var Ut=["header"],Vt=["footer"],Pt=["content"],Lt=["closeicon"],Mt=["headless"],Rt=["maskRef"],At=["container"],Ot=["closeButton"],Bt=["*"],Ht=(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}),Nt=(t,o)=>({transform:t,transition:o}),Qt=t=>({value:"visible",params:t});function zt(t,o){t&1&&U(0)}function jt(t,o){if(t&1&&u(0,zt,1,0,"ng-container",4),t&2){let e=c(2);p("ngTemplateOutlet",e.headlessTemplate||e._headlessTemplate)}}function qt(t,o){t&1&&U(0)}function Gt(t,o){if(t&1&&(l(0,"div"),d(1),a()),t&2){let e=c(3);ae(e.cx("title")),s(),k(e.header)}}function $t(t,o){t&1&&y(0,"TimesIcon"),t&2&&F("data-pc-section","closeicon")}function Zt(t,o){}function Jt(t,o){t&1&&u(0,Zt,0,0,"ng-template")}function Wt(t,o){if(t&1&&u(0,$t,1,1,"TimesIcon",8)(1,Jt,1,0,null,4),t&2){let e=c(4);p("ngIf",!e.closeIconTemplate&&!e._closeIconTemplate),s(),p("ngTemplateOutlet",e.closeIconTemplate||e._closeIconTemplate)}}function Kt(t,o){if(t&1){let e=S();l(0,"p-button",9),b("onClick",function(i){_(e);let r=c(3);return f(r.close(i))})("keydown.enter",function(i){_(e);let r=c(3);return f(r.close(i))}),u(1,Wt,2,2,"ng-template",null,1,x),a()}if(t&2){let e=c(3);p("ngClass",e.cx("closeButton"))("buttonProps",e.closeButtonProps)("ariaLabel",e.ariaCloseLabel),F("data-pc-section","closebutton")("data-pc-group-section","iconcontainer")}}function Xt(t,o){t&1&&U(0)}function Yt(t,o){t&1&&U(0)}function ei(t,o){if(t&1&&(ye(0),l(1,"div",5),u(2,Yt,1,0,"ng-container",4),a(),ve()),t&2){let e=c(3);s(),p("ngClass",e.cx("footer")),F("data-pc-section","footer"),s(),p("ngTemplateOutlet",e.footerTemplate||e._footerTemplate)}}function ti(t,o){if(t&1&&(l(0,"div",5),u(1,qt,1,0,"ng-container",4)(2,Gt,2,3,"div",6)(3,Kt,3,5,"p-button",7),a(),l(4,"div",5),ke(5),u(6,Xt,1,0,"ng-container",4),a(),u(7,ei,3,3,"ng-container",8)),t&2){let e=c(2);p("ngClass",e.cx("header")),F("data-pc-section","header"),s(),p("ngTemplateOutlet",e.headerTemplate||e._headerTemplate),s(),p("ngIf",e.header),s(),p("ngIf",e.showCloseIcon&&e.closable),s(),p("ngClass",e.cx("content")),F("data-pc-section","content"),s(2),p("ngTemplateOutlet",e.contentTemplate||e._contentTemplate),s(),p("ngIf",e.footerTemplate||e._footerTemplate)}}function ii(t,o){if(t&1){let e=S();l(0,"div",3,0),b("@panelState.start",function(i){_(e);let r=c();return f(r.onAnimationStart(i))})("@panelState.done",function(i){_(e);let r=c();return f(r.onAnimationEnd(i))})("keydown",function(i){_(e);let r=c();return f(r.onKeyDown(i))}),u(2,jt,1,1,"ng-container")(3,ti,8,9),a()}if(t&2){let e=c();Ce(e.style),ae(e.styleClass),p("ngClass",Ee(9,Ht,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",I(19,Qt,De(16,Nt,e.transformOptions,e.transitionOptions))),F("data-pc-name","sidebar")("data-pc-section","root"),s(2),j(e.headlessTemplate||e._headlessTemplate?2:3)}}var ni=({dt:t})=>`
|
|
2
|
+
.p-drawer {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
pointer-events: auto;
|
|
6
|
+
transform: translate3d(0px, 0px, 0px);
|
|
7
|
+
position: fixed;
|
|
8
|
+
transition: transform 0.3s;
|
|
9
|
+
background: ${t("drawer.background")};
|
|
10
|
+
color: ${t("drawer.color")};
|
|
11
|
+
border: 1px solid ${t("drawer.border.color")};
|
|
12
|
+
box-shadow: ${t("drawer.shadow")};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.p-drawer-content {
|
|
16
|
+
overflow-y: auto;
|
|
17
|
+
flex-grow: 1;
|
|
18
|
+
padding: ${t("drawer.content.padding")};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.p-drawer-header {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
flex-shrink: 0;
|
|
26
|
+
padding: ${t("drawer.header.padding")};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.p-drawer-footer {
|
|
30
|
+
padding: ${t("drawer.header.padding")};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.p-drawer-title {
|
|
34
|
+
font-weight: ${t("drawer.title.font.weight")};
|
|
35
|
+
font-size: ${t("drawer.title.font.size")};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.p-drawer-full .p-drawer {
|
|
39
|
+
transition: none;
|
|
40
|
+
transform: none;
|
|
41
|
+
width: 100vw !important;
|
|
42
|
+
height: 100vh !important;
|
|
43
|
+
max-height: 100%;
|
|
44
|
+
top: 0px !important;
|
|
45
|
+
left: 0px !important;
|
|
46
|
+
border-width: 1px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.p-drawer-left .p-drawer {
|
|
50
|
+
align-self: start;
|
|
51
|
+
width: 20rem;
|
|
52
|
+
height: 100%;
|
|
53
|
+
border-right-width: 1px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.p-drawer-right .p-drawer {
|
|
57
|
+
align-self: end;
|
|
58
|
+
width: 20rem;
|
|
59
|
+
height: 100%;
|
|
60
|
+
border-left-width: 1px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.p-drawer-top .p-drawer {
|
|
64
|
+
height: 10rem;
|
|
65
|
+
width: 100%;
|
|
66
|
+
border-bottom-width: 1px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.p-drawer-bottom .p-drawer {
|
|
70
|
+
height: 10rem;
|
|
71
|
+
width: 100%;
|
|
72
|
+
border-top-width: 1px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.p-drawer-left .p-drawer-content,
|
|
76
|
+
.p-drawer-right .p-drawer-content,
|
|
77
|
+
.p-drawer-top .p-drawer-content,
|
|
78
|
+
.p-drawer-bottom .p-drawer-content {
|
|
79
|
+
width: 100%;
|
|
80
|
+
height: 100%;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.p-drawer-open {
|
|
84
|
+
display: flex;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.p-drawer-top {
|
|
88
|
+
justify-content: flex-start;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.p-drawer-bottom {
|
|
92
|
+
justify-content: flex-end;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.p-drawer {
|
|
96
|
+
position: fixed;
|
|
97
|
+
transition: transform 0.3s;
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.p-drawer-content {
|
|
103
|
+
position: relative;
|
|
104
|
+
overflow-y: auto;
|
|
105
|
+
flex-grow: 1;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.p-drawer-header {
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.p-drawer-footer {
|
|
114
|
+
margin-top: auto;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.p-drawer-icon {
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
justify-content: center;
|
|
121
|
+
margin-left: auto;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.p-drawer-left {
|
|
125
|
+
top: 0;
|
|
126
|
+
left: 0;
|
|
127
|
+
width: 20rem;
|
|
128
|
+
height: 100%;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.p-drawer-right {
|
|
132
|
+
top: 0;
|
|
133
|
+
right: 0;
|
|
134
|
+
width: 20rem;
|
|
135
|
+
height: 100%;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.p-drawer-top {
|
|
139
|
+
top: 0;
|
|
140
|
+
left: 0;
|
|
141
|
+
width: 100%;
|
|
142
|
+
height: 10rem;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.p-drawer-bottom {
|
|
146
|
+
bottom: 0;
|
|
147
|
+
left: 0;
|
|
148
|
+
width: 100%;
|
|
149
|
+
height: 10rem;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.p-drawer-full {
|
|
153
|
+
width: 100%;
|
|
154
|
+
height: 100%;
|
|
155
|
+
top: 0;
|
|
156
|
+
left: 0;
|
|
157
|
+
-webkit-transition: none;
|
|
158
|
+
transition: none;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.p-drawer-mask {
|
|
162
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
163
|
+
transition-duration: 0.2s;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.p-overlay-mask {
|
|
167
|
+
position: fixed;
|
|
168
|
+
top: 0;
|
|
169
|
+
left: 0;
|
|
170
|
+
width: 100%;
|
|
171
|
+
height: 100%;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.p-overlay-mask:dir(rtl) {
|
|
175
|
+
flex-direction: row-reverse;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.p-overlay-mask-enter {
|
|
179
|
+
animation: p-overlay-mask-enter-animation 150ms forwards;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.p-overlay-mask-leave {
|
|
183
|
+
animation: p-overlay-mask-leave-animation 150ms forwards;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@keyframes p-overlay-mask-enter-animation {
|
|
187
|
+
from {
|
|
188
|
+
background-color: transparent;
|
|
189
|
+
}
|
|
190
|
+
to {
|
|
191
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
@keyframes p-overlay-mask-leave-animation {
|
|
195
|
+
from {
|
|
196
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
197
|
+
}
|
|
198
|
+
to {
|
|
199
|
+
background-color: transparent;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
`,ri={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"})},oi={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"},St=(()=>{class t extends Ke{name="drawer";theme=ni;classes=oi;inlineStyles=ri;static \u0275fac=(()=>{let e;return function(i){return(e||(e=oe(t)))(i||t)}})();static \u0275prov=we({token:t,factory:t.\u0275fac})}return t})();var ai=ue([me({transform:"{{transform}}",opacity:0}),ce("{{transition}}")]),si=ue([ce("{{transition}}",me({transform:"{{transform}}",opacity:0}))]),ge=(()=>{class t extends Xe{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 N;onHide=new N;visibleChange=new N;maskRef;containerViewChild;closeButtonViewChild;initialized;_visible;_position="left";_fullScreen=!1;container;transformOptions="translate3d(-100%, 0px, 0px)";mask;maskClickListener;documentEscapeListener;animationEndListener;_componentStyle=C(St);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&&O.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),Je(this.mask,"style",this.maskStyle),fe(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&&(fe(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&&$e(),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),O.clear(this.container),this.unbindGlobalListeners();break}}appendContainer(){this.appendTo&&(this.appendTo==="body"?this.renderer.appendChild(this.document.body,this.container):Ze(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)===O.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&&O.clear(this.container),this.container=null,this.unbindGlobalListeners(),this.unbindAnimationEndListener()}static \u0275fac=(()=>{let e;return function(i){return(e||(e=oe(t)))(i||t)}})();static \u0275cmp=Q({type:t,selectors:[["p-drawer"]],contentQueries:function(n,i,r){if(n&1&&(V(r,Ut,4),V(r,Vt,4),V(r,Pt,4),V(r,Lt,4),V(r,Mt,4),V(r,We,4)),n&2){let m;v(m=T())&&(i.headerTemplate=m.first),v(m=T())&&(i.footerTemplate=m.first),v(m=T())&&(i.contentTemplate=m.first),v(m=T())&&(i.closeIconTemplate=m.first),v(m=T())&&(i.headlessTemplate=m.first),v(m=T())&&(i.templates=m)}},viewQuery:function(n,i){if(n&1&&(q(Rt,5),q(At,5),q(Ot,5)),n&2){let r;v(r=T())&&(i.maskRef=r.first),v(r=T())&&(i.containerViewChild=r.first),v(r=T())&&(i.closeButtonViewChild=r.first)}},inputs:{appendTo:"appendTo",blockScroll:[2,"blockScroll","blockScroll",D],style:"style",styleClass:"styleClass",ariaCloseLabel:"ariaCloseLabel",autoZIndex:[2,"autoZIndex","autoZIndex",D],baseZIndex:[2,"baseZIndex","baseZIndex",Ve],modal:[2,"modal","modal",D],closeButtonProps:"closeButtonProps",dismissible:[2,"dismissible","dismissible",D],showCloseIcon:[2,"showCloseIcon","showCloseIcon",D],closeOnEscape:[2,"closeOnEscape","closeOnEscape",D],transitionOptions:"transitionOptions",visible:"visible",position:"position",fullScreen:"fullScreen",header:"header",maskStyle:"maskStyle",closable:[2,"closable","closable",D]},outputs:{onShow:"onShow",onHide:"onHide",visibleChange:"visibleChange"},features:[$([St]),z],ngContentSelectors:Bt,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&&(Te(),u(0,ii,4,21,"div",2)),n&2&&p("ngIf",i.visible)},dependencies:[W,Z,J,Le,Y,Ye,X],encapsulation:2,data:{animation:[Be("panelState",[de("void => visible",[_e(ai)]),de("visible => void",[_e(si)])])]},changeDetection:0})}return t})(),It=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=xe({type:t});static \u0275inj=be({imports:[ge,X,X]})}return t})();var pi=["class","page"],ne=t=>({"ng-invalid ng-dirty":t}),ci=t=>({groupID:t});function mi(t,o){if(t&1){let e=S();l(0,"p-button",23),b("onClick",function(){_(e);let i=c(2);return f(i.onDeleteUser())}),a()}}function di(t,o){if(t&1){let e=S();l(0,"p-button",24),b("onClick",function(){_(e);let i=c(2);return f(i.onHandleDrawer())}),a()}}function ui(t,o){if(t&1&&(l(0,"div",20),u(1,mi,1,0,"p-button",21)(2,di,1,0,"p-button",22),a()),t&2){let e=c();s(),p("ngIf",e.store.hasCheckedRows()),s(),p("ngIf",e.roleService.user().create)}}function _i(t,o){t&1&&(l(0,"th",28),y(1,"p-tableHeaderCheckbox"),a())}function fi(t,o){if(t&1&&(l(0,"tr"),u(1,_i,2,0,"th",27),l(2,"th"),d(3,"LoginID"),a(),l(4,"th"),d(5,"Group"),a(),l(6,"th"),d(7,"Access Type"),a(),l(8,"th"),d(9,"Tags"),a(),l(10,"th"),d(11,"Last Login"),a()()),t&2){let e=c(2);s(),p("ngIf",e.roleService.user().delete)}}function hi(t,o){t&1&&U(0)}function gi(t,o){if(t&1&&y(0,"p-tableCheckbox",34),t&2){let e=c(3).$implicit;p("value",e)}}function wi(t,o){if(t&1&&u(0,gi,1,1,"p-tableCheckbox",33),t&2){let e=c(4);p("ngIf",e.roleService.user().delete)}}function bi(t,o){if(t&1&&(l(0,"td"),u(1,hi,1,0,"ng-container",32)(2,wi,1,1,"ng-template",null,7,x),a()),t&2){let e=Se(3),n=c().$implicit,i=c(2);s(),p("ngIf",i.roleService.user().delete&&n.userName===i.currentUser())("ngIfElse",e)}}function xi(t,o){t&1&&(l(0,"div"),d(1,"No Tags Assigned"),a())}function Ci(t,o){if(t&1&&(l(0,"div"),d(1),a()),t&2){let e=c().$implicit;s(),G("",e.tagsCount," Tags Assigned")}}function yi(t,o){if(t&1){let e=S();l(0,"tr"),u(1,bi,4,2,"td",29),l(2,"td")(3,"button",30),b("click",function(){let i=_(e).$implicit,r=c(2);return f(r.onEditUser(i))}),d(4),a()(),l(5,"td")(6,"a",31),d(7),a()(),l(8,"td"),d(9),a(),l(10,"td"),u(11,xi,2,0,"div")(12,Ci,2,1,"div"),a(),l(13,"td")(14,"span"),d(15),Fe(16,"date"),a()()()}if(t&2){let e=o.$implicit,n=c(2);s(),p("ngIf",n.roleService.user().delete),s(2),p("disabled",!n.roleService.user().edit),s(),G(" ",e.userName||e.userID," "),s(2),p("queryParams",I(11,ci,e.groupID)),s(),k(e.groupName),s(2),G(" ",e.accessTypeName," "),s(2),j(e.tagsCount===0?11:12),s(4),k(Ue(16,8,e.lastLogin,"d MMM y HH:mm"))}}function vi(t,o){if(t&1&&d(0),t&2){let e=c(2);Ie(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.count()," entries ")}}function Ti(t,o){t&1&&(l(0,"tr")(1,"td",35)(2,"span"),d(3,"No users found. Try adjusting your filters or add a new user."),a()()())}function ki(t,o){if(t&1){let e=S();l(0,"p-panel")(1,"div",25),y(2,"app-user-tabs"),l(3,"p-table",26),b("onPage",function(i){_(e);let r=c();return f(r.onPageChange(i))})("onRowSelect",function(i){_(e);let r=c();return f(r.onRowSelect(i))})("onRowUnselect",function(i){_(e);let r=c();return f(r.onRowUnselect(i))})("onHeaderCheckboxToggle",function(i){_(e);let r=c();return f(r.onHeaderCheckboxToggle(i))}),u(4,fi,12,1,"ng-template",null,3,x)(6,yi,17,13,"ng-template",null,4,x)(8,vi,1,3,"ng-template",null,5,x)(10,Ti,4,0,"ng-template",null,6,x),a()()()}if(t&2){let e=c();s(3),p("value",e.store.data())("lazy",!0)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.count())}}function Si(t,o){if(t&1&&(l(0,"div",36)(1,"div",18)(2,"div",37)(3,"label",38),d(4,"Group"),a(),y(5,"p-select",39),a()()()),t&2){let e=c();p("formGroup",e.forms.filterForm),s(5),p("showClear",!0)("options",e.store.meta().options.groups)}}function Ii(t,o){if(t&1&&(l(0,"span",40),d(1),a()),t&2){let e=c();s(),k(e.store.hasCheckedRows()?"Edit User":"Invite User")}}function Di(t,o){if(t&1&&(l(0,"small",14),d(1),a()),t&2){let e=o.$implicit;s(),k(e)}}function Ei(t,o){if(t&1&&(l(0,"small",14),d(1),a()),t&2){let e=o.$implicit;s(),k(e)}}function Fi(t,o){if(t&1&&(l(0,"small",14),d(1),a()),t&2){let e=o.$implicit;s(),k(e)}}function Ui(t,o){if(t&1&&(l(0,"small",14),d(1),a()),t&2){let e=o.$implicit;s(),k(e)}}var On=(()=>{class t extends yt{ngOnInit(){this.generateForm()}constructor(){Pe(()=>{this.store.metaForm()&&this.generateForm()}),super(),this.store=C(he),this.fb=C(je),this.userService=C(ie),this.isLoading=L(!1),this.form=null,this.isDrawerOpen=L(!1),this.router=C(Ae),this.route=C(Re),this.isDialogFilterVisible=L(!1),this.roleService=C(st),this.currentUser=L(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(g(h({},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!==vt},[K.required]),groupID:this.fb.control(this.store.metaForm().form.groupID,[K.required]),accessTypeID:this.fb.control(this.store.metaForm().form.accessTypeID,[K.required]),listJournalTagID:this.fb.control(this.store.metaForm().form.listJournalTagID??[])})}}onHandleDrawer(){this.isDrawerOpen.update(e=>!e),this.store.getUserFormMeta(this.route.snapshot.params.id||null)}onInviteUser(){let{userForm:e}=this.forms;if(e.invalid){e.markAllAsTouched();return}let n=e.getRawValue(),i;if(this.store.hasCheckedRows()){let[r]=this.store.checkedData();i={id:r,groupID:n.groupID,accessTypeID:n.accessTypeID,listJournalTagID:n.listJournalTagID}}else i=n;this.userService.inviteUser(i).pipe(re(()=>{this.onHandleDrawer(),this.store.setFilter(h({},this.store.filter())),e.reset()})).subscribe()}onSearch(e){this.store.setFilter(g(h({},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(g(h({},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(re(()=>{this.store.setFilter(h({},this.store.filter()))})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=Q({type:t,selectors:[["app-user",8,"page"]],features:[$([he]),z],attrs:pi,decls:41,vars:23,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["showCheckbox",""],["pageTitle","User List",3,"search","isDialogFilterVisibleChange","filterConfirmed","isSearchableInput","isFilterable","isDialogFilterVisible","scrollable"],["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"],["filter","","filterBy","name","formControlName","accessTypeID","optionLabel","value","optionValue","key","placeholder","Select Access Type","fluid","",3,"options","ngClass"],["fluid","","filter","","filterBy","name","formControlName","listJournalTagID","optionLabel","name","optionValue","id","placeholder","Select a Tag",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","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();l(0,"app-main-panel",8),b("search",function(w){return _(r),f(i.onSearch(w))}),pe("isDialogFilterVisibleChange",function(w){return _(r),le(i.isDialogFilterVisible,w)||(i.isDialogFilterVisible=w),f(w)}),b("filterConfirmed",function(){return _(r),f(i.onOKFilter())}),u(1,ui,3,2,"ng-template",null,0,x)(3,ki,12,5,"ng-template",null,1,x)(5,Si,6,3,"ng-template",null,2,x),a(),l(7,"p-drawer",9),pe("visibleChange",function(w){return _(r),le(i.isDrawerOpen,w)||(i.isDrawerOpen=w),f(w)}),b("onHide",function(){return _(r),f(i.onHideDrawer())}),u(8,Ii,2,1,"ng-template",null,3,x),l(10,"div",10)(11,"div",11)(12,"div")(13,"label",12),d(14,"Users"),a(),y(15,"p-select",13),R(16,Di,2,1,"small",14,M),a()(),l(18,"div",11)(19,"div")(20,"label",12),d(21,"Groups"),a(),y(22,"p-select",15),R(23,Ei,2,1,"small",14,M),a()(),l(25,"div",11)(26,"div")(27,"label",12),d(28,"Access Type"),a(),y(29,"p-select",16),R(30,Fi,2,1,"small",14,M),a()(),l(32,"div",11)(33,"div")(34,"label",12),d(35,"Tags"),a(),y(36,"p-multiSelect",17),R(37,Ui,2,1,"small",14,M),a()(),l(39,"div",18)(40,"p-button",19),b("onClick",function(){return _(r),f(i.onInviteUser())}),a()()()()}n&2&&(p("isSearchableInput",!0)("isFilterable",!0),se("isDialogFilterVisible",i.isDialogFilterVisible),p("scrollable",!0),s(7),se("visible",i.isDrawerOpen),s(3),p("formGroup",i.forms.userForm),s(5),p("disabled",i.store.hasCheckedRows())("options",i.store.metaForm().options.users)("ngClass",I(15,ne,i.isInvalid("id","userForm"))),s(),A(i.getErrors("id","userForm")),s(6),p("options",i.store.metaForm().options.groups)("ngClass",I(17,ne,i.isInvalid("groupID","userForm"))),s(),A(i.getErrors("id","userForm")),s(6),p("options",i.store.metaForm().options.accessTypes)("ngClass",I(19,ne,i.isInvalid("accessTypeID","userForm"))),s(),A(i.getErrors("accessTypeID","userForm")),s(6),p("options",i.store.metaForm().options.journalTags)("ngClass",I(21,ne,i.isInvalid("listJournalTagID","userForm"))),s(),A(i.getErrors("listJournalTagID","userForm")))},dependencies:[_t,W,Z,J,Me,xt,gt,wt,bt,rt,Y,It,ge,qe,He,Ne,Qe,ze,it,et,tt,nt,ht,ft,Tt,at,ot,kt,Oe,Ct],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{On as UserPageComponent};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{a as pt}from"./chunk-FQRRGJBE.js";import{a as De,b as Re}from"./chunk-UVSR4LPB.js";import{a as Se}from"./chunk-6RB67IF5.js";import{a as Ht,b as ce}from"./chunk-XLEICBBP.js";import{b as rt}from"./chunk-B4C3ZPN6.js";import{b as Wt,c as at,d as lt}from"./chunk-HCJK6VTO.js";import{a as de,b as ue}from"./chunk-ELMSU4U7.js";import"./chunk-VDXZGF3M.js";import"./chunk-MHRSQRHT.js";import{a as oe}from"./chunk-6WWXJJID.js";import"./chunk-U2VDC52W.js";import{a as Ie,b as we}from"./chunk-3VQUNDVT.js";import{a as it,b as nt,d as me,k as se}from"./chunk-DGACZ747.js";import{a as le,b as pe}from"./chunk-EBEY2MBR.js";import"./chunk-AMGBUOC4.js";import"./chunk-UPSNJEHO.js";import{a as ot}from"./chunk-CAS5GLLU.js";import{a as Ne}from"./chunk-BT7Y4ADP.js";import{b as Ee}from"./chunk-DJXQKSLT.js";import"./chunk-VKNINE5Q.js";import"./chunk-E7QWESN4.js";import{a as qt,b as Te}from"./chunk-AN4SAUSA.js";import"./chunk-URH77XNK.js";import"./chunk-PPXXWO4E.js";import{d as Ue}from"./chunk-3DBSHDAQ.js";import"./chunk-M4SSELXT.js";import{b as ae}from"./chunk-WXIG4CXY.js";import"./chunk-QPPFPDWZ.js";import"./chunk-WMZF4DQK.js";import{e as et,f as tt,i as re}from"./chunk-ADODNO5M.js";import"./chunk-S27Z7D3D.js";import{a as $e,b as ne}from"./chunk-AD247LWQ.js";import{b as O,c as Ye,d as Xe,e as Je,f as Qe,g as Ze}from"./chunk-BKTBVFNX.js";import"./chunk-ZFNIPERQ.js";import{n as Ot,o as Ke,w as te,x as ie,y as jt,z as zt}from"./chunk-ME4ALIS7.js";import{b as ye}from"./chunk-DTYVTTET.js";import{b as Bt,c as Pt,e as Y,f as X,g as Gt,i as st,k as J,l as Q,o as Z,u as ve,x as ee}from"./chunk-VMI3QWC6.js";import{b as He,e as U,l as $}from"./chunk-F7PVAVLQ.js";import{a as Ce}from"./chunk-Q3HB53OC.js";import{a as At}from"./chunk-5DRALZZF.js";import{a as We}from"./chunk-2BI7WNJP.js";import{A as Nt,h as ze,k as H,p as qe,q as W,s as K,z as kt}from"./chunk-ZK43JB4A.js";import"./chunk-F2X3VGZZ.js";import{Ac as Lt,Bc as mt,Cc as _e,D as Be,Dc as Oe,Eb as g,Ec as M,Fc as F,Gc as Vt,Ha as E,Hc as je,Mb as s,Oc as S,Pb as Ge,Pc as y,Qc as ke,Rb as V,Sb as Fe,Sc as _,Ub as Me,Vb as Le,W as Dt,Wb as o,X as Rt,Xb as r,Y as be,Yb as T,Zb as z,_ as L,_b as q,ac as D,bd as R,c as xe,ca as Ft,cd as ge,db as j,eb as Pe,fc as w,gc as c,ia as C,ib as l,jc as Mt,qa as h,ra as x,s as Ae,sc as a,tc as b,uc as I,vc as Ve,xc as B,yb as N,yc as A,zc as G}from"./chunk-6QJHEOXN.js";import{a as f,b as v,c as he,e as Tt}from"./chunk-YQFG5XE2.js";var P=(()=>{class t{constructor(){this.httpService=C(At),this.authService=C(Se)}fetchGeneralLedgerLoader(e="single",n={}){return this.httpService.get(void 0,`api/GeneralLedgerLoader/${e==="single"?"GetFilterSingle":"GetFilter"}`,{params:n})}getGLCount(e){return this.httpService.post(void 0,"api/GeneralLedger/GetGeneralLedgerCount",e)}fetchGeneralLedgerReport(e,n="single"){return this.httpService.post(void 0,`api/GeneralLedger/${n==="single"?"GetGeneralLedger":"GetMultiLedger"}`,e)}exportGeneralLedger(e,n={}){let i=f({responseType:"blob"},n);return this.httpService.post(void 0,"/api/GeneralLedgerExport/GetGeneralLedgerExport",e,i)}exportMultiLedger(e,n={}){let i=f({responseType:"blob"},n);return this.httpService.post(void 0,"/api/GeneralLedgerExport/GetMultiLedgerExport",e,i)}getCustomerSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/API/AC/GetCustomerSuggestion",{params:n})}getSupplierSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/API/AC/GetSupplierSuggestion",{params:n})}getCashierSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/api/ac/GetUserSuggestion",{params:n})}getBalanceSheetLoader(){return this.httpService.get(void 0,"/api/BalanceSheetLoader/GetBalanceSheet")}getBalanceSheet(e,n={}){let i=new Nt({fromObject:Object.fromEntries(Object.entries(e).map(([d,k])=>[d,String(k)]))}),p=new kt({"X-Timeout":"50000","X-Retry":"3","X-Retry-Delay":"2000","X-Exponential-Backoff":"true","X-Retry-On-500":"true","X-Retry-On-500-Message":"timeout expired"}),u=f({params:i,headers:p},n);return this.httpService.get(void 0,"/api/BalanceSheet",u)}getIncomeStatementLoader(){return this.httpService.get(void 0,"api/IncomeStatementLoader/Filter")}getIncomeStatement(e,n={}){return this.httpService.post(void 0,"api/IncomeStatement/List",f({},e),n)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=Ft({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var ri=()=>({width:"30vw"}),ai=()=>({"1199px":"75vw","575px":"90vw"}),li=t=>({"ng-dirty ng-invalid":t}),pi=t=>["/pages/journal/journal-entry/",t],mi=t=>({"text-success":t}),si=t=>({"text-danger":t});function ci(t,m){if(t&1&&(o(0,"div",32)(1,"div",33)(2,"span",34),a(3),r()(),o(4,"div")(5,"span"),a(6,"-"),r()(),o(7,"div",33)(8,"span",35),a(9),r()()()),t&2){let e=m.$implicit;l(3),I("(",e.code,")"),l(6),b(e.name)}}function di(t,m){if(t&1&&(o(0,"div",32)(1,"div",33)(2,"span",34),a(3),r()(),o(4,"div")(5,"span"),a(6,"-"),r()(),o(7,"div",33)(8,"span",35),a(9),r()()()),t&2){let e=m.$implicit;l(3),I("(",e.code,")"),l(6),b(e.name)}}function ui(t,m){t&1&&(o(0,"div",36),a(1," Account is required. "),r())}function _i(t,m){if(t&1&&(o(0,"div",37)(1,"div"),a(2),r()()),t&2){let e=m.$implicit;l(2),b(e.value)}}function gi(t,m){if(t&1&&(o(0,"div",25)(1,"div",26),T(2,"p-radiobutton",38),o(3,"label",39),a(4),r()()()),t&2){let e=m.$implicit;l(2),s("value",e.key)("inputId",e.key),l(),s("for",e.key),l(),b(e.value)}}function fi(t,m){if(t&1){let e=D();o(0,"div",15)(1,"label",16),a(2,"Customer"),r(),o(3,"p-autocomplete",40),w("completeMethod",function(i){h(e);let p=c(3);return x(p.searchCustomer(i))}),r()()}if(t&2){let e=c(3);l(3),s("suggestions",e.customerSuggestions())}}function hi(t,m){if(t&1){let e=D();o(0,"div",15)(1,"label",16),a(2,"Supplier"),r(),o(3,"p-autocomplete",41),w("completeMethod",function(i){h(e);let p=c(3);return x(p.searchSupplier(i))}),r()()}if(t&2){let e=c(3);l(3),s("suggestions",e.supplierSuggestions())}}function xi(t,m){if(t&1){let e=D();o(0,"div",15)(1,"label",16),a(2,"Customer"),r(),o(3,"p-autocomplete",40),w("completeMethod",function(i){h(e);let p=c(3);return x(p.searchCustomer(i))}),r()()}if(t&2){let e=c(3);l(3),s("suggestions",e.customerSuggestions())}}function bi(t,m){if(t&1&&(o(0,"form",14)(1,"div",15)(2,"label",16),a(3,"Accounts"),r(),o(4,"p-select",17),g(5,ci,10,2,"ng-template",null,5,_)(7,di,10,2,"ng-template",null,6,_),r(),g(9,ui,2,0,"div",18),r(),o(10,"div",15)(11,"label",16),a(12,"From"),r(),o(13,"div",19),T(14,"p-datepicker",20)(15,"p-datepicker",21),r()(),o(16,"div",15)(17,"label",16),a(18,"Tag"),r(),o(19,"p-multiselect",22),g(20,_i,3,1,"ng-template",null,6,_),r()(),o(22,"div",15)(23,"label",23),a(24,"Contact Type"),r(),o(25,"div",24),Me(26,gi,5,4,"div",25,Fe),r()(),g(28,fi,4,1,"div",15)(29,hi,4,1,"div",15)(30,xi,4,1,"div",15),o(31,"div",15)(32,"label",23),a(33,"Sort order"),r(),o(34,"div",24)(35,"div",25)(36,"div",26),T(37,"p-radiobutton",27),o(38,"label",28),a(39,"Asc"),r()()(),o(40,"div",29)(41,"div",26),T(42,"p-radiobutton",30),o(43,"label",31),a(44,"Desc"),r()()()()()()),t&2){let e,n,i,p=c(2);s("formGroup",p.form),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",p.loaderMetadata().options.accounts)("ngClass",F(14,li,((e=p.form.get("accountID"))==null?null:e.invalid)&&(((e=p.form.get("accountID"))==null?null:e.touched)||((e=p.form.get("accountID"))==null?null:e.dirty)))),l(5),s("ngIf",((n=p.form.get("accountID"))==null?null:n.invalid)&&(((n=p.form.get("accountID"))==null?null:n.touched)||((n=p.form.get("accountID"))==null?null:n.dirty))),l(5),s("showIcon",!0),l(),s("showIcon",!0),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",p.loaderMetadata().options.outlets),l(7),Le(p.loaderMetadata().options.contactTypeOptions),l(2),V((i=p.form.controls.contactType.value)===1?28:i===2?29:30),l(9),s("value",!0),l(5),s("value",!1)}}function Ci(t,m){if(t&1&&g(0,bi,45,16,"form",13),t&2){let e=c();s("ngIf",e.loaderMetadata())}}function Si(t,m){if(t&1){let e=D();o(0,"p-button",44),w("onClick",function(){h(e);let i=c(2);return x(i.onToggleExportDialog())}),r()}}function vi(t,m){if(t&1&&(o(0,"div",32)(1,"a",42),a(2,"Return to Accounts"),r(),g(3,Si,1,0,"p-button",43),r()),t&2){let e=c();l(3),s("ngIf",e.roleService.global().export)}}function yi(t,m){t&1&&(o(0,"tr")(1,"th",51),a(2,"Number"),r(),o(3,"th"),a(4,"Date"),r(),o(5,"th"),a(6,"Contact / Note"),r(),o(7,"th",52),a(8,"Debit"),r(),o(9,"th",52),a(10,"Credit"),r(),o(11,"th",52),a(12,"Balance"),r()())}function Ei(t,m){if(t&1&&(o(0,"div")(1,"span",60),a(2),r()()),t&2){let e=c().$implicit;l(2),I(" ",e.outletName," ")}}function Ii(t,m){if(t&1&&(o(0,"div",15),T(1,"div",61),o(2,"span",62),a(3),r()()),t&2){let e=c().$implicit;l(),s("innerHTML",e.journalNote,j),l(2),I("",e.note," ")}}function wi(t,m){if(t&1&&(o(0,"div",15),T(1,"span",61)(2,"div",61),o(3,"span",63),a(4),r()()),t&2){let e=c().$implicit;l(),s("innerHTML",e.referenceText,j),l(),s("innerHTML",e.journalNote,j),l(2),I("",e.note," ")}}function Ti(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.debitAmount)," ")}}function Di(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.creditAmount)," ")}}function Ri(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.balance)," ")}}function Fi(t,m){if(t&1&&(o(0,"tr")(1,"td",53)(2,"a",54),a(3),r(),g(4,Ei,3,1,"div",55),r(),o(5,"td",53)(6,"span",56),S(7,"date"),a(8),S(9,"date"),r()(),o(10,"td",53)(11,"div",15)(12,"a",57),a(13),r(),g(14,Ii,4,2,"div",15)(15,wi,5,3,"div",15),r()(),o(16,"td",58),g(17,Ti,3,3,"ng-container",55),r(),o(18,"td",58),g(19,Di,3,3,"ng-container",55),r(),o(20,"td",59),g(21,Ri,3,3,"ng-container",55),r()()),t&2){let e=m.$implicit,n=c(3);l(2),s("routerLink",F(19,pi,e.id)),l(),b(e.number),l(),s("ngIf",e.outletName==null?null:e.outletName.trim()),l(2),s("pTooltip",ke(7,13,e.date,"dd MMM y")),l(2),I(" ",ke(9,16,e.date,"dd MMM y")," "),l(4),s("href",n.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.contactID,Pe),l(),b(e.contactName),l(),V(n.buildReferenceUrl(e)?14:15),l(2),s("ngClass",F(21,mi,e.debitAmount!==0)),l(),s("ngIf",e.debitAmount!==0),l(),s("ngClass",F(23,si,e.creditAmount!==0)),l(),s("ngIf",e.creditAmount!==0),l(2),s("ngIf",e.balance!==0)}}function Mi(t,m){if(t&1&&(o(0,"tr"),T(1,"td",64),o(2,"td",65),a(3,"Total"),r(),o(4,"td",66),a(5),S(6,"number"),r(),o(7,"td",67),a(8),S(9,"number"),r(),T(10,"td"),r()),t&2){let e=c(3);l(5),I(" ",y(6,2,e.debitSubTotal())," "),l(3),I(" ",y(9,4,e.creditSubTotal())," ")}}function Li(t,m){t&1&&(o(0,"tr")(1,"td",68)(2,"span"),a(3,"No records found."),r()()())}function Vi(t,m){if(t&1){let e=D();o(0,"button",69),w("click",function(){h(e);let i=c(3);return x(i.getGLCount())})("keyup.enter",function(){h(e);let i=c(3);return x(i.getGLCount())}),r()}}function ki(t,m){if(t&1&&a(0),t&2){let e=c(3);I(" ",e.count()," ")}}function Ni(t,m){if(t&1){let e=D();o(0,"p-button",70),w("onClick",function(){h(e);let i=c(3);return x(i.onNextPage())}),r()}}function Ai(t,m){if(t&1&&(o(0,"div",46)(1,"p-table",47),g(2,yi,13,0,"ng-template",null,7,_)(4,Fi,22,25,"ng-template",null,8,_)(6,Mi,11,6,"ng-template",null,4,_)(8,Li,4,0,"ng-template",null,9,_),r(),o(10,"div",48)(11,"div"),a(12),g(13,Vi,1,0,"button",49)(14,ki,1,1),a(15," entries "),r(),o(16,"div",32),g(17,Ni,1,0,"p-button",50),r()()()),t&2){let e=c(2);l(),s("value",e.items().data.data),l(11),Ve(" Showing ",e.pagination().first," to ",e.pagination().end," of "),l(),V(e.totalRecords()===-1?13:14),l(4),V(e.pagination().hasNext?17:-1)}}function Bi(t,m){if(t&1&&g(0,Ai,18,5,"div",45),t&2){let e=c();s("ngIf",e.items()&&e.items().data)}}function Pi(t,m){if(t&1&&(o(0,"div",71)(1,"div",72),T(2,"div",73),r(),o(3,"div",74)(4,"div",26),T(5,"i",75),o(6,"span",76),a(7),S(8,"number"),S(9,"number"),r()()()()),t&2){let e=c();l(),s("formGroup",e.form),l(6),Ve("Exporting data from ",y(8,3,e.filter().exportPageNumber)," - ",y(9,5,e.filter().exportPageSize),"")}}function Gi(t,m){if(t&1){let e=D();o(0,"p-button",77),w("onClick",function(){h(e);let i=c();return x(i.onToggleExportDialog())}),r()}t&2&&s("rounded",!0)("text",!0)}function Oi(t,m){if(t&1){let e=D();o(0,"p-button",78),w("click",function(){h(e);let i=c();return x(i.onToggleExportDialog())}),r(),o(1,"p-button",79),w("click",function(){h(e);let i=c();return x(i.onExport())}),r()}}var Ut=(()=>{class t{getGLCount(){this.reportService.getGLCount(this.filter()).pipe(L(({count:e})=>{this.totalRecords.set(e)})).subscribe()}onToggleExportDialog(){this.isDialogExportVisible.update(e=>!e)}get pageTitle(){return this.items()&&this.items().pageTitle?this.items().pageTitle:"General Ledger"}constructor(){this.reportService=C(P),this.route=C(He),this.roleService=C(oe),this.authService=C(Se),this.fb=C(ve),this.coaService=C(ot),this.toastr=C(We),this.dayjsService=C(ce),this.metadata=E(null),this.items=E(null),this.totalRecords=E(-1),this.dialogFilterVisible=E(!0),this.initDialogVisible=E(!1),this.isDialogExportVisible=E(!1),this.customerSuggestions=E([]),this.supplierSuggestions=E([]),this.categoriesOptions=E([]),this.localFilter=E({}),this.count=R(()=>this.totalRecords()<0?1/0:this.totalRecords()),this.lastGetDataLength=E(0),this.pagination=R(()=>{let e=this.filter(),n=this.totalRecords()!=null&&this.totalRecords()>=0?this.totalRecords():1/0,i=this.items()?.data?.data?.length||0,p=i==n||this.lastGetDataLength()<e.pageSize;return{first:1,end:e.pageSize>0?i:0,total:n,page:e.pageNumber,pageSize:e.pageSize,hasPrev:e.pageNumber>1,hasNext:!p}}),this.queryFilter=ye(this.route.queryParamMap.pipe(Ae(e=>{let n=e.get("from")?this.dayjsService.format(new Date(e.get("from"))):null,i=e.get("to")?this.dayjsService.format(new Date(e.get("to"))):null,p={},u=e.get("id");return Ce.IsNotEmpty(u)&&(p=v(f({},p),{accountID:u})),Ce.IsNotEmpty(n)&&Ce.IsNotEmpty(i)&&(p=v(f({},p),{from:n,to:i})),p})),{initialValue:null}),this.loaderMetadata=ye(this.reportService.fetchGeneralLedgerLoader("single",this.queryFilter()),{initialValue:null}),this.baseFilter=R(()=>{let e=this.loaderMetadata();return e?e.filter:null}),this.exportFileTypes=E([{key:0,value:"CSV"},{key:1,value:"Excel"}]),this.filter=R(()=>{let e=this.baseFilter(),n=this.localFilter();return e?f(f({},e),n):null}),this.creditSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.creditAmount)||0),0)),this.balanceSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.balance)||0),0)),this.debitSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.debitAmount)||0),0)),this.initializeForm(),ge(()=>{let e=this.filter();e&&(Ce.IsEmpty(this.form.value.accountID)||this.form.value.accountID!==e.accountID)&&this.form.patchValue(this.transformFilterToFormValue(e),{emitEvent:!1})}),ge(()=>{let e=this.filter(),n=this.form.value.accountID;!e||Ce.IsEmpty(n)||this.reportService.fetchGeneralLedgerReport(e).subscribe(i=>{this.lastGetDataLength.set(i.data?.data?.length),this.items.update(p=>e.pageNumber===1?i:v(f({},i),{data:v(f({},i.data),{data:[...p?.data.data??[],...i.data.data]})}))})})}buildReferenceUrl(e){return pt(e)}ngOnInit(){this.route.queryParamMap.pipe(Be(e=>e.keys.length>0)).subscribe({next:()=>this.initDialogVisible.set(!0)})}initializeForm(){this.form=this.fb.group({accountID:this.fb.control(null,[Pt.required]),from:this.fb.control(null),to:this.fb.control(new Date),contactType:this.fb.control(null),contactID:this.fb.control(""),listOutletID:this.fb.control([]),pageNumber:this.fb.control(1),pageSize:this.fb.control(50),sortAscending:this.fb.control(!0),listAccountID:this.fb.control([]),export:this.fb.control(!1),exportPageNumber:this.fb.control(1),exportPageSize:this.fb.control(0)})}findNodeByKey(e,n){for(let i of e){if(i.key===n)return i;if(i.children){let p=this.findNodeByKey(i.children,n);if(p)return p}}return null}transformFilterToFormValue(e){return Object.entries(e).reduce((n,[i,p])=>{switch(i){case"from":n[i]=p&&(typeof p=="string"||typeof p=="number"||p instanceof Date)?this.dayjsService.from(p)?.toDate():null;break;case"to":n[i]=p&&(typeof p=="string"||typeof p=="number"||p instanceof Date)?this.dayjsService.from(p)?.toDate():this.dayjsService.now.toDate();break;case"listCategoryID":Array.isArray(p)?n[i]=p.map(u=>this.findNodeByKey(this.categoriesOptions(),u)).filter(u=>!!u):n[i]=[];break;case"listOutletID":case"listAccountID":n[i]=Array.isArray(p)?p:[];break;case"pageNumber":case"pageSize":case"exportPageNumber":case"exportPageSize":n[i]=p!=null?Number(p):0;break;case"sortAscending":case"export":n[i]=!!p;break;case"contactType":n[i]=p!=null?Number(p):null;break;default:n[i]=p}return n},{})}clearContactValueOnContactTypeChange(){this.form.get("contactType")?.valueChanges.subscribe(()=>this.form.get("contactID")?.setValue(""))}isEmpty(e){return e==null||typeof e=="string"&&e.trim().length===0}onCategoryFocus(){this.coaService.getCachedCategoriesOptions().pipe(L(e=>this.categoriesOptions.set(e))).subscribe()}searchCustomer(e){this.reportService.getCustomerSuggestions(e.query).pipe(L(n=>this.customerSuggestions.set(n))).subscribe()}searchSupplier(e){this.reportService.getSupplierSuggestions(e.query).pipe(L(n=>this.supplierSuggestions.set(n))).subscribe()}onAccountChange(e){Array.isArray(e.value)&&e.value.length>=1&&this.toastr.warning("Please select at least 1 accounts for the general ledger report.","Warning")}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched(),this.dialogFilterVisible.set(!0);return}let e=this.buildFilterBody();this.dialogFilterVisible.set(!1),this.localFilter.set(e),this.totalRecords()!==-1&&this.getGLCount()}buildFilterBody(){let p=this.form.getRawValue(),{from:e,to:n}=p,i=he(p,["from","to"]);return v(f({},this.filter()),{pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType})}onExport(){let e=this.buildExportBody();this.performExport(e)}performExport(e){this.reportService.exportGeneralLedger(e,{responseType:"blob",observe:"response"}).pipe(L(n=>this.handleExportResponse(n))).subscribe()}handleExportResponse(e){let n=e.headers,i=n.get("Content-Disposition")??n.get("content-disposition"),p="download.csv";if(i){let d=i.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);d?.[1]&&(p=decodeURIComponent(d[1].replace(/"/g,"")))}let u=e.body;lt(u,p,u.type)}buildExportBody(){let p=this.form.value,{from:e,to:n}=p,i=he(p,["from","to"]);return v(f({},this.filter()),{exportPageNumber:+i.exportPageNumber,pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType,export:!0})}onNextPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(f({},e),{pageNumber:n+1,balance:this.items().data.data[this.items().data.data.length-1]?.balance??0,credit:this.items().data.data[this.items().data.data.length-1]?.creditAmount??0,debit:this.items().data.data[this.items().data.data.length-1]?.debitAmount??0})})}onPrevPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(f({},e),{pageNumber:Math.max(1,n-1)})})}goToPage(e){this.localFilter.update(n=>v(f({},n),{pageNumber:e}))}goToLastPage(){let e=this.filter();if(!e)return;let n=this.totalRecords();if(n===-1||!isFinite(n)){this.toastr.info("Please load total records before going to the last page","Info");return}let i=Math.ceil(n/e.pageSize);if(e.pageNumber>=i){this.toastr.warning("You are already on the last page","Warning");return}this.localFilter.update(p=>v(f({},p),{pageNumber:i}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-general-ledger"]],decls:13,vars:13,consts:[["filters",""],["actionButton",""],["content",""],["closeIconTemplate",""],["footer",""],["selectedItem",""],["item",""],["header",""],["body",""],["emptymessage",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isDialogFilterVisible","isFilterable","isInitDialogFilterVisible","scrollable"],["header","Export General Ledger",3,"visibleChange","modal","visible","breakpoints"],["class","d-flex flex-column gap-3",4,"ngIf"],["class","d-flex flex-column row-gap-3",3,"formGroup",4,"ngIf"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["showClear","","filter","","filterBy","code,name","display","chip","formControlName","accountID","appendTo","body","optionLabel","name","optionValue","id","placeholder","Select Accounts",3,"virtualScroll","virtualScrollItemSize","options","ngClass"],["class","text-danger",4,"ngIf"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","iconDisplay","input","inputId","icondisplay",3,"showIcon"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","iconDisplay","input","inputId","icondisplay",3,"showIcon"],["showClear","","display","chip","formControlName","listOutletID","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select an Tag",3,"virtualScroll","virtualScrollItemSize","options"],["for",""],[1,"row"],[1,"col-4"],[1,"d-flex","align-items-center","gap-2"],["name","sortAscending","formControlName","sortAscending","inputId","asc",3,"value"],["for","asc",1,"m-0"],[1,"col-3"],["name","sortAscending","formControlName","sortAscending","inputId","desc",3,"value"],["for","desc",1,"m-0"],[1,"d-flex","gap-2"],[1,""],[1,"h-full","align-middle"],[1,"text-truncate","d-inline-block","h-full","align-middle"],[1,"text-danger"],[1,"flex","items-center","gap-2"],["name","contactType","formControlName","contactType",3,"value","inputId"],[1,"m-0",3,"for"],["formControlName","contactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["formControlName","ContactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["routerLink","/pages/chart-of-account/account",1,"p-button","p-button-secondary","p-button-outlined","fs-3"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],["class","px-3 h-100 bg-white border-top",4,"ngIf"],[1,"px-3","h-100","bg-white","border-top"],[3,"value"],[1,"d-flex","justify-content-between","align-items-center","my-2"],["type","button","aria-label","Get journal entry count","tabindex","0",1,"fa-solid","fa-circle-question","cursor-pointer","p-0","border-0","bg-transparent"],["variant","outlined","severity","secondary","icon","fa-solid fa-angle-right","size","small","label","next"],[2,"width","180px"],[1,"text-end"],[1,"text-break"],["target","_blank",1,"link","link-primary",3,"routerLink"],[4,"ngIf"],["tooltipPosition","top",3,"pTooltip"],["target","_blank",1,"link","link-primary",3,"href"],[1,"text-end","text-break",3,"ngClass"],[1,"text-end","text-break"],[1,"badge","bg-light","text-dark"],[3,"innerHTML"],[2,"width","300px","white-space","normal","word-break","break-word"],[2,"white-space","normal","word-break","break-word"],["colspan","2"],[1,"text-end","fw-semibold"],[1,"text-end","fw-semibold","text-success"],[1,"text-end","fw-semibold","text-danger"],["colspan","8"],["type","button","aria-label","Get journal entry count","tabindex","0",1,"fa-solid","fa-circle-question","cursor-pointer","p-0","border-0","bg-transparent",3,"click","keyup.enter"],["variant","outlined","severity","secondary","icon","fa-solid fa-angle-right","size","small","label","next",3,"onClick"],[1,"d-flex","flex-column","gap-3"],[1,"row",3,"formGroup"],[1,"col-8"],["role","alert",1,"alert","alert-primary","m-0","p-2"],[1,"fa-solid","fa-circle-info"],[1,"fs-2","text-dark","fw-semibold"],["severity","secondary","variant","outlined","icon","fa-solid fa-xmark",3,"onClick","rounded","text"],["label","Cancel","severity","secondary","variant","outlined",3,"click"],["label","OK (F2)",3,"click"]],template:function(n,i){if(n&1){let p=D();o(0,"app-main-panel",10),G("isDialogFilterVisibleChange",function(d){return h(p),A(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),x(d)})("isInitDialogFilterVisibleChange",function(d){return h(p),A(i.initDialogVisible,d)||(i.initDialogVisible=d),x(d)}),w("filterConfirmed",function(){return h(p),x(i.onFilterOKEvent())}),g(1,Ci,1,1,"ng-template",null,0,_)(3,vi,4,1,"ng-template",null,1,_)(5,Bi,1,1,"ng-template",null,2,_),r(),o(7,"p-dialog",11),G("visibleChange",function(d){return h(p),A(i.isDialogExportVisible,d)||(i.isDialogExportVisible=d),x(d)}),g(8,Pi,10,7,"div",12)(9,Gi,1,2,"ng-template",null,3,_)(11,Oi,2,0,"ng-template",null,4,_),r()}n&2&&(s("pageTitle",i.pageTitle),B("isDialogFilterVisible",i.dialogFilterVisible),s("isFilterable",!0),B("isInitDialogFilterVisible",i.initDialogVisible),s("scrollable",!0),l(7),Ge(M(11,ri)),s("modal",!0),B("visible",i.isDialogExportVisible),s("breakpoints",M(12,ai)),l(),s("ngIf",i.form&&i.filter()))},dependencies:[re,K,ze,H,W,qe,ae,se,me,tt,et,ie,te,Te,qt,pe,le,Re,De,ee,J,Y,X,Q,Z,ue,de,Ee,Ue,at,rt,ne,$,U,nt,it,zt,jt,Ke],styles:["[_nghost-%COMP%] .p-datatable .p-datatable-header{padding:.75rem 1rem .75rem 0}[_nghost-%COMP%] th:nth-child(1){width:10%}[_nghost-%COMP%] th:nth-child(2){width:15%}[_nghost-%COMP%] th:nth-child(3){width:40%}[_nghost-%COMP%] th:nth-child(4){width:15%}[_nghost-%COMP%] th:nth-child(5){width:15%}[_nghost-%COMP%] th:nth-child(6){width:15%}"],changeDetection:0})}}return t})();var ji={data:{},filter:{EntityID:[],CashierID:null,Text:null,from:null,to:null},isLoading:!0,loader:{options:{outlets:[]},filter:{from:"",to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}}},xt=Ye(Ze(ji),Xe(t=>{let m={totalCOGS:R(()=>{let e=t.data()?.data?.cogs;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),totalRevenue:R(()=>{let e=t.data()?.data?.revenue;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),totalExpense:R(()=>{let e=t.data()?.data?.expense;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),grossProfit:R(()=>Array.isArray(t.data()?.data?.cogs)&&Array.isArray(t.data()?.data?.revenue)?m.totalRevenue()-m.totalCOGS():0),profitOrLoss:R(()=>m.totalRevenue()-m.totalCOGS()-m.totalExpense()),isDataEmpty:R(()=>Object.keys(t.data()?.data??{}).length===0)};return m}),Qe(t=>{let m=C(P),e=C(ce),n={updateFilter(i){O(t,p=>v(f({},p),{filter:f(f({},p.filter),i)}))},getLoader:Ie(xe(be(()=>m.getIncomeStatementLoader().pipe(we({next:i=>{O(t,p=>v(f({},p),{loader:i,filter:v(f({},p.filter),{from:e.from(i.filter.from).format(),to:e.from(i.filter.to).format()})})),n.getIncomeStatement(t.filter)},error:i=>{console.error(i)}}))))),getIncomeStatement:Ie(xe(be(i=>m.getIncomeStatement(i).pipe(Rt(()=>O(t,p=>v(f({},p),{isLoading:!0}))),we({next:p=>{O(t,u=>v(f({},u),{data:p,isLoading:!1}))},error:p=>{console.error(p)}})))))};return n}),Je({onInit:t=>{t.getLoader()}}));var bt=()=>({}),Ct=t=>["/pages/chart-of-account/account/",t],St=()=>["/pages/report/general-ledger"],vt=(t,m,e)=>({id:t,from:m,to:e});function qi(t,m){if(t&1){let e=D();o(0,"p-button",10),w("onClick",function(){h(e);let i=c(2);return x(i.onExport())}),r()}}function Hi(t,m){if(t&1&&(o(0,"div",8),g(1,qi,1,0,"p-button",9),r()),t&2){let e=c();l(),s("ngIf",e.roleService.global().export)}}function Wi(t,m){t&1&&(o(0,"tr")(1,"th",14),a(2,"Code"),r(),o(3,"th",15),a(4,"Name"),r(),o(5,"th",16),a(6,"Total"),r()())}function Ki(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",17),a(5),r()(),o(6,"td",16)(7,"a",18),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=_e(0),i=_e(1);l(2),b(e.code),l(2),s("routerLink",F(8,Ct,e.accountID)),l(),b(e.name),l(2),s("routerLink",M(10,St))("queryParams",je(11,vt,e.accountID,n,i)),l(),b(y(9,6,e.amount))}}function Ui(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),a(4,"Total Revenue :"),r(),o(5,"span",22),a(6),S(7,"number"),r()()()()),t&2){let e=c(3);l(6),b(y(7,1,e.store.totalRevenue()))}}function $i(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No revenue records available"),r()()())}function Yi(t,m){if(t&1&&(o(0,"h6",12),a(1,"Revenue"),r(),o(2,"p-table",13),g(3,Wi,7,0,"ng-template",null,3,_)(5,Ki,10,15,"ng-template",null,4,_)(7,Ui,8,3,"ng-template",null,5,_)(9,$i,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);l(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.revenue)}}function Xi(t,m){t&1&&(o(0,"tr")(1,"th",14),a(2,"Code"),r(),o(3,"th",15),a(4,"Name"),r(),o(5,"th",24),a(6,"Total"),r()())}function Ji(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",17),a(5),r()(),o(6,"td",16)(7,"a",18),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=_e(0),i=_e(1);l(2),b(e.code),l(2),s("routerLink",F(8,Ct,e.accountID)),l(),b(e.name),l(2),s("routerLink",M(10,St))("queryParams",je(11,vt,e.accountID,n,i)),l(),b(y(9,6,e.amount))}}function Qi(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),a(4,"Total COGS :"),r(),o(5,"span",22),a(6),S(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),a(12,"Gross Profit :"),r(),o(13,"span",22),a(14),S(15,"number"),r()()()()),t&2){let e=c(3);l(6),b(y(7,2,e.store.totalCOGS())),l(8),b(y(15,4,e.store.grossProfit()))}}function Zi(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No COGS records available"),r()()())}function en(t,m){if(t&1&&(o(0,"h4",12),a(1,"COGS"),r(),o(2,"p-table",13),g(3,Xi,7,0,"ng-template",null,3,_)(5,Ji,10,15,"ng-template",null,4,_)(7,Qi,16,6,"ng-template",null,5,_)(9,Zi,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);l(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.cogs)}}function tn(t,m){t&1&&(o(0,"tr")(1,"th",14),a(2,"Code"),r(),o(3,"th",15),a(4,"Name"),r(),o(5,"th",16),a(6,"Total"),r()())}function nn(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",17),a(5),r()(),o(6,"td",16)(7,"a",18),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=_e(0),i=_e(1);l(2),b(e.code),l(2),s("routerLink",F(8,Ct,e.accountID)),l(),b(e.name),l(2),s("routerLink",M(10,St))("queryParams",je(11,vt,e.accountID,n,i)),l(),b(y(9,6,e.amount))}}function on(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),a(4,"Total Expense :"),r(),o(5,"span",22),a(6),S(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),a(12,"Profit / Loss :"),r(),o(13,"span",22),a(14),S(15,"number"),r()()()()),t&2){let e=c(3);l(6),b(y(7,2,e.store.totalExpense())),l(8),b(y(15,4,e.store.profitOrLoss()))}}function rn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No expense records available"),r()()())}function an(t,m){if(t&1&&(o(0,"h4",12),a(1,"Expense"),r(),o(2,"p-table",13),g(3,tn,7,0,"ng-template",null,3,_)(5,nn,10,15,"ng-template",null,4,_)(7,on,16,6,"ng-template",null,5,_)(9,rn,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);l(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.expense)}}function ln(t,m){if(t&1&&(Lt(0)(1),o(2,"p-panel")(3,"div",11),g(4,Yi,11,1)(5,en,11,1)(6,an,11,1),r()()),t&2){let e,n,i,p,u,d=c();mt((e=d.store.filter())!=null&&e.from?d.store.filter().from:null),l(),mt((n=d.store.filter())!=null&&n.to?d.store.filter().to:null),l(3),V(d.Object.keys((i=d.store.data().data)!==null&&i!==void 0?i:M(5,bt)).length>0?4:-1),l(),V(d.Object.keys((p=(p=d.store.data().data)==null?null:p.cogs)!==null&&p!==void 0?p:M(6,bt)).length>0?5:-1),l(),V(d.Object.keys((u=(u=d.store.data().data)==null?null:u.expense)!==null&&u!==void 0?u:M(7,bt)).length>0?6:-1)}}function pn(t,m){if(t&1){let e=D();o(0,"form",25)(1,"div",26)(2,"label",27),a(3,"Tag"),r(),T(4,"p-multiselect",28),r(),o(5,"div",26)(6,"label",27),a(7,"Cashier"),r(),o(8,"p-autocomplete",29),w("completeMethod",function(i){h(e);let p=c();return x(p.onCashierSearch(i))})("onSelect",function(i){h(e);let p=c();return x(p.onCashierSelect(i))}),r()(),o(9,"div",26)(10,"label",30),a(11,"From - To"),r(),o(12,"div",31),T(13,"p-datepicker",32)(14,"p-datepicker",33),r()()()}if(t&2){let e=c();s("formGroup",e.formFilter),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.loader().options.outlets)("showClear",!0),l(4),s("showClear",!0)("suggestions",e.cashierSuggestions())("showClear",!0),l(5),s("iconDisplay","input")("showIcon",!0),l(),s("iconDisplay","input")("showIcon",!0)}}var $t=(()=>{class t{constructor(){this.dayjsService=C(ce),this.store=C(xt),this.fb=C(ve),this.reportService=C(P),this.roleService=C(oe),this.isInitDialogFilterVisible=E(!1),this.dialogFilterVisible=E(!1),this.cashierSuggestions=E([]),this.cashierHashMap=new Map,this.Object=Object,ge(()=>{this.store.filter()&&this.initForm()})}ngOnInit(){this.initForm(),console.log(this.cashierHashMap.entries())}onSearch(e){this.store.updateFilter(v(f({},this.store.filter()),{Text:e}))}onCashierSearch(e){this.reportService.getCashierSuggestions(e.query).pipe(Ne("Cashier Suggestions"),L(n=>this.cashierSuggestions.set(n))).subscribe()}initForm(){let e=this.store.filter();console.log("initForm",this.cashierHashMap.get(e.CashierID)),this.formFilter=this.fb.group({EntityID:this.fb.control(e.EntityID??[]),CashierID:this.fb.control(this.cashierHashMap.get(e.CashierID)??""),Text:this.fb.control(e.Text??""),from:this.fb.control(e.from?this.dayjsService.from(e.from).toDate():null),to:this.fb.control(e.to?this.dayjsService.from(e.to).toDate():null)})}onFilterOK(){let e=this.formFilter.getRawValue(),n=Object.entries(e).reduce((i,[p,u])=>(p==="from"||p==="to"?u instanceof Date&&(i[p]=this.dayjsService.format(u)):i[p]=u||null,i),{});this.store.updateFilter(f(f({},this.store.filter()),n)),this.dialogFilterVisible.update(i=>!i),console.log("body",e)}onCashierSelect(e){console.log("Cashier selected:",e),!this.cashierHashMap.has(e.value.Key)&&(this.cashierHashMap.set(e.value.Key,e.value.Value),console.log("Cashier HashMap:",this.cashierHashMap))}onExport(){let e=v(f({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.reportService.getIncomeStatement(e,{responseType:"blob"}).pipe(Ne("Export Profit & Loss"),L(n=>{let i=n.type,p=[n],u=document.createElement("a");u.href=window.URL.createObjectURL(new Blob(p,{type:i}));let d=`profit-and-loss.${i.split("/")[1]}`;u.setAttribute("download",d),document.body.appendChild(u),u.click(),document.body.removeChild(u)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-income-statement"]],features:[Oe([xt])],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","isFilterable","pageTitle","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],[1,"d-flex","gap-2"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],[1,"d-flex","flex-column","gap-3"],[1,"fs-5","fw-semibold"],[3,"value"],[2,"width","20%"],[2,"width","30%"],[1,"text-end"],["target","_blank",1,"link","link-primary",3,"routerLink"],["target","_blank",1,"link","link-primary",3,"routerLink","queryParams"],["colspan","3",1,"text-end","fw-semibold"],[1,"row"],[1,"col"],[1,"col-1","col-lg-2"],["colspan","3",1,""],[1,"text-end",2,"min-width","10%"],[1,"d-flex","flex-column","gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for",""],["formControlName","EntityID","filterBy","value","appendTo","body","display","chip","optionLabel","value","optionValue","key","placeholder","Select an Tag",3,"virtualScroll","virtualScrollItemSize","options","showClear"],["appendTo","body","formControlName","CashierID","optionLabel","Value","optionValue","Key","styleClass","w-100","inputStyleClass","w-100","field","Value","placeholder","Search a cashier",3,"completeMethod","onSelect","showClear","suggestions"],["for","outlet"],[1,"d-flex","flex-column","gap-2"],["formControlName","from","styleClass","w-100 mb-0","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],["formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"]],template:function(n,i){if(n&1){let p=D();o(0,"app-main-panel",7),G("isDialogFilterVisibleChange",function(d){return h(p),A(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),x(d)})("isInitDialogFilterVisibleChange",function(d){return h(p),A(i.isInitDialogFilterVisible,d)||(i.isInitDialogFilterVisible=d),x(d)}),w("filterConfirmed",function(){return h(p),x(i.onFilterOK())}),g(1,Hi,2,1,"ng-template",null,0,_)(3,ln,7,8,"ng-template",null,1,_)(5,pn,15,12,"ng-template",null,2,_),r()}n&2&&(s("isFilterable",!0)("pageTitle",i.store.data().pageTitle),B("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[re,K,H,W,Te,pe,le,ee,J,Y,X,Q,Z,ue,de,ae,se,me,ne,$e,$,U,Re,De,ie,te],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var yt=Tt(Ht());var mn={metadata:{options:{outlets:[]},filter:{to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}},data:{asset:[],liability:[],equity:[],pageTitle:""},filter:{date:(0,yt.default)().format("YYYY-MM-DD"),listOutletParam:[]}},Et=Ye(Ze(mn),Xe(t=>({totalAsset:R(()=>t.data().asset.reduce((m,e)=>m+ +e.amount,0)),totalLiability:R(()=>t.data().liability.reduce((m,e)=>m+ +e.counterAmount,0)),totalEquity:R(()=>t.data().equity.reduce((m,e)=>m+ +e.counterAmount,0))})),Qe(t=>{let m=C(P),e={updateFilter:n=>{O(t,i=>v(f({},i),{filter:n}))},fetchBalanceSheet:Ie(xe(Be(()=>{let n=t.filter();return Object.entries(n).every(([i,p])=>p!=null&&p!=="")}),be(n=>m.getBalanceSheet(n).pipe(we({next:i=>{O(t,p=>v(f({},p),{data:i}))},error:i=>{console.error(i)}}))),Dt(1))),fetchLoader:Ie(xe(be(()=>m.getBalanceSheetLoader().pipe(we({next:n=>{O(t,i=>v(f({},i),{metadata:n,filter:{date:(0,yt.default)(n.filter.to).format("YYYY-MM-DD")}})),e.fetchBalanceSheet(t.filter)},error:n=>{console.error(n)}})))))};return e}),Je(t=>({onInit:()=>{t.fetchLoader()}})));var Yt=Tt(Ht());var It=t=>["/pages/chart-of-account/account/",t],wt=()=>["/pages/report/general-ledger"],sn=(t,m)=>({id:t,to:m}),Xt=t=>({id:t});function cn(t,m){if(t&1){let e=D();o(0,"p-button",11),w("onClick",function(){h(e);let i=c(2);return x(i.onExport())}),r()}}function dn(t,m){if(t&1&&(o(0,"div",9),g(1,cn,1,0,"p-button",10),r()),t&2){let e=c();l(),s("ngIf",e.roleService.global().export)}}function un(t,m){t&1&&(o(0,"tr")(1,"th",16),a(2,"Code"),r(),o(3,"th"),a(4,"Asset"),r(),o(5,"th",17),a(6,"Total"),r()())}function _n(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",18),a(5),r()(),o(6,"td",19)(7,"a",20),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit,n=c(3);l(2),b(e.code),l(2),s("routerLink",F(8,It,e.accountID)),l(),b(e.name),l(2),s("routerLink",M(10,wt))("queryParams",Vt(11,sn,e.accountID,n.store.filter().date)),l(),b(y(9,6,e.amount))}}function gn(t,m){if(t&1&&(o(0,"tr")(1,"td",21),a(2,"Total Asset"),r(),o(3,"td",22),a(4),S(5,"number"),r()()),t&2){let e=c(3);l(4),I(" ",y(5,1,e.store.totalAsset())," ")}}function fn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No asset records found."),r()()())}function hn(t,m){if(t&1&&(o(0,"h4",14),a(1,"Asset"),r(),o(2,"p-table",15),g(3,un,7,0,"ng-template",null,3,_)(5,_n,10,14,"ng-template",null,4,_)(7,gn,6,3,"ng-template",null,5,_)(9,fn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);l(2),s("value",e.store.data().asset)}}function xn(t,m){t&1&&(o(0,"tr")(1,"th",16),a(2,"Code"),r(),o(3,"th"),a(4,"Liability"),r(),o(5,"th",17),a(6,"Total"),r()())}function bn(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",25),a(5),r()(),o(6,"td",19)(7,"a",20),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;l(2),b(e.code),l(2),s("routerLink",F(8,It,e.accountID)),l(),b(e.name),l(2),s("routerLink",M(10,wt))("queryParams",F(11,Xt,e.accountID)),l(),b(y(9,6,e.counterAmount))}}function Cn(t,m){if(t&1&&(o(0,"tr")(1,"td",21),a(2," Total Liability "),r(),o(3,"td",22),a(4),S(5,"number"),r()()),t&2){let e=c(3);l(4),I(" ",y(5,1,e.store.totalLiability())," ")}}function Sn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No liability records found."),r()()())}function vn(t,m){if(t&1&&(o(0,"h4",24),a(1,"Liability"),r(),o(2,"p-table",15),g(3,xn,7,0,"ng-template",null,3,_)(5,bn,10,13,"ng-template",null,4,_)(7,Cn,6,3,"ng-template",null,5,_)(9,Sn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);l(2),s("value",e.store.data().liability)}}function yn(t,m){t&1&&(o(0,"tr")(1,"th",16),a(2,"Code"),r(),o(3,"th"),a(4,"Equity"),r(),o(5,"th",17),a(6,"Total"),r()())}function En(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",18),a(5),r()(),o(6,"td",19)(7,"a",20),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;l(2),b(e.code),l(2),s("routerLink",F(8,It,e.accountID)),l(),b(e.name),l(2),s("routerLink",M(10,wt))("queryParams",F(11,Xt,e.accountID)),l(),b(y(9,6,e.counterAmount))}}function In(t,m){if(t&1&&(o(0,"tr")(1,"td",21),a(2,"Total Equity"),r(),o(3,"td",22),a(4),S(5,"number"),r()(),o(6,"tr")(7,"td",21),a(8," Total Liability + Equity "),r(),o(9,"td",22),a(10),S(11,"number"),r()()),t&2){let e=c(3);l(4),I(" ",y(5,2,e.store.totalEquity())," "),l(6),I(" ",y(11,4,e.store.totalLiability()+e.store.totalEquity())," ")}}function wn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No equity records found."),r()()())}function Tn(t,m){if(t&1&&(o(0,"h4",24),a(1,"Equity"),r(),o(2,"p-table",15),g(3,yn,7,0,"ng-template",null,3,_)(5,En,10,13,"ng-template",null,4,_),a(7," <"),g(8,In,12,6,"ng-template",null,5,_)(10,wn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);l(2),s("value",e.store.data().equity)}}function Dn(t,m){if(t&1&&(o(0,"p-panel",12)(1,"div",13),g(2,hn,11,1)(3,vn,11,1)(4,Tn,12,1),r()()),t&2){let e=c();s("showHeader",!1),l(2),V(e.Object.keys(e.store.data().asset).length>0?2:-1),l(),V(e.Object.keys(e.store.data().liability).length>0?3:-1),l(),V(e.Object.keys(e.store.data().equity).length>0?4:-1)}}function Rn(t,m){if(t&1&&(o(0,"div",31)(1,"div"),a(2),r()()),t&2){let e=m.$implicit;l(2),b(e.value)}}function Fn(t,m){if(t&1&&(o(0,"form",26)(1,"div",27)(2,"label",28),a(3,"Tag"),r(),o(4,"p-multiselect",29),g(5,Rn,3,1,"ng-template",null,7,_),r()(),o(7,"div",27)(8,"label",28),a(9,"From"),r(),T(10,"p-datepicker",30),r()()),t&2){let e=c();s("formGroup",e.filterForm),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.metadata().options.outlets)("showClear",!0),l(6),s("iconDisplay","input")("showIcon",!0)}}var Jt=(()=>{class t{constructor(){this.store=C(Et),this.ReportServiceStore=C(P),this.dialogFilterVisible=E(!1),this.isInitDialogFilterVisible=E(!1),this.roleService=C(oe),this.Object=Object}ngOnInit(){this.generateFilterForm()}generateFilterForm(){this.filterForm=new Gt({date:new st(new Date),outletID:new st([])})}onFilterOKEvent(){let{date:e,outletID:n}=this.filterForm.value;this.store.updateFilter({date:(0,Yt.default)(e).format("YYYY-MM-DD"),listOutletParam:n}),this.dialogFilterVisible.update(i=>!i)}onExport(){let e=v(f({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.ReportServiceStore.getBalanceSheet(e,{responseType:"blob"}).pipe(Ne("Export Balance Sheet"),L(n=>{let i=n.type,p=[n],u=document.createElement("a");u.href=window.URL.createObjectURL(new Blob(p,{type:i}));let d=`balance-sheet.${i.split("/")[1]}`;u.setAttribute("download",d),document.body.appendChild(u),u.click(),document.body.removeChild(u)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-balance-sheet"]],features:[Oe([Et])],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],["item",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],[1,"d-flex","gap-2"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],[3,"showHeader"],[1,"d-flex","flex-column","gap-3"],[1,"fs-5","fw-semibold","mt-3"],[3,"value"],[2,"width","20%"],[1,"text-end",2,"width","12rem"],["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 an Tag",3,"virtualScroll","virtualScrollItemSize","options","showClear"],["formControlName","date","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],[1,"flex","items-center","gap-2"]],template:function(n,i){if(n&1){let p=D();o(0,"app-main-panel",8),G("isDialogFilterVisibleChange",function(d){return h(p),A(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),x(d)})("isInitDialogFilterVisibleChange",function(d){return h(p),A(i.isInitDialogFilterVisible,d)||(i.isInitDialogFilterVisible=d),x(d)}),w("filterConfirmed",function(){return h(p),x(i.onFilterOKEvent())}),g(1,dn,2,1,"ng-template",null,0,_)(3,Dn,5,4,"ng-template",null,1,_)(5,Fn,11,7,"ng-template",null,2,_),r()}n&2&&(s("pageTitle",i.store.data().pageTitle)("isFilterable",!0),B("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[re,K,H,W,se,me,ae,ie,te,ee,J,Y,X,Q,Z,ue,de,pe,le,Ee,ne,$e,$,U],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Qt=(()=>{class t{static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-comparative-balance"]],decls:3,vars:0,template:function(n,i){n&1&&(o(0,"p"),a(1,"report-comparative-balance works!"),r(),a(2,`
|
|
2
|
+
,
|
|
3
|
+
`))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Zt=(()=>{class t{static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-cash-flow"]],decls:3,vars:0,template:function(n,i){n&1&&(o(0,"p"),a(1,"report-cash-flow works!"),r(),a(2,`
|
|
4
|
+
,
|
|
5
|
+
`))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var ei=(()=>{class t{static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-trial-balance"]],decls:3,vars:0,template:function(n,i){n&1&&(o(0,"p"),a(1,"report-trial-balance works!"),r(),a(2,`
|
|
6
|
+
,
|
|
7
|
+
`))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Mn=()=>({width:"30vw"}),Ln=()=>({"1199px":"75vw","575px":"90vw"}),Vn=t=>["/pages/journal/journal-entry/",t],ti=t=>({"text-success":t}),kn=t=>({"text-danger":t}),Nn=t=>({"ng-dirty ng-invalid":t}),An=()=>({scrollHeight:"250px"});function Bn(t,m){if(t&1){let e=D();o(0,"p-button",27),w("onClick",function(){h(e);let i=c(2);return x(i.onToggleExportDialog())}),r()}}function Pn(t,m){if(t&1&&(o(0,"div",24)(1,"a",25),a(2,"Return to Accounts"),r(),g(3,Bn,1,0,"p-button",26),r()),t&2){let e=c();l(3),s("ngIf",e.roleService.global().export)}}function Gn(t,m){if(t&1&&(o(0,"div",24)(1,"span",31)(2,"h2",32),a(3),r()(),o(4,"span",31)(5,"h2",32),a(6),r()()()),t&2){let e=c().$implicit;l(3),b(e.name),l(3),I(" (",e.chartOfAccountCode,") ")}}function On(t,m){t&1&&(o(0,"tr")(1,"th"),a(2,"No."),r(),o(3,"th"),a(4,"Date"),r(),o(5,"th"),a(6,"Contact / Note"),r(),o(7,"th",33),a(8,"Debit"),r(),o(9,"th",33),a(10,"Credit"),r(),o(11,"th",33),a(12,"Balance"),r()())}function jn(t,m){if(t&1&&(o(0,"div")(1,"span",42),a(2),r()()),t&2){let e=c().$implicit;l(2),I(" ",e.outletName," ")}}function zn(t,m){if(t&1&&(o(0,"div",38),T(1,"div",43),o(2,"span",44),a(3),r()()),t&2){let e=c().$implicit;l(),s("innerHTML",e.journalNote,j),l(2),I("",e.note," ")}}function qn(t,m){if(t&1&&(o(0,"div",38),T(1,"span",43)(2,"div",43),o(3,"span",44),a(4),r()()),t&2){let e=c().$implicit;l(),s("innerHTML",e.referenceText,j),l(),s("innerHTML",e.journalNote,j),l(2),I("",e.note," ")}}function Hn(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.debitAmount)," ")}}function Wn(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.creditAmount)," ")}}function Kn(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;l(),I(" ",y(2,1,e.balance)," ")}}function Un(t,m){if(t&1&&(o(0,"tr")(1,"td",34),g(2,jn,3,1,"div",35),o(3,"a",36),a(4),r()(),o(5,"td",34),a(6),S(7,"date"),r(),o(8,"td",37)(9,"div",38)(10,"a",39),a(11),r(),g(12,zn,4,2,"div",38)(13,qn,5,3,"div",38),r()(),o(14,"td",40),g(15,Hn,3,3,"ng-container",35),r(),o(16,"td",40),g(17,Wn,3,3,"ng-container",35),r(),o(18,"td",41),g(19,Kn,3,3,"ng-container",35),r()()),t&2){let e=m.$implicit,n=c(4);l(2),s("ngIf",e.outletName==null?null:e.outletName.trim()),l(),s("routerLink",F(16,Vn,e.id)),l(),b(e.number),l(2),I(" ",ke(7,13,e.date,"dd MMM yyyy")," "),l(2),s("ngClass",F(18,ti,e.debitAmount!==0)),l(2),s("href",n.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.contactID,Pe),l(),b(e.contactName),l(),V(n.buildReferenceUrl(e)?12:13),l(2),s("ngClass",F(20,ti,e.debitAmount!==0)),l(),s("ngIf",e.debitAmount!==0),l(),s("ngClass",F(22,kn,e.creditAmount!==0)),l(),s("ngIf",e.creditAmount!==0),l(2),s("ngIf",e.balance!==0)}}function $n(t,m){if(t&1&&(o(0,"tr"),T(1,"td",45),o(2,"td",46),a(3,"Total"),r(),o(4,"td",47),a(5),S(6,"number"),r(),o(7,"td",48),a(8),S(9,"number"),r(),T(10,"td"),r()),t&2){let e=c().$index,n=c(3);l(5),I(" ",y(6,2,n.items().data[e].debitTotal)," "),l(3),I(" ",y(9,4,n.items().data[e].creditTotal)," ")}}function Yn(t,m){t&1&&(o(0,"tr")(1,"td",49)(2,"span"),a(3,"No records found."),r()()())}function Xn(t,m){if(t&1&&(o(0,"p-table",30),g(1,Gn,7,2,"ng-template",null,5,_)(3,On,13,0,"ng-template",null,6,_)(5,Un,20,24,"ng-template",null,7,_)(7,$n,11,6,"ng-template",null,4,_)(9,Yn,4,0,"ng-template",null,8,_),r()),t&2){let e=m.$implicit;s("value",e.data)}}function Jn(t,m){if(t&1&&(o(0,"div",29),Me(1,Xn,11,1,"p-table",30,Fe),r()),t&2){let e=c(2);l(),Le(e.items().data)}}function Qn(t,m){if(t&1&&g(0,Jn,3,0,"div",28),t&2){let e=c();s("ngIf",e.items()&&e.items().data)}}function Zn(t,m){if(t&1&&(o(0,"div",24)(1,"div",31)(2,"span",65),a(3),r()(),o(4,"div")(5,"span"),a(6,"-"),r()(),o(7,"div",31)(8,"span",66),a(9),r()()()),t&2){let e=m.$implicit;l(3),I("(",e.code,")"),l(6),b(e.name)}}function eo(t,m){if(t&1&&(o(0,"div",24)(1,"div",31)(2,"span",65),a(3),r()(),o(4,"div")(5,"span"),a(6,"-"),r()(),o(7,"div",31)(8,"span",66),a(9),r()()()),t&2){let e=m.$implicit;l(3),I("(",e.code,")"),l(6),b(e.name)}}function to(t,m){t&1&&(o(0,"div",67),a(1," Account is required. "),r())}function io(t,m){if(t&1&&(o(0,"div",68)(1,"div"),a(2),r()()),t&2){let e=m.$implicit;l(2),b(e.value)}}function no(t,m){if(t&1&&(o(0,"div",59)(1,"div",21),T(2,"p-radiobutton",69),o(3,"label",70),a(4),r()()()),t&2){let e=m.$implicit;l(2),s("value",e.key)("inputId",e.key),l(),Mt("for",e.key),l(),b(e.value)}}function oo(t,m){if(t&1){let e=D();o(0,"div",38)(1,"label",51),a(2,"Customer"),r(),o(3,"p-autocomplete",71),w("completeMethod",function(i){h(e);let p=c(2);return x(p.searchCustomer(i))}),r()()}if(t&2){let e=c(2);l(3),s("suggestions",e.customerSuggestions())}}function ro(t,m){if(t&1){let e=D();o(0,"div",38)(1,"label",51),a(2,"Supplier"),r(),o(3,"p-autocomplete",72),w("completeMethod",function(i){h(e);let p=c(2);return x(p.searchSupplier(i))}),r()()}if(t&2){let e=c(2);l(3),s("suggestions",e.supplierSuggestions())}}function ao(t,m){if(t&1){let e=D();o(0,"div",38)(1,"label",51),a(2,"Customer"),r(),o(3,"p-autocomplete",71),w("completeMethod",function(i){h(e);let p=c(2);return x(p.searchCustomer(i))}),r()()}if(t&2){let e=c(2);l(3),s("suggestions",e.customerSuggestions())}}function lo(t,m){if(t&1){let e=D();o(0,"form",50)(1,"div",38)(2,"label",51),a(3,"Accounts"),r(),o(4,"p-multiselect",52),w("onChange",function(i){h(e);let p=c();return x(p.onAccountChange(i))}),g(5,Zn,10,2,"ng-template",null,9,_)(7,eo,10,2,"ng-template",null,10,_),r(),g(9,to,2,0,"div",53),r(),o(10,"div",38)(11,"label",51),a(12,"From"),r(),o(13,"div",54),T(14,"p-datepicker",55)(15,"p-datepicker",56),r()(),o(16,"div",38)(17,"label",51),a(18,"Tag"),r(),o(19,"p-multiselect",57),g(20,io,3,1,"ng-template",null,10,_),r()(),o(22,"div",38)(23,"label",51),a(24,"Category"),r(),o(25,"p-treeselect",58),w("onFocus",function(){h(e);let i=c();return x(i.onCategoryFocus())}),r()(),o(26,"div",38)(27,"label",18),a(28,"Contact Type"),r(),o(29,"div",16),Me(30,no,5,4,"div",59,Fe),r()(),o(32,"div",38)(33,"label",18),a(34,"Sort order"),r(),o(35,"div",16)(36,"div",59)(37,"div",21),T(38,"p-radiobutton",60),o(39,"label",61),a(40,"Asc"),r()()(),o(41,"div",62)(42,"div",21),T(43,"p-radiobutton",63),o(44,"label",64),a(45,"Desc"),r()()()()(),g(46,oo,4,1,"div",38)(47,ro,4,1,"div",38)(48,ao,4,1,"div",38),r()}if(t&2){let e,n,i,p,u,d,k=c();s("formGroup",k.form),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",(e=k.loaderMetadata())==null||e.options==null?null:e.options.accounts)("selectionLimit",5)("ngClass",F(21,Nn,((n=k.form.get("listAccountID"))==null?null:n.invalid)&&(((n=k.form.get("listAccountID"))==null?null:n.touched)||((n=k.form.get("listAccountID"))==null?null:n.dirty)))),l(5),s("ngIf",((i=k.form.get("listAccountID"))==null?null:i.invalid)&&(((i=k.form.get("listAccountID"))==null?null:i.touched)||((i=k.form.get("listAccountID"))==null?null:i.dirty))),l(5),s("showIcon",!0),l(),s("iconDisplay","input")("showIcon",!0),l(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",(p=k.loaderMetadata())==null||p.options==null?null:p.options.outlets),l(6),s("metaKeySelection",!1)("virtualScroll",!0)("virtualScrollItemSize",50)("virtualScrollOptions",M(23,An))("options",k.categoriesOptions()),l(5),Le((u=k.loaderMetadata())==null||u.options==null?null:u.options.contactTypeOptions),l(8),s("value",!0),l(5),s("value",!1),l(3),V((d=k.form.controls.contactType.value)===1?46:d===2?47:48)}}function po(t,m){if(t&1){let e=D();o(0,"p-button",73),w("onClick",function(){h(e);let i=c();return x(i.onToggleExportDialog())}),r()}t&2&&s("rounded",!0)("text",!0)}function mo(t,m){if(t&1){let e=D();o(0,"p-button",74),w("click",function(){h(e);let i=c();return x(i.onToggleExportDialog())}),r(),o(1,"p-button",75),w("click",function(){h(e);let i=c();return x(i.onExport())}),r()}}var ii=(()=>{class t{buildReferenceUrl(e){return pt(e)}getGLCount(){this.reportService.getGLCount(this.filter()).pipe(L(({count:e})=>{this.totalRecords.set(e)})).subscribe()}onToggleExportDialog(){this.isDialogExportVisible.update(e=>!e)}get pageTitle(){return this.items()&&this.items().pageTitle?this.items().pageTitle:"General Ledger"}constructor(){this.reportService=C(P),this.route=C(He),this.roleService=C(oe),this.authService=C(Se),this.fb=C(ve),this.coaService=C(ot),this.toastr=C(We),this.dayjsService=C(ce),this.infinity=1/0,this.metadata=E(null),this.items=E(null),this.totalRecords=E(-1),this.dialogFilterVisible=E(!0),this.initDialogVisible=E(!1),this.isDialogExportVisible=E(!1),this.customerSuggestions=E([]),this.supplierSuggestions=E([]),this.categoriesOptions=E([]),this.localFilter=E({}),this.count=R(()=>this.totalRecords()<0?1/0:this.totalRecords()),this.pagination=R(()=>{let e=this.filter(),n=this.totalRecords()!=null&&this.totalRecords()>=0?this.totalRecords():1/0,i=Math.min(e.pageNumber*e.pageSize,isFinite(n)?n:e.pageNumber*e.pageSize);return{first:1,end:e.pageSize>0?i:0,total:n,page:e.pageNumber,pageSize:e.pageSize,hasPrev:e.pageNumber>1,hasNext:isFinite(n)?e.pageNumber*e.pageSize<n:!0}}),this.loaderMetadata=ye(this.reportService.fetchGeneralLedgerLoader("multiple"),{initialValue:null}),this.baseFilter=R(()=>{let e=this.loaderMetadata();return e?e.filter:null}),this.exportFileTypes=E([{key:0,value:"CSV"},{key:1,value:"Excel"}]),this.queryFilter=ye(this.route.queryParamMap.pipe(Ae(e=>({accountID:e.get("id"),to:e.get("to")}))),{initialValue:null}),this.filter=R(()=>{let e=this.baseFilter(),n=this.queryFilter(),i=this.localFilter();return e?f(f(f({},e),n??{}),i):null}),this.creditSubTotal=R(()=>0),this.debitSubTotal=R(()=>0),this.initializeForm(),ge(()=>{let e=this.filter();if(e){this.form.patchValue(this.transformFilterToFormValue(e),{emitEvent:!1});let n=Array.isArray(e.listAccountID)?e.listAccountID:[],i=Array.isArray(e.listCategoryID)?e.listCategoryID:[];(n.length>0||i.length>0)&&this.reportService.fetchGeneralLedgerReport(e,"multiple").pipe().subscribe(p=>{this.items.set(p)})}})}initializeForm(){this.form=this.fb.group({accountID:this.fb.control(null),from:this.fb.control(null),to:this.fb.control(new Date),contactType:this.fb.control(null),contactID:this.fb.control(""),listOutletID:this.fb.control([]),pageNumber:this.fb.control(1),pageSize:this.fb.control(50),sortAscending:this.fb.control(!0),listCategoryID:this.fb.control([]),listAccountID:this.fb.control([]),export:this.fb.control(!1),exportPageNumber:this.fb.control(1),exportPageSize:this.fb.control(0)})}findNodeByKey(e,n){for(let i of e){if(i.key===n)return i;if(i.children){let p=this.findNodeByKey(i.children,n);if(p)return p}}return null}transformFilterToFormValue(e){return Object.entries(e).reduce((n,[i,p])=>{switch(i){case"from":break;case"to":n[i]=p&&(typeof p=="string"||typeof p=="number"||p instanceof Date)?this.dayjsService.from(p)?.toDate():this.dayjsService.now.toDate();break;case"listCategoryID":Array.isArray(p)?n[i]=p.map(u=>this.findNodeByKey(this.categoriesOptions(),u)).filter(u=>!!u):n[i]=[];break;case"listOutletID":case"listAccountID":n[i]=Array.isArray(p)?p:[];break;case"pageNumber":case"pageSize":case"exportPageNumber":case"exportPageSize":n[i]=p!=null?Number(p):0;break;case"sortAscending":case"export":n[i]=!!p;break;case"contactType":console.log("contactType value:",p),n[i]=p!=null?Number(p):null;break;default:n[i]=p}return n},{})}clearContactValueOnContactTypeChange(){this.form.get("contactType")?.valueChanges.subscribe(()=>this.form.get("contactID")?.setValue(""))}onFormValueChange(){let e=this.form.controls.listAccountID.value,n=this.form.controls.listCategoryID.value;e.length<=0&&n.length<=0?(this.form.controls.listAccountID.enable({emitEvent:!1}),this.form.controls.listCategoryID.enable({emitEvent:!1})):e.length>0?(this.form.controls.listAccountID.enable({emitEvent:!1}),this.form.controls.listCategoryID.disable({emitEvent:!1})):n.length>0&&(this.form.controls.listAccountID.disable({emitEvent:!1}),this.form.controls.listCategoryID.enable({emitEvent:!1}))}isEmpty(e){return e==null||typeof e=="string"&&e.trim().length===0}onCategoryFocus(){this.coaService.getCachedCategoriesOptions().pipe(L(e=>this.categoriesOptions.set(e))).subscribe()}searchCustomer(e){this.reportService.getCustomerSuggestions(e.query).pipe(L(n=>this.customerSuggestions.set(n))).subscribe()}searchSupplier(e){this.reportService.getSupplierSuggestions(e.query).pipe(L(n=>this.supplierSuggestions.set(n))).subscribe()}onAccountChange(e){Array.isArray(e.value)&&e.value.length>5&&this.toastr.warning("Please select at most 5 accounts for the general ledger report.","Warning")}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched(),this.dialogFilterVisible.set(!0);return}let e=this.buildFilterBody();this.dialogFilterVisible.set(!1),this.localFilter.set(e)}buildFilterBody(){let p=this.form.value,{from:e,to:n}=p,i=he(p,["from","to"]);return v(f({},this.filter()),{pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,listCategoryID:i.listCategoryID?.map(u=>u.key)??[],contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType})}onExport(){let e=this.buildExportBody();this.performExport(e)}performExport(e){this.reportService.exportMultiLedger(e,{responseType:"blob",observe:"response"}).pipe(L(n=>this.handleExportResponse(n))).subscribe()}handleExportResponse(e){let n=e.headers,i=n.get("Content-Disposition")??n.get("content-disposition"),p="download.csv";if(i){let d=i.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);d?.[1]&&(p=decodeURIComponent(d[1].replace(/"/g,"")))}let u=e.body;lt(u,p,u.type)}buildExportBody(){let p=this.form.value,{from:e,to:n}=p,i=he(p,["from","to"]);return v(f({},this.filter()),{exportPageNumber:+i.exportPageNumber,pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,listCategoryID:i.listCategoryID?.map(u=>u.key)??[],contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType,export:!0})}onNextPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(f({},e),{pageNumber:n+1})})}onPrevPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(f({},e),{pageNumber:Math.max(1,n-1)})})}goToPage(e){this.localFilter.update(n=>v(f({},n),{pageNumber:e}))}goToLastPage(){let e=this.filter();if(!e)return;let n=this.totalRecords();if(n===-1||!isFinite(n)){this.toastr.info("Please load total records before going to the last page","Info");return}let i=Math.ceil(n/e.pageSize);if(e.pageNumber>=i){this.toastr.warning("You are already on the last page","Warning");return}this.localFilter.update(p=>v(f({},p),{pageNumber:i}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-multiple-ledger"]],decls:28,vars:19,consts:[["actionButton",""],["content",""],["filters",""],["closeIconTemplate",""],["footer",""],["caption",""],["header",""],["body",""],["emptymessage",""],["selectedItem",""],["item",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isDialogFilterVisible","isFilterable","isInitDialogFilterVisible","scrollable"],["header","Export Journal Entry",3,"visibleChange","modal","visible","breakpoints"],[1,"d-flex","flex-column","gap-3"],[1,"row",3,"formGroup"],[1,"col-8"],[1,"row"],[1,"col"],["for",""],["type","text","formControlName","exportPageNumber","fluid","","pInputText","","pSize","small"],["role","alert",1,"alert","alert-primary","m-0","p-2"],[1,"d-flex","align-items-center","gap-2"],[1,"fa-solid","fa-circle-info"],[1,"fs-2","text-dark","fw-semibold"],[1,"d-flex","gap-2"],["routerLink","/pages/chart-of-account/account",1,"p-button","p-button-secondary","p-button-outlined","fs-3"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],["class","px-3 h-100 bg-white border-top",4,"ngIf"],[1,"px-3","h-100","bg-white","border-top"],[3,"value"],[1,""],[1,"fs-5","fw-semibold"],[1,"text-end"],[1,"text-break"],[4,"ngIf"],["target","_blank",1,"link","link-primary",3,"routerLink"],[1,"text-break",3,"ngClass"],[1,"d-flex","flex-column"],["target","_blank",1,"link","link-primary",3,"href"],[1,"text-end","text-break",3,"ngClass"],[1,"text-end","text-break"],[1,"badge","bg-light","text-dark"],[3,"innerHTML"],[2,"width","300px","white-space","normal","word-break","break-word"],["colspan","2"],[1,"text-end","fw-semibold"],[1,"text-end","fw-semibold","text-success"],[1,"text-end","fw-semibold","text-danger"],["colspan","8"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],["for","outlet"],["showClear","","filter","","filterBy","code,name","display","chip","formControlName","listAccountID","appendTo","body","optionLabel","name","optionValue","id","placeholder","Select Accounts",3,"onChange","virtualScroll","virtualScrollItemSize","options","selectionLimit","ngClass"],["class","text-danger",4,"ngIf"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","iconDisplay","input","inputId","icondisplay",3,"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 an Tag",3,"virtualScroll","virtualScrollItemSize","options"],["showClear","","display","chip","selectionMode","multiple","filter","","filterBy","label","formControlName","listCategoryID","appendTo","body","containerStyleClass","w-100","optionLabel","label","optionValue","key","placeholder","Select Category",3,"onFocus","metaKeySelection","virtualScroll","virtualScrollItemSize","virtualScrollOptions","options"],[1,"col-4"],["name","sortAscending","formControlName","sortAscending","inputId","asc",3,"value"],["for","asc",1,"m-0"],[1,"col-3"],["name","sortAscending","formControlName","sortAscending","inputId","desc",3,"value"],["for","desc",1,"m-0"],[1,"h-full","align-middle"],[1,"text-truncate","d-inline-block","h-full","align-middle"],[1,"text-danger"],[1,"flex","items-center","gap-2"],["name","contactType","formControlName","contactType",3,"value","inputId"],[1,"m-0",3,"for"],["formControlName","contactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["formControlName","ContactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["severity","secondary","variant","outlined","icon","fa-solid fa-xmark",3,"onClick","rounded","text"],["label","Cancel","severity","secondary","variant","outlined",3,"click"],["label","OK (F2)",3,"click"]],template:function(n,i){if(n&1){let p=D();o(0,"app-main-panel",11),G("isDialogFilterVisibleChange",function(d){return h(p),A(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),x(d)})("isInitDialogFilterVisibleChange",function(d){return h(p),A(i.initDialogVisible,d)||(i.initDialogVisible=d),x(d)}),w("filterConfirmed",function(){return h(p),x(i.onFilterOKEvent())}),g(1,Pn,4,1,"ng-template",null,0,_)(3,Qn,1,1,"ng-template",null,1,_)(5,lo,49,24,"ng-template",null,2,_),r(),o(7,"p-dialog",12),G("visibleChange",function(d){return h(p),A(i.isDialogExportVisible,d)||(i.isDialogExportVisible=d),x(d)}),o(8,"div",13)(9,"div",14)(10,"div",15)(11,"div",16)(12,"div",17)(13,"label",18),a(14,"Page"),r()(),o(15,"div",17),T(16,"input",19),r()()()(),o(17,"div",20)(18,"div",21),T(19,"i",22),o(20,"span",23),a(21),S(22,"number"),S(23,"number"),r()()()(),g(24,po,1,2,"ng-template",null,3,_)(26,mo,2,0,"ng-template",null,4,_),r()}if(n&2){let p;s("pageTitle",i.pageTitle),B("isDialogFilterVisible",i.dialogFilterVisible),s("isFilterable",!0),B("isInitDialogFilterVisible",i.initDialogVisible),s("scrollable",!0),l(7),Ge(M(17,Mn)),s("modal",!0),B("visible",i.isDialogExportVisible),s("breakpoints",M(18,Ln)),l(2),s("formGroup",i.form),l(12),Ve("Exporting data from ",y(22,13,(p=i.filter())==null?null:p.exportPageNumber)," - ",y(23,15,(p=i.filter())==null?null:p.exportPageSize),"")}},dependencies:[re,K,ze,H,W,qe,ae,se,me,tt,et,ie,te,Te,pe,le,Re,De,ee,J,Bt,Y,X,Q,Z,ue,de,Ee,Ue,at,Wt,rt,ne,$,U,nt,it,Ke,Ot],styles:["[_nghost-%COMP%] .p-datatable .p-datatable-header{padding:.75rem 1rem .75rem 0}[_nghost-%COMP%] th:nth-child(1){width:10%}[_nghost-%COMP%] th:nth-child(2){width:15%}[_nghost-%COMP%] th:nth-child(3){width:40%}[_nghost-%COMP%] th:nth-child(4){width:15%}[_nghost-%COMP%] th:nth-child(5){width:15%}[_nghost-%COMP%] th:nth-child(6){width:15%}"],changeDetection:0})}}return t})();var tl=[{path:"",redirectTo:"general-ledger",pathMatch:"full"},{path:"",children:[{path:"general-ledger",component:Ut},{path:"multiple-general-ledger",component:ii},{path:"profit-loss",component:$t},{path:"balance-sheet",component:Jt},{path:"comparative-balance",component:Qt},{path:"trial-balance",component:ei},{path:"cash-flow",component:Zt}]}];export{tl as REPORTS_ROUTES};
|