dealposbooks 5.32.0 → 5.32.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/{chunk-IU2PF53V.js → chunk-2CSSUKCF.js} +1 -1
  2. package/{chunk-WSZ5MU6V.js → chunk-2QWFLAG5.js} +1 -1
  3. package/{chunk-74MJ3NFN.js → chunk-4EUKDALJ.js} +1 -1
  4. package/{chunk-RBTNUVT5.js → chunk-4W2QF5R5.js} +1 -1
  5. package/{chunk-INXSCWN3.js → chunk-5OYK64TO.js} +1 -1
  6. package/{chunk-HAZ77TED.js → chunk-6UIJBWT6.js} +1 -1
  7. package/{chunk-OYHHWU2W.js → chunk-7I5R2CUM.js} +1 -1
  8. package/{chunk-VVHTNAHQ.js → chunk-AGLKA7OG.js} +1 -1
  9. package/{chunk-QLUQTLSH.js → chunk-ALYAGR32.js} +1 -1
  10. package/{chunk-33YEAYJV.js → chunk-B4HCPA6E.js} +1 -1
  11. package/{chunk-REXWFSN3.js → chunk-B7A5CWPE.js} +1 -1
  12. package/{chunk-2KB4NNVP.js → chunk-BDDB5AS7.js} +1 -1
  13. package/{chunk-GORMHEMA.js → chunk-BJ7FEOET.js} +1 -1
  14. package/{chunk-63YXSI43.js → chunk-CACGTOSZ.js} +1 -1
  15. package/{chunk-PV3NLUKC.js → chunk-CJ6UGNBN.js} +1 -1
  16. package/{chunk-MXBBJHYA.js → chunk-CMRVHYI7.js} +1 -1
  17. package/{chunk-W4SAEISC.js → chunk-CR2R5F5T.js} +2 -2
  18. package/{chunk-XILGARZ5.js → chunk-ERFXO32T.js} +1 -1
  19. package/{chunk-W24I5WPW.js → chunk-EXGI2AG7.js} +1 -1
  20. package/{chunk-7VQQO4OE.js → chunk-FP5LIX5S.js} +1 -1
  21. package/{chunk-UWNAF5OL.js → chunk-FSEW3LUP.js} +1 -1
  22. package/{chunk-SEGRH6C4.js → chunk-GK2S4TYF.js} +1 -1
  23. package/{chunk-XJEZJFWN.js → chunk-HICPZPJI.js} +1 -1
  24. package/{chunk-7EZGTYA2.js → chunk-HKQCPLSX.js} +1 -1
  25. package/{chunk-BQXWTZHK.js → chunk-ICOTZOJJ.js} +5 -5
  26. package/{chunk-QSWSGP4B.js → chunk-JZU6YAPX.js} +1 -1
  27. package/{chunk-3WD3CTYC.js → chunk-MEXKKLEE.js} +1 -1
  28. package/{chunk-L725MUU2.js → chunk-NCY25JG4.js} +4 -4
  29. package/{chunk-6OQPMZXU.js → chunk-OQ52MPGS.js} +1 -1
  30. package/{chunk-JPP5O2O5.js → chunk-QTALSVSB.js} +1 -1
  31. package/{chunk-C6U3U6SW.js → chunk-RPPLUBX5.js} +1 -1
  32. package/{chunk-7EJVMM7V.js → chunk-RQ4G322O.js} +1 -1
  33. package/{chunk-B5JORMF2.js → chunk-SASCD5HU.js} +1 -1
  34. package/{chunk-3LDYJV3L.js → chunk-SUYXXZHZ.js} +1 -1
  35. package/{chunk-TT745CJN.js → chunk-SZ3LQIKH.js} +1 -1
  36. package/{chunk-2BCAGP7R.js → chunk-UEWFM35O.js} +1 -1
  37. package/{chunk-AIZN44RL.js → chunk-UVXRATHG.js} +1 -1
  38. package/{chunk-6DRYMDZA.js → chunk-V5OZ47U6.js} +1 -1
  39. package/{chunk-F5Z3IX4J.js → chunk-VJBDOS6M.js} +1 -1
  40. package/{chunk-VYK2CQ72.js → chunk-VVGZUJP6.js} +1 -1
  41. package/{chunk-ZNIFAG4O.js → chunk-W4GXLPRM.js} +1 -1
  42. package/{chunk-2FU3LWGL.js → chunk-Y5FQDBGQ.js} +1 -1
  43. package/chunk-YBZSBC7H.js +7 -0
  44. package/chunk-YGEMHXDD.js +1 -0
  45. package/{chunk-RMRYZWCP.js → chunk-ZA5U4RYI.js} +1 -1
  46. package/chunk-ZGXJEG37.js +1 -0
  47. package/{chunk-MFH4UZ6J.js → chunk-ZM5TVQUU.js} +1 -1
  48. package/{chunk-A7EGGUJQ.js → chunk-ZSVULSVG.js} +1 -1
  49. package/index.html +2 -2
  50. package/main-RAHFUIZB.js +1 -0
  51. package/package.json +1 -1
  52. package/chunk-4ANXHXE3.js +0 -7
  53. package/chunk-56GDP75Z.js +0 -1
  54. package/chunk-P3V7Z3A6.js +0 -1
  55. package/main-OTYR5DFR.js +0 -1
@@ -1 +1 @@
1
- import{a as oe}from"./chunk-G4XX7EU2.js";import{a as gt,b as ft}from"./chunk-HHJMN4BS.js";import{a as dt}from"./chunk-MDH73MG3.js";import{a as wt,b as ut}from"./chunk-XILGARZ5.js";import"./chunk-MFH4UZ6J.js";import{a as Xe}from"./chunk-VVHTNAHQ.js";import"./chunk-YOUPD27G.js";import{a as st,b as ct}from"./chunk-TVNXFJII.js";import{a as mt}from"./chunk-XKI7WLHE.js";import"./chunk-AZUQDRJU.js";import{a as tt}from"./chunk-6ACYDH2N.js";import"./chunk-C2GO6SPF.js";import{a as ie,b as re}from"./chunk-O4QM64EH.js";import{b as at,d as Ve,i as lt,j as pt,k as Ne}from"./chunk-EW3R2HAB.js";import{a as rt,b as ot}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import{a as Ae}from"./chunk-XKCLERWG.js";import{a as Ie,b as we}from"./chunk-4LGDNQMZ.js";import"./chunk-PKN47FQE.js";import{a as Me,b as ke}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{b as Z}from"./chunk-5R3XKSDM.js";import{f as it,h as L}from"./chunk-UYC454VQ.js";import"./chunk-C7LM5UCK.js";import{a as N,b as A}from"./chunk-J4XRJAME.js";import{a as w,b as Fe,c as nt,d as Te,e as De,f as Pe}from"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{n as ye,o as Re,w as J,x as Q}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{b as he,c as X,e as Y,f as Ee,i as Ye,j as Je,k as ve,l as be,o as Ce,v as Qe,w as Ze,x as et,y as Se}from"./chunk-FMVCTBCQ.js";import{a as _e}from"./chunk-P3V7Z3A6.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{D as fe,F as xe,G as k,N as V,c as Ke,f as P,k as ge,l as K,m as M}from"./chunk-B63BKC6F.js";import{Ab as $e,Ac as S,Cb as h,Ga as q,J as Ue,Jc as C,Kb as m,Kc as T,Lc as G,Mc as x,Nb as se,Pb as We,Qb as $,Sb as W,Tb as z,Ub as r,Vb as n,Wb as d,X as O,Yc as ne,Z as F,_b as y,ba as pe,c as te,dc as R,ec as g,gb as l,ha as u,pa as v,qa as b,qc as a,rc as E,s as H,sc as I,ta as Ge,uc as ze,vc as ce,wa as He,wb as D,wc as me,xc as ue,yc as de,zc as U}from"./chunk-JP6RBSB3.js";import{a as f,b as _,e as It}from"./chunk-YQFG5XE2.js";var B=(()=>{class t{#e=u(_e);#t=u(Xe);getRecurringExpenseLoader(){return this.#e.get(void 0,"api/RecurringExpenseLoader/GetList")}getRecurringExpenses(e){return this.#e.post(void 0,"api/RecurringExpense/GetList",e)}fetchRecurringExpenseForm(e){return this.#e.get(void 0,`api/RecurringExpense/form/${e??""}`)}fetchSupplierSuggestion(e){let o={count:100,prefix:e};return this.#e.post(this.#t.getTenantExternalURL(),"/API/AC/GetSupplierSuggestion",o)}fetchCustomerSuggestion(e){let o={count:100,prefix:e};return this.#e.post(this.#t.getTenantExternalURL(),"/API/AC/GetCustomerSuggestion",o)}submitRecurringExpense(e,o={}){return this.#e.post(void 0,"api/RecurringExpense/submit",e,o)}removeRecurringExpense(e){return this.#e.delete(void 0,`api/RecurringExpense/${e}`,void 0)}removeRecurringExpenses(e){let o={body:e};return this.#e.delete(void 0,"api/RecurringExpense/Batch",o)}getRecurringExpenseByID(e){return this.#e.get(void 0,`api/RecurringExpense/Info/${e}`)}getAssetValueList(){return this.#e.get(void 0,"api/AssetValue/GetListt")}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275prov=pe({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Ft={data:{data:[],count:0},meta:{Options:{Frequencies:[]},Filter:{text:null,Frequency:0,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},filter:{text:null,Frequency:0,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},Le=Fe(Pe(Ft),nt(t=>({first:ne(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:ne(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().count)),hasCheckedRows:ne(()=>t.data().data.some(c=>c.checked)),checkedInvoice:ne(()=>t.data().data.filter(c=>c.checked).map(c=>c.id))})),De(t=>{let c=u(B);return{updateFilter(o){w(t,i=>_(f({},i),{filter:f(f({},i.filter),o)}))},onRowSelect(o){w(t,i=>{let s=i.data.data.map(p=>p.id===o.id?_(f({},p),{checked:!0}):p);return _(f({},i),{data:_(f({},i.data),{data:s})})})},onRowUnselect(o){w(t,i=>{let s=i.data.data.map(p=>p.id===o.id?_(f({},p),{checked:!1}):p);return _(f({},i),{data:_(f({},i.data),{data:s})})})},onHeaderCheckboxToggle(o){w(t,i=>{let s=i.data.data.map(p=>_(f({},p),{checked:o}));return _(f({},i),{data:_(f({},i.data),{data:s})})})},getRecurringExpenseLoader:ie(te(O(()=>c.getRecurringExpenseLoader().pipe(re({next:o=>{w(t,i=>_(f({},i),{meta:o}))},error:o=>{console.error("Error fetching Recurring Expense Loader:",o)}}))))),getRecurringExpenses:ie(te(H(o=>Object.entries(o).reduce((i,[s,p])=>(p!=null&&(i[s]=p),i),{})),O(o=>c.getRecurringExpenses(o).pipe(re({next:i=>{w(t,s=>_(f({},s),{data:i}))},error:i=>{console.error("Error fetching Recurring Expenses:",i)}})))))}}),Te(t=>({onInit:()=>{t.getRecurringExpenseLoader(),t.getRecurringExpenses(t.filter)}})));var Pt=["class","page"],Mt=()=>({height:"calc(100vh - 70px)"}),kt=t=>["details/",t];function Vt(t,c){if(t&1){let e=y();r(0,"p-button",12),R("onClick",function(){v(e);let i=g(2);return b(i.onDeleteSelected())}),n()}}function Nt(t,c){if(t&1&&(r(0,"div",8),h(1,Vt,1,0,"p-button",9),r(2,"a",10),d(3,"i",11),r(4,"span"),a(5,"Add"),n()()()),t&2){let e=g();l(),m("ngIf",e.store.hasCheckedRows())}}function At(t,c){t&1&&(r(0,"tr")(1,"th"),d(2,"p-tableHeaderCheckbox"),n(),r(3,"th"),a(4,"Outlet"),n(),r(5,"th"),a(6,"Name"),n(),r(7,"th"),a(8,"Expense Account"),n(),r(9,"th"),a(10,"Start Date"),n(),r(11,"th"),a(12,"End Date"),n(),r(13,"th"),a(14,"Last Expense"),n(),r(15,"th"),a(16,"Amount"),n(),r(17,"th"),a(18,"Frequency"),n()())}function Lt(t,c){if(t&1&&(r(0,"tr")(1,"td"),d(2,"p-tableCheckbox",14),n(),r(3,"td"),a(4),n(),r(5,"td")(6,"a",15),a(7),n()(),r(8,"td"),a(9),n(),r(10,"td"),a(11),C(12,"date"),n(),r(13,"td"),a(14),C(15,"date"),n(),r(16,"td"),a(17),C(18,"date"),n(),r(19,"td"),a(20),C(21,"number"),n(),r(22,"td"),a(23),n()()),t&2){let e=c.$implicit;l(2),m("value",e),l(2),E(e.outletName),l(2),m("routerLink",S(21,kt,e.id)),l(),E(e.name),l(2),E(e.expenseName),l(2),E(G(12,10,e.startDate,"d MMM y")),l(3),E(G(15,13,e.endDate,"d MMM y")),l(3),E(G(18,16,e.lastExpenseDate,"d MMM y")),l(3),E(T(21,19,e.amount)),l(3),E(e.repeatTypeLabel)}}function Bt(t,c){if(t&1&&(r(0,"div"),a(1),n()),t&2){let e=g(2);l(),ze(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().count," entries ")}}function jt(t,c){t&1&&(r(0,"tr")(1,"td",16)(2,"span"),a(3,"No recurring expenses found."),n()()())}function Ot(t,c){if(t&1){let e=y();r(0,"p-panel")(1,"p-table",13),R("onPage",function(i){v(e);let s=g();return b(s.onPageChange(i))})("onHeaderCheckboxToggle",function(i){v(e);let s=g();return b(s.onHeaderCheckboxToggle(i))})("onRowSelect",function(i){v(e);let s=g();return b(s.onRowSelect(i))})("onRowUnselect",function(i){v(e);let s=g();return b(s.onRowUnselect(i))}),h(2,At,19,0,"ng-template",null,3,x)(4,Lt,24,23,"ng-template",null,4,x)(6,Bt,2,3,"ng-template",null,5,x)(8,jt,4,0,"ng-template",null,6,x),n()()}if(t&2){let e=g();se(U(9,Mt)),l(),m("scrollable",!0)("scrollHeight","calc(100vh - 142px)")("lazy",!0)("totalRecords",e.store.data().count)("rows",e.store.filter().pageSize)("paginator",!0)("value",e.store.data().data)}}function qt(t,c){if(t&1&&(r(0,"form",17)(1,"div",18)(2,"label",19),a(3,"Type"),n(),d(4,"p-select",20),n()()),t&2){let e=g();m("formGroup",e.form),l(4),m("options",e.store.meta().Options.Frequencies)}}var ht=(()=>{class t extends mt{constructor(){super(...arguments),this.store=u(Le),this.recurringExpenseService=u(B),this.fb=u(Qe),this.isDialogFilterVisible=q(!1)}ngOnInit(){this.initForm()}onPageChange(e){let o=e.first/e.rows;this.store.updateFilter(_(f({},this.store.filter()),{pageNumber:o+1}))}onDeleteSelected(){this.recurringExpenseService.removeRecurringExpenses(this.store.checkedInvoice()).pipe(F(()=>{this.store.updateFilter(_(f({},this.store.filter()),{pageNumber:1}))})).subscribe()}onSearchEvent(e){this.store.updateFilter(_(f({},this.store.filter()),{text:e}))}onFilterEvent(){this.onSubmitFilterDialog()}onSubmitFilterDialog(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((o,[i,s])=>(s!=null&&(o[i]=s),o),{});this.store.updateFilter(e),this.isDialogFilterVisible.update(o=>!o)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(o=>{this.store.onRowUnselect(o)});return}else this.store.onRowUnselect(e.data)}initForm(){let{text:e,Frequency:o,pageNumber:i,rowCount:s,pageSize:p,export:j,exportPageNumber:yt,exportRowCount:Rt}=this.store.filter();this.form=this.fb.group({text:this.fb.control(e),Frequency:this.fb.control(o),pageNumber:this.fb.control(i),rowCount:this.fb.control(s),pageSize:this.fb.control(p),export:this.fb.control(j),exportPageNumber:this.fb.control(yt),exportRowCount:this.fb.control(Rt)})}static{this.\u0275fac=(()=>{let e;return function(i){return(e||(e=Ge(t)))(i||t)}})()}static{this.\u0275cmp=D({type:t,selectors:[["app-recurring-expense",8,"page"]],features:[de([Le]),$e],attrs:Pt,decls:7,vars:3,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["pageTitle","Recurring Expenses",3,"search","isDialogFilterVisibleChange","filterConfirmed","isSearchableInput","isFilterable","isDialogFilterVisible"],[1,"d-flex","gap-2"],["severity","danger","label","Delete","icon","fa-solid fa-trash",3,"onClick",4,"ngIf"],["routerLink","create",1,"p-button"],[1,"fa-solid","fa-plus"],["severity","danger","label","Delete","icon","fa-solid fa-trash",3,"onClick"],["dataKey","id","styleClass","d-flex flex-column justify-content-between h-100",3,"onPage","onHeaderCheckboxToggle","onRowSelect","onRowUnselect","scrollable","scrollHeight","lazy","totalRecords","rows","paginator","value"],[3,"value"],[1,"link-primary",3,"routerLink"],["colspan","9"],[1,"d-flex","flex-column",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["formControlName","Frequency","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select Type",3,"options"]],template:function(o,i){if(o&1){let s=y();r(0,"app-main-panel",7),R("search",function(j){return v(s),b(i.onSearchEvent(j))}),ue("isDialogFilterVisibleChange",function(j){return v(s),me(i.isDialogFilterVisible,j)||(i.isDialogFilterVisible=j),b(j)}),R("filterConfirmed",function(){return v(s),b(i.onFilterEvent())}),h(1,Nt,6,1,"ng-template",null,0,x)(3,Ot,10,10,"ng-template",null,1,x)(5,qt,5,2,"ng-template",null,2,x),n()}o&2&&(m("isSearchableInput",!0)("isFilterable",!0),ce("isDialogFilterVisible",i.isDialogFilterVisible))},dependencies:[L,k,Z,Ne,Ve,lt,pt,M,P,K,ge,V,it,ke,Me,Q,J,Se,ve,Y,Ee,be,Ce,A,N],styles:["[_nghost-%COMP%]{display:block} .p-card{height:100%} .p-card .p-card-body{height:inherit} .p-card .p-card-body .p-card-content{height:inherit}"],changeDetection:0})}}return t})();var ee=It(wt());var Ht=["class","page"],$t=()=>["/pages/recurring/recurring-expense"],le=t=>({"ng-dirty ng-invalid":t}),Wt=()=>({});function zt(t,c){if(t&1){let e=y();r(0,"div",5)(1,"a",6),a(2," Cancel "),n(),r(3,"p-button",7),R("click",function(){v(e);let i=g();return b(i.onSubmit())}),n()()}t&2&&(l(),m("routerLink",U(1,$t)))}function Kt(t,c){if(t&1&&(r(0,"small",19),a(1),n()),t&2){let e=c.$implicit;l(),E(e)}}function Xt(t,c){if(t&1&&(r(0,"div",32)(1,"div",33),a(2),n()()),t&2){let e=c.$implicit;l(2),I(" ",e.name," ")}}function Yt(t,c){if(t&1&&(r(0,"small",19),a(1),n()),t&2){let e=c.$implicit;l(),E(e)}}function Jt(t,c){if(t&1&&(r(0,"small",19),a(1),n()),t&2){let e=c.$implicit;l(),E(e)}}function Qt(t,c){if(t&1&&(r(0,"div",5)(1,"div")(2,"span"),a(3),n()(),r(4,"div",33),a(5),n()()),t&2){let e=c.$implicit;l(3),I("(",e.code,")"),l(2),I(" ",e.value," ")}}function Zt(t,c){if(t&1&&(r(0,"small",19),a(1),n()),t&2){let e=c.$implicit;l(),E(e)}}function en(t,c){if(t&1&&(r(0,"div",5)(1,"div")(2,"span"),a(3),n()(),r(4,"div",33),a(5),n()()),t&2){let e=c.$implicit;l(3),I("(",e.code,")"),l(2),I(" ",e.value," ")}}function tn(t,c){if(t&1&&(r(0,"small",19),a(1),n()),t&2){let e=c.$implicit;l(),E(e)}}function nn(t,c){if(t&1){let e=y();r(0,"div",9)(1,"div",10)(2,"p-panel",11)(3,"p-scroll-panel")(4,"div",12)(5,"div",13)(6,"form",14)(7,"div",15)(8,"div",13)(9,"div",16)(10,"label",17),a(11,"Name"),n(),d(12,"input",18),r(13,"div"),W(14,Kt,2,1,"small",19,$),n()()(),r(16,"div",20,2)(18,"div",16)(19,"label",17),a(20,"Outlet"),n(),r(21,"p-select",21),h(22,Xt,3,1,"ng-template",null,3,x),n()()(),r(24,"div",20)(25,"div",16)(26,"div")(27,"label",17),a(28,"Supplier"),n(),r(29,"p-autocomplete",22),R("completeMethod",function(i){v(e);let s=g(2);return b(s.searchContact(i))}),n()(),r(30,"div"),W(31,Yt,2,1,"small",19,$),n()()(),r(33,"div",20)(34,"div",16)(35,"label",17),a(36,"From"),n(),d(37,"p-datepicker",23),n()(),r(38,"div",20)(39,"div",16)(40,"label",17),a(41,"To"),n(),d(42,"p-datepicker",24),n()(),d(43,"div",25),n(),d(44,"hr"),r(45,"div",15)(46,"div",20)(47,"div",16)(48,"label",17),a(49,"Amount"),n(),d(50,"input",26),r(51,"div"),W(52,Jt,2,1,"small",19,$),n()()(),r(54,"div",20)(55,"div",16)(56,"label",17),a(57,"Frequency"),n(),d(58,"p-select",27),n()(),r(59,"div",20)(60,"div",16)(61,"label",17),a(62,"Expense (Debit)"),n(),r(63,"p-select",28),h(64,Qt,6,2,"ng-template",null,3,x),n()(),r(66,"div"),W(67,Zt,2,1,"small",19,$),n()(),r(69,"div",20)(70,"div",16)(71,"label",17),a(72,"Payment (Credit)"),n(),r(73,"p-select",29),h(74,en,6,2,"ng-template",null,3,x),n()(),r(76,"div"),W(77,tn,2,1,"small",19,$),n()(),r(79,"div",30)(80,"div",16)(81,"label",17),a(82,"Description"),n(),d(83,"textarea",31),n()()()()()()()()()()}if(t&2){let e,o,i,s,p=g(2);l(6),m("formGroup",p.recurringExpenseForm),l(6),m("ngClass",S(17,le,p.isInvalid("name"))),l(2),z(p.getErrors("name")),l(7),m("options",(e=p.recurringExpenseData())==null||e.options==null?null:e.options.entities),l(8),m("showClear",!0)("ngClass",S(19,le,p.isInvalid("contact")))("suggestions",p.customerSupplierSuggestions()),l(2),z(p.getErrors("contact")),l(6),m("iconDisplay","input")("showIcon",!0),l(5),m("iconDisplay","input")("showIcon",!0),l(8),m("ngClass",S(21,le,p.isInvalid("amount")))("autoNumeric",U(23,Wt)),l(2),z(p.getErrors("amount")),l(6),m("options",(o=p.recurringExpenseData())==null||o.options==null?null:o.options.frequency),l(5),m("options",(i=p.recurringExpenseData())==null||i.options==null?null:i.options.expenses)("ngClass",S(24,le,p.isInvalid("expenseAccountID"))),l(4),z(p.getErrors("expenseAccountID")),l(6),m("ngClass",S(26,le,p.isInvalid("paymentAccountID")))("options",(s=p.recurringExpenseData())==null||s.options==null?null:s.options.assets),l(4),z(p.getErrors("paymentAccountID"))}}function rn(t,c){if(t&1&&h(0,nn,84,28,"div",8),t&2){let e=g();m("ngIf",e.recurringExpenseData())}}var Oe=(()=>{class t{constructor(){this.recurringExpenseService=u(B),this.fb=u(Ze),this.destroyRef=u(He),this.route=u(fe),this.recurringExpenseData=q(null),this.customerSupplierSuggestions=q([]),this.router=u(xe),this.contactType=new Ye(0),this.dayjsService=u(ut)}ngOnInit(){this.initializeForm(),this.fetchRecurringExpenseForm()}initializeForm(){this.recurringExpenseForm=this.fb.group({id:this.fb.control(""),name:this.fb.control("",[X.required]),repeatTypeID:this.fb.control(1,[X.required]),startDate:this.fb.control((0,ee.default)().toISOString()),endDate:this.fb.control(null),lastExpenseDate:this.fb.control(""),amount:this.fb.control(0,[X.required]),paymentAccountID:this.fb.control(null,[X.required]),expenseAccountID:this.fb.control(null,[X.required]),contact:this.fb.control("",[]),description:this.fb.control(""),repeatTypeLabel:this.fb.control(""),outletID:this.fb.control(""),creatorID:this.fb.control(""),created:this.fb.control(""),modifierID:this.fb.control(""),modified:this.fb.control("")})}fetchRecurringExpenseForm(){this.route.paramMap.pipe(H(e=>e.get("id")),O(e=>e?this.recurringExpenseService.fetchRecurringExpenseForm(e):this.recurringExpenseService.fetchRecurringExpenseForm()),F(e=>{this.recurringExpenseData.set(e),this.updateFormWithRecurringExpense(e.form)})).subscribe()}updateFormWithRecurringExpense(e){let o=Object.entries(e).reduce((i,[s,p])=>{switch(s){case"startDate":i[s]=(0,ee.default)(p).isSame((0,ee.default)("0001-01-01T00:00:00"))?(0,ee.default)().toDate():(0,ee.default)(p).toDate();break;case"repeatTypeID":i[s]=1;break;case"contactID":i.contact=e.contactID?{Key:e.contactID,Value:e.contactName}:null;break;case"paymentAccountID":i[s]=p===oe?null:p;break;case"expenseAccountID":i[s]=p===oe?null:p;break;default:i[s]=p}return i},{});this.recurringExpenseForm.patchValue(o)}searchContact(e){this.recurringExpenseService.fetchSupplierSuggestion(e.query).pipe(F(this.customerSupplierSuggestions.set)).subscribe()}onSubmit(){let e=this.recurringExpenseForm.value;if(this.recurringExpenseForm.invalid){this.recurringExpenseForm.markAllAsTouched();return}let o=Object.entries(e).reduce((i,[s,p])=>{switch(s){case"amount":i[s]=+p;break;case"startDate":i[s]=p?this.dayjsService.from(p).format():null;break;case"endDate":i[s]=p?this.dayjsService.from(p).format():null;break;case"contact":typeof p=="string"?i.contactID=p:typeof p=="object"&&p!==null?i.contactID=p&&Object.prototype.hasOwnProperty.call(p,"Key")?p.Key:p:i.contactID=oe;break;default:i[s]=p;break}return i},{});this.recurringExpenseService.submitRecurringExpense(o).pipe(F(()=>{this.router.navigate(["/pages/recurring/recurring-expense"])})).subscribe()}isInvalid(e){let o=this.recurringExpenseForm.controls[e];return o.invalid&&(o.dirty||o.touched)}getErrors(e){if(!this.isInvalid(e))return null;let o=this.recurringExpenseForm.controls[e];if(!o.errors)return null;let i=[];for(let[s,p]of Object.entries(o.errors))switch(s){case"required":i.push("This field is required.");break;case"minlength":i.push(`Minimum length is ${p.requiredLength} characters.`);break;case"maxlength":i.push(`Maximum length is ${p.requiredLength} characters.`);break;case"email":i.push("Please enter a valid email address.");break;case"pattern":i.push("The format is invalid.");break;case"min":i.push(`Minimum value is ${p.min}.`);break;case"max":i.push(`Maximum value is ${p.max}.`);break;default:i.push("Invalid value.")}return i}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=D({type:t,selectors:[["app-recurring-expense-form",8,"page"]],attrs:Ht,decls:5,vars:2,consts:[["actionButton",""],["content",""],["outlet",""],["item",""],["pageTitle","Recurring Expense Form",3,"hasMainWrapperPadding","overflowScroll"],[1,"d-flex","gap-2"],["type","button",1,"p-button","p-button-secondary","p-button-outlined",3,"routerLink"],["label","Submit","icon","fa-solid fa-plus",3,"click"],["class","row justify-content-center",4,"ngIf"],[1,"row","justify-content-center"],[1,"col-6"],[1,"h-100","d-flex"],[1,"row","justify-content-center","h-100"],[1,"col-12"],[1,"d-flex","flex-column","row-gap-2",3,"formGroup"],[1,"row","row-gap-2"],[1,"d-flex","flex-column"],["for",""],["formControlName","name","type","text","pInputText","",3,"ngClass"],[1,"text-danger"],[1,"col","col-lg-6"],["filter","","filterBy","name","appendTo","body","formControlName","outletID","optionLabel","name","optionValue","id","placeholder","Select Outlet",3,"options"],["formControlName","contact","inputStyleClass","w-100","styleClass","w-100","optionLabel","Value","optionValue","Key",3,"completeMethod","showClear","ngClass","suggestions"],["dateFormat","mm/dd/yy","appendTo","body","formControlName","startDate","styleClass","w-100","inputId","icondisplay",3,"iconDisplay","showIcon"],["appendTo","body","formControlName","endDate","styleClass","w-100","inputId","icondisplay",3,"iconDisplay","showIcon"],[1,"col"],["formControlName","amount","type","text","pInputText","",3,"ngClass","autoNumeric"],["appendTo","body","formControlName","repeatTypeID","optionLabel","value","optionValue","key","placeholder","Select Outlet",3,"options"],["appendTo","body","formControlName","expenseAccountID","optionLabel","value","optionValue","key","placeholder","Select Expense","filter","","filterBy","code,value",3,"options","ngClass"],["appendTo","body","formControlName","paymentAccountID","optionLabel","value","optionValue","key","filter","","filterBy","code,value","placeholder","Select Payment",3,"ngClass","options"],[1,"col","col-lg-12"],["formControlName","description","rows","3","cols","30","pTextarea",""],[1,"flex","items-center","gap-2"],[1,"text-truncate","d-inline-block",2,"max-width","250px"]],template:function(o,i){o&1&&(r(0,"app-main-panel",4),h(1,zt,4,2,"ng-template",null,0,x)(3,rn,1,1,"ng-template",null,1,x),n()),o&2&&m("hasMainWrapperPadding",!0)("overflowScroll",!0)},dependencies:[L,Z,Re,ye,ke,Me,ot,rt,ft,gt,ct,st,we,Ie,M,Ke,P,Se,ve,he,Y,Ee,be,Ce,V,k,Q,J,dt,A,N,at],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var on=["class","page"],an=t=>["/pages/recurring/recurring-expense/edit",t];function ln(t,c){if(t&1&&(r(0,"a",7),d(1,"i",8),r(2,"span"),a(3,"Edit"),n()()),t&2){let e=g(4);m("routerLink",S(1,an,e.currentRecurringExpense().id))}}function pn(t,c){if(t&1){let e=y();r(0,"p-button",9),R("onClick",function(){v(e);let i=g(4);return b(i.onDeleteRecurringExpense(i.currentRecurringExpense().id))}),n()}}function sn(t,c){if(t&1&&(r(0,"div",4),h(1,ln,4,3,"a",5)(2,pn,1,0,"p-button",6),n()),t&2){let e=g(3);l(),m("ngIf",e.roleService.setup.recurring),l(),m("ngIf",e.roleService.setup.recurring)}}function cn(t,c){if(t&1&&h(0,sn,3,2,"div",3),t&2){let e=g(2);m("ngIf",e.currentRecurringExpense())}}function mn(t,c){if(t&1){let e=y();r(0,"p-panel",13)(1,"p-scroll-panel")(2,"div",10)(3,"div",14)(4,"div",15)(5,"div",14)(6,"div",16)(7,"div",17)(8,"div",18)(9,"label",19),a(10,"Outlet"),n(),r(11,"input",20),ue("ngModelChange",function(i){v(e);let s=g(3);return me(s.currentRecurringExpense().outletName,i)||(s.currentRecurringExpense().outletName=i),b(i)}),n()()(),r(12,"div",17)(13,"div",18)(14,"label",19),a(15,"Supplier"),n(),d(16,"input",21),n()(),r(17,"div",17)(18,"div",18)(19,"label",19),a(20,"From"),n(),d(21,"input",22),C(22,"date"),n()(),r(23,"div",17)(24,"div",18)(25,"label",19),a(26,"To"),n(),d(27,"input",22),C(28,"date"),n()()(),d(29,"hr"),r(30,"div",16)(31,"div",17)(32,"div",18)(33,"label",19),a(34,"Amount"),n(),d(35,"input",22),C(36,"number"),n()(),r(37,"div",17)(38,"div",18)(39,"label",19),a(40,"Frequency"),n(),d(41,"input",22),n()(),r(42,"div",17)(43,"div",18)(44,"label",19),a(45,"Expense (Debit)"),n(),d(46,"input",22),n()(),r(47,"div",17)(48,"div",18)(49,"label",19),a(50,"Payment (Credit)"),n(),d(51,"input",22),n()(),r(52,"div",23)(53,"div",18)(54,"label",19),a(55,"Description"),n(),d(56,"textarea",24),n()()()()()()()()()}if(t&2){let e=g(3);l(11),ce("ngModel",e.currentRecurringExpense().outletName),l(5),m("value",e.currentRecurringExpense().contactName),l(5),m("value",G(22,9,e.currentRecurringExpense().startDate,"d MMM y")),l(6),m("value",G(28,12,e.currentRecurringExpense().endDate,"d MMM y")),l(8),m("value",T(36,15,e.currentRecurringExpense().amount)),l(6),m("value",e.currentRecurringExpense().repeatTypeLabel),l(5),m("value",e.currentRecurringExpense().expenseName),l(5),m("value",e.currentRecurringExpense().paymentName),l(5),m("value",e.currentRecurringExpense().description)}}function un(t,c){if(t&1&&(r(0,"div",10)(1,"div",11),h(2,mn,57,17,"p-panel",12),n()()),t&2){let e=g(2);l(2),m("ngIf",e.currentRecurringExpense())}}function dn(t,c){if(t&1&&(r(0,"app-main-panel",2),h(1,cn,1,1,"ng-template",null,0,x)(3,un,3,1,"ng-template",null,1,x),n()),t&2){let e=g();m("pageTitle",e.currentRecurringExpense().name+" Info")("hasMainWrapperPadding",!0)("overflowScroll",!0)}}var vt=(()=>{class t{constructor(){this.recurringExpenseService=u(B),this.route=u(fe),this.router=u(xe),this.currentRecurringExpense=q(null),this.roleService=u(tt)}ngOnInit(){this.route.paramMap.pipe(H(e=>e.get("id")),Ae("params"),Ue(e=>this.recurringExpenseService.getRecurringExpenseByID(e)),F(e=>this.currentRecurringExpense.set(e)),Ae("recurringExpense")).subscribe()}onDeleteRecurringExpense(e){this.recurringExpenseService.removeRecurringExpense(e).pipe(F(()=>{this.router.navigate(["/pages/recurring/recurring-expense"])})).subscribe()}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=D({type:t,selectors:[["app-recurring-expense-info",8,"page"]],attrs:on,decls:1,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle","hasMainWrapperPadding","overflowScroll"],["class","d-flex gap-2",4,"ngIf"],[1,"d-flex","gap-2"],["class","p-button p-button-outlined p-button-secondary d-flex gap-2 align-items-center",3,"routerLink",4,"ngIf"],["icon","fa-solid fa-trash","label","Delete","severity","danger",3,"onClick",4,"ngIf"],[1,"p-button","p-button-outlined","p-button-secondary","d-flex","gap-2","align-items-center",3,"routerLink"],[1,"fa-solid","fa-pen-to-square"],["icon","fa-solid fa-trash","label","Delete","severity","danger",3,"onClick"],[1,"row","justify-content-center"],[1,"col-6"],["class","h-100 d-flex",4,"ngIf"],[1,"h-100","d-flex"],[1,"col"],[1,"row"],[1,"row","row-gap-2"],[1,"col","col-lg-6"],[1,"d-flex","flex-column"],["for",""],["readonly","","type","text","pInputText","",3,"ngModelChange","ngModel"],["type","text","readonly","","pInputText","",3,"value"],["readonly","","type","text","pInputText","",3,"value"],[1,"col","col-lg-12"],["readonly","","rows","5","cols","30","pTextarea","",3,"value"]],template:function(o,i){o&1&&h(0,dn,5,3,"app-main-panel",2),o&2&&We(i.currentRecurringExpense()?0:-1)},dependencies:[L,Z,M,P,K,ge,Re,ye,et,he,Y,Je,Q,J,V,k,A,N,we,Ie],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var bt=[{path:"",redirectTo:"",pathMatch:"full"},{path:"",children:[{path:"",component:ht},{path:"create",component:Oe},{path:"details/:id",component:vt},{path:"edit/:id",component:Oe}]}];var Ct=(()=>{class t{constructor(){this.httpService=u(_e)}getAssetValue(e){return this.httpService.post(void 0,"/api/AssetValue/GetList",e)}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275prov=pe({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var gn={filter:{Text:"",Frequency:0,PageNumber:1,RowCount:10},data:null},qe=Fe(Pe(gn),De(t=>{let c=u(Ct);return{getAssetValue:ie(te(O(o=>c.getAssetValue(o).pipe(re({next:i=>{w(t,s=>_(f({},s),{data:i}))},error:i=>{console.error("Error fetching asset value:",i)}}))))),updateFilter:o=>{w(t,i=>_(f({},i),{filter:o}))}}}),Te({onInit:t=>{t.getAssetValue(t.filter())}}));var fn=()=>({height:"calc(100vh - 70px)"}),xn=t=>["/pages/recurring/recurring-expense/details/",t];function _n(t,c){t&1&&d(0,"div",5)}function hn(t,c){t&1&&(r(0,"tr")(1,"th"),a(2,"Outlet"),n(),r(3,"th"),a(4,"Name"),n(),r(5,"th"),a(6,"Account Code"),n(),r(7,"th",8),a(8,"Price on Purchase"),n(),r(9,"th",8),a(10,"Accomulated Depreciation"),n(),r(11,"th",8),a(12,"Book Value"),n(),r(13,"th",8),a(14,"Frequency"),n()())}function En(t,c){if(t&1&&(r(0,"tr")(1,"td"),a(2),n(),r(3,"td")(4,"a",9),a(5),n()(),r(6,"td"),a(7),n(),r(8,"td",8),a(9),C(10,"number"),n(),r(11,"td",8),a(12),C(13,"number"),n(),r(14,"td",8),a(15),C(16,"number"),n(),r(17,"td",8),a(18),C(19,"number"),n()()),t&2){let e=c.$implicit;l(2),E(e.entityName),l(2),m("routerLink",S(16,xn,e.id)),l(),E(e.name),l(2),E(e.accountCode),l(2),E(T(10,8,e.priceOnPurchase)),l(3),I(" ",T(13,10,e.accumulatedDepreciation)," "),l(3),I(" ",T(16,12,e.bookValue)," "),l(3),I(" ",T(19,14,e.depreciationPerYear)," ")}}function vn(t,c){if(t&1&&(r(0,"p-panel")(1,"p-table",7),h(2,hn,15,0,"ng-template",null,2,x)(4,En,20,18,"ng-template",null,3,x),n()()),t&2){let e=g(2);se(U(7,fn)),l(),m("value",e.store.data().data)("rows",e.store.filter().RowCount)("totalRecords",e.store.data().count)("scrollable",!0)("scrollHeight","calc(100vh - 200px)")}}function bn(t,c){if(t&1&&h(0,vn,6,8,"p-panel",6),t&2){let e=g();m("ngIf",e.store.data())}}var St=(()=>{class t{constructor(){this.store=u(qe)}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=D({type:t,selectors:[["app-asset-value"]],features:[de([qe])],decls:5,vars:1,consts:[["actionButton",""],["content",""],["header",""],["body",""],["pageTitle","Asset Value",3,"isSearchableInput"],[1,"d-flex","gap-2"],[3,"style",4,"ngIf"],["styleClass","h-100","dataKey","id",1,"",3,"value","rows","totalRecords","scrollable","scrollHeight"],[1,"text-end"],["target","_blank",1,"link","link-primary",3,"routerLink"]],template:function(o,i){o&1&&(r(0,"app-main-panel",4),h(1,_n,1,0,"ng-template",null,0,x)(3,bn,1,1,"ng-template",null,1,x),n()),o&2&&m("isSearchableInput",!0)},dependencies:[L,M,P,K,A,N,Ne,Ve,V,k],encapsulation:2})}}return t})();var xr=[{path:"",redirectTo:"recurring-expense",pathMatch:"full"},{path:"recurring-expense",children:bt},{path:"asset-value",component:St},{path:"post-to-journal",loadComponent:()=>import("./chunk-RMRYZWCP.js").then(t=>t.PostRecurringExpenseComponent)}];export{xr as RECURRING_ROUTES};
1
+ import{a as oe}from"./chunk-G4XX7EU2.js";import{a as gt,b as ft}from"./chunk-HHJMN4BS.js";import{a as dt}from"./chunk-MDH73MG3.js";import{a as wt,b as ut}from"./chunk-ERFXO32T.js";import"./chunk-ZM5TVQUU.js";import{a as Xe}from"./chunk-AGLKA7OG.js";import"./chunk-YOUPD27G.js";import{a as st,b as ct}from"./chunk-TVNXFJII.js";import{a as mt}from"./chunk-XKI7WLHE.js";import"./chunk-AZUQDRJU.js";import{a as tt}from"./chunk-6ACYDH2N.js";import"./chunk-C2GO6SPF.js";import{a as ie,b as re}from"./chunk-O4QM64EH.js";import{b as at,d as Ve,i as lt,j as pt,k as Ne}from"./chunk-EW3R2HAB.js";import{a as rt,b as ot}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import{a as Ae}from"./chunk-XKCLERWG.js";import{a as Ie,b as we}from"./chunk-4LGDNQMZ.js";import"./chunk-PKN47FQE.js";import{a as Me,b as ke}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{b as Z}from"./chunk-5R3XKSDM.js";import{f as it,h as L}from"./chunk-UYC454VQ.js";import"./chunk-C7LM5UCK.js";import{a as N,b as A}from"./chunk-J4XRJAME.js";import{a as w,b as Fe,c as nt,d as Te,e as De,f as Pe}from"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{n as ye,o as Re,w as J,x as Q}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{b as he,c as X,e as Y,f as Ee,i as Ye,j as Je,k as ve,l as be,o as Ce,v as Qe,w as Ze,x as et,y as Se}from"./chunk-FMVCTBCQ.js";import{a as _e}from"./chunk-ZGXJEG37.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{D as fe,F as xe,G as k,N as V,c as Ke,f as P,k as ge,l as K,m as M}from"./chunk-B63BKC6F.js";import{Ab as $e,Ac as S,Cb as h,Ga as q,J as Ue,Jc as C,Kb as m,Kc as T,Lc as G,Mc as x,Nb as se,Pb as We,Qb as $,Sb as W,Tb as z,Ub as r,Vb as n,Wb as d,X as O,Yc as ne,Z as F,_b as y,ba as pe,c as te,dc as R,ec as g,gb as l,ha as u,pa as v,qa as b,qc as a,rc as E,s as H,sc as I,ta as Ge,uc as ze,vc as ce,wa as He,wb as D,wc as me,xc as ue,yc as de,zc as U}from"./chunk-JP6RBSB3.js";import{a as f,b as _,e as It}from"./chunk-YQFG5XE2.js";var B=(()=>{class t{#e=u(_e);#t=u(Xe);getRecurringExpenseLoader(){return this.#e.get(void 0,"api/RecurringExpenseLoader/GetList")}getRecurringExpenses(e){return this.#e.post(void 0,"api/RecurringExpense/GetList",e)}fetchRecurringExpenseForm(e){return this.#e.get(void 0,`api/RecurringExpense/form/${e??""}`)}fetchSupplierSuggestion(e){let o={count:100,prefix:e};return this.#e.post(this.#t.getTenantExternalURL(),"/API/AC/GetSupplierSuggestion",o)}fetchCustomerSuggestion(e){let o={count:100,prefix:e};return this.#e.post(this.#t.getTenantExternalURL(),"/API/AC/GetCustomerSuggestion",o)}submitRecurringExpense(e,o={}){return this.#e.post(void 0,"api/RecurringExpense/submit",e,o)}removeRecurringExpense(e){return this.#e.delete(void 0,`api/RecurringExpense/${e}`,void 0)}removeRecurringExpenses(e){let o={body:e};return this.#e.delete(void 0,"api/RecurringExpense/Batch",o)}getRecurringExpenseByID(e){return this.#e.get(void 0,`api/RecurringExpense/Info/${e}`)}getAssetValueList(){return this.#e.get(void 0,"api/AssetValue/GetListt")}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275prov=pe({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Ft={data:{data:[],count:0},meta:{Options:{Frequencies:[]},Filter:{text:null,Frequency:0,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},filter:{text:null,Frequency:0,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},Le=Fe(Pe(Ft),nt(t=>({first:ne(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:ne(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().count)),hasCheckedRows:ne(()=>t.data().data.some(c=>c.checked)),checkedInvoice:ne(()=>t.data().data.filter(c=>c.checked).map(c=>c.id))})),De(t=>{let c=u(B);return{updateFilter(o){w(t,i=>_(f({},i),{filter:f(f({},i.filter),o)}))},onRowSelect(o){w(t,i=>{let s=i.data.data.map(p=>p.id===o.id?_(f({},p),{checked:!0}):p);return _(f({},i),{data:_(f({},i.data),{data:s})})})},onRowUnselect(o){w(t,i=>{let s=i.data.data.map(p=>p.id===o.id?_(f({},p),{checked:!1}):p);return _(f({},i),{data:_(f({},i.data),{data:s})})})},onHeaderCheckboxToggle(o){w(t,i=>{let s=i.data.data.map(p=>_(f({},p),{checked:o}));return _(f({},i),{data:_(f({},i.data),{data:s})})})},getRecurringExpenseLoader:ie(te(O(()=>c.getRecurringExpenseLoader().pipe(re({next:o=>{w(t,i=>_(f({},i),{meta:o}))},error:o=>{console.error("Error fetching Recurring Expense Loader:",o)}}))))),getRecurringExpenses:ie(te(H(o=>Object.entries(o).reduce((i,[s,p])=>(p!=null&&(i[s]=p),i),{})),O(o=>c.getRecurringExpenses(o).pipe(re({next:i=>{w(t,s=>_(f({},s),{data:i}))},error:i=>{console.error("Error fetching Recurring Expenses:",i)}})))))}}),Te(t=>({onInit:()=>{t.getRecurringExpenseLoader(),t.getRecurringExpenses(t.filter)}})));var Pt=["class","page"],Mt=()=>({height:"calc(100vh - 70px)"}),kt=t=>["details/",t];function Vt(t,c){if(t&1){let e=y();r(0,"p-button",12),R("onClick",function(){v(e);let i=g(2);return b(i.onDeleteSelected())}),n()}}function Nt(t,c){if(t&1&&(r(0,"div",8),h(1,Vt,1,0,"p-button",9),r(2,"a",10),d(3,"i",11),r(4,"span"),a(5,"Add"),n()()()),t&2){let e=g();l(),m("ngIf",e.store.hasCheckedRows())}}function At(t,c){t&1&&(r(0,"tr")(1,"th"),d(2,"p-tableHeaderCheckbox"),n(),r(3,"th"),a(4,"Outlet"),n(),r(5,"th"),a(6,"Name"),n(),r(7,"th"),a(8,"Expense Account"),n(),r(9,"th"),a(10,"Start Date"),n(),r(11,"th"),a(12,"End Date"),n(),r(13,"th"),a(14,"Last Expense"),n(),r(15,"th"),a(16,"Amount"),n(),r(17,"th"),a(18,"Frequency"),n()())}function Lt(t,c){if(t&1&&(r(0,"tr")(1,"td"),d(2,"p-tableCheckbox",14),n(),r(3,"td"),a(4),n(),r(5,"td")(6,"a",15),a(7),n()(),r(8,"td"),a(9),n(),r(10,"td"),a(11),C(12,"date"),n(),r(13,"td"),a(14),C(15,"date"),n(),r(16,"td"),a(17),C(18,"date"),n(),r(19,"td"),a(20),C(21,"number"),n(),r(22,"td"),a(23),n()()),t&2){let e=c.$implicit;l(2),m("value",e),l(2),E(e.outletName),l(2),m("routerLink",S(21,kt,e.id)),l(),E(e.name),l(2),E(e.expenseName),l(2),E(G(12,10,e.startDate,"d MMM y")),l(3),E(G(15,13,e.endDate,"d MMM y")),l(3),E(G(18,16,e.lastExpenseDate,"d MMM y")),l(3),E(T(21,19,e.amount)),l(3),E(e.repeatTypeLabel)}}function Bt(t,c){if(t&1&&(r(0,"div"),a(1),n()),t&2){let e=g(2);l(),ze(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().count," entries ")}}function jt(t,c){t&1&&(r(0,"tr")(1,"td",16)(2,"span"),a(3,"No recurring expenses found."),n()()())}function Ot(t,c){if(t&1){let e=y();r(0,"p-panel")(1,"p-table",13),R("onPage",function(i){v(e);let s=g();return b(s.onPageChange(i))})("onHeaderCheckboxToggle",function(i){v(e);let s=g();return b(s.onHeaderCheckboxToggle(i))})("onRowSelect",function(i){v(e);let s=g();return b(s.onRowSelect(i))})("onRowUnselect",function(i){v(e);let s=g();return b(s.onRowUnselect(i))}),h(2,At,19,0,"ng-template",null,3,x)(4,Lt,24,23,"ng-template",null,4,x)(6,Bt,2,3,"ng-template",null,5,x)(8,jt,4,0,"ng-template",null,6,x),n()()}if(t&2){let e=g();se(U(9,Mt)),l(),m("scrollable",!0)("scrollHeight","calc(100vh - 142px)")("lazy",!0)("totalRecords",e.store.data().count)("rows",e.store.filter().pageSize)("paginator",!0)("value",e.store.data().data)}}function qt(t,c){if(t&1&&(r(0,"form",17)(1,"div",18)(2,"label",19),a(3,"Type"),n(),d(4,"p-select",20),n()()),t&2){let e=g();m("formGroup",e.form),l(4),m("options",e.store.meta().Options.Frequencies)}}var ht=(()=>{class t extends mt{constructor(){super(...arguments),this.store=u(Le),this.recurringExpenseService=u(B),this.fb=u(Qe),this.isDialogFilterVisible=q(!1)}ngOnInit(){this.initForm()}onPageChange(e){let o=e.first/e.rows;this.store.updateFilter(_(f({},this.store.filter()),{pageNumber:o+1}))}onDeleteSelected(){this.recurringExpenseService.removeRecurringExpenses(this.store.checkedInvoice()).pipe(F(()=>{this.store.updateFilter(_(f({},this.store.filter()),{pageNumber:1}))})).subscribe()}onSearchEvent(e){this.store.updateFilter(_(f({},this.store.filter()),{text:e}))}onFilterEvent(){this.onSubmitFilterDialog()}onSubmitFilterDialog(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((o,[i,s])=>(s!=null&&(o[i]=s),o),{});this.store.updateFilter(e),this.isDialogFilterVisible.update(o=>!o)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(o=>{this.store.onRowUnselect(o)});return}else this.store.onRowUnselect(e.data)}initForm(){let{text:e,Frequency:o,pageNumber:i,rowCount:s,pageSize:p,export:j,exportPageNumber:yt,exportRowCount:Rt}=this.store.filter();this.form=this.fb.group({text:this.fb.control(e),Frequency:this.fb.control(o),pageNumber:this.fb.control(i),rowCount:this.fb.control(s),pageSize:this.fb.control(p),export:this.fb.control(j),exportPageNumber:this.fb.control(yt),exportRowCount:this.fb.control(Rt)})}static{this.\u0275fac=(()=>{let e;return function(i){return(e||(e=Ge(t)))(i||t)}})()}static{this.\u0275cmp=D({type:t,selectors:[["app-recurring-expense",8,"page"]],features:[de([Le]),$e],attrs:Pt,decls:7,vars:3,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["pageTitle","Recurring Expenses",3,"search","isDialogFilterVisibleChange","filterConfirmed","isSearchableInput","isFilterable","isDialogFilterVisible"],[1,"d-flex","gap-2"],["severity","danger","label","Delete","icon","fa-solid fa-trash",3,"onClick",4,"ngIf"],["routerLink","create",1,"p-button"],[1,"fa-solid","fa-plus"],["severity","danger","label","Delete","icon","fa-solid fa-trash",3,"onClick"],["dataKey","id","styleClass","d-flex flex-column justify-content-between h-100",3,"onPage","onHeaderCheckboxToggle","onRowSelect","onRowUnselect","scrollable","scrollHeight","lazy","totalRecords","rows","paginator","value"],[3,"value"],[1,"link-primary",3,"routerLink"],["colspan","9"],[1,"d-flex","flex-column",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["formControlName","Frequency","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select Type",3,"options"]],template:function(o,i){if(o&1){let s=y();r(0,"app-main-panel",7),R("search",function(j){return v(s),b(i.onSearchEvent(j))}),ue("isDialogFilterVisibleChange",function(j){return v(s),me(i.isDialogFilterVisible,j)||(i.isDialogFilterVisible=j),b(j)}),R("filterConfirmed",function(){return v(s),b(i.onFilterEvent())}),h(1,Nt,6,1,"ng-template",null,0,x)(3,Ot,10,10,"ng-template",null,1,x)(5,qt,5,2,"ng-template",null,2,x),n()}o&2&&(m("isSearchableInput",!0)("isFilterable",!0),ce("isDialogFilterVisible",i.isDialogFilterVisible))},dependencies:[L,k,Z,Ne,Ve,lt,pt,M,P,K,ge,V,it,ke,Me,Q,J,Se,ve,Y,Ee,be,Ce,A,N],styles:["[_nghost-%COMP%]{display:block} .p-card{height:100%} .p-card .p-card-body{height:inherit} .p-card .p-card-body .p-card-content{height:inherit}"],changeDetection:0})}}return t})();var ee=It(wt());var Ht=["class","page"],$t=()=>["/pages/recurring/recurring-expense"],le=t=>({"ng-dirty ng-invalid":t}),Wt=()=>({});function zt(t,c){if(t&1){let e=y();r(0,"div",5)(1,"a",6),a(2," Cancel "),n(),r(3,"p-button",7),R("click",function(){v(e);let i=g();return b(i.onSubmit())}),n()()}t&2&&(l(),m("routerLink",U(1,$t)))}function Kt(t,c){if(t&1&&(r(0,"small",19),a(1),n()),t&2){let e=c.$implicit;l(),E(e)}}function Xt(t,c){if(t&1&&(r(0,"div",32)(1,"div",33),a(2),n()()),t&2){let e=c.$implicit;l(2),I(" ",e.name," ")}}function Yt(t,c){if(t&1&&(r(0,"small",19),a(1),n()),t&2){let e=c.$implicit;l(),E(e)}}function Jt(t,c){if(t&1&&(r(0,"small",19),a(1),n()),t&2){let e=c.$implicit;l(),E(e)}}function Qt(t,c){if(t&1&&(r(0,"div",5)(1,"div")(2,"span"),a(3),n()(),r(4,"div",33),a(5),n()()),t&2){let e=c.$implicit;l(3),I("(",e.code,")"),l(2),I(" ",e.value," ")}}function Zt(t,c){if(t&1&&(r(0,"small",19),a(1),n()),t&2){let e=c.$implicit;l(),E(e)}}function en(t,c){if(t&1&&(r(0,"div",5)(1,"div")(2,"span"),a(3),n()(),r(4,"div",33),a(5),n()()),t&2){let e=c.$implicit;l(3),I("(",e.code,")"),l(2),I(" ",e.value," ")}}function tn(t,c){if(t&1&&(r(0,"small",19),a(1),n()),t&2){let e=c.$implicit;l(),E(e)}}function nn(t,c){if(t&1){let e=y();r(0,"div",9)(1,"div",10)(2,"p-panel",11)(3,"p-scroll-panel")(4,"div",12)(5,"div",13)(6,"form",14)(7,"div",15)(8,"div",13)(9,"div",16)(10,"label",17),a(11,"Name"),n(),d(12,"input",18),r(13,"div"),W(14,Kt,2,1,"small",19,$),n()()(),r(16,"div",20,2)(18,"div",16)(19,"label",17),a(20,"Outlet"),n(),r(21,"p-select",21),h(22,Xt,3,1,"ng-template",null,3,x),n()()(),r(24,"div",20)(25,"div",16)(26,"div")(27,"label",17),a(28,"Supplier"),n(),r(29,"p-autocomplete",22),R("completeMethod",function(i){v(e);let s=g(2);return b(s.searchContact(i))}),n()(),r(30,"div"),W(31,Yt,2,1,"small",19,$),n()()(),r(33,"div",20)(34,"div",16)(35,"label",17),a(36,"From"),n(),d(37,"p-datepicker",23),n()(),r(38,"div",20)(39,"div",16)(40,"label",17),a(41,"To"),n(),d(42,"p-datepicker",24),n()(),d(43,"div",25),n(),d(44,"hr"),r(45,"div",15)(46,"div",20)(47,"div",16)(48,"label",17),a(49,"Amount"),n(),d(50,"input",26),r(51,"div"),W(52,Jt,2,1,"small",19,$),n()()(),r(54,"div",20)(55,"div",16)(56,"label",17),a(57,"Frequency"),n(),d(58,"p-select",27),n()(),r(59,"div",20)(60,"div",16)(61,"label",17),a(62,"Expense (Debit)"),n(),r(63,"p-select",28),h(64,Qt,6,2,"ng-template",null,3,x),n()(),r(66,"div"),W(67,Zt,2,1,"small",19,$),n()(),r(69,"div",20)(70,"div",16)(71,"label",17),a(72,"Payment (Credit)"),n(),r(73,"p-select",29),h(74,en,6,2,"ng-template",null,3,x),n()(),r(76,"div"),W(77,tn,2,1,"small",19,$),n()(),r(79,"div",30)(80,"div",16)(81,"label",17),a(82,"Description"),n(),d(83,"textarea",31),n()()()()()()()()()()}if(t&2){let e,o,i,s,p=g(2);l(6),m("formGroup",p.recurringExpenseForm),l(6),m("ngClass",S(17,le,p.isInvalid("name"))),l(2),z(p.getErrors("name")),l(7),m("options",(e=p.recurringExpenseData())==null||e.options==null?null:e.options.entities),l(8),m("showClear",!0)("ngClass",S(19,le,p.isInvalid("contact")))("suggestions",p.customerSupplierSuggestions()),l(2),z(p.getErrors("contact")),l(6),m("iconDisplay","input")("showIcon",!0),l(5),m("iconDisplay","input")("showIcon",!0),l(8),m("ngClass",S(21,le,p.isInvalid("amount")))("autoNumeric",U(23,Wt)),l(2),z(p.getErrors("amount")),l(6),m("options",(o=p.recurringExpenseData())==null||o.options==null?null:o.options.frequency),l(5),m("options",(i=p.recurringExpenseData())==null||i.options==null?null:i.options.expenses)("ngClass",S(24,le,p.isInvalid("expenseAccountID"))),l(4),z(p.getErrors("expenseAccountID")),l(6),m("ngClass",S(26,le,p.isInvalid("paymentAccountID")))("options",(s=p.recurringExpenseData())==null||s.options==null?null:s.options.assets),l(4),z(p.getErrors("paymentAccountID"))}}function rn(t,c){if(t&1&&h(0,nn,84,28,"div",8),t&2){let e=g();m("ngIf",e.recurringExpenseData())}}var Oe=(()=>{class t{constructor(){this.recurringExpenseService=u(B),this.fb=u(Ze),this.destroyRef=u(He),this.route=u(fe),this.recurringExpenseData=q(null),this.customerSupplierSuggestions=q([]),this.router=u(xe),this.contactType=new Ye(0),this.dayjsService=u(ut)}ngOnInit(){this.initializeForm(),this.fetchRecurringExpenseForm()}initializeForm(){this.recurringExpenseForm=this.fb.group({id:this.fb.control(""),name:this.fb.control("",[X.required]),repeatTypeID:this.fb.control(1,[X.required]),startDate:this.fb.control((0,ee.default)().toISOString()),endDate:this.fb.control(null),lastExpenseDate:this.fb.control(""),amount:this.fb.control(0,[X.required]),paymentAccountID:this.fb.control(null,[X.required]),expenseAccountID:this.fb.control(null,[X.required]),contact:this.fb.control("",[]),description:this.fb.control(""),repeatTypeLabel:this.fb.control(""),outletID:this.fb.control(""),creatorID:this.fb.control(""),created:this.fb.control(""),modifierID:this.fb.control(""),modified:this.fb.control("")})}fetchRecurringExpenseForm(){this.route.paramMap.pipe(H(e=>e.get("id")),O(e=>e?this.recurringExpenseService.fetchRecurringExpenseForm(e):this.recurringExpenseService.fetchRecurringExpenseForm()),F(e=>{this.recurringExpenseData.set(e),this.updateFormWithRecurringExpense(e.form)})).subscribe()}updateFormWithRecurringExpense(e){let o=Object.entries(e).reduce((i,[s,p])=>{switch(s){case"startDate":i[s]=(0,ee.default)(p).isSame((0,ee.default)("0001-01-01T00:00:00"))?(0,ee.default)().toDate():(0,ee.default)(p).toDate();break;case"repeatTypeID":i[s]=1;break;case"contactID":i.contact=e.contactID?{Key:e.contactID,Value:e.contactName}:null;break;case"paymentAccountID":i[s]=p===oe?null:p;break;case"expenseAccountID":i[s]=p===oe?null:p;break;default:i[s]=p}return i},{});this.recurringExpenseForm.patchValue(o)}searchContact(e){this.recurringExpenseService.fetchSupplierSuggestion(e.query).pipe(F(this.customerSupplierSuggestions.set)).subscribe()}onSubmit(){let e=this.recurringExpenseForm.value;if(this.recurringExpenseForm.invalid){this.recurringExpenseForm.markAllAsTouched();return}let o=Object.entries(e).reduce((i,[s,p])=>{switch(s){case"amount":i[s]=+p;break;case"startDate":i[s]=p?this.dayjsService.from(p).format():null;break;case"endDate":i[s]=p?this.dayjsService.from(p).format():null;break;case"contact":typeof p=="string"?i.contactID=p:typeof p=="object"&&p!==null?i.contactID=p&&Object.prototype.hasOwnProperty.call(p,"Key")?p.Key:p:i.contactID=oe;break;default:i[s]=p;break}return i},{});this.recurringExpenseService.submitRecurringExpense(o).pipe(F(()=>{this.router.navigate(["/pages/recurring/recurring-expense"])})).subscribe()}isInvalid(e){let o=this.recurringExpenseForm.controls[e];return o.invalid&&(o.dirty||o.touched)}getErrors(e){if(!this.isInvalid(e))return null;let o=this.recurringExpenseForm.controls[e];if(!o.errors)return null;let i=[];for(let[s,p]of Object.entries(o.errors))switch(s){case"required":i.push("This field is required.");break;case"minlength":i.push(`Minimum length is ${p.requiredLength} characters.`);break;case"maxlength":i.push(`Maximum length is ${p.requiredLength} characters.`);break;case"email":i.push("Please enter a valid email address.");break;case"pattern":i.push("The format is invalid.");break;case"min":i.push(`Minimum value is ${p.min}.`);break;case"max":i.push(`Maximum value is ${p.max}.`);break;default:i.push("Invalid value.")}return i}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=D({type:t,selectors:[["app-recurring-expense-form",8,"page"]],attrs:Ht,decls:5,vars:2,consts:[["actionButton",""],["content",""],["outlet",""],["item",""],["pageTitle","Recurring Expense Form",3,"hasMainWrapperPadding","overflowScroll"],[1,"d-flex","gap-2"],["type","button",1,"p-button","p-button-secondary","p-button-outlined",3,"routerLink"],["label","Submit","icon","fa-solid fa-plus",3,"click"],["class","row justify-content-center",4,"ngIf"],[1,"row","justify-content-center"],[1,"col-6"],[1,"h-100","d-flex"],[1,"row","justify-content-center","h-100"],[1,"col-12"],[1,"d-flex","flex-column","row-gap-2",3,"formGroup"],[1,"row","row-gap-2"],[1,"d-flex","flex-column"],["for",""],["formControlName","name","type","text","pInputText","",3,"ngClass"],[1,"text-danger"],[1,"col","col-lg-6"],["filter","","filterBy","name","appendTo","body","formControlName","outletID","optionLabel","name","optionValue","id","placeholder","Select Outlet",3,"options"],["formControlName","contact","inputStyleClass","w-100","styleClass","w-100","optionLabel","Value","optionValue","Key",3,"completeMethod","showClear","ngClass","suggestions"],["dateFormat","mm/dd/yy","appendTo","body","formControlName","startDate","styleClass","w-100","inputId","icondisplay",3,"iconDisplay","showIcon"],["appendTo","body","formControlName","endDate","styleClass","w-100","inputId","icondisplay",3,"iconDisplay","showIcon"],[1,"col"],["formControlName","amount","type","text","pInputText","",3,"ngClass","autoNumeric"],["appendTo","body","formControlName","repeatTypeID","optionLabel","value","optionValue","key","placeholder","Select Outlet",3,"options"],["appendTo","body","formControlName","expenseAccountID","optionLabel","value","optionValue","key","placeholder","Select Expense","filter","","filterBy","code,value",3,"options","ngClass"],["appendTo","body","formControlName","paymentAccountID","optionLabel","value","optionValue","key","filter","","filterBy","code,value","placeholder","Select Payment",3,"ngClass","options"],[1,"col","col-lg-12"],["formControlName","description","rows","3","cols","30","pTextarea",""],[1,"flex","items-center","gap-2"],[1,"text-truncate","d-inline-block",2,"max-width","250px"]],template:function(o,i){o&1&&(r(0,"app-main-panel",4),h(1,zt,4,2,"ng-template",null,0,x)(3,rn,1,1,"ng-template",null,1,x),n()),o&2&&m("hasMainWrapperPadding",!0)("overflowScroll",!0)},dependencies:[L,Z,Re,ye,ke,Me,ot,rt,ft,gt,ct,st,we,Ie,M,Ke,P,Se,ve,he,Y,Ee,be,Ce,V,k,Q,J,dt,A,N,at],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var on=["class","page"],an=t=>["/pages/recurring/recurring-expense/edit",t];function ln(t,c){if(t&1&&(r(0,"a",7),d(1,"i",8),r(2,"span"),a(3,"Edit"),n()()),t&2){let e=g(4);m("routerLink",S(1,an,e.currentRecurringExpense().id))}}function pn(t,c){if(t&1){let e=y();r(0,"p-button",9),R("onClick",function(){v(e);let i=g(4);return b(i.onDeleteRecurringExpense(i.currentRecurringExpense().id))}),n()}}function sn(t,c){if(t&1&&(r(0,"div",4),h(1,ln,4,3,"a",5)(2,pn,1,0,"p-button",6),n()),t&2){let e=g(3);l(),m("ngIf",e.roleService.setup.recurring),l(),m("ngIf",e.roleService.setup.recurring)}}function cn(t,c){if(t&1&&h(0,sn,3,2,"div",3),t&2){let e=g(2);m("ngIf",e.currentRecurringExpense())}}function mn(t,c){if(t&1){let e=y();r(0,"p-panel",13)(1,"p-scroll-panel")(2,"div",10)(3,"div",14)(4,"div",15)(5,"div",14)(6,"div",16)(7,"div",17)(8,"div",18)(9,"label",19),a(10,"Outlet"),n(),r(11,"input",20),ue("ngModelChange",function(i){v(e);let s=g(3);return me(s.currentRecurringExpense().outletName,i)||(s.currentRecurringExpense().outletName=i),b(i)}),n()()(),r(12,"div",17)(13,"div",18)(14,"label",19),a(15,"Supplier"),n(),d(16,"input",21),n()(),r(17,"div",17)(18,"div",18)(19,"label",19),a(20,"From"),n(),d(21,"input",22),C(22,"date"),n()(),r(23,"div",17)(24,"div",18)(25,"label",19),a(26,"To"),n(),d(27,"input",22),C(28,"date"),n()()(),d(29,"hr"),r(30,"div",16)(31,"div",17)(32,"div",18)(33,"label",19),a(34,"Amount"),n(),d(35,"input",22),C(36,"number"),n()(),r(37,"div",17)(38,"div",18)(39,"label",19),a(40,"Frequency"),n(),d(41,"input",22),n()(),r(42,"div",17)(43,"div",18)(44,"label",19),a(45,"Expense (Debit)"),n(),d(46,"input",22),n()(),r(47,"div",17)(48,"div",18)(49,"label",19),a(50,"Payment (Credit)"),n(),d(51,"input",22),n()(),r(52,"div",23)(53,"div",18)(54,"label",19),a(55,"Description"),n(),d(56,"textarea",24),n()()()()()()()()()}if(t&2){let e=g(3);l(11),ce("ngModel",e.currentRecurringExpense().outletName),l(5),m("value",e.currentRecurringExpense().contactName),l(5),m("value",G(22,9,e.currentRecurringExpense().startDate,"d MMM y")),l(6),m("value",G(28,12,e.currentRecurringExpense().endDate,"d MMM y")),l(8),m("value",T(36,15,e.currentRecurringExpense().amount)),l(6),m("value",e.currentRecurringExpense().repeatTypeLabel),l(5),m("value",e.currentRecurringExpense().expenseName),l(5),m("value",e.currentRecurringExpense().paymentName),l(5),m("value",e.currentRecurringExpense().description)}}function un(t,c){if(t&1&&(r(0,"div",10)(1,"div",11),h(2,mn,57,17,"p-panel",12),n()()),t&2){let e=g(2);l(2),m("ngIf",e.currentRecurringExpense())}}function dn(t,c){if(t&1&&(r(0,"app-main-panel",2),h(1,cn,1,1,"ng-template",null,0,x)(3,un,3,1,"ng-template",null,1,x),n()),t&2){let e=g();m("pageTitle",e.currentRecurringExpense().name+" Info")("hasMainWrapperPadding",!0)("overflowScroll",!0)}}var vt=(()=>{class t{constructor(){this.recurringExpenseService=u(B),this.route=u(fe),this.router=u(xe),this.currentRecurringExpense=q(null),this.roleService=u(tt)}ngOnInit(){this.route.paramMap.pipe(H(e=>e.get("id")),Ae("params"),Ue(e=>this.recurringExpenseService.getRecurringExpenseByID(e)),F(e=>this.currentRecurringExpense.set(e)),Ae("recurringExpense")).subscribe()}onDeleteRecurringExpense(e){this.recurringExpenseService.removeRecurringExpense(e).pipe(F(()=>{this.router.navigate(["/pages/recurring/recurring-expense"])})).subscribe()}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=D({type:t,selectors:[["app-recurring-expense-info",8,"page"]],attrs:on,decls:1,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle","hasMainWrapperPadding","overflowScroll"],["class","d-flex gap-2",4,"ngIf"],[1,"d-flex","gap-2"],["class","p-button p-button-outlined p-button-secondary d-flex gap-2 align-items-center",3,"routerLink",4,"ngIf"],["icon","fa-solid fa-trash","label","Delete","severity","danger",3,"onClick",4,"ngIf"],[1,"p-button","p-button-outlined","p-button-secondary","d-flex","gap-2","align-items-center",3,"routerLink"],[1,"fa-solid","fa-pen-to-square"],["icon","fa-solid fa-trash","label","Delete","severity","danger",3,"onClick"],[1,"row","justify-content-center"],[1,"col-6"],["class","h-100 d-flex",4,"ngIf"],[1,"h-100","d-flex"],[1,"col"],[1,"row"],[1,"row","row-gap-2"],[1,"col","col-lg-6"],[1,"d-flex","flex-column"],["for",""],["readonly","","type","text","pInputText","",3,"ngModelChange","ngModel"],["type","text","readonly","","pInputText","",3,"value"],["readonly","","type","text","pInputText","",3,"value"],[1,"col","col-lg-12"],["readonly","","rows","5","cols","30","pTextarea","",3,"value"]],template:function(o,i){o&1&&h(0,dn,5,3,"app-main-panel",2),o&2&&We(i.currentRecurringExpense()?0:-1)},dependencies:[L,Z,M,P,K,ge,Re,ye,et,he,Y,Je,Q,J,V,k,A,N,we,Ie],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var bt=[{path:"",redirectTo:"",pathMatch:"full"},{path:"",children:[{path:"",component:ht},{path:"create",component:Oe},{path:"details/:id",component:vt},{path:"edit/:id",component:Oe}]}];var Ct=(()=>{class t{constructor(){this.httpService=u(_e)}getAssetValue(e){return this.httpService.post(void 0,"/api/AssetValue/GetList",e)}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275prov=pe({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var gn={filter:{Text:"",Frequency:0,PageNumber:1,RowCount:10},data:null},qe=Fe(Pe(gn),De(t=>{let c=u(Ct);return{getAssetValue:ie(te(O(o=>c.getAssetValue(o).pipe(re({next:i=>{w(t,s=>_(f({},s),{data:i}))},error:i=>{console.error("Error fetching asset value:",i)}}))))),updateFilter:o=>{w(t,i=>_(f({},i),{filter:o}))}}}),Te({onInit:t=>{t.getAssetValue(t.filter())}}));var fn=()=>({height:"calc(100vh - 70px)"}),xn=t=>["/pages/recurring/recurring-expense/details/",t];function _n(t,c){t&1&&d(0,"div",5)}function hn(t,c){t&1&&(r(0,"tr")(1,"th"),a(2,"Outlet"),n(),r(3,"th"),a(4,"Name"),n(),r(5,"th"),a(6,"Account Code"),n(),r(7,"th",8),a(8,"Price on Purchase"),n(),r(9,"th",8),a(10,"Accomulated Depreciation"),n(),r(11,"th",8),a(12,"Book Value"),n(),r(13,"th",8),a(14,"Frequency"),n()())}function En(t,c){if(t&1&&(r(0,"tr")(1,"td"),a(2),n(),r(3,"td")(4,"a",9),a(5),n()(),r(6,"td"),a(7),n(),r(8,"td",8),a(9),C(10,"number"),n(),r(11,"td",8),a(12),C(13,"number"),n(),r(14,"td",8),a(15),C(16,"number"),n(),r(17,"td",8),a(18),C(19,"number"),n()()),t&2){let e=c.$implicit;l(2),E(e.entityName),l(2),m("routerLink",S(16,xn,e.id)),l(),E(e.name),l(2),E(e.accountCode),l(2),E(T(10,8,e.priceOnPurchase)),l(3),I(" ",T(13,10,e.accumulatedDepreciation)," "),l(3),I(" ",T(16,12,e.bookValue)," "),l(3),I(" ",T(19,14,e.depreciationPerYear)," ")}}function vn(t,c){if(t&1&&(r(0,"p-panel")(1,"p-table",7),h(2,hn,15,0,"ng-template",null,2,x)(4,En,20,18,"ng-template",null,3,x),n()()),t&2){let e=g(2);se(U(7,fn)),l(),m("value",e.store.data().data)("rows",e.store.filter().RowCount)("totalRecords",e.store.data().count)("scrollable",!0)("scrollHeight","calc(100vh - 200px)")}}function bn(t,c){if(t&1&&h(0,vn,6,8,"p-panel",6),t&2){let e=g();m("ngIf",e.store.data())}}var St=(()=>{class t{constructor(){this.store=u(qe)}static{this.\u0275fac=function(o){return new(o||t)}}static{this.\u0275cmp=D({type:t,selectors:[["app-asset-value"]],features:[de([qe])],decls:5,vars:1,consts:[["actionButton",""],["content",""],["header",""],["body",""],["pageTitle","Asset Value",3,"isSearchableInput"],[1,"d-flex","gap-2"],[3,"style",4,"ngIf"],["styleClass","h-100","dataKey","id",1,"",3,"value","rows","totalRecords","scrollable","scrollHeight"],[1,"text-end"],["target","_blank",1,"link","link-primary",3,"routerLink"]],template:function(o,i){o&1&&(r(0,"app-main-panel",4),h(1,_n,1,0,"ng-template",null,0,x)(3,bn,1,1,"ng-template",null,1,x),n()),o&2&&m("isSearchableInput",!0)},dependencies:[L,M,P,K,A,N,Ne,Ve,V,k],encapsulation:2})}}return t})();var xr=[{path:"",redirectTo:"recurring-expense",pathMatch:"full"},{path:"recurring-expense",children:bt},{path:"asset-value",component:St},{path:"post-to-journal",loadComponent:()=>import("./chunk-ZA5U4RYI.js").then(t=>t.PostRecurringExpenseComponent)}];export{xr as RECURRING_ROUTES};
@@ -1 +1 @@
1
- import{a as F}from"./chunk-W24I5WPW.js";import{a as Be,b as Oe}from"./chunk-HHJMN4BS.js";import{a as He}from"./chunk-MDH73MG3.js";import{b as D}from"./chunk-XILGARZ5.js";import"./chunk-MFH4UZ6J.js";import{a as ae}from"./chunk-VVHTNAHQ.js";import"./chunk-YOUPD27G.js";import{a as je}from"./chunk-XKI7WLHE.js";import"./chunk-AZUQDRJU.js";import"./chunk-C2GO6SPF.js";import{a as j,b as H}from"./chunk-O4QM64EH.js";import{d as ke,i as Pe,j as Me,k as ze}from"./chunk-EW3R2HAB.js";import{a as Fe,b as Je}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import"./chunk-PKN47FQE.js";import{a as Re,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 Ae,h as De}from"./chunk-UYC454VQ.js";import{b as Te,c as Ve}from"./chunk-C7LM5UCK.js";import{a as Se,b as be}from"./chunk-J4XRJAME.js";import{a as w,b as ve,c as we,d as ye,e as Ee,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 pe,e as me,f as se,k as ce,l as ue,o as de,v as fe,y as _e}from"./chunk-FMVCTBCQ.js";import"./chunk-P3V7Z3A6.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 V,Cb as x,Ga as k,Jc as I,Kb as c,Kc as Z,Lc as A,Mc as v,Nb as $,Ub as r,Vb as o,Wb as S,X as N,Yc as T,Z as U,_b as y,bb as L,c as J,cb as G,dc as E,ec as _,gb as l,ha as C,pa as g,qa as h,qc as s,rc as b,s as R,sc as P,uc as q,vc as Q,wb as K,wc as M,xc as X,yc as Y,zc as z}from"./chunk-JP6RBSB3.js";import{a as u,b as f}from"./chunk-YQFG5XE2.js";var qe={data:{data:[],totalCount:0},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0}}},B=ve(Ie(qe),we(t=>({first:T(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:T(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:T(()=>t.data().data.some(a=>a.checked)),checkedAPCollection:T(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),Ee(t=>{let a=C(F),e=C(D);return{updateFilter(n){w(t,i=>f(u({},i),{filter:u(u({},i.filter),n)}))},onRowSelect(n){w(t,i=>{let d=i.data.data.map(m=>m.id===n.id?f(u({},m),{checked:!0}):m);return f(u({},i),{data:f(u({},i.data),{data:d})})})},onRowUnselect(n){w(t,i=>{let d=i.data.data.map(m=>m.id===n.id?f(u({},m),{checked:!1}):m);return f(u({},i),{data:f(u({},i.data),{data:d})})})},onHeaderCheckboxToggle(n){w(t,i=>{let d=i.data.data.map(m=>f(u({},m),{checked:n}));return f(u({},i),{data:f(u({},i.data),{data:d})})})},getAPLoader:j(J(N(()=>a.getAPJournalLoader().pipe(H({next:n=>{w(t,i=>f(u({},i),{meta:n}))},error:n=>{console.error("Error fetching AP journal:",n)}}))))),getARCollection:j(J(R(n=>Object.entries(n).reduce((i,[d,m])=>(m!=null&&(i[d]=m),i),{})),N(n=>a.getAPJournal(n).pipe(R(i=>f(u({},i),{data:i.data.map(d=>f(u({},d),{due:e.from(d.due)?e.from(d.due).format():null,checked:!1}))})),H({next:i=>{w(t,d=>f(u({},d),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),ye(t=>({onInit:()=>{t.getAPLoader(),t.getARCollection(t.filter)}})));var Qe=()=>({height:"calc(100vh - 70px)"}),O=t=>({"ng-invalid ng-dirty":t}),Xe=()=>({});function Ye(t,a){if(t&1){let e=y();r(0,"p-button",10),E("onClick",function(){g(e);let n=_(2);return h(n.onCreateJournal())}),o()}}function Ze(t,a){if(t&1&&x(0,Ye,1,0,"p-button",9),t&2){let e=_();c("ngIf",e.store.hasCheckedRows())}}function et(t,a){t&1&&(r(0,"tr")(1,"th",12),S(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),s(4,"Outlet"),o(),r(5,"th",14),s(6,"Number"),o(),r(7,"th",15),s(8,"Supplier"),o(),r(9,"th",16),s(10,"Date"),o(),r(11,"th",16),s(12,"Due"),o(),r(13,"th",15),s(14,"Note"),o(),r(15,"th",17),s(16,"Payment"),o(),S(17,"th",12),o())}function tt(t,a){if(t&1&&(r(0,"tr")(1,"td"),S(2,"p-tableCheckbox",18),o(),r(3,"td"),s(4),o(),r(5,"td")(6,"a",19),s(7),o()(),r(8,"td"),s(9),o(),r(10,"td"),s(11),I(12,"date"),o(),r(13,"td"),s(14),I(15,"date"),o(),r(16,"td"),S(17,"div",20),o(),r(18,"td"),s(19),o(),r(20,"td"),S(21,"p-button",21),o()()),t&2){let e=a.$implicit,p=_(2);l(2),c("value",e),l(2),b(e.outlet),l(2),c("href",p.authService.getTenantExternalURL()+"/menu/Debt/Debt/Join_Bill/New_Join_Bill/Info?ID="+e.id,G),l(),P(" ",e.number," "),l(2),b(e.customer),l(2),b(A(12,12,e.date,"d MMM y")),l(3),b(e.due?A(15,15,e.due,"d MMM y hh:mm"):"-"),l(3),c("innerHTML",e.note,L),l(2),b(e.payment),l(2),c("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function it(t,a){if(t&1&&s(0),t&2){let e=_(2);q(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function nt(t,a){t&1&&(r(0,"tr")(1,"td",22)(2,"span"),s(3,"No records found."),o()()())}function ot(t,a){if(t&1){let e=y();r(0,"p-panel")(1,"p-table",11),E("onPage",function(n){g(e);let i=_();return h(i.onPageChange(n))})("onHeaderCheckboxToggle",function(n){g(e);let i=_();return h(i.onHeaderCheckboxToggle(n))})("onRowSelect",function(n){g(e);let i=_();return h(i.onRowSelect(n))})("onRowUnselect",function(n){g(e);let i=_();return h(i.onRowUnselect(n))}),x(2,et,18,0,"ng-template",null,3,v)(4,tt,22,18,"ng-template",null,4,v)(6,it,1,3,"ng-template",null,5,v)(8,nt,4,0,"ng-template",null,6,v),o()()}if(t&2){let e=_();$(z(9,Qe)),l(),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 rt(t,a){if(t&1&&(r(0,"span",32),s(1),I(2,"truncate"),o()),t&2){let e=a.$implicit;c("pTooltip",e.name),l(),P(" ",A(2,2,e.name,30)," ")}}function at(t,a){if(t&1&&(r(0,"div")(1,"span",34),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function lt(t,a){if(t&1&&(r(0,"div"),x(1,at,3,1,"div",33),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("from"))}}function pt(t,a){if(t&1&&(r(0,"div")(1,"span",34),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function mt(t,a){if(t&1&&(r(0,"div"),x(1,pt,3,1,"div",33),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("to"))}}function st(t,a){if(t&1&&(r(0,"div")(1,"span",34),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function ct(t,a){if(t&1&&(r(0,"div"),x(1,st,3,1,"div",33),o()),t&2){let e=_(2);l(),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),s(3,"Outlet"),o(),r(4,"p-select",26),x(5,rt,3,5,"ng-template",null,7,v),o()(),r(7,"div",24)(8,"label",25),s(9,"From"),o(),S(10,"p-datepicker",27),x(11,lt,2,1,"div",28),o(),r(12,"div",24)(13,"label",25),s(14,"To"),o(),S(15,"p-datepicker",29),x(16,mt,2,1,"div",28),o(),r(17,"div",24)(18,"label",25),s(19,"Supplier"),o(),r(20,"p-autocomplete",30),I(21,"async"),E("completeMethod",function(n){g(e);let i=_();return h(i.onSearchSupplier(n))}),o()(),r(22,"div",24)(23,"label",25),s(24,"Page Size"),o(),S(25,"input",31),x(26,ct,2,1,"div",28),o()()}if(t&2){let e=_();c("formGroup",e.form),l(4),c("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),l(6),c("iconDisplay","input")("showIcon",!0)("ngClass",V(17,O,e.isInvalid("from"))),l(),c("ngIf",e.isInvalid("from")),l(4),c("iconDisplay","input")("showIcon",!0)("ngClass",V(19,O,e.isInvalid("to"))),l(),c("ngIf",e.isInvalid("to")),l(4),c("suggestions",Z(21,15,e.supplierSuggestions$)),l(5),c("autoNumeric",z(21,Xe))("ngClass",V(22,O,e.isInvalid("pageSize"))),l(),c("ngIf",e.isInvalid("pageSize"))}}var ti=(()=>{class t extends je{constructor(){super(),this.store=C(B),this.generateJournalService=C(F),this.authService=C(ae),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=C(fe),this.dayjsService=C(D)}ngOnInit(){this.initform()}initform(){let{outletName:e,number:p,from:n,to:i,paymentState:d,supplierID:m,pageNumber:Ue,rowCount:Le,pageSize:Ge,export:Ke,exportPageNumber:We,exportRowCount:$e}=this.store.filter();this.form=this.fb.group({outletName:this.fb.control(e),number:this.fb.control(p),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),paymentState:this.fb.control(d),supplierID:this.fb.control(m),pageNumber:this.fb.control(Ue),rowCount:this.fb.control(Le),pageSize:this.fb.control(Ge,[pe.required]),export:this.fb.control(Ke),exportPageNumber:this.fb.control(We),exportRowCount:this.fb.control($e)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((p,[n,i])=>(i!=null&&(n==="from"||n==="to"?(typeof i=="string"||typeof i=="number"||i instanceof Date)&&(p[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null):p[n]=i),p),{});this.store.updateFilter(e),this.isDialogFilterVisible.update(p=>!p)}onSearch(e){this.store.updateFilter(f(u({},this.store.filter()),{number:e}))}onSearchSupplier(e){this.supplierSuggestions$=this.generateJournalService.getSupplierSuggestions(e.query).pipe()}onPageChange(e){let p=e.first/e.rows;this.store.updateFilter(f(u({},this.store.filter()),{pageNumber:p+1}))}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(p=>{this.store.onRowUnselect(p)});return}else this.store.onRowUnselect(e.data)}onCreateJournal(){this.generateJournalService.createAPJournal(this.store.checkedAPCollection()).pipe(U(()=>{this.store.getARCollection(this.store.filter)})).subscribe()}static{this.\u0275fac=function(p){return new(p||t)}}static{this.\u0275cmp=K({type:t,selectors:[["app-ap-journal"]],features:[Y([B]),W],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","AP 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","supplierID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(p,n){if(p&1){let i=y();r(0,"app-main-panel",8),X("isDialogFilterVisibleChange",function(m){return g(i),M(n.isDialogFilterVisible,m)||(n.isDialogFilterVisible=m),h(m)})("isInitDialogFilterVisibleChange",function(m){return g(i),M(n.isInitDialogFilterVisible,m)||(n.isInitDialogFilterVisible=m),h(m)}),E("filterConfirmed",function(){return g(i),h(n.onFilterOKEvent())})("search",function(m){return g(i),h(n.onSearch(m))}),x(1,Ze,1,1,"ng-template",null,0,v)(3,ot,10,10,"ng-template",null,1,v)(5,ut,27,24,"ng-template",null,2,v),o()}p&2&&(c("isSearchableInput",!0)("isFilterable",!0),Q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[De,ze,ke,Pe,Me,re,ee,te,ie,ne,oe,Ce,xe,be,Se,_e,ce,le,me,se,ue,de,Ne,Re,Je,Fe,he,ge,Oe,Be,Ve,Te,Ae,He],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{ti as ApJournalComponent};
1
+ import{a as F}from"./chunk-EXGI2AG7.js";import{a as Be,b as Oe}from"./chunk-HHJMN4BS.js";import{a as He}from"./chunk-MDH73MG3.js";import{b as D}from"./chunk-ERFXO32T.js";import"./chunk-ZM5TVQUU.js";import{a as ae}from"./chunk-AGLKA7OG.js";import"./chunk-YOUPD27G.js";import{a as je}from"./chunk-XKI7WLHE.js";import"./chunk-AZUQDRJU.js";import"./chunk-C2GO6SPF.js";import{a as j,b as H}from"./chunk-O4QM64EH.js";import{d as ke,i as Pe,j as Me,k as ze}from"./chunk-EW3R2HAB.js";import{a as Fe,b as Je}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import"./chunk-PKN47FQE.js";import{a as Re,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 Ae,h as De}from"./chunk-UYC454VQ.js";import{b as Te,c as Ve}from"./chunk-C7LM5UCK.js";import{a as Se,b as be}from"./chunk-J4XRJAME.js";import{a as w,b as ve,c as we,d as ye,e as Ee,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 pe,e as me,f as se,k as ce,l as ue,o as de,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 V,Cb as x,Ga as k,Jc as I,Kb as c,Kc as Z,Lc as A,Mc as v,Nb as $,Ub as r,Vb as o,Wb as S,X as N,Yc as T,Z as U,_b as y,bb as L,c as J,cb as G,dc as E,ec as _,gb as l,ha as C,pa as g,qa as h,qc as s,rc as b,s as R,sc as P,uc as q,vc as Q,wb as K,wc as M,xc as X,yc as Y,zc as z}from"./chunk-JP6RBSB3.js";import{a as u,b as f}from"./chunk-YQFG5XE2.js";var qe={data:{data:[],totalCount:0},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0}}},B=ve(Ie(qe),we(t=>({first:T(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:T(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:T(()=>t.data().data.some(a=>a.checked)),checkedAPCollection:T(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),Ee(t=>{let a=C(F),e=C(D);return{updateFilter(n){w(t,i=>f(u({},i),{filter:u(u({},i.filter),n)}))},onRowSelect(n){w(t,i=>{let d=i.data.data.map(m=>m.id===n.id?f(u({},m),{checked:!0}):m);return f(u({},i),{data:f(u({},i.data),{data:d})})})},onRowUnselect(n){w(t,i=>{let d=i.data.data.map(m=>m.id===n.id?f(u({},m),{checked:!1}):m);return f(u({},i),{data:f(u({},i.data),{data:d})})})},onHeaderCheckboxToggle(n){w(t,i=>{let d=i.data.data.map(m=>f(u({},m),{checked:n}));return f(u({},i),{data:f(u({},i.data),{data:d})})})},getAPLoader:j(J(N(()=>a.getAPJournalLoader().pipe(H({next:n=>{w(t,i=>f(u({},i),{meta:n}))},error:n=>{console.error("Error fetching AP journal:",n)}}))))),getARCollection:j(J(R(n=>Object.entries(n).reduce((i,[d,m])=>(m!=null&&(i[d]=m),i),{})),N(n=>a.getAPJournal(n).pipe(R(i=>f(u({},i),{data:i.data.map(d=>f(u({},d),{due:e.from(d.due)?e.from(d.due).format():null,checked:!1}))})),H({next:i=>{w(t,d=>f(u({},d),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),ye(t=>({onInit:()=>{t.getAPLoader(),t.getARCollection(t.filter)}})));var Qe=()=>({height:"calc(100vh - 70px)"}),O=t=>({"ng-invalid ng-dirty":t}),Xe=()=>({});function Ye(t,a){if(t&1){let e=y();r(0,"p-button",10),E("onClick",function(){g(e);let n=_(2);return h(n.onCreateJournal())}),o()}}function Ze(t,a){if(t&1&&x(0,Ye,1,0,"p-button",9),t&2){let e=_();c("ngIf",e.store.hasCheckedRows())}}function et(t,a){t&1&&(r(0,"tr")(1,"th",12),S(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),s(4,"Outlet"),o(),r(5,"th",14),s(6,"Number"),o(),r(7,"th",15),s(8,"Supplier"),o(),r(9,"th",16),s(10,"Date"),o(),r(11,"th",16),s(12,"Due"),o(),r(13,"th",15),s(14,"Note"),o(),r(15,"th",17),s(16,"Payment"),o(),S(17,"th",12),o())}function tt(t,a){if(t&1&&(r(0,"tr")(1,"td"),S(2,"p-tableCheckbox",18),o(),r(3,"td"),s(4),o(),r(5,"td")(6,"a",19),s(7),o()(),r(8,"td"),s(9),o(),r(10,"td"),s(11),I(12,"date"),o(),r(13,"td"),s(14),I(15,"date"),o(),r(16,"td"),S(17,"div",20),o(),r(18,"td"),s(19),o(),r(20,"td"),S(21,"p-button",21),o()()),t&2){let e=a.$implicit,p=_(2);l(2),c("value",e),l(2),b(e.outlet),l(2),c("href",p.authService.getTenantExternalURL()+"/menu/Debt/Debt/Join_Bill/New_Join_Bill/Info?ID="+e.id,G),l(),P(" ",e.number," "),l(2),b(e.customer),l(2),b(A(12,12,e.date,"d MMM y")),l(3),b(e.due?A(15,15,e.due,"d MMM y hh:mm"):"-"),l(3),c("innerHTML",e.note,L),l(2),b(e.payment),l(2),c("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function it(t,a){if(t&1&&s(0),t&2){let e=_(2);q(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function nt(t,a){t&1&&(r(0,"tr")(1,"td",22)(2,"span"),s(3,"No records found."),o()()())}function ot(t,a){if(t&1){let e=y();r(0,"p-panel")(1,"p-table",11),E("onPage",function(n){g(e);let i=_();return h(i.onPageChange(n))})("onHeaderCheckboxToggle",function(n){g(e);let i=_();return h(i.onHeaderCheckboxToggle(n))})("onRowSelect",function(n){g(e);let i=_();return h(i.onRowSelect(n))})("onRowUnselect",function(n){g(e);let i=_();return h(i.onRowUnselect(n))}),x(2,et,18,0,"ng-template",null,3,v)(4,tt,22,18,"ng-template",null,4,v)(6,it,1,3,"ng-template",null,5,v)(8,nt,4,0,"ng-template",null,6,v),o()()}if(t&2){let e=_();$(z(9,Qe)),l(),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 rt(t,a){if(t&1&&(r(0,"span",32),s(1),I(2,"truncate"),o()),t&2){let e=a.$implicit;c("pTooltip",e.name),l(),P(" ",A(2,2,e.name,30)," ")}}function at(t,a){if(t&1&&(r(0,"div")(1,"span",34),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function lt(t,a){if(t&1&&(r(0,"div"),x(1,at,3,1,"div",33),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("from"))}}function pt(t,a){if(t&1&&(r(0,"div")(1,"span",34),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function mt(t,a){if(t&1&&(r(0,"div"),x(1,pt,3,1,"div",33),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("to"))}}function st(t,a){if(t&1&&(r(0,"div")(1,"span",34),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function ct(t,a){if(t&1&&(r(0,"div"),x(1,st,3,1,"div",33),o()),t&2){let e=_(2);l(),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),s(3,"Outlet"),o(),r(4,"p-select",26),x(5,rt,3,5,"ng-template",null,7,v),o()(),r(7,"div",24)(8,"label",25),s(9,"From"),o(),S(10,"p-datepicker",27),x(11,lt,2,1,"div",28),o(),r(12,"div",24)(13,"label",25),s(14,"To"),o(),S(15,"p-datepicker",29),x(16,mt,2,1,"div",28),o(),r(17,"div",24)(18,"label",25),s(19,"Supplier"),o(),r(20,"p-autocomplete",30),I(21,"async"),E("completeMethod",function(n){g(e);let i=_();return h(i.onSearchSupplier(n))}),o()(),r(22,"div",24)(23,"label",25),s(24,"Page Size"),o(),S(25,"input",31),x(26,ct,2,1,"div",28),o()()}if(t&2){let e=_();c("formGroup",e.form),l(4),c("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),l(6),c("iconDisplay","input")("showIcon",!0)("ngClass",V(17,O,e.isInvalid("from"))),l(),c("ngIf",e.isInvalid("from")),l(4),c("iconDisplay","input")("showIcon",!0)("ngClass",V(19,O,e.isInvalid("to"))),l(),c("ngIf",e.isInvalid("to")),l(4),c("suggestions",Z(21,15,e.supplierSuggestions$)),l(5),c("autoNumeric",z(21,Xe))("ngClass",V(22,O,e.isInvalid("pageSize"))),l(),c("ngIf",e.isInvalid("pageSize"))}}var ti=(()=>{class t extends je{constructor(){super(),this.store=C(B),this.generateJournalService=C(F),this.authService=C(ae),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=C(fe),this.dayjsService=C(D)}ngOnInit(){this.initform()}initform(){let{outletName:e,number:p,from:n,to:i,paymentState:d,supplierID:m,pageNumber:Ue,rowCount:Le,pageSize:Ge,export:Ke,exportPageNumber:We,exportRowCount:$e}=this.store.filter();this.form=this.fb.group({outletName:this.fb.control(e),number:this.fb.control(p),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),paymentState:this.fb.control(d),supplierID:this.fb.control(m),pageNumber:this.fb.control(Ue),rowCount:this.fb.control(Le),pageSize:this.fb.control(Ge,[pe.required]),export:this.fb.control(Ke),exportPageNumber:this.fb.control(We),exportRowCount:this.fb.control($e)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((p,[n,i])=>(i!=null&&(n==="from"||n==="to"?(typeof i=="string"||typeof i=="number"||i instanceof Date)&&(p[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null):p[n]=i),p),{});this.store.updateFilter(e),this.isDialogFilterVisible.update(p=>!p)}onSearch(e){this.store.updateFilter(f(u({},this.store.filter()),{number:e}))}onSearchSupplier(e){this.supplierSuggestions$=this.generateJournalService.getSupplierSuggestions(e.query).pipe()}onPageChange(e){let p=e.first/e.rows;this.store.updateFilter(f(u({},this.store.filter()),{pageNumber:p+1}))}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(p=>{this.store.onRowUnselect(p)});return}else this.store.onRowUnselect(e.data)}onCreateJournal(){this.generateJournalService.createAPJournal(this.store.checkedAPCollection()).pipe(U(()=>{this.store.getARCollection(this.store.filter)})).subscribe()}static{this.\u0275fac=function(p){return new(p||t)}}static{this.\u0275cmp=K({type:t,selectors:[["app-ap-journal"]],features:[Y([B]),W],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","AP 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","supplierID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(p,n){if(p&1){let i=y();r(0,"app-main-panel",8),X("isDialogFilterVisibleChange",function(m){return g(i),M(n.isDialogFilterVisible,m)||(n.isDialogFilterVisible=m),h(m)})("isInitDialogFilterVisibleChange",function(m){return g(i),M(n.isInitDialogFilterVisible,m)||(n.isInitDialogFilterVisible=m),h(m)}),E("filterConfirmed",function(){return g(i),h(n.onFilterOKEvent())})("search",function(m){return g(i),h(n.onSearch(m))}),x(1,Ze,1,1,"ng-template",null,0,v)(3,ot,10,10,"ng-template",null,1,v)(5,ut,27,24,"ng-template",null,2,v),o()}p&2&&(c("isSearchableInput",!0)("isFilterable",!0),Q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[De,ze,ke,Pe,Me,re,ee,te,ie,ne,oe,Ce,xe,be,Se,_e,ce,le,me,se,ue,de,Ne,Re,Je,Fe,he,ge,Oe,Be,Ve,Te,Ae,He],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{ti as ApJournalComponent};
@@ -1 +1 @@
1
- import{a as D}from"./chunk-W24I5WPW.js";import{a as rt}from"./chunk-G4XX7EU2.js";import{a as Le,b as We}from"./chunk-HHJMN4BS.js";import{a as ze}from"./chunk-MDH73MG3.js";import{b as N}from"./chunk-XILGARZ5.js";import"./chunk-MFH4UZ6J.js";import{a as ne}from"./chunk-VVHTNAHQ.js";import{a as Ae,b as Pe}from"./chunk-YOUPD27G.js";import{a as je}from"./chunk-XKI7WLHE.js";import"./chunk-AZUQDRJU.js";import"./chunk-C2GO6SPF.js";import{a as z,b as O}from"./chunk-O4QM64EH.js";import{d as ke,i as Ne,j as Je,k as Be}from"./chunk-EW3R2HAB.js";import{a as Fe,b as Ve}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import{a as Me}from"./chunk-XKCLERWG.js";import"./chunk-PKN47FQE.js";import{a as De,b as Re}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 Ee,h as Te}from"./chunk-UYC454VQ.js";import{b as we,c as Ie}from"./chunk-C7LM5UCK.js";import{a as he,b as Se}from"./chunk-J4XRJAME.js";import{a as y,b as Ce,c as xe,d as be,e as ve,f as ye,g as ot}from"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{n as de,o as fe,w as _e,x as ge}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{b as oe,c as re,e as le,f as ae,k as pe,l as me,o as se,v as ce,y as ue}from"./chunk-FMVCTBCQ.js";import"./chunk-P3V7Z3A6.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{c as X,e as Y,f as Z,i as nt,k as ee,l as te,m as ie}from"./chunk-B63BKC6F.js";import{Ab as L,Ac as F,Cb as g,Ga as R,Jc as w,Kb as s,Kc as j,Lc as V,Mc as b,Nb as W,Ub as l,Vb as o,Wb as C,X as B,Yc as I,Z as H,_b as E,c as J,cb as U,dc as T,ec as _,gb as a,ha as v,pa as h,qa as S,qc as m,rc as x,s as G,sc as k,ta as it,uc as K,vc as q,wb as A,wc as M,xc as $,yc as Q,zc as P}from"./chunk-JP6RBSB3.js";import{a as c,b as u}from"./chunk-YQFG5XE2.js";var Ct={data:{data:[],totalCount:0},meta:{options:{outlets:[],paymentStates:[],deliveryStates:[]},filter:{number:null,outletName:null,paymentState:0,deliveryState:0,from:null,to:null,customerID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},filter:{number:null,outletName:null,paymentState:0,deliveryState:0,from:null,to:null,customerID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},Qe=Ce(ye(Ct),xe(t=>({first:I(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:I(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:I(()=>t.data().data.some(p=>p.checked)),checkedInvoice:I(()=>t.data().data.filter(p=>p.checked).map(p=>p.id))})),ve(t=>{let p=v(D),e=v(N);return{updateFilter(n){y(t,i=>u(c({},i),{filter:c(c({},i.filter),n),skipRequestFirst:!1}))},onRowSelect(n){y(t,i=>{let f=i.data.data.map(d=>d.id===n.id?u(c({},d),{checked:!0}):d);return u(c({},i),{data:u(c({},i.data),{data:f})})})},onRowUnselect(n){y(t,i=>{let f=i.data.data.map(d=>d.id===n.id?u(c({},d),{checked:!1}):d);return u(c({},i),{data:u(c({},i.data),{data:f})})})},onHeaderCheckboxToggle(n){y(t,i=>{let f=i.data.data.map(d=>u(c({},d),{checked:n}));return u(c({},i),{data:u(c({},i.data),{data:f})})})},getCustomerInvoice:z(J(G(n=>Object.entries(n).reduce((i,[f,d])=>(d!=null&&(i[f]=d),i),{})),B(n=>p.getJournalInvoice(n).pipe(G(i=>u(c({},i),{data:i.data.map(f=>u(c({},f),{due:e.from(f.due)?e.from(f.due).format():null,checked:!1}))})),Me("getCustomerInvoice"),O({next:i=>{y(t,f=>u(c({},f),{data:u(c({},f.data),{data:i.data,totalCount:i.totalCount})}))},error:i=>{console.error("Error fetching customer invoice:",i)}}))))),getCustomerInvoiceLoader:z(J(B(()=>p.getJournalInvoiceLoader().pipe(O({next:n=>{y(t,i=>u(c({},i),{meta:n}))},error:n=>{console.error("Error fetching customer invoice loader:",n)}})))))}}),be(t=>({onInit:()=>{t.getCustomerInvoiceLoader(),t.getCustomerInvoice(t.filter)}})));var vt=()=>({height:"calc(100vh - 70px)"}),Xe=t=>({"ng-invalid ng-dirty":t}),yt=()=>({});function wt(t,p){if(t&1){let e=E();l(0,"p-button",10),T("onClick",function(){h(e);let n=_(2);return S(n.onGenerateJournal())}),o()}}function It(t,p){if(t&1&&g(0,wt,1,0,"p-button",9),t&2){let e=_();s("ngIf",e.store.hasCheckedRows())}}function Et(t,p){t&1&&(l(0,"tr")(1,"th",12),C(2,"p-tableHeaderCheckbox"),o(),l(3,"th",13),m(4,"Outlet"),o(),l(5,"th",14),m(6,"Number"),o(),l(7,"th",15),m(8,"Customer"),o(),l(9,"th",16),m(10,"Date"),o(),l(11,"th",16),m(12,"Due"),o(),l(13,"th",13),m(14,"Amount"),o(),l(15,"th",17),m(16,"Payment"),o(),l(17,"th",17),m(18,"Delivery"),o(),C(19,"th",12),o())}function Tt(t,p){if(t&1&&(l(0,"tr")(1,"td"),C(2,"p-tableCheckbox",18),o(),l(3,"td"),m(4),o(),l(5,"td")(6,"a",19),m(7),o()(),l(8,"td")(9,"a",19),m(10),o()(),l(11,"td"),m(12),w(13,"date"),o(),l(14,"td"),m(15),w(16,"date"),o(),l(17,"td"),m(18),w(19,"number"),o(),l(20,"td"),C(21,"p-chip",20),o(),l(22,"td"),C(23,"p-chip",20),o(),l(24,"td"),C(25,"p-button",21),o()()),t&2){let e=p.$implicit,r=_(2);a(2),s("value",e),a(2),x(e.outlet),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Orders/Orders/Customer_Invoice/Info?ID="+e.id,U),a(),k(" ",e.number," "),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.customerID,U),a(),k(" ",e.customer," "),a(2),x(V(13,14,e.date,"d MMM y hh:mm")),a(3),x(e.due?V(16,17,e.due,"d MMM y hh:mm"):"-"),a(3),x(j(19,20,e.amount)),a(3),s("label",e.payment),a(2),s("label",e.delivery),a(2),s("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function Ft(t,p){if(t&1&&m(0),t&2){let e=_(2);K(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Vt(t,p){t&1&&(l(0,"tr")(1,"td",22)(2,"span"),m(3,"No records found."),o()()())}function Dt(t,p){if(t&1){let e=E();l(0,"p-panel")(1,"p-table",11),T("onPage",function(n){h(e);let i=_();return S(i.onPageChange(n))})("onRowSelect",function(n){h(e);let i=_();return S(i.onRowSelect(n))})("onRowUnselect",function(n){h(e);let i=_();return S(i.onRowUnselect(n))})("onHeaderCheckboxToggle",function(n){h(e);let i=_();return S(i.onHeaderCheckboxToggle(n))}),g(2,Et,20,0,"ng-template",null,3,b)(4,Tt,26,22,"ng-template",null,4,b)(6,Ft,1,3,"ng-template",null,5,b)(8,Vt,4,0,"ng-template",null,6,b),o()()}if(t&2){let e=_();W(P(9,vt)),a(),s("scrollable",!0)("scrollHeight","calc(100vh - 142px)")("lazy",!0)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("value",e.store.data().data)}}function Rt(t,p){if(t&1&&(l(0,"span",34),m(1),w(2,"truncate"),o()),t&2){let e=p.$implicit;s("pTooltip",e.name),a(),k(" ",V(2,2,e.name,30)," ")}}function kt(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Nt(t,p){if(t&1&&(l(0,"div"),g(1,kt,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("from"))}}function Jt(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Bt(t,p){if(t&1&&(l(0,"div"),g(1,Jt,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("to"))}}function Mt(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Pt(t,p){if(t&1&&(l(0,"div"),g(1,Mt,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("pageSize"))}}function jt(t,p){if(t&1){let e=E();l(0,"form",23)(1,"div",24)(2,"label",25),m(3,"Outlet"),o(),l(4,"p-select",26),g(5,Rt,3,5,"ng-template",null,7,b),o()(),l(7,"div",24)(8,"label",25),m(9,"Payment"),o(),C(10,"p-select",27),o(),l(11,"div",24)(12,"label",25),m(13,"Delivery"),o(),C(14,"p-select",28),o(),l(15,"div",24)(16,"label",25),m(17,"From"),o(),C(18,"p-datepicker",29),g(19,Nt,2,1,"div",30),o(),l(20,"div",24)(21,"label",25),m(22,"To"),o(),C(23,"p-datepicker",31),g(24,Bt,2,1,"div",30),o(),l(25,"div",24)(26,"label",25),m(27,"Customer"),o(),l(28,"p-autocomplete",32),T("completeMethod",function(n){h(e);let i=_();return S(i.onSearchContact(n))}),o()(),l(29,"div",24)(30,"label",25),m(31,"Page Size"),o(),C(32,"input",33),g(33,Pt,2,1,"div",30),o()()}if(t&2){let e=_();s("formGroup",e.form),a(4),s("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),a(6),s("options",e.store.meta().options.paymentStates),a(4),s("options",e.store.meta().options.deliveryStates),a(4),s("iconDisplay","input")("showIcon",!0)("ngClass",F(17,Xe,e.isInvalid("from"))),a(),s("ngIf",e.isInvalid("from")),a(4),s("iconDisplay","input")("showIcon",!0)("ngClass",F(19,Xe,e.isInvalid("to"))),a(),s("ngIf",e.isInvalid("to")),a(4),s("suggestions",e.customerSuggestions()),a(4),s("ngClass",F(21,Xe,e.isInvalid("pageSize")))("autoNumeric",P(23,yt)),a(),s("ngIf",e.isInvalid("pageSize"))}}var gt=(()=>{class t extends je{constructor(){super(...arguments),this.store=v(Qe),this.dayjsService=v(N),this.generateJournalService=v(D),this.authService=v(ne),this.isDialogFilterVisible=R(!1),this.isInitDialogFilterVisible=R(!1),this.customerSuggestions=R([]),this.fb=v(ce)}ngOnInit(){console.log(this.dayjsService.from('0001-01-01T00:00:00"')&&!0),this.generateFilterForm()}generateFilterForm(){let{number:e,outletName:r,paymentState:n,deliveryState:i,from:f,to:d,customerID:Oe,pageNumber:Ge,rowCount:He,pageSize:Ue,export:Ke,exportPageNumber:qe,exportRowCount:$e}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),outletName:this.fb.control(r),paymentState:this.fb.control(n),deliveryState:this.fb.control(i),from:this.fb.control(this.dayjsService.from(f)?this.dayjsService.from(f).toDate():null),to:this.fb.control(this.dayjsService.from(d)?this.dayjsService.from(d).toDate():null),customerID:this.fb.control(Oe),pageNumber:this.fb.control(Ge),rowCount:this.fb.control(He),pageSize:this.fb.control(Ue,[re.required]),export:this.fb.control(Ke),exportPageNumber:this.fb.control(qe),exportRowCount:this.fb.control($e)})}onSearchContact(e){let{query:r}=e;this.generateJournalService.getCustomerSuggestions(r).pipe(Me("Customer Suggestions"),H(n=>{this.customerSuggestions.set(n)})).subscribe()}onSearch(e){this.store.updateFilter(u(c({},this.store.filter()),{number:e}))}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(r=>{this.store.onRowUnselect(r)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onPageChange(e){let r=e.first/e.rows;this.store.updateFilter(u(c({},this.store.filter()),{pageNumber:r+1}))}onGenerateJournal(){this.generateJournalService.generateJournalInvoice(this.store.checkedInvoice()).pipe(H(()=>{this.store.getCustomerInvoice(this.store.filter)})).subscribe()}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((r,[n,i])=>{switch(n){case"customerID":i||(r[n]=rt);break;case"from":typeof i=="object"?r[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:r[n]=i!=null?String(i):null;break;case"to":typeof i=="object"?r[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:r[n]=i!=null?String(i):null;break;default:r[n]=i===null?"":i;break}return r},{});console.log("Filter Body:",e),this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}static{this.\u0275fac=(()=>{let e;return function(n){return(e||(e=it(t)))(n||t)}})()}static{this.\u0275cmp=A({type:t,selectors:[["app-customer-invoice"]],features:[Q([Qe]),L],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Customer Invoice",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","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","scrollable","scrollHeight","lazy","paginator","rows","totalRecords","value"],[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,"label"],[3,"icon","severity","text"],["colspan","10"],[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","paymentState","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select a Payment",3,"options"],["showClear","","formControlName","deliveryState","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select a Delivery",3,"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,"ngClass","autoNumeric"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(r,n){if(r&1){let i=E();l(0,"app-main-panel",8),$("isDialogFilterVisibleChange",function(d){return h(i),M(n.isDialogFilterVisible,d)||(n.isDialogFilterVisible=d),S(d)})("isInitDialogFilterVisibleChange",function(d){return h(i),M(n.isInitDialogFilterVisible,d)||(n.isInitDialogFilterVisible=d),S(d)}),T("filterConfirmed",function(){return h(i),S(n.onFilterOKEvent())})("search",function(d){return h(i),S(n.onSearch(d))}),g(1,It,1,1,"ng-template",null,0,b)(3,Dt,10,10,"ng-template",null,1,b)(5,jt,34,24,"ng-template",null,2,b),o()}r&2&&(s("isSearchableInput",!0)("isFilterable",!0),q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[Te,Be,ke,Ne,Je,ie,X,Y,Z,te,ee,Pe,Ae,Se,he,ge,_e,Re,De,Ve,Fe,fe,de,We,Le,ue,pe,oe,le,ae,me,se,Ie,we,Ee,ze],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var zt={data:{data:[],totalCount:0},meta:{options:{Outlets:[],PaymentStates:[],DeliveryStates:[]},filter:{number:null,outletName:null,paymentState:0,deliveryState:0,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},filter:{number:null,outletName:null,paymentState:0,deliveryState:0,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4},skipRequestFirst:!0},Ye=Ce(ot("JournalSupplierBillStore"),ye(zt),xe(t=>({first:I(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:I(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:I(()=>t.data().data.some(p=>p.checked)),checkedSupplierBill:I(()=>t.data().data.filter(p=>p.checked).map(p=>p.id))})),ve(t=>{let p=v(D),e=v(N);return{updateFilter(r){y(t,n=>u(c({},n),{filter:c(c({},n.filter),r),skipRequestFirst:!1}))},onRowSelect(r){y(t,n=>{let i=n.data.data.map(f=>f.id===r.id?u(c({},f),{checked:!0}):f);return u(c({},n),{data:u(c({},n.data),{data:i})})})},onRowUnselect(r){y(t,n=>{let i=n.data.data.map(f=>f.id===r.id?u(c({},f),{checked:!1}):f);return u(c({},n),{data:u(c({},n.data),{data:i})})})},onHeaderCheckboxToggle(r){y(t,n=>{let i=n.data.data.map(f=>u(c({},f),{checked:r}));return u(c({},n),{data:u(c({},n.data),{data:i})})})},getGJSupplierBillLoader:z(J(B(()=>p.getGJSupplierBillLoader().pipe(O({next:r=>{console.log("GJSupplierBillLoader response:",r),y(t,n=>u(c({},n),{meta:r}))},error:r=>{console.error("Error fetching GJSupplierBillLoader:",r)}}))))),getJournalSupplierBill:z(J(G(r=>Object.entries(r).reduce((n,[i,f])=>(f!=null&&(n[i]=f),n),{})),B(r=>p.getJournalSupplierBill(r).pipe(G(n=>u(c({},n),{data:n.data.map(i=>u(c({},i),{due:e.from(i.due)?e.from(i.due).format():null,checked:!1}))})),O({next:n=>{y(t,i=>u(c({},i),{data:n}))},error:n=>{console.error("Error fetching journal supplier bill:",n)}})))))}}),be(t=>({onInit:()=>{t.getGJSupplierBillLoader(),t.getJournalSupplierBill(t.filter)}})));var Ot=()=>({height:"calc(100vh - 70px)"}),Ze=t=>({"ng-invalid ng-dirty":t}),Gt=()=>({});function Ht(t,p){if(t&1){let e=E();l(0,"p-button",10),T("onClick",function(){h(e);let n=_(2);return S(n.onGenerateJournal())}),o()}}function Ut(t,p){if(t&1&&g(0,Ht,1,0,"p-button",9),t&2){let e=_();s("ngIf",e.store.hasCheckedRows())}}function At(t,p){t&1&&(l(0,"tr")(1,"th",12),C(2,"p-tableHeaderCheckbox"),o(),l(3,"th",13),m(4,"Outlet"),o(),l(5,"th",14),m(6,"Number"),o(),l(7,"th",15),m(8,"Supplier"),o(),l(9,"th",16),m(10,"Date"),o(),l(11,"th",16),m(12,"Due"),o(),l(13,"th",13),m(14,"Amount"),o(),l(15,"th",17),m(16,"Payment"),o(),l(17,"th",17),m(18,"Delivery"),o(),C(19,"th",12),o())}function Lt(t,p){if(t&1&&(l(0,"tr")(1,"td"),C(2,"p-tableCheckbox",18),o(),l(3,"td"),m(4),o(),l(5,"td")(6,"a",19),m(7),o()(),l(8,"td"),m(9),o(),l(10,"td"),m(11),w(12,"date"),o(),l(13,"td"),m(14),w(15,"date"),o(),l(16,"td"),m(17),w(18,"number"),o(),l(19,"td"),C(20,"p-chip",20),o(),l(21,"td"),C(22,"p-chip",20),o(),l(23,"td"),C(24,"p-button",21),o()()),t&2){let e=p.$implicit,r=_(2);a(2),s("value",e),a(2),x(e.outlet),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Orders/Orders/Supplier_Bill/Info?ID="+e.id,U),a(),k(" ",e.number," "),a(2),x(e.customer),a(2),x(V(12,13,e.date,"d MMM y hh:mm")),a(3),x(e.due?V(15,16,e.due,"d MMM y hh:mm"):"-"),a(3),x(j(18,19,e.amount)),a(3),s("label",e.payment),a(2),s("label",e.delivery),a(2),s("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function Wt(t,p){if(t&1&&m(0),t&2){let e=_(2);K(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Kt(t,p){t&1&&(l(0,"tr")(1,"td",22)(2,"span"),m(3,"No records found."),o()()())}function qt(t,p){if(t&1){let e=E();l(0,"p-panel")(1,"p-table",11),T("onPage",function(n){h(e);let i=_();return S(i.onPageChange(n))})("onRowSelect",function(n){h(e);let i=_();return S(i.onRowSelect(n))})("onRowUnselect",function(n){h(e);let i=_();return S(i.onRowUnselect(n))})("onHeaderCheckboxToggle",function(n){h(e);let i=_();return S(i.onHeaderCheckboxToggle(n))}),g(2,At,20,0,"ng-template",null,3,b)(4,Lt,25,21,"ng-template",null,4,b)(6,Wt,1,3,"ng-template",null,5,b)(8,Kt,4,0,"ng-template",null,6,b),o()()}if(t&2){let e=_();W(P(9,Ot)),a(),s("scrollHeight","calc(100vh - 142px)")("value",e.store.data().data)("scrollable",!0)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function $t(t,p){if(t&1&&(l(0,"span",34),m(1),w(2,"truncate"),o()),t&2){let e=p.$implicit;s("pTooltip",e.name),a(),k(" ",V(2,2,e.name,30)," ")}}function Qt(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Xt(t,p){if(t&1&&(l(0,"div"),g(1,Qt,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("from"))}}function Yt(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Zt(t,p){if(t&1&&(l(0,"div"),g(1,Yt,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("to"))}}function ei(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function ti(t,p){if(t&1&&(l(0,"div"),g(1,ei,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("pageSize"))}}function ii(t,p){if(t&1){let e=E();l(0,"form",23)(1,"div",24)(2,"label",25),m(3,"Outlet"),o(),l(4,"p-select",26),g(5,$t,3,5,"ng-template",null,7,b),o()(),l(7,"div",24)(8,"label",25),m(9,"Payment"),o(),C(10,"p-select",27),o(),l(11,"div",24)(12,"label",25),m(13,"Delivery"),o(),C(14,"p-select",28),o(),l(15,"div",24)(16,"label",25),m(17,"From"),o(),C(18,"p-datepicker",29),g(19,Xt,2,1,"div",30),o(),l(20,"div",24)(21,"label",25),m(22,"To"),o(),C(23,"p-datepicker",31),g(24,Zt,2,1,"div",30),o(),l(25,"div",24)(26,"label",25),m(27,"Supplier"),o(),l(28,"p-autocomplete",32),w(29,"async"),T("completeMethod",function(n){h(e);let i=_();return S(i.onSearchSupplier(n))}),o()(),l(30,"div",24)(31,"label",25),m(32,"Page Size"),o(),C(33,"input",33),g(34,ti,2,1,"div",30),o()()}if(t&2){let e=_();s("formGroup",e.form),a(4),s("virtualScrollItemSize",50)("options",e.store.meta().options.Outlets),a(6),s("options",e.store.meta().options.PaymentStates),a(4),s("options",e.store.meta().options.DeliveryStates),a(4),s("iconDisplay","input")("showIcon",!0)("ngClass",F(19,Ze,e.isInvalid("from"))),a(),s("ngIf",e.isInvalid("from")),a(4),s("iconDisplay","input")("showIcon",!0)("ngClass",F(21,Ze,e.isInvalid("to"))),a(),s("ngIf",e.isInvalid("to")),a(4),s("suggestions",j(29,17,e.supplierSuggestions$)),a(5),s("autoNumeric",P(23,Gt))("ngClass",F(24,Ze,e.isInvalid("pageSize"))),a(),s("ngIf",e.isInvalid("pageSize"))}}var ht=(()=>{class t extends je{constructor(){super(),this.generateJournalService=v(D),this.store=v(Ye),this.authService=v(ne),this.isDialogFilterVisible=R(!1),this.isInitDialogFilterVisible=R(!1),this.fb=v(ce),this.dayjsService=v(N)}ngOnInit(){this.initform()}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((r,[n,i])=>(i!=null&&(n==="from"||n==="to"?(typeof i=="string"||typeof i=="number"||i instanceof Date)&&(r[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null):r[n]=i),r),{});this.store.updateFilter(e),this.isDialogFilterVisible.update(r=>!r)}onRowSelect(e){this.store.onRowSelect(e.data)}onSearchSupplier(e){this.supplierSuggestions$=this.generateJournalService.getSupplierSuggestions(e.query).pipe(Me("Supplier Suggestions"))}initform(){let{outletName:e,number:r,from:n,to:i,paymentState:f,deliveryState:d,supplierID:Oe,pageNumber:Ge,rowCount:He,pageSize:Ue,export:Ke,exportPageNumber:qe,exportRowCount:$e}=this.store.filter();this.form=this.fb.group({outletName:this.fb.control(e),number:this.fb.control(r),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),paymentState:this.fb.control(f),deliveryState:this.fb.control(d),supplierID:this.fb.control(Oe),pageNumber:this.fb.control(Ge),rowCount:this.fb.control(He),pageSize:this.fb.control(Ue,[re.required]),export:this.fb.control(Ke),exportPageNumber:this.fb.control(qe),exportRowCount:this.fb.control($e)})}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(r=>{this.store.onRowUnselect(r)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onGenerateJournal(){this.generateJournalService.generateJournalSupplierBill(this.store.checkedSupplierBill()).pipe(H(()=>{this.store.getJournalSupplierBill(this.store.filter)})).subscribe()}onSearch(e){this.store.updateFilter(u(c({},this.store.filter()),{number:e}))}onPageChange(e){this.store.updateFilter(u(c({},this.store.filter()),{pageNumber:e.first/e.rows+1}))}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=A({type:t,selectors:[["app-journal-supplier-bill"]],features:[Q([Ye]),L],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Supplier Bill",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","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","scrollHeight","value","scrollable","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,"label"],[3,"icon","severity","text"],["colspan","10"],[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","paymentState","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select a Payment",3,"options"],["showClear","","formControlName","deliveryState","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select a Delivery",3,"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","supplierID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(r,n){if(r&1){let i=E();l(0,"app-main-panel",8),$("isDialogFilterVisibleChange",function(d){return h(i),M(n.isDialogFilterVisible,d)||(n.isDialogFilterVisible=d),S(d)})("isInitDialogFilterVisibleChange",function(d){return h(i),M(n.isInitDialogFilterVisible,d)||(n.isInitDialogFilterVisible=d),S(d)}),T("filterConfirmed",function(){return h(i),S(n.onFilterOKEvent())})("search",function(d){return h(i),S(n.onSearch(d))}),g(1,Ut,1,1,"ng-template",null,0,b)(3,qt,10,10,"ng-template",null,1,b)(5,ii,35,26,"ng-template",null,2,b),o()}r&2&&(s("isSearchableInput",!0)("isFilterable",!0),q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[Te,Be,ke,Ne,Je,ie,X,Y,Z,nt,te,ee,Pe,Ae,Se,he,ge,_e,Re,De,Ve,Fe,We,Le,ue,pe,oe,le,ae,me,se,fe,de,Ee,Ie,we,ze],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var ni={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},filter:{number:null,outletName:null,from:null,to:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},et=Ce(ye(ni),xe(t=>({first:I(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:I(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:I(()=>t.data().data.some(p=>p.checked)),checkedShift:I(()=>t.data().data.filter(p=>p.checked).map(p=>p.id))})),ve(t=>{let p=v(D);return{updateFilter(e){y(t,r=>u(c({},r),{filter:c(c({},r.filter),e)}))},onRowSelect(e){y(t,r=>{let n=r.data.data.map(i=>i.id===e.id?u(c({},i),{checked:!0}):i);return u(c({},r),{data:u(c({},r.data),{data:n})})})},onRowUnselect(e){y(t,r=>{let n=r.data.data.map(i=>i.id===e.id?u(c({},i),{checked:!1}):i);return u(c({},r),{data:u(c({},r.data),{data:n})})})},onHeaderCheckboxToggle(e){y(t,r=>{let n=r.data.data.map(i=>u(c({},i),{checked:e}));return u(c({},r),{data:u(c({},r.data),{data:n})})})},getGJShiftLoader:z(J(B(()=>p.getGJShiftLoader().pipe(O(e=>y(t,r=>u(c({},r),{meta:e})),e=>console.error("Error fetching GJ Shift Loader:",e)))))),getJournalShift:z(J(G(e=>Object.entries(e).reduce((r,[n,i])=>(i!=null&&(r[n]=i),r),{})),B(e=>p.getJournalShift(e).pipe(O(r=>y(t,n=>u(c({},n),{data:r})),r=>console.error("Error fetching journal shift:",r))))))}}),be(t=>({onInit:()=>{t.getGJShiftLoader(),t.getJournalShift(t.filter)}})));var oi=()=>({height:"calc(100vh - 70px)"}),tt=t=>({"ng-invalid ng-dirty":t}),ri=()=>({});function li(t,p){if(t&1){let e=E();l(0,"p-button",10),T("onClick",function(){h(e);let n=_(2);return S(n.onGenerateJournal())}),o()}}function ai(t,p){if(t&1&&g(0,li,1,0,"p-button",9),t&2){let e=_();s("ngIf",e.store.hasCheckedRows())}}function pi(t,p){t&1&&(l(0,"tr")(1,"th",12),C(2,"p-tableHeaderCheckbox"),o(),l(3,"th",13),m(4,"Number"),o(),l(5,"th",14),m(6,"Open"),o(),l(7,"th",14),m(8,"Close"),o(),l(9,"th",15),m(10,"Cashier"),o(),l(11,"th",16),m(12,"Sales + Tax"),o(),l(13,"th",17),m(14,"Invoices"),o(),l(15,"th",16),m(16,"Outlet"),o(),l(17,"th",17),m(18,"Register"),o(),l(19,"th",17),m(20,"Visitors"),o(),C(21,"th",12),o())}function mi(t,p){if(t&1&&(l(0,"tr")(1,"td"),C(2,"p-tableCheckbox",18),o(),l(3,"td")(4,"a",19),m(5),o()(),l(6,"td"),m(7),w(8,"date"),o(),l(9,"td"),m(10),w(11,"date"),o(),l(12,"td"),m(13),o(),l(14,"td"),m(15),w(16,"number"),o(),l(17,"td"),m(18),w(19,"number"),o(),l(20,"td"),m(21),o(),l(22,"td"),m(23),o(),l(24,"td"),m(25),w(26,"number"),o(),l(27,"td"),C(28,"p-button",20),o()()),t&2){let e=p.$implicit,r=_(2);a(2),s("value",e),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Shift/Main/Previous_Shift/Register_Shift_Detail?ID="+e.id,U),a(),k(" ",e.number," "),a(2),x(V(8,14,e.open,"dd MMM y hh:mm")),a(3),x(V(11,17,e.close,"dd MMM y hh:mm")),a(3),x(e.cashier),a(2),x(j(16,20,e.salesNTax)),a(3),x(j(19,22,e.totalInvoice)),a(3),x(e.outlet),a(2),x(e.register),a(2),x(j(26,24,e.visitors)),a(3),s("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function si(t,p){if(t&1&&m(0),t&2){let e=_(2);K(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function ci(t,p){t&1&&(l(0,"tr")(1,"td",21)(2,"span"),m(3,"No records found."),o()()())}function ui(t,p){if(t&1){let e=E();l(0,"p-panel")(1,"p-table",11),T("onPage",function(n){h(e);let i=_();return S(i.onPageChange(n))})("onRowSelect",function(n){h(e);let i=_();return S(i.onRowSelect(n))})("onRowUnselect",function(n){h(e);let i=_();return S(i.onRowUnselect(n))})("onHeaderCheckboxToggle",function(n){h(e);let i=_();return S(i.onHeaderCheckboxToggle(n))}),g(2,pi,22,0,"ng-template",null,3,b)(4,mi,29,26,"ng-template",null,4,b)(6,si,1,3,"ng-template",null,5,b)(8,ci,4,0,"ng-template",null,6,b),o()()}if(t&2){let e=_();W(P(9,oi)),a(),s("scrollHeight","calc(100vh - 142px)")("scrollable",!0)("paginator",!0)("lazy",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("value",e.store.data().data)}}function di(t,p){if(t&1&&(l(0,"span",30),m(1),w(2,"truncate"),o()),t&2){let e=p.$implicit;s("pTooltip",e.name),a(),k(" ",V(2,2,e.name,30)," ")}}function fi(t,p){if(t&1&&(l(0,"div")(1,"span",32),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function _i(t,p){if(t&1&&(l(0,"div"),g(1,fi,3,1,"div",31),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("from"))}}function gi(t,p){if(t&1&&(l(0,"div")(1,"span",32),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function hi(t,p){if(t&1&&(l(0,"div"),g(1,gi,3,1,"div",31),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("to"))}}function Si(t,p){if(t&1&&(l(0,"div")(1,"span",32),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Ci(t,p){if(t&1&&(l(0,"div"),g(1,Si,3,1,"div",31),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("pageSize"))}}function xi(t,p){if(t&1&&(l(0,"form",22)(1,"div",23)(2,"label",24),m(3,"Outlet"),o(),l(4,"p-select",25),g(5,di,3,5,"ng-template",null,7,b),o()(),l(7,"div",23)(8,"label",24),m(9,"From"),o(),C(10,"p-datepicker",26),g(11,_i,2,1,"div",27),o(),l(12,"div",23)(13,"label",24),m(14,"To"),o(),C(15,"p-datepicker",28),g(16,hi,2,1,"div",27),o(),l(17,"div",23)(18,"label",24),m(19,"Page Size"),o(),C(20,"input",29),g(21,Ci,2,1,"div",27),o()()),t&2){let e=_();s("formGroup",e.form),a(4),s("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),a(6),s("iconDisplay","input")("showIcon",!0)("ngClass",F(14,tt,e.isInvalid("from"))),a(),s("ngIf",e.isInvalid("from")),a(4),s("iconDisplay","input")("showIcon",!0)("ngClass",F(16,tt,e.isInvalid("to"))),a(),s("ngIf",e.isInvalid("to")),a(4),s("autoNumeric",P(18,ri))("ngClass",F(19,tt,e.isInvalid("pageSize"))),a(),s("ngIf",e.isInvalid("pageSize"))}}var St=(()=>{class t extends je{constructor(){super(),this.generateJournalService=v(D),this.store=v(et),this.authService=v(ne),this.isDialogFilterVisible=R(!1),this.isInitDialogFilterVisible=R(!1),this.fb=v(ce),this.dayjsService=v(N)}ngOnInit(){this.initForm()}initForm(){let{number:e,outletName:r,from:n,to:i,pageNumber:f,rowCount:d,pageSize:Oe,export:Ge,exportPageNumber:He,exportRowCount:Ue}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),outletName:this.fb.control(r),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(f),rowCount:this.fb.control(d),pageSize:this.fb.control(Oe,[re.required]),export:this.fb.control(Ge),exportPageNumber:this.fb.control(He),exportRowCount:this.fb.control(Ue)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((r,[n,i])=>{switch(n){case"from":typeof i=="object"?r[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:r[n]=i!=null?String(i):null;break;case"to":typeof i=="object"?r[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:r[n]=i!=null?String(i):null;break;default:r[n]=i===null?"":i;break}return r},{});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(r=>{this.store.onRowUnselect(r)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onGenerateJournal(){this.generateJournalService.generateJournalSupplierBill(this.store.checkedShift()).pipe(H(()=>{this.store.getJournalShift(this.store.filter)})).subscribe()}onSearch(e){this.store.updateFilter(u(c({},this.store.filter()),{number:e}))}onPageChange(e){let r=e.first/e.rows;this.store.updateFilter(u(c({},this.store.filter()),{pageNumber:r+1}))}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=A({type:t,selectors:[["app-journal-shift"]],features:[Q([et]),L],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Shift Journal",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","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","scrollHeight","scrollable","paginator","lazy","rows","totalRecords","value"],[2,"width","4rem"],[2,"width","12rem"],[2,"width","11rem"],[2,"width","14rem"],[2,"width","10rem"],[2,"width","9rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"icon","severity","text"],["colspan","11"],[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(r,n){if(r&1){let i=E();l(0,"app-main-panel",8),$("isDialogFilterVisibleChange",function(d){return h(i),M(n.isDialogFilterVisible,d)||(n.isDialogFilterVisible=d),S(d)})("isInitDialogFilterVisibleChange",function(d){return h(i),M(n.isInitDialogFilterVisible,d)||(n.isInitDialogFilterVisible=d),S(d)}),T("filterConfirmed",function(){return h(i),S(n.onFilterOKEvent())})("search",function(d){return h(i),S(n.onSearch(d))}),g(1,ai,1,1,"ng-template",null,0,b)(3,ui,10,10,"ng-template",null,1,b)(5,xi,22,21,"ng-template",null,2,b),o()}r&2&&(s("isSearchableInput",!0)("isFilterable",!0),q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[Te,Be,ke,Ne,Je,ie,X,Y,Z,te,ee,Pe,Se,he,ge,_e,ue,pe,oe,le,ae,me,se,Re,De,Ve,Fe,Ee,Ie,we,fe,de,ze],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var yo=[{path:"invoice",component:gt},{path:"supplier-bill",component:ht},{path:"shift",component:St},{path:"join-invoice",loadComponent:()=>import("./chunk-PV3NLUKC.js").then(t=>t.ARJournalComponent)},{path:"join-bill",loadComponent:()=>import("./chunk-33YEAYJV.js").then(t=>t.ApJournalComponent)},{path:"adjustment",loadComponent:()=>import("./chunk-JPP5O2O5.js").then(t=>t.AdjustmentJournalComponent)}];export{yo as generateJournalRoutes};
1
+ import{a as D}from"./chunk-EXGI2AG7.js";import{a as rt}from"./chunk-G4XX7EU2.js";import{a as Le,b as We}from"./chunk-HHJMN4BS.js";import{a as ze}from"./chunk-MDH73MG3.js";import{b as N}from"./chunk-ERFXO32T.js";import"./chunk-ZM5TVQUU.js";import{a as ne}from"./chunk-AGLKA7OG.js";import{a as Ae,b as Pe}from"./chunk-YOUPD27G.js";import{a as je}from"./chunk-XKI7WLHE.js";import"./chunk-AZUQDRJU.js";import"./chunk-C2GO6SPF.js";import{a as z,b as O}from"./chunk-O4QM64EH.js";import{d as ke,i as Ne,j as Je,k as Be}from"./chunk-EW3R2HAB.js";import{a as Fe,b as Ve}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import{a as Me}from"./chunk-XKCLERWG.js";import"./chunk-PKN47FQE.js";import{a as De,b as Re}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 Ee,h as Te}from"./chunk-UYC454VQ.js";import{b as we,c as Ie}from"./chunk-C7LM5UCK.js";import{a as he,b as Se}from"./chunk-J4XRJAME.js";import{a as y,b as Ce,c as xe,d as be,e as ve,f as ye,g as ot}from"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{n as de,o as fe,w as _e,x as ge}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{b as oe,c as re,e as le,f as ae,k as pe,l as me,o as se,v as ce,y as ue}from"./chunk-FMVCTBCQ.js";import"./chunk-ZGXJEG37.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{c as X,e as Y,f as Z,i as nt,k as ee,l as te,m as ie}from"./chunk-B63BKC6F.js";import{Ab as L,Ac as F,Cb as g,Ga as R,Jc as w,Kb as s,Kc as j,Lc as V,Mc as b,Nb as W,Ub as l,Vb as o,Wb as C,X as B,Yc as I,Z as H,_b as E,c as J,cb as U,dc as T,ec as _,gb as a,ha as v,pa as h,qa as S,qc as m,rc as x,s as G,sc as k,ta as it,uc as K,vc as q,wb as A,wc as M,xc as $,yc as Q,zc as P}from"./chunk-JP6RBSB3.js";import{a as c,b as u}from"./chunk-YQFG5XE2.js";var Ct={data:{data:[],totalCount:0},meta:{options:{outlets:[],paymentStates:[],deliveryStates:[]},filter:{number:null,outletName:null,paymentState:0,deliveryState:0,from:null,to:null,customerID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},filter:{number:null,outletName:null,paymentState:0,deliveryState:0,from:null,to:null,customerID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},Qe=Ce(ye(Ct),xe(t=>({first:I(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:I(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:I(()=>t.data().data.some(p=>p.checked)),checkedInvoice:I(()=>t.data().data.filter(p=>p.checked).map(p=>p.id))})),ve(t=>{let p=v(D),e=v(N);return{updateFilter(n){y(t,i=>u(c({},i),{filter:c(c({},i.filter),n),skipRequestFirst:!1}))},onRowSelect(n){y(t,i=>{let f=i.data.data.map(d=>d.id===n.id?u(c({},d),{checked:!0}):d);return u(c({},i),{data:u(c({},i.data),{data:f})})})},onRowUnselect(n){y(t,i=>{let f=i.data.data.map(d=>d.id===n.id?u(c({},d),{checked:!1}):d);return u(c({},i),{data:u(c({},i.data),{data:f})})})},onHeaderCheckboxToggle(n){y(t,i=>{let f=i.data.data.map(d=>u(c({},d),{checked:n}));return u(c({},i),{data:u(c({},i.data),{data:f})})})},getCustomerInvoice:z(J(G(n=>Object.entries(n).reduce((i,[f,d])=>(d!=null&&(i[f]=d),i),{})),B(n=>p.getJournalInvoice(n).pipe(G(i=>u(c({},i),{data:i.data.map(f=>u(c({},f),{due:e.from(f.due)?e.from(f.due).format():null,checked:!1}))})),Me("getCustomerInvoice"),O({next:i=>{y(t,f=>u(c({},f),{data:u(c({},f.data),{data:i.data,totalCount:i.totalCount})}))},error:i=>{console.error("Error fetching customer invoice:",i)}}))))),getCustomerInvoiceLoader:z(J(B(()=>p.getJournalInvoiceLoader().pipe(O({next:n=>{y(t,i=>u(c({},i),{meta:n}))},error:n=>{console.error("Error fetching customer invoice loader:",n)}})))))}}),be(t=>({onInit:()=>{t.getCustomerInvoiceLoader(),t.getCustomerInvoice(t.filter)}})));var vt=()=>({height:"calc(100vh - 70px)"}),Xe=t=>({"ng-invalid ng-dirty":t}),yt=()=>({});function wt(t,p){if(t&1){let e=E();l(0,"p-button",10),T("onClick",function(){h(e);let n=_(2);return S(n.onGenerateJournal())}),o()}}function It(t,p){if(t&1&&g(0,wt,1,0,"p-button",9),t&2){let e=_();s("ngIf",e.store.hasCheckedRows())}}function Et(t,p){t&1&&(l(0,"tr")(1,"th",12),C(2,"p-tableHeaderCheckbox"),o(),l(3,"th",13),m(4,"Outlet"),o(),l(5,"th",14),m(6,"Number"),o(),l(7,"th",15),m(8,"Customer"),o(),l(9,"th",16),m(10,"Date"),o(),l(11,"th",16),m(12,"Due"),o(),l(13,"th",13),m(14,"Amount"),o(),l(15,"th",17),m(16,"Payment"),o(),l(17,"th",17),m(18,"Delivery"),o(),C(19,"th",12),o())}function Tt(t,p){if(t&1&&(l(0,"tr")(1,"td"),C(2,"p-tableCheckbox",18),o(),l(3,"td"),m(4),o(),l(5,"td")(6,"a",19),m(7),o()(),l(8,"td")(9,"a",19),m(10),o()(),l(11,"td"),m(12),w(13,"date"),o(),l(14,"td"),m(15),w(16,"date"),o(),l(17,"td"),m(18),w(19,"number"),o(),l(20,"td"),C(21,"p-chip",20),o(),l(22,"td"),C(23,"p-chip",20),o(),l(24,"td"),C(25,"p-button",21),o()()),t&2){let e=p.$implicit,r=_(2);a(2),s("value",e),a(2),x(e.outlet),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Orders/Orders/Customer_Invoice/Info?ID="+e.id,U),a(),k(" ",e.number," "),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.customerID,U),a(),k(" ",e.customer," "),a(2),x(V(13,14,e.date,"d MMM y hh:mm")),a(3),x(e.due?V(16,17,e.due,"d MMM y hh:mm"):"-"),a(3),x(j(19,20,e.amount)),a(3),s("label",e.payment),a(2),s("label",e.delivery),a(2),s("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function Ft(t,p){if(t&1&&m(0),t&2){let e=_(2);K(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Vt(t,p){t&1&&(l(0,"tr")(1,"td",22)(2,"span"),m(3,"No records found."),o()()())}function Dt(t,p){if(t&1){let e=E();l(0,"p-panel")(1,"p-table",11),T("onPage",function(n){h(e);let i=_();return S(i.onPageChange(n))})("onRowSelect",function(n){h(e);let i=_();return S(i.onRowSelect(n))})("onRowUnselect",function(n){h(e);let i=_();return S(i.onRowUnselect(n))})("onHeaderCheckboxToggle",function(n){h(e);let i=_();return S(i.onHeaderCheckboxToggle(n))}),g(2,Et,20,0,"ng-template",null,3,b)(4,Tt,26,22,"ng-template",null,4,b)(6,Ft,1,3,"ng-template",null,5,b)(8,Vt,4,0,"ng-template",null,6,b),o()()}if(t&2){let e=_();W(P(9,vt)),a(),s("scrollable",!0)("scrollHeight","calc(100vh - 142px)")("lazy",!0)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("value",e.store.data().data)}}function Rt(t,p){if(t&1&&(l(0,"span",34),m(1),w(2,"truncate"),o()),t&2){let e=p.$implicit;s("pTooltip",e.name),a(),k(" ",V(2,2,e.name,30)," ")}}function kt(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Nt(t,p){if(t&1&&(l(0,"div"),g(1,kt,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("from"))}}function Jt(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Bt(t,p){if(t&1&&(l(0,"div"),g(1,Jt,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("to"))}}function Mt(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Pt(t,p){if(t&1&&(l(0,"div"),g(1,Mt,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("pageSize"))}}function jt(t,p){if(t&1){let e=E();l(0,"form",23)(1,"div",24)(2,"label",25),m(3,"Outlet"),o(),l(4,"p-select",26),g(5,Rt,3,5,"ng-template",null,7,b),o()(),l(7,"div",24)(8,"label",25),m(9,"Payment"),o(),C(10,"p-select",27),o(),l(11,"div",24)(12,"label",25),m(13,"Delivery"),o(),C(14,"p-select",28),o(),l(15,"div",24)(16,"label",25),m(17,"From"),o(),C(18,"p-datepicker",29),g(19,Nt,2,1,"div",30),o(),l(20,"div",24)(21,"label",25),m(22,"To"),o(),C(23,"p-datepicker",31),g(24,Bt,2,1,"div",30),o(),l(25,"div",24)(26,"label",25),m(27,"Customer"),o(),l(28,"p-autocomplete",32),T("completeMethod",function(n){h(e);let i=_();return S(i.onSearchContact(n))}),o()(),l(29,"div",24)(30,"label",25),m(31,"Page Size"),o(),C(32,"input",33),g(33,Pt,2,1,"div",30),o()()}if(t&2){let e=_();s("formGroup",e.form),a(4),s("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),a(6),s("options",e.store.meta().options.paymentStates),a(4),s("options",e.store.meta().options.deliveryStates),a(4),s("iconDisplay","input")("showIcon",!0)("ngClass",F(17,Xe,e.isInvalid("from"))),a(),s("ngIf",e.isInvalid("from")),a(4),s("iconDisplay","input")("showIcon",!0)("ngClass",F(19,Xe,e.isInvalid("to"))),a(),s("ngIf",e.isInvalid("to")),a(4),s("suggestions",e.customerSuggestions()),a(4),s("ngClass",F(21,Xe,e.isInvalid("pageSize")))("autoNumeric",P(23,yt)),a(),s("ngIf",e.isInvalid("pageSize"))}}var gt=(()=>{class t extends je{constructor(){super(...arguments),this.store=v(Qe),this.dayjsService=v(N),this.generateJournalService=v(D),this.authService=v(ne),this.isDialogFilterVisible=R(!1),this.isInitDialogFilterVisible=R(!1),this.customerSuggestions=R([]),this.fb=v(ce)}ngOnInit(){console.log(this.dayjsService.from('0001-01-01T00:00:00"')&&!0),this.generateFilterForm()}generateFilterForm(){let{number:e,outletName:r,paymentState:n,deliveryState:i,from:f,to:d,customerID:Oe,pageNumber:Ge,rowCount:He,pageSize:Ue,export:Ke,exportPageNumber:qe,exportRowCount:$e}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),outletName:this.fb.control(r),paymentState:this.fb.control(n),deliveryState:this.fb.control(i),from:this.fb.control(this.dayjsService.from(f)?this.dayjsService.from(f).toDate():null),to:this.fb.control(this.dayjsService.from(d)?this.dayjsService.from(d).toDate():null),customerID:this.fb.control(Oe),pageNumber:this.fb.control(Ge),rowCount:this.fb.control(He),pageSize:this.fb.control(Ue,[re.required]),export:this.fb.control(Ke),exportPageNumber:this.fb.control(qe),exportRowCount:this.fb.control($e)})}onSearchContact(e){let{query:r}=e;this.generateJournalService.getCustomerSuggestions(r).pipe(Me("Customer Suggestions"),H(n=>{this.customerSuggestions.set(n)})).subscribe()}onSearch(e){this.store.updateFilter(u(c({},this.store.filter()),{number:e}))}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(r=>{this.store.onRowUnselect(r)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onPageChange(e){let r=e.first/e.rows;this.store.updateFilter(u(c({},this.store.filter()),{pageNumber:r+1}))}onGenerateJournal(){this.generateJournalService.generateJournalInvoice(this.store.checkedInvoice()).pipe(H(()=>{this.store.getCustomerInvoice(this.store.filter)})).subscribe()}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((r,[n,i])=>{switch(n){case"customerID":i||(r[n]=rt);break;case"from":typeof i=="object"?r[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:r[n]=i!=null?String(i):null;break;case"to":typeof i=="object"?r[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:r[n]=i!=null?String(i):null;break;default:r[n]=i===null?"":i;break}return r},{});console.log("Filter Body:",e),this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}static{this.\u0275fac=(()=>{let e;return function(n){return(e||(e=it(t)))(n||t)}})()}static{this.\u0275cmp=A({type:t,selectors:[["app-customer-invoice"]],features:[Q([Qe]),L],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Customer Invoice",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","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","scrollable","scrollHeight","lazy","paginator","rows","totalRecords","value"],[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,"label"],[3,"icon","severity","text"],["colspan","10"],[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","paymentState","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select a Payment",3,"options"],["showClear","","formControlName","deliveryState","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select a Delivery",3,"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,"ngClass","autoNumeric"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(r,n){if(r&1){let i=E();l(0,"app-main-panel",8),$("isDialogFilterVisibleChange",function(d){return h(i),M(n.isDialogFilterVisible,d)||(n.isDialogFilterVisible=d),S(d)})("isInitDialogFilterVisibleChange",function(d){return h(i),M(n.isInitDialogFilterVisible,d)||(n.isInitDialogFilterVisible=d),S(d)}),T("filterConfirmed",function(){return h(i),S(n.onFilterOKEvent())})("search",function(d){return h(i),S(n.onSearch(d))}),g(1,It,1,1,"ng-template",null,0,b)(3,Dt,10,10,"ng-template",null,1,b)(5,jt,34,24,"ng-template",null,2,b),o()}r&2&&(s("isSearchableInput",!0)("isFilterable",!0),q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[Te,Be,ke,Ne,Je,ie,X,Y,Z,te,ee,Pe,Ae,Se,he,ge,_e,Re,De,Ve,Fe,fe,de,We,Le,ue,pe,oe,le,ae,me,se,Ie,we,Ee,ze],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var zt={data:{data:[],totalCount:0},meta:{options:{Outlets:[],PaymentStates:[],DeliveryStates:[]},filter:{number:null,outletName:null,paymentState:0,deliveryState:0,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},filter:{number:null,outletName:null,paymentState:0,deliveryState:0,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4},skipRequestFirst:!0},Ye=Ce(ot("JournalSupplierBillStore"),ye(zt),xe(t=>({first:I(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:I(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:I(()=>t.data().data.some(p=>p.checked)),checkedSupplierBill:I(()=>t.data().data.filter(p=>p.checked).map(p=>p.id))})),ve(t=>{let p=v(D),e=v(N);return{updateFilter(r){y(t,n=>u(c({},n),{filter:c(c({},n.filter),r),skipRequestFirst:!1}))},onRowSelect(r){y(t,n=>{let i=n.data.data.map(f=>f.id===r.id?u(c({},f),{checked:!0}):f);return u(c({},n),{data:u(c({},n.data),{data:i})})})},onRowUnselect(r){y(t,n=>{let i=n.data.data.map(f=>f.id===r.id?u(c({},f),{checked:!1}):f);return u(c({},n),{data:u(c({},n.data),{data:i})})})},onHeaderCheckboxToggle(r){y(t,n=>{let i=n.data.data.map(f=>u(c({},f),{checked:r}));return u(c({},n),{data:u(c({},n.data),{data:i})})})},getGJSupplierBillLoader:z(J(B(()=>p.getGJSupplierBillLoader().pipe(O({next:r=>{console.log("GJSupplierBillLoader response:",r),y(t,n=>u(c({},n),{meta:r}))},error:r=>{console.error("Error fetching GJSupplierBillLoader:",r)}}))))),getJournalSupplierBill:z(J(G(r=>Object.entries(r).reduce((n,[i,f])=>(f!=null&&(n[i]=f),n),{})),B(r=>p.getJournalSupplierBill(r).pipe(G(n=>u(c({},n),{data:n.data.map(i=>u(c({},i),{due:e.from(i.due)?e.from(i.due).format():null,checked:!1}))})),O({next:n=>{y(t,i=>u(c({},i),{data:n}))},error:n=>{console.error("Error fetching journal supplier bill:",n)}})))))}}),be(t=>({onInit:()=>{t.getGJSupplierBillLoader(),t.getJournalSupplierBill(t.filter)}})));var Ot=()=>({height:"calc(100vh - 70px)"}),Ze=t=>({"ng-invalid ng-dirty":t}),Gt=()=>({});function Ht(t,p){if(t&1){let e=E();l(0,"p-button",10),T("onClick",function(){h(e);let n=_(2);return S(n.onGenerateJournal())}),o()}}function Ut(t,p){if(t&1&&g(0,Ht,1,0,"p-button",9),t&2){let e=_();s("ngIf",e.store.hasCheckedRows())}}function At(t,p){t&1&&(l(0,"tr")(1,"th",12),C(2,"p-tableHeaderCheckbox"),o(),l(3,"th",13),m(4,"Outlet"),o(),l(5,"th",14),m(6,"Number"),o(),l(7,"th",15),m(8,"Supplier"),o(),l(9,"th",16),m(10,"Date"),o(),l(11,"th",16),m(12,"Due"),o(),l(13,"th",13),m(14,"Amount"),o(),l(15,"th",17),m(16,"Payment"),o(),l(17,"th",17),m(18,"Delivery"),o(),C(19,"th",12),o())}function Lt(t,p){if(t&1&&(l(0,"tr")(1,"td"),C(2,"p-tableCheckbox",18),o(),l(3,"td"),m(4),o(),l(5,"td")(6,"a",19),m(7),o()(),l(8,"td"),m(9),o(),l(10,"td"),m(11),w(12,"date"),o(),l(13,"td"),m(14),w(15,"date"),o(),l(16,"td"),m(17),w(18,"number"),o(),l(19,"td"),C(20,"p-chip",20),o(),l(21,"td"),C(22,"p-chip",20),o(),l(23,"td"),C(24,"p-button",21),o()()),t&2){let e=p.$implicit,r=_(2);a(2),s("value",e),a(2),x(e.outlet),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Orders/Orders/Supplier_Bill/Info?ID="+e.id,U),a(),k(" ",e.number," "),a(2),x(e.customer),a(2),x(V(12,13,e.date,"d MMM y hh:mm")),a(3),x(e.due?V(15,16,e.due,"d MMM y hh:mm"):"-"),a(3),x(j(18,19,e.amount)),a(3),s("label",e.payment),a(2),s("label",e.delivery),a(2),s("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function Wt(t,p){if(t&1&&m(0),t&2){let e=_(2);K(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Kt(t,p){t&1&&(l(0,"tr")(1,"td",22)(2,"span"),m(3,"No records found."),o()()())}function qt(t,p){if(t&1){let e=E();l(0,"p-panel")(1,"p-table",11),T("onPage",function(n){h(e);let i=_();return S(i.onPageChange(n))})("onRowSelect",function(n){h(e);let i=_();return S(i.onRowSelect(n))})("onRowUnselect",function(n){h(e);let i=_();return S(i.onRowUnselect(n))})("onHeaderCheckboxToggle",function(n){h(e);let i=_();return S(i.onHeaderCheckboxToggle(n))}),g(2,At,20,0,"ng-template",null,3,b)(4,Lt,25,21,"ng-template",null,4,b)(6,Wt,1,3,"ng-template",null,5,b)(8,Kt,4,0,"ng-template",null,6,b),o()()}if(t&2){let e=_();W(P(9,Ot)),a(),s("scrollHeight","calc(100vh - 142px)")("value",e.store.data().data)("scrollable",!0)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function $t(t,p){if(t&1&&(l(0,"span",34),m(1),w(2,"truncate"),o()),t&2){let e=p.$implicit;s("pTooltip",e.name),a(),k(" ",V(2,2,e.name,30)," ")}}function Qt(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Xt(t,p){if(t&1&&(l(0,"div"),g(1,Qt,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("from"))}}function Yt(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Zt(t,p){if(t&1&&(l(0,"div"),g(1,Yt,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("to"))}}function ei(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function ti(t,p){if(t&1&&(l(0,"div"),g(1,ei,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("pageSize"))}}function ii(t,p){if(t&1){let e=E();l(0,"form",23)(1,"div",24)(2,"label",25),m(3,"Outlet"),o(),l(4,"p-select",26),g(5,$t,3,5,"ng-template",null,7,b),o()(),l(7,"div",24)(8,"label",25),m(9,"Payment"),o(),C(10,"p-select",27),o(),l(11,"div",24)(12,"label",25),m(13,"Delivery"),o(),C(14,"p-select",28),o(),l(15,"div",24)(16,"label",25),m(17,"From"),o(),C(18,"p-datepicker",29),g(19,Xt,2,1,"div",30),o(),l(20,"div",24)(21,"label",25),m(22,"To"),o(),C(23,"p-datepicker",31),g(24,Zt,2,1,"div",30),o(),l(25,"div",24)(26,"label",25),m(27,"Supplier"),o(),l(28,"p-autocomplete",32),w(29,"async"),T("completeMethod",function(n){h(e);let i=_();return S(i.onSearchSupplier(n))}),o()(),l(30,"div",24)(31,"label",25),m(32,"Page Size"),o(),C(33,"input",33),g(34,ti,2,1,"div",30),o()()}if(t&2){let e=_();s("formGroup",e.form),a(4),s("virtualScrollItemSize",50)("options",e.store.meta().options.Outlets),a(6),s("options",e.store.meta().options.PaymentStates),a(4),s("options",e.store.meta().options.DeliveryStates),a(4),s("iconDisplay","input")("showIcon",!0)("ngClass",F(19,Ze,e.isInvalid("from"))),a(),s("ngIf",e.isInvalid("from")),a(4),s("iconDisplay","input")("showIcon",!0)("ngClass",F(21,Ze,e.isInvalid("to"))),a(),s("ngIf",e.isInvalid("to")),a(4),s("suggestions",j(29,17,e.supplierSuggestions$)),a(5),s("autoNumeric",P(23,Gt))("ngClass",F(24,Ze,e.isInvalid("pageSize"))),a(),s("ngIf",e.isInvalid("pageSize"))}}var ht=(()=>{class t extends je{constructor(){super(),this.generateJournalService=v(D),this.store=v(Ye),this.authService=v(ne),this.isDialogFilterVisible=R(!1),this.isInitDialogFilterVisible=R(!1),this.fb=v(ce),this.dayjsService=v(N)}ngOnInit(){this.initform()}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((r,[n,i])=>(i!=null&&(n==="from"||n==="to"?(typeof i=="string"||typeof i=="number"||i instanceof Date)&&(r[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null):r[n]=i),r),{});this.store.updateFilter(e),this.isDialogFilterVisible.update(r=>!r)}onRowSelect(e){this.store.onRowSelect(e.data)}onSearchSupplier(e){this.supplierSuggestions$=this.generateJournalService.getSupplierSuggestions(e.query).pipe(Me("Supplier Suggestions"))}initform(){let{outletName:e,number:r,from:n,to:i,paymentState:f,deliveryState:d,supplierID:Oe,pageNumber:Ge,rowCount:He,pageSize:Ue,export:Ke,exportPageNumber:qe,exportRowCount:$e}=this.store.filter();this.form=this.fb.group({outletName:this.fb.control(e),number:this.fb.control(r),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),paymentState:this.fb.control(f),deliveryState:this.fb.control(d),supplierID:this.fb.control(Oe),pageNumber:this.fb.control(Ge),rowCount:this.fb.control(He),pageSize:this.fb.control(Ue,[re.required]),export:this.fb.control(Ke),exportPageNumber:this.fb.control(qe),exportRowCount:this.fb.control($e)})}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(r=>{this.store.onRowUnselect(r)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onGenerateJournal(){this.generateJournalService.generateJournalSupplierBill(this.store.checkedSupplierBill()).pipe(H(()=>{this.store.getJournalSupplierBill(this.store.filter)})).subscribe()}onSearch(e){this.store.updateFilter(u(c({},this.store.filter()),{number:e}))}onPageChange(e){this.store.updateFilter(u(c({},this.store.filter()),{pageNumber:e.first/e.rows+1}))}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=A({type:t,selectors:[["app-journal-supplier-bill"]],features:[Q([Ye]),L],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Supplier Bill",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","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","scrollHeight","value","scrollable","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,"label"],[3,"icon","severity","text"],["colspan","10"],[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","paymentState","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select a Payment",3,"options"],["showClear","","formControlName","deliveryState","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select a Delivery",3,"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","supplierID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(r,n){if(r&1){let i=E();l(0,"app-main-panel",8),$("isDialogFilterVisibleChange",function(d){return h(i),M(n.isDialogFilterVisible,d)||(n.isDialogFilterVisible=d),S(d)})("isInitDialogFilterVisibleChange",function(d){return h(i),M(n.isInitDialogFilterVisible,d)||(n.isInitDialogFilterVisible=d),S(d)}),T("filterConfirmed",function(){return h(i),S(n.onFilterOKEvent())})("search",function(d){return h(i),S(n.onSearch(d))}),g(1,Ut,1,1,"ng-template",null,0,b)(3,qt,10,10,"ng-template",null,1,b)(5,ii,35,26,"ng-template",null,2,b),o()}r&2&&(s("isSearchableInput",!0)("isFilterable",!0),q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[Te,Be,ke,Ne,Je,ie,X,Y,Z,nt,te,ee,Pe,Ae,Se,he,ge,_e,Re,De,Ve,Fe,We,Le,ue,pe,oe,le,ae,me,se,fe,de,Ee,Ie,we,ze],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var ni={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},filter:{number:null,outletName:null,from:null,to:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},et=Ce(ye(ni),xe(t=>({first:I(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:I(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:I(()=>t.data().data.some(p=>p.checked)),checkedShift:I(()=>t.data().data.filter(p=>p.checked).map(p=>p.id))})),ve(t=>{let p=v(D);return{updateFilter(e){y(t,r=>u(c({},r),{filter:c(c({},r.filter),e)}))},onRowSelect(e){y(t,r=>{let n=r.data.data.map(i=>i.id===e.id?u(c({},i),{checked:!0}):i);return u(c({},r),{data:u(c({},r.data),{data:n})})})},onRowUnselect(e){y(t,r=>{let n=r.data.data.map(i=>i.id===e.id?u(c({},i),{checked:!1}):i);return u(c({},r),{data:u(c({},r.data),{data:n})})})},onHeaderCheckboxToggle(e){y(t,r=>{let n=r.data.data.map(i=>u(c({},i),{checked:e}));return u(c({},r),{data:u(c({},r.data),{data:n})})})},getGJShiftLoader:z(J(B(()=>p.getGJShiftLoader().pipe(O(e=>y(t,r=>u(c({},r),{meta:e})),e=>console.error("Error fetching GJ Shift Loader:",e)))))),getJournalShift:z(J(G(e=>Object.entries(e).reduce((r,[n,i])=>(i!=null&&(r[n]=i),r),{})),B(e=>p.getJournalShift(e).pipe(O(r=>y(t,n=>u(c({},n),{data:r})),r=>console.error("Error fetching journal shift:",r))))))}}),be(t=>({onInit:()=>{t.getGJShiftLoader(),t.getJournalShift(t.filter)}})));var oi=()=>({height:"calc(100vh - 70px)"}),tt=t=>({"ng-invalid ng-dirty":t}),ri=()=>({});function li(t,p){if(t&1){let e=E();l(0,"p-button",10),T("onClick",function(){h(e);let n=_(2);return S(n.onGenerateJournal())}),o()}}function ai(t,p){if(t&1&&g(0,li,1,0,"p-button",9),t&2){let e=_();s("ngIf",e.store.hasCheckedRows())}}function pi(t,p){t&1&&(l(0,"tr")(1,"th",12),C(2,"p-tableHeaderCheckbox"),o(),l(3,"th",13),m(4,"Number"),o(),l(5,"th",14),m(6,"Open"),o(),l(7,"th",14),m(8,"Close"),o(),l(9,"th",15),m(10,"Cashier"),o(),l(11,"th",16),m(12,"Sales + Tax"),o(),l(13,"th",17),m(14,"Invoices"),o(),l(15,"th",16),m(16,"Outlet"),o(),l(17,"th",17),m(18,"Register"),o(),l(19,"th",17),m(20,"Visitors"),o(),C(21,"th",12),o())}function mi(t,p){if(t&1&&(l(0,"tr")(1,"td"),C(2,"p-tableCheckbox",18),o(),l(3,"td")(4,"a",19),m(5),o()(),l(6,"td"),m(7),w(8,"date"),o(),l(9,"td"),m(10),w(11,"date"),o(),l(12,"td"),m(13),o(),l(14,"td"),m(15),w(16,"number"),o(),l(17,"td"),m(18),w(19,"number"),o(),l(20,"td"),m(21),o(),l(22,"td"),m(23),o(),l(24,"td"),m(25),w(26,"number"),o(),l(27,"td"),C(28,"p-button",20),o()()),t&2){let e=p.$implicit,r=_(2);a(2),s("value",e),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Shift/Main/Previous_Shift/Register_Shift_Detail?ID="+e.id,U),a(),k(" ",e.number," "),a(2),x(V(8,14,e.open,"dd MMM y hh:mm")),a(3),x(V(11,17,e.close,"dd MMM y hh:mm")),a(3),x(e.cashier),a(2),x(j(16,20,e.salesNTax)),a(3),x(j(19,22,e.totalInvoice)),a(3),x(e.outlet),a(2),x(e.register),a(2),x(j(26,24,e.visitors)),a(3),s("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function si(t,p){if(t&1&&m(0),t&2){let e=_(2);K(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function ci(t,p){t&1&&(l(0,"tr")(1,"td",21)(2,"span"),m(3,"No records found."),o()()())}function ui(t,p){if(t&1){let e=E();l(0,"p-panel")(1,"p-table",11),T("onPage",function(n){h(e);let i=_();return S(i.onPageChange(n))})("onRowSelect",function(n){h(e);let i=_();return S(i.onRowSelect(n))})("onRowUnselect",function(n){h(e);let i=_();return S(i.onRowUnselect(n))})("onHeaderCheckboxToggle",function(n){h(e);let i=_();return S(i.onHeaderCheckboxToggle(n))}),g(2,pi,22,0,"ng-template",null,3,b)(4,mi,29,26,"ng-template",null,4,b)(6,si,1,3,"ng-template",null,5,b)(8,ci,4,0,"ng-template",null,6,b),o()()}if(t&2){let e=_();W(P(9,oi)),a(),s("scrollHeight","calc(100vh - 142px)")("scrollable",!0)("paginator",!0)("lazy",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("value",e.store.data().data)}}function di(t,p){if(t&1&&(l(0,"span",30),m(1),w(2,"truncate"),o()),t&2){let e=p.$implicit;s("pTooltip",e.name),a(),k(" ",V(2,2,e.name,30)," ")}}function fi(t,p){if(t&1&&(l(0,"div")(1,"span",32),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function _i(t,p){if(t&1&&(l(0,"div"),g(1,fi,3,1,"div",31),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("from"))}}function gi(t,p){if(t&1&&(l(0,"div")(1,"span",32),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function hi(t,p){if(t&1&&(l(0,"div"),g(1,gi,3,1,"div",31),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("to"))}}function Si(t,p){if(t&1&&(l(0,"div")(1,"span",32),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Ci(t,p){if(t&1&&(l(0,"div"),g(1,Si,3,1,"div",31),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("pageSize"))}}function xi(t,p){if(t&1&&(l(0,"form",22)(1,"div",23)(2,"label",24),m(3,"Outlet"),o(),l(4,"p-select",25),g(5,di,3,5,"ng-template",null,7,b),o()(),l(7,"div",23)(8,"label",24),m(9,"From"),o(),C(10,"p-datepicker",26),g(11,_i,2,1,"div",27),o(),l(12,"div",23)(13,"label",24),m(14,"To"),o(),C(15,"p-datepicker",28),g(16,hi,2,1,"div",27),o(),l(17,"div",23)(18,"label",24),m(19,"Page Size"),o(),C(20,"input",29),g(21,Ci,2,1,"div",27),o()()),t&2){let e=_();s("formGroup",e.form),a(4),s("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),a(6),s("iconDisplay","input")("showIcon",!0)("ngClass",F(14,tt,e.isInvalid("from"))),a(),s("ngIf",e.isInvalid("from")),a(4),s("iconDisplay","input")("showIcon",!0)("ngClass",F(16,tt,e.isInvalid("to"))),a(),s("ngIf",e.isInvalid("to")),a(4),s("autoNumeric",P(18,ri))("ngClass",F(19,tt,e.isInvalid("pageSize"))),a(),s("ngIf",e.isInvalid("pageSize"))}}var St=(()=>{class t extends je{constructor(){super(),this.generateJournalService=v(D),this.store=v(et),this.authService=v(ne),this.isDialogFilterVisible=R(!1),this.isInitDialogFilterVisible=R(!1),this.fb=v(ce),this.dayjsService=v(N)}ngOnInit(){this.initForm()}initForm(){let{number:e,outletName:r,from:n,to:i,pageNumber:f,rowCount:d,pageSize:Oe,export:Ge,exportPageNumber:He,exportRowCount:Ue}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),outletName:this.fb.control(r),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(f),rowCount:this.fb.control(d),pageSize:this.fb.control(Oe,[re.required]),export:this.fb.control(Ge),exportPageNumber:this.fb.control(He),exportRowCount:this.fb.control(Ue)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((r,[n,i])=>{switch(n){case"from":typeof i=="object"?r[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:r[n]=i!=null?String(i):null;break;case"to":typeof i=="object"?r[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:r[n]=i!=null?String(i):null;break;default:r[n]=i===null?"":i;break}return r},{});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(r=>{this.store.onRowUnselect(r)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onGenerateJournal(){this.generateJournalService.generateJournalSupplierBill(this.store.checkedShift()).pipe(H(()=>{this.store.getJournalShift(this.store.filter)})).subscribe()}onSearch(e){this.store.updateFilter(u(c({},this.store.filter()),{number:e}))}onPageChange(e){let r=e.first/e.rows;this.store.updateFilter(u(c({},this.store.filter()),{pageNumber:r+1}))}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=A({type:t,selectors:[["app-journal-shift"]],features:[Q([et]),L],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Shift Journal",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","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","scrollHeight","scrollable","paginator","lazy","rows","totalRecords","value"],[2,"width","4rem"],[2,"width","12rem"],[2,"width","11rem"],[2,"width","14rem"],[2,"width","10rem"],[2,"width","9rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"icon","severity","text"],["colspan","11"],[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(r,n){if(r&1){let i=E();l(0,"app-main-panel",8),$("isDialogFilterVisibleChange",function(d){return h(i),M(n.isDialogFilterVisible,d)||(n.isDialogFilterVisible=d),S(d)})("isInitDialogFilterVisibleChange",function(d){return h(i),M(n.isInitDialogFilterVisible,d)||(n.isInitDialogFilterVisible=d),S(d)}),T("filterConfirmed",function(){return h(i),S(n.onFilterOKEvent())})("search",function(d){return h(i),S(n.onSearch(d))}),g(1,ai,1,1,"ng-template",null,0,b)(3,ui,10,10,"ng-template",null,1,b)(5,xi,22,21,"ng-template",null,2,b),o()}r&2&&(s("isSearchableInput",!0)("isFilterable",!0),q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[Te,Be,ke,Ne,Je,ie,X,Y,Z,te,ee,Pe,Se,he,ge,_e,ue,pe,oe,le,ae,me,se,Re,De,Ve,Fe,Ee,Ie,we,fe,de,ze],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var yo=[{path:"invoice",component:gt},{path:"supplier-bill",component:ht},{path:"shift",component:St},{path:"join-invoice",loadComponent:()=>import("./chunk-CJ6UGNBN.js").then(t=>t.ARJournalComponent)},{path:"join-bill",loadComponent:()=>import("./chunk-B4HCPA6E.js").then(t=>t.ApJournalComponent)},{path:"adjustment",loadComponent:()=>import("./chunk-QTALSVSB.js").then(t=>t.AdjustmentJournalComponent)}];export{yo as generateJournalRoutes};
@@ -1 +1 @@
1
- import{a as i}from"./chunk-VVHTNAHQ.js";import{a}from"./chunk-P3V7Z3A6.js";import{ba as o,ha as n}from"./chunk-JP6RBSB3.js";var h=(()=>{class e{constructor(){this.#t=n(a),this.authService=n(i)}#t;getJournalEntryLoader(){return this.#t.get("","api/JournalLoader/JournalEntry")}getJournalReceiveMoney(){return this.#t.get("","api/JournalLoader/ReceiveJournal")}getJournalRecordExpenseLoader(){return this.#t.get("","api/JournalLoader/RecordExpense")}getJournalEntryData(t,r={}){return this.#t.post("","api/Journal/JournalEntry",t,r)}getJournalEntryInfo(t){let r={ID:t};return this.#t.get("","/api/Journal/Info",{params:r})}getJournalEntryForm(t){return this.#t.get("",`api/journalloader/form/${t}`).pipe()}getJournalEntryCount(t){return this.#t.post("","api/Journal/JournalEntryCount",t)}getJournalEntryCustomerSuggestions(t){let r={Prefix:t,Count:100};return this.#t.get(this.authService.getTenantExternalURL(),"/API/AC/GetCustomerSuggestion",{params:r})}getJournalEntrySupplierSuggestions(t){let r={Prefix:t,Count:100};return this.#t.get(this.authService.getTenantExternalURL(),"/API/AC/GetSupplierSuggestion",{params:r})}submitJournalEntry(t){return this.#t.post(void 0,"api/journal/submit",t,{observe:"response"})}deleteJournalEntry(t){let r={params:{ID:t.join(",")}};return this.#t.delete(void 0,"/api/Journal/delete",r)}fetchCategoryOptions(){return this.#t.get("","api/ChartOfAccount/CategoryOptions")}submitChartAccount(t,r={}){return this.#t.post("","api/ChartOfAccount/Submit",t,r)}getImageFileName(t){return new URL(t).pathname.split("/").pop()||""}importPreviewJournal(t){return this.#t.post(void 0,"api/Journal/ImportPreview",t)}importConfirmJournal(t){return this.#t.post(void 0,"api/Journal/ImportConfirm",t)}static{this.\u0275fac=function(r){return new(r||e)}}static{this.\u0275prov=o({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();export{h as a};
1
+ import{a as i}from"./chunk-AGLKA7OG.js";import{a}from"./chunk-ZGXJEG37.js";import{ba as o,ha as n}from"./chunk-JP6RBSB3.js";var h=(()=>{class e{constructor(){this.#t=n(a),this.authService=n(i)}#t;getJournalEntryLoader(){return this.#t.get("","api/JournalLoader/JournalEntry")}getJournalReceiveMoney(){return this.#t.get("","api/JournalLoader/ReceiveJournal")}getJournalRecordExpenseLoader(){return this.#t.get("","api/JournalLoader/RecordExpense")}getJournalEntryData(t,r={}){return this.#t.post("","api/Journal/JournalEntry",t,r)}getJournalEntryInfo(t){let r={ID:t};return this.#t.get("","/api/Journal/Info",{params:r})}getJournalEntryForm(t){return this.#t.get("",`api/journalloader/form/${t}`).pipe()}getJournalEntryCount(t){return this.#t.post("","api/Journal/JournalEntryCount",t)}getJournalEntryCustomerSuggestions(t){let r={Prefix:t,Count:100};return this.#t.get(this.authService.getTenantExternalURL(),"/API/AC/GetCustomerSuggestion",{params:r})}getJournalEntrySupplierSuggestions(t){let r={Prefix:t,Count:100};return this.#t.get(this.authService.getTenantExternalURL(),"/API/AC/GetSupplierSuggestion",{params:r})}submitJournalEntry(t){return this.#t.post(void 0,"api/journal/submit",t,{observe:"response"})}deleteJournalEntry(t){let r={params:{ID:t.join(",")}};return this.#t.delete(void 0,"/api/Journal/delete",r)}fetchCategoryOptions(){return this.#t.get("","api/ChartOfAccount/CategoryOptions")}submitChartAccount(t,r={}){return this.#t.post("","api/ChartOfAccount/Submit",t,r)}getImageFileName(t){return new URL(t).pathname.split("/").pop()||""}importPreviewJournal(t){return this.#t.post(void 0,"api/Journal/ImportPreview",t)}importConfirmJournal(t){return this.#t.post(void 0,"api/Journal/ImportConfirm",t)}static{this.\u0275fac=function(r){return new(r||e)}}static{this.\u0275prov=o({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();export{h as a};