dealposbooks 5.47.0 → 5.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/3rdpartylicenses.txt +75 -26
  2. package/assets/images/users/user1_160.jpg +0 -0
  3. package/assets/images/users/user1_40.jpg +0 -0
  4. package/assets/images/users/user1_80.jpg +0 -0
  5. package/assets/scss/layouts/_sidebar.scss +0 -1
  6. package/{chunk-2MKKFLNJ.js → chunk-2BI7WNJP.js} +1 -1
  7. package/{chunk-OVEQKHUV.js → chunk-2H7KQZEC.js} +2 -2
  8. package/{chunk-XT4YHL2M.js → chunk-2JNXKEYZ.js} +1 -1
  9. package/{chunk-53HJBLFX.js → chunk-2VZ7JZIO.js} +1 -1
  10. package/{chunk-YFNWEI3R.js → chunk-2XW2ZOT4.js} +1 -1
  11. package/{chunk-E4MHRZVH.js → chunk-3DBSHDAQ.js} +1 -1
  12. package/{chunk-MT3DTYJO.js → chunk-3NWFEFT2.js} +1 -1
  13. package/{chunk-JOHRJHEX.js → chunk-3UAQHNUY.js} +1 -1
  14. package/{chunk-3A4BFUGD.js → chunk-3VQUNDVT.js} +1 -1
  15. package/{chunk-CL4EKWSU.js → chunk-4LI7GDDM.js} +1 -1
  16. package/chunk-52U5NSQT.js +2 -0
  17. package/{chunk-VK3G2VIU.js → chunk-5B5AMMR3.js} +1 -1
  18. package/{chunk-5K3KAKU5.js → chunk-5FV7K5RQ.js} +1 -1
  19. package/{chunk-6NX36ZC2.js → chunk-6DTQWLB3.js} +1 -1
  20. package/chunk-6GQ4PTPT.js +7 -0
  21. package/chunk-6QJHEOXN.js +7 -0
  22. package/chunk-6WWXJJID.js +1 -0
  23. package/chunk-72H3DW5Z.js +1 -0
  24. package/{chunk-L2524E6T.js → chunk-7OP477BS.js} +1 -1
  25. package/{chunk-EIV4TELQ.js → chunk-7WCUKMRG.js} +1 -1
  26. package/{chunk-XDJSQLQN.js → chunk-ACDLAA4B.js} +1 -1
  27. package/{chunk-BUDZ3ONE.js → chunk-AD247LWQ.js} +1 -1
  28. package/{chunk-HQMTUZZQ.js → chunk-AMGBUOC4.js} +1 -1
  29. package/{chunk-CWFLUFKM.js → chunk-AN4SAUSA.js} +1 -1
  30. package/{chunk-KIBBRAL5.js → chunk-ARJ7OCQO.js} +1 -1
  31. package/{chunk-EEJGJ7WF.js → chunk-B3VZ2ZHJ.js} +1 -1
  32. package/{chunk-5BXMDXZD.js → chunk-B4C3ZPN6.js} +1 -1
  33. package/{chunk-WFIXL354.js → chunk-BG6BR7KI.js} +1 -1
  34. package/chunk-BKTBVFNX.js +1 -0
  35. package/chunk-BNPR5SPH.js +1 -0
  36. package/chunk-BT7Y4ADP.js +1 -0
  37. package/{chunk-5YO43YBO.js → chunk-CEK7MQW2.js} +1 -1
  38. package/chunk-CVDRHTES.js +1 -0
  39. package/{chunk-IYFNOI7S.js → chunk-CZSVRFCL.js} +1 -1
  40. package/chunk-D6IS6PE6.js +1 -0
  41. package/{chunk-GDQUB54I.js → chunk-DDM2KWNX.js} +1 -1
  42. package/{chunk-Q7SK53ST.js → chunk-DJXQKSLT.js} +1 -1
  43. package/chunk-DSZOROE6.js +1 -0
  44. package/{chunk-2D2YD753.js → chunk-DTYVTTET.js} +1 -1
  45. package/{chunk-PTQPB44D.js → chunk-E6SW7I4D.js} +1 -1
  46. package/{chunk-NDLX3ORI.js → chunk-E7QWESN4.js} +1 -1
  47. package/{chunk-CNXYBR45.js → chunk-ENH6HA3V.js} +1 -1
  48. package/{chunk-6XE7LGUS.js → chunk-EQTP2O7O.js} +1 -1
  49. package/{chunk-NHHXXJY6.js → chunk-F3RSX7TC.js} +1 -1
  50. package/{chunk-3IEOINKV.js → chunk-F6LZM7H5.js} +1 -1
  51. package/{chunk-AOOG6YOT.js → chunk-F7PVAVLQ.js} +1 -1
  52. package/{chunk-BXEGWIR3.js → chunk-F7XGJYCZ.js} +1 -1
  53. package/{chunk-53I5JFOQ.js → chunk-FSB3LHPU.js} +1 -1
  54. package/{chunk-S3FQPUAS.js → chunk-FUCKNGW4.js} +1 -1
  55. package/{chunk-AHX56FH2.js → chunk-FVYL3BQ7.js} +1 -1
  56. package/{chunk-5SYYPB6N.js → chunk-G42V3ZZU.js} +1 -1
  57. package/{chunk-C3IOIS5V.js → chunk-H7GQCGCR.js} +1 -1
  58. package/{chunk-F5CCLXIY.js → chunk-IDHDHBFV.js} +1 -1
  59. package/{chunk-JZVNZ3I3.js → chunk-JD3HX7VY.js} +1 -1
  60. package/{chunk-DEOAL7PG.js → chunk-JE4XET33.js} +1 -1
  61. package/{chunk-VSHPIUZM.js → chunk-KZHI6PGZ.js} +1 -1
  62. package/{chunk-PXN4RATH.js → chunk-LBREDZL5.js} +1 -1
  63. package/{chunk-35UWKNGE.js → chunk-LCKRY7CZ.js} +1 -1
  64. package/{chunk-SZAGTA5I.js → chunk-LXLOWSN6.js} +1 -1
  65. package/{chunk-YZTBV6HG.js → chunk-M4SSELXT.js} +1 -1
  66. package/{chunk-IMVMIXVJ.js → chunk-ME4ALIS7.js} +1 -1
  67. package/{chunk-LABWETHZ.js → chunk-MHRSQRHT.js} +1 -1
  68. package/{chunk-CWDU4F7J.js → chunk-NNNKDAA2.js} +1 -1
  69. package/{chunk-DRTMMJ4Q.js → chunk-NPXVSAMB.js} +1 -1
  70. package/chunk-O76TW6JA.js +1 -0
  71. package/{chunk-U5XXKH2H.js → chunk-OJTHBHGK.js} +1 -1
  72. package/{chunk-RZFXAB7W.js → chunk-OT3UFDBI.js} +1 -1
  73. package/chunk-OVDG3ZBT.js +1 -0
  74. package/{chunk-Q4LKKVQU.js → chunk-PGOSR3RI.js} +1 -1
  75. package/{chunk-XPRP6AB4.js → chunk-PPXXWO4E.js} +1 -1
  76. package/{chunk-ML5KV2U2.js → chunk-PQL4GCC5.js} +1 -1
  77. package/{chunk-QWTGY7FA.js → chunk-QPPFPDWZ.js} +1 -1
  78. package/{chunk-EQU7DDK6.js → chunk-RE5GBQH6.js} +1 -1
  79. package/{chunk-PKOERZXQ.js → chunk-RM5HLXNW.js} +1 -1
  80. package/{chunk-NM5M567G.js → chunk-RXR5DXWS.js} +1 -1
  81. package/{chunk-ZUDQOT7C.js → chunk-S27Z7D3D.js} +1 -1
  82. package/{chunk-GJYEM7DL.js → chunk-S2BFXF7C.js} +1 -1
  83. package/{chunk-DTFLX2XQ.js → chunk-SFMFIWMX.js} +1 -1
  84. package/{chunk-OLLF6BKH.js → chunk-SUXEBUIX.js} +1 -1
  85. package/chunk-SV6BE4HG.js +130 -0
  86. package/{chunk-SEXB43QC.js → chunk-T367AQJ2.js} +1 -1
  87. package/{chunk-SS4J7T3N.js → chunk-TOGXYKTE.js} +1 -1
  88. package/{chunk-IGWIRCAS.js → chunk-U2VDC52W.js} +1 -1
  89. package/{chunk-OW25MQS7.js → chunk-UEFTMQDF.js} +1 -1
  90. package/{chunk-4X3G6MGP.js → chunk-UI2UMYSE.js} +1 -1
  91. package/{chunk-RXOOTYEO.js → chunk-UPSNJEHO.js} +1 -1
  92. package/{chunk-LWYAFMN3.js → chunk-URH77XNK.js} +1 -1
  93. package/{chunk-HZ7BZ72K.js → chunk-UVSR4LPB.js} +1 -1
  94. package/{chunk-AXU3K2IY.js → chunk-V22QPBAO.js} +1 -1
  95. package/{chunk-T3EH4DR2.js → chunk-VDXZGF3M.js} +1 -1
  96. package/{chunk-ZBO62XAM.js → chunk-VKT27VPR.js} +2 -2
  97. package/{chunk-OIBDX2CA.js → chunk-VMI3QWC6.js} +1 -1
  98. package/{chunk-VTCV67A4.js → chunk-VVAI7ZGN.js} +1 -1
  99. package/{chunk-6PNHT5U7.js → chunk-VW2FJYIZ.js} +1 -1
  100. package/{chunk-VL2HEHI5.js → chunk-W5E37PZP.js} +1 -1
  101. package/chunk-W63NE6LU.js +229 -0
  102. package/{chunk-OJ2VC4ER.js → chunk-WKHQICFW.js} +1 -1
  103. package/{chunk-DHLFL3KH.js → chunk-WMZF4DQK.js} +1 -1
  104. package/{chunk-ETFYQ4GV.js → chunk-WOYTUHJD.js} +1 -1
  105. package/{chunk-WPMC3LJJ.js → chunk-WPJGKTVO.js} +5 -5
  106. package/{chunk-ZMIVD3SF.js → chunk-WXIG4CXY.js} +1 -1
  107. package/{chunk-Q47KHO2M.js → chunk-XCTUTMD3.js} +1 -1
  108. package/{chunk-MBJKUKHJ.js → chunk-XOSALV7T.js} +1 -1
  109. package/{chunk-RF27SIL3.js → chunk-Y7SF5NXD.js} +1 -1
  110. package/{chunk-DU72RNAU.js → chunk-YPOBALKC.js} +1 -1
  111. package/{chunk-V4SH72WU.js → chunk-ZFNIPERQ.js} +1 -1
  112. package/chunk-ZK43JB4A.js +2 -0
  113. package/{chunk-5JZTWUDG.js → chunk-ZQWFATZY.js} +1 -1
  114. package/index.html +2 -2
  115. package/main-XTOQBEFQ.js +1 -0
  116. package/package.json +1 -1
  117. package/{styles-4HAX3IDP.css → styles-4L5CAR46.css} +1 -1
  118. package/chunk-2RNKYO2Q.js +0 -1
  119. package/chunk-5CZNOXPC.js +0 -1
  120. package/chunk-5HZBSMCT.js +0 -7
  121. package/chunk-6ZZZTNIH.js +0 -130
  122. package/chunk-EPLZY6T4.js +0 -1
  123. package/chunk-M3TKVRYP.js +0 -1
  124. package/chunk-NMCKMUY4.js +0 -7
  125. package/chunk-QF4D5YPK.js +0 -1
  126. package/chunk-SN7DLFX2.js +0 -1
  127. package/chunk-TUFQ5JVG.js +0 -180
  128. package/chunk-V4B5LQYD.js +0 -2
  129. package/chunk-VZ5CMS5O.js +0 -2
  130. package/chunk-WGJFR6CK.js +0 -1
  131. package/main-Q2T6QX2N.js +0 -1
@@ -1,4 +1,4 @@
1
- import{a as f,g as W}from"./chunk-IMVMIXVJ.js";import{Da as he,La as U,Ma as y,P as fe,Ua as ge,ua as me}from"./chunk-OIBDX2CA.js";import{m as N,s as d}from"./chunk-VZ5CMS5O.js";import{c as de,d as R,f as G,g as J,h as K}from"./chunk-F2X3VGZZ.js";import{$b as oe,Bb as c,Cc as ue,Db as h,Ea as M,Ec as Q,Gc as q,Ha as se,Kb as $,Lb as F,Nb as u,Qb as C,Vb as w,Wb as O,Xb as z,_b as E,ba as m,bd as s,ca as te,cd as H,da as ne,ec as ae,fc as k,gc as g,hb as _,hc as v,ia as D,kc as I,mc as P,nc as B,oc as b,pc as L,qa as ie,qb as V,ra as pe,rb as j,rc as le,sb as T,sc as ce,ua as a,xb as l,yb as re}from"./chunk-NMCKMUY4.js";var x=["*"],ye=["content"],Se=(e,r,t)=>({activateCallback:e,value:r,active:t});function _e(e,r){e&1&&z(0,"p-stepper-separator")}function $e(e,r){if(e&1){let t=oe();w(0,"button",0),ae("click",function(){ie(t);let n=k();return pe(n.onStepClick())}),w(1,"span",1),le(2),O(),w(3,"span",2),v(4),O()(),h(5,_e,1,0,"p-stepper-separator")}if(e&2){let t=k();F("tabindex",t.isStepDisabled()?-1:void 0)("disabled",t.isStepDisabled()),$("id",t.id())("role","tab")("aria-controls",t.ariaControls()),_(2),ce(t.value()),_(3),C(t.isSeparatorVisible()?5:-1)}}function Ce(e,r){e&1&&E(0)}function xe(e,r){e&1&&z(0,"p-stepper-separator")}function De(e,r){if(e&1&&h(0,Ce,1,0,"ng-container",3)(1,xe,1,0,"p-stepper-separator"),e&2){let t=k();F("ngTemplateOutlet",t.content||t._contentTemplate)("ngTemplateOutletContext",q(3,Se,t.onStepClick.bind(t),t.value(),t.active())),_(),C(t.isSeparatorVisible()?1:-1)}}var ve=e=>({transitionParams:e}),Te=e=>({value:"visible",params:e}),Fe=e=>({value:"hidden",params:e});function we(e,r){e&1&&z(0,"p-stepper-separator")}function ke(e,r){e&1&&E(0)}function Ie(e,r){if(e&1&&h(0,ke,1,0,"ng-container",1),e&2){let t=k();F("ngTemplateOutlet",t.contentTemplate||t._contentTemplate)("ngTemplateOutletContext",q(2,Se,t.updateValue.bind(t),t.value(),t.active()))}}var Pe=({dt:e})=>`
1
+ import{a as f,g as W}from"./chunk-ME4ALIS7.js";import{Da as he,La as U,Ma as y,P as fe,Ua as ge,ua as me}from"./chunk-VMI3QWC6.js";import{m as N,s as d}from"./chunk-ZK43JB4A.js";import{c as de,d as R,f as G,g as J,h as K}from"./chunk-F2X3VGZZ.js";import{$b as E,Cb as c,Dc as ue,Ea as M,Eb as h,Fc as Q,Ha as se,Hc as q,Lb as $,Mb as F,Ob as u,Rb as C,Wb as w,Xb as O,Yb as z,ac as oe,ba as m,bd as s,ca as te,cd as H,da as ne,fc as ae,gc as k,hc as g,ia as D,ib as _,ic as v,lc as I,nc as P,oc as B,pc as b,qa as ie,qc as L,ra as pe,rb as V,sb as j,sc as le,tb as T,tc as ce,ua as a,yb as l,zb as re}from"./chunk-6QJHEOXN.js";var x=["*"],ye=["content"],Se=(e,r,t)=>({activateCallback:e,value:r,active:t});function _e(e,r){e&1&&z(0,"p-stepper-separator")}function $e(e,r){if(e&1){let t=oe();w(0,"button",0),ae("click",function(){ie(t);let n=k();return pe(n.onStepClick())}),w(1,"span",1),le(2),O(),w(3,"span",2),v(4),O()(),h(5,_e,1,0,"p-stepper-separator")}if(e&2){let t=k();F("tabindex",t.isStepDisabled()?-1:void 0)("disabled",t.isStepDisabled()),$("id",t.id())("role","tab")("aria-controls",t.ariaControls()),_(2),ce(t.value()),_(3),C(t.isSeparatorVisible()?5:-1)}}function Ce(e,r){e&1&&E(0)}function xe(e,r){e&1&&z(0,"p-stepper-separator")}function De(e,r){if(e&1&&h(0,Ce,1,0,"ng-container",3)(1,xe,1,0,"p-stepper-separator"),e&2){let t=k();F("ngTemplateOutlet",t.content||t._contentTemplate)("ngTemplateOutletContext",q(3,Se,t.onStepClick.bind(t),t.value(),t.active())),_(),C(t.isSeparatorVisible()?1:-1)}}var ve=e=>({transitionParams:e}),Te=e=>({value:"visible",params:e}),Fe=e=>({value:"hidden",params:e});function we(e,r){e&1&&z(0,"p-stepper-separator")}function ke(e,r){e&1&&E(0)}function Ie(e,r){if(e&1&&h(0,ke,1,0,"ng-container",1),e&2){let t=k();F("ngTemplateOutlet",t.contentTemplate||t._contentTemplate)("ngTemplateOutletContext",q(2,Se,t.updateValue.bind(t),t.value(),t.active()))}}var Pe=({dt:e})=>`
2
2
  .p-steplist {
3
3
  position: relative;
4
4
  display: flex;
@@ -1 +1 @@
1
- import{a as A}from"./chunk-XT4YHL2M.js";import{a as Me}from"./chunk-VSHPIUZM.js";import{a as ne}from"./chunk-NHHXXJY6.js";import{b as Ae}from"./chunk-DU72RNAU.js";import{a as Re}from"./chunk-XKI7WLHE.js";import"./chunk-IGWIRCAS.js";import{a as M,b as P}from"./chunk-3A4BFUGD.js";import{d as Je,i as De,j as ke,k as Ne}from"./chunk-3IEOINKV.js";import{a as Ee,b as Ie}from"./chunk-53I5JFOQ.js";import"./chunk-HQMTUZZQ.js";import"./chunk-RXOOTYEO.js";import"./chunk-SEXB43QC.js";import{a as Fe,b as Ve}from"./chunk-CWFLUFKM.js";import"./chunk-LWYAFMN3.js";import"./chunk-NDLX3ORI.js";import"./chunk-E4MHRZVH.js";import"./chunk-XPRP6AB4.js";import"./chunk-YZTBV6HG.js";import"./chunk-DHLFL3KH.js";import"./chunk-QWTGY7FA.js";import{g as Te}from"./chunk-TUFQ5JVG.js";import"./chunk-ZUDQOT7C.js";import{a as ge,b as he}from"./chunk-BUDZ3ONE.js";import{a as Se,b as w,c as Ce,d as ve,e as we,f as ye,g as je}from"./chunk-SN7DLFX2.js";import"./chunk-V4SH72WU.js";import{n as ue,o as ce,w as fe,x as _e,y as xe,z as be}from"./chunk-IMVMIXVJ.js";import"./chunk-2D2YD753.js";import{b as oe,e as re,f as ae,k as le,l as me,o as pe,u as se,x as de}from"./chunk-OIBDX2CA.js";import"./chunk-AOOG6YOT.js";import"./chunk-M3TKVRYP.js";import"./chunk-2MKKFLNJ.js";import{h as X,j as Y,k as Z,p as ee,q as te,s as ie}from"./chunk-VZ5CMS5O.js";import"./chunk-F2X3VGZZ.js";import{$b as j,Bb as L,Cc as Q,Db as g,Ec as E,Ha as D,Lb as s,Nc as I,Oc as $,Pc as R,Rc as C,Vb as a,Wb as r,Xb as b,Y as J,_ as H,bd as y,c as F,cb as B,db as G,ec as T,fc as f,hb as m,ia as v,qa as h,ra as x,rc as p,s as V,sc as S,tc as k,vc as W,wc as K,xb as U,xc as N,yc as q}from"./chunk-NMCKMUY4.js";import{a as d,b as c}from"./chunk-YQFG5XE2.js";var Oe={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,from:null,to:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,outletName:""}},filter:{number:null,from:null,to:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,outletName:""}},z=Ce(je(Oe),ve(t=>({first:y(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:y(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:y(()=>t.data().data.some(l=>l.checked)),checkedAdjustment:y(()=>t.data().data.filter(l=>l.checked).map(l=>l.id))})),ye(t=>{let l=v(A);return{updateFilter(n){w(t,i=>c(d({},i),{filter:d(d({},i.filter),n)}))},onRowSelect(n){w(t,i=>{let o=i.data.data.map(u=>u.id===n.id?c(d({},u),{checked:!0}):u);return c(d({},i),{data:c(d({},i.data),{data:o})})})},onRowUnselect(n){w(t,i=>{let o=i.data.data.map(u=>u.id===n.id?c(d({},u),{checked:!1}):u);return c(d({},i),{data:c(d({},i.data),{data:o})})})},onHeaderCheckboxToggle(n){w(t,i=>{let o=i.data.data.map(u=>c(d({},u),{checked:n}));return c(d({},i),{data:c(d({},i.data),{data:o})})})},getGJAdjustmentLoader:M(F(J(()=>l.getGJAdjustmentLoader().pipe(P({next:n=>{w(t,i=>c(d({},i),{meta:n}))},error:n=>{console.error("Error fetching adjustment loader:",n)}}))))),getAdjustmentJournal:M(F(V(n=>Object.entries(n).reduce((i,[o,u])=>(u!=null&&(i[o]=u),i),{})),J(n=>l.getAdjustmentJournal(n).pipe(V(i=>c(d({},i),{data:i.data.map(o=>c(d({},o),{checked:!1}))})),P({next:i=>{w(t,o=>c(d({},o),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),we(t=>({onInit:()=>{t.getGJAdjustmentLoader(),t.getAdjustmentJournal(t.filter)}})));var O=t=>({"ng-invalid ng-dirty":t});function He(t,l){if(t&1){let e=j();a(0,"p-button",10),T("onClick",function(){h(e);let i=f(2);return x(i.generateAdjusmentJournal())}),r()}}function Be(t,l){if(t&1&&g(0,He,1,0,"p-button",9),t&2){let e=f();s("ngIf",e.store.hasCheckedRows())}}function Ge(t,l){t&1&&(a(0,"tr")(1,"th",12),b(2,"p-tableHeaderCheckbox"),r(),a(3,"th",13),p(4,"Outlet"),r(),a(5,"th",14),p(6,"Number"),r(),a(7,"th",15),p(8,"Date"),r(),a(9,"th",14),p(10,"Adjustment Qty"),r(),a(11,"th",13),p(12,"Type"),r(),a(13,"th",16),p(14,"State"),r(),a(15,"th",17),p(16,"Note"),r(),b(17,"th",18),r())}function Ue(t,l){if(t&1&&(a(0,"tr")(1,"td"),b(2,"p-tableCheckbox",19),r(),a(3,"td"),p(4),r(),a(5,"td")(6,"a",20),p(7),r()(),a(8,"td"),p(9),I(10,"date"),r(),a(11,"td"),p(12),I(13,"number"),r(),a(14,"td"),p(15),r(),a(16,"td"),p(17),r(),a(18,"td"),b(19,"div",21),r(),a(20,"td"),b(21,"p-button",22),r()()),t&2){let e=l.$implicit,n=f(2);m(2),s("value",e),m(2),S(e.outlet),m(2),s("href",n.authService.getTenantExternalURL()+"/menu/Adjustment/Adjustment/Archive/Info?ID="+e.id,G),m(),k(" ",e.number," "),m(2),S(R(10,12,e.date,"d MMM y")),m(3),S($(13,15,e.quantitySUM)),m(3),S(e.type),m(2),S(e.state),m(2),s("innerHTML",e.note,B),m(2),s("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function Le(t,l){if(t&1&&p(0),t&2){let e=f(2);W(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function We(t,l){t&1&&(a(0,"tr")(1,"td",23)(2,"span"),p(3,"No records found."),r()()())}function Ke(t,l){if(t&1){let e=j();a(0,"p-panel")(1,"p-table",11),T("onRowSelect",function(i){h(e);let o=f();return x(o.onRowSelect(i))})("onRowUnselect",function(i){h(e);let o=f();return x(o.onRowUnselect(i))})("onHeaderCheckboxToggle",function(i){h(e);let o=f();return x(o.onHeaderCheckboxToggle(i))})("onPage",function(i){h(e);let o=f();return x(o.onPageChange(i))}),g(2,Ge,18,0,"ng-template",null,3,C)(4,Ue,22,17,"ng-template",null,4,C)(6,Le,1,3,"ng-template",null,5,C)(8,We,4,0,"ng-template",null,6,C),r()()}if(t&2){let e=f();m(),s("value",e.store.data().data)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function qe(t,l){if(t&1&&(a(0,"span",33),p(1),I(2,"truncate"),r()),t&2){let e=l.$implicit;s("pTooltip",e.name),m(),k(" ",R(2,2,e.name,30)," ")}}function Qe(t,l){if(t&1&&(a(0,"div")(1,"span",35),p(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function $e(t,l){if(t&1&&(a(0,"div"),g(1,Qe,3,1,"div",34),r()),t&2){let e=f(2);m(),s("ngForOf",e.getErrors("from"))}}function Xe(t,l){if(t&1&&(a(0,"div")(1,"span",35),p(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function Ye(t,l){if(t&1&&(a(0,"div"),g(1,Xe,3,1,"div",34),r()),t&2){let e=f(2);m(),s("ngForOf",e.getErrors("to"))}}function Ze(t,l){if(t&1&&(a(0,"div")(1,"span",35),p(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function et(t,l){if(t&1&&(a(0,"div"),g(1,Ze,3,1,"div",34),r()),t&2){let e=f(2);m(),s("ngForOf",e.getErrors("pageSize"))}}function tt(t,l){if(t&1&&(a(0,"form",24)(1,"div",25)(2,"label",26),p(3,"Outlet"),r(),a(4,"p-select",27),g(5,qe,3,5,"ng-template",null,7,C),r()(),a(7,"div",25)(8,"label",26),p(9,"From - To"),r(),a(10,"div",28),b(11,"p-datepicker",29),g(12,$e,2,1,"div",30),b(13,"p-datepicker",31),g(14,Ye,2,1,"div",30),r()(),a(15,"div",25)(16,"label",26),p(17,"Page Size"),r(),b(18,"input",32),g(19,et,2,1,"div",30),r()()),t&2){let e=f();s("formGroup",e.form),m(4),s("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),m(7),s("iconDisplay","input")("showIcon",!0)("ngClass",E(13,O,e.isInvalid("from"))),m(),s("ngIf",e.isInvalid("from")),m(),s("iconDisplay","input")("showIcon",!0)("ngClass",E(15,O,e.isInvalid("to"))),m(),s("ngIf",e.isInvalid("to")),m(4),s("ngClass",E(17,O,e.isInvalid("pageSize"))),m(),s("ngIf",e.isInvalid("pageSize"))}}var Ht=(()=>{class t extends Re{constructor(){super(),this.store=v(z),this.generateJournalService=v(A),this.authService=v(ne),this.isDialogFilterVisible=D(!1),this.isInitDialogFilterVisible=D(!1),this.fb=v(se),this.dayjsService=v(Ae)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:n,to:i,pageNumber:o,pageSize:u,export:_,exportPageNumber:Pe,exportPageSize:ze}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),outletName:this.fb.control(""),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),pageNumber:this.fb.control(o),pageSize:this.fb.control(u),export:this.fb.control(_),exportPageNumber:this.fb.control(Pe),exportPageSize:this.fb.control(ze)})}onSearch(e){this.store.updateFilter(c(d({},this.store.filter()),{number:e,pageNumber:1}))}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((n,[i,o])=>{switch(i){case"from":typeof o=="object"?n[i]=this.dayjsService.from(o)?this.dayjsService.format(o):null:n[i]=o!=null?String(o):null;break;case"to":typeof o=="object"?n[i]=this.dayjsService.from(o)?this.dayjsService.format(o):null:n[i]=o!=null?String(o):null;break;default:n[i]=o===null?"":o;break}return n},{});this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(n=>{this.store.onRowUnselect(n)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onPageChange(e){let n=e.first/e.rows;this.store.updateFilter(c(d({},this.store.filter()),{pageNumber:n+1}))}generateAdjusmentJournal(){this.generateJournalService.createAdjustmentJournal(this.store.checkedAdjustment()).pipe(H(()=>this.store.getAdjustmentJournal(this.store.filter))).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=U({type:t,selectors:[["app-adjustment-journal"]],features:[Q([z]),L],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Adjustment",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","onPage","value","paginator","rows","totalRecords","lazy"],[2,"width","1rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","11rem"],[2,"width","9rem"],[2,"width","14rem"],[2,"width","4rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"innerHTML"],[3,"icon","severity","text"],["colspan","9"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["virtualScroll","","showClear","","filter","","filterBy","name","formControlName","outletName","appendTo","body","optionLabel","name","optionValue","name","placeholder","Select an Outlet",3,"virtualScrollItemSize","options"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["type","text","pInputText","","formControlName","pageSize","appMaskNumber","",3,"ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(n,i){if(n&1){let o=j();a(0,"app-main-panel",8),q("isDialogFilterVisibleChange",function(_){return h(o),N(i.isDialogFilterVisible,_)||(i.isDialogFilterVisible=_),x(_)})("isInitDialogFilterVisibleChange",function(_){return h(o),N(i.isInitDialogFilterVisible,_)||(i.isInitDialogFilterVisible=_),x(_)}),T("filterConfirmed",function(){return h(o),x(i.onFilterOKEvent())})("search",function(_){return h(o),x(i.onSearch(_))}),g(1,Be,1,1,"ng-template",null,0,C)(3,Ke,10,5,"ng-template",null,1,C)(5,tt,20,19,"ng-template",null,2,C),r()}n&2&&(s("isSearchableInput",!0)("isFilterable",!0),K("isDialogFilterVisible",i.isDialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[Te,Ne,Je,De,ke,ie,X,Y,Z,te,ee,he,ge,_e,fe,Ie,Ee,Ve,Fe,de,le,oe,re,ae,me,pe,ce,ue,Se,be,xe,Me],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{Ht as AdjustmentJournalComponent};
1
+ import{a as A}from"./chunk-2JNXKEYZ.js";import{a as Me}from"./chunk-KZHI6PGZ.js";import{a as ne}from"./chunk-F3RSX7TC.js";import{b as Ne}from"./chunk-YPOBALKC.js";import{a as Re}from"./chunk-XKI7WLHE.js";import"./chunk-U2VDC52W.js";import{a as M,b as P}from"./chunk-3VQUNDVT.js";import{d as Ve,i as Je,j as De,k as ke}from"./chunk-F6LZM7H5.js";import{a as Ee,b as Ie}from"./chunk-FSB3LHPU.js";import"./chunk-AMGBUOC4.js";import"./chunk-UPSNJEHO.js";import"./chunk-T367AQJ2.js";import{a as Ae,b as Fe}from"./chunk-AN4SAUSA.js";import"./chunk-URH77XNK.js";import"./chunk-E7QWESN4.js";import"./chunk-3DBSHDAQ.js";import"./chunk-PPXXWO4E.js";import"./chunk-M4SSELXT.js";import"./chunk-WMZF4DQK.js";import"./chunk-QPPFPDWZ.js";import{i as Te}from"./chunk-W63NE6LU.js";import"./chunk-S27Z7D3D.js";import{a as ge,b as he}from"./chunk-AD247LWQ.js";import{a as Se,b as w,c as Ce,d as ve,e as we,f as ye,g as je}from"./chunk-BKTBVFNX.js";import"./chunk-ZFNIPERQ.js";import{n as ue,o as ce,w as fe,x as _e,y as xe,z as be}from"./chunk-ME4ALIS7.js";import"./chunk-DTYVTTET.js";import{b as oe,e as re,f as ae,k as le,l as me,o as pe,u as se,x as de}from"./chunk-VMI3QWC6.js";import"./chunk-F7PVAVLQ.js";import"./chunk-DSZOROE6.js";import"./chunk-2BI7WNJP.js";import{h as X,j as Y,k as Z,p as ee,q as te,s as ie}from"./chunk-ZK43JB4A.js";import"./chunk-F2X3VGZZ.js";import{Cb as L,Dc as Q,Eb as g,Fc as E,Ha as D,Mb as s,Oc as I,Pc as $,Qc as R,Sc as C,Wb as a,Xb as r,Y as J,Yb as b,_ as H,ac as j,bd as y,c as F,db as B,eb as G,fc as T,gc as f,ia as v,ib as m,qa as h,ra as x,s as V,sc as p,tc as S,uc as k,wc as W,xc as K,yb as U,yc as N,zc as q}from"./chunk-6QJHEOXN.js";import{a as d,b as c}from"./chunk-YQFG5XE2.js";var Oe={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,from:null,to:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,outletName:""}},filter:{number:null,from:null,to:null,pageNumber:1,pageSize:20,export:!1,exportPageNumber:1,exportPageSize:1e4,outletName:""}},z=Ce(je(Oe),ve(t=>({first:y(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:y(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:y(()=>t.data().data.some(l=>l.checked)),checkedAdjustment:y(()=>t.data().data.filter(l=>l.checked).map(l=>l.id))})),ye(t=>{let l=v(A);return{updateFilter(n){w(t,i=>c(d({},i),{filter:d(d({},i.filter),n)}))},onRowSelect(n){w(t,i=>{let o=i.data.data.map(u=>u.id===n.id?c(d({},u),{checked:!0}):u);return c(d({},i),{data:c(d({},i.data),{data:o})})})},onRowUnselect(n){w(t,i=>{let o=i.data.data.map(u=>u.id===n.id?c(d({},u),{checked:!1}):u);return c(d({},i),{data:c(d({},i.data),{data:o})})})},onHeaderCheckboxToggle(n){w(t,i=>{let o=i.data.data.map(u=>c(d({},u),{checked:n}));return c(d({},i),{data:c(d({},i.data),{data:o})})})},getGJAdjustmentLoader:M(F(J(()=>l.getGJAdjustmentLoader().pipe(P({next:n=>{w(t,i=>c(d({},i),{meta:n}))},error:n=>{console.error("Error fetching adjustment loader:",n)}}))))),getAdjustmentJournal:M(F(V(n=>Object.entries(n).reduce((i,[o,u])=>(u!=null&&(i[o]=u),i),{})),J(n=>l.getAdjustmentJournal(n).pipe(V(i=>c(d({},i),{data:i.data.map(o=>c(d({},o),{checked:!1}))})),P({next:i=>{w(t,o=>c(d({},o),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),we(t=>({onInit:()=>{t.getGJAdjustmentLoader(),t.getAdjustmentJournal(t.filter)}})));var O=t=>({"ng-invalid ng-dirty":t});function He(t,l){if(t&1){let e=j();a(0,"p-button",10),T("onClick",function(){h(e);let i=f(2);return x(i.generateAdjusmentJournal())}),r()}}function Be(t,l){if(t&1&&g(0,He,1,0,"p-button",9),t&2){let e=f();s("ngIf",e.store.hasCheckedRows())}}function Ge(t,l){t&1&&(a(0,"tr")(1,"th",12),b(2,"p-tableHeaderCheckbox"),r(),a(3,"th",13),p(4,"Outlet"),r(),a(5,"th",14),p(6,"Number"),r(),a(7,"th",15),p(8,"Date"),r(),a(9,"th",14),p(10,"Adjustment Qty"),r(),a(11,"th",13),p(12,"Type"),r(),a(13,"th",16),p(14,"State"),r(),a(15,"th",17),p(16,"Note"),r(),b(17,"th",18),r())}function Ue(t,l){if(t&1&&(a(0,"tr")(1,"td"),b(2,"p-tableCheckbox",19),r(),a(3,"td"),p(4),r(),a(5,"td")(6,"a",20),p(7),r()(),a(8,"td"),p(9),I(10,"date"),r(),a(11,"td"),p(12),I(13,"number"),r(),a(14,"td"),p(15),r(),a(16,"td"),p(17),r(),a(18,"td"),b(19,"div",21),r(),a(20,"td"),b(21,"p-button",22),r()()),t&2){let e=l.$implicit,n=f(2);m(2),s("value",e),m(2),S(e.outlet),m(2),s("href",n.authService.getTenantExternalURL()+"/menu/Adjustment/Adjustment/Archive/Info?ID="+e.id,G),m(),k(" ",e.number," "),m(2),S(R(10,12,e.date,"d MMM y")),m(3),S($(13,15,e.quantitySUM)),m(3),S(e.type),m(2),S(e.state),m(2),s("innerHTML",e.note,B),m(2),s("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function Le(t,l){if(t&1&&p(0),t&2){let e=f(2);W(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function We(t,l){t&1&&(a(0,"tr")(1,"td",23)(2,"span"),p(3,"No records found."),r()()())}function Ke(t,l){if(t&1){let e=j();a(0,"p-panel")(1,"p-table",11),T("onRowSelect",function(i){h(e);let o=f();return x(o.onRowSelect(i))})("onRowUnselect",function(i){h(e);let o=f();return x(o.onRowUnselect(i))})("onHeaderCheckboxToggle",function(i){h(e);let o=f();return x(o.onHeaderCheckboxToggle(i))})("onPage",function(i){h(e);let o=f();return x(o.onPageChange(i))}),g(2,Ge,18,0,"ng-template",null,3,C)(4,Ue,22,17,"ng-template",null,4,C)(6,Le,1,3,"ng-template",null,5,C)(8,We,4,0,"ng-template",null,6,C),r()()}if(t&2){let e=f();m(),s("value",e.store.data().data)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function qe(t,l){if(t&1&&(a(0,"span",33),p(1),I(2,"truncate"),r()),t&2){let e=l.$implicit;s("pTooltip",e.name),m(),k(" ",R(2,2,e.name,30)," ")}}function Qe(t,l){if(t&1&&(a(0,"div")(1,"span",35),p(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function $e(t,l){if(t&1&&(a(0,"div"),g(1,Qe,3,1,"div",34),r()),t&2){let e=f(2);m(),s("ngForOf",e.getErrors("from"))}}function Xe(t,l){if(t&1&&(a(0,"div")(1,"span",35),p(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function Ye(t,l){if(t&1&&(a(0,"div"),g(1,Xe,3,1,"div",34),r()),t&2){let e=f(2);m(),s("ngForOf",e.getErrors("to"))}}function Ze(t,l){if(t&1&&(a(0,"div")(1,"span",35),p(2),r()()),t&2){let e=l.$implicit;m(2),S(e)}}function et(t,l){if(t&1&&(a(0,"div"),g(1,Ze,3,1,"div",34),r()),t&2){let e=f(2);m(),s("ngForOf",e.getErrors("pageSize"))}}function tt(t,l){if(t&1&&(a(0,"form",24)(1,"div",25)(2,"label",26),p(3,"Outlet"),r(),a(4,"p-select",27),g(5,qe,3,5,"ng-template",null,7,C),r()(),a(7,"div",25)(8,"label",26),p(9,"From - To"),r(),a(10,"div",28),b(11,"p-datepicker",29),g(12,$e,2,1,"div",30),b(13,"p-datepicker",31),g(14,Ye,2,1,"div",30),r()(),a(15,"div",25)(16,"label",26),p(17,"Page Size"),r(),b(18,"input",32),g(19,et,2,1,"div",30),r()()),t&2){let e=f();s("formGroup",e.form),m(4),s("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),m(7),s("iconDisplay","input")("showIcon",!0)("ngClass",E(13,O,e.isInvalid("from"))),m(),s("ngIf",e.isInvalid("from")),m(),s("iconDisplay","input")("showIcon",!0)("ngClass",E(15,O,e.isInvalid("to"))),m(),s("ngIf",e.isInvalid("to")),m(4),s("ngClass",E(17,O,e.isInvalid("pageSize"))),m(),s("ngIf",e.isInvalid("pageSize"))}}var Ht=(()=>{class t extends Re{constructor(){super(),this.store=v(z),this.generateJournalService=v(A),this.authService=v(ne),this.isDialogFilterVisible=D(!1),this.isInitDialogFilterVisible=D(!1),this.fb=v(se),this.dayjsService=v(Ne)}ngOnInit(){this.initForm()}initForm(){let{number:e,from:n,to:i,pageNumber:o,pageSize:u,export:_,exportPageNumber:Pe,exportPageSize:ze}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),outletName:this.fb.control(""),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),pageNumber:this.fb.control(o),pageSize:this.fb.control(u),export:this.fb.control(_),exportPageNumber:this.fb.control(Pe),exportPageSize:this.fb.control(ze)})}onSearch(e){this.store.updateFilter(c(d({},this.store.filter()),{number:e,pageNumber:1}))}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((n,[i,o])=>{switch(i){case"from":typeof o=="object"?n[i]=this.dayjsService.from(o)?this.dayjsService.format(o):null:n[i]=o!=null?String(o):null;break;case"to":typeof o=="object"?n[i]=this.dayjsService.from(o)?this.dayjsService.format(o):null:n[i]=o!=null?String(o):null;break;default:n[i]=o===null?"":o;break}return n},{});this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(n=>{this.store.onRowUnselect(n)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onPageChange(e){let n=e.first/e.rows;this.store.updateFilter(c(d({},this.store.filter()),{pageNumber:n+1}))}generateAdjusmentJournal(){this.generateJournalService.createAdjustmentJournal(this.store.checkedAdjustment()).pipe(H(()=>this.store.getAdjustmentJournal(this.store.filter))).subscribe()}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=U({type:t,selectors:[["app-adjustment-journal"]],features:[Q([z]),L],decls:7,vars:5,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Adjustment",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible","scrollable"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onRowSelect","onRowUnselect","onHeaderCheckboxToggle","onPage","value","paginator","rows","totalRecords","lazy"],[2,"width","1rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","11rem"],[2,"width","9rem"],[2,"width","14rem"],[2,"width","4rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"innerHTML"],[3,"icon","severity","text"],["colspan","9"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["virtualScroll","","showClear","","filter","","filterBy","name","formControlName","outletName","appendTo","body","optionLabel","name","optionValue","name","placeholder","Select an Outlet",3,"virtualScrollItemSize","options"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["type","text","pInputText","","formControlName","pageSize","appMaskNumber","",3,"ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(n,i){if(n&1){let o=j();a(0,"app-main-panel",8),q("isDialogFilterVisibleChange",function(_){return h(o),N(i.isDialogFilterVisible,_)||(i.isDialogFilterVisible=_),x(_)})("isInitDialogFilterVisibleChange",function(_){return h(o),N(i.isInitDialogFilterVisible,_)||(i.isInitDialogFilterVisible=_),x(_)}),T("filterConfirmed",function(){return h(o),x(i.onFilterOKEvent())})("search",function(_){return h(o),x(i.onSearch(_))}),g(1,Be,1,1,"ng-template",null,0,C)(3,Ke,10,5,"ng-template",null,1,C)(5,tt,20,19,"ng-template",null,2,C),r()}n&2&&(s("isSearchableInput",!0)("isFilterable",!0),K("isDialogFilterVisible",i.isDialogFilterVisible)("isInitDialogFilterVisible",i.isInitDialogFilterVisible),s("scrollable",!0))},dependencies:[Te,ke,Ve,Je,De,ie,X,Y,Z,te,ee,he,ge,_e,fe,Ie,Ee,Fe,Ae,de,le,oe,re,ae,me,pe,ce,ue,Se,be,xe,Me],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{Ht as AdjustmentJournalComponent};
@@ -1 +1 @@
1
- import{Xb as n,xb as o}from"./chunk-NMCKMUY4.js";import"./chunk-YQFG5XE2.js";var c=(()=>{class t{static{this.\u0275fac=function(e){return new(e||t)}}static{this.\u0275cmp=o({type:t,selectors:[["app-timeout"]],decls:1,vars:0,consts:[["src","assets/images/background/timeout.svg","alt","timeout"]],template:function(e,s){e&1&&n(0,"img",0)},styles:["[_nghost-%COMP%]{display:block}img[_ngcontent-%COMP%]{height:100vh;width:100%}"],changeDetection:0})}}return t})();export{c as TimeoutComponent};
1
+ import{Yb as n,yb as o}from"./chunk-6QJHEOXN.js";import"./chunk-YQFG5XE2.js";var c=(()=>{class t{static{this.\u0275fac=function(e){return new(e||t)}}static{this.\u0275cmp=o({type:t,selectors:[["app-timeout"]],decls:1,vars:0,consts:[["src","assets/images/background/timeout.svg","alt","timeout"]],template:function(e,s){e&1&&n(0,"img",0)},styles:["[_nghost-%COMP%]{display:block}img[_ngcontent-%COMP%]{height:100vh;width:100%}"],changeDetection:0})}}return t})();export{c as TimeoutComponent};
@@ -0,0 +1,7 @@
1
+ import{a as pt}from"./chunk-FQRRGJBE.js";import{a as De,b as Re}from"./chunk-UVSR4LPB.js";import{a as Se}from"./chunk-F3RSX7TC.js";import{a as Ht,b as ce}from"./chunk-YPOBALKC.js";import{b as rt}from"./chunk-B4C3ZPN6.js";import{b as Wt,c as at,d as lt}from"./chunk-LXLOWSN6.js";import{a as de,b as ue}from"./chunk-RXR5DXWS.js";import"./chunk-VDXZGF3M.js";import"./chunk-MHRSQRHT.js";import{a as oe}from"./chunk-6WWXJJID.js";import"./chunk-U2VDC52W.js";import{a as Ie,b as we}from"./chunk-3VQUNDVT.js";import{a as it,b as nt,d as me,k as se}from"./chunk-F6LZM7H5.js";import{a as le,b as pe}from"./chunk-FSB3LHPU.js";import"./chunk-AMGBUOC4.js";import"./chunk-UPSNJEHO.js";import{a as ot}from"./chunk-NNNKDAA2.js";import{a as Ne}from"./chunk-BT7Y4ADP.js";import{b as Ee}from"./chunk-DJXQKSLT.js";import"./chunk-T367AQJ2.js";import{a as qt,b as Te}from"./chunk-AN4SAUSA.js";import"./chunk-URH77XNK.js";import"./chunk-E7QWESN4.js";import{d as Ue}from"./chunk-3DBSHDAQ.js";import"./chunk-PPXXWO4E.js";import"./chunk-M4SSELXT.js";import{b as ae}from"./chunk-WXIG4CXY.js";import"./chunk-WMZF4DQK.js";import"./chunk-QPPFPDWZ.js";import{e as et,f as tt,i as re}from"./chunk-W63NE6LU.js";import"./chunk-S27Z7D3D.js";import{a as $e,b as ne}from"./chunk-AD247LWQ.js";import{b as O,c as Ye,d as Xe,e as Je,f as Qe,g as Ze}from"./chunk-BKTBVFNX.js";import"./chunk-ZFNIPERQ.js";import{n as Ot,o as Ke,w as te,x as ie,y as jt,z as zt}from"./chunk-ME4ALIS7.js";import{b as ye}from"./chunk-DTYVTTET.js";import{b as At,c as Gt,e as Y,f as X,g as Pt,i as st,k as J,l as Q,o as Z,u as ve,x as ee}from"./chunk-VMI3QWC6.js";import{b as He,e as U,l as $}from"./chunk-F7PVAVLQ.js";import{a as Bt,b as Ce}from"./chunk-DSZOROE6.js";import{a as We}from"./chunk-2BI7WNJP.js";import{A as Nt,h as ze,k as H,p as qe,q as W,s as K,z as kt}from"./chunk-ZK43JB4A.js";import"./chunk-F2X3VGZZ.js";import{Ac as Vt,Bc as mt,Cc as _e,D as Ae,Dc as Oe,Eb as g,Ec as L,Fc as F,Gc as Mt,Ha as E,Hc as je,Mb as s,Oc as S,Pb as Pe,Pc as y,Qc as ke,Rb as M,Sb as Fe,Sc as _,Ub as Le,Vb as Ve,W as Dt,Wb as o,X as Rt,Xb as r,Y as be,Yb as w,Zb as z,_ as V,_b as q,ac as D,bd as R,c as he,ca as Ft,cd as fe,db as j,eb as Ge,fc as I,gc as c,ia as C,ib as p,jc as Lt,qa as h,ra as b,s as Be,sc as a,tc as x,uc as T,vc as Me,xc as A,yb as N,yc as B,zc as P}from"./chunk-6QJHEOXN.js";import{a as f,b as v,c as xe,e as Tt}from"./chunk-YQFG5XE2.js";var G=(()=>{class t{constructor(){this.httpService=C(Bt),this.authService=C(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/GetGeneralLedgerCount",e)}fetchGeneralLedgerReport(e,n="single"){return this.httpService.post(void 0,`api/GeneralLedger/${n==="single"?"GetGeneralLedger":"GetMultiLedger"}`,e)}exportGeneralLedger(e,n={}){let i=f({responseType:"blob"},n);return this.httpService.post(void 0,"/api/GeneralLedgerExport/GetGeneralLedgerExport",e,i)}exportMultiLedger(e,n={}){let i=f({responseType:"blob"},n);return this.httpService.post(void 0,"/api/GeneralLedgerExport/GetMultiLedgerExport",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 Nt({fromObject:Object.fromEntries(Object.entries(e).map(([d,k])=>[d,String(k)]))}),l=new kt({"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=f({params:i,headers:l},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",f({},e),n)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=Ft({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var oi=()=>({width:"30vw"}),ri=()=>({"1199px":"75vw","575px":"90vw"}),ai=t=>({"ng-dirty ng-invalid":t}),li=t=>["/pages/journal/journal-entry/",t],pi=t=>({"text-success":t}),mi=t=>({"text-danger":t});function si(t,m){if(t&1&&(o(0,"div",33)(1,"div",34)(2,"span",35),a(3),r()(),o(4,"div")(5,"span"),a(6,"-"),r()(),o(7,"div",34)(8,"span",36),a(9),r()()()),t&2){let e=m.$implicit;p(3),T("(",e.code,")"),p(6),x(e.name)}}function ci(t,m){if(t&1&&(o(0,"div",33)(1,"div",34)(2,"span",35),a(3),r()(),o(4,"div")(5,"span"),a(6,"-"),r()(),o(7,"div",34)(8,"span",36),a(9),r()()()),t&2){let e=m.$implicit;p(3),T("(",e.code,")"),p(6),x(e.name)}}function di(t,m){t&1&&(o(0,"div",37),a(1," Account is required. "),r())}function ui(t,m){if(t&1&&(o(0,"div",38)(1,"div"),a(2),r()()),t&2){let e=m.$implicit;p(2),x(e.value)}}function _i(t,m){if(t&1&&(o(0,"div",26)(1,"div",27),w(2,"p-radiobutton",39),o(3,"label",40),a(4),r()()()),t&2){let e=m.$implicit;p(2),s("value",e.key)("inputId",e.key),p(),s("for",e.key),p(),x(e.value)}}function fi(t,m){if(t&1){let e=D();o(0,"div",16)(1,"label",17),a(2,"Customer"),r(),o(3,"p-autocomplete",41),I("completeMethod",function(i){h(e);let l=c(3);return b(l.searchCustomer(i))}),r()()}if(t&2){let e=c(3);p(3),s("suggestions",e.customerSuggestions())}}function gi(t,m){if(t&1){let e=D();o(0,"div",16)(1,"label",17),a(2,"Supplier"),r(),o(3,"p-autocomplete",42),I("completeMethod",function(i){h(e);let l=c(3);return b(l.searchSupplier(i))}),r()()}if(t&2){let e=c(3);p(3),s("suggestions",e.supplierSuggestions())}}function xi(t,m){if(t&1){let e=D();o(0,"div",16)(1,"label",17),a(2,"Customer"),r(),o(3,"p-autocomplete",41),I("completeMethod",function(i){h(e);let l=c(3);return b(l.searchCustomer(i))}),r()()}if(t&2){let e=c(3);p(3),s("suggestions",e.customerSuggestions())}}function hi(t,m){if(t&1&&(o(0,"form",15)(1,"div",16)(2,"label",17),a(3,"Accounts"),r(),o(4,"p-select",18),g(5,si,10,2,"ng-template",null,5,_)(7,ci,10,2,"ng-template",null,6,_),r(),g(9,di,2,0,"div",19),r(),o(10,"div",16)(11,"label",17),a(12,"From"),r(),o(13,"div",20),w(14,"p-datepicker",21)(15,"p-datepicker",22),r()(),o(16,"div",16)(17,"label",17),a(18,"Outlets"),r(),o(19,"p-multiselect",23),g(20,ui,3,1,"ng-template",null,6,_),r()(),o(22,"div",16)(23,"label",24),a(24,"Contact Type"),r(),o(25,"div",25),Le(26,_i,5,4,"div",26,Fe),r()(),g(28,fi,4,1,"div",16)(29,gi,4,1,"div",16)(30,xi,4,1,"div",16),o(31,"div",16)(32,"label",24),a(33,"Sort order"),r(),o(34,"div",25)(35,"div",26)(36,"div",27),w(37,"p-radiobutton",28),o(38,"label",29),a(39,"Asc"),r()()(),o(40,"div",30)(41,"div",27),w(42,"p-radiobutton",31),o(43,"label",32),a(44,"Desc"),r()()()()()()),t&2){let e,n,i,l=c(2);s("formGroup",l.form),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",l.loaderMetadata().options.accounts)("ngClass",F(14,ai,((e=l.form.get("accountID"))==null?null:e.invalid)&&(((e=l.form.get("accountID"))==null?null:e.touched)||((e=l.form.get("accountID"))==null?null:e.dirty)))),p(5),s("ngIf",((n=l.form.get("accountID"))==null?null:n.invalid)&&(((n=l.form.get("accountID"))==null?null:n.touched)||((n=l.form.get("accountID"))==null?null:n.dirty))),p(5),s("showIcon",!0),p(),s("showIcon",!0),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",l.loaderMetadata().options.outlets),p(7),Ve(l.loaderMetadata().options.contactTypeOptions),p(2),M((i=l.form.controls.contactType.value)===1?28:i===2?29:30),p(9),s("value",!0),p(5),s("value",!1)}}function bi(t,m){if(t&1&&g(0,hi,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 Si(t,m){if(t&1&&(o(0,"div",33)(1,"a",43),a(2,"Return to Accounts"),r(),g(3,Ci,1,0,"p-button",44),r()),t&2){let e=c();p(3),s("ngIf",e.roleService.global().export)}}function vi(t,m){t&1&&w(0,"div",52)}function yi(t,m){t&1&&(o(0,"tr")(1,"th",53),a(2,"Outlet"),r(),o(3,"th",54),a(4,"No."),r(),o(5,"th",55),a(6,"Date"),r(),o(7,"th",56),a(8,"Contact / Note"),r(),o(9,"th",57),a(10,"Debit"),r(),o(11,"th",57),a(12,"Credit"),r(),o(13,"th",58),a(14,"Balance"),r()())}function Ei(t,m){if(t&1&&(o(0,"div",16),w(1,"div",66),o(2,"span",67),a(3),r()()),t&2){let e=c().$implicit;p(),s("innerHTML",e.journalNote,j),p(2),T("",e.note," ")}}function Ii(t,m){if(t&1&&(o(0,"div",16),w(1,"span",66)(2,"div",66),o(3,"span",68),a(4),r()()),t&2){let e=c().$implicit;p(),s("innerHTML",e.referenceText,j),p(),s("innerHTML",e.journalNote,j),p(2),T("",e.note," ")}}function wi(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;p(),T(" ",y(2,1,e.debitAmount)," ")}}function Ti(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;p(),T(" ",y(2,1,e.creditAmount)," ")}}function Di(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;p(),T(" ",y(2,1,e.balance)," ")}}function Ri(t,m){if(t&1&&(o(0,"tr")(1,"td",59),a(2),r(),o(3,"td",59)(4,"a",60),a(5),r()(),o(6,"td",59)(7,"span",61),S(8,"date"),a(9),S(10,"date"),r()(),o(11,"td",59)(12,"div",16)(13,"a",62),a(14),r(),g(15,Ei,4,2,"div",16)(16,Ii,5,3,"div",16),r()(),o(17,"td",63),g(18,wi,3,3,"ng-container",64),r(),o(19,"td",63),g(20,Ti,3,3,"ng-container",64),r(),o(21,"td",65),g(22,Di,3,3,"ng-container",64),r()()),t&2){let e=m.$implicit,n=c(3);p(2),x(e.outletName),p(2),s("routerLink",F(19,li,e.id)),p(),x(e.number),p(2),s("pTooltip",ke(8,13,e.date,"dd MMM y")),p(2),T(" ",ke(10,16,e.date,"dd MMM y")," "),p(4),s("href",n.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.contactID,Ge),p(),x(e.contactName),p(),M(n.buildReferenceUrl(e)?15:16),p(2),s("ngClass",F(21,pi,e.debitAmount!==0)),p(),s("ngIf",e.debitAmount!==0),p(),s("ngClass",F(23,mi,e.creditAmount!==0)),p(),s("ngIf",e.creditAmount!==0),p(2),s("ngIf",e.balance!==0)}}function Fi(t,m){if(t&1&&(o(0,"tr"),w(1,"td",69),o(2,"td",70),a(3,"Total"),r(),o(4,"td",71),a(5),S(6,"number"),r(),o(7,"td",72),a(8),S(9,"number"),r(),w(10,"td"),r()),t&2){let e=c(3);p(5),T(" ",y(6,2,e.debitSubTotal())," "),p(3),T(" ",y(9,4,e.creditSubTotal())," ")}}function Li(t,m){t&1&&(o(0,"tr")(1,"td",73)(2,"span"),a(3,"No records found."),r()()())}function Vi(t,m){if(t&1){let e=D();o(0,"button",74),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 Mi(t,m){if(t&1&&a(0),t&2){let e=c(3);T(" ",e.count()," ")}}function ki(t,m){if(t&1){let e=D();o(0,"p-button",75),I("onClick",function(){h(e);let i=c(3);return b(i.onNextPage())}),r()}}function Ni(t,m){if(t&1&&(o(0,"div",47)(1,"p-table",48),g(2,vi,1,0,"ng-template",null,7,_)(4,yi,15,0,"ng-template",null,8,_)(6,Ri,23,25,"ng-template",null,9,_)(8,Fi,11,6,"ng-template",null,4,_)(10,Li,4,0,"ng-template",null,10,_),r(),o(12,"div",49)(13,"div"),a(14),g(15,Vi,1,0,"button",50)(16,Mi,1,1),a(17," entries "),r(),o(18,"div",33),g(19,ki,1,0,"p-button",51),r()()()),t&2){let e=c(2);p(),s("value",e.items().data.data),p(13),Me(" 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 Bi(t,m){if(t&1&&g(0,Ni,20,5,"div",46),t&2){let e=c();s("ngIf",e.items()&&e.items().data)}}function Ai(t,m){if(t&1&&(o(0,"div",76)(1,"div",77),w(2,"div",78),r(),o(3,"div",79)(4,"div",27),w(5,"i",80),o(6,"span",81),a(7),S(8,"number"),S(9,"number"),r()()()()),t&2){let e=c();p(),s("formGroup",e.form),p(6),Me("Exporting data from ",y(8,3,e.filter().exportPageNumber)," - ",y(9,5,e.filter().exportPageSize),"")}}function Gi(t,m){if(t&1){let e=D();o(0,"p-button",82),I("onClick",function(){h(e);let i=c();return b(i.onToggleExportDialog())}),r()}t&2&&s("rounded",!0)("text",!0)}function Pi(t,m){if(t&1){let e=D();o(0,"p-button",83),I("click",function(){h(e);let i=c();return b(i.onToggleExportDialog())}),r(),o(1,"p-button",84),I("click",function(){h(e);let i=c();return b(i.onExport())}),r()}}var Ut=(()=>{class t{getGLCount(){this.reportService.getGLCount(this.filter()).pipe(V(({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=C(G),this.route=C(He),this.roleService=C(oe),this.authService=C(Se),this.fb=C(ve),this.coaService=C(ot),this.toastr=C(We),this.dayjsService=C(ce),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,l=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:!l}}),this.queryFilter=ye(this.route.queryParamMap.pipe(Be(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,l={},u=e.get("id");return Ce.IsNotEmpty(u)&&(l=v(f({},l),{accountID:u})),Ce.IsNotEmpty(n)&&Ce.IsNotEmpty(i)&&(l=v(f({},l),{from:n,to:i})),l})),{initialValue:null}),this.loaderMetadata=ye(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?f(f({},e),n):null}),this.creditSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.creditAmount)||0),0)),this.balanceSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.balance)||0),0)),this.debitSubTotal=R(()=>(this.items()?.data?.data??[]).reduce((n,i)=>n+(Number(i.debitAmount)||0),0)),this.initializeForm(),fe(()=>{let e=this.filter();e&&(Ce.IsEmpty(this.form.value.accountID)||this.form.value.accountID!==e.accountID)&&this.form.patchValue(this.transformFilterToFormValue(e),{emitEvent:!1})}),fe(()=>{let e=this.filter(),n=this.form.value.accountID;!e||Ce.IsEmpty(n)||this.reportService.fetchGeneralLedgerReport(e).subscribe(i=>{this.lastGetDataLength.set(i.data?.data?.length),this.items.update(l=>e.pageNumber===1?i:v(f({},i),{data:v(f({},i.data),{data:[...l?.data.data??[],...i.data.data]})}))})})}buildReferenceUrl(e){return pt(e)}ngOnInit(){this.route.queryParamMap.pipe(Ae(e=>e.keys.length>0)).subscribe({next:()=>this.initDialogVisible.set(!0)})}initializeForm(){this.form=this.fb.group({accountID:this.fb.control(null,[Gt.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 l=this.findNodeByKey(i.children,n);if(l)return l}}return null}transformFilterToFormValue(e){return Object.entries(e).reduce((n,[i,l])=>{switch(i){case"from":n[i]=l&&(typeof l=="string"||typeof l=="number"||l instanceof Date)?this.dayjsService.from(l)?.toDate():null;break;case"to":n[i]=l&&(typeof l=="string"||typeof l=="number"||l instanceof Date)?this.dayjsService.from(l)?.toDate():this.dayjsService.now.toDate();break;case"listCategoryID":Array.isArray(l)?n[i]=l.map(u=>this.findNodeByKey(this.categoriesOptions(),u)).filter(u=>!!u):n[i]=[];break;case"listOutletID":case"listAccountID":n[i]=Array.isArray(l)?l:[];break;case"pageNumber":case"pageSize":case"exportPageNumber":case"exportPageSize":n[i]=l!=null?Number(l):0;break;case"sortAscending":case"export":n[i]=!!l;break;case"contactType":n[i]=l!=null?Number(l):null;break;default:n[i]=l}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(V(e=>this.categoriesOptions.set(e))).subscribe()}searchCustomer(e){this.reportService.getCustomerSuggestions(e.query).pipe(V(n=>this.customerSuggestions.set(n))).subscribe()}searchSupplier(e){this.reportService.getSupplierSuggestions(e.query).pipe(V(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 l=this.form.getRawValue(),{from:e,to:n}=l,i=xe(l,["from","to"]);return v(f({},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(V(n=>this.handleExportResponse(n))).subscribe()}handleExportResponse(e){let n=e.headers,i=n.get("Content-Disposition")??n.get("content-disposition"),l="download.csv";if(i){let d=i.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);d?.[1]&&(l=decodeURIComponent(d[1].replace(/"/g,"")))}let u=e.body;lt(u,l,u.type)}buildExportBody(){let l=this.form.value,{from:e,to:n}=l,i=xe(l,["from","to"]);return v(f({},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(f({},e),{pageNumber:n+1,balance:this.items().data.data[this.items().data.data.length-1]?.balance??0,credit:this.items().data.data[this.items().data.data.length-1]?.creditAmount??0,debit:this.items().data.data[this.items().data.data.length-1]?.debitAmount??0})})}onPrevPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(f({},e),{pageNumber:Math.max(1,n-1)})})}goToPage(e){this.localFilter.update(n=>v(f({},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(l=>v(f({},l),{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 General Ledger",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"],[2,"width","380px"],[2,"width","240px"],[2,"width","150px"],[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"],["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 l=D();o(0,"app-main-panel",11),P("isDialogFilterVisibleChange",function(d){return h(l),B(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),b(d)})("isInitDialogFilterVisibleChange",function(d){return h(l),B(i.initDialogVisible,d)||(i.initDialogVisible=d),b(d)}),I("filterConfirmed",function(){return h(l),b(i.onFilterOKEvent())}),g(1,bi,1,1,"ng-template",null,0,_)(3,Si,4,1,"ng-template",null,1,_)(5,Bi,1,1,"ng-template",null,2,_),r(),o(7,"p-dialog",12),P("visibleChange",function(d){return h(l),B(i.isDialogExportVisible,d)||(i.isDialogExportVisible=d),b(d)}),g(8,Ai,10,7,"div",13)(9,Gi,1,2,"ng-template",null,3,_)(11,Pi,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),Pe(L(11,oi)),s("modal",!0),A("visible",i.isDialogExportVisible),s("breakpoints",L(12,ri)),p(),s("ngIf",i.form&&i.filter()))},dependencies:[re,K,ze,H,W,qe,ae,se,me,tt,et,ie,te,Te,qt,pe,le,Re,De,ee,J,Y,X,Q,Z,ue,de,Ee,Ue,at,rt,ne,$,U,nt,it,zt,jt,Ke],styles:["[_nghost-%COMP%] .p-datatable .p-datatable-header{padding:.75rem 1rem .75rem 0}"],changeDetection:0})}}return t})();var Oi={data:{},filter:{EntityID:[],CashierID:null,Text:null,from:null,to:null},isLoading:!0,loader:{options:{outlets:[]},filter:{from:"",to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}}},ht=Ye(Ze(Oi),Xe(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}),Qe(t=>{let m=C(G),e=C(ce),n={updateFilter(i){O(t,l=>v(f({},l),{filter:f(f({},l.filter),i)}))},getLoader:Ie(he(be(()=>m.getIncomeStatementLoader().pipe(we({next:i=>{O(t,l=>v(f({},l),{loader:i,filter:v(f({},l.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:Ie(he(be(i=>m.getIncomeStatement(i).pipe(Rt(()=>O(t,l=>v(f({},l),{isLoading:!0}))),we({next:l=>{O(t,u=>v(f({},u),{data:l,isLoading:!1}))},error:l=>{console.error(l)}})))))};return n}),Je({onInit:t=>{t.getLoader()}}));var bt=()=>({}),Ct=t=>["/pages/chart-of-account/account/",t],St=()=>["/pages/report/general-ledger"],vt=(t,m,e)=>({id:t,from:m,to:e});function zi(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 qi(t,m){if(t&1&&(o(0,"div",8),g(1,zi,1,0,"p-button",9),r()),t&2){let e=c();p(),s("ngIf",e.roleService.global().export)}}function Hi(t,m){t&1&&(o(0,"tr")(1,"th",14),a(2,"Code"),r(),o(3,"th",15),a(4,"Name"),r(),o(5,"th",16),a(6,"Total"),r()())}function Wi(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",17),a(5),r()(),o(6,"td",16)(7,"a",18),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=_e(0),i=_e(1);p(2),x(e.code),p(2),s("routerLink",F(8,Ct,e.accountID)),p(),x(e.name),p(2),s("routerLink",L(10,St))("queryParams",je(11,vt,e.accountID,n,i)),p(),x(y(9,6,e.amount))}}function Ki(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),a(4,"Total Revenue :"),r(),o(5,"span",22),a(6),S(7,"number"),r()()()()),t&2){let e=c(3);p(6),x(y(7,1,e.store.totalRevenue()))}}function Ui(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No revenue records available"),r()()())}function $i(t,m){if(t&1&&(o(0,"h6",12),a(1,"Revenue"),r(),o(2,"p-table",13),g(3,Hi,7,0,"ng-template",null,3,_)(5,Wi,10,15,"ng-template",null,4,_)(7,Ki,8,3,"ng-template",null,5,_)(9,Ui,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 Yi(t,m){t&1&&(o(0,"tr")(1,"th",14),a(2,"Code"),r(),o(3,"th",15),a(4,"Name"),r(),o(5,"th",24),a(6,"Total"),r()())}function Xi(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",17),a(5),r()(),o(6,"td",16)(7,"a",18),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=_e(0),i=_e(1);p(2),x(e.code),p(2),s("routerLink",F(8,Ct,e.accountID)),p(),x(e.name),p(2),s("routerLink",L(10,St))("queryParams",je(11,vt,e.accountID,n,i)),p(),x(y(9,6,e.amount))}}function Ji(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),a(4,"Total COGS :"),r(),o(5,"span",22),a(6),S(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),a(12,"Gross Profit :"),r(),o(13,"span",22),a(14),S(15,"number"),r()()()()),t&2){let e=c(3);p(6),x(y(7,2,e.store.totalCOGS())),p(8),x(y(15,4,e.store.grossProfit()))}}function Qi(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No COGS records available"),r()()())}function Zi(t,m){if(t&1&&(o(0,"h4",12),a(1,"COGS"),r(),o(2,"p-table",13),g(3,Yi,7,0,"ng-template",null,3,_)(5,Xi,10,15,"ng-template",null,4,_)(7,Ji,16,6,"ng-template",null,5,_)(9,Qi,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 en(t,m){t&1&&(o(0,"tr")(1,"th",14),a(2,"Code"),r(),o(3,"th",15),a(4,"Name"),r(),o(5,"th",16),a(6,"Total"),r()())}function tn(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",17),a(5),r()(),o(6,"td",16)(7,"a",18),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;c(2);let n=_e(0),i=_e(1);p(2),x(e.code),p(2),s("routerLink",F(8,Ct,e.accountID)),p(),x(e.name),p(2),s("routerLink",L(10,St))("queryParams",je(11,vt,e.accountID,n,i)),p(),x(y(9,6,e.amount))}}function nn(t,m){if(t&1&&(o(0,"tr")(1,"td",19)(2,"div",20)(3,"span",21),a(4,"Total Expense :"),r(),o(5,"span",22),a(6),S(7,"number"),r()()()(),o(8,"tr")(9,"td",19)(10,"div",20)(11,"span",21),a(12,"Profit / Loss :"),r(),o(13,"span",22),a(14),S(15,"number"),r()()()()),t&2){let e=c(3);p(6),x(y(7,2,e.store.totalExpense())),p(8),x(y(15,4,e.store.profitOrLoss()))}}function on(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No expense records available"),r()()())}function rn(t,m){if(t&1&&(o(0,"h4",12),a(1,"Expense"),r(),o(2,"p-table",13),g(3,en,7,0,"ng-template",null,3,_)(5,tn,10,15,"ng-template",null,4,_)(7,nn,16,6,"ng-template",null,5,_)(9,on,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&&(Vt(0)(1),o(2,"p-panel")(3,"div",11),g(4,$i,11,1)(5,Zi,11,1)(6,rn,11,1),r()()),t&2){let e,n,i,l,u,d=c();mt((e=d.store.filter())!=null&&e.from?d.store.filter().from:null),p(),mt((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:L(5,bt)).length>0?4:-1),p(),M(d.Object.keys((l=(l=d.store.data().data)==null?null:l.cogs)!==null&&l!==void 0?l:L(6,bt)).length>0?5:-1),p(),M(d.Object.keys((u=(u=d.store.data().data)==null?null:u.expense)!==null&&u!==void 0?u:L(7,bt)).length>0?6:-1)}}function ln(t,m){if(t&1){let e=D();o(0,"form",25)(1,"div",26)(2,"label",27),a(3,"Outlet"),r(),w(4,"p-multiselect",28),r(),o(5,"div",26)(6,"label",27),a(7,"Cashier"),r(),o(8,"p-autocomplete",29),I("completeMethod",function(i){h(e);let l=c();return b(l.onCashierSearch(i))})("onSelect",function(i){h(e);let l=c();return b(l.onCashierSelect(i))}),r()(),o(9,"div",26)(10,"label",30),a(11,"From - To"),r(),o(12,"div",31),w(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 $t=(()=>{class t{constructor(){this.dayjsService=C(ce),this.store=C(ht),this.fb=C(ve),this.reportService=C(G),this.roleService=C(oe),this.isInitDialogFilterVisible=E(!1),this.dialogFilterVisible=E(!1),this.cashierSuggestions=E([]),this.cashierHashMap=new Map,this.Object=Object,fe(()=>{this.store.filter()&&this.initForm()})}ngOnInit(){this.initForm(),console.log(this.cashierHashMap.entries())}onSearch(e){this.store.updateFilter(v(f({},this.store.filter()),{Text:e}))}onCashierSearch(e){this.reportService.getCashierSuggestions(e.query).pipe(Ne("Cashier Suggestions"),V(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,[l,u])=>(l==="from"||l==="to"?u instanceof Date&&(i[l]=this.dayjsService.from(u).format()):i[l]=u||null,i),{});this.store.updateFilter(f(f({},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(f({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.reportService.getIncomeStatement(e,{responseType:"blob"}).pipe(Ne("Export Profit & Loss"),V(n=>{let i=n.type,l=[n],u=document.createElement("a");u.href=window.URL.createObjectURL(new Blob(l,{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([ht])],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 l=D();o(0,"app-main-panel",7),P("isDialogFilterVisibleChange",function(d){return h(l),B(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),b(d)})("isInitDialogFilterVisibleChange",function(d){return h(l),B(i.isInitDialogFilterVisible,d)||(i.isInitDialogFilterVisible=d),b(d)}),I("filterConfirmed",function(){return h(l),b(i.onFilterOK())}),g(1,qi,2,1,"ng-template",null,0,_)(3,an,7,8,"ng-template",null,1,_)(5,ln,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:[re,K,H,W,Te,pe,le,ee,J,Y,X,Q,Z,ue,de,ae,se,me,ne,$e,$,U,Re,De,ie,te],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var yt=Tt(Ht());var pn={metadata:{options:{outlets:[]},filter:{to:"",outletID:[]},roles:{isInRoleEmptyOutlet:!1}},data:{asset:[],liability:[],equity:[],pageTitle:""},filter:{date:(0,yt.default)().format("YYYY-MM-DD"),listOutletParam:[]}},Et=Ye(Ze(pn),Xe(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))})),Qe(t=>{let m=C(G),e={updateFilter:n=>{O(t,i=>v(f({},i),{filter:n}))},fetchBalanceSheet:Ie(he(Ae(()=>{let n=t.filter();return Object.entries(n).every(([i,l])=>l!=null&&l!=="")}),be(n=>m.getBalanceSheet(n).pipe(we({next:i=>{O(t,l=>v(f({},l),{data:i}))},error:i=>{console.error(i)}}))),Dt(1))),fetchLoader:Ie(he(be(()=>m.getBalanceSheetLoader().pipe(we({next:n=>{O(t,i=>v(f({},i),{metadata:n,filter:{date:(0,yt.default)(n.filter.to).format("YYYY-MM-DD")}})),e.fetchBalanceSheet(t.filter)},error:n=>{console.error(n)}})))))};return e}),Je(t=>({onInit:()=>{t.fetchLoader()}})));var Yt=Tt(Ht());var It=t=>["/pages/chart-of-account/account/",t],wt=()=>["/pages/report/general-ledger"],mn=(t,m)=>({id:t,to:m}),Xt=t=>({id:t});function sn(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 cn(t,m){if(t&1&&(o(0,"div",9),g(1,sn,1,0,"p-button",10),r()),t&2){let e=c();p(),s("ngIf",e.roleService.global().export)}}function dn(t,m){t&1&&(o(0,"tr")(1,"th",16),a(2,"Code"),r(),o(3,"th"),a(4,"Asset"),r(),o(5,"th",17),a(6,"Total"),r()())}function un(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",18),a(5),r()(),o(6,"td",19)(7,"a",20),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit,n=c(3);p(2),x(e.code),p(2),s("routerLink",F(8,It,e.accountID)),p(),x(e.name),p(2),s("routerLink",L(10,wt))("queryParams",Mt(11,mn,e.accountID,n.store.filter().date)),p(),x(y(9,6,e.amount))}}function _n(t,m){if(t&1&&(o(0,"tr")(1,"td",21),a(2,"Total Asset"),r(),o(3,"td",22),a(4),S(5,"number"),r()()),t&2){let e=c(3);p(4),T(" ",y(5,1,e.store.totalAsset())," ")}}function fn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No asset records found."),r()()())}function gn(t,m){if(t&1&&(o(0,"h4",14),a(1,"Asset"),r(),o(2,"p-table",15),g(3,dn,7,0,"ng-template",null,3,_)(5,un,10,14,"ng-template",null,4,_)(7,_n,6,3,"ng-template",null,5,_)(9,fn,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);p(2),s("value",e.store.data().asset)}}function xn(t,m){t&1&&(o(0,"tr")(1,"th",16),a(2,"Code"),r(),o(3,"th"),a(4,"Liability"),r(),o(5,"th",17),a(6,"Total"),r()())}function hn(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",25),a(5),r()(),o(6,"td",19)(7,"a",20),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;p(2),x(e.code),p(2),s("routerLink",F(8,It,e.accountID)),p(),x(e.name),p(2),s("routerLink",L(10,wt))("queryParams",F(11,Xt,e.accountID)),p(),x(y(9,6,e.counterAmount))}}function bn(t,m){if(t&1&&(o(0,"tr")(1,"td",21),a(2," Total Liability "),r(),o(3,"td",22),a(4),S(5,"number"),r()()),t&2){let e=c(3);p(4),T(" ",y(5,1,e.store.totalLiability())," ")}}function Cn(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No liability records found."),r()()())}function Sn(t,m){if(t&1&&(o(0,"h4",24),a(1,"Liability"),r(),o(2,"p-table",15),g(3,xn,7,0,"ng-template",null,3,_)(5,hn,10,13,"ng-template",null,4,_)(7,bn,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 vn(t,m){t&1&&(o(0,"tr")(1,"th",16),a(2,"Code"),r(),o(3,"th"),a(4,"Equity"),r(),o(5,"th",17),a(6,"Total"),r()())}function yn(t,m){if(t&1&&(o(0,"tr")(1,"td"),a(2),r(),o(3,"td")(4,"a",18),a(5),r()(),o(6,"td",19)(7,"a",20),a(8),S(9,"number"),r()()()),t&2){let e=m.$implicit;p(2),x(e.code),p(2),s("routerLink",F(8,It,e.accountID)),p(),x(e.name),p(2),s("routerLink",L(10,wt))("queryParams",F(11,Xt,e.accountID)),p(),x(y(9,6,e.counterAmount))}}function En(t,m){if(t&1&&(o(0,"tr")(1,"td",21),a(2,"Total Equity"),r(),o(3,"td",22),a(4),S(5,"number"),r()(),o(6,"tr")(7,"td",21),a(8," Total Liability + Equity "),r(),o(9,"td",22),a(10),S(11,"number"),r()()),t&2){let e=c(3);p(4),T(" ",y(5,2,e.store.totalEquity())," "),p(6),T(" ",y(11,4,e.store.totalLiability()+e.store.totalEquity())," ")}}function In(t,m){t&1&&(o(0,"tr")(1,"td",23)(2,"span"),a(3,"No equity records found."),r()()())}function wn(t,m){if(t&1&&(o(0,"h4",24),a(1,"Equity"),r(),o(2,"p-table",15),g(3,vn,7,0,"ng-template",null,3,_)(5,yn,10,13,"ng-template",null,4,_),a(7," <"),g(8,En,12,6,"ng-template",null,5,_)(10,In,4,0,"ng-template",null,6,_),r()),t&2){let e=c(2);p(2),s("value",e.store.data().equity)}}function Tn(t,m){if(t&1&&(o(0,"p-panel",12)(1,"div",13),g(2,gn,11,1)(3,Sn,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 Dn(t,m){if(t&1&&(o(0,"div",31)(1,"div"),a(2),r()()),t&2){let e=m.$implicit;p(2),x(e.value)}}function Rn(t,m){if(t&1&&(o(0,"form",26)(1,"div",27)(2,"label",28),a(3,"Outlet"),r(),o(4,"p-multiselect",29),g(5,Dn,3,1,"ng-template",null,7,_),r()(),o(7,"div",27)(8,"label",28),a(9,"From"),r(),w(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=C(Et),this.ReportServiceStore=C(G),this.dialogFilterVisible=E(!1),this.isInitDialogFilterVisible=E(!1),this.roleService=C(oe),this.Object=Object}ngOnInit(){this.generateFilterForm()}generateFilterForm(){this.filterForm=new Pt({date:new st(new Date),outletID:new st([])})}onFilterOKEvent(){let{date:e,outletID:n}=this.filterForm.value;this.store.updateFilter({date:(0,Yt.default)(e).format("YYYY-MM-DD"),listOutletParam:n}),this.dialogFilterVisible.update(i=>!i)}onExport(){let e=v(f({},this.store.filter()),{export:!0,ExportPageNumber:1,ExportPageSize:1e4});this.ReportServiceStore.getBalanceSheet(e,{responseType:"blob"}).pipe(Ne("Export Balance Sheet"),V(n=>{let i=n.type,l=[n],u=document.createElement("a");u.href=window.URL.createObjectURL(new Blob(l,{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([Et])],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 l=D();o(0,"app-main-panel",8),P("isDialogFilterVisibleChange",function(d){return h(l),B(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),b(d)})("isInitDialogFilterVisibleChange",function(d){return h(l),B(i.isInitDialogFilterVisible,d)||(i.isInitDialogFilterVisible=d),b(d)}),I("filterConfirmed",function(){return h(l),b(i.onFilterOKEvent())}),g(1,cn,2,1,"ng-template",null,0,_)(3,Tn,5,4,"ng-template",null,1,_)(5,Rn,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:[re,K,H,W,se,me,ae,ie,te,ee,J,Y,X,Q,Z,ue,de,pe,le,Ee,ne,$e,$,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"),a(1,"report-comparative-balance works!"),r(),a(2,`
2
+ ,
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"),a(1,"report-cash-flow works!"),r(),a(2,`
4
+ ,
5
+ `))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var ei=(()=>{class t{static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-trial-balance"]],decls:3,vars:0,template:function(n,i){n&1&&(o(0,"p"),a(1,"report-trial-balance works!"),r(),a(2,`
6
+ ,
7
+ `))},styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var Fn=()=>({width:"30vw"}),Ln=()=>({"1199px":"75vw","575px":"90vw"}),Vn=t=>["/pages/journal/journal-entry/",t],Mn=t=>({"text-success":t}),kn=t=>({"text-danger":t}),Nn=t=>({"ng-dirty ng-invalid":t}),Bn=()=>({scrollHeight:"250px"});function An(t,m){if(t&1){let e=D();o(0,"p-button",27),I("onClick",function(){h(e);let i=c(2);return b(i.onToggleExportDialog())}),r()}}function Gn(t,m){if(t&1&&(o(0,"div",24)(1,"a",25),a(2,"Return to Accounts"),r(),g(3,An,1,0,"p-button",26),r()),t&2){let e=c();p(3),s("ngIf",e.roleService.global().export)}}function Pn(t,m){if(t&1&&(o(0,"div",24)(1,"span",31)(2,"h2",32),a(3),r()(),o(4,"span",31)(5,"h2",32),a(6),r()()()),t&2){let e=c().$implicit;p(3),x(e.name),p(3),T(" (",e.chartOfAccountCode,") ")}}function On(t,m){t&1&&(o(0,"tr")(1,"th",33),a(2,"Outlet"),r(),o(3,"th",33),a(4,"No."),r(),o(5,"th",33),a(6,"Date"),r(),o(7,"th"),a(8,"Contact / Note"),r(),o(9,"th",34),a(10,"Debit"),r(),o(11,"th",35),a(12,"Credit"),r(),o(13,"th",35),a(14,"Balance"),r()())}function jn(t,m){if(t&1&&(o(0,"div",38),w(1,"div",43),o(2,"span",44),a(3),r()()),t&2){let e=c().$implicit;p(),s("innerHTML",e.journalNote,j),p(2),T("",e.note," ")}}function zn(t,m){if(t&1&&(o(0,"div",38),w(1,"span",43)(2,"div",43),o(3,"span",44),a(4),r()()),t&2){let e=c().$implicit;p(),s("innerHTML",e.referenceText,j),p(),s("innerHTML",e.journalNote,j),p(2),T("",e.note," ")}}function qn(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;p(),T(" ",y(2,1,e.debitAmount)," ")}}function Hn(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;p(),T(" ",y(2,1,e.creditAmount)," ")}}function Wn(t,m){if(t&1&&(z(0),a(1),S(2,"number"),q()),t&2){let e=c().$implicit;p(),T(" ",y(2,1,e.balance)," ")}}function Kn(t,m){if(t&1&&(o(0,"tr")(1,"td",36),a(2),r(),o(3,"td",36)(4,"a",37),a(5),r()(),o(6,"td",36),a(7),S(8,"date"),r(),o(9,"td",36)(10,"div",38)(11,"a",39),a(12),r(),g(13,jn,4,2,"div",38)(14,zn,5,3,"div",38),r()(),o(15,"td",40),g(16,qn,3,3,"ng-container",41),r(),o(17,"td",40),g(18,Hn,3,3,"ng-container",41),r(),o(19,"td",42),g(20,Wn,3,3,"ng-container",41),r()()),t&2){let e=m.$implicit,n=c(4);p(2),x(e.outletName),p(2),s("routerLink",F(15,Vn,e.id)),p(),x(e.number),p(2),x(ke(8,12,e.date,"dd MMM yyyy")),p(4),s("href",n.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.contactID,Ge),p(),x(e.contactName),p(),M(n.buildReferenceUrl(e)?13:14),p(2),s("ngClass",F(17,Mn,e.debitAmount!==0)),p(),s("ngIf",e.debitAmount!==0),p(),s("ngClass",F(19,kn,e.creditAmount!==0)),p(),s("ngIf",e.creditAmount!==0),p(2),s("ngIf",e.balance!==0)}}function Un(t,m){if(t&1&&(o(0,"tr"),w(1,"td",45),o(2,"td",46),a(3,"Total"),r(),o(4,"td",47),a(5),S(6,"number"),r(),o(7,"td",48),a(8),S(9,"number"),r(),w(10,"td"),r()),t&2){let e=c().$index,n=c(3);p(5),T(" ",y(6,2,n.items().data[e].debitTotal)," "),p(3),T(" ",y(9,4,n.items().data[e].creditTotal)," ")}}function $n(t,m){t&1&&(o(0,"tr")(1,"td",49)(2,"span"),a(3,"No records found."),r()()())}function Yn(t,m){if(t&1&&(o(0,"p-table",30),g(1,Pn,7,2,"ng-template",null,5,_)(3,On,15,0,"ng-template",null,6,_)(5,Kn,21,21,"ng-template",null,7,_)(7,Un,11,6,"ng-template",null,4,_)(9,$n,4,0,"ng-template",null,8,_),r()),t&2){let e=m.$implicit;s("value",e.data)}}function Xn(t,m){if(t&1&&(o(0,"div",29),Le(1,Yn,11,1,"p-table",30,Fe),r()),t&2){let e=c(2);p(),Ve(e.items().data)}}function Jn(t,m){if(t&1&&g(0,Xn,3,0,"div",28),t&2){let e=c();s("ngIf",e.items()&&e.items().data)}}function Qn(t,m){if(t&1&&(o(0,"div",24)(1,"div",31)(2,"span",65),a(3),r()(),o(4,"div")(5,"span"),a(6,"-"),r()(),o(7,"div",31)(8,"span",66),a(9),r()()()),t&2){let e=m.$implicit;p(3),T("(",e.code,")"),p(6),x(e.name)}}function Zn(t,m){if(t&1&&(o(0,"div",24)(1,"div",31)(2,"span",65),a(3),r()(),o(4,"div")(5,"span"),a(6,"-"),r()(),o(7,"div",31)(8,"span",66),a(9),r()()()),t&2){let e=m.$implicit;p(3),T("(",e.code,")"),p(6),x(e.name)}}function eo(t,m){t&1&&(o(0,"div",67),a(1," Account is required. "),r())}function to(t,m){if(t&1&&(o(0,"div",68)(1,"div"),a(2),r()()),t&2){let e=m.$implicit;p(2),x(e.value)}}function io(t,m){if(t&1&&(o(0,"div",59)(1,"div",21),w(2,"p-radiobutton",69),o(3,"label",70),a(4),r()()()),t&2){let e=m.$implicit;p(2),s("value",e.key)("inputId",e.key),p(),Lt("for",e.key),p(),x(e.value)}}function no(t,m){if(t&1){let e=D();o(0,"div",38)(1,"label",51),a(2,"Customer"),r(),o(3,"p-autocomplete",71),I("completeMethod",function(i){h(e);let l=c(2);return b(l.searchCustomer(i))}),r()()}if(t&2){let e=c(2);p(3),s("suggestions",e.customerSuggestions())}}function oo(t,m){if(t&1){let e=D();o(0,"div",38)(1,"label",51),a(2,"Supplier"),r(),o(3,"p-autocomplete",72),I("completeMethod",function(i){h(e);let l=c(2);return b(l.searchSupplier(i))}),r()()}if(t&2){let e=c(2);p(3),s("suggestions",e.supplierSuggestions())}}function ro(t,m){if(t&1){let e=D();o(0,"div",38)(1,"label",51),a(2,"Customer"),r(),o(3,"p-autocomplete",71),I("completeMethod",function(i){h(e);let l=c(2);return b(l.searchCustomer(i))}),r()()}if(t&2){let e=c(2);p(3),s("suggestions",e.customerSuggestions())}}function ao(t,m){if(t&1){let e=D();o(0,"form",50)(1,"div",38)(2,"label",51),a(3,"Accounts"),r(),o(4,"p-multiselect",52),I("onChange",function(i){h(e);let l=c();return b(l.onAccountChange(i))}),g(5,Qn,10,2,"ng-template",null,9,_)(7,Zn,10,2,"ng-template",null,10,_),r(),g(9,eo,2,0,"div",53),r(),o(10,"div",38)(11,"label",51),a(12,"From"),r(),o(13,"div",54),w(14,"p-datepicker",55)(15,"p-datepicker",56),r()(),o(16,"div",38)(17,"label",51),a(18,"Outlets"),r(),o(19,"p-multiselect",57),g(20,to,3,1,"ng-template",null,10,_),r()(),o(22,"div",38)(23,"label",51),a(24,"Category"),r(),o(25,"p-treeselect",58),I("onFocus",function(){h(e);let i=c();return b(i.onCategoryFocus())}),r()(),o(26,"div",38)(27,"label",18),a(28,"Contact Type"),r(),o(29,"div",16),Le(30,io,5,4,"div",59,Fe),r()(),o(32,"div",38)(33,"label",18),a(34,"Sort order"),r(),o(35,"div",16)(36,"div",59)(37,"div",21),w(38,"p-radiobutton",60),o(39,"label",61),a(40,"Asc"),r()()(),o(41,"div",62)(42,"div",21),w(43,"p-radiobutton",63),o(44,"label",64),a(45,"Desc"),r()()()()(),g(46,no,4,1,"div",38)(47,oo,4,1,"div",38)(48,ro,4,1,"div",38),r()}if(t&2){let e,n,i,l,u,d,k=c();s("formGroup",k.form),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",(e=k.loaderMetadata())==null||e.options==null?null:e.options.accounts)("selectionLimit",5)("ngClass",F(22,Nn,((n=k.form.get("listAccountID"))==null?null:n.invalid)&&(((n=k.form.get("listAccountID"))==null?null:n.touched)||((n=k.form.get("listAccountID"))==null?null:n.dirty)))),p(5),s("ngIf",((i=k.form.get("listAccountID"))==null?null:i.invalid)&&(((i=k.form.get("listAccountID"))==null?null:i.touched)||((i=k.form.get("listAccountID"))==null?null:i.dirty))),p(5),s("iconDisplay","input")("showIcon",!0),p(),s("iconDisplay","input")("showIcon",!0),p(4),s("virtualScroll",!0)("virtualScrollItemSize",50)("options",(l=k.loaderMetadata())==null||l.options==null?null:l.options.outlets),p(6),s("metaKeySelection",!1)("virtualScroll",!0)("virtualScrollItemSize",50)("virtualScrollOptions",L(24,Bn))("options",k.categoriesOptions()),p(5),Ve((u=k.loaderMetadata())==null||u.options==null?null:u.options.contactTypeOptions),p(8),s("value",!0),p(5),s("value",!1),p(3),M((d=k.form.controls.contactType.value)===1?46:d===2?47:48)}}function lo(t,m){if(t&1){let e=D();o(0,"p-button",73),I("onClick",function(){h(e);let i=c();return b(i.onToggleExportDialog())}),r()}t&2&&s("rounded",!0)("text",!0)}function po(t,m){if(t&1){let e=D();o(0,"p-button",74),I("click",function(){h(e);let i=c();return b(i.onToggleExportDialog())}),r(),o(1,"p-button",75),I("click",function(){h(e);let i=c();return b(i.onExport())}),r()}}var ti=(()=>{class t{buildReferenceUrl(e){return pt(e)}getGLCount(){this.reportService.getGLCount(this.filter()).pipe(V(({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=C(G),this.route=C(He),this.roleService=C(oe),this.authService=C(Se),this.fb=C(ve),this.coaService=C(ot),this.toastr=C(We),this.dayjsService=C(ce),this.infinity=1/0,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.pagination=R(()=>{let e=this.filter(),n=this.totalRecords()!=null&&this.totalRecords()>=0?this.totalRecords():1/0,i=Math.min(e.pageNumber*e.pageSize,isFinite(n)?n:e.pageNumber*e.pageSize);return{first:1,end:e.pageSize>0?i:0,total:n,page:e.pageNumber,pageSize:e.pageSize,hasPrev:e.pageNumber>1,hasNext:isFinite(n)?e.pageNumber*e.pageSize<n:!0}}),this.loaderMetadata=ye(this.reportService.fetchGeneralLedgerLoader("multiple"),{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.queryFilter=ye(this.route.queryParamMap.pipe(Be(e=>({accountID:e.get("id"),to:e.get("to")}))),{initialValue:null}),this.filter=R(()=>{let e=this.baseFilter(),n=this.queryFilter(),i=this.localFilter();return e?f(f(f({},e),n??{}),i):null}),this.creditSubTotal=R(()=>0),this.debitSubTotal=R(()=>0),this.initializeForm(),fe(()=>{let e=this.filter();if(e){this.form.patchValue(this.transformFilterToFormValue(e),{emitEvent:!1});let n=Array.isArray(e.listAccountID)?e.listAccountID:[],i=Array.isArray(e.listCategoryID)?e.listCategoryID:[];(n.length>0||i.length>0)&&this.reportService.fetchGeneralLedgerReport(e,"multiple").pipe().subscribe(l=>{this.items.set(l)})}})}initializeForm(){this.form=this.fb.group({accountID:this.fb.control(null),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),listCategoryID:this.fb.control([]),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 l=this.findNodeByKey(i.children,n);if(l)return l}}return null}transformFilterToFormValue(e){return Object.entries(e).reduce((n,[i,l])=>{switch(i){case"from":break;case"to":n[i]=l&&(typeof l=="string"||typeof l=="number"||l instanceof Date)?this.dayjsService.from(l)?.toDate():this.dayjsService.now.toDate();break;case"listCategoryID":Array.isArray(l)?n[i]=l.map(u=>this.findNodeByKey(this.categoriesOptions(),u)).filter(u=>!!u):n[i]=[];break;case"listOutletID":case"listAccountID":n[i]=Array.isArray(l)?l:[];break;case"pageNumber":case"pageSize":case"exportPageNumber":case"exportPageSize":n[i]=l!=null?Number(l):0;break;case"sortAscending":case"export":n[i]=!!l;break;case"contactType":console.log("contactType value:",l),n[i]=l!=null?Number(l):null;break;default:n[i]=l}return n},{})}clearContactValueOnContactTypeChange(){this.form.get("contactType")?.valueChanges.subscribe(()=>this.form.get("contactID")?.setValue(""))}onFormValueChange(){let e=this.form.controls.listAccountID.value,n=this.form.controls.listCategoryID.value;e.length<=0&&n.length<=0?(this.form.controls.listAccountID.enable({emitEvent:!1}),this.form.controls.listCategoryID.enable({emitEvent:!1})):e.length>0?(this.form.controls.listAccountID.enable({emitEvent:!1}),this.form.controls.listCategoryID.disable({emitEvent:!1})):n.length>0&&(this.form.controls.listAccountID.disable({emitEvent:!1}),this.form.controls.listCategoryID.enable({emitEvent:!1}))}isEmpty(e){return e==null||typeof e=="string"&&e.trim().length===0}onCategoryFocus(){this.coaService.getCachedCategoriesOptions().pipe(V(e=>this.categoriesOptions.set(e))).subscribe()}searchCustomer(e){this.reportService.getCustomerSuggestions(e.query).pipe(V(n=>this.customerSuggestions.set(n))).subscribe()}searchSupplier(e){this.reportService.getSupplierSuggestions(e.query).pipe(V(n=>this.supplierSuggestions.set(n))).subscribe()}onAccountChange(e){Array.isArray(e.value)&&e.value.length>5&&this.toastr.warning("Please select at most 5 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)}buildFilterBody(){let l=this.form.value,{from:e,to:n}=l,i=xe(l,["from","to"]);return v(f({},this.filter()),{pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,listCategoryID:i.listCategoryID?.map(u=>u.key)??[],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.exportMultiLedger(e,{responseType:"blob",observe:"response"}).pipe(V(n=>this.handleExportResponse(n))).subscribe()}handleExportResponse(e){let n=e.headers,i=n.get("Content-Disposition")??n.get("content-disposition"),l="download.csv";if(i){let d=i.match(/filename\*?=(?:UTF-8'')?"?([^;\r\n"]+)/i);d?.[1]&&(l=decodeURIComponent(d[1].replace(/"/g,"")))}let u=e.body;lt(u,l,u.type)}buildExportBody(){let l=this.form.value,{from:e,to:n}=l,i=xe(l,["from","to"]);return v(f({},this.filter()),{exportPageNumber:+i.exportPageNumber,pageNumber:i.pageNumber,pageSize:i.pageSize,sortAscending:i.sortAscending,accountID:i.accountID,listCategoryID:i.listCategoryID?.map(u=>u.key)??[],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(f({},e),{pageNumber:n+1})})}onPrevPage(){this.localFilter.update(e=>{let n=e.pageNumber??this.baseFilter()?.pageNumber??1;return v(f({},e),{pageNumber:Math.max(1,n-1)})})}goToPage(e){this.localFilter.update(n=>v(f({},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(l=>v(f({},l),{pageNumber:i}))}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=N({type:t,selectors:[["app-report-multiple-ledger"]],decls:28,vars:19,consts:[["actionButton",""],["content",""],["filters",""],["closeIconTemplate",""],["footer",""],["caption",""],["header",""],["body",""],["emptymessage",""],["selectedItem",""],["item",""],[3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","pageTitle","isDialogFilterVisible","isFilterable","isInitDialogFilterVisible","scrollable"],["header","Export Journal Entry",3,"visibleChange","modal","visible","breakpoints"],[1,"d-flex","flex-column","gap-3"],[1,"row",3,"formGroup"],[1,"col-8"],[1,"row"],[1,"col"],["for",""],["type","text","formControlName","exportPageNumber","fluid","","pInputText","","pSize","small"],["role","alert",1,"alert","alert-primary","m-0","p-2"],[1,"d-flex","align-items-center","gap-2"],[1,"fa-solid","fa-circle-info"],[1,"fs-2","text-dark","fw-semibold"],[1,"d-flex","gap-2"],["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,""],[1,"fs-5","fw-semibold"],[2,"width","10%"],[1,"text-end",2,"width","10%"],[1,"text-end",2,"width","20%"],[1,"text-break"],["target","_blank",1,"link","link-primary",3,"routerLink"],[1,"d-flex","flex-column"],["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"],["colspan","3"],[1,"text-end","fw-semibold"],[1,"text-end","fw-semibold","text-success"],[1,"text-end","fw-semibold","text-danger"],["colspan","8"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],["for","outlet"],["showClear","","filter","","filterBy","code,name","display","chip","formControlName","listAccountID","appendTo","body","optionLabel","name","optionValue","id","placeholder","Select Accounts",3,"onChange","virtualScroll","virtualScrollItemSize","options","selectionLimit","ngClass"],["class","text-danger",4,"ngIf"],[1,"d-flex","flex-column","gap-2"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon"],["showClear","","display","chip","formControlName","listOutletID","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select Outlets",3,"virtualScroll","virtualScrollItemSize","options"],["showClear","","display","chip","selectionMode","multiple","filter","","filterBy","label","formControlName","listCategoryID","appendTo","body","containerStyleClass","w-100","optionLabel","label","optionValue","key","placeholder","Select Category",3,"onFocus","metaKeySelection","virtualScroll","virtualScrollItemSize","virtualScrollOptions","options"],[1,"col-4"],["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,"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"],["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 l=D();o(0,"app-main-panel",11),P("isDialogFilterVisibleChange",function(d){return h(l),B(i.dialogFilterVisible,d)||(i.dialogFilterVisible=d),b(d)})("isInitDialogFilterVisibleChange",function(d){return h(l),B(i.initDialogVisible,d)||(i.initDialogVisible=d),b(d)}),I("filterConfirmed",function(){return h(l),b(i.onFilterOKEvent())}),g(1,Gn,4,1,"ng-template",null,0,_)(3,Jn,1,1,"ng-template",null,1,_)(5,ao,49,25,"ng-template",null,2,_),r(),o(7,"p-dialog",12),P("visibleChange",function(d){return h(l),B(i.isDialogExportVisible,d)||(i.isDialogExportVisible=d),b(d)}),o(8,"div",13)(9,"div",14)(10,"div",15)(11,"div",16)(12,"div",17)(13,"label",18),a(14,"Page"),r()(),o(15,"div",17),w(16,"input",19),r()()()(),o(17,"div",20)(18,"div",21),w(19,"i",22),o(20,"span",23),a(21),S(22,"number"),S(23,"number"),r()()()(),g(24,lo,1,2,"ng-template",null,3,_)(26,po,2,0,"ng-template",null,4,_),r()}if(n&2){let l;s("pageTitle",i.pageTitle),A("isDialogFilterVisible",i.dialogFilterVisible),s("isFilterable",!0),A("isInitDialogFilterVisible",i.initDialogVisible),s("scrollable",!0),p(7),Pe(L(17,Fn)),s("modal",!0),A("visible",i.isDialogExportVisible),s("breakpoints",L(18,Ln)),p(2),s("formGroup",i.form),p(12),Me("Exporting data from ",y(22,13,(l=i.filter())==null?null:l.exportPageNumber)," - ",y(23,15,(l=i.filter())==null?null:l.exportPageSize),"")}},dependencies:[re,K,ze,H,W,qe,ae,se,me,tt,et,ie,te,Te,pe,le,Re,De,ee,J,At,Y,X,Q,Z,ue,de,Ee,Ue,at,Wt,rt,ne,$,U,nt,it,Ke,Ot],styles:["[_nghost-%COMP%]{display:block} .p-datatable .p-datatable-header{padding-left:0!important}"],changeDetection:0})}}return t})();var el=[{path:"",redirectTo:"general-ledger",pathMatch:"full"},{path:"",children:[{path:"general-ledger",component:Ut},{path:"multiple-general-ledger",component:ti},{path:"profit-loss",component:$t},{path:"balance-sheet",component:Jt},{path:"comparative-balance",component:Qt},{path:"trial-balance",component:ei},{path:"cash-flow",component:Zt}]}];export{el as REPORTS_ROUTES};