dealposbooks 6.1.2 → 6.1.4

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-3ZUNX7VU.js → chunk-24XESN42.js} +1 -1
  2. package/{chunk-NMOIUA6X.js → chunk-26DZRM4N.js} +1 -1
  3. package/{chunk-AZBEWVID.js → chunk-2VS3VSU7.js} +1 -1
  4. package/{chunk-QJD5K4TQ.js → chunk-45VMXAZC.js} +1 -1
  5. package/{chunk-YDWQDJEA.js → chunk-47JE7N7K.js} +1 -1
  6. package/{chunk-JSCEZN7L.js → chunk-4BU6GDWG.js} +1 -1
  7. package/{chunk-SBY42MRN.js → chunk-5TNLXZA4.js} +1 -1
  8. package/{chunk-FFTAVKXN.js → chunk-5Z3KG4UC.js} +2 -2
  9. package/{chunk-IV6U6FEE.js → chunk-6G7QHM2A.js} +1 -1
  10. package/{chunk-KX5T5GT4.js → chunk-6N2ZPIVB.js} +1 -1
  11. package/{chunk-ITZG65LC.js → chunk-6N4NLYL5.js} +1 -1
  12. package/{chunk-SL4B7NII.js → chunk-6PY7HDOP.js} +1 -1
  13. package/{chunk-S5BG5EGL.js → chunk-6UMQVEIW.js} +1 -1
  14. package/{chunk-V5TE2DDF.js → chunk-72ZYV7VJ.js} +1 -1
  15. package/{chunk-N2BMSGXB.js → chunk-73WPQGR3.js} +1 -1
  16. package/chunk-BPD2EN47.js +1 -0
  17. package/{chunk-OBPYHPHW.js → chunk-BQDUQ3QB.js} +1 -1
  18. package/{chunk-QKOOQ5C6.js → chunk-CAT5SVSC.js} +1 -1
  19. package/{chunk-62IWOTCR.js → chunk-CCV7YXZK.js} +1 -1
  20. package/{chunk-K32QD3HY.js → chunk-DFH6V3CT.js} +1 -1
  21. package/{chunk-T7VWZPHW.js → chunk-EAGKI7R2.js} +1 -1
  22. package/{chunk-FMUAKMQ5.js → chunk-F46YCJVP.js} +1 -1
  23. package/{chunk-X5H54AB7.js → chunk-FDP645EA.js} +1 -1
  24. package/{chunk-R7JOHC7X.js → chunk-GPOV4LLJ.js} +1 -1
  25. package/{chunk-JP63AHXQ.js → chunk-GVY54AI2.js} +1 -1
  26. package/{chunk-ET2CSJP4.js → chunk-GYMS47XH.js} +1 -1
  27. package/{chunk-VF5FAVF2.js → chunk-HPTPORPS.js} +1 -1
  28. package/{chunk-BIWU6LQ4.js → chunk-IRMAUKSU.js} +1 -1
  29. package/{chunk-6KZDDZJR.js → chunk-KLD4OZ5H.js} +1 -1
  30. package/{chunk-COGLGLZN.js → chunk-KMJLKHVI.js} +1 -1
  31. package/{chunk-WUFTR2A3.js → chunk-KZKJCQQM.js} +1 -1
  32. package/{chunk-GD3XKRKO.js → chunk-LF72M3HF.js} +1 -1
  33. package/{chunk-TP3VPXGY.js → chunk-LU7FYL4S.js} +1 -1
  34. package/{chunk-GTX34ZM3.js → chunk-LU7LBQAQ.js} +1 -1
  35. package/{chunk-E5DM3TCW.js → chunk-MY6BPKII.js} +1 -1
  36. package/{chunk-KH66PYZ6.js → chunk-NBX25LTA.js} +2 -2
  37. package/{chunk-BIOJKKEJ.js → chunk-NE7Y446D.js} +1 -1
  38. package/{chunk-SOIFEV7G.js → chunk-NPQB5L3W.js} +1 -1
  39. package/{chunk-TDKHCTOJ.js → chunk-NUR6GPCD.js} +1 -1
  40. package/{chunk-IY6CYYHW.js → chunk-OCZUW7AE.js} +1 -1
  41. package/{chunk-UIAMVGX6.js → chunk-QEJUI7CU.js} +1 -1
  42. package/{chunk-BXBME2GW.js → chunk-QH2IPAMM.js} +1 -1
  43. package/{chunk-B3O26J3M.js → chunk-QJ7VHLHE.js} +1 -1
  44. package/{chunk-FN4UAN7G.js → chunk-QXSQXGVH.js} +2 -2
  45. package/{chunk-OSGJ7FIK.js → chunk-TB3BAWVP.js} +1 -1
  46. package/{chunk-JHBRCP5H.js → chunk-THX64GHC.js} +1 -1
  47. package/{chunk-WOL3MISH.js → chunk-TOQ23VQY.js} +1 -1
  48. package/{chunk-DESK3OTZ.js → chunk-ULDOMTBC.js} +1 -1
  49. package/{chunk-UOXEXJ2S.js → chunk-VFOVPHXM.js} +2 -2
  50. package/{chunk-5BR6MXLX.js → chunk-WN3IKEDR.js} +1 -1
  51. package/{chunk-FT3TVNWY.js → chunk-X76L5GEF.js} +1 -1
  52. package/{chunk-QEGANYLE.js → chunk-XF65IHRE.js} +1 -1
  53. package/{chunk-URW7SXYE.js → chunk-Y6Y3BWAM.js} +1 -1
  54. package/{chunk-JOMQZ2PR.js → chunk-Y726UXCA.js} +1 -1
  55. package/{chunk-ONEE4PD6.js → chunk-YWKUDH4I.js} +1 -1
  56. package/{chunk-UA3NWMTR.js → chunk-YZQEGKFU.js} +1 -1
  57. package/index.html +1 -1
  58. package/{main-M7FIUNAZ.js → main-EN7RW2XI.js} +1 -1
  59. package/package.json +1 -1
  60. package/chunk-MTBBYR5X.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-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
+ 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-EAGKI7R2.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 v}from"./chunk-THW7B5DI.js";import{m as K}from"./chunk-SPDFU2FM.js";import"./chunk-IEOE2XJ7.js";import{a as V,b as I}from"./chunk-YKC7ERDO.js";import{b as ee,g as te,h as ne,i as ie}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 Z}from"./chunk-URW7SXYE.js";import"./chunk-MTPMCC6U.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import{b as C,c as G,d as J,e as Q,f as W,g as X,h as Y}from"./chunk-3BPX4XM7.js";import{H as O,I as q}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import"./chunk-OQDKL2MG.js";import{e as $}from"./chunk-7NZRUZLK.js";import"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-T7VWZPHW.js";import{q as A,t as L}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{Ab as R,Ic as F,Mb as h,Nb as S,Sb as b,Sc as D,T,Tb as o,Ub as l,Uc as H,V as N,Vb as P,Wc as _,_c as E,ac as k,c as y,da as u,db as d,fc as M,gc as p,ka as f,la as x,s as z,ub as B,vc as m,wc as w,zc as j}from"./chunk-T6YHDD6J.js";import{a as c,b as s}from"./chunk-PRARYYF3.js";var oe={data:[],count:0,filter:{PageSize:20,PageNumber:1}},U=G(X(oe),Y("Closing Entries Store"),J(e=>({first:E(()=>(e.filter().PageNumber-1)*e.filter().PageSize+1),end:E(()=>Math.min(e.filter().PageNumber*e.filter().PageSize,e.count())),hasCheckedRows:E(()=>e.data().some(r=>r.checked)),selectedItems:E(()=>e.data().filter(r=>r.checked))})),W(e=>{let r=u(v),t={updateFilter:n=>{C(e,i=>s(c({},i),{filter:c(c({},i.filter),n)}))},onRowSelect(n){C(e,i=>{let a=i.data.map(g=>g.id===n.id?s(c({},g),{checked:!0}):g);return s(c({},i),{data:a})})},onRowUnselect(n){C(e,i=>{let a=i.data.map(g=>g.id===n.id?s(c({},g),{checked:!1}):g);return s(c({},i),{data:a})})},onHeaderCheckboxToggle(n){C(e,i=>{let a=i.data.map(g=>s(c({},g),{checked:n}));return s(c({},i),{data:a})})},getClosingEntries:V(y(T(n=>r.getClosingEntries(n).pipe(z(i=>i.map(a=>s(c({},a),{checked:!1}))),I({next:i=>{C(e,a=>s(c({},a),{data:i})),t.getClosingEntryCount()},error:i=>{console.error("Error fetching closing entries:",i)}}))))),getClosingEntryCount:V(y(T(()=>r.getClosingEntryCount().pipe(I({next:({count:n})=>{C(e,i=>s(c({},i),{count:n}))},error:n=>{console.error("Error fetching closing entry count:",n)}})))))};return t}),Q(e=>({onInit:()=>{e.getClosingEntries(e.filter)}})));function re(e,r){if(e&1){let t=k();o(0,"p-button",10),M("onClick",function(){f(t);let i=p(3);return x(i.onDeleteClosingEntries())}),l()}}function ae(e,r){if(e&1&&h(0,re,1,0,"p-button",9),e&2){let t=p(2);S(t.store.hasCheckedRows()?0:-1)}}function le(e,r){e&1&&(o(0,"a",8),P(1,"i",11),m(2," Add"),l())}function ce(e,r){if(e&1&&(o(0,"div",7),h(1,ae,1,1),h(2,le,3,0,"a",8),l()),e&2){let t=p();d(),S(t.roleService.permissions().accountingSetup.delete?1:-1),d(),S(t.roleService.permissions().accountingSetup.create?2:-1)}}function se(e,r){e&1&&(o(0,"th",13),P(1,"p-tableHeaderCheckbox"),l())}function pe(e,r){if(e&1&&(o(0,"tr"),h(1,se,2,0,"th",13),o(2,"th"),m(3,"Period"),l(),o(4,"th"),m(5,"Note"),l(),o(6,"th"),m(7,"Created"),l(),o(8,"th"),m(9,"CreatedBy"),l()()),e&2){let t=p(2);d(),S(t.roleService.permissions().accountingSetup.delete?1:-1)}}function me(e,r){if(e&1&&(o(0,"td"),P(1,"p-tableCheckbox",14),l()),e&2){let t=p().$implicit;d(),b("value",t)}}function de(e,r){if(e&1&&(o(0,"tr"),h(1,me,2,1,"td"),o(2,"td"),m(3),D(4,"date"),l(),o(5,"td"),m(6),l(),o(7,"td"),m(8),D(9,"date"),l(),o(10,"td"),m(11),l()()),e&2){let t=r.$implicit,n=p(2);d(),S(n.roleService.permissions().accountingSetup.delete?1:-1),d(2),w(H(4,5,t.period,"d MMM y")),d(3),w(t.note),d(2),w(H(9,8,t.created,"d MMM y")),d(3),w(t.creatorName)}}function ge(e,r){if(e&1&&m(0),e&2){let t=p(2);j(" Showing ",t.store.first()," to ",t.store.end()," of ",t.store.count()," entries ")}}function _e(e,r){e&1&&(o(0,"tr")(1,"td",15)(2,"span"),m(3," No journal entries found. "),l()()())}function Ce(e,r){if(e&1){let t=k();o(0,"p-table",12),M("onPage",function(i){f(t);let a=p();return x(a.onPageChange(i))})("onRowSelect",function(i){f(t);let a=p();return x(a.onRowSelect(i))})("onRowUnselect",function(i){f(t);let a=p();return x(a.onRowUnselect(i))})("onHeaderCheckboxToggle",function(i){f(t);let a=p();return x(a.onHeaderCheckboxToggle(i))}),R(1,pe,10,1,"ng-template",null,2,_)(3,de,12,11,"ng-template",null,3,_)(5,ge,1,3,"ng-template",null,4,_)(7,_e,4,0,"ng-template",null,5,_),l()}if(e&2){let t=p();b("value",t.store.data())("paginator",!0)("totalRecords",t.store.count())("lazy",!0)("rows",t.store.filter().PageSize)("scrollHeight","calc(100vh - 142px)")}}var Ae=(()=>{class e{constructor(){this.store=u(U),this.closingEntryService=u(v),this.roleService=u(K)}onPageChange(t){let n=t.first/t.rows+1;this.store.updateFilter(s(c({},this.store.filter()),{PageSize:n}))}onRowSelect(t){this.store.onRowSelect(t.data)}onRowUnselect(t){if(Array.isArray(t.data)){t.data.forEach(n=>{this.store.onRowUnselect(n)});return}else this.store.onRowUnselect(t.data)}onHeaderCheckboxToggle(t){this.store.onHeaderCheckboxToggle(t.checked)}onDeleteClosingEntries(){let t=this.store.selectedItems().map(n=>n.id).join(",");console.log("Deleting closing entries with IDs:",t),this.closingEntryService.deleteClosingEntry(t).pipe(N(()=>{this.store.updateFilter(c({},this.store.filter()))})).subscribe()}static{this.\u0275fac=function(n){return new(n||e)}}static{this.\u0275cmp=B({type:e,selectors:[["app-closing-page"]],features:[F([U])],decls:5,vars:1,consts:[["actionButton",""],["content",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["pageTitle","Closing Entries List",3,"scrollable"],[1,"d-flex","gap-2"],["routerLink","create",1,"p-button"],["label","Delete","severity","danger","icon","fa-solid fa-trash"],["label","Delete","severity","danger","icon","fa-solid fa-trash",3,"onClick"],[1,"fa-solid","fa-plus"],["dataKey","id","styleClass","d-flex flex-column justify-content-between h-100",3,"onPage","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value","paginator","totalRecords","lazy","rows","scrollHeight"],[2,"width","1rem"],[3,"value"],["colspan","5"]],template:function(n,i){n&1&&(o(0,"app-main-panel",6),R(1,ce,3,2,"ng-template",null,0,_)(3,Ce,9,6,"ng-template",null,1,_),l()),n&2&&b("scrollable",!0)},dependencies:[Z,L,ie,ee,te,ne,$,q,O,A],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return e})();export{Ae as ClosingPageComponent};
1
+ import{a as v}from"./chunk-THW7B5DI.js";import{m as K}from"./chunk-SPDFU2FM.js";import"./chunk-IEOE2XJ7.js";import{a as V,b as I}from"./chunk-YKC7ERDO.js";import{b as ee,g as te,h as ne,i as ie}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 Z}from"./chunk-Y6Y3BWAM.js";import"./chunk-MTPMCC6U.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import{b as C,c as G,d as J,e as Q,f as W,g as X,h as Y}from"./chunk-3BPX4XM7.js";import{H as O,I as q}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import"./chunk-OQDKL2MG.js";import{e as $}from"./chunk-7NZRUZLK.js";import"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-EAGKI7R2.js";import{q as A,t as L}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{Ab as R,Ic as F,Mb as h,Nb as S,Sb as b,Sc as D,T,Tb as o,Ub as l,Uc as H,V as N,Vb as P,Wc as _,_c as E,ac as k,c as y,da as u,db as d,fc as M,gc as p,ka as f,la as x,s as z,ub as B,vc as m,wc as w,zc as j}from"./chunk-T6YHDD6J.js";import{a as c,b as s}from"./chunk-PRARYYF3.js";var oe={data:[],count:0,filter:{PageSize:20,PageNumber:1}},U=G(X(oe),Y("Closing Entries Store"),J(e=>({first:E(()=>(e.filter().PageNumber-1)*e.filter().PageSize+1),end:E(()=>Math.min(e.filter().PageNumber*e.filter().PageSize,e.count())),hasCheckedRows:E(()=>e.data().some(r=>r.checked)),selectedItems:E(()=>e.data().filter(r=>r.checked))})),W(e=>{let r=u(v),t={updateFilter:n=>{C(e,i=>s(c({},i),{filter:c(c({},i.filter),n)}))},onRowSelect(n){C(e,i=>{let a=i.data.map(g=>g.id===n.id?s(c({},g),{checked:!0}):g);return s(c({},i),{data:a})})},onRowUnselect(n){C(e,i=>{let a=i.data.map(g=>g.id===n.id?s(c({},g),{checked:!1}):g);return s(c({},i),{data:a})})},onHeaderCheckboxToggle(n){C(e,i=>{let a=i.data.map(g=>s(c({},g),{checked:n}));return s(c({},i),{data:a})})},getClosingEntries:V(y(T(n=>r.getClosingEntries(n).pipe(z(i=>i.map(a=>s(c({},a),{checked:!1}))),I({next:i=>{C(e,a=>s(c({},a),{data:i})),t.getClosingEntryCount()},error:i=>{console.error("Error fetching closing entries:",i)}}))))),getClosingEntryCount:V(y(T(()=>r.getClosingEntryCount().pipe(I({next:({count:n})=>{C(e,i=>s(c({},i),{count:n}))},error:n=>{console.error("Error fetching closing entry count:",n)}})))))};return t}),Q(e=>({onInit:()=>{e.getClosingEntries(e.filter)}})));function re(e,r){if(e&1){let t=k();o(0,"p-button",10),M("onClick",function(){f(t);let i=p(3);return x(i.onDeleteClosingEntries())}),l()}}function ae(e,r){if(e&1&&h(0,re,1,0,"p-button",9),e&2){let t=p(2);S(t.store.hasCheckedRows()?0:-1)}}function le(e,r){e&1&&(o(0,"a",8),P(1,"i",11),m(2," Add"),l())}function ce(e,r){if(e&1&&(o(0,"div",7),h(1,ae,1,1),h(2,le,3,0,"a",8),l()),e&2){let t=p();d(),S(t.roleService.permissions().accountingSetup.delete?1:-1),d(),S(t.roleService.permissions().accountingSetup.create?2:-1)}}function se(e,r){e&1&&(o(0,"th",13),P(1,"p-tableHeaderCheckbox"),l())}function pe(e,r){if(e&1&&(o(0,"tr"),h(1,se,2,0,"th",13),o(2,"th"),m(3,"Period"),l(),o(4,"th"),m(5,"Note"),l(),o(6,"th"),m(7,"Created"),l(),o(8,"th"),m(9,"CreatedBy"),l()()),e&2){let t=p(2);d(),S(t.roleService.permissions().accountingSetup.delete?1:-1)}}function me(e,r){if(e&1&&(o(0,"td"),P(1,"p-tableCheckbox",14),l()),e&2){let t=p().$implicit;d(),b("value",t)}}function de(e,r){if(e&1&&(o(0,"tr"),h(1,me,2,1,"td"),o(2,"td"),m(3),D(4,"date"),l(),o(5,"td"),m(6),l(),o(7,"td"),m(8),D(9,"date"),l(),o(10,"td"),m(11),l()()),e&2){let t=r.$implicit,n=p(2);d(),S(n.roleService.permissions().accountingSetup.delete?1:-1),d(2),w(H(4,5,t.period,"d MMM y")),d(3),w(t.note),d(2),w(H(9,8,t.created,"d MMM y")),d(3),w(t.creatorName)}}function ge(e,r){if(e&1&&m(0),e&2){let t=p(2);j(" Showing ",t.store.first()," to ",t.store.end()," of ",t.store.count()," entries ")}}function _e(e,r){e&1&&(o(0,"tr")(1,"td",15)(2,"span"),m(3," No journal entries found. "),l()()())}function Ce(e,r){if(e&1){let t=k();o(0,"p-table",12),M("onPage",function(i){f(t);let a=p();return x(a.onPageChange(i))})("onRowSelect",function(i){f(t);let a=p();return x(a.onRowSelect(i))})("onRowUnselect",function(i){f(t);let a=p();return x(a.onRowUnselect(i))})("onHeaderCheckboxToggle",function(i){f(t);let a=p();return x(a.onHeaderCheckboxToggle(i))}),R(1,pe,10,1,"ng-template",null,2,_)(3,de,12,11,"ng-template",null,3,_)(5,ge,1,3,"ng-template",null,4,_)(7,_e,4,0,"ng-template",null,5,_),l()}if(e&2){let t=p();b("value",t.store.data())("paginator",!0)("totalRecords",t.store.count())("lazy",!0)("rows",t.store.filter().PageSize)("scrollHeight","calc(100vh - 142px)")}}var Ae=(()=>{class e{constructor(){this.store=u(U),this.closingEntryService=u(v),this.roleService=u(K)}onPageChange(t){let n=t.first/t.rows+1;this.store.updateFilter(s(c({},this.store.filter()),{PageSize:n}))}onRowSelect(t){this.store.onRowSelect(t.data)}onRowUnselect(t){if(Array.isArray(t.data)){t.data.forEach(n=>{this.store.onRowUnselect(n)});return}else this.store.onRowUnselect(t.data)}onHeaderCheckboxToggle(t){this.store.onHeaderCheckboxToggle(t.checked)}onDeleteClosingEntries(){let t=this.store.selectedItems().map(n=>n.id).join(",");console.log("Deleting closing entries with IDs:",t),this.closingEntryService.deleteClosingEntry(t).pipe(N(()=>{this.store.updateFilter(c({},this.store.filter()))})).subscribe()}static{this.\u0275fac=function(n){return new(n||e)}}static{this.\u0275cmp=B({type:e,selectors:[["app-closing-page"]],features:[F([U])],decls:5,vars:1,consts:[["actionButton",""],["content",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["pageTitle","Closing Entries List",3,"scrollable"],[1,"d-flex","gap-2"],["routerLink","create",1,"p-button"],["label","Delete","severity","danger","icon","fa-solid fa-trash"],["label","Delete","severity","danger","icon","fa-solid fa-trash",3,"onClick"],[1,"fa-solid","fa-plus"],["dataKey","id","styleClass","d-flex flex-column justify-content-between h-100",3,"onPage","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value","paginator","totalRecords","lazy","rows","scrollHeight"],[2,"width","1rem"],[3,"value"],["colspan","5"]],template:function(n,i){n&1&&(o(0,"app-main-panel",6),R(1,ce,3,2,"ng-template",null,0,_)(3,Ce,9,6,"ng-template",null,1,_),l()),n&2&&b("scrollable",!0)},dependencies:[Z,L,ie,ee,te,ne,$,q,O,A],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return e})();export{Ae as ClosingPageComponent};
@@ -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-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
+ 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-Y6Y3BWAM.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-EAGKI7R2.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 +1 @@
1
- import{a}from"./chunk-DESK3OTZ.js";import"./chunk-3ZUNX7VU.js";import"./chunk-IEOE2XJ7.js";import"./chunk-7NZRUZLK.js";import"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-T7VWZPHW.js";import"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import"./chunk-T6YHDD6J.js";import"./chunk-PRARYYF3.js";var o=[{path:"",canActivate:[a],children:[{path:"",loadComponent:()=>import("./chunk-VF5FAVF2.js").then(t=>t.Dashboard1Component),data:{title:"Dashboard",headerTemplate:"header"}}]}];export{o as DashboardRoutes};
1
+ import{a}from"./chunk-ULDOMTBC.js";import"./chunk-24XESN42.js";import"./chunk-IEOE2XJ7.js";import"./chunk-7NZRUZLK.js";import"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-EAGKI7R2.js";import"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import"./chunk-T6YHDD6J.js";import"./chunk-PRARYYF3.js";var o=[{path:"",canActivate:[a],children:[{path:"",loadComponent:()=>import("./chunk-HPTPORPS.js").then(t=>t.Dashboard1Component),data:{title:"Dashboard",headerTemplate:"header"}}]}];export{o as DashboardRoutes};
@@ -1 +1 @@
1
- import{a as P}from"./chunk-ONEE4PD6.js";import{a as Ue}from"./chunk-HOVGLXVU.js";import{a as Le,b as Ge}from"./chunk-XTTKUB6Z.js";import{a as le}from"./chunk-3ZUNX7VU.js";import{a as M}from"./chunk-K32QD3HY.js";import"./chunk-OS646RNF.js";import{a as He}from"./chunk-XKI7WLHE.js";import{a as je}from"./chunk-7R4NAOW3.js";import"./chunk-5TAKHYWV.js";import"./chunk-IEOE2XJ7.js";import{a as L,b as G}from"./chunk-YKC7ERDO.js";import{b as Pe,g as Re,h as ze,i as Be}from"./chunk-5NZPHAOL.js";import"./chunk-Y54QBXKN.js";import{a as Je,b as ke}from"./chunk-X2F5ZNTW.js";import"./chunk-ZULPRZ24.js";import"./chunk-BA72IEO2.js";import"./chunk-UEJR6B7A.js";import"./chunk-YYMD4TUO.js";import{b as Ne,c as Me}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{h as Fe}from"./chunk-URW7SXYE.js";import"./chunk-MTPMCC6U.js";import{a as Se,b as ye}from"./chunk-RO474VQ2.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import{a as Te,b as y,c as De,d as Ee,e as Ve,f as Ie,g as Ae}from"./chunk-3BPX4XM7.js";import{H as Ce,I as be,J as ve,K as we,y as he,z as xe}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import{b as pe,c as me,e as se,f as ce,k as de,p as ue,q as fe,v as _e,y as ge}from"./chunk-OQDKL2MG.js";import"./chunk-7NZRUZLK.js";import"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-T7VWZPHW.js";import{i as ne,o as oe,q as re,t as ae}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{$a as q,Ab as I,Ac as Z,Bc as U,Cc as ee,Ic as te,Kc as k,Mb as v,Nb as w,Pb as A,Qb as F,Rb as J,Sb as f,Sc as E,T as B,Tb as r,Tc as ie,Ub as o,Uc as N,V as W,Vb as x,Wc as b,_a as $,_c as V,ac as T,c as R,da as C,db as l,fc as D,gc as _,ka as g,la as h,s as z,ub as Q,vc as s,wa as j,wc as S,xc as H,zb as X,zc as Y}from"./chunk-T6YHDD6J.js";import{a as c,b as u}from"./chunk-PRARYYF3.js";var Qe={data:{data:[],totalCount:0},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,paymentState:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,paymentState:0}}},O=De(Ae(Qe),Ee(t=>({first:V(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:V(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:V(()=>t.data().data.some(a=>a.checked)),checkedAPCollection:V(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),Ie(t=>{let a=C(P),e=C(M);return{updateFilter(n){y(t,i=>u(c({},i),{filter:c(c({},i.filter),n)}))},onRowSelect(n){y(t,i=>{let d=i.data.data.map(m=>m.id===n.id?u(c({},m),{checked:!0}):m);return u(c({},i),{data:u(c({},i.data),{data:d})})})},onRowUnselect(n){y(t,i=>{let d=i.data.data.map(m=>m.id===n.id?u(c({},m),{checked:!1}):m);return u(c({},i),{data:u(c({},i.data),{data:d})})})},onHeaderCheckboxToggle(n){y(t,i=>{let d=i.data.data.map(m=>u(c({},m),{checked:n}));return u(c({},i),{data:u(c({},i.data),{data:d})})})},getAPLoader:L(R(B(()=>a.getAPJournalLoader().pipe(G({next:n=>{y(t,i=>u(c({},i),{meta:n}))},error:n=>{console.error("Error fetching AP journal:",n)}}))))),getARCollection:L(R(z(n=>Object.entries(n).reduce((i,[d,m])=>(m!=null&&(i[d]=m),i),{})),B(n=>a.getAPJournal(n).pipe(z(i=>u(c({},i),{data:i.data.map(d=>u(c({},d),{due:e.from(d.due)?e.from(d.due).format():null,checked:!1}))})),G({next:i=>{y(t,d=>u(c({},d),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),Ve(t=>({onInit:()=>{t.getAPLoader(),t.getARCollection(t.filter)}})));var K=t=>({"ng-invalid ng-dirty":t});function Xe(t,a){if(t&1){let e=T();r(0,"p-button",10),D("onClick",function(){g(e);let n=_(2);return h(n.onCreateJournal())}),o()}}function Ye(t,a){if(t&1&&v(0,Xe,1,0,"p-button",9),t&2){let e=_();w(e.store.hasCheckedRows()?0:-1)}}function Ze(t,a){t&1&&(r(0,"tr")(1,"th",12),x(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),s(4,"Number"),o(),r(5,"th",14),s(6,"Supplier"),o(),r(7,"th",15),s(8,"Date"),o(),r(9,"th",15),s(10,"Due"),o(),r(11,"th",14),s(12,"Note"),o(),r(13,"th",16),s(14,"Payment"),o(),x(15,"th",17),o())}function et(t,a){if(t&1&&(r(0,"tr")(1,"td"),x(2,"p-tableCheckbox",18),o(),r(3,"td")(4,"div",19)(5,"a",20),s(6),o(),x(7,"p-chip",21),o()(),r(8,"td"),s(9),o(),r(10,"td"),s(11),E(12,"date"),o(),r(13,"td"),s(14),E(15,"date"),o(),r(16,"td"),x(17,"div",22),o(),r(18,"td"),s(19),o(),r(20,"td"),x(21,"p-button",23),o()()),t&2){let e=a.$implicit,p=_(2);l(2),f("value",e),l(3),f("href",p.authService.getTenantExternalURL()+"/menu/Debt/Debt/Join_Bill/New_Join_Bill/Info?ID="+e.id,q),l(),H(" ",e.number," "),l(),f("label",e.outlet),l(2),S(e.customer),l(2),S(N(12,12,e.date,"d MMM y")),l(3),S(e.due?N(15,15,e.due,"d MMM y hh:mm"):"-"),l(3),f("innerHTML",e.note,$),l(2),S(e.payment),l(2),f("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function tt(t,a){if(t&1&&s(0),t&2){let e=_(2);Y(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function it(t,a){t&1&&(r(0,"tr")(1,"td",24)(2,"span"),s(3,"No records found."),o()()())}function nt(t,a){if(t&1){let e=T();r(0,"p-panel")(1,"p-table",11),D("onHeaderCheckboxToggle",function(n){g(e);let i=_();return h(i.onHeaderCheckboxToggle(n))})("onPage",function(n){g(e);let i=_();return h(i.onPageChange(n))})("onRowSelect",function(n){g(e);let i=_();return h(i.onRowSelect(n))})("onRowUnselect",function(n){g(e);let i=_();return h(i.onRowUnselect(n))}),I(2,Ze,16,0,"ng-template",null,3,b)(4,et,22,18,"ng-template",null,4,b)(6,tt,1,3,"ng-template",null,5,b)(8,it,4,0,"ng-template",null,6,b),o()()}if(t&2){let e=_();l(),f("lazy",!0)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("value",e.store.data().data)}}function ot(t,a){if(t&1&&(r(0,"span",34),s(1),E(2,"truncate"),o()),t&2){let e=a.$implicit;f("pTooltip",e.name),l(),H(" ",N(2,2,e.name,30)," ")}}function rt(t,a){if(t&1&&(r(0,"div")(1,"span",35),s(2),o()()),t&2){let e=a.$implicit;l(2),S(e)}}function at(t,a){if(t&1&&(r(0,"div"),F(1,rt,3,1,"div",null,A),o()),t&2){let e=_(2);l(),J(e.getErrors("from"))}}function lt(t,a){if(t&1&&(r(0,"div")(1,"span",35),s(2),o()()),t&2){let e=a.$implicit;l(2),S(e)}}function pt(t,a){if(t&1&&(r(0,"div"),F(1,lt,3,1,"div",null,A),o()),t&2){let e=_(2);l(),J(e.getErrors("to"))}}function mt(t,a){if(t&1&&(r(0,"div")(1,"span",35),s(2),o()()),t&2){let e=a.$implicit;l(2),S(e)}}function st(t,a){if(t&1&&(r(0,"div"),F(1,mt,3,1,"div",null,A),o()),t&2){let e=_(2);l(),J(e.getErrors("pageSize"))}}function ct(t,a){if(t&1){let e=T();r(0,"form",25)(1,"div",26)(2,"label",27),s(3,"Tag"),o(),r(4,"p-select",28),I(5,ot,3,5,"ng-template",null,7,b),o()(),r(7,"div",26)(8,"label",27),s(9,"From - To"),o(),r(10,"div",29),x(11,"p-datepicker",30),v(12,at,3,0,"div"),x(13,"p-datepicker",31),v(14,pt,3,0,"div"),o()(),r(15,"div",26)(16,"label",27),s(17,"Supplier"),o(),r(18,"p-autocomplete",32),E(19,"async"),D("completeMethod",function(n){g(e);let i=_();return h(i.onSearchSupplier(n))}),o()(),r(20,"div",26)(21,"label",27),s(22,"Page Size"),o(),x(23,"input",33),v(24,st,3,0,"div"),o()()}if(t&2){let e=_();f("formGroup",e.form),l(4),f("options",e.store.meta().options.outlets)("virtualScrollItemSize",50),l(7),f("iconDisplay","input")("ngClass",k(16,K,e.isInvalid("from")))("showIcon",!0),l(),w(e.isInvalid("from")?12:-1),l(),f("iconDisplay","input")("ngClass",k(18,K,e.isInvalid("to")))("showIcon",!0),l(),w(e.isInvalid("to")?14:-1),l(4),f("suggestions",ie(19,14,e.supplierSuggestions$)),l(5),f("ngClass",k(20,K,e.isInvalid("pageSize"))),l(),w(e.isInvalid("pageSize")?24:-1)}}var ti=(()=>{class t extends He{constructor(){super(),this.store=C(O),this.authService=C(le),this.isDialogFilterVisible=j(!1),this.isInitDialogFilterVisible=j(!1),this.dayjsService=C(M),this.generateJournalService=C(P),this.fb=C(_e)}ngOnInit(){this.initform()}initform(){let{outletName:e,number:p,from:n,to:i,paymentState:d,supplierID:m,pageNumber:Oe,pageSize:Ke,export:We,exportPageNumber:$e,exportPageSize:qe}=this.store.filter();this.form=this.fb.group({outletName:this.fb.control(e),number:this.fb.control(p),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),paymentState:this.fb.control(d),supplierID:this.fb.control(m),pageNumber:this.fb.control(Oe),pageSize:this.fb.control(Ke,[me.required]),export:this.fb.control(We),exportPageNumber:this.fb.control($e),exportPageSize:this.fb.control(qe)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((p,[n,i])=>(i!=null&&(n==="from"||n==="to"?(typeof i=="string"||typeof i=="number"||i instanceof Date)&&(p[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null):p[n]=i),p),{});this.store.updateFilter(e),this.isDialogFilterVisible.update(p=>!p)}onSearch(e){this.store.updateFilter(u(c({},this.store.filter()),{number:e}))}onSearchSupplier(e){this.supplierSuggestions$=this.generateJournalService.getSupplierSuggestions(e.query).pipe()}onPageChange(e){let p=e.first/e.rows;this.store.updateFilter(u(c({},this.store.filter()),{pageNumber:p+1}))}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(p=>{this.store.onRowUnselect(p)});return}else this.store.onRowUnselect(e.data)}onCreateJournal(){this.generateJournalService.createAPJournal(this.store.checkedAPCollection()).pipe(W(()=>{this.store.getARCollection(this.store.filter)})).subscribe()}static{this.\u0275fac=function(p){return new(p||t)}}static{this.\u0275cmp=Q({type:t,selectors:[["app-ap-journal"]],features:[te([O]),X],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Join Bill",3,"filterConfirmed","search","isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","isDialogFilterVisible","isInitDialogFilterVisible","isFilterable","isSearchableInput","scrollable"],["label","Generate Journal"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onHeaderCheckboxToggle","onPage","onRowSelect","onRowUnselect","lazy","paginator","rows","totalRecords","value"],[2,"width","1rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[2,"width","4rem"],[3,"value"],[1,"d-flex","flex-column","align-items-start","gap-1"],["target","_blank",1,"link","link-primary",3,"href"],[1,"p-1","px-2",3,"label"],[3,"innerHTML"],[3,"icon","severity","text"],["colspan","8"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["appendTo","body","filter","","filterBy","name","formControlName","outletName","optionLabel","name","optionValue","name","placeholder","Select an Tag","showClear","","virtualScroll","",3,"options","virtualScrollItemSize"],[1,"d-flex","flex-column","gap-2"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","from","inputId","icondisplay","showClear","","styleClass","w-100",3,"iconDisplay","ngClass","showIcon"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","to","inputId","icondisplay","showClear","","styleClass","w-100",3,"iconDisplay","ngClass","showIcon"],["appendTo","body","formControlName","supplierID","inputStyleClass","w-100","optionLabel","Value","optionValue","Key","showClear","","styleClass","w-100",3,"completeMethod","suggestions"],["appMaskNumber","","formControlName","pageSize","pInputText","","type","text",3,"ngClass"],[3,"pTooltip"],[1,"text-danger"]],template:function(p,n){if(p&1){let i=T();r(0,"app-main-panel",8),D("filterConfirmed",function(){return g(i),h(n.onFilterOKEvent())})("search",function(m){return g(i),h(n.onSearch(m))}),ee("isDialogFilterVisibleChange",function(m){return g(i),U(n.isDialogFilterVisible,m)||(n.isDialogFilterVisible=m),h(m)})("isInitDialogFilterVisibleChange",function(m){return g(i),U(n.isInitDialogFilterVisible,m)||(n.isInitDialogFilterVisible=m),h(m)}),I(1,Ye,1,1,"ng-template",null,0,b)(3,nt,10,5,"ng-template",null,1,b)(5,ct,25,22,"ng-template",null,2,b),o()}p&2&&(Z("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible),f("isFilterable",!0)("isSearchableInput",!0)("scrollable",!0))},dependencies:[Fe,Be,Pe,Re,ze,ae,ne,be,Ce,ye,Se,ge,de,pe,se,ce,fe,ue,Me,Ne,ke,Je,xe,he,Ge,Le,we,ve,Ue,je,oe,re,Te],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{ti as ApJournalComponent};
1
+ import{a as P}from"./chunk-YWKUDH4I.js";import{a as Ue}from"./chunk-HOVGLXVU.js";import{a as Le,b as Ge}from"./chunk-XTTKUB6Z.js";import{a as le}from"./chunk-24XESN42.js";import{a as M}from"./chunk-DFH6V3CT.js";import"./chunk-OS646RNF.js";import{a as He}from"./chunk-XKI7WLHE.js";import{a as je}from"./chunk-7R4NAOW3.js";import"./chunk-5TAKHYWV.js";import"./chunk-IEOE2XJ7.js";import{a as L,b as G}from"./chunk-YKC7ERDO.js";import{b as Pe,g as Re,h as ze,i as Be}from"./chunk-5NZPHAOL.js";import"./chunk-Y54QBXKN.js";import{a as Je,b as ke}from"./chunk-X2F5ZNTW.js";import"./chunk-ZULPRZ24.js";import"./chunk-BA72IEO2.js";import"./chunk-UEJR6B7A.js";import"./chunk-YYMD4TUO.js";import{b as Ne,c as Me}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{h as Fe}from"./chunk-Y6Y3BWAM.js";import"./chunk-MTPMCC6U.js";import{a as Se,b as ye}from"./chunk-RO474VQ2.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import{a as Te,b as y,c as De,d as Ee,e as Ve,f as Ie,g as Ae}from"./chunk-3BPX4XM7.js";import{H as Ce,I as be,J as ve,K as we,y as he,z as xe}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import{b as pe,c as me,e as se,f as ce,k as de,p as ue,q as fe,v as _e,y as ge}from"./chunk-OQDKL2MG.js";import"./chunk-7NZRUZLK.js";import"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-EAGKI7R2.js";import{i as ne,o as oe,q as re,t as ae}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{$a as q,Ab as I,Ac as Z,Bc as U,Cc as ee,Ic as te,Kc as k,Mb as v,Nb as w,Pb as A,Qb as F,Rb as J,Sb as f,Sc as E,T as B,Tb as r,Tc as ie,Ub as o,Uc as N,V as W,Vb as x,Wc as b,_a as $,_c as V,ac as T,c as R,da as C,db as l,fc as D,gc as _,ka as g,la as h,s as z,ub as Q,vc as s,wa as j,wc as S,xc as H,zb as X,zc as Y}from"./chunk-T6YHDD6J.js";import{a as c,b as u}from"./chunk-PRARYYF3.js";var Qe={data:{data:[],totalCount:0},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,paymentState:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,paymentState:0}}},O=De(Ae(Qe),Ee(t=>({first:V(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:V(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:V(()=>t.data().data.some(a=>a.checked)),checkedAPCollection:V(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),Ie(t=>{let a=C(P),e=C(M);return{updateFilter(n){y(t,i=>u(c({},i),{filter:c(c({},i.filter),n)}))},onRowSelect(n){y(t,i=>{let d=i.data.data.map(m=>m.id===n.id?u(c({},m),{checked:!0}):m);return u(c({},i),{data:u(c({},i.data),{data:d})})})},onRowUnselect(n){y(t,i=>{let d=i.data.data.map(m=>m.id===n.id?u(c({},m),{checked:!1}):m);return u(c({},i),{data:u(c({},i.data),{data:d})})})},onHeaderCheckboxToggle(n){y(t,i=>{let d=i.data.data.map(m=>u(c({},m),{checked:n}));return u(c({},i),{data:u(c({},i.data),{data:d})})})},getAPLoader:L(R(B(()=>a.getAPJournalLoader().pipe(G({next:n=>{y(t,i=>u(c({},i),{meta:n}))},error:n=>{console.error("Error fetching AP journal:",n)}}))))),getARCollection:L(R(z(n=>Object.entries(n).reduce((i,[d,m])=>(m!=null&&(i[d]=m),i),{})),B(n=>a.getAPJournal(n).pipe(z(i=>u(c({},i),{data:i.data.map(d=>u(c({},d),{due:e.from(d.due)?e.from(d.due).format():null,checked:!1}))})),G({next:i=>{y(t,d=>u(c({},d),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),Ve(t=>({onInit:()=>{t.getAPLoader(),t.getARCollection(t.filter)}})));var K=t=>({"ng-invalid ng-dirty":t});function Xe(t,a){if(t&1){let e=T();r(0,"p-button",10),D("onClick",function(){g(e);let n=_(2);return h(n.onCreateJournal())}),o()}}function Ye(t,a){if(t&1&&v(0,Xe,1,0,"p-button",9),t&2){let e=_();w(e.store.hasCheckedRows()?0:-1)}}function Ze(t,a){t&1&&(r(0,"tr")(1,"th",12),x(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),s(4,"Number"),o(),r(5,"th",14),s(6,"Supplier"),o(),r(7,"th",15),s(8,"Date"),o(),r(9,"th",15),s(10,"Due"),o(),r(11,"th",14),s(12,"Note"),o(),r(13,"th",16),s(14,"Payment"),o(),x(15,"th",17),o())}function et(t,a){if(t&1&&(r(0,"tr")(1,"td"),x(2,"p-tableCheckbox",18),o(),r(3,"td")(4,"div",19)(5,"a",20),s(6),o(),x(7,"p-chip",21),o()(),r(8,"td"),s(9),o(),r(10,"td"),s(11),E(12,"date"),o(),r(13,"td"),s(14),E(15,"date"),o(),r(16,"td"),x(17,"div",22),o(),r(18,"td"),s(19),o(),r(20,"td"),x(21,"p-button",23),o()()),t&2){let e=a.$implicit,p=_(2);l(2),f("value",e),l(3),f("href",p.authService.getTenantExternalURL()+"/menu/Debt/Debt/Join_Bill/New_Join_Bill/Info?ID="+e.id,q),l(),H(" ",e.number," "),l(),f("label",e.outlet),l(2),S(e.customer),l(2),S(N(12,12,e.date,"d MMM y")),l(3),S(e.due?N(15,15,e.due,"d MMM y hh:mm"):"-"),l(3),f("innerHTML",e.note,$),l(2),S(e.payment),l(2),f("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function tt(t,a){if(t&1&&s(0),t&2){let e=_(2);Y(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function it(t,a){t&1&&(r(0,"tr")(1,"td",24)(2,"span"),s(3,"No records found."),o()()())}function nt(t,a){if(t&1){let e=T();r(0,"p-panel")(1,"p-table",11),D("onHeaderCheckboxToggle",function(n){g(e);let i=_();return h(i.onHeaderCheckboxToggle(n))})("onPage",function(n){g(e);let i=_();return h(i.onPageChange(n))})("onRowSelect",function(n){g(e);let i=_();return h(i.onRowSelect(n))})("onRowUnselect",function(n){g(e);let i=_();return h(i.onRowUnselect(n))}),I(2,Ze,16,0,"ng-template",null,3,b)(4,et,22,18,"ng-template",null,4,b)(6,tt,1,3,"ng-template",null,5,b)(8,it,4,0,"ng-template",null,6,b),o()()}if(t&2){let e=_();l(),f("lazy",!0)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("value",e.store.data().data)}}function ot(t,a){if(t&1&&(r(0,"span",34),s(1),E(2,"truncate"),o()),t&2){let e=a.$implicit;f("pTooltip",e.name),l(),H(" ",N(2,2,e.name,30)," ")}}function rt(t,a){if(t&1&&(r(0,"div")(1,"span",35),s(2),o()()),t&2){let e=a.$implicit;l(2),S(e)}}function at(t,a){if(t&1&&(r(0,"div"),F(1,rt,3,1,"div",null,A),o()),t&2){let e=_(2);l(),J(e.getErrors("from"))}}function lt(t,a){if(t&1&&(r(0,"div")(1,"span",35),s(2),o()()),t&2){let e=a.$implicit;l(2),S(e)}}function pt(t,a){if(t&1&&(r(0,"div"),F(1,lt,3,1,"div",null,A),o()),t&2){let e=_(2);l(),J(e.getErrors("to"))}}function mt(t,a){if(t&1&&(r(0,"div")(1,"span",35),s(2),o()()),t&2){let e=a.$implicit;l(2),S(e)}}function st(t,a){if(t&1&&(r(0,"div"),F(1,mt,3,1,"div",null,A),o()),t&2){let e=_(2);l(),J(e.getErrors("pageSize"))}}function ct(t,a){if(t&1){let e=T();r(0,"form",25)(1,"div",26)(2,"label",27),s(3,"Tag"),o(),r(4,"p-select",28),I(5,ot,3,5,"ng-template",null,7,b),o()(),r(7,"div",26)(8,"label",27),s(9,"From - To"),o(),r(10,"div",29),x(11,"p-datepicker",30),v(12,at,3,0,"div"),x(13,"p-datepicker",31),v(14,pt,3,0,"div"),o()(),r(15,"div",26)(16,"label",27),s(17,"Supplier"),o(),r(18,"p-autocomplete",32),E(19,"async"),D("completeMethod",function(n){g(e);let i=_();return h(i.onSearchSupplier(n))}),o()(),r(20,"div",26)(21,"label",27),s(22,"Page Size"),o(),x(23,"input",33),v(24,st,3,0,"div"),o()()}if(t&2){let e=_();f("formGroup",e.form),l(4),f("options",e.store.meta().options.outlets)("virtualScrollItemSize",50),l(7),f("iconDisplay","input")("ngClass",k(16,K,e.isInvalid("from")))("showIcon",!0),l(),w(e.isInvalid("from")?12:-1),l(),f("iconDisplay","input")("ngClass",k(18,K,e.isInvalid("to")))("showIcon",!0),l(),w(e.isInvalid("to")?14:-1),l(4),f("suggestions",ie(19,14,e.supplierSuggestions$)),l(5),f("ngClass",k(20,K,e.isInvalid("pageSize"))),l(),w(e.isInvalid("pageSize")?24:-1)}}var ti=(()=>{class t extends He{constructor(){super(),this.store=C(O),this.authService=C(le),this.isDialogFilterVisible=j(!1),this.isInitDialogFilterVisible=j(!1),this.dayjsService=C(M),this.generateJournalService=C(P),this.fb=C(_e)}ngOnInit(){this.initform()}initform(){let{outletName:e,number:p,from:n,to:i,paymentState:d,supplierID:m,pageNumber:Oe,pageSize:Ke,export:We,exportPageNumber:$e,exportPageSize:qe}=this.store.filter();this.form=this.fb.group({outletName:this.fb.control(e),number:this.fb.control(p),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),paymentState:this.fb.control(d),supplierID:this.fb.control(m),pageNumber:this.fb.control(Oe),pageSize:this.fb.control(Ke,[me.required]),export:this.fb.control(We),exportPageNumber:this.fb.control($e),exportPageSize:this.fb.control(qe)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((p,[n,i])=>(i!=null&&(n==="from"||n==="to"?(typeof i=="string"||typeof i=="number"||i instanceof Date)&&(p[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null):p[n]=i),p),{});this.store.updateFilter(e),this.isDialogFilterVisible.update(p=>!p)}onSearch(e){this.store.updateFilter(u(c({},this.store.filter()),{number:e}))}onSearchSupplier(e){this.supplierSuggestions$=this.generateJournalService.getSupplierSuggestions(e.query).pipe()}onPageChange(e){let p=e.first/e.rows;this.store.updateFilter(u(c({},this.store.filter()),{pageNumber:p+1}))}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(p=>{this.store.onRowUnselect(p)});return}else this.store.onRowUnselect(e.data)}onCreateJournal(){this.generateJournalService.createAPJournal(this.store.checkedAPCollection()).pipe(W(()=>{this.store.getARCollection(this.store.filter)})).subscribe()}static{this.\u0275fac=function(p){return new(p||t)}}static{this.\u0275cmp=Q({type:t,selectors:[["app-ap-journal"]],features:[te([O]),X],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Join Bill",3,"filterConfirmed","search","isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","isDialogFilterVisible","isInitDialogFilterVisible","isFilterable","isSearchableInput","scrollable"],["label","Generate Journal"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onHeaderCheckboxToggle","onPage","onRowSelect","onRowUnselect","lazy","paginator","rows","totalRecords","value"],[2,"width","1rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[2,"width","4rem"],[3,"value"],[1,"d-flex","flex-column","align-items-start","gap-1"],["target","_blank",1,"link","link-primary",3,"href"],[1,"p-1","px-2",3,"label"],[3,"innerHTML"],[3,"icon","severity","text"],["colspan","8"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["appendTo","body","filter","","filterBy","name","formControlName","outletName","optionLabel","name","optionValue","name","placeholder","Select an Tag","showClear","","virtualScroll","",3,"options","virtualScrollItemSize"],[1,"d-flex","flex-column","gap-2"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","from","inputId","icondisplay","showClear","","styleClass","w-100",3,"iconDisplay","ngClass","showIcon"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","to","inputId","icondisplay","showClear","","styleClass","w-100",3,"iconDisplay","ngClass","showIcon"],["appendTo","body","formControlName","supplierID","inputStyleClass","w-100","optionLabel","Value","optionValue","Key","showClear","","styleClass","w-100",3,"completeMethod","suggestions"],["appMaskNumber","","formControlName","pageSize","pInputText","","type","text",3,"ngClass"],[3,"pTooltip"],[1,"text-danger"]],template:function(p,n){if(p&1){let i=T();r(0,"app-main-panel",8),D("filterConfirmed",function(){return g(i),h(n.onFilterOKEvent())})("search",function(m){return g(i),h(n.onSearch(m))}),ee("isDialogFilterVisibleChange",function(m){return g(i),U(n.isDialogFilterVisible,m)||(n.isDialogFilterVisible=m),h(m)})("isInitDialogFilterVisibleChange",function(m){return g(i),U(n.isInitDialogFilterVisible,m)||(n.isInitDialogFilterVisible=m),h(m)}),I(1,Ye,1,1,"ng-template",null,0,b)(3,nt,10,5,"ng-template",null,1,b)(5,ct,25,22,"ng-template",null,2,b),o()}p&2&&(Z("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible),f("isFilterable",!0)("isSearchableInput",!0)("scrollable",!0))},dependencies:[Fe,Be,Pe,Re,ze,ae,ne,be,Ce,ye,Se,ge,de,pe,se,ce,fe,ue,Me,Ne,ke,Je,xe,he,Ge,Le,we,ve,Ue,je,oe,re,Te],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{ti as ApJournalComponent};
@@ -1 +1 @@
1
- import{a as k}from"./chunk-ONEE4PD6.js";import{a as He}from"./chunk-HOVGLXVU.js";import{a as ae}from"./chunk-3ZUNX7VU.js";import{a as Pe}from"./chunk-K32QD3HY.js";import"./chunk-OS646RNF.js";import{a as Be}from"./chunk-XKI7WLHE.js";import{a as ze}from"./chunk-7R4NAOW3.js";import"./chunk-5TAKHYWV.js";import"./chunk-IEOE2XJ7.js";import{a as G,b as U}from"./chunk-YKC7ERDO.js";import{b as ke,g as Ne,h as Re,i as Me}from"./chunk-5NZPHAOL.js";import"./chunk-Y54QBXKN.js";import{a as Ie,b as Ve}from"./chunk-X2F5ZNTW.js";import"./chunk-ZULPRZ24.js";import"./chunk-BA72IEO2.js";import"./chunk-UEJR6B7A.js";import"./chunk-YYMD4TUO.js";import{b as De,c as Je}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{h as Fe}from"./chunk-URW7SXYE.js";import"./chunk-MTPMCC6U.js";import{a as Ce,b as be}from"./chunk-RO474VQ2.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import{a as ye,b as w,c as ve,d as je,e as Te,f as Ee,g as Ae}from"./chunk-3BPX4XM7.js";import{H as he,I as xe,J as Se,K as we,y as _e,z as ge}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import{b as le,e as me,f as se,k as pe,p as de,q as ce,v as ue,y as fe}from"./chunk-OQDKL2MG.js";import"./chunk-7NZRUZLK.js";import"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-T7VWZPHW.js";import{i as ie,q as ne,r as oe,t as re}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{$a as q,Ab as T,Ac as Y,Bc as B,Cc as Z,Ic as ee,Kc as D,Mb as y,Nb as v,Pb as E,Qb as A,Rb as F,Sb as u,Sc as J,T as M,Tb as a,Tc as te,Ub as r,Uc as H,V as W,Vb as x,Wc as C,_a as K,_c as j,ac as I,c as N,da as b,db as m,fc as V,gc as f,ka as g,la as h,s as R,ub as Q,vc as s,wa as P,wc as S,xc as z,zb as $,zc as X}from"./chunk-T6YHDD6J.js";import{a as p,b as c}from"./chunk-PRARYYF3.js";var Le={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,from:null,to:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,outletName:""}},filter:{number:null,from:null,to:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,outletName:""}},L=ve(Ae(Le),je(t=>({first:j(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:j(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:j(()=>t.data().data.some(l=>l.checked)),checkedAdjustment:j(()=>t.data().data.filter(l=>l.checked).map(l=>l.id))})),Ee(t=>{let l=b(k);return{updateFilter(n){w(t,i=>c(p({},i),{filter:p(p({},i.filter),n)}))},onRowSelect(n){w(t,i=>{let o=i.data.data.map(d=>d.id===n.id?c(p({},d),{checked:!0}):d);return c(p({},i),{data:c(p({},i.data),{data:o})})})},onRowUnselect(n){w(t,i=>{let o=i.data.data.map(d=>d.id===n.id?c(p({},d),{checked:!1}):d);return c(p({},i),{data:c(p({},i.data),{data:o})})})},onHeaderCheckboxToggle(n){w(t,i=>{let o=i.data.data.map(d=>c(p({},d),{checked:n}));return c(p({},i),{data:c(p({},i.data),{data:o})})})},getGJAdjustmentLoader:G(N(M(()=>l.getGJAdjustmentLoader().pipe(U({next:n=>{w(t,i=>c(p({},i),{meta:n}))},error:n=>{console.error("Error fetching adjustment loader:",n)}}))))),getAdjustmentJournal:G(N(R(n=>Object.entries(n).reduce((i,[o,d])=>(d!=null&&(i[o]=d),i),{})),M(n=>l.getAdjustmentJournal(n).pipe(R(i=>c(p({},i),{data:i.data.map(o=>c(p({},o),{checked:!1}))})),U({next:i=>{w(t,o=>c(p({},o),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),Te(t=>({onInit:()=>{t.getGJAdjustmentLoader(),t.getAdjustmentJournal(t.filter)}})));var O=t=>({"ng-invalid ng-dirty":t});function Oe(t,l){if(t&1){let e=I();a(0,"p-button",10),V("onClick",function(){g(e);let i=f(2);return h(i.generateAdjusmentJournal())}),r()}}function We(t,l){if(t&1&&y(0,Oe,1,0,"p-button",9),t&2){let e=f();v(e.store.hasCheckedRows()?0:-1)}}function Ke(t,l){t&1&&(a(0,"tr")(1,"th",12),x(2,"p-tableHeaderCheckbox"),r(),a(3,"th",13),s(4,"Number"),r(),a(5,"th",14),s(6,"Date"),r(),a(7,"th",13),s(8,"Adjustment Qty"),r(),a(9,"th",15),s(10,"Type"),r(),a(11,"th",16),s(12,"State"),r(),a(13,"th",17),s(14,"Note"),r(),x(15,"th",18),r())}function qe(t,l){if(t&1&&(a(0,"tr")(1,"td"),x(2,"p-tableCheckbox",19),r(),a(3,"td")(4,"div",20)(5,"a",21),s(6),r(),x(7,"p-chip",22),r()(),a(8,"td"),s(9),J(10,"date"),r(),a(11,"td"),s(12),J(13,"number"),r(),a(14,"td"),s(15),r(),a(16,"td"),s(17),r(),a(18,"td"),x(19,"div",23),r(),a(20,"td"),x(21,"p-button",24),r()()),t&2){let e=l.$implicit,n=f(2);m(2),u("value",e),m(3),u("href",n.authService.getTenantExternalURL()+"/menu/Adjustment/Adjustment/Archive/Info?ID="+e.id,q),m(),z(" ",e.number," "),m(),u("label",e.outlet),m(2),S(H(10,12,e.date,"d MMM y")),m(3),S(te(13,15,e.quantitySUM)),m(3),S(e.type),m(2),S(e.state),m(2),u("innerHTML",e.note,K),m(2),u("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function Qe(t,l){if(t&1&&s(0),t&2){let e=f(2);X(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function $e(t,l){t&1&&(a(0,"tr")(1,"td",25)(2,"span"),s(3,"No records found."),r()()())}function Xe(t,l){if(t&1){let e=I();a(0,"p-panel")(1,"p-table",11),V("onHeaderCheckboxToggle",function(i){g(e);let o=f();return h(o.onHeaderCheckboxToggle(i))})("onPage",function(i){g(e);let o=f();return h(o.onPageChange(i))})("onRowSelect",function(i){g(e);let o=f();return h(o.onRowSelect(i))})("onRowUnselect",function(i){g(e);let o=f();return h(o.onRowUnselect(i))}),T(2,Ke,16,0,"ng-template",null,3,C)(4,qe,22,17,"ng-template",null,4,C)(6,Qe,1,3,"ng-template",null,5,C)(8,$e,4,0,"ng-template",null,6,C),r()()}if(t&2){let e=f();m(),u("lazy",!0)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("value",e.store.data().data)}}function Ye(t,l){if(t&1&&(a(0,"span",34),s(1),J(2,"truncate"),r()),t&2){let e=l.$implicit;u("pTooltip",e.name),m(),z(" ",H(2,2,e.name,30)," ")}}function Ze(t,l){if(t&1&&(a(0,"div")(1,"span",35),s(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function et(t,l){if(t&1&&(a(0,"div"),A(1,Ze,3,1,"div",null,E),r()),t&2){let e=f(2);m(),F(e.getErrors("from"))}}function tt(t,l){if(t&1&&(a(0,"div")(1,"span",35),s(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function it(t,l){if(t&1&&(a(0,"div"),A(1,tt,3,1,"div",null,E),r()),t&2){let e=f(2);m(),F(e.getErrors("to"))}}function nt(t,l){if(t&1&&(a(0,"div")(1,"span",35),s(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function ot(t,l){if(t&1&&(a(0,"div"),A(1,nt,3,1,"div",null,E),r()),t&2){let e=f(2);m(),F(e.getErrors("pageSize"))}}function rt(t,l){if(t&1&&(a(0,"form",26)(1,"div",27)(2,"label",28),s(3,"Tag"),r(),a(4,"p-select",29),T(5,Ye,3,5,"ng-template",null,7,C),r()(),a(7,"div",27)(8,"label",28),s(9,"From - To"),r(),a(10,"div",30),x(11,"p-datepicker",31),y(12,et,3,0,"div"),x(13,"p-datepicker",32),y(14,it,3,0,"div"),r()(),a(15,"div",27)(16,"label",28),s(17,"Page Size"),r(),x(18,"input",33),y(19,ot,3,0,"div"),r()()),t&2){let e=f();u("formGroup",e.form),m(4),u("options",e.store.meta().options.outlets)("virtualScrollItemSize",50),m(7),u("iconDisplay","input")("ngClass",D(13,O,e.isInvalid("from")))("showIcon",!0),m(),v(e.isInvalid("from")?12:-1),m(),u("iconDisplay","input")("ngClass",D(15,O,e.isInvalid("to")))("showIcon",!0),m(),v(e.isInvalid("to")?14:-1),m(4),u("ngClass",D(17,O,e.isInvalid("pageSize"))),m(),v(e.isInvalid("pageSize")?19:-1)}}var Wt=(()=>{class t extends Be{constructor(){super(),this.store=b(L),this.authService=b(ae),this.isDialogFilterVisible=P(!1),this.isInitDialogFilterVisible=P(!1),this.generateJournalService=b(k),this.fb=b(ue),this.dayjsService=b(Pe)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:n,to:i,pageNumber:o,pageSize:d,export:_,exportPageNumber:Ge,exportPageSize:Ue}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),outletName:this.fb.control(""),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),pageNumber:this.fb.control(o),pageSize:this.fb.control(d),export:this.fb.control(_),exportPageNumber:this.fb.control(Ge),exportPageSize:this.fb.control(Ue)})}onSearch(e){this.store.updateFilter(c(p({},this.store.filter()),{number:e,pageNumber:1}))}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((n,[i,o])=>{switch(i){case"from":typeof o=="object"?n[i]=this.dayjsService.from(o)?this.dayjsService.format(o):null:n[i]=o!=null?String(o):null;break;case"to":typeof o=="object"?n[i]=this.dayjsService.from(o)?this.dayjsService.format(o):null:n[i]=o!=null?String(o):null;break;default:n[i]=o===null?"":o;break}return n},{});this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(n=>{this.store.onRowUnselect(n)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onPageChange(e){let n=e.first/e.rows;this.store.updateFilter(c(p({},this.store.filter()),{pageNumber:n+1}))}generateAdjusmentJournal(){this.generateJournalService.createAdjustmentJournal(this.store.checkedAdjustment()).pipe(W(()=>this.store.getAdjustmentJournal(this.store.filter))).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=Q({type:t,selectors:[["app-adjustment-journal"]],features:[ee([L]),$],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Adjustment",3,"filterConfirmed","search","isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","isDialogFilterVisible","isInitDialogFilterVisible","isFilterable","isSearchableInput","scrollable"],["label","Generate Journal"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onHeaderCheckboxToggle","onPage","onRowSelect","onRowUnselect","lazy","paginator","rows","totalRecords","value"],[2,"width","1rem"],[2,"width","12rem"],[2,"width","11rem"],[2,"width","10rem"],[2,"width","9rem"],[2,"width","14rem"],[2,"width","4rem"],[3,"value"],[1,"d-flex","flex-column","align-items-start","gap-1"],["target","_blank",1,"link","link-primary",3,"href"],[1,"p-1","px-2",3,"label"],[3,"innerHTML"],[3,"icon","severity","text"],["colspan","8"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["appendTo","body","filter","","filterBy","name","formControlName","outletName","optionLabel","name","optionValue","name","placeholder","Select an Tag","showClear","","virtualScroll","",3,"options","virtualScrollItemSize"],[1,"d-flex","flex-column","gap-2"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","from","inputId","icondisplay","showClear","","styleClass","w-100",3,"iconDisplay","ngClass","showIcon"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","to","inputId","icondisplay","showClear","","styleClass","w-100",3,"iconDisplay","ngClass","showIcon"],["appMaskNumber","","formControlName","pageSize","pInputText","","type","text",3,"ngClass"],[3,"pTooltip"],[1,"text-danger"]],template:function(n,i){if(n&1){let o=I();a(0,"app-main-panel",8),V("filterConfirmed",function(){return g(o),h(i.onFilterOKEvent())})("search",function(_){return g(o),h(i.onSearch(_))}),Z("isDialogFilterVisibleChange",function(_){return g(o),B(i.isDialogFilterVisible,_)||(i.isDialogFilterVisible=_),h(_)})("isInitDialogFilterVisibleChange",function(_){return g(o),B(i.isInitDialogFilterVisible,_)||(i.isInitDialogFilterVisible=_),h(_)}),T(1,We,1,1,"ng-template",null,0,C)(3,Xe,10,5,"ng-template",null,1,C)(5,rt,20,19,"ng-template",null,2,C),r()}n&2&&(Y("isDialogFilterVisible",i.isDialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),u("isFilterable",!0)("isSearchableInput",!0)("scrollable",!0))},dependencies:[Fe,Me,ke,Ne,Re,re,ie,be,Ce,xe,he,Ve,Ie,Je,De,fe,pe,le,me,se,ce,de,ge,_e,we,Se,He,ze,oe,ne,ye],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{Wt as AdjustmentJournalComponent};
1
+ import{a as k}from"./chunk-YWKUDH4I.js";import{a as He}from"./chunk-HOVGLXVU.js";import{a as ae}from"./chunk-24XESN42.js";import{a as Pe}from"./chunk-DFH6V3CT.js";import"./chunk-OS646RNF.js";import{a as Be}from"./chunk-XKI7WLHE.js";import{a as ze}from"./chunk-7R4NAOW3.js";import"./chunk-5TAKHYWV.js";import"./chunk-IEOE2XJ7.js";import{a as G,b as U}from"./chunk-YKC7ERDO.js";import{b as ke,g as Ne,h as Re,i as Me}from"./chunk-5NZPHAOL.js";import"./chunk-Y54QBXKN.js";import{a as Ie,b as Ve}from"./chunk-X2F5ZNTW.js";import"./chunk-ZULPRZ24.js";import"./chunk-BA72IEO2.js";import"./chunk-UEJR6B7A.js";import"./chunk-YYMD4TUO.js";import{b as De,c as Je}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{h as Fe}from"./chunk-Y6Y3BWAM.js";import"./chunk-MTPMCC6U.js";import{a as Ce,b as be}from"./chunk-RO474VQ2.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import{a as ye,b as w,c as ve,d as je,e as Te,f as Ee,g as Ae}from"./chunk-3BPX4XM7.js";import{H as he,I as xe,J as Se,K as we,y as _e,z as ge}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import{b as le,e as me,f as se,k as pe,p as de,q as ce,v as ue,y as fe}from"./chunk-OQDKL2MG.js";import"./chunk-7NZRUZLK.js";import"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-EAGKI7R2.js";import{i as ie,q as ne,r as oe,t as re}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{$a as q,Ab as T,Ac as Y,Bc as B,Cc as Z,Ic as ee,Kc as D,Mb as y,Nb as v,Pb as E,Qb as A,Rb as F,Sb as u,Sc as J,T as M,Tb as a,Tc as te,Ub as r,Uc as H,V as W,Vb as x,Wc as C,_a as K,_c as j,ac as I,c as N,da as b,db as m,fc as V,gc as f,ka as g,la as h,s as R,ub as Q,vc as s,wa as P,wc as S,xc as z,zb as $,zc as X}from"./chunk-T6YHDD6J.js";import{a as p,b as c}from"./chunk-PRARYYF3.js";var Le={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,from:null,to:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,outletName:""}},filter:{number:null,from:null,to:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,outletName:""}},L=ve(Ae(Le),je(t=>({first:j(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:j(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:j(()=>t.data().data.some(l=>l.checked)),checkedAdjustment:j(()=>t.data().data.filter(l=>l.checked).map(l=>l.id))})),Ee(t=>{let l=b(k);return{updateFilter(n){w(t,i=>c(p({},i),{filter:p(p({},i.filter),n)}))},onRowSelect(n){w(t,i=>{let o=i.data.data.map(d=>d.id===n.id?c(p({},d),{checked:!0}):d);return c(p({},i),{data:c(p({},i.data),{data:o})})})},onRowUnselect(n){w(t,i=>{let o=i.data.data.map(d=>d.id===n.id?c(p({},d),{checked:!1}):d);return c(p({},i),{data:c(p({},i.data),{data:o})})})},onHeaderCheckboxToggle(n){w(t,i=>{let o=i.data.data.map(d=>c(p({},d),{checked:n}));return c(p({},i),{data:c(p({},i.data),{data:o})})})},getGJAdjustmentLoader:G(N(M(()=>l.getGJAdjustmentLoader().pipe(U({next:n=>{w(t,i=>c(p({},i),{meta:n}))},error:n=>{console.error("Error fetching adjustment loader:",n)}}))))),getAdjustmentJournal:G(N(R(n=>Object.entries(n).reduce((i,[o,d])=>(d!=null&&(i[o]=d),i),{})),M(n=>l.getAdjustmentJournal(n).pipe(R(i=>c(p({},i),{data:i.data.map(o=>c(p({},o),{checked:!1}))})),U({next:i=>{w(t,o=>c(p({},o),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),Te(t=>({onInit:()=>{t.getGJAdjustmentLoader(),t.getAdjustmentJournal(t.filter)}})));var O=t=>({"ng-invalid ng-dirty":t});function Oe(t,l){if(t&1){let e=I();a(0,"p-button",10),V("onClick",function(){g(e);let i=f(2);return h(i.generateAdjusmentJournal())}),r()}}function We(t,l){if(t&1&&y(0,Oe,1,0,"p-button",9),t&2){let e=f();v(e.store.hasCheckedRows()?0:-1)}}function Ke(t,l){t&1&&(a(0,"tr")(1,"th",12),x(2,"p-tableHeaderCheckbox"),r(),a(3,"th",13),s(4,"Number"),r(),a(5,"th",14),s(6,"Date"),r(),a(7,"th",13),s(8,"Adjustment Qty"),r(),a(9,"th",15),s(10,"Type"),r(),a(11,"th",16),s(12,"State"),r(),a(13,"th",17),s(14,"Note"),r(),x(15,"th",18),r())}function qe(t,l){if(t&1&&(a(0,"tr")(1,"td"),x(2,"p-tableCheckbox",19),r(),a(3,"td")(4,"div",20)(5,"a",21),s(6),r(),x(7,"p-chip",22),r()(),a(8,"td"),s(9),J(10,"date"),r(),a(11,"td"),s(12),J(13,"number"),r(),a(14,"td"),s(15),r(),a(16,"td"),s(17),r(),a(18,"td"),x(19,"div",23),r(),a(20,"td"),x(21,"p-button",24),r()()),t&2){let e=l.$implicit,n=f(2);m(2),u("value",e),m(3),u("href",n.authService.getTenantExternalURL()+"/menu/Adjustment/Adjustment/Archive/Info?ID="+e.id,q),m(),z(" ",e.number," "),m(),u("label",e.outlet),m(2),S(H(10,12,e.date,"d MMM y")),m(3),S(te(13,15,e.quantitySUM)),m(3),S(e.type),m(2),S(e.state),m(2),u("innerHTML",e.note,K),m(2),u("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function Qe(t,l){if(t&1&&s(0),t&2){let e=f(2);X(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function $e(t,l){t&1&&(a(0,"tr")(1,"td",25)(2,"span"),s(3,"No records found."),r()()())}function Xe(t,l){if(t&1){let e=I();a(0,"p-panel")(1,"p-table",11),V("onHeaderCheckboxToggle",function(i){g(e);let o=f();return h(o.onHeaderCheckboxToggle(i))})("onPage",function(i){g(e);let o=f();return h(o.onPageChange(i))})("onRowSelect",function(i){g(e);let o=f();return h(o.onRowSelect(i))})("onRowUnselect",function(i){g(e);let o=f();return h(o.onRowUnselect(i))}),T(2,Ke,16,0,"ng-template",null,3,C)(4,qe,22,17,"ng-template",null,4,C)(6,Qe,1,3,"ng-template",null,5,C)(8,$e,4,0,"ng-template",null,6,C),r()()}if(t&2){let e=f();m(),u("lazy",!0)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("value",e.store.data().data)}}function Ye(t,l){if(t&1&&(a(0,"span",34),s(1),J(2,"truncate"),r()),t&2){let e=l.$implicit;u("pTooltip",e.name),m(),z(" ",H(2,2,e.name,30)," ")}}function Ze(t,l){if(t&1&&(a(0,"div")(1,"span",35),s(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function et(t,l){if(t&1&&(a(0,"div"),A(1,Ze,3,1,"div",null,E),r()),t&2){let e=f(2);m(),F(e.getErrors("from"))}}function tt(t,l){if(t&1&&(a(0,"div")(1,"span",35),s(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function it(t,l){if(t&1&&(a(0,"div"),A(1,tt,3,1,"div",null,E),r()),t&2){let e=f(2);m(),F(e.getErrors("to"))}}function nt(t,l){if(t&1&&(a(0,"div")(1,"span",35),s(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function ot(t,l){if(t&1&&(a(0,"div"),A(1,nt,3,1,"div",null,E),r()),t&2){let e=f(2);m(),F(e.getErrors("pageSize"))}}function rt(t,l){if(t&1&&(a(0,"form",26)(1,"div",27)(2,"label",28),s(3,"Tag"),r(),a(4,"p-select",29),T(5,Ye,3,5,"ng-template",null,7,C),r()(),a(7,"div",27)(8,"label",28),s(9,"From - To"),r(),a(10,"div",30),x(11,"p-datepicker",31),y(12,et,3,0,"div"),x(13,"p-datepicker",32),y(14,it,3,0,"div"),r()(),a(15,"div",27)(16,"label",28),s(17,"Page Size"),r(),x(18,"input",33),y(19,ot,3,0,"div"),r()()),t&2){let e=f();u("formGroup",e.form),m(4),u("options",e.store.meta().options.outlets)("virtualScrollItemSize",50),m(7),u("iconDisplay","input")("ngClass",D(13,O,e.isInvalid("from")))("showIcon",!0),m(),v(e.isInvalid("from")?12:-1),m(),u("iconDisplay","input")("ngClass",D(15,O,e.isInvalid("to")))("showIcon",!0),m(),v(e.isInvalid("to")?14:-1),m(4),u("ngClass",D(17,O,e.isInvalid("pageSize"))),m(),v(e.isInvalid("pageSize")?19:-1)}}var Wt=(()=>{class t extends Be{constructor(){super(),this.store=b(L),this.authService=b(ae),this.isDialogFilterVisible=P(!1),this.isInitDialogFilterVisible=P(!1),this.generateJournalService=b(k),this.fb=b(ue),this.dayjsService=b(Pe)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:n,to:i,pageNumber:o,pageSize:d,export:_,exportPageNumber:Ge,exportPageSize:Ue}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),outletName:this.fb.control(""),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),pageNumber:this.fb.control(o),pageSize:this.fb.control(d),export:this.fb.control(_),exportPageNumber:this.fb.control(Ge),exportPageSize:this.fb.control(Ue)})}onSearch(e){this.store.updateFilter(c(p({},this.store.filter()),{number:e,pageNumber:1}))}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((n,[i,o])=>{switch(i){case"from":typeof o=="object"?n[i]=this.dayjsService.from(o)?this.dayjsService.format(o):null:n[i]=o!=null?String(o):null;break;case"to":typeof o=="object"?n[i]=this.dayjsService.from(o)?this.dayjsService.format(o):null:n[i]=o!=null?String(o):null;break;default:n[i]=o===null?"":o;break}return n},{});this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(n=>{this.store.onRowUnselect(n)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onPageChange(e){let n=e.first/e.rows;this.store.updateFilter(c(p({},this.store.filter()),{pageNumber:n+1}))}generateAdjusmentJournal(){this.generateJournalService.createAdjustmentJournal(this.store.checkedAdjustment()).pipe(W(()=>this.store.getAdjustmentJournal(this.store.filter))).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=Q({type:t,selectors:[["app-adjustment-journal"]],features:[ee([L]),$],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Adjustment",3,"filterConfirmed","search","isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","isDialogFilterVisible","isInitDialogFilterVisible","isFilterable","isSearchableInput","scrollable"],["label","Generate Journal"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onHeaderCheckboxToggle","onPage","onRowSelect","onRowUnselect","lazy","paginator","rows","totalRecords","value"],[2,"width","1rem"],[2,"width","12rem"],[2,"width","11rem"],[2,"width","10rem"],[2,"width","9rem"],[2,"width","14rem"],[2,"width","4rem"],[3,"value"],[1,"d-flex","flex-column","align-items-start","gap-1"],["target","_blank",1,"link","link-primary",3,"href"],[1,"p-1","px-2",3,"label"],[3,"innerHTML"],[3,"icon","severity","text"],["colspan","8"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["appendTo","body","filter","","filterBy","name","formControlName","outletName","optionLabel","name","optionValue","name","placeholder","Select an Tag","showClear","","virtualScroll","",3,"options","virtualScrollItemSize"],[1,"d-flex","flex-column","gap-2"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","from","inputId","icondisplay","showClear","","styleClass","w-100",3,"iconDisplay","ngClass","showIcon"],["appendTo","body","dateFormat","dd M yy","fluid","","formControlName","to","inputId","icondisplay","showClear","","styleClass","w-100",3,"iconDisplay","ngClass","showIcon"],["appMaskNumber","","formControlName","pageSize","pInputText","","type","text",3,"ngClass"],[3,"pTooltip"],[1,"text-danger"]],template:function(n,i){if(n&1){let o=I();a(0,"app-main-panel",8),V("filterConfirmed",function(){return g(o),h(i.onFilterOKEvent())})("search",function(_){return g(o),h(i.onSearch(_))}),Z("isDialogFilterVisibleChange",function(_){return g(o),B(i.isDialogFilterVisible,_)||(i.isDialogFilterVisible=_),h(_)})("isInitDialogFilterVisibleChange",function(_){return g(o),B(i.isInitDialogFilterVisible,_)||(i.isInitDialogFilterVisible=_),h(_)}),T(1,We,1,1,"ng-template",null,0,C)(3,Xe,10,5,"ng-template",null,1,C)(5,rt,20,19,"ng-template",null,2,C),r()}n&2&&(Y("isDialogFilterVisible",i.isDialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),u("isFilterable",!0)("isSearchableInput",!0)("scrollable",!0))},dependencies:[Fe,Me,ke,Ne,Re,re,ie,be,Ce,xe,he,Ve,Ie,Je,De,fe,pe,le,me,se,ce,de,ge,_e,we,Se,He,ze,oe,ne,ye],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{Wt as AdjustmentJournalComponent};
@@ -1 +1 @@
1
- import{a as Je}from"./chunk-OBPYHPHW.js";import"./chunk-3ZUNX7VU.js";import{a as ve,b as Ee,c as he,d as be,e as Ie,f as Se}from"./chunk-2L65SN3U.js";import{a as Ce,b as ke,c as we}from"./chunk-JM6FKNTC.js";import"./chunk-IEOE2XJ7.js";import{b as ue,d as fe,e as ge,f as xe,i as ye}from"./chunk-5NZPHAOL.js";import"./chunk-Y54QBXKN.js";import"./chunk-X2F5ZNTW.js";import"./chunk-ZULPRZ24.js";import"./chunk-BA72IEO2.js";import{a as R}from"./chunk-TTIQSVQF.js";import{a as oe}from"./chunk-OVMM5CPY.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{a as ce,b as _e}from"./chunk-KG3OLRKU.js";import"./chunk-4D6KKSM5.js";import"./chunk-BEEH5PAA.js";import{d as me,e as se,h as de}from"./chunk-URW7SXYE.js";import"./chunk-MTPMCC6U.js";import{a as le,b as pe}from"./chunk-RO474VQ2.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import"./chunk-3BPX4XM7.js";import{H as re,I as ae}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import"./chunk-OQDKL2MG.js";import{d as ie}from"./chunk-7NZRUZLK.js";import"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-T7VWZPHW.js";import{i as Y,l as Z,q as ee,r as te,t as ne}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{Ab as u,Ac as W,Bc as z,Cc as q,F as U,Jc as T,Kc as V,Mb as h,Mc as G,Nb as b,Ob as F,Qb as P,Rb as D,Sb as m,Sc as E,T as j,Tb as n,Tc as I,Ub as i,Uc as X,V as J,Vb as c,Wc as d,ac as v,bb as K,da as A,db as l,fc as y,gc as s,ka as f,kc as L,la as g,lc as O,m as N,mc as $,qc as Q,s as B,tc as M,ub as H,vc as r,wa as w,wc as x,xc as C}from"./chunk-T6YHDD6J.js";import{g as Re}from"./chunk-PRARYYF3.js";var Te=Re(ke());var Ae=["stepper"],Fe=()=>({width:"30vw"}),Pe=()=>({"1199px":"75vw","575px":"100vw"}),De=()=>({height:"calc(100vh - 70px)"}),Me=t=>({"col-12":t}),Ne=(t,p,e)=>({"bg-gradient-danger":t,"bg-gradient-success":p,"bg-gradient-warning":e}),Ve=t=>({"state-danger":t});function Be(t,p){if(t&1){let e=v();n(0,"p-button",14),y("click",function(){f(e);let o=s(2);return g(o.onPrevStep())}),i()}if(t&2){let e=s(2);m("disabled",e.stepActiveIndex()===1)}}function Ue(t,p){if(t&1){let e=v();n(0,"p-button",15),y("click",function(){f(e);let o=s(2);return g(o.onNextStep())}),i()}if(t&2){let e=s(2);m("disabled",e.stepActiveIndex()===3||!e.JournalEntryImport())}}function je(t,p){if(t&1){let e=v();n(0,"p-button",16),y("click",function(){f(e);let o=s(2);return g(o.onReset())}),i()}}function Ke(t,p){if(t&1&&u(0,Be,1,1,"p-button",11)(1,Ue,1,1,"p-button",12)(2,je,1,0,"p-button",13),t&2){let e=s();m("ngIf",e.stepActiveIndex()>1),l(),m("ngIf",e.stepActiveIndex()<3),l(),m("ngIf",e.stepActiveIndex()===3)}}function He(t,p){if(t&1){let e=v();n(0,"POS-uppy",25),y("fileUploaded",function(o){f(e);let _=s(2);return g(_.onFileUploaded(o))})("fileRemoved",function(o){f(e);let _=s(2);return g(_.onFileRemoved(o))}),i(),n(1,"p",26),r(2," Please refer this "),n(3,"a",27),r(4,"article"),i(),r(5," for more information "),i()}if(t&2){let e=s(2);m("uppyCoreConfiguration",e.uppyCore)("dashboardPropsConfiguration",e.dashboardProps)("sampleUrl",e.SAMPLE_URL)("subtitle",e.subtitle)}}function Le(t,p){t&1&&(n(0,"tr"),c(1,"th",29),n(2,"th",30),r(3," Number "),c(4,"p-sortIcon",31),i(),n(5,"th",32),r(6," Outlet "),c(7,"p-sortIcon",33),i(),n(8,"th",34),r(9," Date "),c(10,"p-sortIcon",35),i(),n(11,"th",36),r(12," Status "),c(13,"p-sortIcon",37),i(),n(14,"th"),r(15,"Message"),i()())}function Oe(t,p){if(t&1&&(n(0,"div",41)(1,"span"),r(2),i(),n(3,"span"),r(4),i()()),t&2){let e=p.$implicit;l(2),x(e.issue),l(2),x(e.solution)}}function $e(t,p){if(t&1&&(n(0,"div",40),P(1,Oe,5,2,"div",41,F),i()),t&2){let e=s(2).$implicit;l(),D(e.issues)}}function Qe(t,p){}function We(t,p){if(t&1&&h(0,$e,3,0,"div",40)(1,Qe,0,0),t&2){let e=s().$implicit;b(e.issues&&e.issues.length>0?0:1)}}function ze(t,p){if(t&1&&(n(0,"tr")(1,"td"),c(2,"p-button",38),i(),n(3,"td"),r(4),i(),n(5,"td"),r(6),i(),n(7,"td"),r(8),E(9,"date"),i(),n(10,"td",39),r(11),i(),n(12,"td",39),h(13,We,2,1),i()()),t&2){let e=p.$implicit,a=p.expanded,o=s(4);l(2),m("pRowToggler",e)("text",!0)("rounded",!0)("plain",!0)("icon",a?"fa-solid fa-chevron-down":"fa-solid fa-chevron-right"),l(2),x(e.number),l(2),C(" ",e.outlet," "),l(2),x(X(9,12,e.date,"d MMM y")),l(2),m("ngClass",G(15,Ne,e.actionName==="Error",e.actionName==="New",e.actionName==="Update")),l(),C(" ",e.actionName," "),l(),m("ngClass",V(19,Ve,o.hasIssue)),l(),b(o.hasIssue?13:-1)}}function qe(t,p){t&1&&(n(0,"tr")(1,"th",45),r(2," Code "),c(3,"p-sortIcon",46),i(),n(4,"th",47),r(5," Name "),c(6,"p-sortIcon",48),i(),n(7,"th",49),r(8," Note "),c(9,"p-sortIcon",50),i(),n(10,"th",51),r(11," Debit "),c(12,"p-sortIcon",52),i(),n(13,"th",53),r(14," Credit "),c(15,"p-sortIcon",54),i(),n(16,"th"),r(17,"Message"),i()())}function Ge(t,p){if(t&1&&(n(0,"div",41)(1,"span"),r(2),i(),n(3,"span"),r(4),i()()),t&2){let e=p.$implicit;l(2),x(e.issue),l(2),x(e.solution)}}function Xe(t,p){if(t&1&&(n(0,"div",40),P(1,Ge,5,2,"div",41,F),i()),t&2){let e=s().$implicit;l(),D(e.issues)}}function Ye(t,p){if(t&1&&(n(0,"tr")(1,"td"),r(2),i(),n(3,"td"),r(4),i(),n(5,"td"),r(6),i(),n(7,"td"),r(8),E(9,"number"),i(),n(10,"td"),r(11),E(12,"number"),i(),n(13,"td",39),h(14,Xe,3,0,"div",40),i()()),t&2){let e=p.$implicit,a=s(5);l(2),x(e.accountCode),l(2),x(e.accountName),l(2),x(e.note),l(2),C(" ",I(9,7,e.debitAmount)," "),l(3),C(" ",I(12,9,e.creditAmount)," "),l(2),m("ngClass",V(11,Ve,e.issues&&e.issues.length>0)),l(),b(a.hasIssue?14:-1)}}function Ze(t,p){t&1&&(n(0,"tr")(1,"td",55),r(2," There are no order for this product yet. "),i()())}function et(t,p){if(t&1&&(n(0,"tr")(1,"td",42)(2,"div",43)(3,"p-table",44),u(4,qe,18,0,"ng-template",null,3,d)(6,Ye,15,13,"ng-template",null,6,d)(8,Ze,3,0,"ng-template",null,8,d),i()()()()),t&2){let e=p.$implicit;l(3),m("value",e.items)}}function tt(t,p){if(t&1&&(n(0,"p-table",28),u(1,Le,16,0,"ng-template",null,3,d)(3,ze,14,21,"ng-template",null,6,d)(5,et,10,1,"ng-template",null,7,d),i()),t&2){let e=s(3);m("scrollable",!0)("scrollHeight","calc(100vh - 160px)")("value",e.JournalEntryImport().dataRow)}}function nt(t,p){if(t&1&&h(0,tt,7,3,"p-table",28),t&2){let e=s(2);b(e.JournalEntryImport()?0:-1)}}function it(t,p){t&1&&(n(0,"h5"),r(1,"Successfully Imported"),i())}function ot(t,p){if(t&1&&(n(0,"p-panel")(1,"p-scroll-panel")(2,"div",17)(3,"div",18)(4,"p-stepper",19,5)(6,"p-step-list")(7,"p-step",20)(8,"div",21),c(9,"i",22),n(10,"span"),r(11,"Upload"),i()()(),n(12,"p-step",20)(13,"div",21),c(14,"i",23),n(15,"span"),r(16,"Preview"),i()()(),n(17,"p-step",20)(18,"div",21),c(19,"i",24),n(20,"span"),r(21,"Finish"),i()()()(),n(22,"p-step-panels")(23,"p-step-panel",20),u(24,He,6,4,"ng-template",null,1,d),i(),n(26,"p-step-panel",20),u(27,nt,1,1,"ng-template",null,1,d),i(),n(29,"p-step-panel",20),u(30,it,2,0,"ng-template",null,1,d),i()()()()()()()),t&2){let e=s();l(),M(T(11,De)),l(2),m("ngClass",V(12,Me,e.stepActiveIndex()===2)),l(),m("linear",!0)("value",e.stepActiveIndex()),l(3),m("value",1),l(5),m("value",2),l(5),m("value",3),l(6),m("value",1),l(3),m("value",2),l(3),m("value",3)}}function rt(t,p){if(t&1){let e=v();n(0,"p-button",56),y("onClick",function(){f(e);let o=s();return g(o.summaryDialogVisible.set(!1))}),i()}t&2&&m("rounded",!0)("text",!0)}function at(t,p){if(t&1&&(n(0,"div",57)(1,"h4",58),r(2,"Import Summary"),i(),n(3,"p",59),r(4),i()()),t&2){let e=s();l(4),C("(",e.CSVRowCount()," rows ready for import)")}}function lt(t,p){t&1&&(n(0,"div",63)(1,"h4",64),r(2,"Journal"),i()())}function pt(t,p){t&1&&(n(0,"div",65)(1,"h4",64),r(2,"Debit"),i()())}function mt(t,p){t&1&&(n(0,"div",65)(1,"h4",64),r(2,"Credit"),i()())}function st(t,p){if(t&1&&(n(0,"div",60)(1,"div",61)(2,"p-card"),u(3,lt,3,0,"ng-template",null,3,d),n(5,"div",60)(6,"div",61)(7,"h5",62),r(8),E(9,"number"),i()()()()(),n(10,"div",61)(11,"p-card"),u(12,pt,3,0,"ng-template",null,3,d),n(14,"div",60)(15,"div",61)(16,"h5",62),r(17),E(18,"number"),i()()()()(),n(19,"div",61)(20,"p-card"),u(21,mt,3,0,"ng-template",null,3,d),n(23,"div",60)(24,"div",61)(25,"h5",62),r(26),E(27,"number"),i()()()()()()),t&2){let e=s(2);l(8),C(" ",I(9,3,e.JournalEntryImport().summary.journal)," "),l(9),C(" ",I(18,5,e.JournalEntryImport().summary.debit)," "),l(9),C(" ",I(27,7,e.JournalEntryImport().summary.credit)," ")}}function dt(t,p){if(t&1&&h(0,st,28,9,"div",60),t&2){let e=s();b(e.JournalEntryImport()?0:-1)}}function ct(t,p){if(t&1){let e=v();n(0,"p-button",66),y("click",function(){f(e);let o=s();return g(o.summaryDialogVisible.set(!1))}),i(),n(1,"p-button",67),y("click",function(){f(e);let o=s();return g(o.onConfirmImport())}),i()}}var Kt=(()=>{class t{constructor(){this.service=A(Je),this.router=A(ie),this.subtitle="Accepted file format: .csv & max file size: 1MB",this.stepActiveIndex=w(1),this.JournalEntryImport=w(null),this.summaryDialogVisible=w(!1),this.CSVRowCount=w(0),this.dashboardProps={inline:!0,width:580,height:350},this.uppyCore={restrictions:{allowedFileTypes:["text/csv","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]}},this.SAMPLE_URL="https://resc.cloudinary.com/pos/raw/upload/POS/CSV/Journal_DealPOS.csv"}ngAfterViewInit(){console.log("Stepper instance:",this.stepperRef)}onFileUpload(e){console.log("File upload event:",e);let a=new FormData;Array.isArray(e.currentFiles)&&e.currentFiles.forEach(o=>{o instanceof File&&a.append("File",o,o.name)}),console.log("Form data prepared for upload:",a.get("File")),this.service.importPreviewJournal(a).pipe(R("Import Preview"),B(o=>({cacheKey:o.cacheKey})),j(o=>this.service.importConfirmJournal(o)),J(()=>{this.router.navigate(["/pages/journal/journal-entry"])})).subscribe()}onFileRemoved(e){console.log("File removed event:",e),this.JournalEntryImport.set(null),this.CSVRowCount.set(0)}onNextStep(){if(this.stepActiveIndex()<3&&(this.stepActiveIndex.update(e=>e+1),this.stepActiveIndex()===3)){this.stepActiveIndex.update(()=>this.stepActiveIndex()-1),this.summaryDialogVisible.set(!0);return}}onPrevStep(){this.stepActiveIndex()>1&&this.stepActiveIndex.update(e=>e-1)}onFileUploaded(e){let a=new FormData;if("name"in e&&typeof e.name=="string")a.append("File",e,e.name),this.service.importPreviewJournal(a).pipe(R("Import Preview"),J(o=>{this.JournalEntryImport.set(o)})).subscribe(),Te.default.parse(e,{header:!0,skipEmptyLines:!0,complete:o=>{console.log("CSV Parsing Results:",o),this.CSVRowCount.set(o.data.length)},error:o=>{console.error("Error parsing CSV:",o)}});else return}onConfirmImport(){if(this.JournalEntryImport()&&this.JournalEntryImport().canProceed){let e={cacheKey:this.JournalEntryImport().cacheKey};this.service.importConfirmJournal(e).pipe(R("Import Confirm"),J(()=>{this.router.navigate(["/pages/journal/journal-entry"]),this.stepActiveIndex.update(a=>a+1),this.summaryDialogVisible.update(a=>!a)}),U(a=>(console.error("Error occurred during import confirmation:",a),this.stepActiveIndex.update(o=>o+1),this.summaryDialogVisible.update(o=>!o),N(null)))).subscribe()}else{console.error("Cannot proceed with import, JournalEntryImport is not set or canProceed is false.");return}}onReset(){this.stepActiveIndex.set(1),this.JournalEntryImport.set(null)}handleKeyboardEvent(e){e.key==="F2"&&this.onConfirmImport()}get hasIssue(){let e=this.JournalEntryImport();return e&&Array.isArray(e.dataRow)?e.dataRow.some(a=>{let o=a.issues&&a.issues.length>0,_=Array.isArray(a.items)&&a.items.some(S=>S.issues&&S.issues.length>0);return o||_}):!1}static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275cmp=H({type:t,selectors:[["app-journal-entry-import"]],viewQuery:function(a,o){if(a&1&&L(Ae,5),a&2){let _;O(_=$())&&(o.stepperRef=_.first)}},hostBindings:function(a,o){a&1&&y("keydown",function(S){return o.handleKeyboardEvent(S)},K)},decls:14,vars:10,consts:[["actionButton",""],["content",""],["closeIconTemplate",""],["header",""],["footer",""],["stepper",""],["body",""],["expandedrow",""],["emptymessage",""],["pageTitle","Manual Journal Import"],["position","center","appendTo","body",3,"visibleChange","modal","visible","breakpoints","draggable","closeIconTemplate","dismissableMask"],["label","Back","severity","secondary","variant","outlined",3,"disabled","click",4,"ngIf"],["label","Next","severity","primary",3,"disabled","click",4,"ngIf"],["label","Finish","severity","primary",3,"click",4,"ngIf"],["label","Back","severity","secondary","variant","outlined",3,"click","disabled"],["label","Next","severity","primary",3,"click","disabled"],["label","Finish","severity","primary",3,"click"],[1,"row","justify-content-center"],[1,"col-6",3,"ngClass"],[3,"linear","value"],[3,"value"],[1,"d-flex","gap-2","align-items-center"],[1,"fa-solid","fa-upload"],[1,"fa-solid","fa-file"],[1,"fa-solid","fa-check"],[3,"fileUploaded","fileRemoved","uppyCoreConfiguration","dashboardPropsConfiguration","sampleUrl","subtitle"],[1,"fst-italic"],["href","#","target","_blank",1,"link","link-primary"],["dataKey","number",3,"scrollable","scrollHeight","value"],[2,"width","5rem"],["pSortableColumn","number"],["field","number"],["pSortableColumn","outlet"],["field","outlet"],["pSortableColumn","date"],["field","date"],["pSortableColumn","inventoryStatus"],["field","inventoryStatus"],["type","button","pRipple","",3,"pRowToggler","text","rounded","plain","icon"],[3,"ngClass"],[1,"d-flex","flex-column","gap-2"],[1,"d-flex","flex-column"],["colspan","8"],[1,"p-4"],["dataKey","accountID",3,"value"],["pSortableColumn","accountCode"],["field","accountCode"],["pSortableColumn","accountName"],["field","accountName"],["pSortableColumn","note"],["field","note"],["pSortableColumn","debitAmount"],["field","debitAmount"],["pSortableColumn","creditAmount"],["field","creditAmount"],["colspan","6"],["severity","secondary","variant","outlined","icon","fa-solid fa-xmark",3,"onClick","rounded","text"],[1,"d-flex","gap-2","align-items-baseline"],[1,"fs-4","text-white","m-0"],[1,"m-0","fs-3"],[1,"row"],[1,"col"],[1,"fs-2"],[1,"state-new"],[1,"fs-3","m-0"],[1,"state-unchanged"],["label","Cancel","severity","secondary","variant","outlined",3,"click"],["label","OK (F2)",3,"click"]],template:function(a,o){if(a&1){let _=v();n(0,"app-main-panel",9),u(1,Ke,3,3,"ng-template",null,0,d)(3,ot,32,14,"ng-template",null,1,d),i(),n(5,"p-dialog",10),q("visibleChange",function(k){return f(_),z(o.summaryDialogVisible,k)||(o.summaryDialogVisible=k),g(k)}),u(6,rt,1,2,"ng-template",null,2,d)(8,at,5,1,"ng-template",null,3,d)(10,dt,1,1,"ng-template",null,1,d)(12,ct,2,0,"ng-template",null,4,d),i()}if(a&2){let _=Q(7);l(5),M(T(8,Fe)),m("modal",!0),W("visible",o.summaryDialogVisible),m("breakpoints",T(9,Pe))("draggable",!1)("closeIconTemplate",_)("dismissableMask",!0)}},dependencies:[de,ne,Y,Z,pe,le,Ce,_e,ce,Se,Ie,ve,be,he,Ee,we,ae,re,ye,ue,fe,xe,ge,se,me,oe,te,ee],styles:[".p-datatable-thead>tr>th{background-color:transparent!important;color:#000!important} .p-stepper{display:flex;flex-direction:column;align-items:center} .p-stepper .p-steplist{width:40vw} .p-stepper .p-steppanels{width:100%} .p-card{border-radius:4px} .p-card .p-card-body{padding:.75rem!important} .p-card .p-card-header{display:flex;align-items:center;width:100%} .p-card .p-card-header .state-new{width:inherit;padding:.75rem;vertical-align:middle;background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important} .p-card .p-card-header .state-updated{width:inherit;padding:.75rem;background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important} .p-card .p-card-header .state-unchanged{width:inherit;padding:.75rem;border-bottom:1px solid #dee2e6} .p-card .p-card-header .state-error{width:inherit;padding:.75rem;background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important} pos-uppy div div h4{font-size:16px} pos-uppy div div p{font-size:14px!important} pos-uppy div div hr{margin:0}"],changeDetection:0})}}return t})();export{Kt as JournalEntryImportComponent};
1
+ import{a as Je}from"./chunk-BQDUQ3QB.js";import"./chunk-24XESN42.js";import{a as ve,b as Ee,c as he,d as be,e as Ie,f as Se}from"./chunk-2L65SN3U.js";import{a as Ce,b as ke,c as we}from"./chunk-JM6FKNTC.js";import"./chunk-IEOE2XJ7.js";import{b as ue,d as fe,e as ge,f as xe,i as ye}from"./chunk-5NZPHAOL.js";import"./chunk-Y54QBXKN.js";import"./chunk-X2F5ZNTW.js";import"./chunk-ZULPRZ24.js";import"./chunk-BA72IEO2.js";import{a as R}from"./chunk-TTIQSVQF.js";import{a as oe}from"./chunk-OVMM5CPY.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{a as ce,b as _e}from"./chunk-KG3OLRKU.js";import"./chunk-4D6KKSM5.js";import"./chunk-BEEH5PAA.js";import{d as me,e as se,h as de}from"./chunk-Y6Y3BWAM.js";import"./chunk-MTPMCC6U.js";import{a as le,b as pe}from"./chunk-RO474VQ2.js";import"./chunk-JVSOCU4S.js";import"./chunk-E4FUCIJZ.js";import"./chunk-3BPX4XM7.js";import{H as re,I as ae}from"./chunk-U2ZZPRP6.js";import"./chunk-7C7GSAC3.js";import"./chunk-OQDKL2MG.js";import{d as ie}from"./chunk-7NZRUZLK.js";import"./chunk-WDFE7CAE.js";import"./chunk-DOSAQI5P.js";import"./chunk-MKCZKYSF.js";import"./chunk-EAGKI7R2.js";import{i as Y,l as Z,q as ee,r as te,t as ne}from"./chunk-ISLNIBSF.js";import"./chunk-CJPLD6EO.js";import{Ab as u,Ac as W,Bc as z,Cc as q,F as U,Jc as T,Kc as V,Mb as h,Mc as G,Nb as b,Ob as F,Qb as P,Rb as D,Sb as m,Sc as E,T as j,Tb as n,Tc as I,Ub as i,Uc as X,V as J,Vb as c,Wc as d,ac as v,bb as K,da as A,db as l,fc as y,gc as s,ka as f,kc as L,la as g,lc as O,m as N,mc as $,qc as Q,s as B,tc as M,ub as H,vc as r,wa as w,wc as x,xc as C}from"./chunk-T6YHDD6J.js";import{g as Re}from"./chunk-PRARYYF3.js";var Te=Re(ke());var Ae=["stepper"],Fe=()=>({width:"30vw"}),Pe=()=>({"1199px":"75vw","575px":"100vw"}),De=()=>({height:"calc(100vh - 70px)"}),Me=t=>({"col-12":t}),Ne=(t,p,e)=>({"bg-gradient-danger":t,"bg-gradient-success":p,"bg-gradient-warning":e}),Ve=t=>({"state-danger":t});function Be(t,p){if(t&1){let e=v();n(0,"p-button",14),y("click",function(){f(e);let o=s(2);return g(o.onPrevStep())}),i()}if(t&2){let e=s(2);m("disabled",e.stepActiveIndex()===1)}}function Ue(t,p){if(t&1){let e=v();n(0,"p-button",15),y("click",function(){f(e);let o=s(2);return g(o.onNextStep())}),i()}if(t&2){let e=s(2);m("disabled",e.stepActiveIndex()===3||!e.JournalEntryImport())}}function je(t,p){if(t&1){let e=v();n(0,"p-button",16),y("click",function(){f(e);let o=s(2);return g(o.onReset())}),i()}}function Ke(t,p){if(t&1&&u(0,Be,1,1,"p-button",11)(1,Ue,1,1,"p-button",12)(2,je,1,0,"p-button",13),t&2){let e=s();m("ngIf",e.stepActiveIndex()>1),l(),m("ngIf",e.stepActiveIndex()<3),l(),m("ngIf",e.stepActiveIndex()===3)}}function He(t,p){if(t&1){let e=v();n(0,"POS-uppy",25),y("fileUploaded",function(o){f(e);let _=s(2);return g(_.onFileUploaded(o))})("fileRemoved",function(o){f(e);let _=s(2);return g(_.onFileRemoved(o))}),i(),n(1,"p",26),r(2," Please refer this "),n(3,"a",27),r(4,"article"),i(),r(5," for more information "),i()}if(t&2){let e=s(2);m("uppyCoreConfiguration",e.uppyCore)("dashboardPropsConfiguration",e.dashboardProps)("sampleUrl",e.SAMPLE_URL)("subtitle",e.subtitle)}}function Le(t,p){t&1&&(n(0,"tr"),c(1,"th",29),n(2,"th",30),r(3," Number "),c(4,"p-sortIcon",31),i(),n(5,"th",32),r(6," Outlet "),c(7,"p-sortIcon",33),i(),n(8,"th",34),r(9," Date "),c(10,"p-sortIcon",35),i(),n(11,"th",36),r(12," Status "),c(13,"p-sortIcon",37),i(),n(14,"th"),r(15,"Message"),i()())}function Oe(t,p){if(t&1&&(n(0,"div",41)(1,"span"),r(2),i(),n(3,"span"),r(4),i()()),t&2){let e=p.$implicit;l(2),x(e.issue),l(2),x(e.solution)}}function $e(t,p){if(t&1&&(n(0,"div",40),P(1,Oe,5,2,"div",41,F),i()),t&2){let e=s(2).$implicit;l(),D(e.issues)}}function Qe(t,p){}function We(t,p){if(t&1&&h(0,$e,3,0,"div",40)(1,Qe,0,0),t&2){let e=s().$implicit;b(e.issues&&e.issues.length>0?0:1)}}function ze(t,p){if(t&1&&(n(0,"tr")(1,"td"),c(2,"p-button",38),i(),n(3,"td"),r(4),i(),n(5,"td"),r(6),i(),n(7,"td"),r(8),E(9,"date"),i(),n(10,"td",39),r(11),i(),n(12,"td",39),h(13,We,2,1),i()()),t&2){let e=p.$implicit,a=p.expanded,o=s(4);l(2),m("pRowToggler",e)("text",!0)("rounded",!0)("plain",!0)("icon",a?"fa-solid fa-chevron-down":"fa-solid fa-chevron-right"),l(2),x(e.number),l(2),C(" ",e.outlet," "),l(2),x(X(9,12,e.date,"d MMM y")),l(2),m("ngClass",G(15,Ne,e.actionName==="Error",e.actionName==="New",e.actionName==="Update")),l(),C(" ",e.actionName," "),l(),m("ngClass",V(19,Ve,o.hasIssue)),l(),b(o.hasIssue?13:-1)}}function qe(t,p){t&1&&(n(0,"tr")(1,"th",45),r(2," Code "),c(3,"p-sortIcon",46),i(),n(4,"th",47),r(5," Name "),c(6,"p-sortIcon",48),i(),n(7,"th",49),r(8," Note "),c(9,"p-sortIcon",50),i(),n(10,"th",51),r(11," Debit "),c(12,"p-sortIcon",52),i(),n(13,"th",53),r(14," Credit "),c(15,"p-sortIcon",54),i(),n(16,"th"),r(17,"Message"),i()())}function Ge(t,p){if(t&1&&(n(0,"div",41)(1,"span"),r(2),i(),n(3,"span"),r(4),i()()),t&2){let e=p.$implicit;l(2),x(e.issue),l(2),x(e.solution)}}function Xe(t,p){if(t&1&&(n(0,"div",40),P(1,Ge,5,2,"div",41,F),i()),t&2){let e=s().$implicit;l(),D(e.issues)}}function Ye(t,p){if(t&1&&(n(0,"tr")(1,"td"),r(2),i(),n(3,"td"),r(4),i(),n(5,"td"),r(6),i(),n(7,"td"),r(8),E(9,"number"),i(),n(10,"td"),r(11),E(12,"number"),i(),n(13,"td",39),h(14,Xe,3,0,"div",40),i()()),t&2){let e=p.$implicit,a=s(5);l(2),x(e.accountCode),l(2),x(e.accountName),l(2),x(e.note),l(2),C(" ",I(9,7,e.debitAmount)," "),l(3),C(" ",I(12,9,e.creditAmount)," "),l(2),m("ngClass",V(11,Ve,e.issues&&e.issues.length>0)),l(),b(a.hasIssue?14:-1)}}function Ze(t,p){t&1&&(n(0,"tr")(1,"td",55),r(2," There are no order for this product yet. "),i()())}function et(t,p){if(t&1&&(n(0,"tr")(1,"td",42)(2,"div",43)(3,"p-table",44),u(4,qe,18,0,"ng-template",null,3,d)(6,Ye,15,13,"ng-template",null,6,d)(8,Ze,3,0,"ng-template",null,8,d),i()()()()),t&2){let e=p.$implicit;l(3),m("value",e.items)}}function tt(t,p){if(t&1&&(n(0,"p-table",28),u(1,Le,16,0,"ng-template",null,3,d)(3,ze,14,21,"ng-template",null,6,d)(5,et,10,1,"ng-template",null,7,d),i()),t&2){let e=s(3);m("scrollable",!0)("scrollHeight","calc(100vh - 160px)")("value",e.JournalEntryImport().dataRow)}}function nt(t,p){if(t&1&&h(0,tt,7,3,"p-table",28),t&2){let e=s(2);b(e.JournalEntryImport()?0:-1)}}function it(t,p){t&1&&(n(0,"h5"),r(1,"Successfully Imported"),i())}function ot(t,p){if(t&1&&(n(0,"p-panel")(1,"p-scroll-panel")(2,"div",17)(3,"div",18)(4,"p-stepper",19,5)(6,"p-step-list")(7,"p-step",20)(8,"div",21),c(9,"i",22),n(10,"span"),r(11,"Upload"),i()()(),n(12,"p-step",20)(13,"div",21),c(14,"i",23),n(15,"span"),r(16,"Preview"),i()()(),n(17,"p-step",20)(18,"div",21),c(19,"i",24),n(20,"span"),r(21,"Finish"),i()()()(),n(22,"p-step-panels")(23,"p-step-panel",20),u(24,He,6,4,"ng-template",null,1,d),i(),n(26,"p-step-panel",20),u(27,nt,1,1,"ng-template",null,1,d),i(),n(29,"p-step-panel",20),u(30,it,2,0,"ng-template",null,1,d),i()()()()()()()),t&2){let e=s();l(),M(T(11,De)),l(2),m("ngClass",V(12,Me,e.stepActiveIndex()===2)),l(),m("linear",!0)("value",e.stepActiveIndex()),l(3),m("value",1),l(5),m("value",2),l(5),m("value",3),l(6),m("value",1),l(3),m("value",2),l(3),m("value",3)}}function rt(t,p){if(t&1){let e=v();n(0,"p-button",56),y("onClick",function(){f(e);let o=s();return g(o.summaryDialogVisible.set(!1))}),i()}t&2&&m("rounded",!0)("text",!0)}function at(t,p){if(t&1&&(n(0,"div",57)(1,"h4",58),r(2,"Import Summary"),i(),n(3,"p",59),r(4),i()()),t&2){let e=s();l(4),C("(",e.CSVRowCount()," rows ready for import)")}}function lt(t,p){t&1&&(n(0,"div",63)(1,"h4",64),r(2,"Journal"),i()())}function pt(t,p){t&1&&(n(0,"div",65)(1,"h4",64),r(2,"Debit"),i()())}function mt(t,p){t&1&&(n(0,"div",65)(1,"h4",64),r(2,"Credit"),i()())}function st(t,p){if(t&1&&(n(0,"div",60)(1,"div",61)(2,"p-card"),u(3,lt,3,0,"ng-template",null,3,d),n(5,"div",60)(6,"div",61)(7,"h5",62),r(8),E(9,"number"),i()()()()(),n(10,"div",61)(11,"p-card"),u(12,pt,3,0,"ng-template",null,3,d),n(14,"div",60)(15,"div",61)(16,"h5",62),r(17),E(18,"number"),i()()()()(),n(19,"div",61)(20,"p-card"),u(21,mt,3,0,"ng-template",null,3,d),n(23,"div",60)(24,"div",61)(25,"h5",62),r(26),E(27,"number"),i()()()()()()),t&2){let e=s(2);l(8),C(" ",I(9,3,e.JournalEntryImport().summary.journal)," "),l(9),C(" ",I(18,5,e.JournalEntryImport().summary.debit)," "),l(9),C(" ",I(27,7,e.JournalEntryImport().summary.credit)," ")}}function dt(t,p){if(t&1&&h(0,st,28,9,"div",60),t&2){let e=s();b(e.JournalEntryImport()?0:-1)}}function ct(t,p){if(t&1){let e=v();n(0,"p-button",66),y("click",function(){f(e);let o=s();return g(o.summaryDialogVisible.set(!1))}),i(),n(1,"p-button",67),y("click",function(){f(e);let o=s();return g(o.onConfirmImport())}),i()}}var Kt=(()=>{class t{constructor(){this.service=A(Je),this.router=A(ie),this.subtitle="Accepted file format: .csv & max file size: 1MB",this.stepActiveIndex=w(1),this.JournalEntryImport=w(null),this.summaryDialogVisible=w(!1),this.CSVRowCount=w(0),this.dashboardProps={inline:!0,width:580,height:350},this.uppyCore={restrictions:{allowedFileTypes:["text/csv","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]}},this.SAMPLE_URL="https://resc.cloudinary.com/pos/raw/upload/POS/CSV/Journal_DealPOS.csv"}ngAfterViewInit(){console.log("Stepper instance:",this.stepperRef)}onFileUpload(e){console.log("File upload event:",e);let a=new FormData;Array.isArray(e.currentFiles)&&e.currentFiles.forEach(o=>{o instanceof File&&a.append("File",o,o.name)}),console.log("Form data prepared for upload:",a.get("File")),this.service.importPreviewJournal(a).pipe(R("Import Preview"),B(o=>({cacheKey:o.cacheKey})),j(o=>this.service.importConfirmJournal(o)),J(()=>{this.router.navigate(["/pages/journal/journal-entry"])})).subscribe()}onFileRemoved(e){console.log("File removed event:",e),this.JournalEntryImport.set(null),this.CSVRowCount.set(0)}onNextStep(){if(this.stepActiveIndex()<3&&(this.stepActiveIndex.update(e=>e+1),this.stepActiveIndex()===3)){this.stepActiveIndex.update(()=>this.stepActiveIndex()-1),this.summaryDialogVisible.set(!0);return}}onPrevStep(){this.stepActiveIndex()>1&&this.stepActiveIndex.update(e=>e-1)}onFileUploaded(e){let a=new FormData;if("name"in e&&typeof e.name=="string")a.append("File",e,e.name),this.service.importPreviewJournal(a).pipe(R("Import Preview"),J(o=>{this.JournalEntryImport.set(o)})).subscribe(),Te.default.parse(e,{header:!0,skipEmptyLines:!0,complete:o=>{console.log("CSV Parsing Results:",o),this.CSVRowCount.set(o.data.length)},error:o=>{console.error("Error parsing CSV:",o)}});else return}onConfirmImport(){if(this.JournalEntryImport()&&this.JournalEntryImport().canProceed){let e={cacheKey:this.JournalEntryImport().cacheKey};this.service.importConfirmJournal(e).pipe(R("Import Confirm"),J(()=>{this.router.navigate(["/pages/journal/journal-entry"]),this.stepActiveIndex.update(a=>a+1),this.summaryDialogVisible.update(a=>!a)}),U(a=>(console.error("Error occurred during import confirmation:",a),this.stepActiveIndex.update(o=>o+1),this.summaryDialogVisible.update(o=>!o),N(null)))).subscribe()}else{console.error("Cannot proceed with import, JournalEntryImport is not set or canProceed is false.");return}}onReset(){this.stepActiveIndex.set(1),this.JournalEntryImport.set(null)}handleKeyboardEvent(e){e.key==="F2"&&this.onConfirmImport()}get hasIssue(){let e=this.JournalEntryImport();return e&&Array.isArray(e.dataRow)?e.dataRow.some(a=>{let o=a.issues&&a.issues.length>0,_=Array.isArray(a.items)&&a.items.some(S=>S.issues&&S.issues.length>0);return o||_}):!1}static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275cmp=H({type:t,selectors:[["app-journal-entry-import"]],viewQuery:function(a,o){if(a&1&&L(Ae,5),a&2){let _;O(_=$())&&(o.stepperRef=_.first)}},hostBindings:function(a,o){a&1&&y("keydown",function(S){return o.handleKeyboardEvent(S)},K)},decls:14,vars:10,consts:[["actionButton",""],["content",""],["closeIconTemplate",""],["header",""],["footer",""],["stepper",""],["body",""],["expandedrow",""],["emptymessage",""],["pageTitle","Manual Journal Import"],["position","center","appendTo","body",3,"visibleChange","modal","visible","breakpoints","draggable","closeIconTemplate","dismissableMask"],["label","Back","severity","secondary","variant","outlined",3,"disabled","click",4,"ngIf"],["label","Next","severity","primary",3,"disabled","click",4,"ngIf"],["label","Finish","severity","primary",3,"click",4,"ngIf"],["label","Back","severity","secondary","variant","outlined",3,"click","disabled"],["label","Next","severity","primary",3,"click","disabled"],["label","Finish","severity","primary",3,"click"],[1,"row","justify-content-center"],[1,"col-6",3,"ngClass"],[3,"linear","value"],[3,"value"],[1,"d-flex","gap-2","align-items-center"],[1,"fa-solid","fa-upload"],[1,"fa-solid","fa-file"],[1,"fa-solid","fa-check"],[3,"fileUploaded","fileRemoved","uppyCoreConfiguration","dashboardPropsConfiguration","sampleUrl","subtitle"],[1,"fst-italic"],["href","#","target","_blank",1,"link","link-primary"],["dataKey","number",3,"scrollable","scrollHeight","value"],[2,"width","5rem"],["pSortableColumn","number"],["field","number"],["pSortableColumn","outlet"],["field","outlet"],["pSortableColumn","date"],["field","date"],["pSortableColumn","inventoryStatus"],["field","inventoryStatus"],["type","button","pRipple","",3,"pRowToggler","text","rounded","plain","icon"],[3,"ngClass"],[1,"d-flex","flex-column","gap-2"],[1,"d-flex","flex-column"],["colspan","8"],[1,"p-4"],["dataKey","accountID",3,"value"],["pSortableColumn","accountCode"],["field","accountCode"],["pSortableColumn","accountName"],["field","accountName"],["pSortableColumn","note"],["field","note"],["pSortableColumn","debitAmount"],["field","debitAmount"],["pSortableColumn","creditAmount"],["field","creditAmount"],["colspan","6"],["severity","secondary","variant","outlined","icon","fa-solid fa-xmark",3,"onClick","rounded","text"],[1,"d-flex","gap-2","align-items-baseline"],[1,"fs-4","text-white","m-0"],[1,"m-0","fs-3"],[1,"row"],[1,"col"],[1,"fs-2"],[1,"state-new"],[1,"fs-3","m-0"],[1,"state-unchanged"],["label","Cancel","severity","secondary","variant","outlined",3,"click"],["label","OK (F2)",3,"click"]],template:function(a,o){if(a&1){let _=v();n(0,"app-main-panel",9),u(1,Ke,3,3,"ng-template",null,0,d)(3,ot,32,14,"ng-template",null,1,d),i(),n(5,"p-dialog",10),q("visibleChange",function(k){return f(_),z(o.summaryDialogVisible,k)||(o.summaryDialogVisible=k),g(k)}),u(6,rt,1,2,"ng-template",null,2,d)(8,at,5,1,"ng-template",null,3,d)(10,dt,1,1,"ng-template",null,1,d)(12,ct,2,0,"ng-template",null,4,d),i()}if(a&2){let _=Q(7);l(5),M(T(8,Fe)),m("modal",!0),W("visible",o.summaryDialogVisible),m("breakpoints",T(9,Pe))("draggable",!1)("closeIconTemplate",_)("dismissableMask",!0)}},dependencies:[de,ne,Y,Z,pe,le,Ce,_e,ce,Se,Ie,ve,be,he,Ee,we,ae,re,ye,ue,fe,xe,ge,se,me,oe,te,ee],styles:[".p-datatable-thead>tr>th{background-color:transparent!important;color:#000!important} .p-stepper{display:flex;flex-direction:column;align-items:center} .p-stepper .p-steplist{width:40vw} .p-stepper .p-steppanels{width:100%} .p-card{border-radius:4px} .p-card .p-card-body{padding:.75rem!important} .p-card .p-card-header{display:flex;align-items:center;width:100%} .p-card .p-card-header .state-new{width:inherit;padding:.75rem;vertical-align:middle;background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important} .p-card .p-card-header .state-updated{width:inherit;padding:.75rem;background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important} .p-card .p-card-header .state-unchanged{width:inherit;padding:.75rem;border-bottom:1px solid #dee2e6} .p-card .p-card-header .state-error{width:inherit;padding:.75rem;background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important} pos-uppy div div h4{font-size:16px} pos-uppy div div p{font-size:14px!important} pos-uppy div div hr{margin:0}"],changeDetection:0})}}return t})();export{Kt as JournalEntryImportComponent};