dealposbooks 5.32.2 → 5.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/assets/scss/layouts/_sidebar.scss +1 -1
  2. package/assets/scss/style.scss +52 -6
  3. package/{chunk-ZM5TVQUU.js → chunk-6ATDYFCA.js} +1 -1
  4. package/chunk-6VZGWVBI.js +1 -0
  5. package/{chunk-CR2R5F5T.js → chunk-76K2CYGK.js} +1 -1
  6. package/{chunk-VJBDOS6M.js → chunk-7Q7GUZQB.js} +1 -1
  7. package/chunk-AWXT2WGR.js +180 -0
  8. package/{chunk-V5OZ47U6.js → chunk-BPAXVUBR.js} +1 -1
  9. package/{chunk-VVGZUJP6.js → chunk-BU5IXVPY.js} +1 -1
  10. package/{chunk-ICOTZOJJ.js → chunk-CM2QLSCG.js} +5 -5
  11. package/{chunk-QTALSVSB.js → chunk-FFGCE3TK.js} +1 -1
  12. package/{chunk-BJ7FEOET.js → chunk-GQWMJTTS.js} +1 -1
  13. package/{chunk-GK2S4TYF.js → chunk-H4PZGISP.js} +1 -1
  14. package/{chunk-CJ6UGNBN.js → chunk-JB4UBWDT.js} +1 -1
  15. package/{chunk-UVXRATHG.js → chunk-JL2CN3ZY.js} +1 -1
  16. package/{chunk-OQ52MPGS.js → chunk-KBT2GX7L.js} +1 -1
  17. package/{chunk-ALYAGR32.js → chunk-KINBDQRV.js} +1 -1
  18. package/{chunk-Y5FQDBGQ.js → chunk-LMNTEWLI.js} +1 -1
  19. package/{chunk-W4GXLPRM.js → chunk-MNFWDRDS.js} +1 -1
  20. package/{chunk-ERFXO32T.js → chunk-MPFBVM6S.js} +1 -1
  21. package/{chunk-MEXKKLEE.js → chunk-MZGANYF3.js} +1 -1
  22. package/{chunk-NCY25JG4.js → chunk-OD62LD7H.js} +4 -4
  23. package/{chunk-FSEW3LUP.js → chunk-OFLZMVEN.js} +1 -1
  24. package/{chunk-FP5LIX5S.js → chunk-P37DL4A6.js} +1 -1
  25. package/{chunk-MDH73MG3.js → chunk-P7Z64VPC.js} +1 -1
  26. package/{chunk-5OYK64TO.js → chunk-PBN5IYNX.js} +1 -1
  27. package/{chunk-SZ3LQIKH.js → chunk-PDFK6YU3.js} +1 -1
  28. package/{chunk-SASCD5HU.js → chunk-PI5RBOCG.js} +1 -1
  29. package/{chunk-CMRVHYI7.js → chunk-QAQ2CXF3.js} +2 -2
  30. package/chunk-QVKOUG4C.js +7 -0
  31. package/{chunk-RQ4G322O.js → chunk-R2SYW2WU.js} +1 -1
  32. package/{chunk-7I5R2CUM.js → chunk-SMXZZ5T3.js} +1 -1
  33. package/{chunk-ZSVULSVG.js → chunk-TB3PSBKG.js} +1 -1
  34. package/{chunk-B4HCPA6E.js → chunk-TBT7EWUJ.js} +1 -1
  35. package/{chunk-6UIJBWT6.js → chunk-UP43K7DD.js} +1 -1
  36. package/{chunk-ZA5U4RYI.js → chunk-UPYOERLM.js} +1 -1
  37. package/chunk-V3F7SFWL.js +1 -0
  38. package/{chunk-2QWFLAG5.js → chunk-VLC4IRPH.js} +1 -1
  39. package/{chunk-JZU6YAPX.js → chunk-W5IDHDT2.js} +1 -1
  40. package/{chunk-HKQCPLSX.js → chunk-WBPKGJTU.js} +1 -1
  41. package/{chunk-4EUKDALJ.js → chunk-WJNROQNY.js} +1 -1
  42. package/{chunk-CACGTOSZ.js → chunk-ZXCNQW44.js} +1 -1
  43. package/index.html +2 -2
  44. package/main-RFYAOUOX.js +1 -0
  45. package/package.json +1 -1
  46. package/{styles-TTHIY3OR.css → styles-ERZ5377A.css} +1 -1
  47. package/chunk-B7A5CWPE.js +0 -1
  48. package/chunk-UYC454VQ.js +0 -180
  49. package/chunk-YBZSBC7H.js +0 -7
  50. package/chunk-YGEMHXDD.js +0 -1
  51. package/main-RAHFUIZB.js +0 -1
@@ -1 +1 @@
1
- import{a as A}from"./chunk-EXGI2AG7.js";import{a as He}from"./chunk-MDH73MG3.js";import{b as ze}from"./chunk-ERFXO32T.js";import"./chunk-ZM5TVQUU.js";import{a as re}from"./chunk-AGLKA7OG.js";import{a as Pe}from"./chunk-XKI7WLHE.js";import"./chunk-C2GO6SPF.js";import{a as P,b as z}from"./chunk-O4QM64EH.js";import{d as ke,i as Ne,j as Re,k as Me}from"./chunk-EW3R2HAB.js";import{a as Fe,b as Ve}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import"./chunk-PKN47FQE.js";import{a as Je,b as De}from"./chunk-LRRVQSMI.js";import"./chunk-42UIGXWH.js";import"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{g as Ie,h as Ae}from"./chunk-UYC454VQ.js";import{b as Ee,c as Te}from"./chunk-C7LM5UCK.js";import{a as be,b as Ce}from"./chunk-J4XRJAME.js";import{a as v,b as Se,c as we,d as ve,e as ye,f as je}from"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{n as _e,o as ge,w as he,x as xe}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{b as ae,c as le,e as me,f as pe,k as se,l as de,o as ue,v as ce,y as fe}from"./chunk-FMVCTBCQ.js";import"./chunk-ZGXJEG37.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{c as Z,e as ee,f as te,k as ie,l as ne,m as oe}from"./chunk-B63BKC6F.js";import{Ab as W,Ac as T,Cb as g,Ga as D,Jc as I,Kb as d,Kc as Y,Lc as M,Mc as S,Nb as K,Ub as a,Vb as r,Wb as b,X as J,Yc as y,Z as B,_b as j,bb as G,c as F,cb as U,dc as E,ec as f,gb as m,ha as w,pa as h,qa as x,qc as p,rc as C,s as V,sc as k,uc as q,vc as Q,wb as L,wc as N,xc as $,yc as X,zc as R}from"./chunk-JP6RBSB3.js";import{a as s,b as c}from"./chunk-YQFG5XE2.js";var Ue={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,from:null,to:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,outletName:""}},filter:{number:null,from:null,to:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,outletName:""}},H=Se(je(Ue),we(t=>({first:y(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:y(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:y(()=>t.data().data.some(l=>l.checked)),checkedAdjustment:y(()=>t.data().data.filter(l=>l.checked).map(l=>l.id))})),ye(t=>{let l=w(A);return{updateFilter(n){v(t,i=>c(s({},i),{filter:s(s({},i.filter),n)}))},onRowSelect(n){v(t,i=>{let o=i.data.data.map(u=>u.id===n.id?c(s({},u),{checked:!0}):u);return c(s({},i),{data:c(s({},i.data),{data:o})})})},onRowUnselect(n){v(t,i=>{let o=i.data.data.map(u=>u.id===n.id?c(s({},u),{checked:!1}):u);return c(s({},i),{data:c(s({},i.data),{data:o})})})},onHeaderCheckboxToggle(n){v(t,i=>{let o=i.data.data.map(u=>c(s({},u),{checked:n}));return c(s({},i),{data:c(s({},i.data),{data:o})})})},getGJAdjustmentLoader:P(F(J(()=>l.getGJAdjustmentLoader().pipe(z({next:n=>{v(t,i=>c(s({},i),{meta:n}))},error:n=>{console.error("Error fetching adjustment loader:",n)}}))))),getAdjustmentJournal:P(F(V(n=>Object.entries(n).reduce((i,[o,u])=>(u!=null&&(i[o]=u),i),{})),J(n=>l.getAdjustmentJournal(n).pipe(V(i=>c(s({},i),{data:i.data.map(o=>c(s({},o),{checked:!1}))})),z({next:i=>{v(t,o=>c(s({},o),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),ve(t=>({onInit:()=>{t.getGJAdjustmentLoader(),t.getAdjustmentJournal(t.filter)}})));var Le=()=>({height:"calc(100vh - 70px)"}),O=t=>({"ng-invalid ng-dirty":t}),We=()=>({});function Ke(t,l){if(t&1){let e=j();a(0,"p-button",10),E("onClick",function(){h(e);let i=f(2);return x(i.generateAdjusmentJournal())}),r()}}function qe(t,l){if(t&1&&g(0,Ke,1,0,"p-button",9),t&2){let e=f();d("ngIf",e.store.hasCheckedRows())}}function Qe(t,l){t&1&&(a(0,"tr")(1,"th",12),b(2,"p-tableHeaderCheckbox"),r(),a(3,"th",13),p(4,"Outlet"),r(),a(5,"th",14),p(6,"Number"),r(),a(7,"th",15),p(8,"Date"),r(),a(9,"th",14),p(10,"Adjustment Qty"),r(),a(11,"th",13),p(12,"Type"),r(),a(13,"th",16),p(14,"State"),r(),a(15,"th",17),p(16,"Note"),r(),b(17,"th",12),r())}function $e(t,l){if(t&1&&(a(0,"tr")(1,"td"),b(2,"p-tableCheckbox",18),r(),a(3,"td"),p(4),r(),a(5,"td")(6,"a",19),p(7),r()(),a(8,"td"),p(9),I(10,"date"),r(),a(11,"td"),p(12),I(13,"number"),r(),a(14,"td"),p(15),r(),a(16,"td"),p(17),r(),a(18,"td"),b(19,"div",20),r(),a(20,"td"),b(21,"p-button",21),r()()),t&2){let e=l.$implicit,n=f(2);m(2),d("value",e),m(2),C(e.outlet),m(2),d("href",n.authService.getTenantExternalURL()+"/menu/Adjustment/Adjustment/Archive/Info?ID="+e.id,U),m(),k(" ",e.number," "),m(2),C(M(10,12,e.date,"d MMM y")),m(3),C(Y(13,15,e.quantitySUM)),m(3),C(e.type),m(2),C(e.state),m(2),d("innerHTML",e.note,G),m(2),d("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function Xe(t,l){if(t&1&&p(0),t&2){let e=f(2);q(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Ye(t,l){t&1&&(a(0,"tr")(1,"td",22)(2,"span"),p(3,"No records found."),r()()())}function Ze(t,l){if(t&1){let e=j();a(0,"p-panel")(1,"p-table",11),E("onRowSelect",function(i){h(e);let o=f();return x(o.onRowSelect(i))})("onRowUnselect",function(i){h(e);let o=f();return x(o.onRowUnselect(i))})("onHeaderCheckboxToggle",function(i){h(e);let o=f();return x(o.onHeaderCheckboxToggle(i))})("onPage",function(i){h(e);let o=f();return x(o.onPageChange(i))}),g(2,Qe,18,0,"ng-template",null,3,S)(4,$e,22,17,"ng-template",null,4,S)(6,Xe,1,3,"ng-template",null,5,S)(8,Ye,4,0,"ng-template",null,6,S),r()()}if(t&2){let e=f();K(R(9,Le)),m(),d("value",e.store.data().data)("scrollable",!0)("scrollHeight","calc(100vh - 142px)")("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function et(t,l){if(t&1&&(a(0,"span",31),p(1),I(2,"truncate"),r()),t&2){let e=l.$implicit;d("pTooltip",e.name),m(),k(" ",M(2,2,e.name,30)," ")}}function tt(t,l){if(t&1&&(a(0,"div")(1,"span",33),p(2),r()()),t&2){let e=l.$implicit;m(2),C(e)}}function it(t,l){if(t&1&&(a(0,"div"),g(1,tt,3,1,"div",32),r()),t&2){let e=f(2);m(),d("ngForOf",e.getErrors("from"))}}function nt(t,l){if(t&1&&(a(0,"div")(1,"span",33),p(2),r()()),t&2){let e=l.$implicit;m(2),C(e)}}function ot(t,l){if(t&1&&(a(0,"div"),g(1,nt,3,1,"div",32),r()),t&2){let e=f(2);m(),d("ngForOf",e.getErrors("to"))}}function rt(t,l){if(t&1&&(a(0,"div")(1,"span",33),p(2),r()()),t&2){let e=l.$implicit;m(2),C(e)}}function at(t,l){if(t&1&&(a(0,"div"),g(1,rt,3,1,"div",32),r()),t&2){let e=f(2);m(),d("ngForOf",e.getErrors("pageSize"))}}function lt(t,l){if(t&1&&(a(0,"form",23)(1,"div",24)(2,"label",25),p(3,"Outlet"),r(),a(4,"p-select",26),g(5,et,3,5,"ng-template",null,7,S),r()(),a(7,"div",24)(8,"label",25),p(9,"From"),r(),b(10,"p-datepicker",27),g(11,it,2,1,"div",28),r(),a(12,"div",24)(13,"label",25),p(14,"To"),r(),b(15,"p-datepicker",29),g(16,ot,2,1,"div",28),r(),a(17,"div",24)(18,"label",25),p(19,"Page Size"),r(),b(20,"input",30),g(21,at,2,1,"div",28),r()()),t&2){let e=f();d("formGroup",e.form),m(4),d("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),m(6),d("iconDisplay","input")("showIcon",!0)("ngClass",T(14,O,e.isInvalid("from"))),m(),d("ngIf",e.isInvalid("from")),m(4),d("iconDisplay","input")("showIcon",!0)("ngClass",T(16,O,e.isInvalid("to"))),m(),d("ngIf",e.isInvalid("to")),m(4),d("autoNumeric",R(18,We))("ngClass",T(19,O,e.isInvalid("pageSize"))),m(),d("ngIf",e.isInvalid("pageSize"))}}var Kt=(()=>{class t extends Pe{constructor(){super(),this.store=w(H),this.generateJournalService=w(A),this.authService=w(re),this.isDialogFilterVisible=D(!1),this.isInitDialogFilterVisible=D(!1),this.fb=w(ce),this.dayjsService=w(ze)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:n,to:i,pageNumber:o,rowCount:u,pageSize:_,export:Oe,exportPageNumber:Be,exportRowCount:Ge}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),outletName:this.fb.control(""),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),pageNumber:this.fb.control(o),rowCount:this.fb.control(u),pageSize:this.fb.control(_,[le.required]),export:this.fb.control(Oe),exportPageNumber:this.fb.control(Be),exportRowCount:this.fb.control(Ge)})}onSearch(e){this.store.updateFilter(c(s({},this.store.filter()),{number:e,pageNumber:1}))}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((n,[i,o])=>{switch(i){case"from":typeof o=="object"?n[i]=this.dayjsService.from(o)?this.dayjsService.format(o):null:n[i]=o!=null?String(o):null;break;case"to":typeof o=="object"?n[i]=this.dayjsService.from(o)?this.dayjsService.format(o):null:n[i]=o!=null?String(o):null;break;default:n[i]=o===null?"":o;break}return n},{});this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(n=>{this.store.onRowUnselect(n)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onPageChange(e){let n=e.first/e.rows;this.store.updateFilter(c(s({},this.store.filter()),{pageNumber:n+1}))}generateAdjusmentJournal(){this.generateJournalService.createAdjustmentJournal(this.store.checkedAdjustment()).pipe(B(()=>this.store.getAdjustmentJournal(this.store.filter))).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=L({type:t,selectors:[["app-adjustment-journal"]],features:[X([H]),W],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Adjustment",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","onPage","value","scrollable","scrollHeight","paginator","rows","totalRecords","lazy"],[2,"width","4rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","11rem"],[2,"width","9rem"],[2,"width","14rem"],[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"],["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"],["type","text","pInputText","","formControlName","pageSize",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(n,i){if(n&1){let o=j();a(0,"app-main-panel",8),$("isDialogFilterVisibleChange",function(_){return h(o),N(i.isDialogFilterVisible,_)||(i.isDialogFilterVisible=_),x(_)})("isInitDialogFilterVisibleChange",function(_){return h(o),N(i.isInitDialogFilterVisible,_)||(i.isInitDialogFilterVisible=_),x(_)}),E("filterConfirmed",function(){return h(o),x(i.onFilterOKEvent())})("search",function(_){return h(o),x(i.onSearch(_))}),g(1,qe,1,1,"ng-template",null,0,S)(3,Ze,10,10,"ng-template",null,1,S)(5,lt,22,21,"ng-template",null,2,S),r()}n&2&&(d("isSearchableInput",!0)("isFilterable",!0),Q("isDialogFilterVisible",i.isDialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible))},dependencies:[Ae,Me,ke,Ne,Re,oe,Z,ee,te,ne,ie,Ce,be,xe,he,Ve,Fe,De,Je,fe,se,ae,me,pe,de,ue,ge,_e,Ie,Te,Ee,He],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{Kt as AdjustmentJournalComponent};
1
+ import{a as A}from"./chunk-EXGI2AG7.js";import{a as He}from"./chunk-P7Z64VPC.js";import{b as ze}from"./chunk-MPFBVM6S.js";import"./chunk-6ATDYFCA.js";import{a as re}from"./chunk-AGLKA7OG.js";import{a as Pe}from"./chunk-XKI7WLHE.js";import"./chunk-C2GO6SPF.js";import{a as P,b as z}from"./chunk-O4QM64EH.js";import{d as ke,i as Ne,j as Re,k as Me}from"./chunk-EW3R2HAB.js";import{a as Fe,b as Ve}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import"./chunk-PKN47FQE.js";import{a as Je,b as De}from"./chunk-LRRVQSMI.js";import"./chunk-42UIGXWH.js";import"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{g as Ie,h as Ae}from"./chunk-AWXT2WGR.js";import{b as Ee,c as Te}from"./chunk-C7LM5UCK.js";import{a as be,b as Ce}from"./chunk-J4XRJAME.js";import{a as v,b as Se,c as we,d as ve,e as ye,f as je}from"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{n as _e,o as ge,w as he,x as xe}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{b as ae,c as le,e as me,f as pe,k as se,l as de,o as ue,v as ce,y as fe}from"./chunk-FMVCTBCQ.js";import"./chunk-ZGXJEG37.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{c as Z,e as ee,f as te,k as ie,l as ne,m as oe}from"./chunk-B63BKC6F.js";import{Ab as W,Ac as T,Cb as g,Ga as D,Jc as I,Kb as d,Kc as Y,Lc as M,Mc as S,Nb as K,Ub as a,Vb as r,Wb as b,X as J,Yc as y,Z as B,_b as j,bb as G,c as F,cb as U,dc as E,ec as f,gb as m,ha as w,pa as h,qa as x,qc as p,rc as C,s as V,sc as k,uc as q,vc as Q,wb as L,wc as N,xc as $,yc as X,zc as R}from"./chunk-JP6RBSB3.js";import{a as s,b as c}from"./chunk-YQFG5XE2.js";var Ue={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,from:null,to:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,outletName:""}},filter:{number:null,from:null,to:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,outletName:""}},H=Se(je(Ue),we(t=>({first:y(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:y(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:y(()=>t.data().data.some(l=>l.checked)),checkedAdjustment:y(()=>t.data().data.filter(l=>l.checked).map(l=>l.id))})),ye(t=>{let l=w(A);return{updateFilter(n){v(t,i=>c(s({},i),{filter:s(s({},i.filter),n)}))},onRowSelect(n){v(t,i=>{let o=i.data.data.map(u=>u.id===n.id?c(s({},u),{checked:!0}):u);return c(s({},i),{data:c(s({},i.data),{data:o})})})},onRowUnselect(n){v(t,i=>{let o=i.data.data.map(u=>u.id===n.id?c(s({},u),{checked:!1}):u);return c(s({},i),{data:c(s({},i.data),{data:o})})})},onHeaderCheckboxToggle(n){v(t,i=>{let o=i.data.data.map(u=>c(s({},u),{checked:n}));return c(s({},i),{data:c(s({},i.data),{data:o})})})},getGJAdjustmentLoader:P(F(J(()=>l.getGJAdjustmentLoader().pipe(z({next:n=>{v(t,i=>c(s({},i),{meta:n}))},error:n=>{console.error("Error fetching adjustment loader:",n)}}))))),getAdjustmentJournal:P(F(V(n=>Object.entries(n).reduce((i,[o,u])=>(u!=null&&(i[o]=u),i),{})),J(n=>l.getAdjustmentJournal(n).pipe(V(i=>c(s({},i),{data:i.data.map(o=>c(s({},o),{checked:!1}))})),z({next:i=>{v(t,o=>c(s({},o),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),ve(t=>({onInit:()=>{t.getGJAdjustmentLoader(),t.getAdjustmentJournal(t.filter)}})));var Le=()=>({height:"calc(100vh - 70px)"}),O=t=>({"ng-invalid ng-dirty":t}),We=()=>({});function Ke(t,l){if(t&1){let e=j();a(0,"p-button",10),E("onClick",function(){h(e);let i=f(2);return x(i.generateAdjusmentJournal())}),r()}}function qe(t,l){if(t&1&&g(0,Ke,1,0,"p-button",9),t&2){let e=f();d("ngIf",e.store.hasCheckedRows())}}function Qe(t,l){t&1&&(a(0,"tr")(1,"th",12),b(2,"p-tableHeaderCheckbox"),r(),a(3,"th",13),p(4,"Outlet"),r(),a(5,"th",14),p(6,"Number"),r(),a(7,"th",15),p(8,"Date"),r(),a(9,"th",14),p(10,"Adjustment Qty"),r(),a(11,"th",13),p(12,"Type"),r(),a(13,"th",16),p(14,"State"),r(),a(15,"th",17),p(16,"Note"),r(),b(17,"th",18),r())}function $e(t,l){if(t&1&&(a(0,"tr")(1,"td"),b(2,"p-tableCheckbox",19),r(),a(3,"td"),p(4),r(),a(5,"td")(6,"a",20),p(7),r()(),a(8,"td"),p(9),I(10,"date"),r(),a(11,"td"),p(12),I(13,"number"),r(),a(14,"td"),p(15),r(),a(16,"td"),p(17),r(),a(18,"td"),b(19,"div",21),r(),a(20,"td"),b(21,"p-button",22),r()()),t&2){let e=l.$implicit,n=f(2);m(2),d("value",e),m(2),C(e.outlet),m(2),d("href",n.authService.getTenantExternalURL()+"/menu/Adjustment/Adjustment/Archive/Info?ID="+e.id,U),m(),k(" ",e.number," "),m(2),C(M(10,12,e.date,"d MMM y")),m(3),C(Y(13,15,e.quantitySUM)),m(3),C(e.type),m(2),C(e.state),m(2),d("innerHTML",e.note,G),m(2),d("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function Xe(t,l){if(t&1&&p(0),t&2){let e=f(2);q(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Ye(t,l){t&1&&(a(0,"tr")(1,"td",23)(2,"span"),p(3,"No records found."),r()()())}function Ze(t,l){if(t&1){let e=j();a(0,"p-panel")(1,"p-table",11),E("onRowSelect",function(i){h(e);let o=f();return x(o.onRowSelect(i))})("onRowUnselect",function(i){h(e);let o=f();return x(o.onRowUnselect(i))})("onHeaderCheckboxToggle",function(i){h(e);let o=f();return x(o.onHeaderCheckboxToggle(i))})("onPage",function(i){h(e);let o=f();return x(o.onPageChange(i))}),g(2,Qe,18,0,"ng-template",null,3,S)(4,$e,22,17,"ng-template",null,4,S)(6,Xe,1,3,"ng-template",null,5,S)(8,Ye,4,0,"ng-template",null,6,S),r()()}if(t&2){let e=f();K(R(9,Le)),m(),d("value",e.store.data().data)("scrollable",!0)("scrollHeight","calc(100vh - 142px)")("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function et(t,l){if(t&1&&(a(0,"span",32),p(1),I(2,"truncate"),r()),t&2){let e=l.$implicit;d("pTooltip",e.name),m(),k(" ",M(2,2,e.name,30)," ")}}function tt(t,l){if(t&1&&(a(0,"div")(1,"span",34),p(2),r()()),t&2){let e=l.$implicit;m(2),C(e)}}function it(t,l){if(t&1&&(a(0,"div"),g(1,tt,3,1,"div",33),r()),t&2){let e=f(2);m(),d("ngForOf",e.getErrors("from"))}}function nt(t,l){if(t&1&&(a(0,"div")(1,"span",34),p(2),r()()),t&2){let e=l.$implicit;m(2),C(e)}}function ot(t,l){if(t&1&&(a(0,"div"),g(1,nt,3,1,"div",33),r()),t&2){let e=f(2);m(),d("ngForOf",e.getErrors("to"))}}function rt(t,l){if(t&1&&(a(0,"div")(1,"span",34),p(2),r()()),t&2){let e=l.$implicit;m(2),C(e)}}function at(t,l){if(t&1&&(a(0,"div"),g(1,rt,3,1,"div",33),r()),t&2){let e=f(2);m(),d("ngForOf",e.getErrors("pageSize"))}}function lt(t,l){if(t&1&&(a(0,"form",24)(1,"div",25)(2,"label",26),p(3,"Outlet"),r(),a(4,"p-select",27),g(5,et,3,5,"ng-template",null,7,S),r()(),a(7,"div",25)(8,"label",26),p(9,"From"),r(),b(10,"p-datepicker",28),g(11,it,2,1,"div",29),r(),a(12,"div",25)(13,"label",26),p(14,"To"),r(),b(15,"p-datepicker",30),g(16,ot,2,1,"div",29),r(),a(17,"div",25)(18,"label",26),p(19,"Page Size"),r(),b(20,"input",31),g(21,at,2,1,"div",29),r()()),t&2){let e=f();d("formGroup",e.form),m(4),d("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),m(6),d("iconDisplay","input")("showIcon",!0)("ngClass",T(14,O,e.isInvalid("from"))),m(),d("ngIf",e.isInvalid("from")),m(4),d("iconDisplay","input")("showIcon",!0)("ngClass",T(16,O,e.isInvalid("to"))),m(),d("ngIf",e.isInvalid("to")),m(4),d("autoNumeric",R(18,We))("ngClass",T(19,O,e.isInvalid("pageSize"))),m(),d("ngIf",e.isInvalid("pageSize"))}}var Kt=(()=>{class t extends Pe{constructor(){super(),this.store=w(H),this.generateJournalService=w(A),this.authService=w(re),this.isDialogFilterVisible=D(!1),this.isInitDialogFilterVisible=D(!1),this.fb=w(ce),this.dayjsService=w(ze)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:n,to:i,pageNumber:o,rowCount:u,pageSize:_,export:Oe,exportPageNumber:Be,exportRowCount:Ge}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),outletName:this.fb.control(""),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),pageNumber:this.fb.control(o),rowCount:this.fb.control(u),pageSize:this.fb.control(_,[le.required]),export:this.fb.control(Oe),exportPageNumber:this.fb.control(Be),exportRowCount:this.fb.control(Ge)})}onSearch(e){this.store.updateFilter(c(s({},this.store.filter()),{number:e,pageNumber:1}))}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((n,[i,o])=>{switch(i){case"from":typeof o=="object"?n[i]=this.dayjsService.from(o)?this.dayjsService.format(o):null:n[i]=o!=null?String(o):null;break;case"to":typeof o=="object"?n[i]=this.dayjsService.from(o)?this.dayjsService.format(o):null:n[i]=o!=null?String(o):null;break;default:n[i]=o===null?"":o;break}return n},{});this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(n=>{this.store.onRowUnselect(n)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onPageChange(e){let n=e.first/e.rows;this.store.updateFilter(c(s({},this.store.filter()),{pageNumber:n+1}))}generateAdjusmentJournal(){this.generateJournalService.createAdjustmentJournal(this.store.checkedAdjustment()).pipe(B(()=>this.store.getAdjustmentJournal(this.store.filter))).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=L({type:t,selectors:[["app-adjustment-journal"]],features:[X([H]),W],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Adjustment",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","onPage","value","scrollable","scrollHeight","paginator","rows","totalRecords","lazy"],[2,"width","1rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","11rem"],[2,"width","9rem"],[2,"width","14rem"],[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"],["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"],["type","text","pInputText","","formControlName","pageSize",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(n,i){if(n&1){let o=j();a(0,"app-main-panel",8),$("isDialogFilterVisibleChange",function(_){return h(o),N(i.isDialogFilterVisible,_)||(i.isDialogFilterVisible=_),x(_)})("isInitDialogFilterVisibleChange",function(_){return h(o),N(i.isInitDialogFilterVisible,_)||(i.isInitDialogFilterVisible=_),x(_)}),E("filterConfirmed",function(){return h(o),x(i.onFilterOKEvent())})("search",function(_){return h(o),x(i.onSearch(_))}),g(1,qe,1,1,"ng-template",null,0,S)(3,Ze,10,10,"ng-template",null,1,S)(5,lt,22,21,"ng-template",null,2,S),r()}n&2&&(d("isSearchableInput",!0)("isFilterable",!0),Q("isDialogFilterVisible",i.isDialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible))},dependencies:[Ae,Me,ke,Ne,Re,oe,Z,ee,te,ne,ie,Ce,be,xe,he,Ve,Fe,De,Je,fe,se,ae,me,pe,de,ue,ge,_e,Ie,Te,Ee,He],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{Kt as AdjustmentJournalComponent};
@@ -1 +1 @@
1
- import{a as Qe}from"./chunk-G4XX7EU2.js";import{a as Xe,b as Ze,c as et,d as tt,e as nt,f as ot}from"./chunk-EDCDR4RJ.js";import{a as Te,b as Fe}from"./chunk-O4QM64EH.js";import{d as ne,e as qe,i as we,j as Me,k as oe}from"./chunk-EW3R2HAB.js";import"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import{a as Ae}from"./chunk-XKCLERWG.js";import{a as ee,b as pe}from"./chunk-4LGDNQMZ.js";import"./chunk-PKN47FQE.js";import{a as K,b as J}from"./chunk-LRRVQSMI.js";import"./chunk-42UIGXWH.js";import"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{a as Ee,b as Y}from"./chunk-5R3XKSDM.js";import{h as M}from"./chunk-UYC454VQ.js";import"./chunk-C7LM5UCK.js";import{a as z,b as U}from"./chunk-J4XRJAME.js";import{a as te,b as ye,c as Pe,d as be,e as Oe,f as Ie,g as Je}from"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{o as Ke,w as B,x as V}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{e as H,f as _e,j as re,k as ge,l as xe,m as he,n as Ye,o as Ce,v as Se,x as Z,y as ve}from"./chunk-FMVCTBCQ.js";import{a as fe}from"./chunk-ZGXJEG37.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{D as ae,F as ze,G,N as k,f as L,j as He,m as w}from"./chunk-B63BKC6F.js";import{Ac as ie,Cb as _,Ga as R,Jc as Ue,Kb as s,Kc as je,Mc as u,Nb as F,Pb as $e,Qb as P,Sb as b,Tb as O,Ub as a,Vb as i,Wb as $,X as j,Yc as X,Z as D,_b as v,ba as ue,bb as Ve,c as se,dc as y,ec as c,gb as p,ha as h,pa as C,qa as S,qc as m,rc as d,s as Q,sc as I,uc as We,wb as T,yc as de,zc as E}from"./chunk-JP6RBSB3.js";import{a as f,b as x}from"./chunk-YQFG5XE2.js";var A=(()=>{class t{constructor(){this.httpService=h(fe)}getGlobalConfiguration(){return this.httpService.get(void 0,"/api/setup/GlobalConfiguration")}saveGlobalConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitGlobalConfiguration",e)}fetchPOSOutletConfiguration(e){return this.httpService.get(void 0,"/api/Setup/OutletConfiguration",{params:e})}fetchPOSOutletFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"/api/Setup/OutletConfigurationForm",n)}updatePOSOutletConfiguration(e){return this.httpService.post(void 0,"/api/Setup/SubmitOutletConfiguration",e)}fetchPOSPaymentConfiguration(e){return this.httpService.get(void 0,"/api/Setup/PaymentConfiguration",{params:e})}fetchPOSPaymentFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"api/Setup/PaymentConfigurationForm",n)}updatePOSPaymentConfiguration(e){return this.httpService.post(void 0,"/api/Setup/SubmitPaymentConfiguration",e)}fetchPOSTaxConfiguration(){return this.httpService.get(void 0,"/api/setup/TaxConfigurationForm")}updatePOSTaxConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitTaxConfiguration",e)}fetchPOSWriteOffConfiguration(){return this.httpService.get(void 0,"/api/setup/WriteOffConfigurationList")}fetchPOSWriteOffFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"/api/setup/WriteOffConfigurationForm",n)}updatePOSWriteOffConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitWriteOffConfiguration",e)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=ue({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var N=function(t){return t.POSGLOBAL_SELL="Sell",t.POSGLOBAL_BUY="Buy",t.POSGLOBAL_ADJUSTMENT="Adjustment",t.POSGLOBAL_PREPAID="Prepaid",t.POSGLOBAL_RETURN="Return",t.POSGLOBAL_DEBT="Debt",t.POSGLOBAL_PAYMENTFEE="Payment Fee",t.POSGLOBAL_MANUFACTURING="Manufacturing",t.POSGLOBAL_ADVANCE="Advance",t}(N||{});var it={[N.POSGLOBAL_SELL]:[{typeID:2,side:"debit",label:"Account Receivable"},{typeID:1,side:"credit",label:"Sales"},{typeID:4,side:"debit",label:"COGS"},{typeID:3,side:"credit",label:"Sold Inventory"},{typeID:10,side:"debit",label:"Sales Discount"}],[N.POSGLOBAL_BUY]:[{typeID:27,side:"debit",label:"Pending Paid Inventory"},{typeID:5,side:"credit",label:"Account Payable"},{typeID:28,side:"debit",label:"Inventory Bought"},{typeID:27,side:"credit",label:"Pending Paid Inventory"},{typeID:11,side:"credit",label:"Purchase Discount"}],[N.POSGLOBAL_ADJUSTMENT]:[{typeID:26,side:"debit",label:"Adjustment Asset"},{typeID:21,side:"credit",label:"Adjustment Expense"}],[N.POSGLOBAL_PREPAID]:[{typeID:29,side:"debit",label:"Accounting for Prepaid"},{typeID:30,side:"debit",label:"Sales For Prepaid"}],[N.POSGLOBAL_RETURN]:[{typeID:8,side:"debit",label:"Sales Return"},{typeID:27,side:"debit",label:"Inventory"},{typeID:4,side:"credit",label:"COGS"},{typeID:9,side:"credit",label:"Purchase Return"}],[N.POSGLOBAL_DEBT]:[{typeID:17,side:"debit",label:"Consignment Payable"}],[N.POSGLOBAL_PAYMENTFEE]:[{typeID:19,side:"debit",label:"Payment Fee"},{typeID:20,side:"credit",label:"Surcharge"}],[N.POSGLOBAL_MANUFACTURING]:[{typeID:24,side:"debit",label:"Finished Goods"},{typeID:23,side:"credit",label:"Raw Material"},{typeID:25,side:"credit",label:"Production Expenses"}],[N.POSGLOBAL_ADVANCE]:[{typeID:15,side:"debit",label:"Crossing Account"},{typeID:16,side:"debit",label:"Retained Earnings"},{typeID:18,side:"debit",label:"Current Earnings"}]};function gt(t,r){if(t&1){let e=v();a(0,"div",5)(1,"p-button",6),y("onClick",function(){C(e);let o=c();return S(o.onSubmit())}),i()()}}function xt(t,r){if(t&1&&(a(0,"p-tab",10),m(1),i()),t&2){let e=r.$implicit;s("value",e.value),p(),d(e.label)}}function ht(t,r){if(t&1&&(a(0,"div",19)(1,"div")(2,"span"),m(3),i()(),a(4,"div")(5,"span"),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function Ct(t,r){if(t&1&&(a(0,"div",19)(1,"div")(2,"span"),m(3),i()(),a(4,"div")(5,"span"),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function St(t,r){if(t&1&&(a(0,"div",14)(1,"div",15)(2,"div",5)(3,"label",16),m(4),i(),a(5,"span",17),m(6),i()(),a(7,"p-select",18),_(8,ht,7,2,"ng-template",null,2,u)(10,Ct,7,2,"ng-template",null,3,u),i()()()),t&2){let e=r.$implicit,n=c(4);s("formGroupName",e.index),p(4),d(e.entry.value.label),p(2),d(e.entry.value.side),p(),s("options",n.posIntegration().options.accounts)}}function vt(t,r){if(t&1&&(a(0,"div",19)(1,"div")(2,"span"),m(3),i()(),a(4,"div")(5,"span"),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function yt(t,r){if(t&1&&(a(0,"div",19)(1,"div")(2,"span"),m(3),i()(),a(4,"div")(5,"span"),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function Pt(t,r){if(t&1&&(a(0,"div",14)(1,"div",15)(2,"div",5)(3,"label",16),m(4),i(),a(5,"span",20),m(6),i()(),a(7,"p-select",18),_(8,vt,7,2,"ng-template",null,2,u)(10,yt,7,2,"ng-template",null,3,u),i()()()),t&2){let e=r.$implicit,n=c(4);s("formGroupName",e.index),p(4),d(e.entry.value.label),p(2),d(e.entry.value.side),p(),s("options",n.posIntegration().options.accounts)}}function bt(t,r){if(t&1&&(a(0,"p-tabpanel",10)(1,"div",11)(2,"div",12)(3,"div",13),b(4,St,12,4,"div",14,P),i()(),a(6,"div",12)(7,"div",13),b(8,Pt,12,4,"div",14,P),i()()()()),t&2){let e=r.$implicit,n=c(3);s("value",e.value),p(),s("formGroupName",e.value),p(3),O(n.getDebitEntries(e.value)),p(4),O(n.getCreditEntries(e.value))}}function Ot(t,r){if(t&1){let e=v();a(0,"form",8),y("ngSubmit",function(){C(e);let o=c(2);return S(o.onSubmit())}),a(1,"p-tabs",9)(2,"p-tablist"),b(3,xt,2,2,"p-tab",10,P),i(),a(5,"p-tabpanels"),b(6,bt,10,2,"p-tabpanel",10,P),i()()()}if(t&2){let e=c(2);s("formGroup",e.accountForm),p(),s("value",e.tab())("lazy",!0),p(2),O(e.tabs()),p(3),O(e.tabs())}}function It(t,r){if(t&1&&_(0,Ot,8,3,"form",7),t&2){let e=c();s("ngIf",e.posIntegration()&&e.accountForm)}}var at=(()=>{class t{constructor(){this.posConfigService=h(A),this.fb=h(Se),this.tab=R(N.POSGLOBAL_SELL),this.tabs=R(Object.values(N).map(e=>({label:e,value:e}))),this.posIntegration=R(null),this.form=R([]),this.descriptionsMap=new Map,this.objectKeys=Object.keys,this.posGlobalTabEnum=N}ngOnInit(){this.posConfigService.getGlobalConfiguration().pipe(D(e=>{this.posIntegration.set(e),this.form.set(e.form),this.descriptionsMap=new Map(e.descriptions.map(n=>[+n.id,n.name])),this.initializeForm()})).subscribe()}initializeForm(){let e={};this.tabs().forEach(n=>{let o=this.getEntriesForTab(n.value);console.log(`Entries for ${n.value}:`,o),e[n.value]=this.fb.array(o.map(l=>this.createEntryFormGroup(l)))}),this.accountForm=this.fb.group(e)}createEntryFormGroup(e){let n=this.fb.group({typeID:[e.typeID],label:[e.label],side:[e.side],accountID:[this.getAccountIDByTypeID(e.typeID)]});return n.get("accountID").valueChanges.subscribe(o=>{this.syncAccountIDs(e.typeID,o,n)}),n}getAccountIDByTypeID(e){return this.form().find(o=>o.typeID===e)?.accountID||""}getEntriesForTab(e){return it[e]||[]}getTabEntries(e){return this.accountForm.get(e)}onSubmit(){let e=this.accountForm.getRawValue(),n=[],o=new Set;for(let l of Object.values(e))for(let{typeID:g,accountID:W}of l){let Be=`${g}_${W}`;o.has(Be)||(o.add(Be),n.push({typeID:g,accountID:W||Qe}))}console.log("Form submitted with value:",n),this.posConfigService.saveGlobalConfiguration({form:n}).subscribe({next:()=>console.log("Save successful"),error:l=>console.error("Save failed",l)})}getDebitEntries(e){return this.getTabEntries(e).controls.map((n,o)=>({entry:n,index:o})).filter(n=>n.entry.value.side==="debit")}getCreditEntries(e){return this.getTabEntries(e).controls.map((n,o)=>({entry:n,index:o})).filter(n=>n.entry.value.side==="credit")}syncAccountIDs(e,n,o){Object.values(this.accountForm.controls).forEach(l=>{l.controls.forEach(g=>{g!==o&&g.get("typeID")?.value===e&&g.get("accountID")?.value!==n&&g.get("accountID")?.setValue(n,{emitEvent:!1})})})}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-global"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],["pageTitle","POS Integration"],[1,"d-flex","gap-2"],["label","Submit",3,"onClick"],[3,"formGroup","ngSubmit",4,"ngIf"],[3,"ngSubmit","formGroup"],[1,"border-top",3,"value","lazy"],[3,"value"],[1,"row",3,"formGroupName"],[1,"col"],[1,"row","gap-3"],[1,"col-12",3,"formGroupName"],[1,"form-group","d-flex","flex-column"],["for","",1,"fs-3"],[1,"text-success","fs-3"],["filter","","filterBy","code,name","formControlName","accountID","optionLabel","name","optionValue","id",3,"options"],[1,"d-flex","align-items-center","gap-2"],[1,"text-danger","fs-3"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,gt,2,0,"ng-template",null,0,u)(3,It,1,1,"ng-template",null,1,u),i())},dependencies:[M,ot,nt,tt,et,Xe,Ze,Ke,J,K,Z,ge,H,_e,w,L,k,V,B,ve,xe,Ce,he],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Et=t=>[t];function Tt(t,r){if(t&1&&(a(0,"th",7),m(1),i()),t&2){let e=r.$implicit;p(),d(e.name.slice(0,10))}}function Ft(t,r){if(t&1&&(a(0,"tr")(1,"th",6),m(2,"Method"),i()(),a(3,"tr"),b(4,Tt,2,1,"th",7,P),i()),t&2){let e=c(3);p(4),O(e.paymentConfiguration().outlets)}}function wt(t,r){if(t&1&&(a(0,"td"),m(1),i()),t&2){let e=r.$implicit;p(),d(e.accountName)}}function Mt(t,r){if(t&1&&(a(0,"tr")(1,"td",8)(2,"a",9),m(3),i()(),b(4,wt,2,1,"td",null,P),i()),t&2){let e=r.$implicit;p(2),s("routerLink",ie(2,Et,e.id)),p(),d(e.name),p(),O(e.accounts)}}function Dt(t,r){if(t&1&&(a(0,"p-table",5),_(1,Ft,6,0,"ng-template",null,1,u)(3,Mt,6,4,"ng-template",null,2,u),i()),t&2){let e=c(2);s("scrollable",!0)("scrollHeight","calc(100vh - 70px)")("value",e.paymentConfiguration().payment)}}function Rt(t,r){if(t&1){let e=v();a(0,"app-main-panel",4),y("search",function(o){C(e);let l=c();return S(l.onSearch(o))}),_(1,Dt,5,3,"ng-template",null,0,u),i()}t&2&&s("isSearchableInput",!0)}var rt=(()=>{class t{constructor(){this.POSSetupService=h(A),this.paymentConfiguration=R(null)}ngOnInit(){this.POSSetupService.fetchPOSPaymentConfiguration({}).pipe(D(e=>{this.paymentConfiguration.set(e)})).subscribe()}onSearch(e){this.POSSetupService.fetchPOSPaymentConfiguration({Search:e}).pipe(D(n=>{this.paymentConfiguration.set(n)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-payment"]],decls:1,vars:1,consts:[["content",""],["header",""],["body",""],["pageTitle","Payment Method Accounting",3,"isSearchableInput","search",4,"ngIf"],["pageTitle","Payment Method Accounting",3,"search","isSearchableInput"],[3,"scrollable","scrollHeight","value"],["rowspan","3",2,"min-width","300px"],[2,"min-width","200px"],["pFrozenColumn",""],[1,"link-primary",3,"routerLink"]],template:function(n,o){n&1&&_(0,Rt,3,1,"app-main-panel",3),n&2&&s("ngIf",o.paymentConfiguration())},dependencies:[M,oe,ne,qe,w,L,k,G],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var kt={data:{listOutletAccount:[],listCOAType:[],pageNumber:1,pageSize:20,totalCount:0,totalPages:0},filter:{PageNumber:1,PageSize:20,Search:""}},Le=ye(Ie(kt),Pe(t=>({first:X(()=>(t.filter().PageNumber-1)*t.filter().PageSize+1),end:X(()=>Math.min(t.filter().PageNumber*t.filter().PageSize,t.data().totalCount))})),Oe(t=>{let r=h(A);return{updateFilter:n=>{te(t,o=>x(f({},o),{filter:f(f({},o.filter),n)}))},getPOSOutlets:Te(se(j(n=>r.fetchPOSOutletConfiguration(n).pipe(Fe({next:o=>{te(t,l=>x(f({},l),{data:o}))},error:o=>{console.error("Error fetching POS outlets:",o)}})))))}}),be(t=>({onInit:()=>{t.getPOSOutlets(t.filter)}})));var At=()=>({height:"calc(100vh - 70px)"}),Nt=t=>[t];function Lt(t,r){if(t&1&&(a(0,"th"),m(1),i()),t&2){let e=r.$implicit;p(),d(e.value)}}function Gt(t,r){if(t&1&&(a(0,"tr")(1,"th"),m(2,"Name"),i(),b(3,Lt,2,1,"th",null,P),i()),t&2){let e=c(2);p(3),O(e.store.data().listCOAType)}}function Bt(t,r){if(t&1&&(a(0,"td"),m(1),i()),t&2){let e=r.$implicit;p(),d(e)}}function Vt(t,r){if(t&1&&(a(0,"tr")(1,"td")(2,"a",7),m(3),i()(),b(4,Bt,2,1,"td",null,P),i()),t&2){let e=r.$implicit;p(2),s("routerLink",ie(2,Nt,e.OutletID)),p(),I(" ",e.OutletName,""),p(),O(e.Accounts)}}function $t(t,r){if(t&1&&m(0),t&2){let e=c(2);We(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Wt(t,r){t&1&&(a(0,"tr")(1,"td",8)(2,"span"),m(3," No journal entries found. "),i()()())}function Ut(t,r){if(t&1){let e=v();a(0,"p-panel")(1,"p-table",6),y("onPage",function(o){C(e);let l=c();return S(l.onPage(o))}),_(2,Gt,5,0,"ng-template",null,1,u)(4,Vt,6,4,"ng-template",null,2,u)(6,$t,1,3,"ng-template",null,3,u)(8,Wt,4,0,"ng-template",null,4,u),i()()}if(t&2){let e=c();F(E(11,At)),p(),s("scrollable",!0)("scrollHeight","calc(100vh - 100px)")("value",e.store.data().listOutletAccount)("paginator",!0)("rows",e.store.filter().PageSize)("lazy",!0)("scrollable",!0)("scrollHeight","calc(100vh - 142px)")("totalRecords",e.store.data().totalCount)}}var pt=(()=>{class t{constructor(){this.store=h(Le)}onSearch(e){this.store.updateFilter({PageNumber:1,PageSize:20,Search:e})}onPage(e){let n=e.first/e.rows+1;this.store.updateFilter(x(f({},this.store.filter()),{PageSize:e.rows,PageNumber:n}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-outlet"]],features:[de([Le])],decls:3,vars:1,consts:[["content",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["pageTitle","Outlet Account",3,"search","isSearchableInput"],["styleClass","d-flex flex-column justify-content-between h-100",3,"onPage","scrollable","scrollHeight","value","paginator","rows","lazy","totalRecords"],[1,"link","link-primary",3,"routerLink"],["colspan","8"]],template:function(n,o){if(n&1){let l=v();a(0,"app-main-panel",5),y("search",function(W){return C(l),S(o.onSearch(W))}),_(1,Ut,10,12,"ng-template",null,0,u),i()}n&2&&s("isSearchableInput",!0)},dependencies:[M,w,Y,oe,ne,k,G,U,z],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var jt=()=>({height:"calc(100vh - 100px)"}),Ht=()=>({height:"calc(100vh - 150px)"});function zt(t,r){if(t&1){let e=v();a(0,"a",5),m(1,"Cancel"),i(),a(2,"p-button",6),y("onClick",function(){C(e);let o=c();return S(o.updatePOsOutletConfiguration())}),i()}}function Yt(t,r){if(t&1&&(a(0,"div",16)(1,"div",17)(2,"span"),m(3),i()(),a(4,"div",17)(5,"span",17),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function Kt(t,r){if(t&1&&(a(0,"div",16)(1,"div",17)(2,"span"),m(3),i()(),a(4,"div",18)(5,"span",17),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function Jt(t,r){if(t&1&&(a(0,"div",12)(1,"span",14),m(2),i(),a(3,"p-select",15),_(4,Yt,7,2,"ng-template",null,2,u)(6,Kt,7,2,"ng-template",null,3,u),i()()),t&2){let e,n=r.$implicit,o=r.$index,l=c(3);s("formGroupName",o),p(2),d((e=n.get("TypeName"))==null?null:e.value),p(),s("options",l.options.accounts)}}function qt(t,r){t&1&&$(0,"hr")}function Qt(t,r){if(t&1&&(a(0,"div",9)(1,"h3",10),m(2),Ue(3,"titlecase"),i(),a(4,"div",11),b(5,Jt,8,3,"div",12,P),i()(),_(7,qt,1,0,"hr",13)),t&2){let e,n=r.$implicit,o=r.$index,l=r.$index,g=r.$count,W=c(2);s("formGroupName",o),p(2),I(" ",je(3,3,(e=n.get("groupName"))==null?null:e.value)," "),p(3),O(W.getAccountsFormArray(l).controls),p(2),s("ngIf",l!==g-1)}}function Xt(t,r){if(t&1&&(a(0,"p-panel")(1,"p-scroll-panel")(2,"form",7)(3,"div",8),b(4,Qt,8,5,null,null,P),i()()()()),t&2){let e=c();F(E(5,jt)),p(),F(E(6,Ht)),p(),s("formGroup",e.accountsForm),p(2),O(e.accountGroupsArray.controls)}}var lt=(()=>{class t{constructor(){this.route=h(ae),this.POSSetupService=h(A),this.outletForm=R(null),this.allAccounts=[],this.options=null,this.outletName="",this.accountGroups=[{name:"sell",typeIds:[1,2],accounts:[]},{name:"delivery",typeIds:[3,4],accounts:[]},{name:"buy",typeIds:[27,11,28],accounts:[]},{name:"purchase return",typeIds:[9],accounts:[]},{name:"sales return",typeIds:[8],accounts:[]},{name:"adjustment",typeIds:[21,26],accounts:[]}],this.fb=h(Se)}ngOnInit(){this.accountsForm=this.fb.group({accountGroups:this.fb.array([])}),this.route.paramMap.pipe(Q(e=>e.get("id")),j(e=>this.POSSetupService.fetchPOSOutletFormConfiguration({outletID:e})),D(e=>{this.allAccounts=e.form,this.options=e.options,this.outletName=e.form[0].OutletName,this.accountGroups.forEach(o=>{o.accounts=this.allAccounts.filter(l=>o.typeIds.includes(l.TypeID))});let n=this.accountsForm.get("accountGroups");this.accountGroups.forEach(o=>{n.push(this.createAccountGroupControl(o))})})).subscribe()}get accountGroupsArray(){return this.accountsForm.get("accountGroups")}getAccountsFormArray(e){return this.accountGroupsArray.at(e).get("accounts")}createAccountGroupControl(e){return this.fb.group({groupName:[e.name],accounts:this.fb.array(e.accounts.map(n=>this.createAccountControl(n)))})}createAccountControl(e){return this.fb.group({AccountID:[e.AccountID],TypeID:[e.TypeID],TypeName:[e.TypeName],OutletID:[e.OutletID],OutletName:[e.OutletName]})}updatePOsOutletConfiguration(){let{accountGroups:e}=this.accountsForm.value,n={form:e.flatMap(o=>o.accounts.map(l=>({AccountID:l.AccountID,TypeID:l.TypeID,TypeName:l.TypeName,OutletID:l.OutletID,OutletName:l.OutletName})))};this.POSSetupService.updatePOSOutletConfiguration(n).pipe().subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-outlet-form"]],decls:5,vars:2,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"pageTitle","hasMainWrapperPadding"],["routerLink","/pages/pos-setup/outlets",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"onClick"],[1,"",3,"formGroup"],["formArrayName","accountGroups",1,"d-flex","flex-column","gap-2"],[1,"row",3,"formGroupName"],[1,"fs-4","fw-semibold"],["formArrayName","accounts",1,"row","row-gap-3"],[1,"col-6",3,"formGroupName"],[4,"ngIf"],[1,"fs-3"],["formControlName","AccountID","filter","","filterBy","code,name","optionLabel","name","optionValue","id","placeholder","Select an account",1,"w-100",3,"options"],[1,"d-flex","gap-2"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,zt,3,0,"ng-template",null,0,u)(3,Xt,6,7,"ng-template",null,1,u),i()),n&2&&s("pageTitle","Edit "+o.outletName)("hasMainWrapperPadding",!0)},dependencies:[M,w,L,He,Y,ve,ge,H,_e,xe,Ce,he,Ye,J,K,U,z,ee,V,B,k,G],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var en=()=>({height:"calc(100vh - 100px)"}),tn=()=>({width:"100%",height:"calc(100vh - 150px)"}),nn=()=>({width:"100%"});function on(t,r){if(t&1){let e=v();a(0,"a",6),m(1,"Cancel"),i(),a(2,"p-button",7),y("onClick",function(){C(e);let o=c(3);return S(o.updatePOSOutletConfiguration())}),i()}}function an(t,r){if(t&1&&(a(0,"div",16)(1,"div",17)(2,"span"),m(3),i()(),a(4,"div",17)(5,"span",17),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function rn(t,r){if(t&1&&(a(0,"div",16)(1,"div",17)(2,"span"),m(3),i()(),a(4,"div",18)(5,"span",17),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function pn(t,r){if(t&1){let e=v();a(0,"div",9)(1,"div",10)(2,"div",11)(3,"label",12),m(4),i()(),$(5,"div",13),a(6,"div",14)(7,"p-select",15),y("ngModelChange",function(o){let l=C(e).$index,g=c(4);return S(g.updateAccountById(o,l))}),_(8,an,7,2,"ng-template",null,2,u)(10,rn,7,2,"ng-template",null,3,u),i()()()()}if(t&2){let e=r.$implicit,n=r.$index,o=c(4);p(4),d(e.outletName.slice(0,15)),p(3),F(E(7,nn)),s("ngModel",o.paymentForm().form.accounts[n].accountID)("virtualScroll",!0)("virtualScrollItemSize",50)("options",o.paymentForm().options.chartOfAccount)}}function ln(t,r){if(t&1&&(a(0,"p-card")(1,"p-scrollpanel")(2,"div",8),b(3,pn,12,8,"div",9,P),i()()()),t&2){let e=c(3);F(E(4,en)),p(),F(E(5,tn)),p(2),O(e.paymentForm().form.accounts)}}function mn(t,r){if(t&1&&(a(0,"app-main-panel",4),_(1,on,3,0,"ng-template",null,0,u)(3,ln,5,6,"ng-template",null,1,u),i()),t&2){let e=c(2);s("pageTitle",e.paymentForm().form.paymentMethod.name+" Form Accounting")("hasMainWrapperPadding",!0)}}function cn(t,r){if(t&1&&_(0,mn,5,2,"app-main-panel",5),t&2){let e=c();s("ngIf",e.paymentForm())}}var ct=(()=>{class t{constructor(){this.route=h(ae),this.POSSetupService=h(A),this.paymentForm=R(null),this.router=h(ze)}ngOnInit(){this.route.paramMap.pipe(Q(e=>+e.get("id")),j(e=>this.POSSetupService.fetchPOSPaymentFormConfiguration({ID:e})),D(e=>{this.paymentForm.set(e)}),Ae("response")).subscribe()}updateAccountById(e,n){let o=this.paymentForm().form.accounts,l=x(f({},this.paymentForm()),{form:x(f({},this.paymentForm().form),{accounts:o.map((g,W)=>W===n?x(f({},g),{accountID:e}):g)})});this.paymentForm.set(l)}updatePOSOutletConfiguration(){let e={form:[...this.paymentForm().form.accounts]};this.POSSetupService.updatePOSPaymentConfiguration(e).pipe(Ae("response"),D(()=>{this.router.navigate(["/pages/pos-setup/payments"])})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-payment-form"]],decls:1,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"pageTitle","hasMainWrapperPadding"],[3,"pageTitle","hasMainWrapperPadding",4,"ngIf"],["routerLink","/pages/pos-setup/payments",1,"p-button","p-button-outlined","p-button-secondary"],["label","Submit",3,"onClick"],[1,"row","row-gap-3"],[1,"col-6","d-flex","flex-column","gap-2"],[1,"row","row-gap-4"],[1,"col-2"],["for",""],[1,"col-3"],[1,"col-7"],["filter","","filterBy","name,code","optionLabel","name","optionValue","id","placeholder","Select an account",1,"w-full",3,"ngModelChange","ngModel","virtualScroll","virtualScrollItemSize","options"],[1,"d-flex","gap-2"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&_(0,cn,1,1,"app-main-panel",4),n&2&&$e(o.paymentForm()?0:-1)},dependencies:[Y,Ee,M,w,L,pe,ee,J,K,Z,H,re,k,G,V,B,U],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var sn=()=>({height:"calc(100vh - 70px)"}),un=()=>({width:"100%",height:"calc(100vh - 100px)"});function dn(t,r){if(t&1){let e=v();a(0,"div",5)(1,"a",6),m(2,"Cancel"),i(),a(3,"p-button",7),y("onClick",function(){C(e);let o=c();return S(o.updatePOSTaxConfiguration())}),i()()}}function fn(t,r){if(t&1&&(a(0,"div",5)(1,"div",15)(2,"span"),m(3),i()(),a(4,"div",15)(5,"span",15),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function _n(t,r){if(t&1&&(a(0,"div",5)(1,"div",15)(2,"span"),m(3),i()(),a(4,"div",16)(5,"span",15),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function gn(t,r){if(t&1){let e=v();a(0,"div",11)(1,"div",12)(2,"label",13),m(3),i(),a(4,"p-select",14),y("ngModelChange",function(o){let l=C(e).$index,g=c(2);return S(g.updateAccountID(o,l))}),_(5,fn,7,2,"ng-template",null,2,u)(7,_n,7,2,"ng-template",null,3,u),i()()()}if(t&2){let e=r.$implicit,n=r.$index,o=c(2);p(3),d(e.name),p(),s("options",o.taxForm().options.chartOfAccount)("ngModel",o.taxForm().form[n].accountID)}}function xn(t,r){if(t&1&&(a(0,"p-panel")(1,"p-scroll-panel")(2,"div",8)(3,"div",9)(4,"div",10),b(5,gn,9,3,"div",11,P),i()()()()()),t&2){let e=c();F(E(4,sn)),p(),F(E(5,un)),p(4),O(e.taxForm().form)}}var st=(()=>{class t{constructor(){this.POSSetupService=h(A),this.taxForm=R(null)}ngOnInit(){this.POSSetupService.fetchPOSTaxConfiguration().pipe(D(e=>{this.taxForm.set(e)})).subscribe()}updateAccountID(e,n){let o=this.taxForm().form,l=x(f({},this.taxForm()),{form:o.map((g,W)=>W===n?x(f({},g),{accountID:e}):g)});this.taxForm.set(l)}updatePOSTaxConfiguration(){let e={form:[...this.taxForm().form]};this.POSSetupService.updatePOSTaxConfiguration(e).pipe(D(n=>console.log(n))).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-tax"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],["pageTitle","Tax Setup"],[1,"d-flex","gap-2"],["routerLink","..",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"onClick"],[1,"row"],[1,"col-4"],[1,"row","row-gap-3"],[1,"col-12"],[1,"d-flex","flex-column"],["for",""],["filter","","filterBy","name,code","optionLabel","name","optionValue","id","placeholder","Select an Account",3,"ngModelChange","options","ngModel"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,dn,4,0,"ng-template",null,0,u)(3,xn,7,6,"ng-template",null,1,u),i())},dependencies:[M,Y,w,J,K,pe,ee,Z,H,re,k,G,V,B,U,z],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var hn=()=>({height:"calc(100vh - 70px)"}),Cn=()=>({"min-width":"50rem"}),Sn=t=>[t];function vn(t,r){t&1&&$(0,"p-button",6)}function yn(t,r){if(t&1&&_(0,vn,1,0,"p-button",5),t&2){let e=c();s("ngIf",e.hasCheckedItems())}}function Pn(t,r){t&1&&(a(0,"tr")(1,"th",9),$(2,"p-tableHeaderCheckbox"),i(),a(3,"th"),m(4,"Name"),i(),a(5,"th"),m(6,"Description"),i()())}function bn(t,r){if(t&1&&(a(0,"tr")(1,"td"),$(2,"p-tableCheckbox",10),i(),a(3,"td")(4,"a",11),m(5),i()(),a(6,"td"),m(7),i()()),t&2){let e=r.$implicit;p(2),s("value",e),p(2),s("routerLink",ie(4,Sn,e.id)),p(),d(e.name),p(2),d(e.description)}}function On(t,r){if(t&1){let e=v();a(0,"p-panel")(1,"p-table",8),y("onRowSelect",function(o){C(e);let l=c(2);return S(l.onRowSelect(o))})("onRowUnselect",function(o){C(e);let l=c(2);return S(l.onRowSelect(o))})("onHeaderCheckboxToggle",function(o){C(e);let l=c(2);return S(l.onSelectAll(o))}),_(2,Pn,7,0,"ng-template",null,2,u)(4,bn,8,6,"ng-template",null,3,u),i()()}if(t&2){let e=c(2);F(E(4,hn)),p(),s("value",e.writeoffList().data)("tableStyle",E(5,Cn))}}function In(t,r){if(t&1&&_(0,On,6,6,"p-panel",7),t&2){let e=c();s("ngIf",e.writeoffList())}}var ut=(()=>{class t{constructor(){this.POSSetupService=h(A),this.writeoffList=R(null),this.hasCheckedItems=X(()=>{let e=this.writeoffList();return!e||!e.data||!Array.isArray(e.data)?!1:e.data.some(n=>n&&n.checked===!0)})}ngOnInit(){this.POSSetupService.fetchPOSWriteOffConfiguration().pipe(Q(e=>x(f({},e),{data:e.data.map(n=>x(f({},n),{checked:!1}))})),D(e=>{this.writeoffList.set(e)})).subscribe()}onRowSelect(e){console.log("Selected Row:",e.data);let n=this.writeoffList();if(!n||!n.data)return;let o=n.data.findIndex(l=>l.id===e.data.id);if(o!==-1){let l=[...n.data];l[o]=x(f({},l[o]),{checked:!l[o].checked}),this.writeoffList.set(x(f({},n),{data:l}))}}onSelectAll(e){let n=this.writeoffList();if(!n?.data)return;let o=n.data.map(l=>x(f({},l),{checked:e.checked}));this.writeoffList.set(x(f({},n),{data:o}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-writeoff"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["body",""],["pageTitle","Write Off"],["severity","danger","label","Delete","icon","fa-solid fa-trash",4,"ngIf"],["severity","danger","label","Delete","icon","fa-solid fa-trash"],[3,"style",4,"ngIf"],["dataKey","id",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value","tableStyle"],[2,"width","4rem"],[3,"value"],[1,"link-primary",3,"routerLink"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,yn,1,1,"ng-template",null,0,u)(3,In,1,1,"ng-template",null,1,u),i())},dependencies:[M,w,L,oe,ne,we,Me,k,G,V,B,U,z],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var En=()=>({witdh:"100%",height:"calc(100vh - 150px)"});function Tn(t,r){if(t&1){let e=v();a(0,"div",6)(1,"a",7),m(2,"Cancel"),i(),a(3,"p-button",8),y("onClick",function(){C(e);let o=c(2);return S(o.updateWriteOffConfiguration())}),i()()}}function Fn(t,r){if(t&1&&(a(0,"div",6)(1,"span",16),m(2),i(),a(3,"span",16),m(4),i()()),t&2){let e=r.$implicit;p(2),I("(",e.code,")"),p(2),d(e.name)}}function wn(t,r){if(t&1&&(a(0,"div",6)(1,"span",16),m(2),i(),a(3,"span",16),m(4),i()()),t&2){let e=r.$implicit;p(2),I("(",e.code,")"),p(2),d(e.name)}}function Mn(t,r){if(t&1){let e=v();a(0,"div",12)(1,"div",13)(2,"label",14),m(3),i(),a(4,"p-select",15),y("ngModelChange",function(o){let l=C(e).$index,g=c(3);return S(g.updateAccountById(o,l))}),_(5,Fn,5,2,"ng-template",null,2,u)(7,wn,5,2,"ng-template",null,3,u),i()()()}if(t&2){let e=r.$implicit,n=c(3);p(3),d(e.name),p(),s("ngModel",e.accountID)("options",n.writeOffForm().options.account)("virtualScroll",!0)("virtualScrollItemSize",50)}}function Dn(t,r){if(t&1&&(a(0,"p-card")(1,"p-scroll-panel")(2,"div",9)(3,"div",10)(4,"div",11),b(5,Mn,9,5,"div",12,P),i()()()()()),t&2){let e=c(2);p(),F(E(2,En)),p(4),O(e.writeOffForm().form)}}function Rn(t,r){if(t&1&&(a(0,"app-main-panel",5),_(1,Tn,4,0,"ng-template",null,0,u)(3,Dn,7,3,"ng-template",null,1,u),i()),t&2){let e=c();s("pageTitle","Write Off Form "+e.writeOffForm().info.name)("hasMainWrapperPadding",!0)}}var dt=(()=>{class t{constructor(){this.POSSetupService=h(A),this.route=h(ae),this.writeOffForm=R(null)}ngOnInit(){this.route.paramMap.pipe(Q(e=>e.get("id")),j(e=>this.POSSetupService.fetchPOSWriteOffFormConfiguration({ID:e})),D(e=>this.writeOffForm.set(e))).subscribe()}updateAccountById(e,n){let o=this.writeOffForm().form,l=x(f({},this.writeOffForm()),{form:o.map((g,W)=>W===n?x(f({},g),{accountID:e}):g)});this.writeOffForm.set(l)}updateWriteOffConfiguration(){let e={form:this.writeOffForm().form};this.POSSetupService.updatePOSWriteOffConfiguration(e).pipe().subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-writeoff-form"]],decls:1,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"pageTitle","hasMainWrapperPadding",4,"ngIf"],[3,"pageTitle","hasMainWrapperPadding"],[1,"d-flex","gap-2"],["routerLink","/pages/pos-setup/writeoff",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"onClick"],[1,"row"],[1,"col"],[1,"row","row-gap-3"],[1,"col-3"],[1,"d-flex","flex-column"],["for","",1,"d-inline-block","text-truncate",2,"max-width","300px"],["filter","","filterBy","name,code","optionLabel","name","filter","","filterBy","name,code","optionValue","id","placeholder","Select an account",3,"ngModelChange","ngModel","options","virtualScroll","virtualScrollItemSize"],[1,""]],template:function(n,o){n&1&&_(0,Rn,5,2,"app-main-panel",4),n&2&&s("ngIf",o.writeOffForm())},dependencies:[M,w,L,Y,Ee,pe,ee,J,K,Z,H,re,k,G,V,B],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var ft=(()=>{class t{constructor(){this.httpService=h(fe)}getExpenseOptions(){return this.httpService.get(void 0,"/api/SetupExpenseOption/GetExpenseOptions")}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=ue({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var kn={data:{expenseOptions:[]}},Ge=ye(Ie(kn),Je("POSExpenseOptionStore"),Pe(t=>({hasCheckedRows:X(()=>t.data().expenseOptions.some(r=>r.checked)),checkedInvoice:X(()=>t.data().expenseOptions.filter(r=>r.checked).map(r=>r.id))})),Oe(t=>{let r=h(ft);return{onRowSelect(n){te(t,o=>{let l=o.data.expenseOptions.map(g=>g.id===n.id?x(f({},g),{checked:!0}):g);return x(f({},o),{data:x(f({},o.data),{expenseOptions:l})})})},onRowUnselect(n){te(t,o=>{let l=o.data.expenseOptions.map(g=>g.id===n.id?x(f({},g),{checked:!1}):g);return x(f({},o),{data:x(f({},o.data),{expenseOptions:l})})})},onHeaderCheckboxToggle(n){te(t,o=>{let l=o.data.expenseOptions.map(g=>x(f({},g),{checked:n}));return x(f({},o),{data:x(f({},o.data),{expenseOptions:l})})})},getExpenseOptions:Te(se(j(()=>r.getExpenseOptions().pipe(Fe({next:n=>{te(t,o=>x(f({},o),{data:x(f({},o.data),{expenseOptions:n.expenseOptions.map(l=>x(f({},l),{checked:!1}))})}))},error:n=>{console.error("Error fetching expense options:",n)}})))))}}),be({onInit:t=>{t.getExpenseOptions()}}));var An=()=>({height:"calc(100vh - 70px)"});function Nn(t,r){t&1&&$(0,"p-button",6)}function Ln(t,r){if(t&1&&_(0,Nn,1,0,"p-button",5),t&2){let e=c();s("ngIf",e.store.hasCheckedRows())}}function Gn(t,r){t&1&&(a(0,"tr")(1,"th",8),$(2,"p-tableHeaderCheckbox"),i(),a(3,"th"),m(4,"Name"),i(),a(5,"th"),m(6,"Account"),i(),a(7,"th"),m(8,"Description"),i()())}function Bn(t,r){if(t&1&&(a(0,"tr")(1,"td"),$(2,"p-tableCheckbox",9),i(),a(3,"td"),m(4),i(),a(5,"td"),m(6),i(),a(7,"td"),$(8,"p",10),i()()),t&2){let e=r.$implicit;p(2),s("value",e),p(2),d(e.name),p(2),d(e.accountName),p(2),s("innerHTML",e.description,Ve)}}function Vn(t,r){if(t&1){let e=v();a(0,"p-panel")(1,"p-table",7),y("onRowSelect",function(o){C(e);let l=c();return S(l.onRowSelect(o))})("onRowUnselect",function(o){C(e);let l=c();return S(l.onRowUnselect(o))})("onHeaderCheckboxToggle",function(o){C(e);let l=c();return S(l.onHeaderCheckboxToggle(o))}),_(2,Gn,9,0,"ng-template",null,2,u)(4,Bn,9,4,"ng-template",null,3,u),i()()}if(t&2){let e=c();F(E(3,An)),p(),s("value",e.store.data().expenseOptions)}}var _t=(()=>{class t{constructor(){this.store=h(Ge)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){Array.isArray(e.data)?e.data.forEach(n=>{this.store.onRowUnselect(n)}):this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-expense-option"]],features:[de([Ge])],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["body",""],["pageTitle","Expense Option"],["label","Delete","severity","danger","icon","fa-solid fa-trash",4,"ngIf"],["label","Delete","severity","danger","icon","fa-solid fa-trash"],["dataKey","id",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value"],[2,"width","4rem"],[3,"value"],[3,"innerHTML"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,Ln,1,1,"ng-template",null,0,u)(3,Vn,6,4,"ng-template",null,1,u),i())},dependencies:[M,oe,ne,we,Me,U,z,V,B,w,L],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Ua=[{path:"",redirectTo:"global",pathMatch:"full"},{path:"",children:[{path:"global",component:at},{path:"outlets",component:pt},{path:"outlets/:id",component:lt},{path:"payments",component:rt},{path:"payments/:id",component:ct},{path:"taxs",component:st},{path:"writeoff",component:ut},{path:"writeoff/:id",component:dt},{path:"expense-option",component:_t}]}];export{Ua as POS_SETUP_ROUTES};
1
+ import{a as Qe}from"./chunk-G4XX7EU2.js";import{a as Xe,b as Ze,c as et,d as tt,e as nt,f as ot}from"./chunk-EDCDR4RJ.js";import{a as Te,b as Fe}from"./chunk-O4QM64EH.js";import{d as ne,e as qe,i as we,j as Me,k as oe}from"./chunk-EW3R2HAB.js";import"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import{a as Ae}from"./chunk-XKCLERWG.js";import{a as ee,b as pe}from"./chunk-4LGDNQMZ.js";import"./chunk-PKN47FQE.js";import{a as K,b as J}from"./chunk-LRRVQSMI.js";import"./chunk-42UIGXWH.js";import"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{a as Ee,b as Y}from"./chunk-5R3XKSDM.js";import{h as M}from"./chunk-AWXT2WGR.js";import"./chunk-C7LM5UCK.js";import{a as z,b as U}from"./chunk-J4XRJAME.js";import{a as te,b as ye,c as Pe,d as be,e as Oe,f as Ie,g as Je}from"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{o as Ke,w as B,x as V}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{e as H,f as _e,j as re,k as ge,l as xe,m as he,n as Ye,o as Ce,v as Se,x as Z,y as ve}from"./chunk-FMVCTBCQ.js";import{a as fe}from"./chunk-ZGXJEG37.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{D as ae,F as ze,G,N as k,f as L,j as He,m as w}from"./chunk-B63BKC6F.js";import{Ac as ie,Cb as _,Ga as R,Jc as Ue,Kb as s,Kc as je,Mc as u,Nb as F,Pb as $e,Qb as P,Sb as b,Tb as O,Ub as a,Vb as i,Wb as $,X as j,Yc as X,Z as D,_b as v,ba as ue,bb as Ve,c as se,dc as y,ec as c,gb as p,ha as h,pa as C,qa as S,qc as m,rc as d,s as Q,sc as I,uc as We,wb as T,yc as de,zc as E}from"./chunk-JP6RBSB3.js";import{a as f,b as x}from"./chunk-YQFG5XE2.js";var A=(()=>{class t{constructor(){this.httpService=h(fe)}getGlobalConfiguration(){return this.httpService.get(void 0,"/api/setup/GlobalConfiguration")}saveGlobalConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitGlobalConfiguration",e)}fetchPOSOutletConfiguration(e){return this.httpService.get(void 0,"/api/Setup/OutletConfiguration",{params:e})}fetchPOSOutletFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"/api/Setup/OutletConfigurationForm",n)}updatePOSOutletConfiguration(e){return this.httpService.post(void 0,"/api/Setup/SubmitOutletConfiguration",e)}fetchPOSPaymentConfiguration(e){return this.httpService.get(void 0,"/api/Setup/PaymentConfiguration",{params:e})}fetchPOSPaymentFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"api/Setup/PaymentConfigurationForm",n)}updatePOSPaymentConfiguration(e){return this.httpService.post(void 0,"/api/Setup/SubmitPaymentConfiguration",e)}fetchPOSTaxConfiguration(){return this.httpService.get(void 0,"/api/setup/TaxConfigurationForm")}updatePOSTaxConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitTaxConfiguration",e)}fetchPOSWriteOffConfiguration(){return this.httpService.get(void 0,"/api/setup/WriteOffConfigurationList")}fetchPOSWriteOffFormConfiguration(e){let n={params:e};return this.httpService.get(void 0,"/api/setup/WriteOffConfigurationForm",n)}updatePOSWriteOffConfiguration(e){return this.httpService.post(void 0,"/api/setup/SubmitWriteOffConfiguration",e)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=ue({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var N=function(t){return t.POSGLOBAL_SELL="Sell",t.POSGLOBAL_BUY="Buy",t.POSGLOBAL_ADJUSTMENT="Adjustment",t.POSGLOBAL_PREPAID="Prepaid",t.POSGLOBAL_RETURN="Return",t.POSGLOBAL_DEBT="Debt",t.POSGLOBAL_PAYMENTFEE="Payment Fee",t.POSGLOBAL_MANUFACTURING="Manufacturing",t.POSGLOBAL_ADVANCE="Advance",t}(N||{});var it={[N.POSGLOBAL_SELL]:[{typeID:2,side:"debit",label:"Account Receivable"},{typeID:1,side:"credit",label:"Sales"},{typeID:4,side:"debit",label:"COGS"},{typeID:3,side:"credit",label:"Sold Inventory"},{typeID:10,side:"debit",label:"Sales Discount"}],[N.POSGLOBAL_BUY]:[{typeID:27,side:"debit",label:"Pending Paid Inventory"},{typeID:5,side:"credit",label:"Account Payable"},{typeID:28,side:"debit",label:"Inventory Bought"},{typeID:27,side:"credit",label:"Pending Paid Inventory"},{typeID:11,side:"credit",label:"Purchase Discount"}],[N.POSGLOBAL_ADJUSTMENT]:[{typeID:26,side:"debit",label:"Adjustment Asset"},{typeID:21,side:"credit",label:"Adjustment Expense"}],[N.POSGLOBAL_PREPAID]:[{typeID:29,side:"debit",label:"Accounting for Prepaid"},{typeID:30,side:"debit",label:"Sales For Prepaid"}],[N.POSGLOBAL_RETURN]:[{typeID:8,side:"debit",label:"Sales Return"},{typeID:27,side:"debit",label:"Inventory"},{typeID:4,side:"credit",label:"COGS"},{typeID:9,side:"credit",label:"Purchase Return"}],[N.POSGLOBAL_DEBT]:[{typeID:17,side:"debit",label:"Consignment Payable"}],[N.POSGLOBAL_PAYMENTFEE]:[{typeID:19,side:"debit",label:"Payment Fee"},{typeID:20,side:"credit",label:"Surcharge"}],[N.POSGLOBAL_MANUFACTURING]:[{typeID:24,side:"debit",label:"Finished Goods"},{typeID:23,side:"credit",label:"Raw Material"},{typeID:25,side:"credit",label:"Production Expenses"}],[N.POSGLOBAL_ADVANCE]:[{typeID:15,side:"debit",label:"Crossing Account"},{typeID:16,side:"debit",label:"Retained Earnings"},{typeID:18,side:"debit",label:"Current Earnings"}]};function gt(t,r){if(t&1){let e=v();a(0,"div",5)(1,"p-button",6),y("onClick",function(){C(e);let o=c();return S(o.onSubmit())}),i()()}}function xt(t,r){if(t&1&&(a(0,"p-tab",10),m(1),i()),t&2){let e=r.$implicit;s("value",e.value),p(),d(e.label)}}function ht(t,r){if(t&1&&(a(0,"div",19)(1,"div")(2,"span"),m(3),i()(),a(4,"div")(5,"span"),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function Ct(t,r){if(t&1&&(a(0,"div",19)(1,"div")(2,"span"),m(3),i()(),a(4,"div")(5,"span"),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function St(t,r){if(t&1&&(a(0,"div",14)(1,"div",15)(2,"div",5)(3,"label",16),m(4),i(),a(5,"span",17),m(6),i()(),a(7,"p-select",18),_(8,ht,7,2,"ng-template",null,2,u)(10,Ct,7,2,"ng-template",null,3,u),i()()()),t&2){let e=r.$implicit,n=c(4);s("formGroupName",e.index),p(4),d(e.entry.value.label),p(2),d(e.entry.value.side),p(),s("options",n.posIntegration().options.accounts)}}function vt(t,r){if(t&1&&(a(0,"div",19)(1,"div")(2,"span"),m(3),i()(),a(4,"div")(5,"span"),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function yt(t,r){if(t&1&&(a(0,"div",19)(1,"div")(2,"span"),m(3),i()(),a(4,"div")(5,"span"),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function Pt(t,r){if(t&1&&(a(0,"div",14)(1,"div",15)(2,"div",5)(3,"label",16),m(4),i(),a(5,"span",20),m(6),i()(),a(7,"p-select",18),_(8,vt,7,2,"ng-template",null,2,u)(10,yt,7,2,"ng-template",null,3,u),i()()()),t&2){let e=r.$implicit,n=c(4);s("formGroupName",e.index),p(4),d(e.entry.value.label),p(2),d(e.entry.value.side),p(),s("options",n.posIntegration().options.accounts)}}function bt(t,r){if(t&1&&(a(0,"p-tabpanel",10)(1,"div",11)(2,"div",12)(3,"div",13),b(4,St,12,4,"div",14,P),i()(),a(6,"div",12)(7,"div",13),b(8,Pt,12,4,"div",14,P),i()()()()),t&2){let e=r.$implicit,n=c(3);s("value",e.value),p(),s("formGroupName",e.value),p(3),O(n.getDebitEntries(e.value)),p(4),O(n.getCreditEntries(e.value))}}function Ot(t,r){if(t&1){let e=v();a(0,"form",8),y("ngSubmit",function(){C(e);let o=c(2);return S(o.onSubmit())}),a(1,"p-tabs",9)(2,"p-tablist"),b(3,xt,2,2,"p-tab",10,P),i(),a(5,"p-tabpanels"),b(6,bt,10,2,"p-tabpanel",10,P),i()()()}if(t&2){let e=c(2);s("formGroup",e.accountForm),p(),s("value",e.tab())("lazy",!0),p(2),O(e.tabs()),p(3),O(e.tabs())}}function It(t,r){if(t&1&&_(0,Ot,8,3,"form",7),t&2){let e=c();s("ngIf",e.posIntegration()&&e.accountForm)}}var at=(()=>{class t{constructor(){this.posConfigService=h(A),this.fb=h(Se),this.tab=R(N.POSGLOBAL_SELL),this.tabs=R(Object.values(N).map(e=>({label:e,value:e}))),this.posIntegration=R(null),this.form=R([]),this.descriptionsMap=new Map,this.objectKeys=Object.keys,this.posGlobalTabEnum=N}ngOnInit(){this.posConfigService.getGlobalConfiguration().pipe(D(e=>{this.posIntegration.set(e),this.form.set(e.form),this.descriptionsMap=new Map(e.descriptions.map(n=>[+n.id,n.name])),this.initializeForm()})).subscribe()}initializeForm(){let e={};this.tabs().forEach(n=>{let o=this.getEntriesForTab(n.value);console.log(`Entries for ${n.value}:`,o),e[n.value]=this.fb.array(o.map(l=>this.createEntryFormGroup(l)))}),this.accountForm=this.fb.group(e)}createEntryFormGroup(e){let n=this.fb.group({typeID:[e.typeID],label:[e.label],side:[e.side],accountID:[this.getAccountIDByTypeID(e.typeID)]});return n.get("accountID").valueChanges.subscribe(o=>{this.syncAccountIDs(e.typeID,o,n)}),n}getAccountIDByTypeID(e){return this.form().find(o=>o.typeID===e)?.accountID||""}getEntriesForTab(e){return it[e]||[]}getTabEntries(e){return this.accountForm.get(e)}onSubmit(){let e=this.accountForm.getRawValue(),n=[],o=new Set;for(let l of Object.values(e))for(let{typeID:g,accountID:W}of l){let Be=`${g}_${W}`;o.has(Be)||(o.add(Be),n.push({typeID:g,accountID:W||Qe}))}console.log("Form submitted with value:",n),this.posConfigService.saveGlobalConfiguration({form:n}).subscribe({next:()=>console.log("Save successful"),error:l=>console.error("Save failed",l)})}getDebitEntries(e){return this.getTabEntries(e).controls.map((n,o)=>({entry:n,index:o})).filter(n=>n.entry.value.side==="debit")}getCreditEntries(e){return this.getTabEntries(e).controls.map((n,o)=>({entry:n,index:o})).filter(n=>n.entry.value.side==="credit")}syncAccountIDs(e,n,o){Object.values(this.accountForm.controls).forEach(l=>{l.controls.forEach(g=>{g!==o&&g.get("typeID")?.value===e&&g.get("accountID")?.value!==n&&g.get("accountID")?.setValue(n,{emitEvent:!1})})})}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-global"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],["pageTitle","POS Integration"],[1,"d-flex","gap-2"],["label","Submit",3,"onClick"],[3,"formGroup","ngSubmit",4,"ngIf"],[3,"ngSubmit","formGroup"],[1,"border-top",3,"value","lazy"],[3,"value"],[1,"row",3,"formGroupName"],[1,"col"],[1,"row","gap-3"],[1,"col-12",3,"formGroupName"],[1,"form-group","d-flex","flex-column"],["for","",1,"fs-3"],[1,"text-success","fs-3"],["filter","","filterBy","code,name","formControlName","accountID","optionLabel","name","optionValue","id",3,"options"],[1,"d-flex","align-items-center","gap-2"],[1,"text-danger","fs-3"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,gt,2,0,"ng-template",null,0,u)(3,It,1,1,"ng-template",null,1,u),i())},dependencies:[M,ot,nt,tt,et,Xe,Ze,Ke,J,K,Z,ge,H,_e,w,L,k,V,B,ve,xe,Ce,he],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Et=t=>[t];function Tt(t,r){if(t&1&&(a(0,"th",7),m(1),i()),t&2){let e=r.$implicit;p(),d(e.name.slice(0,10))}}function Ft(t,r){if(t&1&&(a(0,"tr")(1,"th",6),m(2,"Method"),i()(),a(3,"tr"),b(4,Tt,2,1,"th",7,P),i()),t&2){let e=c(3);p(4),O(e.paymentConfiguration().outlets)}}function wt(t,r){if(t&1&&(a(0,"td"),m(1),i()),t&2){let e=r.$implicit;p(),d(e.accountName)}}function Mt(t,r){if(t&1&&(a(0,"tr")(1,"td",8)(2,"a",9),m(3),i()(),b(4,wt,2,1,"td",null,P),i()),t&2){let e=r.$implicit;p(2),s("routerLink",ie(2,Et,e.id)),p(),d(e.name),p(),O(e.accounts)}}function Dt(t,r){if(t&1&&(a(0,"p-table",5),_(1,Ft,6,0,"ng-template",null,1,u)(3,Mt,6,4,"ng-template",null,2,u),i()),t&2){let e=c(2);s("scrollable",!0)("scrollHeight","calc(100vh - 70px)")("value",e.paymentConfiguration().payment)}}function Rt(t,r){if(t&1){let e=v();a(0,"app-main-panel",4),y("search",function(o){C(e);let l=c();return S(l.onSearch(o))}),_(1,Dt,5,3,"ng-template",null,0,u),i()}t&2&&s("isSearchableInput",!0)}var rt=(()=>{class t{constructor(){this.POSSetupService=h(A),this.paymentConfiguration=R(null)}ngOnInit(){this.POSSetupService.fetchPOSPaymentConfiguration({}).pipe(D(e=>{this.paymentConfiguration.set(e)})).subscribe()}onSearch(e){this.POSSetupService.fetchPOSPaymentConfiguration({Search:e}).pipe(D(n=>{this.paymentConfiguration.set(n)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-payment"]],decls:1,vars:1,consts:[["content",""],["header",""],["body",""],["pageTitle","Payment Method Accounting",3,"isSearchableInput","search",4,"ngIf"],["pageTitle","Payment Method Accounting",3,"search","isSearchableInput"],[3,"scrollable","scrollHeight","value"],["rowspan","3",2,"min-width","300px"],[2,"min-width","200px"],["pFrozenColumn",""],[1,"link-primary",3,"routerLink"]],template:function(n,o){n&1&&_(0,Rt,3,1,"app-main-panel",3),n&2&&s("ngIf",o.paymentConfiguration())},dependencies:[M,oe,ne,qe,w,L,k,G],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var kt={data:{listOutletAccount:[],listCOAType:[],pageNumber:1,pageSize:20,totalCount:0,totalPages:0},filter:{PageNumber:1,PageSize:20,Search:""}},Le=ye(Ie(kt),Pe(t=>({first:X(()=>(t.filter().PageNumber-1)*t.filter().PageSize+1),end:X(()=>Math.min(t.filter().PageNumber*t.filter().PageSize,t.data().totalCount))})),Oe(t=>{let r=h(A);return{updateFilter:n=>{te(t,o=>x(f({},o),{filter:f(f({},o.filter),n)}))},getPOSOutlets:Te(se(j(n=>r.fetchPOSOutletConfiguration(n).pipe(Fe({next:o=>{te(t,l=>x(f({},l),{data:o}))},error:o=>{console.error("Error fetching POS outlets:",o)}})))))}}),be(t=>({onInit:()=>{t.getPOSOutlets(t.filter)}})));var At=()=>({height:"calc(100vh - 70px)"}),Nt=t=>[t];function Lt(t,r){if(t&1&&(a(0,"th"),m(1),i()),t&2){let e=r.$implicit;p(),d(e.value)}}function Gt(t,r){if(t&1&&(a(0,"tr")(1,"th"),m(2,"Name"),i(),b(3,Lt,2,1,"th",null,P),i()),t&2){let e=c(2);p(3),O(e.store.data().listCOAType)}}function Bt(t,r){if(t&1&&(a(0,"td"),m(1),i()),t&2){let e=r.$implicit;p(),d(e)}}function Vt(t,r){if(t&1&&(a(0,"tr")(1,"td")(2,"a",7),m(3),i()(),b(4,Bt,2,1,"td",null,P),i()),t&2){let e=r.$implicit;p(2),s("routerLink",ie(2,Nt,e.OutletID)),p(),I(" ",e.OutletName,""),p(),O(e.Accounts)}}function $t(t,r){if(t&1&&m(0),t&2){let e=c(2);We(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Wt(t,r){t&1&&(a(0,"tr")(1,"td",8)(2,"span"),m(3," No journal entries found. "),i()()())}function Ut(t,r){if(t&1){let e=v();a(0,"p-panel")(1,"p-table",6),y("onPage",function(o){C(e);let l=c();return S(l.onPage(o))}),_(2,Gt,5,0,"ng-template",null,1,u)(4,Vt,6,4,"ng-template",null,2,u)(6,$t,1,3,"ng-template",null,3,u)(8,Wt,4,0,"ng-template",null,4,u),i()()}if(t&2){let e=c();F(E(11,At)),p(),s("scrollable",!0)("scrollHeight","calc(100vh - 100px)")("value",e.store.data().listOutletAccount)("paginator",!0)("rows",e.store.filter().PageSize)("lazy",!0)("scrollable",!0)("scrollHeight","calc(100vh - 142px)")("totalRecords",e.store.data().totalCount)}}var pt=(()=>{class t{constructor(){this.store=h(Le)}onSearch(e){this.store.updateFilter({PageNumber:1,PageSize:20,Search:e})}onPage(e){let n=e.first/e.rows+1;this.store.updateFilter(x(f({},this.store.filter()),{PageSize:e.rows,PageNumber:n}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-outlet"]],features:[de([Le])],decls:3,vars:1,consts:[["content",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["pageTitle","Outlet Account",3,"search","isSearchableInput"],["styleClass","d-flex flex-column justify-content-between h-100",3,"onPage","scrollable","scrollHeight","value","paginator","rows","lazy","totalRecords"],[1,"link","link-primary",3,"routerLink"],["colspan","8"]],template:function(n,o){if(n&1){let l=v();a(0,"app-main-panel",5),y("search",function(W){return C(l),S(o.onSearch(W))}),_(1,Ut,10,12,"ng-template",null,0,u),i()}n&2&&s("isSearchableInput",!0)},dependencies:[M,w,Y,oe,ne,k,G,U,z],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var jt=()=>({height:"calc(100vh - 100px)"}),Ht=()=>({height:"calc(100vh - 150px)"});function zt(t,r){if(t&1){let e=v();a(0,"a",5),m(1,"Cancel"),i(),a(2,"p-button",6),y("onClick",function(){C(e);let o=c();return S(o.updatePOsOutletConfiguration())}),i()}}function Yt(t,r){if(t&1&&(a(0,"div",16)(1,"div",17)(2,"span"),m(3),i()(),a(4,"div",17)(5,"span",17),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function Kt(t,r){if(t&1&&(a(0,"div",16)(1,"div",17)(2,"span"),m(3),i()(),a(4,"div",18)(5,"span",17),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function Jt(t,r){if(t&1&&(a(0,"div",12)(1,"span",14),m(2),i(),a(3,"p-select",15),_(4,Yt,7,2,"ng-template",null,2,u)(6,Kt,7,2,"ng-template",null,3,u),i()()),t&2){let e,n=r.$implicit,o=r.$index,l=c(3);s("formGroupName",o),p(2),d((e=n.get("TypeName"))==null?null:e.value),p(),s("options",l.options.accounts)}}function qt(t,r){t&1&&$(0,"hr")}function Qt(t,r){if(t&1&&(a(0,"div",9)(1,"h3",10),m(2),Ue(3,"titlecase"),i(),a(4,"div",11),b(5,Jt,8,3,"div",12,P),i()(),_(7,qt,1,0,"hr",13)),t&2){let e,n=r.$implicit,o=r.$index,l=r.$index,g=r.$count,W=c(2);s("formGroupName",o),p(2),I(" ",je(3,3,(e=n.get("groupName"))==null?null:e.value)," "),p(3),O(W.getAccountsFormArray(l).controls),p(2),s("ngIf",l!==g-1)}}function Xt(t,r){if(t&1&&(a(0,"p-panel")(1,"p-scroll-panel")(2,"form",7)(3,"div",8),b(4,Qt,8,5,null,null,P),i()()()()),t&2){let e=c();F(E(5,jt)),p(),F(E(6,Ht)),p(),s("formGroup",e.accountsForm),p(2),O(e.accountGroupsArray.controls)}}var lt=(()=>{class t{constructor(){this.route=h(ae),this.POSSetupService=h(A),this.outletForm=R(null),this.allAccounts=[],this.options=null,this.outletName="",this.accountGroups=[{name:"sell",typeIds:[1,2],accounts:[]},{name:"delivery",typeIds:[3,4],accounts:[]},{name:"buy",typeIds:[27,11,28],accounts:[]},{name:"purchase return",typeIds:[9],accounts:[]},{name:"sales return",typeIds:[8],accounts:[]},{name:"adjustment",typeIds:[21,26],accounts:[]}],this.fb=h(Se)}ngOnInit(){this.accountsForm=this.fb.group({accountGroups:this.fb.array([])}),this.route.paramMap.pipe(Q(e=>e.get("id")),j(e=>this.POSSetupService.fetchPOSOutletFormConfiguration({outletID:e})),D(e=>{this.allAccounts=e.form,this.options=e.options,this.outletName=e.form[0].OutletName,this.accountGroups.forEach(o=>{o.accounts=this.allAccounts.filter(l=>o.typeIds.includes(l.TypeID))});let n=this.accountsForm.get("accountGroups");this.accountGroups.forEach(o=>{n.push(this.createAccountGroupControl(o))})})).subscribe()}get accountGroupsArray(){return this.accountsForm.get("accountGroups")}getAccountsFormArray(e){return this.accountGroupsArray.at(e).get("accounts")}createAccountGroupControl(e){return this.fb.group({groupName:[e.name],accounts:this.fb.array(e.accounts.map(n=>this.createAccountControl(n)))})}createAccountControl(e){return this.fb.group({AccountID:[e.AccountID],TypeID:[e.TypeID],TypeName:[e.TypeName],OutletID:[e.OutletID],OutletName:[e.OutletName]})}updatePOsOutletConfiguration(){let{accountGroups:e}=this.accountsForm.value,n={form:e.flatMap(o=>o.accounts.map(l=>({AccountID:l.AccountID,TypeID:l.TypeID,TypeName:l.TypeName,OutletID:l.OutletID,OutletName:l.OutletName})))};this.POSSetupService.updatePOSOutletConfiguration(n).pipe().subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-outlet-form"]],decls:5,vars:2,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"pageTitle","hasMainWrapperPadding"],["routerLink","/pages/pos-setup/outlets",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"onClick"],[1,"",3,"formGroup"],["formArrayName","accountGroups",1,"d-flex","flex-column","gap-2"],[1,"row",3,"formGroupName"],[1,"fs-4","fw-semibold"],["formArrayName","accounts",1,"row","row-gap-3"],[1,"col-6",3,"formGroupName"],[4,"ngIf"],[1,"fs-3"],["formControlName","AccountID","filter","","filterBy","code,name","optionLabel","name","optionValue","id","placeholder","Select an account",1,"w-100",3,"options"],[1,"d-flex","gap-2"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,zt,3,0,"ng-template",null,0,u)(3,Xt,6,7,"ng-template",null,1,u),i()),n&2&&s("pageTitle","Edit "+o.outletName)("hasMainWrapperPadding",!0)},dependencies:[M,w,L,He,Y,ve,ge,H,_e,xe,Ce,he,Ye,J,K,U,z,ee,V,B,k,G],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var en=()=>({height:"calc(100vh - 100px)"}),tn=()=>({width:"100%",height:"calc(100vh - 150px)"}),nn=()=>({width:"100%"});function on(t,r){if(t&1){let e=v();a(0,"a",6),m(1,"Cancel"),i(),a(2,"p-button",7),y("onClick",function(){C(e);let o=c(3);return S(o.updatePOSOutletConfiguration())}),i()}}function an(t,r){if(t&1&&(a(0,"div",16)(1,"div",17)(2,"span"),m(3),i()(),a(4,"div",17)(5,"span",17),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function rn(t,r){if(t&1&&(a(0,"div",16)(1,"div",17)(2,"span"),m(3),i()(),a(4,"div",18)(5,"span",17),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function pn(t,r){if(t&1){let e=v();a(0,"div",9)(1,"div",10)(2,"div",11)(3,"label",12),m(4),i()(),$(5,"div",13),a(6,"div",14)(7,"p-select",15),y("ngModelChange",function(o){let l=C(e).$index,g=c(4);return S(g.updateAccountById(o,l))}),_(8,an,7,2,"ng-template",null,2,u)(10,rn,7,2,"ng-template",null,3,u),i()()()()}if(t&2){let e=r.$implicit,n=r.$index,o=c(4);p(4),d(e.outletName.slice(0,15)),p(3),F(E(7,nn)),s("ngModel",o.paymentForm().form.accounts[n].accountID)("virtualScroll",!0)("virtualScrollItemSize",50)("options",o.paymentForm().options.chartOfAccount)}}function ln(t,r){if(t&1&&(a(0,"p-card")(1,"p-scrollpanel")(2,"div",8),b(3,pn,12,8,"div",9,P),i()()()),t&2){let e=c(3);F(E(4,en)),p(),F(E(5,tn)),p(2),O(e.paymentForm().form.accounts)}}function mn(t,r){if(t&1&&(a(0,"app-main-panel",4),_(1,on,3,0,"ng-template",null,0,u)(3,ln,5,6,"ng-template",null,1,u),i()),t&2){let e=c(2);s("pageTitle",e.paymentForm().form.paymentMethod.name+" Form Accounting")("hasMainWrapperPadding",!0)}}function cn(t,r){if(t&1&&_(0,mn,5,2,"app-main-panel",5),t&2){let e=c();s("ngIf",e.paymentForm())}}var ct=(()=>{class t{constructor(){this.route=h(ae),this.POSSetupService=h(A),this.paymentForm=R(null),this.router=h(ze)}ngOnInit(){this.route.paramMap.pipe(Q(e=>+e.get("id")),j(e=>this.POSSetupService.fetchPOSPaymentFormConfiguration({ID:e})),D(e=>{this.paymentForm.set(e)}),Ae("response")).subscribe()}updateAccountById(e,n){let o=this.paymentForm().form.accounts,l=x(f({},this.paymentForm()),{form:x(f({},this.paymentForm().form),{accounts:o.map((g,W)=>W===n?x(f({},g),{accountID:e}):g)})});this.paymentForm.set(l)}updatePOSOutletConfiguration(){let e={form:[...this.paymentForm().form.accounts]};this.POSSetupService.updatePOSPaymentConfiguration(e).pipe(Ae("response"),D(()=>{this.router.navigate(["/pages/pos-setup/payments"])})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-payment-form"]],decls:1,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"pageTitle","hasMainWrapperPadding"],[3,"pageTitle","hasMainWrapperPadding",4,"ngIf"],["routerLink","/pages/pos-setup/payments",1,"p-button","p-button-outlined","p-button-secondary"],["label","Submit",3,"onClick"],[1,"row","row-gap-3"],[1,"col-6","d-flex","flex-column","gap-2"],[1,"row","row-gap-4"],[1,"col-2"],["for",""],[1,"col-3"],[1,"col-7"],["filter","","filterBy","name,code","optionLabel","name","optionValue","id","placeholder","Select an account",1,"w-full",3,"ngModelChange","ngModel","virtualScroll","virtualScrollItemSize","options"],[1,"d-flex","gap-2"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&_(0,cn,1,1,"app-main-panel",4),n&2&&$e(o.paymentForm()?0:-1)},dependencies:[Y,Ee,M,w,L,pe,ee,J,K,Z,H,re,k,G,V,B,U],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var sn=()=>({height:"calc(100vh - 70px)"}),un=()=>({width:"100%",height:"calc(100vh - 100px)"});function dn(t,r){if(t&1){let e=v();a(0,"div",5)(1,"a",6),m(2,"Cancel"),i(),a(3,"p-button",7),y("onClick",function(){C(e);let o=c();return S(o.updatePOSTaxConfiguration())}),i()()}}function fn(t,r){if(t&1&&(a(0,"div",5)(1,"div",15)(2,"span"),m(3),i()(),a(4,"div",15)(5,"span",15),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function _n(t,r){if(t&1&&(a(0,"div",5)(1,"div",15)(2,"span"),m(3),i()(),a(4,"div",16)(5,"span",15),m(6),i()()()),t&2){let e=r.$implicit;p(3),I("(",e.code,")"),p(3),d(e.name)}}function gn(t,r){if(t&1){let e=v();a(0,"div",11)(1,"div",12)(2,"label",13),m(3),i(),a(4,"p-select",14),y("ngModelChange",function(o){let l=C(e).$index,g=c(2);return S(g.updateAccountID(o,l))}),_(5,fn,7,2,"ng-template",null,2,u)(7,_n,7,2,"ng-template",null,3,u),i()()()}if(t&2){let e=r.$implicit,n=r.$index,o=c(2);p(3),d(e.name),p(),s("options",o.taxForm().options.chartOfAccount)("ngModel",o.taxForm().form[n].accountID)}}function xn(t,r){if(t&1&&(a(0,"p-panel")(1,"p-scroll-panel")(2,"div",8)(3,"div",9)(4,"div",10),b(5,gn,9,3,"div",11,P),i()()()()()),t&2){let e=c();F(E(4,sn)),p(),F(E(5,un)),p(4),O(e.taxForm().form)}}var st=(()=>{class t{constructor(){this.POSSetupService=h(A),this.taxForm=R(null)}ngOnInit(){this.POSSetupService.fetchPOSTaxConfiguration().pipe(D(e=>{this.taxForm.set(e)})).subscribe()}updateAccountID(e,n){let o=this.taxForm().form,l=x(f({},this.taxForm()),{form:o.map((g,W)=>W===n?x(f({},g),{accountID:e}):g)});this.taxForm.set(l)}updatePOSTaxConfiguration(){let e={form:[...this.taxForm().form]};this.POSSetupService.updatePOSTaxConfiguration(e).pipe(D(n=>console.log(n))).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-tax"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],["pageTitle","Tax Setup"],[1,"d-flex","gap-2"],["routerLink","..",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"onClick"],[1,"row"],[1,"col-4"],[1,"row","row-gap-3"],[1,"col-12"],[1,"d-flex","flex-column"],["for",""],["filter","","filterBy","name,code","optionLabel","name","optionValue","id","placeholder","Select an Account",3,"ngModelChange","options","ngModel"],[1,""],[1,"d-inline-block","text-truncate",2,"max-width","250px"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,dn,4,0,"ng-template",null,0,u)(3,xn,7,6,"ng-template",null,1,u),i())},dependencies:[M,Y,w,J,K,pe,ee,Z,H,re,k,G,V,B,U,z],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var hn=()=>({height:"calc(100vh - 70px)"}),Cn=()=>({"min-width":"50rem"}),Sn=t=>[t];function vn(t,r){t&1&&$(0,"p-button",6)}function yn(t,r){if(t&1&&_(0,vn,1,0,"p-button",5),t&2){let e=c();s("ngIf",e.hasCheckedItems())}}function Pn(t,r){t&1&&(a(0,"tr")(1,"th",9),$(2,"p-tableHeaderCheckbox"),i(),a(3,"th"),m(4,"Name"),i(),a(5,"th"),m(6,"Description"),i()())}function bn(t,r){if(t&1&&(a(0,"tr")(1,"td"),$(2,"p-tableCheckbox",10),i(),a(3,"td")(4,"a",11),m(5),i()(),a(6,"td"),m(7),i()()),t&2){let e=r.$implicit;p(2),s("value",e),p(2),s("routerLink",ie(4,Sn,e.id)),p(),d(e.name),p(2),d(e.description)}}function On(t,r){if(t&1){let e=v();a(0,"p-panel")(1,"p-table",8),y("onRowSelect",function(o){C(e);let l=c(2);return S(l.onRowSelect(o))})("onRowUnselect",function(o){C(e);let l=c(2);return S(l.onRowSelect(o))})("onHeaderCheckboxToggle",function(o){C(e);let l=c(2);return S(l.onSelectAll(o))}),_(2,Pn,7,0,"ng-template",null,2,u)(4,bn,8,6,"ng-template",null,3,u),i()()}if(t&2){let e=c(2);F(E(4,hn)),p(),s("value",e.writeoffList().data)("tableStyle",E(5,Cn))}}function In(t,r){if(t&1&&_(0,On,6,6,"p-panel",7),t&2){let e=c();s("ngIf",e.writeoffList())}}var ut=(()=>{class t{constructor(){this.POSSetupService=h(A),this.writeoffList=R(null),this.hasCheckedItems=X(()=>{let e=this.writeoffList();return!e||!e.data||!Array.isArray(e.data)?!1:e.data.some(n=>n&&n.checked===!0)})}ngOnInit(){this.POSSetupService.fetchPOSWriteOffConfiguration().pipe(Q(e=>x(f({},e),{data:e.data.map(n=>x(f({},n),{checked:!1}))})),D(e=>{this.writeoffList.set(e)})).subscribe()}onRowSelect(e){console.log("Selected Row:",e.data);let n=this.writeoffList();if(!n||!n.data)return;let o=n.data.findIndex(l=>l.id===e.data.id);if(o!==-1){let l=[...n.data];l[o]=x(f({},l[o]),{checked:!l[o].checked}),this.writeoffList.set(x(f({},n),{data:l}))}}onSelectAll(e){let n=this.writeoffList();if(!n?.data)return;let o=n.data.map(l=>x(f({},l),{checked:e.checked}));this.writeoffList.set(x(f({},n),{data:o}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-writeoff"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["body",""],["pageTitle","Write Off"],["severity","danger","label","Delete","icon","fa-solid fa-trash",4,"ngIf"],["severity","danger","label","Delete","icon","fa-solid fa-trash"],[3,"style",4,"ngIf"],["dataKey","id",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value","tableStyle"],[2,"width","1rem"],[3,"value"],[1,"link-primary",3,"routerLink"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,yn,1,1,"ng-template",null,0,u)(3,In,1,1,"ng-template",null,1,u),i())},dependencies:[M,w,L,oe,ne,we,Me,k,G,V,B,U,z],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var En=()=>({witdh:"100%",height:"calc(100vh - 150px)"});function Tn(t,r){if(t&1){let e=v();a(0,"div",6)(1,"a",7),m(2,"Cancel"),i(),a(3,"p-button",8),y("onClick",function(){C(e);let o=c(2);return S(o.updateWriteOffConfiguration())}),i()()}}function Fn(t,r){if(t&1&&(a(0,"div",6)(1,"span",16),m(2),i(),a(3,"span",16),m(4),i()()),t&2){let e=r.$implicit;p(2),I("(",e.code,")"),p(2),d(e.name)}}function wn(t,r){if(t&1&&(a(0,"div",6)(1,"span",16),m(2),i(),a(3,"span",16),m(4),i()()),t&2){let e=r.$implicit;p(2),I("(",e.code,")"),p(2),d(e.name)}}function Mn(t,r){if(t&1){let e=v();a(0,"div",12)(1,"div",13)(2,"label",14),m(3),i(),a(4,"p-select",15),y("ngModelChange",function(o){let l=C(e).$index,g=c(3);return S(g.updateAccountById(o,l))}),_(5,Fn,5,2,"ng-template",null,2,u)(7,wn,5,2,"ng-template",null,3,u),i()()()}if(t&2){let e=r.$implicit,n=c(3);p(3),d(e.name),p(),s("ngModel",e.accountID)("options",n.writeOffForm().options.account)("virtualScroll",!0)("virtualScrollItemSize",50)}}function Dn(t,r){if(t&1&&(a(0,"p-card")(1,"p-scroll-panel")(2,"div",9)(3,"div",10)(4,"div",11),b(5,Mn,9,5,"div",12,P),i()()()()()),t&2){let e=c(2);p(),F(E(2,En)),p(4),O(e.writeOffForm().form)}}function Rn(t,r){if(t&1&&(a(0,"app-main-panel",5),_(1,Tn,4,0,"ng-template",null,0,u)(3,Dn,7,3,"ng-template",null,1,u),i()),t&2){let e=c();s("pageTitle","Write Off Form "+e.writeOffForm().info.name)("hasMainWrapperPadding",!0)}}var dt=(()=>{class t{constructor(){this.POSSetupService=h(A),this.route=h(ae),this.writeOffForm=R(null)}ngOnInit(){this.route.paramMap.pipe(Q(e=>e.get("id")),j(e=>this.POSSetupService.fetchPOSWriteOffFormConfiguration({ID:e})),D(e=>this.writeOffForm.set(e))).subscribe()}updateAccountById(e,n){let o=this.writeOffForm().form,l=x(f({},this.writeOffForm()),{form:o.map((g,W)=>W===n?x(f({},g),{accountID:e}):g)});this.writeOffForm.set(l)}updateWriteOffConfiguration(){let e={form:this.writeOffForm().form};this.POSSetupService.updatePOSWriteOffConfiguration(e).pipe().subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-writeoff-form"]],decls:1,vars:1,consts:[["actionButton",""],["content",""],["selectedItem",""],["item",""],[3,"pageTitle","hasMainWrapperPadding",4,"ngIf"],[3,"pageTitle","hasMainWrapperPadding"],[1,"d-flex","gap-2"],["routerLink","/pages/pos-setup/writeoff",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"onClick"],[1,"row"],[1,"col"],[1,"row","row-gap-3"],[1,"col-3"],[1,"d-flex","flex-column"],["for","",1,"d-inline-block","text-truncate",2,"max-width","300px"],["filter","","filterBy","name,code","optionLabel","name","filter","","filterBy","name,code","optionValue","id","placeholder","Select an account",3,"ngModelChange","ngModel","options","virtualScroll","virtualScrollItemSize"],[1,""]],template:function(n,o){n&1&&_(0,Rn,5,2,"app-main-panel",4),n&2&&s("ngIf",o.writeOffForm())},dependencies:[M,w,L,Y,Ee,pe,ee,J,K,Z,H,re,k,G,V,B],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var ft=(()=>{class t{constructor(){this.httpService=h(fe)}getExpenseOptions(){return this.httpService.get(void 0,"/api/SetupExpenseOption/GetExpenseOptions")}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=ue({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var kn={data:{expenseOptions:[]}},Ge=ye(Ie(kn),Je("POSExpenseOptionStore"),Pe(t=>({hasCheckedRows:X(()=>t.data().expenseOptions.some(r=>r.checked)),checkedInvoice:X(()=>t.data().expenseOptions.filter(r=>r.checked).map(r=>r.id))})),Oe(t=>{let r=h(ft);return{onRowSelect(n){te(t,o=>{let l=o.data.expenseOptions.map(g=>g.id===n.id?x(f({},g),{checked:!0}):g);return x(f({},o),{data:x(f({},o.data),{expenseOptions:l})})})},onRowUnselect(n){te(t,o=>{let l=o.data.expenseOptions.map(g=>g.id===n.id?x(f({},g),{checked:!1}):g);return x(f({},o),{data:x(f({},o.data),{expenseOptions:l})})})},onHeaderCheckboxToggle(n){te(t,o=>{let l=o.data.expenseOptions.map(g=>x(f({},g),{checked:n}));return x(f({},o),{data:x(f({},o.data),{expenseOptions:l})})})},getExpenseOptions:Te(se(j(()=>r.getExpenseOptions().pipe(Fe({next:n=>{te(t,o=>x(f({},o),{data:x(f({},o.data),{expenseOptions:n.expenseOptions.map(l=>x(f({},l),{checked:!1}))})}))},error:n=>{console.error("Error fetching expense options:",n)}})))))}}),be({onInit:t=>{t.getExpenseOptions()}}));var An=()=>({height:"calc(100vh - 70px)"});function Nn(t,r){t&1&&$(0,"p-button",6)}function Ln(t,r){if(t&1&&_(0,Nn,1,0,"p-button",5),t&2){let e=c();s("ngIf",e.store.hasCheckedRows())}}function Gn(t,r){t&1&&(a(0,"tr")(1,"th",8),$(2,"p-tableHeaderCheckbox"),i(),a(3,"th"),m(4,"Name"),i(),a(5,"th"),m(6,"Account"),i(),a(7,"th"),m(8,"Description"),i()())}function Bn(t,r){if(t&1&&(a(0,"tr")(1,"td"),$(2,"p-tableCheckbox",9),i(),a(3,"td"),m(4),i(),a(5,"td"),m(6),i(),a(7,"td"),$(8,"p",10),i()()),t&2){let e=r.$implicit;p(2),s("value",e),p(2),d(e.name),p(2),d(e.accountName),p(2),s("innerHTML",e.description,Ve)}}function Vn(t,r){if(t&1){let e=v();a(0,"p-panel")(1,"p-table",7),y("onRowSelect",function(o){C(e);let l=c();return S(l.onRowSelect(o))})("onRowUnselect",function(o){C(e);let l=c();return S(l.onRowUnselect(o))})("onHeaderCheckboxToggle",function(o){C(e);let l=c();return S(l.onHeaderCheckboxToggle(o))}),_(2,Gn,9,0,"ng-template",null,2,u)(4,Bn,9,4,"ng-template",null,3,u),i()()}if(t&2){let e=c();F(E(3,An)),p(),s("value",e.store.data().expenseOptions)}}var _t=(()=>{class t{constructor(){this.store=h(Ge)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){Array.isArray(e.data)?e.data.forEach(n=>{this.store.onRowUnselect(n)}):this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=T({type:t,selectors:[["app-pos-expense-option"]],features:[de([Ge])],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["body",""],["pageTitle","Expense Option"],["label","Delete","severity","danger","icon","fa-solid fa-trash",4,"ngIf"],["label","Delete","severity","danger","icon","fa-solid fa-trash"],["dataKey","id",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value"],[2,"width","1rem"],[3,"value"],[3,"innerHTML"]],template:function(n,o){n&1&&(a(0,"app-main-panel",4),_(1,Ln,1,1,"ng-template",null,0,u)(3,Vn,6,4,"ng-template",null,1,u),i())},dependencies:[M,oe,ne,we,Me,U,z,V,B,w,L],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Ua=[{path:"",redirectTo:"global",pathMatch:"full"},{path:"",children:[{path:"global",component:at},{path:"outlets",component:pt},{path:"outlets/:id",component:lt},{path:"payments",component:rt},{path:"payments/:id",component:ct},{path:"taxs",component:st},{path:"writeoff",component:ut},{path:"writeoff/:id",component:dt},{path:"expense-option",component:_t}]}];export{Ua as POS_SETUP_ROUTES};
@@ -1 +1 @@
1
- import{a as Ke,b as Qe,c as Xe,d as Ye,e as Ze,f as et}from"./chunk-EDCDR4RJ.js";import{a as ze,b as Ue,c as qe}from"./chunk-B7WHT2EP.js";import{a as We,b as He}from"./chunk-HHDFSN55.js";import{a as Le}from"./chunk-MDH73MG3.js";import{b as $e}from"./chunk-ERFXO32T.js";import"./chunk-ZM5TVQUU.js";import{a as Ve,b as je}from"./chunk-YO23YVSC.js";import"./chunk-AZUQDRJU.js";import{a as Pe,b as Oe,d as ke,k as Re}from"./chunk-EW3R2HAB.js";import{a as Ne,b as Me}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import{a as Je}from"./chunk-XKCLERWG.js";import{a as K,b as Q}from"./chunk-4LGDNQMZ.js";import"./chunk-PKN47FQE.js";import{a as Ge,b as Be}from"./chunk-LRRVQSMI.js";import"./chunk-42UIGXWH.js";import{a as De,b as we}from"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{b as X}from"./chunk-5R3XKSDM.js";import{h as M}from"./chunk-UYC454VQ.js";import"./chunk-C7LM5UCK.js";import{a as j,b as $}from"./chunk-J4XRJAME.js";import"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{n as H,o as N,w as J,x as V}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{Ia as Ie,Ma as Te,b as G,c as re,e as T,f as B,j as Ae,l as P,m as q,n as Ee,o as O,v as k,x as W,y as R}from"./chunk-FMVCTBCQ.js";import{a as Fe}from"./chunk-ZGXJEG37.js";import{a as ye}from"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{D as he,G as xe,N as Se,c as _e,f as be,l as Ce,m as I}from"./chunk-B63BKC6F.js";import{Ac as ne,Cb as g,Ga as z,Jc as ie,Kb as p,Kc as oe,L as pe,Mc as f,Nb as U,Qb as y,Sb as F,Tb as A,Ub as i,Vb as n,Wb as c,Y as ce,Z as w,_b as h,ba as ue,dc as E,ec as s,g as le,gb as a,ha as u,mb as se,pa as b,qa as C,qc as o,rc as x,s as me,sc as te,vc as de,wb as S,wc as fe,xc as ge,yc as ve,zc as D}from"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var _=(()=>{class t{#e=u(Fe);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)}formatJournal(e){return this.#e.post("","/api/setup/formatdata/clearjournal",{domain:e})}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275prov=ue({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var ut=()=>({height:"calc(100vh - 100px)"});function st(t,m){if(t&1){let e=h();i(0,"div",4)(1,"a",5),o(2,"Cancel"),n(),i(3,"p-button",6),E("click",function(){b(e);let l=s();return C(l.updateAccountingIntegration())}),n()()}}function dt(t,m){if(t&1&&(i(0,"p-tab",8),o(1),n()),t&2){let e=m.$implicit,r=m.$index;p("value",r),a(),x(e)}}function ft(t,m){if(t&1&&(i(0,"div",25),c(1,"p-radiobutton",43),i(2,"label",44),o(3),n()()),t&2){let e=m.$implicit;a(),p("value",e.key)("inputId",e.value),a(),p("for",e.value),a(),x(e.value)}}function gt(t,m){if(t&1&&(i(0,"div",40)(1,"div",25),c(2,"p-radiobutton",45),i(3,"label",44),o(4),n()()()),t&2){let e=m.$implicit;a(2),p("value",e.key)("inputId",e.value),a(),p("for",e.value),a(),x(e.value)}}function vt(t,m){if(t&1&&(i(0,"div",40)(1,"div",25),c(2,"p-radiobutton",46),i(3,"label",44),o(4),n()()()),t&2){let e=m.$implicit;a(2),p("value",e.key)("inputId",e.key.toString()),a(),p("for",e.key),a(),x(e.value)}}function _t(t,m){if(t&1&&(i(0,"div",40)(1,"div",25),c(2,"p-radiobutton",47),i(3,"label",44),o(4),n()()()),t&2){let e=m.$implicit;a(2),p("value",e.key)("inputId",e.value),a(),p("for",e.value),a(),x(e.value)}}function bt(t,m){if(t&1&&(i(0,"p-scrollpanel",null,2)(2,"p-tabs",7)(3,"p-tablist"),F(4,dt,2,2,"p-tab",8,y),n(),i(6,"p-tabpanels")(7,"p-tabpanel",9)(8,"div",10)(9,"h3",11),o(10,"Accounting Numbering"),n(),i(11,"div",12)(12,"div",13)(13,"div",14)(14,"div",13)(15,"div",15)(16,"label",16),o(17,"Digit"),n(),c(18,"p-inputnumber",17),n()(),i(19,"div",13)(20,"div",15)(21,"label",18),o(22,"Seed"),n(),c(23,"p-inputnumber",19),n()(),i(24,"div",13)(25,"div",15)(26,"label",20),o(27,"Last Number"),n(),c(28,"p-inputnumber",21),n()(),i(29,"div",13)(30,"div",15)(31,"label",22),o(32,"Format"),n(),c(33,"p-select",23),n()(),i(34,"div",13)(35,"div",15)(36,"label",22),o(37,"Reset Every"),n(),i(38,"div",24),F(39,ft,4,4,"div",25,y),n()()()()()()()(),i(41,"p-tabpanel",8)(42,"div",26)(43,"div",27)(44,"h3",11),o(45,"Journal Generate"),n(),i(46,"p"),o(47,"Configure generate transaction"),n()(),i(48,"div",12)(49,"div",28)(50,"div",12)(51,"div",29)(52,"div",15)(53,"label",22),o(54,"Outlet Delivery Journal"),n(),c(55,"p-toggleswitch",30),n()(),i(56,"div",31)(57,"div",15)(58,"label",22),o(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),o(67,"Note"),n()(),i(68,"div",29)(69,"div",15)(70,"label",22),o(71,"Note Required On Journal"),n(),c(72,"p-toggleswitch",34),n()(),i(73,"div",29)(74,"div",15)(75,"label",22),o(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),o(82,"Report"),n(),i(83,"div",12)(84,"div",27)(85,"div",37)(86,"div")(87,"label",38),o(88,"Audit Journal Transaction"),n(),i(89,"div",12)(90,"div",39)(91,"div",12),F(92,gt,5,4,"div",40,y),n()()()(),i(94,"div")(95,"label",41),o(96,"Accounting For Treatment"),n(),i(97,"div",12)(98,"div",39)(99,"div",12),F(100,vt,5,4,"div",40,y),n()()()(),i(102,"div")(103,"label",42),o(104,"Configure Report Access Control in COA"),n(),i(105,"div",12)(106,"div",39)(107,"div",12),F(108,_t,5,4,"div",40,y),n()()()()()()()()()()()()),t&2){let e,r,l,d,L,v=s();U(D(8,ut)),a(2),p("value",0)("formGroup",v.form),a(2),A(v.tabs()),a(3),p("value",0),a(26),p("options",(e=v.accountingIntegration())==null||e.options==null?null:e.options.monthlyResetPeriodFormat),a(6),A((r=v.accountingIntegration())==null||r.options==null?null:r.options.resetPeriods),a(2),p("value",1),a(38),p("value",2),a(13),A((l=v.accountingIntegration())==null||l.options==null?null:l.options.auditType),a(8),A((d=v.accountingIntegration())==null||d.options==null?null:d.options.generatePrepaidJournal),a(8),A((L=v.accountingIntegration())==null||L.options==null?null:L.options.entityAccess)}}var nt=(()=>{class t{constructor(){this.accountingSetupService=u(_),this.fb=u(k).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(w(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(r){return new(r||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","accountingAuditType",1,"fs-4","mb-2"],[1,"col-8"],[1,"col-4"],["for","generatePrepaidJournal",1,"fs-4","mb-2"],["for","accountingEntityAccess",1,"fs-4","mb-2"],["name","resetEvery","formControlName","resetEvery",3,"value","inputId"],[1,"m-0",3,"for"],["name","accountingAuditType","formControlName","accountingAuditType",3,"value","inputId"],["name","generatePrepaidJournal","formControlName","generatePrepaidJournal",3,"value","inputId"],["name","accountingEntityAccess","formControlName","accountingEntityAccess",3,"value","inputId"]],template:function(r,l){r&1&&(i(0,"app-main-panel",3),g(1,st,4,0,"ng-template",null,0,f)(3,bt,110,9,"ng-template",null,1,f),n())},dependencies:[I,et,Ze,Ye,Xe,Ke,Qe,M,X,Oe,Pe,R,T,B,P,O,q,N,Be,Ge,je,Ve,Se,xe,V,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 ht=()=>({height:"calc(100vh - 250px)"}),xt=()=>[],it=()=>({});function St(t,m){if(t&1){let e=h();i(0,"div")(1,"p-button",6),E("onClick",function(){b(e);let l=s();return C(l.submitForm())}),n()()}}function yt(t,m){t&1&&(i(0,"div",12)(1,"h3",13),o(2,"Date"),n(),c(3,"p-datePicker",14),n())}function Ft(t,m){t&1&&(i(0,"tr")(1,"th",20),o(2,"Account Name"),n(),i(3,"th",21),o(4,"Debit"),n(),i(5,"th",21),o(6,"Credit"),n()())}function At(t,m){if(t&1&&(i(0,"tr",10)(1,"td",20),o(2),n(),i(3,"td"),c(4,"input",22),n(),i(5,"td"),c(6,"input",23),n()()),t&2){let e,r=m.$implicit,l=m.rowIndex,d=s(4);p("formGroupName",l),a(2),te(" ",(e=d.asFormGroup(r).get("accountName"))==null?null:e.value," "),a(2),p("autoNumeric",D(4,it)),a(2),p("autoNumeric",D(5,it))}}function Et(t,m){if(t&1&&(i(0,"div",10)(1,"h4",15),o(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,r=m.$index,l=s(3);p("formGroupName",r),a(2),te(" ",e.get("name").value," "),a(2),p("value",l.getItemsArray(l.asFormGroup(e)).controls)}}function It(t,m){if(t&1&&(i(0,"tr")(1,"td")(2,"p",24),o(3,"Total"),n()(),i(4,"td",25)(5,"p",24),o(6),ie(7,"number"),n()(),i(8,"td",25)(9,"p",24),o(10),ie(11,"number"),n()()()),t&2){let e=s(3);a(6),x(oe(7,2,e.subtotalDebit)),a(4),x(oe(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),F(6,Et,7,3,"div",10,y),n()(),i(8,"p-table",11),g(9,It,12,6,"ng-template",null,3,f),n()()),t&2){let e=s(2);p("formGroup",e.formGroups),a(4),U(D(4,ht)),a(2),A(e.formsArray.controls),a(2),p("value",D(5,xt))}}function Nt(t,m){if(t&1&&g(0,Tt,11,6,"p-panel",7),t&2){let e=s();p("ngIf",e.formGroups)}}var rt=(()=>{class t{constructor(){this.destroy$=new le,this.subtotalDebit=0,this.subtotalCredit=0,this.fb=u(k),this.accSetupService=u(_),this.dayjsService=u($e),this.date=new Date,this.routes=u(he)}ngOnInit(){this.initializeForm(),this.loadFormData(),this.calculateSubtotalDebit(),this.formGroups.get("forms").valueChanges.pipe(pe(300),ce(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 r=e.map(l=>this.createItemGroup(l));return this.fb.array(r)}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(me(e=>e.data),Je("response"),w(e=>{for(;this.formsArray.length>0;)this.formsArray.removeAt(0);e.form.filter(l=>l.items&&l.items.length>0).forEach(l=>{this.formsArray.push(this.createFormGroup(l))})})).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(r=>{let l=this.getItemsArray(r),d=l.controls.reduce((v,Z)=>{let ee=Z.get("debitAmount").value||0;return v+ee},0),L=l.controls.reduce((v,Z)=>{let ee=Z.get("creditAmount").value||0;return v+ee},0);this.subtotalDebit+=d,this.subtotalCredit+=L})}submitForm(){let e=Object.entries(this.formGroups.getRawValue()).reduce((r,[l,d])=>(l==="date"?r[l]=d instanceof Date?this.dayjsService.format(d):d:l==="forms"?r.form=d:r[l]=d,r),{});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(r){return new(r||t)}}static{this.\u0275cmp=S({type:t,selectors:[["app-acc-opening-balance-form"]],features:[ve([Ie])],decls:6,vars:0,consts:[["actionButton",""],["content",""],["header",""],["footer",""],["pageTitle","Opening Balance Form"],["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(r,l){r&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))},dependencies:[M,X,Te,I,be,Ce,Me,Ne,Re,ke,Q,K,W,G,T,B,N,qe,V,J,$,j,Le,R,P,O,q,Ee,He,We],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var at=t=>({"ng-invalid ng-dirty":t});function Dt(t,m){if(t&1){let e=h();i(0,"p-button",4),E("onClick",function(){b(e);let l=s();return C(l.saveCredentials())}),o(1,"Update"),n()}}function wt(t,m){t&1&&(i(0,"div",12)(1,"h3",13),o(2,"Account"),n(),i(3,"small",14),o(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),o(8,"Client ID"),n(),c(9,"input",10),n()(),i(10,"div",7)(11,"div",8)(12,"label",9),o(13,"Client Secret"),n(),c(14,"input",11),n()()()()()),t&2){let e=s();a(4),p("formGroup",e.credentialForm),a(5),p("ngClass",ne(3,at,e.clientIDControl.invalid&&e.clientIDControl.dirty||e.clientIDControl.touched)),a(5),p("ngClass",ne(5,at,e.clientSecretControl.invalid&&e.clientSecretControl.dirty||e.clientSecretControl.touched))}}var lt=(()=>{class t{constructor(e){this.fb=e,this.setupService=u(_)}ngOnInit(){this.initForm(),this.setupService.fetchAPICredential().pipe(w(e=>{this.credentialForm.patchValue({clientID:e.clientID||"",clientSecret:e.clientSecret||""})})).subscribe()}initForm(){this.credentialForm=this.fb.group({clientID:["",[re.required]],clientSecret:["",[re.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()}static{this.\u0275fac=function(r){return new(r||t)(se(k))}}static{this.\u0275cmp=S({type:t,selectors:[["app-api-credential"]],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(r,l){r&1&&(i(0,"app-main-panel",3),g(1,Dt,2,0,"ng-template",null,0,f)(3,Gt,15,7,"ng-template",null,1,f),n())},dependencies:[I,_e,R,G,T,B,P,O,N,H,$,j,M,V,J],encapsulation:2})}}return t})();function Bt(t,m){if(t&1){let e=h();i(0,"button",4),E("click",function(){b(e);let l=s();return C(l.onFormatJournal())}),o(1," Format "),n()}}function Pt(t,m){t&1&&(i(0,"div",12)(1,"div",13)(2,"h4",14),o(3,"Journal Configuration"),n(),i(4,"small",15),o(5," Enter your account information to format journal entries "),n()()())}function Ot(t,m){if(t&1){let e=h();i(0,"div",5)(1,"p-panel"),g(2,Pt,6,0,"ng-template",null,2,f),i(4,"div",6)(5,"div",7)(6,"p-floatlabel",8)(7,"input",9),ge("ngModelChange",function(l){b(e);let d=s();return fe(d.subdomain,l)||(d.subdomain=l),C(l)}),n(),i(8,"label",10),o(9,"Subdomain"),n()(),i(10,"small",11),o(11,"Enter your account subdomain (e.g., mycompany.dealpos.net)"),n()()()()()}if(t&2){let e=s();a(7),de("ngModel",e.subdomain)}}var mt=(()=>{class t{constructor(){this.setupService=u(_),this.subdomain=z(""),this.toastrService=u(ye)}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(r){return new(r||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(r,l){r&1&&(i(0,"app-main-panel",3),g(1,Bt,2,0,"ng-template",null,0,f)(3,Ot,12,1,"ng-template",null,1,f),n())},dependencies:[I,W,G,T,Ae,N,H,M,$,j,Ue,ze],encapsulation:2})}}return t})();var pt=()=>u(_).fetchOpeningBalanceFormConfiguration();var _i=[{path:"",redirectTo:"accounting-integration",pathMatch:"full"},{path:"",children:[{path:"accounting-integration",component:nt},{path:"opening-balance-form",component:rt,resolve:{data:pt}},{path:"api-crendetial",component:lt},{path:"format-journal",component:mt},{path:"closing-entries",loadComponent:()=>import("./chunk-FP5LIX5S.js").then(t=>t.ClosingPageComponent)},{path:"closing-entries/create",loadComponent:()=>import("./chunk-MEXKKLEE.js").then(t=>t.ClosingFormComponent)}]}];export{_i as ACCOUNTING_SETUP_ROUTES};
1
+ import{a as Ke,b as Qe,c as Xe,d as Ye,e as Ze,f as et}from"./chunk-EDCDR4RJ.js";import{a as ze,b as Ue,c as qe}from"./chunk-B7WHT2EP.js";import{a as We,b as He}from"./chunk-HHDFSN55.js";import{a as Le}from"./chunk-P7Z64VPC.js";import{b as $e}from"./chunk-MPFBVM6S.js";import"./chunk-6ATDYFCA.js";import{a as Ve,b as je}from"./chunk-YO23YVSC.js";import"./chunk-AZUQDRJU.js";import{a as Pe,b as Oe,d as ke,k as Re}from"./chunk-EW3R2HAB.js";import{a as Ne,b as Me}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import{a as Je}from"./chunk-XKCLERWG.js";import{a as K,b as Q}from"./chunk-4LGDNQMZ.js";import"./chunk-PKN47FQE.js";import{a as Ge,b as Be}from"./chunk-LRRVQSMI.js";import"./chunk-42UIGXWH.js";import{a as De,b as we}from"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{b as X}from"./chunk-5R3XKSDM.js";import{h as M}from"./chunk-AWXT2WGR.js";import"./chunk-C7LM5UCK.js";import{a as j,b as $}from"./chunk-J4XRJAME.js";import"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{n as H,o as N,w as J,x as V}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{Ia as Ie,Ma as Te,b as G,c as re,e as T,f as B,j as Ae,l as P,m as q,n as Ee,o as O,v as k,x as W,y as R}from"./chunk-FMVCTBCQ.js";import{a as Fe}from"./chunk-ZGXJEG37.js";import{a as ye}from"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{D as he,G as xe,N as Se,c as _e,f as be,l as Ce,m as I}from"./chunk-B63BKC6F.js";import{Ac as ne,Cb as g,Ga as z,Jc as ie,Kb as p,Kc as oe,L as pe,Mc as f,Nb as U,Qb as y,Sb as F,Tb as A,Ub as i,Vb as n,Wb as c,Y as ce,Z as w,_b as h,ba as ue,dc as E,ec as s,g as le,gb as a,ha as u,mb as se,pa as b,qa as C,qc as o,rc as x,s as me,sc as te,vc as de,wb as S,wc as fe,xc as ge,yc as ve,zc as D}from"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var _=(()=>{class t{#e=u(Fe);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)}formatJournal(e){return this.#e.post("","/api/setup/formatdata/clearjournal",{domain:e})}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275prov=ue({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var ut=()=>({height:"calc(100vh - 100px)"});function st(t,m){if(t&1){let e=h();i(0,"div",4)(1,"a",5),o(2,"Cancel"),n(),i(3,"p-button",6),E("click",function(){b(e);let l=s();return C(l.updateAccountingIntegration())}),n()()}}function dt(t,m){if(t&1&&(i(0,"p-tab",8),o(1),n()),t&2){let e=m.$implicit,r=m.$index;p("value",r),a(),x(e)}}function ft(t,m){if(t&1&&(i(0,"div",25),c(1,"p-radiobutton",43),i(2,"label",44),o(3),n()()),t&2){let e=m.$implicit;a(),p("value",e.key)("inputId",e.value),a(),p("for",e.value),a(),x(e.value)}}function gt(t,m){if(t&1&&(i(0,"div",40)(1,"div",25),c(2,"p-radiobutton",45),i(3,"label",44),o(4),n()()()),t&2){let e=m.$implicit;a(2),p("value",e.key)("inputId",e.value),a(),p("for",e.value),a(),x(e.value)}}function vt(t,m){if(t&1&&(i(0,"div",40)(1,"div",25),c(2,"p-radiobutton",46),i(3,"label",44),o(4),n()()()),t&2){let e=m.$implicit;a(2),p("value",e.key)("inputId",e.key.toString()),a(),p("for",e.key),a(),x(e.value)}}function _t(t,m){if(t&1&&(i(0,"div",40)(1,"div",25),c(2,"p-radiobutton",47),i(3,"label",44),o(4),n()()()),t&2){let e=m.$implicit;a(2),p("value",e.key)("inputId",e.value),a(),p("for",e.value),a(),x(e.value)}}function bt(t,m){if(t&1&&(i(0,"p-scrollpanel",null,2)(2,"p-tabs",7)(3,"p-tablist"),F(4,dt,2,2,"p-tab",8,y),n(),i(6,"p-tabpanels")(7,"p-tabpanel",9)(8,"div",10)(9,"h3",11),o(10,"Accounting Numbering"),n(),i(11,"div",12)(12,"div",13)(13,"div",14)(14,"div",13)(15,"div",15)(16,"label",16),o(17,"Digit"),n(),c(18,"p-inputnumber",17),n()(),i(19,"div",13)(20,"div",15)(21,"label",18),o(22,"Seed"),n(),c(23,"p-inputnumber",19),n()(),i(24,"div",13)(25,"div",15)(26,"label",20),o(27,"Last Number"),n(),c(28,"p-inputnumber",21),n()(),i(29,"div",13)(30,"div",15)(31,"label",22),o(32,"Format"),n(),c(33,"p-select",23),n()(),i(34,"div",13)(35,"div",15)(36,"label",22),o(37,"Reset Every"),n(),i(38,"div",24),F(39,ft,4,4,"div",25,y),n()()()()()()()(),i(41,"p-tabpanel",8)(42,"div",26)(43,"div",27)(44,"h3",11),o(45,"Journal Generate"),n(),i(46,"p"),o(47,"Configure generate transaction"),n()(),i(48,"div",12)(49,"div",28)(50,"div",12)(51,"div",29)(52,"div",15)(53,"label",22),o(54,"Outlet Delivery Journal"),n(),c(55,"p-toggleswitch",30),n()(),i(56,"div",31)(57,"div",15)(58,"label",22),o(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),o(67,"Note"),n()(),i(68,"div",29)(69,"div",15)(70,"label",22),o(71,"Note Required On Journal"),n(),c(72,"p-toggleswitch",34),n()(),i(73,"div",29)(74,"div",15)(75,"label",22),o(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),o(82,"Report"),n(),i(83,"div",12)(84,"div",27)(85,"div",37)(86,"div")(87,"label",38),o(88,"Audit Journal Transaction"),n(),i(89,"div",12)(90,"div",39)(91,"div",12),F(92,gt,5,4,"div",40,y),n()()()(),i(94,"div")(95,"label",41),o(96,"Accounting For Treatment"),n(),i(97,"div",12)(98,"div",39)(99,"div",12),F(100,vt,5,4,"div",40,y),n()()()(),i(102,"div")(103,"label",42),o(104,"Configure Report Access Control in COA"),n(),i(105,"div",12)(106,"div",39)(107,"div",12),F(108,_t,5,4,"div",40,y),n()()()()()()()()()()()()),t&2){let e,r,l,d,L,v=s();U(D(8,ut)),a(2),p("value",0)("formGroup",v.form),a(2),A(v.tabs()),a(3),p("value",0),a(26),p("options",(e=v.accountingIntegration())==null||e.options==null?null:e.options.monthlyResetPeriodFormat),a(6),A((r=v.accountingIntegration())==null||r.options==null?null:r.options.resetPeriods),a(2),p("value",1),a(38),p("value",2),a(13),A((l=v.accountingIntegration())==null||l.options==null?null:l.options.auditType),a(8),A((d=v.accountingIntegration())==null||d.options==null?null:d.options.generatePrepaidJournal),a(8),A((L=v.accountingIntegration())==null||L.options==null?null:L.options.entityAccess)}}var nt=(()=>{class t{constructor(){this.accountingSetupService=u(_),this.fb=u(k).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(w(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(r){return new(r||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","accountingAuditType",1,"fs-4","mb-2"],[1,"col-8"],[1,"col-4"],["for","generatePrepaidJournal",1,"fs-4","mb-2"],["for","accountingEntityAccess",1,"fs-4","mb-2"],["name","resetEvery","formControlName","resetEvery",3,"value","inputId"],[1,"m-0",3,"for"],["name","accountingAuditType","formControlName","accountingAuditType",3,"value","inputId"],["name","generatePrepaidJournal","formControlName","generatePrepaidJournal",3,"value","inputId"],["name","accountingEntityAccess","formControlName","accountingEntityAccess",3,"value","inputId"]],template:function(r,l){r&1&&(i(0,"app-main-panel",3),g(1,st,4,0,"ng-template",null,0,f)(3,bt,110,9,"ng-template",null,1,f),n())},dependencies:[I,et,Ze,Ye,Xe,Ke,Qe,M,X,Oe,Pe,R,T,B,P,O,q,N,Be,Ge,je,Ve,Se,xe,V,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 ht=()=>({height:"calc(100vh - 250px)"}),xt=()=>[],it=()=>({});function St(t,m){if(t&1){let e=h();i(0,"div")(1,"p-button",6),E("onClick",function(){b(e);let l=s();return C(l.submitForm())}),n()()}}function yt(t,m){t&1&&(i(0,"div",12)(1,"h3",13),o(2,"Date"),n(),c(3,"p-datePicker",14),n())}function Ft(t,m){t&1&&(i(0,"tr")(1,"th",20),o(2,"Account Name"),n(),i(3,"th",21),o(4,"Debit"),n(),i(5,"th",21),o(6,"Credit"),n()())}function At(t,m){if(t&1&&(i(0,"tr",10)(1,"td",20),o(2),n(),i(3,"td"),c(4,"input",22),n(),i(5,"td"),c(6,"input",23),n()()),t&2){let e,r=m.$implicit,l=m.rowIndex,d=s(4);p("formGroupName",l),a(2),te(" ",(e=d.asFormGroup(r).get("accountName"))==null?null:e.value," "),a(2),p("autoNumeric",D(4,it)),a(2),p("autoNumeric",D(5,it))}}function Et(t,m){if(t&1&&(i(0,"div",10)(1,"h4",15),o(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,r=m.$index,l=s(3);p("formGroupName",r),a(2),te(" ",e.get("name").value," "),a(2),p("value",l.getItemsArray(l.asFormGroup(e)).controls)}}function It(t,m){if(t&1&&(i(0,"tr")(1,"td")(2,"p",24),o(3,"Total"),n()(),i(4,"td",25)(5,"p",24),o(6),ie(7,"number"),n()(),i(8,"td",25)(9,"p",24),o(10),ie(11,"number"),n()()()),t&2){let e=s(3);a(6),x(oe(7,2,e.subtotalDebit)),a(4),x(oe(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),F(6,Et,7,3,"div",10,y),n()(),i(8,"p-table",11),g(9,It,12,6,"ng-template",null,3,f),n()()),t&2){let e=s(2);p("formGroup",e.formGroups),a(4),U(D(4,ht)),a(2),A(e.formsArray.controls),a(2),p("value",D(5,xt))}}function Nt(t,m){if(t&1&&g(0,Tt,11,6,"p-panel",7),t&2){let e=s();p("ngIf",e.formGroups)}}var rt=(()=>{class t{constructor(){this.destroy$=new le,this.subtotalDebit=0,this.subtotalCredit=0,this.fb=u(k),this.accSetupService=u(_),this.dayjsService=u($e),this.date=new Date,this.routes=u(he)}ngOnInit(){this.initializeForm(),this.loadFormData(),this.calculateSubtotalDebit(),this.formGroups.get("forms").valueChanges.pipe(pe(300),ce(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 r=e.map(l=>this.createItemGroup(l));return this.fb.array(r)}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(me(e=>e.data),Je("response"),w(e=>{for(;this.formsArray.length>0;)this.formsArray.removeAt(0);e.form.filter(l=>l.items&&l.items.length>0).forEach(l=>{this.formsArray.push(this.createFormGroup(l))})})).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(r=>{let l=this.getItemsArray(r),d=l.controls.reduce((v,Z)=>{let ee=Z.get("debitAmount").value||0;return v+ee},0),L=l.controls.reduce((v,Z)=>{let ee=Z.get("creditAmount").value||0;return v+ee},0);this.subtotalDebit+=d,this.subtotalCredit+=L})}submitForm(){let e=Object.entries(this.formGroups.getRawValue()).reduce((r,[l,d])=>(l==="date"?r[l]=d instanceof Date?this.dayjsService.format(d):d:l==="forms"?r.form=d:r[l]=d,r),{});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(r){return new(r||t)}}static{this.\u0275cmp=S({type:t,selectors:[["app-acc-opening-balance-form"]],features:[ve([Ie])],decls:6,vars:0,consts:[["actionButton",""],["content",""],["header",""],["footer",""],["pageTitle","Opening Balance Form"],["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(r,l){r&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))},dependencies:[M,X,Te,I,be,Ce,Me,Ne,Re,ke,Q,K,W,G,T,B,N,qe,V,J,$,j,Le,R,P,O,q,Ee,He,We],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var at=t=>({"ng-invalid ng-dirty":t});function Dt(t,m){if(t&1){let e=h();i(0,"p-button",4),E("onClick",function(){b(e);let l=s();return C(l.saveCredentials())}),o(1,"Update"),n()}}function wt(t,m){t&1&&(i(0,"div",12)(1,"h3",13),o(2,"Account"),n(),i(3,"small",14),o(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),o(8,"Client ID"),n(),c(9,"input",10),n()(),i(10,"div",7)(11,"div",8)(12,"label",9),o(13,"Client Secret"),n(),c(14,"input",11),n()()()()()),t&2){let e=s();a(4),p("formGroup",e.credentialForm),a(5),p("ngClass",ne(3,at,e.clientIDControl.invalid&&e.clientIDControl.dirty||e.clientIDControl.touched)),a(5),p("ngClass",ne(5,at,e.clientSecretControl.invalid&&e.clientSecretControl.dirty||e.clientSecretControl.touched))}}var lt=(()=>{class t{constructor(e){this.fb=e,this.setupService=u(_)}ngOnInit(){this.initForm(),this.setupService.fetchAPICredential().pipe(w(e=>{this.credentialForm.patchValue({clientID:e.clientID||"",clientSecret:e.clientSecret||""})})).subscribe()}initForm(){this.credentialForm=this.fb.group({clientID:["",[re.required]],clientSecret:["",[re.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()}static{this.\u0275fac=function(r){return new(r||t)(se(k))}}static{this.\u0275cmp=S({type:t,selectors:[["app-api-credential"]],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(r,l){r&1&&(i(0,"app-main-panel",3),g(1,Dt,2,0,"ng-template",null,0,f)(3,Gt,15,7,"ng-template",null,1,f),n())},dependencies:[I,_e,R,G,T,B,P,O,N,H,$,j,M,V,J],encapsulation:2})}}return t})();function Bt(t,m){if(t&1){let e=h();i(0,"button",4),E("click",function(){b(e);let l=s();return C(l.onFormatJournal())}),o(1," Format "),n()}}function Pt(t,m){t&1&&(i(0,"div",12)(1,"div",13)(2,"h4",14),o(3,"Journal Configuration"),n(),i(4,"small",15),o(5," Enter your account information to format journal entries "),n()()())}function Ot(t,m){if(t&1){let e=h();i(0,"div",5)(1,"p-panel"),g(2,Pt,6,0,"ng-template",null,2,f),i(4,"div",6)(5,"div",7)(6,"p-floatlabel",8)(7,"input",9),ge("ngModelChange",function(l){b(e);let d=s();return fe(d.subdomain,l)||(d.subdomain=l),C(l)}),n(),i(8,"label",10),o(9,"Subdomain"),n()(),i(10,"small",11),o(11,"Enter your account subdomain (e.g., mycompany.dealpos.net)"),n()()()()()}if(t&2){let e=s();a(7),de("ngModel",e.subdomain)}}var mt=(()=>{class t{constructor(){this.setupService=u(_),this.subdomain=z(""),this.toastrService=u(ye)}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(r){return new(r||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(r,l){r&1&&(i(0,"app-main-panel",3),g(1,Bt,2,0,"ng-template",null,0,f)(3,Ot,12,1,"ng-template",null,1,f),n())},dependencies:[I,W,G,T,Ae,N,H,M,$,j,Ue,ze],encapsulation:2})}}return t})();var pt=()=>u(_).fetchOpeningBalanceFormConfiguration();var _i=[{path:"",redirectTo:"accounting-integration",pathMatch:"full"},{path:"",children:[{path:"accounting-integration",component:nt},{path:"opening-balance-form",component:rt,resolve:{data:pt}},{path:"api-crendetial",component:lt},{path:"format-journal",component:mt},{path:"closing-entries",loadComponent:()=>import("./chunk-P37DL4A6.js").then(t=>t.ClosingPageComponent)},{path:"closing-entries/create",loadComponent:()=>import("./chunk-MZGANYF3.js").then(t=>t.ClosingFormComponent)}]}];export{_i as ACCOUNTING_SETUP_ROUTES};
@@ -1 +1 @@
1
- import{a as A}from"./chunk-EXGI2AG7.js";import{a as Ue}from"./chunk-G4XX7EU2.js";import{a as Oe,b as Be}from"./chunk-HHJMN4BS.js";import{a as He}from"./chunk-MDH73MG3.js";import{b as V}from"./chunk-ERFXO32T.js";import"./chunk-ZM5TVQUU.js";import{a as ae}from"./chunk-AGLKA7OG.js";import"./chunk-YOUPD27G.js";import{a as ze}from"./chunk-XKI7WLHE.js";import"./chunk-AZUQDRJU.js";import"./chunk-C2GO6SPF.js";import{a as z,b as H}from"./chunk-O4QM64EH.js";import{d as ke,i as Me,j as Pe,k as je}from"./chunk-EW3R2HAB.js";import{a as Ae,b as De}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import"./chunk-PKN47FQE.js";import{a as Je,b as Ne}from"./chunk-LRRVQSMI.js";import"./chunk-42UIGXWH.js";import"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{g as Fe,h as Ve}from"./chunk-UYC454VQ.js";import{b as Ee,c as Te}from"./chunk-C7LM5UCK.js";import{a as be,b as Se}from"./chunk-J4XRJAME.js";import{a as v,b as we,c as ve,d as ye,e as Re,f as Ie}from"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{n as ge,o as he,w as xe,x as Ce}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{b as le,c as me,e as pe,f as se,k as ce,l as de,o as ue,v as fe,y as _e}from"./chunk-FMVCTBCQ.js";import"./chunk-ZGXJEG37.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{c as ee,e as te,f as ie,i as ne,k as oe,m as re}from"./chunk-B63BKC6F.js";import{Ab as W,Ac as T,Cb as g,Ga as k,Jc as I,Kb as c,Kc as Z,Lc as F,Mc as w,Nb as $,Ub as r,Vb as o,Wb as b,X as N,Yc as E,Z as U,_b as y,bb as L,c as D,cb as G,dc as R,ec as _,gb as m,ha as C,pa as h,qa as x,qc as p,rc as S,s as J,sc as M,uc as q,vc as Q,wb as K,wc as P,xc as X,yc as Y,zc as j}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=we(Ie(Qe),ve(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)),checkedARCollection:E(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),Re(t=>{let a=C(A),e=C(V);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(s=>s.id===n.id?f(d({},s),{checked:!0}):s);return f(d({},i),{data:f(d({},i.data),{data:u})})})},onRowUnselect(n){v(t,i=>{let u=i.data.data.map(s=>s.id===n.id?f(d({},s),{checked:!1}):s);return f(d({},i),{data:f(d({},i.data),{data:u})})})},onHeaderCheckboxToggle(n){v(t,i=>{let u=i.data.data.map(s=>f(d({},s),{checked:n}));return f(d({},i),{data:f(d({},i.data),{data:u})})})},getARLoader:z(D(N(()=>a.getARJournalLoader().pipe(H({next:n=>{v(t,i=>f(d({},i),{meta:n}))},error:n=>{console.error("Error fetching AR collection loader:",n)}}))))),getARCollection:z(D(J(n=>Object.entries(n).reduce((i,[u,s])=>(s!=null&&(i[u]=s),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}))})),H({next:i=>{v(t,u=>f(d({},u),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),ye(t=>({onInit:()=>{t.getARLoader(),t.getARCollection(t.filter)}})));var Xe=()=>({height:"calc(100vh - 70px)"}),B=t=>({"ng-invalid ng-dirty":t}),Ye=()=>({});function Ze(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 et(t,a){if(t&1&&g(0,Ze,1,0,"p-button",9),t&2){let e=_();c("ngIf",e.store.hasCheckedRows())}}function tt(t,a){t&1&&(r(0,"tr")(1,"th",12),b(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),p(4,"Outlet"),o(),r(5,"th",14),p(6,"Number"),o(),r(7,"th",15),p(8,"Customer"),o(),r(9,"th",16),p(10,"Date"),o(),r(11,"th",16),p(12,"Due"),o(),r(13,"th",15),p(14,"Note"),o(),r(15,"th",17),p(16,"Payment"),o(),b(17,"th",12),o())}function it(t,a){if(t&1&&(r(0,"tr")(1,"td"),b(2,"p-tableCheckbox",18),o(),r(3,"td"),p(4),o(),r(5,"td")(6,"a",19),p(7),o()(),r(8,"td"),p(9),o(),r(10,"td"),p(11),I(12,"date"),o(),r(13,"td"),p(14),I(15,"date"),o(),r(16,"td"),b(17,"div",20),o(),r(18,"td"),p(19),o(),r(20,"td"),b(21,"p-button",21),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,G),m(),M(" ",e.number," "),m(2),S(e.customer),m(2),S(F(12,12,e.date,"d MMM y")),m(3),S(e.due?F(15,15,e.due,"d MMM y hh:mm"):"-"),m(3),c("innerHTML",e.note,L),m(2),S(e.payment),m(2),c("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function nt(t,a){if(t&1&&p(0),t&2){let e=_(2);q(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function ot(t,a){t&1&&(r(0,"tr")(1,"td",22)(2,"span"),p(3,"No records found."),o()()())}function rt(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,tt,18,0,"ng-template",null,3,w)(4,it,22,18,"ng-template",null,4,w)(6,nt,1,3,"ng-template",null,5,w)(8,ot,4,0,"ng-template",null,6,w),o()()}if(t&2){let e=_();$(j(9,Xe)),m(),c("value",e.store.data().data)("scrollable",!0)("scrollHeight","calc(100vh - 142px)")("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function at(t,a){if(t&1&&(r(0,"span",32),p(1),I(2,"truncate"),o()),t&2){let e=a.$implicit;c("pTooltip",e.name),m(),M(" ",F(2,2,e.name,30)," ")}}function lt(t,a){if(t&1&&(r(0,"div")(1,"span",34),p(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",33),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("from"))}}function pt(t,a){if(t&1&&(r(0,"div")(1,"span",34),p(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",33),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("to"))}}function ct(t,a){if(t&1&&(r(0,"div")(1,"span",34),p(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function dt(t,a){if(t&1&&(r(0,"div"),g(1,ct,3,1,"div",33),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("pageSize"))}}function ut(t,a){if(t&1){let e=y();r(0,"form",23)(1,"div",24)(2,"label",25),p(3,"Outlet"),o(),r(4,"p-select",26),g(5,at,3,5,"ng-template",null,7,w),o()(),r(7,"div",24)(8,"label",25),p(9,"From"),o(),b(10,"p-datepicker",27),g(11,mt,2,1,"div",28),o(),r(12,"div",24)(13,"label",25),p(14,"To"),o(),b(15,"p-datepicker",29),g(16,st,2,1,"div",28),o(),r(17,"div",24)(18,"label",25),p(19,"Customer"),o(),r(20,"p-autocomplete",30),I(21,"async"),R("completeMethod",function(n){h(e);let i=_();return x(i.onSearchContact(n))}),o()(),r(22,"div",24)(23,"label",25),p(24,"Page Size"),o(),b(25,"input",31),g(26,dt,2,1,"div",28),o()()}if(t&2){let e=_();c("formGroup",e.form),m(4),c("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),m(6),c("iconDisplay","input")("showIcon",!0)("ngClass",T(17,B,e.isInvalid("from"))),m(),c("ngIf",e.isInvalid("from")),m(4),c("iconDisplay","input")("showIcon",!0)("ngClass",T(19,B,e.isInvalid("to"))),m(),c("ngIf",e.isInvalid("to")),m(4),c("suggestions",Z(21,15,e.customerSuggestions$)),m(5),c("autoNumeric",j(21,Ye))("ngClass",T(22,B,e.isInvalid("pageSize"))),m(),c("ngIf",e.isInvalid("pageSize"))}}var ni=(()=>{class t extends ze{constructor(){super(),this.store=C(O),this.generateJournalService=C(A),this.authService=C(ae),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=C(fe),this.dayjsService=C(V)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:l,to:n,pageNumber:i,rowCount:u,pageSize:s,export:Le,exportPageNumber:Ge,exportRowCount:Ke,outletName:We,customerID:$e,paymentState:qe}=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(s,[me.required]),export:this.fb.control(Le),exportPageNumber:this.fb.control(Ge),exportRowCount:this.fb.control(Ke),outletName:this.fb.control(We),customerID:this.fb.control($e),paymentState:this.fb.control(qe)})}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]=Ue);break;case"from":typeof i=="object"?l[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:l[n]=i!=null?String(i):null;break;case"to":typeof i=="object"?l[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:l[n]=i!=null?String(i):null;break;default:l[n]=i===null?"":i;break}return l},{});console.log("Filter Body:",e),this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}onSearchContact(e){this.customerSuggestions$=this.generateJournalService.getCustomerSuggestions(e.query)}onSearch(e){this.store.updateFilter(f(d({},this.store.filter()),{number:e,pageNumber:1})),this.store.getARCollection(this.store.filter())}onPageChange(e){let l=e.first/e.rows;this.store.updateFilter(f(d({},this.store.filter()),{pageNumber:l+1}))}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(l=>{this.store.onRowUnselect(l)});return}else this.store.onRowUnselect(e.data)}onCreateJournal(){this.generateJournalService.createARJournal(this.store.checkedARCollection()).pipe(U(()=>this.store.getARCollection(this.store.filter))).subscribe()}static{this.\u0275fac=function(l){return new(l||t)}}static{this.\u0275cmp=K({type:t,selectors:[["app-ar-journal"]],features:[Y([O]),W],decls:8,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","AR Collection",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onHeaderCheckboxToggle","onRowSelect","onRowUnselect","value","scrollable","scrollHeight","paginator","rows","totalRecords","lazy"],[2,"width","4rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[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"],["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),X("isDialogFilterVisibleChange",function(s){return h(i),P(n.isDialogFilterVisible,s)||(n.isDialogFilterVisible=s),x(s)})("isInitDialogFilterVisibleChange",function(s){return h(i),P(n.isInitDialogFilterVisible,s)||(n.isInitDialogFilterVisible=s),x(s)}),R("filterConfirmed",function(){return h(i),x(n.onFilterOKEvent())})("search",function(s){return h(i),x(n.onSearch(s))}),g(1,et,1,1,"ng-template",null,0,w)(3,rt,10,10,"ng-template",null,1,w),p(5," <"),g(6,ut,27,24,"ng-template",null,2,w),o()}l&2&&(c("isSearchableInput",!0)("isFilterable",!0),Q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[Ve,re,ee,te,ie,ne,oe,je,ke,Me,Pe,Ce,xe,Se,be,_e,ce,le,pe,se,de,ue,Ne,Je,De,Ae,Be,Oe,he,ge,Fe,Te,Ee,He],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{ni as ARJournalComponent};
1
+ import{a as A}from"./chunk-EXGI2AG7.js";import{a as Ue}from"./chunk-G4XX7EU2.js";import{a as Oe,b as Be}from"./chunk-HHJMN4BS.js";import{a as He}from"./chunk-P7Z64VPC.js";import{b as V}from"./chunk-MPFBVM6S.js";import"./chunk-6ATDYFCA.js";import{a as ae}from"./chunk-AGLKA7OG.js";import"./chunk-YOUPD27G.js";import{a as ze}from"./chunk-XKI7WLHE.js";import"./chunk-AZUQDRJU.js";import"./chunk-C2GO6SPF.js";import{a as z,b as H}from"./chunk-O4QM64EH.js";import{d as ke,i as Me,j as Pe,k as je}from"./chunk-EW3R2HAB.js";import{a as Ae,b as De}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import"./chunk-PKN47FQE.js";import{a as Je,b as Ne}from"./chunk-LRRVQSMI.js";import"./chunk-42UIGXWH.js";import"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{g as Fe,h as Ve}from"./chunk-AWXT2WGR.js";import{b as Ee,c as Te}from"./chunk-C7LM5UCK.js";import{a as be,b as Se}from"./chunk-J4XRJAME.js";import{a as v,b as we,c as ve,d as ye,e as Re,f as Ie}from"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{n as ge,o as he,w as xe,x as Ce}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{b as le,c as me,e as pe,f as se,k as ce,l as de,o as ue,v as fe,y as _e}from"./chunk-FMVCTBCQ.js";import"./chunk-ZGXJEG37.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{c as ee,e as te,f as ie,i as ne,k as oe,m as re}from"./chunk-B63BKC6F.js";import{Ab as W,Ac as T,Cb as g,Ga as k,Jc as I,Kb as c,Kc as Z,Lc as F,Mc as w,Nb as $,Ub as r,Vb as o,Wb as b,X as N,Yc as E,Z as U,_b as y,bb as L,c as D,cb as G,dc as R,ec as _,gb as m,ha as C,pa as h,qa as x,qc as p,rc as S,s as J,sc as M,uc as q,vc as Q,wb as K,wc as P,xc as X,yc as Y,zc as j}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=we(Ie(Qe),ve(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)),checkedARCollection:E(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),Re(t=>{let a=C(A),e=C(V);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(s=>s.id===n.id?f(d({},s),{checked:!0}):s);return f(d({},i),{data:f(d({},i.data),{data:u})})})},onRowUnselect(n){v(t,i=>{let u=i.data.data.map(s=>s.id===n.id?f(d({},s),{checked:!1}):s);return f(d({},i),{data:f(d({},i.data),{data:u})})})},onHeaderCheckboxToggle(n){v(t,i=>{let u=i.data.data.map(s=>f(d({},s),{checked:n}));return f(d({},i),{data:f(d({},i.data),{data:u})})})},getARLoader:z(D(N(()=>a.getARJournalLoader().pipe(H({next:n=>{v(t,i=>f(d({},i),{meta:n}))},error:n=>{console.error("Error fetching AR collection loader:",n)}}))))),getARCollection:z(D(J(n=>Object.entries(n).reduce((i,[u,s])=>(s!=null&&(i[u]=s),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}))})),H({next:i=>{v(t,u=>f(d({},u),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),ye(t=>({onInit:()=>{t.getARLoader(),t.getARCollection(t.filter)}})));var Xe=()=>({height:"calc(100vh - 70px)"}),B=t=>({"ng-invalid ng-dirty":t}),Ye=()=>({});function Ze(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 et(t,a){if(t&1&&g(0,Ze,1,0,"p-button",9),t&2){let e=_();c("ngIf",e.store.hasCheckedRows())}}function tt(t,a){t&1&&(r(0,"tr")(1,"th",12),b(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),p(4,"Outlet"),o(),r(5,"th",14),p(6,"Number"),o(),r(7,"th",15),p(8,"Customer"),o(),r(9,"th",16),p(10,"Date"),o(),r(11,"th",16),p(12,"Due"),o(),r(13,"th",15),p(14,"Note"),o(),r(15,"th",17),p(16,"Payment"),o(),b(17,"th",18),o())}function it(t,a){if(t&1&&(r(0,"tr")(1,"td"),b(2,"p-tableCheckbox",19),o(),r(3,"td"),p(4),o(),r(5,"td")(6,"a",20),p(7),o()(),r(8,"td"),p(9),o(),r(10,"td"),p(11),I(12,"date"),o(),r(13,"td"),p(14),I(15,"date"),o(),r(16,"td"),b(17,"div",21),o(),r(18,"td"),p(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,G),m(),M(" ",e.number," "),m(2),S(e.customer),m(2),S(F(12,12,e.date,"d MMM y")),m(3),S(e.due?F(15,15,e.due,"d MMM y hh:mm"):"-"),m(3),c("innerHTML",e.note,L),m(2),S(e.payment),m(2),c("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function nt(t,a){if(t&1&&p(0),t&2){let e=_(2);q(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function ot(t,a){t&1&&(r(0,"tr")(1,"td",23)(2,"span"),p(3,"No records found."),o()()())}function rt(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,tt,18,0,"ng-template",null,3,w)(4,it,22,18,"ng-template",null,4,w)(6,nt,1,3,"ng-template",null,5,w)(8,ot,4,0,"ng-template",null,6,w),o()()}if(t&2){let e=_();$(j(9,Xe)),m(),c("value",e.store.data().data)("scrollable",!0)("scrollHeight","calc(100vh - 142px)")("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function at(t,a){if(t&1&&(r(0,"span",33),p(1),I(2,"truncate"),o()),t&2){let e=a.$implicit;c("pTooltip",e.name),m(),M(" ",F(2,2,e.name,30)," ")}}function lt(t,a){if(t&1&&(r(0,"div")(1,"span",35),p(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",34),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("from"))}}function pt(t,a){if(t&1&&(r(0,"div")(1,"span",35),p(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",34),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("to"))}}function ct(t,a){if(t&1&&(r(0,"div")(1,"span",35),p(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function dt(t,a){if(t&1&&(r(0,"div"),g(1,ct,3,1,"div",34),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("pageSize"))}}function ut(t,a){if(t&1){let e=y();r(0,"form",24)(1,"div",25)(2,"label",26),p(3,"Outlet"),o(),r(4,"p-select",27),g(5,at,3,5,"ng-template",null,7,w),o()(),r(7,"div",25)(8,"label",26),p(9,"From"),o(),b(10,"p-datepicker",28),g(11,mt,2,1,"div",29),o(),r(12,"div",25)(13,"label",26),p(14,"To"),o(),b(15,"p-datepicker",30),g(16,st,2,1,"div",29),o(),r(17,"div",25)(18,"label",26),p(19,"Customer"),o(),r(20,"p-autocomplete",31),I(21,"async"),R("completeMethod",function(n){h(e);let i=_();return x(i.onSearchContact(n))}),o()(),r(22,"div",25)(23,"label",26),p(24,"Page Size"),o(),b(25,"input",32),g(26,dt,2,1,"div",29),o()()}if(t&2){let e=_();c("formGroup",e.form),m(4),c("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),m(6),c("iconDisplay","input")("showIcon",!0)("ngClass",T(17,B,e.isInvalid("from"))),m(),c("ngIf",e.isInvalid("from")),m(4),c("iconDisplay","input")("showIcon",!0)("ngClass",T(19,B,e.isInvalid("to"))),m(),c("ngIf",e.isInvalid("to")),m(4),c("suggestions",Z(21,15,e.customerSuggestions$)),m(5),c("autoNumeric",j(21,Ye))("ngClass",T(22,B,e.isInvalid("pageSize"))),m(),c("ngIf",e.isInvalid("pageSize"))}}var ni=(()=>{class t extends ze{constructor(){super(),this.store=C(O),this.generateJournalService=C(A),this.authService=C(ae),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=C(fe),this.dayjsService=C(V)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:l,to:n,pageNumber:i,rowCount:u,pageSize:s,export:Le,exportPageNumber:Ge,exportRowCount:Ke,outletName:We,customerID:$e,paymentState:qe}=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(s,[me.required]),export:this.fb.control(Le),exportPageNumber:this.fb.control(Ge),exportRowCount:this.fb.control(Ke),outletName:this.fb.control(We),customerID:this.fb.control($e),paymentState:this.fb.control(qe)})}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]=Ue);break;case"from":typeof i=="object"?l[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:l[n]=i!=null?String(i):null;break;case"to":typeof i=="object"?l[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:l[n]=i!=null?String(i):null;break;default:l[n]=i===null?"":i;break}return l},{});console.log("Filter Body:",e),this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}onSearchContact(e){this.customerSuggestions$=this.generateJournalService.getCustomerSuggestions(e.query)}onSearch(e){this.store.updateFilter(f(d({},this.store.filter()),{number:e,pageNumber:1})),this.store.getARCollection(this.store.filter())}onPageChange(e){let l=e.first/e.rows;this.store.updateFilter(f(d({},this.store.filter()),{pageNumber:l+1}))}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(l=>{this.store.onRowUnselect(l)});return}else this.store.onRowUnselect(e.data)}onCreateJournal(){this.generateJournalService.createARJournal(this.store.checkedARCollection()).pipe(U(()=>this.store.getARCollection(this.store.filter))).subscribe()}static{this.\u0275fac=function(l){return new(l||t)}}static{this.\u0275cmp=K({type:t,selectors:[["app-ar-journal"]],features:[Y([O]),W],decls:8,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","AR Collection",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onHeaderCheckboxToggle","onRowSelect","onRowUnselect","value","scrollable","scrollHeight","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"],["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),X("isDialogFilterVisibleChange",function(s){return h(i),P(n.isDialogFilterVisible,s)||(n.isDialogFilterVisible=s),x(s)})("isInitDialogFilterVisibleChange",function(s){return h(i),P(n.isInitDialogFilterVisible,s)||(n.isInitDialogFilterVisible=s),x(s)}),R("filterConfirmed",function(){return h(i),x(n.onFilterOKEvent())})("search",function(s){return h(i),x(n.onSearch(s))}),g(1,et,1,1,"ng-template",null,0,w)(3,rt,10,10,"ng-template",null,1,w),p(5," <"),g(6,ut,27,24,"ng-template",null,2,w),o()}l&2&&(c("isSearchableInput",!0)("isFilterable",!0),Q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[Ve,re,ee,te,ie,ne,oe,je,ke,Me,Pe,Ce,xe,Se,be,_e,ce,le,pe,se,de,ue,Ne,Je,De,Ae,Be,Oe,he,ge,Fe,Te,Ee,He],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{ni as ARJournalComponent};