dealposbooks 6.1.0 → 6.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/{chunk-SGZKLLJ3.js → chunk-3ZUNX7VU.js} +1 -1
  2. package/{chunk-7YZVZ5BS.js → chunk-5BR6MXLX.js} +1 -1
  3. package/{chunk-7BF6SRB6.js → chunk-62IWOTCR.js} +1 -1
  4. package/{chunk-57ZAKRGI.js → chunk-6KZDDZJR.js} +1 -1
  5. package/{chunk-UG22TPCX.js → chunk-AZBEWVID.js} +1 -1
  6. package/{chunk-DV6F4QO2.js → chunk-B3O26J3M.js} +1 -1
  7. package/{chunk-K7BIGLIP.js → chunk-BIOJKKEJ.js} +1 -1
  8. package/{chunk-K5J6NUJE.js → chunk-BIWU6LQ4.js} +1 -1
  9. package/{chunk-NZSJRTRD.js → chunk-BXBME2GW.js} +1 -1
  10. package/{chunk-NJPIJBIH.js → chunk-COGLGLZN.js} +1 -1
  11. package/{chunk-N5VERGYS.js → chunk-DESK3OTZ.js} +1 -1
  12. package/{chunk-LPQEYBQJ.js → chunk-E5DM3TCW.js} +1 -1
  13. package/{chunk-FVGNCLOK.js → chunk-ET2CSJP4.js} +1 -1
  14. package/{chunk-54DASCAO.js → chunk-FFTAVKXN.js} +2 -2
  15. package/{chunk-3YEWFLAB.js → chunk-FMUAKMQ5.js} +1 -1
  16. package/{chunk-23GVTAWH.js → chunk-FN4UAN7G.js} +2 -2
  17. package/{chunk-TFWPK5J7.js → chunk-FT3TVNWY.js} +1 -1
  18. package/{chunk-WRIMBWE3.js → chunk-GD3XKRKO.js} +1 -1
  19. package/{chunk-VTWVZP43.js → chunk-GTX34ZM3.js} +1 -1
  20. package/{chunk-4PQV7T7O.js → chunk-ITZG65LC.js} +1 -1
  21. package/{chunk-UYZEPPQA.js → chunk-IV6U6FEE.js} +1 -1
  22. package/{chunk-IYF3XQOZ.js → chunk-IY6CYYHW.js} +1 -1
  23. package/{chunk-FN42URZ3.js → chunk-JHBRCP5H.js} +1 -1
  24. package/{chunk-EX4CZ2IJ.js → chunk-JOMQZ2PR.js} +1 -1
  25. package/{chunk-NF2REGV3.js → chunk-JP63AHXQ.js} +1 -1
  26. package/{chunk-FUUUWWNE.js → chunk-JSCEZN7L.js} +1 -1
  27. package/{chunk-XZGQHWLM.js → chunk-K32QD3HY.js} +1 -1
  28. package/{chunk-YG2CG5KO.js → chunk-KH66PYZ6.js} +2 -2
  29. package/{chunk-3KN63HEO.js → chunk-KX5T5GT4.js} +1 -1
  30. package/chunk-MTBBYR5X.js +1 -0
  31. package/{chunk-2ISYUFG4.js → chunk-N2BMSGXB.js} +1 -1
  32. package/{chunk-XRSMVQPC.js → chunk-NMOIUA6X.js} +1 -1
  33. package/{chunk-T2VQD2QW.js → chunk-OBPYHPHW.js} +1 -1
  34. package/{chunk-5L65JV3Z.js → chunk-ONEE4PD6.js} +1 -1
  35. package/{chunk-3MU7BZQU.js → chunk-OSGJ7FIK.js} +1 -1
  36. package/{chunk-VU37VDEH.js → chunk-QEGANYLE.js} +1 -1
  37. package/{chunk-TPC2WBCZ.js → chunk-QJD5K4TQ.js} +1 -1
  38. package/{chunk-GQGDL2PY.js → chunk-QKOOQ5C6.js} +1 -1
  39. package/{chunk-CYXK442Y.js → chunk-R7JOHC7X.js} +1 -1
  40. package/{chunk-DPPBBVUJ.js → chunk-S5BG5EGL.js} +1 -1
  41. package/{chunk-QZUOIZEL.js → chunk-SBY42MRN.js} +1 -1
  42. package/{chunk-F5KRTO45.js → chunk-SL4B7NII.js} +1 -1
  43. package/{chunk-5GRB6DBD.js → chunk-SOIFEV7G.js} +1 -1
  44. package/{chunk-WNU7SPEQ.js → chunk-T7VWZPHW.js} +1 -1
  45. package/{chunk-WRDVJWTP.js → chunk-TDKHCTOJ.js} +1 -1
  46. package/{chunk-RECDKMMV.js → chunk-TP3VPXGY.js} +1 -1
  47. package/{chunk-4P2FBAEV.js → chunk-UA3NWMTR.js} +1 -1
  48. package/{chunk-U7VHSRLR.js → chunk-UIAMVGX6.js} +1 -1
  49. package/{chunk-CTGNW5L6.js → chunk-UOXEXJ2S.js} +1 -1
  50. package/{chunk-5FVLV36I.js → chunk-URW7SXYE.js} +1 -1
  51. package/{chunk-HFBOGVOC.js → chunk-V5TE2DDF.js} +1 -1
  52. package/{chunk-S2HC6Q76.js → chunk-VF5FAVF2.js} +1 -1
  53. package/{chunk-XOVBJ4EV.js → chunk-WOL3MISH.js} +1 -1
  54. package/{chunk-ZUVAI5XZ.js → chunk-WUFTR2A3.js} +1 -1
  55. package/{chunk-MLJIFWTK.js → chunk-X5H54AB7.js} +1 -1
  56. package/{chunk-C6FMCO33.js → chunk-YDWQDJEA.js} +1 -1
  57. package/index.html +2 -2
  58. package/{main-SLOJLSEN.js → main-M7FIUNAZ.js} +1 -1
  59. package/package.json +1 -1
  60. package/chunk-ADDLKMW6.js +0 -1
@@ -1 +1 @@
1
- import{a as i,b as T}from"./chunk-IEOE2XJ7.js";import{d as s}from"./chunk-7NZRUZLK.js";import{a as l}from"./chunk-WDFE7CAE.js";import{c as m}from"./chunk-WNU7SPEQ.js";import{V as a,_ as c,da as r}from"./chunk-T6YHDD6J.js";var h=(()=>{class o{constructor(){this.httpService=r(l),this.router=r(s),this.intercomService=r(m),this.tokenService=r(T),this.autoLogout()}login(e){return this.httpService.post("","api/Authentication/login",e).pipe(a(t=>{let n=e.SubDomain;localStorage.setItem("AUTH_TOKEN",t.access_token),localStorage.setItem("AUTH_POS_TOKEN",t.pos.access_token),localStorage.setItem("AUTH_TOKEN_TYPE",t.token_type),localStorage.setItem("AUTH_EXPIRES_AT",t.expiredAt),localStorage.setItem("AUTH_DOMAIN",n.substring(n.indexOf("."))),localStorage.setItem("AUTH_SUB_DOMAIN",e.SubDomain.split(".")[0]),localStorage.setItem("AUTH_USERNAME",e.Username),this.storeIntercom(t),this.storeTenantId(t.pos.access_token),this.storeRoles(t.access_token),this.tokenService.setToken(t.access_token),this.autoLogout()}))}storeIntercom(e){let t=e.intercomWidget?JSON.stringify(e.intercomWidget):null;t&&localStorage.setItem("INTERCOM",t)}isAuthenticated(){return!!localStorage.getItem("AUTH_TOKEN")}getToken(){return localStorage.getItem("AUTH_TOKEN")}getTokenType(){return localStorage.getItem("AUTH_TOKEN_TYPE")}isTokenExpired(){let e=localStorage.getItem("AUTH_EXPIRES_AT");return e?new Date(e).getTime()<Date.now():!0}autoLogout(){clearTimeout(this.logoutTimer);let e=localStorage.getItem("AUTH_EXPIRES_AT");if(!e)return;let t=new Date(e).getTime()-Date.now();t>0?this.logoutTimer=setTimeout(()=>this.logout(),t):this.logout()}getTenantExternalURL(){let e=localStorage.getItem("AUTH_SUB_DOMAIN")||"",t=localStorage.getItem("AUTH_DOMAIN")||"";return e&&t?`https://${e}${t}`:""}getTanantToken(){return localStorage.getItem("AUTH_POS_TOKEN")}logout(){this.intercomService.shutdown(),localStorage.removeItem("AUTH_TOKEN"),localStorage.removeItem("AUTH_TOKEN_TYPE"),localStorage.removeItem("AUTH_EXPIRES_AT"),localStorage.removeItem("INTERCOM"),clearTimeout(this.logoutTimer),this.router.navigate([""])}getFullDomain(){let e=localStorage.getItem("AUTH_SUB_DOMAIN"),t=localStorage.getItem("AUTH_DOMAIN");return!e||!t?(console.error("Subdomain or domain is missing in local storage."),null):`${e}${t}`}storeTenantId(e){let t=i(e);console.log("Decoded Token:",t),t&&(localStorage.setItem("AC_TENANT_BRAND",t.Brand),localStorage.setItem("AC_TENANT_LID",t.LID))}storeRoles(e){let t=i(e);console.log("Decoded Token:",t),t&&localStorage.setItem("AUTH_ROLES",JSON.stringify(t["http://schemas.microsoft.com/ws/2008/06/identity/claims/role"]))}checkAuthKeysExists(){return["AC_TENANT_BRAND","AC_TENANT_LID","AUTH_DOMAIN","AUTH_EXPIRES_AT","AUTH_POS_TOKEN","AUTH_SUB_DOMAIN","AUTH_TOKEN","AUTH_TOKEN_TYPE","AUTH_USERNAME","AUTH_ROLES"].every(t=>!!localStorage.getItem(t))}static{this.\u0275fac=function(t){return new(t||o)}}static{this.\u0275prov=c({token:o,factory:o.\u0275fac,providedIn:"root"})}}return o})();export{h as a};
1
+ import{a as i,b as T}from"./chunk-IEOE2XJ7.js";import{d as s}from"./chunk-7NZRUZLK.js";import{a as l}from"./chunk-WDFE7CAE.js";import{c as m}from"./chunk-T7VWZPHW.js";import{V as a,_ as c,da as r}from"./chunk-T6YHDD6J.js";var h=(()=>{class o{constructor(){this.httpService=r(l),this.router=r(s),this.intercomService=r(m),this.tokenService=r(T),this.autoLogout()}login(e){return this.httpService.post("","api/Authentication/login",e).pipe(a(t=>{let n=e.SubDomain;localStorage.setItem("AUTH_TOKEN",t.access_token),localStorage.setItem("AUTH_POS_TOKEN",t.pos.access_token),localStorage.setItem("AUTH_TOKEN_TYPE",t.token_type),localStorage.setItem("AUTH_EXPIRES_AT",t.expiredAt),localStorage.setItem("AUTH_DOMAIN",n.substring(n.indexOf("."))),localStorage.setItem("AUTH_SUB_DOMAIN",e.SubDomain.split(".")[0]),localStorage.setItem("AUTH_USERNAME",e.Username),this.storeIntercom(t),this.storeTenantId(t.pos.access_token),this.storeRoles(t.access_token),this.tokenService.setToken(t.access_token),this.autoLogout()}))}storeIntercom(e){let t=e.intercomWidget?JSON.stringify(e.intercomWidget):null;t&&localStorage.setItem("INTERCOM",t)}isAuthenticated(){return!!localStorage.getItem("AUTH_TOKEN")}getToken(){return localStorage.getItem("AUTH_TOKEN")}getTokenType(){return localStorage.getItem("AUTH_TOKEN_TYPE")}isTokenExpired(){let e=localStorage.getItem("AUTH_EXPIRES_AT");return e?new Date(e).getTime()<Date.now():!0}autoLogout(){clearTimeout(this.logoutTimer);let e=localStorage.getItem("AUTH_EXPIRES_AT");if(!e)return;let t=new Date(e).getTime()-Date.now();t>0?this.logoutTimer=setTimeout(()=>this.logout(),t):this.logout()}getTenantExternalURL(){let e=localStorage.getItem("AUTH_SUB_DOMAIN")||"",t=localStorage.getItem("AUTH_DOMAIN")||"";return e&&t?`https://${e}${t}`:""}getTanantToken(){return localStorage.getItem("AUTH_POS_TOKEN")}logout(){this.intercomService.shutdown(),localStorage.removeItem("AUTH_TOKEN"),localStorage.removeItem("AUTH_TOKEN_TYPE"),localStorage.removeItem("AUTH_EXPIRES_AT"),localStorage.removeItem("INTERCOM"),clearTimeout(this.logoutTimer),this.router.navigate([""])}getFullDomain(){let e=localStorage.getItem("AUTH_SUB_DOMAIN"),t=localStorage.getItem("AUTH_DOMAIN");return!e||!t?(console.error("Subdomain or domain is missing in local storage."),null):`${e}${t}`}storeTenantId(e){let t=i(e);console.log("Decoded Token:",t),t&&(localStorage.setItem("AC_TENANT_BRAND",t.Brand),localStorage.setItem("AC_TENANT_LID",t.LID))}storeRoles(e){let t=i(e);console.log("Decoded Token:",t),t&&localStorage.setItem("AUTH_ROLES",JSON.stringify(t["http://schemas.microsoft.com/ws/2008/06/identity/claims/role"]))}checkAuthKeysExists(){return["AC_TENANT_BRAND","AC_TENANT_LID","AUTH_DOMAIN","AUTH_EXPIRES_AT","AUTH_POS_TOKEN","AUTH_SUB_DOMAIN","AUTH_TOKEN","AUTH_TOKEN_TYPE","AUTH_USERNAME","AUTH_ROLES"].every(t=>!!localStorage.getItem(t))}static{this.\u0275fac=function(t){return new(t||o)}}static{this.\u0275prov=c({token:o,factory:o.\u0275fac,providedIn:"root"})}}return o})();export{h as a};
@@ -1 +1 @@
1
- import{a as S,b as w,c as E,d as I,e as k,f as j}from"./chunk-AP2QQRNJ.js";import"./chunk-BA72IEO2.js";import{a as T}from"./chunk-TTIQSVQF.js";import{b as C}from"./chunk-2LI4CEOF.js";import"./chunk-RUYPEXNQ.js";import"./chunk-4D6KKSM5.js";import{h as M}from"./chunk-5FVLV36I.js";import"./chunk-MTPMCC6U.js";import{a as P}from"./chunk-RO474VQ2.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import"./chunk-3BPX4XM7.js";import"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import"./chunk-OQDKL2MG.js";import{a as _}from"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-WNU7SPEQ.js";import"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{Ab as v,Ob as m,Qb as c,Rb as s,Tb as o,Ub as r,V as f,Wc as y,_ as d,da as l,db as n,gc as g,ub as b,vc as p,wa as u,wc as h,xc as x}from"./chunk-T6YHDD6J.js";import"./chunk-PRARYYF3.js";var F=(()=>{class e{constructor(){this.httpService=l(_)}getUserProfile(){return this.httpService.get(void 0,"api/MyProfile")}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();function N(e,a){if(e&1&&(o(0,"div",10)(1,"div",11)(2,"p",12),p(3),r()()()),e&2){let t=a.$implicit;n(3),x(" ",t.roleName," ")}}function O(e,a){if(e&1&&(o(0,"div",4)(1,"div",5)(2,"div",6)(3,"span",7),p(4),r()()(),o(5,"div",8)(6,"div",9),c(7,N,4,1,"div",10,m),r()()()),e&2){let t=a.$implicit;n(4),h(t.roleGroupName),n(3),s(t.listRole)}}function U(e,a){if(e&1&&(o(0,"p-panel")(1,"p-tabs",2)(2,"p-tablist")(3,"p-tab",2),p(4,"Roles"),r()(),o(5,"p-tabpanels")(6,"p-tabpanel",2)(7,"div",3),c(8,O,9,1,"div",4,m),r()()()()()),e&2){let t,i=g();n(8),s((t=i.roles())==null?null:t.Roles)}}var R=(()=>{class e{constructor(){this.profileService=l(F),this.roles=u(null)}ngOnInit(){this.profileService.getUserProfile().pipe(T("response"),f(t=>this.roles.set(t))).subscribe()}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=b({type:e,selectors:[["app-my-profile"]],decls:3,vars:0,consts:[["content",""],["pageTitle","My Profile"],["value","0"],["formArrayName","roles",1,"container-fluid","d-flex","flex-column","row-gap-3"],[1,"row"],[1,"col-2","border","d-flex","align-items-center","justify-content-between",2,"height","50px","background","#f6f6f6"],[1,"d-flex","justify-content-center","w-100"],[1,"text-dark","fw-semibold","fs-2"],[1,"col"],["formArrayName","roles",1,"row","h-100"],[1,"col-3","border-top","border-bottom","border-end","p-0","bg-white"],[1,"d-flex","h-100","align-items-center","gap-2","px-2"],[1,"fs-2","text-dark","m-0"]],template:function(i,A){i&1&&(o(0,"app-main-panel",1),v(1,U,10,0,"ng-template",null,0,y),r())},dependencies:[M,P,j,S,k,I,w,E,C],styles:["[_nghost-%COMP%]{display:block} .p-tabs .p-tab{padding-top:0!important}"],changeDetection:0})}}return e})();var ie=[{path:"",redirectTo:"my-profile",pathMatch:"full"},{path:"",children:[{path:"my-profile",component:R}]}];export{ie as PROFILE_ROUTES};
1
+ import{a as S,b as w,c as E,d as I,e as k,f as j}from"./chunk-AP2QQRNJ.js";import"./chunk-BA72IEO2.js";import{a as T}from"./chunk-TTIQSVQF.js";import{b as C}from"./chunk-2LI4CEOF.js";import"./chunk-RUYPEXNQ.js";import"./chunk-4D6KKSM5.js";import{h as M}from"./chunk-URW7SXYE.js";import"./chunk-MTPMCC6U.js";import{a as P}from"./chunk-RO474VQ2.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import"./chunk-3BPX4XM7.js";import"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import"./chunk-OQDKL2MG.js";import{a as _}from"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-T7VWZPHW.js";import"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{Ab as v,Ob as m,Qb as c,Rb as s,Tb as o,Ub as r,V as f,Wc as y,_ as d,da as l,db as n,gc as g,ub as b,vc as p,wa as u,wc as h,xc as x}from"./chunk-T6YHDD6J.js";import"./chunk-PRARYYF3.js";var F=(()=>{class e{constructor(){this.httpService=l(_)}getUserProfile(){return this.httpService.get(void 0,"api/MyProfile")}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();function N(e,a){if(e&1&&(o(0,"div",10)(1,"div",11)(2,"p",12),p(3),r()()()),e&2){let t=a.$implicit;n(3),x(" ",t.roleName," ")}}function O(e,a){if(e&1&&(o(0,"div",4)(1,"div",5)(2,"div",6)(3,"span",7),p(4),r()()(),o(5,"div",8)(6,"div",9),c(7,N,4,1,"div",10,m),r()()()),e&2){let t=a.$implicit;n(4),h(t.roleGroupName),n(3),s(t.listRole)}}function U(e,a){if(e&1&&(o(0,"p-panel")(1,"p-tabs",2)(2,"p-tablist")(3,"p-tab",2),p(4,"Roles"),r()(),o(5,"p-tabpanels")(6,"p-tabpanel",2)(7,"div",3),c(8,O,9,1,"div",4,m),r()()()()()),e&2){let t,i=g();n(8),s((t=i.roles())==null?null:t.Roles)}}var R=(()=>{class e{constructor(){this.profileService=l(F),this.roles=u(null)}ngOnInit(){this.profileService.getUserProfile().pipe(T("response"),f(t=>this.roles.set(t))).subscribe()}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=b({type:e,selectors:[["app-my-profile"]],decls:3,vars:0,consts:[["content",""],["pageTitle","My Profile"],["value","0"],["formArrayName","roles",1,"container-fluid","d-flex","flex-column","row-gap-3"],[1,"row"],[1,"col-2","border","d-flex","align-items-center","justify-content-between",2,"height","50px","background","#f6f6f6"],[1,"d-flex","justify-content-center","w-100"],[1,"text-dark","fw-semibold","fs-2"],[1,"col"],["formArrayName","roles",1,"row","h-100"],[1,"col-3","border-top","border-bottom","border-end","p-0","bg-white"],[1,"d-flex","h-100","align-items-center","gap-2","px-2"],[1,"fs-2","text-dark","m-0"]],template:function(i,A){i&1&&(o(0,"app-main-panel",1),v(1,U,10,0,"ng-template",null,0,y),r())},dependencies:[M,P,j,S,k,I,w,E,C],styles:["[_nghost-%COMP%]{display:block} .p-tabs .p-tab{padding-top:0!important}"],changeDetection:0})}}return e})();var ie=[{path:"",redirectTo:"my-profile",pathMatch:"full"},{path:"",children:[{path:"my-profile",component:R}]}];export{ie as PROFILE_ROUTES};
@@ -1 +1 @@
1
- import{a as O,b as J}from"./chunk-3MU7BZQU.js";import"./chunk-XZGQHWLM.js";import"./chunk-OS646RNF.js";import{m as A}from"./chunk-SPDFU2FM.js";import"./chunk-IEOE2XJ7.js";import{a as j,b as R}from"./chunk-OVMM5CPY.js";import"./chunk-KG3OLRKU.js";import{h as z}from"./chunk-5FVLV36I.js";import"./chunk-MTPMCC6U.js";import{a as G,b as H}from"./chunk-RO474VQ2.js";import"./chunk-E4FUCIJZ.js";import"./chunk-3BPX4XM7.js";import{H as D,I as N,J as L,K as q}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import"./chunk-OQDKL2MG.js";import"./chunk-WDFE7CAE.js";import{a as V}from"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-WNU7SPEQ.js";import{o as I,t as E}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{Ab as P,Ic as F,Jc as v,Mb as W,Nb as $,R as T,Sb as l,Sc as s,T as b,Tb as o,Tc as m,Ub as r,V as k,Vb as f,Wc as x,ac as _,da as c,db as n,f as y,fc as h,gc as p,ka as g,la as d,ma as M,na as w,s as u,tc as C,ub as B}from"./chunk-T6YHDD6J.js";import"./chunk-PRARYYF3.js";var K=()=>({height:"calc(100vh - 100px)"});function Q(t,S){if(t&1){let e=_();o(0,"p-button",6),h("onClick",function(){g(e);let a=p(2);return d(a.onFormat())}),r()}}function U(t,S){if(t&1){let e=_();o(0,"div",3),W(1,Q,1,0,"p-button",4),o(2,"p-button",5),s(3,"async"),s(4,"async"),h("onClick",function(){g(e);let a=p();return d(a.migrateWriteoffOutlet())}),r()()}if(t&2){let e=p();n(),$(e.roleService.permissions().migrate.delete?1:-1),n(),l("disabled",m(3,3,e.countInBooks$)!==0)("pTooltip",m(4,5,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function X(t,S){if(t&1&&(o(0,"p-scroll-panel")(1,"p-panel")(2,"div",7),f(3,"app-migration-cards",8),s(4,"async"),M(),o(5,"svg",9),f(6,"path",10),r(),w(),f(7,"app-migration-cards",11),s(8,"async"),r()()()),t&2){let e=p();C(v(12,K)),n(),C(v(13,K)),n(2),l("migrationCount",m(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),n(4),l("migrationCount",m(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var he=(()=>{class t{constructor(){this.migrateService=c(O),this.toastr=c(V),this.refresh$=new y(void 0),this.pageTitle="Write-Off Outlet",this.roleService=c(A)}ngOnInit(){let e=this.refresh$.pipe(b(()=>this.migrateService.getWriteOffOutletAccountCount()),k(i=>console.log("API response:",i)),T(1));this.countInPOS$=e.pipe(u(i=>Number(i.pos))),this.countInBooks$=e.pipe(u(i=>Number(i.books)))}migrateWriteoffOutlet(){this.migrateService.migrateWriteOffOutlet().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormat(){confirm("Are you sure you want to format?")&&this.migrateService.formatWriteOff().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Format Successful")})}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=B({type:t,selectors:[["app-writeoff-outlet"]],features:[F([O])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger"],["label","Migrate","tooltipPosition","left",3,"onClick","disabled","pTooltip"],["label","Format","severity","danger",3,"onClick"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(i,a){i&1&&(o(0,"app-main-panel",2),P(1,U,5,7,"ng-template",null,0,x)(3,X,9,14,"ng-template",null,1,x),r()),i&2&&l("pageTitle",a.pageTitle)},dependencies:[z,E,R,j,H,G,q,L,J,N,D,I],encapsulation:2})}}return t})();export{he as WriteOffOutletComponent};
1
+ import{a as O,b as J}from"./chunk-OSGJ7FIK.js";import"./chunk-K32QD3HY.js";import"./chunk-OS646RNF.js";import{m as A}from"./chunk-SPDFU2FM.js";import"./chunk-IEOE2XJ7.js";import{a as j,b as R}from"./chunk-OVMM5CPY.js";import"./chunk-KG3OLRKU.js";import{h as z}from"./chunk-URW7SXYE.js";import"./chunk-MTPMCC6U.js";import{a as G,b as H}from"./chunk-RO474VQ2.js";import"./chunk-E4FUCIJZ.js";import"./chunk-3BPX4XM7.js";import{H as D,I as N,J as L,K as q}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import"./chunk-OQDKL2MG.js";import"./chunk-WDFE7CAE.js";import{a as V}from"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-T7VWZPHW.js";import{o as I,t as E}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{Ab as P,Ic as F,Jc as v,Mb as W,Nb as $,R as T,Sb as l,Sc as s,T as b,Tb as o,Tc as m,Ub as r,V as k,Vb as f,Wc as x,ac as _,da as c,db as n,f as y,fc as h,gc as p,ka as g,la as d,ma as M,na as w,s as u,tc as C,ub as B}from"./chunk-T6YHDD6J.js";import"./chunk-PRARYYF3.js";var K=()=>({height:"calc(100vh - 100px)"});function Q(t,S){if(t&1){let e=_();o(0,"p-button",6),h("onClick",function(){g(e);let a=p(2);return d(a.onFormat())}),r()}}function U(t,S){if(t&1){let e=_();o(0,"div",3),W(1,Q,1,0,"p-button",4),o(2,"p-button",5),s(3,"async"),s(4,"async"),h("onClick",function(){g(e);let a=p();return d(a.migrateWriteoffOutlet())}),r()()}if(t&2){let e=p();n(),$(e.roleService.permissions().migrate.delete?1:-1),n(),l("disabled",m(3,3,e.countInBooks$)!==0)("pTooltip",m(4,5,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function X(t,S){if(t&1&&(o(0,"p-scroll-panel")(1,"p-panel")(2,"div",7),f(3,"app-migration-cards",8),s(4,"async"),M(),o(5,"svg",9),f(6,"path",10),r(),w(),f(7,"app-migration-cards",11),s(8,"async"),r()()()),t&2){let e=p();C(v(12,K)),n(),C(v(13,K)),n(2),l("migrationCount",m(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),n(4),l("migrationCount",m(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var he=(()=>{class t{constructor(){this.migrateService=c(O),this.toastr=c(V),this.refresh$=new y(void 0),this.pageTitle="Write-Off Outlet",this.roleService=c(A)}ngOnInit(){let e=this.refresh$.pipe(b(()=>this.migrateService.getWriteOffOutletAccountCount()),k(i=>console.log("API response:",i)),T(1));this.countInPOS$=e.pipe(u(i=>Number(i.pos))),this.countInBooks$=e.pipe(u(i=>Number(i.books)))}migrateWriteoffOutlet(){this.migrateService.migrateWriteOffOutlet().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormat(){confirm("Are you sure you want to format?")&&this.migrateService.formatWriteOff().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Format Successful")})}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=B({type:t,selectors:[["app-writeoff-outlet"]],features:[F([O])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger"],["label","Migrate","tooltipPosition","left",3,"onClick","disabled","pTooltip"],["label","Format","severity","danger",3,"onClick"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(i,a){i&1&&(o(0,"app-main-panel",2),P(1,U,5,7,"ng-template",null,0,x)(3,X,9,14,"ng-template",null,1,x),r()),i&2&&l("pageTitle",a.pageTitle)},dependencies:[z,E,R,j,H,G,q,L,J,N,D,I],encapsulation:2})}}return t})();export{he as WriteOffOutletComponent};
@@ -1,4 +1,4 @@
1
- import{a as ct}from"./chunk-6NXDL5QO.js";import{a as ke,b as Be}from"./chunk-XTTKUB6Z.js";import{a as we}from"./chunk-SGZKLLJ3.js";import{a as ue}from"./chunk-XZGQHWLM.js";import{a as $t}from"./chunk-OS646RNF.js";import{b as pt}from"./chunk-G7M65KLU.js";import{b as Yt,c as mt,d as st}from"./chunk-ERHRLVEN.js";import{a as _e,b as ge}from"./chunk-7UYG2IJ5.js";import"./chunk-7R4NAOW3.js";import"./chunk-5TAKHYWV.js";import{m as J}from"./chunk-SPDFU2FM.js";import"./chunk-IEOE2XJ7.js";import{a as Ve,b as Le}from"./chunk-YKC7ERDO.js";import{b as ce,i as de}from"./chunk-5NZPHAOL.js";import{a as rt,b as at}from"./chunk-Y54QBXKN.js";import{a as me,b as se}from"./chunk-X2F5ZNTW.js";import"./chunk-ZULPRZ24.js";import"./chunk-BA72IEO2.js";import{a as lt}from"./chunk-VWBZGFWI.js";import{a as Ge}from"./chunk-TTIQSVQF.js";import{b as Me}from"./chunk-OVMM5CPY.js";import"./chunk-UEJR6B7A.js";import"./chunk-YYMD4TUO.js";import{b as Ut,c as Ne}from"./chunk-R46SVYN4.js";import"./chunk-2LI4CEOF.js";import{d as Xe}from"./chunk-RAFKRDM2.js";import"./chunk-RUYPEXNQ.js";import{b as pe}from"./chunk-KG3OLRKU.js";import"./chunk-4D6KKSM5.js";import"./chunk-BEEH5PAA.js";import{d as nt,e as ot,h as le}from"./chunk-5FVLV36I.js";import"./chunk-MTPMCC6U.js";import{a as Je,b as ae}from"./chunk-RO474VQ2.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import{b as z,c as Qe,d as Ze,e as et,f as tt,g as it}from"./chunk-3BPX4XM7.js";import{H as oe,I as re,J as Wt,K as Kt,y as Ht,z as Ye}from"./chunk-U2ZZPRP6.js";import{b as Re}from"./chunk-7C7GSAC3.js";import{b as jt,c as zt,e as Q,f as Z,g as qt,i as ut,k as ee,p as te,q as ie,v as Fe,y as ne}from"./chunk-OQDKL2MG.js";import{b as Ue,e as Y,l as X}from"./chunk-7NZRUZLK.js";import{a as Ot}from"./chunk-WDFE7CAE.js";import{a as $e}from"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import{a as Te}from"./chunk-WNU7SPEQ.js";import{B as Gt,C as Pt,i as We,l as K,q as Ke,r as U,t as $}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{$a as je,Ab as h,Ac as O,Bc as A,C as Oe,Cc as j,Dc as kt,Ec as dt,Fc as xe,Gc as Bt,Ic as qe,Jc as M,Kc as F,Lc as At,Mb as L,Mc as He,Nb as N,Ob as ve,Qb as ye,R as Mt,Rb as Ee,S as Vt,Sb as s,Sc as S,T as Se,Tb as o,Tc as T,Ub as r,Uc as P,V,Vb as D,Wb as Ie,Wc as u,Xb as De,Zb as H,_ as Lt,_a as q,_b as W,_c as R,ac as w,c as Ce,da as C,db as a,fc as I,gc as c,ka as f,la as x,s as Pe,tc as ze,ub as B,uc as Nt,vc as l,wa as E,wc as b,xc as v,yc as Ae,za as fe}from"./chunk-T6YHDD6J.js";import{a as g,b as y,d as be,g as Ft}from"./chunk-PRARYYF3.js";var G=(()=>{class t{constructor(){this.httpService=C(Ot),this.authService=C(we)}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=g({responseType:"blob"},n);return this.httpService.post(void 0,"/api/GeneralLedgerExport/GetGeneralLedgerExport",e,i)}exportMultiLedger(e,n={}){let i=g({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 Pt({fromObject:Object.fromEntries(Object.entries(e).map(([_,k])=>[_,String(k)]))}),p=new Gt({"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"}),d=g({params:i,headers:p},n);return this.httpService.get(void 0,"/api/BalanceSheet",d)}getIncomeStatementLoader(){return this.httpService.get(void 0,"api/IncomeStatementLoader/Filter")}getIncomeStatement(e,n={}){return this.httpService.post(void 0,"api/IncomeStatement/List",g({},e),n)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=Lt({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var mi=()=>({width:"30vw"}),si=()=>({"1199px":"75vw","575px":"90vw"}),ci=t=>({"ng-dirty ng-invalid":t}),di=t=>["/pages/journal/journal-entry/",t],ui=t=>({"text-success":t}),_i=t=>({"text-danger":t});function gi(t,m){if(t&1&&(o(0,"div",33)(1,"div",34)(2,"span",35),l(3),r()(),o(4,"div")(5,"span"),l(6,"-"),r()(),o(7,"div",34)(8,"span",36),l(9),r()()()),t&2){let e=m.$implicit;a(3),v("(",e.code,")"),a(6),b(e.name)}}function fi(t,m){if(t&1&&(o(0,"div",33)(1,"div",34)(2,"span",35),l(3),r()(),o(4,"div")(5,"span"),l(6,"-"),r()(),o(7,"div",34)(8,"span",36),l(9),r()()()),t&2){let e=m.$implicit;a(3),v("(",e.code,")"),a(6),b(e.name)}}function xi(t,m){t&1&&(o(0,"div",37),l(1," Account is required. "),r())}function hi(t,m){if(t&1&&(o(0,"div",38)(1,"div"),l(2),r()()),t&2){let e=m.$implicit;a(2),b(e.value)}}function bi(t,m){if(t&1&&(o(0,"div",25)(1,"div",26),D(2,"p-radiobutton",39),o(3,"label",40),l(4),r()()()),t&2){let e=m.$implicit;a(2),s("inputId",e.key)("value",e.key),a(),s("for",e.key),a(),b(e.value)}}function Ci(t,m){if(t&1){let e=w();o(0,"div",15)(1,"label",16),l(2,"Customer"),r(),o(3,"p-autocomplete",41),I("completeMethod",function(i){f(e);let p=c(3);return x(p.searchCustomer(i))}),r()()}if(t&2){let e=c(3);a(3),s("suggestions",e.customerSuggestions())}}function Si(t,m){if(t&1){let e=w();o(0,"div",15)(1,"label",16),l(2,"Supplier"),r(),o(3,"p-autocomplete",42),I("completeMethod",function(i){f(e);let p=c(3);return x(p.searchSupplier(i))}),r()()}if(t&2){let e=c(3);a(3),s("suggestions",e.supplierSuggestions())}}function vi(t,m){if(t&1){let e=w();o(0,"div",15)(1,"label",16),l(2,"Customer"),r(),o(3,"p-autocomplete",41),I("completeMethod",function(i){f(e);let p=c(3);return x(p.searchCustomer(i))}),r()()}if(t&2){let e=c(3);a(3),s("suggestions",e.customerSuggestions())}}function yi(t,m){if(t&1&&(o(0,"div")(1,"div",26),D(2,"p-radiobutton",43),o(3,"label",40),l(4),r()()()),t&2){let e=m.$implicit;Nt(e.key===0?"col-4":"col-6"),a(2),s("value",e.key)("inputId",e.value),a(),s("for",e.value),a(),b(e.value)}}function Ei(t,m){if(t&1&&(o(0,"form",14)(1,"div",15)(2,"label",16),l(3,"Accounts"),r(),o(4,"p-select",17),h(5,gi,10,2,"ng-template",null,5,u)(7,fi,10,2,"ng-template",null,6,u),r(),h(9,xi,2,0,"div",18),r(),o(10,"div",15)(11,"label",16),l(12,"From"),r(),o(13,"div",19),D(14,"p-datepicker",20)(15,"p-datepicker",21),r()(),o(16,"div",15)(17,"label",16),l(18,"Tag"),r(),o(19,"p-multiselect",22),h(20,hi,3,1,"ng-template",null,6,u),r()(),o(22,"div",15)(23,"label",23),l(24,"Contact Type"),r(),o(25,"div",24),ye(26,bi,5,4,"div",25,ve),r()(),L(28,Ci,4,1,"div",15)(29,Si,4,1,"div",15)(30,vi,4,1,"div",15),o(31,"div",15)(32,"label",23),l(33,"Sort order"),r(),o(34,"div",24)(35,"div",25)(36,"div",26),D(37,"p-radiobutton",27),o(38,"label",28),l(39,"Asc"),r()()(),o(40,"div",29)(41,"div",26),D(42,"p-radiobutton",30),o(43,"label",31),l(44,"Desc"),r()()()()(),o(45,"div",15)(46,"label",23),l(47,"Order By"),r(),o(48,"div",24),ye(49,yi,5,6,"div",32,ve),r()()()),t&2){let e,n,i,p=c(2);s("formGroup",p.form),a(4),s("ngClass",F(14,ci,((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))))("options",p.loaderMetadata().options.accounts)("virtualScrollItemSize",50)("virtualScroll",!0),a(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))),a(5),s("showIcon",!0),a(),s("showIcon",!0),a(4),s("options",p.loaderMetadata().options.outlets)("virtualScrollItemSize",50)("virtualScroll",!0),a(7),Ee(p.loaderMetadata().options.contactTypeOptions),a(2),N((i=p.form.controls.contactType.value)===1?28:i===2?29:30),a(9),s("value",!0),a(5),s("value",!1),a(7),Ee(p.loaderMetadata().options.orderBy)}}function Ii(t,m){if(t&1&&h(0,Ei,51,16,"form",13),t&2){let e=c();s("ngIf",e.loaderMetadata())}}function Di(t,m){if(t&1){let e=w();o(0,"p-button",45),I("onClick",function(){f(e);let i=c(2);return x(i.onToggleExportDialog())}),r()}}function Ti(t,m){if(t&1&&(o(0,"div",33),h(1,Di,1,0,"p-button",44),r()),t&2){let e=c();a(),s("ngIf",e.roleService.permissions().global.export)}}function wi(t,m){t&1&&(o(0,"tr")(1,"th",52),l(2,"Number"),r(),o(3,"th",53),l(4,"Date"),r(),o(5,"th"),l(6,"Contact / Note"),r(),o(7,"th",54),l(8,"Debit"),r(),o(9,"th",54),l(10,"Credit"),r(),o(11,"th",55),l(12,"Balance"),r()())}function Ri(t,m){if(t&1&&(o(0,"div")(1,"span",63),l(2),r()()),t&2){let e=c().$implicit;a(2),v(" ",e.outletName," ")}}function Fi(t,m){if(t&1&&(o(0,"div",15),D(1,"div",64),o(2,"span",65),l(3),r()()),t&2){let e=c().$implicit;a(),s("innerHTML",e.journalNote,q),a(2),v("",e.note," ")}}function Mi(t,m){if(t&1&&(o(0,"div",15),D(1,"span",64)(2,"div",64),o(3,"span",66),l(4),r()()),t&2){let e=c().$implicit;a(),s("innerHTML",e.referenceText,q),a(),s("innerHTML",e.journalNote,q),a(2),v("",e.note," ")}}function Vi(t,m){if(t&1&&(H(0),l(1),S(2,"number"),W()),t&2){let e=c().$implicit;a(),v(" ",P(2,1,e.debitAmount,"1.0-2")," ")}}function Li(t,m){if(t&1&&(H(0),l(1),S(2,"number"),W()),t&2){let e=c().$implicit;a(),v(" ",P(2,1,e.creditAmount,"1.0-2")," ")}}function Ni(t,m){if(t&1&&(H(0),l(1),S(2,"number"),W()),t&2){let e=c().$implicit;a(),v(" ",P(2,1,e.balance,"1.0-2")," ")}}function ki(t,m){if(t&1&&(o(0,"tr")(1,"td",56)(2,"a",57),l(3),r(),o(4,"span"),l(5),r(),h(6,Ri,3,1,"div",58),r(),o(7,"td",56)(8,"span",59),S(9,"date"),l(10),S(11,"date"),r()(),o(12,"td",56)(13,"div",15)(14,"a",60),l(15),r(),L(16,Fi,4,2,"div",15)(17,Mi,5,3,"div",15),r()(),o(18,"td",61),h(19,Vi,3,4,"ng-container",58),r(),o(20,"td",61),h(21,Li,3,4,"ng-container",58),r(),o(22,"td",62),h(23,Ni,3,4,"ng-container",58),r()()),t&2){let e=m.$implicit,n=c(3);a(2),s("routerLink",F(20,di,e.id)),a(),v(" ",e.number," "),a(2),v(" ",n.getReferenceText(e.referenceText)," "),a(),s("ngIf",e.outletName==null?null:e.outletName.trim()),a(2),s("pTooltip",P(9,14,e.date,"dd MMM y")),a(2),v(" ",P(11,17,e.date,"dd MMM y")," "),a(4),s("href",n.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.contactID,je),a(),b(e.contactName),a(),N(n.buildReferenceUrl(e)?16:17),a(2),s("ngClass",F(22,ui,e.debitAmount!==0)),a(),s("ngIf",e.debitAmount!==0),a(),s("ngClass",F(24,_i,e.creditAmount!==0)),a(),s("ngIf",e.creditAmount!==0),a(2),s("ngIf",e.balance!==0)}}function Bi(t,m){if(t&1&&(o(0,"tr"),D(1,"td",67),o(2,"td",68),l(3,"Total"),r(),o(4,"td",69),l(5),S(6,"number"),r(),o(7,"td",70),l(8),S(9,"number"),r(),D(10,"td"),r()),t&2){let e=c(3);a(5),v(" ",T(6,2,e.debitSubTotal())," "),a(3),v(" ",T(9,4,e.creditSubTotal())," ")}}function Ai(t,m){t&1&&(o(0,"tr")(1,"td",71)(2,"span"),l(3,"No records found."),r()()())}function Gi(t,m){if(t&1){let e=w();o(0,"button",72),I("click",function(){f(e);let i=c(3);return x(i.getGLCount())})("keyup.enter",function(){f(e);let i=c(3);return x(i.getGLCount())}),r()}}function Pi(t,m){if(t&1&&l(0),t&2){let e=c(3);v(" ",e.count()," ")}}function Oi(t,m){if(t&1){let e=w();o(0,"p-button",73),I("onClick",function(){f(e);let i=c(3);return x(i.onNextPage())}),r()}}function ji(t,m){if(t&1&&(o(0,"div",47)(1,"p-table",48),h(2,wi,13,0,"ng-template",null,7,u)(4,ki,24,26,"ng-template",null,8,u)(6,Bi,11,6,"ng-template",null,4,u)(8,Ai,4,0,"ng-template",null,9,u),r(),o(10,"div",49)(11,"div"),l(12),L(13,Gi,1,0,"button",50)(14,Pi,1,1),l(15," entries "),r(),o(16,"div",33),L(17,Oi,1,0,"p-button",51),r()()()),t&2){let e=c(2);a(),s("value",e.items().data.data),a(11),Ae(" Showing ",e.pagination().first," to ",e.pagination().end," of "),a(),N(e.totalRecords()===-1?13:14),a(4),N(e.pagination().hasNext?17:-1)}}function zi(t,m){if(t&1&&h(0,ji,18,5,"div",46),t&2){let e=c();s("ngIf",e.items()&&e.items().data)}}function qi(t,m){if(t&1&&(o(0,"div",74)(1,"div",75),D(2,"div",76),r(),o(3,"div",77)(4,"div",26),D(5,"i",78),o(6,"span",79),l(7),S(8,"number"),S(9,"number"),r()()()()),t&2){let e=c();a(),s("formGroup",e.form),a(6),Ae("Exporting data from ",T(8,3,e.filter().exportPageNumber)," - ",T(9,5,e.filter().exportPageSize))}}function Hi(t,m){if(t&1){let e=w();o(0,"p-button",80),I("onClick",function(){f(e);let i=c();return x(i.onToggleExportDialog())}),r()}t&2&&s("rounded",!0)("text",!0)}function Wi(t,m){if(t&1){let e=w();o(0,"p-button",81),I("click",function(){f(e);let i=c();return x(i.onToggleExportDialog())}),r(),o(1,"p-button",82),I("click",function(){f(e);let i=c();return x(i.onExport())}),r()}}var Jt=(()=>{class t{getGLCount(){this.reportService.getGLCount(this.filter()).pipe(V(({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(G),this.route=C(Ue),this.roleService=C(J),this.authService=C(we),this.fb=C(Fe),this.coaService=C(lt),this.toastr=C($e),this.dayjsService=C(ue),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=Re(this.route.queryParamMap.pipe(Pe(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={},d=e.get("id");return Te.IsNotEmpty(d)&&(p=y(g({},p),{accountID:d})),Te.IsNotEmpty(n)&&Te.IsNotEmpty(i)&&(p=y(g({},p),{from:n,to:i})),p})),{initialValue:null}),this.loaderMetadata=Re(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?g(g({},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(),fe(()=>{let e=this.filter();e&&(Te.IsEmpty(this.form.value.accountID)||this.form.value.accountID!==e.accountID)&&this.form.patchValue(this.transformFilterToFormValue(e),{emitEvent:!1})}),fe(()=>{let e=this.filter(),n=this.form.value.accountID;!e||Te.IsEmpty(n)||this.reportService.fetchGeneralLedgerReport(e).subscribe(i=>{this.lastGetDataLength.set(i.data?.data?.length),this.items.update(p=>e.pageNumber===1?i:y(g({},i),{data:y(g({},i.data),{data:[...p?.data.data??[],...i.data.data]})}))})})}buildReferenceUrl(e){return ct(e)}ngOnInit(){this.route.queryParamMap.pipe(Oe(e=>e.keys.length>0)).subscribe({next:()=>this.initDialogVisible.set(!0)})}initializeForm(){this.form=this.fb.group({accountID:this.fb.control(null,[zt.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),orderBy: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(d=>this.findNodeByKey(this.categoriesOptions(),d)).filter(d=>!!d):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(V(e=>this.categoriesOptions.set(e))).subscribe()}searchCustomer(e){this.reportService.getCustomerSuggestions(e.query).pipe(V(n=>this.customerSuggestions.set(n))).subscribe()}searchSupplier(e){this.reportService.getSupplierSuggestions(e.query).pipe(V(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=be(p,["from","to"]);return y(g({},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,orderBy:i.orderBy})}onExport(){let e=this.buildExportBody();this.performExport(e)}performExport(e){this.reportService.exportGeneralLedger(e,{responseType:"blob",observe:"response"}).pipe(V(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 _=i.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);_?.[1]&&(p=decodeURIComponent(_[1].replace(/"/g,"")))}let d=e.body;st(d,p,d.type)}buildExportBody(){let p=this.form.value,{from:e,to:n}=p,i=be(p,["from","to"]);return y(g({},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 y(g({},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 y(g({},e),{pageNumber:Math.max(1,n-1)})})}goToPage(e){this.localFilter.update(n=>y(g({},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=>y(g({},p),{pageNumber:i}))}getReferenceText(e){return/\d/.test(e)?e:""}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=B({type:t,selectors:[["app-report-general-ledger"]],decls:13,vars:13,consts:[["filters",""],["actionButton",""],["content",""],["closeIconTemplate",""],["footer",""],["selectedItem",""],["item",""],["header",""],["body",""],["emptymessage",""],[3,"filterConfirmed","isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","isDialogFilterVisible","isInitDialogFilterVisible","isFilterable","pageTitle","scrollable"],["header","Export General Ledger",3,"visibleChange","visible","breakpoints","modal"],["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"],["appendTo","body","display","chip","filter","","filterBy","code,name","formControlName","accountID","optionLabel","name","optionValue","id","placeholder","Select Accounts","showClear","",3,"ngClass","options","virtualScrollItemSize","virtualScroll"],["class","text-danger",4,"ngIf"],[1,"d-flex","flex-column","gap-2"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","from","iconDisplay","input","inputId","icondisplay","showClear","","styleClass","w-100",3,"showIcon"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","to","iconDisplay","input","inputId","icondisplay","showClear","","styleClass","w-100",3,"showIcon"],["appendTo","body","display","chip","formControlName","listOutletID","optionLabel","value","optionValue","key","placeholder","Select an Tag","showClear","",3,"options","virtualScrollItemSize","virtualScroll"],["for",""],[1,"row"],[1,"col-4"],[1,"d-flex","align-items-center","gap-2"],["formControlName","sortAscending","inputId","asc","name","sortAscending",3,"value"],["for","asc",1,"m-0"],[1,"col-3"],["formControlName","sortAscending","inputId","desc","name","sortAscending",3,"value"],["for","desc",1,"m-0"],[3,"class"],[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"],["formControlName","contactType","name","contactType",3,"inputId","value"],[1,"m-0",3,"for"],["appendTo","body","formControlName","contactID","inputStyleClass","w-100","optionLabel","Value","optionValue","Key","styleClass","w-100",3,"completeMethod","suggestions"],["appendTo","body","formControlName","ContactID","inputStyleClass","w-100","optionLabel","Value","optionValue","Key","styleClass","w-100",3,"completeMethod","suggestions"],["formControlName","orderBy","name","orderBy",3,"value","inputId"],["icon","fa-solid fa-upload","label","Export","severity","secondary","variant","outlined",3,"onClick",4,"ngIf"],["icon","fa-solid fa-upload","label","Export","severity","secondary","variant","outlined",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"],["aria-label","Get journal entry count","tabindex","0","type","button",1,"fa-solid","fa-circle-question","cursor-pointer","p-0","border-0","bg-transparent"],["icon","fa-solid fa-angle-right","label","next","severity","secondary","size","small","variant","outlined"],[2,"width","200px"],[2,"width","140px"],[1,"text-end",2,"width","120px"],[1,"text-end",2,"width","160px"],[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"],["aria-label","Get journal entry count","tabindex","0","type","button",1,"fa-solid","fa-circle-question","cursor-pointer","p-0","border-0","bg-transparent",3,"click","keyup.enter"],["icon","fa-solid fa-angle-right","label","next","severity","secondary","size","small","variant","outlined",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"],["icon","fa-solid fa-xmark","severity","secondary","variant","outlined",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=w();o(0,"app-main-panel",10),I("filterConfirmed",function(){return f(p),x(i.onFilterOKEvent())}),j("isDialogFilterVisibleChange",function(_){return f(p),A(i.dialogFilterVisible,_)||(i.dialogFilterVisible=_),x(_)})("isInitDialogFilterVisibleChange",function(_){return f(p),A(i.initDialogVisible,_)||(i.initDialogVisible=_),x(_)}),h(1,Ii,1,1,"ng-template",null,0,u)(3,Ti,2,1,"ng-template",null,1,u)(5,zi,1,1,"ng-template",null,2,u),r(),o(7,"p-dialog",11),j("visibleChange",function(_){return f(p),A(i.isDialogExportVisible,_)||(i.isDialogExportVisible=_),x(_)}),h(8,qi,10,7,"div",12)(9,Hi,1,2,"ng-template",null,3,u)(11,Wi,2,0,"ng-template",null,4,u),r()}n&2&&(O("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.initDialogVisible),s("isFilterable",!0)("pageTitle",i.pageTitle)("scrollable",!0),a(7),ze(M(11,mi)),O("visible",i.isDialogExportVisible),s("breakpoints",M(12,si))("modal",!0),a(),s("ngIf",i.form&&i.filter()))},dependencies:[le,$,We,K,pe,de,ce,ot,nt,re,oe,Ne,Ut,se,me,Be,ke,ne,ee,Q,Z,ie,te,ge,_e,Me,Xe,mt,pt,ae,X,Y,at,rt,Kt,Wt,Ye,U,Ke],styles:["[_nghost-%COMP%] .p-datatable .p-datatable-header{padding:.75rem 1rem .75rem 0}"],changeDetection:0})}}return t})();var Ki={data:{},filter:{EntityID:[],CashierID:null,Text:null,from:null,to:null},isLoading:!0,loader:{options:{outlets:[]},filter:{from:"",to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}}},St=Qe(it(Ki),Ze(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}),tt(t=>{let m=C(G),e=C(ue),n={updateFilter(i){z(t,p=>y(g({},p),{filter:g(g({},p.filter),i)}))},getLoader:Ve(Ce(Se(()=>m.getIncomeStatementLoader().pipe(Le({next:i=>{z(t,p=>y(g({},p),{loader:i,filter:y(g({},p.filter),{from:e.format(i.filter.from),to:e.format(i.filter.to)})})),n.getIncomeStatement(t.filter)},error:i=>{console.error(i)}}))))),getIncomeStatement:Ve(Ce(Se(i=>m.getIncomeStatement(i).pipe(Vt(()=>z(t,p=>y(g({},p),{isLoading:!0}))),Le({next:p=>{z(t,d=>y(g({},d),{data:p,isLoading:!1}))},error:p=>{console.error(p)}})))))};return n}),et({onInit:t=>{t.getLoader()}}));var vt=()=>({}),yt=t=>["/pages/chart-of-account/account/",t],Et=(t,m,e)=>({id:t,from:m,to:e}),It=()=>["/pages/report/general-ledger"];function $i(t,m){if(t&1){let e=w();o(0,"p-button",10),I("onClick",function(){f(e);let i=c(2);return x(i.onExport())}),r()}}function Yi(t,m){if(t&1&&(o(0,"div",8),h(1,$i,1,0,"p-button",9),r()),t&2){let e=c();a(),s("ngIf",e.roleService.permissions().global.export)}}function Xi(t,m){t&1&&(o(0,"tr")(1,"th",14),l(2,"Code"),r(),o(3,"th",15),l(4,"Name"),r(),o(5,"th",16),l(6,"Total"),r()())}function Ji(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",17),l(5),r()(),o(6,"td",16)(7,"a",18),l(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=xe(0),i=xe(1);a(2),b(e.code),a(2),s("routerLink",F(8,yt,e.accountID)),a(),b(e.name),a(2),s("queryParams",He(10,Et,e.accountID,n,i))("routerLink",M(14,It)),a(),b(T(9,6,e.amount))}}function Qi(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),l(4,"Total Revenue :"),r(),o(5,"span",22),l(6),S(7,"number"),r()()()()),t&2){let e=c(3);a(6),b(T(7,1,e.store.totalRevenue()))}}function Zi(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No revenue records available"),r()()())}function en(t,m){if(t&1&&(o(0,"h6",12),l(1,"Revenue"),r(),o(2,"p-table",13),h(3,Xi,7,0,"ng-template",null,3,u)(5,Ji,10,15,"ng-template",null,4,u)(7,Qi,8,3,"ng-template",null,5,u)(9,Zi,4,0,"ng-template",null,6,u),r()),t&2){let e,n=c(2);a(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.revenue)}}function tn(t,m){t&1&&(o(0,"tr")(1,"th",14),l(2,"Code"),r(),o(3,"th",15),l(4,"Name"),r(),o(5,"th",24),l(6,"Total"),r()())}function nn(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",17),l(5),r()(),o(6,"td",16)(7,"a",18),l(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=xe(0),i=xe(1);a(2),b(e.code),a(2),s("routerLink",F(8,yt,e.accountID)),a(),b(e.name),a(2),s("queryParams",He(10,Et,e.accountID,n,i))("routerLink",M(14,It)),a(),b(T(9,6,e.amount))}}function on(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),l(4,"Total COGS :"),r(),o(5,"span",22),l(6),S(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),l(12,"Gross Profit :"),r(),o(13,"span",22),l(14),S(15,"number"),r()()()()),t&2){let e=c(3);a(6),b(T(7,2,e.store.totalCOGS())),a(8),b(T(15,4,e.store.grossProfit()))}}function rn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No COGS records available"),r()()())}function an(t,m){if(t&1&&(o(0,"h4",12),l(1,"COGS"),r(),o(2,"p-table",13),h(3,tn,7,0,"ng-template",null,3,u)(5,nn,10,15,"ng-template",null,4,u)(7,on,16,6,"ng-template",null,5,u)(9,rn,4,0,"ng-template",null,6,u),r()),t&2){let e,n=c(2);a(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.cogs)}}function ln(t,m){t&1&&(o(0,"tr")(1,"th",14),l(2,"Code"),r(),o(3,"th",15),l(4,"Name"),r(),o(5,"th",16),l(6,"Total"),r()())}function pn(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",17),l(5),r()(),o(6,"td",16)(7,"a",18),l(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=xe(0),i=xe(1);a(2),b(e.code),a(2),s("routerLink",F(8,yt,e.accountID)),a(),b(e.name),a(2),s("queryParams",He(10,Et,e.accountID,n,i))("routerLink",M(14,It)),a(),b(T(9,6,e.amount))}}function mn(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),l(4,"Total Expense :"),r(),o(5,"span",22),l(6),S(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),l(12,"Profit / Loss :"),r(),o(13,"span",22),l(14),S(15,"number"),r()()()()),t&2){let e=c(3);a(6),b(T(7,2,e.store.totalExpense())),a(8),b(T(15,4,e.store.profitOrLoss()))}}function sn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No expense records available"),r()()())}function cn(t,m){if(t&1&&(o(0,"h4",12),l(1,"Expense"),r(),o(2,"p-table",13),h(3,ln,7,0,"ng-template",null,3,u)(5,pn,10,15,"ng-template",null,4,u)(7,mn,16,6,"ng-template",null,5,u)(9,sn,4,0,"ng-template",null,6,u),r()),t&2){let e,n=c(2);a(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.expense)}}function dn(t,m){if(t&1&&(kt(0)(1),o(2,"p-panel")(3,"div",11),L(4,en,11,1),L(5,an,11,1),L(6,cn,11,1),r()()),t&2){let e,n,i,p,d=c();dt((e=d.store.filter())!=null&&e.from?d.store.filter().from:null),a(),dt((n=d.store.filter())!=null&&n.to?d.store.filter().to:null),a(3),N(d.Object.keys(d.store.data().data??M(5,vt)).length>0?4:-1),a(),N(d.Object.keys(((i=d.store.data().data)==null?null:i.cogs)??M(6,vt)).length>0?5:-1),a(),N(d.Object.keys(((p=d.store.data().data)==null?null:p.expense)??M(7,vt)).length>0?6:-1)}}function un(t,m){if(t&1){let e=w();o(0,"form",25)(1,"div",26)(2,"label",27),l(3,"Tag"),r(),D(4,"p-multiselect",28),r(),o(5,"div",26)(6,"label",27),l(7,"Cashier"),r(),o(8,"p-autocomplete",29),I("completeMethod",function(i){f(e);let p=c();return x(p.onCashierSearch(i))})("onSelect",function(i){f(e);let p=c();return x(p.onCashierSelect(i))}),r()(),o(9,"div",26)(10,"label",30),l(11,"From - To"),r(),o(12,"div",31),D(13,"p-datepicker",32)(14,"p-datepicker",33),r()()()}if(t&2){let e=c();s("formGroup",e.formFilter),a(4),s("options",e.store.loader().options.outlets)("showClear",!0)("virtualScrollItemSize",50)("virtualScroll",!0),a(4),s("showClear",!0)("showClear",!0)("suggestions",e.cashierSuggestions()),a(5),s("iconDisplay","input")("showIcon",!0),a(),s("iconDisplay","input")("showIcon",!0)}}var Qt=(()=>{class t{constructor(){this.dayjsService=C(ue),this.store=C(St),this.fb=C(Fe),this.reportService=C(G),this.roleService=C(J),this.isInitDialogFilterVisible=E(!1),this.dialogFilterVisible=E(!1),this.cashierSuggestions=E([]),this.cashierHashMap=new Map,this.Object=Object,fe(()=>{this.store.filter()&&this.initForm()})}ngOnInit(){this.initForm()}onSearch(e){this.store.updateFilter(y(g({},this.store.filter()),{Text:e}))}onCashierSearch(e){this.reportService.getCashierSuggestions(e.query).pipe(Ge("Cashier Suggestions"),V(n=>this.cashierSuggestions.set(n))).subscribe()}initForm(){let e=this.store.filter();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,d])=>(p==="from"||p==="to"?d instanceof Date&&(i[p]=this.dayjsService.format(d)):i[p]=d||null,i),{});this.store.updateFilter(g(g({},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=y(g({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.reportService.getIncomeStatement(e,{responseType:"blob"}).pipe(Ge("Export Profit & Loss"),V(n=>{let i=n.type,p=[n],d=document.createElement("a");d.href=window.URL.createObjectURL(new Blob(p,{type:i}));let _=`profit-and-loss.${i.split("/")[1]}`;d.setAttribute("download",_),document.body.appendChild(d),d.click(),document.body.removeChild(d)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=B({type:t,selectors:[["app-report-income-statement"]],features:[qe([St])],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],[3,"filterConfirmed","isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","isDialogFilterVisible","isInitDialogFilterVisible","isFilterable","pageTitle","scrollable"],[1,"d-flex","gap-2"],["icon","fa-solid fa-upload","label","Export","severity","secondary","variant","outlined",3,"onClick",4,"ngIf"],["icon","fa-solid fa-upload","label","Export","severity","secondary","variant","outlined",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,"queryParams","routerLink"],["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",""],["appendTo","body","display","chip","filterBy","value","formControlName","EntityID","optionLabel","value","optionValue","key","placeholder","Select an Tag",3,"options","showClear","virtualScrollItemSize","virtualScroll"],["appendTo","body","field","Value","formControlName","CashierID","inputStyleClass","w-100","optionLabel","Value","optionValue","Key","placeholder","Search a cashier","styleClass","w-100",3,"completeMethod","onSelect","showClear","suggestions"],["for","outlet"],[1,"d-flex","flex-column","gap-2"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","from","inputId","icondisplay","styleClass","w-100 mb-0",3,"iconDisplay","showIcon"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","to","inputId","icondisplay","styleClass","w-100",3,"iconDisplay","showIcon"]],template:function(n,i){if(n&1){let p=w();o(0,"app-main-panel",7),I("filterConfirmed",function(){return f(p),x(i.onFilterOK())}),j("isDialogFilterVisibleChange",function(_){return f(p),A(i.dialogFilterVisible,_)||(i.dialogFilterVisible=_),x(_)})("isInitDialogFilterVisibleChange",function(_){return f(p),A(i.isInitDialogFilterVisible,_)||(i.isInitDialogFilterVisible=_),x(_)}),h(1,Yi,2,1,"ng-template",null,0,u)(3,dn,7,8,"ng-template",null,1,u)(5,un,15,12,"ng-template",null,2,u),r()}n&2&&(O("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("isFilterable",!0)("pageTitle",i.store.data().pageTitle)("scrollable",!0))},dependencies:[le,$,K,Ne,se,me,ne,ee,Q,Z,ie,te,ge,_e,pe,de,ce,ae,Je,X,Y,Be,ke,re,oe,U],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Dt=Ft($t());var _n={metadata:{options:{outlets:[]},filter:{to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}},data:{asset:[],liability:[],equity:[],pageTitle:""},filter:{date:(0,Dt.default)().format("YYYY-MM-DD"),listOutletParam:[]}},Tt=Qe(it(_n),Ze(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))})),tt(t=>{let m=C(G),e={updateFilter:n=>{z(t,i=>y(g({},i),{filter:n}))},fetchBalanceSheet:Ve(Ce(Oe(()=>{let n=t.filter();return Object.entries(n).every(([i,p])=>p!=null&&p!=="")}),Se(n=>m.getBalanceSheet(n).pipe(Le({next:i=>{z(t,p=>y(g({},p),{data:i}))},error:i=>{console.error(i)}}))),Mt(1))),fetchLoader:Ve(Ce(Se(()=>m.getBalanceSheetLoader().pipe(Le({next:n=>{z(t,i=>y(g({},i),{metadata:n,filter:{date:(0,Dt.default)(n.filter.to).format("YYYY-MM-DD")}})),e.fetchBalanceSheet(t.filter)},error:n=>{console.error(n)}})))))};return e}),et(t=>({onInit:()=>{t.fetchLoader()}})));var Zt=Ft($t());var wt=t=>["/pages/chart-of-account/account/",t],gn=(t,m)=>({id:t,to:m}),Rt=()=>["/pages/report/general-ledger"],ei=t=>({id:t});function fn(t,m){if(t&1){let e=w();o(0,"p-button",11),I("onClick",function(){f(e);let i=c(2);return x(i.onExport())}),r()}}function xn(t,m){if(t&1&&(o(0,"div",9),h(1,fn,1,0,"p-button",10),r()),t&2){let e=c();a(),s("ngIf",e.roleService.permissions().global.export)}}function hn(t,m){t&1&&(o(0,"tr")(1,"th",16),l(2,"Code"),r(),o(3,"th"),l(4,"Asset"),r(),o(5,"th",17),l(6,"Total"),r()())}function bn(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",18),l(5),r()(),o(6,"td",19)(7,"a",20),l(8),S(9,"number"),r()()()),t&2){let e=m.$implicit,n=c(3);a(2),b(e.code),a(2),s("routerLink",F(8,wt,e.accountID)),a(),b(e.name),a(2),s("queryParams",At(10,gn,e.accountID,n.store.filter().date))("routerLink",M(13,Rt)),a(),b(T(9,6,e.amount))}}function Cn(t,m){if(t&1&&(o(0,"tr")(1,"td",21),l(2,"Total Asset"),r(),o(3,"td",22),l(4),S(5,"number"),r()()),t&2){let e=c(3);a(4),v(" ",T(5,1,e.store.totalAsset())," ")}}function Sn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No asset records found."),r()()())}function vn(t,m){if(t&1&&(o(0,"h4",14),l(1,"Asset"),r(),o(2,"p-table",15),h(3,hn,7,0,"ng-template",null,3,u)(5,bn,10,14,"ng-template",null,4,u)(7,Cn,6,3,"ng-template",null,5,u)(9,Sn,4,0,"ng-template",null,6,u),r()),t&2){let e=c(2);a(2),s("value",e.store.data().asset)}}function yn(t,m){t&1&&(o(0,"tr")(1,"th",16),l(2,"Code"),r(),o(3,"th"),l(4,"Liability"),r(),o(5,"th",17),l(6,"Total"),r()())}function En(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",25),l(5),r()(),o(6,"td",19)(7,"a",20),l(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;a(2),b(e.code),a(2),s("routerLink",F(8,wt,e.accountID)),a(),b(e.name),a(2),s("queryParams",F(10,ei,e.accountID))("routerLink",M(12,Rt)),a(),b(T(9,6,e.counterAmount))}}function In(t,m){if(t&1&&(o(0,"tr")(1,"td",21),l(2," Total Liability "),r(),o(3,"td",22),l(4),S(5,"number"),r()()),t&2){let e=c(3);a(4),v(" ",T(5,1,e.store.totalLiability())," ")}}function Dn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No liability records found."),r()()())}function Tn(t,m){if(t&1&&(o(0,"h4",24),l(1,"Liability"),r(),o(2,"p-table",15),h(3,yn,7,0,"ng-template",null,3,u)(5,En,10,13,"ng-template",null,4,u)(7,In,6,3,"ng-template",null,5,u)(9,Dn,4,0,"ng-template",null,6,u),r()),t&2){let e=c(2);a(2),s("value",e.store.data().liability)}}function wn(t,m){t&1&&(o(0,"tr")(1,"th",16),l(2,"Code"),r(),o(3,"th"),l(4,"Equity"),r(),o(5,"th",17),l(6,"Total"),r()())}function Rn(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",18),l(5),r()(),o(6,"td",19)(7,"a",20),l(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;a(2),b(e.code),a(2),s("routerLink",F(8,wt,e.accountID)),a(),b(e.name),a(2),s("queryParams",F(10,ei,e.accountID))("routerLink",M(12,Rt)),a(),b(T(9,6,e.counterAmount))}}function Fn(t,m){if(t&1&&(o(0,"tr")(1,"td",21),l(2,"Total Equity"),r(),o(3,"td",22),l(4),S(5,"number"),r()(),o(6,"tr")(7,"td",21),l(8," Total Liability + Equity "),r(),o(9,"td",22),l(10),S(11,"number"),r()()),t&2){let e=c(3);a(4),v(" ",T(5,2,e.store.totalEquity())," "),a(6),v(" ",T(11,4,e.store.totalLiability()+e.store.totalEquity())," ")}}function Mn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No equity records found."),r()()())}function Vn(t,m){if(t&1&&(o(0,"h4",24),l(1,"Equity"),r(),o(2,"p-table",15),h(3,wn,7,0,"ng-template",null,3,u)(5,Rn,10,13,"ng-template",null,4,u),l(7," < "),h(8,Fn,12,6,"ng-template",null,5,u)(10,Mn,4,0,"ng-template",null,6,u),r()),t&2){let e=c(2);a(2),s("value",e.store.data().equity)}}function Ln(t,m){if(t&1&&(o(0,"p-panel",12)(1,"div",13),L(2,vn,11,1),L(3,Tn,11,1),L(4,Vn,12,1),r()()),t&2){let e=c();s("showHeader",!1),a(2),N(e.Object.keys(e.store.data().asset).length>0?2:-1),a(),N(e.Object.keys(e.store.data().liability).length>0?3:-1),a(),N(e.Object.keys(e.store.data().equity).length>0?4:-1)}}function Nn(t,m){if(t&1&&(o(0,"div",31)(1,"div"),l(2),r()()),t&2){let e=m.$implicit;a(2),b(e.value)}}function kn(t,m){if(t&1&&(o(0,"form",26)(1,"div",27)(2,"label",28),l(3,"Tag"),r(),o(4,"p-multiselect",29),h(5,Nn,3,1,"ng-template",null,7,u),r()(),o(7,"div",27)(8,"label",28),l(9,"From"),r(),D(10,"p-datepicker",30),r()()),t&2){let e=c();s("formGroup",e.filterForm),a(4),s("options",e.store.metadata().options.outlets)("showClear",!0)("virtualScrollItemSize",50)("virtualScroll",!0),a(6),s("iconDisplay","input")("showIcon",!0)}}var ti=(()=>{class t{constructor(){this.store=C(Tt),this.ReportServiceStore=C(G),this.dialogFilterVisible=E(!1),this.isInitDialogFilterVisible=E(!1),this.roleService=C(J),this.Object=Object}ngOnInit(){this.generateFilterForm()}generateFilterForm(){this.filterForm=new qt({date:new ut(new Date),outletID:new ut([])})}onFilterOKEvent(){let{date:e,outletID:n}=this.filterForm.value;this.store.updateFilter({date:(0,Zt.default)(e).format("YYYY-MM-DD"),listOutletParam:n}),this.dialogFilterVisible.update(i=>!i)}onExport(){let e=y(g({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.ReportServiceStore.getBalanceSheet(e,{responseType:"blob"}).pipe(Ge("Export Balance Sheet"),V(n=>{let i=n.type,p=[n],d=document.createElement("a");d.href=window.URL.createObjectURL(new Blob(p,{type:i}));let _=`balance-sheet.${i.split("/")[1]}`;d.setAttribute("download",_),document.body.appendChild(d),d.click(),document.body.removeChild(d)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=B({type:t,selectors:[["app-report-balance-sheet"]],features:[qe([Tt])],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],["item",""],[3,"filterConfirmed","isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","isDialogFilterVisible","isInitDialogFilterVisible","isFilterable","pageTitle","scrollable"],[1,"d-flex","gap-2"],["icon","fa-solid fa-upload","label","Export","severity","secondary","variant","outlined",3,"onClick",4,"ngIf"],["icon","fa-solid fa-upload","label","Export","severity","secondary","variant","outlined",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,"queryParams","routerLink"],["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"],["appendTo","body","display","chip","formControlName","outletID","optionLabel","value","optionValue","key","placeholder","Select an Tag",3,"options","showClear","virtualScrollItemSize","virtualScroll"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","date","inputId","icondisplay","styleClass","w-100",3,"iconDisplay","showIcon"],[1,"flex","items-center","gap-2"]],template:function(n,i){if(n&1){let p=w();o(0,"app-main-panel",8),I("filterConfirmed",function(){return f(p),x(i.onFilterOKEvent())}),j("isDialogFilterVisibleChange",function(_){return f(p),A(i.dialogFilterVisible,_)||(i.dialogFilterVisible=_),x(_)})("isInitDialogFilterVisibleChange",function(_){return f(p),A(i.isInitDialogFilterVisible,_)||(i.isInitDialogFilterVisible=_),x(_)}),h(1,xn,2,1,"ng-template",null,0,u)(3,Ln,5,4,"ng-template",null,1,u)(5,kn,11,7,"ng-template",null,2,u),r()}n&2&&(O("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("isFilterable",!0)("pageTitle",i.store.data().pageTitle)("scrollable",!0))},dependencies:[le,$,K,de,ce,pe,re,oe,ne,ee,Q,Z,ie,te,ge,_e,se,me,Me,ae,Je,X,Y,U],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var ii=(()=>{class t{static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=B({type:t,selectors:[["app-report-comparative-balance"]],decls:3,vars:0,template:function(n,i){n&1&&(Ie(0,"p"),l(1,"report-comparative-balance works!"),De(),l(2,`
1
+ import{a as ct}from"./chunk-6NXDL5QO.js";import{a as ke,b as Be}from"./chunk-XTTKUB6Z.js";import{a as we}from"./chunk-3ZUNX7VU.js";import{a as ue}from"./chunk-K32QD3HY.js";import{a as $t}from"./chunk-OS646RNF.js";import{b as pt}from"./chunk-G7M65KLU.js";import{b as Yt,c as mt,d as st}from"./chunk-ERHRLVEN.js";import{a as _e,b as ge}from"./chunk-7UYG2IJ5.js";import"./chunk-7R4NAOW3.js";import"./chunk-5TAKHYWV.js";import{m as J}from"./chunk-SPDFU2FM.js";import"./chunk-IEOE2XJ7.js";import{a as Ve,b as Le}from"./chunk-YKC7ERDO.js";import{b as ce,i as de}from"./chunk-5NZPHAOL.js";import{a as rt,b as at}from"./chunk-Y54QBXKN.js";import{a as me,b as se}from"./chunk-X2F5ZNTW.js";import"./chunk-ZULPRZ24.js";import"./chunk-BA72IEO2.js";import{a as lt}from"./chunk-VWBZGFWI.js";import{a as Ge}from"./chunk-TTIQSVQF.js";import{b as Me}from"./chunk-OVMM5CPY.js";import"./chunk-UEJR6B7A.js";import"./chunk-YYMD4TUO.js";import{b as Ut,c as Ne}from"./chunk-R46SVYN4.js";import"./chunk-2LI4CEOF.js";import{d as Xe}from"./chunk-RAFKRDM2.js";import"./chunk-RUYPEXNQ.js";import{b as pe}from"./chunk-KG3OLRKU.js";import"./chunk-4D6KKSM5.js";import"./chunk-BEEH5PAA.js";import{d as nt,e as ot,h as le}from"./chunk-URW7SXYE.js";import"./chunk-MTPMCC6U.js";import{a as Je,b as ae}from"./chunk-RO474VQ2.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import{b as z,c as Qe,d as Ze,e as et,f as tt,g as it}from"./chunk-3BPX4XM7.js";import{H as oe,I as re,J as Wt,K as Kt,y as Ht,z as Ye}from"./chunk-U2ZZPRP6.js";import{b as Re}from"./chunk-7C7GSAC3.js";import{b as jt,c as zt,e as Q,f as Z,g as qt,i as ut,k as ee,p as te,q as ie,v as Fe,y as ne}from"./chunk-OQDKL2MG.js";import{b as Ue,e as Y,l as X}from"./chunk-7NZRUZLK.js";import{a as Ot}from"./chunk-WDFE7CAE.js";import{a as $e}from"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import{a as Te}from"./chunk-T7VWZPHW.js";import{B as Gt,C as Pt,i as We,l as K,q as Ke,r as U,t as $}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{$a as je,Ab as h,Ac as O,Bc as A,C as Oe,Cc as j,Dc as kt,Ec as dt,Fc as xe,Gc as Bt,Ic as qe,Jc as M,Kc as F,Lc as At,Mb as L,Mc as He,Nb as N,Ob as ve,Qb as ye,R as Mt,Rb as Ee,S as Vt,Sb as s,Sc as S,T as Se,Tb as o,Tc as T,Ub as r,Uc as P,V,Vb as D,Wb as Ie,Wc as u,Xb as De,Zb as H,_ as Lt,_a as q,_b as W,_c as R,ac as w,c as Ce,da as C,db as a,fc as I,gc as c,ka as f,la as x,s as Pe,tc as ze,ub as B,uc as Nt,vc as l,wa as E,wc as b,xc as v,yc as Ae,za as fe}from"./chunk-T6YHDD6J.js";import{a as g,b as y,d as be,g as Ft}from"./chunk-PRARYYF3.js";var G=(()=>{class t{constructor(){this.httpService=C(Ot),this.authService=C(we)}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=g({responseType:"blob"},n);return this.httpService.post(void 0,"/api/GeneralLedgerExport/GetGeneralLedgerExport",e,i)}exportMultiLedger(e,n={}){let i=g({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 Pt({fromObject:Object.fromEntries(Object.entries(e).map(([_,k])=>[_,String(k)]))}),p=new Gt({"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"}),d=g({params:i,headers:p},n);return this.httpService.get(void 0,"/api/BalanceSheet",d)}getIncomeStatementLoader(){return this.httpService.get(void 0,"api/IncomeStatementLoader/Filter")}getIncomeStatement(e,n={}){return this.httpService.post(void 0,"api/IncomeStatement/List",g({},e),n)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=Lt({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var mi=()=>({width:"30vw"}),si=()=>({"1199px":"75vw","575px":"90vw"}),ci=t=>({"ng-dirty ng-invalid":t}),di=t=>["/pages/journal/journal-entry/",t],ui=t=>({"text-success":t}),_i=t=>({"text-danger":t});function gi(t,m){if(t&1&&(o(0,"div",33)(1,"div",34)(2,"span",35),l(3),r()(),o(4,"div")(5,"span"),l(6,"-"),r()(),o(7,"div",34)(8,"span",36),l(9),r()()()),t&2){let e=m.$implicit;a(3),v("(",e.code,")"),a(6),b(e.name)}}function fi(t,m){if(t&1&&(o(0,"div",33)(1,"div",34)(2,"span",35),l(3),r()(),o(4,"div")(5,"span"),l(6,"-"),r()(),o(7,"div",34)(8,"span",36),l(9),r()()()),t&2){let e=m.$implicit;a(3),v("(",e.code,")"),a(6),b(e.name)}}function xi(t,m){t&1&&(o(0,"div",37),l(1," Account is required. "),r())}function hi(t,m){if(t&1&&(o(0,"div",38)(1,"div"),l(2),r()()),t&2){let e=m.$implicit;a(2),b(e.value)}}function bi(t,m){if(t&1&&(o(0,"div",25)(1,"div",26),D(2,"p-radiobutton",39),o(3,"label",40),l(4),r()()()),t&2){let e=m.$implicit;a(2),s("inputId",e.key)("value",e.key),a(),s("for",e.key),a(),b(e.value)}}function Ci(t,m){if(t&1){let e=w();o(0,"div",15)(1,"label",16),l(2,"Customer"),r(),o(3,"p-autocomplete",41),I("completeMethod",function(i){f(e);let p=c(3);return x(p.searchCustomer(i))}),r()()}if(t&2){let e=c(3);a(3),s("suggestions",e.customerSuggestions())}}function Si(t,m){if(t&1){let e=w();o(0,"div",15)(1,"label",16),l(2,"Supplier"),r(),o(3,"p-autocomplete",42),I("completeMethod",function(i){f(e);let p=c(3);return x(p.searchSupplier(i))}),r()()}if(t&2){let e=c(3);a(3),s("suggestions",e.supplierSuggestions())}}function vi(t,m){if(t&1){let e=w();o(0,"div",15)(1,"label",16),l(2,"Customer"),r(),o(3,"p-autocomplete",41),I("completeMethod",function(i){f(e);let p=c(3);return x(p.searchCustomer(i))}),r()()}if(t&2){let e=c(3);a(3),s("suggestions",e.customerSuggestions())}}function yi(t,m){if(t&1&&(o(0,"div")(1,"div",26),D(2,"p-radiobutton",43),o(3,"label",40),l(4),r()()()),t&2){let e=m.$implicit;Nt(e.key===0?"col-4":"col-6"),a(2),s("value",e.key)("inputId",e.value),a(),s("for",e.value),a(),b(e.value)}}function Ei(t,m){if(t&1&&(o(0,"form",14)(1,"div",15)(2,"label",16),l(3,"Accounts"),r(),o(4,"p-select",17),h(5,gi,10,2,"ng-template",null,5,u)(7,fi,10,2,"ng-template",null,6,u),r(),h(9,xi,2,0,"div",18),r(),o(10,"div",15)(11,"label",16),l(12,"From"),r(),o(13,"div",19),D(14,"p-datepicker",20)(15,"p-datepicker",21),r()(),o(16,"div",15)(17,"label",16),l(18,"Tag"),r(),o(19,"p-multiselect",22),h(20,hi,3,1,"ng-template",null,6,u),r()(),o(22,"div",15)(23,"label",23),l(24,"Contact Type"),r(),o(25,"div",24),ye(26,bi,5,4,"div",25,ve),r()(),L(28,Ci,4,1,"div",15)(29,Si,4,1,"div",15)(30,vi,4,1,"div",15),o(31,"div",15)(32,"label",23),l(33,"Sort order"),r(),o(34,"div",24)(35,"div",25)(36,"div",26),D(37,"p-radiobutton",27),o(38,"label",28),l(39,"Asc"),r()()(),o(40,"div",29)(41,"div",26),D(42,"p-radiobutton",30),o(43,"label",31),l(44,"Desc"),r()()()()(),o(45,"div",15)(46,"label",23),l(47,"Order By"),r(),o(48,"div",24),ye(49,yi,5,6,"div",32,ve),r()()()),t&2){let e,n,i,p=c(2);s("formGroup",p.form),a(4),s("ngClass",F(14,ci,((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))))("options",p.loaderMetadata().options.accounts)("virtualScrollItemSize",50)("virtualScroll",!0),a(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))),a(5),s("showIcon",!0),a(),s("showIcon",!0),a(4),s("options",p.loaderMetadata().options.outlets)("virtualScrollItemSize",50)("virtualScroll",!0),a(7),Ee(p.loaderMetadata().options.contactTypeOptions),a(2),N((i=p.form.controls.contactType.value)===1?28:i===2?29:30),a(9),s("value",!0),a(5),s("value",!1),a(7),Ee(p.loaderMetadata().options.orderBy)}}function Ii(t,m){if(t&1&&h(0,Ei,51,16,"form",13),t&2){let e=c();s("ngIf",e.loaderMetadata())}}function Di(t,m){if(t&1){let e=w();o(0,"p-button",45),I("onClick",function(){f(e);let i=c(2);return x(i.onToggleExportDialog())}),r()}}function Ti(t,m){if(t&1&&(o(0,"div",33),h(1,Di,1,0,"p-button",44),r()),t&2){let e=c();a(),s("ngIf",e.roleService.permissions().global.export)}}function wi(t,m){t&1&&(o(0,"tr")(1,"th",52),l(2,"Number"),r(),o(3,"th",53),l(4,"Date"),r(),o(5,"th"),l(6,"Contact / Note"),r(),o(7,"th",54),l(8,"Debit"),r(),o(9,"th",54),l(10,"Credit"),r(),o(11,"th",55),l(12,"Balance"),r()())}function Ri(t,m){if(t&1&&(o(0,"div")(1,"span",63),l(2),r()()),t&2){let e=c().$implicit;a(2),v(" ",e.outletName," ")}}function Fi(t,m){if(t&1&&(o(0,"div",15),D(1,"div",64),o(2,"span",65),l(3),r()()),t&2){let e=c().$implicit;a(),s("innerHTML",e.journalNote,q),a(2),v("",e.note," ")}}function Mi(t,m){if(t&1&&(o(0,"div",15),D(1,"span",64)(2,"div",64),o(3,"span",66),l(4),r()()),t&2){let e=c().$implicit;a(),s("innerHTML",e.referenceText,q),a(),s("innerHTML",e.journalNote,q),a(2),v("",e.note," ")}}function Vi(t,m){if(t&1&&(H(0),l(1),S(2,"number"),W()),t&2){let e=c().$implicit;a(),v(" ",P(2,1,e.debitAmount,"1.0-2")," ")}}function Li(t,m){if(t&1&&(H(0),l(1),S(2,"number"),W()),t&2){let e=c().$implicit;a(),v(" ",P(2,1,e.creditAmount,"1.0-2")," ")}}function Ni(t,m){if(t&1&&(H(0),l(1),S(2,"number"),W()),t&2){let e=c().$implicit;a(),v(" ",P(2,1,e.balance,"1.0-2")," ")}}function ki(t,m){if(t&1&&(o(0,"tr")(1,"td",56)(2,"a",57),l(3),r(),o(4,"span"),l(5),r(),h(6,Ri,3,1,"div",58),r(),o(7,"td",56)(8,"span",59),S(9,"date"),l(10),S(11,"date"),r()(),o(12,"td",56)(13,"div",15)(14,"a",60),l(15),r(),L(16,Fi,4,2,"div",15)(17,Mi,5,3,"div",15),r()(),o(18,"td",61),h(19,Vi,3,4,"ng-container",58),r(),o(20,"td",61),h(21,Li,3,4,"ng-container",58),r(),o(22,"td",62),h(23,Ni,3,4,"ng-container",58),r()()),t&2){let e=m.$implicit,n=c(3);a(2),s("routerLink",F(20,di,e.id)),a(),v(" ",e.number," "),a(2),v(" ",n.getReferenceText(e.referenceText)," "),a(),s("ngIf",e.outletName==null?null:e.outletName.trim()),a(2),s("pTooltip",P(9,14,e.date,"dd MMM y")),a(2),v(" ",P(11,17,e.date,"dd MMM y")," "),a(4),s("href",n.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.contactID,je),a(),b(e.contactName),a(),N(n.buildReferenceUrl(e)?16:17),a(2),s("ngClass",F(22,ui,e.debitAmount!==0)),a(),s("ngIf",e.debitAmount!==0),a(),s("ngClass",F(24,_i,e.creditAmount!==0)),a(),s("ngIf",e.creditAmount!==0),a(2),s("ngIf",e.balance!==0)}}function Bi(t,m){if(t&1&&(o(0,"tr"),D(1,"td",67),o(2,"td",68),l(3,"Total"),r(),o(4,"td",69),l(5),S(6,"number"),r(),o(7,"td",70),l(8),S(9,"number"),r(),D(10,"td"),r()),t&2){let e=c(3);a(5),v(" ",T(6,2,e.debitSubTotal())," "),a(3),v(" ",T(9,4,e.creditSubTotal())," ")}}function Ai(t,m){t&1&&(o(0,"tr")(1,"td",71)(2,"span"),l(3,"No records found."),r()()())}function Gi(t,m){if(t&1){let e=w();o(0,"button",72),I("click",function(){f(e);let i=c(3);return x(i.getGLCount())})("keyup.enter",function(){f(e);let i=c(3);return x(i.getGLCount())}),r()}}function Pi(t,m){if(t&1&&l(0),t&2){let e=c(3);v(" ",e.count()," ")}}function Oi(t,m){if(t&1){let e=w();o(0,"p-button",73),I("onClick",function(){f(e);let i=c(3);return x(i.onNextPage())}),r()}}function ji(t,m){if(t&1&&(o(0,"div",47)(1,"p-table",48),h(2,wi,13,0,"ng-template",null,7,u)(4,ki,24,26,"ng-template",null,8,u)(6,Bi,11,6,"ng-template",null,4,u)(8,Ai,4,0,"ng-template",null,9,u),r(),o(10,"div",49)(11,"div"),l(12),L(13,Gi,1,0,"button",50)(14,Pi,1,1),l(15," entries "),r(),o(16,"div",33),L(17,Oi,1,0,"p-button",51),r()()()),t&2){let e=c(2);a(),s("value",e.items().data.data),a(11),Ae(" Showing ",e.pagination().first," to ",e.pagination().end," of "),a(),N(e.totalRecords()===-1?13:14),a(4),N(e.pagination().hasNext?17:-1)}}function zi(t,m){if(t&1&&h(0,ji,18,5,"div",46),t&2){let e=c();s("ngIf",e.items()&&e.items().data)}}function qi(t,m){if(t&1&&(o(0,"div",74)(1,"div",75),D(2,"div",76),r(),o(3,"div",77)(4,"div",26),D(5,"i",78),o(6,"span",79),l(7),S(8,"number"),S(9,"number"),r()()()()),t&2){let e=c();a(),s("formGroup",e.form),a(6),Ae("Exporting data from ",T(8,3,e.filter().exportPageNumber)," - ",T(9,5,e.filter().exportPageSize))}}function Hi(t,m){if(t&1){let e=w();o(0,"p-button",80),I("onClick",function(){f(e);let i=c();return x(i.onToggleExportDialog())}),r()}t&2&&s("rounded",!0)("text",!0)}function Wi(t,m){if(t&1){let e=w();o(0,"p-button",81),I("click",function(){f(e);let i=c();return x(i.onToggleExportDialog())}),r(),o(1,"p-button",82),I("click",function(){f(e);let i=c();return x(i.onExport())}),r()}}var Jt=(()=>{class t{getGLCount(){this.reportService.getGLCount(this.filter()).pipe(V(({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(G),this.route=C(Ue),this.roleService=C(J),this.authService=C(we),this.fb=C(Fe),this.coaService=C(lt),this.toastr=C($e),this.dayjsService=C(ue),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=Re(this.route.queryParamMap.pipe(Pe(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={},d=e.get("id");return Te.IsNotEmpty(d)&&(p=y(g({},p),{accountID:d})),Te.IsNotEmpty(n)&&Te.IsNotEmpty(i)&&(p=y(g({},p),{from:n,to:i})),p})),{initialValue:null}),this.loaderMetadata=Re(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?g(g({},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(),fe(()=>{let e=this.filter();e&&(Te.IsEmpty(this.form.value.accountID)||this.form.value.accountID!==e.accountID)&&this.form.patchValue(this.transformFilterToFormValue(e),{emitEvent:!1})}),fe(()=>{let e=this.filter(),n=this.form.value.accountID;!e||Te.IsEmpty(n)||this.reportService.fetchGeneralLedgerReport(e).subscribe(i=>{this.lastGetDataLength.set(i.data?.data?.length),this.items.update(p=>e.pageNumber===1?i:y(g({},i),{data:y(g({},i.data),{data:[...p?.data.data??[],...i.data.data]})}))})})}buildReferenceUrl(e){return ct(e)}ngOnInit(){this.route.queryParamMap.pipe(Oe(e=>e.keys.length>0)).subscribe({next:()=>this.initDialogVisible.set(!0)})}initializeForm(){this.form=this.fb.group({accountID:this.fb.control(null,[zt.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),orderBy: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(d=>this.findNodeByKey(this.categoriesOptions(),d)).filter(d=>!!d):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(V(e=>this.categoriesOptions.set(e))).subscribe()}searchCustomer(e){this.reportService.getCustomerSuggestions(e.query).pipe(V(n=>this.customerSuggestions.set(n))).subscribe()}searchSupplier(e){this.reportService.getSupplierSuggestions(e.query).pipe(V(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=be(p,["from","to"]);return y(g({},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,orderBy:i.orderBy})}onExport(){let e=this.buildExportBody();this.performExport(e)}performExport(e){this.reportService.exportGeneralLedger(e,{responseType:"blob",observe:"response"}).pipe(V(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 _=i.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);_?.[1]&&(p=decodeURIComponent(_[1].replace(/"/g,"")))}let d=e.body;st(d,p,d.type)}buildExportBody(){let p=this.form.value,{from:e,to:n}=p,i=be(p,["from","to"]);return y(g({},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 y(g({},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 y(g({},e),{pageNumber:Math.max(1,n-1)})})}goToPage(e){this.localFilter.update(n=>y(g({},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=>y(g({},p),{pageNumber:i}))}getReferenceText(e){return/\d/.test(e)?e:""}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=B({type:t,selectors:[["app-report-general-ledger"]],decls:13,vars:13,consts:[["filters",""],["actionButton",""],["content",""],["closeIconTemplate",""],["footer",""],["selectedItem",""],["item",""],["header",""],["body",""],["emptymessage",""],[3,"filterConfirmed","isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","isDialogFilterVisible","isInitDialogFilterVisible","isFilterable","pageTitle","scrollable"],["header","Export General Ledger",3,"visibleChange","visible","breakpoints","modal"],["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"],["appendTo","body","display","chip","filter","","filterBy","code,name","formControlName","accountID","optionLabel","name","optionValue","id","placeholder","Select Accounts","showClear","",3,"ngClass","options","virtualScrollItemSize","virtualScroll"],["class","text-danger",4,"ngIf"],[1,"d-flex","flex-column","gap-2"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","from","iconDisplay","input","inputId","icondisplay","showClear","","styleClass","w-100",3,"showIcon"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","to","iconDisplay","input","inputId","icondisplay","showClear","","styleClass","w-100",3,"showIcon"],["appendTo","body","display","chip","formControlName","listOutletID","optionLabel","value","optionValue","key","placeholder","Select an Tag","showClear","",3,"options","virtualScrollItemSize","virtualScroll"],["for",""],[1,"row"],[1,"col-4"],[1,"d-flex","align-items-center","gap-2"],["formControlName","sortAscending","inputId","asc","name","sortAscending",3,"value"],["for","asc",1,"m-0"],[1,"col-3"],["formControlName","sortAscending","inputId","desc","name","sortAscending",3,"value"],["for","desc",1,"m-0"],[3,"class"],[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"],["formControlName","contactType","name","contactType",3,"inputId","value"],[1,"m-0",3,"for"],["appendTo","body","formControlName","contactID","inputStyleClass","w-100","optionLabel","Value","optionValue","Key","styleClass","w-100",3,"completeMethod","suggestions"],["appendTo","body","formControlName","ContactID","inputStyleClass","w-100","optionLabel","Value","optionValue","Key","styleClass","w-100",3,"completeMethod","suggestions"],["formControlName","orderBy","name","orderBy",3,"value","inputId"],["icon","fa-solid fa-upload","label","Export","severity","secondary","variant","outlined",3,"onClick",4,"ngIf"],["icon","fa-solid fa-upload","label","Export","severity","secondary","variant","outlined",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"],["aria-label","Get journal entry count","tabindex","0","type","button",1,"fa-solid","fa-circle-question","cursor-pointer","p-0","border-0","bg-transparent"],["icon","fa-solid fa-angle-right","label","next","severity","secondary","size","small","variant","outlined"],[2,"width","200px"],[2,"width","140px"],[1,"text-end",2,"width","120px"],[1,"text-end",2,"width","160px"],[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"],["aria-label","Get journal entry count","tabindex","0","type","button",1,"fa-solid","fa-circle-question","cursor-pointer","p-0","border-0","bg-transparent",3,"click","keyup.enter"],["icon","fa-solid fa-angle-right","label","next","severity","secondary","size","small","variant","outlined",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"],["icon","fa-solid fa-xmark","severity","secondary","variant","outlined",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=w();o(0,"app-main-panel",10),I("filterConfirmed",function(){return f(p),x(i.onFilterOKEvent())}),j("isDialogFilterVisibleChange",function(_){return f(p),A(i.dialogFilterVisible,_)||(i.dialogFilterVisible=_),x(_)})("isInitDialogFilterVisibleChange",function(_){return f(p),A(i.initDialogVisible,_)||(i.initDialogVisible=_),x(_)}),h(1,Ii,1,1,"ng-template",null,0,u)(3,Ti,2,1,"ng-template",null,1,u)(5,zi,1,1,"ng-template",null,2,u),r(),o(7,"p-dialog",11),j("visibleChange",function(_){return f(p),A(i.isDialogExportVisible,_)||(i.isDialogExportVisible=_),x(_)}),h(8,qi,10,7,"div",12)(9,Hi,1,2,"ng-template",null,3,u)(11,Wi,2,0,"ng-template",null,4,u),r()}n&2&&(O("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.initDialogVisible),s("isFilterable",!0)("pageTitle",i.pageTitle)("scrollable",!0),a(7),ze(M(11,mi)),O("visible",i.isDialogExportVisible),s("breakpoints",M(12,si))("modal",!0),a(),s("ngIf",i.form&&i.filter()))},dependencies:[le,$,We,K,pe,de,ce,ot,nt,re,oe,Ne,Ut,se,me,Be,ke,ne,ee,Q,Z,ie,te,ge,_e,Me,Xe,mt,pt,ae,X,Y,at,rt,Kt,Wt,Ye,U,Ke],styles:["[_nghost-%COMP%] .p-datatable .p-datatable-header{padding:.75rem 1rem .75rem 0}"],changeDetection:0})}}return t})();var Ki={data:{},filter:{EntityID:[],CashierID:null,Text:null,from:null,to:null},isLoading:!0,loader:{options:{outlets:[]},filter:{from:"",to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}}},St=Qe(it(Ki),Ze(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}),tt(t=>{let m=C(G),e=C(ue),n={updateFilter(i){z(t,p=>y(g({},p),{filter:g(g({},p.filter),i)}))},getLoader:Ve(Ce(Se(()=>m.getIncomeStatementLoader().pipe(Le({next:i=>{z(t,p=>y(g({},p),{loader:i,filter:y(g({},p.filter),{from:e.format(i.filter.from),to:e.format(i.filter.to)})})),n.getIncomeStatement(t.filter)},error:i=>{console.error(i)}}))))),getIncomeStatement:Ve(Ce(Se(i=>m.getIncomeStatement(i).pipe(Vt(()=>z(t,p=>y(g({},p),{isLoading:!0}))),Le({next:p=>{z(t,d=>y(g({},d),{data:p,isLoading:!1}))},error:p=>{console.error(p)}})))))};return n}),et({onInit:t=>{t.getLoader()}}));var vt=()=>({}),yt=t=>["/pages/chart-of-account/account/",t],Et=(t,m,e)=>({id:t,from:m,to:e}),It=()=>["/pages/report/general-ledger"];function $i(t,m){if(t&1){let e=w();o(0,"p-button",10),I("onClick",function(){f(e);let i=c(2);return x(i.onExport())}),r()}}function Yi(t,m){if(t&1&&(o(0,"div",8),h(1,$i,1,0,"p-button",9),r()),t&2){let e=c();a(),s("ngIf",e.roleService.permissions().global.export)}}function Xi(t,m){t&1&&(o(0,"tr")(1,"th",14),l(2,"Code"),r(),o(3,"th",15),l(4,"Name"),r(),o(5,"th",16),l(6,"Total"),r()())}function Ji(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",17),l(5),r()(),o(6,"td",16)(7,"a",18),l(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=xe(0),i=xe(1);a(2),b(e.code),a(2),s("routerLink",F(8,yt,e.accountID)),a(),b(e.name),a(2),s("queryParams",He(10,Et,e.accountID,n,i))("routerLink",M(14,It)),a(),b(T(9,6,e.amount))}}function Qi(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),l(4,"Total Revenue :"),r(),o(5,"span",22),l(6),S(7,"number"),r()()()()),t&2){let e=c(3);a(6),b(T(7,1,e.store.totalRevenue()))}}function Zi(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No revenue records available"),r()()())}function en(t,m){if(t&1&&(o(0,"h6",12),l(1,"Revenue"),r(),o(2,"p-table",13),h(3,Xi,7,0,"ng-template",null,3,u)(5,Ji,10,15,"ng-template",null,4,u)(7,Qi,8,3,"ng-template",null,5,u)(9,Zi,4,0,"ng-template",null,6,u),r()),t&2){let e,n=c(2);a(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.revenue)}}function tn(t,m){t&1&&(o(0,"tr")(1,"th",14),l(2,"Code"),r(),o(3,"th",15),l(4,"Name"),r(),o(5,"th",24),l(6,"Total"),r()())}function nn(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",17),l(5),r()(),o(6,"td",16)(7,"a",18),l(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=xe(0),i=xe(1);a(2),b(e.code),a(2),s("routerLink",F(8,yt,e.accountID)),a(),b(e.name),a(2),s("queryParams",He(10,Et,e.accountID,n,i))("routerLink",M(14,It)),a(),b(T(9,6,e.amount))}}function on(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),l(4,"Total COGS :"),r(),o(5,"span",22),l(6),S(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),l(12,"Gross Profit :"),r(),o(13,"span",22),l(14),S(15,"number"),r()()()()),t&2){let e=c(3);a(6),b(T(7,2,e.store.totalCOGS())),a(8),b(T(15,4,e.store.grossProfit()))}}function rn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No COGS records available"),r()()())}function an(t,m){if(t&1&&(o(0,"h4",12),l(1,"COGS"),r(),o(2,"p-table",13),h(3,tn,7,0,"ng-template",null,3,u)(5,nn,10,15,"ng-template",null,4,u)(7,on,16,6,"ng-template",null,5,u)(9,rn,4,0,"ng-template",null,6,u),r()),t&2){let e,n=c(2);a(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.cogs)}}function ln(t,m){t&1&&(o(0,"tr")(1,"th",14),l(2,"Code"),r(),o(3,"th",15),l(4,"Name"),r(),o(5,"th",16),l(6,"Total"),r()())}function pn(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",17),l(5),r()(),o(6,"td",16)(7,"a",18),l(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=xe(0),i=xe(1);a(2),b(e.code),a(2),s("routerLink",F(8,yt,e.accountID)),a(),b(e.name),a(2),s("queryParams",He(10,Et,e.accountID,n,i))("routerLink",M(14,It)),a(),b(T(9,6,e.amount))}}function mn(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),l(4,"Total Expense :"),r(),o(5,"span",22),l(6),S(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),l(12,"Profit / Loss :"),r(),o(13,"span",22),l(14),S(15,"number"),r()()()()),t&2){let e=c(3);a(6),b(T(7,2,e.store.totalExpense())),a(8),b(T(15,4,e.store.profitOrLoss()))}}function sn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No expense records available"),r()()())}function cn(t,m){if(t&1&&(o(0,"h4",12),l(1,"Expense"),r(),o(2,"p-table",13),h(3,ln,7,0,"ng-template",null,3,u)(5,pn,10,15,"ng-template",null,4,u)(7,mn,16,6,"ng-template",null,5,u)(9,sn,4,0,"ng-template",null,6,u),r()),t&2){let e,n=c(2);a(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.expense)}}function dn(t,m){if(t&1&&(kt(0)(1),o(2,"p-panel")(3,"div",11),L(4,en,11,1),L(5,an,11,1),L(6,cn,11,1),r()()),t&2){let e,n,i,p,d=c();dt((e=d.store.filter())!=null&&e.from?d.store.filter().from:null),a(),dt((n=d.store.filter())!=null&&n.to?d.store.filter().to:null),a(3),N(d.Object.keys(d.store.data().data??M(5,vt)).length>0?4:-1),a(),N(d.Object.keys(((i=d.store.data().data)==null?null:i.cogs)??M(6,vt)).length>0?5:-1),a(),N(d.Object.keys(((p=d.store.data().data)==null?null:p.expense)??M(7,vt)).length>0?6:-1)}}function un(t,m){if(t&1){let e=w();o(0,"form",25)(1,"div",26)(2,"label",27),l(3,"Tag"),r(),D(4,"p-multiselect",28),r(),o(5,"div",26)(6,"label",27),l(7,"Cashier"),r(),o(8,"p-autocomplete",29),I("completeMethod",function(i){f(e);let p=c();return x(p.onCashierSearch(i))})("onSelect",function(i){f(e);let p=c();return x(p.onCashierSelect(i))}),r()(),o(9,"div",26)(10,"label",30),l(11,"From - To"),r(),o(12,"div",31),D(13,"p-datepicker",32)(14,"p-datepicker",33),r()()()}if(t&2){let e=c();s("formGroup",e.formFilter),a(4),s("options",e.store.loader().options.outlets)("showClear",!0)("virtualScrollItemSize",50)("virtualScroll",!0),a(4),s("showClear",!0)("showClear",!0)("suggestions",e.cashierSuggestions()),a(5),s("iconDisplay","input")("showIcon",!0),a(),s("iconDisplay","input")("showIcon",!0)}}var Qt=(()=>{class t{constructor(){this.dayjsService=C(ue),this.store=C(St),this.fb=C(Fe),this.reportService=C(G),this.roleService=C(J),this.isInitDialogFilterVisible=E(!1),this.dialogFilterVisible=E(!1),this.cashierSuggestions=E([]),this.cashierHashMap=new Map,this.Object=Object,fe(()=>{this.store.filter()&&this.initForm()})}ngOnInit(){this.initForm()}onSearch(e){this.store.updateFilter(y(g({},this.store.filter()),{Text:e}))}onCashierSearch(e){this.reportService.getCashierSuggestions(e.query).pipe(Ge("Cashier Suggestions"),V(n=>this.cashierSuggestions.set(n))).subscribe()}initForm(){let e=this.store.filter();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,d])=>(p==="from"||p==="to"?d instanceof Date&&(i[p]=this.dayjsService.format(d)):i[p]=d||null,i),{});this.store.updateFilter(g(g({},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=y(g({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.reportService.getIncomeStatement(e,{responseType:"blob"}).pipe(Ge("Export Profit & Loss"),V(n=>{let i=n.type,p=[n],d=document.createElement("a");d.href=window.URL.createObjectURL(new Blob(p,{type:i}));let _=`profit-and-loss.${i.split("/")[1]}`;d.setAttribute("download",_),document.body.appendChild(d),d.click(),document.body.removeChild(d)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=B({type:t,selectors:[["app-report-income-statement"]],features:[qe([St])],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],[3,"filterConfirmed","isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","isDialogFilterVisible","isInitDialogFilterVisible","isFilterable","pageTitle","scrollable"],[1,"d-flex","gap-2"],["icon","fa-solid fa-upload","label","Export","severity","secondary","variant","outlined",3,"onClick",4,"ngIf"],["icon","fa-solid fa-upload","label","Export","severity","secondary","variant","outlined",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,"queryParams","routerLink"],["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",""],["appendTo","body","display","chip","filterBy","value","formControlName","EntityID","optionLabel","value","optionValue","key","placeholder","Select an Tag",3,"options","showClear","virtualScrollItemSize","virtualScroll"],["appendTo","body","field","Value","formControlName","CashierID","inputStyleClass","w-100","optionLabel","Value","optionValue","Key","placeholder","Search a cashier","styleClass","w-100",3,"completeMethod","onSelect","showClear","suggestions"],["for","outlet"],[1,"d-flex","flex-column","gap-2"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","from","inputId","icondisplay","styleClass","w-100 mb-0",3,"iconDisplay","showIcon"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","to","inputId","icondisplay","styleClass","w-100",3,"iconDisplay","showIcon"]],template:function(n,i){if(n&1){let p=w();o(0,"app-main-panel",7),I("filterConfirmed",function(){return f(p),x(i.onFilterOK())}),j("isDialogFilterVisibleChange",function(_){return f(p),A(i.dialogFilterVisible,_)||(i.dialogFilterVisible=_),x(_)})("isInitDialogFilterVisibleChange",function(_){return f(p),A(i.isInitDialogFilterVisible,_)||(i.isInitDialogFilterVisible=_),x(_)}),h(1,Yi,2,1,"ng-template",null,0,u)(3,dn,7,8,"ng-template",null,1,u)(5,un,15,12,"ng-template",null,2,u),r()}n&2&&(O("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("isFilterable",!0)("pageTitle",i.store.data().pageTitle)("scrollable",!0))},dependencies:[le,$,K,Ne,se,me,ne,ee,Q,Z,ie,te,ge,_e,pe,de,ce,ae,Je,X,Y,Be,ke,re,oe,U],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Dt=Ft($t());var _n={metadata:{options:{outlets:[]},filter:{to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}},data:{asset:[],liability:[],equity:[],pageTitle:""},filter:{date:(0,Dt.default)().format("YYYY-MM-DD"),listOutletParam:[]}},Tt=Qe(it(_n),Ze(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))})),tt(t=>{let m=C(G),e={updateFilter:n=>{z(t,i=>y(g({},i),{filter:n}))},fetchBalanceSheet:Ve(Ce(Oe(()=>{let n=t.filter();return Object.entries(n).every(([i,p])=>p!=null&&p!=="")}),Se(n=>m.getBalanceSheet(n).pipe(Le({next:i=>{z(t,p=>y(g({},p),{data:i}))},error:i=>{console.error(i)}}))),Mt(1))),fetchLoader:Ve(Ce(Se(()=>m.getBalanceSheetLoader().pipe(Le({next:n=>{z(t,i=>y(g({},i),{metadata:n,filter:{date:(0,Dt.default)(n.filter.to).format("YYYY-MM-DD")}})),e.fetchBalanceSheet(t.filter)},error:n=>{console.error(n)}})))))};return e}),et(t=>({onInit:()=>{t.fetchLoader()}})));var Zt=Ft($t());var wt=t=>["/pages/chart-of-account/account/",t],gn=(t,m)=>({id:t,to:m}),Rt=()=>["/pages/report/general-ledger"],ei=t=>({id:t});function fn(t,m){if(t&1){let e=w();o(0,"p-button",11),I("onClick",function(){f(e);let i=c(2);return x(i.onExport())}),r()}}function xn(t,m){if(t&1&&(o(0,"div",9),h(1,fn,1,0,"p-button",10),r()),t&2){let e=c();a(),s("ngIf",e.roleService.permissions().global.export)}}function hn(t,m){t&1&&(o(0,"tr")(1,"th",16),l(2,"Code"),r(),o(3,"th"),l(4,"Asset"),r(),o(5,"th",17),l(6,"Total"),r()())}function bn(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",18),l(5),r()(),o(6,"td",19)(7,"a",20),l(8),S(9,"number"),r()()()),t&2){let e=m.$implicit,n=c(3);a(2),b(e.code),a(2),s("routerLink",F(8,wt,e.accountID)),a(),b(e.name),a(2),s("queryParams",At(10,gn,e.accountID,n.store.filter().date))("routerLink",M(13,Rt)),a(),b(T(9,6,e.amount))}}function Cn(t,m){if(t&1&&(o(0,"tr")(1,"td",21),l(2,"Total Asset"),r(),o(3,"td",22),l(4),S(5,"number"),r()()),t&2){let e=c(3);a(4),v(" ",T(5,1,e.store.totalAsset())," ")}}function Sn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No asset records found."),r()()())}function vn(t,m){if(t&1&&(o(0,"h4",14),l(1,"Asset"),r(),o(2,"p-table",15),h(3,hn,7,0,"ng-template",null,3,u)(5,bn,10,14,"ng-template",null,4,u)(7,Cn,6,3,"ng-template",null,5,u)(9,Sn,4,0,"ng-template",null,6,u),r()),t&2){let e=c(2);a(2),s("value",e.store.data().asset)}}function yn(t,m){t&1&&(o(0,"tr")(1,"th",16),l(2,"Code"),r(),o(3,"th"),l(4,"Liability"),r(),o(5,"th",17),l(6,"Total"),r()())}function En(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",25),l(5),r()(),o(6,"td",19)(7,"a",20),l(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;a(2),b(e.code),a(2),s("routerLink",F(8,wt,e.accountID)),a(),b(e.name),a(2),s("queryParams",F(10,ei,e.accountID))("routerLink",M(12,Rt)),a(),b(T(9,6,e.counterAmount))}}function In(t,m){if(t&1&&(o(0,"tr")(1,"td",21),l(2," Total Liability "),r(),o(3,"td",22),l(4),S(5,"number"),r()()),t&2){let e=c(3);a(4),v(" ",T(5,1,e.store.totalLiability())," ")}}function Dn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No liability records found."),r()()())}function Tn(t,m){if(t&1&&(o(0,"h4",24),l(1,"Liability"),r(),o(2,"p-table",15),h(3,yn,7,0,"ng-template",null,3,u)(5,En,10,13,"ng-template",null,4,u)(7,In,6,3,"ng-template",null,5,u)(9,Dn,4,0,"ng-template",null,6,u),r()),t&2){let e=c(2);a(2),s("value",e.store.data().liability)}}function wn(t,m){t&1&&(o(0,"tr")(1,"th",16),l(2,"Code"),r(),o(3,"th"),l(4,"Equity"),r(),o(5,"th",17),l(6,"Total"),r()())}function Rn(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",18),l(5),r()(),o(6,"td",19)(7,"a",20),l(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;a(2),b(e.code),a(2),s("routerLink",F(8,wt,e.accountID)),a(),b(e.name),a(2),s("queryParams",F(10,ei,e.accountID))("routerLink",M(12,Rt)),a(),b(T(9,6,e.counterAmount))}}function Fn(t,m){if(t&1&&(o(0,"tr")(1,"td",21),l(2,"Total Equity"),r(),o(3,"td",22),l(4),S(5,"number"),r()(),o(6,"tr")(7,"td",21),l(8," Total Liability + Equity "),r(),o(9,"td",22),l(10),S(11,"number"),r()()),t&2){let e=c(3);a(4),v(" ",T(5,2,e.store.totalEquity())," "),a(6),v(" ",T(11,4,e.store.totalLiability()+e.store.totalEquity())," ")}}function Mn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No equity records found."),r()()())}function Vn(t,m){if(t&1&&(o(0,"h4",24),l(1,"Equity"),r(),o(2,"p-table",15),h(3,wn,7,0,"ng-template",null,3,u)(5,Rn,10,13,"ng-template",null,4,u),l(7," < "),h(8,Fn,12,6,"ng-template",null,5,u)(10,Mn,4,0,"ng-template",null,6,u),r()),t&2){let e=c(2);a(2),s("value",e.store.data().equity)}}function Ln(t,m){if(t&1&&(o(0,"p-panel",12)(1,"div",13),L(2,vn,11,1),L(3,Tn,11,1),L(4,Vn,12,1),r()()),t&2){let e=c();s("showHeader",!1),a(2),N(e.Object.keys(e.store.data().asset).length>0?2:-1),a(),N(e.Object.keys(e.store.data().liability).length>0?3:-1),a(),N(e.Object.keys(e.store.data().equity).length>0?4:-1)}}function Nn(t,m){if(t&1&&(o(0,"div",31)(1,"div"),l(2),r()()),t&2){let e=m.$implicit;a(2),b(e.value)}}function kn(t,m){if(t&1&&(o(0,"form",26)(1,"div",27)(2,"label",28),l(3,"Tag"),r(),o(4,"p-multiselect",29),h(5,Nn,3,1,"ng-template",null,7,u),r()(),o(7,"div",27)(8,"label",28),l(9,"From"),r(),D(10,"p-datepicker",30),r()()),t&2){let e=c();s("formGroup",e.filterForm),a(4),s("options",e.store.metadata().options.outlets)("showClear",!0)("virtualScrollItemSize",50)("virtualScroll",!0),a(6),s("iconDisplay","input")("showIcon",!0)}}var ti=(()=>{class t{constructor(){this.store=C(Tt),this.ReportServiceStore=C(G),this.dialogFilterVisible=E(!1),this.isInitDialogFilterVisible=E(!1),this.roleService=C(J),this.Object=Object}ngOnInit(){this.generateFilterForm()}generateFilterForm(){this.filterForm=new qt({date:new ut(new Date),outletID:new ut([])})}onFilterOKEvent(){let{date:e,outletID:n}=this.filterForm.value;this.store.updateFilter({date:(0,Zt.default)(e).format("YYYY-MM-DD"),listOutletParam:n}),this.dialogFilterVisible.update(i=>!i)}onExport(){let e=y(g({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.ReportServiceStore.getBalanceSheet(e,{responseType:"blob"}).pipe(Ge("Export Balance Sheet"),V(n=>{let i=n.type,p=[n],d=document.createElement("a");d.href=window.URL.createObjectURL(new Blob(p,{type:i}));let _=`balance-sheet.${i.split("/")[1]}`;d.setAttribute("download",_),document.body.appendChild(d),d.click(),document.body.removeChild(d)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=B({type:t,selectors:[["app-report-balance-sheet"]],features:[qe([Tt])],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],["item",""],[3,"filterConfirmed","isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","isDialogFilterVisible","isInitDialogFilterVisible","isFilterable","pageTitle","scrollable"],[1,"d-flex","gap-2"],["icon","fa-solid fa-upload","label","Export","severity","secondary","variant","outlined",3,"onClick",4,"ngIf"],["icon","fa-solid fa-upload","label","Export","severity","secondary","variant","outlined",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,"queryParams","routerLink"],["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"],["appendTo","body","display","chip","formControlName","outletID","optionLabel","value","optionValue","key","placeholder","Select an Tag",3,"options","showClear","virtualScrollItemSize","virtualScroll"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","date","inputId","icondisplay","styleClass","w-100",3,"iconDisplay","showIcon"],[1,"flex","items-center","gap-2"]],template:function(n,i){if(n&1){let p=w();o(0,"app-main-panel",8),I("filterConfirmed",function(){return f(p),x(i.onFilterOKEvent())}),j("isDialogFilterVisibleChange",function(_){return f(p),A(i.dialogFilterVisible,_)||(i.dialogFilterVisible=_),x(_)})("isInitDialogFilterVisibleChange",function(_){return f(p),A(i.isInitDialogFilterVisible,_)||(i.isInitDialogFilterVisible=_),x(_)}),h(1,xn,2,1,"ng-template",null,0,u)(3,Ln,5,4,"ng-template",null,1,u)(5,kn,11,7,"ng-template",null,2,u),r()}n&2&&(O("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("isFilterable",!0)("pageTitle",i.store.data().pageTitle)("scrollable",!0))},dependencies:[le,$,K,de,ce,pe,re,oe,ne,ee,Q,Z,ie,te,ge,_e,se,me,Me,ae,Je,X,Y,U],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var ii=(()=>{class t{static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=B({type:t,selectors:[["app-report-comparative-balance"]],decls:3,vars:0,template:function(n,i){n&1&&(Ie(0,"p"),l(1,"report-comparative-balance works!"),De(),l(2,`
2
2
  ,
3
3
  `))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var ni=(()=>{class t{static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=B({type:t,selectors:[["app-report-cash-flow"]],decls:3,vars:0,template:function(n,i){n&1&&(Ie(0,"p"),l(1,"report-cash-flow works!"),De(),l(2,`
4
4
  ,
@@ -1 +1 @@
1
- import{a as Me}from"./chunk-QTJQPJZS.js";import{a as ve,b as Ce,c as be,d as xe,e as ye,f as Fe}from"./chunk-AP2QQRNJ.js";import"./chunk-NNU2L44G.js";import{a as ge,b as he}from"./chunk-MDCWCEZ7.js";import{a as _e}from"./chunk-XKI7WLHE.js";import{m as H}from"./chunk-SPDFU2FM.js";import"./chunk-IEOE2XJ7.js";import"./chunk-BA72IEO2.js";import{a as ie,b as ne}from"./chunk-2LI4CEOF.js";import"./chunk-RUYPEXNQ.js";import"./chunk-4D6KKSM5.js";import{h as fe}from"./chunk-5FVLV36I.js";import"./chunk-MTPMCC6U.js";import{a as me,b as ce}from"./chunk-RO474VQ2.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import"./chunk-3BPX4XM7.js";import{H as pe,I as se,J as de,K as ue,y as ae,z as le}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import{b as J,c as K,e as Q,f as W,k as X,n as Y,o as Z,p as ee,q as te,v as oe,y as re}from"./chunk-OQDKL2MG.js";import{b as U,d as L}from"./chunk-7NZRUZLK.js";import"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-WNU7SPEQ.js";import{i as q,t as z}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{Ab as R,Da as D,Jc as x,Kc as y,Mb as h,Nb as _,Ob as k,Pb as O,Qb as v,Rb as C,Sb as s,T as E,Tb as i,Ub as n,V as M,Vb as g,Wc as G,ac as V,da as c,db as r,fc as B,gc as d,hd as j,ka as I,la as N,tc as b,ub as P,uc as S,vc as f,wa as A,wc as T,xc as $,zb as w}from"./chunk-T6YHDD6J.js";import"./chunk-PRARYYF3.js";var Ge=()=>({height:"calc(100vh - 70px)"}),Ee=t=>({"ng-invalid ng-dirty":t}),ke=t=>({"ps-0":t}),Se=()=>({display:"flex"});function Ie(t,a){if(t&1){let e=V();i(0,"p-button",4),B("onClick",function(){I(e);let l=d(2);return N(l.onSubmit())}),n()}}function Ne(t,a){if(t&1&&h(0,Ie,1,0,"p-button",3),t&2){let e=d();_(e.roleService.permissions().user.edit||e.roleService.permissions().user.create?0:-1)}}function Ae(t,a){if(t&1&&(i(0,"div")(1,"span",14),f(2),n()()),t&2){let e=a.$implicit;r(2),T(e)}}function De(t,a){if(t&1&&(i(0,"div"),v(1,Ae,3,1,"div",null,O),n()),t&2){let e=d(2);r(),C(e.getErrors("name"))}}function Pe(t,a){if(t&1&&(i(0,"div",22)(1,"div",23),g(2,"p-checkbox",24),i(3,"p",25),f(4),n()()()),t&2){let e=a.$implicit,o=a.$index;s("formGroupName",o)("pTooltip",e.get("description").value),r(2),b(x(6,Se)),s("binary",!0),r(2),$(" ",e.get("name").value," ")}}function we(t,a){if(t&1&&(i(0,"div",15)(1,"div",16)(2,"div",17)(3,"span",18),f(4),n()(),g(5,"p-checkbox",19),n(),i(6,"div",20)(7,"div",21),v(8,Pe,5,7,"div",22,k),n()()()),t&2){let e=a.$implicit,o=a.$index,l=d(3);s("formGroupName",o),r(4),T(e.get("groupName").value),r(),b(x(5,Se)),s("binary",!0),r(3),C(l.getRolesArray(o).controls)}}function Re(t,a){if(t&1&&(i(0,"div",11),v(1,we,10,6,"div",15,k),n()),t&2){let e=d(2);r(),C(e.rolesFormArray.controls)}}function Oe(t,a){if(t&1&&(i(0,"p-panel")(1,"div",5)(2,"form",6),g(3,"input",7),h(4,De,3,0,"div"),n(),i(5,"p-tabs",8)(6,"p-tablist")(7,"p-tab",8),f(8,"Permission"),n(),i(9,"p-tab",9),f(10,"Description"),n()(),i(11,"p-tabpanels",10)(12,"p-tabpanel",8)(13,"form",6),h(14,Re,3,0,"div",11),n()(),i(15,"p-tabpanel",9)(16,"div",12),g(17,"textarea",13),n()()()()()()),t&2){let e=d();b(x(13,Ge)),r(2),s("formGroup",e.form),r(),s("fluid",!0)("ngClass",y(14,Ee,e.isInvalid("name"))),r(),_(e.isInvalid("name")?4:-1),r(3),S(y(16,ke,e.router.url.includes("forms"))),r(2),S(y(18,ke,e.router.url.includes("forms"))),r(4),s("formGroup",e.form),r(),_(e.rolesFormArray.length>0?14:-1),r(2),s("formGroup",e.form)}}var ft=(()=>{class t extends _e{constructor(){super(...arguments),this.service=c(Me),this.fb=c(oe),this.cdr=c(j),this.route=c(U),this.router=c(L),this.roleService=c(H),this.form=this.fb.group({groupID:this.fb.control(""),name:this.fb.control("",[K.required]),description:this.fb.control(""),roles:this.fb.array([])}),this.groupFormMeta=A(null)}ngOnInit(){this.route.queryParamMap.pipe(E(e=>this.service.getGroupFormMeta(e.get("groupID")).pipe(M(o=>{this.groupFormMeta.set(o),this.populateForm(o)})))).subscribe()}populateForm(e){this.form.patchValue({groupID:e.form.groupID,name:e.form.name,description:e.form.description});let o=this.rolesFormArray;o.clear(),e.options.roles.forEach(l=>{let m=this.fb.array(l.roles.map(p=>this.fb.group({id:this.fb.control(p.id),name:this.fb.control(p.name),checked:this.fb.control({value:e.form.rolesID.includes(p.id),disabled:!this.roleService.permissions().user.edit}),description:this.fb.control(p.description||"")}))),u=this.fb.group({groupName:this.fb.control(l.name),groupChecked:this.fb.control(!1),roles:m}),Te=m.controls.every(p=>p.get("checked").value);u.get("groupChecked").setValue(Te,{emitEvent:!1}),this.roleService.permissions().user.edit?u.get("groupChecked").enable():u.get("groupChecked").disable(),u.get("groupChecked").valueChanges.subscribe(p=>{m.controls.forEach(F=>{F.get("checked").setValue(p,{emitEvent:!1})})}),m.valueChanges.subscribe(()=>{let p=m.controls.every(F=>F.get("checked").value);u.get("groupChecked").setValue(p,{emitEvent:!1})}),o.push(u)}),this.cdr.detectChanges()}get rolesFormArray(){return this.form.get("roles")}getRolesArray(e){return this.rolesFormArray.at(e).get("roles")}getSelectedRoleIDs(){let e=[];return this.rolesFormArray.controls.forEach(o=>{o.get("roles").controls.forEach(m=>{m.get("checked").value&&e.push(m.get("id").value)})}),e}onSubmit(){if(this.form.invalid){this.form.markAllAsTouched();return}let e={groupID:this.form.get("groupID").value,name:this.form.get("name").value,rolesID:this.getSelectedRoleIDs(),description:this.form.controls.description.value};this.service.assignGroupRole(e).pipe(M(()=>{this.router.navigate(["/pages/users/groups"])})).subscribe()}static{this.\u0275fac=(()=>{let e;return function(l){return(e||(e=D(t)))(l||t)}})()}static{this.\u0275cmp=P({type:t,selectors:[["app-group-form"]],features:[w],decls:5,vars:1,consts:[["actionButton",""],["content",""],["pageTitle","Group Form",3,"overflowScroll"],["label","Submit"],["label","Submit",3,"onClick"],[1,"d-flex","flex-column","gap-3","py-2"],[1,"d-flex","flex-column","gap-2",3,"formGroup"],["type","text","pInputText","","formControlName","name","placeholder","Group Name",3,"fluid","ngClass"],["value","0"],["value","1"],[2,"padding-left","0"],["formArrayName","roles",1,"container-fluid","d-flex","flex-column","row-gap-3"],[3,"formGroup"],["formControlName","description","fluid","","rows","5","cols","30","pTextarea",""],[1,"text-danger"],[1,"row","align-items-stretch",3,"formGroupName"],[1,"col-2","py-2","border-top","border-bottom","border-start","d-flex","justify-content-between",2,"background","#f6f6f6"],[1,"d-flex","justify-content-center","w-100"],[1,"text-dark","fw-semibold","fs-2"],["size","small","formControlName","groupChecked",3,"binary"],[1,"col","p-0"],["formArrayName","roles",1,"roles-grid","h-100"],["tooltipPosition","top",1,"role-cell",3,"formGroupName","pTooltip"],[1,"py-2","d-flex","h-100","align-items-center","gap-2","px-2"],["size","small","formControlName","checked",3,"binary"],[1,"fs-2","text-dark","m-0"]],template:function(o,l){o&1&&(i(0,"app-main-panel",2),R(1,Ne,1,1,"ng-template",null,0,G)(3,Oe,18,20,"ng-template",null,1,G),n()),o&2&&s("overflowScroll",!0)},dependencies:[fe,ne,ie,re,X,J,Q,W,te,ee,Y,Z,z,q,le,ae,Fe,ve,ye,xe,Ce,be,he,ge,se,pe,ce,me,ue,de],styles:["[_nghost-%COMP%]{display:block}[_nghost-%COMP%] .p-checkbox{display:flex!important}[_nghost-%COMP%] .p-tabs .p-tab{padding-left:0!important}[_nghost-%COMP%] .p-panel .p-panel-header{display:none!important}.roles-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(4,1fr)}.role-cell[_ngcontent-%COMP%]{border:1px solid #ddd;border-top:none;border-left:none;background:#fff}.roles-grid[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:nth-child(-n+4){border-top:1px solid #ddd}.roles-grid[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:nth-child(4n+1){border-left:1px solid #ddd}"],changeDetection:0})}}return t})();export{ft as GroupFormComponent};
1
+ import{a as Me}from"./chunk-QTJQPJZS.js";import{a as ve,b as Ce,c as be,d as xe,e as ye,f as Fe}from"./chunk-AP2QQRNJ.js";import"./chunk-NNU2L44G.js";import{a as ge,b as he}from"./chunk-MDCWCEZ7.js";import{a as _e}from"./chunk-XKI7WLHE.js";import{m as H}from"./chunk-SPDFU2FM.js";import"./chunk-IEOE2XJ7.js";import"./chunk-BA72IEO2.js";import{a as ie,b as ne}from"./chunk-2LI4CEOF.js";import"./chunk-RUYPEXNQ.js";import"./chunk-4D6KKSM5.js";import{h as fe}from"./chunk-URW7SXYE.js";import"./chunk-MTPMCC6U.js";import{a as me,b as ce}from"./chunk-RO474VQ2.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import"./chunk-3BPX4XM7.js";import{H as pe,I as se,J as de,K as ue,y as ae,z as le}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import{b as J,c as K,e as Q,f as W,k as X,n as Y,o as Z,p as ee,q as te,v as oe,y as re}from"./chunk-OQDKL2MG.js";import{b as U,d as L}from"./chunk-7NZRUZLK.js";import"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-T7VWZPHW.js";import{i as q,t as z}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{Ab as R,Da as D,Jc as x,Kc as y,Mb as h,Nb as _,Ob as k,Pb as O,Qb as v,Rb as C,Sb as s,T as E,Tb as i,Ub as n,V as M,Vb as g,Wc as G,ac as V,da as c,db as r,fc as B,gc as d,hd as j,ka as I,la as N,tc as b,ub as P,uc as S,vc as f,wa as A,wc as T,xc as $,zb as w}from"./chunk-T6YHDD6J.js";import"./chunk-PRARYYF3.js";var Ge=()=>({height:"calc(100vh - 70px)"}),Ee=t=>({"ng-invalid ng-dirty":t}),ke=t=>({"ps-0":t}),Se=()=>({display:"flex"});function Ie(t,a){if(t&1){let e=V();i(0,"p-button",4),B("onClick",function(){I(e);let l=d(2);return N(l.onSubmit())}),n()}}function Ne(t,a){if(t&1&&h(0,Ie,1,0,"p-button",3),t&2){let e=d();_(e.roleService.permissions().user.edit||e.roleService.permissions().user.create?0:-1)}}function Ae(t,a){if(t&1&&(i(0,"div")(1,"span",14),f(2),n()()),t&2){let e=a.$implicit;r(2),T(e)}}function De(t,a){if(t&1&&(i(0,"div"),v(1,Ae,3,1,"div",null,O),n()),t&2){let e=d(2);r(),C(e.getErrors("name"))}}function Pe(t,a){if(t&1&&(i(0,"div",22)(1,"div",23),g(2,"p-checkbox",24),i(3,"p",25),f(4),n()()()),t&2){let e=a.$implicit,o=a.$index;s("formGroupName",o)("pTooltip",e.get("description").value),r(2),b(x(6,Se)),s("binary",!0),r(2),$(" ",e.get("name").value," ")}}function we(t,a){if(t&1&&(i(0,"div",15)(1,"div",16)(2,"div",17)(3,"span",18),f(4),n()(),g(5,"p-checkbox",19),n(),i(6,"div",20)(7,"div",21),v(8,Pe,5,7,"div",22,k),n()()()),t&2){let e=a.$implicit,o=a.$index,l=d(3);s("formGroupName",o),r(4),T(e.get("groupName").value),r(),b(x(5,Se)),s("binary",!0),r(3),C(l.getRolesArray(o).controls)}}function Re(t,a){if(t&1&&(i(0,"div",11),v(1,we,10,6,"div",15,k),n()),t&2){let e=d(2);r(),C(e.rolesFormArray.controls)}}function Oe(t,a){if(t&1&&(i(0,"p-panel")(1,"div",5)(2,"form",6),g(3,"input",7),h(4,De,3,0,"div"),n(),i(5,"p-tabs",8)(6,"p-tablist")(7,"p-tab",8),f(8,"Permission"),n(),i(9,"p-tab",9),f(10,"Description"),n()(),i(11,"p-tabpanels",10)(12,"p-tabpanel",8)(13,"form",6),h(14,Re,3,0,"div",11),n()(),i(15,"p-tabpanel",9)(16,"div",12),g(17,"textarea",13),n()()()()()()),t&2){let e=d();b(x(13,Ge)),r(2),s("formGroup",e.form),r(),s("fluid",!0)("ngClass",y(14,Ee,e.isInvalid("name"))),r(),_(e.isInvalid("name")?4:-1),r(3),S(y(16,ke,e.router.url.includes("forms"))),r(2),S(y(18,ke,e.router.url.includes("forms"))),r(4),s("formGroup",e.form),r(),_(e.rolesFormArray.length>0?14:-1),r(2),s("formGroup",e.form)}}var ft=(()=>{class t extends _e{constructor(){super(...arguments),this.service=c(Me),this.fb=c(oe),this.cdr=c(j),this.route=c(U),this.router=c(L),this.roleService=c(H),this.form=this.fb.group({groupID:this.fb.control(""),name:this.fb.control("",[K.required]),description:this.fb.control(""),roles:this.fb.array([])}),this.groupFormMeta=A(null)}ngOnInit(){this.route.queryParamMap.pipe(E(e=>this.service.getGroupFormMeta(e.get("groupID")).pipe(M(o=>{this.groupFormMeta.set(o),this.populateForm(o)})))).subscribe()}populateForm(e){this.form.patchValue({groupID:e.form.groupID,name:e.form.name,description:e.form.description});let o=this.rolesFormArray;o.clear(),e.options.roles.forEach(l=>{let m=this.fb.array(l.roles.map(p=>this.fb.group({id:this.fb.control(p.id),name:this.fb.control(p.name),checked:this.fb.control({value:e.form.rolesID.includes(p.id),disabled:!this.roleService.permissions().user.edit}),description:this.fb.control(p.description||"")}))),u=this.fb.group({groupName:this.fb.control(l.name),groupChecked:this.fb.control(!1),roles:m}),Te=m.controls.every(p=>p.get("checked").value);u.get("groupChecked").setValue(Te,{emitEvent:!1}),this.roleService.permissions().user.edit?u.get("groupChecked").enable():u.get("groupChecked").disable(),u.get("groupChecked").valueChanges.subscribe(p=>{m.controls.forEach(F=>{F.get("checked").setValue(p,{emitEvent:!1})})}),m.valueChanges.subscribe(()=>{let p=m.controls.every(F=>F.get("checked").value);u.get("groupChecked").setValue(p,{emitEvent:!1})}),o.push(u)}),this.cdr.detectChanges()}get rolesFormArray(){return this.form.get("roles")}getRolesArray(e){return this.rolesFormArray.at(e).get("roles")}getSelectedRoleIDs(){let e=[];return this.rolesFormArray.controls.forEach(o=>{o.get("roles").controls.forEach(m=>{m.get("checked").value&&e.push(m.get("id").value)})}),e}onSubmit(){if(this.form.invalid){this.form.markAllAsTouched();return}let e={groupID:this.form.get("groupID").value,name:this.form.get("name").value,rolesID:this.getSelectedRoleIDs(),description:this.form.controls.description.value};this.service.assignGroupRole(e).pipe(M(()=>{this.router.navigate(["/pages/users/groups"])})).subscribe()}static{this.\u0275fac=(()=>{let e;return function(l){return(e||(e=D(t)))(l||t)}})()}static{this.\u0275cmp=P({type:t,selectors:[["app-group-form"]],features:[w],decls:5,vars:1,consts:[["actionButton",""],["content",""],["pageTitle","Group Form",3,"overflowScroll"],["label","Submit"],["label","Submit",3,"onClick"],[1,"d-flex","flex-column","gap-3","py-2"],[1,"d-flex","flex-column","gap-2",3,"formGroup"],["type","text","pInputText","","formControlName","name","placeholder","Group Name",3,"fluid","ngClass"],["value","0"],["value","1"],[2,"padding-left","0"],["formArrayName","roles",1,"container-fluid","d-flex","flex-column","row-gap-3"],[3,"formGroup"],["formControlName","description","fluid","","rows","5","cols","30","pTextarea",""],[1,"text-danger"],[1,"row","align-items-stretch",3,"formGroupName"],[1,"col-2","py-2","border-top","border-bottom","border-start","d-flex","justify-content-between",2,"background","#f6f6f6"],[1,"d-flex","justify-content-center","w-100"],[1,"text-dark","fw-semibold","fs-2"],["size","small","formControlName","groupChecked",3,"binary"],[1,"col","p-0"],["formArrayName","roles",1,"roles-grid","h-100"],["tooltipPosition","top",1,"role-cell",3,"formGroupName","pTooltip"],[1,"py-2","d-flex","h-100","align-items-center","gap-2","px-2"],["size","small","formControlName","checked",3,"binary"],[1,"fs-2","text-dark","m-0"]],template:function(o,l){o&1&&(i(0,"app-main-panel",2),R(1,Ne,1,1,"ng-template",null,0,G)(3,Oe,18,20,"ng-template",null,1,G),n()),o&2&&s("overflowScroll",!0)},dependencies:[fe,ne,ie,re,X,J,Q,W,te,ee,Y,Z,z,q,le,ae,Fe,ve,ye,xe,Ce,be,he,ge,se,pe,ce,me,ue,de],styles:["[_nghost-%COMP%]{display:block}[_nghost-%COMP%] .p-checkbox{display:flex!important}[_nghost-%COMP%] .p-tabs .p-tab{padding-left:0!important}[_nghost-%COMP%] .p-panel .p-panel-header{display:none!important}.roles-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(4,1fr)}.role-cell[_ngcontent-%COMP%]{border:1px solid #ddd;border-top:none;border-left:none;background:#fff}.roles-grid[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:nth-child(-n+4){border-top:1px solid #ddd}.roles-grid[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:nth-child(4n+1){border-left:1px solid #ddd}"],changeDetection:0})}}return t})();export{ft as GroupFormComponent};
@@ -1,4 +1,4 @@
1
- import{a as ne}from"./chunk-QTJQPJZS.js";import{f as Et}from"./chunk-AP2QQRNJ.js";import"./chunk-NNU2L44G.js";import{a as Dt}from"./chunk-KIJKVEX5.js";import{a as St}from"./chunk-XKI7WLHE.js";import{a as It}from"./chunk-7UYG2IJ5.js";import"./chunk-7R4NAOW3.js";import"./chunk-5TAKHYWV.js";import{m as ze}from"./chunk-SPDFU2FM.js";import"./chunk-IEOE2XJ7.js";import{a as ee,b as te}from"./chunk-YKC7ERDO.js";import{b as vt,g as yt,h as Tt,i as kt}from"./chunk-5NZPHAOL.js";import"./chunk-Y54QBXKN.js";import"./chunk-X2F5ZNTW.js";import"./chunk-ZULPRZ24.js";import"./chunk-BA72IEO2.js";import"./chunk-UEJR6B7A.js";import"./chunk-YYMD4TUO.js";import{b as Ct,c as xt}from"./chunk-R46SVYN4.js";import"./chunk-2LI4CEOF.js";import"./chunk-RAFKRDM2.js";import"./chunk-RUYPEXNQ.js";import"./chunk-4D6KKSM5.js";import"./chunk-BEEH5PAA.js";import{a as gt,b as wt,h as bt}from"./chunk-5FVLV36I.js";import{a as rt}from"./chunk-MTPMCC6U.js";import{a as pt,b as dt}from"./chunk-RO474VQ2.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import{b as E,c as mt,d as ct,e as ut,f as ft,g as _t,h as ht}from"./chunk-3BPX4XM7.js";import{D as st,H as Y,I as lt,b as Ke,c as Xe,d as B,g as Ye,h as et,k as tt,l as nt,o as O,t as it,w as ot,z as at}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import{Ka as fe,T as ce,V as Ze,Xa as Je,Ya as X,ab as We,c as K,e as $e,f as He,ga as ue,p as je,q as Ge,v as qe,y as Qe}from"./chunk-OQDKL2MG.js";import{b as Be,d as Oe,e as Ne}from"./chunk-7NZRUZLK.js";import"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-WNU7SPEQ.js";import{i as Z,l as J,n as Ae,q as Re,t as W}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{$ as we,$b as F,Ab as h,Ac as pe,Bc as de,Cc as me,Da as oe,Ic as Q,Jb as M,Jc as Ue,Kc as U,Mb as ae,Nb as se,Ob as L,Qb as P,Rb as A,Sb as p,Sc as Ve,T as z,Tb as l,Ub as s,Uc as Le,V as re,Vb as y,Wc as x,Zb as Te,_ as ge,_b as ke,_c as v,ac as k,ba as be,bd as R,c as N,da as b,db as a,fc as C,gc as d,hc as Ie,ic as Se,jc as De,ka as f,kc as Ee,la as _,lc as I,ld as D,ma as Ce,mc as S,md as Pe,qc as Me,sa as $,tc as G,ub as H,uc as le,vb as ve,vc as c,wa as V,wc as T,xc as q,yb as ye,za as xe,zb as j,zc as Fe}from"./chunk-T6YHDD6J.js";import{a as u,b as g}from"./chunk-PRARYYF3.js";var Lt={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:[]}}},_e=mt(ht("UserStore"),_t(Lt),ct(t=>({first:v(()=>(t.filter().pagination-1)*t.filter().pageSize+1),end:v(()=>Math.min(t.filter().pagination*t.filter().pageSize,t.count())),hasCheckedRows:v(()=>t.data().some(o=>o.checked)),checkedData:v(()=>t.data().filter(o=>o.checked).map(o=>o.userID)),selectedID:v(()=>t.data().find(o=>o.checked)?.userID||null)})),ft(t=>{let o=b(ne);return{setFilter(i){E(t,n=>g(u({},n),{filter:i}))},onRowSelect(i){E(t,n=>{let r=n.data.map(m=>m.userID===i.userID?g(u({},m),{checked:!0}):m);return g(u({},n),{data:r})})},onRowUnselect(i){E(t,n=>{let r=n.data.map(m=>m.userID===i.userID?g(u({},m),{checked:!1}):m);return g(u({},n),{data:r})})},onHeaderCheckboxToggle(i){let n=localStorage.getItem("AUTH_USERNAME");E(t,r=>{let m=r.data.map(w=>w.userName!==n?g(u({},w),{checked:i}):g(u({},w),{checked:!1}));return g(u({},r),{data:m})})},getUserLoader:ee(N(z(()=>o.getUserLoaderList().pipe(te({next:i=>{E(t,n=>g(u({},n),{meta:i}))},error:i=>{console.error("Failed to fetch user loader list:",i)}}))))),getUserFormMeta:ee(N(z(i=>o.getUserFormMeta(i).pipe(te({next:n=>{E(t,r=>g(u({},r),{metaForm:n}))},error:n=>{console.error("Failed to fetch user form meta:",n)}}))))),getUsers:ee(N(z(i=>o.getUsers(i).pipe(te({next:n=>{E(t,r=>g(u({},r),{data:n.data.map(m=>g(u({},m),{checked:!1})),count:n.count}))},error:n=>{console.error("Failed to fetch users:",n)}})))))}}),ut({onInit:t=>{t.getUserLoader(),t.getUsers(t.filter)}}));var Mt=`
1
+ import{a as ne}from"./chunk-QTJQPJZS.js";import{f as Et}from"./chunk-AP2QQRNJ.js";import"./chunk-NNU2L44G.js";import{a as Dt}from"./chunk-KIJKVEX5.js";import{a as St}from"./chunk-XKI7WLHE.js";import{a as It}from"./chunk-7UYG2IJ5.js";import"./chunk-7R4NAOW3.js";import"./chunk-5TAKHYWV.js";import{m as ze}from"./chunk-SPDFU2FM.js";import"./chunk-IEOE2XJ7.js";import{a as ee,b as te}from"./chunk-YKC7ERDO.js";import{b as vt,g as yt,h as Tt,i as kt}from"./chunk-5NZPHAOL.js";import"./chunk-Y54QBXKN.js";import"./chunk-X2F5ZNTW.js";import"./chunk-ZULPRZ24.js";import"./chunk-BA72IEO2.js";import"./chunk-UEJR6B7A.js";import"./chunk-YYMD4TUO.js";import{b as Ct,c as xt}from"./chunk-R46SVYN4.js";import"./chunk-2LI4CEOF.js";import"./chunk-RAFKRDM2.js";import"./chunk-RUYPEXNQ.js";import"./chunk-4D6KKSM5.js";import"./chunk-BEEH5PAA.js";import{a as gt,b as wt,h as bt}from"./chunk-URW7SXYE.js";import{a as rt}from"./chunk-MTPMCC6U.js";import{a as pt,b as dt}from"./chunk-RO474VQ2.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import{b as E,c as mt,d as ct,e as ut,f as ft,g as _t,h as ht}from"./chunk-3BPX4XM7.js";import{D as st,H as Y,I as lt,b as Ke,c as Xe,d as B,g as Ye,h as et,k as tt,l as nt,o as O,t as it,w as ot,z as at}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import{Ka as fe,T as ce,V as Ze,Xa as Je,Ya as X,ab as We,c as K,e as $e,f as He,ga as ue,p as je,q as Ge,v as qe,y as Qe}from"./chunk-OQDKL2MG.js";import{b as Be,d as Oe,e as Ne}from"./chunk-7NZRUZLK.js";import"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-T7VWZPHW.js";import{i as Z,l as J,n as Ae,q as Re,t as W}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{$ as we,$b as F,Ab as h,Ac as pe,Bc as de,Cc as me,Da as oe,Ic as Q,Jb as M,Jc as Ue,Kc as U,Mb as ae,Nb as se,Ob as L,Qb as P,Rb as A,Sb as p,Sc as Ve,T as z,Tb as l,Ub as s,Uc as Le,V as re,Vb as y,Wc as x,Zb as Te,_ as ge,_b as ke,_c as v,ac as k,ba as be,bd as R,c as N,da as b,db as a,fc as C,gc as d,hc as Ie,ic as Se,jc as De,ka as f,kc as Ee,la as _,lc as I,ld as D,ma as Ce,mc as S,md as Pe,qc as Me,sa as $,tc as G,ub as H,uc as le,vb as ve,vc as c,wa as V,wc as T,xc as q,yb as ye,za as xe,zb as j,zc as Fe}from"./chunk-T6YHDD6J.js";import{a as u,b as g}from"./chunk-PRARYYF3.js";var Lt={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:[]}}},_e=mt(ht("UserStore"),_t(Lt),ct(t=>({first:v(()=>(t.filter().pagination-1)*t.filter().pageSize+1),end:v(()=>Math.min(t.filter().pagination*t.filter().pageSize,t.count())),hasCheckedRows:v(()=>t.data().some(o=>o.checked)),checkedData:v(()=>t.data().filter(o=>o.checked).map(o=>o.userID)),selectedID:v(()=>t.data().find(o=>o.checked)?.userID||null)})),ft(t=>{let o=b(ne);return{setFilter(i){E(t,n=>g(u({},n),{filter:i}))},onRowSelect(i){E(t,n=>{let r=n.data.map(m=>m.userID===i.userID?g(u({},m),{checked:!0}):m);return g(u({},n),{data:r})})},onRowUnselect(i){E(t,n=>{let r=n.data.map(m=>m.userID===i.userID?g(u({},m),{checked:!1}):m);return g(u({},n),{data:r})})},onHeaderCheckboxToggle(i){let n=localStorage.getItem("AUTH_USERNAME");E(t,r=>{let m=r.data.map(w=>w.userName!==n?g(u({},w),{checked:i}):g(u({},w),{checked:!1}));return g(u({},r),{data:m})})},getUserLoader:ee(N(z(()=>o.getUserLoaderList().pipe(te({next:i=>{E(t,n=>g(u({},n),{meta:i}))},error:i=>{console.error("Failed to fetch user loader list:",i)}}))))),getUserFormMeta:ee(N(z(i=>o.getUserFormMeta(i).pipe(te({next:n=>{E(t,r=>g(u({},r),{metaForm:n}))},error:n=>{console.error("Failed to fetch user form meta:",n)}}))))),getUsers:ee(N(z(i=>o.getUsers(i).pipe(te({next:n=>{E(t,r=>g(u({},r),{data:n.data.map(m=>g(u({},m),{checked:!1})),count:n.count}))},error:n=>{console.error("Failed to fetch users:",n)}})))))}}),ut({onInit:t=>{t.getUserLoader(),t.getUsers(t.filter)}}));var Mt=`
2
2
  .p-drawer {
3
3
  display: flex;
4
4
  flex-direction: column;
@@ -1 +1 @@
1
- import{a as U}from"./chunk-XZGQHWLM.js";import"./chunk-OS646RNF.js";import{a as W}from"./chunk-7R4NAOW3.js";import"./chunk-5TAKHYWV.js";import{b as K,i as Q}from"./chunk-5NZPHAOL.js";import"./chunk-Y54QBXKN.js";import"./chunk-X2F5ZNTW.js";import"./chunk-ZULPRZ24.js";import"./chunk-BA72IEO2.js";import"./chunk-UEJR6B7A.js";import"./chunk-YYMD4TUO.js";import"./chunk-R46SVYN4.js";import"./chunk-2LI4CEOF.js";import"./chunk-RAFKRDM2.js";import"./chunk-RUYPEXNQ.js";import"./chunk-4D6KKSM5.js";import"./chunk-BEEH5PAA.js";import{h as A}from"./chunk-5FVLV36I.js";import"./chunk-MTPMCC6U.js";import{a as G}from"./chunk-RO474VQ2.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import"./chunk-3BPX4XM7.js";import"./chunk-U2ZZPRP6.js";import{a as O}from"./chunk-7C7GSAC3.js";import"./chunk-OQDKL2MG.js";import{e as H}from"./chunk-7NZRUZLK.js";import{a as V}from"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-WNU7SPEQ.js";import{i as L,q as B,r as F,t as $}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{Ab as S,Jc as N,Kc as J,Lc as z,Mb as g,Nb as x,Sb as c,Sc as s,T as w,Tb as i,Tc as R,Ub as n,Uc as d,V as E,Vb as C,Wc as u,_ as D,_c as y,ac as P,da as _,db as l,fc as T,gc as p,ka as M,la as q,ub as I,vc as a,wa as f,wc as m,xc as v,zc as k}from"./chunk-T6YHDD6J.js";import{a as b,b as h}from"./chunk-PRARYYF3.js";var X=(()=>{class t{constructor(){this.httpService=_(V)}getJournalJobList(e={}){let o={params:{page:e.page,pageSize:e.pageSize}};return this.httpService.get(void 0,"api/JournalSquash/GetListSquashJob",o)}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275prov=D({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var ee=()=>({"min-width":"50rem"}),te=t=>["/pages/tools/journal-squash-job-detail",t],ne=(t,r)=>({"bg-success":t,"bg-danger":r}),ie=t=>["/pages/journal/journal-entry/",t];function ae(t,r){t&1&&(i(0,"tr")(1,"th"),a(2,"Job ID"),n(),i(3,"th"),a(4,"Date"),n(),i(5,"th"),a(6,"Message"),n(),i(7,"th"),a(8,"Duration"),n(),i(9,"th"),a(10,"Creator"),n()())}function oe(t,r){if(t&1&&(i(0,"div",12)(1,"a",17),a(2),n()()),t&2){let e=p().$implicit;l(),c("routerLink",J(2,ie,e.id)),l(),m(e.journalNumber)}}function le(t,r){if(t&1&&(i(0,"span"),a(1),s(2,"number"),n()),t&2){let e=p().$implicit,o=p(3);l(),v("",d(2,1,o.dayjsService.from(o.now()).diff(e.created,"second"),"1.1-1")," s")}}function re(t,r){if(t&1&&(i(0,"span"),a(1),s(2,"number"),n()),t&2){let e=p().$implicit;l(),v("",d(2,1,e.duration/1e3,"1.1-1")," s")}}function pe(t,r){if(t&1&&(i(0,"tr")(1,"td")(2,"a",8),a(3),n()(),i(4,"td")(5,"div",9)(6,"span"),a(7),s(8,"date"),n(),i(9,"span"),a(10,"-"),n(),i(11,"span"),a(12),s(13,"date"),n()()(),i(14,"td")(15,"div",10)(16,"div",11)(17,"span"),a(18),s(19,"number"),n(),i(20,"span"),a(21,"Journal"),n()(),g(22,oe,3,4,"div",12),n()(),i(23,"td",13)(24,"div",14),g(25,le,3,4,"span")(26,re,3,4,"span"),C(27,"p-chip",15),n()(),i(28,"td")(29,"div",16)(30,"span"),a(31),n(),i(32,"span"),a(33),s(34,"date"),n()()()()),t&2){let e=r.$implicit;l(2),c("routerLink",J(22,te,e.id)),l(),m(e.id),l(4),m(d(8,11,e.from,"d")),l(5),m(d(13,14,e.to,"d MMM y")),l(6),m(R(19,17,e.journalCount)),l(4),x(e.journalNumber?22:-1),l(3),x(e.status!==2?25:26),l(2),c("label",e.statusString)("ngClass",z(24,ne,e.status===2,e.status!==2)),l(4),m(e.creator),l(2),m(d(34,19,e.created,"d MMM y hh:mm"))}}function me(t,r){if(t&1&&a(0),t&2){let e=p(3);k(" Showing ",e.first()," to ",e.end()," of ",e.journalJobData().count," entries ")}}function se(t,r){t&1&&(i(0,"tr")(1,"td",18),C(2,"span"),a(3," No squash jobs found. "),n()())}function ce(t,r){if(t&1){let e=P();i(0,"p-table",7),T("onPage",function(j){M(e);let Y=p(2);return q(Y.onPageHandler(j))}),S(1,ae,11,0,"ng-template",null,1,u)(3,pe,35,27,"ng-template",null,2,u)(5,me,1,3,"ng-template",null,3,u)(7,se,4,0,"ng-template",null,4,u),n()}if(t&2){let e=p(2);c("lazy",!0)("paginator",!0)("rows",e.params().pageSize)("tableStyle",N(6,ee))("totalRecords",e.journalJobData().count)("value",e.journalJobData().data)}}function de(t,r){if(t&1&&(i(0,"p-panel"),g(1,ce,9,7,"p-table",6),n()),t&2){let e=p();l(),x(e.journalJobData()?1:-1)}}var Ie=(()=>{class t{constructor(){this.journalJobData=f(null),this.inf=1/0,this.count=f(-1),this.params=f({page:1,pageSize:20}),this.first=y(()=>(this.params().page-1)*this.params().pageSize+1),this.end=y(()=>this.first()+this.params().pageSize-1),this.dayjsService=_(U),this.now=f(new Date),this.journalJobService=_(X),O(this.params).pipe(w(e=>this.journalJobService.getJournalJobList(e)),E(e=>this.journalJobData.set(e))).subscribe()}onPageHandler(e){console.log(e);let o=e.first/e.rows;this.onPageChange(o+1)}onPageChange(e){this.params.update(o=>h(b({},o),{page:e}))}onPageSizeChange(e){this.params.update(o=>h(b({},o),{pageSize:e,page:1}))}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=I({type:t,selectors:[["app-squash-job"]],decls:3,vars:1,consts:[["content",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["pageTitle","Journal Squash Job",3,"scrollable"],["styleClass","d-flex flex-column justify-content-between h-100",3,"lazy","paginator","rows","tableStyle","totalRecords","value"],["styleClass","d-flex flex-column justify-content-between h-100",3,"onPage","lazy","paginator","rows","tableStyle","totalRecords","value"],["target","_blank",1,"link-primary","fs-2",3,"routerLink"],[1,"d-flex","align-items-center","gap-2","fw-normal","fs-2"],[1,"d-flex","gap-2","flex-column","fw-normal","fs-2"],[1,"d-flex","align-items-center","gap-2"],[1,"d-flex"],[1,"fw-normal"],[1,"d-flex","flex-column","align-items-start","fs-2"],[1,"py-1","px-2","text-white",3,"label","ngClass"],[1,"d-flex","flex-column","fw-normal","fs-2"],["target","_blank",1,"link","link-primary",3,"routerLink"],["colspan","6"]],template:function(o,j){o&1&&(i(0,"app-main-panel",5),S(1,de,2,1,"ng-template",null,0,u),n()),o&2&&c("scrollable",!0)},dependencies:[A,$,L,G,Q,K,H,W,F,B],encapsulation:2})}}return t})();export{Ie as SquashJobComponent};
1
+ import{a as U}from"./chunk-K32QD3HY.js";import"./chunk-OS646RNF.js";import{a as W}from"./chunk-7R4NAOW3.js";import"./chunk-5TAKHYWV.js";import{b as K,i as Q}from"./chunk-5NZPHAOL.js";import"./chunk-Y54QBXKN.js";import"./chunk-X2F5ZNTW.js";import"./chunk-ZULPRZ24.js";import"./chunk-BA72IEO2.js";import"./chunk-UEJR6B7A.js";import"./chunk-YYMD4TUO.js";import"./chunk-R46SVYN4.js";import"./chunk-2LI4CEOF.js";import"./chunk-RAFKRDM2.js";import"./chunk-RUYPEXNQ.js";import"./chunk-4D6KKSM5.js";import"./chunk-BEEH5PAA.js";import{h as A}from"./chunk-URW7SXYE.js";import"./chunk-MTPMCC6U.js";import{a as G}from"./chunk-RO474VQ2.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import"./chunk-3BPX4XM7.js";import"./chunk-U2ZZPRP6.js";import{a as O}from"./chunk-7C7GSAC3.js";import"./chunk-OQDKL2MG.js";import{e as H}from"./chunk-7NZRUZLK.js";import{a as V}from"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-T7VWZPHW.js";import{i as L,q as B,r as F,t as $}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{Ab as S,Jc as N,Kc as J,Lc as z,Mb as g,Nb as x,Sb as c,Sc as s,T as w,Tb as i,Tc as R,Ub as n,Uc as d,V as E,Vb as C,Wc as u,_ as D,_c as y,ac as P,da as _,db as l,fc as T,gc as p,ka as M,la as q,ub as I,vc as a,wa as f,wc as m,xc as v,zc as k}from"./chunk-T6YHDD6J.js";import{a as b,b as h}from"./chunk-PRARYYF3.js";var X=(()=>{class t{constructor(){this.httpService=_(V)}getJournalJobList(e={}){let o={params:{page:e.page,pageSize:e.pageSize}};return this.httpService.get(void 0,"api/JournalSquash/GetListSquashJob",o)}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275prov=D({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var ee=()=>({"min-width":"50rem"}),te=t=>["/pages/tools/journal-squash-job-detail",t],ne=(t,r)=>({"bg-success":t,"bg-danger":r}),ie=t=>["/pages/journal/journal-entry/",t];function ae(t,r){t&1&&(i(0,"tr")(1,"th"),a(2,"Job ID"),n(),i(3,"th"),a(4,"Date"),n(),i(5,"th"),a(6,"Message"),n(),i(7,"th"),a(8,"Duration"),n(),i(9,"th"),a(10,"Creator"),n()())}function oe(t,r){if(t&1&&(i(0,"div",12)(1,"a",17),a(2),n()()),t&2){let e=p().$implicit;l(),c("routerLink",J(2,ie,e.id)),l(),m(e.journalNumber)}}function le(t,r){if(t&1&&(i(0,"span"),a(1),s(2,"number"),n()),t&2){let e=p().$implicit,o=p(3);l(),v("",d(2,1,o.dayjsService.from(o.now()).diff(e.created,"second"),"1.1-1")," s")}}function re(t,r){if(t&1&&(i(0,"span"),a(1),s(2,"number"),n()),t&2){let e=p().$implicit;l(),v("",d(2,1,e.duration/1e3,"1.1-1")," s")}}function pe(t,r){if(t&1&&(i(0,"tr")(1,"td")(2,"a",8),a(3),n()(),i(4,"td")(5,"div",9)(6,"span"),a(7),s(8,"date"),n(),i(9,"span"),a(10,"-"),n(),i(11,"span"),a(12),s(13,"date"),n()()(),i(14,"td")(15,"div",10)(16,"div",11)(17,"span"),a(18),s(19,"number"),n(),i(20,"span"),a(21,"Journal"),n()(),g(22,oe,3,4,"div",12),n()(),i(23,"td",13)(24,"div",14),g(25,le,3,4,"span")(26,re,3,4,"span"),C(27,"p-chip",15),n()(),i(28,"td")(29,"div",16)(30,"span"),a(31),n(),i(32,"span"),a(33),s(34,"date"),n()()()()),t&2){let e=r.$implicit;l(2),c("routerLink",J(22,te,e.id)),l(),m(e.id),l(4),m(d(8,11,e.from,"d")),l(5),m(d(13,14,e.to,"d MMM y")),l(6),m(R(19,17,e.journalCount)),l(4),x(e.journalNumber?22:-1),l(3),x(e.status!==2?25:26),l(2),c("label",e.statusString)("ngClass",z(24,ne,e.status===2,e.status!==2)),l(4),m(e.creator),l(2),m(d(34,19,e.created,"d MMM y hh:mm"))}}function me(t,r){if(t&1&&a(0),t&2){let e=p(3);k(" Showing ",e.first()," to ",e.end()," of ",e.journalJobData().count," entries ")}}function se(t,r){t&1&&(i(0,"tr")(1,"td",18),C(2,"span"),a(3," No squash jobs found. "),n()())}function ce(t,r){if(t&1){let e=P();i(0,"p-table",7),T("onPage",function(j){M(e);let Y=p(2);return q(Y.onPageHandler(j))}),S(1,ae,11,0,"ng-template",null,1,u)(3,pe,35,27,"ng-template",null,2,u)(5,me,1,3,"ng-template",null,3,u)(7,se,4,0,"ng-template",null,4,u),n()}if(t&2){let e=p(2);c("lazy",!0)("paginator",!0)("rows",e.params().pageSize)("tableStyle",N(6,ee))("totalRecords",e.journalJobData().count)("value",e.journalJobData().data)}}function de(t,r){if(t&1&&(i(0,"p-panel"),g(1,ce,9,7,"p-table",6),n()),t&2){let e=p();l(),x(e.journalJobData()?1:-1)}}var Ie=(()=>{class t{constructor(){this.journalJobData=f(null),this.inf=1/0,this.count=f(-1),this.params=f({page:1,pageSize:20}),this.first=y(()=>(this.params().page-1)*this.params().pageSize+1),this.end=y(()=>this.first()+this.params().pageSize-1),this.dayjsService=_(U),this.now=f(new Date),this.journalJobService=_(X),O(this.params).pipe(w(e=>this.journalJobService.getJournalJobList(e)),E(e=>this.journalJobData.set(e))).subscribe()}onPageHandler(e){console.log(e);let o=e.first/e.rows;this.onPageChange(o+1)}onPageChange(e){this.params.update(o=>h(b({},o),{page:e}))}onPageSizeChange(e){this.params.update(o=>h(b({},o),{pageSize:e,page:1}))}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=I({type:t,selectors:[["app-squash-job"]],decls:3,vars:1,consts:[["content",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["pageTitle","Journal Squash Job",3,"scrollable"],["styleClass","d-flex flex-column justify-content-between h-100",3,"lazy","paginator","rows","tableStyle","totalRecords","value"],["styleClass","d-flex flex-column justify-content-between h-100",3,"onPage","lazy","paginator","rows","tableStyle","totalRecords","value"],["target","_blank",1,"link-primary","fs-2",3,"routerLink"],[1,"d-flex","align-items-center","gap-2","fw-normal","fs-2"],[1,"d-flex","gap-2","flex-column","fw-normal","fs-2"],[1,"d-flex","align-items-center","gap-2"],[1,"d-flex"],[1,"fw-normal"],[1,"d-flex","flex-column","align-items-start","fs-2"],[1,"py-1","px-2","text-white",3,"label","ngClass"],[1,"d-flex","flex-column","fw-normal","fs-2"],["target","_blank",1,"link","link-primary",3,"routerLink"],["colspan","6"]],template:function(o,j){o&1&&(i(0,"app-main-panel",5),S(1,de,2,1,"ng-template",null,0,u),n()),o&2&&c("scrollable",!0)},dependencies:[A,$,L,G,Q,K,H,W,F,B],encapsulation:2})}}return t})();export{Ie as SquashJobComponent};
@@ -1 +1 @@
1
- import{a as y,b as K}from"./chunk-3MU7BZQU.js";import"./chunk-XZGQHWLM.js";import"./chunk-OS646RNF.js";import{m as j}from"./chunk-SPDFU2FM.js";import"./chunk-IEOE2XJ7.js";import{a as R,b as D}from"./chunk-OVMM5CPY.js";import"./chunk-KG3OLRKU.js";import{h as J}from"./chunk-5FVLV36I.js";import"./chunk-MTPMCC6U.js";import{a as H,b as L}from"./chunk-RO474VQ2.js";import"./chunk-E4FUCIJZ.js";import"./chunk-3BPX4XM7.js";import{H as N,I as G,J as q,K as z}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import"./chunk-OQDKL2MG.js";import"./chunk-WDFE7CAE.js";import{a as V}from"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-WNU7SPEQ.js";import{o as E,t as I}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{Ab as $,Ic as F,Jc as b,Mb as _,Nb as h,R as M,Sb as p,Sc as l,T as k,Tb as o,Tc as s,Ub as n,V as w,Vb as u,Wc as S,ac as x,da as m,db as r,f as A,fc as v,gc as a,ka as g,la as C,ma as B,na as O,s as d,tc as T,ub as P}from"./chunk-T6YHDD6J.js";import"./chunk-PRARYYF3.js";var Q=()=>({height:"calc(100vh - 100px)"});function U(e,f){if(e&1){let t=x();o(0,"p-button",6),v("onClick",function(){g(t);let c=a(2);return C(c.onFormatCOA())}),n()}}function W(e,f){if(e&1){let t=x();o(0,"p-button",7),l(1,"async"),l(2,"async"),v("onClick",function(){g(t);let c=a(2);return C(c.onMigrateCoaAccount())}),n()}if(e&2){let t=a(2);p("disabled",s(1,2,t.countInBooks$)!==0)("pTooltip",s(2,4,t.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function X(e,f){if(e&1&&(o(0,"div",3),_(1,U,1,0,"p-button",4),_(2,W,3,6,"p-button",5),n()),e&2){let t=a();r(),h(t.roleService.permissions().migrate.delete?1:-1),r(),h(t.roleService.permissions().migrate.create?2:-1)}}function Y(e,f){if(e&1&&(o(0,"p-scroll-panel")(1,"p-panel")(2,"div",8),u(3,"app-migration-cards",9),l(4,"async"),B(),o(5,"svg",10),u(6,"path",11),n(),O(),u(7,"app-migration-cards",12),l(8,"async"),n()()()),e&2){let t=a();T(b(12,Q)),r(),T(b(13,Q)),r(2),p("migrationCount",s(4,8,t.countInPOS$))("migrationTitle",t.pageTitle),r(4),p("migrationCount",s(8,10,t.countInBooks$))("migrationTitle",t.pageTitle)}}var vt=(()=>{class e{constructor(){this.migrateService=m(y),this.toastr=m(V),this.refresh$=new A(void 0),this.pageTitle="Chart of Account",this.roleService=m(j)}ngOnInit(){let t=this.refresh$.pipe(k(()=>this.migrateService.getCOACount()),w(i=>console.log("API response:",i)),M(1));this.countInPOS$=t.pipe(d(i=>Number(i.pos))),this.countInBooks$=t.pipe(d(i=>Number(i.books)))}onMigrateCoaAccount(){this.migrateService.migrateCoaAccount().subscribe(t=>{this.refresh$.next(),this.toastr.success(t.message,"Migration Successful")})}onFormatCOA(){window.confirm("Are you sure you want to format this data? This action cannot be undone.")&&this.migrateService.formatManualCOA().subscribe(i=>{this.refresh$.next(),this.toastr.success(i.message,"Format Successful")})}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=P({type:e,selectors:[["app-chart-of-account"]],features:[F([y])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger"],["label","Create","tooltipPosition","left",3,"disabled","pTooltip"],["label","Format","severity","danger",3,"onClick"],["label","Create","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(i,c){i&1&&(o(0,"app-main-panel",2),$(1,X,3,2,"ng-template",null,0,S)(3,Y,9,14,"ng-template",null,1,S),n()),i&2&&p("pageTitle",c.pageTitle)},dependencies:[J,I,K,G,N,D,R,L,H,z,q,E],encapsulation:2})}}return e})();export{vt as ChartOfAccountComponent};
1
+ import{a as y,b as K}from"./chunk-OSGJ7FIK.js";import"./chunk-K32QD3HY.js";import"./chunk-OS646RNF.js";import{m as j}from"./chunk-SPDFU2FM.js";import"./chunk-IEOE2XJ7.js";import{a as R,b as D}from"./chunk-OVMM5CPY.js";import"./chunk-KG3OLRKU.js";import{h as J}from"./chunk-URW7SXYE.js";import"./chunk-MTPMCC6U.js";import{a as H,b as L}from"./chunk-RO474VQ2.js";import"./chunk-E4FUCIJZ.js";import"./chunk-3BPX4XM7.js";import{H as N,I as G,J as q,K as z}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import"./chunk-OQDKL2MG.js";import"./chunk-WDFE7CAE.js";import{a as V}from"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-T7VWZPHW.js";import{o as E,t as I}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{Ab as $,Ic as F,Jc as b,Mb as _,Nb as h,R as M,Sb as p,Sc as l,T as k,Tb as o,Tc as s,Ub as n,V as w,Vb as u,Wc as S,ac as x,da as m,db as r,f as A,fc as v,gc as a,ka as g,la as C,ma as B,na as O,s as d,tc as T,ub as P}from"./chunk-T6YHDD6J.js";import"./chunk-PRARYYF3.js";var Q=()=>({height:"calc(100vh - 100px)"});function U(e,f){if(e&1){let t=x();o(0,"p-button",6),v("onClick",function(){g(t);let c=a(2);return C(c.onFormatCOA())}),n()}}function W(e,f){if(e&1){let t=x();o(0,"p-button",7),l(1,"async"),l(2,"async"),v("onClick",function(){g(t);let c=a(2);return C(c.onMigrateCoaAccount())}),n()}if(e&2){let t=a(2);p("disabled",s(1,2,t.countInBooks$)!==0)("pTooltip",s(2,4,t.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function X(e,f){if(e&1&&(o(0,"div",3),_(1,U,1,0,"p-button",4),_(2,W,3,6,"p-button",5),n()),e&2){let t=a();r(),h(t.roleService.permissions().migrate.delete?1:-1),r(),h(t.roleService.permissions().migrate.create?2:-1)}}function Y(e,f){if(e&1&&(o(0,"p-scroll-panel")(1,"p-panel")(2,"div",8),u(3,"app-migration-cards",9),l(4,"async"),B(),o(5,"svg",10),u(6,"path",11),n(),O(),u(7,"app-migration-cards",12),l(8,"async"),n()()()),e&2){let t=a();T(b(12,Q)),r(),T(b(13,Q)),r(2),p("migrationCount",s(4,8,t.countInPOS$))("migrationTitle",t.pageTitle),r(4),p("migrationCount",s(8,10,t.countInBooks$))("migrationTitle",t.pageTitle)}}var vt=(()=>{class e{constructor(){this.migrateService=m(y),this.toastr=m(V),this.refresh$=new A(void 0),this.pageTitle="Chart of Account",this.roleService=m(j)}ngOnInit(){let t=this.refresh$.pipe(k(()=>this.migrateService.getCOACount()),w(i=>console.log("API response:",i)),M(1));this.countInPOS$=t.pipe(d(i=>Number(i.pos))),this.countInBooks$=t.pipe(d(i=>Number(i.books)))}onMigrateCoaAccount(){this.migrateService.migrateCoaAccount().subscribe(t=>{this.refresh$.next(),this.toastr.success(t.message,"Migration Successful")})}onFormatCOA(){window.confirm("Are you sure you want to format this data? This action cannot be undone.")&&this.migrateService.formatManualCOA().subscribe(i=>{this.refresh$.next(),this.toastr.success(i.message,"Format Successful")})}static{this.\u0275fac=function(i){return new(i||e)}}static{this.\u0275cmp=P({type:e,selectors:[["app-chart-of-account"]],features:[F([y])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger"],["label","Create","tooltipPosition","left",3,"disabled","pTooltip"],["label","Format","severity","danger",3,"onClick"],["label","Create","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(i,c){i&1&&(o(0,"app-main-panel",2),$(1,X,3,2,"ng-template",null,0,S)(3,Y,9,14,"ng-template",null,1,S),n()),i&2&&p("pageTitle",c.pageTitle)},dependencies:[J,I,K,G,N,D,R,L,H,z,q,E],encapsulation:2})}}return e})();export{vt as ChartOfAccountComponent};
@@ -1 +1 @@
1
- import{a as y,b as K}from"./chunk-3MU7BZQU.js";import"./chunk-XZGQHWLM.js";import"./chunk-OS646RNF.js";import{m as R}from"./chunk-SPDFU2FM.js";import"./chunk-IEOE2XJ7.js";import{a as O,b as D}from"./chunk-OVMM5CPY.js";import"./chunk-KG3OLRKU.js";import{h as J}from"./chunk-5FVLV36I.js";import"./chunk-MTPMCC6U.js";import{a as H,b as L}from"./chunk-RO474VQ2.js";import"./chunk-E4FUCIJZ.js";import"./chunk-3BPX4XM7.js";import{H as N,I as G,J as q,K as z}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import"./chunk-OQDKL2MG.js";import"./chunk-WDFE7CAE.js";import{a as j}from"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-WNU7SPEQ.js";import{o as I,t as V}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{Ab as F,Ic as E,Jc as S,Mb as x,Nb as C,R as k,Sb as c,Sc as l,T as A,Tb as n,Tc as s,Ub as o,V as B,Vb as u,Wc as b,ac as T,da as m,db as r,f as M,fc as h,gc as a,ka as g,la as _,ma as P,na as w,s as f,tc as v,ub as $}from"./chunk-T6YHDD6J.js";import"./chunk-PRARYYF3.js";var Q=()=>({height:"calc(100vh - 100px)"});function U(t,d){if(t&1){let e=T();n(0,"p-button",6),h("onClick",function(){g(e);let p=a(2);return _(p.onFormat())}),o()}}function W(t,d){if(t&1){let e=T();n(0,"p-button",7),l(1,"async"),l(2,"async"),h("onClick",function(){g(e);let p=a(2);return _(p.onMigrate())}),o()}if(t&2){let e=a(2);c("disabled",s(1,2,e.countInBooks$)!==0)("pTooltip",s(2,4,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function X(t,d){if(t&1&&(n(0,"div",3),x(1,U,1,0,"p-button",4),x(2,W,3,6,"p-button",5),o()),t&2){let e=a();r(),C(e.roleService.permissions().migrate.delete?1:-1),r(),C(e.roleService.permissions().migrate.create?2:-1)}}function Y(t,d){if(t&1&&(n(0,"p-scroll-panel")(1,"p-panel")(2,"div",8),u(3,"app-migration-cards",9),l(4,"async"),P(),n(5,"svg",10),u(6,"path",11),o(),w(),u(7,"app-migration-cards",12),l(8,"async"),o()()()),t&2){let e=a();v(S(12,Q)),r(),v(S(13,Q)),r(2),c("migrationCount",s(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),r(4),c("migrationCount",s(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var Ce=(()=>{class t{constructor(){this.migrateService=m(y),this.toastr=m(j),this.refresh$=new M(void 0),this.pageTitle="Tax Account",this.roleService=m(R)}ngOnInit(){let e=this.refresh$.pipe(A(()=>this.migrateService.getTaxAccountCount()),B(i=>console.log("API response:",i)),k(1));this.countInPOS$=e.pipe(f(i=>Number(i.pos))),this.countInBooks$=e.pipe(f(i=>Number(i.books)))}onMigrate(){this.migrateService.migrateTaxAccount().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormat(){confirm("Are you sure you want to format?")&&this.migrateService.formatTaxAccount().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Format Successful")})}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=$({type:t,selectors:[["app-tax-account"]],features:[E([y])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger"],["label","Create","tooltipPosition","left",3,"disabled","pTooltip"],["label","Format","severity","danger",3,"onClick"],["label","Create","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(i,p){i&1&&(n(0,"app-main-panel",2),F(1,X,3,2,"ng-template",null,0,b)(3,Y,9,14,"ng-template",null,1,b),o()),i&2&&c("pageTitle",p.pageTitle)},dependencies:[J,V,D,O,L,H,z,q,K,G,N,I],encapsulation:2})}}return t})();export{Ce as TaxAccountComponent};
1
+ import{a as y,b as K}from"./chunk-OSGJ7FIK.js";import"./chunk-K32QD3HY.js";import"./chunk-OS646RNF.js";import{m as R}from"./chunk-SPDFU2FM.js";import"./chunk-IEOE2XJ7.js";import{a as O,b as D}from"./chunk-OVMM5CPY.js";import"./chunk-KG3OLRKU.js";import{h as J}from"./chunk-URW7SXYE.js";import"./chunk-MTPMCC6U.js";import{a as H,b as L}from"./chunk-RO474VQ2.js";import"./chunk-E4FUCIJZ.js";import"./chunk-3BPX4XM7.js";import{H as N,I as G,J as q,K as z}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import"./chunk-OQDKL2MG.js";import"./chunk-WDFE7CAE.js";import{a as j}from"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-T7VWZPHW.js";import{o as I,t as V}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{Ab as F,Ic as E,Jc as S,Mb as x,Nb as C,R as k,Sb as c,Sc as l,T as A,Tb as n,Tc as s,Ub as o,V as B,Vb as u,Wc as b,ac as T,da as m,db as r,f as M,fc as h,gc as a,ka as g,la as _,ma as P,na as w,s as f,tc as v,ub as $}from"./chunk-T6YHDD6J.js";import"./chunk-PRARYYF3.js";var Q=()=>({height:"calc(100vh - 100px)"});function U(t,d){if(t&1){let e=T();n(0,"p-button",6),h("onClick",function(){g(e);let p=a(2);return _(p.onFormat())}),o()}}function W(t,d){if(t&1){let e=T();n(0,"p-button",7),l(1,"async"),l(2,"async"),h("onClick",function(){g(e);let p=a(2);return _(p.onMigrate())}),o()}if(t&2){let e=a(2);c("disabled",s(1,2,e.countInBooks$)!==0)("pTooltip",s(2,4,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function X(t,d){if(t&1&&(n(0,"div",3),x(1,U,1,0,"p-button",4),x(2,W,3,6,"p-button",5),o()),t&2){let e=a();r(),C(e.roleService.permissions().migrate.delete?1:-1),r(),C(e.roleService.permissions().migrate.create?2:-1)}}function Y(t,d){if(t&1&&(n(0,"p-scroll-panel")(1,"p-panel")(2,"div",8),u(3,"app-migration-cards",9),l(4,"async"),P(),n(5,"svg",10),u(6,"path",11),o(),w(),u(7,"app-migration-cards",12),l(8,"async"),o()()()),t&2){let e=a();v(S(12,Q)),r(),v(S(13,Q)),r(2),c("migrationCount",s(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),r(4),c("migrationCount",s(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var Ce=(()=>{class t{constructor(){this.migrateService=m(y),this.toastr=m(j),this.refresh$=new M(void 0),this.pageTitle="Tax Account",this.roleService=m(R)}ngOnInit(){let e=this.refresh$.pipe(A(()=>this.migrateService.getTaxAccountCount()),B(i=>console.log("API response:",i)),k(1));this.countInPOS$=e.pipe(f(i=>Number(i.pos))),this.countInBooks$=e.pipe(f(i=>Number(i.books)))}onMigrate(){this.migrateService.migrateTaxAccount().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormat(){confirm("Are you sure you want to format?")&&this.migrateService.formatTaxAccount().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Format Successful")})}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=$({type:t,selectors:[["app-tax-account"]],features:[E([y])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger"],["label","Create","tooltipPosition","left",3,"disabled","pTooltip"],["label","Format","severity","danger",3,"onClick"],["label","Create","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(i,p){i&1&&(n(0,"app-main-panel",2),F(1,X,3,2,"ng-template",null,0,b)(3,Y,9,14,"ng-template",null,1,b),o()),i&2&&c("pageTitle",p.pageTitle)},dependencies:[J,V,D,O,L,H,z,q,K,G,N,I],encapsulation:2})}}return t})();export{Ce as TaxAccountComponent};
@@ -1 +1 @@
1
- import"./chunk-PRARYYF3.js";var t=[{path:"",redirectTo:"users",pathMatch:"full"},{path:"",children:[{path:"users",loadComponent:()=>import("./chunk-DV6F4QO2.js").then(o=>o.UserPageComponent)},{path:"groups",loadComponent:()=>import("./chunk-CTGNW5L6.js").then(o=>o.GroupPageComponent)},{path:"groups/forms",loadComponent:()=>import("./chunk-UG22TPCX.js").then(o=>o.GroupFormComponent)}]}];export{t as USERS_ROUTES};
1
+ import"./chunk-PRARYYF3.js";var t=[{path:"",redirectTo:"users",pathMatch:"full"},{path:"",children:[{path:"users",loadComponent:()=>import("./chunk-B3O26J3M.js").then(o=>o.UserPageComponent)},{path:"groups",loadComponent:()=>import("./chunk-UOXEXJ2S.js").then(o=>o.GroupPageComponent)},{path:"groups/forms",loadComponent:()=>import("./chunk-AZBEWVID.js").then(o=>o.GroupFormComponent)}]}];export{t as USERS_ROUTES};
@@ -1 +1 @@
1
- import{a as i}from"./chunk-SGZKLLJ3.js";import{d as r}from"./chunk-7NZRUZLK.js";import{da as e}from"./chunk-T6YHDD6J.js";var f=(a,o)=>{let t=e(i),s=e(r),n=t.isAuthenticated(),u=!t.isTokenExpired(),c=t.checkAuthKeysExists();return!n||!u||!c?(s.navigate(["/"],{queryParams:{returnUrl:o.url}}),!1):!0};export{f as a};
1
+ import{a as i}from"./chunk-3ZUNX7VU.js";import{d as r}from"./chunk-7NZRUZLK.js";import{da as e}from"./chunk-T6YHDD6J.js";var f=(a,o)=>{let t=e(i),s=e(r),n=t.isAuthenticated(),u=!t.isTokenExpired(),c=t.checkAuthKeysExists();return!n||!u||!c?(s.navigate(["/"],{queryParams:{returnUrl:o.url}}),!1):!0};export{f as a};