dealposbooks 5.36.2 → 5.36.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 (52) hide show
  1. package/{chunk-AYDYX3J4.js → chunk-2CFYVQAK.js} +1 -1
  2. package/{chunk-7SXGBB2J.js → chunk-2LQZ4KWH.js} +1 -1
  3. package/{chunk-UDNPUUWO.js → chunk-4DYLPYFL.js} +1 -1
  4. package/{chunk-6Y7LC5K4.js → chunk-66USIUOD.js} +1 -1
  5. package/chunk-6EKEG6RN.js +1 -0
  6. package/{chunk-EVRPQUZB.js → chunk-6I5H3YGD.js} +1 -1
  7. package/{chunk-5L5UVIIK.js → chunk-6M3ROM2S.js} +1 -1
  8. package/{chunk-EA47GVMD.js → chunk-6VR5JNBD.js} +1 -1
  9. package/{chunk-GCTX4M5B.js → chunk-7ABLTWH5.js} +1 -1
  10. package/{chunk-O3JBRZF4.js → chunk-7BWZMKYR.js} +1 -1
  11. package/{chunk-XZQ3IYQ6.js → chunk-7INXBUUN.js} +1 -1
  12. package/{chunk-6SQ75ZSO.js → chunk-7QH3KK6N.js} +1 -1
  13. package/{chunk-5U2DQZ3P.js → chunk-A52O36YW.js} +1 -1
  14. package/{chunk-IQQJUFFQ.js → chunk-AA444QAF.js} +1 -1
  15. package/{chunk-FE4Q3L6W.js → chunk-AF7SZ7GC.js} +1 -1
  16. package/{chunk-LSY7PUC7.js → chunk-C5LLL3Q2.js} +1 -1
  17. package/{chunk-JTK43IPK.js → chunk-CQPOKER3.js} +1 -1
  18. package/{chunk-6DH5EZBL.js → chunk-CT4PVBTR.js} +2 -2
  19. package/{chunk-4AOHMAEQ.js → chunk-CV4R4TBA.js} +1 -1
  20. package/{chunk-VKYNOYJC.js → chunk-DOISARVN.js} +1 -1
  21. package/{chunk-3PPJHQQ4.js → chunk-ENIW7TNR.js} +1 -1
  22. package/{chunk-62S2RZ5N.js → chunk-EY42XRK4.js} +2 -2
  23. package/{chunk-ASZXOTXP.js → chunk-FHKTIAXX.js} +1 -1
  24. package/{chunk-N5RPPHA6.js → chunk-FXYYPCNX.js} +1 -1
  25. package/{chunk-SSZSLP4Z.js → chunk-G3SKSKOH.js} +1 -1
  26. package/{chunk-GTVRKYLY.js → chunk-GI246KYJ.js} +1 -1
  27. package/{chunk-YARD4P64.js → chunk-GIYK6BQG.js} +1 -1
  28. package/{chunk-FETWPNGI.js → chunk-HGXQRTWW.js} +1 -1
  29. package/{chunk-MQPAWXQR.js → chunk-HNKJIRE3.js} +1 -1
  30. package/{chunk-TB6LDOLG.js → chunk-I4PT5J7Y.js} +1 -1
  31. package/{chunk-SNKHWMQW.js → chunk-INB6OCHW.js} +1 -1
  32. package/{chunk-GI2IGVR7.js → chunk-IPYNYURM.js} +1 -1
  33. package/{chunk-LZSGMIGM.js → chunk-J2PXABSJ.js} +1 -1
  34. package/{chunk-JOLNIJ36.js → chunk-JJ4OPVUC.js} +1 -1
  35. package/{chunk-O75U5E6H.js → chunk-K6XRQ3BT.js} +1 -1
  36. package/{chunk-NSHK5C75.js → chunk-KGYYEYB3.js} +1 -1
  37. package/{chunk-WKBCELT6.js → chunk-KY7VHQP6.js} +1 -1
  38. package/{chunk-EM3AQZPZ.js → chunk-LGEAM7GG.js} +1 -1
  39. package/{chunk-XGCWDZO7.js → chunk-MLQD24WT.js} +1 -1
  40. package/{chunk-EBEP5ZNI.js → chunk-NHIRDW4W.js} +1 -1
  41. package/{chunk-4O47GML2.js → chunk-OEK2FZGW.js} +1 -1
  42. package/{chunk-6XZEYZFV.js → chunk-OWIJGDDS.js} +1 -1
  43. package/{chunk-WW5ELKKO.js → chunk-PXCF3E7D.js} +1 -1
  44. package/{chunk-YJ2QEIBF.js → chunk-QBFAXFUM.js} +1 -1
  45. package/{chunk-X5PP77DR.js → chunk-QUUZKSSA.js} +1 -1
  46. package/{chunk-4OMJSWGH.js → chunk-VG24FAJ7.js} +1 -1
  47. package/{chunk-7K7AJJBA.js → chunk-YIH3GJPY.js} +1 -1
  48. package/{chunk-XO27WEAF.js → chunk-YZSCPMW2.js} +1 -1
  49. package/index.html +2 -2
  50. package/{main-RSQGAYLC.js → main-JNWTJZEO.js} +1 -1
  51. package/package.json +1 -1
  52. package/chunk-4BKREZBV.js +0 -1
@@ -1 +1 @@
1
- import{a as F}from"./chunk-JOLNIJ36.js";import{a as Be,b as Oe}from"./chunk-AACWH3EJ.js";import{a as je}from"./chunk-YPBGL37O.js";import{b as D}from"./chunk-SNKHWMQW.js";import{a as re}from"./chunk-WW5ELKKO.js";import"./chunk-FLZXCWDU.js";import{a as ze}from"./chunk-XKI7WLHE.js";import"./chunk-DHW7UHFT.js";import"./chunk-C2GO6SPF.js";import{a as z,b as j}from"./chunk-O4QM64EH.js";import{d as Ne,i as ke,j as Pe,k as Me}from"./chunk-SVXDMOLP.js";import{a as De,b as Fe}from"./chunk-S6X7PJAB.js";import"./chunk-LWLJZPBI.js";import"./chunk-3NU3P6NL.js";import"./chunk-GDX5XEV3.js";import{a as Je,b as Re}from"./chunk-DLUALPHU.js";import"./chunk-4DOELXOP.js";import"./chunk-VVUSFS6O.js";import"./chunk-ZTEDQLOG.js";import"./chunk-EDGADVEY.js";import"./chunk-JTDJJORR.js";import"./chunk-LZUGPBFD.js";import"./chunk-2KERKGCG.js";import{g as Ve,h as Ae}from"./chunk-XZQ3IYQ6.js";import{b as Te,c as Ee}from"./chunk-X22YKT5B.js";import{a as Ce,b as Se}from"./chunk-JYCUE5HV.js";import{a as v,b as be,c as we,d as ve,e as ye,f as Ie}from"./chunk-JMEBBWX4.js";import"./chunk-FUZFAJGJ.js";import{n as _e,o as ge,w as he,x as xe}from"./chunk-5FSMHZSY.js";import"./chunk-A5HAJEPC.js";import{b as ae,c as le,e as pe,f as me,k as se,l as ce,o as ue,u as de,x as fe}from"./chunk-G5S5AZA7.js";import"./chunk-Z45NTTES.js";import"./chunk-4AOHMAEQ.js";import"./chunk-BLQJXMNV.js";import"./chunk-F2X3VGZZ.js";import{h as Z,j as ee,k as te,n as ie,p as ne,r as oe}from"./chunk-OKCHQM5Q.js";import{Ab as K,Ac as V,Cb as x,Ga as k,Jc as T,Kb as c,Kc as Y,Lc as A,Mc as w,Ub as r,Vb as o,Wb as S,X as N,Yc as E,Z as H,_b as y,bb as U,c as J,cb as L,dc as I,ec as _,gb as l,ha as C,pa as g,qa as h,qc as s,rc as b,s as R,sc as P,uc as W,vc as $,wb as G,wc as M,xc as q,yc as Q,zc as X}from"./chunk-JP6RBSB3.js";import{a as u,b as f}from"./chunk-YQFG5XE2.js";var $e={data:{data:[],totalCount:0},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0}}},B=be(Ie($e),we(t=>({first:E(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:E(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:E(()=>t.data().data.some(a=>a.checked)),checkedAPCollection:E(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),ye(t=>{let a=C(F),e=C(D);return{updateFilter(n){v(t,i=>f(u({},i),{filter:u(u({},i.filter),n)}))},onRowSelect(n){v(t,i=>{let d=i.data.data.map(m=>m.id===n.id?f(u({},m),{checked:!0}):m);return f(u({},i),{data:f(u({},i.data),{data:d})})})},onRowUnselect(n){v(t,i=>{let d=i.data.data.map(m=>m.id===n.id?f(u({},m),{checked:!1}):m);return f(u({},i),{data:f(u({},i.data),{data:d})})})},onHeaderCheckboxToggle(n){v(t,i=>{let d=i.data.data.map(m=>f(u({},m),{checked:n}));return f(u({},i),{data:f(u({},i.data),{data:d})})})},getAPLoader:z(J(N(()=>a.getAPJournalLoader().pipe(j({next:n=>{v(t,i=>f(u({},i),{meta:n}))},error:n=>{console.error("Error fetching AP journal:",n)}}))))),getARCollection:z(J(R(n=>Object.entries(n).reduce((i,[d,m])=>(m!=null&&(i[d]=m),i),{})),N(n=>a.getAPJournal(n).pipe(R(i=>f(u({},i),{data:i.data.map(d=>f(u({},d),{due:e.from(d.due)?e.from(d.due).format():null,checked:!1}))})),j({next:i=>{v(t,d=>f(u({},d),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),ve(t=>({onInit:()=>{t.getAPLoader(),t.getARCollection(t.filter)}})));var O=t=>({"ng-invalid ng-dirty":t}),qe=()=>({});function Qe(t,a){if(t&1){let e=y();r(0,"p-button",10),I("onClick",function(){g(e);let n=_(2);return h(n.onCreateJournal())}),o()}}function Xe(t,a){if(t&1&&x(0,Qe,1,0,"p-button",9),t&2){let e=_();c("ngIf",e.store.hasCheckedRows())}}function Ye(t,a){t&1&&(r(0,"tr")(1,"th",12),S(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),s(4,"Outlet"),o(),r(5,"th",14),s(6,"Number"),o(),r(7,"th",15),s(8,"Supplier"),o(),r(9,"th",16),s(10,"Date"),o(),r(11,"th",16),s(12,"Due"),o(),r(13,"th",15),s(14,"Note"),o(),r(15,"th",17),s(16,"Payment"),o(),S(17,"th",18),o())}function Ze(t,a){if(t&1&&(r(0,"tr")(1,"td"),S(2,"p-tableCheckbox",19),o(),r(3,"td"),s(4),o(),r(5,"td")(6,"a",20),s(7),o()(),r(8,"td"),s(9),o(),r(10,"td"),s(11),T(12,"date"),o(),r(13,"td"),s(14),T(15,"date"),o(),r(16,"td"),S(17,"div",21),o(),r(18,"td"),s(19),o(),r(20,"td"),S(21,"p-button",22),o()()),t&2){let e=a.$implicit,p=_(2);l(2),c("value",e),l(2),b(e.outlet),l(2),c("href",p.authService.getTenantExternalURL()+"/menu/Debt/Debt/Join_Bill/New_Join_Bill/Info?ID="+e.id,L),l(),P(" ",e.number," "),l(2),b(e.customer),l(2),b(A(12,12,e.date,"d MMM y")),l(3),b(e.due?A(15,15,e.due,"d MMM y hh:mm"):"-"),l(3),c("innerHTML",e.note,U),l(2),b(e.payment),l(2),c("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function et(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 tt(t,a){t&1&&(r(0,"tr")(1,"td",23)(2,"span"),s(3,"No records found."),o()()())}function it(t,a){if(t&1){let e=y();r(0,"p-panel")(1,"p-table",11),I("onPage",function(n){g(e);let i=_();return h(i.onPageChange(n))})("onHeaderCheckboxToggle",function(n){g(e);let i=_();return h(i.onHeaderCheckboxToggle(n))})("onRowSelect",function(n){g(e);let i=_();return h(i.onRowSelect(n))})("onRowUnselect",function(n){g(e);let i=_();return h(i.onRowUnselect(n))}),x(2,Ye,18,0,"ng-template",null,3,w)(4,Ze,22,18,"ng-template",null,4,w)(6,et,1,3,"ng-template",null,5,w)(8,tt,4,0,"ng-template",null,6,w),o()()}if(t&2){let e=_();l(),c("value",e.store.data().data)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function nt(t,a){if(t&1&&(r(0,"span",34),s(1),T(2,"truncate"),o()),t&2){let e=a.$implicit;c("pTooltip",e.name),l(),P(" ",A(2,2,e.name,30)," ")}}function ot(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function rt(t,a){if(t&1&&(r(0,"div"),x(1,ot,3,1,"div",35),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("from"))}}function at(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function lt(t,a){if(t&1&&(r(0,"div"),x(1,at,3,1,"div",35),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("to"))}}function pt(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function mt(t,a){if(t&1&&(r(0,"div"),x(1,pt,3,1,"div",35),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("pageSize"))}}function st(t,a){if(t&1){let e=y();r(0,"form",24)(1,"div",25)(2,"label",26),s(3,"Outlet"),o(),r(4,"p-select",27),x(5,nt,3,5,"ng-template",null,7,w),o()(),r(7,"div",25)(8,"label",26),s(9,"From - To"),o(),r(10,"div",28),S(11,"p-datepicker",29),x(12,rt,2,1,"div",30),S(13,"p-datepicker",31),x(14,lt,2,1,"div",30),o()(),r(15,"div",25)(16,"label",26),s(17,"Supplier"),o(),r(18,"p-autocomplete",32),T(19,"async"),I("completeMethod",function(n){g(e);let i=_();return h(i.onSearchSupplier(n))}),o()(),r(20,"div",25)(21,"label",26),s(22,"Page Size"),o(),S(23,"input",33),x(24,mt,2,1,"div",30),o()()}if(t&2){let e=_();c("formGroup",e.form),l(4),c("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),l(7),c("iconDisplay","input")("showIcon",!0)("ngClass",V(17,O,e.isInvalid("from"))),l(),c("ngIf",e.isInvalid("from")),l(),c("iconDisplay","input")("showIcon",!0)("ngClass",V(19,O,e.isInvalid("to"))),l(),c("ngIf",e.isInvalid("to")),l(4),c("suggestions",Y(19,15,e.supplierSuggestions$)),l(5),c("autoNumeric",X(21,qe))("ngClass",V(22,O,e.isInvalid("pageSize"))),l(),c("ngIf",e.isInvalid("pageSize"))}}var Zt=(()=>{class t extends ze{constructor(){super(),this.store=C(B),this.generateJournalService=C(F),this.authService=C(re),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=C(de),this.dayjsService=C(D)}ngOnInit(){this.initform()}initform(){let{outletName:e,number:p,from:n,to:i,paymentState:d,supplierID:m,pageNumber:He,rowCount:Ue,pageSize:Le,export:Ge,exportPageNumber:Ke,exportRowCount:We}=this.store.filter();this.form=this.fb.group({outletName:this.fb.control(e),number:this.fb.control(p),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),paymentState:this.fb.control(d),supplierID:this.fb.control(m),pageNumber:this.fb.control(He),rowCount:this.fb.control(Ue),pageSize:this.fb.control(Le,[le.required]),export:this.fb.control(Ge),exportPageNumber:this.fb.control(Ke),exportRowCount:this.fb.control(We)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((p,[n,i])=>(i!=null&&(n==="from"||n==="to"?(typeof i=="string"||typeof i=="number"||i instanceof Date)&&(p[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null):p[n]=i),p),{});this.store.updateFilter(e),this.isDialogFilterVisible.update(p=>!p)}onSearch(e){this.store.updateFilter(f(u({},this.store.filter()),{number:e}))}onSearchSupplier(e){this.supplierSuggestions$=this.generateJournalService.getSupplierSuggestions(e.query).pipe()}onPageChange(e){let p=e.first/e.rows;this.store.updateFilter(f(u({},this.store.filter()),{pageNumber:p+1}))}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(p=>{this.store.onRowUnselect(p)});return}else this.store.onRowUnselect(e.data)}onCreateJournal(){this.generateJournalService.createAPJournal(this.store.checkedAPCollection()).pipe(H(()=>{this.store.getARCollection(this.store.filter)})).subscribe()}static{this.\u0275fac=function(p){return new(p||t)}}static{this.\u0275cmp=G({type:t,selectors:[["app-ap-journal"]],features:[Q([B]),K],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","AP Collection",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 Outlet",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","supplierID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(p,n){if(p&1){let i=y();r(0,"app-main-panel",8),q("isDialogFilterVisibleChange",function(m){return g(i),M(n.isDialogFilterVisible,m)||(n.isDialogFilterVisible=m),h(m)})("isInitDialogFilterVisibleChange",function(m){return g(i),M(n.isInitDialogFilterVisible,m)||(n.isInitDialogFilterVisible=m),h(m)}),I("filterConfirmed",function(){return g(i),h(n.onFilterOKEvent())})("search",function(m){return g(i),h(n.onSearch(m))}),x(1,Xe,1,1,"ng-template",null,0,w)(3,it,10,5,"ng-template",null,1,w)(5,st,25,24,"ng-template",null,2,w),o()}p&2&&(c("isSearchableInput",!0)("isFilterable",!0),$("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible),c("scrollable",!0))},dependencies:[Ae,Me,Ne,ke,Pe,oe,Z,ee,te,ie,ne,xe,he,Se,Ce,fe,se,ae,pe,me,ce,ue,Re,Je,Fe,De,ge,_e,Oe,Be,Ee,Te,Ve,je],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{Zt as ApJournalComponent};
1
+ import{a as F}from"./chunk-JJ4OPVUC.js";import{a as Be,b as Oe}from"./chunk-AACWH3EJ.js";import{a as je}from"./chunk-YPBGL37O.js";import{b as D}from"./chunk-INB6OCHW.js";import{a as re}from"./chunk-PXCF3E7D.js";import"./chunk-FLZXCWDU.js";import{a as ze}from"./chunk-XKI7WLHE.js";import"./chunk-DHW7UHFT.js";import"./chunk-C2GO6SPF.js";import{a as z,b as j}from"./chunk-O4QM64EH.js";import{d as Ne,i as ke,j as Pe,k as Me}from"./chunk-SVXDMOLP.js";import{a as De,b as Fe}from"./chunk-S6X7PJAB.js";import"./chunk-LWLJZPBI.js";import"./chunk-3NU3P6NL.js";import"./chunk-GDX5XEV3.js";import{a as Je,b as Re}from"./chunk-DLUALPHU.js";import"./chunk-4DOELXOP.js";import"./chunk-VVUSFS6O.js";import"./chunk-ZTEDQLOG.js";import"./chunk-EDGADVEY.js";import"./chunk-JTDJJORR.js";import"./chunk-LZUGPBFD.js";import"./chunk-2KERKGCG.js";import{g as Ve,h as Ae}from"./chunk-7INXBUUN.js";import{b as Te,c as Ee}from"./chunk-X22YKT5B.js";import{a as Ce,b as Se}from"./chunk-JYCUE5HV.js";import{a as v,b as be,c as we,d as ve,e as ye,f as Ie}from"./chunk-JMEBBWX4.js";import"./chunk-FUZFAJGJ.js";import{n as _e,o as ge,w as he,x as xe}from"./chunk-5FSMHZSY.js";import"./chunk-A5HAJEPC.js";import{b as ae,c as le,e as pe,f as me,k as se,l as ce,o as ue,u as de,x as fe}from"./chunk-G5S5AZA7.js";import"./chunk-Z45NTTES.js";import"./chunk-CV4R4TBA.js";import"./chunk-BLQJXMNV.js";import"./chunk-F2X3VGZZ.js";import{h as Z,j as ee,k as te,n as ie,p as ne,r as oe}from"./chunk-OKCHQM5Q.js";import{Ab as K,Ac as V,Cb as x,Ga as k,Jc as T,Kb as c,Kc as Y,Lc as A,Mc as w,Ub as r,Vb as o,Wb as S,X as N,Yc as E,Z as H,_b as y,bb as U,c as J,cb as L,dc as I,ec as _,gb as l,ha as C,pa as g,qa as h,qc as s,rc as b,s as R,sc as P,uc as W,vc as $,wb as G,wc as M,xc as q,yc as Q,zc as X}from"./chunk-JP6RBSB3.js";import{a as u,b as f}from"./chunk-YQFG5XE2.js";var $e={data:{data:[],totalCount:0},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0}}},B=be(Ie($e),we(t=>({first:E(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:E(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:E(()=>t.data().data.some(a=>a.checked)),checkedAPCollection:E(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),ye(t=>{let a=C(F),e=C(D);return{updateFilter(n){v(t,i=>f(u({},i),{filter:u(u({},i.filter),n)}))},onRowSelect(n){v(t,i=>{let d=i.data.data.map(m=>m.id===n.id?f(u({},m),{checked:!0}):m);return f(u({},i),{data:f(u({},i.data),{data:d})})})},onRowUnselect(n){v(t,i=>{let d=i.data.data.map(m=>m.id===n.id?f(u({},m),{checked:!1}):m);return f(u({},i),{data:f(u({},i.data),{data:d})})})},onHeaderCheckboxToggle(n){v(t,i=>{let d=i.data.data.map(m=>f(u({},m),{checked:n}));return f(u({},i),{data:f(u({},i.data),{data:d})})})},getAPLoader:z(J(N(()=>a.getAPJournalLoader().pipe(j({next:n=>{v(t,i=>f(u({},i),{meta:n}))},error:n=>{console.error("Error fetching AP journal:",n)}}))))),getARCollection:z(J(R(n=>Object.entries(n).reduce((i,[d,m])=>(m!=null&&(i[d]=m),i),{})),N(n=>a.getAPJournal(n).pipe(R(i=>f(u({},i),{data:i.data.map(d=>f(u({},d),{due:e.from(d.due)?e.from(d.due).format():null,checked:!1}))})),j({next:i=>{v(t,d=>f(u({},d),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),ve(t=>({onInit:()=>{t.getAPLoader(),t.getARCollection(t.filter)}})));var O=t=>({"ng-invalid ng-dirty":t}),qe=()=>({});function Qe(t,a){if(t&1){let e=y();r(0,"p-button",10),I("onClick",function(){g(e);let n=_(2);return h(n.onCreateJournal())}),o()}}function Xe(t,a){if(t&1&&x(0,Qe,1,0,"p-button",9),t&2){let e=_();c("ngIf",e.store.hasCheckedRows())}}function Ye(t,a){t&1&&(r(0,"tr")(1,"th",12),S(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),s(4,"Outlet"),o(),r(5,"th",14),s(6,"Number"),o(),r(7,"th",15),s(8,"Supplier"),o(),r(9,"th",16),s(10,"Date"),o(),r(11,"th",16),s(12,"Due"),o(),r(13,"th",15),s(14,"Note"),o(),r(15,"th",17),s(16,"Payment"),o(),S(17,"th",18),o())}function Ze(t,a){if(t&1&&(r(0,"tr")(1,"td"),S(2,"p-tableCheckbox",19),o(),r(3,"td"),s(4),o(),r(5,"td")(6,"a",20),s(7),o()(),r(8,"td"),s(9),o(),r(10,"td"),s(11),T(12,"date"),o(),r(13,"td"),s(14),T(15,"date"),o(),r(16,"td"),S(17,"div",21),o(),r(18,"td"),s(19),o(),r(20,"td"),S(21,"p-button",22),o()()),t&2){let e=a.$implicit,p=_(2);l(2),c("value",e),l(2),b(e.outlet),l(2),c("href",p.authService.getTenantExternalURL()+"/menu/Debt/Debt/Join_Bill/New_Join_Bill/Info?ID="+e.id,L),l(),P(" ",e.number," "),l(2),b(e.customer),l(2),b(A(12,12,e.date,"d MMM y")),l(3),b(e.due?A(15,15,e.due,"d MMM y hh:mm"):"-"),l(3),c("innerHTML",e.note,U),l(2),b(e.payment),l(2),c("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function et(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 tt(t,a){t&1&&(r(0,"tr")(1,"td",23)(2,"span"),s(3,"No records found."),o()()())}function it(t,a){if(t&1){let e=y();r(0,"p-panel")(1,"p-table",11),I("onPage",function(n){g(e);let i=_();return h(i.onPageChange(n))})("onHeaderCheckboxToggle",function(n){g(e);let i=_();return h(i.onHeaderCheckboxToggle(n))})("onRowSelect",function(n){g(e);let i=_();return h(i.onRowSelect(n))})("onRowUnselect",function(n){g(e);let i=_();return h(i.onRowUnselect(n))}),x(2,Ye,18,0,"ng-template",null,3,w)(4,Ze,22,18,"ng-template",null,4,w)(6,et,1,3,"ng-template",null,5,w)(8,tt,4,0,"ng-template",null,6,w),o()()}if(t&2){let e=_();l(),c("value",e.store.data().data)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function nt(t,a){if(t&1&&(r(0,"span",34),s(1),T(2,"truncate"),o()),t&2){let e=a.$implicit;c("pTooltip",e.name),l(),P(" ",A(2,2,e.name,30)," ")}}function ot(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function rt(t,a){if(t&1&&(r(0,"div"),x(1,ot,3,1,"div",35),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("from"))}}function at(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function lt(t,a){if(t&1&&(r(0,"div"),x(1,at,3,1,"div",35),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("to"))}}function pt(t,a){if(t&1&&(r(0,"div")(1,"span",36),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function mt(t,a){if(t&1&&(r(0,"div"),x(1,pt,3,1,"div",35),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("pageSize"))}}function st(t,a){if(t&1){let e=y();r(0,"form",24)(1,"div",25)(2,"label",26),s(3,"Outlet"),o(),r(4,"p-select",27),x(5,nt,3,5,"ng-template",null,7,w),o()(),r(7,"div",25)(8,"label",26),s(9,"From - To"),o(),r(10,"div",28),S(11,"p-datepicker",29),x(12,rt,2,1,"div",30),S(13,"p-datepicker",31),x(14,lt,2,1,"div",30),o()(),r(15,"div",25)(16,"label",26),s(17,"Supplier"),o(),r(18,"p-autocomplete",32),T(19,"async"),I("completeMethod",function(n){g(e);let i=_();return h(i.onSearchSupplier(n))}),o()(),r(20,"div",25)(21,"label",26),s(22,"Page Size"),o(),S(23,"input",33),x(24,mt,2,1,"div",30),o()()}if(t&2){let e=_();c("formGroup",e.form),l(4),c("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),l(7),c("iconDisplay","input")("showIcon",!0)("ngClass",V(17,O,e.isInvalid("from"))),l(),c("ngIf",e.isInvalid("from")),l(),c("iconDisplay","input")("showIcon",!0)("ngClass",V(19,O,e.isInvalid("to"))),l(),c("ngIf",e.isInvalid("to")),l(4),c("suggestions",Y(19,15,e.supplierSuggestions$)),l(5),c("autoNumeric",X(21,qe))("ngClass",V(22,O,e.isInvalid("pageSize"))),l(),c("ngIf",e.isInvalid("pageSize"))}}var Zt=(()=>{class t extends ze{constructor(){super(),this.store=C(B),this.generateJournalService=C(F),this.authService=C(re),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=C(de),this.dayjsService=C(D)}ngOnInit(){this.initform()}initform(){let{outletName:e,number:p,from:n,to:i,paymentState:d,supplierID:m,pageNumber:He,rowCount:Ue,pageSize:Le,export:Ge,exportPageNumber:Ke,exportRowCount:We}=this.store.filter();this.form=this.fb.group({outletName:this.fb.control(e),number:this.fb.control(p),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),paymentState:this.fb.control(d),supplierID:this.fb.control(m),pageNumber:this.fb.control(He),rowCount:this.fb.control(Ue),pageSize:this.fb.control(Le,[le.required]),export:this.fb.control(Ge),exportPageNumber:this.fb.control(Ke),exportRowCount:this.fb.control(We)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((p,[n,i])=>(i!=null&&(n==="from"||n==="to"?(typeof i=="string"||typeof i=="number"||i instanceof Date)&&(p[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null):p[n]=i),p),{});this.store.updateFilter(e),this.isDialogFilterVisible.update(p=>!p)}onSearch(e){this.store.updateFilter(f(u({},this.store.filter()),{number:e}))}onSearchSupplier(e){this.supplierSuggestions$=this.generateJournalService.getSupplierSuggestions(e.query).pipe()}onPageChange(e){let p=e.first/e.rows;this.store.updateFilter(f(u({},this.store.filter()),{pageNumber:p+1}))}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(p=>{this.store.onRowUnselect(p)});return}else this.store.onRowUnselect(e.data)}onCreateJournal(){this.generateJournalService.createAPJournal(this.store.checkedAPCollection()).pipe(H(()=>{this.store.getARCollection(this.store.filter)})).subscribe()}static{this.\u0275fac=function(p){return new(p||t)}}static{this.\u0275cmp=G({type:t,selectors:[["app-ap-journal"]],features:[Q([B]),K],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","AP Collection",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 Outlet",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","supplierID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(p,n){if(p&1){let i=y();r(0,"app-main-panel",8),q("isDialogFilterVisibleChange",function(m){return g(i),M(n.isDialogFilterVisible,m)||(n.isDialogFilterVisible=m),h(m)})("isInitDialogFilterVisibleChange",function(m){return g(i),M(n.isInitDialogFilterVisible,m)||(n.isInitDialogFilterVisible=m),h(m)}),I("filterConfirmed",function(){return g(i),h(n.onFilterOKEvent())})("search",function(m){return g(i),h(n.onSearch(m))}),x(1,Xe,1,1,"ng-template",null,0,w)(3,it,10,5,"ng-template",null,1,w)(5,st,25,24,"ng-template",null,2,w),o()}p&2&&(c("isSearchableInput",!0)("isFilterable",!0),$("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible),c("scrollable",!0))},dependencies:[Ae,Me,Ne,ke,Pe,oe,Z,ee,te,ie,ne,xe,he,Se,Ce,fe,se,ae,pe,me,ce,ue,Re,Je,Fe,De,ge,_e,Oe,Be,Ee,Te,Ve,je],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{Zt as ApJournalComponent};
@@ -1 +1 @@
1
- import{a as i,b as T}from"./chunk-C2GO6SPF.js";import{d as s}from"./chunk-Z45NTTES.js";import{a as l,c as m}from"./chunk-4AOHMAEQ.js";import{Z as a,ba as c,ha as r}from"./chunk-JP6RBSB3.js";var h=(()=>{class o{constructor(){this.httpService=r(l),this.router=r(s),this.intercomService=r(m),this.tokenService=r(T),this.autoLogout()}login(e){return this.httpService.post("","api/Authentication/login",e).pipe(a(t=>{let n=e.SubDomain;localStorage.setItem("AUTH_TOKEN",t.access_token),localStorage.setItem("AUTH_POS_TOKEN",t.pos.access_token),localStorage.setItem("AUTH_TOKEN_TYPE",t.token_type),localStorage.setItem("AUTH_EXPIRES_AT",t.expiredAt),localStorage.setItem("AUTH_DOMAIN",n.substring(n.indexOf("."))),localStorage.setItem("AUTH_SUB_DOMAIN",e.SubDomain.split(".")[0]),localStorage.setItem("AUTH_USERNAME",e.Username),this.storeIntercom(t),this.storeTenantId(t.pos.access_token),this.storeRoles(t.access_token),this.tokenService.setToken(t.access_token),this.autoLogout()}))}storeIntercom(e){let t=e.intercomWidget?JSON.stringify(e.intercomWidget):null;t&&localStorage.setItem("INTERCOM",t)}isAuthenticated(){return!!localStorage.getItem("AUTH_TOKEN")}getToken(){return localStorage.getItem("AUTH_TOKEN")}getTokenType(){return localStorage.getItem("AUTH_TOKEN_TYPE")}isTokenExpired(){let e=localStorage.getItem("AUTH_EXPIRES_AT");return e?new Date(e).getTime()<Date.now():!0}autoLogout(){clearTimeout(this.logoutTimer);let e=localStorage.getItem("AUTH_EXPIRES_AT");if(!e)return;let t=new Date(e).getTime()-Date.now();t>0?this.logoutTimer=setTimeout(()=>this.logout(),t):this.logout()}getTenantExternalURL(){let e=localStorage.getItem("AUTH_SUB_DOMAIN")||"",t=localStorage.getItem("AUTH_DOMAIN")||"";return e&&t?`https://${e}${t}`:""}getTanantToken(){return localStorage.getItem("AUTH_POS_TOKEN")}logout(){this.intercomService.shutdown(),localStorage.removeItem("AUTH_TOKEN"),localStorage.removeItem("AUTH_TOKEN_TYPE"),localStorage.removeItem("AUTH_EXPIRES_AT"),localStorage.removeItem("INTERCOM"),clearTimeout(this.logoutTimer),this.router.navigate([""])}getFullDomain(){let e=localStorage.getItem("AUTH_SUB_DOMAIN"),t=localStorage.getItem("AUTH_DOMAIN");return!e||!t?(console.error("Subdomain or domain is missing in local storage."),null):`${e}${t}`}storeTenantId(e){let t=i(e);console.log("Decoded Token:",t),t&&(localStorage.setItem("AC_TENANT_BRAND",t.Brand),localStorage.setItem("AC_TENANT_LID",t.LID))}storeRoles(e){let t=i(e);console.log("Decoded Token:",t),t&&localStorage.setItem("AUTH_ROLES",JSON.stringify(t["http://schemas.microsoft.com/ws/2008/06/identity/claims/role"]))}checkAuthKeysExists(){return["AC_TENANT_BRAND","AC_TENANT_LID","AUTH_DOMAIN","AUTH_EXPIRES_AT","AUTH_POS_TOKEN","AUTH_SUB_DOMAIN","AUTH_TOKEN","AUTH_TOKEN_TYPE","AUTH_USERNAME","AUTH_ROLES"].every(t=>!!localStorage.getItem(t))}static{this.\u0275fac=function(t){return new(t||o)}}static{this.\u0275prov=c({token:o,factory:o.\u0275fac,providedIn:"root"})}}return o})();export{h as a};
1
+ import{a as i,b as T}from"./chunk-C2GO6SPF.js";import{d as s}from"./chunk-Z45NTTES.js";import{a as l,c as m}from"./chunk-CV4R4TBA.js";import{Z as a,ba as c,ha as r}from"./chunk-JP6RBSB3.js";var h=(()=>{class o{constructor(){this.httpService=r(l),this.router=r(s),this.intercomService=r(m),this.tokenService=r(T),this.autoLogout()}login(e){return this.httpService.post("","api/Authentication/login",e).pipe(a(t=>{let n=e.SubDomain;localStorage.setItem("AUTH_TOKEN",t.access_token),localStorage.setItem("AUTH_POS_TOKEN",t.pos.access_token),localStorage.setItem("AUTH_TOKEN_TYPE",t.token_type),localStorage.setItem("AUTH_EXPIRES_AT",t.expiredAt),localStorage.setItem("AUTH_DOMAIN",n.substring(n.indexOf("."))),localStorage.setItem("AUTH_SUB_DOMAIN",e.SubDomain.split(".")[0]),localStorage.setItem("AUTH_USERNAME",e.Username),this.storeIntercom(t),this.storeTenantId(t.pos.access_token),this.storeRoles(t.access_token),this.tokenService.setToken(t.access_token),this.autoLogout()}))}storeIntercom(e){let t=e.intercomWidget?JSON.stringify(e.intercomWidget):null;t&&localStorage.setItem("INTERCOM",t)}isAuthenticated(){return!!localStorage.getItem("AUTH_TOKEN")}getToken(){return localStorage.getItem("AUTH_TOKEN")}getTokenType(){return localStorage.getItem("AUTH_TOKEN_TYPE")}isTokenExpired(){let e=localStorage.getItem("AUTH_EXPIRES_AT");return e?new Date(e).getTime()<Date.now():!0}autoLogout(){clearTimeout(this.logoutTimer);let e=localStorage.getItem("AUTH_EXPIRES_AT");if(!e)return;let t=new Date(e).getTime()-Date.now();t>0?this.logoutTimer=setTimeout(()=>this.logout(),t):this.logout()}getTenantExternalURL(){let e=localStorage.getItem("AUTH_SUB_DOMAIN")||"",t=localStorage.getItem("AUTH_DOMAIN")||"";return e&&t?`https://${e}${t}`:""}getTanantToken(){return localStorage.getItem("AUTH_POS_TOKEN")}logout(){this.intercomService.shutdown(),localStorage.removeItem("AUTH_TOKEN"),localStorage.removeItem("AUTH_TOKEN_TYPE"),localStorage.removeItem("AUTH_EXPIRES_AT"),localStorage.removeItem("INTERCOM"),clearTimeout(this.logoutTimer),this.router.navigate([""])}getFullDomain(){let e=localStorage.getItem("AUTH_SUB_DOMAIN"),t=localStorage.getItem("AUTH_DOMAIN");return!e||!t?(console.error("Subdomain or domain is missing in local storage."),null):`${e}${t}`}storeTenantId(e){let t=i(e);console.log("Decoded Token:",t),t&&(localStorage.setItem("AC_TENANT_BRAND",t.Brand),localStorage.setItem("AC_TENANT_LID",t.LID))}storeRoles(e){let t=i(e);console.log("Decoded Token:",t),t&&localStorage.setItem("AUTH_ROLES",JSON.stringify(t["http://schemas.microsoft.com/ws/2008/06/identity/claims/role"]))}checkAuthKeysExists(){return["AC_TENANT_BRAND","AC_TENANT_LID","AUTH_DOMAIN","AUTH_EXPIRES_AT","AUTH_POS_TOKEN","AUTH_SUB_DOMAIN","AUTH_TOKEN","AUTH_TOKEN_TYPE","AUTH_USERNAME","AUTH_ROLES"].every(t=>!!localStorage.getItem(t))}static{this.\u0275fac=function(t){return new(t||o)}}static{this.\u0275prov=c({token:o,factory:o.\u0275fac,providedIn:"root"})}}return o})();export{h as a};
@@ -1 +1 @@
1
- import{a as u}from"./chunk-WW5ELKKO.js";import{d as e}from"./chunk-Z45NTTES.js";import{ha as t}from"./chunk-JP6RBSB3.js";var m=(n,i)=>{let r=t(u),o=t(e);return!r.isAuthenticated()||r.isTokenExpired()||!r.checkAuthKeysExists()?(o.navigate(["/"],{queryParams:{returnUrl:i.url}}),!1):!0};export{m as a};
1
+ import{a as u}from"./chunk-PXCF3E7D.js";import{d as e}from"./chunk-Z45NTTES.js";import{ha as t}from"./chunk-JP6RBSB3.js";var m=(n,i)=>{let r=t(u),o=t(e);return!r.isAuthenticated()||r.isTokenExpired()||!r.checkAuthKeysExists()?(o.navigate(["/"],{queryParams:{returnUrl:i.url}}),!1):!0};export{m as a};
@@ -1 +1 @@
1
- import{a as Qe,b as Xe,c as Ye,d as Ze,e as et,f as tt}from"./chunk-3VJJTR55.js";import{a as ze,b as Ue,c as qe,d as We}from"./chunk-XAWSZFE3.js";import{a as He,b as Ke}from"./chunk-YYDAQ7AW.js";import{a as $e}from"./chunk-YPBGL37O.js";import{b as Le}from"./chunk-SNKHWMQW.js";import{a as Je,b as je}from"./chunk-Q23KXB3T.js";import"./chunk-DHW7UHFT.js";import{a as Be,b as Oe,d as Ve,k as ke}from"./chunk-SVXDMOLP.js";import{a as Ne,b as Me}from"./chunk-S6X7PJAB.js";import"./chunk-LWLJZPBI.js";import"./chunk-3NU3P6NL.js";import{a as Re}from"./chunk-XKCLERWG.js";import{a as K,b as Q}from"./chunk-H57SDRPH.js";import"./chunk-GDX5XEV3.js";import{a as Ge,b as Pe}from"./chunk-DLUALPHU.js";import"./chunk-4DOELXOP.js";import{a as De,b as we}from"./chunk-VVUSFS6O.js";import"./chunk-ZTEDQLOG.js";import"./chunk-EDGADVEY.js";import"./chunk-JTDJJORR.js";import"./chunk-LZUGPBFD.js";import"./chunk-2KERKGCG.js";import{b as X}from"./chunk-4CDAAU6Z.js";import{h as I}from"./chunk-XZQ3IYQ6.js";import"./chunk-X22YKT5B.js";import{a as L,b as $}from"./chunk-JYCUE5HV.js";import"./chunk-JMEBBWX4.js";import"./chunk-FUZFAJGJ.js";import{n as H,o as E,w as J,x as j}from"./chunk-5FSMHZSY.js";import"./chunk-A5HAJEPC.js";import{Ha as R,La as Te,b as G,c as le,e as A,f as P,j as Ee,l as B,m as q,n as Ie,o as O,u as V,w as W,x as k}from"./chunk-G5S5AZA7.js";import{b as xe,e as Se,l as ye}from"./chunk-Z45NTTES.js";import{a as Ae}from"./chunk-4AOHMAEQ.js";import{a as Fe}from"./chunk-BLQJXMNV.js";import"./chunk-F2X3VGZZ.js";import{h as be,k as Ce,q as he,r as F}from"./chunk-OKCHQM5Q.js";import{Ac as oe,Cb as g,Ga as z,Jc as re,Kb as p,Kc as ae,L as ue,Mc as f,Nb as fe,Qb as T,Sb as N,Tb as M,Ub as i,Vb as n,Wb as c,Y as se,Z as D,_b as C,ba as de,dc as h,ec as u,g as pe,gb as l,ha as s,mb as ne,pa as v,qa as _,qc as r,rc as y,s as ce,sc as ie,vc as ge,wb as S,wc as ve,xc as _e,yc as U,zc as w}from"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var b=(()=>{class t{#e=s(Ae);fetchLoaderConfiguration(){return this.#e.get("","api/SetupLoader/Load")}updateAccountingIntegrationConfiguration(e){return this.#e.post(void 0,"/api/setup/SubmitConfig",e)}fetchOpeningBalanceFormConfiguration(){return this.#e.get("","/api/setup/OpeningBalance/Form")}submitOpeningBalanceFormConfiguration(e){return this.#e.post("","api/setup/OpeningBalance/Submit",e)}fetchAPICredential(){return this.#e.get(void 0,"/api/AccountConfig")}updateAPICredential(e){return this.#e.put(void 0,"/api/AccountConfig",e)}verifyAPICredential(e){return this.#e.post(void 0,"/api/AccountConfig/Validate",e)}formatJournal(e){return this.#e.post("","/api/setup/formatdata/clearjournal",{domain:e})}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275prov=de({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var st=()=>({height:"calc(100vh - 100px)"});function dt(t,m){if(t&1){let e=C();i(0,"div",4)(1,"a",5),r(2,"Cancel"),n(),i(3,"p-button",6),h("click",function(){v(e);let a=u();return _(a.updateAccountingIntegration())}),n()()}}function ft(t,m){if(t&1&&(i(0,"p-tab",8),r(1),n()),t&2){let e=m.$implicit,o=m.$index;p("value",o),l(),y(e)}}function gt(t,m){if(t&1&&(i(0,"div",25),c(1,"p-radiobutton",42),i(2,"label",43),r(3),n()()),t&2){let e=m.$implicit;l(),p("value",e.key)("inputId",e.value),l(),p("for",e.value),l(),y(e.value)}}function vt(t,m){if(t&1&&(i(0,"div",40)(1,"div",25),c(2,"p-radiobutton",44),i(3,"label",43),r(4),n()()()),t&2){let e=m.$implicit;l(2),p("value",e.key)("inputId",e.key.toString()),l(),p("for",e.key),l(),y(e.value)}}function _t(t,m){if(t&1&&(i(0,"div",40)(1,"div",25),c(2,"p-radiobutton",45),i(3,"label",43),r(4),n()()()),t&2){let e=m.$implicit;l(2),p("value",e.key)("inputId",e.value),l(),p("for",e.value),l(),y(e.value)}}function bt(t,m){if(t&1&&(i(0,"p-scrollpanel",null,2)(2,"p-tabs",7)(3,"p-tablist"),N(4,ft,2,2,"p-tab",8,T),n(),i(6,"p-tabpanels")(7,"p-tabpanel",9)(8,"div",10)(9,"h3",11),r(10,"Accounting Numbering"),n(),i(11,"div",12)(12,"div",13)(13,"div",14)(14,"div",13)(15,"div",15)(16,"label",16),r(17,"Digit"),n(),c(18,"p-inputnumber",17),n()(),i(19,"div",13)(20,"div",15)(21,"label",18),r(22,"Seed"),n(),c(23,"p-inputnumber",19),n()(),i(24,"div",13)(25,"div",15)(26,"label",20),r(27,"Last Number"),n(),c(28,"p-inputnumber",21),n()(),i(29,"div",13)(30,"div",15)(31,"label",22),r(32,"Format"),n(),c(33,"p-select",23),n()(),i(34,"div",13)(35,"div",15)(36,"label",22),r(37,"Reset Every"),n(),i(38,"div",24),N(39,gt,4,4,"div",25,T),n()()()()()()()(),i(41,"p-tabpanel",8)(42,"div",26)(43,"div",27)(44,"h3",11),r(45,"Journal Generate"),n(),i(46,"p"),r(47,"Configure generate transaction"),n()(),i(48,"div",12)(49,"div",28)(50,"div",12)(51,"div",29)(52,"div",15)(53,"label",22),r(54,"Outlet Delivery Journal"),n(),c(55,"p-toggleswitch",30),n()(),i(56,"div",31)(57,"div",15)(58,"label",22),r(59,"Payment Discount Journal On Payment"),n(),c(60,"p-toggleswitch",32),n()()()()()(),c(61,"hr"),i(62,"div",26)(63,"div",28)(64,"div",12)(65,"div",33)(66,"label",22),r(67,"Note"),n()(),i(68,"div",29)(69,"div",15)(70,"label",22),r(71,"Note Required On Journal"),n(),c(72,"p-toggleswitch",34),n()(),i(73,"div",29)(74,"div",15)(75,"label",22),r(76,"Trial Balance Footer Visible"),n(),c(77,"p-toggleswitch",35),n()(),c(78,"div",29),n()()()(),i(79,"p-tabpanel",36)(80,"div",10)(81,"h3",11),r(82,"Report"),n(),i(83,"div",12)(84,"div",27)(85,"div",37)(86,"div")(87,"label",38),r(88,"Accounting For Treatment"),n(),i(89,"div",12)(90,"div",39)(91,"div",12),N(92,vt,5,4,"div",40,T),n()()()(),i(94,"div")(95,"label",41),r(96,"Configure Report Access Control in COA"),n(),i(97,"div",12)(98,"div",39)(99,"div",12),N(100,_t,5,4,"div",40,T),n()()()()()()()()()()()()),t&2){let e,o,a,d,x=u();fe(w(8,st)),l(2),p("value",0)("formGroup",x.form),l(2),M(x.tabs()),l(3),p("value",0),l(26),p("options",(e=x.accountingIntegration())==null||e.options==null?null:e.options.monthlyResetPeriodFormat),l(6),M((o=x.accountingIntegration())==null||o.options==null?null:o.options.resetPeriods),l(2),p("value",1),l(38),p("value",2),l(13),M((a=x.accountingIntegration())==null||a.options==null?null:a.options.generatePrepaidJournal),l(8),M((d=x.accountingIntegration())==null||d.options==null?null:d.options.entityAccess)}}var it=(()=>{class t{constructor(){this.accountingSetupService=s(b),this.fb=s(V).nonNullable,this.tabs=z(["Numbering","Journal","Report"]),this.accountingIntegration=z(null)}ngOnInit(){this.initializeForm(),this.loadAccountingConfiguration()}initializeForm(){this.form=this.fb.group({number:this.createNumberGroup(),report:this.createReportGroup(),journalGenerate:this.createJournalGenerateGroup()})}createNumberGroup(){return this.fb.group({seed:this.fb.control(""),digit:this.fb.control(""),resetEvery:this.fb.control(""),monthlyFormat:this.fb.control(""),lastNumber:this.fb.control(""),lastModified:this.fb.control("")})}createReportGroup(){return this.fb.group({accountingAuditType:this.fb.control(""),accountingEntityAccess:this.fb.control(""),generatePrepaidJournal:this.fb.control("")})}createJournalGenerateGroup(){return this.fb.group({eodExpenseJournal:this.fb.control(""),transferOrder:this.fb.control(""),paymentDiscount:this.fb.control(""),noteMandatory:this.fb.control(""),trialBalanceFooterVisible:this.fb.control("")})}loadAccountingConfiguration(){this.accountingSetupService.fetchLoaderConfiguration().pipe(D(e=>{this.accountingIntegration.set(e),this.form.patchValue(e.form)})).subscribe()}updateAccountingIntegration(){let e={form:this.form.getRawValue()};this.accountingSetupService.updateAccountingIntegrationConfiguration(e).pipe().subscribe()}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=S({type:t,selectors:[["app-accounting-integration"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["scrollPanelContainer",""],["pageTitle","Accounting Integration"],[1,"d-flex","gap-2"],["routerLink","..",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"click"],[1,"border-top",3,"value","formGroup"],[3,"value"],["formGroupName","number",3,"value"],[1,""],[1,"fs-5"],[1,"row"],[1,"col-6"],[1,"row","row-gap-3"],[1,"d-flex","flex-column"],["for","digit",1,"fs-4"],["inputId","digit","formControlName","digit"],["for","seed",1,"fs-4"],["inputId","seed","formControlName","seed"],["for","lastNumber",1,"fs-4"],["inputId","lastNumber","formControlName","lastNumber"],["for","",1,"fs-4"],["appendTo","body","formControlName","monthlyFormat","optionValue","key","optionLabel","value",3,"options"],[1,"d-flex","gap-4"],[1,"d-flex","align-items-center","gap-2"],["formGroupName","journalGenerate",1,"row"],[1,"col-12"],[1,"col-10"],[1,"col-md-4","mb-3"],["formControlName","transferOrder"],[1,"col-md-6","mb-4"],["formControlName","paymentDiscount"],[1,"col-12","mb-2"],["formControlName","noteMandatory"],["formControlName","trialBalanceFooterVisible"],["formGroupName","report",3,"value"],[1,"d-flex","flex-column","gap-4"],["for","generatePrepaidJournal",1,"fs-4","mb-2"],[1,"col-8"],[1,"col-4"],["for","accountingEntityAccess",1,"fs-4","mb-2"],["name","resetEvery","formControlName","resetEvery",3,"value","inputId"],[1,"m-0",3,"for"],["name","generatePrepaidJournal","formControlName","generatePrepaidJournal",3,"value","inputId"],["name","accountingEntityAccess","formControlName","accountingEntityAccess",3,"value","inputId"]],template:function(o,a){o&1&&(i(0,"app-main-panel",3),g(1,dt,4,0,"ng-template",null,0,f)(3,bt,102,9,"ng-template",null,1,f),n())},dependencies:[F,tt,et,Ze,Ye,Qe,Xe,I,X,Oe,Be,k,A,P,B,O,q,E,Pe,Ge,je,Je,ye,Se,j,J,we,De,Q,K],styles:["[_nghost-%COMP%]{display:block}.inactive-state[_ngcontent-%COMP%]{background-color:#e5e5e5}.active-state[_ngcontent-%COMP%]{background-color:var(--p-primary-color)}"],changeDetection:0})}}return t})();var xt=()=>[],ot=()=>({});function St(t,m){if(t&1){let e=C();i(0,"div")(1,"p-button",6),h("onClick",function(){v(e);let a=u();return _(a.submitForm())}),n()()}}function yt(t,m){t&1&&(i(0,"div",12)(1,"h3",13),r(2,"Date"),n(),c(3,"p-datePicker",14),n())}function Ft(t,m){t&1&&(i(0,"tr")(1,"th",20),r(2,"Account Name"),n(),i(3,"th",21),r(4,"Debit"),n(),i(5,"th",21),r(6,"Credit"),n()())}function At(t,m){if(t&1&&(i(0,"tr",10)(1,"td",20),r(2),n(),i(3,"td"),c(4,"input",22),n(),i(5,"td"),c(6,"input",23),n()()),t&2){let e,o=m.$implicit,a=m.rowIndex,d=u(4);p("formGroupName",a),l(2),ie(" ",(e=d.asFormGroup(o).get("accountName"))==null?null:e.value," "),l(2),p("autoNumeric",w(4,ot)),l(2),p("autoNumeric",w(5,ot))}}function Et(t,m){if(t&1&&(i(0,"div",10)(1,"h4",15),r(2),n(),i(3,"div",16)(4,"p-table",17),g(5,Ft,7,0,"ng-template",18)(6,At,7,6,"ng-template",19),n()()()),t&2){let e=m.$implicit,o=m.$index,a=u(3);p("formGroupName",o),l(2),ie(" ",e.get("name").value," "),l(2),p("value",a.getItemsArray(a.asFormGroup(e)).controls)}}function It(t,m){if(t&1&&(i(0,"tr")(1,"td")(2,"p",24),r(3,"Total"),n()(),i(4,"td",25)(5,"p",24),r(6),re(7,"number"),n()(),i(8,"td",25)(9,"p",24),r(10),re(11,"number"),n()()()),t&2){let e=u(3);l(6),y(ae(7,2,e.subtotalDebit)),l(4),y(ae(11,4,e.subtotalCredit))}}function Tt(t,m){if(t&1&&(i(0,"p-panel",8),g(1,yt,4,0,"ng-template",null,2,f),c(3,"p-divider"),i(4,"p-scroll-panel")(5,"div",9),N(6,Et,7,3,"div",10,T),n()(),i(8,"p-table",11),g(9,It,12,6,"ng-template",null,3,f),n()()),t&2){let e=u(2);p("formGroup",e.formGroups),l(6),M(e.formsArray.controls),l(2),p("value",w(2,xt))}}function Nt(t,m){if(t&1&&g(0,Tt,11,3,"p-panel",7),t&2){let e=u();p("ngIf",e.formGroups)}}var at=(()=>{class t{constructor(){this.destroy$=new pe,this.subtotalDebit=0,this.subtotalCredit=0,this.fb=s(V),this.accSetupService=s(b),this.dayjsService=s(Le),this.date=new Date,this.routes=s(xe)}ngOnInit(){this.initializeForm(),this.loadFormData(),this.calculateSubtotalDebit(),this.formGroups.get("forms").valueChanges.pipe(ue(300),se(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 o=e.map(a=>this.createItemGroup(a));return this.fb.array(o)}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(ce(e=>e.data),Re("response"),D(e=>{for(;this.formsArray.length>0;)this.formsArray.removeAt(0);e.form.filter(a=>a.items&&a.items.length>0).forEach(a=>{this.formsArray.push(this.createFormGroup(a))})})).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(o=>{let a=this.getItemsArray(o),d=a.controls.reduce((Z,ee)=>{let te=ee.get("debitAmount").value||0;return Z+te},0),x=a.controls.reduce((Z,ee)=>{let te=ee.get("creditAmount").value||0;return Z+te},0);this.subtotalDebit+=d,this.subtotalCredit+=x})}submitForm(){let e=Object.entries(this.formGroups.getRawValue()).reduce((o,[a,d])=>(a==="date"?o[a]=d instanceof Date?this.dayjsService.format(d):d:a==="forms"?o.form=d:o[a]=d,o),{});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(o){return new(o||t)}}static{this.\u0275cmp=S({type:t,selectors:[["app-acc-opening-balance-form"]],features:[U([R])],decls:6,vars:1,consts:[["actionButton",""],["content",""],["header",""],["footer",""],["pageTitle","Opening Balance Form",3,"scrollable"],["preventOpenDuplicates",""],["label","Submit",3,"onClick"],[3,"formGroup",4,"ngIf"],[3,"formGroup"],["formArrayName","forms",1,"d-flex","flex-column","row-gap-4"],[3,"formGroupName"],[3,"value"],[1,"d-flex","flex-column","gap-2","mx-2"],[1,"fs-5","m-0"],["formControlName","date"],[1,"fs-4"],["formArrayName","items"],["dataKey","id",3,"value"],["pTemplate","header"],["pTemplate","body"],[1,"fs-3"],[1,"fs-3",2,"width","200px"],["formControlName","debitAmount",1,"fs-3","form-control",3,"autoNumeric"],["formControlName","creditAmount",1,"fs-3","form-control",3,"autoNumeric"],[1,"fw-semibold","fs-4"],[1,"text-end",2,"width","200px"]],template:function(o,a){o&1&&(i(0,"app-main-panel",4),g(1,St,2,0,"ng-template",null,0,f)(3,Nt,1,1,"ng-template",null,1,f),n(),c(5,"p-toast",5)),o&2&&p("scrollable",!0)},dependencies:[I,X,Te,F,Ce,he,Me,Ne,ke,Ve,Q,K,W,G,A,P,E,qe,j,J,$,L,$e,k,B,O,q,Ie,Ke,He],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var lt=t=>({"ng-invalid ng-dirty":t});function Dt(t,m){if(t&1){let e=C();i(0,"p-button",4),h("onClick",function(){v(e);let a=u();return _(a.verifyCredentials())}),r(1,"Verify"),n(),i(2,"p-button",4),h("onClick",function(){v(e);let a=u();return _(a.saveCredentials())}),r(3,"Update"),n()}}function wt(t,m){t&1&&(i(0,"div",12)(1,"h3",13),r(2,"Account"),n(),i(3,"small",14),r(4,"Configure Client ID and Client Secret"),n()())}function Gt(t,m){if(t&1&&(i(0,"div",5)(1,"p-panel"),g(2,wt,5,0,"ng-template",null,2,f),i(4,"div",6)(5,"div",7)(6,"div",8)(7,"label",9),r(8,"Client ID"),n(),c(9,"input",10),n()(),i(10,"div",7)(11,"div",8)(12,"label",9),r(13,"Client Secret"),n(),c(14,"input",11),n()()()()()),t&2){let e=u();l(4),p("formGroup",e.credentialForm),l(5),p("ngClass",oe(3,lt,e.clientIDControl.invalid&&e.clientIDControl.dirty||e.clientIDControl.touched)),l(5),p("ngClass",oe(5,lt,e.clientSecretControl.invalid&&e.clientSecretControl.dirty||e.clientSecretControl.touched))}}var mt=(()=>{class t{constructor(e,o){this.fb=e,this.messageService=o,this.setupService=s(b)}ngOnInit(){this.initForm(),this.setupService.fetchAPICredential().pipe(D(e=>{this.credentialForm.patchValue({clientID:e.clientID||"",clientSecret:e.clientSecret||""})})).subscribe()}initForm(){this.credentialForm=this.fb.group({clientID:["",[le.required]],clientSecret:["",[le.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:o=>{console.log("Verify result:",o),this.messageService.add({severity:"success",summary:"Verified",detail:"Credentials are valid!"})},error:o=>{console.error("Verify failed:",o),this.messageService.add({severity:"error",summary:"Invalid",detail:"Client ID or Secret is wrong!"})}})}static{this.\u0275fac=function(o){return new(o||t)(ne(V),ne(R))}}static{this.\u0275cmp=S({type:t,selectors:[["app-api-credential"]],features:[U([R])],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(o,a){o&1&&(i(0,"app-main-panel",3),g(1,Dt,4,0,"ng-template",null,0,f)(3,Gt,15,7,"ng-template",null,1,f),n())},dependencies:[F,be,k,G,A,P,B,O,E,H,$,L,I,j,J,We],encapsulation:2})}}return t})();function Pt(t,m){if(t&1){let e=C();i(0,"button",4),h("click",function(){v(e);let a=u();return _(a.onFormatJournal())}),r(1," Format "),n()}}function Bt(t,m){t&1&&(i(0,"div",12)(1,"div",13)(2,"h4",14),r(3,"Journal Configuration"),n(),i(4,"small",15),r(5," Enter your account information to format journal entries "),n()()())}function Ot(t,m){if(t&1){let e=C();i(0,"div",5)(1,"p-panel"),g(2,Bt,6,0,"ng-template",null,2,f),i(4,"div",6)(5,"div",7)(6,"p-floatlabel",8)(7,"input",9),_e("ngModelChange",function(a){v(e);let d=u();return ve(d.subdomain,a)||(d.subdomain=a),_(a)}),n(),i(8,"label",10),r(9,"Subdomain"),n()(),i(10,"small",11),r(11,"Enter your account subdomain (e.g., mycompany.dealpos.net)"),n()()()()()}if(t&2){let e=u();l(7),ge("ngModel",e.subdomain)}}var pt=(()=>{class t{constructor(){this.setupService=s(b),this.subdomain=z(""),this.toastrService=s(Fe)}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(o){return new(o||t)}}static{this.\u0275cmp=S({type:t,selectors:[["app-format-jurnal"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","Format Journal"],[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(o,a){o&1&&(i(0,"app-main-panel",3),g(1,Pt,2,0,"ng-template",null,0,f)(3,Ot,12,1,"ng-template",null,1,f),n())},dependencies:[F,W,G,A,Ee,E,H,I,$,L,Ue,ze],encapsulation:2})}}return t})();var ct=()=>s(b).fetchOpeningBalanceFormConfiguration();var bi=[{path:"",redirectTo:"accounting-integration",pathMatch:"full"},{path:"",children:[{path:"accounting-integration",component:it},{path:"opening-balance-form",component:at,resolve:{data:ct}},{path:"api-crendetial",component:mt},{path:"format-journal",component:pt},{path:"closing-entries",loadComponent:()=>import("./chunk-7SXGBB2J.js").then(t=>t.ClosingPageComponent)},{path:"closing-entries/create",loadComponent:()=>import("./chunk-MQPAWXQR.js").then(t=>t.ClosingFormComponent)}]}];export{bi as ACCOUNTING_SETUP_ROUTES};
1
+ import{a as Qe,b as Xe,c as Ye,d as Ze,e as et,f as tt}from"./chunk-3VJJTR55.js";import{a as ze,b as Ue,c as qe,d as We}from"./chunk-XAWSZFE3.js";import{a as He,b as Ke}from"./chunk-YYDAQ7AW.js";import{a as $e}from"./chunk-YPBGL37O.js";import{b as Le}from"./chunk-INB6OCHW.js";import{a as Je,b as je}from"./chunk-Q23KXB3T.js";import"./chunk-DHW7UHFT.js";import{a as Be,b as Oe,d as Ve,k as ke}from"./chunk-SVXDMOLP.js";import{a as Ne,b as Me}from"./chunk-S6X7PJAB.js";import"./chunk-LWLJZPBI.js";import"./chunk-3NU3P6NL.js";import{a as Re}from"./chunk-XKCLERWG.js";import{a as K,b as Q}from"./chunk-H57SDRPH.js";import"./chunk-GDX5XEV3.js";import{a as Ge,b as Pe}from"./chunk-DLUALPHU.js";import"./chunk-4DOELXOP.js";import{a as De,b as we}from"./chunk-VVUSFS6O.js";import"./chunk-ZTEDQLOG.js";import"./chunk-EDGADVEY.js";import"./chunk-JTDJJORR.js";import"./chunk-LZUGPBFD.js";import"./chunk-2KERKGCG.js";import{b as X}from"./chunk-4CDAAU6Z.js";import{h as I}from"./chunk-7INXBUUN.js";import"./chunk-X22YKT5B.js";import{a as L,b as $}from"./chunk-JYCUE5HV.js";import"./chunk-JMEBBWX4.js";import"./chunk-FUZFAJGJ.js";import{n as H,o as E,w as J,x as j}from"./chunk-5FSMHZSY.js";import"./chunk-A5HAJEPC.js";import{Ha as R,La as Te,b as G,c as le,e as A,f as P,j as Ee,l as B,m as q,n as Ie,o as O,u as V,w as W,x as k}from"./chunk-G5S5AZA7.js";import{b as xe,e as Se,l as ye}from"./chunk-Z45NTTES.js";import{a as Ae}from"./chunk-CV4R4TBA.js";import{a as Fe}from"./chunk-BLQJXMNV.js";import"./chunk-F2X3VGZZ.js";import{h as be,k as Ce,q as he,r as F}from"./chunk-OKCHQM5Q.js";import{Ac as oe,Cb as g,Ga as z,Jc as re,Kb as p,Kc as ae,L as ue,Mc as f,Nb as fe,Qb as T,Sb as N,Tb as M,Ub as i,Vb as n,Wb as c,Y as se,Z as D,_b as C,ba as de,dc as h,ec as u,g as pe,gb as l,ha as s,mb as ne,pa as v,qa as _,qc as r,rc as y,s as ce,sc as ie,vc as ge,wb as S,wc as ve,xc as _e,yc as U,zc as w}from"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var b=(()=>{class t{#e=s(Ae);fetchLoaderConfiguration(){return this.#e.get("","api/SetupLoader/Load")}updateAccountingIntegrationConfiguration(e){return this.#e.post(void 0,"/api/setup/SubmitConfig",e)}fetchOpeningBalanceFormConfiguration(){return this.#e.get("","/api/setup/OpeningBalance/Form")}submitOpeningBalanceFormConfiguration(e){return this.#e.post("","api/setup/OpeningBalance/Submit",e)}fetchAPICredential(){return this.#e.get(void 0,"/api/AccountConfig")}updateAPICredential(e){return this.#e.put(void 0,"/api/AccountConfig",e)}verifyAPICredential(e){return this.#e.post(void 0,"/api/AccountConfig/Validate",e)}formatJournal(e){return this.#e.post("","/api/setup/formatdata/clearjournal",{domain:e})}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275prov=de({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var st=()=>({height:"calc(100vh - 100px)"});function dt(t,m){if(t&1){let e=C();i(0,"div",4)(1,"a",5),r(2,"Cancel"),n(),i(3,"p-button",6),h("click",function(){v(e);let a=u();return _(a.updateAccountingIntegration())}),n()()}}function ft(t,m){if(t&1&&(i(0,"p-tab",8),r(1),n()),t&2){let e=m.$implicit,o=m.$index;p("value",o),l(),y(e)}}function gt(t,m){if(t&1&&(i(0,"div",25),c(1,"p-radiobutton",42),i(2,"label",43),r(3),n()()),t&2){let e=m.$implicit;l(),p("value",e.key)("inputId",e.value),l(),p("for",e.value),l(),y(e.value)}}function vt(t,m){if(t&1&&(i(0,"div",40)(1,"div",25),c(2,"p-radiobutton",44),i(3,"label",43),r(4),n()()()),t&2){let e=m.$implicit;l(2),p("value",e.key)("inputId",e.key.toString()),l(),p("for",e.key),l(),y(e.value)}}function _t(t,m){if(t&1&&(i(0,"div",40)(1,"div",25),c(2,"p-radiobutton",45),i(3,"label",43),r(4),n()()()),t&2){let e=m.$implicit;l(2),p("value",e.key)("inputId",e.value),l(),p("for",e.value),l(),y(e.value)}}function bt(t,m){if(t&1&&(i(0,"p-scrollpanel",null,2)(2,"p-tabs",7)(3,"p-tablist"),N(4,ft,2,2,"p-tab",8,T),n(),i(6,"p-tabpanels")(7,"p-tabpanel",9)(8,"div",10)(9,"h3",11),r(10,"Accounting Numbering"),n(),i(11,"div",12)(12,"div",13)(13,"div",14)(14,"div",13)(15,"div",15)(16,"label",16),r(17,"Digit"),n(),c(18,"p-inputnumber",17),n()(),i(19,"div",13)(20,"div",15)(21,"label",18),r(22,"Seed"),n(),c(23,"p-inputnumber",19),n()(),i(24,"div",13)(25,"div",15)(26,"label",20),r(27,"Last Number"),n(),c(28,"p-inputnumber",21),n()(),i(29,"div",13)(30,"div",15)(31,"label",22),r(32,"Format"),n(),c(33,"p-select",23),n()(),i(34,"div",13)(35,"div",15)(36,"label",22),r(37,"Reset Every"),n(),i(38,"div",24),N(39,gt,4,4,"div",25,T),n()()()()()()()(),i(41,"p-tabpanel",8)(42,"div",26)(43,"div",27)(44,"h3",11),r(45,"Journal Generate"),n(),i(46,"p"),r(47,"Configure generate transaction"),n()(),i(48,"div",12)(49,"div",28)(50,"div",12)(51,"div",29)(52,"div",15)(53,"label",22),r(54,"Outlet Delivery Journal"),n(),c(55,"p-toggleswitch",30),n()(),i(56,"div",31)(57,"div",15)(58,"label",22),r(59,"Payment Discount Journal On Payment"),n(),c(60,"p-toggleswitch",32),n()()()()()(),c(61,"hr"),i(62,"div",26)(63,"div",28)(64,"div",12)(65,"div",33)(66,"label",22),r(67,"Note"),n()(),i(68,"div",29)(69,"div",15)(70,"label",22),r(71,"Note Required On Journal"),n(),c(72,"p-toggleswitch",34),n()(),i(73,"div",29)(74,"div",15)(75,"label",22),r(76,"Trial Balance Footer Visible"),n(),c(77,"p-toggleswitch",35),n()(),c(78,"div",29),n()()()(),i(79,"p-tabpanel",36)(80,"div",10)(81,"h3",11),r(82,"Report"),n(),i(83,"div",12)(84,"div",27)(85,"div",37)(86,"div")(87,"label",38),r(88,"Accounting For Treatment"),n(),i(89,"div",12)(90,"div",39)(91,"div",12),N(92,vt,5,4,"div",40,T),n()()()(),i(94,"div")(95,"label",41),r(96,"Configure Report Access Control in COA"),n(),i(97,"div",12)(98,"div",39)(99,"div",12),N(100,_t,5,4,"div",40,T),n()()()()()()()()()()()()),t&2){let e,o,a,d,x=u();fe(w(8,st)),l(2),p("value",0)("formGroup",x.form),l(2),M(x.tabs()),l(3),p("value",0),l(26),p("options",(e=x.accountingIntegration())==null||e.options==null?null:e.options.monthlyResetPeriodFormat),l(6),M((o=x.accountingIntegration())==null||o.options==null?null:o.options.resetPeriods),l(2),p("value",1),l(38),p("value",2),l(13),M((a=x.accountingIntegration())==null||a.options==null?null:a.options.generatePrepaidJournal),l(8),M((d=x.accountingIntegration())==null||d.options==null?null:d.options.entityAccess)}}var it=(()=>{class t{constructor(){this.accountingSetupService=s(b),this.fb=s(V).nonNullable,this.tabs=z(["Numbering","Journal","Report"]),this.accountingIntegration=z(null)}ngOnInit(){this.initializeForm(),this.loadAccountingConfiguration()}initializeForm(){this.form=this.fb.group({number:this.createNumberGroup(),report:this.createReportGroup(),journalGenerate:this.createJournalGenerateGroup()})}createNumberGroup(){return this.fb.group({seed:this.fb.control(""),digit:this.fb.control(""),resetEvery:this.fb.control(""),monthlyFormat:this.fb.control(""),lastNumber:this.fb.control(""),lastModified:this.fb.control("")})}createReportGroup(){return this.fb.group({accountingAuditType:this.fb.control(""),accountingEntityAccess:this.fb.control(""),generatePrepaidJournal:this.fb.control("")})}createJournalGenerateGroup(){return this.fb.group({eodExpenseJournal:this.fb.control(""),transferOrder:this.fb.control(""),paymentDiscount:this.fb.control(""),noteMandatory:this.fb.control(""),trialBalanceFooterVisible:this.fb.control("")})}loadAccountingConfiguration(){this.accountingSetupService.fetchLoaderConfiguration().pipe(D(e=>{this.accountingIntegration.set(e),this.form.patchValue(e.form)})).subscribe()}updateAccountingIntegration(){let e={form:this.form.getRawValue()};this.accountingSetupService.updateAccountingIntegrationConfiguration(e).pipe().subscribe()}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=S({type:t,selectors:[["app-accounting-integration"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["scrollPanelContainer",""],["pageTitle","Accounting Integration"],[1,"d-flex","gap-2"],["routerLink","..",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"click"],[1,"border-top",3,"value","formGroup"],[3,"value"],["formGroupName","number",3,"value"],[1,""],[1,"fs-5"],[1,"row"],[1,"col-6"],[1,"row","row-gap-3"],[1,"d-flex","flex-column"],["for","digit",1,"fs-4"],["inputId","digit","formControlName","digit"],["for","seed",1,"fs-4"],["inputId","seed","formControlName","seed"],["for","lastNumber",1,"fs-4"],["inputId","lastNumber","formControlName","lastNumber"],["for","",1,"fs-4"],["appendTo","body","formControlName","monthlyFormat","optionValue","key","optionLabel","value",3,"options"],[1,"d-flex","gap-4"],[1,"d-flex","align-items-center","gap-2"],["formGroupName","journalGenerate",1,"row"],[1,"col-12"],[1,"col-10"],[1,"col-md-4","mb-3"],["formControlName","transferOrder"],[1,"col-md-6","mb-4"],["formControlName","paymentDiscount"],[1,"col-12","mb-2"],["formControlName","noteMandatory"],["formControlName","trialBalanceFooterVisible"],["formGroupName","report",3,"value"],[1,"d-flex","flex-column","gap-4"],["for","generatePrepaidJournal",1,"fs-4","mb-2"],[1,"col-8"],[1,"col-4"],["for","accountingEntityAccess",1,"fs-4","mb-2"],["name","resetEvery","formControlName","resetEvery",3,"value","inputId"],[1,"m-0",3,"for"],["name","generatePrepaidJournal","formControlName","generatePrepaidJournal",3,"value","inputId"],["name","accountingEntityAccess","formControlName","accountingEntityAccess",3,"value","inputId"]],template:function(o,a){o&1&&(i(0,"app-main-panel",3),g(1,dt,4,0,"ng-template",null,0,f)(3,bt,102,9,"ng-template",null,1,f),n())},dependencies:[F,tt,et,Ze,Ye,Qe,Xe,I,X,Oe,Be,k,A,P,B,O,q,E,Pe,Ge,je,Je,ye,Se,j,J,we,De,Q,K],styles:["[_nghost-%COMP%]{display:block}.inactive-state[_ngcontent-%COMP%]{background-color:#e5e5e5}.active-state[_ngcontent-%COMP%]{background-color:var(--p-primary-color)}"],changeDetection:0})}}return t})();var xt=()=>[],ot=()=>({});function St(t,m){if(t&1){let e=C();i(0,"div")(1,"p-button",6),h("onClick",function(){v(e);let a=u();return _(a.submitForm())}),n()()}}function yt(t,m){t&1&&(i(0,"div",12)(1,"h3",13),r(2,"Date"),n(),c(3,"p-datePicker",14),n())}function Ft(t,m){t&1&&(i(0,"tr")(1,"th",20),r(2,"Account Name"),n(),i(3,"th",21),r(4,"Debit"),n(),i(5,"th",21),r(6,"Credit"),n()())}function At(t,m){if(t&1&&(i(0,"tr",10)(1,"td",20),r(2),n(),i(3,"td"),c(4,"input",22),n(),i(5,"td"),c(6,"input",23),n()()),t&2){let e,o=m.$implicit,a=m.rowIndex,d=u(4);p("formGroupName",a),l(2),ie(" ",(e=d.asFormGroup(o).get("accountName"))==null?null:e.value," "),l(2),p("autoNumeric",w(4,ot)),l(2),p("autoNumeric",w(5,ot))}}function Et(t,m){if(t&1&&(i(0,"div",10)(1,"h4",15),r(2),n(),i(3,"div",16)(4,"p-table",17),g(5,Ft,7,0,"ng-template",18)(6,At,7,6,"ng-template",19),n()()()),t&2){let e=m.$implicit,o=m.$index,a=u(3);p("formGroupName",o),l(2),ie(" ",e.get("name").value," "),l(2),p("value",a.getItemsArray(a.asFormGroup(e)).controls)}}function It(t,m){if(t&1&&(i(0,"tr")(1,"td")(2,"p",24),r(3,"Total"),n()(),i(4,"td",25)(5,"p",24),r(6),re(7,"number"),n()(),i(8,"td",25)(9,"p",24),r(10),re(11,"number"),n()()()),t&2){let e=u(3);l(6),y(ae(7,2,e.subtotalDebit)),l(4),y(ae(11,4,e.subtotalCredit))}}function Tt(t,m){if(t&1&&(i(0,"p-panel",8),g(1,yt,4,0,"ng-template",null,2,f),c(3,"p-divider"),i(4,"p-scroll-panel")(5,"div",9),N(6,Et,7,3,"div",10,T),n()(),i(8,"p-table",11),g(9,It,12,6,"ng-template",null,3,f),n()()),t&2){let e=u(2);p("formGroup",e.formGroups),l(6),M(e.formsArray.controls),l(2),p("value",w(2,xt))}}function Nt(t,m){if(t&1&&g(0,Tt,11,3,"p-panel",7),t&2){let e=u();p("ngIf",e.formGroups)}}var at=(()=>{class t{constructor(){this.destroy$=new pe,this.subtotalDebit=0,this.subtotalCredit=0,this.fb=s(V),this.accSetupService=s(b),this.dayjsService=s(Le),this.date=new Date,this.routes=s(xe)}ngOnInit(){this.initializeForm(),this.loadFormData(),this.calculateSubtotalDebit(),this.formGroups.get("forms").valueChanges.pipe(ue(300),se(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 o=e.map(a=>this.createItemGroup(a));return this.fb.array(o)}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(ce(e=>e.data),Re("response"),D(e=>{for(;this.formsArray.length>0;)this.formsArray.removeAt(0);e.form.filter(a=>a.items&&a.items.length>0).forEach(a=>{this.formsArray.push(this.createFormGroup(a))})})).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(o=>{let a=this.getItemsArray(o),d=a.controls.reduce((Z,ee)=>{let te=ee.get("debitAmount").value||0;return Z+te},0),x=a.controls.reduce((Z,ee)=>{let te=ee.get("creditAmount").value||0;return Z+te},0);this.subtotalDebit+=d,this.subtotalCredit+=x})}submitForm(){let e=Object.entries(this.formGroups.getRawValue()).reduce((o,[a,d])=>(a==="date"?o[a]=d instanceof Date?this.dayjsService.format(d):d:a==="forms"?o.form=d:o[a]=d,o),{});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(o){return new(o||t)}}static{this.\u0275cmp=S({type:t,selectors:[["app-acc-opening-balance-form"]],features:[U([R])],decls:6,vars:1,consts:[["actionButton",""],["content",""],["header",""],["footer",""],["pageTitle","Opening Balance Form",3,"scrollable"],["preventOpenDuplicates",""],["label","Submit",3,"onClick"],[3,"formGroup",4,"ngIf"],[3,"formGroup"],["formArrayName","forms",1,"d-flex","flex-column","row-gap-4"],[3,"formGroupName"],[3,"value"],[1,"d-flex","flex-column","gap-2","mx-2"],[1,"fs-5","m-0"],["formControlName","date"],[1,"fs-4"],["formArrayName","items"],["dataKey","id",3,"value"],["pTemplate","header"],["pTemplate","body"],[1,"fs-3"],[1,"fs-3",2,"width","200px"],["formControlName","debitAmount",1,"fs-3","form-control",3,"autoNumeric"],["formControlName","creditAmount",1,"fs-3","form-control",3,"autoNumeric"],[1,"fw-semibold","fs-4"],[1,"text-end",2,"width","200px"]],template:function(o,a){o&1&&(i(0,"app-main-panel",4),g(1,St,2,0,"ng-template",null,0,f)(3,Nt,1,1,"ng-template",null,1,f),n(),c(5,"p-toast",5)),o&2&&p("scrollable",!0)},dependencies:[I,X,Te,F,Ce,he,Me,Ne,ke,Ve,Q,K,W,G,A,P,E,qe,j,J,$,L,$e,k,B,O,q,Ie,Ke,He],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var lt=t=>({"ng-invalid ng-dirty":t});function Dt(t,m){if(t&1){let e=C();i(0,"p-button",4),h("onClick",function(){v(e);let a=u();return _(a.verifyCredentials())}),r(1,"Verify"),n(),i(2,"p-button",4),h("onClick",function(){v(e);let a=u();return _(a.saveCredentials())}),r(3,"Update"),n()}}function wt(t,m){t&1&&(i(0,"div",12)(1,"h3",13),r(2,"Account"),n(),i(3,"small",14),r(4,"Configure Client ID and Client Secret"),n()())}function Gt(t,m){if(t&1&&(i(0,"div",5)(1,"p-panel"),g(2,wt,5,0,"ng-template",null,2,f),i(4,"div",6)(5,"div",7)(6,"div",8)(7,"label",9),r(8,"Client ID"),n(),c(9,"input",10),n()(),i(10,"div",7)(11,"div",8)(12,"label",9),r(13,"Client Secret"),n(),c(14,"input",11),n()()()()()),t&2){let e=u();l(4),p("formGroup",e.credentialForm),l(5),p("ngClass",oe(3,lt,e.clientIDControl.invalid&&e.clientIDControl.dirty||e.clientIDControl.touched)),l(5),p("ngClass",oe(5,lt,e.clientSecretControl.invalid&&e.clientSecretControl.dirty||e.clientSecretControl.touched))}}var mt=(()=>{class t{constructor(e,o){this.fb=e,this.messageService=o,this.setupService=s(b)}ngOnInit(){this.initForm(),this.setupService.fetchAPICredential().pipe(D(e=>{this.credentialForm.patchValue({clientID:e.clientID||"",clientSecret:e.clientSecret||""})})).subscribe()}initForm(){this.credentialForm=this.fb.group({clientID:["",[le.required]],clientSecret:["",[le.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:o=>{console.log("Verify result:",o),this.messageService.add({severity:"success",summary:"Verified",detail:"Credentials are valid!"})},error:o=>{console.error("Verify failed:",o),this.messageService.add({severity:"error",summary:"Invalid",detail:"Client ID or Secret is wrong!"})}})}static{this.\u0275fac=function(o){return new(o||t)(ne(V),ne(R))}}static{this.\u0275cmp=S({type:t,selectors:[["app-api-credential"]],features:[U([R])],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(o,a){o&1&&(i(0,"app-main-panel",3),g(1,Dt,4,0,"ng-template",null,0,f)(3,Gt,15,7,"ng-template",null,1,f),n())},dependencies:[F,be,k,G,A,P,B,O,E,H,$,L,I,j,J,We],encapsulation:2})}}return t})();function Pt(t,m){if(t&1){let e=C();i(0,"button",4),h("click",function(){v(e);let a=u();return _(a.onFormatJournal())}),r(1," Format "),n()}}function Bt(t,m){t&1&&(i(0,"div",12)(1,"div",13)(2,"h4",14),r(3,"Journal Configuration"),n(),i(4,"small",15),r(5," Enter your account information to format journal entries "),n()()())}function Ot(t,m){if(t&1){let e=C();i(0,"div",5)(1,"p-panel"),g(2,Bt,6,0,"ng-template",null,2,f),i(4,"div",6)(5,"div",7)(6,"p-floatlabel",8)(7,"input",9),_e("ngModelChange",function(a){v(e);let d=u();return ve(d.subdomain,a)||(d.subdomain=a),_(a)}),n(),i(8,"label",10),r(9,"Subdomain"),n()(),i(10,"small",11),r(11,"Enter your account subdomain (e.g., mycompany.dealpos.net)"),n()()()()()}if(t&2){let e=u();l(7),ge("ngModel",e.subdomain)}}var pt=(()=>{class t{constructor(){this.setupService=s(b),this.subdomain=z(""),this.toastrService=s(Fe)}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(o){return new(o||t)}}static{this.\u0275cmp=S({type:t,selectors:[["app-format-jurnal"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","Format Journal"],[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(o,a){o&1&&(i(0,"app-main-panel",3),g(1,Pt,2,0,"ng-template",null,0,f)(3,Ot,12,1,"ng-template",null,1,f),n())},dependencies:[F,W,G,A,Ee,E,H,I,$,L,Ue,ze],encapsulation:2})}}return t})();var ct=()=>s(b).fetchOpeningBalanceFormConfiguration();var bi=[{path:"",redirectTo:"accounting-integration",pathMatch:"full"},{path:"",children:[{path:"accounting-integration",component:it},{path:"opening-balance-form",component:at,resolve:{data:ct}},{path:"api-crendetial",component:mt},{path:"format-journal",component:pt},{path:"closing-entries",loadComponent:()=>import("./chunk-2LQZ4KWH.js").then(t=>t.ClosingPageComponent)},{path:"closing-entries/create",loadComponent:()=>import("./chunk-HNKJIRE3.js").then(t=>t.ClosingFormComponent)}]}];export{bi as ACCOUNTING_SETUP_ROUTES};
@@ -1 +1 @@
1
- import{a}from"./chunk-YJ2QEIBF.js";import"./chunk-WW5ELKKO.js";import"./chunk-C2GO6SPF.js";import"./chunk-Z45NTTES.js";import"./chunk-4AOHMAEQ.js";import"./chunk-BLQJXMNV.js";import"./chunk-F2X3VGZZ.js";import"./chunk-OKCHQM5Q.js";import"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var o=[{path:"",canActivate:[a],children:[{path:"",loadComponent:()=>import("./chunk-3PPJHQQ4.js").then(t=>t.Dashboard1Component),data:{title:"Dashboard",headerTemplate:"header"}}]}];export{o as DashboardRoutes};
1
+ import{a}from"./chunk-QBFAXFUM.js";import"./chunk-PXCF3E7D.js";import"./chunk-C2GO6SPF.js";import"./chunk-Z45NTTES.js";import"./chunk-CV4R4TBA.js";import"./chunk-BLQJXMNV.js";import"./chunk-F2X3VGZZ.js";import"./chunk-OKCHQM5Q.js";import"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var o=[{path:"",canActivate:[a],children:[{path:"",loadComponent:()=>import("./chunk-ENIW7TNR.js").then(t=>t.Dashboard1Component),data:{title:"Dashboard",headerTemplate:"header"}}]}];export{o as DashboardRoutes};
@@ -1 +1 @@
1
- import{a as n}from"./chunk-WW5ELKKO.js";import"./chunk-C2GO6SPF.js";import{d as e}from"./chunk-Z45NTTES.js";import"./chunk-4AOHMAEQ.js";import"./chunk-BLQJXMNV.js";import"./chunk-F2X3VGZZ.js";import"./chunk-OKCHQM5Q.js";import{ha as o}from"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var r=()=>{let t=o(n),i=o(e);return t.isAuthenticated()&&!t.isTokenExpired()&&t.checkAuthKeysExists()?(i.navigate(["/pages/dashboard"]),!1):!0};var h=[{path:"",canActivate:[r],loadComponent:()=>import("./chunk-EA47GVMD.js").then(t=>t.LoginComponent)},{path:"404",loadComponent:()=>import("./chunk-IDW6F2F3.js").then(t=>t.NotfoundComponent)},{path:"signup",loadComponent:()=>import("./chunk-SLHUSJER.js").then(t=>t.SignupComponent)},{path:"504",loadComponent:()=>import("./chunk-M4Z3FI3C.js").then(t=>t.TimeoutComponent)}];export{h as AuthenticationRoutes};
1
+ import{a as n}from"./chunk-PXCF3E7D.js";import"./chunk-C2GO6SPF.js";import{d as e}from"./chunk-Z45NTTES.js";import"./chunk-CV4R4TBA.js";import"./chunk-BLQJXMNV.js";import"./chunk-F2X3VGZZ.js";import"./chunk-OKCHQM5Q.js";import{ha as o}from"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var r=()=>{let t=o(n),i=o(e);return t.isAuthenticated()&&!t.isTokenExpired()&&t.checkAuthKeysExists()?(i.navigate(["/pages/dashboard"]),!1):!0};var h=[{path:"",canActivate:[r],loadComponent:()=>import("./chunk-6VR5JNBD.js").then(t=>t.LoginComponent)},{path:"404",loadComponent:()=>import("./chunk-IDW6F2F3.js").then(t=>t.NotfoundComponent)},{path:"signup",loadComponent:()=>import("./chunk-SLHUSJER.js").then(t=>t.SignupComponent)},{path:"504",loadComponent:()=>import("./chunk-M4Z3FI3C.js").then(t=>t.TimeoutComponent)}];export{h as AuthenticationRoutes};
@@ -1 +1 @@
1
- import{a as D}from"./chunk-JOLNIJ36.js";import{a as He}from"./chunk-G4XX7EU2.js";import{a as Oe,b as Be}from"./chunk-AACWH3EJ.js";import{a as ze}from"./chunk-YPBGL37O.js";import{b as A}from"./chunk-SNKHWMQW.js";import{a as re}from"./chunk-WW5ELKKO.js";import"./chunk-FLZXCWDU.js";import{a as je}from"./chunk-XKI7WLHE.js";import"./chunk-DHW7UHFT.js";import"./chunk-C2GO6SPF.js";import{a as j,b as z}from"./chunk-O4QM64EH.js";import{d as Ne,i as ke,j as Me,k as Pe}from"./chunk-SVXDMOLP.js";import{a as Ae,b as De}from"./chunk-S6X7PJAB.js";import"./chunk-LWLJZPBI.js";import"./chunk-3NU3P6NL.js";import"./chunk-GDX5XEV3.js";import{a as Fe,b as Je}from"./chunk-DLUALPHU.js";import"./chunk-4DOELXOP.js";import"./chunk-VVUSFS6O.js";import"./chunk-ZTEDQLOG.js";import"./chunk-EDGADVEY.js";import"./chunk-JTDJJORR.js";import"./chunk-LZUGPBFD.js";import"./chunk-2KERKGCG.js";import{g as Ee,h as Ve}from"./chunk-XZQ3IYQ6.js";import{b as Ie,c as Te}from"./chunk-X22YKT5B.js";import{a as Ce,b as be}from"./chunk-JYCUE5HV.js";import{a as v,b as Se,c as we,d as ve,e as ye,f as Re}from"./chunk-JMEBBWX4.js";import"./chunk-FUZFAJGJ.js";import{n as _e,o as ge,w as he,x as xe}from"./chunk-5FSMHZSY.js";import"./chunk-A5HAJEPC.js";import{b as ae,c as le,e as me,f as pe,k as se,l as ce,o as de,u as ue,x as fe}from"./chunk-G5S5AZA7.js";import"./chunk-Z45NTTES.js";import"./chunk-4AOHMAEQ.js";import"./chunk-BLQJXMNV.js";import"./chunk-F2X3VGZZ.js";import{h as Z,j as ee,k as te,n as ie,p as ne,r as oe}from"./chunk-OKCHQM5Q.js";import{Ab as K,Ac as E,Cb as g,Ga as k,Jc as I,Kb as c,Kc as Y,Lc as V,Mc as w,Ub as r,Vb as o,Wb as b,X as N,Yc as T,Z as H,_b as y,bb as U,c as F,cb as L,dc as R,ec as _,gb as m,ha as C,pa as h,qa as x,qc as s,rc as S,s as J,sc as M,uc as W,vc as $,wb as G,wc as P,xc as q,yc as Q,zc as X}from"./chunk-JP6RBSB3.js";import{a as d,b as f}from"./chunk-YQFG5XE2.js";var qe={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,customerID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0}},filter:{number:null,outletName:null,from:null,to:null,customerID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0}},O=Se(Re(qe),we(t=>({first:T(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:T(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:T(()=>t.data().data.some(a=>a.checked)),checkedARCollection:T(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),ye(t=>{let a=C(D),e=C(A);return{updateFilter(n){v(t,i=>f(d({},i),{filter:d(d({},i.filter),n)}))},onRowSelect(n){v(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){v(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){v(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:j(F(N(()=>a.getARJournalLoader().pipe(z({next:n=>{v(t,i=>f(d({},i),{meta:n}))},error:n=>{console.error("Error fetching AR collection loader:",n)}}))))),getARCollection:j(F(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}))})),z({next:i=>{v(t,u=>f(d({},u),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),ve(t=>({onInit:()=>{t.getARLoader(),t.getARCollection(t.filter)}})));var B=t=>({"ng-invalid ng-dirty":t}),Qe=()=>({});function Xe(t,a){if(t&1){let e=y();r(0,"p-button",10),R("onClick",function(){h(e);let n=_(2);return x(n.onCreateJournal())}),o()}}function Ye(t,a){if(t&1&&g(0,Xe,1,0,"p-button",9),t&2){let e=_();c("ngIf",e.store.hasCheckedRows())}}function Ze(t,a){t&1&&(r(0,"tr")(1,"th",12),b(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),s(4,"Outlet"),o(),r(5,"th",14),s(6,"Number"),o(),r(7,"th",15),s(8,"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 et(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,L),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,U),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 tt(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 it(t,a){t&1&&(r(0,"tr")(1,"td",23)(2,"span"),s(3,"No records found."),o()()())}function nt(t,a){if(t&1){let e=y();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,Ze,18,0,"ng-template",null,3,w)(4,et,22,18,"ng-template",null,4,w)(6,tt,1,3,"ng-template",null,5,w)(8,it,4,0,"ng-template",null,6,w),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 ot(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 rt(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 at(t,a){if(t&1&&(r(0,"div"),g(1,rt,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("from"))}}function lt(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 mt(t,a){if(t&1&&(r(0,"div"),g(1,lt,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("to"))}}function pt(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 st(t,a){if(t&1&&(r(0,"div"),g(1,pt,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("pageSize"))}}function ct(t,a){if(t&1){let e=y();r(0,"form",24)(1,"div",25)(2,"label",26),s(3,"Outlet"),o(),r(4,"p-select",27),g(5,ot,3,5,"ng-template",null,7,w),o()(),r(7,"div",25)(8,"label",26),s(9,"From - To"),o(),r(10,"div",28),b(11,"p-datepicker",29),g(12,at,2,1,"div",30),b(13,"p-datepicker",31),g(14,mt,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,st,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(17,B,e.isInvalid("from"))),m(),c("ngIf",e.isInvalid("from")),m(),c("iconDisplay","input")("showIcon",!0)("ngClass",E(19,B,e.isInvalid("to"))),m(),c("ngIf",e.isInvalid("to")),m(4),c("suggestions",Y(19,15,e.customerSuggestions$)),m(5),c("autoNumeric",X(21,Qe))("ngClass",E(22,B,e.isInvalid("pageSize"))),m(),c("ngIf",e.isInvalid("pageSize"))}}var ti=(()=>{class t extends je{constructor(){super(),this.store=C(O),this.generateJournalService=C(D),this.authService=C(re),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=C(ue),this.dayjsService=C(A)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:l,to:n,pageNumber:i,rowCount:u,pageSize:p,export:Ue,exportPageNumber:Le,exportRowCount:Ge,outletName:Ke,customerID:We,paymentState:$e}=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),rowCount:this.fb.control(u),pageSize:this.fb.control(p,[le.required]),export:this.fb.control(Ue),exportPageNumber:this.fb.control(Le),exportRowCount:this.fb.control(Ge),outletName:this.fb.control(Ke),customerID:this.fb.control(We),paymentState:this.fb.control($e)})}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]=He);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(H(()=>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([O]),K],decls:8,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","AR Collection",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 Outlet",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",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(l,n){if(l&1){let i=y();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,Ye,1,1,"ng-template",null,0,w)(3,nt,10,5,"ng-template",null,1,w),s(5," <"),g(6,ct,25,24,"ng-template",null,2,w),o()}l&2&&(c("isSearchableInput",!0)("isFilterable",!0),$("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible),c("scrollable",!0))},dependencies:[Ve,oe,Z,ee,te,ie,ne,Pe,Ne,ke,Me,xe,he,be,Ce,fe,se,ae,me,pe,ce,de,Je,Fe,De,Ae,Be,Oe,ge,_e,Ee,Te,Ie,ze],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{ti as ARJournalComponent};
1
+ import{a as D}from"./chunk-JJ4OPVUC.js";import{a as He}from"./chunk-G4XX7EU2.js";import{a as Oe,b as Be}from"./chunk-AACWH3EJ.js";import{a as ze}from"./chunk-YPBGL37O.js";import{b as A}from"./chunk-INB6OCHW.js";import{a as re}from"./chunk-PXCF3E7D.js";import"./chunk-FLZXCWDU.js";import{a as je}from"./chunk-XKI7WLHE.js";import"./chunk-DHW7UHFT.js";import"./chunk-C2GO6SPF.js";import{a as j,b as z}from"./chunk-O4QM64EH.js";import{d as Ne,i as ke,j as Me,k as Pe}from"./chunk-SVXDMOLP.js";import{a as Ae,b as De}from"./chunk-S6X7PJAB.js";import"./chunk-LWLJZPBI.js";import"./chunk-3NU3P6NL.js";import"./chunk-GDX5XEV3.js";import{a as Fe,b as Je}from"./chunk-DLUALPHU.js";import"./chunk-4DOELXOP.js";import"./chunk-VVUSFS6O.js";import"./chunk-ZTEDQLOG.js";import"./chunk-EDGADVEY.js";import"./chunk-JTDJJORR.js";import"./chunk-LZUGPBFD.js";import"./chunk-2KERKGCG.js";import{g as Ee,h as Ve}from"./chunk-7INXBUUN.js";import{b as Ie,c as Te}from"./chunk-X22YKT5B.js";import{a as Ce,b as be}from"./chunk-JYCUE5HV.js";import{a as v,b as Se,c as we,d as ve,e as ye,f as Re}from"./chunk-JMEBBWX4.js";import"./chunk-FUZFAJGJ.js";import{n as _e,o as ge,w as he,x as xe}from"./chunk-5FSMHZSY.js";import"./chunk-A5HAJEPC.js";import{b as ae,c as le,e as me,f as pe,k as se,l as ce,o as de,u as ue,x as fe}from"./chunk-G5S5AZA7.js";import"./chunk-Z45NTTES.js";import"./chunk-CV4R4TBA.js";import"./chunk-BLQJXMNV.js";import"./chunk-F2X3VGZZ.js";import{h as Z,j as ee,k as te,n as ie,p as ne,r as oe}from"./chunk-OKCHQM5Q.js";import{Ab as K,Ac as E,Cb as g,Ga as k,Jc as I,Kb as c,Kc as Y,Lc as V,Mc as w,Ub as r,Vb as o,Wb as b,X as N,Yc as T,Z as H,_b as y,bb as U,c as F,cb as L,dc as R,ec as _,gb as m,ha as C,pa as h,qa as x,qc as s,rc as S,s as J,sc as M,uc as W,vc as $,wb as G,wc as P,xc as q,yc as Q,zc as X}from"./chunk-JP6RBSB3.js";import{a as d,b as f}from"./chunk-YQFG5XE2.js";var qe={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,customerID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0}},filter:{number:null,outletName:null,from:null,to:null,customerID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0}},O=Se(Re(qe),we(t=>({first:T(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:T(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:T(()=>t.data().data.some(a=>a.checked)),checkedARCollection:T(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),ye(t=>{let a=C(D),e=C(A);return{updateFilter(n){v(t,i=>f(d({},i),{filter:d(d({},i.filter),n)}))},onRowSelect(n){v(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){v(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){v(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:j(F(N(()=>a.getARJournalLoader().pipe(z({next:n=>{v(t,i=>f(d({},i),{meta:n}))},error:n=>{console.error("Error fetching AR collection loader:",n)}}))))),getARCollection:j(F(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}))})),z({next:i=>{v(t,u=>f(d({},u),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),ve(t=>({onInit:()=>{t.getARLoader(),t.getARCollection(t.filter)}})));var B=t=>({"ng-invalid ng-dirty":t}),Qe=()=>({});function Xe(t,a){if(t&1){let e=y();r(0,"p-button",10),R("onClick",function(){h(e);let n=_(2);return x(n.onCreateJournal())}),o()}}function Ye(t,a){if(t&1&&g(0,Xe,1,0,"p-button",9),t&2){let e=_();c("ngIf",e.store.hasCheckedRows())}}function Ze(t,a){t&1&&(r(0,"tr")(1,"th",12),b(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),s(4,"Outlet"),o(),r(5,"th",14),s(6,"Number"),o(),r(7,"th",15),s(8,"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 et(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,L),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,U),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 tt(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 it(t,a){t&1&&(r(0,"tr")(1,"td",23)(2,"span"),s(3,"No records found."),o()()())}function nt(t,a){if(t&1){let e=y();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,Ze,18,0,"ng-template",null,3,w)(4,et,22,18,"ng-template",null,4,w)(6,tt,1,3,"ng-template",null,5,w)(8,it,4,0,"ng-template",null,6,w),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 ot(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 rt(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 at(t,a){if(t&1&&(r(0,"div"),g(1,rt,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("from"))}}function lt(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 mt(t,a){if(t&1&&(r(0,"div"),g(1,lt,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("to"))}}function pt(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 st(t,a){if(t&1&&(r(0,"div"),g(1,pt,3,1,"div",35),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("pageSize"))}}function ct(t,a){if(t&1){let e=y();r(0,"form",24)(1,"div",25)(2,"label",26),s(3,"Outlet"),o(),r(4,"p-select",27),g(5,ot,3,5,"ng-template",null,7,w),o()(),r(7,"div",25)(8,"label",26),s(9,"From - To"),o(),r(10,"div",28),b(11,"p-datepicker",29),g(12,at,2,1,"div",30),b(13,"p-datepicker",31),g(14,mt,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,st,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(17,B,e.isInvalid("from"))),m(),c("ngIf",e.isInvalid("from")),m(),c("iconDisplay","input")("showIcon",!0)("ngClass",E(19,B,e.isInvalid("to"))),m(),c("ngIf",e.isInvalid("to")),m(4),c("suggestions",Y(19,15,e.customerSuggestions$)),m(5),c("autoNumeric",X(21,Qe))("ngClass",E(22,B,e.isInvalid("pageSize"))),m(),c("ngIf",e.isInvalid("pageSize"))}}var ti=(()=>{class t extends je{constructor(){super(),this.store=C(O),this.generateJournalService=C(D),this.authService=C(re),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=C(ue),this.dayjsService=C(A)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:l,to:n,pageNumber:i,rowCount:u,pageSize:p,export:Ue,exportPageNumber:Le,exportRowCount:Ge,outletName:Ke,customerID:We,paymentState:$e}=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),rowCount:this.fb.control(u),pageSize:this.fb.control(p,[le.required]),export:this.fb.control(Ue),exportPageNumber:this.fb.control(Le),exportRowCount:this.fb.control(Ge),outletName:this.fb.control(Ke),customerID:this.fb.control(We),paymentState:this.fb.control($e)})}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]=He);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(H(()=>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([O]),K],decls:8,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","AR Collection",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 Outlet",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",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(l,n){if(l&1){let i=y();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,Ye,1,1,"ng-template",null,0,w)(3,nt,10,5,"ng-template",null,1,w),s(5," <"),g(6,ct,25,24,"ng-template",null,2,w),o()}l&2&&(c("isSearchableInput",!0)("isFilterable",!0),$("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible),c("scrollable",!0))},dependencies:[Ve,oe,Z,ee,te,ie,ne,Pe,Ne,ke,Me,xe,he,be,Ce,fe,se,ae,me,pe,ce,de,Je,Fe,De,Ae,Be,Oe,ge,_e,Ee,Te,Ie,ze],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{ti as ARJournalComponent};