dealposbooks 5.49.0 → 5.49.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/{chunk-KSPR5HTA.js → chunk-2BTS7BEP.js} +1 -1
  2. package/{chunk-6RB67IF5.js → chunk-2RI2WRFG.js} +1 -1
  3. package/{chunk-XLEICBBP.js → chunk-33JUCBXH.js} +1 -1
  4. package/{chunk-ZIZHSXQM.js → chunk-3LOZ6OKX.js} +1 -1
  5. package/{chunk-XVAFZB6H.js → chunk-4YH7A4M6.js} +1 -1
  6. package/{chunk-K4IULEBH.js → chunk-66YEZ4LP.js} +1 -1
  7. package/{chunk-UHOHG6YG.js → chunk-6KSTIWOD.js} +1 -1
  8. package/{chunk-TFW2HBFA.js → chunk-7NY7TIU4.js} +1 -1
  9. package/{chunk-ADODNO5M.js → chunk-7P5XATXL.js} +1 -1
  10. package/{chunk-L6PLE5U4.js → chunk-ADC7G7M6.js} +1 -1
  11. package/{chunk-O7PTQ6FD.js → chunk-B4CNCOTT.js} +1 -1
  12. package/{chunk-7HVUWEG2.js → chunk-BVXHSTT4.js} +1 -1
  13. package/{chunk-5YGRLXFR.js → chunk-BZUZKZY4.js} +1 -1
  14. package/{chunk-Q3HB53OC.js → chunk-C4W7XYJD.js} +1 -1
  15. package/{chunk-CLWQ53HX.js → chunk-CIPN4BTQ.js} +1 -1
  16. package/{chunk-WTU5HM6J.js → chunk-EEQIJSRK.js} +2 -2
  17. package/chunk-EOU5D6FS.js +1 -0
  18. package/{chunk-IW7TNRJO.js → chunk-F4WXASVJ.js} +1 -1
  19. package/{chunk-AOQH3HTB.js → chunk-F6G7POPA.js} +1 -1
  20. package/{chunk-O54WM4PU.js → chunk-GWKQHO7M.js} +1 -1
  21. package/{chunk-VCUOMA7I.js → chunk-HA7LLTOG.js} +1 -1
  22. package/{chunk-4KDA7ZRZ.js → chunk-HY3WGTQF.js} +1 -1
  23. package/{chunk-A5Q65V4N.js → chunk-JD4TR3G6.js} +1 -1
  24. package/{chunk-HECYO7RI.js → chunk-JJ2G2ITS.js} +1 -1
  25. package/{chunk-OQRWMLXY.js → chunk-KDCDSUGW.js} +1 -1
  26. package/{chunk-U57VXKUE.js → chunk-KGZUIHAZ.js} +1 -1
  27. package/{chunk-ER5Y4FMF.js → chunk-L7WPJUZ6.js} +1 -1
  28. package/{chunk-OPSSYJMR.js → chunk-LO2GGXGQ.js} +1 -1
  29. package/{chunk-JLFNJ2HH.js → chunk-LXHUCAAY.js} +1 -1
  30. package/{chunk-QJGYGXL3.js → chunk-M5M3M3GU.js} +1 -1
  31. package/{chunk-2A5KXVYV.js → chunk-MGGC32PD.js} +2 -2
  32. package/{chunk-ERG2YCYC.js → chunk-MQPKGA4I.js} +1 -1
  33. package/{chunk-WUMR7VK2.js → chunk-OARM3UHP.js} +1 -1
  34. package/{chunk-LOLOGGWA.js → chunk-P5ICG7YE.js} +1 -1
  35. package/{chunk-MV52MU2A.js → chunk-Q52A3GQ5.js} +1 -1
  36. package/{chunk-IMQMRA4Y.js → chunk-RIBVS2ZL.js} +1 -1
  37. package/{chunk-4ZU2FOSO.js → chunk-RTMNVCIM.js} +1 -1
  38. package/{chunk-TON77VSP.js → chunk-S72FLLKS.js} +1 -1
  39. package/{chunk-ULAE6ZMS.js → chunk-TG6Y7ANZ.js} +1 -1
  40. package/{chunk-J3R2TUSM.js → chunk-TJQSE35W.js} +1 -1
  41. package/{chunk-SWU3XDYQ.js → chunk-TSPM6IPU.js} +1 -1
  42. package/{chunk-2RHKXE62.js → chunk-ULBVUV32.js} +1 -1
  43. package/{chunk-OZXIWJFE.js → chunk-UM2HOJJR.js} +1 -1
  44. package/{chunk-STBJVKOH.js → chunk-W6V2QFA7.js} +1 -1
  45. package/{chunk-5M5KVWZB.js → chunk-WBGCOYQJ.js} +1 -1
  46. package/{chunk-WDT3X7BX.js → chunk-X57GOVJJ.js} +1 -1
  47. package/{chunk-O3XDMCQO.js → chunk-YSZN7YTG.js} +2 -2
  48. package/{chunk-ZXJEHHMR.js → chunk-YUS2B7BT.js} +1 -1
  49. package/{chunk-2RKPDCYU.js → chunk-ZVEQIMYP.js} +1 -1
  50. package/index.html +2 -2
  51. package/{main-P47IKABJ.js → main-OZKRZLSC.js} +1 -1
  52. package/package.json +1 -1
  53. package/chunk-AJA5W4PQ.js +0 -1
@@ -1 +1 @@
1
- import{a as D}from"./chunk-OPSSYJMR.js";import{a as it}from"./chunk-G4XX7EU2.js";import{a as Pe}from"./chunk-KZHI6PGZ.js";import{a as Ue,b as He}from"./chunk-UVSR4LPB.js";import{a as te}from"./chunk-6RB67IF5.js";import{b as N}from"./chunk-XLEICBBP.js";import{a as Me}from"./chunk-XKI7WLHE.js";import{a as Ge,b as Be}from"./chunk-VDXZGF3M.js";import"./chunk-MHRSQRHT.js";import"./chunk-U2VDC52W.js";import{a as z,b as j}from"./chunk-3VQUNDVT.js";import{d as ke,i as Je,j as Ne,k as Re}from"./chunk-DGACZ747.js";import{a as Ee,b as Te}from"./chunk-EBEY2MBR.js";import"./chunk-AMGBUOC4.js";import"./chunk-UPSNJEHO.js";import{a as Ve}from"./chunk-BT7Y4ADP.js";import"./chunk-VKNINE5Q.js";import"./chunk-E7QWESN4.js";import{a as Fe,b as De}from"./chunk-AN4SAUSA.js";import"./chunk-URH77XNK.js";import"./chunk-PPXXWO4E.js";import"./chunk-3DBSHDAQ.js";import"./chunk-M4SSELXT.js";import"./chunk-QPPFPDWZ.js";import"./chunk-WMZF4DQK.js";import{i as Ie}from"./chunk-ADODNO5M.js";import"./chunk-S27Z7D3D.js";import{a as _e,b as ge}from"./chunk-AD247LWQ.js";import{a as xe,b as y,c as Ce,d as be,e as ve,f as ye,g as we,h as tt}from"./chunk-BKTBVFNX.js";import"./chunk-ZFNIPERQ.js";import{n as ce,o as de,w as ue,x as fe,y as he,z as Se}from"./chunk-ME4ALIS7.js";import"./chunk-DTYVTTET.js";import{b as ie,c as ne,e as oe,f as re,k as le,l as ae,o as pe,u as me,x as se}from"./chunk-VMI3QWC6.js";import"./chunk-F7PVAVLQ.js";import"./chunk-Q3HB53OC.js";import"./chunk-5DRALZZF.js";import"./chunk-2BI7WNJP.js";import{h as $,j as Q,k as X,n as et,p as Y,q as Z,s as ee}from"./chunk-ZK43JB4A.js";import"./chunk-F2X3VGZZ.js";import{Cb as L,Dc as q,Eb as g,Fc as V,Ha as k,Mb as s,Oc as w,Pc as P,Qc as F,Sc as b,Wb as l,Xb as o,Y as B,Yb as x,_ as G,ac as E,bd as I,c as R,eb as U,fc as T,gc as _,ia as v,ib as a,qa as h,ra as S,s as O,sc as m,tc as C,ua as Ze,uc as J,wc as A,xc as W,yb as H,yc as M,zc as K}from"./chunk-6QJHEOXN.js";import{a as c,b as d}from"./chunk-YQFG5XE2.js";var gt={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,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4}},filter:{number:null,outletName:null,paymentState:0,deliveryState:0,from:null,to:null,customerID:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4}},Ke=Ce(we(gt),be(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))})),ye(t=>{let p=v(D),e=v(N);return{updateFilter(n){y(t,i=>d(c({},i),{filter:c(c({},i.filter),n),skipRequestFirst:!1}))},onRowSelect(n){y(t,i=>{let f=i.data.data.map(u=>u.id===n.id?d(c({},u),{checked:!0}):u);return d(c({},i),{data:d(c({},i.data),{data:f})})})},onRowUnselect(n){y(t,i=>{let f=i.data.data.map(u=>u.id===n.id?d(c({},u),{checked:!1}):u);return d(c({},i),{data:d(c({},i.data),{data:f})})})},onHeaderCheckboxToggle(n){y(t,i=>{let f=i.data.data.map(u=>d(c({},u),{checked:n}));return d(c({},i),{data:d(c({},i.data),{data:f})})})},getCustomerInvoice:z(R(O(n=>Object.entries(n).reduce((i,[f,u])=>(u!=null&&(i[f]=u),i),{})),B(n=>p.getJournalInvoice(n).pipe(O(i=>d(c({},i),{data:i.data.map(f=>d(c({},f),{due:e.from(f.due)?e.from(f.due).format():null,checked:!1}))})),Ve("getCustomerInvoice"),j({next:i=>{y(t,f=>d(c({},f),{data:d(c({},f.data),{data:i.data,totalCount:i.totalCount})}))},error:i=>{console.error("Error fetching customer invoice:",i)}}))))),getCustomerInvoiceLoader:z(R(B(()=>p.getJournalInvoiceLoader().pipe(j({next:n=>{y(t,i=>d(c({},i),{meta:n}))},error:n=>{console.error("Error fetching customer invoice loader:",n)}})))))}}),ve(t=>({onInit:()=>{t.getCustomerInvoiceLoader(),t.getCustomerInvoice(t.filter)}})));var qe=t=>({"ng-invalid ng-dirty":t});function xt(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 Ct(t,p){if(t&1&&g(0,xt,1,0,"p-button",9),t&2){let e=_();s("ngIf",e.store.hasCheckedRows())}}function bt(t,p){t&1&&(l(0,"tr")(1,"th",12),x(2,"p-tableHeaderCheckbox"),o(),l(3,"th",13),m(4,"Tag"),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(),x(19,"th",18),o())}function vt(t,p){if(t&1&&(l(0,"tr")(1,"td"),x(2,"p-tableCheckbox",19),o(),l(3,"td"),m(4),o(),l(5,"td")(6,"a",20),m(7),o()(),l(8,"td")(9,"a",20),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"),x(21,"p-chip",21),o(),l(22,"td"),x(23,"p-chip",21),o(),l(24,"td"),x(25,"p-button",22),o()()),t&2){let e=p.$implicit,r=_(2);a(2),s("value",e),a(2),C(e.outlet),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Orders/Orders/Customer_Invoice/Info?ID="+e.id,U),a(),J(" ",e.number," "),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.customerID,U),a(),J(" ",e.customer," "),a(2),C(F(13,14,e.date,"d MMM y hh:mm")),a(3),C(e.due?F(16,17,e.due,"d MMM y hh:mm"):"-"),a(3),C(P(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 yt(t,p){if(t&1&&m(0),t&2){let e=_(2);A(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function wt(t,p){t&1&&(l(0,"tr")(1,"td",23)(2,"span"),m(3,"No records found."),o()()())}function It(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,bt,20,0,"ng-template",null,3,b)(4,vt,26,22,"ng-template",null,4,b)(6,yt,1,3,"ng-template",null,5,b)(8,wt,4,0,"ng-template",null,6,b),o()()}if(t&2){let e=_();a(),s("lazy",!0)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("value",e.store.data().data)}}function Et(t,p){if(t&1&&(l(0,"span",36),m(1),w(2,"truncate"),o()),t&2){let e=p.$implicit;s("pTooltip",e.name),a(),J(" ",F(2,2,e.name,30)," ")}}function Tt(t,p){if(t&1&&(l(0,"div")(1,"span",38),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function Vt(t,p){if(t&1&&(l(0,"div"),g(1,Tt,3,1,"div",37),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("from"))}}function Ft(t,p){if(t&1&&(l(0,"div")(1,"span",38),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function Dt(t,p){if(t&1&&(l(0,"div"),g(1,Ft,3,1,"div",37),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("to"))}}function kt(t,p){if(t&1&&(l(0,"div")(1,"span",38),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function Jt(t,p){if(t&1&&(l(0,"div"),g(1,kt,3,1,"div",37),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("pageSize"))}}function Nt(t,p){if(t&1){let e=E();l(0,"form",24)(1,"div",25)(2,"label",26),m(3,"Tag"),o(),l(4,"p-select",27),g(5,Et,3,5,"ng-template",null,7,b),o()(),l(7,"div",25)(8,"label",26),m(9,"Payment"),o(),x(10,"p-select",28),o(),l(11,"div",25)(12,"label",26),m(13,"Delivery"),o(),x(14,"p-select",29),o(),l(15,"div",25)(16,"label",26),m(17,"From - To"),o(),l(18,"div",30),x(19,"p-datepicker",31),g(20,Vt,2,1,"div",32),x(21,"p-datepicker",33),g(22,Dt,2,1,"div",32),o()(),l(23,"div",25)(24,"label",26),m(25,"Customer"),o(),l(26,"p-autocomplete",34),T("completeMethod",function(n){h(e);let i=_();return S(i.onSearchContact(n))}),o()(),l(27,"div",25)(28,"label",26),m(29,"Page Size"),o(),x(30,"input",35),g(31,Jt,2,1,"div",32),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(5),s("iconDisplay","input")("showIcon",!0)("ngClass",V(16,qe,e.isInvalid("from"))),a(),s("ngIf",e.isInvalid("from")),a(),s("iconDisplay","input")("showIcon",!0)("ngClass",V(18,qe,e.isInvalid("to"))),a(),s("ngIf",e.isInvalid("to")),a(4),s("suggestions",e.customerSuggestions()),a(4),s("ngClass",V(20,qe,e.isInvalid("pageSize"))),a(),s("ngIf",e.isInvalid("pageSize"))}}var ut=(()=>{class t extends Me{constructor(){super(...arguments),this.store=v(Ke),this.dayjsService=v(N),this.generateJournalService=v(D),this.authService=v(te),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.customerSuggestions=k([]),this.fb=v(me)}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:u,customerID:ze,pageNumber:je,pageSize:Oe,export:Le,exportPageNumber:Ae,exportPageSize:We}=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(u)?this.dayjsService.from(u).toDate():null),customerID:this.fb.control(ze),pageNumber:this.fb.control(je),pageSize:this.fb.control(Oe,[ne.required]),export:this.fb.control(Le),exportPageNumber:this.fb.control(Ae),exportPageSize:this.fb.control(We)})}onSearchContact(e){let{query:r}=e;this.generateJournalService.getCustomerSuggestions(r).pipe(Ve("Customer Suggestions"),G(n=>{this.customerSuggestions.set(n)})).subscribe()}onSearch(e){this.store.updateFilter(d(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(d(c({},this.store.filter()),{pageNumber:r+1}))}onGenerateJournal(){this.generateJournalService.generateJournalInvoice(this.store.checkedInvoice()).pipe(G(()=>{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]=it);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=Ze(t)))(n||t)}})()}static{this.\u0275cmp=H({type:t,selectors:[["app-customer-invoice"]],features:[q([Ke]),L],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Customer Invoice",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","lazy","paginator","rows","totalRecords","value"],[2,"width","1rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[2,"width","4rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"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 Tag",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"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["showClear","","formControlName","customerID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize","appMaskNumber","",3,"ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(r,n){if(r&1){let i=E();l(0,"app-main-panel",8),K("isDialogFilterVisibleChange",function(u){return h(i),M(n.isDialogFilterVisible,u)||(n.isDialogFilterVisible=u),S(u)})("isInitDialogFilterVisibleChange",function(u){return h(i),M(n.isInitDialogFilterVisible,u)||(n.isInitDialogFilterVisible=u),S(u)}),T("filterConfirmed",function(){return h(i),S(n.onFilterOKEvent())})("search",function(u){return h(i),S(n.onSearch(u))}),g(1,Ct,1,1,"ng-template",null,0,b)(3,It,10,5,"ng-template",null,1,b)(5,Nt,32,22,"ng-template",null,2,b),o()}r&2&&(s("isSearchableInput",!0)("isFilterable",!0),W("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[Ie,Re,ke,Je,Ne,ee,$,Q,X,Z,Y,Be,Ge,ge,_e,fe,ue,De,Fe,Te,Ee,de,ce,He,Ue,se,le,ie,oe,re,ae,pe,Se,he,xe,Pe],encapsulation:2,changeDetection:0})}}return t})();var Rt={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,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4}},filter:{number:null,outletName:null,paymentState:0,deliveryState:0,from:null,to:null,supplierID:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4},skipRequestFirst:!0},$e=Ce(tt("JournalSupplierBillStore"),we(Rt),be(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))})),ye(t=>{let p=v(D),e=v(N);return{updateFilter(r){y(t,n=>d(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?d(c({},f),{checked:!0}):f);return d(c({},n),{data:d(c({},n.data),{data:i})})})},onRowUnselect(r){y(t,n=>{let i=n.data.data.map(f=>f.id===r.id?d(c({},f),{checked:!1}):f);return d(c({},n),{data:d(c({},n.data),{data:i})})})},onHeaderCheckboxToggle(r){y(t,n=>{let i=n.data.data.map(f=>d(c({},f),{checked:r}));return d(c({},n),{data:d(c({},n.data),{data:i})})})},getGJSupplierBillLoader:z(R(B(()=>p.getGJSupplierBillLoader().pipe(j({next:r=>{console.log("GJSupplierBillLoader response:",r),y(t,n=>d(c({},n),{meta:r}))},error:r=>{console.error("Error fetching GJSupplierBillLoader:",r)}}))))),getJournalSupplierBill:z(R(O(r=>Object.entries(r).reduce((n,[i,f])=>(f!=null&&(n[i]=f),n),{})),B(r=>p.getJournalSupplierBill(r).pipe(O(n=>d(c({},n),{data:n.data.map(i=>d(c({},i),{due:e.from(i.due)?e.from(i.due).format():null,checked:!1}))})),j({next:n=>{y(t,i=>d(c({},i),{data:n}))},error:n=>{console.error("Error fetching journal supplier bill:",n)}})))))}}),ve(t=>({onInit:()=>{t.getGJSupplierBillLoader(),t.getJournalSupplierBill(t.filter)}})));var Qe=t=>({"ng-invalid ng-dirty":t});function Bt(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 Mt(t,p){if(t&1&&g(0,Bt,1,0,"p-button",9),t&2){let e=_();s("ngIf",e.store.hasCheckedRows())}}function Pt(t,p){t&1&&(l(0,"tr")(1,"th",12),x(2,"p-tableHeaderCheckbox"),o(),l(3,"th",13),m(4,"Tag"),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(),x(19,"th",18),o())}function zt(t,p){if(t&1&&(l(0,"tr")(1,"td"),x(2,"p-tableCheckbox",19),o(),l(3,"td"),m(4),o(),l(5,"td")(6,"a",20),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"),x(20,"p-chip",21),o(),l(21,"td"),x(22,"p-chip",21),o(),l(23,"td"),x(24,"p-button",22),o()()),t&2){let e=p.$implicit,r=_(2);a(2),s("value",e),a(2),C(e.outlet),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Orders/Orders/Supplier_Bill/Info?ID="+e.id,U),a(),J(" ",e.number," "),a(2),C(e.customer),a(2),C(F(12,13,e.date,"d MMM y hh:mm")),a(3),C(e.due?F(15,16,e.due,"d MMM y hh:mm"):"-"),a(3),C(P(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 jt(t,p){if(t&1&&m(0),t&2){let e=_(2);A(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Ot(t,p){t&1&&(l(0,"tr")(1,"td",23)(2,"span"),m(3,"No records found."),o()()())}function Gt(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,Pt,20,0,"ng-template",null,3,b)(4,zt,25,21,"ng-template",null,4,b)(6,jt,1,3,"ng-template",null,5,b)(8,Ot,4,0,"ng-template",null,6,b),o()()}if(t&2){let e=_();a(),s("value",e.store.data().data)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function Ut(t,p){if(t&1&&(l(0,"span",36),m(1),w(2,"truncate"),o()),t&2){let e=p.$implicit;s("pTooltip",e.name),a(),J(" ",F(2,2,e.name,30)," ")}}function Ht(t,p){if(t&1&&(l(0,"div")(1,"span",38),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function Lt(t,p){if(t&1&&(l(0,"div"),g(1,Ht,3,1,"div",37),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("from"))}}function At(t,p){if(t&1&&(l(0,"div")(1,"span",38),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function Wt(t,p){if(t&1&&(l(0,"div"),g(1,At,3,1,"div",37),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("to"))}}function Kt(t,p){if(t&1&&(l(0,"div")(1,"span",38),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function qt(t,p){if(t&1&&(l(0,"div"),g(1,Kt,3,1,"div",37),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("pageSize"))}}function $t(t,p){if(t&1){let e=E();l(0,"form",24)(1,"div",25)(2,"label",26),m(3,"Tag"),o(),l(4,"p-select",27),g(5,Ut,3,5,"ng-template",null,7,b),o()(),l(7,"div",25)(8,"label",26),m(9,"Payment"),o(),x(10,"p-select",28),o(),l(11,"div",25)(12,"label",26),m(13,"Delivery"),o(),x(14,"p-select",29),o(),l(15,"div",25)(16,"label",26),m(17,"From - To"),o(),l(18,"div",30),x(19,"p-datepicker",31),g(20,Lt,2,1,"div",32),x(21,"p-datepicker",33),g(22,Wt,2,1,"div",32),o()(),l(23,"div",25)(24,"label",26),m(25,"Supplier"),o(),l(26,"p-autocomplete",34),w(27,"async"),T("completeMethod",function(n){h(e);let i=_();return S(i.onSearchSupplier(n))}),o()(),l(28,"div",25)(29,"label",26),m(30,"Page Size"),o(),x(31,"input",35),g(32,qt,2,1,"div",32),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(5),s("iconDisplay","input")("showIcon",!0)("ngClass",V(18,Qe,e.isInvalid("from"))),a(),s("ngIf",e.isInvalid("from")),a(),s("iconDisplay","input")("showIcon",!0)("ngClass",V(20,Qe,e.isInvalid("to"))),a(),s("ngIf",e.isInvalid("to")),a(4),s("suggestions",P(27,16,e.supplierSuggestions$)),a(5),s("ngClass",V(22,Qe,e.isInvalid("pageSize"))),a(),s("ngIf",e.isInvalid("pageSize"))}}var ft=(()=>{class t extends Me{constructor(){super(),this.generateJournalService=v(D),this.store=v($e),this.authService=v(te),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=v(me),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(Ve("Supplier Suggestions"))}initform(){let{outletName:e,number:r,from:n,to:i,paymentState:f,deliveryState:u,supplierID:ze,pageNumber:je,pageSize:Oe,export:Le,exportPageNumber:Ae,exportPageSize:We}=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(u),supplierID:this.fb.control(ze),pageNumber:this.fb.control(je),pageSize:this.fb.control(Oe,[ne.required]),export:this.fb.control(Le),exportPageNumber:this.fb.control(Ae),exportPageSize:this.fb.control(We)})}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(G(()=>{this.store.getJournalSupplierBill(this.store.filter)})).subscribe()}onSearch(e){this.store.updateFilter(d(c({},this.store.filter()),{number:e}))}onPageChange(e){this.store.updateFilter(d(c({},this.store.filter()),{pageNumber:e.first/e.rows+1}))}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=H({type:t,selectors:[["app-journal-supplier-bill"]],features:[q([$e]),L],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Supplier Bill",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value","paginator","rows","totalRecords","lazy"],[2,"width","1rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[2,"width","4rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"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 Tag",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"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["showClear","","formControlName","supplierID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","appMaskNumber","","formControlName","pageSize",3,"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),K("isDialogFilterVisibleChange",function(u){return h(i),M(n.isDialogFilterVisible,u)||(n.isDialogFilterVisible=u),S(u)})("isInitDialogFilterVisibleChange",function(u){return h(i),M(n.isInitDialogFilterVisible,u)||(n.isInitDialogFilterVisible=u),S(u)}),T("filterConfirmed",function(){return h(i),S(n.onFilterOKEvent())})("search",function(u){return h(i),S(n.onSearch(u))}),g(1,Mt,1,1,"ng-template",null,0,b)(3,Gt,10,5,"ng-template",null,1,b)(5,$t,33,24,"ng-template",null,2,b),o()}r&2&&(s("isSearchableInput",!0)("isFilterable",!0),W("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[Ie,Re,ke,Je,Ne,ee,$,Q,X,et,Z,Y,Be,Ge,ge,_e,fe,ue,De,Fe,Te,Ee,He,Ue,se,le,ie,oe,re,ae,pe,de,ce,xe,Se,he,Pe],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Qt={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4}},filter:{number:null,outletName:null,from:null,to:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4}},Xe=Ce(we(Qt),be(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))})),ye(t=>{let p=v(D);return{updateFilter(e){y(t,r=>d(c({},r),{filter:c(c({},r.filter),e)}))},onRowSelect(e){y(t,r=>{let n=r.data.data.map(i=>i.id===e.id?d(c({},i),{checked:!0}):i);return d(c({},r),{data:d(c({},r.data),{data:n})})})},onRowUnselect(e){y(t,r=>{let n=r.data.data.map(i=>i.id===e.id?d(c({},i),{checked:!1}):i);return d(c({},r),{data:d(c({},r.data),{data:n})})})},onHeaderCheckboxToggle(e){y(t,r=>{let n=r.data.data.map(i=>d(c({},i),{checked:e}));return d(c({},r),{data:d(c({},r.data),{data:n})})})},getGJShiftLoader:z(R(B(()=>p.getGJShiftLoader().pipe(j(e=>y(t,r=>d(c({},r),{meta:e})),e=>console.error("Error fetching GJ Shift Loader:",e)))))),getJournalShift:z(R(O(e=>Object.entries(e).reduce((r,[n,i])=>(i!=null&&(r[n]=i),r),{})),B(e=>p.getJournalShift(e).pipe(j(r=>y(t,n=>d(c({},n),{data:r})),r=>console.error("Error fetching journal shift:",r))))))}}),ve(t=>({onInit:()=>{t.getGJShiftLoader(),t.getJournalShift(t.filter)}})));var Ye=t=>({"ng-invalid ng-dirty":t});function Xt(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 Yt(t,p){if(t&1&&g(0,Xt,1,0,"p-button",9),t&2){let e=_();s("ngIf",e.store.hasCheckedRows())}}function Zt(t,p){t&1&&(l(0,"tr")(1,"th",12),x(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,"Tag"),o(),l(17,"th",17),m(18,"Register"),o(),l(19,"th",17),m(20,"Visitors"),o(),x(21,"th",18),o())}function ei(t,p){if(t&1&&(l(0,"tr")(1,"td"),x(2,"p-tableCheckbox",19),o(),l(3,"td")(4,"a",20),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"),x(28,"p-button",21),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(),J(" ",e.number," "),a(2),C(F(8,14,e.open,"dd MMM y hh:mm")),a(3),C(F(11,17,e.close,"dd MMM y hh:mm")),a(3),C(e.cashier),a(2),C(P(16,20,e.salesNTax)),a(3),C(P(19,22,e.totalInvoice)),a(3),C(e.outlet),a(2),C(e.register),a(2),C(P(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 ti(t,p){if(t&1&&m(0),t&2){let e=_(2);A(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function ii(t,p){t&1&&(l(0,"tr")(1,"td",22)(2,"span"),m(3,"No records found."),o()()())}function ni(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,Zt,22,0,"ng-template",null,3,b)(4,ei,29,26,"ng-template",null,4,b)(6,ti,1,3,"ng-template",null,5,b)(8,ii,4,0,"ng-template",null,6,b),o()()}if(t&2){let e=_();a(),s("paginator",!0)("lazy",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("value",e.store.data().data)}}function oi(t,p){if(t&1&&(l(0,"span",32),m(1),w(2,"truncate"),o()),t&2){let e=p.$implicit;s("pTooltip",e.name),a(),J(" ",F(2,2,e.name,30)," ")}}function ri(t,p){if(t&1&&(l(0,"div")(1,"span",34),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function li(t,p){if(t&1&&(l(0,"div"),g(1,ri,3,1,"div",33),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("from"))}}function ai(t,p){if(t&1&&(l(0,"div")(1,"span",34),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function pi(t,p){if(t&1&&(l(0,"div"),g(1,ai,3,1,"div",33),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("to"))}}function mi(t,p){if(t&1&&(l(0,"div")(1,"span",34),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function si(t,p){if(t&1&&(l(0,"div"),g(1,mi,3,1,"div",33),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("pageSize"))}}function ci(t,p){if(t&1&&(l(0,"form",23)(1,"div",24)(2,"label",25),m(3,"Tag"),o(),l(4,"p-select",26),g(5,oi,3,5,"ng-template",null,7,b),o()(),l(7,"div",24)(8,"label",25),m(9,"From - To"),o(),l(10,"div",27),x(11,"p-datepicker",28),g(12,li,2,1,"div",29),x(13,"p-datepicker",30),g(14,pi,2,1,"div",29),o()(),l(15,"div",24)(16,"label",25),m(17,"Page Size"),o(),x(18,"input",31),g(19,si,2,1,"div",29),o()()),t&2){let e=_();s("formGroup",e.form),a(4),s("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),a(7),s("iconDisplay","input")("showIcon",!0)("ngClass",V(13,Ye,e.isInvalid("from"))),a(),s("ngIf",e.isInvalid("from")),a(),s("iconDisplay","input")("showIcon",!0)("ngClass",V(15,Ye,e.isInvalid("to"))),a(),s("ngIf",e.isInvalid("to")),a(4),s("ngClass",V(17,Ye,e.isInvalid("pageSize"))),a(),s("ngIf",e.isInvalid("pageSize"))}}var _t=(()=>{class t extends Me{constructor(){super(),this.generateJournalService=v(D),this.store=v(Xe),this.authService=v(te),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=v(me),this.dayjsService=v(N)}ngOnInit(){this.initForm()}initForm(){let{number:e,outletName:r,from:n,to:i,pageNumber:f,pageSize:u,export:ze,exportPageNumber:je,exportPageSize:Oe}=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),pageSize:this.fb.control(u,[ne.required]),export:this.fb.control(ze),exportPageNumber:this.fb.control(je),exportPageSize:this.fb.control(Oe)})}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(G(()=>{this.store.getJournalShift(this.store.filter)})).subscribe()}onSearch(e){this.store.updateFilter(d(c({},this.store.filter()),{number:e}))}onPageChange(e){let r=e.first/e.rows;this.store.updateFilter(d(c({},this.store.filter()),{pageNumber:r+1}))}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=H({type:t,selectors:[["app-journal-shift"]],features:[q([Xe]),L],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Shift Journal",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","paginator","lazy","rows","totalRecords","value"],[2,"width","1rem"],[2,"width","12rem"],[2,"width","11rem"],[2,"width","14rem"],[2,"width","10rem"],[2,"width","9rem"],[2,"width","4rem"],[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 Tag",3,"virtualScrollItemSize","options"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["type","text","pInputText","","formControlName","pageSize","appMaskNumber","",3,"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),K("isDialogFilterVisibleChange",function(u){return h(i),M(n.isDialogFilterVisible,u)||(n.isDialogFilterVisible=u),S(u)})("isInitDialogFilterVisibleChange",function(u){return h(i),M(n.isInitDialogFilterVisible,u)||(n.isInitDialogFilterVisible=u),S(u)}),T("filterConfirmed",function(){return h(i),S(n.onFilterOKEvent())})("search",function(u){return h(i),S(n.onSearch(u))}),g(1,Yt,1,1,"ng-template",null,0,b)(3,ni,10,5,"ng-template",null,1,b)(5,ci,20,19,"ng-template",null,2,b),o()}r&2&&(s("isSearchableInput",!0)("isFilterable",!0),W("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[Ie,Re,ke,Je,Ne,ee,$,Q,X,Z,Y,Be,ge,_e,fe,ue,se,le,ie,oe,re,ae,pe,De,Fe,Te,Ee,xe,Se,he,de,ce,Pe],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var fo=[{path:"invoice",component:ut},{path:"supplier-bill",component:ft},{path:"shift",component:_t},{path:"join-invoice",loadComponent:()=>import("./chunk-ULAE6ZMS.js").then(t=>t.ARJournalComponent)},{path:"join-bill",loadComponent:()=>import("./chunk-VCUOMA7I.js").then(t=>t.ApJournalComponent)},{path:"adjustment",loadComponent:()=>import("./chunk-2RKPDCYU.js").then(t=>t.AdjustmentJournalComponent)}];export{fo as generateJournalRoutes};
1
+ import{a as D}from"./chunk-LO2GGXGQ.js";import{a as it}from"./chunk-G4XX7EU2.js";import{a as Pe}from"./chunk-KZHI6PGZ.js";import{a as Ue,b as He}from"./chunk-UVSR4LPB.js";import{a as te}from"./chunk-2RI2WRFG.js";import{b as N}from"./chunk-33JUCBXH.js";import{a as Me}from"./chunk-XKI7WLHE.js";import{a as Ge,b as Be}from"./chunk-VDXZGF3M.js";import"./chunk-MHRSQRHT.js";import"./chunk-U2VDC52W.js";import{a as z,b as j}from"./chunk-3VQUNDVT.js";import{d as ke,i as Je,j as Ne,k as Re}from"./chunk-DGACZ747.js";import{a as Ee,b as Te}from"./chunk-EBEY2MBR.js";import"./chunk-AMGBUOC4.js";import"./chunk-UPSNJEHO.js";import{a as Ve}from"./chunk-BT7Y4ADP.js";import"./chunk-VKNINE5Q.js";import"./chunk-E7QWESN4.js";import{a as Fe,b as De}from"./chunk-AN4SAUSA.js";import"./chunk-URH77XNK.js";import"./chunk-PPXXWO4E.js";import"./chunk-3DBSHDAQ.js";import"./chunk-M4SSELXT.js";import"./chunk-QPPFPDWZ.js";import"./chunk-WMZF4DQK.js";import{i as Ie}from"./chunk-7P5XATXL.js";import"./chunk-S27Z7D3D.js";import{a as _e,b as ge}from"./chunk-AD247LWQ.js";import{a as xe,b as y,c as Ce,d as be,e as ve,f as ye,g as we,h as tt}from"./chunk-BKTBVFNX.js";import"./chunk-ZFNIPERQ.js";import{n as ce,o as de,w as ue,x as fe,y as he,z as Se}from"./chunk-ME4ALIS7.js";import"./chunk-DTYVTTET.js";import{b as ie,c as ne,e as oe,f as re,k as le,l as ae,o as pe,u as me,x as se}from"./chunk-VMI3QWC6.js";import"./chunk-F7PVAVLQ.js";import"./chunk-C4W7XYJD.js";import"./chunk-5DRALZZF.js";import"./chunk-2BI7WNJP.js";import{h as $,j as Q,k as X,n as et,p as Y,q as Z,s as ee}from"./chunk-ZK43JB4A.js";import"./chunk-F2X3VGZZ.js";import{Cb as L,Dc as q,Eb as g,Fc as V,Ha as k,Mb as s,Oc as w,Pc as P,Qc as F,Sc as b,Wb as l,Xb as o,Y as B,Yb as x,_ as G,ac as E,bd as I,c as R,eb as U,fc as T,gc as _,ia as v,ib as a,qa as h,ra as S,s as O,sc as m,tc as C,ua as Ze,uc as J,wc as A,xc as W,yb as H,yc as M,zc as K}from"./chunk-6QJHEOXN.js";import{a as c,b as d}from"./chunk-YQFG5XE2.js";var gt={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,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4}},filter:{number:null,outletName:null,paymentState:0,deliveryState:0,from:null,to:null,customerID:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4}},Ke=Ce(we(gt),be(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))})),ye(t=>{let p=v(D),e=v(N);return{updateFilter(n){y(t,i=>d(c({},i),{filter:c(c({},i.filter),n),skipRequestFirst:!1}))},onRowSelect(n){y(t,i=>{let f=i.data.data.map(u=>u.id===n.id?d(c({},u),{checked:!0}):u);return d(c({},i),{data:d(c({},i.data),{data:f})})})},onRowUnselect(n){y(t,i=>{let f=i.data.data.map(u=>u.id===n.id?d(c({},u),{checked:!1}):u);return d(c({},i),{data:d(c({},i.data),{data:f})})})},onHeaderCheckboxToggle(n){y(t,i=>{let f=i.data.data.map(u=>d(c({},u),{checked:n}));return d(c({},i),{data:d(c({},i.data),{data:f})})})},getCustomerInvoice:z(R(O(n=>Object.entries(n).reduce((i,[f,u])=>(u!=null&&(i[f]=u),i),{})),B(n=>p.getJournalInvoice(n).pipe(O(i=>d(c({},i),{data:i.data.map(f=>d(c({},f),{due:e.from(f.due)?e.from(f.due).format():null,checked:!1}))})),Ve("getCustomerInvoice"),j({next:i=>{y(t,f=>d(c({},f),{data:d(c({},f.data),{data:i.data,totalCount:i.totalCount})}))},error:i=>{console.error("Error fetching customer invoice:",i)}}))))),getCustomerInvoiceLoader:z(R(B(()=>p.getJournalInvoiceLoader().pipe(j({next:n=>{y(t,i=>d(c({},i),{meta:n}))},error:n=>{console.error("Error fetching customer invoice loader:",n)}})))))}}),ve(t=>({onInit:()=>{t.getCustomerInvoiceLoader(),t.getCustomerInvoice(t.filter)}})));var qe=t=>({"ng-invalid ng-dirty":t});function xt(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 Ct(t,p){if(t&1&&g(0,xt,1,0,"p-button",9),t&2){let e=_();s("ngIf",e.store.hasCheckedRows())}}function bt(t,p){t&1&&(l(0,"tr")(1,"th",12),x(2,"p-tableHeaderCheckbox"),o(),l(3,"th",13),m(4,"Tag"),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(),x(19,"th",18),o())}function vt(t,p){if(t&1&&(l(0,"tr")(1,"td"),x(2,"p-tableCheckbox",19),o(),l(3,"td"),m(4),o(),l(5,"td")(6,"a",20),m(7),o()(),l(8,"td")(9,"a",20),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"),x(21,"p-chip",21),o(),l(22,"td"),x(23,"p-chip",21),o(),l(24,"td"),x(25,"p-button",22),o()()),t&2){let e=p.$implicit,r=_(2);a(2),s("value",e),a(2),C(e.outlet),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Orders/Orders/Customer_Invoice/Info?ID="+e.id,U),a(),J(" ",e.number," "),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.customerID,U),a(),J(" ",e.customer," "),a(2),C(F(13,14,e.date,"d MMM y hh:mm")),a(3),C(e.due?F(16,17,e.due,"d MMM y hh:mm"):"-"),a(3),C(P(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 yt(t,p){if(t&1&&m(0),t&2){let e=_(2);A(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function wt(t,p){t&1&&(l(0,"tr")(1,"td",23)(2,"span"),m(3,"No records found."),o()()())}function It(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,bt,20,0,"ng-template",null,3,b)(4,vt,26,22,"ng-template",null,4,b)(6,yt,1,3,"ng-template",null,5,b)(8,wt,4,0,"ng-template",null,6,b),o()()}if(t&2){let e=_();a(),s("lazy",!0)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("value",e.store.data().data)}}function Et(t,p){if(t&1&&(l(0,"span",36),m(1),w(2,"truncate"),o()),t&2){let e=p.$implicit;s("pTooltip",e.name),a(),J(" ",F(2,2,e.name,30)," ")}}function Tt(t,p){if(t&1&&(l(0,"div")(1,"span",38),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function Vt(t,p){if(t&1&&(l(0,"div"),g(1,Tt,3,1,"div",37),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("from"))}}function Ft(t,p){if(t&1&&(l(0,"div")(1,"span",38),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function Dt(t,p){if(t&1&&(l(0,"div"),g(1,Ft,3,1,"div",37),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("to"))}}function kt(t,p){if(t&1&&(l(0,"div")(1,"span",38),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function Jt(t,p){if(t&1&&(l(0,"div"),g(1,kt,3,1,"div",37),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("pageSize"))}}function Nt(t,p){if(t&1){let e=E();l(0,"form",24)(1,"div",25)(2,"label",26),m(3,"Tag"),o(),l(4,"p-select",27),g(5,Et,3,5,"ng-template",null,7,b),o()(),l(7,"div",25)(8,"label",26),m(9,"Payment"),o(),x(10,"p-select",28),o(),l(11,"div",25)(12,"label",26),m(13,"Delivery"),o(),x(14,"p-select",29),o(),l(15,"div",25)(16,"label",26),m(17,"From - To"),o(),l(18,"div",30),x(19,"p-datepicker",31),g(20,Vt,2,1,"div",32),x(21,"p-datepicker",33),g(22,Dt,2,1,"div",32),o()(),l(23,"div",25)(24,"label",26),m(25,"Customer"),o(),l(26,"p-autocomplete",34),T("completeMethod",function(n){h(e);let i=_();return S(i.onSearchContact(n))}),o()(),l(27,"div",25)(28,"label",26),m(29,"Page Size"),o(),x(30,"input",35),g(31,Jt,2,1,"div",32),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(5),s("iconDisplay","input")("showIcon",!0)("ngClass",V(16,qe,e.isInvalid("from"))),a(),s("ngIf",e.isInvalid("from")),a(),s("iconDisplay","input")("showIcon",!0)("ngClass",V(18,qe,e.isInvalid("to"))),a(),s("ngIf",e.isInvalid("to")),a(4),s("suggestions",e.customerSuggestions()),a(4),s("ngClass",V(20,qe,e.isInvalid("pageSize"))),a(),s("ngIf",e.isInvalid("pageSize"))}}var ut=(()=>{class t extends Me{constructor(){super(...arguments),this.store=v(Ke),this.dayjsService=v(N),this.generateJournalService=v(D),this.authService=v(te),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.customerSuggestions=k([]),this.fb=v(me)}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:u,customerID:ze,pageNumber:je,pageSize:Oe,export:Le,exportPageNumber:Ae,exportPageSize:We}=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(u)?this.dayjsService.from(u).toDate():null),customerID:this.fb.control(ze),pageNumber:this.fb.control(je),pageSize:this.fb.control(Oe,[ne.required]),export:this.fb.control(Le),exportPageNumber:this.fb.control(Ae),exportPageSize:this.fb.control(We)})}onSearchContact(e){let{query:r}=e;this.generateJournalService.getCustomerSuggestions(r).pipe(Ve("Customer Suggestions"),G(n=>{this.customerSuggestions.set(n)})).subscribe()}onSearch(e){this.store.updateFilter(d(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(d(c({},this.store.filter()),{pageNumber:r+1}))}onGenerateJournal(){this.generateJournalService.generateJournalInvoice(this.store.checkedInvoice()).pipe(G(()=>{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]=it);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=Ze(t)))(n||t)}})()}static{this.\u0275cmp=H({type:t,selectors:[["app-customer-invoice"]],features:[q([Ke]),L],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Customer Invoice",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","lazy","paginator","rows","totalRecords","value"],[2,"width","1rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[2,"width","4rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"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 Tag",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"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["showClear","","formControlName","customerID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize","appMaskNumber","",3,"ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(r,n){if(r&1){let i=E();l(0,"app-main-panel",8),K("isDialogFilterVisibleChange",function(u){return h(i),M(n.isDialogFilterVisible,u)||(n.isDialogFilterVisible=u),S(u)})("isInitDialogFilterVisibleChange",function(u){return h(i),M(n.isInitDialogFilterVisible,u)||(n.isInitDialogFilterVisible=u),S(u)}),T("filterConfirmed",function(){return h(i),S(n.onFilterOKEvent())})("search",function(u){return h(i),S(n.onSearch(u))}),g(1,Ct,1,1,"ng-template",null,0,b)(3,It,10,5,"ng-template",null,1,b)(5,Nt,32,22,"ng-template",null,2,b),o()}r&2&&(s("isSearchableInput",!0)("isFilterable",!0),W("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[Ie,Re,ke,Je,Ne,ee,$,Q,X,Z,Y,Be,Ge,ge,_e,fe,ue,De,Fe,Te,Ee,de,ce,He,Ue,se,le,ie,oe,re,ae,pe,Se,he,xe,Pe],encapsulation:2,changeDetection:0})}}return t})();var Rt={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,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4}},filter:{number:null,outletName:null,paymentState:0,deliveryState:0,from:null,to:null,supplierID:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4},skipRequestFirst:!0},$e=Ce(tt("JournalSupplierBillStore"),we(Rt),be(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))})),ye(t=>{let p=v(D),e=v(N);return{updateFilter(r){y(t,n=>d(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?d(c({},f),{checked:!0}):f);return d(c({},n),{data:d(c({},n.data),{data:i})})})},onRowUnselect(r){y(t,n=>{let i=n.data.data.map(f=>f.id===r.id?d(c({},f),{checked:!1}):f);return d(c({},n),{data:d(c({},n.data),{data:i})})})},onHeaderCheckboxToggle(r){y(t,n=>{let i=n.data.data.map(f=>d(c({},f),{checked:r}));return d(c({},n),{data:d(c({},n.data),{data:i})})})},getGJSupplierBillLoader:z(R(B(()=>p.getGJSupplierBillLoader().pipe(j({next:r=>{console.log("GJSupplierBillLoader response:",r),y(t,n=>d(c({},n),{meta:r}))},error:r=>{console.error("Error fetching GJSupplierBillLoader:",r)}}))))),getJournalSupplierBill:z(R(O(r=>Object.entries(r).reduce((n,[i,f])=>(f!=null&&(n[i]=f),n),{})),B(r=>p.getJournalSupplierBill(r).pipe(O(n=>d(c({},n),{data:n.data.map(i=>d(c({},i),{due:e.from(i.due)?e.from(i.due).format():null,checked:!1}))})),j({next:n=>{y(t,i=>d(c({},i),{data:n}))},error:n=>{console.error("Error fetching journal supplier bill:",n)}})))))}}),ve(t=>({onInit:()=>{t.getGJSupplierBillLoader(),t.getJournalSupplierBill(t.filter)}})));var Qe=t=>({"ng-invalid ng-dirty":t});function Bt(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 Mt(t,p){if(t&1&&g(0,Bt,1,0,"p-button",9),t&2){let e=_();s("ngIf",e.store.hasCheckedRows())}}function Pt(t,p){t&1&&(l(0,"tr")(1,"th",12),x(2,"p-tableHeaderCheckbox"),o(),l(3,"th",13),m(4,"Tag"),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(),x(19,"th",18),o())}function zt(t,p){if(t&1&&(l(0,"tr")(1,"td"),x(2,"p-tableCheckbox",19),o(),l(3,"td"),m(4),o(),l(5,"td")(6,"a",20),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"),x(20,"p-chip",21),o(),l(21,"td"),x(22,"p-chip",21),o(),l(23,"td"),x(24,"p-button",22),o()()),t&2){let e=p.$implicit,r=_(2);a(2),s("value",e),a(2),C(e.outlet),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Orders/Orders/Supplier_Bill/Info?ID="+e.id,U),a(),J(" ",e.number," "),a(2),C(e.customer),a(2),C(F(12,13,e.date,"d MMM y hh:mm")),a(3),C(e.due?F(15,16,e.due,"d MMM y hh:mm"):"-"),a(3),C(P(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 jt(t,p){if(t&1&&m(0),t&2){let e=_(2);A(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Ot(t,p){t&1&&(l(0,"tr")(1,"td",23)(2,"span"),m(3,"No records found."),o()()())}function Gt(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,Pt,20,0,"ng-template",null,3,b)(4,zt,25,21,"ng-template",null,4,b)(6,jt,1,3,"ng-template",null,5,b)(8,Ot,4,0,"ng-template",null,6,b),o()()}if(t&2){let e=_();a(),s("value",e.store.data().data)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function Ut(t,p){if(t&1&&(l(0,"span",36),m(1),w(2,"truncate"),o()),t&2){let e=p.$implicit;s("pTooltip",e.name),a(),J(" ",F(2,2,e.name,30)," ")}}function Ht(t,p){if(t&1&&(l(0,"div")(1,"span",38),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function Lt(t,p){if(t&1&&(l(0,"div"),g(1,Ht,3,1,"div",37),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("from"))}}function At(t,p){if(t&1&&(l(0,"div")(1,"span",38),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function Wt(t,p){if(t&1&&(l(0,"div"),g(1,At,3,1,"div",37),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("to"))}}function Kt(t,p){if(t&1&&(l(0,"div")(1,"span",38),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function qt(t,p){if(t&1&&(l(0,"div"),g(1,Kt,3,1,"div",37),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("pageSize"))}}function $t(t,p){if(t&1){let e=E();l(0,"form",24)(1,"div",25)(2,"label",26),m(3,"Tag"),o(),l(4,"p-select",27),g(5,Ut,3,5,"ng-template",null,7,b),o()(),l(7,"div",25)(8,"label",26),m(9,"Payment"),o(),x(10,"p-select",28),o(),l(11,"div",25)(12,"label",26),m(13,"Delivery"),o(),x(14,"p-select",29),o(),l(15,"div",25)(16,"label",26),m(17,"From - To"),o(),l(18,"div",30),x(19,"p-datepicker",31),g(20,Lt,2,1,"div",32),x(21,"p-datepicker",33),g(22,Wt,2,1,"div",32),o()(),l(23,"div",25)(24,"label",26),m(25,"Supplier"),o(),l(26,"p-autocomplete",34),w(27,"async"),T("completeMethod",function(n){h(e);let i=_();return S(i.onSearchSupplier(n))}),o()(),l(28,"div",25)(29,"label",26),m(30,"Page Size"),o(),x(31,"input",35),g(32,qt,2,1,"div",32),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(5),s("iconDisplay","input")("showIcon",!0)("ngClass",V(18,Qe,e.isInvalid("from"))),a(),s("ngIf",e.isInvalid("from")),a(),s("iconDisplay","input")("showIcon",!0)("ngClass",V(20,Qe,e.isInvalid("to"))),a(),s("ngIf",e.isInvalid("to")),a(4),s("suggestions",P(27,16,e.supplierSuggestions$)),a(5),s("ngClass",V(22,Qe,e.isInvalid("pageSize"))),a(),s("ngIf",e.isInvalid("pageSize"))}}var ft=(()=>{class t extends Me{constructor(){super(),this.generateJournalService=v(D),this.store=v($e),this.authService=v(te),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=v(me),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(Ve("Supplier Suggestions"))}initform(){let{outletName:e,number:r,from:n,to:i,paymentState:f,deliveryState:u,supplierID:ze,pageNumber:je,pageSize:Oe,export:Le,exportPageNumber:Ae,exportPageSize:We}=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(u),supplierID:this.fb.control(ze),pageNumber:this.fb.control(je),pageSize:this.fb.control(Oe,[ne.required]),export:this.fb.control(Le),exportPageNumber:this.fb.control(Ae),exportPageSize:this.fb.control(We)})}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(G(()=>{this.store.getJournalSupplierBill(this.store.filter)})).subscribe()}onSearch(e){this.store.updateFilter(d(c({},this.store.filter()),{number:e}))}onPageChange(e){this.store.updateFilter(d(c({},this.store.filter()),{pageNumber:e.first/e.rows+1}))}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=H({type:t,selectors:[["app-journal-supplier-bill"]],features:[q([$e]),L],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Supplier Bill",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","value","paginator","rows","totalRecords","lazy"],[2,"width","1rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[2,"width","4rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"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 Tag",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"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["showClear","","formControlName","supplierID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","appMaskNumber","","formControlName","pageSize",3,"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),K("isDialogFilterVisibleChange",function(u){return h(i),M(n.isDialogFilterVisible,u)||(n.isDialogFilterVisible=u),S(u)})("isInitDialogFilterVisibleChange",function(u){return h(i),M(n.isInitDialogFilterVisible,u)||(n.isInitDialogFilterVisible=u),S(u)}),T("filterConfirmed",function(){return h(i),S(n.onFilterOKEvent())})("search",function(u){return h(i),S(n.onSearch(u))}),g(1,Mt,1,1,"ng-template",null,0,b)(3,Gt,10,5,"ng-template",null,1,b)(5,$t,33,24,"ng-template",null,2,b),o()}r&2&&(s("isSearchableInput",!0)("isFilterable",!0),W("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[Ie,Re,ke,Je,Ne,ee,$,Q,X,et,Z,Y,Be,Ge,ge,_e,fe,ue,De,Fe,Te,Ee,He,Ue,se,le,ie,oe,re,ae,pe,de,ce,xe,Se,he,Pe],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Qt={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4}},filter:{number:null,outletName:null,from:null,to:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4}},Xe=Ce(we(Qt),be(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))})),ye(t=>{let p=v(D);return{updateFilter(e){y(t,r=>d(c({},r),{filter:c(c({},r.filter),e)}))},onRowSelect(e){y(t,r=>{let n=r.data.data.map(i=>i.id===e.id?d(c({},i),{checked:!0}):i);return d(c({},r),{data:d(c({},r.data),{data:n})})})},onRowUnselect(e){y(t,r=>{let n=r.data.data.map(i=>i.id===e.id?d(c({},i),{checked:!1}):i);return d(c({},r),{data:d(c({},r.data),{data:n})})})},onHeaderCheckboxToggle(e){y(t,r=>{let n=r.data.data.map(i=>d(c({},i),{checked:e}));return d(c({},r),{data:d(c({},r.data),{data:n})})})},getGJShiftLoader:z(R(B(()=>p.getGJShiftLoader().pipe(j(e=>y(t,r=>d(c({},r),{meta:e})),e=>console.error("Error fetching GJ Shift Loader:",e)))))),getJournalShift:z(R(O(e=>Object.entries(e).reduce((r,[n,i])=>(i!=null&&(r[n]=i),r),{})),B(e=>p.getJournalShift(e).pipe(j(r=>y(t,n=>d(c({},n),{data:r})),r=>console.error("Error fetching journal shift:",r))))))}}),ve(t=>({onInit:()=>{t.getGJShiftLoader(),t.getJournalShift(t.filter)}})));var Ye=t=>({"ng-invalid ng-dirty":t});function Xt(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 Yt(t,p){if(t&1&&g(0,Xt,1,0,"p-button",9),t&2){let e=_();s("ngIf",e.store.hasCheckedRows())}}function Zt(t,p){t&1&&(l(0,"tr")(1,"th",12),x(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,"Tag"),o(),l(17,"th",17),m(18,"Register"),o(),l(19,"th",17),m(20,"Visitors"),o(),x(21,"th",18),o())}function ei(t,p){if(t&1&&(l(0,"tr")(1,"td"),x(2,"p-tableCheckbox",19),o(),l(3,"td")(4,"a",20),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"),x(28,"p-button",21),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(),J(" ",e.number," "),a(2),C(F(8,14,e.open,"dd MMM y hh:mm")),a(3),C(F(11,17,e.close,"dd MMM y hh:mm")),a(3),C(e.cashier),a(2),C(P(16,20,e.salesNTax)),a(3),C(P(19,22,e.totalInvoice)),a(3),C(e.outlet),a(2),C(e.register),a(2),C(P(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 ti(t,p){if(t&1&&m(0),t&2){let e=_(2);A(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function ii(t,p){t&1&&(l(0,"tr")(1,"td",22)(2,"span"),m(3,"No records found."),o()()())}function ni(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,Zt,22,0,"ng-template",null,3,b)(4,ei,29,26,"ng-template",null,4,b)(6,ti,1,3,"ng-template",null,5,b)(8,ii,4,0,"ng-template",null,6,b),o()()}if(t&2){let e=_();a(),s("paginator",!0)("lazy",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("value",e.store.data().data)}}function oi(t,p){if(t&1&&(l(0,"span",32),m(1),w(2,"truncate"),o()),t&2){let e=p.$implicit;s("pTooltip",e.name),a(),J(" ",F(2,2,e.name,30)," ")}}function ri(t,p){if(t&1&&(l(0,"div")(1,"span",34),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function li(t,p){if(t&1&&(l(0,"div"),g(1,ri,3,1,"div",33),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("from"))}}function ai(t,p){if(t&1&&(l(0,"div")(1,"span",34),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function pi(t,p){if(t&1&&(l(0,"div"),g(1,ai,3,1,"div",33),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("to"))}}function mi(t,p){if(t&1&&(l(0,"div")(1,"span",34),m(2),o()()),t&2){let e=p.$implicit;a(2),C(e)}}function si(t,p){if(t&1&&(l(0,"div"),g(1,mi,3,1,"div",33),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("pageSize"))}}function ci(t,p){if(t&1&&(l(0,"form",23)(1,"div",24)(2,"label",25),m(3,"Tag"),o(),l(4,"p-select",26),g(5,oi,3,5,"ng-template",null,7,b),o()(),l(7,"div",24)(8,"label",25),m(9,"From - To"),o(),l(10,"div",27),x(11,"p-datepicker",28),g(12,li,2,1,"div",29),x(13,"p-datepicker",30),g(14,pi,2,1,"div",29),o()(),l(15,"div",24)(16,"label",25),m(17,"Page Size"),o(),x(18,"input",31),g(19,si,2,1,"div",29),o()()),t&2){let e=_();s("formGroup",e.form),a(4),s("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),a(7),s("iconDisplay","input")("showIcon",!0)("ngClass",V(13,Ye,e.isInvalid("from"))),a(),s("ngIf",e.isInvalid("from")),a(),s("iconDisplay","input")("showIcon",!0)("ngClass",V(15,Ye,e.isInvalid("to"))),a(),s("ngIf",e.isInvalid("to")),a(4),s("ngClass",V(17,Ye,e.isInvalid("pageSize"))),a(),s("ngIf",e.isInvalid("pageSize"))}}var _t=(()=>{class t extends Me{constructor(){super(),this.generateJournalService=v(D),this.store=v(Xe),this.authService=v(te),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=v(me),this.dayjsService=v(N)}ngOnInit(){this.initForm()}initForm(){let{number:e,outletName:r,from:n,to:i,pageNumber:f,pageSize:u,export:ze,exportPageNumber:je,exportPageSize:Oe}=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),pageSize:this.fb.control(u,[ne.required]),export:this.fb.control(ze),exportPageNumber:this.fb.control(je),exportPageSize:this.fb.control(Oe)})}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(G(()=>{this.store.getJournalShift(this.store.filter)})).subscribe()}onSearch(e){this.store.updateFilter(d(c({},this.store.filter()),{number:e}))}onPageChange(e){let r=e.first/e.rows;this.store.updateFilter(d(c({},this.store.filter()),{pageNumber:r+1}))}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=H({type:t,selectors:[["app-journal-shift"]],features:[q([Xe]),L],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Shift Journal",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","paginator","lazy","rows","totalRecords","value"],[2,"width","1rem"],[2,"width","12rem"],[2,"width","11rem"],[2,"width","14rem"],[2,"width","10rem"],[2,"width","9rem"],[2,"width","4rem"],[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 Tag",3,"virtualScrollItemSize","options"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["type","text","pInputText","","formControlName","pageSize","appMaskNumber","",3,"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),K("isDialogFilterVisibleChange",function(u){return h(i),M(n.isDialogFilterVisible,u)||(n.isDialogFilterVisible=u),S(u)})("isInitDialogFilterVisibleChange",function(u){return h(i),M(n.isInitDialogFilterVisible,u)||(n.isInitDialogFilterVisible=u),S(u)}),T("filterConfirmed",function(){return h(i),S(n.onFilterOKEvent())})("search",function(u){return h(i),S(n.onSearch(u))}),g(1,Yt,1,1,"ng-template",null,0,b)(3,ni,10,5,"ng-template",null,1,b)(5,ci,20,19,"ng-template",null,2,b),o()}r&2&&(s("isSearchableInput",!0)("isFilterable",!0),W("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[Ie,Re,ke,Je,Ne,ee,$,Q,X,Z,Y,Be,ge,_e,fe,ue,se,le,ie,oe,re,ae,pe,De,Fe,Te,Ee,xe,Se,he,de,ce,Pe],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var fo=[{path:"invoice",component:ut},{path:"supplier-bill",component:ft},{path:"shift",component:_t},{path:"join-invoice",loadComponent:()=>import("./chunk-TG6Y7ANZ.js").then(t=>t.ARJournalComponent)},{path:"join-bill",loadComponent:()=>import("./chunk-HA7LLTOG.js").then(t=>t.ApJournalComponent)},{path:"adjustment",loadComponent:()=>import("./chunk-ZVEQIMYP.js").then(t=>t.AdjustmentJournalComponent)}];export{fo as generateJournalRoutes};
@@ -1 +1 @@
1
- import{a as A}from"./chunk-OPSSYJMR.js";import{a as Me}from"./chunk-KZHI6PGZ.js";import{a as ne}from"./chunk-6RB67IF5.js";import{b as Ne}from"./chunk-XLEICBBP.js";import{a as Re}from"./chunk-XKI7WLHE.js";import"./chunk-U2VDC52W.js";import{a as M,b as P}from"./chunk-3VQUNDVT.js";import{d as Ve,i as Je,j as De,k as ke}from"./chunk-DGACZ747.js";import{a as Ee,b as Ie}from"./chunk-EBEY2MBR.js";import"./chunk-AMGBUOC4.js";import"./chunk-UPSNJEHO.js";import"./chunk-VKNINE5Q.js";import"./chunk-E7QWESN4.js";import{a as Ae,b as Fe}from"./chunk-AN4SAUSA.js";import"./chunk-URH77XNK.js";import"./chunk-PPXXWO4E.js";import"./chunk-3DBSHDAQ.js";import"./chunk-M4SSELXT.js";import"./chunk-QPPFPDWZ.js";import"./chunk-WMZF4DQK.js";import{i as Te}from"./chunk-ADODNO5M.js";import"./chunk-S27Z7D3D.js";import{a as ge,b as he}from"./chunk-AD247LWQ.js";import{a as Se,b as w,c as Ce,d as ve,e as we,f as ye,g as je}from"./chunk-BKTBVFNX.js";import"./chunk-ZFNIPERQ.js";import{n as ue,o as ce,w as fe,x as _e,y as xe,z as be}from"./chunk-ME4ALIS7.js";import"./chunk-DTYVTTET.js";import{b as oe,e as re,f as ae,k as le,l as me,o as pe,u as se,x as de}from"./chunk-VMI3QWC6.js";import"./chunk-F7PVAVLQ.js";import"./chunk-Q3HB53OC.js";import"./chunk-5DRALZZF.js";import"./chunk-2BI7WNJP.js";import{h as X,j as Y,k as Z,p as ee,q as te,s as ie}from"./chunk-ZK43JB4A.js";import"./chunk-F2X3VGZZ.js";import{Cb as L,Dc as Q,Eb as g,Fc as E,Ha as D,Mb as s,Oc as I,Pc as $,Qc as R,Sc as C,Wb as a,Xb as r,Y as J,Yb as b,_ as B,ac as j,bd as y,c as F,db as G,eb as O,fc as T,gc as f,ia as v,ib as m,qa as h,ra as x,s as V,sc as p,tc as S,uc as k,wc as W,xc as K,yb as U,yc as N,zc as q}from"./chunk-6QJHEOXN.js";import{a as d,b as c}from"./chunk-YQFG5XE2.js";var He={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,from:null,to:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,outletName:""}},filter:{number:null,from:null,to:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,outletName:""}},z=Ce(je(He),ve(t=>({first:y(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:y(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:y(()=>t.data().data.some(l=>l.checked)),checkedAdjustment:y(()=>t.data().data.filter(l=>l.checked).map(l=>l.id))})),ye(t=>{let l=v(A);return{updateFilter(n){w(t,i=>c(d({},i),{filter:d(d({},i.filter),n)}))},onRowSelect(n){w(t,i=>{let o=i.data.data.map(u=>u.id===n.id?c(d({},u),{checked:!0}):u);return c(d({},i),{data:c(d({},i.data),{data:o})})})},onRowUnselect(n){w(t,i=>{let o=i.data.data.map(u=>u.id===n.id?c(d({},u),{checked:!1}):u);return c(d({},i),{data:c(d({},i.data),{data:o})})})},onHeaderCheckboxToggle(n){w(t,i=>{let o=i.data.data.map(u=>c(d({},u),{checked:n}));return c(d({},i),{data:c(d({},i.data),{data:o})})})},getGJAdjustmentLoader:M(F(J(()=>l.getGJAdjustmentLoader().pipe(P({next:n=>{w(t,i=>c(d({},i),{meta:n}))},error:n=>{console.error("Error fetching adjustment loader:",n)}}))))),getAdjustmentJournal:M(F(V(n=>Object.entries(n).reduce((i,[o,u])=>(u!=null&&(i[o]=u),i),{})),J(n=>l.getAdjustmentJournal(n).pipe(V(i=>c(d({},i),{data:i.data.map(o=>c(d({},o),{checked:!1}))})),P({next:i=>{w(t,o=>c(d({},o),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),we(t=>({onInit:()=>{t.getGJAdjustmentLoader(),t.getAdjustmentJournal(t.filter)}})));var H=t=>({"ng-invalid ng-dirty":t});function Be(t,l){if(t&1){let e=j();a(0,"p-button",10),T("onClick",function(){h(e);let i=f(2);return x(i.generateAdjusmentJournal())}),r()}}function Ge(t,l){if(t&1&&g(0,Be,1,0,"p-button",9),t&2){let e=f();s("ngIf",e.store.hasCheckedRows())}}function Oe(t,l){t&1&&(a(0,"tr")(1,"th",12),b(2,"p-tableHeaderCheckbox"),r(),a(3,"th",13),p(4,"Tag"),r(),a(5,"th",14),p(6,"Number"),r(),a(7,"th",15),p(8,"Date"),r(),a(9,"th",14),p(10,"Adjustment Qty"),r(),a(11,"th",13),p(12,"Type"),r(),a(13,"th",16),p(14,"State"),r(),a(15,"th",17),p(16,"Note"),r(),b(17,"th",18),r())}function Ue(t,l){if(t&1&&(a(0,"tr")(1,"td"),b(2,"p-tableCheckbox",19),r(),a(3,"td"),p(4),r(),a(5,"td")(6,"a",20),p(7),r()(),a(8,"td"),p(9),I(10,"date"),r(),a(11,"td"),p(12),I(13,"number"),r(),a(14,"td"),p(15),r(),a(16,"td"),p(17),r(),a(18,"td"),b(19,"div",21),r(),a(20,"td"),b(21,"p-button",22),r()()),t&2){let e=l.$implicit,n=f(2);m(2),s("value",e),m(2),S(e.outlet),m(2),s("href",n.authService.getTenantExternalURL()+"/menu/Adjustment/Adjustment/Archive/Info?ID="+e.id,O),m(),k(" ",e.number," "),m(2),S(R(10,12,e.date,"d MMM y")),m(3),S($(13,15,e.quantitySUM)),m(3),S(e.type),m(2),S(e.state),m(2),s("innerHTML",e.note,G),m(2),s("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function Le(t,l){if(t&1&&p(0),t&2){let e=f(2);W(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function We(t,l){t&1&&(a(0,"tr")(1,"td",23)(2,"span"),p(3,"No records found."),r()()())}function Ke(t,l){if(t&1){let e=j();a(0,"p-panel")(1,"p-table",11),T("onRowSelect",function(i){h(e);let o=f();return x(o.onRowSelect(i))})("onRowUnselect",function(i){h(e);let o=f();return x(o.onRowUnselect(i))})("onHeaderCheckboxToggle",function(i){h(e);let o=f();return x(o.onHeaderCheckboxToggle(i))})("onPage",function(i){h(e);let o=f();return x(o.onPageChange(i))}),g(2,Oe,18,0,"ng-template",null,3,C)(4,Ue,22,17,"ng-template",null,4,C)(6,Le,1,3,"ng-template",null,5,C)(8,We,4,0,"ng-template",null,6,C),r()()}if(t&2){let e=f();m(),s("value",e.store.data().data)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function qe(t,l){if(t&1&&(a(0,"span",33),p(1),I(2,"truncate"),r()),t&2){let e=l.$implicit;s("pTooltip",e.name),m(),k(" ",R(2,2,e.name,30)," ")}}function Qe(t,l){if(t&1&&(a(0,"div")(1,"span",35),p(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function $e(t,l){if(t&1&&(a(0,"div"),g(1,Qe,3,1,"div",34),r()),t&2){let e=f(2);m(),s("ngForOf",e.getErrors("from"))}}function Xe(t,l){if(t&1&&(a(0,"div")(1,"span",35),p(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function Ye(t,l){if(t&1&&(a(0,"div"),g(1,Xe,3,1,"div",34),r()),t&2){let e=f(2);m(),s("ngForOf",e.getErrors("to"))}}function Ze(t,l){if(t&1&&(a(0,"div")(1,"span",35),p(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function et(t,l){if(t&1&&(a(0,"div"),g(1,Ze,3,1,"div",34),r()),t&2){let e=f(2);m(),s("ngForOf",e.getErrors("pageSize"))}}function tt(t,l){if(t&1&&(a(0,"form",24)(1,"div",25)(2,"label",26),p(3,"Tag"),r(),a(4,"p-select",27),g(5,qe,3,5,"ng-template",null,7,C),r()(),a(7,"div",25)(8,"label",26),p(9,"From - To"),r(),a(10,"div",28),b(11,"p-datepicker",29),g(12,$e,2,1,"div",30),b(13,"p-datepicker",31),g(14,Ye,2,1,"div",30),r()(),a(15,"div",25)(16,"label",26),p(17,"Page Size"),r(),b(18,"input",32),g(19,et,2,1,"div",30),r()()),t&2){let e=f();s("formGroup",e.form),m(4),s("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),m(7),s("iconDisplay","input")("showIcon",!0)("ngClass",E(13,H,e.isInvalid("from"))),m(),s("ngIf",e.isInvalid("from")),m(),s("iconDisplay","input")("showIcon",!0)("ngClass",E(15,H,e.isInvalid("to"))),m(),s("ngIf",e.isInvalid("to")),m(4),s("ngClass",E(17,H,e.isInvalid("pageSize"))),m(),s("ngIf",e.isInvalid("pageSize"))}}var Bt=(()=>{class t extends Re{constructor(){super(),this.store=v(z),this.generateJournalService=v(A),this.authService=v(ne),this.isDialogFilterVisible=D(!1),this.isInitDialogFilterVisible=D(!1),this.fb=v(se),this.dayjsService=v(Ne)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:n,to:i,pageNumber:o,pageSize:u,export:_,exportPageNumber:Pe,exportPageSize:ze}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),outletName:this.fb.control(""),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),pageNumber:this.fb.control(o),pageSize:this.fb.control(u),export:this.fb.control(_),exportPageNumber:this.fb.control(Pe),exportPageSize:this.fb.control(ze)})}onSearch(e){this.store.updateFilter(c(d({},this.store.filter()),{number:e,pageNumber:1}))}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((n,[i,o])=>{switch(i){case"from":typeof o=="object"?n[i]=this.dayjsService.from(o)?this.dayjsService.format(o):null:n[i]=o!=null?String(o):null;break;case"to":typeof o=="object"?n[i]=this.dayjsService.from(o)?this.dayjsService.format(o):null:n[i]=o!=null?String(o):null;break;default:n[i]=o===null?"":o;break}return n},{});this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(n=>{this.store.onRowUnselect(n)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onPageChange(e){let n=e.first/e.rows;this.store.updateFilter(c(d({},this.store.filter()),{pageNumber:n+1}))}generateAdjusmentJournal(){this.generateJournalService.createAdjustmentJournal(this.store.checkedAdjustment()).pipe(B(()=>this.store.getAdjustmentJournal(this.store.filter))).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=U({type:t,selectors:[["app-adjustment-journal"]],features:[Q([z]),L],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Adjustment",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","onPage","value","paginator","rows","totalRecords","lazy"],[2,"width","1rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","11rem"],[2,"width","9rem"],[2,"width","14rem"],[2,"width","4rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"innerHTML"],[3,"icon","severity","text"],["colspan","9"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["virtualScroll","","showClear","","filter","","filterBy","name","formControlName","outletName","appendTo","body","optionLabel","name","optionValue","name","placeholder","Select an Tag",3,"virtualScrollItemSize","options"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["type","text","pInputText","","formControlName","pageSize","appMaskNumber","",3,"ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(n,i){if(n&1){let o=j();a(0,"app-main-panel",8),q("isDialogFilterVisibleChange",function(_){return h(o),N(i.isDialogFilterVisible,_)||(i.isDialogFilterVisible=_),x(_)})("isInitDialogFilterVisibleChange",function(_){return h(o),N(i.isInitDialogFilterVisible,_)||(i.isInitDialogFilterVisible=_),x(_)}),T("filterConfirmed",function(){return h(o),x(i.onFilterOKEvent())})("search",function(_){return h(o),x(i.onSearch(_))}),g(1,Ge,1,1,"ng-template",null,0,C)(3,Ke,10,5,"ng-template",null,1,C)(5,tt,20,19,"ng-template",null,2,C),r()}n&2&&(s("isSearchableInput",!0)("isFilterable",!0),K("isDialogFilterVisible",i.isDialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[Te,ke,Ve,Je,De,ie,X,Y,Z,te,ee,he,ge,_e,fe,Ie,Ee,Fe,Ae,de,le,oe,re,ae,me,pe,ce,ue,Se,be,xe,Me],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{Bt as AdjustmentJournalComponent};
1
+ import{a as A}from"./chunk-LO2GGXGQ.js";import{a as Me}from"./chunk-KZHI6PGZ.js";import{a as ne}from"./chunk-2RI2WRFG.js";import{b as Ne}from"./chunk-33JUCBXH.js";import{a as Re}from"./chunk-XKI7WLHE.js";import"./chunk-U2VDC52W.js";import{a as M,b as P}from"./chunk-3VQUNDVT.js";import{d as Ve,i as Je,j as De,k as ke}from"./chunk-DGACZ747.js";import{a as Ee,b as Ie}from"./chunk-EBEY2MBR.js";import"./chunk-AMGBUOC4.js";import"./chunk-UPSNJEHO.js";import"./chunk-VKNINE5Q.js";import"./chunk-E7QWESN4.js";import{a as Ae,b as Fe}from"./chunk-AN4SAUSA.js";import"./chunk-URH77XNK.js";import"./chunk-PPXXWO4E.js";import"./chunk-3DBSHDAQ.js";import"./chunk-M4SSELXT.js";import"./chunk-QPPFPDWZ.js";import"./chunk-WMZF4DQK.js";import{i as Te}from"./chunk-7P5XATXL.js";import"./chunk-S27Z7D3D.js";import{a as ge,b as he}from"./chunk-AD247LWQ.js";import{a as Se,b as w,c as Ce,d as ve,e as we,f as ye,g as je}from"./chunk-BKTBVFNX.js";import"./chunk-ZFNIPERQ.js";import{n as ue,o as ce,w as fe,x as _e,y as xe,z as be}from"./chunk-ME4ALIS7.js";import"./chunk-DTYVTTET.js";import{b as oe,e as re,f as ae,k as le,l as me,o as pe,u as se,x as de}from"./chunk-VMI3QWC6.js";import"./chunk-F7PVAVLQ.js";import"./chunk-C4W7XYJD.js";import"./chunk-5DRALZZF.js";import"./chunk-2BI7WNJP.js";import{h as X,j as Y,k as Z,p as ee,q as te,s as ie}from"./chunk-ZK43JB4A.js";import"./chunk-F2X3VGZZ.js";import{Cb as L,Dc as Q,Eb as g,Fc as E,Ha as D,Mb as s,Oc as I,Pc as $,Qc as R,Sc as C,Wb as a,Xb as r,Y as J,Yb as b,_ as B,ac as j,bd as y,c as F,db as G,eb as O,fc as T,gc as f,ia as v,ib as m,qa as h,ra as x,s as V,sc as p,tc as S,uc as k,wc as W,xc as K,yb as U,yc as N,zc as q}from"./chunk-6QJHEOXN.js";import{a as d,b as c}from"./chunk-YQFG5XE2.js";var He={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,from:null,to:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,outletName:""}},filter:{number:null,from:null,to:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,outletName:""}},z=Ce(je(He),ve(t=>({first:y(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:y(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:y(()=>t.data().data.some(l=>l.checked)),checkedAdjustment:y(()=>t.data().data.filter(l=>l.checked).map(l=>l.id))})),ye(t=>{let l=v(A);return{updateFilter(n){w(t,i=>c(d({},i),{filter:d(d({},i.filter),n)}))},onRowSelect(n){w(t,i=>{let o=i.data.data.map(u=>u.id===n.id?c(d({},u),{checked:!0}):u);return c(d({},i),{data:c(d({},i.data),{data:o})})})},onRowUnselect(n){w(t,i=>{let o=i.data.data.map(u=>u.id===n.id?c(d({},u),{checked:!1}):u);return c(d({},i),{data:c(d({},i.data),{data:o})})})},onHeaderCheckboxToggle(n){w(t,i=>{let o=i.data.data.map(u=>c(d({},u),{checked:n}));return c(d({},i),{data:c(d({},i.data),{data:o})})})},getGJAdjustmentLoader:M(F(J(()=>l.getGJAdjustmentLoader().pipe(P({next:n=>{w(t,i=>c(d({},i),{meta:n}))},error:n=>{console.error("Error fetching adjustment loader:",n)}}))))),getAdjustmentJournal:M(F(V(n=>Object.entries(n).reduce((i,[o,u])=>(u!=null&&(i[o]=u),i),{})),J(n=>l.getAdjustmentJournal(n).pipe(V(i=>c(d({},i),{data:i.data.map(o=>c(d({},o),{checked:!1}))})),P({next:i=>{w(t,o=>c(d({},o),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),we(t=>({onInit:()=>{t.getGJAdjustmentLoader(),t.getAdjustmentJournal(t.filter)}})));var H=t=>({"ng-invalid ng-dirty":t});function Be(t,l){if(t&1){let e=j();a(0,"p-button",10),T("onClick",function(){h(e);let i=f(2);return x(i.generateAdjusmentJournal())}),r()}}function Ge(t,l){if(t&1&&g(0,Be,1,0,"p-button",9),t&2){let e=f();s("ngIf",e.store.hasCheckedRows())}}function Oe(t,l){t&1&&(a(0,"tr")(1,"th",12),b(2,"p-tableHeaderCheckbox"),r(),a(3,"th",13),p(4,"Tag"),r(),a(5,"th",14),p(6,"Number"),r(),a(7,"th",15),p(8,"Date"),r(),a(9,"th",14),p(10,"Adjustment Qty"),r(),a(11,"th",13),p(12,"Type"),r(),a(13,"th",16),p(14,"State"),r(),a(15,"th",17),p(16,"Note"),r(),b(17,"th",18),r())}function Ue(t,l){if(t&1&&(a(0,"tr")(1,"td"),b(2,"p-tableCheckbox",19),r(),a(3,"td"),p(4),r(),a(5,"td")(6,"a",20),p(7),r()(),a(8,"td"),p(9),I(10,"date"),r(),a(11,"td"),p(12),I(13,"number"),r(),a(14,"td"),p(15),r(),a(16,"td"),p(17),r(),a(18,"td"),b(19,"div",21),r(),a(20,"td"),b(21,"p-button",22),r()()),t&2){let e=l.$implicit,n=f(2);m(2),s("value",e),m(2),S(e.outlet),m(2),s("href",n.authService.getTenantExternalURL()+"/menu/Adjustment/Adjustment/Archive/Info?ID="+e.id,O),m(),k(" ",e.number," "),m(2),S(R(10,12,e.date,"d MMM y")),m(3),S($(13,15,e.quantitySUM)),m(3),S(e.type),m(2),S(e.state),m(2),s("innerHTML",e.note,G),m(2),s("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function Le(t,l){if(t&1&&p(0),t&2){let e=f(2);W(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function We(t,l){t&1&&(a(0,"tr")(1,"td",23)(2,"span"),p(3,"No records found."),r()()())}function Ke(t,l){if(t&1){let e=j();a(0,"p-panel")(1,"p-table",11),T("onRowSelect",function(i){h(e);let o=f();return x(o.onRowSelect(i))})("onRowUnselect",function(i){h(e);let o=f();return x(o.onRowUnselect(i))})("onHeaderCheckboxToggle",function(i){h(e);let o=f();return x(o.onHeaderCheckboxToggle(i))})("onPage",function(i){h(e);let o=f();return x(o.onPageChange(i))}),g(2,Oe,18,0,"ng-template",null,3,C)(4,Ue,22,17,"ng-template",null,4,C)(6,Le,1,3,"ng-template",null,5,C)(8,We,4,0,"ng-template",null,6,C),r()()}if(t&2){let e=f();m(),s("value",e.store.data().data)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function qe(t,l){if(t&1&&(a(0,"span",33),p(1),I(2,"truncate"),r()),t&2){let e=l.$implicit;s("pTooltip",e.name),m(),k(" ",R(2,2,e.name,30)," ")}}function Qe(t,l){if(t&1&&(a(0,"div")(1,"span",35),p(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function $e(t,l){if(t&1&&(a(0,"div"),g(1,Qe,3,1,"div",34),r()),t&2){let e=f(2);m(),s("ngForOf",e.getErrors("from"))}}function Xe(t,l){if(t&1&&(a(0,"div")(1,"span",35),p(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function Ye(t,l){if(t&1&&(a(0,"div"),g(1,Xe,3,1,"div",34),r()),t&2){let e=f(2);m(),s("ngForOf",e.getErrors("to"))}}function Ze(t,l){if(t&1&&(a(0,"div")(1,"span",35),p(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function et(t,l){if(t&1&&(a(0,"div"),g(1,Ze,3,1,"div",34),r()),t&2){let e=f(2);m(),s("ngForOf",e.getErrors("pageSize"))}}function tt(t,l){if(t&1&&(a(0,"form",24)(1,"div",25)(2,"label",26),p(3,"Tag"),r(),a(4,"p-select",27),g(5,qe,3,5,"ng-template",null,7,C),r()(),a(7,"div",25)(8,"label",26),p(9,"From - To"),r(),a(10,"div",28),b(11,"p-datepicker",29),g(12,$e,2,1,"div",30),b(13,"p-datepicker",31),g(14,Ye,2,1,"div",30),r()(),a(15,"div",25)(16,"label",26),p(17,"Page Size"),r(),b(18,"input",32),g(19,et,2,1,"div",30),r()()),t&2){let e=f();s("formGroup",e.form),m(4),s("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),m(7),s("iconDisplay","input")("showIcon",!0)("ngClass",E(13,H,e.isInvalid("from"))),m(),s("ngIf",e.isInvalid("from")),m(),s("iconDisplay","input")("showIcon",!0)("ngClass",E(15,H,e.isInvalid("to"))),m(),s("ngIf",e.isInvalid("to")),m(4),s("ngClass",E(17,H,e.isInvalid("pageSize"))),m(),s("ngIf",e.isInvalid("pageSize"))}}var Bt=(()=>{class t extends Re{constructor(){super(),this.store=v(z),this.generateJournalService=v(A),this.authService=v(ne),this.isDialogFilterVisible=D(!1),this.isInitDialogFilterVisible=D(!1),this.fb=v(se),this.dayjsService=v(Ne)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:n,to:i,pageNumber:o,pageSize:u,export:_,exportPageNumber:Pe,exportPageSize:ze}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),outletName:this.fb.control(""),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),pageNumber:this.fb.control(o),pageSize:this.fb.control(u),export:this.fb.control(_),exportPageNumber:this.fb.control(Pe),exportPageSize:this.fb.control(ze)})}onSearch(e){this.store.updateFilter(c(d({},this.store.filter()),{number:e,pageNumber:1}))}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((n,[i,o])=>{switch(i){case"from":typeof o=="object"?n[i]=this.dayjsService.from(o)?this.dayjsService.format(o):null:n[i]=o!=null?String(o):null;break;case"to":typeof o=="object"?n[i]=this.dayjsService.from(o)?this.dayjsService.format(o):null:n[i]=o!=null?String(o):null;break;default:n[i]=o===null?"":o;break}return n},{});this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(n=>{this.store.onRowUnselect(n)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onPageChange(e){let n=e.first/e.rows;this.store.updateFilter(c(d({},this.store.filter()),{pageNumber:n+1}))}generateAdjusmentJournal(){this.generateJournalService.createAdjustmentJournal(this.store.checkedAdjustment()).pipe(B(()=>this.store.getAdjustmentJournal(this.store.filter))).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=U({type:t,selectors:[["app-adjustment-journal"]],features:[Q([z]),L],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Adjustment",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","onPage","value","paginator","rows","totalRecords","lazy"],[2,"width","1rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","11rem"],[2,"width","9rem"],[2,"width","14rem"],[2,"width","4rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"innerHTML"],[3,"icon","severity","text"],["colspan","9"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["virtualScroll","","showClear","","filter","","filterBy","name","formControlName","outletName","appendTo","body","optionLabel","name","optionValue","name","placeholder","Select an Tag",3,"virtualScrollItemSize","options"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["type","text","pInputText","","formControlName","pageSize","appMaskNumber","",3,"ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(n,i){if(n&1){let o=j();a(0,"app-main-panel",8),q("isDialogFilterVisibleChange",function(_){return h(o),N(i.isDialogFilterVisible,_)||(i.isDialogFilterVisible=_),x(_)})("isInitDialogFilterVisibleChange",function(_){return h(o),N(i.isInitDialogFilterVisible,_)||(i.isInitDialogFilterVisible=_),x(_)}),T("filterConfirmed",function(){return h(o),x(i.onFilterOKEvent())})("search",function(_){return h(o),x(i.onSearch(_))}),g(1,Ge,1,1,"ng-template",null,0,C)(3,Ke,10,5,"ng-template",null,1,C)(5,tt,20,19,"ng-template",null,2,C),r()}n&2&&(s("isSearchableInput",!0)("isFilterable",!0),K("isDialogFilterVisible",i.isDialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[Te,ke,Ve,Je,De,ie,X,Y,Z,te,ee,he,ge,_e,fe,Ie,Ee,Fe,Ae,de,le,oe,re,ae,me,pe,ce,ue,Se,be,xe,Me],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{Bt as AdjustmentJournalComponent};