dealposbooks 5.43.0 → 5.43.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/{chunk-MGTSVSFN.js → chunk-2VQQEXJA.js} +1 -1
  2. package/{chunk-6EDSP2AA.js → chunk-33OH23NL.js} +1 -1
  3. package/{chunk-HVXMIONQ.js → chunk-35ITGGSZ.js} +1 -1
  4. package/{chunk-MDMGBODU.js → chunk-4L2F2JYT.js} +1 -1
  5. package/{chunk-6MOKBNZ6.js → chunk-4QA6PJYM.js} +1 -1
  6. package/{chunk-NDWYDOFG.js → chunk-6KDFPHJV.js} +1 -1
  7. package/{chunk-4TSB6554.js → chunk-77OBQMSS.js} +1 -1
  8. package/chunk-7B6EWIM4.js +1 -0
  9. package/{chunk-FFBH7KYD.js → chunk-7DONF5P4.js} +1 -1
  10. package/{chunk-MWKQV6FL.js → chunk-7YNVXRQ3.js} +1 -1
  11. package/{chunk-PNDE7M5T.js → chunk-AWCGYJP7.js} +1 -1
  12. package/{chunk-GKFRKDT6.js → chunk-AYUFYFUB.js} +1 -1
  13. package/{chunk-SUKZ6XS4.js → chunk-BAHH4HL3.js} +1 -1
  14. package/{chunk-M3WCSF6D.js → chunk-BM3MNYWW.js} +1 -1
  15. package/{chunk-ZIEHNLX3.js → chunk-CQ2SMQNS.js} +1 -1
  16. package/{chunk-5CI4POVW.js → chunk-E2HTGITF.js} +1 -1
  17. package/{chunk-DG63C6O3.js → chunk-FOUSV5W2.js} +1 -1
  18. package/{chunk-VTMQTY2F.js → chunk-GB5M23CX.js} +1 -1
  19. package/{chunk-3MDAGJGX.js → chunk-GDGNBGCE.js} +1 -1
  20. package/{chunk-VNUZJSHB.js → chunk-GJWSARZM.js} +1 -1
  21. package/{chunk-3TIJYNSV.js → chunk-GTDIXMKH.js} +1 -1
  22. package/{chunk-XYU7C523.js → chunk-HGVXVOFY.js} +1 -1
  23. package/{chunk-4JVYK7DR.js → chunk-HR4JVZ4V.js} +1 -1
  24. package/{chunk-UYGD5VP2.js → chunk-JYJZS4U4.js} +1 -1
  25. package/{chunk-IY4CV424.js → chunk-KAWGMTDN.js} +1 -1
  26. package/{chunk-6JKCYLO5.js → chunk-KUDR6C6Y.js} +1 -1
  27. package/{chunk-AUWCRG4B.js → chunk-L33MZZPK.js} +1 -1
  28. package/{chunk-2DSX3KAL.js → chunk-NJ7D3QYH.js} +2 -2
  29. package/{chunk-7PDMDNJK.js → chunk-NXAQCWYX.js} +1 -1
  30. package/{chunk-B4JW5G5L.js → chunk-O6PHQDZH.js} +1 -1
  31. package/{chunk-SVFKNAYN.js → chunk-QC3F6W4P.js} +2 -2
  32. package/{chunk-ROJ6NA2I.js → chunk-QNCIH2ZA.js} +1 -1
  33. package/{chunk-O5EVYQVN.js → chunk-R3GHYD6Y.js} +1 -1
  34. package/{chunk-JRH7ZWIT.js → chunk-RD2UE5ML.js} +1 -1
  35. package/{chunk-Q6NOUY4Z.js → chunk-RK2BTJAS.js} +1 -1
  36. package/{chunk-O6C3N77O.js → chunk-RMOBSREQ.js} +1 -1
  37. package/{chunk-7R6GFW7F.js → chunk-RVN2ENY5.js} +1 -1
  38. package/{chunk-EM4HKTKQ.js → chunk-S7IT3NE6.js} +1 -1
  39. package/{chunk-LT3ZB5UZ.js → chunk-U3TFXUW7.js} +1 -1
  40. package/{chunk-UCCAYD3A.js → chunk-UJDPTU63.js} +2 -2
  41. package/{chunk-MJJXITD5.js → chunk-VCIDPN4K.js} +1 -1
  42. package/{chunk-Q2RQ5PCS.js → chunk-VRD577YD.js} +1 -1
  43. package/{chunk-J2LCCQ6P.js → chunk-WJA77OH2.js} +1 -1
  44. package/{chunk-J7XLDEPN.js → chunk-WJVRZNOB.js} +1 -1
  45. package/{chunk-KBXNDYNF.js → chunk-WUQXNEUF.js} +1 -1
  46. package/{chunk-X6D7ZE6G.js → chunk-XZG6FHL4.js} +1 -1
  47. package/{chunk-6WBZACEK.js → chunk-ZB7BW4AF.js} +1 -1
  48. package/{chunk-3XWJYJ4W.js → chunk-ZQE76MZZ.js} +1 -1
  49. package/index.html +2 -2
  50. package/{main-2JJLKGIJ.js → main-VEXPCE7F.js} +1 -1
  51. package/package.json +1 -1
  52. package/chunk-23R63A5E.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as st}from"./chunk-SMZ363LC.js";import{a as we,b as De}from"./chunk-CX3TZ3F3.js";import{a as Se}from"./chunk-EM4HKTKQ.js";import{a as Ht,b as me}from"./chunk-JRH7ZWIT.js";import{b as Ut,c as pt,d as mt}from"./chunk-HEX727RH.js";import{a as se,b as ce}from"./chunk-BJ4RON42.js";import"./chunk-CNXEJBY5.js";import{b as at}from"./chunk-MPHY6FVN.js";import"./chunk-NMSYINDE.js";import{a as ie}from"./chunk-ORLKNWW4.js";import"./chunk-WLKS6LBU.js";import{a as Ee,b as Ie}from"./chunk-NHZLS6JU.js";import{a as ot,b as rt,d as ae,k as pe}from"./chunk-KLKIEREL.js";import{a as re,b as le}from"./chunk-76LPTGLX.js";import"./chunk-CWHL7PNC.js";import"./chunk-VRKBMD72.js";import{a as lt}from"./chunk-Q6NOUY4Z.js";import{a as ke}from"./chunk-KXE3J4PK.js";import{b as ye}from"./chunk-E3QNEH3B.js";import"./chunk-EOT2WEXN.js";import{a as qt,b as Te}from"./chunk-X4KTMWVO.js";import"./chunk-I7ILLTFH.js";import"./chunk-2LQVI4EI.js";import"./chunk-AJZ7YLT4.js";import"./chunk-ATJ55H5D.js";import"./chunk-SPKOXGSS.js";import{d as $e}from"./chunk-3KYU6FI2.js";import"./chunk-IJTQE2H4.js";import{b as oe}from"./chunk-WXT6EZ2V.js";import{e as it,f as nt,h as ne}from"./chunk-O5EVYQVN.js";import{b as jt,c as zt}from"./chunk-L3PZS6EL.js";import{a as Xe,b as te}from"./chunk-5JV52UYK.js";import{a as O,b as Je,c as Qe,d as Ze,e as et,f as tt}from"./chunk-ACTRMWEI.js";import"./chunk-ARXP327B.js";import{n as Ke,o as Ye,w as Z,x as ee}from"./chunk-7FFMPB6T.js";import{b as ve}from"./chunk-UKBDY33R.js";import{b as We,c as Pt,e as K,f as Y,g as Ot,i as dt,k as $,l as X,o as J,u as Ce,x as Q}from"./chunk-72LNXEXV.js";import{b as He,e as U,l as W}from"./chunk-EFDD6Q3K.js";import{a as Gt,b as be}from"./chunk-M3WCSF6D.js";import{a as Ue}from"./chunk-ZDTMCWOO.js";import"./chunk-F2X3VGZZ.js";import{h as ze,k as z,p as qe,q,s as H,y as Bt,z as At}from"./chunk-SB5MSLCX.js";import{$b as D,Ac as ct,Bc as de,Cc as Oe,D as Be,Db as x,Dc as F,Ec as V,Fc as Nt,Gc as je,Ha as E,Lb as s,Nc as C,Ob as Ae,Oc as y,Pc as Me,Qb as M,Rb as Re,Rc as _,Tb as Fe,Ub as Ve,Vb as o,W as Ft,Wb as r,X as Vt,Xb as T,Y as xe,Yb as Ge,Zb as Pe,_ as L,bd as R,c as ge,ca as Lt,cb as j,cd as ue,db as he,ec as I,fc as c,hb as p,ia as S,ic as Mt,qa as h,ra as b,rc as l,s as Ne,sc as f,tc as w,uc as Le,wc as A,xb as N,xc as B,yc as P,zc as kt}from"./chunk-6K5LNQ4J.js";import{a as g,b as v,c as fe,e as Rt}from"./chunk-YQFG5XE2.js";var G=(()=>{class t{constructor(){this.httpService=S(Gt),this.authService=S(Se)}fetchGeneralLedgerLoader(e="single",n={}){return this.httpService.get(void 0,`api/GeneralLedgerLoader/${e==="single"?"GetFilterSingle":"GetFilter"}`,{params:n})}getGLCount(e){return this.httpService.post(void 0,"api/GeneralLedger/GetSingleCount",e)}fetchGeneralLedgerReport(e,n="single"){return this.httpService.post(void 0,`api/GeneralLedger/${n==="single"?"GetSingle":"Get"}`,e)}exportGeneralLedger(e,n={}){let i=g({responseType:"blob"},n);return this.httpService.post(void 0,"/api/GeneralLedgerExport/GetGeneralLedgerExport",e,i)}getCustomerSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/API/AC/GetCustomerSuggestion",{params:n})}getSupplierSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/API/AC/GetSupplierSuggestion",{params:n})}getCashierSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/api/ac/GetUserSuggestion",{params:n})}getBalanceSheetLoader(){return this.httpService.get(void 0,"/api/BalanceSheetLoader/GetBalanceSheet")}getBalanceSheet(e,n={}){let i=new At({fromObject:Object.fromEntries(Object.entries(e).map(([d,k])=>[d,String(k)]))}),a=new Bt({"X-Timeout":"50000","X-Retry":"3","X-Retry-Delay":"2000","X-Exponential-Backoff":"true","X-Retry-On-500":"true","X-Retry-On-500-Message":"timeout expired"}),u=g({params:i,headers:a},n);return this.httpService.get(void 0,"/api/BalanceSheet",u)}getIncomeStatementLoader(){return this.httpService.get(void 0,"api/IncomeStatementLoader/Filter")}getIncomeStatement(e,n={}){return this.httpService.post(void 0,"api/IncomeStatement/List",g({},e),n)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=Lt({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var ri=()=>({width:"30vw"}),li=()=>({"1199px":"75vw","575px":"90vw"}),ai=t=>({"ng-dirty ng-invalid":t}),pi=t=>["/pages/journal/journal-entry/",t],mi=t=>({"text-success":t}),si=t=>({"text-danger":t});function ci(t,m){if(t&1&&(o(0,"div",33)(1,"div",34)(2,"span",35),l(3),r()(),o(4,"div")(5,"span"),l(6,"-"),r()(),o(7,"div",34)(8,"span",36),l(9),r()()()),t&2){let e=m.$implicit;p(3),w("(",e.code,")"),p(6),f(e.name)}}function di(t,m){if(t&1&&(o(0,"div",33)(1,"div",34)(2,"span",35),l(3),r()(),o(4,"div")(5,"span"),l(6,"-"),r()(),o(7,"div",34)(8,"span",36),l(9),r()()()),t&2){let e=m.$implicit;p(3),w("(",e.code,")"),p(6),f(e.name)}}function ui(t,m){t&1&&(o(0,"div",37),l(1," Account is required. "),r())}function _i(t,m){if(t&1&&(o(0,"div",38)(1,"div"),l(2),r()()),t&2){let e=m.$implicit;p(2),f(e.value)}}function fi(t,m){if(t&1&&(o(0,"div",26)(1,"div",27),T(2,"p-radiobutton",39),o(3,"label",40),l(4),r()()()),t&2){let e=m.$implicit;p(2),s("value",e.key)("inputId",e.key),p(),s("for",e.key),p(),f(e.value)}}function gi(t,m){if(t&1){let e=D();o(0,"div",16)(1,"label",17),l(2,"Customer"),r(),o(3,"p-autocomplete",41),I("completeMethod",function(i){h(e);let a=c(3);return b(a.searchCustomer(i))}),r()()}if(t&2){let e=c(3);p(3),s("suggestions",e.customerSuggestions())}}function xi(t,m){if(t&1){let e=D();o(0,"div",16)(1,"label",17),l(2,"Supplier"),r(),o(3,"p-autocomplete",42),I("completeMethod",function(i){h(e);let a=c(3);return b(a.searchSupplier(i))}),r()()}if(t&2){let e=c(3);p(3),s("suggestions",e.supplierSuggestions())}}function hi(t,m){if(t&1){let e=D();o(0,"div",16)(1,"label",17),l(2,"Customer"),r(),o(3,"p-autocomplete",41),I("completeMethod",function(i){h(e);let a=c(3);return b(a.searchCustomer(i))}),r()()}if(t&2){let e=c(3);p(3),s("suggestions",e.customerSuggestions())}}function bi(t,m){if(t&1&&(o(0,"form",15)(1,"div",16)(2,"label",17),l(3,"Accounts"),r(),o(4,"p-select",18),x(5,ci,10,2,"ng-template",null,5,_)(7,di,10,2,"ng-template",null,6,_),r(),x(9,ui,2,0,"div",19),r(),o(10,"div",16)(11,"label",17),l(12,"From"),r(),o(13,"div",20),T(14,"p-datepicker",21)(15,"p-datepicker",22),r()(),o(16,"div",16)(17,"label",17),l(18,"Outlets"),r(),o(19,"p-multiselect",23),x(20,_i,3,1,"ng-template",null,6,_),r()(),o(22,"div",16)(23,"label",24),l(24,"Contact Type"),r(),o(25,"div",25),Fe(26,fi,5,4,"div",26,Re),r()(),x(28,gi,4,1,"div",16)(29,xi,4,1,"div",16)(30,hi,4,1,"div",16),o(31,"div",16)(32,"label",24),l(33,"Sort order"),r(),o(34,"div",25)(35,"div",26)(36,"div",27),T(37,"p-radiobutton",28),o(38,"label",29),l(39,"Asc"),r()()(),o(40,"div",30)(41,"div",27),T(42,"p-radiobutton",31),o(43,"label",32),l(44,"Desc"),r()()()()()()),t&2){let e,n,i,a=c(2);s("formGroup",a.form),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",a.loaderMetadata().options.accounts)("ngClass",V(14,ai,((e=a.form.get("accountID"))==null?null:e.invalid)&&(((e=a.form.get("accountID"))==null?null:e.touched)||((e=a.form.get("accountID"))==null?null:e.dirty)))),p(5),s("ngIf",((n=a.form.get("accountID"))==null?null:n.invalid)&&(((n=a.form.get("accountID"))==null?null:n.touched)||((n=a.form.get("accountID"))==null?null:n.dirty))),p(5),s("showIcon",!0),p(),s("showIcon",!0),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",a.loaderMetadata().options.outlets),p(7),Ve(a.loaderMetadata().options.contactTypeOptions),p(2),M((i=a.form.controls.contactType.value)===1?28:i===2?29:30),p(9),s("value",!0),p(5),s("value",!1)}}function Si(t,m){if(t&1&&x(0,bi,45,16,"form",14),t&2){let e=c();s("ngIf",e.loaderMetadata())}}function Ci(t,m){if(t&1){let e=D();o(0,"p-button",45),I("onClick",function(){h(e);let i=c(2);return b(i.onToggleExportDialog())}),r()}}function vi(t,m){if(t&1&&(o(0,"div",33)(1,"a",43),l(2,"Return to Accounts"),r(),x(3,Ci,1,0,"p-button",44),r()),t&2){let e=c();p(3),s("ngIf",e.roleService.global.export)}}function yi(t,m){t&1&&T(0,"div",52)}function Ei(t,m){t&1&&(o(0,"tr")(1,"th",53),l(2,"Outlet"),r(),o(3,"th",53),l(4,"No."),r(),o(5,"th",53),l(6,"Date"),r(),o(7,"th"),l(8,"Contact / Note"),r(),o(9,"th",54),l(10,"Debit"),r(),o(11,"th",54),l(12,"Credit"),r(),o(13,"th",55),l(14,"Balance"),r()())}function Ii(t,m){if(t&1&&(o(0,"div",16)(1,"a",59),l(2),r(),T(3,"div",63),o(4,"span",64),l(5),r()()),t&2){let e=c().$implicit,n=c(3);p(),s("href",n.authService.getTenantExternalURL()+n.buildReferenceUrl(e),he),p(),f(e.referenceText),p(),s("innerHTML",e.journalNote,j),p(2),w("",e.note," ")}}function Ti(t,m){if(t&1&&(o(0,"div",16),T(1,"span",63)(2,"div",63),o(3,"span",65),l(4),r()()),t&2){let e=c().$implicit;p(),s("innerHTML",e.referenceText,j),p(),s("innerHTML",e.journalNote,j),p(2),w("",e.note," ")}}function wi(t,m){if(t&1&&(Ge(0),l(1),C(2,"number"),Pe()),t&2){let e=c().$implicit;p(),w(" ",y(2,1,e.debitAmount)," ")}}function Di(t,m){if(t&1&&(Ge(0),l(1),C(2,"number"),Pe()),t&2){let e=c().$implicit;p(),w(" ",y(2,1,e.creditAmount)," ")}}function Ri(t,m){if(t&1&&(Ge(0),l(1),C(2,"number"),Pe()),t&2){let e=c().$implicit;p(),w(" ",y(2,1,e.balance)," ")}}function Fi(t,m){if(t&1&&(o(0,"tr")(1,"td",56),l(2),r(),o(3,"td",56)(4,"a",57),l(5),r()(),o(6,"td",56)(7,"span",58),C(8,"date"),l(9),C(10,"date"),r()(),o(11,"td",56)(12,"div",16)(13,"a",59),l(14),r(),x(15,Ii,6,4,"div",16)(16,Ti,5,3,"div",16),r()(),o(17,"td",60),x(18,wi,3,3,"ng-container",61),r(),o(19,"td",60),x(20,Di,3,3,"ng-container",61),r(),o(21,"td",62),x(22,Ri,3,3,"ng-container",61),r()()),t&2){let e=m.$implicit,n=c(3);p(2),f(e.outletName),p(2),s("routerLink",V(19,pi,e.id)),p(),f(e.number),p(2),s("pTooltip",Me(8,13,e.date,"dd MMM y")),p(2),w(" ",Me(10,16,e.date,"dd MMM y")," "),p(4),s("href",n.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.contactID,he),p(),f(e.contactName),p(),M(n.buildReferenceUrl(e)?15:16),p(2),s("ngClass",V(21,mi,e.debitAmount!==0)),p(),s("ngIf",e.debitAmount!==0),p(),s("ngClass",V(23,si,e.creditAmount!==0)),p(),s("ngIf",e.creditAmount!==0),p(2),s("ngIf",e.balance!==0)}}function Vi(t,m){if(t&1&&(o(0,"tr"),T(1,"td",66),o(2,"td",67),l(3,"Total"),r(),o(4,"td",68),l(5),C(6,"number"),r(),o(7,"td",69),l(8),C(9,"number"),r(),T(10,"td"),r()),t&2){let e=c(3);p(5),w(" ",y(6,2,e.debitSubTotal())," "),p(3),w(" ",y(9,4,e.creditSubTotal())," ")}}function Li(t,m){t&1&&(o(0,"tr")(1,"td",70)(2,"span"),l(3,"No records found."),r()()())}function Mi(t,m){if(t&1){let e=D();o(0,"button",71),I("click",function(){h(e);let i=c(3);return b(i.getGLCount())})("keyup.enter",function(){h(e);let i=c(3);return b(i.getGLCount())}),r()}}function ki(t,m){if(t&1&&l(0),t&2){let e=c(3);w(" ",e.count()," ")}}function Ni(t,m){if(t&1){let e=D();o(0,"p-button",72),I("onClick",function(){h(e);let i=c(3);return b(i.onNextPage())}),r()}}function Bi(t,m){if(t&1&&(o(0,"div",47)(1,"p-table",48),x(2,yi,1,0,"ng-template",null,7,_)(4,Ei,15,0,"ng-template",null,8,_)(6,Fi,23,25,"ng-template",null,9,_)(8,Vi,11,6,"ng-template",null,4,_)(10,Li,4,0,"ng-template",null,10,_),r(),o(12,"div",49)(13,"div"),l(14),x(15,Mi,1,0,"button",50)(16,ki,1,1),l(17," entries "),r(),o(18,"div",33),x(19,Ni,1,0,"p-button",51),r()()()),t&2){let e=c(2);p(),s("value",e.items().data.data),p(13),Le(" Showing ",e.pagination().first," to ",e.pagination().end," of "),p(),M(e.totalRecords()===-1?15:16),p(4),M(e.pagination().hasNext?19:-1)}}function Ai(t,m){if(t&1&&x(0,Bi,20,5,"div",46),t&2){let e=c();s("ngIf",e.items()&&e.items().data)}}function Gi(t,m){if(t&1&&(o(0,"div",73)(1,"div",74)(2,"div",75)(3,"div",25)(4,"div",76)(5,"label",24),l(6,"Page"),r()(),o(7,"div",76),T(8,"input",77),r()()()(),o(9,"div",78)(10,"div",27),T(11,"i",79),o(12,"span",80),l(13),C(14,"number"),C(15,"number"),r()()()()),t&2){let e=c();p(),s("formGroup",e.form),p(12),Le("Exporting data from ",y(14,3,e.filter().exportPageNumber)," - ",y(15,5,e.filter().exportPageSize),"")}}function Pi(t,m){if(t&1){let e=D();o(0,"p-button",81),I("onClick",function(){h(e);let i=c();return b(i.onToggleExportDialog())}),r()}t&2&&s("rounded",!0)("text",!0)}function Oi(t,m){if(t&1){let e=D();o(0,"p-button",82),I("click",function(){h(e);let i=c();return b(i.onToggleExportDialog())}),r(),o(1,"p-button",83),I("click",function(){h(e);let i=c();return b(i.onExport())}),r()}}var Kt=(()=>{class t{getGLCount(){this.reportService.getGLCount(this.filter()).pipe(L(({count:e})=>{this.totalRecords.set(e)})).subscribe()}onToggleExportDialog(){this.isDialogExportVisible.update(e=>!e)}get pageTitle(){return this.items()&&this.items().pageTitle?this.items().pageTitle:"General Ledger"}constructor(){this.reportService=S(G),this.route=S(He),this.roleService=S(ie),this.authService=S(Se),this.fb=S(Ce),this.coaService=S(lt),this.toastr=S(Ue),this.dayjsService=S(me),this.metadata=E(null),this.items=E(null),this.totalRecords=E(-1),this.dialogFilterVisible=E(!0),this.initDialogVisible=E(!1),this.isDialogExportVisible=E(!1),this.customerSuggestions=E([]),this.supplierSuggestions=E([]),this.categoriesOptions=E([]),this.localFilter=E({}),this.count=R(()=>this.totalRecords()<0?1/0:this.totalRecords()),this.lastGetDataLength=E(0),this.pagination=R(()=>{let e=this.filter(),n=this.totalRecords()!=null&&this.totalRecords()>=0?this.totalRecords():1/0,i=this.items()?.data?.data?.length||0,a=i==n||this.lastGetDataLength()<e.pageSize;return{first:1,end:e.pageSize>0?i:0,total:n,page:e.pageNumber,pageSize:e.pageSize,hasPrev:e.pageNumber>1,hasNext:!a}}),this.queryFilter=ve(this.route.queryParamMap.pipe(Ne(e=>{let n=e.get("from")?this.dayjsService.format(new Date(e.get("from"))):null,i=e.get("to")?this.dayjsService.format(new Date(e.get("to"))):null,a={},u=e.get("id");return be.IsNotEmpty(u)&&(a=v(g({},a),{accountID:u})),be.IsNotEmpty(n)&&be.IsNotEmpty(i)&&(a=v(g({},a),{from:n,to:i})),a})),{initialValue:null}),this.loaderMetadata=ve(this.reportService.fetchGeneralLedgerLoader("single",this.queryFilter()),{initialValue:null}),this.baseFilter=R(()=>{let e=this.loaderMetadata();return e?e.filter:null}),this.exportFileTypes=E([{key:0,value:"CSV"},{key:1,value:"Excel"}]),this.filter=R(()=>{let e=this.baseFilter(),n=this.localFilter();return e?g(g({},e),n):null}),this.creditSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.creditAmount)||0),0)),this.debitSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.debitAmount)||0),0)),this.initializeForm(),ue(()=>{let e=this.filter();e&&(be.IsEmpty(this.form.value.accountID)||this.form.value.accountID!==e.accountID)&&this.form.patchValue(this.transformFilterToFormValue(e),{emitEvent:!1})}),ue(()=>{let e=this.filter(),n=this.form.value.accountID;!e||be.IsEmpty(n)||this.reportService.fetchGeneralLedgerReport(e).subscribe(i=>{this.lastGetDataLength.set(i.data?.data?.length),this.items.update(a=>e.pageNumber===1?i:v(g({},i),{data:v(g({},i.data),{data:[...a?.data.data??[],...i.data.data]})}))})})}buildReferenceUrl(e){return st(e)}ngOnInit(){this.route.queryParamMap.pipe(Be(e=>e.keys.length>0)).subscribe({next:()=>this.initDialogVisible.set(!0)})}initializeForm(){this.form=this.fb.group({accountID:this.fb.control(null,[Pt.required]),from:this.fb.control(null),to:this.fb.control(new Date),contactType:this.fb.control(null),contactID:this.fb.control(""),listOutletID:this.fb.control([]),pageNumber:this.fb.control(1),pageSize:this.fb.control(50),sortAscending:this.fb.control(!0),listAccountID:this.fb.control([]),export:this.fb.control(!1),exportPageNumber:this.fb.control(1),exportPageSize:this.fb.control(0)})}findNodeByKey(e,n){for(let i of e){if(i.key===n)return i;if(i.children){let a=this.findNodeByKey(i.children,n);if(a)return a}}return null}transformFilterToFormValue(e){return Object.entries(e).reduce((n,[i,a])=>{switch(i){case"from":n[i]=a&&(typeof a=="string"||typeof a=="number"||a instanceof Date)?this.dayjsService.from(a)?.toDate():null;break;case"to":n[i]=a&&(typeof a=="string"||typeof a=="number"||a instanceof Date)?this.dayjsService.from(a)?.toDate():this.dayjsService.now.toDate();break;case"listCategoryID":Array.isArray(a)?n[i]=a.map(u=>this.findNodeByKey(this.categoriesOptions(),u)).filter(u=>!!u):n[i]=[];break;case"listOutletID":case"listAccountID":n[i]=Array.isArray(a)?a:[];break;case"pageNumber":case"pageSize":case"exportPageNumber":case"exportPageSize":n[i]=a!=null?Number(a):0;break;case"sortAscending":case"export":n[i]=!!a;break;case"contactType":n[i]=a!=null?Number(a):null;break;default:n[i]=a}return n},{})}clearContactValueOnContactTypeChange(){this.form.get("contactType")?.valueChanges.subscribe(()=>this.form.get("contactID")?.setValue(""))}isEmpty(e){return e==null||typeof e=="string"&&e.trim().length===0}onCategoryFocus(){this.coaService.getCachedCategoriesOptions().pipe(L(e=>this.categoriesOptions.set(e))).subscribe()}searchCustomer(e){this.reportService.getCustomerSuggestions(e.query).pipe(L(n=>this.customerSuggestions.set(n))).subscribe()}searchSupplier(e){this.reportService.getSupplierSuggestions(e.query).pipe(L(n=>this.supplierSuggestions.set(n))).subscribe()}onAccountChange(e){Array.isArray(e.value)&&e.value.length>=1&&this.toastr.warning("Please select at least 1 accounts for the general ledger report.","Warning")}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched(),this.dialogFilterVisible.set(!0);return}let e=this.buildFilterBody();this.dialogFilterVisible.set(!1),this.localFilter.set(e),this.totalRecords()!==-1&&this.getGLCount()}buildFilterBody(){let a=this.form.getRawValue(),{from:e,to:n}=a,i=fe(a,["from","to"]);return v(g({},this.filter()),{pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType})}onExport(){let e=this.buildExportBody();this.performExport(e)}performExport(e){this.reportService.exportGeneralLedger(e,{responseType:"blob",observe:"response"}).pipe(L(n=>this.handleExportResponse(n))).subscribe()}handleExportResponse(e){let n=e.headers,i=n.get("Content-Disposition")??n.get("content-disposition"),a="download.csv";if(i){let d=i.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);d?.[1]&&(a=decodeURIComponent(d[1].replace(/"/g,"")))}let u=e.body;mt(u,a,u.type)}buildExportBody(){let a=this.form.value,{from:e,to:n}=a,i=fe(a,["from","to"]);return v(g({},this.filter()),{exportPageNumber:+i.exportPageNumber,pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType,export:!0})}onNextPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(g({},e),{pageNumber:n+1,balance:this.items().data.data[this.items().data.data.length-1]?.balance??0})})}onPrevPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(g({},e),{pageNumber:Math.max(1,n-1)})})}goToPage(e){this.localFilter.update(n=>v(g({},n),{pageNumber:e}))}goToLastPage(){let e=this.filter();if(!e)return;let n=this.totalRecords();if(n===-1||!isFinite(n)){this.toastr.info("Please load total records before going to the last page","Info");return}let i=Math.ceil(n/e.pageSize);if(e.pageNumber>=i){this.toastr.warning("You are already on the last page","Warning");return}this.localFilter.update(a=>v(g({},a),{pageNumber:i}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-general-ledger"]],decls:13,vars:13,consts:[["filters",""],["actionButton",""],["content",""],["closeIconTemplate",""],["footer",""],["selectedItem",""],["item",""],["caption",""],["header",""],["body",""],["emptymessage",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isDialogFilterVisible","isFilterable","isInitDialogFilterVisible","scrollable"],["header","Export Journal Entry",3,"visibleChange","modal","visible","breakpoints"],["class","d-flex flex-column gap-3",4,"ngIf"],["class","d-flex flex-column row-gap-3",3,"formGroup",4,"ngIf"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["showClear","","filter","","filterBy","code,name","display","chip","formControlName","accountID","appendTo","body","optionLabel","name","optionValue","id","placeholder","Select Accounts",3,"virtualScroll","virtualScrollItemSize","options","ngClass"],["class","text-danger",4,"ngIf"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","iconDisplay","input","inputId","icondisplay",3,"showIcon"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","iconDisplay","input","inputId","icondisplay",3,"showIcon"],["showClear","","display","chip","formControlName","listOutletID","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select Outlets",3,"virtualScroll","virtualScrollItemSize","options"],["for",""],[1,"row"],[1,"col-4"],[1,"d-flex","align-items-center","gap-2"],["name","sortAscending","formControlName","sortAscending","inputId","asc",3,"value"],["for","asc",1,"m-0"],[1,"col-3"],["name","sortAscending","formControlName","sortAscending","inputId","desc",3,"value"],["for","desc",1,"m-0"],[1,"d-flex","gap-2"],[1,""],[1,"h-full","align-middle"],[1,"text-truncate","d-inline-block","h-full","align-middle"],[1,"text-danger"],[1,"flex","items-center","gap-2"],["name","contactType","formControlName","contactType",3,"value","inputId"],[1,"m-0",3,"for"],["formControlName","contactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["formControlName","ContactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["routerLink","/pages/chart-of-account/account",1,"p-button","p-button-secondary","p-button-outlined","fs-3"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],["class","px-3 h-100 bg-white border-top",4,"ngIf"],[1,"px-3","h-100","bg-white","border-top"],[3,"value"],[1,"d-flex","justify-content-between","align-items-center","my-2"],["type","button","aria-label","Get journal entry count","tabindex","0",1,"fa-solid","fa-circle-question","cursor-pointer","p-0","border-0","bg-transparent"],["variant","outlined","severity","secondary","icon","fa-solid fa-angle-right","size","small","label","next"],[1,"d-flex","gap-1"],[2,"width","120px"],[1,"text-end",2,"width","120px"],[1,"text-end",2,"width","140px"],[1,"text-break"],["target","_blank",1,"link","link-primary",3,"routerLink"],["tooltipPosition","top",3,"pTooltip"],["target","_blank",1,"link","link-primary",3,"href"],[1,"text-end","text-break",3,"ngClass"],[4,"ngIf"],[1,"text-end","text-break"],[3,"innerHTML"],[2,"width","300px","white-space","normal","word-break","break-word"],[2,"white-space","normal","word-break","break-word"],["colspan","3"],[1,"text-end","fw-semibold"],[1,"text-end","fw-semibold","text-success"],[1,"text-end","fw-semibold","text-danger"],["colspan","8"],["type","button","aria-label","Get journal entry count","tabindex","0",1,"fa-solid","fa-circle-question","cursor-pointer","p-0","border-0","bg-transparent",3,"click","keyup.enter"],["variant","outlined","severity","secondary","icon","fa-solid fa-angle-right","size","small","label","next",3,"onClick"],[1,"d-flex","flex-column","gap-3"],[1,"row",3,"formGroup"],[1,"col-8"],[1,"col"],["type","text","formControlName","exportPageNumber","fluid","","pInputText","","pSize","small"],["role","alert",1,"alert","alert-primary","m-0","p-2"],[1,"fa-solid","fa-circle-info"],[1,"fs-2","text-dark","fw-semibold"],["severity","secondary","variant","outlined","icon","fa-solid fa-xmark",3,"onClick","rounded","text"],["label","Cancel","severity","secondary","variant","outlined",3,"click"],["label","OK (F2)",3,"click"]],template:function(n,i){if(n&1){let a=D();o(0,"app-main-panel",11),P("isDialogFilterVisibleChange",function(d){return h(a),B(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),b(d)})("isInitDialogFilterVisibleChange",function(d){return h(a),B(i.initDialogVisible,d)||(i.initDialogVisible=d),b(d)}),I("filterConfirmed",function(){return h(a),b(i.onFilterOKEvent())}),x(1,Si,1,1,"ng-template",null,0,_)(3,vi,4,1,"ng-template",null,1,_)(5,Ai,1,1,"ng-template",null,2,_),r(),o(7,"p-dialog",12),P("visibleChange",function(d){return h(a),B(i.isDialogExportVisible,d)||(i.isDialogExportVisible=d),b(d)}),x(8,Gi,16,7,"div",13)(9,Pi,1,2,"ng-template",null,3,_)(11,Oi,2,0,"ng-template",null,4,_),r()}n&2&&(s("pageTitle",i.pageTitle),A("isDialogFilterVisible",i.dialogFilterVisible),s("isFilterable",!0),A("isInitDialogFilterVisible",i.initDialogVisible),s("scrollable",!0),p(7),Ae(F(11,ri)),s("modal",!0),A("visible",i.isDialogExportVisible),s("breakpoints",F(12,li)),p(),s("ngIf",i.form&&i.filter()))},dependencies:[ne,H,ze,z,q,qe,oe,pe,ae,nt,it,ee,Z,Te,qt,le,re,De,we,Q,$,We,K,Y,X,J,ce,se,ye,$e,pt,at,te,W,U,rt,ot,zt,jt,Ye,Ke],styles:["[_nghost-%COMP%] .p-datatable .p-datatable-header{padding:.75rem 1rem .75rem 0}"],changeDetection:0})}}return t})();var ji={data:{},filter:{EntityID:[],CashierID:null,Text:null,from:null,to:null},isLoading:!0,loader:{options:{outlets:[]},filter:{from:"",to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}}},St=Je(tt(ji),Qe(t=>{let m={totalCOGS:R(()=>{let e=t.data()?.data?.cogs;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),totalRevenue:R(()=>{let e=t.data()?.data?.revenue;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),totalExpense:R(()=>{let e=t.data()?.data?.expense;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),grossProfit:R(()=>Array.isArray(t.data()?.data?.cogs)&&Array.isArray(t.data()?.data?.revenue)?m.totalRevenue()-m.totalCOGS():0),profitOrLoss:R(()=>m.totalRevenue()-m.totalCOGS()-m.totalExpense()),isDataEmpty:R(()=>Object.keys(t.data()?.data??{}).length===0)};return m}),et(t=>{let m=S(G),e=S(me),n={updateFilter(i){O(t,a=>v(g({},a),{filter:g(g({},a.filter),i)}))},getLoader:Ee(ge(xe(()=>m.getIncomeStatementLoader().pipe(Ie({next:i=>{O(t,a=>v(g({},a),{loader:i,filter:v(g({},a.filter),{from:e.from(i.filter.from).format(),to:e.from(i.filter.to).format()})})),n.getIncomeStatement(t.filter)},error:i=>{console.error(i)}}))))),getIncomeStatement:Ee(ge(xe(i=>m.getIncomeStatement(i).pipe(Vt(()=>O(t,a=>v(g({},a),{isLoading:!0}))),Ie({next:a=>{O(t,u=>v(g({},u),{data:a,isLoading:!1}))},error:a=>{console.error(a)}})))))};return n}),Ze({onInit:t=>{t.getLoader()}}));var Ct=()=>({}),vt=t=>["/pages/chart-of-account/account/",t],yt=()=>["/pages/report/general-ledger"],Et=(t,m,e)=>({id:t,from:m,to:e});function qi(t,m){if(t&1){let e=D();o(0,"p-button",10),I("onClick",function(){h(e);let i=c(2);return b(i.onExport())}),r()}}function Hi(t,m){if(t&1&&(o(0,"div",8),x(1,qi,1,0,"p-button",9),r()),t&2){let e=c();p(),s("ngIf",e.roleService.global.export)}}function Ui(t,m){t&1&&(o(0,"tr")(1,"th",14),l(2,"Code"),r(),o(3,"th",15),l(4,"Name"),r(),o(5,"th",16),l(6,"Total"),r()())}function Wi(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",17),l(5),r()(),o(6,"td",16)(7,"a",18),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=de(0),i=de(1);p(2),f(e.code),p(2),s("routerLink",V(8,vt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,yt))("queryParams",je(11,Et,e.accountID,n,i)),p(),f(y(9,6,e.amount))}}function Ki(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),l(4,"Total Revenue :"),r(),o(5,"span",22),l(6),C(7,"number"),r()()()()),t&2){let e=c(3);p(6),f(y(7,1,e.store.totalRevenue()))}}function Yi(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No revenue records available"),r()()())}function $i(t,m){if(t&1&&(o(0,"h6",12),l(1,"Revenue"),r(),o(2,"p-table",13),x(3,Ui,7,0,"ng-template",null,3,_)(5,Wi,10,15,"ng-template",null,4,_)(7,Ki,8,3,"ng-template",null,5,_)(9,Yi,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);p(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.revenue)}}function Xi(t,m){t&1&&(o(0,"tr")(1,"th",14),l(2,"Code"),r(),o(3,"th",15),l(4,"Name"),r(),o(5,"th",24),l(6,"Total"),r()())}function Ji(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",17),l(5),r()(),o(6,"td",16)(7,"a",18),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=de(0),i=de(1);p(2),f(e.code),p(2),s("routerLink",V(8,vt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,yt))("queryParams",je(11,Et,e.accountID,n,i)),p(),f(y(9,6,e.amount))}}function Qi(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),l(4,"Total COGS :"),r(),o(5,"span",22),l(6),C(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),l(12,"Gross Profit :"),r(),o(13,"span",22),l(14),C(15,"number"),r()()()()),t&2){let e=c(3);p(6),f(y(7,2,e.store.totalCOGS())),p(8),f(y(15,4,e.store.grossProfit()))}}function Zi(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No COGS records available"),r()()())}function en(t,m){if(t&1&&(o(0,"h4",12),l(1,"COGS"),r(),o(2,"p-table",13),x(3,Xi,7,0,"ng-template",null,3,_)(5,Ji,10,15,"ng-template",null,4,_)(7,Qi,16,6,"ng-template",null,5,_)(9,Zi,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);p(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.cogs)}}function tn(t,m){t&1&&(o(0,"tr")(1,"th",14),l(2,"Code"),r(),o(3,"th",15),l(4,"Name"),r(),o(5,"th",16),l(6,"Total"),r()())}function nn(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",17),l(5),r()(),o(6,"td",16)(7,"a",18),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=de(0),i=de(1);p(2),f(e.code),p(2),s("routerLink",V(8,vt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,yt))("queryParams",je(11,Et,e.accountID,n,i)),p(),f(y(9,6,e.amount))}}function on(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),l(4,"Total Expense :"),r(),o(5,"span",22),l(6),C(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),l(12,"Profit / Loss :"),r(),o(13,"span",22),l(14),C(15,"number"),r()()()()),t&2){let e=c(3);p(6),f(y(7,2,e.store.totalExpense())),p(8),f(y(15,4,e.store.profitOrLoss()))}}function rn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No expense records available"),r()()())}function ln(t,m){if(t&1&&(o(0,"h4",12),l(1,"Expense"),r(),o(2,"p-table",13),x(3,tn,7,0,"ng-template",null,3,_)(5,nn,10,15,"ng-template",null,4,_)(7,on,16,6,"ng-template",null,5,_)(9,rn,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);p(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.expense)}}function an(t,m){if(t&1&&(kt(0)(1),o(2,"p-panel")(3,"div",11),x(4,$i,11,1)(5,en,11,1)(6,ln,11,1),r()()),t&2){let e,n,i,a,u,d=c();ct((e=d.store.filter())!=null&&e.from?d.store.filter().from:null),p(),ct((n=d.store.filter())!=null&&n.to?d.store.filter().to:null),p(3),M(d.Object.keys((i=d.store.data().data)!==null&&i!==void 0?i:F(5,Ct)).length>0?4:-1),p(),M(d.Object.keys((a=(a=d.store.data().data)==null?null:a.cogs)!==null&&a!==void 0?a:F(6,Ct)).length>0?5:-1),p(),M(d.Object.keys((u=(u=d.store.data().data)==null?null:u.expense)!==null&&u!==void 0?u:F(7,Ct)).length>0?6:-1)}}function pn(t,m){if(t&1){let e=D();o(0,"form",25)(1,"div",26)(2,"label",27),l(3,"Outlet"),r(),T(4,"p-multiselect",28),r(),o(5,"div",26)(6,"label",27),l(7,"Cashier"),r(),o(8,"p-autocomplete",29),I("completeMethod",function(i){h(e);let a=c();return b(a.onCashierSearch(i))})("onSelect",function(i){h(e);let a=c();return b(a.onCashierSelect(i))}),r()(),o(9,"div",26)(10,"label",30),l(11,"From - To"),r(),o(12,"div",31),T(13,"p-datepicker",32)(14,"p-datepicker",33),r()()()}if(t&2){let e=c();s("formGroup",e.formFilter),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.loader().options.outlets)("showClear",!0),p(4),s("showClear",!0)("suggestions",e.cashierSuggestions())("showClear",!0),p(5),s("iconDisplay","input")("showIcon",!0),p(),s("iconDisplay","input")("showIcon",!0)}}var Yt=(()=>{class t{constructor(){this.dayjsService=S(me),this.store=S(St),this.fb=S(Ce),this.reportService=S(G),this.roleService=S(ie),this.isInitDialogFilterVisible=E(!1),this.dialogFilterVisible=E(!1),this.cashierSuggestions=E([]),this.cashierHashMap=new Map,this.Object=Object,ue(()=>{this.store.filter()&&this.initForm()})}ngOnInit(){this.initForm(),console.log(this.cashierHashMap.entries())}onSearch(e){this.store.updateFilter(v(g({},this.store.filter()),{Text:e}))}onCashierSearch(e){this.reportService.getCashierSuggestions(e.query).pipe(ke("Cashier Suggestions"),L(n=>this.cashierSuggestions.set(n))).subscribe()}initForm(){let e=this.store.filter();console.log("initForm",this.cashierHashMap.get(e.CashierID)),this.formFilter=this.fb.group({EntityID:this.fb.control(e.EntityID??[]),CashierID:this.fb.control(this.cashierHashMap.get(e.CashierID)??""),Text:this.fb.control(e.Text??""),from:this.fb.control(e.from?this.dayjsService.from(e.from).toDate():null),to:this.fb.control(e.to?this.dayjsService.from(e.to).toDate():null)})}onFilterOK(){let e=this.formFilter.getRawValue(),n=Object.entries(e).reduce((i,[a,u])=>(a==="from"||a==="to"?u instanceof Date&&(i[a]=this.dayjsService.from(u).format()):i[a]=u||null,i),{});this.store.updateFilter(g(g({},this.store.filter()),n)),this.dialogFilterVisible.update(i=>!i),console.log("body",e)}onCashierSelect(e){console.log("Cashier selected:",e),!this.cashierHashMap.has(e.value.Key)&&(this.cashierHashMap.set(e.value.Key,e.value.Value),console.log("Cashier HashMap:",this.cashierHashMap))}onExport(){let e=v(g({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.reportService.getIncomeStatement(e,{responseType:"blob"}).pipe(ke("Export Profit & Loss"),L(n=>{let i=n.type,a=[n],u=document.createElement("a");u.href=window.URL.createObjectURL(new Blob(a,{type:i}));let d=`profit-and-loss.${i.split("/")[1]}`;u.setAttribute("download",d),document.body.appendChild(u),u.click(),document.body.removeChild(u)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-income-statement"]],features:[Oe([St])],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","isFilterable","pageTitle","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],[1,"d-flex","gap-2"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],[1,"d-flex","flex-column","gap-3"],[1,"fs-5","fw-semibold"],[3,"value"],[2,"width","20%"],[2,"width","30%"],[1,"text-end"],["target","_blank",1,"link","link-primary",3,"routerLink"],["target","_blank",1,"link","link-primary",3,"routerLink","queryParams"],["colspan","3",1,"text-end","fw-semibold"],[1,"row"],[1,"col"],[1,"col-1","col-lg-2"],["colspan","3",1,""],[1,"text-end",2,"min-width","10%"],[1,"d-flex","flex-column","gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for",""],["formControlName","EntityID","filterBy","value","appendTo","body","display","chip","optionLabel","value","optionValue","key","placeholder","Select an Outlet",3,"virtualScroll","virtualScrollItemSize","options","showClear"],["appendTo","body","formControlName","CashierID","optionLabel","Value","optionValue","Key","styleClass","w-100","inputStyleClass","w-100","field","Value","placeholder","Search a cashier",3,"completeMethod","onSelect","showClear","suggestions"],["for","outlet"],[1,"d-flex","flex-column","gap-2"],["formControlName","from","styleClass","w-100 mb-0","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],["formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"]],template:function(n,i){if(n&1){let a=D();o(0,"app-main-panel",7),P("isDialogFilterVisibleChange",function(d){return h(a),B(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),b(d)})("isInitDialogFilterVisibleChange",function(d){return h(a),B(i.isInitDialogFilterVisible,d)||(i.isInitDialogFilterVisible=d),b(d)}),I("filterConfirmed",function(){return h(a),b(i.onFilterOK())}),x(1,Hi,2,1,"ng-template",null,0,_)(3,an,7,8,"ng-template",null,1,_)(5,pn,15,12,"ng-template",null,2,_),r()}n&2&&(s("isFilterable",!0)("pageTitle",i.store.data().pageTitle),A("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[ne,H,z,q,Te,le,re,Q,$,K,Y,X,J,ce,se,oe,pe,ae,te,Xe,W,U,De,we,ee,Z],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var It=Rt(Ht());var mn={metadata:{options:{outlets:[]},filter:{to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}},data:{asset:[],liability:[],equity:[],pageTitle:""},filter:{date:(0,It.default)().format("YYYY-MM-DD"),listOutletParam:[]}},Tt=Je(tt(mn),Qe(t=>({totalAsset:R(()=>t.data().asset.reduce((m,e)=>m+ +e.amount,0)),totalLiability:R(()=>t.data().liability.reduce((m,e)=>m+ +e.counterAmount,0)),totalEquity:R(()=>t.data().equity.reduce((m,e)=>m+ +e.counterAmount,0))})),et(t=>{let m=S(G),e={updateFilter:n=>{O(t,i=>v(g({},i),{filter:n}))},fetchBalanceSheet:Ee(ge(Be(()=>{let n=t.filter();return Object.entries(n).every(([i,a])=>a!=null&&a!=="")}),xe(n=>m.getBalanceSheet(n).pipe(Ie({next:i=>{O(t,a=>v(g({},a),{data:i}))},error:i=>{console.error(i)}}))),Ft(1))),fetchLoader:Ee(ge(xe(()=>m.getBalanceSheetLoader().pipe(Ie({next:n=>{O(t,i=>v(g({},i),{metadata:n,filter:{date:(0,It.default)(n.filter.to).format("YYYY-MM-DD")}})),e.fetchBalanceSheet(t.filter)},error:n=>{console.error(n)}})))))};return e}),Ze(t=>({onInit:()=>{t.fetchLoader()}})));var $t=Rt(Ht());var wt=t=>["/pages/chart-of-account/account/",t],Dt=()=>["/pages/report/general-ledger"],sn=(t,m)=>({id:t,to:m}),Xt=t=>({id:t});function cn(t,m){if(t&1){let e=D();o(0,"p-button",11),I("onClick",function(){h(e);let i=c(2);return b(i.onExport())}),r()}}function dn(t,m){if(t&1&&(o(0,"div",9),x(1,cn,1,0,"p-button",10),r()),t&2){let e=c();p(),s("ngIf",e.roleService.global.export)}}function un(t,m){t&1&&(o(0,"tr")(1,"th",16),l(2,"Code"),r(),o(3,"th"),l(4,"Asset"),r(),o(5,"th",17),l(6,"Total"),r()())}function _n(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",18),l(5),r()(),o(6,"td",19)(7,"a",20),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit,n=c(3);p(2),f(e.code),p(2),s("routerLink",V(8,wt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,Dt))("queryParams",Nt(11,sn,e.accountID,n.store.filter().date)),p(),f(y(9,6,e.amount))}}function fn(t,m){if(t&1&&(o(0,"tr")(1,"td",21),l(2,"Total Asset"),r(),o(3,"td",22),l(4),C(5,"number"),r()()),t&2){let e=c(3);p(4),w(" ",y(5,1,e.store.totalAsset())," ")}}function gn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No asset records found."),r()()())}function xn(t,m){if(t&1&&(o(0,"h4",14),l(1,"Asset"),r(),o(2,"p-table",15),x(3,un,7,0,"ng-template",null,3,_)(5,_n,10,14,"ng-template",null,4,_)(7,fn,6,3,"ng-template",null,5,_)(9,gn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);p(2),s("value",e.store.data().asset)}}function hn(t,m){t&1&&(o(0,"tr")(1,"th",16),l(2,"Code"),r(),o(3,"th"),l(4,"Liability"),r(),o(5,"th",17),l(6,"Total"),r()())}function bn(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",25),l(5),r()(),o(6,"td",19)(7,"a",20),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit;p(2),f(e.code),p(2),s("routerLink",V(8,wt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,Dt))("queryParams",V(11,Xt,e.accountID)),p(),f(y(9,6,e.counterAmount))}}function Sn(t,m){if(t&1&&(o(0,"tr")(1,"td",21),l(2," Total Liability "),r(),o(3,"td",22),l(4),C(5,"number"),r()()),t&2){let e=c(3);p(4),w(" ",y(5,1,e.store.totalLiability())," ")}}function Cn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No liability records found."),r()()())}function vn(t,m){if(t&1&&(o(0,"h4",24),l(1,"Liability"),r(),o(2,"p-table",15),x(3,hn,7,0,"ng-template",null,3,_)(5,bn,10,13,"ng-template",null,4,_)(7,Sn,6,3,"ng-template",null,5,_)(9,Cn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);p(2),s("value",e.store.data().liability)}}function yn(t,m){t&1&&(o(0,"tr")(1,"th",16),l(2,"Code"),r(),o(3,"th"),l(4,"Equity"),r(),o(5,"th",17),l(6,"Total"),r()())}function En(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",18),l(5),r()(),o(6,"td",19)(7,"a",20),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit;p(2),f(e.code),p(2),s("routerLink",V(8,wt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,Dt))("queryParams",V(11,Xt,e.accountID)),p(),f(y(9,6,e.counterAmount))}}function In(t,m){if(t&1&&(o(0,"tr")(1,"td",21),l(2,"Total Equity"),r(),o(3,"td",22),l(4),C(5,"number"),r()(),o(6,"tr")(7,"td",21),l(8," Total Liability + Equity "),r(),o(9,"td",22),l(10),C(11,"number"),r()()),t&2){let e=c(3);p(4),w(" ",y(5,2,e.store.totalEquity())," "),p(6),w(" ",y(11,4,e.store.totalLiability()+e.store.totalEquity())," ")}}function Tn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No equity records found."),r()()())}function wn(t,m){if(t&1&&(o(0,"h4",24),l(1,"Equity"),r(),o(2,"p-table",15),x(3,yn,7,0,"ng-template",null,3,_)(5,En,10,13,"ng-template",null,4,_),l(7," <"),x(8,In,12,6,"ng-template",null,5,_)(10,Tn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);p(2),s("value",e.store.data().equity)}}function Dn(t,m){if(t&1&&(o(0,"p-panel",12)(1,"div",13),x(2,xn,11,1)(3,vn,11,1)(4,wn,12,1),r()()),t&2){let e=c();s("showHeader",!1),p(2),M(e.Object.keys(e.store.data().asset).length>0?2:-1),p(),M(e.Object.keys(e.store.data().liability).length>0?3:-1),p(),M(e.Object.keys(e.store.data().equity).length>0?4:-1)}}function Rn(t,m){if(t&1&&(o(0,"div",31)(1,"div"),l(2),r()()),t&2){let e=m.$implicit;p(2),f(e.value)}}function Fn(t,m){if(t&1&&(o(0,"form",26)(1,"div",27)(2,"label",28),l(3,"Outlet"),r(),o(4,"p-multiselect",29),x(5,Rn,3,1,"ng-template",null,7,_),r()(),o(7,"div",27)(8,"label",28),l(9,"From"),r(),T(10,"p-datepicker",30),r()()),t&2){let e=c();s("formGroup",e.filterForm),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.metadata().options.outlets)("showClear",!0),p(6),s("iconDisplay","input")("showIcon",!0)}}var Jt=(()=>{class t{constructor(){this.store=S(Tt),this.ReportServiceStore=S(G),this.dialogFilterVisible=E(!1),this.isInitDialogFilterVisible=E(!1),this.roleService=S(ie),this.Object=Object}ngOnInit(){this.generateFilterForm()}generateFilterForm(){this.filterForm=new Ot({date:new dt(new Date),outletID:new dt([])})}onFilterOKEvent(){let{date:e,outletID:n}=this.filterForm.value;this.store.updateFilter({date:(0,$t.default)(e).format("YYYY-MM-DD"),listOutletParam:n}),this.dialogFilterVisible.update(i=>!i)}onExport(){let e=v(g({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.ReportServiceStore.getBalanceSheet(e,{responseType:"blob"}).pipe(ke("Export Balance Sheet"),L(n=>{let i=n.type,a=[n],u=document.createElement("a");u.href=window.URL.createObjectURL(new Blob(a,{type:i}));let d=`balance-sheet.${i.split("/")[1]}`;u.setAttribute("download",d),document.body.appendChild(u),u.click(),document.body.removeChild(u)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-balance-sheet"]],features:[Oe([Tt])],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],["item",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],[1,"d-flex","gap-2"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],[3,"showHeader"],[1,"d-flex","flex-column","gap-3"],[1,"fs-5","fw-semibold","mt-3"],[3,"value"],[2,"width","20%"],[1,"text-end",2,"width","5%"],["target","_blank",1,"link","link-primary",3,"routerLink"],[1,"text-end"],["target","_blank",1,"link","link-primary",3,"routerLink","queryParams"],["colspan","2",1,"fw-semibold","text-end"],[1,"text-end","fw-semibold"],["colspan","3",1,""],[1,"fs-5","fw-semibold"],["target","_blank",1,"link","link-primary","d-flex","align-items-center",3,"routerLink"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["formControlName","outletID","display","chip","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select Outlet",3,"virtualScroll","virtualScrollItemSize","options","showClear"],["formControlName","date","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],[1,"flex","items-center","gap-2"]],template:function(n,i){if(n&1){let a=D();o(0,"app-main-panel",8),P("isDialogFilterVisibleChange",function(d){return h(a),B(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),b(d)})("isInitDialogFilterVisibleChange",function(d){return h(a),B(i.isInitDialogFilterVisible,d)||(i.isInitDialogFilterVisible=d),b(d)}),I("filterConfirmed",function(){return h(a),b(i.onFilterOKEvent())}),x(1,dn,2,1,"ng-template",null,0,_)(3,Dn,5,4,"ng-template",null,1,_)(5,Fn,11,7,"ng-template",null,2,_),r()}n&2&&(s("pageTitle",i.store.data().pageTitle)("isFilterable",!0),A("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[ne,H,z,q,pe,ae,oe,ee,Z,Q,$,K,Y,X,J,ce,se,le,re,ye,te,Xe,W,U],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Qt=(()=>{class t{static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-comparative-balance"]],decls:3,vars:0,template:function(n,i){n&1&&(o(0,"p"),l(1,"report-comparative-balance works!"),r(),l(2,`
1
+ import{a as st}from"./chunk-SMZ363LC.js";import{a as we,b as De}from"./chunk-CX3TZ3F3.js";import{a as Se}from"./chunk-S7IT3NE6.js";import{a as Ht,b as me}from"./chunk-RD2UE5ML.js";import{b as Ut,c as pt,d as mt}from"./chunk-HEX727RH.js";import{a as se,b as ce}from"./chunk-BJ4RON42.js";import"./chunk-CNXEJBY5.js";import{b as at}from"./chunk-MPHY6FVN.js";import"./chunk-NMSYINDE.js";import{a as ie}from"./chunk-ORLKNWW4.js";import"./chunk-WLKS6LBU.js";import{a as Ee,b as Ie}from"./chunk-NHZLS6JU.js";import{a as ot,b as rt,d as ae,k as pe}from"./chunk-KLKIEREL.js";import{a as re,b as le}from"./chunk-76LPTGLX.js";import"./chunk-CWHL7PNC.js";import"./chunk-VRKBMD72.js";import{a as lt}from"./chunk-RK2BTJAS.js";import{a as ke}from"./chunk-KXE3J4PK.js";import{b as ye}from"./chunk-E3QNEH3B.js";import"./chunk-EOT2WEXN.js";import{a as qt,b as Te}from"./chunk-X4KTMWVO.js";import"./chunk-I7ILLTFH.js";import"./chunk-2LQVI4EI.js";import"./chunk-AJZ7YLT4.js";import"./chunk-ATJ55H5D.js";import"./chunk-SPKOXGSS.js";import{d as $e}from"./chunk-3KYU6FI2.js";import"./chunk-IJTQE2H4.js";import{b as oe}from"./chunk-WXT6EZ2V.js";import{e as it,f as nt,h as ne}from"./chunk-R3GHYD6Y.js";import{b as jt,c as zt}from"./chunk-L3PZS6EL.js";import{a as Xe,b as te}from"./chunk-5JV52UYK.js";import{a as O,b as Je,c as Qe,d as Ze,e as et,f as tt}from"./chunk-ACTRMWEI.js";import"./chunk-ARXP327B.js";import{n as Ke,o as Ye,w as Z,x as ee}from"./chunk-7FFMPB6T.js";import{b as ve}from"./chunk-UKBDY33R.js";import{b as We,c as Pt,e as K,f as Y,g as Ot,i as dt,k as $,l as X,o as J,u as Ce,x as Q}from"./chunk-72LNXEXV.js";import{b as He,e as U,l as W}from"./chunk-EFDD6Q3K.js";import{a as Gt,b as be}from"./chunk-BM3MNYWW.js";import{a as Ue}from"./chunk-ZDTMCWOO.js";import"./chunk-F2X3VGZZ.js";import{h as ze,k as z,p as qe,q,s as H,y as Bt,z as At}from"./chunk-SB5MSLCX.js";import{$b as D,Ac as ct,Bc as de,Cc as Oe,D as Be,Db as x,Dc as F,Ec as V,Fc as Nt,Gc as je,Ha as E,Lb as s,Nc as C,Ob as Ae,Oc as y,Pc as Me,Qb as M,Rb as Re,Rc as _,Tb as Fe,Ub as Ve,Vb as o,W as Ft,Wb as r,X as Vt,Xb as T,Y as xe,Yb as Ge,Zb as Pe,_ as L,bd as R,c as ge,ca as Lt,cb as j,cd as ue,db as he,ec as I,fc as c,hb as p,ia as S,ic as Mt,qa as h,ra as b,rc as l,s as Ne,sc as f,tc as w,uc as Le,wc as A,xb as N,xc as B,yc as P,zc as kt}from"./chunk-6K5LNQ4J.js";import{a as g,b as v,c as fe,e as Rt}from"./chunk-YQFG5XE2.js";var G=(()=>{class t{constructor(){this.httpService=S(Gt),this.authService=S(Se)}fetchGeneralLedgerLoader(e="single",n={}){return this.httpService.get(void 0,`api/GeneralLedgerLoader/${e==="single"?"GetFilterSingle":"GetFilter"}`,{params:n})}getGLCount(e){return this.httpService.post(void 0,"api/GeneralLedger/GetSingleCount",e)}fetchGeneralLedgerReport(e,n="single"){return this.httpService.post(void 0,`api/GeneralLedger/${n==="single"?"GetSingle":"Get"}`,e)}exportGeneralLedger(e,n={}){let i=g({responseType:"blob"},n);return this.httpService.post(void 0,"/api/GeneralLedgerExport/GetGeneralLedgerExport",e,i)}getCustomerSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/API/AC/GetCustomerSuggestion",{params:n})}getSupplierSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/API/AC/GetSupplierSuggestion",{params:n})}getCashierSuggestions(e){let n={Prefix:e,Count:100};return this.httpService.get(this.authService.getTenantExternalURL(),"/api/ac/GetUserSuggestion",{params:n})}getBalanceSheetLoader(){return this.httpService.get(void 0,"/api/BalanceSheetLoader/GetBalanceSheet")}getBalanceSheet(e,n={}){let i=new At({fromObject:Object.fromEntries(Object.entries(e).map(([d,k])=>[d,String(k)]))}),a=new Bt({"X-Timeout":"50000","X-Retry":"3","X-Retry-Delay":"2000","X-Exponential-Backoff":"true","X-Retry-On-500":"true","X-Retry-On-500-Message":"timeout expired"}),u=g({params:i,headers:a},n);return this.httpService.get(void 0,"/api/BalanceSheet",u)}getIncomeStatementLoader(){return this.httpService.get(void 0,"api/IncomeStatementLoader/Filter")}getIncomeStatement(e,n={}){return this.httpService.post(void 0,"api/IncomeStatement/List",g({},e),n)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=Lt({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var ri=()=>({width:"30vw"}),li=()=>({"1199px":"75vw","575px":"90vw"}),ai=t=>({"ng-dirty ng-invalid":t}),pi=t=>["/pages/journal/journal-entry/",t],mi=t=>({"text-success":t}),si=t=>({"text-danger":t});function ci(t,m){if(t&1&&(o(0,"div",33)(1,"div",34)(2,"span",35),l(3),r()(),o(4,"div")(5,"span"),l(6,"-"),r()(),o(7,"div",34)(8,"span",36),l(9),r()()()),t&2){let e=m.$implicit;p(3),w("(",e.code,")"),p(6),f(e.name)}}function di(t,m){if(t&1&&(o(0,"div",33)(1,"div",34)(2,"span",35),l(3),r()(),o(4,"div")(5,"span"),l(6,"-"),r()(),o(7,"div",34)(8,"span",36),l(9),r()()()),t&2){let e=m.$implicit;p(3),w("(",e.code,")"),p(6),f(e.name)}}function ui(t,m){t&1&&(o(0,"div",37),l(1," Account is required. "),r())}function _i(t,m){if(t&1&&(o(0,"div",38)(1,"div"),l(2),r()()),t&2){let e=m.$implicit;p(2),f(e.value)}}function fi(t,m){if(t&1&&(o(0,"div",26)(1,"div",27),T(2,"p-radiobutton",39),o(3,"label",40),l(4),r()()()),t&2){let e=m.$implicit;p(2),s("value",e.key)("inputId",e.key),p(),s("for",e.key),p(),f(e.value)}}function gi(t,m){if(t&1){let e=D();o(0,"div",16)(1,"label",17),l(2,"Customer"),r(),o(3,"p-autocomplete",41),I("completeMethod",function(i){h(e);let a=c(3);return b(a.searchCustomer(i))}),r()()}if(t&2){let e=c(3);p(3),s("suggestions",e.customerSuggestions())}}function xi(t,m){if(t&1){let e=D();o(0,"div",16)(1,"label",17),l(2,"Supplier"),r(),o(3,"p-autocomplete",42),I("completeMethod",function(i){h(e);let a=c(3);return b(a.searchSupplier(i))}),r()()}if(t&2){let e=c(3);p(3),s("suggestions",e.supplierSuggestions())}}function hi(t,m){if(t&1){let e=D();o(0,"div",16)(1,"label",17),l(2,"Customer"),r(),o(3,"p-autocomplete",41),I("completeMethod",function(i){h(e);let a=c(3);return b(a.searchCustomer(i))}),r()()}if(t&2){let e=c(3);p(3),s("suggestions",e.customerSuggestions())}}function bi(t,m){if(t&1&&(o(0,"form",15)(1,"div",16)(2,"label",17),l(3,"Accounts"),r(),o(4,"p-select",18),x(5,ci,10,2,"ng-template",null,5,_)(7,di,10,2,"ng-template",null,6,_),r(),x(9,ui,2,0,"div",19),r(),o(10,"div",16)(11,"label",17),l(12,"From"),r(),o(13,"div",20),T(14,"p-datepicker",21)(15,"p-datepicker",22),r()(),o(16,"div",16)(17,"label",17),l(18,"Outlets"),r(),o(19,"p-multiselect",23),x(20,_i,3,1,"ng-template",null,6,_),r()(),o(22,"div",16)(23,"label",24),l(24,"Contact Type"),r(),o(25,"div",25),Fe(26,fi,5,4,"div",26,Re),r()(),x(28,gi,4,1,"div",16)(29,xi,4,1,"div",16)(30,hi,4,1,"div",16),o(31,"div",16)(32,"label",24),l(33,"Sort order"),r(),o(34,"div",25)(35,"div",26)(36,"div",27),T(37,"p-radiobutton",28),o(38,"label",29),l(39,"Asc"),r()()(),o(40,"div",30)(41,"div",27),T(42,"p-radiobutton",31),o(43,"label",32),l(44,"Desc"),r()()()()()()),t&2){let e,n,i,a=c(2);s("formGroup",a.form),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",a.loaderMetadata().options.accounts)("ngClass",V(14,ai,((e=a.form.get("accountID"))==null?null:e.invalid)&&(((e=a.form.get("accountID"))==null?null:e.touched)||((e=a.form.get("accountID"))==null?null:e.dirty)))),p(5),s("ngIf",((n=a.form.get("accountID"))==null?null:n.invalid)&&(((n=a.form.get("accountID"))==null?null:n.touched)||((n=a.form.get("accountID"))==null?null:n.dirty))),p(5),s("showIcon",!0),p(),s("showIcon",!0),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",a.loaderMetadata().options.outlets),p(7),Ve(a.loaderMetadata().options.contactTypeOptions),p(2),M((i=a.form.controls.contactType.value)===1?28:i===2?29:30),p(9),s("value",!0),p(5),s("value",!1)}}function Si(t,m){if(t&1&&x(0,bi,45,16,"form",14),t&2){let e=c();s("ngIf",e.loaderMetadata())}}function Ci(t,m){if(t&1){let e=D();o(0,"p-button",45),I("onClick",function(){h(e);let i=c(2);return b(i.onToggleExportDialog())}),r()}}function vi(t,m){if(t&1&&(o(0,"div",33)(1,"a",43),l(2,"Return to Accounts"),r(),x(3,Ci,1,0,"p-button",44),r()),t&2){let e=c();p(3),s("ngIf",e.roleService.global.export)}}function yi(t,m){t&1&&T(0,"div",52)}function Ei(t,m){t&1&&(o(0,"tr")(1,"th",53),l(2,"Outlet"),r(),o(3,"th",53),l(4,"No."),r(),o(5,"th",53),l(6,"Date"),r(),o(7,"th"),l(8,"Contact / Note"),r(),o(9,"th",54),l(10,"Debit"),r(),o(11,"th",54),l(12,"Credit"),r(),o(13,"th",55),l(14,"Balance"),r()())}function Ii(t,m){if(t&1&&(o(0,"div",16)(1,"a",59),l(2),r(),T(3,"div",63),o(4,"span",64),l(5),r()()),t&2){let e=c().$implicit,n=c(3);p(),s("href",n.authService.getTenantExternalURL()+n.buildReferenceUrl(e),he),p(),f(e.referenceText),p(),s("innerHTML",e.journalNote,j),p(2),w("",e.note," ")}}function Ti(t,m){if(t&1&&(o(0,"div",16),T(1,"span",63)(2,"div",63),o(3,"span",65),l(4),r()()),t&2){let e=c().$implicit;p(),s("innerHTML",e.referenceText,j),p(),s("innerHTML",e.journalNote,j),p(2),w("",e.note," ")}}function wi(t,m){if(t&1&&(Ge(0),l(1),C(2,"number"),Pe()),t&2){let e=c().$implicit;p(),w(" ",y(2,1,e.debitAmount)," ")}}function Di(t,m){if(t&1&&(Ge(0),l(1),C(2,"number"),Pe()),t&2){let e=c().$implicit;p(),w(" ",y(2,1,e.creditAmount)," ")}}function Ri(t,m){if(t&1&&(Ge(0),l(1),C(2,"number"),Pe()),t&2){let e=c().$implicit;p(),w(" ",y(2,1,e.balance)," ")}}function Fi(t,m){if(t&1&&(o(0,"tr")(1,"td",56),l(2),r(),o(3,"td",56)(4,"a",57),l(5),r()(),o(6,"td",56)(7,"span",58),C(8,"date"),l(9),C(10,"date"),r()(),o(11,"td",56)(12,"div",16)(13,"a",59),l(14),r(),x(15,Ii,6,4,"div",16)(16,Ti,5,3,"div",16),r()(),o(17,"td",60),x(18,wi,3,3,"ng-container",61),r(),o(19,"td",60),x(20,Di,3,3,"ng-container",61),r(),o(21,"td",62),x(22,Ri,3,3,"ng-container",61),r()()),t&2){let e=m.$implicit,n=c(3);p(2),f(e.outletName),p(2),s("routerLink",V(19,pi,e.id)),p(),f(e.number),p(2),s("pTooltip",Me(8,13,e.date,"dd MMM y")),p(2),w(" ",Me(10,16,e.date,"dd MMM y")," "),p(4),s("href",n.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.contactID,he),p(),f(e.contactName),p(),M(n.buildReferenceUrl(e)?15:16),p(2),s("ngClass",V(21,mi,e.debitAmount!==0)),p(),s("ngIf",e.debitAmount!==0),p(),s("ngClass",V(23,si,e.creditAmount!==0)),p(),s("ngIf",e.creditAmount!==0),p(2),s("ngIf",e.balance!==0)}}function Vi(t,m){if(t&1&&(o(0,"tr"),T(1,"td",66),o(2,"td",67),l(3,"Total"),r(),o(4,"td",68),l(5),C(6,"number"),r(),o(7,"td",69),l(8),C(9,"number"),r(),T(10,"td"),r()),t&2){let e=c(3);p(5),w(" ",y(6,2,e.debitSubTotal())," "),p(3),w(" ",y(9,4,e.creditSubTotal())," ")}}function Li(t,m){t&1&&(o(0,"tr")(1,"td",70)(2,"span"),l(3,"No records found."),r()()())}function Mi(t,m){if(t&1){let e=D();o(0,"button",71),I("click",function(){h(e);let i=c(3);return b(i.getGLCount())})("keyup.enter",function(){h(e);let i=c(3);return b(i.getGLCount())}),r()}}function ki(t,m){if(t&1&&l(0),t&2){let e=c(3);w(" ",e.count()," ")}}function Ni(t,m){if(t&1){let e=D();o(0,"p-button",72),I("onClick",function(){h(e);let i=c(3);return b(i.onNextPage())}),r()}}function Bi(t,m){if(t&1&&(o(0,"div",47)(1,"p-table",48),x(2,yi,1,0,"ng-template",null,7,_)(4,Ei,15,0,"ng-template",null,8,_)(6,Fi,23,25,"ng-template",null,9,_)(8,Vi,11,6,"ng-template",null,4,_)(10,Li,4,0,"ng-template",null,10,_),r(),o(12,"div",49)(13,"div"),l(14),x(15,Mi,1,0,"button",50)(16,ki,1,1),l(17," entries "),r(),o(18,"div",33),x(19,Ni,1,0,"p-button",51),r()()()),t&2){let e=c(2);p(),s("value",e.items().data.data),p(13),Le(" Showing ",e.pagination().first," to ",e.pagination().end," of "),p(),M(e.totalRecords()===-1?15:16),p(4),M(e.pagination().hasNext?19:-1)}}function Ai(t,m){if(t&1&&x(0,Bi,20,5,"div",46),t&2){let e=c();s("ngIf",e.items()&&e.items().data)}}function Gi(t,m){if(t&1&&(o(0,"div",73)(1,"div",74)(2,"div",75)(3,"div",25)(4,"div",76)(5,"label",24),l(6,"Page"),r()(),o(7,"div",76),T(8,"input",77),r()()()(),o(9,"div",78)(10,"div",27),T(11,"i",79),o(12,"span",80),l(13),C(14,"number"),C(15,"number"),r()()()()),t&2){let e=c();p(),s("formGroup",e.form),p(12),Le("Exporting data from ",y(14,3,e.filter().exportPageNumber)," - ",y(15,5,e.filter().exportPageSize),"")}}function Pi(t,m){if(t&1){let e=D();o(0,"p-button",81),I("onClick",function(){h(e);let i=c();return b(i.onToggleExportDialog())}),r()}t&2&&s("rounded",!0)("text",!0)}function Oi(t,m){if(t&1){let e=D();o(0,"p-button",82),I("click",function(){h(e);let i=c();return b(i.onToggleExportDialog())}),r(),o(1,"p-button",83),I("click",function(){h(e);let i=c();return b(i.onExport())}),r()}}var Kt=(()=>{class t{getGLCount(){this.reportService.getGLCount(this.filter()).pipe(L(({count:e})=>{this.totalRecords.set(e)})).subscribe()}onToggleExportDialog(){this.isDialogExportVisible.update(e=>!e)}get pageTitle(){return this.items()&&this.items().pageTitle?this.items().pageTitle:"General Ledger"}constructor(){this.reportService=S(G),this.route=S(He),this.roleService=S(ie),this.authService=S(Se),this.fb=S(Ce),this.coaService=S(lt),this.toastr=S(Ue),this.dayjsService=S(me),this.metadata=E(null),this.items=E(null),this.totalRecords=E(-1),this.dialogFilterVisible=E(!0),this.initDialogVisible=E(!1),this.isDialogExportVisible=E(!1),this.customerSuggestions=E([]),this.supplierSuggestions=E([]),this.categoriesOptions=E([]),this.localFilter=E({}),this.count=R(()=>this.totalRecords()<0?1/0:this.totalRecords()),this.lastGetDataLength=E(0),this.pagination=R(()=>{let e=this.filter(),n=this.totalRecords()!=null&&this.totalRecords()>=0?this.totalRecords():1/0,i=this.items()?.data?.data?.length||0,a=i==n||this.lastGetDataLength()<e.pageSize;return{first:1,end:e.pageSize>0?i:0,total:n,page:e.pageNumber,pageSize:e.pageSize,hasPrev:e.pageNumber>1,hasNext:!a}}),this.queryFilter=ve(this.route.queryParamMap.pipe(Ne(e=>{let n=e.get("from")?this.dayjsService.format(new Date(e.get("from"))):null,i=e.get("to")?this.dayjsService.format(new Date(e.get("to"))):null,a={},u=e.get("id");return be.IsNotEmpty(u)&&(a=v(g({},a),{accountID:u})),be.IsNotEmpty(n)&&be.IsNotEmpty(i)&&(a=v(g({},a),{from:n,to:i})),a})),{initialValue:null}),this.loaderMetadata=ve(this.reportService.fetchGeneralLedgerLoader("single",this.queryFilter()),{initialValue:null}),this.baseFilter=R(()=>{let e=this.loaderMetadata();return e?e.filter:null}),this.exportFileTypes=E([{key:0,value:"CSV"},{key:1,value:"Excel"}]),this.filter=R(()=>{let e=this.baseFilter(),n=this.localFilter();return e?g(g({},e),n):null}),this.creditSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.creditAmount)||0),0)),this.debitSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.debitAmount)||0),0)),this.initializeForm(),ue(()=>{let e=this.filter();e&&(be.IsEmpty(this.form.value.accountID)||this.form.value.accountID!==e.accountID)&&this.form.patchValue(this.transformFilterToFormValue(e),{emitEvent:!1})}),ue(()=>{let e=this.filter(),n=this.form.value.accountID;!e||be.IsEmpty(n)||this.reportService.fetchGeneralLedgerReport(e).subscribe(i=>{this.lastGetDataLength.set(i.data?.data?.length),this.items.update(a=>e.pageNumber===1?i:v(g({},i),{data:v(g({},i.data),{data:[...a?.data.data??[],...i.data.data]})}))})})}buildReferenceUrl(e){return st(e)}ngOnInit(){this.route.queryParamMap.pipe(Be(e=>e.keys.length>0)).subscribe({next:()=>this.initDialogVisible.set(!0)})}initializeForm(){this.form=this.fb.group({accountID:this.fb.control(null,[Pt.required]),from:this.fb.control(null),to:this.fb.control(new Date),contactType:this.fb.control(null),contactID:this.fb.control(""),listOutletID:this.fb.control([]),pageNumber:this.fb.control(1),pageSize:this.fb.control(50),sortAscending:this.fb.control(!0),listAccountID:this.fb.control([]),export:this.fb.control(!1),exportPageNumber:this.fb.control(1),exportPageSize:this.fb.control(0)})}findNodeByKey(e,n){for(let i of e){if(i.key===n)return i;if(i.children){let a=this.findNodeByKey(i.children,n);if(a)return a}}return null}transformFilterToFormValue(e){return Object.entries(e).reduce((n,[i,a])=>{switch(i){case"from":n[i]=a&&(typeof a=="string"||typeof a=="number"||a instanceof Date)?this.dayjsService.from(a)?.toDate():null;break;case"to":n[i]=a&&(typeof a=="string"||typeof a=="number"||a instanceof Date)?this.dayjsService.from(a)?.toDate():this.dayjsService.now.toDate();break;case"listCategoryID":Array.isArray(a)?n[i]=a.map(u=>this.findNodeByKey(this.categoriesOptions(),u)).filter(u=>!!u):n[i]=[];break;case"listOutletID":case"listAccountID":n[i]=Array.isArray(a)?a:[];break;case"pageNumber":case"pageSize":case"exportPageNumber":case"exportPageSize":n[i]=a!=null?Number(a):0;break;case"sortAscending":case"export":n[i]=!!a;break;case"contactType":n[i]=a!=null?Number(a):null;break;default:n[i]=a}return n},{})}clearContactValueOnContactTypeChange(){this.form.get("contactType")?.valueChanges.subscribe(()=>this.form.get("contactID")?.setValue(""))}isEmpty(e){return e==null||typeof e=="string"&&e.trim().length===0}onCategoryFocus(){this.coaService.getCachedCategoriesOptions().pipe(L(e=>this.categoriesOptions.set(e))).subscribe()}searchCustomer(e){this.reportService.getCustomerSuggestions(e.query).pipe(L(n=>this.customerSuggestions.set(n))).subscribe()}searchSupplier(e){this.reportService.getSupplierSuggestions(e.query).pipe(L(n=>this.supplierSuggestions.set(n))).subscribe()}onAccountChange(e){Array.isArray(e.value)&&e.value.length>=1&&this.toastr.warning("Please select at least 1 accounts for the general ledger report.","Warning")}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched(),this.dialogFilterVisible.set(!0);return}let e=this.buildFilterBody();this.dialogFilterVisible.set(!1),this.localFilter.set(e),this.totalRecords()!==-1&&this.getGLCount()}buildFilterBody(){let a=this.form.getRawValue(),{from:e,to:n}=a,i=fe(a,["from","to"]);return v(g({},this.filter()),{pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType})}onExport(){let e=this.buildExportBody();this.performExport(e)}performExport(e){this.reportService.exportGeneralLedger(e,{responseType:"blob",observe:"response"}).pipe(L(n=>this.handleExportResponse(n))).subscribe()}handleExportResponse(e){let n=e.headers,i=n.get("Content-Disposition")??n.get("content-disposition"),a="download.csv";if(i){let d=i.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);d?.[1]&&(a=decodeURIComponent(d[1].replace(/"/g,"")))}let u=e.body;mt(u,a,u.type)}buildExportBody(){let a=this.form.value,{from:e,to:n}=a,i=fe(a,["from","to"]);return v(g({},this.filter()),{exportPageNumber:+i.exportPageNumber,pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,contactID:i.contactID?.length===0?null:i.contactID,listOutletID:i.listOutletID??[],listAccountID:i.listAccountID??[],from:this.dayjsService.from(e)?this.dayjsService.format(e):null,to:this.dayjsService.from(n)?this.dayjsService.format(n):null,contactType:i.contactType,export:!0})}onNextPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(g({},e),{pageNumber:n+1,balance:this.items().data.data[this.items().data.data.length-1]?.balance??0})})}onPrevPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(g({},e),{pageNumber:Math.max(1,n-1)})})}goToPage(e){this.localFilter.update(n=>v(g({},n),{pageNumber:e}))}goToLastPage(){let e=this.filter();if(!e)return;let n=this.totalRecords();if(n===-1||!isFinite(n)){this.toastr.info("Please load total records before going to the last page","Info");return}let i=Math.ceil(n/e.pageSize);if(e.pageNumber>=i){this.toastr.warning("You are already on the last page","Warning");return}this.localFilter.update(a=>v(g({},a),{pageNumber:i}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-general-ledger"]],decls:13,vars:13,consts:[["filters",""],["actionButton",""],["content",""],["closeIconTemplate",""],["footer",""],["selectedItem",""],["item",""],["caption",""],["header",""],["body",""],["emptymessage",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isDialogFilterVisible","isFilterable","isInitDialogFilterVisible","scrollable"],["header","Export Journal Entry",3,"visibleChange","modal","visible","breakpoints"],["class","d-flex flex-column gap-3",4,"ngIf"],["class","d-flex flex-column row-gap-3",3,"formGroup",4,"ngIf"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["showClear","","filter","","filterBy","code,name","display","chip","formControlName","accountID","appendTo","body","optionLabel","name","optionValue","id","placeholder","Select Accounts",3,"virtualScroll","virtualScrollItemSize","options","ngClass"],["class","text-danger",4,"ngIf"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","iconDisplay","input","inputId","icondisplay",3,"showIcon"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","iconDisplay","input","inputId","icondisplay",3,"showIcon"],["showClear","","display","chip","formControlName","listOutletID","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select Outlets",3,"virtualScroll","virtualScrollItemSize","options"],["for",""],[1,"row"],[1,"col-4"],[1,"d-flex","align-items-center","gap-2"],["name","sortAscending","formControlName","sortAscending","inputId","asc",3,"value"],["for","asc",1,"m-0"],[1,"col-3"],["name","sortAscending","formControlName","sortAscending","inputId","desc",3,"value"],["for","desc",1,"m-0"],[1,"d-flex","gap-2"],[1,""],[1,"h-full","align-middle"],[1,"text-truncate","d-inline-block","h-full","align-middle"],[1,"text-danger"],[1,"flex","items-center","gap-2"],["name","contactType","formControlName","contactType",3,"value","inputId"],[1,"m-0",3,"for"],["formControlName","contactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["formControlName","ContactID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["routerLink","/pages/chart-of-account/account",1,"p-button","p-button-secondary","p-button-outlined","fs-3"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],["class","px-3 h-100 bg-white border-top",4,"ngIf"],[1,"px-3","h-100","bg-white","border-top"],[3,"value"],[1,"d-flex","justify-content-between","align-items-center","my-2"],["type","button","aria-label","Get journal entry count","tabindex","0",1,"fa-solid","fa-circle-question","cursor-pointer","p-0","border-0","bg-transparent"],["variant","outlined","severity","secondary","icon","fa-solid fa-angle-right","size","small","label","next"],[1,"d-flex","gap-1"],[2,"width","120px"],[1,"text-end",2,"width","120px"],[1,"text-end",2,"width","140px"],[1,"text-break"],["target","_blank",1,"link","link-primary",3,"routerLink"],["tooltipPosition","top",3,"pTooltip"],["target","_blank",1,"link","link-primary",3,"href"],[1,"text-end","text-break",3,"ngClass"],[4,"ngIf"],[1,"text-end","text-break"],[3,"innerHTML"],[2,"width","300px","white-space","normal","word-break","break-word"],[2,"white-space","normal","word-break","break-word"],["colspan","3"],[1,"text-end","fw-semibold"],[1,"text-end","fw-semibold","text-success"],[1,"text-end","fw-semibold","text-danger"],["colspan","8"],["type","button","aria-label","Get journal entry count","tabindex","0",1,"fa-solid","fa-circle-question","cursor-pointer","p-0","border-0","bg-transparent",3,"click","keyup.enter"],["variant","outlined","severity","secondary","icon","fa-solid fa-angle-right","size","small","label","next",3,"onClick"],[1,"d-flex","flex-column","gap-3"],[1,"row",3,"formGroup"],[1,"col-8"],[1,"col"],["type","text","formControlName","exportPageNumber","fluid","","pInputText","","pSize","small"],["role","alert",1,"alert","alert-primary","m-0","p-2"],[1,"fa-solid","fa-circle-info"],[1,"fs-2","text-dark","fw-semibold"],["severity","secondary","variant","outlined","icon","fa-solid fa-xmark",3,"onClick","rounded","text"],["label","Cancel","severity","secondary","variant","outlined",3,"click"],["label","OK (F2)",3,"click"]],template:function(n,i){if(n&1){let a=D();o(0,"app-main-panel",11),P("isDialogFilterVisibleChange",function(d){return h(a),B(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),b(d)})("isInitDialogFilterVisibleChange",function(d){return h(a),B(i.initDialogVisible,d)||(i.initDialogVisible=d),b(d)}),I("filterConfirmed",function(){return h(a),b(i.onFilterOKEvent())}),x(1,Si,1,1,"ng-template",null,0,_)(3,vi,4,1,"ng-template",null,1,_)(5,Ai,1,1,"ng-template",null,2,_),r(),o(7,"p-dialog",12),P("visibleChange",function(d){return h(a),B(i.isDialogExportVisible,d)||(i.isDialogExportVisible=d),b(d)}),x(8,Gi,16,7,"div",13)(9,Pi,1,2,"ng-template",null,3,_)(11,Oi,2,0,"ng-template",null,4,_),r()}n&2&&(s("pageTitle",i.pageTitle),A("isDialogFilterVisible",i.dialogFilterVisible),s("isFilterable",!0),A("isInitDialogFilterVisible",i.initDialogVisible),s("scrollable",!0),p(7),Ae(F(11,ri)),s("modal",!0),A("visible",i.isDialogExportVisible),s("breakpoints",F(12,li)),p(),s("ngIf",i.form&&i.filter()))},dependencies:[ne,H,ze,z,q,qe,oe,pe,ae,nt,it,ee,Z,Te,qt,le,re,De,we,Q,$,We,K,Y,X,J,ce,se,ye,$e,pt,at,te,W,U,rt,ot,zt,jt,Ye,Ke],styles:["[_nghost-%COMP%] .p-datatable .p-datatable-header{padding:.75rem 1rem .75rem 0}"],changeDetection:0})}}return t})();var ji={data:{},filter:{EntityID:[],CashierID:null,Text:null,from:null,to:null},isLoading:!0,loader:{options:{outlets:[]},filter:{from:"",to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}}},St=Je(tt(ji),Qe(t=>{let m={totalCOGS:R(()=>{let e=t.data()?.data?.cogs;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),totalRevenue:R(()=>{let e=t.data()?.data?.revenue;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),totalExpense:R(()=>{let e=t.data()?.data?.expense;return Array.isArray(e)?e.reduce((n,i)=>n+(i?.amount??0),0):0}),grossProfit:R(()=>Array.isArray(t.data()?.data?.cogs)&&Array.isArray(t.data()?.data?.revenue)?m.totalRevenue()-m.totalCOGS():0),profitOrLoss:R(()=>m.totalRevenue()-m.totalCOGS()-m.totalExpense()),isDataEmpty:R(()=>Object.keys(t.data()?.data??{}).length===0)};return m}),et(t=>{let m=S(G),e=S(me),n={updateFilter(i){O(t,a=>v(g({},a),{filter:g(g({},a.filter),i)}))},getLoader:Ee(ge(xe(()=>m.getIncomeStatementLoader().pipe(Ie({next:i=>{O(t,a=>v(g({},a),{loader:i,filter:v(g({},a.filter),{from:e.from(i.filter.from).format(),to:e.from(i.filter.to).format()})})),n.getIncomeStatement(t.filter)},error:i=>{console.error(i)}}))))),getIncomeStatement:Ee(ge(xe(i=>m.getIncomeStatement(i).pipe(Vt(()=>O(t,a=>v(g({},a),{isLoading:!0}))),Ie({next:a=>{O(t,u=>v(g({},u),{data:a,isLoading:!1}))},error:a=>{console.error(a)}})))))};return n}),Ze({onInit:t=>{t.getLoader()}}));var Ct=()=>({}),vt=t=>["/pages/chart-of-account/account/",t],yt=()=>["/pages/report/general-ledger"],Et=(t,m,e)=>({id:t,from:m,to:e});function qi(t,m){if(t&1){let e=D();o(0,"p-button",10),I("onClick",function(){h(e);let i=c(2);return b(i.onExport())}),r()}}function Hi(t,m){if(t&1&&(o(0,"div",8),x(1,qi,1,0,"p-button",9),r()),t&2){let e=c();p(),s("ngIf",e.roleService.global.export)}}function Ui(t,m){t&1&&(o(0,"tr")(1,"th",14),l(2,"Code"),r(),o(3,"th",15),l(4,"Name"),r(),o(5,"th",16),l(6,"Total"),r()())}function Wi(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",17),l(5),r()(),o(6,"td",16)(7,"a",18),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=de(0),i=de(1);p(2),f(e.code),p(2),s("routerLink",V(8,vt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,yt))("queryParams",je(11,Et,e.accountID,n,i)),p(),f(y(9,6,e.amount))}}function Ki(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),l(4,"Total Revenue :"),r(),o(5,"span",22),l(6),C(7,"number"),r()()()()),t&2){let e=c(3);p(6),f(y(7,1,e.store.totalRevenue()))}}function Yi(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No revenue records available"),r()()())}function $i(t,m){if(t&1&&(o(0,"h6",12),l(1,"Revenue"),r(),o(2,"p-table",13),x(3,Ui,7,0,"ng-template",null,3,_)(5,Wi,10,15,"ng-template",null,4,_)(7,Ki,8,3,"ng-template",null,5,_)(9,Yi,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);p(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.revenue)}}function Xi(t,m){t&1&&(o(0,"tr")(1,"th",14),l(2,"Code"),r(),o(3,"th",15),l(4,"Name"),r(),o(5,"th",24),l(6,"Total"),r()())}function Ji(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",17),l(5),r()(),o(6,"td",16)(7,"a",18),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=de(0),i=de(1);p(2),f(e.code),p(2),s("routerLink",V(8,vt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,yt))("queryParams",je(11,Et,e.accountID,n,i)),p(),f(y(9,6,e.amount))}}function Qi(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),l(4,"Total COGS :"),r(),o(5,"span",22),l(6),C(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),l(12,"Gross Profit :"),r(),o(13,"span",22),l(14),C(15,"number"),r()()()()),t&2){let e=c(3);p(6),f(y(7,2,e.store.totalCOGS())),p(8),f(y(15,4,e.store.grossProfit()))}}function Zi(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No COGS records available"),r()()())}function en(t,m){if(t&1&&(o(0,"h4",12),l(1,"COGS"),r(),o(2,"p-table",13),x(3,Xi,7,0,"ng-template",null,3,_)(5,Ji,10,15,"ng-template",null,4,_)(7,Qi,16,6,"ng-template",null,5,_)(9,Zi,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);p(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.cogs)}}function tn(t,m){t&1&&(o(0,"tr")(1,"th",14),l(2,"Code"),r(),o(3,"th",15),l(4,"Name"),r(),o(5,"th",16),l(6,"Total"),r()())}function nn(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",17),l(5),r()(),o(6,"td",16)(7,"a",18),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=de(0),i=de(1);p(2),f(e.code),p(2),s("routerLink",V(8,vt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,yt))("queryParams",je(11,Et,e.accountID,n,i)),p(),f(y(9,6,e.amount))}}function on(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),l(4,"Total Expense :"),r(),o(5,"span",22),l(6),C(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),l(12,"Profit / Loss :"),r(),o(13,"span",22),l(14),C(15,"number"),r()()()()),t&2){let e=c(3);p(6),f(y(7,2,e.store.totalExpense())),p(8),f(y(15,4,e.store.profitOrLoss()))}}function rn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No expense records available"),r()()())}function ln(t,m){if(t&1&&(o(0,"h4",12),l(1,"Expense"),r(),o(2,"p-table",13),x(3,tn,7,0,"ng-template",null,3,_)(5,nn,10,15,"ng-template",null,4,_)(7,on,16,6,"ng-template",null,5,_)(9,rn,4,0,"ng-template",null,6,_),r()),t&2){let e,n=c(2);p(2),s("value",(e=n.store.data())==null||e.data==null?null:e.data.expense)}}function an(t,m){if(t&1&&(kt(0)(1),o(2,"p-panel")(3,"div",11),x(4,$i,11,1)(5,en,11,1)(6,ln,11,1),r()()),t&2){let e,n,i,a,u,d=c();ct((e=d.store.filter())!=null&&e.from?d.store.filter().from:null),p(),ct((n=d.store.filter())!=null&&n.to?d.store.filter().to:null),p(3),M(d.Object.keys((i=d.store.data().data)!==null&&i!==void 0?i:F(5,Ct)).length>0?4:-1),p(),M(d.Object.keys((a=(a=d.store.data().data)==null?null:a.cogs)!==null&&a!==void 0?a:F(6,Ct)).length>0?5:-1),p(),M(d.Object.keys((u=(u=d.store.data().data)==null?null:u.expense)!==null&&u!==void 0?u:F(7,Ct)).length>0?6:-1)}}function pn(t,m){if(t&1){let e=D();o(0,"form",25)(1,"div",26)(2,"label",27),l(3,"Outlet"),r(),T(4,"p-multiselect",28),r(),o(5,"div",26)(6,"label",27),l(7,"Cashier"),r(),o(8,"p-autocomplete",29),I("completeMethod",function(i){h(e);let a=c();return b(a.onCashierSearch(i))})("onSelect",function(i){h(e);let a=c();return b(a.onCashierSelect(i))}),r()(),o(9,"div",26)(10,"label",30),l(11,"From - To"),r(),o(12,"div",31),T(13,"p-datepicker",32)(14,"p-datepicker",33),r()()()}if(t&2){let e=c();s("formGroup",e.formFilter),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.loader().options.outlets)("showClear",!0),p(4),s("showClear",!0)("suggestions",e.cashierSuggestions())("showClear",!0),p(5),s("iconDisplay","input")("showIcon",!0),p(),s("iconDisplay","input")("showIcon",!0)}}var Yt=(()=>{class t{constructor(){this.dayjsService=S(me),this.store=S(St),this.fb=S(Ce),this.reportService=S(G),this.roleService=S(ie),this.isInitDialogFilterVisible=E(!1),this.dialogFilterVisible=E(!1),this.cashierSuggestions=E([]),this.cashierHashMap=new Map,this.Object=Object,ue(()=>{this.store.filter()&&this.initForm()})}ngOnInit(){this.initForm(),console.log(this.cashierHashMap.entries())}onSearch(e){this.store.updateFilter(v(g({},this.store.filter()),{Text:e}))}onCashierSearch(e){this.reportService.getCashierSuggestions(e.query).pipe(ke("Cashier Suggestions"),L(n=>this.cashierSuggestions.set(n))).subscribe()}initForm(){let e=this.store.filter();console.log("initForm",this.cashierHashMap.get(e.CashierID)),this.formFilter=this.fb.group({EntityID:this.fb.control(e.EntityID??[]),CashierID:this.fb.control(this.cashierHashMap.get(e.CashierID)??""),Text:this.fb.control(e.Text??""),from:this.fb.control(e.from?this.dayjsService.from(e.from).toDate():null),to:this.fb.control(e.to?this.dayjsService.from(e.to).toDate():null)})}onFilterOK(){let e=this.formFilter.getRawValue(),n=Object.entries(e).reduce((i,[a,u])=>(a==="from"||a==="to"?u instanceof Date&&(i[a]=this.dayjsService.from(u).format()):i[a]=u||null,i),{});this.store.updateFilter(g(g({},this.store.filter()),n)),this.dialogFilterVisible.update(i=>!i),console.log("body",e)}onCashierSelect(e){console.log("Cashier selected:",e),!this.cashierHashMap.has(e.value.Key)&&(this.cashierHashMap.set(e.value.Key,e.value.Value),console.log("Cashier HashMap:",this.cashierHashMap))}onExport(){let e=v(g({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.reportService.getIncomeStatement(e,{responseType:"blob"}).pipe(ke("Export Profit & Loss"),L(n=>{let i=n.type,a=[n],u=document.createElement("a");u.href=window.URL.createObjectURL(new Blob(a,{type:i}));let d=`profit-and-loss.${i.split("/")[1]}`;u.setAttribute("download",d),document.body.appendChild(u),u.click(),document.body.removeChild(u)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-income-statement"]],features:[Oe([St])],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","isFilterable","pageTitle","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],[1,"d-flex","gap-2"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],[1,"d-flex","flex-column","gap-3"],[1,"fs-5","fw-semibold"],[3,"value"],[2,"width","20%"],[2,"width","30%"],[1,"text-end"],["target","_blank",1,"link","link-primary",3,"routerLink"],["target","_blank",1,"link","link-primary",3,"routerLink","queryParams"],["colspan","3",1,"text-end","fw-semibold"],[1,"row"],[1,"col"],[1,"col-1","col-lg-2"],["colspan","3",1,""],[1,"text-end",2,"min-width","10%"],[1,"d-flex","flex-column","gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for",""],["formControlName","EntityID","filterBy","value","appendTo","body","display","chip","optionLabel","value","optionValue","key","placeholder","Select an Outlet",3,"virtualScroll","virtualScrollItemSize","options","showClear"],["appendTo","body","formControlName","CashierID","optionLabel","Value","optionValue","Key","styleClass","w-100","inputStyleClass","w-100","field","Value","placeholder","Search a cashier",3,"completeMethod","onSelect","showClear","suggestions"],["for","outlet"],[1,"d-flex","flex-column","gap-2"],["formControlName","from","styleClass","w-100 mb-0","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],["formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"]],template:function(n,i){if(n&1){let a=D();o(0,"app-main-panel",7),P("isDialogFilterVisibleChange",function(d){return h(a),B(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),b(d)})("isInitDialogFilterVisibleChange",function(d){return h(a),B(i.isInitDialogFilterVisible,d)||(i.isInitDialogFilterVisible=d),b(d)}),I("filterConfirmed",function(){return h(a),b(i.onFilterOK())}),x(1,Hi,2,1,"ng-template",null,0,_)(3,an,7,8,"ng-template",null,1,_)(5,pn,15,12,"ng-template",null,2,_),r()}n&2&&(s("isFilterable",!0)("pageTitle",i.store.data().pageTitle),A("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[ne,H,z,q,Te,le,re,Q,$,K,Y,X,J,ce,se,oe,pe,ae,te,Xe,W,U,De,we,ee,Z],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var It=Rt(Ht());var mn={metadata:{options:{outlets:[]},filter:{to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}},data:{asset:[],liability:[],equity:[],pageTitle:""},filter:{date:(0,It.default)().format("YYYY-MM-DD"),listOutletParam:[]}},Tt=Je(tt(mn),Qe(t=>({totalAsset:R(()=>t.data().asset.reduce((m,e)=>m+ +e.amount,0)),totalLiability:R(()=>t.data().liability.reduce((m,e)=>m+ +e.counterAmount,0)),totalEquity:R(()=>t.data().equity.reduce((m,e)=>m+ +e.counterAmount,0))})),et(t=>{let m=S(G),e={updateFilter:n=>{O(t,i=>v(g({},i),{filter:n}))},fetchBalanceSheet:Ee(ge(Be(()=>{let n=t.filter();return Object.entries(n).every(([i,a])=>a!=null&&a!=="")}),xe(n=>m.getBalanceSheet(n).pipe(Ie({next:i=>{O(t,a=>v(g({},a),{data:i}))},error:i=>{console.error(i)}}))),Ft(1))),fetchLoader:Ee(ge(xe(()=>m.getBalanceSheetLoader().pipe(Ie({next:n=>{O(t,i=>v(g({},i),{metadata:n,filter:{date:(0,It.default)(n.filter.to).format("YYYY-MM-DD")}})),e.fetchBalanceSheet(t.filter)},error:n=>{console.error(n)}})))))};return e}),Ze(t=>({onInit:()=>{t.fetchLoader()}})));var $t=Rt(Ht());var wt=t=>["/pages/chart-of-account/account/",t],Dt=()=>["/pages/report/general-ledger"],sn=(t,m)=>({id:t,to:m}),Xt=t=>({id:t});function cn(t,m){if(t&1){let e=D();o(0,"p-button",11),I("onClick",function(){h(e);let i=c(2);return b(i.onExport())}),r()}}function dn(t,m){if(t&1&&(o(0,"div",9),x(1,cn,1,0,"p-button",10),r()),t&2){let e=c();p(),s("ngIf",e.roleService.global.export)}}function un(t,m){t&1&&(o(0,"tr")(1,"th",16),l(2,"Code"),r(),o(3,"th"),l(4,"Asset"),r(),o(5,"th",17),l(6,"Total"),r()())}function _n(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",18),l(5),r()(),o(6,"td",19)(7,"a",20),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit,n=c(3);p(2),f(e.code),p(2),s("routerLink",V(8,wt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,Dt))("queryParams",Nt(11,sn,e.accountID,n.store.filter().date)),p(),f(y(9,6,e.amount))}}function fn(t,m){if(t&1&&(o(0,"tr")(1,"td",21),l(2,"Total Asset"),r(),o(3,"td",22),l(4),C(5,"number"),r()()),t&2){let e=c(3);p(4),w(" ",y(5,1,e.store.totalAsset())," ")}}function gn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No asset records found."),r()()())}function xn(t,m){if(t&1&&(o(0,"h4",14),l(1,"Asset"),r(),o(2,"p-table",15),x(3,un,7,0,"ng-template",null,3,_)(5,_n,10,14,"ng-template",null,4,_)(7,fn,6,3,"ng-template",null,5,_)(9,gn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);p(2),s("value",e.store.data().asset)}}function hn(t,m){t&1&&(o(0,"tr")(1,"th",16),l(2,"Code"),r(),o(3,"th"),l(4,"Liability"),r(),o(5,"th",17),l(6,"Total"),r()())}function bn(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",25),l(5),r()(),o(6,"td",19)(7,"a",20),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit;p(2),f(e.code),p(2),s("routerLink",V(8,wt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,Dt))("queryParams",V(11,Xt,e.accountID)),p(),f(y(9,6,e.counterAmount))}}function Sn(t,m){if(t&1&&(o(0,"tr")(1,"td",21),l(2," Total Liability "),r(),o(3,"td",22),l(4),C(5,"number"),r()()),t&2){let e=c(3);p(4),w(" ",y(5,1,e.store.totalLiability())," ")}}function Cn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No liability records found."),r()()())}function vn(t,m){if(t&1&&(o(0,"h4",24),l(1,"Liability"),r(),o(2,"p-table",15),x(3,hn,7,0,"ng-template",null,3,_)(5,bn,10,13,"ng-template",null,4,_)(7,Sn,6,3,"ng-template",null,5,_)(9,Cn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);p(2),s("value",e.store.data().liability)}}function yn(t,m){t&1&&(o(0,"tr")(1,"th",16),l(2,"Code"),r(),o(3,"th"),l(4,"Equity"),r(),o(5,"th",17),l(6,"Total"),r()())}function En(t,m){if(t&1&&(o(0,"tr")(1,"td"),l(2),r(),o(3,"td")(4,"a",18),l(5),r()(),o(6,"td",19)(7,"a",20),l(8),C(9,"number"),r()()()),t&2){let e=m.$implicit;p(2),f(e.code),p(2),s("routerLink",V(8,wt,e.accountID)),p(),f(e.name),p(2),s("routerLink",F(10,Dt))("queryParams",V(11,Xt,e.accountID)),p(),f(y(9,6,e.counterAmount))}}function In(t,m){if(t&1&&(o(0,"tr")(1,"td",21),l(2,"Total Equity"),r(),o(3,"td",22),l(4),C(5,"number"),r()(),o(6,"tr")(7,"td",21),l(8," Total Liability + Equity "),r(),o(9,"td",22),l(10),C(11,"number"),r()()),t&2){let e=c(3);p(4),w(" ",y(5,2,e.store.totalEquity())," "),p(6),w(" ",y(11,4,e.store.totalLiability()+e.store.totalEquity())," ")}}function Tn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),l(3,"No equity records found."),r()()())}function wn(t,m){if(t&1&&(o(0,"h4",24),l(1,"Equity"),r(),o(2,"p-table",15),x(3,yn,7,0,"ng-template",null,3,_)(5,En,10,13,"ng-template",null,4,_),l(7," <"),x(8,In,12,6,"ng-template",null,5,_)(10,Tn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);p(2),s("value",e.store.data().equity)}}function Dn(t,m){if(t&1&&(o(0,"p-panel",12)(1,"div",13),x(2,xn,11,1)(3,vn,11,1)(4,wn,12,1),r()()),t&2){let e=c();s("showHeader",!1),p(2),M(e.Object.keys(e.store.data().asset).length>0?2:-1),p(),M(e.Object.keys(e.store.data().liability).length>0?3:-1),p(),M(e.Object.keys(e.store.data().equity).length>0?4:-1)}}function Rn(t,m){if(t&1&&(o(0,"div",31)(1,"div"),l(2),r()()),t&2){let e=m.$implicit;p(2),f(e.value)}}function Fn(t,m){if(t&1&&(o(0,"form",26)(1,"div",27)(2,"label",28),l(3,"Outlet"),r(),o(4,"p-multiselect",29),x(5,Rn,3,1,"ng-template",null,7,_),r()(),o(7,"div",27)(8,"label",28),l(9,"From"),r(),T(10,"p-datepicker",30),r()()),t&2){let e=c();s("formGroup",e.filterForm),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",e.store.metadata().options.outlets)("showClear",!0),p(6),s("iconDisplay","input")("showIcon",!0)}}var Jt=(()=>{class t{constructor(){this.store=S(Tt),this.ReportServiceStore=S(G),this.dialogFilterVisible=E(!1),this.isInitDialogFilterVisible=E(!1),this.roleService=S(ie),this.Object=Object}ngOnInit(){this.generateFilterForm()}generateFilterForm(){this.filterForm=new Ot({date:new dt(new Date),outletID:new dt([])})}onFilterOKEvent(){let{date:e,outletID:n}=this.filterForm.value;this.store.updateFilter({date:(0,$t.default)(e).format("YYYY-MM-DD"),listOutletParam:n}),this.dialogFilterVisible.update(i=>!i)}onExport(){let e=v(g({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.ReportServiceStore.getBalanceSheet(e,{responseType:"blob"}).pipe(ke("Export Balance Sheet"),L(n=>{let i=n.type,a=[n],u=document.createElement("a");u.href=window.URL.createObjectURL(new Blob(a,{type:i}));let d=`balance-sheet.${i.split("/")[1]}`;u.setAttribute("download",d),document.body.appendChild(u),u.click(),document.body.removeChild(u)})).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-balance-sheet"]],features:[Oe([Tt])],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["footer",""],["emptymessage",""],["item",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],[1,"d-flex","gap-2"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick",4,"ngIf"],["severity","secondary","variant","outlined","icon","fa-solid fa-upload","label","Export",3,"onClick"],[3,"showHeader"],[1,"d-flex","flex-column","gap-3"],[1,"fs-5","fw-semibold","mt-3"],[3,"value"],[2,"width","20%"],[1,"text-end",2,"width","5%"],["target","_blank",1,"link","link-primary",3,"routerLink"],[1,"text-end"],["target","_blank",1,"link","link-primary",3,"routerLink","queryParams"],["colspan","2",1,"fw-semibold","text-end"],[1,"text-end","fw-semibold"],["colspan","3",1,""],[1,"fs-5","fw-semibold"],["target","_blank",1,"link","link-primary","d-flex","align-items-center",3,"routerLink"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["formControlName","outletID","display","chip","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select Outlet",3,"virtualScroll","virtualScrollItemSize","options","showClear"],["formControlName","date","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],[1,"flex","items-center","gap-2"]],template:function(n,i){if(n&1){let a=D();o(0,"app-main-panel",8),P("isDialogFilterVisibleChange",function(d){return h(a),B(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),b(d)})("isInitDialogFilterVisibleChange",function(d){return h(a),B(i.isInitDialogFilterVisible,d)||(i.isInitDialogFilterVisible=d),b(d)}),I("filterConfirmed",function(){return h(a),b(i.onFilterOKEvent())}),x(1,dn,2,1,"ng-template",null,0,_)(3,Dn,5,4,"ng-template",null,1,_)(5,Fn,11,7,"ng-template",null,2,_),r()}n&2&&(s("pageTitle",i.store.data().pageTitle)("isFilterable",!0),A("isDialogFilterVisible",i.dialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[ne,H,z,q,pe,ae,oe,ee,Z,Q,$,K,Y,X,J,ce,se,le,re,ye,te,Xe,W,U],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Qt=(()=>{class t{static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-comparative-balance"]],decls:3,vars:0,template:function(n,i){n&1&&(o(0,"p"),l(1,"report-comparative-balance works!"),r(),l(2,`
2
2
  ,
3
3
  `))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Zt=(()=>{class t{static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-cash-flow"]],decls:3,vars:0,template:function(n,i){n&1&&(o(0,"p"),l(1,"report-cash-flow works!"),r(),l(2,`
4
4
  ,
@@ -1 +1 @@
1
- import{a as r}from"./chunk-M3WCSF6D.js";import{ca as i,ia as n}from"./chunk-6K5LNQ4J.js";var u=(()=>{class e{constructor(){this.httpService=n(r)}getClosingEntries(t){return this.httpService.get(void 0,"api/SetupClosingEntries/GetAll",{params:t})}createClosingEntry(t){return this.httpService.post(void 0,"api/SetupClosingEntries/Submit",t)}deleteClosingEntry(t){return this.httpService.delete(void 0,`api/SetupClosingEntries/Delete?closingEntryIds=${t}`)}getClosingEntryCount(){return this.httpService.get(void 0,"api/SetupClosingEntries/GetAllCount")}static{this.\u0275fac=function(o){return new(o||e)}}static{this.\u0275prov=i({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();export{u as a};
1
+ import{a as r}from"./chunk-BM3MNYWW.js";import{ca as i,ia as n}from"./chunk-6K5LNQ4J.js";var u=(()=>{class e{constructor(){this.httpService=n(r)}getClosingEntries(t){return this.httpService.get(void 0,"api/SetupClosingEntries/GetAll",{params:t})}createClosingEntry(t){return this.httpService.post(void 0,"api/SetupClosingEntries/Submit",t)}deleteClosingEntry(t){return this.httpService.delete(void 0,`api/SetupClosingEntries/Delete?closingEntryIds=${t}`)}getClosingEntryCount(){return this.httpService.get(void 0,"api/SetupClosingEntries/GetAllCount")}static{this.\u0275fac=function(o){return new(o||e)}}static{this.\u0275prov=i({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();export{u as a};
@@ -1 +1 @@
1
- import{a as b}from"./chunk-ZDTMCWOO.js";import{B as I,C as g,D}from"./chunk-SB5MSLCX.js";import{I as u,_ as d,ca as m,ia as f,n as y,s as h}from"./chunk-6K5LNQ4J.js";import{a as o,b as c}from"./chunk-YQFG5XE2.js";var L=(()=>{class s{constructor(){this.httpClient=f(D),this.toastr=f(b)}get(t="",e,a={}){return this.httpClient.get(`${t}${e}`,a).pipe(u(this.handleError.bind(this)))}post(t="",e,a,r={observe:"response"}){return this.httpClient.post(`${t}${e}`,a,o({},r)).pipe(d(this.handleResponse.bind(this)),h(n=>n instanceof I&&Object.prototype.hasOwnProperty.call(r,"observe")&&r.observe==="response"?n.body instanceof Blob?n:n.body:n),u(this.handleError.bind(this)))}put(t="",e,a,r={}){return this.httpClient.put(`${t}${e}`,a,c(o({},r),{observe:"response"})).pipe(d(this.handleResponse.bind(this)),h(n=>n.body),u(this.handleError.bind(this)))}delete(t="",e,a={}){return this.httpClient.delete(`${t}${e}`,c(o({},a),{observe:"response"})).pipe(d(this.handleResponse.bind(this)),h(r=>r.body),u(this.handleError.bind(this)))}handleResponse(t){if(t instanceof I&&t.status===200&&t.body){let e;typeof t.body=="object"&&t.body!==null&&(e=t.body.message||t.body.Message),typeof e=="string"&&e.length>0&&this.toastr.success(e,"Success")}}handleError(t){let e={header:"API Error",message:"An unknown error occurred"};if(t instanceof g)switch(t.status){case 0:e.message="CORS error: Request blocked or server not responding with proper CORS headers",e.header="CORS Error";break;case 504:e.message=t.statusText||"Gateway Timeout",e.header=`API Error: ${t.status}`;break;default:e.header=`API Error: ${t.status}`,e.message=t.error&&(t.error.Message||t.error.message||t.error.error)||t.message}return t instanceof g&&(t.status>=200&&t.status<300?this.toastr.success(e.message,e.header):t.status>=400&&t.status<500?this.toastr.warning(e.message,e.header):t.status>=500&&t.status<600&&this.toastr.error(e.message,e.header)),y(()=>e)}static{this.\u0275fac=function(e){return new(e||s)}}static{this.\u0275prov=m({token:s,factory:s.\u0275fac,providedIn:"root"})}}return s})();var p={production:!0,version:"5.43.0",changelogUrl:"https://changelog.dealpos.com/?categories=cat_O6pYAT7GI1mts",defaultTimezone:"Asia/Jakarta",intercom:{appId:"xv1oomgl"}};var l=class s{static{this.emailRegex=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/}static{this.phoneNumberRegex=/^\d+$/}static{this.GuidEmpty="00000000-0000-0000-0000-000000000000"}static{this.DecimalMinValue="-7.922816251426434e+28"}static{this.InputLockTimeSpan=500}static{this.MinDate="0001-01-01T00:00:00"}static{this.MinTime="00:00:00"}static{this.MinDecimal="-79228162514264337593543950335"}static StringFormat(i,...t){for(let e=0;e<t.length;e++)i=i.replace(`{${e}}`,t[e]);return i}static{this.isMobileDevice=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}static IsNotEmpty(i){return i!=""&&!s.containsOnlySpaces(i)&&i!=s.GuidEmpty&&i!=null&&i!=null}static IsEmpty(i){return!!(i==""||s.containsOnlySpaces(i)||i==null||i==null||i==s.GuidEmpty)}static isGuid(i){let t=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi,e=!1;return i&&(e=t.test(i)),e}static containsOnlySpaces(i){return/^\s*$/.test(i)}static FilterByID(i,t){try{let e=i.filter(a=>a.ID==t);if(e.length>0)return e[0]}catch{}return null}static{this.Months=[{ID:1,Label:"January"},{ID:2,Label:"February"},{ID:3,Label:"March"},{ID:4,Label:"April"},{ID:5,Label:"May"},{ID:6,Label:"June"},{ID:7,Label:"July"},{ID:8,Label:"August"},{ID:9,Label:"September"},{ID:10,Label:"October"},{ID:11,Label:"November"},{ID:12,Label:"December"}]}static GenerateYears(i,t,e){let a=-1;(t==null||t==null)&&(t=11),(e==null||e==null||!e)&&(a=1);let r=[];for(let n=0;n<t;n++)r.push(i+n*a);return r}static DateOnly(i){return i?new Date(new Date(i).toDateString()):new Date(new Date().toDateString())}static differentInDays(i,t){let e=t.getTime()-i.getTime();return Math.floor(e/(1e3*3600*24))}static minutesDiff(i,t){let e=(t.getTime()-i.getTime())/6e4;return Math.ceil(e)}static hoursDiff(i,t){let a=(t.getTime()-i.getTime())/(1e3*3600);return parseFloat(a.toFixed(1))}static Guid_NewGuid(){let i=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var a=(i+Math.random()*16)%16|0;return i=Math.floor(i/16),(e=="x"?a:a&3|8).toString(16)})}static parseJwt(i){var t=i.split(".")[1],e=t.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(e).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)}static numberOnly(i){let t=i.which?i.which:i.keyCode;return!(t>31&&(t<48||t>57))}static formatNumber(i){let t="",e="",a=Math.abs(i);return a>999&&a<1e6?(e="K",t=(a/1e3).toFixed(0)):a>=1e6?(e="M",t=(a/1e6).toFixed(0)):a<999&&(t=a.toString()),i<0&&(t="-"+t),t.replace(/\B(?=(\d{3})+(?!\d))/g,",")+e}static isToDay(i){if(this.IsNotEmpty(i)){i=typeof i=="string"?new Date(i):i;let t=new Date;return t.setHours(0,0,0,0),i.setHours(0,0,0,0),t.getTime()==i.getTime()}return!1}static setToLatestTime(i){let t=new Date(i);return t.setHours(23,59,59),t}static setToFirstTime(i){let t=new Date(i);return t.setHours(0,0,0),t}static compare(i,t,e){return(i<t?-1:1)*(e?1:-1)}static generateSerialasNote(i=[]){let t="";return i&&i.length>0&&(t=`[${i.map((a,r)=>`${r>0?" ":""}${a.Number}${a.Quantity>1||a.Quantity<0?"*"+a.Quantity:""}`)}]`),t}static getDatesInRange(i,t){let e=new Date(i.getTime()),a=[];for(;e<=t;)a.push(new Date(e)),e.setDate(e.getDate()+1);return a}static getDaysBefore(i,t){return new Date(i.setDate(new Date().getDate()-t))}static getRangeDate(i,t){let e=new Date;e.setMonth(i),e.setFullYear(t);let a=new Date(e.getFullYear(),e.getMonth()-1,1),r=new Date(e.getFullYear(),e.getMonth(),0);return{firstDay:a,lastDay:r}}static setDateTime(i,t){let e=new Date;t&&(e=new Date(t));let a=i.split(":");return e.setHours(parseInt(a[0])),e.setMinutes(parseInt(a[1])),e}static isMaskingField(i=""){return i.includes("?")}static generateMaskingField(i=[]){let t={};return i.forEach((e,a)=>{e=e.split(" ")?.join(""),t=c(o({},t),{[e]:!0})}),t}static checkJSApiSupported(i){let t;return i in window?t=!0:t=!1,t}static cloneObject(i){let t;return this.checkJSApiSupported("structuredClone")?t=structuredClone(i):t=JSON.parse(JSON.stringify(i)),t}static formatTitleFromDate(i,t){let e=null,a=new Date(i),r=new Date(t);return a.getDate()!=r.getDate()&&(e="d"),a.getMonth()!=r.getMonth()&&(e="d MMM"),a.getFullYear()!=r.getFullYear()&&(e="d MMM yyyy"),e}};var N=(()=>{class s{initializeIntercom(){let t=this.getFromLocalStorage();l.IsNotEmpty(t)&&window.Intercom("boot",{app_id:p.intercom.appId,name:t.name,email:t.email,created_at:t.created,user_hash:t.hash})}shutdown(){window.Intercom("shutdown"),this.clearStorage()}clearStorage(){localStorage.removeItem("INTERCOM")}updateLocalStorage(t){localStorage.setItem("INTERCOM",JSON.stringify(t))}getFromLocalStorage(){let t=localStorage.getItem("INTERCOM");return JSON.parse(t)}hideLauncher(){let t=this.getFromLocalStorage();t.hide_default_launcher=!0,window.Intercom("update",o({app_id:p.intercom.appId},t)),this.updateLocalStorage(t)}showLauncher(){let t=this.getFromLocalStorage();t.hide_default_launcher=!1,window.Intercom("update",o({app_id:p.intercom.appId},t)),this.updateLocalStorage(t)}isHideLauncher(){let t=this.getFromLocalStorage();return l.IsEmpty(t?.hide_default_launcher)?!1:t?.hide_default_launcher}static{this.\u0275fac=function(e){return new(e||s)}}static{this.\u0275prov=m({token:s,factory:s.\u0275fac,providedIn:"root"})}}return s})();export{L as a,l as b,p as c,N as d};
1
+ import{a as b}from"./chunk-ZDTMCWOO.js";import{B as I,C as g,D}from"./chunk-SB5MSLCX.js";import{I as u,_ as d,ca as m,ia as f,n as y,s as h}from"./chunk-6K5LNQ4J.js";import{a as o,b as c}from"./chunk-YQFG5XE2.js";var L=(()=>{class s{constructor(){this.httpClient=f(D),this.toastr=f(b)}get(t="",e,a={}){return this.httpClient.get(`${t}${e}`,a).pipe(u(this.handleError.bind(this)))}post(t="",e,a,r={observe:"response"}){return this.httpClient.post(`${t}${e}`,a,o({},r)).pipe(d(this.handleResponse.bind(this)),h(n=>n instanceof I&&Object.prototype.hasOwnProperty.call(r,"observe")&&r.observe==="response"?n.body instanceof Blob?n:n.body:n),u(this.handleError.bind(this)))}put(t="",e,a,r={}){return this.httpClient.put(`${t}${e}`,a,c(o({},r),{observe:"response"})).pipe(d(this.handleResponse.bind(this)),h(n=>n.body),u(this.handleError.bind(this)))}delete(t="",e,a={}){return this.httpClient.delete(`${t}${e}`,c(o({},a),{observe:"response"})).pipe(d(this.handleResponse.bind(this)),h(r=>r.body),u(this.handleError.bind(this)))}handleResponse(t){if(t instanceof I&&t.status===200&&t.body){let e;typeof t.body=="object"&&t.body!==null&&(e=t.body.message||t.body.Message),typeof e=="string"&&e.length>0&&this.toastr.success(e,"Success")}}handleError(t){let e={header:"API Error",message:"An unknown error occurred"};if(t instanceof g)switch(t.status){case 0:e.message="CORS error: Request blocked or server not responding with proper CORS headers",e.header="CORS Error";break;case 504:e.message=t.statusText||"Gateway Timeout",e.header=`API Error: ${t.status}`;break;default:e.header=`API Error: ${t.status}`,e.message=t.error&&(t.error.Message||t.error.message||t.error.error)||t.message}return t instanceof g&&(t.status>=200&&t.status<300?this.toastr.success(e.message,e.header):t.status>=400&&t.status<500?this.toastr.warning(e.message,e.header):t.status>=500&&t.status<600&&this.toastr.error(e.message,e.header)),y(()=>e)}static{this.\u0275fac=function(e){return new(e||s)}}static{this.\u0275prov=m({token:s,factory:s.\u0275fac,providedIn:"root"})}}return s})();var p={production:!0,version:"5.43.1",changelogUrl:"https://changelog.dealpos.com/?categories=cat_O6pYAT7GI1mts",defaultTimezone:"Asia/Jakarta",intercom:{appId:"xv1oomgl"}};var l=class s{static{this.emailRegex=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/}static{this.phoneNumberRegex=/^\d+$/}static{this.GuidEmpty="00000000-0000-0000-0000-000000000000"}static{this.DecimalMinValue="-7.922816251426434e+28"}static{this.InputLockTimeSpan=500}static{this.MinDate="0001-01-01T00:00:00"}static{this.MinTime="00:00:00"}static{this.MinDecimal="-79228162514264337593543950335"}static StringFormat(i,...t){for(let e=0;e<t.length;e++)i=i.replace(`{${e}}`,t[e]);return i}static{this.isMobileDevice=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}static IsNotEmpty(i){return i!=""&&!s.containsOnlySpaces(i)&&i!=s.GuidEmpty&&i!=null&&i!=null}static IsEmpty(i){return!!(i==""||s.containsOnlySpaces(i)||i==null||i==null||i==s.GuidEmpty)}static isGuid(i){let t=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi,e=!1;return i&&(e=t.test(i)),e}static containsOnlySpaces(i){return/^\s*$/.test(i)}static FilterByID(i,t){try{let e=i.filter(a=>a.ID==t);if(e.length>0)return e[0]}catch{}return null}static{this.Months=[{ID:1,Label:"January"},{ID:2,Label:"February"},{ID:3,Label:"March"},{ID:4,Label:"April"},{ID:5,Label:"May"},{ID:6,Label:"June"},{ID:7,Label:"July"},{ID:8,Label:"August"},{ID:9,Label:"September"},{ID:10,Label:"October"},{ID:11,Label:"November"},{ID:12,Label:"December"}]}static GenerateYears(i,t,e){let a=-1;(t==null||t==null)&&(t=11),(e==null||e==null||!e)&&(a=1);let r=[];for(let n=0;n<t;n++)r.push(i+n*a);return r}static DateOnly(i){return i?new Date(new Date(i).toDateString()):new Date(new Date().toDateString())}static differentInDays(i,t){let e=t.getTime()-i.getTime();return Math.floor(e/(1e3*3600*24))}static minutesDiff(i,t){let e=(t.getTime()-i.getTime())/6e4;return Math.ceil(e)}static hoursDiff(i,t){let a=(t.getTime()-i.getTime())/(1e3*3600);return parseFloat(a.toFixed(1))}static Guid_NewGuid(){let i=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var a=(i+Math.random()*16)%16|0;return i=Math.floor(i/16),(e=="x"?a:a&3|8).toString(16)})}static parseJwt(i){var t=i.split(".")[1],e=t.replace(/-/g,"+").replace(/_/g,"/"),a=decodeURIComponent(atob(e).split("").map(function(r){return"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(a)}static numberOnly(i){let t=i.which?i.which:i.keyCode;return!(t>31&&(t<48||t>57))}static formatNumber(i){let t="",e="",a=Math.abs(i);return a>999&&a<1e6?(e="K",t=(a/1e3).toFixed(0)):a>=1e6?(e="M",t=(a/1e6).toFixed(0)):a<999&&(t=a.toString()),i<0&&(t="-"+t),t.replace(/\B(?=(\d{3})+(?!\d))/g,",")+e}static isToDay(i){if(this.IsNotEmpty(i)){i=typeof i=="string"?new Date(i):i;let t=new Date;return t.setHours(0,0,0,0),i.setHours(0,0,0,0),t.getTime()==i.getTime()}return!1}static setToLatestTime(i){let t=new Date(i);return t.setHours(23,59,59),t}static setToFirstTime(i){let t=new Date(i);return t.setHours(0,0,0),t}static compare(i,t,e){return(i<t?-1:1)*(e?1:-1)}static generateSerialasNote(i=[]){let t="";return i&&i.length>0&&(t=`[${i.map((a,r)=>`${r>0?" ":""}${a.Number}${a.Quantity>1||a.Quantity<0?"*"+a.Quantity:""}`)}]`),t}static getDatesInRange(i,t){let e=new Date(i.getTime()),a=[];for(;e<=t;)a.push(new Date(e)),e.setDate(e.getDate()+1);return a}static getDaysBefore(i,t){return new Date(i.setDate(new Date().getDate()-t))}static getRangeDate(i,t){let e=new Date;e.setMonth(i),e.setFullYear(t);let a=new Date(e.getFullYear(),e.getMonth()-1,1),r=new Date(e.getFullYear(),e.getMonth(),0);return{firstDay:a,lastDay:r}}static setDateTime(i,t){let e=new Date;t&&(e=new Date(t));let a=i.split(":");return e.setHours(parseInt(a[0])),e.setMinutes(parseInt(a[1])),e}static isMaskingField(i=""){return i.includes("?")}static generateMaskingField(i=[]){let t={};return i.forEach((e,a)=>{e=e.split(" ")?.join(""),t=c(o({},t),{[e]:!0})}),t}static checkJSApiSupported(i){let t;return i in window?t=!0:t=!1,t}static cloneObject(i){let t;return this.checkJSApiSupported("structuredClone")?t=structuredClone(i):t=JSON.parse(JSON.stringify(i)),t}static formatTitleFromDate(i,t){let e=null,a=new Date(i),r=new Date(t);return a.getDate()!=r.getDate()&&(e="d"),a.getMonth()!=r.getMonth()&&(e="d MMM"),a.getFullYear()!=r.getFullYear()&&(e="d MMM yyyy"),e}};var N=(()=>{class s{initializeIntercom(){let t=this.getFromLocalStorage();l.IsNotEmpty(t)&&window.Intercom("boot",{app_id:p.intercom.appId,name:t.name,email:t.email,created_at:t.created,user_hash:t.hash})}shutdown(){window.Intercom("shutdown"),this.clearStorage()}clearStorage(){localStorage.removeItem("INTERCOM")}updateLocalStorage(t){localStorage.setItem("INTERCOM",JSON.stringify(t))}getFromLocalStorage(){let t=localStorage.getItem("INTERCOM");return JSON.parse(t)}hideLauncher(){let t=this.getFromLocalStorage();t.hide_default_launcher=!0,window.Intercom("update",o({app_id:p.intercom.appId},t)),this.updateLocalStorage(t)}showLauncher(){let t=this.getFromLocalStorage();t.hide_default_launcher=!1,window.Intercom("update",o({app_id:p.intercom.appId},t)),this.updateLocalStorage(t)}isHideLauncher(){let t=this.getFromLocalStorage();return l.IsEmpty(t?.hide_default_launcher)?!1:t?.hide_default_launcher}static{this.\u0275fac=function(e){return new(e||s)}}static{this.\u0275prov=m({token:s,factory:s.\u0275fac,providedIn:"root"})}}return s})();export{L as a,l as b,p as c,N as d};
@@ -1 +1 @@
1
- import{a as ke,b as Me}from"./chunk-FFBH7KYD.js";import{a as ve,b as be,c as xe,d as Ce,e as ye,f as Fe}from"./chunk-OB46Z7ZH.js";import"./chunk-E3ZGQRZ3.js";import{a as ge,b as he}from"./chunk-M5PA3FZY.js";import{a as _e}from"./chunk-XKI7WLHE.js";import{a as ce}from"./chunk-ORLKNWW4.js";import"./chunk-WLKS6LBU.js";import"./chunk-VRKBMD72.js";import{a as I}from"./chunk-KXE3J4PK.js";import"./chunk-AJZ7YLT4.js";import{a as re,b as ie}from"./chunk-SPKOXGSS.js";import"./chunk-IJTQE2H4.js";import{h as fe}from"./chunk-O5EVYQVN.js";import{b as de,c as ue}from"./chunk-L3PZS6EL.js";import{a as se,b as me}from"./chunk-5JV52UYK.js";import"./chunk-ACTRMWEI.js";import"./chunk-ARXP327B.js";import{n as ne,o as ae,w as le,x as pe}from"./chunk-7FFMPB6T.js";import"./chunk-UKBDY33R.js";import{b as H,c as J,e as K,f as Q,k as W,l as X,m as Y,n as Z,o as ee,u as te,x as oe}from"./chunk-72LNXEXV.js";import{b as U,d as L}from"./chunk-EFDD6Q3K.js";import"./chunk-M3WCSF6D.js";import"./chunk-ZDTMCWOO.js";import"./chunk-F2X3VGZZ.js";import{h as $,j,k as q,s as z}from"./chunk-SB5MSLCX.js";import{$b as w,Bb as O,Db as f,Dc as v,Ec as b,Ha as D,Lb as a,Ob as _,Pb as y,Rb as F,Rc as T,Tb as k,Ub as M,Vb as i,Vc as B,Wb as n,Xb as g,Y as G,_ as C,ec as R,fc as d,hb as r,ia as c,qa as E,ra as N,rc as h,sc as S,tc as V,ua as A,xb as P}from"./chunk-6K5LNQ4J.js";import"./chunk-YQFG5XE2.js";var Ge=()=>({height:"calc(100vh - 70px)"}),Ee=t=>({"ng-invalid ng-dirty":t}),Se=t=>({"ps-0":t}),Te=()=>({display:"flex"});function Ne(t,l){if(t&1){let e=w();i(0,"p-button",4),R("onClick",function(){E(e);let p=d(2);return N(p.onSubmit())}),n()}}function Ae(t,l){if(t&1&&f(0,Ne,1,0,"p-button",3),t&2){let e=d();a("ngIf",e.roleService.user.edit)}}function De(t,l){if(t&1&&(i(0,"div")(1,"span",16),h(2),n()()),t&2){let e=l.$implicit;r(2),S(e)}}function Pe(t,l){if(t&1&&(i(0,"div"),f(1,De,3,1,"div",15),n()),t&2){let e=d(2);r(),a("ngForOf",e.getErrors("name"))}}function Oe(t,l){if(t&1&&(i(0,"div",25)(1,"div",26),g(2,"p-checkbox",27),i(3,"p",28),h(4),n()()()),t&2){let e=l.$implicit,o=l.$index;a("formGroupName",o)("pTooltip",e.get("description").value),r(2),_(v(6,Te)),a("binary",!0),r(2),V(" ",e.get("name").value," ")}}function we(t,l){if(t&1&&(i(0,"div",18)(1,"div",19)(2,"div",20)(3,"span",21),h(4),n()(),g(5,"p-checkbox",22),n(),i(6,"div",23)(7,"div",24),k(8,Oe,5,7,"div",25,F),n()()()),t&2){let e=l.$implicit,o=l.$index,p=d(3);a("formGroupName",o),r(4),S(e.get("groupName").value),r(),_(v(5,Te)),a("binary",!0),r(3),M(p.getRolesArray(o).controls)}}function Re(t,l){if(t&1&&(i(0,"div",17),k(1,we,10,6,"div",18,F),n()),t&2){let e=d(2);r(),M(e.rolesFormArray.controls)}}function Ve(t,l){if(t&1&&(i(0,"p-panel")(1,"div",5),g(2,"app-user-tabs"),i(3,"form",6),g(4,"input",7),f(5,Pe,2,1,"div",8),n(),i(6,"p-tabs",9)(7,"p-tablist")(8,"p-tab",9),h(9,"Permission"),n(),i(10,"p-tab",10),h(11,"Description"),n()(),i(12,"p-tabpanels",11)(13,"p-tabpanel",9)(14,"form",6),f(15,Re,3,0,"div",12),n()(),i(16,"p-tabpanel",10)(17,"div",13),g(18,"textarea",14),n()()()()()()),t&2){let e=d();_(v(13,Ge)),r(3),a("formGroup",e.form),r(),a("fluid",!0)("ngClass",b(14,Ee,e.isInvalid("name"))),r(),a("ngIf",e.isInvalid("name")),r(3),y(b(16,Se,e.router.url.includes("forms"))),r(2),y(b(18,Se,e.router.url.includes("forms"))),r(4),a("formGroup",e.form),r(),a("ngIf",e.rolesFormArray.length>0),r(2),a("formGroup",e.form)}}var gt=(()=>{class t extends _e{constructor(){super(...arguments),this.service=c(ke),this.fb=c(te),this.cdr=c(B),this.route=c(U),this.router=c(L),this.roleService=c(ce),this.form=this.fb.group({groupID:this.fb.control(""),name:this.fb.control("",[J.required]),description:this.fb.control(""),roles:this.fb.array([])}),this.groupFormMeta=D(null)}ngOnInit(){this.route.queryParamMap.pipe(G(e=>this.service.getGroupFormMeta(e.get("groupID")).pipe(I("Group form meta loaded"),C(o=>{this.groupFormMeta.set(o),this.populateForm(o)})))).subscribe()}populateForm(e){this.form.patchValue({groupID:e.form.groupID,name:e.form.name,description:e.form.description});let o=this.rolesFormArray;o.clear(),e.options.roles.forEach(p=>{let m=this.fb.array(p.roles.map(s=>this.fb.group({id:this.fb.control(s.id),name:this.fb.control(s.name),checked:this.fb.control({value:e.form.rolesID.includes(s.id),disabled:!this.roleService.user.edit}),description:this.fb.control(s.description||"")}))),u=this.fb.group({groupName:this.fb.control(p.name),groupChecked:this.fb.control(!1),roles:m}),Ie=m.controls.every(s=>s.get("checked").value);u.get("groupChecked").setValue(Ie,{emitEvent:!1}),this.roleService.user.edit?u.get("groupChecked").enable():u.get("groupChecked").disable(),u.get("groupChecked").valueChanges.subscribe(s=>{m.controls.forEach(x=>{x.get("checked").setValue(s,{emitEvent:!1})})}),m.valueChanges.subscribe(()=>{let s=m.controls.every(x=>x.get("checked").value);u.get("groupChecked").setValue(s,{emitEvent:!1})}),o.push(u)}),this.cdr.detectChanges()}get rolesFormArray(){return this.form.get("roles")}getRolesArray(e){return this.rolesFormArray.at(e).get("roles")}getSelectedRoleIDs(){let e=[];return this.rolesFormArray.controls.forEach(o=>{o.get("roles").controls.forEach(m=>{m.get("checked").value&&e.push(m.get("id").value)})}),e}onSubmit(){if(this.form.invalid){this.form.markAllAsTouched();return}let e={groupID:this.form.get("groupID").value,name:this.form.get("name").value,rolesID:this.getSelectedRoleIDs(),description:this.form.controls.description.value};this.service.assignGroupRole(e).pipe(I("Group roles assigned successfully"),C(()=>{this.router.navigate(["/pages/users/groups"])})).subscribe(),console.log(e)}static{this.\u0275fac=(()=>{let e;return function(p){return(e||(e=A(t)))(p||t)}})()}static{this.\u0275cmp=P({type:t,selectors:[["app-group-form"]],features:[O],decls:5,vars:1,consts:[["actionButton",""],["content",""],["pageTitle","Group Form",3,"overflowScroll"],["label","Submit",3,"onClick",4,"ngIf"],["label","Submit",3,"onClick"],[1,"d-flex","flex-column","gap-3","py-2"],[1,"d-flex","flex-column","gap-2",3,"formGroup"],["type","text","pInputText","","formControlName","name","placeholder","Group Name",3,"fluid","ngClass"],[4,"ngIf"],["value","0"],["value","1"],[2,"padding-left","0"],["formArrayName","roles","class","container-fluid d-flex flex-column row-gap-3",4,"ngIf"],[3,"formGroup"],["formControlName","description","fluid","","rows","5","cols","30","pTextarea",""],[4,"ngFor","ngForOf"],[1,"text-danger"],["formArrayName","roles",1,"container-fluid","d-flex","flex-column","row-gap-3"],[1,"row","align-items-stretch",3,"formGroupName"],[1,"col-2","py-2","border-top","border-bottom","border-start","d-flex","justify-content-between",2,"background","#f6f6f6"],[1,"d-flex","justify-content-center","w-100"],[1,"text-dark","fw-semibold","fs-2"],["size","small","formControlName","groupChecked",3,"binary"],[1,"col","p-0"],["formArrayName","roles",1,"roles-grid","h-100"],["tooltipPosition","top",1,"role-cell",3,"formGroupName","pTooltip"],[1,"py-2","d-flex","h-100","align-items-center","gap-2","px-2"],["size","small","formControlName","checked",3,"binary"],[1,"fs-2","text-dark","m-0"]],template:function(o,p){o&1&&(i(0,"app-main-panel",2),f(1,Ae,1,1,"ng-template",null,0,T)(3,Ve,19,20,"ng-template",null,1,T),n()),o&2&&a("overflowScroll",!0)},dependencies:[fe,ie,re,oe,W,H,K,Q,X,ee,Y,Z,z,$,j,q,ae,ne,Fe,ye,Ce,xe,ve,be,he,ge,pe,le,Me,me,se,ue,de],styles:["[_nghost-%COMP%]{display:block}[_nghost-%COMP%] .p-checkbox{display:flex!important}[_nghost-%COMP%] .p-tabs .p-tab{padding-left:0!important}[_nghost-%COMP%] .p-panel .p-panel-header{display:none!important}.roles-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(4,1fr)}.role-cell[_ngcontent-%COMP%]{border:1px solid #ddd;border-top:none;border-left:none;background:#fff}.roles-grid[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:nth-child(-n+4){border-top:1px solid #ddd}.roles-grid[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:nth-child(4n+1){border-left:1px solid #ddd}"],changeDetection:0})}}return t})();export{gt as GroupFormComponent};
1
+ import{a as ke,b as Me}from"./chunk-7DONF5P4.js";import{a as ve,b as be,c as xe,d as Ce,e as ye,f as Fe}from"./chunk-OB46Z7ZH.js";import"./chunk-E3ZGQRZ3.js";import{a as ge,b as he}from"./chunk-M5PA3FZY.js";import{a as _e}from"./chunk-XKI7WLHE.js";import{a as ce}from"./chunk-ORLKNWW4.js";import"./chunk-WLKS6LBU.js";import"./chunk-VRKBMD72.js";import{a as I}from"./chunk-KXE3J4PK.js";import"./chunk-AJZ7YLT4.js";import{a as re,b as ie}from"./chunk-SPKOXGSS.js";import"./chunk-IJTQE2H4.js";import{h as fe}from"./chunk-R3GHYD6Y.js";import{b as de,c as ue}from"./chunk-L3PZS6EL.js";import{a as se,b as me}from"./chunk-5JV52UYK.js";import"./chunk-ACTRMWEI.js";import"./chunk-ARXP327B.js";import{n as ne,o as ae,w as le,x as pe}from"./chunk-7FFMPB6T.js";import"./chunk-UKBDY33R.js";import{b as H,c as J,e as K,f as Q,k as W,l as X,m as Y,n as Z,o as ee,u as te,x as oe}from"./chunk-72LNXEXV.js";import{b as U,d as L}from"./chunk-EFDD6Q3K.js";import"./chunk-BM3MNYWW.js";import"./chunk-ZDTMCWOO.js";import"./chunk-F2X3VGZZ.js";import{h as $,j,k as q,s as z}from"./chunk-SB5MSLCX.js";import{$b as w,Bb as O,Db as f,Dc as v,Ec as b,Ha as D,Lb as a,Ob as _,Pb as y,Rb as F,Rc as T,Tb as k,Ub as M,Vb as i,Vc as B,Wb as n,Xb as g,Y as G,_ as C,ec as R,fc as d,hb as r,ia as c,qa as E,ra as N,rc as h,sc as S,tc as V,ua as A,xb as P}from"./chunk-6K5LNQ4J.js";import"./chunk-YQFG5XE2.js";var Ge=()=>({height:"calc(100vh - 70px)"}),Ee=t=>({"ng-invalid ng-dirty":t}),Se=t=>({"ps-0":t}),Te=()=>({display:"flex"});function Ne(t,l){if(t&1){let e=w();i(0,"p-button",4),R("onClick",function(){E(e);let p=d(2);return N(p.onSubmit())}),n()}}function Ae(t,l){if(t&1&&f(0,Ne,1,0,"p-button",3),t&2){let e=d();a("ngIf",e.roleService.user.edit)}}function De(t,l){if(t&1&&(i(0,"div")(1,"span",16),h(2),n()()),t&2){let e=l.$implicit;r(2),S(e)}}function Pe(t,l){if(t&1&&(i(0,"div"),f(1,De,3,1,"div",15),n()),t&2){let e=d(2);r(),a("ngForOf",e.getErrors("name"))}}function Oe(t,l){if(t&1&&(i(0,"div",25)(1,"div",26),g(2,"p-checkbox",27),i(3,"p",28),h(4),n()()()),t&2){let e=l.$implicit,o=l.$index;a("formGroupName",o)("pTooltip",e.get("description").value),r(2),_(v(6,Te)),a("binary",!0),r(2),V(" ",e.get("name").value," ")}}function we(t,l){if(t&1&&(i(0,"div",18)(1,"div",19)(2,"div",20)(3,"span",21),h(4),n()(),g(5,"p-checkbox",22),n(),i(6,"div",23)(7,"div",24),k(8,Oe,5,7,"div",25,F),n()()()),t&2){let e=l.$implicit,o=l.$index,p=d(3);a("formGroupName",o),r(4),S(e.get("groupName").value),r(),_(v(5,Te)),a("binary",!0),r(3),M(p.getRolesArray(o).controls)}}function Re(t,l){if(t&1&&(i(0,"div",17),k(1,we,10,6,"div",18,F),n()),t&2){let e=d(2);r(),M(e.rolesFormArray.controls)}}function Ve(t,l){if(t&1&&(i(0,"p-panel")(1,"div",5),g(2,"app-user-tabs"),i(3,"form",6),g(4,"input",7),f(5,Pe,2,1,"div",8),n(),i(6,"p-tabs",9)(7,"p-tablist")(8,"p-tab",9),h(9,"Permission"),n(),i(10,"p-tab",10),h(11,"Description"),n()(),i(12,"p-tabpanels",11)(13,"p-tabpanel",9)(14,"form",6),f(15,Re,3,0,"div",12),n()(),i(16,"p-tabpanel",10)(17,"div",13),g(18,"textarea",14),n()()()()()()),t&2){let e=d();_(v(13,Ge)),r(3),a("formGroup",e.form),r(),a("fluid",!0)("ngClass",b(14,Ee,e.isInvalid("name"))),r(),a("ngIf",e.isInvalid("name")),r(3),y(b(16,Se,e.router.url.includes("forms"))),r(2),y(b(18,Se,e.router.url.includes("forms"))),r(4),a("formGroup",e.form),r(),a("ngIf",e.rolesFormArray.length>0),r(2),a("formGroup",e.form)}}var gt=(()=>{class t extends _e{constructor(){super(...arguments),this.service=c(ke),this.fb=c(te),this.cdr=c(B),this.route=c(U),this.router=c(L),this.roleService=c(ce),this.form=this.fb.group({groupID:this.fb.control(""),name:this.fb.control("",[J.required]),description:this.fb.control(""),roles:this.fb.array([])}),this.groupFormMeta=D(null)}ngOnInit(){this.route.queryParamMap.pipe(G(e=>this.service.getGroupFormMeta(e.get("groupID")).pipe(I("Group form meta loaded"),C(o=>{this.groupFormMeta.set(o),this.populateForm(o)})))).subscribe()}populateForm(e){this.form.patchValue({groupID:e.form.groupID,name:e.form.name,description:e.form.description});let o=this.rolesFormArray;o.clear(),e.options.roles.forEach(p=>{let m=this.fb.array(p.roles.map(s=>this.fb.group({id:this.fb.control(s.id),name:this.fb.control(s.name),checked:this.fb.control({value:e.form.rolesID.includes(s.id),disabled:!this.roleService.user.edit}),description:this.fb.control(s.description||"")}))),u=this.fb.group({groupName:this.fb.control(p.name),groupChecked:this.fb.control(!1),roles:m}),Ie=m.controls.every(s=>s.get("checked").value);u.get("groupChecked").setValue(Ie,{emitEvent:!1}),this.roleService.user.edit?u.get("groupChecked").enable():u.get("groupChecked").disable(),u.get("groupChecked").valueChanges.subscribe(s=>{m.controls.forEach(x=>{x.get("checked").setValue(s,{emitEvent:!1})})}),m.valueChanges.subscribe(()=>{let s=m.controls.every(x=>x.get("checked").value);u.get("groupChecked").setValue(s,{emitEvent:!1})}),o.push(u)}),this.cdr.detectChanges()}get rolesFormArray(){return this.form.get("roles")}getRolesArray(e){return this.rolesFormArray.at(e).get("roles")}getSelectedRoleIDs(){let e=[];return this.rolesFormArray.controls.forEach(o=>{o.get("roles").controls.forEach(m=>{m.get("checked").value&&e.push(m.get("id").value)})}),e}onSubmit(){if(this.form.invalid){this.form.markAllAsTouched();return}let e={groupID:this.form.get("groupID").value,name:this.form.get("name").value,rolesID:this.getSelectedRoleIDs(),description:this.form.controls.description.value};this.service.assignGroupRole(e).pipe(I("Group roles assigned successfully"),C(()=>{this.router.navigate(["/pages/users/groups"])})).subscribe(),console.log(e)}static{this.\u0275fac=(()=>{let e;return function(p){return(e||(e=A(t)))(p||t)}})()}static{this.\u0275cmp=P({type:t,selectors:[["app-group-form"]],features:[O],decls:5,vars:1,consts:[["actionButton",""],["content",""],["pageTitle","Group Form",3,"overflowScroll"],["label","Submit",3,"onClick",4,"ngIf"],["label","Submit",3,"onClick"],[1,"d-flex","flex-column","gap-3","py-2"],[1,"d-flex","flex-column","gap-2",3,"formGroup"],["type","text","pInputText","","formControlName","name","placeholder","Group Name",3,"fluid","ngClass"],[4,"ngIf"],["value","0"],["value","1"],[2,"padding-left","0"],["formArrayName","roles","class","container-fluid d-flex flex-column row-gap-3",4,"ngIf"],[3,"formGroup"],["formControlName","description","fluid","","rows","5","cols","30","pTextarea",""],[4,"ngFor","ngForOf"],[1,"text-danger"],["formArrayName","roles",1,"container-fluid","d-flex","flex-column","row-gap-3"],[1,"row","align-items-stretch",3,"formGroupName"],[1,"col-2","py-2","border-top","border-bottom","border-start","d-flex","justify-content-between",2,"background","#f6f6f6"],[1,"d-flex","justify-content-center","w-100"],[1,"text-dark","fw-semibold","fs-2"],["size","small","formControlName","groupChecked",3,"binary"],[1,"col","p-0"],["formArrayName","roles",1,"roles-grid","h-100"],["tooltipPosition","top",1,"role-cell",3,"formGroupName","pTooltip"],[1,"py-2","d-flex","h-100","align-items-center","gap-2","px-2"],["size","small","formControlName","checked",3,"binary"],[1,"fs-2","text-dark","m-0"]],template:function(o,p){o&1&&(i(0,"app-main-panel",2),f(1,Ae,1,1,"ng-template",null,0,T)(3,Ve,19,20,"ng-template",null,1,T),n()),o&2&&a("overflowScroll",!0)},dependencies:[fe,ie,re,oe,W,H,K,Q,X,ee,Y,Z,z,$,j,q,ae,ne,Fe,ye,Ce,xe,ve,be,he,ge,pe,le,Me,me,se,ue,de],styles:["[_nghost-%COMP%]{display:block}[_nghost-%COMP%] .p-checkbox{display:flex!important}[_nghost-%COMP%] .p-tabs .p-tab{padding-left:0!important}[_nghost-%COMP%] .p-panel .p-panel-header{display:none!important}.roles-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(4,1fr)}.role-cell[_ngcontent-%COMP%]{border:1px solid #ddd;border-top:none;border-left:none;background:#fff}.roles-grid[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:nth-child(-n+4){border-top:1px solid #ddd}.roles-grid[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:nth-child(4n+1){border-left:1px solid #ddd}"],changeDetection:0})}}return t})();export{gt as GroupFormComponent};
@@ -1 +1 @@
1
- import{a as O,b as H}from"./chunk-B4JW5G5L.js";import"./chunk-JRH7ZWIT.js";import{a as I,b as E}from"./chunk-E3QNEH3B.js";import"./chunk-WXT6EZ2V.js";import{h as G}from"./chunk-O5EVYQVN.js";import{b as D,c as N}from"./chunk-L3PZS6EL.js";import{a as j,b as R}from"./chunk-5JV52UYK.js";import"./chunk-ACTRMWEI.js";import"./chunk-ARXP327B.js";import{w as V,x as A}from"./chunk-7FFMPB6T.js";import"./chunk-UKBDY33R.js";import"./chunk-72LNXEXV.js";import"./chunk-M3WCSF6D.js";import{a as F}from"./chunk-ZDTMCWOO.js";import"./chunk-F2X3VGZZ.js";import{n as W,s as $}from"./chunk-SB5MSLCX.js";import{$b as w,Cc as P,Db as B,Dc as C,Lb as p,Nc as s,Ob as h,Oc as m,Rc as x,Vb as o,W as y,Wb as n,Xb as c,Y as T,_ as S,ec as _,fc as l,h as v,hb as a,ia as u,qa as g,ra as d,s as f,sa as b,ta as k,xb as M}from"./chunk-6K5LNQ4J.js";import"./chunk-YQFG5XE2.js";var L=()=>({height:"calc(100vh - 100px)"});function z(i,q){if(i&1){let e=w();o(0,"div",3)(1,"p-button",4),_("onClick",function(){g(e);let r=l();return d(r.onFormat())}),n(),o(2,"p-button",5),s(3,"async"),s(4,"async"),_("onClick",function(){g(e);let r=l();return d(r.migrateWriteoffOutlet())}),n()()}if(i&2){let e=l();a(2),p("disabled",m(3,2,e.countInBooks$)!==0)("pTooltip",m(4,4,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function J(i,q){if(i&1&&(o(0,"p-scroll-panel")(1,"p-panel")(2,"div",6),c(3,"app-migration-cards",7),s(4,"async"),b(),o(5,"svg",8),c(6,"path",9),n(),k(),c(7,"app-migration-cards",10),s(8,"async"),n()()()),i&2){let e=l();h(C(12,L)),a(),h(C(13,L)),a(2),p("migrationCount",m(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),a(4),p("migrationCount",m(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var fe=(()=>{class i{constructor(){this.migrateService=u(O),this.toastr=u(F),this.refresh$=new v(void 0),this.pageTitle="Write-Off Outlet"}ngOnInit(){let e=this.refresh$.pipe(T(()=>this.migrateService.getWriteOffOutletAccountCount()),S(t=>console.log("API response:",t)),y(1));this.countInPOS$=e.pipe(f(t=>Number(t.pos))),this.countInBooks$=e.pipe(f(t=>Number(t.books)))}migrateWriteoffOutlet(){this.migrateService.migrateWriteOffOutlet().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormat(){confirm("Are you sure you want to format?")&&this.migrateService.formatWriteOff().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Format Successful")})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=M({type:i,selectors:[["app-writeoff-outlet"]],features:[P([O])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger",3,"onClick"],["label","Migrate","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(t,r){t&1&&(o(0,"app-main-panel",2),B(1,z,5,6,"ng-template",null,0,x)(3,J,9,14,"ng-template",null,1,x),n()),t&2&&p("pageTitle",r.pageTitle)},dependencies:[G,$,W,E,I,R,j,N,D,H,A,V],encapsulation:2})}}return i})();export{fe as WriteOffOutletComponent};
1
+ import{a as O,b as H}from"./chunk-O6PHQDZH.js";import"./chunk-RD2UE5ML.js";import{a as I,b as E}from"./chunk-E3QNEH3B.js";import"./chunk-WXT6EZ2V.js";import{h as G}from"./chunk-R3GHYD6Y.js";import{b as D,c as N}from"./chunk-L3PZS6EL.js";import{a as j,b as R}from"./chunk-5JV52UYK.js";import"./chunk-ACTRMWEI.js";import"./chunk-ARXP327B.js";import{w as V,x as A}from"./chunk-7FFMPB6T.js";import"./chunk-UKBDY33R.js";import"./chunk-72LNXEXV.js";import"./chunk-BM3MNYWW.js";import{a as F}from"./chunk-ZDTMCWOO.js";import"./chunk-F2X3VGZZ.js";import{n as W,s as $}from"./chunk-SB5MSLCX.js";import{$b as w,Cc as P,Db as B,Dc as C,Lb as p,Nc as s,Ob as h,Oc as m,Rc as x,Vb as o,W as y,Wb as n,Xb as c,Y as T,_ as S,ec as _,fc as l,h as v,hb as a,ia as u,qa as g,ra as d,s as f,sa as b,ta as k,xb as M}from"./chunk-6K5LNQ4J.js";import"./chunk-YQFG5XE2.js";var L=()=>({height:"calc(100vh - 100px)"});function z(i,q){if(i&1){let e=w();o(0,"div",3)(1,"p-button",4),_("onClick",function(){g(e);let r=l();return d(r.onFormat())}),n(),o(2,"p-button",5),s(3,"async"),s(4,"async"),_("onClick",function(){g(e);let r=l();return d(r.migrateWriteoffOutlet())}),n()()}if(i&2){let e=l();a(2),p("disabled",m(3,2,e.countInBooks$)!==0)("pTooltip",m(4,4,e.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function J(i,q){if(i&1&&(o(0,"p-scroll-panel")(1,"p-panel")(2,"div",6),c(3,"app-migration-cards",7),s(4,"async"),b(),o(5,"svg",8),c(6,"path",9),n(),k(),c(7,"app-migration-cards",10),s(8,"async"),n()()()),i&2){let e=l();h(C(12,L)),a(),h(C(13,L)),a(2),p("migrationCount",m(4,8,e.countInPOS$))("migrationTitle",e.pageTitle),a(4),p("migrationCount",m(8,10,e.countInBooks$))("migrationTitle",e.pageTitle)}}var fe=(()=>{class i{constructor(){this.migrateService=u(O),this.toastr=u(F),this.refresh$=new v(void 0),this.pageTitle="Write-Off Outlet"}ngOnInit(){let e=this.refresh$.pipe(T(()=>this.migrateService.getWriteOffOutletAccountCount()),S(t=>console.log("API response:",t)),y(1));this.countInPOS$=e.pipe(f(t=>Number(t.pos))),this.countInBooks$=e.pipe(f(t=>Number(t.books)))}migrateWriteoffOutlet(){this.migrateService.migrateWriteOffOutlet().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Migration Successful")})}onFormat(){confirm("Are you sure you want to format?")&&this.migrateService.formatWriteOff().subscribe(e=>{this.refresh$.next(),this.toastr.success(e.message,"Format Successful")})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=M({type:i,selectors:[["app-writeoff-outlet"]],features:[P([O])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger",3,"onClick"],["label","Migrate","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(t,r){t&1&&(o(0,"app-main-panel",2),B(1,z,5,6,"ng-template",null,0,x)(3,J,9,14,"ng-template",null,1,x),n()),t&2&&p("pageTitle",r.pageTitle)},dependencies:[G,$,W,E,I,R,j,N,D,H,A,V],encapsulation:2})}}return i})();export{fe as WriteOffOutletComponent};
@@ -1 +1 @@
1
- import{a as we}from"./chunk-X6D7ZE6G.js";import"./chunk-EM4HKTKQ.js";import{a as Ce,b as ve,c as Ee,d as he,e as Ie,f as be}from"./chunk-ODRV6XWO.js";import{b as ye,c as Ve,d as Se}from"./chunk-4FPYSVLT.js";import"./chunk-WLKS6LBU.js";import{d as _e,f as ue,g as fe,h as xe,k as ge}from"./chunk-KLKIEREL.js";import"./chunk-76LPTGLX.js";import"./chunk-CWHL7PNC.js";import"./chunk-VRKBMD72.js";import{a as R}from"./chunk-KXE3J4PK.js";import{a as ie}from"./chunk-E3QNEH3B.js";import"./chunk-EOT2WEXN.js";import"./chunk-X4KTMWVO.js";import"./chunk-I7ILLTFH.js";import"./chunk-2LQVI4EI.js";import"./chunk-AJZ7YLT4.js";import"./chunk-ATJ55H5D.js";import"./chunk-SPKOXGSS.js";import"./chunk-3KYU6FI2.js";import"./chunk-IJTQE2H4.js";import{a as ce,b as de}from"./chunk-WXT6EZ2V.js";import{e as pe,f as me,h as se}from"./chunk-O5EVYQVN.js";import"./chunk-L3PZS6EL.js";import{a as ae,b as le}from"./chunk-5JV52UYK.js";import"./chunk-ACTRMWEI.js";import"./chunk-ARXP327B.js";import{w as oe,x as re}from"./chunk-7FFMPB6T.js";import"./chunk-UKBDY33R.js";import"./chunk-72LNXEXV.js";import{d as ne}from"./chunk-EFDD6Q3K.js";import"./chunk-M3WCSF6D.js";import"./chunk-ZDTMCWOO.js";import"./chunk-F2X3VGZZ.js";import{h as X,k as Y,p as Z,q as ee,s as te}from"./chunk-SB5MSLCX.js";import{$b as v,Db as d,Dc as J,Ec as T,Gc as q,Ha as S,I as N,Lb as m,Nc as E,Ob as A,Oc as I,Pc as G,Qb as h,Rb as F,Rc as c,Tb as P,Ub as D,Vb as n,Wb as i,Xb as _,Y as U,_ as w,ec as y,fb as j,fc as s,hb as l,ia as k,lc as H,m as M,mc as L,nc as O,qa as f,qc as $,ra as x,rc as r,s as B,sc as g,tc as C,wc as Q,xb as K,xc as W,yc as z}from"./chunk-6K5LNQ4J.js";import{e as Re}from"./chunk-YQFG5XE2.js";var Je=Re(Ve());var ke=["stepper"],Ae=()=>({width:"30vw"}),Fe=()=>({"1199px":"75vw","575px":"100vw"}),Pe=()=>({height:"calc(100vh - 70px)"}),De=t=>({"col-12":t}),Me=(t,p,e)=>({"bg-gradient-danger":t,"bg-gradient-success":p,"bg-gradient-warning":e}),Te=t=>({"state-danger":t});function Be(t,p){if(t&1){let e=v();n(0,"p-button",14),y("click",function(){f(e);let o=s(2);return x(o.onPrevStep())}),i()}if(t&2){let e=s(2);m("disabled",e.stepActiveIndex()===1)}}function Ne(t,p){if(t&1){let e=v();n(0,"p-button",15),y("click",function(){f(e);let o=s(2);return x(o.onNextStep())}),i()}if(t&2){let e=s(2);m("disabled",e.stepActiveIndex()===3||!e.JournalEntryImport())}}function Ue(t,p){if(t&1){let e=v();n(0,"p-button",16),y("click",function(){f(e);let o=s(2);return x(o.onReset())}),i()}}function je(t,p){if(t&1&&d(0,Be,1,1,"p-button",11)(1,Ne,1,1,"p-button",12)(2,Ue,1,0,"p-button",13),t&2){let e=s();m("ngIf",e.stepActiveIndex()>1),l(),m("ngIf",e.stepActiveIndex()<3),l(),m("ngIf",e.stepActiveIndex()===3)}}function Ke(t,p){if(t&1){let e=v();n(0,"POS-uppy",25),y("fileUploaded",function(o){f(e);let u=s(2);return x(u.onFileUploaded(o))})("fileRemoved",function(o){f(e);let u=s(2);return x(u.onFileRemoved(o))}),i(),n(1,"p",26),r(2," Please refer this "),n(3,"a",27),r(4,"article"),i(),r(5," for more information "),i()}if(t&2){let e=s(2);m("uppyCoreConfiguration",e.uppyCore)("dashboardPropsConfiguration",e.dashboardProps)("sampleUrl",e.SAMPLE_URL)("subtitle",e.subtitle)}}function He(t,p){t&1&&(n(0,"tr"),_(1,"th",29),n(2,"th",30),r(3," Number "),_(4,"p-sortIcon",31),i(),n(5,"th",32),r(6," Outlet "),_(7,"p-sortIcon",33),i(),n(8,"th",34),r(9," Date "),_(10,"p-sortIcon",35),i(),n(11,"th",36),r(12," Status "),_(13,"p-sortIcon",37),i(),n(14,"th"),r(15,"Message"),i()())}function Le(t,p){if(t&1&&(n(0,"div",41)(1,"span"),r(2),i(),n(3,"span"),r(4),i()()),t&2){let e=p.$implicit;l(2),g(e.issue),l(2),g(e.solution)}}function Oe(t,p){if(t&1&&(n(0,"div",40),P(1,Le,5,2,"div",41,F),i()),t&2){let e=s(2).$implicit;l(),D(e.issues)}}function $e(t,p){}function Qe(t,p){if(t&1&&d(0,Oe,3,0,"div",40)(1,$e,0,0),t&2){let e=s().$implicit;h(e.issues&&e.issues.length>0?0:1)}}function We(t,p){if(t&1&&(n(0,"tr")(1,"td"),_(2,"p-button",38),i(),n(3,"td"),r(4),i(),n(5,"td"),r(6),i(),n(7,"td"),r(8),E(9,"date"),i(),n(10,"td",39),r(11),i(),n(12,"td",39),d(13,Qe,2,1),i()()),t&2){let e=p.$implicit,a=p.expanded,o=s(4);l(2),m("pRowToggler",e)("text",!0)("rounded",!0)("plain",!0)("icon",a?"fa-solid fa-chevron-down":"fa-solid fa-chevron-right"),l(2),g(e.number),l(2),C(" ",e.outlet," "),l(2),g(G(9,12,e.date,"d MMM y")),l(2),m("ngClass",q(15,Me,e.actionName==="Error",e.actionName==="New",e.actionName==="Update")),l(),C(" ",e.actionName," "),l(),m("ngClass",T(19,Te,o.hasIssue)),l(),h(o.hasIssue?13:-1)}}function ze(t,p){t&1&&(n(0,"tr")(1,"th",45),r(2," Code "),_(3,"p-sortIcon",46),i(),n(4,"th",47),r(5," Name "),_(6,"p-sortIcon",48),i(),n(7,"th",49),r(8," Note "),_(9,"p-sortIcon",50),i(),n(10,"th",51),r(11," Debit "),_(12,"p-sortIcon",52),i(),n(13,"th",53),r(14," Credit "),_(15,"p-sortIcon",54),i(),n(16,"th"),r(17,"Message"),i()())}function qe(t,p){if(t&1&&(n(0,"div",41)(1,"span"),r(2),i(),n(3,"span"),r(4),i()()),t&2){let e=p.$implicit;l(2),g(e.issue),l(2),g(e.solution)}}function Ge(t,p){if(t&1&&(n(0,"div",40),P(1,qe,5,2,"div",41,F),i()),t&2){let e=s().$implicit;l(),D(e.issues)}}function Xe(t,p){if(t&1&&(n(0,"tr")(1,"td"),r(2),i(),n(3,"td"),r(4),i(),n(5,"td"),r(6),i(),n(7,"td"),r(8),E(9,"number"),i(),n(10,"td"),r(11),E(12,"number"),i(),n(13,"td",39),d(14,Ge,3,0,"div",40),i()()),t&2){let e=p.$implicit,a=s(5);l(2),g(e.accountCode),l(2),g(e.accountName),l(2),g(e.note),l(2),C(" ",I(9,7,e.debitAmount)," "),l(3),C(" ",I(12,9,e.creditAmount)," "),l(2),m("ngClass",T(11,Te,e.issues&&e.issues.length>0)),l(),h(a.hasIssue?14:-1)}}function Ye(t,p){t&1&&(n(0,"tr")(1,"td",55),r(2," There are no order for this product yet. "),i()())}function Ze(t,p){if(t&1&&(n(0,"tr")(1,"td",42)(2,"div",43)(3,"p-table",44),d(4,ze,18,0,"ng-template",null,3,c)(6,Xe,15,13,"ng-template",null,6,c)(8,Ye,3,0,"ng-template",null,8,c),i()()()()),t&2){let e=p.$implicit;l(3),m("value",e.items)}}function et(t,p){if(t&1&&(n(0,"p-table",28),d(1,He,16,0,"ng-template",null,3,c)(3,We,14,21,"ng-template",null,6,c)(5,Ze,10,1,"ng-template",null,7,c),i()),t&2){let e=s(3);m("scrollable",!0)("scrollHeight","calc(100vh - 160px)")("value",e.JournalEntryImport().dataRow)}}function tt(t,p){if(t&1&&d(0,et,7,3,"p-table",28),t&2){let e=s(2);h(e.JournalEntryImport()?0:-1)}}function nt(t,p){t&1&&(n(0,"h5"),r(1,"Successfully Imported"),i())}function it(t,p){if(t&1&&(n(0,"p-panel")(1,"p-scroll-panel")(2,"div",17)(3,"div",18)(4,"p-stepper",19,5)(6,"p-step-list")(7,"p-step",20)(8,"div",21),_(9,"i",22),n(10,"span"),r(11,"Upload"),i()()(),n(12,"p-step",20)(13,"div",21),_(14,"i",23),n(15,"span"),r(16,"Preview"),i()()(),n(17,"p-step",20)(18,"div",21),_(19,"i",24),n(20,"span"),r(21,"Finish"),i()()()(),n(22,"p-step-panels")(23,"p-step-panel",20),d(24,Ke,6,4,"ng-template",null,1,c),i(),n(26,"p-step-panel",20),d(27,tt,1,1,"ng-template",null,1,c),i(),n(29,"p-step-panel",20),d(30,nt,2,0,"ng-template",null,1,c),i()()()()()()()),t&2){let e=s();l(),A(J(11,Pe)),l(2),m("ngClass",T(12,De,e.stepActiveIndex()===2)),l(),m("linear",!0)("value",e.stepActiveIndex()),l(3),m("value",1),l(5),m("value",2),l(5),m("value",3),l(6),m("value",1),l(3),m("value",2),l(3),m("value",3)}}function ot(t,p){if(t&1){let e=v();n(0,"p-button",56),y("onClick",function(){f(e);let o=s();return x(o.summaryDialogVisible.set(!1))}),i()}t&2&&m("rounded",!0)("text",!0)}function rt(t,p){if(t&1&&(n(0,"div",57)(1,"h4",58),r(2,"Import Summary"),i(),n(3,"p",59),r(4),i()()),t&2){let e=s();l(4),C("(",e.CSVRowCount()," rows ready for import)")}}function at(t,p){t&1&&(n(0,"div",63)(1,"h4",64),r(2,"Journal"),i()())}function lt(t,p){t&1&&(n(0,"div",65)(1,"h4",64),r(2,"Debit"),i()())}function pt(t,p){t&1&&(n(0,"div",65)(1,"h4",64),r(2,"Credit"),i()())}function mt(t,p){if(t&1&&(n(0,"div",60)(1,"div",61)(2,"p-card"),d(3,at,3,0,"ng-template",null,3,c),n(5,"div",60)(6,"div",61)(7,"h5",62),r(8),E(9,"number"),i()()()()(),n(10,"div",61)(11,"p-card"),d(12,lt,3,0,"ng-template",null,3,c),n(14,"div",60)(15,"div",61)(16,"h5",62),r(17),E(18,"number"),i()()()()(),n(19,"div",61)(20,"p-card"),d(21,pt,3,0,"ng-template",null,3,c),n(23,"div",60)(24,"div",61)(25,"h5",62),r(26),E(27,"number"),i()()()()()()),t&2){let e=s(2);l(8),C(" ",I(9,3,e.JournalEntryImport().summary.journal)," "),l(9),C(" ",I(18,5,e.JournalEntryImport().summary.debit)," "),l(9),C(" ",I(27,7,e.JournalEntryImport().summary.credit)," ")}}function st(t,p){if(t&1&&d(0,mt,28,9,"div",60),t&2){let e=s();h(e.JournalEntryImport()?0:-1)}}function ct(t,p){if(t&1){let e=v();n(0,"p-button",66),y("click",function(){f(e);let o=s();return x(o.summaryDialogVisible.set(!1))}),i(),n(1,"p-button",67),y("click",function(){f(e);let o=s();return x(o.onConfirmImport())}),i()}}var jt=(()=>{class t{constructor(){this.service=k(we),this.router=k(ne),this.subtitle="Accepted file format: .csv & max file size: 1MB",this.stepActiveIndex=S(1),this.JournalEntryImport=S(null),this.summaryDialogVisible=S(!1),this.CSVRowCount=S(0),this.dashboardProps={inline:!0,width:580,height:350},this.uppyCore={restrictions:{allowedFileTypes:["text/csv","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]}},this.SAMPLE_URL="https://res.cloudinary.com/pos/raw/upload/POS/CSV/Journal_DealPOS.csv"}ngAfterViewInit(){console.log("Stepper instance:",this.stepperRef)}onFileUpload(e){console.log("File upload event:",e);let a=new FormData;Array.isArray(e.currentFiles)&&e.currentFiles.forEach(o=>{o instanceof File&&a.append("File",o,o.name)}),console.log("Form data prepared for upload:",a.get("File")),this.service.importPreviewJournal(a).pipe(R("Import Preview"),B(o=>({cacheKey:o.cacheKey})),U(o=>this.service.importConfirmJournal(o)),w(()=>{this.router.navigate(["/pages/journal/journal-entry"])})).subscribe()}onFileRemoved(e){console.log("File removed event:",e),this.JournalEntryImport.set(null),this.CSVRowCount.set(0)}onNextStep(){if(this.stepActiveIndex()<3&&(this.stepActiveIndex.update(e=>e+1),this.stepActiveIndex()===3)){this.stepActiveIndex.update(()=>this.stepActiveIndex()-1),this.summaryDialogVisible.set(!0);return}}onPrevStep(){this.stepActiveIndex()>1&&this.stepActiveIndex.update(e=>e-1)}onFileUploaded(e){let a=new FormData;if("name"in e&&typeof e.name=="string")a.append("File",e,e.name),this.service.importPreviewJournal(a).pipe(R("Import Preview"),w(o=>{this.JournalEntryImport.set(o)})).subscribe(),Je.default.parse(e,{header:!0,skipEmptyLines:!0,complete:o=>{console.log("CSV Parsing Results:",o),this.CSVRowCount.set(o.data.length)},error:o=>{console.error("Error parsing CSV:",o)}});else return}onConfirmImport(){if(this.JournalEntryImport()&&this.JournalEntryImport().canProceed){let e={cacheKey:this.JournalEntryImport().cacheKey};this.service.importConfirmJournal(e).pipe(R("Import Confirm"),w(()=>{this.router.navigate(["/pages/journal/journal-entry"]),this.stepActiveIndex.update(a=>a+1),this.summaryDialogVisible.update(a=>!a)}),N(a=>(console.error("Error occurred during import confirmation:",a),this.stepActiveIndex.update(o=>o+1),this.summaryDialogVisible.update(o=>!o),M(null)))).subscribe()}else{console.error("Cannot proceed with import, JournalEntryImport is not set or canProceed is false.");return}}onReset(){this.stepActiveIndex.set(1),this.JournalEntryImport.set(null)}handleKeyboardEvent(e){e.key==="F2"&&this.onConfirmImport()}get hasIssue(){let e=this.JournalEntryImport();return e&&Array.isArray(e.dataRow)?e.dataRow.some(a=>{let o=a.issues&&a.issues.length>0,u=Array.isArray(a.items)&&a.items.some(b=>b.issues&&b.issues.length>0);return o||u}):!1}static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275cmp=K({type:t,selectors:[["app-journal-entry-import"]],viewQuery:function(a,o){if(a&1&&H(ke,5),a&2){let u;L(u=O())&&(o.stepperRef=u.first)}},hostBindings:function(a,o){a&1&&y("keydown",function(b){return o.handleKeyboardEvent(b)},!1,j)},decls:14,vars:10,consts:[["actionButton",""],["content",""],["closeIconTemplate",""],["header",""],["footer",""],["stepper",""],["body",""],["expandedrow",""],["emptymessage",""],["pageTitle","Manual Journal Import"],["position","center","appendTo","body",3,"visibleChange","modal","visible","breakpoints","draggable","closeIconTemplate","dismissableMask"],["label","Back","severity","secondary","variant","outlined",3,"disabled","click",4,"ngIf"],["label","Next","severity","primary",3,"disabled","click",4,"ngIf"],["label","Finish","severity","primary",3,"click",4,"ngIf"],["label","Back","severity","secondary","variant","outlined",3,"click","disabled"],["label","Next","severity","primary",3,"click","disabled"],["label","Finish","severity","primary",3,"click"],[1,"row","justify-content-center"],[1,"col-6",3,"ngClass"],[3,"linear","value"],[3,"value"],[1,"d-flex","gap-2","align-items-center"],[1,"fa-solid","fa-upload"],[1,"fa-solid","fa-file"],[1,"fa-solid","fa-check"],[3,"fileUploaded","fileRemoved","uppyCoreConfiguration","dashboardPropsConfiguration","sampleUrl","subtitle"],[1,"fst-italic"],["href","#","target","_blank",1,"link","link-primary"],["dataKey","number",3,"scrollable","scrollHeight","value"],[2,"width","5rem"],["pSortableColumn","number"],["field","number"],["pSortableColumn","outlet"],["field","outlet"],["pSortableColumn","date"],["field","date"],["pSortableColumn","inventoryStatus"],["field","inventoryStatus"],["type","button","pRipple","",3,"pRowToggler","text","rounded","plain","icon"],[3,"ngClass"],[1,"d-flex","flex-column","gap-2"],[1,"d-flex","flex-column"],["colspan","8"],[1,"p-4"],["dataKey","accountID",3,"value"],["pSortableColumn","accountCode"],["field","accountCode"],["pSortableColumn","accountName"],["field","accountName"],["pSortableColumn","note"],["field","note"],["pSortableColumn","debitAmount"],["field","debitAmount"],["pSortableColumn","creditAmount"],["field","creditAmount"],["colspan","6"],["severity","secondary","variant","outlined","icon","fa-solid fa-xmark",3,"onClick","rounded","text"],[1,"d-flex","gap-2","align-items-baseline"],[1,"fs-4","text-white","m-0"],[1,"m-0","fs-3"],[1,"row"],[1,"col"],[1,"fs-2"],[1,"state-new"],[1,"fs-3","m-0"],[1,"state-unchanged"],["label","Cancel","severity","secondary","variant","outlined",3,"click"],["label","OK (F2)",3,"click"]],template:function(a,o){if(a&1){let u=v();n(0,"app-main-panel",9),d(1,je,3,3,"ng-template",null,0,c)(3,it,32,14,"ng-template",null,1,c),i(),n(5,"p-dialog",10),z("visibleChange",function(V){return f(u),W(o.summaryDialogVisible,V)||(o.summaryDialogVisible=V),x(V)}),d(6,ot,1,2,"ng-template",null,2,c)(8,rt,5,1,"ng-template",null,3,c)(10,st,1,1,"ng-template",null,1,c)(12,ct,2,0,"ng-template",null,4,c),i()}if(a&2){let u=$(7);l(5),A(J(8,Ae)),m("modal",!0),Q("visible",o.summaryDialogVisible),m("breakpoints",J(9,Fe))("draggable",!1)("closeIconTemplate",u)("dismissableMask",!0)}},dependencies:[se,te,X,Y,ee,Z,le,ae,ye,de,ce,be,Ie,Ce,he,Ee,ve,Se,re,oe,ge,_e,ue,xe,fe,me,pe,ie],styles:[".p-datatable-thead>tr>th{background-color:transparent!important;color:#000!important} .p-stepper{display:flex;flex-direction:column;align-items:center} .p-stepper .p-steplist{width:40vw} .p-stepper .p-steppanels{width:100%} .p-card{border-radius:4px} .p-card .p-card-body{padding:.75rem!important} .p-card .p-card-header{display:flex;align-items:center;width:100%} .p-card .p-card-header .state-new{width:inherit;padding:.75rem;vertical-align:middle;background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important} .p-card .p-card-header .state-updated{width:inherit;padding:.75rem;background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important} .p-card .p-card-header .state-unchanged{width:inherit;padding:.75rem;border-bottom:1px solid #dee2e6} .p-card .p-card-header .state-error{width:inherit;padding:.75rem;background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important} pos-uppy div div h4{font-size:16px} pos-uppy div div p{font-size:14px!important} pos-uppy div div hr{margin:0}"],changeDetection:0})}}return t})();export{jt as JournalEntryImportComponent};
1
+ import{a as we}from"./chunk-XZG6FHL4.js";import"./chunk-S7IT3NE6.js";import{a as Ce,b as ve,c as Ee,d as he,e as Ie,f as be}from"./chunk-ODRV6XWO.js";import{b as ye,c as Ve,d as Se}from"./chunk-4FPYSVLT.js";import"./chunk-WLKS6LBU.js";import{d as _e,f as ue,g as fe,h as xe,k as ge}from"./chunk-KLKIEREL.js";import"./chunk-76LPTGLX.js";import"./chunk-CWHL7PNC.js";import"./chunk-VRKBMD72.js";import{a as R}from"./chunk-KXE3J4PK.js";import{a as ie}from"./chunk-E3QNEH3B.js";import"./chunk-EOT2WEXN.js";import"./chunk-X4KTMWVO.js";import"./chunk-I7ILLTFH.js";import"./chunk-2LQVI4EI.js";import"./chunk-AJZ7YLT4.js";import"./chunk-ATJ55H5D.js";import"./chunk-SPKOXGSS.js";import"./chunk-3KYU6FI2.js";import"./chunk-IJTQE2H4.js";import{a as ce,b as de}from"./chunk-WXT6EZ2V.js";import{e as pe,f as me,h as se}from"./chunk-R3GHYD6Y.js";import"./chunk-L3PZS6EL.js";import{a as ae,b as le}from"./chunk-5JV52UYK.js";import"./chunk-ACTRMWEI.js";import"./chunk-ARXP327B.js";import{w as oe,x as re}from"./chunk-7FFMPB6T.js";import"./chunk-UKBDY33R.js";import"./chunk-72LNXEXV.js";import{d as ne}from"./chunk-EFDD6Q3K.js";import"./chunk-BM3MNYWW.js";import"./chunk-ZDTMCWOO.js";import"./chunk-F2X3VGZZ.js";import{h as X,k as Y,p as Z,q as ee,s as te}from"./chunk-SB5MSLCX.js";import{$b as v,Db as d,Dc as J,Ec as T,Gc as q,Ha as S,I as N,Lb as m,Nc as E,Ob as A,Oc as I,Pc as G,Qb as h,Rb as F,Rc as c,Tb as P,Ub as D,Vb as n,Wb as i,Xb as _,Y as U,_ as w,ec as y,fb as j,fc as s,hb as l,ia as k,lc as H,m as M,mc as L,nc as O,qa as f,qc as $,ra as x,rc as r,s as B,sc as g,tc as C,wc as Q,xb as K,xc as W,yc as z}from"./chunk-6K5LNQ4J.js";import{e as Re}from"./chunk-YQFG5XE2.js";var Je=Re(Ve());var ke=["stepper"],Ae=()=>({width:"30vw"}),Fe=()=>({"1199px":"75vw","575px":"100vw"}),Pe=()=>({height:"calc(100vh - 70px)"}),De=t=>({"col-12":t}),Me=(t,p,e)=>({"bg-gradient-danger":t,"bg-gradient-success":p,"bg-gradient-warning":e}),Te=t=>({"state-danger":t});function Be(t,p){if(t&1){let e=v();n(0,"p-button",14),y("click",function(){f(e);let o=s(2);return x(o.onPrevStep())}),i()}if(t&2){let e=s(2);m("disabled",e.stepActiveIndex()===1)}}function Ne(t,p){if(t&1){let e=v();n(0,"p-button",15),y("click",function(){f(e);let o=s(2);return x(o.onNextStep())}),i()}if(t&2){let e=s(2);m("disabled",e.stepActiveIndex()===3||!e.JournalEntryImport())}}function Ue(t,p){if(t&1){let e=v();n(0,"p-button",16),y("click",function(){f(e);let o=s(2);return x(o.onReset())}),i()}}function je(t,p){if(t&1&&d(0,Be,1,1,"p-button",11)(1,Ne,1,1,"p-button",12)(2,Ue,1,0,"p-button",13),t&2){let e=s();m("ngIf",e.stepActiveIndex()>1),l(),m("ngIf",e.stepActiveIndex()<3),l(),m("ngIf",e.stepActiveIndex()===3)}}function Ke(t,p){if(t&1){let e=v();n(0,"POS-uppy",25),y("fileUploaded",function(o){f(e);let u=s(2);return x(u.onFileUploaded(o))})("fileRemoved",function(o){f(e);let u=s(2);return x(u.onFileRemoved(o))}),i(),n(1,"p",26),r(2," Please refer this "),n(3,"a",27),r(4,"article"),i(),r(5," for more information "),i()}if(t&2){let e=s(2);m("uppyCoreConfiguration",e.uppyCore)("dashboardPropsConfiguration",e.dashboardProps)("sampleUrl",e.SAMPLE_URL)("subtitle",e.subtitle)}}function He(t,p){t&1&&(n(0,"tr"),_(1,"th",29),n(2,"th",30),r(3," Number "),_(4,"p-sortIcon",31),i(),n(5,"th",32),r(6," Outlet "),_(7,"p-sortIcon",33),i(),n(8,"th",34),r(9," Date "),_(10,"p-sortIcon",35),i(),n(11,"th",36),r(12," Status "),_(13,"p-sortIcon",37),i(),n(14,"th"),r(15,"Message"),i()())}function Le(t,p){if(t&1&&(n(0,"div",41)(1,"span"),r(2),i(),n(3,"span"),r(4),i()()),t&2){let e=p.$implicit;l(2),g(e.issue),l(2),g(e.solution)}}function Oe(t,p){if(t&1&&(n(0,"div",40),P(1,Le,5,2,"div",41,F),i()),t&2){let e=s(2).$implicit;l(),D(e.issues)}}function $e(t,p){}function Qe(t,p){if(t&1&&d(0,Oe,3,0,"div",40)(1,$e,0,0),t&2){let e=s().$implicit;h(e.issues&&e.issues.length>0?0:1)}}function We(t,p){if(t&1&&(n(0,"tr")(1,"td"),_(2,"p-button",38),i(),n(3,"td"),r(4),i(),n(5,"td"),r(6),i(),n(7,"td"),r(8),E(9,"date"),i(),n(10,"td",39),r(11),i(),n(12,"td",39),d(13,Qe,2,1),i()()),t&2){let e=p.$implicit,a=p.expanded,o=s(4);l(2),m("pRowToggler",e)("text",!0)("rounded",!0)("plain",!0)("icon",a?"fa-solid fa-chevron-down":"fa-solid fa-chevron-right"),l(2),g(e.number),l(2),C(" ",e.outlet," "),l(2),g(G(9,12,e.date,"d MMM y")),l(2),m("ngClass",q(15,Me,e.actionName==="Error",e.actionName==="New",e.actionName==="Update")),l(),C(" ",e.actionName," "),l(),m("ngClass",T(19,Te,o.hasIssue)),l(),h(o.hasIssue?13:-1)}}function ze(t,p){t&1&&(n(0,"tr")(1,"th",45),r(2," Code "),_(3,"p-sortIcon",46),i(),n(4,"th",47),r(5," Name "),_(6,"p-sortIcon",48),i(),n(7,"th",49),r(8," Note "),_(9,"p-sortIcon",50),i(),n(10,"th",51),r(11," Debit "),_(12,"p-sortIcon",52),i(),n(13,"th",53),r(14," Credit "),_(15,"p-sortIcon",54),i(),n(16,"th"),r(17,"Message"),i()())}function qe(t,p){if(t&1&&(n(0,"div",41)(1,"span"),r(2),i(),n(3,"span"),r(4),i()()),t&2){let e=p.$implicit;l(2),g(e.issue),l(2),g(e.solution)}}function Ge(t,p){if(t&1&&(n(0,"div",40),P(1,qe,5,2,"div",41,F),i()),t&2){let e=s().$implicit;l(),D(e.issues)}}function Xe(t,p){if(t&1&&(n(0,"tr")(1,"td"),r(2),i(),n(3,"td"),r(4),i(),n(5,"td"),r(6),i(),n(7,"td"),r(8),E(9,"number"),i(),n(10,"td"),r(11),E(12,"number"),i(),n(13,"td",39),d(14,Ge,3,0,"div",40),i()()),t&2){let e=p.$implicit,a=s(5);l(2),g(e.accountCode),l(2),g(e.accountName),l(2),g(e.note),l(2),C(" ",I(9,7,e.debitAmount)," "),l(3),C(" ",I(12,9,e.creditAmount)," "),l(2),m("ngClass",T(11,Te,e.issues&&e.issues.length>0)),l(),h(a.hasIssue?14:-1)}}function Ye(t,p){t&1&&(n(0,"tr")(1,"td",55),r(2," There are no order for this product yet. "),i()())}function Ze(t,p){if(t&1&&(n(0,"tr")(1,"td",42)(2,"div",43)(3,"p-table",44),d(4,ze,18,0,"ng-template",null,3,c)(6,Xe,15,13,"ng-template",null,6,c)(8,Ye,3,0,"ng-template",null,8,c),i()()()()),t&2){let e=p.$implicit;l(3),m("value",e.items)}}function et(t,p){if(t&1&&(n(0,"p-table",28),d(1,He,16,0,"ng-template",null,3,c)(3,We,14,21,"ng-template",null,6,c)(5,Ze,10,1,"ng-template",null,7,c),i()),t&2){let e=s(3);m("scrollable",!0)("scrollHeight","calc(100vh - 160px)")("value",e.JournalEntryImport().dataRow)}}function tt(t,p){if(t&1&&d(0,et,7,3,"p-table",28),t&2){let e=s(2);h(e.JournalEntryImport()?0:-1)}}function nt(t,p){t&1&&(n(0,"h5"),r(1,"Successfully Imported"),i())}function it(t,p){if(t&1&&(n(0,"p-panel")(1,"p-scroll-panel")(2,"div",17)(3,"div",18)(4,"p-stepper",19,5)(6,"p-step-list")(7,"p-step",20)(8,"div",21),_(9,"i",22),n(10,"span"),r(11,"Upload"),i()()(),n(12,"p-step",20)(13,"div",21),_(14,"i",23),n(15,"span"),r(16,"Preview"),i()()(),n(17,"p-step",20)(18,"div",21),_(19,"i",24),n(20,"span"),r(21,"Finish"),i()()()(),n(22,"p-step-panels")(23,"p-step-panel",20),d(24,Ke,6,4,"ng-template",null,1,c),i(),n(26,"p-step-panel",20),d(27,tt,1,1,"ng-template",null,1,c),i(),n(29,"p-step-panel",20),d(30,nt,2,0,"ng-template",null,1,c),i()()()()()()()),t&2){let e=s();l(),A(J(11,Pe)),l(2),m("ngClass",T(12,De,e.stepActiveIndex()===2)),l(),m("linear",!0)("value",e.stepActiveIndex()),l(3),m("value",1),l(5),m("value",2),l(5),m("value",3),l(6),m("value",1),l(3),m("value",2),l(3),m("value",3)}}function ot(t,p){if(t&1){let e=v();n(0,"p-button",56),y("onClick",function(){f(e);let o=s();return x(o.summaryDialogVisible.set(!1))}),i()}t&2&&m("rounded",!0)("text",!0)}function rt(t,p){if(t&1&&(n(0,"div",57)(1,"h4",58),r(2,"Import Summary"),i(),n(3,"p",59),r(4),i()()),t&2){let e=s();l(4),C("(",e.CSVRowCount()," rows ready for import)")}}function at(t,p){t&1&&(n(0,"div",63)(1,"h4",64),r(2,"Journal"),i()())}function lt(t,p){t&1&&(n(0,"div",65)(1,"h4",64),r(2,"Debit"),i()())}function pt(t,p){t&1&&(n(0,"div",65)(1,"h4",64),r(2,"Credit"),i()())}function mt(t,p){if(t&1&&(n(0,"div",60)(1,"div",61)(2,"p-card"),d(3,at,3,0,"ng-template",null,3,c),n(5,"div",60)(6,"div",61)(7,"h5",62),r(8),E(9,"number"),i()()()()(),n(10,"div",61)(11,"p-card"),d(12,lt,3,0,"ng-template",null,3,c),n(14,"div",60)(15,"div",61)(16,"h5",62),r(17),E(18,"number"),i()()()()(),n(19,"div",61)(20,"p-card"),d(21,pt,3,0,"ng-template",null,3,c),n(23,"div",60)(24,"div",61)(25,"h5",62),r(26),E(27,"number"),i()()()()()()),t&2){let e=s(2);l(8),C(" ",I(9,3,e.JournalEntryImport().summary.journal)," "),l(9),C(" ",I(18,5,e.JournalEntryImport().summary.debit)," "),l(9),C(" ",I(27,7,e.JournalEntryImport().summary.credit)," ")}}function st(t,p){if(t&1&&d(0,mt,28,9,"div",60),t&2){let e=s();h(e.JournalEntryImport()?0:-1)}}function ct(t,p){if(t&1){let e=v();n(0,"p-button",66),y("click",function(){f(e);let o=s();return x(o.summaryDialogVisible.set(!1))}),i(),n(1,"p-button",67),y("click",function(){f(e);let o=s();return x(o.onConfirmImport())}),i()}}var jt=(()=>{class t{constructor(){this.service=k(we),this.router=k(ne),this.subtitle="Accepted file format: .csv & max file size: 1MB",this.stepActiveIndex=S(1),this.JournalEntryImport=S(null),this.summaryDialogVisible=S(!1),this.CSVRowCount=S(0),this.dashboardProps={inline:!0,width:580,height:350},this.uppyCore={restrictions:{allowedFileTypes:["text/csv","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]}},this.SAMPLE_URL="https://res.cloudinary.com/pos/raw/upload/POS/CSV/Journal_DealPOS.csv"}ngAfterViewInit(){console.log("Stepper instance:",this.stepperRef)}onFileUpload(e){console.log("File upload event:",e);let a=new FormData;Array.isArray(e.currentFiles)&&e.currentFiles.forEach(o=>{o instanceof File&&a.append("File",o,o.name)}),console.log("Form data prepared for upload:",a.get("File")),this.service.importPreviewJournal(a).pipe(R("Import Preview"),B(o=>({cacheKey:o.cacheKey})),U(o=>this.service.importConfirmJournal(o)),w(()=>{this.router.navigate(["/pages/journal/journal-entry"])})).subscribe()}onFileRemoved(e){console.log("File removed event:",e),this.JournalEntryImport.set(null),this.CSVRowCount.set(0)}onNextStep(){if(this.stepActiveIndex()<3&&(this.stepActiveIndex.update(e=>e+1),this.stepActiveIndex()===3)){this.stepActiveIndex.update(()=>this.stepActiveIndex()-1),this.summaryDialogVisible.set(!0);return}}onPrevStep(){this.stepActiveIndex()>1&&this.stepActiveIndex.update(e=>e-1)}onFileUploaded(e){let a=new FormData;if("name"in e&&typeof e.name=="string")a.append("File",e,e.name),this.service.importPreviewJournal(a).pipe(R("Import Preview"),w(o=>{this.JournalEntryImport.set(o)})).subscribe(),Je.default.parse(e,{header:!0,skipEmptyLines:!0,complete:o=>{console.log("CSV Parsing Results:",o),this.CSVRowCount.set(o.data.length)},error:o=>{console.error("Error parsing CSV:",o)}});else return}onConfirmImport(){if(this.JournalEntryImport()&&this.JournalEntryImport().canProceed){let e={cacheKey:this.JournalEntryImport().cacheKey};this.service.importConfirmJournal(e).pipe(R("Import Confirm"),w(()=>{this.router.navigate(["/pages/journal/journal-entry"]),this.stepActiveIndex.update(a=>a+1),this.summaryDialogVisible.update(a=>!a)}),N(a=>(console.error("Error occurred during import confirmation:",a),this.stepActiveIndex.update(o=>o+1),this.summaryDialogVisible.update(o=>!o),M(null)))).subscribe()}else{console.error("Cannot proceed with import, JournalEntryImport is not set or canProceed is false.");return}}onReset(){this.stepActiveIndex.set(1),this.JournalEntryImport.set(null)}handleKeyboardEvent(e){e.key==="F2"&&this.onConfirmImport()}get hasIssue(){let e=this.JournalEntryImport();return e&&Array.isArray(e.dataRow)?e.dataRow.some(a=>{let o=a.issues&&a.issues.length>0,u=Array.isArray(a.items)&&a.items.some(b=>b.issues&&b.issues.length>0);return o||u}):!1}static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275cmp=K({type:t,selectors:[["app-journal-entry-import"]],viewQuery:function(a,o){if(a&1&&H(ke,5),a&2){let u;L(u=O())&&(o.stepperRef=u.first)}},hostBindings:function(a,o){a&1&&y("keydown",function(b){return o.handleKeyboardEvent(b)},!1,j)},decls:14,vars:10,consts:[["actionButton",""],["content",""],["closeIconTemplate",""],["header",""],["footer",""],["stepper",""],["body",""],["expandedrow",""],["emptymessage",""],["pageTitle","Manual Journal Import"],["position","center","appendTo","body",3,"visibleChange","modal","visible","breakpoints","draggable","closeIconTemplate","dismissableMask"],["label","Back","severity","secondary","variant","outlined",3,"disabled","click",4,"ngIf"],["label","Next","severity","primary",3,"disabled","click",4,"ngIf"],["label","Finish","severity","primary",3,"click",4,"ngIf"],["label","Back","severity","secondary","variant","outlined",3,"click","disabled"],["label","Next","severity","primary",3,"click","disabled"],["label","Finish","severity","primary",3,"click"],[1,"row","justify-content-center"],[1,"col-6",3,"ngClass"],[3,"linear","value"],[3,"value"],[1,"d-flex","gap-2","align-items-center"],[1,"fa-solid","fa-upload"],[1,"fa-solid","fa-file"],[1,"fa-solid","fa-check"],[3,"fileUploaded","fileRemoved","uppyCoreConfiguration","dashboardPropsConfiguration","sampleUrl","subtitle"],[1,"fst-italic"],["href","#","target","_blank",1,"link","link-primary"],["dataKey","number",3,"scrollable","scrollHeight","value"],[2,"width","5rem"],["pSortableColumn","number"],["field","number"],["pSortableColumn","outlet"],["field","outlet"],["pSortableColumn","date"],["field","date"],["pSortableColumn","inventoryStatus"],["field","inventoryStatus"],["type","button","pRipple","",3,"pRowToggler","text","rounded","plain","icon"],[3,"ngClass"],[1,"d-flex","flex-column","gap-2"],[1,"d-flex","flex-column"],["colspan","8"],[1,"p-4"],["dataKey","accountID",3,"value"],["pSortableColumn","accountCode"],["field","accountCode"],["pSortableColumn","accountName"],["field","accountName"],["pSortableColumn","note"],["field","note"],["pSortableColumn","debitAmount"],["field","debitAmount"],["pSortableColumn","creditAmount"],["field","creditAmount"],["colspan","6"],["severity","secondary","variant","outlined","icon","fa-solid fa-xmark",3,"onClick","rounded","text"],[1,"d-flex","gap-2","align-items-baseline"],[1,"fs-4","text-white","m-0"],[1,"m-0","fs-3"],[1,"row"],[1,"col"],[1,"fs-2"],[1,"state-new"],[1,"fs-3","m-0"],[1,"state-unchanged"],["label","Cancel","severity","secondary","variant","outlined",3,"click"],["label","OK (F2)",3,"click"]],template:function(a,o){if(a&1){let u=v();n(0,"app-main-panel",9),d(1,je,3,3,"ng-template",null,0,c)(3,it,32,14,"ng-template",null,1,c),i(),n(5,"p-dialog",10),z("visibleChange",function(V){return f(u),W(o.summaryDialogVisible,V)||(o.summaryDialogVisible=V),x(V)}),d(6,ot,1,2,"ng-template",null,2,c)(8,rt,5,1,"ng-template",null,3,c)(10,st,1,1,"ng-template",null,1,c)(12,ct,2,0,"ng-template",null,4,c),i()}if(a&2){let u=$(7);l(5),A(J(8,Ae)),m("modal",!0),Q("visible",o.summaryDialogVisible),m("breakpoints",J(9,Fe))("draggable",!1)("closeIconTemplate",u)("dismissableMask",!0)}},dependencies:[se,te,X,Y,ee,Z,le,ae,ye,de,ce,be,Ie,Ce,he,Ee,ve,Se,re,oe,ge,_e,ue,xe,fe,me,pe,ie],styles:[".p-datatable-thead>tr>th{background-color:transparent!important;color:#000!important} .p-stepper{display:flex;flex-direction:column;align-items:center} .p-stepper .p-steplist{width:40vw} .p-stepper .p-steppanels{width:100%} .p-card{border-radius:4px} .p-card .p-card-body{padding:.75rem!important} .p-card .p-card-header{display:flex;align-items:center;width:100%} .p-card .p-card-header .state-new{width:inherit;padding:.75rem;vertical-align:middle;background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important} .p-card .p-card-header .state-updated{width:inherit;padding:.75rem;background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important} .p-card .p-card-header .state-unchanged{width:inherit;padding:.75rem;border-bottom:1px solid #dee2e6} .p-card .p-card-header .state-error{width:inherit;padding:.75rem;background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important} pos-uppy div div h4{font-size:16px} pos-uppy div div p{font-size:14px!important} pos-uppy div div hr{margin:0}"],changeDetection:0})}}return t})();export{jt as JournalEntryImportComponent};
@@ -1 +1 @@
1
- import{a as v,b as L}from"./chunk-B4JW5G5L.js";import"./chunk-JRH7ZWIT.js";import{a as I,b as E}from"./chunk-E3QNEH3B.js";import"./chunk-WXT6EZ2V.js";import{h as H}from"./chunk-O5EVYQVN.js";import{b as N,c as G}from"./chunk-L3PZS6EL.js";import{a as R,b as D}from"./chunk-5JV52UYK.js";import"./chunk-ACTRMWEI.js";import"./chunk-ARXP327B.js";import{w as V,x as j}from"./chunk-7FFMPB6T.js";import"./chunk-UKBDY33R.js";import"./chunk-72LNXEXV.js";import"./chunk-M3WCSF6D.js";import{a as F}from"./chunk-ZDTMCWOO.js";import"./chunk-F2X3VGZZ.js";import{n as w,s as $}from"./chunk-SB5MSLCX.js";import{$b as O,Cc as P,Db as B,Dc as C,Lb as p,Nc as c,Ob as h,Oc as s,Rc as x,Vb as n,W as T,Wb as o,Xb as m,Y as M,_ as S,ec as _,fc as l,h as y,hb as a,ia as f,qa as g,ra as d,s as u,sa as b,ta as k,xb as A}from"./chunk-6K5LNQ4J.js";import"./chunk-YQFG5XE2.js";var q=()=>({height:"calc(100vh - 100px)"});function J(i,z){if(i&1){let t=O();n(0,"div",3)(1,"p-button",4),_("onClick",function(){g(t);let r=l();return d(r.onFormat())}),o(),n(2,"p-button",5),c(3,"async"),c(4,"async"),_("onClick",function(){g(t);let r=l();return d(r.onMigrateOutletAccount())}),o()()}if(i&2){let t=l();a(2),p("disabled",s(3,2,t.countInBooks$)!==0)("pTooltip",s(4,4,t.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function K(i,z){if(i&1&&(n(0,"p-scroll-panel")(1,"p-panel")(2,"div",6),m(3,"app-migration-cards",7),c(4,"async"),b(),n(5,"svg",8),m(6,"path",9),o(),k(),m(7,"app-migration-cards",10),c(8,"async"),o()()()),i&2){let t=l();h(C(12,q)),a(),h(C(13,q)),a(2),p("migrationCount",s(4,8,t.countInPOS$))("migrationTitle",t.pageTitle),a(4),p("migrationCount",s(8,10,t.countInBooks$))("migrationTitle",t.pageTitle)}}var ut=(()=>{class i{constructor(){this.migrateService=f(v),this.toastr=f(F),this.refresh$=new y(void 0),this.pageTitle="Outlet Account"}ngOnInit(){let t=this.refresh$.pipe(M(()=>this.migrateService.getOutletAccountCount()),S(e=>console.log("API response:",e)),T(1));this.countInPOS$=t.pipe(u(e=>Number(e.pos))),this.countInBooks$=t.pipe(u(e=>Number(e.books)))}onMigrateOutletAccount(){this.migrateService.migrateOutletAccount().subscribe(t=>{this.refresh$.next(),this.toastr.success(t.message,"Migration Successful")})}onFormat(){confirm("Are you sure you want to format?")&&this.migrateService.formatOutletAccount().subscribe(t=>{this.refresh$.next(),this.toastr.success(t.message,"Format Successful")})}static{this.\u0275fac=function(e){return new(e||i)}}static{this.\u0275cmp=A({type:i,selectors:[["app-outlet-account"]],features:[P([v])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger",3,"onClick"],["label","Migrate","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(e,r){e&1&&(n(0,"app-main-panel",2),B(1,J,5,6,"ng-template",null,0,x)(3,K,9,14,"ng-template",null,1,x),o()),e&2&&p("pageTitle",r.pageTitle)},dependencies:[H,$,w,j,V,E,I,D,R,G,N,L],encapsulation:2})}}return i})();export{ut as OutletAccountComponent};
1
+ import{a as v,b as L}from"./chunk-O6PHQDZH.js";import"./chunk-RD2UE5ML.js";import{a as I,b as E}from"./chunk-E3QNEH3B.js";import"./chunk-WXT6EZ2V.js";import{h as H}from"./chunk-R3GHYD6Y.js";import{b as N,c as G}from"./chunk-L3PZS6EL.js";import{a as R,b as D}from"./chunk-5JV52UYK.js";import"./chunk-ACTRMWEI.js";import"./chunk-ARXP327B.js";import{w as V,x as j}from"./chunk-7FFMPB6T.js";import"./chunk-UKBDY33R.js";import"./chunk-72LNXEXV.js";import"./chunk-BM3MNYWW.js";import{a as F}from"./chunk-ZDTMCWOO.js";import"./chunk-F2X3VGZZ.js";import{n as w,s as $}from"./chunk-SB5MSLCX.js";import{$b as O,Cc as P,Db as B,Dc as C,Lb as p,Nc as c,Ob as h,Oc as s,Rc as x,Vb as n,W as T,Wb as o,Xb as m,Y as M,_ as S,ec as _,fc as l,h as y,hb as a,ia as f,qa as g,ra as d,s as u,sa as b,ta as k,xb as A}from"./chunk-6K5LNQ4J.js";import"./chunk-YQFG5XE2.js";var q=()=>({height:"calc(100vh - 100px)"});function J(i,z){if(i&1){let t=O();n(0,"div",3)(1,"p-button",4),_("onClick",function(){g(t);let r=l();return d(r.onFormat())}),o(),n(2,"p-button",5),c(3,"async"),c(4,"async"),_("onClick",function(){g(t);let r=l();return d(r.onMigrateOutletAccount())}),o()()}if(i&2){let t=l();a(2),p("disabled",s(3,2,t.countInBooks$)!==0)("pTooltip",s(4,4,t.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function K(i,z){if(i&1&&(n(0,"p-scroll-panel")(1,"p-panel")(2,"div",6),m(3,"app-migration-cards",7),c(4,"async"),b(),n(5,"svg",8),m(6,"path",9),o(),k(),m(7,"app-migration-cards",10),c(8,"async"),o()()()),i&2){let t=l();h(C(12,q)),a(),h(C(13,q)),a(2),p("migrationCount",s(4,8,t.countInPOS$))("migrationTitle",t.pageTitle),a(4),p("migrationCount",s(8,10,t.countInBooks$))("migrationTitle",t.pageTitle)}}var ut=(()=>{class i{constructor(){this.migrateService=f(v),this.toastr=f(F),this.refresh$=new y(void 0),this.pageTitle="Outlet Account"}ngOnInit(){let t=this.refresh$.pipe(M(()=>this.migrateService.getOutletAccountCount()),S(e=>console.log("API response:",e)),T(1));this.countInPOS$=t.pipe(u(e=>Number(e.pos))),this.countInBooks$=t.pipe(u(e=>Number(e.books)))}onMigrateOutletAccount(){this.migrateService.migrateOutletAccount().subscribe(t=>{this.refresh$.next(),this.toastr.success(t.message,"Migration Successful")})}onFormat(){confirm("Are you sure you want to format?")&&this.migrateService.formatOutletAccount().subscribe(t=>{this.refresh$.next(),this.toastr.success(t.message,"Format Successful")})}static{this.\u0275fac=function(e){return new(e||i)}}static{this.\u0275cmp=A({type:i,selectors:[["app-outlet-account"]],features:[P([v])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger",3,"onClick"],["label","Migrate","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(e,r){e&1&&(n(0,"app-main-panel",2),B(1,J,5,6,"ng-template",null,0,x)(3,K,9,14,"ng-template",null,1,x),o()),e&2&&p("pageTitle",r.pageTitle)},dependencies:[H,$,w,j,V,E,I,D,R,G,N,L],encapsulation:2})}}return i})();export{ut as OutletAccountComponent};