dealposbooks 5.51.1 → 5.51.3

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 (56) hide show
  1. package/{chunk-OW6NHTGL.js → chunk-2NSZXE7A.js} +1 -1
  2. package/{chunk-HR6W3DC4.js → chunk-2PW2KI76.js} +1 -1
  3. package/{chunk-N3AQU3B6.js → chunk-2WVFFG26.js} +1 -1
  4. package/{chunk-EO32GXB6.js → chunk-3WP4K427.js} +1 -1
  5. package/{chunk-VANY33VH.js → chunk-45277TJC.js} +1 -1
  6. package/{chunk-LZCLNB3T.js → chunk-53XLJS5G.js} +1 -1
  7. package/{chunk-OZYL2K6P.js → chunk-5M4HQSDE.js} +1 -1
  8. package/{chunk-7XSFPN5T.js → chunk-66XTNHB6.js} +1 -1
  9. package/{chunk-RCHTOR4U.js → chunk-6C5IVTNB.js} +1 -1
  10. package/{chunk-4BAARBYV.js → chunk-AHS622Q3.js} +1 -1
  11. package/{chunk-Y4SHAFGQ.js → chunk-AKHZNBCJ.js} +1 -1
  12. package/{chunk-UNKPZO2B.js → chunk-BAN4BZ4V.js} +1 -1
  13. package/{chunk-IYV5JRCZ.js → chunk-BDIQKQLH.js} +1 -1
  14. package/{chunk-MGEVP222.js → chunk-BXCI7FLO.js} +1 -1
  15. package/{chunk-6JWBYLFX.js → chunk-C4HVS55R.js} +1 -1
  16. package/{chunk-5SDFH3ZF.js → chunk-CP4OMA5A.js} +1 -1
  17. package/{chunk-YZ76QE4R.js → chunk-DD3C4ZJK.js} +1 -1
  18. package/{chunk-YI5IYWUO.js → chunk-EXPUB774.js} +1 -1
  19. package/{chunk-KU3G54A2.js → chunk-F2AUOYRQ.js} +2 -2
  20. package/{chunk-KPSZN2UI.js → chunk-FLSC37KK.js} +1 -1
  21. package/{chunk-IWB6L5HR.js → chunk-FWCM3R4Q.js} +1 -1
  22. package/chunk-FYFGO4SH.js +1 -0
  23. package/{chunk-PXAENMFN.js → chunk-GKPEHY4C.js} +1 -1
  24. package/{chunk-PZCAY2XI.js → chunk-GXWFHDPQ.js} +1 -1
  25. package/{chunk-FUYYSJF7.js → chunk-H3AE3LK2.js} +1 -1
  26. package/{chunk-EZXX3QNG.js → chunk-H7RIXTPZ.js} +1 -1
  27. package/{chunk-FJM77N3D.js → chunk-HIBQ7GQQ.js} +1 -1
  28. package/{chunk-U52NCHP2.js → chunk-IOUEWZQZ.js} +1 -1
  29. package/{chunk-BBR4SZ4S.js → chunk-JC7ZPT6F.js} +1 -1
  30. package/{chunk-VZHZFGQ2.js → chunk-JUDAFNFD.js} +1 -1
  31. package/{chunk-2Z3VSENH.js → chunk-LM3PSBXX.js} +1 -1
  32. package/{chunk-JNPTKMYO.js → chunk-LME6HR4A.js} +1 -1
  33. package/{chunk-G25BIGG3.js → chunk-MYDWRF4X.js} +1 -1
  34. package/{chunk-E2PHUSPH.js → chunk-N3KDIJIC.js} +1 -1
  35. package/{chunk-U7I6X4QJ.js → chunk-N6QZPVZI.js} +2 -2
  36. package/{chunk-3IOJJMQE.js → chunk-NFJAMS74.js} +1 -1
  37. package/{chunk-RA2HD63W.js → chunk-OO2FDGBF.js} +1 -1
  38. package/{chunk-LP4UYVTQ.js → chunk-P5ND3ICW.js} +2 -2
  39. package/{chunk-PQ2NDMDD.js → chunk-PROCZGHH.js} +1 -1
  40. package/{chunk-RNMAINY3.js → chunk-QBBXI37N.js} +1 -1
  41. package/{chunk-JRHKJYE2.js → chunk-QCJYNI45.js} +1 -1
  42. package/{chunk-MDE76CBT.js → chunk-RJDZR2TQ.js} +1 -1
  43. package/{chunk-X7I6QMMX.js → chunk-RRWAF23G.js} +1 -1
  44. package/{chunk-5MLCIFDJ.js → chunk-TBMRVRBG.js} +1 -1
  45. package/{chunk-Z2MDQN57.js → chunk-TPVWARR4.js} +1 -1
  46. package/{chunk-2UDDXT3B.js → chunk-UMXCHIQ6.js} +1 -1
  47. package/{chunk-VYR5D7SO.js → chunk-VF3GNEJQ.js} +1 -1
  48. package/{chunk-3PM6I5JR.js → chunk-VJVH5N44.js} +1 -1
  49. package/{chunk-ZM7C3PCP.js → chunk-W23IXSWP.js} +1 -1
  50. package/{chunk-I3DG6HPA.js → chunk-W2RBWHBT.js} +1 -1
  51. package/{chunk-QSZKELXB.js → chunk-XPKM4HTA.js} +1 -1
  52. package/{chunk-WNEAYP2J.js → chunk-ZBRAMWLM.js} +1 -1
  53. package/index.html +2 -2
  54. package/{main-ARGVLXJ4.js → main-AK3IBIXE.js} +1 -1
  55. package/package.json +1 -1
  56. package/chunk-UMDFA3TV.js +0 -1
@@ -1 +1 @@
1
- import{a as F}from"./chunk-RCHTOR4U.js";import{a as je}from"./chunk-SVGPDGYN.js";import{a as ze}from"./chunk-YHLRDTIS.js";import{a as Be,b as He}from"./chunk-LO4HJ77Y.js";import{a as oe}from"./chunk-QSZKELXB.js";import{b as D}from"./chunk-Y4SHAFGQ.js";import{a as Pe}from"./chunk-XKI7WLHE.js";import"./chunk-KQZMRRMA.js";import"./chunk-ZC7ZENN7.js";import"./chunk-WL6ZZCYW.js";import{a as z,b as j}from"./chunk-3VQUNDVT.js";import{b as Je,g as Ne,h as ke,i as Me}from"./chunk-52EMI2TW.js";import"./chunk-AAKZYXG3.js";import{a as Ve,b as De}from"./chunk-BME4Z6DH.js";import"./chunk-VSDW2RJ5.js";import"./chunk-7L5IAWG2.js";import"./chunk-MJGBBYIO.js";import"./chunk-CN6AT4LE.js";import{a as Fe,b as Ae}from"./chunk-OW2ND5HU.js";import"./chunk-JWNGZMSE.js";import"./chunk-II7KELI4.js";import"./chunk-FTBQKOYS.js";import"./chunk-L4ENW4RK.js";import"./chunk-KONCSTVQ.js";import"./chunk-FMAG3RQL.js";import{i as Ee}from"./chunk-YI5IYWUO.js";import"./chunk-VM56C6ZV.js";import{a as xe,b as Ce}from"./chunk-ISIYG4D5.js";import{a as ve,b as y,c as ye,d as we,e as Re,f as Ie,g as Te}from"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{n as fe,o as _e,w as ge,x as he,y as be,z as Se}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import{b as re,c as ae,e as le,f as me,k as pe,m as se,p as ce,v as de,y as ue}from"./chunk-MGIEURA2.js";import"./chunk-DZCJWJUG.js";import"./chunk-YZ76QE4R.js";import"./chunk-G3BJCT7T.js";import"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import{j as Y,l as Z,m as ee,p as te,r as ie,u as ne}from"./chunk-DM2JLWKE.js";import{Cb as K,Dc as Q,Eb as g,Fc as E,Ha as k,Mb as c,Oc as I,Pc as X,Qc as V,Sc as v,Wb as r,Xb as o,Y as N,Yb as b,_ as U,ac as w,bd as T,c as A,db as L,eb as O,fc as R,gc as _,ia as C,ib as m,qa as h,ra as x,s as J,sc as s,tc as S,uc as M,wc as W,xc as $,yb as G,yc as P,zc as q}from"./chunk-6QJHEOXN.js";import{a as d,b as f}from"./chunk-YQFG5XE2.js";var We={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,customerID:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,paymentState:0}},filter:{number:null,outletName:null,from:null,to:null,customerID:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,paymentState:0}},B=ye(Te(We),we(t=>({first:T(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:T(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:T(()=>t.data().data.some(a=>a.checked)),checkedARCollection:T(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),Ie(t=>{let a=C(F),e=C(D);return{updateFilter(n){y(t,i=>f(d({},i),{filter:d(d({},i.filter),n)}))},onRowSelect(n){y(t,i=>{let u=i.data.data.map(p=>p.id===n.id?f(d({},p),{checked:!0}):p);return f(d({},i),{data:f(d({},i.data),{data:u})})})},onRowUnselect(n){y(t,i=>{let u=i.data.data.map(p=>p.id===n.id?f(d({},p),{checked:!1}):p);return f(d({},i),{data:f(d({},i.data),{data:u})})})},onHeaderCheckboxToggle(n){y(t,i=>{let u=i.data.data.map(p=>f(d({},p),{checked:n}));return f(d({},i),{data:f(d({},i.data),{data:u})})})},getARLoader:z(A(N(()=>a.getARJournalLoader().pipe(j({next:n=>{y(t,i=>f(d({},i),{meta:n}))},error:n=>{console.error("Error fetching AR collection loader:",n)}}))))),getARCollection:z(A(J(n=>Object.entries(n).reduce((i,[u,p])=>(p!=null&&(i[u]=p),i),{})),N(n=>a.getARJournal(n).pipe(J(i=>f(d({},i),{data:i.data.map(u=>f(d({},u),{due:e.from(u.due)?e.from(u.due).format():null,checked:!1}))})),j({next:i=>{y(t,u=>f(d({},u),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),Re(t=>({onInit:()=>{t.getARLoader(),t.getARCollection(t.filter)}})));var H=t=>({"ng-invalid ng-dirty":t});function $e(t,a){if(t&1){let e=w();r(0,"p-button",10),R("onClick",function(){h(e);let n=_(2);return x(n.onCreateJournal())}),o()}}function qe(t,a){if(t&1&&g(0,$e,1,0,"p-button",9),t&2){let e=_();c("ngIf",e.store.hasCheckedRows())}}function Qe(t,a){t&1&&(r(0,"tr")(1,"th",12),b(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),s(4,"Tag"),o(),r(5,"th",14),s(6,"Number"),o(),r(7,"th",15),s(8,"Customer"),o(),r(9,"th",16),s(10,"Date"),o(),r(11,"th",16),s(12,"Due"),o(),r(13,"th",15),s(14,"Note"),o(),r(15,"th",17),s(16,"Payment"),o(),b(17,"th",18),o())}function Xe(t,a){if(t&1&&(r(0,"tr")(1,"td"),b(2,"p-tableCheckbox",19),o(),r(3,"td"),s(4),o(),r(5,"td")(6,"a",20),s(7),o()(),r(8,"td"),s(9),o(),r(10,"td"),s(11),I(12,"date"),o(),r(13,"td"),s(14),I(15,"date"),o(),r(16,"td"),b(17,"div",21),o(),r(18,"td"),s(19),o(),r(20,"td"),b(21,"p-button",22),o()()),t&2){let e=a.$implicit,l=_(2);m(2),c("value",e),m(2),S(e.outlet),m(2),c("href",l.authService.getTenantExternalURL()+"/menu/Debt/Debt/Join_Invoice/New_Join_Invoice/Info?ID="+e.id,O),m(),M(" ",e.number," "),m(2),S(e.customer),m(2),S(V(12,12,e.date,"d MMM y")),m(3),S(e.due?V(15,15,e.due,"d MMM y hh:mm"):"-"),m(3),c("innerHTML",e.note,L),m(2),S(e.payment),m(2),c("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function Ye(t,a){if(t&1&&s(0),t&2){let e=_(2);W(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Ze(t,a){t&1&&(r(0,"tr")(1,"td",23)(2,"span"),s(3,"No records found."),o()()())}function et(t,a){if(t&1){let e=w();r(0,"p-panel")(1,"p-table",11),R("onPage",function(n){h(e);let i=_();return x(i.onPageChange(n))})("onHeaderCheckboxToggle",function(n){h(e);let i=_();return x(i.onHeaderCheckboxToggle(n))})("onRowSelect",function(n){h(e);let i=_();return x(i.onRowSelect(n))})("onRowUnselect",function(n){h(e);let i=_();return x(i.onRowUnselect(n))}),g(2,Qe,18,0,"ng-template",null,3,v)(4,Xe,22,18,"ng-template",null,4,v)(6,Ye,1,3,"ng-template",null,5,v)(8,Ze,4,0,"ng-template",null,6,v),o()()}if(t&2){let e=_();m(),c("value",e.store.data().data)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function tt(t,a){if(t&1&&(r(0,"span",34),s(1),I(2,"truncate"),o()),t&2){let e=a.$implicit;c("pTooltip",e.name),m(),M(" ",V(2,2,e.name,30)," ")}}function it(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function nt(t,a){if(t&1&&(r(0,"div"),g(1,it,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("from"))}}function ot(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function rt(t,a){if(t&1&&(r(0,"div"),g(1,ot,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("to"))}}function at(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function lt(t,a){if(t&1&&(r(0,"div"),g(1,at,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("pageSize"))}}function mt(t,a){if(t&1){let e=w();r(0,"form",24)(1,"div",25)(2,"label",26),s(3,"Tag"),o(),r(4,"p-select",27),g(5,tt,3,5,"ng-template",null,7,v),o()(),r(7,"div",25)(8,"label",26),s(9,"From - To"),o(),r(10,"div",28),b(11,"p-datepicker",29),g(12,nt,2,1,"div",30),b(13,"p-datepicker",31),g(14,rt,2,1,"div",30),o()(),r(15,"div",25)(16,"label",26),s(17,"Customer"),o(),r(18,"p-autocomplete",32),I(19,"async"),R("completeMethod",function(n){h(e);let i=_();return x(i.onSearchContact(n))}),o()(),r(20,"div",25)(21,"label",26),s(22,"Page Size"),o(),b(23,"input",33),g(24,lt,2,1,"div",30),o()()}if(t&2){let e=_();c("formGroup",e.form),m(4),c("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),m(7),c("iconDisplay","input")("showIcon",!0)("ngClass",E(16,H,e.isInvalid("from"))),m(),c("ngIf",e.isInvalid("from")),m(),c("iconDisplay","input")("showIcon",!0)("ngClass",E(18,H,e.isInvalid("to"))),m(),c("ngIf",e.isInvalid("to")),m(4),c("suggestions",X(19,14,e.customerSuggestions$)),m(5),c("ngClass",E(20,H,e.isInvalid("pageSize"))),m(),c("ngIf",e.isInvalid("pageSize"))}}var Yt=(()=>{class t extends Pe{constructor(){super(),this.store=C(B),this.generateJournalService=C(F),this.authService=C(oe),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=C(de),this.dayjsService=C(D)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:l,to:n,pageNumber:i,pageSize:u,export:p,exportPageNumber:Ue,exportPageSize:Le,outletName:Oe,customerID:Ge,paymentState:Ke}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),from:this.fb.control(this.dayjsService.from(l)?this.dayjsService.from(l).toDate():null),to:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),pageNumber:this.fb.control(i),pageSize:this.fb.control(u,[ae.required]),export:this.fb.control(p),exportPageNumber:this.fb.control(Ue),exportPageSize:this.fb.control(Le),outletName:this.fb.control(Oe),customerID:this.fb.control(Ge),paymentState:this.fb.control(Ke)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((l,[n,i])=>{switch(n){case"customerID":i||(l[n]=ze);break;case"from":typeof i=="object"?l[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:l[n]=i!=null?String(i):null;break;case"to":typeof i=="object"?l[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:l[n]=i!=null?String(i):null;break;default:l[n]=i===null?"":i;break}return l},{});console.log("Filter Body:",e),this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}onSearchContact(e){this.customerSuggestions$=this.generateJournalService.getCustomerSuggestions(e.query)}onSearch(e){this.store.updateFilter(f(d({},this.store.filter()),{number:e,pageNumber:1})),this.store.getARCollection(this.store.filter())}onPageChange(e){let l=e.first/e.rows;this.store.updateFilter(f(d({},this.store.filter()),{pageNumber:l+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(l=>{this.store.onRowUnselect(l)});return}else this.store.onRowUnselect(e.data)}onCreateJournal(){this.generateJournalService.createARJournal(this.store.checkedARCollection()).pipe(U(()=>this.store.getARCollection(this.store.filter))).subscribe()}static{this.\u0275fac=function(l){return new(l||t)}}static{this.\u0275cmp=G({type:t,selectors:[["app-ar-journal"]],features:[Q([B]),K],decls:8,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Join Invoice",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onHeaderCheckboxToggle","onRowSelect","onRowUnselect","value","paginator","rows","totalRecords","lazy"],[2,"width","1rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[2,"width","4rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"innerHTML"],[3,"icon","severity","text"],["colspan","9"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["virtualScroll","","showClear","","filter","","filterBy","name","formControlName","outletName","appendTo","body","optionLabel","name","optionValue","name","placeholder","Select an Tag",3,"virtualScrollItemSize","options"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["showClear","","formControlName","customerID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize","appMaskNumber","",3,"ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(l,n){if(l&1){let i=w();r(0,"app-main-panel",8),q("isDialogFilterVisibleChange",function(p){return h(i),P(n.isDialogFilterVisible,p)||(n.isDialogFilterVisible=p),x(p)})("isInitDialogFilterVisibleChange",function(p){return h(i),P(n.isInitDialogFilterVisible,p)||(n.isInitDialogFilterVisible=p),x(p)}),R("filterConfirmed",function(){return h(i),x(n.onFilterOKEvent())})("search",function(p){return h(i),x(n.onSearch(p))}),g(1,qe,1,1,"ng-template",null,0,v)(3,et,10,5,"ng-template",null,1,v),s(5," <"),g(6,mt,25,22,"ng-template",null,2,v),o()}l&2&&(c("isSearchableInput",!0)("isFilterable",!0),$("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible),c("scrollable",!0))},dependencies:[Ee,ne,Y,Z,ee,te,ie,Me,Je,Ne,ke,he,ge,Ce,xe,ue,pe,re,le,me,se,ce,Ae,Fe,De,Ve,He,Be,_e,fe,ve,Se,be,je],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{Yt as ARJournalComponent};
1
+ import{a as F}from"./chunk-6C5IVTNB.js";import{a as je}from"./chunk-SVGPDGYN.js";import{a as ze}from"./chunk-YHLRDTIS.js";import{a as Be,b as He}from"./chunk-LO4HJ77Y.js";import{a as oe}from"./chunk-XPKM4HTA.js";import{b as D}from"./chunk-AKHZNBCJ.js";import{a as Pe}from"./chunk-XKI7WLHE.js";import"./chunk-KQZMRRMA.js";import"./chunk-ZC7ZENN7.js";import"./chunk-WL6ZZCYW.js";import{a as z,b as j}from"./chunk-3VQUNDVT.js";import{b as Je,g as Ne,h as ke,i as Me}from"./chunk-52EMI2TW.js";import"./chunk-AAKZYXG3.js";import{a as Ve,b as De}from"./chunk-BME4Z6DH.js";import"./chunk-VSDW2RJ5.js";import"./chunk-7L5IAWG2.js";import"./chunk-MJGBBYIO.js";import"./chunk-CN6AT4LE.js";import{a as Fe,b as Ae}from"./chunk-OW2ND5HU.js";import"./chunk-JWNGZMSE.js";import"./chunk-II7KELI4.js";import"./chunk-FTBQKOYS.js";import"./chunk-L4ENW4RK.js";import"./chunk-KONCSTVQ.js";import"./chunk-FMAG3RQL.js";import{i as Ee}from"./chunk-EXPUB774.js";import"./chunk-VM56C6ZV.js";import{a as xe,b as Ce}from"./chunk-ISIYG4D5.js";import{a as ve,b as y,c as ye,d as we,e as Re,f as Ie,g as Te}from"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{n as fe,o as _e,w as ge,x as he,y as be,z as Se}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import{b as re,c as ae,e as le,f as me,k as pe,m as se,p as ce,v as de,y as ue}from"./chunk-MGIEURA2.js";import"./chunk-DZCJWJUG.js";import"./chunk-DD3C4ZJK.js";import"./chunk-G3BJCT7T.js";import"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import{j as Y,l as Z,m as ee,p as te,r as ie,u as ne}from"./chunk-DM2JLWKE.js";import{Cb as K,Dc as Q,Eb as g,Fc as E,Ha as k,Mb as c,Oc as I,Pc as X,Qc as V,Sc as v,Wb as r,Xb as o,Y as N,Yb as b,_ as U,ac as w,bd as T,c as A,db as L,eb as O,fc as R,gc as _,ia as C,ib as m,qa as h,ra as x,s as J,sc as s,tc as S,uc as M,wc as W,xc as $,yb as G,yc as P,zc as q}from"./chunk-6QJHEOXN.js";import{a as d,b as f}from"./chunk-YQFG5XE2.js";var We={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,customerID:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,paymentState:0}},filter:{number:null,outletName:null,from:null,to:null,customerID:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,paymentState:0}},B=ye(Te(We),we(t=>({first:T(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:T(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:T(()=>t.data().data.some(a=>a.checked)),checkedARCollection:T(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),Ie(t=>{let a=C(F),e=C(D);return{updateFilter(n){y(t,i=>f(d({},i),{filter:d(d({},i.filter),n)}))},onRowSelect(n){y(t,i=>{let u=i.data.data.map(p=>p.id===n.id?f(d({},p),{checked:!0}):p);return f(d({},i),{data:f(d({},i.data),{data:u})})})},onRowUnselect(n){y(t,i=>{let u=i.data.data.map(p=>p.id===n.id?f(d({},p),{checked:!1}):p);return f(d({},i),{data:f(d({},i.data),{data:u})})})},onHeaderCheckboxToggle(n){y(t,i=>{let u=i.data.data.map(p=>f(d({},p),{checked:n}));return f(d({},i),{data:f(d({},i.data),{data:u})})})},getARLoader:z(A(N(()=>a.getARJournalLoader().pipe(j({next:n=>{y(t,i=>f(d({},i),{meta:n}))},error:n=>{console.error("Error fetching AR collection loader:",n)}}))))),getARCollection:z(A(J(n=>Object.entries(n).reduce((i,[u,p])=>(p!=null&&(i[u]=p),i),{})),N(n=>a.getARJournal(n).pipe(J(i=>f(d({},i),{data:i.data.map(u=>f(d({},u),{due:e.from(u.due)?e.from(u.due).format():null,checked:!1}))})),j({next:i=>{y(t,u=>f(d({},u),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),Re(t=>({onInit:()=>{t.getARLoader(),t.getARCollection(t.filter)}})));var H=t=>({"ng-invalid ng-dirty":t});function $e(t,a){if(t&1){let e=w();r(0,"p-button",10),R("onClick",function(){h(e);let n=_(2);return x(n.onCreateJournal())}),o()}}function qe(t,a){if(t&1&&g(0,$e,1,0,"p-button",9),t&2){let e=_();c("ngIf",e.store.hasCheckedRows())}}function Qe(t,a){t&1&&(r(0,"tr")(1,"th",12),b(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),s(4,"Tag"),o(),r(5,"th",14),s(6,"Number"),o(),r(7,"th",15),s(8,"Customer"),o(),r(9,"th",16),s(10,"Date"),o(),r(11,"th",16),s(12,"Due"),o(),r(13,"th",15),s(14,"Note"),o(),r(15,"th",17),s(16,"Payment"),o(),b(17,"th",18),o())}function Xe(t,a){if(t&1&&(r(0,"tr")(1,"td"),b(2,"p-tableCheckbox",19),o(),r(3,"td"),s(4),o(),r(5,"td")(6,"a",20),s(7),o()(),r(8,"td"),s(9),o(),r(10,"td"),s(11),I(12,"date"),o(),r(13,"td"),s(14),I(15,"date"),o(),r(16,"td"),b(17,"div",21),o(),r(18,"td"),s(19),o(),r(20,"td"),b(21,"p-button",22),o()()),t&2){let e=a.$implicit,l=_(2);m(2),c("value",e),m(2),S(e.outlet),m(2),c("href",l.authService.getTenantExternalURL()+"/menu/Debt/Debt/Join_Invoice/New_Join_Invoice/Info?ID="+e.id,O),m(),M(" ",e.number," "),m(2),S(e.customer),m(2),S(V(12,12,e.date,"d MMM y")),m(3),S(e.due?V(15,15,e.due,"d MMM y hh:mm"):"-"),m(3),c("innerHTML",e.note,L),m(2),S(e.payment),m(2),c("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function Ye(t,a){if(t&1&&s(0),t&2){let e=_(2);W(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Ze(t,a){t&1&&(r(0,"tr")(1,"td",23)(2,"span"),s(3,"No records found."),o()()())}function et(t,a){if(t&1){let e=w();r(0,"p-panel")(1,"p-table",11),R("onPage",function(n){h(e);let i=_();return x(i.onPageChange(n))})("onHeaderCheckboxToggle",function(n){h(e);let i=_();return x(i.onHeaderCheckboxToggle(n))})("onRowSelect",function(n){h(e);let i=_();return x(i.onRowSelect(n))})("onRowUnselect",function(n){h(e);let i=_();return x(i.onRowUnselect(n))}),g(2,Qe,18,0,"ng-template",null,3,v)(4,Xe,22,18,"ng-template",null,4,v)(6,Ye,1,3,"ng-template",null,5,v)(8,Ze,4,0,"ng-template",null,6,v),o()()}if(t&2){let e=_();m(),c("value",e.store.data().data)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function tt(t,a){if(t&1&&(r(0,"span",34),s(1),I(2,"truncate"),o()),t&2){let e=a.$implicit;c("pTooltip",e.name),m(),M(" ",V(2,2,e.name,30)," ")}}function it(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function nt(t,a){if(t&1&&(r(0,"div"),g(1,it,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("from"))}}function ot(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function rt(t,a){if(t&1&&(r(0,"div"),g(1,ot,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("to"))}}function at(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function lt(t,a){if(t&1&&(r(0,"div"),g(1,at,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("pageSize"))}}function mt(t,a){if(t&1){let e=w();r(0,"form",24)(1,"div",25)(2,"label",26),s(3,"Tag"),o(),r(4,"p-select",27),g(5,tt,3,5,"ng-template",null,7,v),o()(),r(7,"div",25)(8,"label",26),s(9,"From - To"),o(),r(10,"div",28),b(11,"p-datepicker",29),g(12,nt,2,1,"div",30),b(13,"p-datepicker",31),g(14,rt,2,1,"div",30),o()(),r(15,"div",25)(16,"label",26),s(17,"Customer"),o(),r(18,"p-autocomplete",32),I(19,"async"),R("completeMethod",function(n){h(e);let i=_();return x(i.onSearchContact(n))}),o()(),r(20,"div",25)(21,"label",26),s(22,"Page Size"),o(),b(23,"input",33),g(24,lt,2,1,"div",30),o()()}if(t&2){let e=_();c("formGroup",e.form),m(4),c("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),m(7),c("iconDisplay","input")("showIcon",!0)("ngClass",E(16,H,e.isInvalid("from"))),m(),c("ngIf",e.isInvalid("from")),m(),c("iconDisplay","input")("showIcon",!0)("ngClass",E(18,H,e.isInvalid("to"))),m(),c("ngIf",e.isInvalid("to")),m(4),c("suggestions",X(19,14,e.customerSuggestions$)),m(5),c("ngClass",E(20,H,e.isInvalid("pageSize"))),m(),c("ngIf",e.isInvalid("pageSize"))}}var Yt=(()=>{class t extends Pe{constructor(){super(),this.store=C(B),this.generateJournalService=C(F),this.authService=C(oe),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=C(de),this.dayjsService=C(D)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:l,to:n,pageNumber:i,pageSize:u,export:p,exportPageNumber:Ue,exportPageSize:Le,outletName:Oe,customerID:Ge,paymentState:Ke}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),from:this.fb.control(this.dayjsService.from(l)?this.dayjsService.from(l).toDate():null),to:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),pageNumber:this.fb.control(i),pageSize:this.fb.control(u,[ae.required]),export:this.fb.control(p),exportPageNumber:this.fb.control(Ue),exportPageSize:this.fb.control(Le),outletName:this.fb.control(Oe),customerID:this.fb.control(Ge),paymentState:this.fb.control(Ke)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((l,[n,i])=>{switch(n){case"customerID":i||(l[n]=ze);break;case"from":typeof i=="object"?l[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:l[n]=i!=null?String(i):null;break;case"to":typeof i=="object"?l[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:l[n]=i!=null?String(i):null;break;default:l[n]=i===null?"":i;break}return l},{});console.log("Filter Body:",e),this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}onSearchContact(e){this.customerSuggestions$=this.generateJournalService.getCustomerSuggestions(e.query)}onSearch(e){this.store.updateFilter(f(d({},this.store.filter()),{number:e,pageNumber:1})),this.store.getARCollection(this.store.filter())}onPageChange(e){let l=e.first/e.rows;this.store.updateFilter(f(d({},this.store.filter()),{pageNumber:l+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(l=>{this.store.onRowUnselect(l)});return}else this.store.onRowUnselect(e.data)}onCreateJournal(){this.generateJournalService.createARJournal(this.store.checkedARCollection()).pipe(U(()=>this.store.getARCollection(this.store.filter))).subscribe()}static{this.\u0275fac=function(l){return new(l||t)}}static{this.\u0275cmp=G({type:t,selectors:[["app-ar-journal"]],features:[Q([B]),K],decls:8,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Join Invoice",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onHeaderCheckboxToggle","onRowSelect","onRowUnselect","value","paginator","rows","totalRecords","lazy"],[2,"width","1rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[2,"width","4rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"innerHTML"],[3,"icon","severity","text"],["colspan","9"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["virtualScroll","","showClear","","filter","","filterBy","name","formControlName","outletName","appendTo","body","optionLabel","name","optionValue","name","placeholder","Select an Tag",3,"virtualScrollItemSize","options"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["showClear","","formControlName","customerID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize","appMaskNumber","",3,"ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(l,n){if(l&1){let i=w();r(0,"app-main-panel",8),q("isDialogFilterVisibleChange",function(p){return h(i),P(n.isDialogFilterVisible,p)||(n.isDialogFilterVisible=p),x(p)})("isInitDialogFilterVisibleChange",function(p){return h(i),P(n.isInitDialogFilterVisible,p)||(n.isInitDialogFilterVisible=p),x(p)}),R("filterConfirmed",function(){return h(i),x(n.onFilterOKEvent())})("search",function(p){return h(i),x(n.onSearch(p))}),g(1,qe,1,1,"ng-template",null,0,v)(3,et,10,5,"ng-template",null,1,v),s(5," <"),g(6,mt,25,22,"ng-template",null,2,v),o()}l&2&&(c("isSearchableInput",!0)("isFilterable",!0),$("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible),c("scrollable",!0))},dependencies:[Ee,ne,Y,Z,ee,te,ie,Me,Je,Ne,ke,he,ge,Ce,xe,ue,pe,re,le,me,se,ce,Ae,Fe,De,Ve,He,Be,_e,fe,ve,Se,be,je],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{Yt as ARJournalComponent};
@@ -1 +1 @@
1
- import{a as Q}from"./chunk-U4AN6IWJ.js";import{f as xt}from"./chunk-YR5KRTHR.js";import{b as vt}from"./chunk-BME4Z6DH.js";import"./chunk-VSDW2RJ5.js";import"./chunk-7L5IAWG2.js";import{a as N}from"./chunk-BT7Y4ADP.js";import{b as Pt}from"./chunk-5U7KZJ3H.js";import{a as P,b as D}from"./chunk-FHJOSHI3.js";import"./chunk-KONCSTVQ.js";import"./chunk-FMAG3RQL.js";import{g as S,h as E,i as Mt}from"./chunk-YI5IYWUO.js";import"./chunk-VM56C6ZV.js";import{a as Tt,b as Ot}from"./chunk-ISIYG4D5.js";import"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import{c as ft}from"./chunk-BFEM6LX7.js";import{y as kt,z as yt}from"./chunk-O44DI62I.js";import{a as w,b as H}from"./chunk-DTYVTTET.js";import{Ma as bt,y as Ct}from"./chunk-MGIEURA2.js";import{l as gt}from"./chunk-DZCJWJUG.js";import{b as q}from"./chunk-YZ76QE4R.js";import{a as ut}from"./chunk-G3BJCT7T.js";import"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import{d as _t}from"./chunk-KL3TPLRB.js";import{s as mt,u as ht}from"./chunk-DM2JLWKE.js";import{Da as b,Eb as _,Fa as $,Ha as h,L as z,Mb as m,Oc as J,Pc as K,Rb as f,Sb as it,Sc as X,Ta as tt,Ub as ot,Vb as at,Wb as a,Wc as lt,Xb as r,Yb as g,_ as I,ac as C,bd as dt,ca as Z,cd as T,fc as B,gc as s,ia as u,ib as p,mc as rt,nb as et,nc as st,oc as pt,qa as l,ra as d,rc as R,s as F,sc as k,t as A,tb as nt,tc as ct,u as j,uc as U,wa as W,xc as y,yb as O,yc as M,zc as v}from"./chunk-6QJHEOXN.js";import{a as L,b as V}from"./chunk-YQFG5XE2.js";var G=(()=>{class n{constructor(){this.httpService=u(ut)}createDashboardParams(t){return new _t().set("DashboardPeriod",t)}fetchDashboardLoader(){return this.httpService.get(void 0,"api/DashboardLoader")}fetchCashAndSplineData(t){let e=this.createDashboardParams(t);return this.httpService.get(void 0,"api/dashboard/getcashandbank",{params:e})}fetchCashAndBankPieData(t){let e=this.createDashboardParams(t);return this.httpService.get(void 0,"api/dashboard/getcashandbankpiechart",{params:e})}fetchExpenseSplineData(t){let e=this.createDashboardParams(t);return this.httpService.get(void 0,"api/dashboard/GetExpense",{params:e})}fetchExpensePieData(t){let e=this.createDashboardParams(t);return this.httpService.get(void 0,"api/dashboard/GetExpensePieChart",{params:e})}static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275prov=Z({token:n,factory:n.\u0275fac,providedIn:"root"})}}return n})();function Bt(n,c){if(n&1){let t=C();a(0,"p-card",2)(1,"highcharts-chart",5),v("updateChange",function(i){l(t);let o=s();return M(o.updateFlag,i)||(o.updateFlag=i),d(i)}),r()()}if(n&2){let t=s();p(),m("constructorType",t.chartConstructor)("options",t.chartOptionsSpline),y("update",t.updateFlag),m("oneToOne",t.oneToOneFlag)}}function Lt(n,c){n&1&&(a(0,"p-card"),g(1,"p-skeleton",6),r())}function Vt(n,c){if(n&1){let t=C();a(0,"p-card",4)(1,"highcharts-chart",5),v("updateChange",function(i){l(t);let o=s();return M(o.updateFlag,i)||(o.updateFlag=i),d(i)}),r()()}if(n&2){let t=s();p(),m("constructorType",t.chartConstructor)("options",t.chartOptionsPie),y("update",t.updateFlag),m("oneToOne",t.oneToOneFlag)}}function Ft(n,c){n&1&&(a(0,"p-card"),g(1,"p-skeleton",6),r())}var Et=(()=>{class n{constructor(){this.chartConstructor="chart",this.updateFlag=!1,this.oneToOneFlag=!0,this.chartOptionsSpline={},this.chartOptionsPie={},this.dashboardService=u(G),this.cdr=u(lt),this.injector=u(W),this.params=h({dashboardPeriod:2}),this.cashBankTitle=b(),this.amountCashBank=b(),this.isLoading=nt(!0),this.tooltip=b(),this.cashAndBankSource=H((q.production?w(this.params):w(this.params).pipe(z(500))).pipe(j(({dashboardPeriod:t})=>A([this.dashboardService.fetchCashAndSplineData(t),this.dashboardService.fetchCashAndBankPieData(t)])),N("Cash & Bank Dashboard Data"),I(([t])=>{this.isLoading.set(!1),this.amountCashBank.emit(t.data),this.tooltip.emit(t.toolTip)}),F(([t,e])=>({splineData:t,pieData:e}))),{initialValue:null}),T(()=>{let t=this.cashAndBankSource();if(!t)return;let{splineData:e,pieData:i}=t;this.cashBankTitle.emit(e.title),tt(()=>{this.chartOptionsSpline={chart:{height:300},title:{text:e.chartTitle,align:"left",style:{fontWeight:"normal"}},xAxis:{categories:[...e.chart.labels]},yAxis:{title:{text:""}},series:[V(L({},e.chart.series),{type:"spline",name:"Amount",data:[...e.chart.series.data]})],plotOptions:{line:{dataLabels:{enabled:!0},enableMouseTracking:!1}}},this.chartOptionsPie={chart:{type:"pie"},title:{text:e.pieTitle,align:"left",style:{fontWeight:"normal"}},series:[{type:"pie",name:"Amount",data:[...i.series.filter(o=>o.y>0)]}],plotOptions:{pie:{allowPointSelect:!0,cursor:"pointer",dataLabels:[{enabled:!1}],showInLegend:!0}}},this.updateFlag=!0,this.cdr.detectChanges()},{injector:this.injector})})}static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275cmp=O({type:n,selectors:[["app-cash-bank"]],inputs:{isLoading:[1,"isLoading"]},outputs:{cashBankTitle:"cashBankTitle",amountCashBank:"amountCashBank",isLoading:"isLoadingChange",tooltip:"tooltip"},decls:7,vars:2,consts:[[1,"row"],[1,"col-12","col-md-6","col-lg-7"],[1,"chart"],[1,"col-12","col-md-6","col-lg-5"],[1,"pie_chart"],[1,"chart",3,"updateChange","constructorType","options","update","oneToOne"],["width","100%","height","15rem"]],template:function(e,i){e&1&&(a(0,"div",0)(1,"div",1),_(2,Bt,2,4,"p-card",2)(3,Lt,2,0,"p-card"),r(),a(4,"div",3),_(5,Vt,2,4,"p-card",4)(6,Ft,2,0,"p-card"),r()()),e&2&&(p(2),f(i.isLoading()?3:2),p(3),f(i.isLoading()?6:5))},dependencies:[Q,E,S,D,P],styles:[".chart[_ngcontent-%COMP%]{width:100%;height:400px;display:block} p-card.chart .p-card-body{padding-top:0!important;padding-bottom:0!important} p-card.pie_chart .p-card-body{padding-top:0!important;padding-bottom:0!important}"]})}}return n})();function At(n,c){if(n&1){let t=C();a(0,"p-card",2)(1,"highcharts-chart",5),v("updateChange",function(i){l(t);let o=s();return M(o.updateFlag,i)||(o.updateFlag=i),d(i)}),r()()}if(n&2){let t=s();p(),m("constructorType",t.chartConstructor)("options",t.chartOptionsSpline),y("update",t.updateFlag),m("oneToOne",t.oneToOneFlag)}}function jt(n,c){n&1&&(a(0,"p-card"),g(1,"p-skeleton",6),r())}function zt(n,c){if(n&1){let t=C();a(0,"p-card",4)(1,"highcharts-chart",5),v("updateChange",function(i){l(t);let o=s();return M(o.updateFlag,i)||(o.updateFlag=i),d(i)}),r()()}if(n&2){let t=s();p(),m("constructorType",t.chartConstructor)("options",t.chartOptionsPie),y("update",t.updateFlag),m("oneToOne",t.oneToOneFlag)}}function It(n,c){n&1&&(a(0,"p-card"),g(1,"p-skeleton",6),r())}var Dt=(()=>{class n{constructor(){this.chartConstructor="chart",this.updateFlag=!1,this.oneToOneFlag=!0,this.chartOptionsSpline={},this.chartOptionsPie={},this.dashboardService=u(G),this.isLoading=h(!0),this.amountExpense=b(),this.params=h({dashboardPeriod:2}),this.expenseTitle=b(),this.tooltip=b(),this.expenseSource=H((q.production?w(this.params):w(this.params).pipe(z(500))).pipe(j(({dashboardPeriod:t})=>A([this.dashboardService.fetchExpenseSplineData(t),this.dashboardService.fetchExpensePieData(t)])),N("Expense Dashboard Data"),I(([t])=>{this.isLoading.set(!1),this.amountExpense.emit(t.data),this.expenseTitle.emit(t.title),this.tooltip.emit(t.toolTip)}),F(([t,e])=>({splineData:t,pieData:e}))),{initialValue:null}),T(()=>{let t=this.expenseSource();if(!t)return;let{splineData:e,pieData:i}=t;console.log("Spline Data:",e),console.log("Pie Data:",i),this.chartOptionsSpline={chart:{height:300},title:{text:e.chartTitle,align:"left",style:{fontWeight:"normal"}},xAxis:{categories:[...e.chart.labels]},yAxis:{title:{text:""}},series:[V(L({},e.chart.series),{type:"spline",name:"Amount",data:[...e.chart.series.data]})],plotOptions:{line:{dataLabels:{enabled:!0},enableMouseTracking:!1}}},this.chartOptionsPie={chart:{type:"pie"},title:{text:e.pieTitle,align:"left",style:{fontWeight:"normal"}},series:[{type:"pie",name:"Amount",data:[...i.series.filter(o=>o.y>0)]}],plotOptions:{pie:{allowPointSelect:!0,cursor:"pointer",dataLabels:[{enabled:!1}],showInLegend:!0}}},this.updateFlag=!0})}static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275cmp=O({type:n,selectors:[["app-expense"]],outputs:{amountExpense:"amountExpense",expenseTitle:"expenseTitle",tooltip:"tooltip"},decls:7,vars:2,consts:[[1,"row"],[1,"col-12","col-md-6","col-lg-7"],[1,"chart"],[1,"col-12","col-md-6","col-lg-5"],[1,"pie_chart"],[1,"chart",3,"updateChange","constructorType","options","update","oneToOne"],["width","100%","height","15rem"]],template:function(e,i){e&1&&(a(0,"div",0)(1,"div",1),_(2,At,2,4,"p-card",2)(3,jt,2,0,"p-card"),r(),a(4,"div",3),_(5,zt,2,4,"p-card",4)(6,It,2,0,"p-card"),r()()),e&2&&(p(2),f(i.isLoading()?3:2),p(3),f(i.isLoading()?6:5))},dependencies:[Q,E,S,D,P],styles:[".chart[_ngcontent-%COMP%]{width:100%;height:400px;display:block} p-card.chart .p-card-body{padding-top:0!important;padding-bottom:0!important} p-card.pie_chart .p-card-body{padding-top:0!important;padding-bottom:0!important}"]})}}return n})();function Wt(n,c){if(n&1&&(a(0,"span"),k(1),r()),n&2){let t=c.$implicit;p(),ct(t)}}function Rt(n,c){if(n&1&&(a(0,"div",21),ot(1,Wt,2,1,"span",null,it),r()),n&2){let t=s(3);p(),at(t.tooltipExpense())}}function qt(n,c){if(n&1){let t=C();g(0,"input",10,1),a(2,"button",11),B("click",function(i){l(t);let o=R(1),x=s(2);return d(x.handleLinkClick(i,o))}),a(3,"div",12)(4,"div",13)(5,"div",14),g(6,"i",15),r()(),a(7,"p-card",16,2),_(9,Rt,3,0,"ng-template",null,3,X),a(11,"div",17)(12,"div",18)(13,"span",19),k(14,"Expense"),r(),a(15,"p",20),k(16),J(17,"number"),r()()()()()()}if(n&2){let t=R(10),e=s(2);p(7),m("pTooltip",t)("fitContent",!1),p(9),U(" ",K(17,3,e.amounts.expense())," ")}}function Ht(n,c){n&1&&g(0,"p-skeleton",9)}function Nt(n,c){if(n&1&&(a(0,"div",17)(1,"div",18)(2,"span",19),k(3,"Cash and Bank"),r(),a(4,"p",20),k(5),J(6,"number"),r()()()),n&2){let t=s(3);p(5),U(" ",t.amounts.cashBank()===0?"-":K(6,1,t.amounts.cashBank())," ")}}function Qt(n,c){if(n&1){let t=C();g(0,"input",22,4),a(2,"button",11),B("click",function(i){l(t);let o=R(1),x=s(2);return d(x.handleLinkClick(i,o))}),a(3,"div",12)(4,"div",23),g(5,"i",24),r(),a(6,"p-card",25,2),_(8,Nt,7,3,"ng-template",26),r()()()}if(n&2){let t=s(2);p(6),m("pTooltip",t.tooltip.cashBank())}}function Gt(n,c){n&1&&g(0,"p-skeleton",9)}function Ut(n,c){if(n&1){let t=C();a(0,"app-expense",27),B("amountExpense",function(i){l(t);let o=s(2);return d(o.onAmountExpense(i))})("expenseTitle",function(i){l(t);let o=s(2);return d(o.onExpenseTitle(i))})("tooltip",function(i){l(t);let o=s(2);return d(o.onExpenseTooltip(i))}),r()}}function Jt(n,c){if(n&1){let t=C();a(0,"app-cash-bank",28),B("cashBankTitle",function(i){l(t);let o=s(2);return d(o.onCashBankTitle(i))})("amountCashBank",function(i){l(t);let o=s(2);return d(o.onAmountCashBank(i))})("tooltip",function(i){l(t);let o=s(2);return d(o.onCashBankTooltip(i))}),r()}}function Kt(n,c){if(n&1&&(a(0,"p-panel")(1,"main",6)(2,"div",7)(3,"div",8),_(4,qt,18,5)(5,Ht,1,0,"p-skeleton",9),r(),a(6,"div",8),_(7,Qt,9,1)(8,Gt,1,0,"p-skeleton",9),r()(),_(9,Ut,1,0,"app-expense")(10,Jt,1,0,"app-cash-bank"),r()()),n&2){let t=s();p(4),f(t.isLoading()?5:4),p(3),f(t.isLoading()?8:7),p(2),f(t.activeIndex()===0?9:t.activeIndex()===1?10:-1)}}var Ge=(()=>{class n{constructor(){this.activeIndex=h(0),this.pageTitle=h("Dashboard"),this.isLoading=h(!0),this.tooltip={cashBank:h(""),expense:h("")},this.renderer=u(et),this.injector=u(W),this.tooltipExpense=dt(()=>this.tooltip.expense().match(/^(.*?)\s*(\[[^\]]+\])$/)?[RegExp.$1.trim(),RegExp.$2.trim()]:[this.tooltip.expense()]),this.amounts={cashBank:h(0),expense:h(0)}}ngAfterViewInit(){T(()=>{this.isLoading()||queueMicrotask(()=>this.runCardEffect())},{injector:this.injector}),T(()=>{this.activeIndex(),queueMicrotask(()=>this.runCardEffect())},{injector:this.injector})}runCardEffect(){let t=this.activeIndex(),e=this.cards?.toArray();if(!e||e.length===0)return;e.forEach(o=>{let x=o.nativeElement.querySelector(".p-card-body");x&&(this.renderer.setStyle(x,"height","90px"),this.renderer.removeStyle(x,"background-color"),this.renderer.removeStyle(x,"box-shadow"))});let i=e[t];if(i){let o=i.nativeElement.querySelector(".p-card-body");o&&(this.renderer.setStyle(o,"background-color","#F0F0F0"),this.renderer.setStyle(o,"overflow","hidden"))}}onTabChange(t){this.activeIndex.set(t)}handleLinkClick(t,e){t.stopPropagation(),e.checked=!e.checked,e.checked&&(console.log(e.value),this.onTabChange(Number(e.value)))}onCashBankTitle(t){this.pageTitle.set(t),this.isLoading.set(!1)}onExpenseTitle(t){this.pageTitle.set(t),this.isLoading.set(!1)}onAmountCashBank(t){console.log("Total Amount from CashBank:",t),this.amounts.cashBank.set(t)}onAmountExpense(t){console.log("Total Amount from Expense:",t),this.amounts.expense.set(t)}onExpenseTooltip(t){this.tooltip.expense.set(t)}onCashBankTooltip(t){this.tooltip.cashBank.set(t)}static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275cmp=O({type:n,selectors:[["ng-component"]],viewQuery:function(e,i){if(e&1&&rt(P,5,$),e&2){let o;st(o=pt())&&(i.cards=o)}},decls:3,vars:5,consts:[["content",""],["expenseCheckbox",""],["card",""],["tooltipContent",""],["cashBankCheckbox",""],[3,"hasMainWrapperPadding","limitStrLength","overflowScroll","isLoading","pageTitle"],[1,"d-flex","flex-column","row-gap-10"],[1,"row","row-gap-24"],[1,"col-12","col-md-6","col-lg-4"],["width","100%","height","8rem"],["name","dashboardOption","type","radio","hidden","","value","0"],[1,"btn","p-0","border-none","btn-link","w-100",3,"click"],[1,"card-container"],[1,"box-icon",2,"background-color","#d73636"],[1,"d-flex","text-white","align-items-baseline"],[1,"fa-solid","fa-circle-dollar-to-slot"],["tooltipPosition","top",3,"pTooltip","fitContent"],[1,"d-flex","justify-content-end"],[1,"d-flex","flex-column","align-items-end"],[1,"fs-5"],[1,"box-number","fs-4"],[1,"d-flex","flex-column"],["name","dashboardOption","type","radio","hidden","","value","1"],[1,"box-icon"],[1,"fa-duotone","fa-solid","fa-wallet","text-white"],["tooltipPosition","top",3,"pTooltip"],["pTemplate","content"],[3,"amountExpense","expenseTitle","tooltip"],[3,"cashBankTitle","amountCashBank","tooltip"]],template:function(e,i){e&1&&(a(0,"app-main-panel",5),_(1,Kt,11,3,"ng-template",null,0,X),r()),e&2&&m("hasMainWrapperPadding",!0)("limitStrLength",50)("overflowScroll",!0)("isLoading",i.isLoading())("pageTitle",i.pageTitle())},dependencies:[xt,ft,Mt,D,P,bt,ht,mt,Pt,gt,Ot,Tt,Ct,vt,Et,Dt,E,S,yt,kt],styles:['@charset "UTF-8";.card-container[_ngcontent-%COMP%] a[_ngcontent-%COMP%], .card-container[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0}.card-container[_ngcontent-%COMP%]{position:relative;height:4rem}.card-container[_ngcontent-%COMP%] .box-icon[_ngcontent-%COMP%]{height:50px;width:50px;background-color:#2175d0;display:flex;justify-content:center;align-items:center;z-index:2;position:relative;border-radius:4px;left:1.5rem;top:-.6rem}.card-container[_ngcontent-%COMP%] .box-icon[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:30px}.card-container[_ngcontent-%COMP%] .box-number[_ngcontent-%COMP%]{font-size:1.25rem;font-weight:500}.card-container[_ngcontent-%COMP%] .box-title[_ngcontent-%COMP%]{font-size:1rem}.card-container[_ngcontent-%COMP%] p-card[_ngcontent-%COMP%]{position:absolute;top:calc(2.6rem - 55%);left:0;width:100%;z-index:1;margin:0!important;padding:0!important}@media (max-width: 85rem){.card-container[_ngcontent-%COMP%] a[_ngcontent-%COMP%], .card-container[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0}.card-container[_ngcontent-%COMP%]{position:relative;height:4rem}.card-container[_ngcontent-%COMP%] .box-icon[_ngcontent-%COMP%]{height:50px;width:50px;background-color:#2175d0;display:flex;justify-content:center;align-items:center;z-index:2;position:relative;border-radius:4px;left:1.5rem;top:-.6rem}.card-container[_ngcontent-%COMP%] .box-icon[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:30px}.card-container[_ngcontent-%COMP%] .box-number[_ngcontent-%COMP%]{font-size:1.25rem;font-weight:500}.card-container[_ngcontent-%COMP%] .box-title[_ngcontent-%COMP%]{font-size:1rem}.card-container[_ngcontent-%COMP%] p-card[_ngcontent-%COMP%]{position:absolute;top:calc(2.6rem - 55%);left:0;width:100%;z-index:1;margin:0!important;padding:0!important}}@media (min-width: 85.001rem) and (max-width: 97.999rem){.card-container[_ngcontent-%COMP%] a[_ngcontent-%COMP%], .card-container[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0}.card-container[_ngcontent-%COMP%]{position:relative;height:4rem}.card-container[_ngcontent-%COMP%] .box-icon[_ngcontent-%COMP%]{height:50px;width:50px;background-color:#2175d0;display:flex;justify-content:center;align-items:center;z-index:2;position:relative;border-radius:4px;left:1.5rem;top:-.6rem}.card-container[_ngcontent-%COMP%] .box-icon[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:30px}.card-container[_ngcontent-%COMP%] .box-number[_ngcontent-%COMP%]{font-size:1.25rem;font-weight:500}.card-container[_ngcontent-%COMP%] .box-title[_ngcontent-%COMP%]{font-size:1rem}.card-container[_ngcontent-%COMP%] p-card[_ngcontent-%COMP%]{position:absolute;top:calc(2.6rem - 55%);left:0;width:100%;z-index:1;margin:0!important;padding:0!important}}@media (min-width: 98rem){.card-container[_ngcontent-%COMP%] a[_ngcontent-%COMP%], .card-container[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0}.card-container[_ngcontent-%COMP%]{position:relative;height:4rem}.card-container[_ngcontent-%COMP%] .box-icon[_ngcontent-%COMP%]{height:80px;width:80px;background-color:#2175d0;display:flex;justify-content:center;align-items:center;z-index:2;position:relative;border-radius:4px;left:1.5rem;top:-.6rem}.card-container[_ngcontent-%COMP%] .box-icon[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:40px}.card-container[_ngcontent-%COMP%] .box-number[_ngcontent-%COMP%]{font-size:1.25rem;font-weight:500}.card-container[_ngcontent-%COMP%] .box-title[_ngcontent-%COMP%]{font-size:1.15rem}.card-container[_ngcontent-%COMP%] p-card[_ngcontent-%COMP%]{position:absolute;top:calc(2.6rem - 55%);left:0;width:100%;z-index:1;margin:0!important;padding:0!important}}']})}}return n})();export{Ge as Dashboard1Component};
1
+ import{a as Q}from"./chunk-U4AN6IWJ.js";import{f as xt}from"./chunk-YR5KRTHR.js";import{b as vt}from"./chunk-BME4Z6DH.js";import"./chunk-VSDW2RJ5.js";import"./chunk-7L5IAWG2.js";import{a as N}from"./chunk-BT7Y4ADP.js";import{b as Pt}from"./chunk-5U7KZJ3H.js";import{a as P,b as D}from"./chunk-FHJOSHI3.js";import"./chunk-KONCSTVQ.js";import"./chunk-FMAG3RQL.js";import{g as S,h as E,i as Mt}from"./chunk-EXPUB774.js";import"./chunk-VM56C6ZV.js";import{a as Tt,b as Ot}from"./chunk-ISIYG4D5.js";import"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import{c as ft}from"./chunk-BFEM6LX7.js";import{y as kt,z as yt}from"./chunk-O44DI62I.js";import{a as w,b as H}from"./chunk-DTYVTTET.js";import{Ma as bt,y as Ct}from"./chunk-MGIEURA2.js";import{l as gt}from"./chunk-DZCJWJUG.js";import{b as q}from"./chunk-DD3C4ZJK.js";import{a as ut}from"./chunk-G3BJCT7T.js";import"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import{d as _t}from"./chunk-KL3TPLRB.js";import{s as mt,u as ht}from"./chunk-DM2JLWKE.js";import{Da as b,Eb as _,Fa as $,Ha as h,L as z,Mb as m,Oc as J,Pc as K,Rb as f,Sb as it,Sc as X,Ta as tt,Ub as ot,Vb as at,Wb as a,Wc as lt,Xb as r,Yb as g,_ as I,ac as C,bd as dt,ca as Z,cd as T,fc as B,gc as s,ia as u,ib as p,mc as rt,nb as et,nc as st,oc as pt,qa as l,ra as d,rc as R,s as F,sc as k,t as A,tb as nt,tc as ct,u as j,uc as U,wa as W,xc as y,yb as O,yc as M,zc as v}from"./chunk-6QJHEOXN.js";import{a as L,b as V}from"./chunk-YQFG5XE2.js";var G=(()=>{class n{constructor(){this.httpService=u(ut)}createDashboardParams(t){return new _t().set("DashboardPeriod",t)}fetchDashboardLoader(){return this.httpService.get(void 0,"api/DashboardLoader")}fetchCashAndSplineData(t){let e=this.createDashboardParams(t);return this.httpService.get(void 0,"api/dashboard/getcashandbank",{params:e})}fetchCashAndBankPieData(t){let e=this.createDashboardParams(t);return this.httpService.get(void 0,"api/dashboard/getcashandbankpiechart",{params:e})}fetchExpenseSplineData(t){let e=this.createDashboardParams(t);return this.httpService.get(void 0,"api/dashboard/GetExpense",{params:e})}fetchExpensePieData(t){let e=this.createDashboardParams(t);return this.httpService.get(void 0,"api/dashboard/GetExpensePieChart",{params:e})}static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275prov=Z({token:n,factory:n.\u0275fac,providedIn:"root"})}}return n})();function Bt(n,c){if(n&1){let t=C();a(0,"p-card",2)(1,"highcharts-chart",5),v("updateChange",function(i){l(t);let o=s();return M(o.updateFlag,i)||(o.updateFlag=i),d(i)}),r()()}if(n&2){let t=s();p(),m("constructorType",t.chartConstructor)("options",t.chartOptionsSpline),y("update",t.updateFlag),m("oneToOne",t.oneToOneFlag)}}function Lt(n,c){n&1&&(a(0,"p-card"),g(1,"p-skeleton",6),r())}function Vt(n,c){if(n&1){let t=C();a(0,"p-card",4)(1,"highcharts-chart",5),v("updateChange",function(i){l(t);let o=s();return M(o.updateFlag,i)||(o.updateFlag=i),d(i)}),r()()}if(n&2){let t=s();p(),m("constructorType",t.chartConstructor)("options",t.chartOptionsPie),y("update",t.updateFlag),m("oneToOne",t.oneToOneFlag)}}function Ft(n,c){n&1&&(a(0,"p-card"),g(1,"p-skeleton",6),r())}var Et=(()=>{class n{constructor(){this.chartConstructor="chart",this.updateFlag=!1,this.oneToOneFlag=!0,this.chartOptionsSpline={},this.chartOptionsPie={},this.dashboardService=u(G),this.cdr=u(lt),this.injector=u(W),this.params=h({dashboardPeriod:2}),this.cashBankTitle=b(),this.amountCashBank=b(),this.isLoading=nt(!0),this.tooltip=b(),this.cashAndBankSource=H((q.production?w(this.params):w(this.params).pipe(z(500))).pipe(j(({dashboardPeriod:t})=>A([this.dashboardService.fetchCashAndSplineData(t),this.dashboardService.fetchCashAndBankPieData(t)])),N("Cash & Bank Dashboard Data"),I(([t])=>{this.isLoading.set(!1),this.amountCashBank.emit(t.data),this.tooltip.emit(t.toolTip)}),F(([t,e])=>({splineData:t,pieData:e}))),{initialValue:null}),T(()=>{let t=this.cashAndBankSource();if(!t)return;let{splineData:e,pieData:i}=t;this.cashBankTitle.emit(e.title),tt(()=>{this.chartOptionsSpline={chart:{height:300},title:{text:e.chartTitle,align:"left",style:{fontWeight:"normal"}},xAxis:{categories:[...e.chart.labels]},yAxis:{title:{text:""}},series:[V(L({},e.chart.series),{type:"spline",name:"Amount",data:[...e.chart.series.data]})],plotOptions:{line:{dataLabels:{enabled:!0},enableMouseTracking:!1}}},this.chartOptionsPie={chart:{type:"pie"},title:{text:e.pieTitle,align:"left",style:{fontWeight:"normal"}},series:[{type:"pie",name:"Amount",data:[...i.series.filter(o=>o.y>0)]}],plotOptions:{pie:{allowPointSelect:!0,cursor:"pointer",dataLabels:[{enabled:!1}],showInLegend:!0}}},this.updateFlag=!0,this.cdr.detectChanges()},{injector:this.injector})})}static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275cmp=O({type:n,selectors:[["app-cash-bank"]],inputs:{isLoading:[1,"isLoading"]},outputs:{cashBankTitle:"cashBankTitle",amountCashBank:"amountCashBank",isLoading:"isLoadingChange",tooltip:"tooltip"},decls:7,vars:2,consts:[[1,"row"],[1,"col-12","col-md-6","col-lg-7"],[1,"chart"],[1,"col-12","col-md-6","col-lg-5"],[1,"pie_chart"],[1,"chart",3,"updateChange","constructorType","options","update","oneToOne"],["width","100%","height","15rem"]],template:function(e,i){e&1&&(a(0,"div",0)(1,"div",1),_(2,Bt,2,4,"p-card",2)(3,Lt,2,0,"p-card"),r(),a(4,"div",3),_(5,Vt,2,4,"p-card",4)(6,Ft,2,0,"p-card"),r()()),e&2&&(p(2),f(i.isLoading()?3:2),p(3),f(i.isLoading()?6:5))},dependencies:[Q,E,S,D,P],styles:[".chart[_ngcontent-%COMP%]{width:100%;height:400px;display:block} p-card.chart .p-card-body{padding-top:0!important;padding-bottom:0!important} p-card.pie_chart .p-card-body{padding-top:0!important;padding-bottom:0!important}"]})}}return n})();function At(n,c){if(n&1){let t=C();a(0,"p-card",2)(1,"highcharts-chart",5),v("updateChange",function(i){l(t);let o=s();return M(o.updateFlag,i)||(o.updateFlag=i),d(i)}),r()()}if(n&2){let t=s();p(),m("constructorType",t.chartConstructor)("options",t.chartOptionsSpline),y("update",t.updateFlag),m("oneToOne",t.oneToOneFlag)}}function jt(n,c){n&1&&(a(0,"p-card"),g(1,"p-skeleton",6),r())}function zt(n,c){if(n&1){let t=C();a(0,"p-card",4)(1,"highcharts-chart",5),v("updateChange",function(i){l(t);let o=s();return M(o.updateFlag,i)||(o.updateFlag=i),d(i)}),r()()}if(n&2){let t=s();p(),m("constructorType",t.chartConstructor)("options",t.chartOptionsPie),y("update",t.updateFlag),m("oneToOne",t.oneToOneFlag)}}function It(n,c){n&1&&(a(0,"p-card"),g(1,"p-skeleton",6),r())}var Dt=(()=>{class n{constructor(){this.chartConstructor="chart",this.updateFlag=!1,this.oneToOneFlag=!0,this.chartOptionsSpline={},this.chartOptionsPie={},this.dashboardService=u(G),this.isLoading=h(!0),this.amountExpense=b(),this.params=h({dashboardPeriod:2}),this.expenseTitle=b(),this.tooltip=b(),this.expenseSource=H((q.production?w(this.params):w(this.params).pipe(z(500))).pipe(j(({dashboardPeriod:t})=>A([this.dashboardService.fetchExpenseSplineData(t),this.dashboardService.fetchExpensePieData(t)])),N("Expense Dashboard Data"),I(([t])=>{this.isLoading.set(!1),this.amountExpense.emit(t.data),this.expenseTitle.emit(t.title),this.tooltip.emit(t.toolTip)}),F(([t,e])=>({splineData:t,pieData:e}))),{initialValue:null}),T(()=>{let t=this.expenseSource();if(!t)return;let{splineData:e,pieData:i}=t;console.log("Spline Data:",e),console.log("Pie Data:",i),this.chartOptionsSpline={chart:{height:300},title:{text:e.chartTitle,align:"left",style:{fontWeight:"normal"}},xAxis:{categories:[...e.chart.labels]},yAxis:{title:{text:""}},series:[V(L({},e.chart.series),{type:"spline",name:"Amount",data:[...e.chart.series.data]})],plotOptions:{line:{dataLabels:{enabled:!0},enableMouseTracking:!1}}},this.chartOptionsPie={chart:{type:"pie"},title:{text:e.pieTitle,align:"left",style:{fontWeight:"normal"}},series:[{type:"pie",name:"Amount",data:[...i.series.filter(o=>o.y>0)]}],plotOptions:{pie:{allowPointSelect:!0,cursor:"pointer",dataLabels:[{enabled:!1}],showInLegend:!0}}},this.updateFlag=!0})}static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275cmp=O({type:n,selectors:[["app-expense"]],outputs:{amountExpense:"amountExpense",expenseTitle:"expenseTitle",tooltip:"tooltip"},decls:7,vars:2,consts:[[1,"row"],[1,"col-12","col-md-6","col-lg-7"],[1,"chart"],[1,"col-12","col-md-6","col-lg-5"],[1,"pie_chart"],[1,"chart",3,"updateChange","constructorType","options","update","oneToOne"],["width","100%","height","15rem"]],template:function(e,i){e&1&&(a(0,"div",0)(1,"div",1),_(2,At,2,4,"p-card",2)(3,jt,2,0,"p-card"),r(),a(4,"div",3),_(5,zt,2,4,"p-card",4)(6,It,2,0,"p-card"),r()()),e&2&&(p(2),f(i.isLoading()?3:2),p(3),f(i.isLoading()?6:5))},dependencies:[Q,E,S,D,P],styles:[".chart[_ngcontent-%COMP%]{width:100%;height:400px;display:block} p-card.chart .p-card-body{padding-top:0!important;padding-bottom:0!important} p-card.pie_chart .p-card-body{padding-top:0!important;padding-bottom:0!important}"]})}}return n})();function Wt(n,c){if(n&1&&(a(0,"span"),k(1),r()),n&2){let t=c.$implicit;p(),ct(t)}}function Rt(n,c){if(n&1&&(a(0,"div",21),ot(1,Wt,2,1,"span",null,it),r()),n&2){let t=s(3);p(),at(t.tooltipExpense())}}function qt(n,c){if(n&1){let t=C();g(0,"input",10,1),a(2,"button",11),B("click",function(i){l(t);let o=R(1),x=s(2);return d(x.handleLinkClick(i,o))}),a(3,"div",12)(4,"div",13)(5,"div",14),g(6,"i",15),r()(),a(7,"p-card",16,2),_(9,Rt,3,0,"ng-template",null,3,X),a(11,"div",17)(12,"div",18)(13,"span",19),k(14,"Expense"),r(),a(15,"p",20),k(16),J(17,"number"),r()()()()()()}if(n&2){let t=R(10),e=s(2);p(7),m("pTooltip",t)("fitContent",!1),p(9),U(" ",K(17,3,e.amounts.expense())," ")}}function Ht(n,c){n&1&&g(0,"p-skeleton",9)}function Nt(n,c){if(n&1&&(a(0,"div",17)(1,"div",18)(2,"span",19),k(3,"Cash and Bank"),r(),a(4,"p",20),k(5),J(6,"number"),r()()()),n&2){let t=s(3);p(5),U(" ",t.amounts.cashBank()===0?"-":K(6,1,t.amounts.cashBank())," ")}}function Qt(n,c){if(n&1){let t=C();g(0,"input",22,4),a(2,"button",11),B("click",function(i){l(t);let o=R(1),x=s(2);return d(x.handleLinkClick(i,o))}),a(3,"div",12)(4,"div",23),g(5,"i",24),r(),a(6,"p-card",25,2),_(8,Nt,7,3,"ng-template",26),r()()()}if(n&2){let t=s(2);p(6),m("pTooltip",t.tooltip.cashBank())}}function Gt(n,c){n&1&&g(0,"p-skeleton",9)}function Ut(n,c){if(n&1){let t=C();a(0,"app-expense",27),B("amountExpense",function(i){l(t);let o=s(2);return d(o.onAmountExpense(i))})("expenseTitle",function(i){l(t);let o=s(2);return d(o.onExpenseTitle(i))})("tooltip",function(i){l(t);let o=s(2);return d(o.onExpenseTooltip(i))}),r()}}function Jt(n,c){if(n&1){let t=C();a(0,"app-cash-bank",28),B("cashBankTitle",function(i){l(t);let o=s(2);return d(o.onCashBankTitle(i))})("amountCashBank",function(i){l(t);let o=s(2);return d(o.onAmountCashBank(i))})("tooltip",function(i){l(t);let o=s(2);return d(o.onCashBankTooltip(i))}),r()}}function Kt(n,c){if(n&1&&(a(0,"p-panel")(1,"main",6)(2,"div",7)(3,"div",8),_(4,qt,18,5)(5,Ht,1,0,"p-skeleton",9),r(),a(6,"div",8),_(7,Qt,9,1)(8,Gt,1,0,"p-skeleton",9),r()(),_(9,Ut,1,0,"app-expense")(10,Jt,1,0,"app-cash-bank"),r()()),n&2){let t=s();p(4),f(t.isLoading()?5:4),p(3),f(t.isLoading()?8:7),p(2),f(t.activeIndex()===0?9:t.activeIndex()===1?10:-1)}}var Ge=(()=>{class n{constructor(){this.activeIndex=h(0),this.pageTitle=h("Dashboard"),this.isLoading=h(!0),this.tooltip={cashBank:h(""),expense:h("")},this.renderer=u(et),this.injector=u(W),this.tooltipExpense=dt(()=>this.tooltip.expense().match(/^(.*?)\s*(\[[^\]]+\])$/)?[RegExp.$1.trim(),RegExp.$2.trim()]:[this.tooltip.expense()]),this.amounts={cashBank:h(0),expense:h(0)}}ngAfterViewInit(){T(()=>{this.isLoading()||queueMicrotask(()=>this.runCardEffect())},{injector:this.injector}),T(()=>{this.activeIndex(),queueMicrotask(()=>this.runCardEffect())},{injector:this.injector})}runCardEffect(){let t=this.activeIndex(),e=this.cards?.toArray();if(!e||e.length===0)return;e.forEach(o=>{let x=o.nativeElement.querySelector(".p-card-body");x&&(this.renderer.setStyle(x,"height","90px"),this.renderer.removeStyle(x,"background-color"),this.renderer.removeStyle(x,"box-shadow"))});let i=e[t];if(i){let o=i.nativeElement.querySelector(".p-card-body");o&&(this.renderer.setStyle(o,"background-color","#F0F0F0"),this.renderer.setStyle(o,"overflow","hidden"))}}onTabChange(t){this.activeIndex.set(t)}handleLinkClick(t,e){t.stopPropagation(),e.checked=!e.checked,e.checked&&(console.log(e.value),this.onTabChange(Number(e.value)))}onCashBankTitle(t){this.pageTitle.set(t),this.isLoading.set(!1)}onExpenseTitle(t){this.pageTitle.set(t),this.isLoading.set(!1)}onAmountCashBank(t){console.log("Total Amount from CashBank:",t),this.amounts.cashBank.set(t)}onAmountExpense(t){console.log("Total Amount from Expense:",t),this.amounts.expense.set(t)}onExpenseTooltip(t){this.tooltip.expense.set(t)}onCashBankTooltip(t){this.tooltip.cashBank.set(t)}static{this.\u0275fac=function(e){return new(e||n)}}static{this.\u0275cmp=O({type:n,selectors:[["ng-component"]],viewQuery:function(e,i){if(e&1&&rt(P,5,$),e&2){let o;st(o=pt())&&(i.cards=o)}},decls:3,vars:5,consts:[["content",""],["expenseCheckbox",""],["card",""],["tooltipContent",""],["cashBankCheckbox",""],[3,"hasMainWrapperPadding","limitStrLength","overflowScroll","isLoading","pageTitle"],[1,"d-flex","flex-column","row-gap-10"],[1,"row","row-gap-24"],[1,"col-12","col-md-6","col-lg-4"],["width","100%","height","8rem"],["name","dashboardOption","type","radio","hidden","","value","0"],[1,"btn","p-0","border-none","btn-link","w-100",3,"click"],[1,"card-container"],[1,"box-icon",2,"background-color","#d73636"],[1,"d-flex","text-white","align-items-baseline"],[1,"fa-solid","fa-circle-dollar-to-slot"],["tooltipPosition","top",3,"pTooltip","fitContent"],[1,"d-flex","justify-content-end"],[1,"d-flex","flex-column","align-items-end"],[1,"fs-5"],[1,"box-number","fs-4"],[1,"d-flex","flex-column"],["name","dashboardOption","type","radio","hidden","","value","1"],[1,"box-icon"],[1,"fa-duotone","fa-solid","fa-wallet","text-white"],["tooltipPosition","top",3,"pTooltip"],["pTemplate","content"],[3,"amountExpense","expenseTitle","tooltip"],[3,"cashBankTitle","amountCashBank","tooltip"]],template:function(e,i){e&1&&(a(0,"app-main-panel",5),_(1,Kt,11,3,"ng-template",null,0,X),r()),e&2&&m("hasMainWrapperPadding",!0)("limitStrLength",50)("overflowScroll",!0)("isLoading",i.isLoading())("pageTitle",i.pageTitle())},dependencies:[xt,ft,Mt,D,P,bt,ht,mt,Pt,gt,Ot,Tt,Ct,vt,Et,Dt,E,S,yt,kt],styles:['@charset "UTF-8";.card-container[_ngcontent-%COMP%] a[_ngcontent-%COMP%], .card-container[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0}.card-container[_ngcontent-%COMP%]{position:relative;height:4rem}.card-container[_ngcontent-%COMP%] .box-icon[_ngcontent-%COMP%]{height:50px;width:50px;background-color:#2175d0;display:flex;justify-content:center;align-items:center;z-index:2;position:relative;border-radius:4px;left:1.5rem;top:-.6rem}.card-container[_ngcontent-%COMP%] .box-icon[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:30px}.card-container[_ngcontent-%COMP%] .box-number[_ngcontent-%COMP%]{font-size:1.25rem;font-weight:500}.card-container[_ngcontent-%COMP%] .box-title[_ngcontent-%COMP%]{font-size:1rem}.card-container[_ngcontent-%COMP%] p-card[_ngcontent-%COMP%]{position:absolute;top:calc(2.6rem - 55%);left:0;width:100%;z-index:1;margin:0!important;padding:0!important}@media (max-width: 85rem){.card-container[_ngcontent-%COMP%] a[_ngcontent-%COMP%], .card-container[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0}.card-container[_ngcontent-%COMP%]{position:relative;height:4rem}.card-container[_ngcontent-%COMP%] .box-icon[_ngcontent-%COMP%]{height:50px;width:50px;background-color:#2175d0;display:flex;justify-content:center;align-items:center;z-index:2;position:relative;border-radius:4px;left:1.5rem;top:-.6rem}.card-container[_ngcontent-%COMP%] .box-icon[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:30px}.card-container[_ngcontent-%COMP%] .box-number[_ngcontent-%COMP%]{font-size:1.25rem;font-weight:500}.card-container[_ngcontent-%COMP%] .box-title[_ngcontent-%COMP%]{font-size:1rem}.card-container[_ngcontent-%COMP%] p-card[_ngcontent-%COMP%]{position:absolute;top:calc(2.6rem - 55%);left:0;width:100%;z-index:1;margin:0!important;padding:0!important}}@media (min-width: 85.001rem) and (max-width: 97.999rem){.card-container[_ngcontent-%COMP%] a[_ngcontent-%COMP%], .card-container[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0}.card-container[_ngcontent-%COMP%]{position:relative;height:4rem}.card-container[_ngcontent-%COMP%] .box-icon[_ngcontent-%COMP%]{height:50px;width:50px;background-color:#2175d0;display:flex;justify-content:center;align-items:center;z-index:2;position:relative;border-radius:4px;left:1.5rem;top:-.6rem}.card-container[_ngcontent-%COMP%] .box-icon[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:30px}.card-container[_ngcontent-%COMP%] .box-number[_ngcontent-%COMP%]{font-size:1.25rem;font-weight:500}.card-container[_ngcontent-%COMP%] .box-title[_ngcontent-%COMP%]{font-size:1rem}.card-container[_ngcontent-%COMP%] p-card[_ngcontent-%COMP%]{position:absolute;top:calc(2.6rem - 55%);left:0;width:100%;z-index:1;margin:0!important;padding:0!important}}@media (min-width: 98rem){.card-container[_ngcontent-%COMP%] a[_ngcontent-%COMP%], .card-container[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:0}.card-container[_ngcontent-%COMP%]{position:relative;height:4rem}.card-container[_ngcontent-%COMP%] .box-icon[_ngcontent-%COMP%]{height:80px;width:80px;background-color:#2175d0;display:flex;justify-content:center;align-items:center;z-index:2;position:relative;border-radius:4px;left:1.5rem;top:-.6rem}.card-container[_ngcontent-%COMP%] .box-icon[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:40px}.card-container[_ngcontent-%COMP%] .box-number[_ngcontent-%COMP%]{font-size:1.25rem;font-weight:500}.card-container[_ngcontent-%COMP%] .box-title[_ngcontent-%COMP%]{font-size:1.15rem}.card-container[_ngcontent-%COMP%] p-card[_ngcontent-%COMP%]{position:absolute;top:calc(2.6rem - 55%);left:0;width:100%;z-index:1;margin:0!important;padding:0!important}}']})}}return n})();export{Ge as Dashboard1Component};
@@ -1 +1 @@
1
- import{a as K}from"./chunk-H7YYGW7V.js";import{b as q}from"./chunk-Y4SHAFGQ.js";import{a as z,b as H}from"./chunk-KARG227P.js";import{a as J}from"./chunk-XKI7WLHE.js";import{a as O,b as W}from"./chunk-BME4Z6DH.js";import"./chunk-VSDW2RJ5.js";import"./chunk-7L5IAWG2.js";import"./chunk-KONCSTVQ.js";import"./chunk-FMAG3RQL.js";import{i as I}from"./chunk-YI5IYWUO.js";import"./chunk-VM56C6ZV.js";import{a as G,b as A}from"./chunk-ISIYG4D5.js";import"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{o as j,w as k,x as B}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import{b as y,e as D,f as M,k as T,m as w,p as N,v as V,y as R}from"./chunk-MGIEURA2.js";import{d as P}from"./chunk-DZCJWJUG.js";import"./chunk-YZ76QE4R.js";import"./chunk-G3BJCT7T.js";import"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import{u as F}from"./chunk-DM2JLWKE.js";import{Cb as S,Eb as p,Mb as c,Sc as a,Wb as i,Xb as t,Yb as f,_ as C,ac as b,fc as E,gc as u,ia as m,ib as _,qa as x,ra as h,sc as l,yb as v}from"./chunk-6QJHEOXN.js";import"./chunk-YQFG5XE2.js";function L(e,d){if(e&1){let o=b();i(0,"p-button",4),E("onClick",function(){x(o);let n=u();return h(n.onSubmit())}),t()}}function Q(e,d){e&1&&(i(0,"div",13)(1,"h3",14),l(2,"General"),t(),i(3,"span",15),l(4,"Enter your closing Fiscal Date"),t()())}function U(e,d){if(e&1&&(i(0,"div",5)(1,"div",6)(2,"p-panel"),p(3,Q,5,0,"ng-template",null,2,a),i(5,"div",5)(6,"div",7)(7,"form",8)(8,"div",9)(9,"label",10),l(10,"Period"),t(),f(11,"p-datePicker",11),t(),i(12,"div",9)(13,"label",10),l(14,"Description"),t(),f(15,"textarea",12),t()()()()()()()),e&2){let o=u();_(7),c("formGroup",o.form)}}var he=(()=>{class e extends J{constructor(){super(),this.closingEntriesService=m(K),this.dayjsService=m(q),this.fb=m(V),this.router=m(P)}ngOnInit(){this.initForm()}initForm(){this.form=this.fb.group({Period:this.fb.control(new Date),Note:this.fb.control("")})}onSubmit(){if(this.form.invalid){this.form.markAllAsTouched();return}let{Period:o}=this.form.getRawValue(),r=Object.entries(this.form.getRawValue()).reduce((n,[s,g])=>(s==="Period"?n[s]=this.dayjsService.from(o)?this.dayjsService.format(g):"":n[s]=g,n),{});this.closingEntriesService.createClosingEntry(r).pipe(C(()=>{this.router.navigate(["/pages/accounting-setup/closing-entries"])})).subscribe()}static{this.\u0275fac=function(r){return new(r||e)}}static{this.\u0275cmp=v({type:e,selectors:[["app-closing-form"]],features:[S],decls:5,vars:1,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","Closing Entries Form",3,"hasMainWrapperPadding"],["label","Submit",3,"onClick"],[1,"row"],[1,"col"],[1,"col-4"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for",""],["formControlName","Period","fluid",""],["formControlName","Note","rows","5","cols","30","pTextarea",""],[1,"d-flex","flex-column","mx-2"],[1,"fs-5","m-0"],[1,"fs-3"]],template:function(r,n){r&1&&(i(0,"app-main-panel",3),p(1,L,1,0,"ng-template",null,0,a)(3,U,16,1,"ng-template",null,1,a),t()),r&2&&c("hasMainWrapperPadding",!0)},dependencies:[I,F,A,G,W,O,j,H,z,B,k,R,T,y,D,M,w,N],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return e})();export{he as ClosingFormComponent};
1
+ import{a as K}from"./chunk-H7YYGW7V.js";import{b as q}from"./chunk-AKHZNBCJ.js";import{a as z,b as H}from"./chunk-KARG227P.js";import{a as J}from"./chunk-XKI7WLHE.js";import{a as O,b as W}from"./chunk-BME4Z6DH.js";import"./chunk-VSDW2RJ5.js";import"./chunk-7L5IAWG2.js";import"./chunk-KONCSTVQ.js";import"./chunk-FMAG3RQL.js";import{i as I}from"./chunk-EXPUB774.js";import"./chunk-VM56C6ZV.js";import{a as G,b as A}from"./chunk-ISIYG4D5.js";import"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{o as j,w as k,x as B}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import{b as y,e as D,f as M,k as T,m as w,p as N,v as V,y as R}from"./chunk-MGIEURA2.js";import{d as P}from"./chunk-DZCJWJUG.js";import"./chunk-DD3C4ZJK.js";import"./chunk-G3BJCT7T.js";import"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import{u as F}from"./chunk-DM2JLWKE.js";import{Cb as S,Eb as p,Mb as c,Sc as a,Wb as i,Xb as t,Yb as f,_ as C,ac as b,fc as E,gc as u,ia as m,ib as _,qa as x,ra as h,sc as l,yb as v}from"./chunk-6QJHEOXN.js";import"./chunk-YQFG5XE2.js";function L(e,d){if(e&1){let o=b();i(0,"p-button",4),E("onClick",function(){x(o);let n=u();return h(n.onSubmit())}),t()}}function Q(e,d){e&1&&(i(0,"div",13)(1,"h3",14),l(2,"General"),t(),i(3,"span",15),l(4,"Enter your closing Fiscal Date"),t()())}function U(e,d){if(e&1&&(i(0,"div",5)(1,"div",6)(2,"p-panel"),p(3,Q,5,0,"ng-template",null,2,a),i(5,"div",5)(6,"div",7)(7,"form",8)(8,"div",9)(9,"label",10),l(10,"Period"),t(),f(11,"p-datePicker",11),t(),i(12,"div",9)(13,"label",10),l(14,"Description"),t(),f(15,"textarea",12),t()()()()()()()),e&2){let o=u();_(7),c("formGroup",o.form)}}var he=(()=>{class e extends J{constructor(){super(),this.closingEntriesService=m(K),this.dayjsService=m(q),this.fb=m(V),this.router=m(P)}ngOnInit(){this.initForm()}initForm(){this.form=this.fb.group({Period:this.fb.control(new Date),Note:this.fb.control("")})}onSubmit(){if(this.form.invalid){this.form.markAllAsTouched();return}let{Period:o}=this.form.getRawValue(),r=Object.entries(this.form.getRawValue()).reduce((n,[s,g])=>(s==="Period"?n[s]=this.dayjsService.from(o)?this.dayjsService.format(g):"":n[s]=g,n),{});this.closingEntriesService.createClosingEntry(r).pipe(C(()=>{this.router.navigate(["/pages/accounting-setup/closing-entries"])})).subscribe()}static{this.\u0275fac=function(r){return new(r||e)}}static{this.\u0275cmp=v({type:e,selectors:[["app-closing-form"]],features:[S],decls:5,vars:1,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","Closing Entries Form",3,"hasMainWrapperPadding"],["label","Submit",3,"onClick"],[1,"row"],[1,"col"],[1,"col-4"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for",""],["formControlName","Period","fluid",""],["formControlName","Note","rows","5","cols","30","pTextarea",""],[1,"d-flex","flex-column","mx-2"],[1,"fs-5","m-0"],[1,"fs-3"]],template:function(r,n){r&1&&(i(0,"app-main-panel",3),p(1,L,1,0,"ng-template",null,0,a)(3,U,16,1,"ng-template",null,1,a),t()),r&2&&c("hasMainWrapperPadding",!0)},dependencies:[I,F,A,G,W,O,j,H,z,B,k,R,T,y,D,M,w,N],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return e})();export{he as ClosingFormComponent};
@@ -1,8 +1,8 @@
1
- import{a as Oe,b as je,c as Je,d as ze}from"./chunk-SLD7RSX6.js";import{a as Ue,b as He}from"./chunk-GIRWHO6Q.js";import{a as Ge}from"./chunk-SVGPDGYN.js";import{a as v}from"./chunk-52PEVPZN.js";import{b as Ne}from"./chunk-Y4SHAFGQ.js";import"./chunk-ZC7ZENN7.js";import{m as J}from"./chunk-Q4XWXOWE.js";import"./chunk-WL6ZZCYW.js";import{b as Pe,g as Ve,h as Be,i as Q}from"./chunk-52EMI2TW.js";import"./chunk-AAKZYXG3.js";import{a as Ie,b as Me}from"./chunk-BME4Z6DH.js";import"./chunk-VSDW2RJ5.js";import"./chunk-7L5IAWG2.js";import{a as Re}from"./chunk-BT7Y4ADP.js";import{a as De,b as Ee}from"./chunk-5U7KZJ3H.js";import"./chunk-MJGBBYIO.js";import"./chunk-CN6AT4LE.js";import"./chunk-OW2ND5HU.js";import"./chunk-JWNGZMSE.js";import"./chunk-II7KELI4.js";import"./chunk-FTBQKOYS.js";import"./chunk-L4ENW4RK.js";import{b as ke}from"./chunk-FHJOSHI3.js";import"./chunk-KONCSTVQ.js";import"./chunk-FMAG3RQL.js";import{i as S}from"./chunk-YI5IYWUO.js";import"./chunk-VM56C6ZV.js";import{a as I,b as M}from"./chunk-ISIYG4D5.js";import"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{n as q,o as E,w as k,x as K}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import{Ia as D,b as T,c as ce,e as A,f as z,j as we,m as U,n as Te,o as Ae,p as H,v as W,x as $,y as L}from"./chunk-MGIEURA2.js";import{b as ve}from"./chunk-DZCJWJUG.js";import"./chunk-YZ76QE4R.js";import{a as ye}from"./chunk-G3BJCT7T.js";import{a as Fe}from"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import{j as ge,l as xe,m as be,s as Se,u as w}from"./chunk-DM2JLWKE.js";import{Dc as j,Eb as d,Ec as oe,Fc as ie,Ha as B,L as pe,Mb as f,Oc as re,Pb as ne,Pc as ae,Rb as y,Sb as fe,Sc as u,Ub as he,Vb as _e,Wb as i,Xb as r,Yb as C,Z as de,_ as V,ac as g,bd as le,ca as ue,fc as x,g as me,gc as l,ia as p,ib as s,ob as te,qa as h,ra as _,s as se,sc as a,tc as Ce,uc as F,xc as N,yb as b,yc as G,zc as O}from"./chunk-6QJHEOXN.js";import{a as R,b as P}from"./chunk-YQFG5XE2.js";var it=()=>({height:"cacl(100vh - 200px)"}),rt=()=>({height:"calc(100vh - 250px)"});function at(t,c){if(t&1){let e=g();i(0,"p-button",6),x("onClick",function(){h(e);let o=l(2);return _(o.submitForm())}),r()}}function lt(t,c){if(t&1&&(i(0,"div"),d(1,at,1,0,"p-button",5),r()),t&2){let e=l();s(),y(e.roleService.permissions().accountingSetup.create?1:-1)}}function ct(t,c){t&1&&(i(0,"div",18)(1,"h3",19),a(2,"Date"),r(),C(3,"p-datePicker",20),r())}function mt(t,c){if(t&1&&(i(0,"tr",10)(1,"td",28),a(2),r(),i(3,"td"),C(4,"input",29),r(),i(5,"td"),C(6,"input",30),r()()),t&2){let e,n=c.$implicit,o=c.index,m=l(4);f("formGroupName",o),s(2),F(" ",(e=m.asFormGroup(n).get("accountName"))==null?null:e.value," ")}}function st(t,c){if(t&1&&(i(0,"div",10)(1,"h4",21),a(2),r(),i(3,"div",22)(4,"table",23)(5,"thead",24)(6,"tr")(7,"th",25),a(8,"Account Name"),r(),i(9,"th",26),a(10,"Debit"),r(),i(11,"th",26),a(12,"Credit"),r()()(),i(13,"tbody"),d(14,mt,7,2,"tr",27),r()()()()),t&2){let e=c.$implicit,n=c.$index,o=l(3);f("formGroupName",n),s(2),F(" ",e.get("name").value," "),s(12),f("ngForOf",o.getItemsArray(o.asFormGroup(e)).controls)}}function pt(t,c){if(t&1&&(i(0,"p-panel",8),d(1,ct,4,0,"ng-template",null,2,u),C(3,"p-divider"),i(4,"p-scroll-panel")(5,"div",9),he(6,st,15,3,"div",10,fe),r()(),i(8,"div",11)(9,"table",12)(10,"tr")(11,"td",13)(12,"p",14),a(13," Total: "),r()(),i(14,"td",15)(15,"p",16),a(16),re(17,"number"),r()(),i(18,"td",17)(19,"p",16),a(20),re(21,"number"),r()()()()()()),t&2){let e=l(2);ne(oe(11,it)),f("formGroup",e.formGroups),s(4),ne(oe(12,rt)),s(2),_e(e.formsArray.controls),s(10),F(" ",ae(17,7,e.subtotalDebit)," "),s(4),F(" ",ae(21,9,e.subtotalCredit)," ")}}function dt(t,c){if(t&1&&d(0,pt,22,13,"p-panel",7),t&2){let e=l();f("ngIf",e.formGroups)}}var Le=(()=>{class t{constructor(){this.destroy$=new me,this.subtotalDebit=0,this.subtotalCredit=0,this.fb=p(W),this.accSetupService=p(v),this.dayjsService=p(Ne),this.date=new Date,this.routes=p(ve),this.roleService=p(J)}ngOnInit(){this.initializeForm(),this.loadFormData(),this.calculateSubtotalDebit(),this.formGroups.get("forms").valueChanges.pipe(pe(300),de(this.destroy$)).subscribe(()=>{this.calculateSubtotalDebit()})}initializeForm(){this.formGroups=this.fb.group({forms:this.fb.array([]),date:this.fb.control(new Date)})}get formsArray(){return this.formGroups.get("forms")}getItemsArray(e){return e.get("items")}asFormGroup(e){return e}createFormGroup(e){return this.fb.group({id:[e.id],name:[e.name],items:this.createItemsArray(e.items)})}createItemsArray(e){let n=e.map(o=>this.createItemGroup(o));return this.fb.array(n)}createItemGroup(e){return this.fb.group({accountName:[e.accountName],accountCode:[e.accountCode],id:[e.id],journalID:[e.journalID],accountID:[e.accountID],debitAmount:[e.debitAmount],creditAmount:[e.creditAmount],index:[e.index],note:[e.note]})}loadFormData(){this.routes.data.pipe(se(e=>e.data),Re("response"),V(e=>{for(;this.formsArray.length>0;)this.formsArray.removeAt(0);e.form.filter(o=>o.items&&o.items.length>0).forEach(o=>{this.formsArray.push(this.createFormGroup(o))})})).subscribe({error:e=>console.error("Error loading form data:",e)})}calculateSubtotalDebit(){let e=this.formGroups.controls.forms;this.subtotalDebit=0,this.subtotalCredit=0,e.controls.forEach(n=>{let o=this.getItemsArray(n),m=o.controls.reduce((Y,Z)=>{let ee=Z.get("debitAmount").value||0;return Y+ee},0),tt=o.controls.reduce((Y,Z)=>{let ee=Z.get("creditAmount").value||0;return Y+ee},0);this.subtotalDebit+=m,this.subtotalCredit+=tt})}submitForm(){let e=Object.entries(this.formGroups.getRawValue()).reduce((n,[o,m])=>(o==="date"?n[o]=m instanceof Date?this.dayjsService.format(m):m:o==="forms"?n.form=m:n[o]=m,n),{});console.log("Submitting form data:",e),this.accSetupService.submitOpeningBalanceFormConfiguration(e).subscribe(),console.log("Submitting form data:",e)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=b({type:t,selectors:[["app-acc-opening-balance-form"]],features:[j([D])],decls:6,vars:1,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","Opening Balance Form",3,"scrollable"],["preventOpenDuplicates",""],["label","Submit"],["label","Submit",3,"onClick"],[3,"formGroup","style",4,"ngIf"],[3,"formGroup"],["formArrayName","forms",1,"d-flex","flex-column","row-gap-4"],[3,"formGroupName"],[2,"position","fixed","bottom","0","left","241px",`/* offset from the left edge (assuming 250px sidebar) */
1
+ import{a as Oe,b as je,c as Je,d as ze}from"./chunk-SLD7RSX6.js";import{a as Ue,b as He}from"./chunk-GIRWHO6Q.js";import{a as Ge}from"./chunk-SVGPDGYN.js";import{a as v}from"./chunk-52PEVPZN.js";import{b as Ne}from"./chunk-AKHZNBCJ.js";import"./chunk-ZC7ZENN7.js";import{m as J}from"./chunk-Q4XWXOWE.js";import"./chunk-WL6ZZCYW.js";import{b as Pe,g as Ve,h as Be,i as Q}from"./chunk-52EMI2TW.js";import"./chunk-AAKZYXG3.js";import{a as Ie,b as Me}from"./chunk-BME4Z6DH.js";import"./chunk-VSDW2RJ5.js";import"./chunk-7L5IAWG2.js";import{a as Re}from"./chunk-BT7Y4ADP.js";import{a as De,b as Ee}from"./chunk-5U7KZJ3H.js";import"./chunk-MJGBBYIO.js";import"./chunk-CN6AT4LE.js";import"./chunk-OW2ND5HU.js";import"./chunk-JWNGZMSE.js";import"./chunk-II7KELI4.js";import"./chunk-FTBQKOYS.js";import"./chunk-L4ENW4RK.js";import{b as ke}from"./chunk-FHJOSHI3.js";import"./chunk-KONCSTVQ.js";import"./chunk-FMAG3RQL.js";import{i as S}from"./chunk-EXPUB774.js";import"./chunk-VM56C6ZV.js";import{a as I,b as M}from"./chunk-ISIYG4D5.js";import"./chunk-FNGX2XFA.js";import"./chunk-ALLR2NXQ.js";import"./chunk-BFEM6LX7.js";import{n as q,o as E,w as k,x as K}from"./chunk-O44DI62I.js";import"./chunk-DTYVTTET.js";import{Ia as D,b as T,c as ce,e as A,f as z,j as we,m as U,n as Te,o as Ae,p as H,v as W,x as $,y as L}from"./chunk-MGIEURA2.js";import{b as ve}from"./chunk-DZCJWJUG.js";import"./chunk-DD3C4ZJK.js";import{a as ye}from"./chunk-G3BJCT7T.js";import{a as Fe}from"./chunk-JBYPGHPN.js";import"./chunk-GGQ7LRWG.js";import"./chunk-F2X3VGZZ.js";import"./chunk-KL3TPLRB.js";import{j as ge,l as xe,m as be,s as Se,u as w}from"./chunk-DM2JLWKE.js";import{Dc as j,Eb as d,Ec as oe,Fc as ie,Ha as B,L as pe,Mb as f,Oc as re,Pb as ne,Pc as ae,Rb as y,Sb as fe,Sc as u,Ub as he,Vb as _e,Wb as i,Xb as r,Yb as C,Z as de,_ as V,ac as g,bd as le,ca as ue,fc as x,g as me,gc as l,ia as p,ib as s,ob as te,qa as h,ra as _,s as se,sc as a,tc as Ce,uc as F,xc as N,yb as b,yc as G,zc as O}from"./chunk-6QJHEOXN.js";import{a as R,b as P}from"./chunk-YQFG5XE2.js";var it=()=>({height:"cacl(100vh - 200px)"}),rt=()=>({height:"calc(100vh - 250px)"});function at(t,c){if(t&1){let e=g();i(0,"p-button",6),x("onClick",function(){h(e);let o=l(2);return _(o.submitForm())}),r()}}function lt(t,c){if(t&1&&(i(0,"div"),d(1,at,1,0,"p-button",5),r()),t&2){let e=l();s(),y(e.roleService.permissions().accountingSetup.create?1:-1)}}function ct(t,c){t&1&&(i(0,"div",18)(1,"h3",19),a(2,"Date"),r(),C(3,"p-datePicker",20),r())}function mt(t,c){if(t&1&&(i(0,"tr",10)(1,"td",28),a(2),r(),i(3,"td"),C(4,"input",29),r(),i(5,"td"),C(6,"input",30),r()()),t&2){let e,n=c.$implicit,o=c.index,m=l(4);f("formGroupName",o),s(2),F(" ",(e=m.asFormGroup(n).get("accountName"))==null?null:e.value," ")}}function st(t,c){if(t&1&&(i(0,"div",10)(1,"h4",21),a(2),r(),i(3,"div",22)(4,"table",23)(5,"thead",24)(6,"tr")(7,"th",25),a(8,"Account Name"),r(),i(9,"th",26),a(10,"Debit"),r(),i(11,"th",26),a(12,"Credit"),r()()(),i(13,"tbody"),d(14,mt,7,2,"tr",27),r()()()()),t&2){let e=c.$implicit,n=c.$index,o=l(3);f("formGroupName",n),s(2),F(" ",e.get("name").value," "),s(12),f("ngForOf",o.getItemsArray(o.asFormGroup(e)).controls)}}function pt(t,c){if(t&1&&(i(0,"p-panel",8),d(1,ct,4,0,"ng-template",null,2,u),C(3,"p-divider"),i(4,"p-scroll-panel")(5,"div",9),he(6,st,15,3,"div",10,fe),r()(),i(8,"div",11)(9,"table",12)(10,"tr")(11,"td",13)(12,"p",14),a(13," Total: "),r()(),i(14,"td",15)(15,"p",16),a(16),re(17,"number"),r()(),i(18,"td",17)(19,"p",16),a(20),re(21,"number"),r()()()()()()),t&2){let e=l(2);ne(oe(11,it)),f("formGroup",e.formGroups),s(4),ne(oe(12,rt)),s(2),_e(e.formsArray.controls),s(10),F(" ",ae(17,7,e.subtotalDebit)," "),s(4),F(" ",ae(21,9,e.subtotalCredit)," ")}}function dt(t,c){if(t&1&&d(0,pt,22,13,"p-panel",7),t&2){let e=l();f("ngIf",e.formGroups)}}var Le=(()=>{class t{constructor(){this.destroy$=new me,this.subtotalDebit=0,this.subtotalCredit=0,this.fb=p(W),this.accSetupService=p(v),this.dayjsService=p(Ne),this.date=new Date,this.routes=p(ve),this.roleService=p(J)}ngOnInit(){this.initializeForm(),this.loadFormData(),this.calculateSubtotalDebit(),this.formGroups.get("forms").valueChanges.pipe(pe(300),de(this.destroy$)).subscribe(()=>{this.calculateSubtotalDebit()})}initializeForm(){this.formGroups=this.fb.group({forms:this.fb.array([]),date:this.fb.control(new Date)})}get formsArray(){return this.formGroups.get("forms")}getItemsArray(e){return e.get("items")}asFormGroup(e){return e}createFormGroup(e){return this.fb.group({id:[e.id],name:[e.name],items:this.createItemsArray(e.items)})}createItemsArray(e){let n=e.map(o=>this.createItemGroup(o));return this.fb.array(n)}createItemGroup(e){return this.fb.group({accountName:[e.accountName],accountCode:[e.accountCode],id:[e.id],journalID:[e.journalID],accountID:[e.accountID],debitAmount:[e.debitAmount],creditAmount:[e.creditAmount],index:[e.index],note:[e.note]})}loadFormData(){this.routes.data.pipe(se(e=>e.data),Re("response"),V(e=>{for(;this.formsArray.length>0;)this.formsArray.removeAt(0);e.form.filter(o=>o.items&&o.items.length>0).forEach(o=>{this.formsArray.push(this.createFormGroup(o))})})).subscribe({error:e=>console.error("Error loading form data:",e)})}calculateSubtotalDebit(){let e=this.formGroups.controls.forms;this.subtotalDebit=0,this.subtotalCredit=0,e.controls.forEach(n=>{let o=this.getItemsArray(n),m=o.controls.reduce((Y,Z)=>{let ee=Z.get("debitAmount").value||0;return Y+ee},0),tt=o.controls.reduce((Y,Z)=>{let ee=Z.get("creditAmount").value||0;return Y+ee},0);this.subtotalDebit+=m,this.subtotalCredit+=tt})}submitForm(){let e=Object.entries(this.formGroups.getRawValue()).reduce((n,[o,m])=>(o==="date"?n[o]=m instanceof Date?this.dayjsService.format(m):m:o==="forms"?n.form=m:n[o]=m,n),{});console.log("Submitting form data:",e),this.accSetupService.submitOpeningBalanceFormConfiguration(e).subscribe(),console.log("Submitting form data:",e)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=b({type:t,selectors:[["app-acc-opening-balance-form"]],features:[j([D])],decls:6,vars:1,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","Opening Balance Form",3,"scrollable"],["preventOpenDuplicates",""],["label","Submit"],["label","Submit",3,"onClick"],[3,"formGroup","style",4,"ngIf"],[3,"formGroup"],["formArrayName","forms",1,"d-flex","flex-column","row-gap-4"],[3,"formGroupName"],[2,"position","fixed","bottom","0","left","241px",`/* offset from the left edge (assuming 250px sidebar) */
2
2
  width`,`calc(
3
3
  100% - 243px
4
4
  )`,`/* adjust width to fit the remaining space */
5
5
  z-index`,"91","background-color","white",`/* added background */
6
6
  /* box-shadow`,"0 -2px 5px rgba(0, 0, 0, 0.1)",`*/ /* added subtle shadow */
7
7
  padding`,"8px 0",`/* added padding for height */
8
- border-top`,"1px solid #e0e0e0"],[1,"w-100","px-4"],[1,"ps-5"],[1,"fw-semibold","fs-4","m-0","text-end",2,"margin-right","10px !important"],[1,"",2,"width","200px"],[1,"fw-semibold","fs-4","m-0","text-start"],[1,"pe-5",2,"width","200px"],[1,"d-flex","flex-column","gap-2","mx-2"],[1,"fs-5","m-0"],["formControlName","date"],[1,"fs-4"],["formArrayName","items"],[1,"table"],[1,"table-secondary"],[1,"fs-3"],[1,"fs-3",2,"width","200px"],[3,"formGroupName",4,"ngFor","ngForOf"],[1,"fs-3","text-dark"],["appMaskNumber","","formControlName","debitAmount",1,"fs-3","form-control","text-dark"],["appMaskNumber","","formControlName","creditAmount",1,"fs-3","form-control","text-dark"]],template:function(n,o){n&1&&(i(0,"app-main-panel",3),d(1,lt,2,1,"ng-template",null,0,u)(3,dt,1,1,"ng-template",null,1,u),r(),C(5,"p-toast",4)),n&2&&f("scrollable",!0)},dependencies:[S,ke,w,xe,be,Se,Me,Ie,Q,Ee,De,$,T,A,z,E,Je,K,k,M,I,Ge,L,U,H,Te,Ae,He,Ue],styles:["[_nghost-%COMP%]{display:block} .table thead tr th{border:none}"],changeDetection:0})}}return t})();var qe=t=>({"ng-invalid ng-dirty":t});function ft(t,c){if(t&1){let e=g();i(0,"p-button",4),x("onClick",function(){h(e);let o=l();return _(o.verifyCredentials())}),a(1,"Verify"),r(),i(2,"p-button",4),x("onClick",function(){h(e);let o=l();return _(o.saveCredentials())}),a(3,"Update"),r()}}function ht(t,c){t&1&&(i(0,"div",12)(1,"h3",13),a(2,"Account"),r(),i(3,"small",14),a(4,"Configure Client ID and Client Secret"),r()())}function _t(t,c){if(t&1&&(i(0,"div",5)(1,"p-panel"),d(2,ht,5,0,"ng-template",null,2,u),i(4,"div",6)(5,"div",7)(6,"div",8)(7,"label",9),a(8,"Client ID"),r(),C(9,"input",10),r()(),i(10,"div",7)(11,"div",8)(12,"label",9),a(13,"Client Secret"),r(),C(14,"input",11),r()()()()()),t&2){let e=l();s(4),f("formGroup",e.credentialForm),s(5),f("ngClass",ie(3,qe,e.clientIDControl.invalid&&e.clientIDControl.dirty||e.clientIDControl.touched)),s(5),f("ngClass",ie(5,qe,e.clientSecretControl.invalid&&e.clientSecretControl.dirty||e.clientSecretControl.touched))}}var Ke=(()=>{class t{constructor(e,n){this.fb=e,this.messageService=n,this.setupService=p(v)}ngOnInit(){this.initForm(),this.setupService.fetchAPICredential().pipe(V(e=>{this.credentialForm.patchValue({clientID:e.clientID||"",clientSecret:e.clientSecret||""})})).subscribe()}initForm(){this.credentialForm=this.fb.group({clientID:["",[ce.required]],clientSecret:["",[ce.required]]})}get clientIDControl(){return this.credentialForm.get("clientID")}get clientSecretControl(){return this.credentialForm.get("clientSecret")}saveCredentials(){if(this.credentialForm.invalid){this.credentialForm.markAllAsTouched();return}let e=this.credentialForm.getRawValue();console.log("Saving credentials:",e),this.setupService.updateAPICredential(e).subscribe()}verifyCredentials(){if(this.credentialForm.invalid){this.credentialForm.markAllAsTouched();return}let e=this.credentialForm.getRawValue();console.log("Verifying credentials:",e),this.setupService.verifyAPICredential(e).subscribe({next:n=>{console.log("Verify result:",n),this.messageService.add({severity:"success",summary:"Verified",detail:"Credentials are valid!"})},error:n=>{console.error("Verify failed:",n),this.messageService.add({severity:"error",summary:"Invalid",detail:"Client ID or Secret is wrong!"})}})}static{this.\u0275fac=function(n){return new(n||t)(te(W),te(D))}}static{this.\u0275cmp=b({type:t,selectors:[["app-api-credential"]],features:[j([D])],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","API Credential"],[3,"onClick"],[1,"d-flex","flex-column","row-gap-4"],[1,"row",3,"formGroup"],[1,"col-6"],[1,"d-flex","flex-column"],["for","outlet"],["type","text","pInputText","","formControlName","clientID",3,"ngClass"],["type","text","pInputText","","formControlName","clientSecret",3,"ngClass"],[1,"d-flex","flex-column","px-2"],[1,"mb-0","fw-bold"],[1,"fst-italic","text-muted"]],template:function(n,o){n&1&&(i(0,"app-main-panel",3),d(1,ft,4,0,"ng-template",null,0,u)(3,_t,15,7,"ng-template",null,1,u),r())},dependencies:[w,ge,L,T,A,z,U,H,E,q,M,I,S,K,k,ze],encapsulation:2})}}return t})();function Ct(t,c){if(t&1){let e=g();i(0,"button",5),x("click",function(){h(e);let o=l(2);return _(o.onFormatJournal())}),a(1," Format "),r()}}function gt(t,c){if(t&1&&d(0,Ct,2,0,"button",4),t&2){let e=l();y(e.roleService.permissions().accountingSetup.delete?0:-1)}}function xt(t,c){t&1&&(i(0,"div",13)(1,"div",14)(2,"h4",15),a(3,"Journal Configuration"),r(),i(4,"small",16),a(5," Enter your account information to format journal entries "),r()()())}function bt(t,c){if(t&1){let e=g();i(0,"div",6)(1,"p-panel"),d(2,xt,6,0,"ng-template",null,2,u),i(4,"div",7)(5,"div",8)(6,"p-floatlabel",9)(7,"input",10),O("ngModelChange",function(o){h(e);let m=l();return G(m.subdomain,o)||(m.subdomain=o),_(o)}),r(),i(8,"label",11),a(9,"Subdomain"),r()(),i(10,"small",12),a(11,"Enter your account subdomain (e.g., mycompany.dealpos.net)"),r()()()()()}if(t&2){let e=l();s(7),N("ngModel",e.subdomain)}}var Qe=(()=>{class t{constructor(){this.setupService=p(v),this.subdomain=B(""),this.toastrService=p(Fe),this.roleService=p(J)}onFormatJournal(){if(!this.subdomain()){this.toastrService.error("Please enter a subdomain","Error");return}this.setupService.formatJournal(this.subdomain()).subscribe({next:e=>{this.toastrService.success(e.message,"Success")}})}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=b({type:t,selectors:[["app-format-jurnal"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","Format Journal"],[1,"btn","btn-success","rounded"],[1,"btn","btn-success","rounded",3,"click"],[1,"d-flex","flex-column","row-gap-4"],[1,"row","mt-6"],[1,"col-12"],["variant","on"],["pInputText","","id","subdomain","autocomplete","off",1,"w-100",3,"ngModelChange","ngModel"],["for","subdomain"],[1,"text-muted","fst-italic",2,"font-size","12px"],[1,"row","ps-2"],[1,"col-12","d-flex","flex-column"],[1,"mb-1","fw-bold"],[1,"fst-italic","text-muted"]],template:function(n,o){n&1&&(i(0,"app-main-panel",3),d(1,gt,1,1,"ng-template",null,0,u)(3,bt,12,1,"ng-template",null,1,u),r())},dependencies:[w,$,T,A,we,E,q,S,M,I,je,Oe],encapsulation:2})}}return t})();var Xe=()=>p(v).fetchOpeningBalanceFormConfiguration();var Ye=(()=>{class t{constructor(){this._httpService=p(ye)}flushCache(e){e.forEach(n=>{this.flushCacheByEndPoint(n.endPoint)})}flushCacheByEndPoint(e){this._httpService.delete("","/api/FlushCache"+e).subscribe(()=>{console.log(`Cache flushed for endpoint: ${e}`)})}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=ue({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Ze=[{endPoint:"/AccessToken",label:"Access Token",description:"Remove token pos in Books",checked:!1},{endPoint:"/Outlet",label:"Outlets",description:"Remove cached for update outlets",checked:!1},{endPoint:"/Payment",label:"Payment Method",description:"Remove cached for payment method",checked:!1},{endPoint:"/Tax",label:"Tax Type",description:"Remove cached for tax type",checked:!1},{endPoint:"/WriteOff",label:"Write Off",description:"Remove cached for write off",checked:!1}];function St(t,c){if(t&1){let e=g();i(0,"div",5)(1,"p-button",6),x("onClick",function(){h(e);let o=l(2);return _(o.onFlushCached())}),r()()}}function vt(t,c){if(t&1&&d(0,St,2,0,"div",5),t&2){let e=l();y(e.isAnyCacheSelected?0:-1)}}function Ft(t,c){t&1&&(i(0,"tr")(1,"th",8),C(2,"p-tableHeaderCheckbox"),r(),i(3,"th"),a(4,"Cache"),r(),i(5,"th"),a(6,"Description"),r()())}function yt(t,c){if(t&1&&(i(0,"tr")(1,"td"),C(2,"p-tableCheckbox",9),r(),i(3,"td"),a(4),r(),i(5,"td"),a(6),r()()),t&2){let e=c.$implicit;s(2),f("value",e),s(2),F(" ",e.label," "),s(2),Ce(e.description)}}function wt(t,c){if(t&1){let e=g();i(0,"p-table",7),x("onRowSelect",function(o){h(e);let m=l();return _(m.onRowSelect(o))})("onRowUnselect",function(o){h(e);let m=l();return _(m.onRowUnselect(o))})("onHeaderCheckboxToggle",function(o){h(e);let m=l();return _(m.onHeaderCheckboxToggle(o))}),O("selectionChange",function(o){h(e);let m=l();return G(m.selectedRows,o)||(m.selectedRows=o),_(o)}),d(1,Ft,7,0,"ng-template",null,2,u)(3,yt,7,3,"ng-template",null,3,u),r()}if(t&2){let e=l();f("value",e.cachedData)("totalRecords",e.cachedData.length)("lazy",!0)("rows",e.params().pageSize)("scrollable",!0),N("selection",e.selectedRows)}}var et=(()=>{class t{constructor(){this.flushCachedService=p(Ye),this.cachedData=Ze,this.selectedRows=[],this.params=B({pageNumber:1,pageSize:100}),this.first=le(()=>(this.params().pageNumber-1)*this.params().pageSize+1),this.end=le(()=>Math.min(this.params().pageNumber*this.params().pageSize,this.cachedData.length||100))}onRowSelect(e){if(Array.isArray(e.data))return;let n=e.data;n?.endPoint&&this.updateCheckedRows([n.endPoint],!0)}updateCheckedRows(e,n){this.cachedData=this.cachedData.map(o=>e.includes(o.endPoint)?P(R({},o),{checked:n}):o),this.selectedRows=this.cachedData.filter(o=>o.checked)}onRowUnselect(e){if(Array.isArray(e.data))return;let n=e.data;n?.endPoint&&this.updateCheckedRows([n.endPoint],!1)}onHeaderCheckboxToggle(e){this.cachedData=this.cachedData.map(n=>P(R({},n),{checked:e.checked})),this.selectedRows=e.checked?[...this.cachedData]:[]}onFlushCached(){let e=this.cachedData.filter(n=>n.checked);this.flushCachedService.flushCache(e),this.cachedData=this.cachedData.map(n=>P(R({},n),{checked:!1})),this.selectedRows=[]}get isAnyCacheSelected(){return this.cachedData.some(e=>e.checked)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=b({type:t,selectors:[["app-flush-cached"]],decls:5,vars:2,consts:[["actionButton",""],["content",""],["header",""],["body",""],["pageTitle","Flush Cache",3,"overflowScroll","showCancelButton"],[1,"d-flex","gap-2"],["label","Flush Cache",3,"onClick"],["dataKey","endPoint","selectionMode","multiple","styleClass","d-flex flex-column justify-content-between h-100",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","selectionChange","value","totalRecords","lazy","rows","scrollable","selection"],[2,"width","1rem"],[3,"value"]],template:function(n,o){n&1&&(i(0,"app-main-panel",4),d(1,vt,1,1,"ng-template",null,0,u)(3,wt,5,6,"ng-template",null,1,u),r()),n&2&&f("overflowScroll",!0)("showCancelButton",!1)},dependencies:[S,Q,Pe,Ve,Be,k],encapsulation:2})}}return t})();var Qn=[{path:"",redirectTo:"timezone",pathMatch:"full"},{path:"",children:[{path:"timezone",loadComponent:()=>import("./chunk-HR6W3DC4.js").then(t=>t.TimezoneComponent)},{path:"journal-tag",loadComponent:()=>import("./chunk-VANY33VH.js").then(t=>t.JournalTagComponent)},{path:"journal-tag/info",loadComponent:()=>import("./chunk-X7I6QMMX.js").then(t=>t.JournalTagInfoComponent)},{path:"journal-tag/form",loadComponent:()=>import("./chunk-MGEVP222.js").then(t=>t.JournalTagFormComponent)},{path:"journal-number",loadComponent:()=>import("./chunk-ZM7C3PCP.js").then(t=>t.JournalNumberComponent)},{path:"advanced",loadComponent:()=>import("./chunk-N3AQU3B6.js").then(t=>t.AdvancedComponent)},{path:"opening-balance-form",component:Le,resolve:{data:Xe}},{path:"api-crendetial",component:Ke},{path:"flush-cached",component:et},{path:"format-journal",component:Qe},{path:"closing-entries",loadComponent:()=>import("./chunk-IWB6L5HR.js").then(t=>t.ClosingPageComponent)},{path:"closing-entries/create",loadComponent:()=>import("./chunk-E2PHUSPH.js").then(t=>t.ClosingFormComponent)}]}];export{Qn as ACCOUNTING_SETUP_ROUTES};
8
+ border-top`,"1px solid #e0e0e0"],[1,"w-100","px-4"],[1,"ps-5"],[1,"fw-semibold","fs-4","m-0","text-end",2,"margin-right","10px !important"],[1,"",2,"width","200px"],[1,"fw-semibold","fs-4","m-0","text-start"],[1,"pe-5",2,"width","200px"],[1,"d-flex","flex-column","gap-2","mx-2"],[1,"fs-5","m-0"],["formControlName","date"],[1,"fs-4"],["formArrayName","items"],[1,"table"],[1,"table-secondary"],[1,"fs-3"],[1,"fs-3",2,"width","200px"],[3,"formGroupName",4,"ngFor","ngForOf"],[1,"fs-3","text-dark"],["appMaskNumber","","formControlName","debitAmount",1,"fs-3","form-control","text-dark"],["appMaskNumber","","formControlName","creditAmount",1,"fs-3","form-control","text-dark"]],template:function(n,o){n&1&&(i(0,"app-main-panel",3),d(1,lt,2,1,"ng-template",null,0,u)(3,dt,1,1,"ng-template",null,1,u),r(),C(5,"p-toast",4)),n&2&&f("scrollable",!0)},dependencies:[S,ke,w,xe,be,Se,Me,Ie,Q,Ee,De,$,T,A,z,E,Je,K,k,M,I,Ge,L,U,H,Te,Ae,He,Ue],styles:["[_nghost-%COMP%]{display:block} .table thead tr th{border:none}"],changeDetection:0})}}return t})();var qe=t=>({"ng-invalid ng-dirty":t});function ft(t,c){if(t&1){let e=g();i(0,"p-button",4),x("onClick",function(){h(e);let o=l();return _(o.verifyCredentials())}),a(1,"Verify"),r(),i(2,"p-button",4),x("onClick",function(){h(e);let o=l();return _(o.saveCredentials())}),a(3,"Update"),r()}}function ht(t,c){t&1&&(i(0,"div",12)(1,"h3",13),a(2,"Account"),r(),i(3,"small",14),a(4,"Configure Client ID and Client Secret"),r()())}function _t(t,c){if(t&1&&(i(0,"div",5)(1,"p-panel"),d(2,ht,5,0,"ng-template",null,2,u),i(4,"div",6)(5,"div",7)(6,"div",8)(7,"label",9),a(8,"Client ID"),r(),C(9,"input",10),r()(),i(10,"div",7)(11,"div",8)(12,"label",9),a(13,"Client Secret"),r(),C(14,"input",11),r()()()()()),t&2){let e=l();s(4),f("formGroup",e.credentialForm),s(5),f("ngClass",ie(3,qe,e.clientIDControl.invalid&&e.clientIDControl.dirty||e.clientIDControl.touched)),s(5),f("ngClass",ie(5,qe,e.clientSecretControl.invalid&&e.clientSecretControl.dirty||e.clientSecretControl.touched))}}var Ke=(()=>{class t{constructor(e,n){this.fb=e,this.messageService=n,this.setupService=p(v)}ngOnInit(){this.initForm(),this.setupService.fetchAPICredential().pipe(V(e=>{this.credentialForm.patchValue({clientID:e.clientID||"",clientSecret:e.clientSecret||""})})).subscribe()}initForm(){this.credentialForm=this.fb.group({clientID:["",[ce.required]],clientSecret:["",[ce.required]]})}get clientIDControl(){return this.credentialForm.get("clientID")}get clientSecretControl(){return this.credentialForm.get("clientSecret")}saveCredentials(){if(this.credentialForm.invalid){this.credentialForm.markAllAsTouched();return}let e=this.credentialForm.getRawValue();console.log("Saving credentials:",e),this.setupService.updateAPICredential(e).subscribe()}verifyCredentials(){if(this.credentialForm.invalid){this.credentialForm.markAllAsTouched();return}let e=this.credentialForm.getRawValue();console.log("Verifying credentials:",e),this.setupService.verifyAPICredential(e).subscribe({next:n=>{console.log("Verify result:",n),this.messageService.add({severity:"success",summary:"Verified",detail:"Credentials are valid!"})},error:n=>{console.error("Verify failed:",n),this.messageService.add({severity:"error",summary:"Invalid",detail:"Client ID or Secret is wrong!"})}})}static{this.\u0275fac=function(n){return new(n||t)(te(W),te(D))}}static{this.\u0275cmp=b({type:t,selectors:[["app-api-credential"]],features:[j([D])],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","API Credential"],[3,"onClick"],[1,"d-flex","flex-column","row-gap-4"],[1,"row",3,"formGroup"],[1,"col-6"],[1,"d-flex","flex-column"],["for","outlet"],["type","text","pInputText","","formControlName","clientID",3,"ngClass"],["type","text","pInputText","","formControlName","clientSecret",3,"ngClass"],[1,"d-flex","flex-column","px-2"],[1,"mb-0","fw-bold"],[1,"fst-italic","text-muted"]],template:function(n,o){n&1&&(i(0,"app-main-panel",3),d(1,ft,4,0,"ng-template",null,0,u)(3,_t,15,7,"ng-template",null,1,u),r())},dependencies:[w,ge,L,T,A,z,U,H,E,q,M,I,S,K,k,ze],encapsulation:2})}}return t})();function Ct(t,c){if(t&1){let e=g();i(0,"button",5),x("click",function(){h(e);let o=l(2);return _(o.onFormatJournal())}),a(1," Format "),r()}}function gt(t,c){if(t&1&&d(0,Ct,2,0,"button",4),t&2){let e=l();y(e.roleService.permissions().accountingSetup.delete?0:-1)}}function xt(t,c){t&1&&(i(0,"div",13)(1,"div",14)(2,"h4",15),a(3,"Journal Configuration"),r(),i(4,"small",16),a(5," Enter your account information to format journal entries "),r()()())}function bt(t,c){if(t&1){let e=g();i(0,"div",6)(1,"p-panel"),d(2,xt,6,0,"ng-template",null,2,u),i(4,"div",7)(5,"div",8)(6,"p-floatlabel",9)(7,"input",10),O("ngModelChange",function(o){h(e);let m=l();return G(m.subdomain,o)||(m.subdomain=o),_(o)}),r(),i(8,"label",11),a(9,"Subdomain"),r()(),i(10,"small",12),a(11,"Enter your account subdomain (e.g., mycompany.dealpos.net)"),r()()()()()}if(t&2){let e=l();s(7),N("ngModel",e.subdomain)}}var Qe=(()=>{class t{constructor(){this.setupService=p(v),this.subdomain=B(""),this.toastrService=p(Fe),this.roleService=p(J)}onFormatJournal(){if(!this.subdomain()){this.toastrService.error("Please enter a subdomain","Error");return}this.setupService.formatJournal(this.subdomain()).subscribe({next:e=>{this.toastrService.success(e.message,"Success")}})}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=b({type:t,selectors:[["app-format-jurnal"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","Format Journal"],[1,"btn","btn-success","rounded"],[1,"btn","btn-success","rounded",3,"click"],[1,"d-flex","flex-column","row-gap-4"],[1,"row","mt-6"],[1,"col-12"],["variant","on"],["pInputText","","id","subdomain","autocomplete","off",1,"w-100",3,"ngModelChange","ngModel"],["for","subdomain"],[1,"text-muted","fst-italic",2,"font-size","12px"],[1,"row","ps-2"],[1,"col-12","d-flex","flex-column"],[1,"mb-1","fw-bold"],[1,"fst-italic","text-muted"]],template:function(n,o){n&1&&(i(0,"app-main-panel",3),d(1,gt,1,1,"ng-template",null,0,u)(3,bt,12,1,"ng-template",null,1,u),r())},dependencies:[w,$,T,A,we,E,q,S,M,I,je,Oe],encapsulation:2})}}return t})();var Xe=()=>p(v).fetchOpeningBalanceFormConfiguration();var Ye=(()=>{class t{constructor(){this._httpService=p(ye)}flushCache(e){e.forEach(n=>{this.flushCacheByEndPoint(n.endPoint)})}flushCacheByEndPoint(e){this._httpService.delete("","/api/FlushCache"+e).subscribe(()=>{console.log(`Cache flushed for endpoint: ${e}`)})}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=ue({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Ze=[{endPoint:"/AccessToken",label:"Access Token",description:"Remove token pos in Books",checked:!1},{endPoint:"/Outlet",label:"Outlets",description:"Remove cached for update outlets",checked:!1},{endPoint:"/Payment",label:"Payment Method",description:"Remove cached for payment method",checked:!1},{endPoint:"/Tax",label:"Tax Type",description:"Remove cached for tax type",checked:!1},{endPoint:"/WriteOff",label:"Write Off",description:"Remove cached for write off",checked:!1}];function St(t,c){if(t&1){let e=g();i(0,"div",5)(1,"p-button",6),x("onClick",function(){h(e);let o=l(2);return _(o.onFlushCached())}),r()()}}function vt(t,c){if(t&1&&d(0,St,2,0,"div",5),t&2){let e=l();y(e.isAnyCacheSelected?0:-1)}}function Ft(t,c){t&1&&(i(0,"tr")(1,"th",8),C(2,"p-tableHeaderCheckbox"),r(),i(3,"th"),a(4,"Cache"),r(),i(5,"th"),a(6,"Description"),r()())}function yt(t,c){if(t&1&&(i(0,"tr")(1,"td"),C(2,"p-tableCheckbox",9),r(),i(3,"td"),a(4),r(),i(5,"td"),a(6),r()()),t&2){let e=c.$implicit;s(2),f("value",e),s(2),F(" ",e.label," "),s(2),Ce(e.description)}}function wt(t,c){if(t&1){let e=g();i(0,"p-table",7),x("onRowSelect",function(o){h(e);let m=l();return _(m.onRowSelect(o))})("onRowUnselect",function(o){h(e);let m=l();return _(m.onRowUnselect(o))})("onHeaderCheckboxToggle",function(o){h(e);let m=l();return _(m.onHeaderCheckboxToggle(o))}),O("selectionChange",function(o){h(e);let m=l();return G(m.selectedRows,o)||(m.selectedRows=o),_(o)}),d(1,Ft,7,0,"ng-template",null,2,u)(3,yt,7,3,"ng-template",null,3,u),r()}if(t&2){let e=l();f("value",e.cachedData)("totalRecords",e.cachedData.length)("lazy",!0)("rows",e.params().pageSize)("scrollable",!0),N("selection",e.selectedRows)}}var et=(()=>{class t{constructor(){this.flushCachedService=p(Ye),this.cachedData=Ze,this.selectedRows=[],this.params=B({pageNumber:1,pageSize:100}),this.first=le(()=>(this.params().pageNumber-1)*this.params().pageSize+1),this.end=le(()=>Math.min(this.params().pageNumber*this.params().pageSize,this.cachedData.length||100))}onRowSelect(e){if(Array.isArray(e.data))return;let n=e.data;n?.endPoint&&this.updateCheckedRows([n.endPoint],!0)}updateCheckedRows(e,n){this.cachedData=this.cachedData.map(o=>e.includes(o.endPoint)?P(R({},o),{checked:n}):o),this.selectedRows=this.cachedData.filter(o=>o.checked)}onRowUnselect(e){if(Array.isArray(e.data))return;let n=e.data;n?.endPoint&&this.updateCheckedRows([n.endPoint],!1)}onHeaderCheckboxToggle(e){this.cachedData=this.cachedData.map(n=>P(R({},n),{checked:e.checked})),this.selectedRows=e.checked?[...this.cachedData]:[]}onFlushCached(){let e=this.cachedData.filter(n=>n.checked);this.flushCachedService.flushCache(e),this.cachedData=this.cachedData.map(n=>P(R({},n),{checked:!1})),this.selectedRows=[]}get isAnyCacheSelected(){return this.cachedData.some(e=>e.checked)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=b({type:t,selectors:[["app-flush-cached"]],decls:5,vars:2,consts:[["actionButton",""],["content",""],["header",""],["body",""],["pageTitle","Flush Cache",3,"overflowScroll","showCancelButton"],[1,"d-flex","gap-2"],["label","Flush Cache",3,"onClick"],["dataKey","endPoint","selectionMode","multiple","styleClass","d-flex flex-column justify-content-between h-100",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","selectionChange","value","totalRecords","lazy","rows","scrollable","selection"],[2,"width","1rem"],[3,"value"]],template:function(n,o){n&1&&(i(0,"app-main-panel",4),d(1,vt,1,1,"ng-template",null,0,u)(3,wt,5,6,"ng-template",null,1,u),r()),n&2&&f("overflowScroll",!0)("showCancelButton",!1)},dependencies:[S,Q,Pe,Ve,Be,k],encapsulation:2})}}return t})();var Qn=[{path:"",redirectTo:"timezone",pathMatch:"full"},{path:"",children:[{path:"timezone",loadComponent:()=>import("./chunk-2PW2KI76.js").then(t=>t.TimezoneComponent)},{path:"journal-tag",loadComponent:()=>import("./chunk-45277TJC.js").then(t=>t.JournalTagComponent)},{path:"journal-tag/info",loadComponent:()=>import("./chunk-RRWAF23G.js").then(t=>t.JournalTagInfoComponent)},{path:"journal-tag/form",loadComponent:()=>import("./chunk-BXCI7FLO.js").then(t=>t.JournalTagFormComponent)},{path:"journal-number",loadComponent:()=>import("./chunk-W23IXSWP.js").then(t=>t.JournalNumberComponent)},{path:"advanced",loadComponent:()=>import("./chunk-2WVFFG26.js").then(t=>t.AdvancedComponent)},{path:"opening-balance-form",component:Le,resolve:{data:Xe}},{path:"api-crendetial",component:Ke},{path:"flush-cached",component:et},{path:"format-journal",component:Qe},{path:"closing-entries",loadComponent:()=>import("./chunk-FWCM3R4Q.js").then(t=>t.ClosingPageComponent)},{path:"closing-entries/create",loadComponent:()=>import("./chunk-N3KDIJIC.js").then(t=>t.ClosingFormComponent)}]}];export{Qn as ACCOUNTING_SETUP_ROUTES};