dealposbooks 5.32.0 → 5.32.1
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.
- package/{chunk-W4SAEISC.js → chunk-2FA22FEI.js} +1 -1
- package/{chunk-JPP5O2O5.js → chunk-4ZMRBRIS.js} +1 -1
- package/{chunk-WSZ5MU6V.js → chunk-5IH7TCZZ.js} +1 -1
- package/{chunk-XJEZJFWN.js → chunk-5Y5SFUMY.js} +1 -1
- package/{chunk-4ANXHXE3.js → chunk-6OJOOXYM.js} +1 -1
- package/{chunk-QSWSGP4B.js → chunk-A6AM5FZ4.js} +1 -1
- package/{chunk-XILGARZ5.js → chunk-BGWDOZQM.js} +1 -1
- package/{chunk-VYK2CQ72.js → chunk-EHUDHXDQ.js} +1 -1
- package/{chunk-HAZ77TED.js → chunk-EJHIGE6D.js} +1 -1
- package/{chunk-3WD3CTYC.js → chunk-FI3ZD46J.js} +1 -1
- package/{chunk-74MJ3NFN.js → chunk-FXAIEUA7.js} +1 -1
- package/{chunk-6OQPMZXU.js → chunk-HO2UBUXM.js} +1 -1
- package/chunk-HVAA6I4V.js +1 -0
- package/{chunk-7EZGTYA2.js → chunk-J5GPRN74.js} +1 -1
- package/{chunk-QLUQTLSH.js → chunk-JK7K55HA.js} +1 -1
- package/{chunk-RMRYZWCP.js → chunk-JLV66YQR.js} +1 -1
- package/{chunk-REXWFSN3.js → chunk-JRMUK54Y.js} +1 -1
- package/{chunk-A7EGGUJQ.js → chunk-KBHFQM5L.js} +1 -1
- package/{chunk-SEGRH6C4.js → chunk-M7MYXWUB.js} +1 -1
- package/{chunk-F5Z3IX4J.js → chunk-MVYMAQJE.js} +1 -1
- package/{chunk-UWNAF5OL.js → chunk-Q5XM4DLN.js} +1 -1
- package/{chunk-PV3NLUKC.js → chunk-RZKMT3UP.js} +1 -1
- package/{chunk-33YEAYJV.js → chunk-UILTGHYP.js} +1 -1
- package/{chunk-MFH4UZ6J.js → chunk-VZI3JZPU.js} +1 -1
- package/{chunk-RBTNUVT5.js → chunk-WIHAMVJN.js} +1 -1
- package/{chunk-BQXWTZHK.js → chunk-WMKKO7RI.js} +1 -1
- package/{chunk-OYHHWU2W.js → chunk-ZABJ7AB6.js} +1 -1
- package/index.html +2 -2
- package/{main-OTYR5DFR.js → main-CTDZ2YSE.js} +1 -1
- package/package.json +1 -1
- package/chunk-56GDP75Z.js +0 -1
|
@@ -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-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-BGWDOZQM.js";import"./chunk-VZI3JZPU.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-RZKMT3UP.js").then(t=>t.ARJournalComponent)},{path:"join-bill",loadComponent:()=>import("./chunk-UILTGHYP.js").then(t=>t.ApJournalComponent)},{path:"adjustment",loadComponent:()=>import("./chunk-4ZMRBRIS.js").then(t=>t.AdjustmentJournalComponent)}];export{yo as generateJournalRoutes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O,b as H}from"./chunk-
|
|
1
|
+
import{a as O,b as H}from"./chunk-EHUDHXDQ.js";import"./chunk-BGWDOZQM.js";import"./chunk-VZI3JZPU.js";import{a as I,b as E}from"./chunk-4LGDNQMZ.js";import"./chunk-5R3XKSDM.js";import{h as G}from"./chunk-UYC454VQ.js";import{b as D,c as N}from"./chunk-C7LM5UCK.js";import{a as j,b as R}from"./chunk-J4XRJAME.js";import"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{w as V,x as A}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import"./chunk-FMVCTBCQ.js";import"./chunk-P3V7Z3A6.js";import{a as F}from"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{i as W,m as $}from"./chunk-B63BKC6F.js";import{Cb as B,Jc as s,Kb as p,Kc as m,Mc as x,Nb as h,Ub as o,V as y,Vb as n,Wb as c,X as T,Z as S,_b as w,dc as _,ec as l,gb as a,h as v,ha as u,pa as g,qa as d,ra as b,s as f,sa as k,wb as M,yc as P,zc as C}from"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var L=()=>({height:"calc(100vh - 100px)"});function z(i,q){if(i&1){let e=w();o(0,"div",3)(1,"p-button",4),_("onClick",function(){g(e);let r=l();return d(r.onFormat())}),n(),o(2,"p-button",5),s(3,"async"),s(4,"async"),_("onClick",function(){g(e);let r=l();return d(r.migrateWriteoffOutlet())}),n()()}if(i&2){let e=l();a(2),p("disabled",m(3,2,e.countInBooks$)!==0)("pTooltip",m(4,4,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function J(i,q){if(i&1&&(o(0,"p-scroll-panel")(1,"p-panel")(2,"div",6),c(3,"app-migration-cards",7),s(4,"async"),b(),o(5,"svg",8),c(6,"path",9),n(),k(),c(7,"app-migration-cards",10),s(8,"async"),n()()()),i&2){let e=l();h(C(12,L)),a(),h(C(13,L)),a(2),p("migrationCount",m(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),a(4),p("migrationCount",m(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var fe=(()=>{class i{constructor(){this.migrateService=u(O),this.toastr=u(F),this.refresh$=new v(void 0),this.pageTitle="Write-Off Outlet"}ngOnInit(){let e=this.refresh$.pipe(T(()=>this.migrateService.getWriteOffOutletAccountCount()),S(t=>console.log("API response:",t)),y(1));this.countInPOS$=e.pipe(f(t=>Number(t.pos))),this.countInBooks$=e.pipe(f(t=>Number(t.books)))}migrateWriteoffOutlet(){this.migrateService.migrateWriteOffOutlet().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormat(){confirm("Are you sure you want to format?")&&this.migrateService.formatWriteOff().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Format Successful")})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=M({type:i,selectors:[["app-writeoff-outlet"]],features:[P([O])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger",3,"onClick"],["label","Migrate","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(t,r){t&1&&(o(0,"app-main-panel",2),B(1,z,5,6,"ng-template",null,0,x)(3,J,9,14,"ng-template",null,1,x),n()),t&2&&p("pageTitle",r.pageTitle)},dependencies:[G,$,W,E,I,R,j,N,D,H,A,V],encapsulation:2})}}return i})();export{fe as WriteOffOutletComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Ke,b as Qe,c as Xe,d as Ye,e as Ze,f as et}from"./chunk-EDCDR4RJ.js";import{a as ze,b as Ue,c as qe}from"./chunk-B7WHT2EP.js";import{a as We,b as He}from"./chunk-HHDFSN55.js";import{a as Le}from"./chunk-MDH73MG3.js";import{b as $e}from"./chunk-XILGARZ5.js";import"./chunk-MFH4UZ6J.js";import{a as Ve,b as je}from"./chunk-YO23YVSC.js";import"./chunk-AZUQDRJU.js";import{a as Pe,b as Oe,d as ke,k as Re}from"./chunk-EW3R2HAB.js";import{a as Ne,b as Me}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import{a as Je}from"./chunk-XKCLERWG.js";import{a as K,b as Q}from"./chunk-4LGDNQMZ.js";import"./chunk-PKN47FQE.js";import{a as Ge,b as Be}from"./chunk-LRRVQSMI.js";import"./chunk-42UIGXWH.js";import{a as De,b as we}from"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{b as X}from"./chunk-5R3XKSDM.js";import{h as M}from"./chunk-UYC454VQ.js";import"./chunk-C7LM5UCK.js";import{a as j,b as $}from"./chunk-J4XRJAME.js";import"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{n as H,o as N,w as J,x as V}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{Ia as Ie,Ma as Te,b as G,c as re,e as T,f as B,j as Ae,l as P,m as q,n as Ee,o as O,v as k,x as W,y as R}from"./chunk-FMVCTBCQ.js";import{a as Fe}from"./chunk-P3V7Z3A6.js";import{a as ye}from"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{D as he,G as xe,N as Se,c as _e,f as be,l as Ce,m as I}from"./chunk-B63BKC6F.js";import{Ac as ne,Cb as g,Ga as z,Jc as ie,Kb as p,Kc as oe,L as pe,Mc as f,Nb as U,Qb as y,Sb as F,Tb as A,Ub as i,Vb as n,Wb as c,Y as ce,Z as w,_b as h,ba as ue,dc as E,ec as s,g as le,gb as a,ha as u,mb as se,pa as b,qa as C,qc as o,rc as x,s as me,sc as te,vc as de,wb as S,wc as fe,xc as ge,yc as ve,zc as D}from"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var _=(()=>{class t{#e=u(Fe);fetchLoaderConfiguration(){return this.#e.get("","api/SetupLoader/Load")}updateAccountingIntegrationConfiguration(e){return this.#e.post(void 0,"/api/setup/SubmitConfig",e)}fetchOpeningBalanceFormConfiguration(){return this.#e.get("","/api/setup/OpeningBalance/Form")}submitOpeningBalanceFormConfiguration(e){return this.#e.post("","api/setup/OpeningBalance/Submit",e)}fetchAPICredential(){return this.#e.get(void 0,"/api/AccountConfig")}updateAPICredential(e){return this.#e.put(void 0,"/api/AccountConfig",e)}formatJournal(e){return this.#e.post("","/api/setup/formatdata/clearjournal",{domain:e})}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275prov=ue({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var ut=()=>({height:"calc(100vh - 100px)"});function st(t,m){if(t&1){let e=h();i(0,"div",4)(1,"a",5),o(2,"Cancel"),n(),i(3,"p-button",6),E("click",function(){b(e);let l=s();return C(l.updateAccountingIntegration())}),n()()}}function dt(t,m){if(t&1&&(i(0,"p-tab",8),o(1),n()),t&2){let e=m.$implicit,r=m.$index;p("value",r),a(),x(e)}}function ft(t,m){if(t&1&&(i(0,"div",25),c(1,"p-radiobutton",43),i(2,"label",44),o(3),n()()),t&2){let e=m.$implicit;a(),p("value",e.key)("inputId",e.value),a(),p("for",e.value),a(),x(e.value)}}function gt(t,m){if(t&1&&(i(0,"div",40)(1,"div",25),c(2,"p-radiobutton",45),i(3,"label",44),o(4),n()()()),t&2){let e=m.$implicit;a(2),p("value",e.key)("inputId",e.value),a(),p("for",e.value),a(),x(e.value)}}function vt(t,m){if(t&1&&(i(0,"div",40)(1,"div",25),c(2,"p-radiobutton",46),i(3,"label",44),o(4),n()()()),t&2){let e=m.$implicit;a(2),p("value",e.key)("inputId",e.key.toString()),a(),p("for",e.key),a(),x(e.value)}}function _t(t,m){if(t&1&&(i(0,"div",40)(1,"div",25),c(2,"p-radiobutton",47),i(3,"label",44),o(4),n()()()),t&2){let e=m.$implicit;a(2),p("value",e.key)("inputId",e.value),a(),p("for",e.value),a(),x(e.value)}}function bt(t,m){if(t&1&&(i(0,"p-scrollpanel",null,2)(2,"p-tabs",7)(3,"p-tablist"),F(4,dt,2,2,"p-tab",8,y),n(),i(6,"p-tabpanels")(7,"p-tabpanel",9)(8,"div",10)(9,"h3",11),o(10,"Accounting Numbering"),n(),i(11,"div",12)(12,"div",13)(13,"div",14)(14,"div",13)(15,"div",15)(16,"label",16),o(17,"Digit"),n(),c(18,"p-inputnumber",17),n()(),i(19,"div",13)(20,"div",15)(21,"label",18),o(22,"Seed"),n(),c(23,"p-inputnumber",19),n()(),i(24,"div",13)(25,"div",15)(26,"label",20),o(27,"Last Number"),n(),c(28,"p-inputnumber",21),n()(),i(29,"div",13)(30,"div",15)(31,"label",22),o(32,"Format"),n(),c(33,"p-select",23),n()(),i(34,"div",13)(35,"div",15)(36,"label",22),o(37,"Reset Every"),n(),i(38,"div",24),F(39,ft,4,4,"div",25,y),n()()()()()()()(),i(41,"p-tabpanel",8)(42,"div",26)(43,"div",27)(44,"h3",11),o(45,"Journal Generate"),n(),i(46,"p"),o(47,"Configure generate transaction"),n()(),i(48,"div",12)(49,"div",28)(50,"div",12)(51,"div",29)(52,"div",15)(53,"label",22),o(54,"Outlet Delivery Journal"),n(),c(55,"p-toggleswitch",30),n()(),i(56,"div",31)(57,"div",15)(58,"label",22),o(59,"Payment Discount Journal On Payment"),n(),c(60,"p-toggleswitch",32),n()()()()()(),c(61,"hr"),i(62,"div",26)(63,"div",28)(64,"div",12)(65,"div",33)(66,"label",22),o(67,"Note"),n()(),i(68,"div",29)(69,"div",15)(70,"label",22),o(71,"Note Required On Journal"),n(),c(72,"p-toggleswitch",34),n()(),i(73,"div",29)(74,"div",15)(75,"label",22),o(76,"Trial Balance Footer Visible"),n(),c(77,"p-toggleswitch",35),n()(),c(78,"div",29),n()()()(),i(79,"p-tabpanel",36)(80,"div",10)(81,"h3",11),o(82,"Report"),n(),i(83,"div",12)(84,"div",27)(85,"div",37)(86,"div")(87,"label",38),o(88,"Audit Journal Transaction"),n(),i(89,"div",12)(90,"div",39)(91,"div",12),F(92,gt,5,4,"div",40,y),n()()()(),i(94,"div")(95,"label",41),o(96,"Accounting For Treatment"),n(),i(97,"div",12)(98,"div",39)(99,"div",12),F(100,vt,5,4,"div",40,y),n()()()(),i(102,"div")(103,"label",42),o(104,"Configure Report Access Control in COA"),n(),i(105,"div",12)(106,"div",39)(107,"div",12),F(108,_t,5,4,"div",40,y),n()()()()()()()()()()()()),t&2){let e,r,l,d,L,v=s();U(D(8,ut)),a(2),p("value",0)("formGroup",v.form),a(2),A(v.tabs()),a(3),p("value",0),a(26),p("options",(e=v.accountingIntegration())==null||e.options==null?null:e.options.monthlyResetPeriodFormat),a(6),A((r=v.accountingIntegration())==null||r.options==null?null:r.options.resetPeriods),a(2),p("value",1),a(38),p("value",2),a(13),A((l=v.accountingIntegration())==null||l.options==null?null:l.options.auditType),a(8),A((d=v.accountingIntegration())==null||d.options==null?null:d.options.generatePrepaidJournal),a(8),A((L=v.accountingIntegration())==null||L.options==null?null:L.options.entityAccess)}}var nt=(()=>{class t{constructor(){this.accountingSetupService=u(_),this.fb=u(k).nonNullable,this.tabs=z(["Numbering","Journal","Report"]),this.accountingIntegration=z(null)}ngOnInit(){this.initializeForm(),this.loadAccountingConfiguration()}initializeForm(){this.form=this.fb.group({number:this.createNumberGroup(),report:this.createReportGroup(),journalGenerate:this.createJournalGenerateGroup()})}createNumberGroup(){return this.fb.group({seed:this.fb.control(""),digit:this.fb.control(""),resetEvery:this.fb.control(""),monthlyFormat:this.fb.control(""),lastNumber:this.fb.control(""),lastModified:this.fb.control("")})}createReportGroup(){return this.fb.group({accountingAuditType:this.fb.control(""),accountingEntityAccess:this.fb.control(""),generatePrepaidJournal:this.fb.control("")})}createJournalGenerateGroup(){return this.fb.group({eodExpenseJournal:this.fb.control(""),transferOrder:this.fb.control(""),paymentDiscount:this.fb.control(""),noteMandatory:this.fb.control(""),trialBalanceFooterVisible:this.fb.control("")})}loadAccountingConfiguration(){this.accountingSetupService.fetchLoaderConfiguration().pipe(w(e=>{this.accountingIntegration.set(e),this.form.patchValue(e.form)})).subscribe()}updateAccountingIntegration(){let e={form:this.form.getRawValue()};this.accountingSetupService.updateAccountingIntegrationConfiguration(e).pipe().subscribe()}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=S({type:t,selectors:[["app-accounting-integration"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["scrollPanelContainer",""],["pageTitle","Accounting Integration"],[1,"d-flex","gap-2"],["routerLink","..",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"click"],[1,"border-top",3,"value","formGroup"],[3,"value"],["formGroupName","number",3,"value"],[1,""],[1,"fs-5"],[1,"row"],[1,"col-6"],[1,"row","row-gap-3"],[1,"d-flex","flex-column"],["for","digit",1,"fs-4"],["inputId","digit","formControlName","digit"],["for","seed",1,"fs-4"],["inputId","seed","formControlName","seed"],["for","lastNumber",1,"fs-4"],["inputId","lastNumber","formControlName","lastNumber"],["for","",1,"fs-4"],["appendTo","body","formControlName","monthlyFormat","optionValue","key","optionLabel","value",3,"options"],[1,"d-flex","gap-4"],[1,"d-flex","align-items-center","gap-2"],["formGroupName","journalGenerate",1,"row"],[1,"col-12"],[1,"col-10"],[1,"col-md-4","mb-3"],["formControlName","transferOrder"],[1,"col-md-6","mb-4"],["formControlName","paymentDiscount"],[1,"col-12","mb-2"],["formControlName","noteMandatory"],["formControlName","trialBalanceFooterVisible"],["formGroupName","report",3,"value"],[1,"d-flex","flex-column","gap-4"],["for","accountingAuditType",1,"fs-4","mb-2"],[1,"col-8"],[1,"col-4"],["for","generatePrepaidJournal",1,"fs-4","mb-2"],["for","accountingEntityAccess",1,"fs-4","mb-2"],["name","resetEvery","formControlName","resetEvery",3,"value","inputId"],[1,"m-0",3,"for"],["name","accountingAuditType","formControlName","accountingAuditType",3,"value","inputId"],["name","generatePrepaidJournal","formControlName","generatePrepaidJournal",3,"value","inputId"],["name","accountingEntityAccess","formControlName","accountingEntityAccess",3,"value","inputId"]],template:function(r,l){r&1&&(i(0,"app-main-panel",3),g(1,st,4,0,"ng-template",null,0,f)(3,bt,110,9,"ng-template",null,1,f),n())},dependencies:[I,et,Ze,Ye,Xe,Ke,Qe,M,X,Oe,Pe,R,T,B,P,O,q,N,Be,Ge,je,Ve,Se,xe,V,J,we,De,Q,K],styles:["[_nghost-%COMP%]{display:block}.inactive-state[_ngcontent-%COMP%]{background-color:#e5e5e5}.active-state[_ngcontent-%COMP%]{background-color:var(--p-primary-color)}"],changeDetection:0})}}return t})();var ht=()=>({height:"calc(100vh - 250px)"}),xt=()=>[],it=()=>({});function St(t,m){if(t&1){let e=h();i(0,"div")(1,"p-button",6),E("onClick",function(){b(e);let l=s();return C(l.submitForm())}),n()()}}function yt(t,m){t&1&&(i(0,"div",12)(1,"h3",13),o(2,"Date"),n(),c(3,"p-datePicker",14),n())}function Ft(t,m){t&1&&(i(0,"tr")(1,"th",20),o(2,"Account Name"),n(),i(3,"th",21),o(4,"Debit"),n(),i(5,"th",21),o(6,"Credit"),n()())}function At(t,m){if(t&1&&(i(0,"tr",10)(1,"td",20),o(2),n(),i(3,"td"),c(4,"input",22),n(),i(5,"td"),c(6,"input",23),n()()),t&2){let e,r=m.$implicit,l=m.rowIndex,d=s(4);p("formGroupName",l),a(2),te(" ",(e=d.asFormGroup(r).get("accountName"))==null?null:e.value," "),a(2),p("autoNumeric",D(4,it)),a(2),p("autoNumeric",D(5,it))}}function Et(t,m){if(t&1&&(i(0,"div",10)(1,"h4",15),o(2),n(),i(3,"div",16)(4,"p-table",17),g(5,Ft,7,0,"ng-template",18)(6,At,7,6,"ng-template",19),n()()()),t&2){let e=m.$implicit,r=m.$index,l=s(3);p("formGroupName",r),a(2),te(" ",e.get("name").value," "),a(2),p("value",l.getItemsArray(l.asFormGroup(e)).controls)}}function It(t,m){if(t&1&&(i(0,"tr")(1,"td")(2,"p",24),o(3,"Total"),n()(),i(4,"td",25)(5,"p",24),o(6),ie(7,"number"),n()(),i(8,"td",25)(9,"p",24),o(10),ie(11,"number"),n()()()),t&2){let e=s(3);a(6),x(oe(7,2,e.subtotalDebit)),a(4),x(oe(11,4,e.subtotalCredit))}}function Tt(t,m){if(t&1&&(i(0,"p-panel",8),g(1,yt,4,0,"ng-template",null,2,f),c(3,"p-divider"),i(4,"p-scroll-panel")(5,"div",9),F(6,Et,7,3,"div",10,y),n()(),i(8,"p-table",11),g(9,It,12,6,"ng-template",null,3,f),n()()),t&2){let e=s(2);p("formGroup",e.formGroups),a(4),U(D(4,ht)),a(2),A(e.formsArray.controls),a(2),p("value",D(5,xt))}}function Nt(t,m){if(t&1&&g(0,Tt,11,6,"p-panel",7),t&2){let e=s();p("ngIf",e.formGroups)}}var rt=(()=>{class t{constructor(){this.destroy$=new le,this.subtotalDebit=0,this.subtotalCredit=0,this.fb=u(k),this.accSetupService=u(_),this.dayjsService=u($e),this.date=new Date,this.routes=u(he)}ngOnInit(){this.initializeForm(),this.loadFormData(),this.calculateSubtotalDebit(),this.formGroups.get("forms").valueChanges.pipe(pe(300),ce(this.destroy$)).subscribe(()=>{this.calculateSubtotalDebit()})}initializeForm(){this.formGroups=this.fb.group({forms:this.fb.array([]),date:this.fb.control(new Date)})}get formsArray(){return this.formGroups.get("forms")}getItemsArray(e){return e.get("items")}asFormGroup(e){return e}createFormGroup(e){return this.fb.group({id:[e.id],name:[e.name],items:this.createItemsArray(e.items)})}createItemsArray(e){let r=e.map(l=>this.createItemGroup(l));return this.fb.array(r)}createItemGroup(e){return this.fb.group({accountName:[e.accountName],accountCode:[e.accountCode],id:[e.id],journalID:[e.journalID],accountID:[e.accountID],debitAmount:[e.debitAmount],creditAmount:[e.creditAmount],index:[e.index],note:[e.note]})}loadFormData(){this.routes.data.pipe(me(e=>e.data),Je("response"),w(e=>{for(;this.formsArray.length>0;)this.formsArray.removeAt(0);e.form.filter(l=>l.items&&l.items.length>0).forEach(l=>{this.formsArray.push(this.createFormGroup(l))})})).subscribe({error:e=>console.error("Error loading form data:",e)})}calculateSubtotalDebit(){let e=this.formGroups.controls.forms;this.subtotalDebit=0,this.subtotalCredit=0,e.controls.forEach(r=>{let l=this.getItemsArray(r),d=l.controls.reduce((v,Z)=>{let ee=Z.get("debitAmount").value||0;return v+ee},0),L=l.controls.reduce((v,Z)=>{let ee=Z.get("creditAmount").value||0;return v+ee},0);this.subtotalDebit+=d,this.subtotalCredit+=L})}submitForm(){let e=Object.entries(this.formGroups.getRawValue()).reduce((r,[l,d])=>(l==="date"?r[l]=d instanceof Date?this.dayjsService.format(d):d:l==="forms"?r.form=d:r[l]=d,r),{});console.log("Submitting form data:",e),this.accSetupService.submitOpeningBalanceFormConfiguration(e).subscribe(),console.log("Submitting form data:",e)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=S({type:t,selectors:[["app-acc-opening-balance-form"]],features:[ve([Ie])],decls:6,vars:0,consts:[["actionButton",""],["content",""],["header",""],["footer",""],["pageTitle","Opening Balance Form"],["preventOpenDuplicates",""],["label","Submit",3,"onClick"],[3,"formGroup",4,"ngIf"],[3,"formGroup"],["formArrayName","forms",1,"d-flex","flex-column","row-gap-4"],[3,"formGroupName"],[3,"value"],[1,"d-flex","flex-column","gap-2","mx-2"],[1,"fs-5","m-0"],["formControlName","date"],[1,"fs-4"],["formArrayName","items"],["dataKey","id",3,"value"],["pTemplate","header"],["pTemplate","body"],[1,"fs-3"],[1,"fs-3",2,"width","200px"],["formControlName","debitAmount",1,"fs-3","form-control",3,"autoNumeric"],["formControlName","creditAmount",1,"fs-3","form-control",3,"autoNumeric"],[1,"fw-semibold","fs-4"],[1,"text-end",2,"width","200px"]],template:function(r,l){r&1&&(i(0,"app-main-panel",4),g(1,St,2,0,"ng-template",null,0,f)(3,Nt,1,1,"ng-template",null,1,f),n(),c(5,"p-toast",5))},dependencies:[M,X,Te,I,be,Ce,Me,Ne,Re,ke,Q,K,W,G,T,B,N,qe,V,J,$,j,Le,R,P,O,q,Ee,He,We],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var at=t=>({"ng-invalid ng-dirty":t});function Dt(t,m){if(t&1){let e=h();i(0,"p-button",4),E("onClick",function(){b(e);let l=s();return C(l.saveCredentials())}),o(1,"Update"),n()}}function wt(t,m){t&1&&(i(0,"div",12)(1,"h3",13),o(2,"Account"),n(),i(3,"small",14),o(4,"Configure Client ID and Client Secret"),n()())}function Gt(t,m){if(t&1&&(i(0,"div",5)(1,"p-panel"),g(2,wt,5,0,"ng-template",null,2,f),i(4,"div",6)(5,"div",7)(6,"div",8)(7,"label",9),o(8,"Client ID"),n(),c(9,"input",10),n()(),i(10,"div",7)(11,"div",8)(12,"label",9),o(13,"Client Secret"),n(),c(14,"input",11),n()()()()()),t&2){let e=s();a(4),p("formGroup",e.credentialForm),a(5),p("ngClass",ne(3,at,e.clientIDControl.invalid&&e.clientIDControl.dirty||e.clientIDControl.touched)),a(5),p("ngClass",ne(5,at,e.clientSecretControl.invalid&&e.clientSecretControl.dirty||e.clientSecretControl.touched))}}var lt=(()=>{class t{constructor(e){this.fb=e,this.setupService=u(_)}ngOnInit(){this.initForm(),this.setupService.fetchAPICredential().pipe(w(e=>{this.credentialForm.patchValue({clientID:e.clientID||"",clientSecret:e.clientSecret||""})})).subscribe()}initForm(){this.credentialForm=this.fb.group({clientID:["",[re.required]],clientSecret:["",[re.required]]})}get clientIDControl(){return this.credentialForm.get("clientID")}get clientSecretControl(){return this.credentialForm.get("clientSecret")}saveCredentials(){if(this.credentialForm.invalid){this.credentialForm.markAllAsTouched();return}let e=this.credentialForm.getRawValue();console.log("Saving credentials:",e),this.setupService.updateAPICredential(e).subscribe()}static{this.\u0275fac=function(r){return new(r||t)(se(k))}}static{this.\u0275cmp=S({type:t,selectors:[["app-api-credential"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","API Credential"],[3,"onClick"],[1,"d-flex","flex-column","row-gap-4"],[1,"row",3,"formGroup"],[1,"col-6"],[1,"d-flex","flex-column"],["for","outlet"],["type","text","pInputText","","formControlName","clientID",3,"ngClass"],["type","text","pInputText","","formControlName","clientSecret",3,"ngClass"],[1,"d-flex","flex-column","px-2"],[1,"mb-0","fw-bold"],[1,"fst-italic","text-muted"]],template:function(r,l){r&1&&(i(0,"app-main-panel",3),g(1,Dt,2,0,"ng-template",null,0,f)(3,Gt,15,7,"ng-template",null,1,f),n())},dependencies:[I,_e,R,G,T,B,P,O,N,H,$,j,M,V,J],encapsulation:2})}}return t})();function Bt(t,m){if(t&1){let e=h();i(0,"button",4),E("click",function(){b(e);let l=s();return C(l.onFormatJournal())}),o(1," Format "),n()}}function Pt(t,m){t&1&&(i(0,"div",12)(1,"div",13)(2,"h4",14),o(3,"Journal Configuration"),n(),i(4,"small",15),o(5," Enter your account information to format journal entries "),n()()())}function Ot(t,m){if(t&1){let e=h();i(0,"div",5)(1,"p-panel"),g(2,Pt,6,0,"ng-template",null,2,f),i(4,"div",6)(5,"div",7)(6,"p-floatlabel",8)(7,"input",9),ge("ngModelChange",function(l){b(e);let d=s();return fe(d.subdomain,l)||(d.subdomain=l),C(l)}),n(),i(8,"label",10),o(9,"Subdomain"),n()(),i(10,"small",11),o(11,"Enter your account subdomain (e.g., mycompany.dealpos.net)"),n()()()()()}if(t&2){let e=s();a(7),de("ngModel",e.subdomain)}}var mt=(()=>{class t{constructor(){this.setupService=u(_),this.subdomain=z(""),this.toastrService=u(ye)}onFormatJournal(){if(!this.subdomain()){this.toastrService.error("Please enter a subdomain","Error");return}this.setupService.formatJournal(this.subdomain()).subscribe({next:e=>{this.toastrService.success(e.message,"Success")}})}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=S({type:t,selectors:[["app-format-jurnal"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","Format Journal"],[1,"btn","btn-success","rounded",3,"click"],[1,"d-flex","flex-column","row-gap-4"],[1,"row","mt-6"],[1,"col-12"],["variant","on"],["pInputText","","id","subdomain","autocomplete","off",1,"w-100",3,"ngModelChange","ngModel"],["for","subdomain"],[1,"text-muted","fst-italic",2,"font-size","12px"],[1,"row","ps-2"],[1,"col-12","d-flex","flex-column"],[1,"mb-1","fw-bold"],[1,"fst-italic","text-muted"]],template:function(r,l){r&1&&(i(0,"app-main-panel",3),g(1,Bt,2,0,"ng-template",null,0,f)(3,Ot,12,1,"ng-template",null,1,f),n())},dependencies:[I,W,G,T,Ae,N,H,M,$,j,Ue,ze],encapsulation:2})}}return t})();var pt=()=>u(_).fetchOpeningBalanceFormConfiguration();var _i=[{path:"",redirectTo:"accounting-integration",pathMatch:"full"},{path:"",children:[{path:"accounting-integration",component:nt},{path:"opening-balance-form",component:rt,resolve:{data:pt}},{path:"api-crendetial",component:lt},{path:"format-journal",component:mt},{path:"closing-entries",loadComponent:()=>import("./chunk-7VQQO4OE.js").then(t=>t.ClosingPageComponent)},{path:"closing-entries/create",loadComponent:()=>import("./chunk-3WD3CTYC.js").then(t=>t.ClosingFormComponent)}]}];export{_i as ACCOUNTING_SETUP_ROUTES};
|
|
1
|
+
import{a as Ke,b as Qe,c as Xe,d as Ye,e as Ze,f as et}from"./chunk-EDCDR4RJ.js";import{a as ze,b as Ue,c as qe}from"./chunk-B7WHT2EP.js";import{a as We,b as He}from"./chunk-HHDFSN55.js";import{a as Le}from"./chunk-MDH73MG3.js";import{b as $e}from"./chunk-BGWDOZQM.js";import"./chunk-VZI3JZPU.js";import{a as Ve,b as je}from"./chunk-YO23YVSC.js";import"./chunk-AZUQDRJU.js";import{a as Pe,b as Oe,d as ke,k as Re}from"./chunk-EW3R2HAB.js";import{a as Ne,b as Me}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import{a as Je}from"./chunk-XKCLERWG.js";import{a as K,b as Q}from"./chunk-4LGDNQMZ.js";import"./chunk-PKN47FQE.js";import{a as Ge,b as Be}from"./chunk-LRRVQSMI.js";import"./chunk-42UIGXWH.js";import{a as De,b as we}from"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{b as X}from"./chunk-5R3XKSDM.js";import{h as M}from"./chunk-UYC454VQ.js";import"./chunk-C7LM5UCK.js";import{a as j,b as $}from"./chunk-J4XRJAME.js";import"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{n as H,o as N,w as J,x as V}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{Ia as Ie,Ma as Te,b as G,c as re,e as T,f as B,j as Ae,l as P,m as q,n as Ee,o as O,v as k,x as W,y as R}from"./chunk-FMVCTBCQ.js";import{a as Fe}from"./chunk-P3V7Z3A6.js";import{a as ye}from"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{D as he,G as xe,N as Se,c as _e,f as be,l as Ce,m as I}from"./chunk-B63BKC6F.js";import{Ac as ne,Cb as g,Ga as z,Jc as ie,Kb as p,Kc as oe,L as pe,Mc as f,Nb as U,Qb as y,Sb as F,Tb as A,Ub as i,Vb as n,Wb as c,Y as ce,Z as w,_b as h,ba as ue,dc as E,ec as s,g as le,gb as a,ha as u,mb as se,pa as b,qa as C,qc as o,rc as x,s as me,sc as te,vc as de,wb as S,wc as fe,xc as ge,yc as ve,zc as D}from"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var _=(()=>{class t{#e=u(Fe);fetchLoaderConfiguration(){return this.#e.get("","api/SetupLoader/Load")}updateAccountingIntegrationConfiguration(e){return this.#e.post(void 0,"/api/setup/SubmitConfig",e)}fetchOpeningBalanceFormConfiguration(){return this.#e.get("","/api/setup/OpeningBalance/Form")}submitOpeningBalanceFormConfiguration(e){return this.#e.post("","api/setup/OpeningBalance/Submit",e)}fetchAPICredential(){return this.#e.get(void 0,"/api/AccountConfig")}updateAPICredential(e){return this.#e.put(void 0,"/api/AccountConfig",e)}formatJournal(e){return this.#e.post("","/api/setup/formatdata/clearjournal",{domain:e})}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275prov=ue({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var ut=()=>({height:"calc(100vh - 100px)"});function st(t,m){if(t&1){let e=h();i(0,"div",4)(1,"a",5),o(2,"Cancel"),n(),i(3,"p-button",6),E("click",function(){b(e);let l=s();return C(l.updateAccountingIntegration())}),n()()}}function dt(t,m){if(t&1&&(i(0,"p-tab",8),o(1),n()),t&2){let e=m.$implicit,r=m.$index;p("value",r),a(),x(e)}}function ft(t,m){if(t&1&&(i(0,"div",25),c(1,"p-radiobutton",43),i(2,"label",44),o(3),n()()),t&2){let e=m.$implicit;a(),p("value",e.key)("inputId",e.value),a(),p("for",e.value),a(),x(e.value)}}function gt(t,m){if(t&1&&(i(0,"div",40)(1,"div",25),c(2,"p-radiobutton",45),i(3,"label",44),o(4),n()()()),t&2){let e=m.$implicit;a(2),p("value",e.key)("inputId",e.value),a(),p("for",e.value),a(),x(e.value)}}function vt(t,m){if(t&1&&(i(0,"div",40)(1,"div",25),c(2,"p-radiobutton",46),i(3,"label",44),o(4),n()()()),t&2){let e=m.$implicit;a(2),p("value",e.key)("inputId",e.key.toString()),a(),p("for",e.key),a(),x(e.value)}}function _t(t,m){if(t&1&&(i(0,"div",40)(1,"div",25),c(2,"p-radiobutton",47),i(3,"label",44),o(4),n()()()),t&2){let e=m.$implicit;a(2),p("value",e.key)("inputId",e.value),a(),p("for",e.value),a(),x(e.value)}}function bt(t,m){if(t&1&&(i(0,"p-scrollpanel",null,2)(2,"p-tabs",7)(3,"p-tablist"),F(4,dt,2,2,"p-tab",8,y),n(),i(6,"p-tabpanels")(7,"p-tabpanel",9)(8,"div",10)(9,"h3",11),o(10,"Accounting Numbering"),n(),i(11,"div",12)(12,"div",13)(13,"div",14)(14,"div",13)(15,"div",15)(16,"label",16),o(17,"Digit"),n(),c(18,"p-inputnumber",17),n()(),i(19,"div",13)(20,"div",15)(21,"label",18),o(22,"Seed"),n(),c(23,"p-inputnumber",19),n()(),i(24,"div",13)(25,"div",15)(26,"label",20),o(27,"Last Number"),n(),c(28,"p-inputnumber",21),n()(),i(29,"div",13)(30,"div",15)(31,"label",22),o(32,"Format"),n(),c(33,"p-select",23),n()(),i(34,"div",13)(35,"div",15)(36,"label",22),o(37,"Reset Every"),n(),i(38,"div",24),F(39,ft,4,4,"div",25,y),n()()()()()()()(),i(41,"p-tabpanel",8)(42,"div",26)(43,"div",27)(44,"h3",11),o(45,"Journal Generate"),n(),i(46,"p"),o(47,"Configure generate transaction"),n()(),i(48,"div",12)(49,"div",28)(50,"div",12)(51,"div",29)(52,"div",15)(53,"label",22),o(54,"Outlet Delivery Journal"),n(),c(55,"p-toggleswitch",30),n()(),i(56,"div",31)(57,"div",15)(58,"label",22),o(59,"Payment Discount Journal On Payment"),n(),c(60,"p-toggleswitch",32),n()()()()()(),c(61,"hr"),i(62,"div",26)(63,"div",28)(64,"div",12)(65,"div",33)(66,"label",22),o(67,"Note"),n()(),i(68,"div",29)(69,"div",15)(70,"label",22),o(71,"Note Required On Journal"),n(),c(72,"p-toggleswitch",34),n()(),i(73,"div",29)(74,"div",15)(75,"label",22),o(76,"Trial Balance Footer Visible"),n(),c(77,"p-toggleswitch",35),n()(),c(78,"div",29),n()()()(),i(79,"p-tabpanel",36)(80,"div",10)(81,"h3",11),o(82,"Report"),n(),i(83,"div",12)(84,"div",27)(85,"div",37)(86,"div")(87,"label",38),o(88,"Audit Journal Transaction"),n(),i(89,"div",12)(90,"div",39)(91,"div",12),F(92,gt,5,4,"div",40,y),n()()()(),i(94,"div")(95,"label",41),o(96,"Accounting For Treatment"),n(),i(97,"div",12)(98,"div",39)(99,"div",12),F(100,vt,5,4,"div",40,y),n()()()(),i(102,"div")(103,"label",42),o(104,"Configure Report Access Control in COA"),n(),i(105,"div",12)(106,"div",39)(107,"div",12),F(108,_t,5,4,"div",40,y),n()()()()()()()()()()()()),t&2){let e,r,l,d,L,v=s();U(D(8,ut)),a(2),p("value",0)("formGroup",v.form),a(2),A(v.tabs()),a(3),p("value",0),a(26),p("options",(e=v.accountingIntegration())==null||e.options==null?null:e.options.monthlyResetPeriodFormat),a(6),A((r=v.accountingIntegration())==null||r.options==null?null:r.options.resetPeriods),a(2),p("value",1),a(38),p("value",2),a(13),A((l=v.accountingIntegration())==null||l.options==null?null:l.options.auditType),a(8),A((d=v.accountingIntegration())==null||d.options==null?null:d.options.generatePrepaidJournal),a(8),A((L=v.accountingIntegration())==null||L.options==null?null:L.options.entityAccess)}}var nt=(()=>{class t{constructor(){this.accountingSetupService=u(_),this.fb=u(k).nonNullable,this.tabs=z(["Numbering","Journal","Report"]),this.accountingIntegration=z(null)}ngOnInit(){this.initializeForm(),this.loadAccountingConfiguration()}initializeForm(){this.form=this.fb.group({number:this.createNumberGroup(),report:this.createReportGroup(),journalGenerate:this.createJournalGenerateGroup()})}createNumberGroup(){return this.fb.group({seed:this.fb.control(""),digit:this.fb.control(""),resetEvery:this.fb.control(""),monthlyFormat:this.fb.control(""),lastNumber:this.fb.control(""),lastModified:this.fb.control("")})}createReportGroup(){return this.fb.group({accountingAuditType:this.fb.control(""),accountingEntityAccess:this.fb.control(""),generatePrepaidJournal:this.fb.control("")})}createJournalGenerateGroup(){return this.fb.group({eodExpenseJournal:this.fb.control(""),transferOrder:this.fb.control(""),paymentDiscount:this.fb.control(""),noteMandatory:this.fb.control(""),trialBalanceFooterVisible:this.fb.control("")})}loadAccountingConfiguration(){this.accountingSetupService.fetchLoaderConfiguration().pipe(w(e=>{this.accountingIntegration.set(e),this.form.patchValue(e.form)})).subscribe()}updateAccountingIntegration(){let e={form:this.form.getRawValue()};this.accountingSetupService.updateAccountingIntegrationConfiguration(e).pipe().subscribe()}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=S({type:t,selectors:[["app-accounting-integration"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["scrollPanelContainer",""],["pageTitle","Accounting Integration"],[1,"d-flex","gap-2"],["routerLink","..",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"click"],[1,"border-top",3,"value","formGroup"],[3,"value"],["formGroupName","number",3,"value"],[1,""],[1,"fs-5"],[1,"row"],[1,"col-6"],[1,"row","row-gap-3"],[1,"d-flex","flex-column"],["for","digit",1,"fs-4"],["inputId","digit","formControlName","digit"],["for","seed",1,"fs-4"],["inputId","seed","formControlName","seed"],["for","lastNumber",1,"fs-4"],["inputId","lastNumber","formControlName","lastNumber"],["for","",1,"fs-4"],["appendTo","body","formControlName","monthlyFormat","optionValue","key","optionLabel","value",3,"options"],[1,"d-flex","gap-4"],[1,"d-flex","align-items-center","gap-2"],["formGroupName","journalGenerate",1,"row"],[1,"col-12"],[1,"col-10"],[1,"col-md-4","mb-3"],["formControlName","transferOrder"],[1,"col-md-6","mb-4"],["formControlName","paymentDiscount"],[1,"col-12","mb-2"],["formControlName","noteMandatory"],["formControlName","trialBalanceFooterVisible"],["formGroupName","report",3,"value"],[1,"d-flex","flex-column","gap-4"],["for","accountingAuditType",1,"fs-4","mb-2"],[1,"col-8"],[1,"col-4"],["for","generatePrepaidJournal",1,"fs-4","mb-2"],["for","accountingEntityAccess",1,"fs-4","mb-2"],["name","resetEvery","formControlName","resetEvery",3,"value","inputId"],[1,"m-0",3,"for"],["name","accountingAuditType","formControlName","accountingAuditType",3,"value","inputId"],["name","generatePrepaidJournal","formControlName","generatePrepaidJournal",3,"value","inputId"],["name","accountingEntityAccess","formControlName","accountingEntityAccess",3,"value","inputId"]],template:function(r,l){r&1&&(i(0,"app-main-panel",3),g(1,st,4,0,"ng-template",null,0,f)(3,bt,110,9,"ng-template",null,1,f),n())},dependencies:[I,et,Ze,Ye,Xe,Ke,Qe,M,X,Oe,Pe,R,T,B,P,O,q,N,Be,Ge,je,Ve,Se,xe,V,J,we,De,Q,K],styles:["[_nghost-%COMP%]{display:block}.inactive-state[_ngcontent-%COMP%]{background-color:#e5e5e5}.active-state[_ngcontent-%COMP%]{background-color:var(--p-primary-color)}"],changeDetection:0})}}return t})();var ht=()=>({height:"calc(100vh - 250px)"}),xt=()=>[],it=()=>({});function St(t,m){if(t&1){let e=h();i(0,"div")(1,"p-button",6),E("onClick",function(){b(e);let l=s();return C(l.submitForm())}),n()()}}function yt(t,m){t&1&&(i(0,"div",12)(1,"h3",13),o(2,"Date"),n(),c(3,"p-datePicker",14),n())}function Ft(t,m){t&1&&(i(0,"tr")(1,"th",20),o(2,"Account Name"),n(),i(3,"th",21),o(4,"Debit"),n(),i(5,"th",21),o(6,"Credit"),n()())}function At(t,m){if(t&1&&(i(0,"tr",10)(1,"td",20),o(2),n(),i(3,"td"),c(4,"input",22),n(),i(5,"td"),c(6,"input",23),n()()),t&2){let e,r=m.$implicit,l=m.rowIndex,d=s(4);p("formGroupName",l),a(2),te(" ",(e=d.asFormGroup(r).get("accountName"))==null?null:e.value," "),a(2),p("autoNumeric",D(4,it)),a(2),p("autoNumeric",D(5,it))}}function Et(t,m){if(t&1&&(i(0,"div",10)(1,"h4",15),o(2),n(),i(3,"div",16)(4,"p-table",17),g(5,Ft,7,0,"ng-template",18)(6,At,7,6,"ng-template",19),n()()()),t&2){let e=m.$implicit,r=m.$index,l=s(3);p("formGroupName",r),a(2),te(" ",e.get("name").value," "),a(2),p("value",l.getItemsArray(l.asFormGroup(e)).controls)}}function It(t,m){if(t&1&&(i(0,"tr")(1,"td")(2,"p",24),o(3,"Total"),n()(),i(4,"td",25)(5,"p",24),o(6),ie(7,"number"),n()(),i(8,"td",25)(9,"p",24),o(10),ie(11,"number"),n()()()),t&2){let e=s(3);a(6),x(oe(7,2,e.subtotalDebit)),a(4),x(oe(11,4,e.subtotalCredit))}}function Tt(t,m){if(t&1&&(i(0,"p-panel",8),g(1,yt,4,0,"ng-template",null,2,f),c(3,"p-divider"),i(4,"p-scroll-panel")(5,"div",9),F(6,Et,7,3,"div",10,y),n()(),i(8,"p-table",11),g(9,It,12,6,"ng-template",null,3,f),n()()),t&2){let e=s(2);p("formGroup",e.formGroups),a(4),U(D(4,ht)),a(2),A(e.formsArray.controls),a(2),p("value",D(5,xt))}}function Nt(t,m){if(t&1&&g(0,Tt,11,6,"p-panel",7),t&2){let e=s();p("ngIf",e.formGroups)}}var rt=(()=>{class t{constructor(){this.destroy$=new le,this.subtotalDebit=0,this.subtotalCredit=0,this.fb=u(k),this.accSetupService=u(_),this.dayjsService=u($e),this.date=new Date,this.routes=u(he)}ngOnInit(){this.initializeForm(),this.loadFormData(),this.calculateSubtotalDebit(),this.formGroups.get("forms").valueChanges.pipe(pe(300),ce(this.destroy$)).subscribe(()=>{this.calculateSubtotalDebit()})}initializeForm(){this.formGroups=this.fb.group({forms:this.fb.array([]),date:this.fb.control(new Date)})}get formsArray(){return this.formGroups.get("forms")}getItemsArray(e){return e.get("items")}asFormGroup(e){return e}createFormGroup(e){return this.fb.group({id:[e.id],name:[e.name],items:this.createItemsArray(e.items)})}createItemsArray(e){let r=e.map(l=>this.createItemGroup(l));return this.fb.array(r)}createItemGroup(e){return this.fb.group({accountName:[e.accountName],accountCode:[e.accountCode],id:[e.id],journalID:[e.journalID],accountID:[e.accountID],debitAmount:[e.debitAmount],creditAmount:[e.creditAmount],index:[e.index],note:[e.note]})}loadFormData(){this.routes.data.pipe(me(e=>e.data),Je("response"),w(e=>{for(;this.formsArray.length>0;)this.formsArray.removeAt(0);e.form.filter(l=>l.items&&l.items.length>0).forEach(l=>{this.formsArray.push(this.createFormGroup(l))})})).subscribe({error:e=>console.error("Error loading form data:",e)})}calculateSubtotalDebit(){let e=this.formGroups.controls.forms;this.subtotalDebit=0,this.subtotalCredit=0,e.controls.forEach(r=>{let l=this.getItemsArray(r),d=l.controls.reduce((v,Z)=>{let ee=Z.get("debitAmount").value||0;return v+ee},0),L=l.controls.reduce((v,Z)=>{let ee=Z.get("creditAmount").value||0;return v+ee},0);this.subtotalDebit+=d,this.subtotalCredit+=L})}submitForm(){let e=Object.entries(this.formGroups.getRawValue()).reduce((r,[l,d])=>(l==="date"?r[l]=d instanceof Date?this.dayjsService.format(d):d:l==="forms"?r.form=d:r[l]=d,r),{});console.log("Submitting form data:",e),this.accSetupService.submitOpeningBalanceFormConfiguration(e).subscribe(),console.log("Submitting form data:",e)}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=S({type:t,selectors:[["app-acc-opening-balance-form"]],features:[ve([Ie])],decls:6,vars:0,consts:[["actionButton",""],["content",""],["header",""],["footer",""],["pageTitle","Opening Balance Form"],["preventOpenDuplicates",""],["label","Submit",3,"onClick"],[3,"formGroup",4,"ngIf"],[3,"formGroup"],["formArrayName","forms",1,"d-flex","flex-column","row-gap-4"],[3,"formGroupName"],[3,"value"],[1,"d-flex","flex-column","gap-2","mx-2"],[1,"fs-5","m-0"],["formControlName","date"],[1,"fs-4"],["formArrayName","items"],["dataKey","id",3,"value"],["pTemplate","header"],["pTemplate","body"],[1,"fs-3"],[1,"fs-3",2,"width","200px"],["formControlName","debitAmount",1,"fs-3","form-control",3,"autoNumeric"],["formControlName","creditAmount",1,"fs-3","form-control",3,"autoNumeric"],[1,"fw-semibold","fs-4"],[1,"text-end",2,"width","200px"]],template:function(r,l){r&1&&(i(0,"app-main-panel",4),g(1,St,2,0,"ng-template",null,0,f)(3,Nt,1,1,"ng-template",null,1,f),n(),c(5,"p-toast",5))},dependencies:[M,X,Te,I,be,Ce,Me,Ne,Re,ke,Q,K,W,G,T,B,N,qe,V,J,$,j,Le,R,P,O,q,Ee,He,We],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var at=t=>({"ng-invalid ng-dirty":t});function Dt(t,m){if(t&1){let e=h();i(0,"p-button",4),E("onClick",function(){b(e);let l=s();return C(l.saveCredentials())}),o(1,"Update"),n()}}function wt(t,m){t&1&&(i(0,"div",12)(1,"h3",13),o(2,"Account"),n(),i(3,"small",14),o(4,"Configure Client ID and Client Secret"),n()())}function Gt(t,m){if(t&1&&(i(0,"div",5)(1,"p-panel"),g(2,wt,5,0,"ng-template",null,2,f),i(4,"div",6)(5,"div",7)(6,"div",8)(7,"label",9),o(8,"Client ID"),n(),c(9,"input",10),n()(),i(10,"div",7)(11,"div",8)(12,"label",9),o(13,"Client Secret"),n(),c(14,"input",11),n()()()()()),t&2){let e=s();a(4),p("formGroup",e.credentialForm),a(5),p("ngClass",ne(3,at,e.clientIDControl.invalid&&e.clientIDControl.dirty||e.clientIDControl.touched)),a(5),p("ngClass",ne(5,at,e.clientSecretControl.invalid&&e.clientSecretControl.dirty||e.clientSecretControl.touched))}}var lt=(()=>{class t{constructor(e){this.fb=e,this.setupService=u(_)}ngOnInit(){this.initForm(),this.setupService.fetchAPICredential().pipe(w(e=>{this.credentialForm.patchValue({clientID:e.clientID||"",clientSecret:e.clientSecret||""})})).subscribe()}initForm(){this.credentialForm=this.fb.group({clientID:["",[re.required]],clientSecret:["",[re.required]]})}get clientIDControl(){return this.credentialForm.get("clientID")}get clientSecretControl(){return this.credentialForm.get("clientSecret")}saveCredentials(){if(this.credentialForm.invalid){this.credentialForm.markAllAsTouched();return}let e=this.credentialForm.getRawValue();console.log("Saving credentials:",e),this.setupService.updateAPICredential(e).subscribe()}static{this.\u0275fac=function(r){return new(r||t)(se(k))}}static{this.\u0275cmp=S({type:t,selectors:[["app-api-credential"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","API Credential"],[3,"onClick"],[1,"d-flex","flex-column","row-gap-4"],[1,"row",3,"formGroup"],[1,"col-6"],[1,"d-flex","flex-column"],["for","outlet"],["type","text","pInputText","","formControlName","clientID",3,"ngClass"],["type","text","pInputText","","formControlName","clientSecret",3,"ngClass"],[1,"d-flex","flex-column","px-2"],[1,"mb-0","fw-bold"],[1,"fst-italic","text-muted"]],template:function(r,l){r&1&&(i(0,"app-main-panel",3),g(1,Dt,2,0,"ng-template",null,0,f)(3,Gt,15,7,"ng-template",null,1,f),n())},dependencies:[I,_e,R,G,T,B,P,O,N,H,$,j,M,V,J],encapsulation:2})}}return t})();function Bt(t,m){if(t&1){let e=h();i(0,"button",4),E("click",function(){b(e);let l=s();return C(l.onFormatJournal())}),o(1," Format "),n()}}function Pt(t,m){t&1&&(i(0,"div",12)(1,"div",13)(2,"h4",14),o(3,"Journal Configuration"),n(),i(4,"small",15),o(5," Enter your account information to format journal entries "),n()()())}function Ot(t,m){if(t&1){let e=h();i(0,"div",5)(1,"p-panel"),g(2,Pt,6,0,"ng-template",null,2,f),i(4,"div",6)(5,"div",7)(6,"p-floatlabel",8)(7,"input",9),ge("ngModelChange",function(l){b(e);let d=s();return fe(d.subdomain,l)||(d.subdomain=l),C(l)}),n(),i(8,"label",10),o(9,"Subdomain"),n()(),i(10,"small",11),o(11,"Enter your account subdomain (e.g., mycompany.dealpos.net)"),n()()()()()}if(t&2){let e=s();a(7),de("ngModel",e.subdomain)}}var mt=(()=>{class t{constructor(){this.setupService=u(_),this.subdomain=z(""),this.toastrService=u(ye)}onFormatJournal(){if(!this.subdomain()){this.toastrService.error("Please enter a subdomain","Error");return}this.setupService.formatJournal(this.subdomain()).subscribe({next:e=>{this.toastrService.success(e.message,"Success")}})}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=S({type:t,selectors:[["app-format-jurnal"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","Format Journal"],[1,"btn","btn-success","rounded",3,"click"],[1,"d-flex","flex-column","row-gap-4"],[1,"row","mt-6"],[1,"col-12"],["variant","on"],["pInputText","","id","subdomain","autocomplete","off",1,"w-100",3,"ngModelChange","ngModel"],["for","subdomain"],[1,"text-muted","fst-italic",2,"font-size","12px"],[1,"row","ps-2"],[1,"col-12","d-flex","flex-column"],[1,"mb-1","fw-bold"],[1,"fst-italic","text-muted"]],template:function(r,l){r&1&&(i(0,"app-main-panel",3),g(1,Bt,2,0,"ng-template",null,0,f)(3,Ot,12,1,"ng-template",null,1,f),n())},dependencies:[I,W,G,T,Ae,N,H,M,$,j,Ue,ze],encapsulation:2})}}return t})();var pt=()=>u(_).fetchOpeningBalanceFormConfiguration();var _i=[{path:"",redirectTo:"accounting-integration",pathMatch:"full"},{path:"",children:[{path:"accounting-integration",component:nt},{path:"opening-balance-form",component:rt,resolve:{data:pt}},{path:"api-crendetial",component:lt},{path:"format-journal",component:mt},{path:"closing-entries",loadComponent:()=>import("./chunk-7VQQO4OE.js").then(t=>t.ClosingPageComponent)},{path:"closing-entries/create",loadComponent:()=>import("./chunk-FI3ZD46J.js").then(t=>t.ClosingFormComponent)}]}];export{_i as ACCOUNTING_SETUP_ROUTES};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as C,b as L}from"./chunk-
|
|
1
|
+
import{a as C,b as L}from"./chunk-EHUDHXDQ.js";import"./chunk-BGWDOZQM.js";import"./chunk-VZI3JZPU.js";import{a as E,b as V}from"./chunk-4LGDNQMZ.js";import"./chunk-5R3XKSDM.js";import{h as H}from"./chunk-UYC454VQ.js";import{b as N,c as G}from"./chunk-C7LM5UCK.js";import{a as R,b as D}from"./chunk-J4XRJAME.js";import"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{w as j,x as O}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import"./chunk-FMVCTBCQ.js";import"./chunk-P3V7Z3A6.js";import{a as I}from"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{i as $,m as F}from"./chunk-B63BKC6F.js";import{Cb as A,Jc as c,Kb as p,Kc as l,Mc as T,Nb as x,Ub as n,V as y,Vb as o,Wb as m,X as M,Z as S,_b as P,dc as h,ec as s,gb as a,h as v,ha as f,pa as g,qa as d,ra as b,s as u,sa as k,wb as B,yc as w,zc as _}from"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var q=()=>({height:"calc(100vh - 100px)"});function J(i,z){if(i&1){let e=P();n(0,"div",3)(1,"p-button",4),h("onClick",function(){g(e);let r=s();return d(r.onFormat())}),o(),n(2,"p-button",5),c(3,"async"),c(4,"async"),h("onClick",function(){g(e);let r=s();return d(r.onMigrate())}),o()()}if(i&2){let e=s();a(2),p("disabled",l(3,2,e.countInBooks$)!==0)("pTooltip",l(4,4,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function K(i,z){if(i&1&&(n(0,"p-scroll-panel")(1,"p-panel")(2,"div",6),m(3,"app-migration-cards",7),c(4,"async"),b(),n(5,"svg",8),m(6,"path",9),o(),k(),m(7,"app-migration-cards",10),c(8,"async"),o()()()),i&2){let e=s();x(_(12,q)),a(),x(_(13,q)),a(2),p("migrationCount",l(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),a(4),p("migrationCount",l(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var ue=(()=>{class i{constructor(){this.migrateService=f(C),this.toastr=f(I),this.refresh$=new v(void 0),this.pageTitle="Tax Account"}ngOnInit(){let e=this.refresh$.pipe(M(()=>this.migrateService.getTaxAccountCount()),S(t=>console.log("API response:",t)),y(1));this.countInPOS$=e.pipe(u(t=>Number(t.pos))),this.countInBooks$=e.pipe(u(t=>Number(t.books)))}onMigrate(){this.migrateService.migrateTaxAccount().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormat(){confirm("Are you sure you want to format?")&&this.migrateService.formatTaxAccount().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Format Successful")})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=B({type:i,selectors:[["app-tax-account"]],features:[w([C])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger",3,"onClick"],["label","Migrate","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(t,r){t&1&&(n(0,"app-main-panel",2),A(1,J,5,6,"ng-template",null,0,T)(3,K,9,14,"ng-template",null,1,T),o()),t&2&&p("pageTitle",r.pageTitle)},dependencies:[H,F,$,V,E,D,R,G,N,L,O,j],encapsulation:2})}}return i})();export{ue as TaxAccountComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n}from"./chunk-VVHTNAHQ.js";import"./chunk-C2GO6SPF.js";import"./chunk-P3V7Z3A6.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{F as e}from"./chunk-B63BKC6F.js";import{ha as o}from"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var r=()=>{let t=o(n),i=o(e);return t.isAuthenticated()&&!t.isTokenExpired()&&t.checkAuthKeysExists()?(i.navigate(["/pages/dashboard"]),!1):!0};var h=[{path:"",canActivate:[r],loadComponent:()=>import("./chunk-
|
|
1
|
+
import{a as n}from"./chunk-VVHTNAHQ.js";import"./chunk-C2GO6SPF.js";import"./chunk-P3V7Z3A6.js";import"./chunk-VFEEFGWW.js";import"./chunk-F2X3VGZZ.js";import{F as e}from"./chunk-B63BKC6F.js";import{ha as o}from"./chunk-JP6RBSB3.js";import"./chunk-YQFG5XE2.js";var r=()=>{let t=o(n),i=o(e);return t.isAuthenticated()&&!t.isTokenExpired()&&t.checkAuthKeysExists()?(i.navigate(["/pages/dashboard"]),!1):!0};var h=[{path:"",canActivate:[r],loadComponent:()=>import("./chunk-2FA22FEI.js").then(t=>t.LoginComponent)},{path:"404",loadComponent:()=>import("./chunk-VAXEGESW.js").then(t=>t.NotfoundComponent)},{path:"signup",loadComponent:()=>import("./chunk-BMBVCXB4.js").then(t=>t.SignupComponent)},{path:"504",loadComponent:()=>import("./chunk-M4Z3FI3C.js").then(t=>t.TimeoutComponent)}];export{h as AuthenticationRoutes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as A}from"./chunk-W24I5WPW.js";import{a as Ue}from"./chunk-G4XX7EU2.js";import{a as Oe,b as Be}from"./chunk-HHJMN4BS.js";import{a as He}from"./chunk-MDH73MG3.js";import{b as V}from"./chunk-XILGARZ5.js";import"./chunk-MFH4UZ6J.js";import{a as ae}from"./chunk-VVHTNAHQ.js";import"./chunk-YOUPD27G.js";import{a as ze}from"./chunk-XKI7WLHE.js";import"./chunk-AZUQDRJU.js";import"./chunk-C2GO6SPF.js";import{a as z,b as H}from"./chunk-O4QM64EH.js";import{d as ke,i as Me,j as Pe,k as je}from"./chunk-EW3R2HAB.js";import{a as Ae,b as De}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import"./chunk-PKN47FQE.js";import{a as Je,b as Ne}from"./chunk-LRRVQSMI.js";import"./chunk-42UIGXWH.js";import"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{g as Fe,h as Ve}from"./chunk-UYC454VQ.js";import{b as Ee,c as Te}from"./chunk-C7LM5UCK.js";import{a as be,b as Se}from"./chunk-J4XRJAME.js";import{a as v,b as we,c as ve,d as ye,e as Re,f as Ie}from"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{n as ge,o as he,w as xe,x as Ce}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{b as le,c as me,e as pe,f as se,k as ce,l as de,o as ue,v as fe,y as _e}from"./chunk-FMVCTBCQ.js";import"./chunk-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 T,Cb as g,Ga as k,Jc as I,Kb as c,Kc as Z,Lc as F,Mc as w,Nb as $,Ub as r,Vb as o,Wb as b,X as N,Yc as E,Z as U,_b as y,bb as L,c as D,cb as G,dc as R,ec as _,gb as m,ha as C,pa as h,qa as x,qc as p,rc as S,s as J,sc as M,uc as q,vc as Q,wb as K,wc as P,xc as X,yc as Y,zc as j}from"./chunk-JP6RBSB3.js";import{a as d,b as f}from"./chunk-YQFG5XE2.js";var Qe={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,customerID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0}},filter:{number:null,outletName:null,from:null,to:null,customerID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0}},O=we(Ie(Qe),ve(t=>({first:E(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:E(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:E(()=>t.data().data.some(a=>a.checked)),checkedARCollection:E(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),Re(t=>{let a=C(A),e=C(V);return{updateFilter(n){v(t,i=>f(d({},i),{filter:d(d({},i.filter),n)}))},onRowSelect(n){v(t,i=>{let u=i.data.data.map(s=>s.id===n.id?f(d({},s),{checked:!0}):s);return f(d({},i),{data:f(d({},i.data),{data:u})})})},onRowUnselect(n){v(t,i=>{let u=i.data.data.map(s=>s.id===n.id?f(d({},s),{checked:!1}):s);return f(d({},i),{data:f(d({},i.data),{data:u})})})},onHeaderCheckboxToggle(n){v(t,i=>{let u=i.data.data.map(s=>f(d({},s),{checked:n}));return f(d({},i),{data:f(d({},i.data),{data:u})})})},getARLoader:z(D(N(()=>a.getARJournalLoader().pipe(H({next:n=>{v(t,i=>f(d({},i),{meta:n}))},error:n=>{console.error("Error fetching AR collection loader:",n)}}))))),getARCollection:z(D(J(n=>Object.entries(n).reduce((i,[u,s])=>(s!=null&&(i[u]=s),i),{})),N(n=>a.getARJournal(n).pipe(J(i=>f(d({},i),{data:i.data.map(u=>f(d({},u),{due:e.from(u.due)?e.from(u.due).format():null,checked:!1}))})),H({next:i=>{v(t,u=>f(d({},u),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),ye(t=>({onInit:()=>{t.getARLoader(),t.getARCollection(t.filter)}})));var Xe=()=>({height:"calc(100vh - 70px)"}),B=t=>({"ng-invalid ng-dirty":t}),Ye=()=>({});function Ze(t,a){if(t&1){let e=y();r(0,"p-button",10),R("onClick",function(){h(e);let n=_(2);return x(n.onCreateJournal())}),o()}}function et(t,a){if(t&1&&g(0,Ze,1,0,"p-button",9),t&2){let e=_();c("ngIf",e.store.hasCheckedRows())}}function tt(t,a){t&1&&(r(0,"tr")(1,"th",12),b(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),p(4,"Outlet"),o(),r(5,"th",14),p(6,"Number"),o(),r(7,"th",15),p(8,"Customer"),o(),r(9,"th",16),p(10,"Date"),o(),r(11,"th",16),p(12,"Due"),o(),r(13,"th",15),p(14,"Note"),o(),r(15,"th",17),p(16,"Payment"),o(),b(17,"th",12),o())}function it(t,a){if(t&1&&(r(0,"tr")(1,"td"),b(2,"p-tableCheckbox",18),o(),r(3,"td"),p(4),o(),r(5,"td")(6,"a",19),p(7),o()(),r(8,"td"),p(9),o(),r(10,"td"),p(11),I(12,"date"),o(),r(13,"td"),p(14),I(15,"date"),o(),r(16,"td"),b(17,"div",20),o(),r(18,"td"),p(19),o(),r(20,"td"),b(21,"p-button",21),o()()),t&2){let e=a.$implicit,l=_(2);m(2),c("value",e),m(2),S(e.outlet),m(2),c("href",l.authService.getTenantExternalURL()+"/menu/Debt/Debt/Join_Invoice/New_Join_Invoice/Info?ID="+e.id,G),m(),M(" ",e.number," "),m(2),S(e.customer),m(2),S(F(12,12,e.date,"d MMM y")),m(3),S(e.due?F(15,15,e.due,"d MMM y hh:mm"):"-"),m(3),c("innerHTML",e.note,L),m(2),S(e.payment),m(2),c("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function nt(t,a){if(t&1&&p(0),t&2){let e=_(2);q(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function ot(t,a){t&1&&(r(0,"tr")(1,"td",22)(2,"span"),p(3,"No records found."),o()()())}function rt(t,a){if(t&1){let e=y();r(0,"p-panel")(1,"p-table",11),R("onPage",function(n){h(e);let i=_();return x(i.onPageChange(n))})("onHeaderCheckboxToggle",function(n){h(e);let i=_();return x(i.onHeaderCheckboxToggle(n))})("onRowSelect",function(n){h(e);let i=_();return x(i.onRowSelect(n))})("onRowUnselect",function(n){h(e);let i=_();return x(i.onRowUnselect(n))}),g(2,tt,18,0,"ng-template",null,3,w)(4,it,22,18,"ng-template",null,4,w)(6,nt,1,3,"ng-template",null,5,w)(8,ot,4,0,"ng-template",null,6,w),o()()}if(t&2){let e=_();$(j(9,Xe)),m(),c("value",e.store.data().data)("scrollable",!0)("scrollHeight","calc(100vh - 142px)")("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function at(t,a){if(t&1&&(r(0,"span",32),p(1),I(2,"truncate"),o()),t&2){let e=a.$implicit;c("pTooltip",e.name),m(),M(" ",F(2,2,e.name,30)," ")}}function lt(t,a){if(t&1&&(r(0,"div")(1,"span",34),p(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function mt(t,a){if(t&1&&(r(0,"div"),g(1,lt,3,1,"div",33),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("from"))}}function pt(t,a){if(t&1&&(r(0,"div")(1,"span",34),p(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function st(t,a){if(t&1&&(r(0,"div"),g(1,pt,3,1,"div",33),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("to"))}}function ct(t,a){if(t&1&&(r(0,"div")(1,"span",34),p(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function dt(t,a){if(t&1&&(r(0,"div"),g(1,ct,3,1,"div",33),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("pageSize"))}}function ut(t,a){if(t&1){let e=y();r(0,"form",23)(1,"div",24)(2,"label",25),p(3,"Outlet"),o(),r(4,"p-select",26),g(5,at,3,5,"ng-template",null,7,w),o()(),r(7,"div",24)(8,"label",25),p(9,"From"),o(),b(10,"p-datepicker",27),g(11,mt,2,1,"div",28),o(),r(12,"div",24)(13,"label",25),p(14,"To"),o(),b(15,"p-datepicker",29),g(16,st,2,1,"div",28),o(),r(17,"div",24)(18,"label",25),p(19,"Customer"),o(),r(20,"p-autocomplete",30),I(21,"async"),R("completeMethod",function(n){h(e);let i=_();return x(i.onSearchContact(n))}),o()(),r(22,"div",24)(23,"label",25),p(24,"Page Size"),o(),b(25,"input",31),g(26,dt,2,1,"div",28),o()()}if(t&2){let e=_();c("formGroup",e.form),m(4),c("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),m(6),c("iconDisplay","input")("showIcon",!0)("ngClass",T(17,B,e.isInvalid("from"))),m(),c("ngIf",e.isInvalid("from")),m(4),c("iconDisplay","input")("showIcon",!0)("ngClass",T(19,B,e.isInvalid("to"))),m(),c("ngIf",e.isInvalid("to")),m(4),c("suggestions",Z(21,15,e.customerSuggestions$)),m(5),c("autoNumeric",j(21,Ye))("ngClass",T(22,B,e.isInvalid("pageSize"))),m(),c("ngIf",e.isInvalid("pageSize"))}}var ni=(()=>{class t extends ze{constructor(){super(),this.store=C(O),this.generateJournalService=C(A),this.authService=C(ae),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=C(fe),this.dayjsService=C(V)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:l,to:n,pageNumber:i,rowCount:u,pageSize:s,export:Le,exportPageNumber:Ge,exportRowCount:Ke,outletName:We,customerID:$e,paymentState:qe}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),from:this.fb.control(this.dayjsService.from(l)?this.dayjsService.from(l).toDate():null),to:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),pageNumber:this.fb.control(i),rowCount:this.fb.control(u),pageSize:this.fb.control(s,[me.required]),export:this.fb.control(Le),exportPageNumber:this.fb.control(Ge),exportRowCount:this.fb.control(Ke),outletName:this.fb.control(We),customerID:this.fb.control($e),paymentState:this.fb.control(qe)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((l,[n,i])=>{switch(n){case"customerID":i||(l[n]=Ue);break;case"from":typeof i=="object"?l[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:l[n]=i!=null?String(i):null;break;case"to":typeof i=="object"?l[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:l[n]=i!=null?String(i):null;break;default:l[n]=i===null?"":i;break}return l},{});console.log("Filter Body:",e),this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}onSearchContact(e){this.customerSuggestions$=this.generateJournalService.getCustomerSuggestions(e.query)}onSearch(e){this.store.updateFilter(f(d({},this.store.filter()),{number:e,pageNumber:1})),this.store.getARCollection(this.store.filter())}onPageChange(e){let l=e.first/e.rows;this.store.updateFilter(f(d({},this.store.filter()),{pageNumber:l+1}))}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(l=>{this.store.onRowUnselect(l)});return}else this.store.onRowUnselect(e.data)}onCreateJournal(){this.generateJournalService.createARJournal(this.store.checkedARCollection()).pipe(U(()=>this.store.getARCollection(this.store.filter))).subscribe()}static{this.\u0275fac=function(l){return new(l||t)}}static{this.\u0275cmp=K({type:t,selectors:[["app-ar-journal"]],features:[Y([O]),W],decls:8,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","AR Collection",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onHeaderCheckboxToggle","onRowSelect","onRowUnselect","value","scrollable","scrollHeight","paginator","rows","totalRecords","lazy"],[2,"width","4rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"innerHTML"],[3,"icon","severity","text"],["colspan","9"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["virtualScroll","","showClear","","filter","","filterBy","name","formControlName","outletName","appendTo","body","optionLabel","name","optionValue","name","placeholder","Select an Outlet",3,"virtualScrollItemSize","options"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["showClear","","formControlName","customerID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(l,n){if(l&1){let i=y();r(0,"app-main-panel",8),X("isDialogFilterVisibleChange",function(s){return h(i),P(n.isDialogFilterVisible,s)||(n.isDialogFilterVisible=s),x(s)})("isInitDialogFilterVisibleChange",function(s){return h(i),P(n.isInitDialogFilterVisible,s)||(n.isInitDialogFilterVisible=s),x(s)}),R("filterConfirmed",function(){return h(i),x(n.onFilterOKEvent())})("search",function(s){return h(i),x(n.onSearch(s))}),g(1,et,1,1,"ng-template",null,0,w)(3,rt,10,10,"ng-template",null,1,w),p(5," <"),g(6,ut,27,24,"ng-template",null,2,w),o()}l&2&&(c("isSearchableInput",!0)("isFilterable",!0),Q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[Ve,re,ee,te,ie,ne,oe,je,ke,Me,Pe,Ce,xe,Se,be,_e,ce,le,pe,se,de,ue,Ne,Je,De,Ae,Be,Oe,he,ge,Fe,Te,Ee,He],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{ni as ARJournalComponent};
|
|
1
|
+
import{a as A}from"./chunk-W24I5WPW.js";import{a as Ue}from"./chunk-G4XX7EU2.js";import{a as Oe,b as Be}from"./chunk-HHJMN4BS.js";import{a as He}from"./chunk-MDH73MG3.js";import{b as V}from"./chunk-BGWDOZQM.js";import"./chunk-VZI3JZPU.js";import{a as ae}from"./chunk-VVHTNAHQ.js";import"./chunk-YOUPD27G.js";import{a as ze}from"./chunk-XKI7WLHE.js";import"./chunk-AZUQDRJU.js";import"./chunk-C2GO6SPF.js";import{a as z,b as H}from"./chunk-O4QM64EH.js";import{d as ke,i as Me,j as Pe,k as je}from"./chunk-EW3R2HAB.js";import{a as Ae,b as De}from"./chunk-OLOVFS3Y.js";import"./chunk-QCLAOAVG.js";import"./chunk-Q33XIUDN.js";import"./chunk-PKN47FQE.js";import{a as Je,b as Ne}from"./chunk-LRRVQSMI.js";import"./chunk-42UIGXWH.js";import"./chunk-NA5YXAMJ.js";import"./chunk-253IFSMV.js";import"./chunk-QYXQYPHB.js";import"./chunk-FBEBMNVC.js";import"./chunk-6NGIQJIP.js";import"./chunk-YDEVG4CR.js";import{g as Fe,h as Ve}from"./chunk-UYC454VQ.js";import{b as Ee,c as Te}from"./chunk-C7LM5UCK.js";import{a as be,b as Se}from"./chunk-J4XRJAME.js";import{a as v,b as we,c as ve,d as ye,e as Re,f as Ie}from"./chunk-JBSIAXM5.js";import"./chunk-GH5Z5SPB.js";import{n as ge,o as he,w as xe,x as Ce}from"./chunk-67VPWIWW.js";import"./chunk-BHV2HCJY.js";import{b as le,c as me,e as pe,f as se,k as ce,l as de,o as ue,v as fe,y as _e}from"./chunk-FMVCTBCQ.js";import"./chunk-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 T,Cb as g,Ga as k,Jc as I,Kb as c,Kc as Z,Lc as F,Mc as w,Nb as $,Ub as r,Vb as o,Wb as b,X as N,Yc as E,Z as U,_b as y,bb as L,c as D,cb as G,dc as R,ec as _,gb as m,ha as C,pa as h,qa as x,qc as p,rc as S,s as J,sc as M,uc as q,vc as Q,wb as K,wc as P,xc as X,yc as Y,zc as j}from"./chunk-JP6RBSB3.js";import{a as d,b as f}from"./chunk-YQFG5XE2.js";var Qe={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,customerID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0}},filter:{number:null,outletName:null,from:null,to:null,customerID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0}},O=we(Ie(Qe),ve(t=>({first:E(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:E(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:E(()=>t.data().data.some(a=>a.checked)),checkedARCollection:E(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),Re(t=>{let a=C(A),e=C(V);return{updateFilter(n){v(t,i=>f(d({},i),{filter:d(d({},i.filter),n)}))},onRowSelect(n){v(t,i=>{let u=i.data.data.map(s=>s.id===n.id?f(d({},s),{checked:!0}):s);return f(d({},i),{data:f(d({},i.data),{data:u})})})},onRowUnselect(n){v(t,i=>{let u=i.data.data.map(s=>s.id===n.id?f(d({},s),{checked:!1}):s);return f(d({},i),{data:f(d({},i.data),{data:u})})})},onHeaderCheckboxToggle(n){v(t,i=>{let u=i.data.data.map(s=>f(d({},s),{checked:n}));return f(d({},i),{data:f(d({},i.data),{data:u})})})},getARLoader:z(D(N(()=>a.getARJournalLoader().pipe(H({next:n=>{v(t,i=>f(d({},i),{meta:n}))},error:n=>{console.error("Error fetching AR collection loader:",n)}}))))),getARCollection:z(D(J(n=>Object.entries(n).reduce((i,[u,s])=>(s!=null&&(i[u]=s),i),{})),N(n=>a.getARJournal(n).pipe(J(i=>f(d({},i),{data:i.data.map(u=>f(d({},u),{due:e.from(u.due)?e.from(u.due).format():null,checked:!1}))})),H({next:i=>{v(t,u=>f(d({},u),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),ye(t=>({onInit:()=>{t.getARLoader(),t.getARCollection(t.filter)}})));var Xe=()=>({height:"calc(100vh - 70px)"}),B=t=>({"ng-invalid ng-dirty":t}),Ye=()=>({});function Ze(t,a){if(t&1){let e=y();r(0,"p-button",10),R("onClick",function(){h(e);let n=_(2);return x(n.onCreateJournal())}),o()}}function et(t,a){if(t&1&&g(0,Ze,1,0,"p-button",9),t&2){let e=_();c("ngIf",e.store.hasCheckedRows())}}function tt(t,a){t&1&&(r(0,"tr")(1,"th",12),b(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),p(4,"Outlet"),o(),r(5,"th",14),p(6,"Number"),o(),r(7,"th",15),p(8,"Customer"),o(),r(9,"th",16),p(10,"Date"),o(),r(11,"th",16),p(12,"Due"),o(),r(13,"th",15),p(14,"Note"),o(),r(15,"th",17),p(16,"Payment"),o(),b(17,"th",12),o())}function it(t,a){if(t&1&&(r(0,"tr")(1,"td"),b(2,"p-tableCheckbox",18),o(),r(3,"td"),p(4),o(),r(5,"td")(6,"a",19),p(7),o()(),r(8,"td"),p(9),o(),r(10,"td"),p(11),I(12,"date"),o(),r(13,"td"),p(14),I(15,"date"),o(),r(16,"td"),b(17,"div",20),o(),r(18,"td"),p(19),o(),r(20,"td"),b(21,"p-button",21),o()()),t&2){let e=a.$implicit,l=_(2);m(2),c("value",e),m(2),S(e.outlet),m(2),c("href",l.authService.getTenantExternalURL()+"/menu/Debt/Debt/Join_Invoice/New_Join_Invoice/Info?ID="+e.id,G),m(),M(" ",e.number," "),m(2),S(e.customer),m(2),S(F(12,12,e.date,"d MMM y")),m(3),S(e.due?F(15,15,e.due,"d MMM y hh:mm"):"-"),m(3),c("innerHTML",e.note,L),m(2),S(e.payment),m(2),c("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function nt(t,a){if(t&1&&p(0),t&2){let e=_(2);q(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function ot(t,a){t&1&&(r(0,"tr")(1,"td",22)(2,"span"),p(3,"No records found."),o()()())}function rt(t,a){if(t&1){let e=y();r(0,"p-panel")(1,"p-table",11),R("onPage",function(n){h(e);let i=_();return x(i.onPageChange(n))})("onHeaderCheckboxToggle",function(n){h(e);let i=_();return x(i.onHeaderCheckboxToggle(n))})("onRowSelect",function(n){h(e);let i=_();return x(i.onRowSelect(n))})("onRowUnselect",function(n){h(e);let i=_();return x(i.onRowUnselect(n))}),g(2,tt,18,0,"ng-template",null,3,w)(4,it,22,18,"ng-template",null,4,w)(6,nt,1,3,"ng-template",null,5,w)(8,ot,4,0,"ng-template",null,6,w),o()()}if(t&2){let e=_();$(j(9,Xe)),m(),c("value",e.store.data().data)("scrollable",!0)("scrollHeight","calc(100vh - 142px)")("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function at(t,a){if(t&1&&(r(0,"span",32),p(1),I(2,"truncate"),o()),t&2){let e=a.$implicit;c("pTooltip",e.name),m(),M(" ",F(2,2,e.name,30)," ")}}function lt(t,a){if(t&1&&(r(0,"div")(1,"span",34),p(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function mt(t,a){if(t&1&&(r(0,"div"),g(1,lt,3,1,"div",33),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("from"))}}function pt(t,a){if(t&1&&(r(0,"div")(1,"span",34),p(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function st(t,a){if(t&1&&(r(0,"div"),g(1,pt,3,1,"div",33),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("to"))}}function ct(t,a){if(t&1&&(r(0,"div")(1,"span",34),p(2),o()()),t&2){let e=a.$implicit;m(2),S(e)}}function dt(t,a){if(t&1&&(r(0,"div"),g(1,ct,3,1,"div",33),o()),t&2){let e=_(2);m(),c("ngForOf",e.getErrors("pageSize"))}}function ut(t,a){if(t&1){let e=y();r(0,"form",23)(1,"div",24)(2,"label",25),p(3,"Outlet"),o(),r(4,"p-select",26),g(5,at,3,5,"ng-template",null,7,w),o()(),r(7,"div",24)(8,"label",25),p(9,"From"),o(),b(10,"p-datepicker",27),g(11,mt,2,1,"div",28),o(),r(12,"div",24)(13,"label",25),p(14,"To"),o(),b(15,"p-datepicker",29),g(16,st,2,1,"div",28),o(),r(17,"div",24)(18,"label",25),p(19,"Customer"),o(),r(20,"p-autocomplete",30),I(21,"async"),R("completeMethod",function(n){h(e);let i=_();return x(i.onSearchContact(n))}),o()(),r(22,"div",24)(23,"label",25),p(24,"Page Size"),o(),b(25,"input",31),g(26,dt,2,1,"div",28),o()()}if(t&2){let e=_();c("formGroup",e.form),m(4),c("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),m(6),c("iconDisplay","input")("showIcon",!0)("ngClass",T(17,B,e.isInvalid("from"))),m(),c("ngIf",e.isInvalid("from")),m(4),c("iconDisplay","input")("showIcon",!0)("ngClass",T(19,B,e.isInvalid("to"))),m(),c("ngIf",e.isInvalid("to")),m(4),c("suggestions",Z(21,15,e.customerSuggestions$)),m(5),c("autoNumeric",j(21,Ye))("ngClass",T(22,B,e.isInvalid("pageSize"))),m(),c("ngIf",e.isInvalid("pageSize"))}}var ni=(()=>{class t extends ze{constructor(){super(),this.store=C(O),this.generateJournalService=C(A),this.authService=C(ae),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=C(fe),this.dayjsService=C(V)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:l,to:n,pageNumber:i,rowCount:u,pageSize:s,export:Le,exportPageNumber:Ge,exportRowCount:Ke,outletName:We,customerID:$e,paymentState:qe}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),from:this.fb.control(this.dayjsService.from(l)?this.dayjsService.from(l).toDate():null),to:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),pageNumber:this.fb.control(i),rowCount:this.fb.control(u),pageSize:this.fb.control(s,[me.required]),export:this.fb.control(Le),exportPageNumber:this.fb.control(Ge),exportRowCount:this.fb.control(Ke),outletName:this.fb.control(We),customerID:this.fb.control($e),paymentState:this.fb.control(qe)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((l,[n,i])=>{switch(n){case"customerID":i||(l[n]=Ue);break;case"from":typeof i=="object"?l[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:l[n]=i!=null?String(i):null;break;case"to":typeof i=="object"?l[n]=this.dayjsService.from(i)?this.dayjsService.format(i):null:l[n]=i!=null?String(i):null;break;default:l[n]=i===null?"":i;break}return l},{});console.log("Filter Body:",e),this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}onSearchContact(e){this.customerSuggestions$=this.generateJournalService.getCustomerSuggestions(e.query)}onSearch(e){this.store.updateFilter(f(d({},this.store.filter()),{number:e,pageNumber:1})),this.store.getARCollection(this.store.filter())}onPageChange(e){let l=e.first/e.rows;this.store.updateFilter(f(d({},this.store.filter()),{pageNumber:l+1}))}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(l=>{this.store.onRowUnselect(l)});return}else this.store.onRowUnselect(e.data)}onCreateJournal(){this.generateJournalService.createARJournal(this.store.checkedARCollection()).pipe(U(()=>this.store.getARCollection(this.store.filter))).subscribe()}static{this.\u0275fac=function(l){return new(l||t)}}static{this.\u0275cmp=K({type:t,selectors:[["app-ar-journal"]],features:[Y([O]),W],decls:8,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","AR Collection",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onHeaderCheckboxToggle","onRowSelect","onRowUnselect","value","scrollable","scrollHeight","paginator","rows","totalRecords","lazy"],[2,"width","4rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"innerHTML"],[3,"icon","severity","text"],["colspan","9"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["virtualScroll","","showClear","","filter","","filterBy","name","formControlName","outletName","appendTo","body","optionLabel","name","optionValue","name","placeholder","Select an Outlet",3,"virtualScrollItemSize","options"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["showClear","","formControlName","customerID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(l,n){if(l&1){let i=y();r(0,"app-main-panel",8),X("isDialogFilterVisibleChange",function(s){return h(i),P(n.isDialogFilterVisible,s)||(n.isDialogFilterVisible=s),x(s)})("isInitDialogFilterVisibleChange",function(s){return h(i),P(n.isInitDialogFilterVisible,s)||(n.isInitDialogFilterVisible=s),x(s)}),R("filterConfirmed",function(){return h(i),x(n.onFilterOKEvent())})("search",function(s){return h(i),x(n.onSearch(s))}),g(1,et,1,1,"ng-template",null,0,w)(3,rt,10,10,"ng-template",null,1,w),p(5," <"),g(6,ut,27,24,"ng-template",null,2,w),o()}l&2&&(c("isSearchableInput",!0)("isFilterable",!0),Q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[Ve,re,ee,te,ie,ne,oe,je,ke,Me,Pe,Ce,xe,Se,be,_e,ce,le,pe,se,de,ue,Ne,Je,De,Ae,Be,Oe,he,ge,Fe,Te,Ee,He],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{ni as ARJournalComponent};
|
|
@@ -1 +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-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-BGWDOZQM.js";import"./chunk-VZI3JZPU.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 +1 @@
|
|
|
1
|
-
var e={production:!0,version:"5.32.
|
|
1
|
+
var e={production:!0,version:"5.32.1",changelogUrl:"https://changelog.dealpos.com/?categories=cat_O6pYAT7GI1mts",defaultTimezone:"Asia/Jakarta"};export{e as a};
|