dealposbooks 1.9.3 → 1.9.5

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 (148) hide show
  1. package/3rdpartylicenses.txt +422 -422
  2. package/assets/scss/components/_navbar.scss +2 -2
  3. package/assets/scss/layouts/_sidebar.scss +1 -2
  4. package/assets/scss/style.scss +40 -3
  5. package/assets/scss/variables/_variables.scss +0 -1
  6. package/{chunk-ZB6TB7JI.js → chunk-2JCKXI2B.js} +3 -3
  7. package/{chunk-OAD4GTH6.js → chunk-3DN7TZCI.js} +1 -1
  8. package/chunk-3HN62WAN.js +1 -0
  9. package/{chunk-4CUA33JH.js → chunk-4B5RFKWI.js} +1 -1
  10. package/chunk-4FGQ5T64.js +2 -0
  11. package/{chunk-7U2I35GP.js → chunk-4GL5YTWS.js} +1 -1
  12. package/chunk-4LFQJHJZ.js +1 -0
  13. package/{chunk-H4V6YZX2.js → chunk-4S33ZRKF.js} +1 -1
  14. package/chunk-4WYSO23S.js +1 -0
  15. package/{chunk-O2GA6PH7.js → chunk-5ROVFZR4.js} +1 -1
  16. package/chunk-5RUWTN5X.js +1 -0
  17. package/chunk-6JZPAN4G.js +1 -0
  18. package/chunk-6NDJPEK4.js +185 -0
  19. package/chunk-6OAGE44Z.js +7 -0
  20. package/chunk-7GHU4UQ7.js +430 -0
  21. package/chunk-7UBLUR5O.js +1 -0
  22. package/{chunk-V3B32QFK.js → chunk-7WXXPCRV.js} +1 -1
  23. package/chunk-7XDZM4MJ.js +1 -0
  24. package/chunk-AF77PUJO.js +1 -0
  25. package/chunk-ALX7UOMP.js +193 -0
  26. package/{chunk-JG5HGOEX.js → chunk-ANG5YF2J.js} +1 -1
  27. package/{chunk-WM3NKRKN.js → chunk-ANMMOPX7.js} +1 -1
  28. package/chunk-ARESU6CY.js +1 -0
  29. package/{chunk-LFDCJISD.js → chunk-ASK2IVMC.js} +1 -1
  30. package/chunk-AZM2EGTF.js +1 -0
  31. package/chunk-B7JILYJO.js +1 -0
  32. package/chunk-BYD3JK4R.js +2 -0
  33. package/chunk-CVMIZKGH.js +1 -0
  34. package/chunk-CVMP55UZ.js +188 -0
  35. package/chunk-CZMTQ4XK.js +1 -0
  36. package/chunk-DAV2SMOY.js +222 -0
  37. package/chunk-DC5OTEZ6.js +1 -0
  38. package/chunk-DCKLQNGL.js +1 -0
  39. package/chunk-F2FW6UDP.js +1 -0
  40. package/chunk-FBUI4SQJ.js +1 -0
  41. package/chunk-FFODCTQC.js +1 -0
  42. package/chunk-FIQFBEQK.js +1 -0
  43. package/chunk-FYQCFDW7.js +1 -0
  44. package/chunk-G2APSUOI.js +1 -0
  45. package/chunk-HAZ5H5ZV.js +1 -0
  46. package/{chunk-5AITWOQZ.js → chunk-HI7JDHS3.js} +1 -1
  47. package/chunk-HJPAXVNY.js +527 -0
  48. package/{chunk-33XUIS57.js → chunk-I3HFXOYS.js} +1 -1
  49. package/{chunk-PJKHUCJX.js → chunk-I7YFUZI7.js} +1 -1
  50. package/chunk-IIB2DZLA.js +1 -0
  51. package/chunk-IL7RZKFX.js +1 -0
  52. package/{chunk-OCIKQOWD.js → chunk-IPKPBYSN.js} +12 -12
  53. package/chunk-IPUUBC74.js +246 -0
  54. package/{chunk-TDDTBHQE.js → chunk-IZ2XPL4O.js} +1 -1
  55. package/{chunk-X4EHZEMZ.js → chunk-J2SK4PGN.js} +1 -1
  56. package/chunk-JGSRMMYX.js +1 -0
  57. package/chunk-JHCHHBCW.js +67 -0
  58. package/{chunk-ZPTNYW2S.js → chunk-JP3F2QND.js} +1 -1
  59. package/{chunk-ACQX2T2H.js → chunk-JQZRKOKE.js} +1 -1
  60. package/chunk-LYDUVWPM.js +397 -0
  61. package/chunk-MFMEPXFQ.js +1 -0
  62. package/{chunk-5QVQY32E.js → chunk-MP7S52YU.js} +1 -1
  63. package/chunk-NXCQN45H.js +1 -0
  64. package/{chunk-RANHETC3.js → chunk-O2G255P4.js} +2 -2
  65. package/{chunk-Q5BXN24W.js → chunk-ONPJXDDI.js} +2 -2
  66. package/chunk-OSFKXKXD.js +947 -0
  67. package/chunk-OVIHA23Z.js +201 -0
  68. package/chunk-P36L53XK.js +1 -0
  69. package/chunk-P5ZPLAYA.js +79 -0
  70. package/{chunk-SGXU6X3O.js → chunk-PGECEXRR.js} +1 -1
  71. package/chunk-PQTUFQME.js +129 -0
  72. package/{chunk-3ENMEUVK.js → chunk-PSDZXCOR.js} +1 -1
  73. package/chunk-Q7ITPAXT.js +1 -0
  74. package/chunk-RIOZSND3.js +1 -0
  75. package/chunk-RVTAI3J3.js +98 -0
  76. package/{chunk-3XLREP6U.js → chunk-RZRT24L6.js} +1 -1
  77. package/chunk-SJ5TWHWM.js +1 -0
  78. package/chunk-TCF45ELT.js +959 -0
  79. package/chunk-TYHNOILY.js +1 -0
  80. package/chunk-VEUXDYYI.js +1 -0
  81. package/chunk-VG23QNZF.js +231 -0
  82. package/{chunk-ZUALJ33O.js → chunk-VUPF5YJY.js} +1 -1
  83. package/chunk-VXSF6SQF.js +1 -0
  84. package/chunk-WSVAXPZZ.js +82 -0
  85. package/chunk-X3PB5IV5.js +1 -0
  86. package/chunk-XLUCH64S.js +449 -0
  87. package/chunk-YDBJGTTB.js +1 -0
  88. package/{chunk-7KQDKLO4.js → chunk-YLHU3GDJ.js} +2 -2
  89. package/chunk-YVEUYFCE.js +7 -0
  90. package/chunk-ZWHB7NI7.js +1 -0
  91. package/index.html +2 -2
  92. package/main-EJEYMG7N.js +1 -0
  93. package/package.json +1 -1
  94. package/{styles-7FHABE27.css → styles-AU7PIISM.css} +1 -1
  95. package/chunk-2US5D2LY.js +0 -1
  96. package/chunk-353U23ZQ.js +0 -1
  97. package/chunk-3B65XZ6E.js +0 -1
  98. package/chunk-3CEJ67I5.js +0 -1
  99. package/chunk-3E2EKFPH.js +0 -1
  100. package/chunk-3H5KBX4R.js +0 -1
  101. package/chunk-4NSHHAXV.js +0 -1
  102. package/chunk-6DPW74DP.js +0 -1
  103. package/chunk-6NCHCAKY.js +0 -300
  104. package/chunk-7G6KXHQB.js +0 -1
  105. package/chunk-7U2775BI.js +0 -1
  106. package/chunk-A47VRZZB.js +0 -1
  107. package/chunk-AG7353CN.js +0 -1
  108. package/chunk-AI6YS6T2.js +0 -1
  109. package/chunk-ANMXAMBL.js +0 -1
  110. package/chunk-ARSLNNKY.js +0 -7
  111. package/chunk-AT7II4DO.js +0 -7
  112. package/chunk-BCXNVGDH.js +0 -193
  113. package/chunk-BJNN42CI.js +0 -1
  114. package/chunk-CSQ4MHL2.js +0 -246
  115. package/chunk-DG6ETDOW.js +0 -1
  116. package/chunk-DIX7J6JH.js +0 -2
  117. package/chunk-DMVAXVYQ.js +0 -1
  118. package/chunk-DNSQSWOS.js +0 -2
  119. package/chunk-F3PEWQT7.js +0 -1
  120. package/chunk-FTVGAWDW.js +0 -1
  121. package/chunk-FUCSF42O.js +0 -2
  122. package/chunk-FXUC6M2U.js +0 -1
  123. package/chunk-GCGWIESO.js +0 -1
  124. package/chunk-GY53MWXH.js +0 -1660
  125. package/chunk-IHJLTHHQ.js +0 -1
  126. package/chunk-J6H3BBKP.js +0 -627
  127. package/chunk-LNRTAR2V.js +0 -1
  128. package/chunk-LWKS2JEV.js +0 -1
  129. package/chunk-N2XLL6HJ.js +0 -33
  130. package/chunk-NM37SDQJ.js +0 -1
  131. package/chunk-NN6GSTBJ.js +0 -1
  132. package/chunk-PRRU3DEZ.js +0 -503
  133. package/chunk-PZBZVQUY.js +0 -67
  134. package/chunk-Q2IWISMY.js +0 -1
  135. package/chunk-QIXIZZPY.js +0 -1
  136. package/chunk-RQEEJGOE.js +0 -1
  137. package/chunk-TNWHAKS6.js +0 -2
  138. package/chunk-TPGKCMVN.js +0 -1
  139. package/chunk-TYETQJ2X.js +0 -2
  140. package/chunk-U5LD55IP.js +0 -1
  141. package/chunk-U6SRN7P3.js +0 -1
  142. package/chunk-VBCJCAMN.js +0 -1
  143. package/chunk-W76GKZZU.js +0 -1
  144. package/chunk-WAJWW3TC.js +0 -960
  145. package/chunk-X5SV4H5B.js +0 -1
  146. package/chunk-YWYF6P7O.js +0 -1
  147. package/chunk-YYUWLV5N.js +0 -1
  148. package/main-L6WVDQUB.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as Le,b as $e,c as ze}from"./chunk-I7YFUZI7.js";import{a as je}from"./chunk-PSDZXCOR.js";import{a as Ue,b as We,c as qe,d as He,e as Ke,f as Qe}from"./chunk-5ROVFZR4.js";import"./chunk-MP7S52YU.js";import{a as Ve,b as Re}from"./chunk-4B5RFKWI.js";import{a as Fe,b as Te}from"./chunk-JHCHHBCW.js";import{a as Je,b as Pe,d as ke,k as Oe}from"./chunk-OSFKXKXD.js";import{b as we}from"./chunk-7GHU4UQ7.js";import"./chunk-P36L53XK.js";import{a as Ne}from"./chunk-B7JILYJO.js";import"./chunk-RVTAI3J3.js";import{a as De,b as Be}from"./chunk-DAV2SMOY.js";import"./chunk-P5ZPLAYA.js";import{a as Ge,b as Me}from"./chunk-CVMP55UZ.js";import"./chunk-7UBLUR5O.js";import"./chunk-AZM2EGTF.js";import"./chunk-HI7JDHS3.js";import"./chunk-JQZRKOKE.js";import{c as z,d as U}from"./chunk-ANG5YF2J.js";import{a as Ae,b as Z}from"./chunk-4GL5YTWS.js";import{h as w}from"./chunk-2JCKXI2B.js";import"./chunk-YLHU3GDJ.js";import"./chunk-4S33ZRKF.js";import"./chunk-4FGQ5T64.js";import{n as j,o as N,w as L,x as $}from"./chunk-TCF45ELT.js";import"./chunk-ZWHB7NI7.js";import{Ja as Ie,Na as Ee,b as J,c as ae,e as A,f as P,j as Se,m as k,n as X,o as ye,p as O,w as V,y as Y,z as R}from"./chunk-ALX7UOMP.js";import{a as he}from"./chunk-HAZ5H5ZV.js";import{a as be}from"./chunk-4LFQJHJZ.js";import"./chunk-F2X3VGZZ.js";import{F as Ce,M as xe,c as Q,f as _e,l as ve,m as T}from"./chunk-BYD3JK4R.js";import{Cb as d,Ga as B,Ic as oe,Jc as re,Kb as p,L as me,Lc as s,Nb as ue,Pb as ne,Qb as b,Sb as h,Tb as S,Ub as i,Vb as n,Wb as c,Z as D,_b as x,ba as pe,dc as y,ec as u,gb as a,ha as f,mb as ce,pa as v,pc as o,qa as C,qc as I,rc as ie,uc as se,vc as de,wb as E,wc as fe,xc as ge,yc as q,zc as F}from"./chunk-YVEUYFCE.js";import{a as H,b as K}from"./chunk-YQFG5XE2.js";var G=(()=>{class t{#e=f(he);fetchLoaderConfiguration(){return this.#e.get("","api/SetupLoader/Load")}updateAccountingIntegrationConfiguration(e){return this.#e.post(void 0,"/api/setup/SubmitConfig",e)}fetchOpeningBalanceFormConfiguration(){return this.#e.get("","/api/setup/OpeningBalance/Form")}submitOpeningBalanceFormConfiguration(e){return this.#e.post("","/api/setup/OpeningBalance/Submit",{form:e})}fetchAPICredential(){return this.#e.get(void 0,"/api/AccountConfig")}updateAPICredential(e){return this.#e.put(void 0,"/api/AccountConfig",e)}formatJournal(e){return this.#e.post("","/api/setup/formatdata/clearjournal",{domain:e})}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275prov=pe({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Ze=t=>({"active-state":t}),et=t=>({"text-white":t});function pt(t,l){if(t&1){let e=x();i(0,"div",4)(1,"a",5),o(2,"Cancel"),n(),i(3,"p-button",6),y("click",function(){v(e);let m=u();return C(m.updateAccountingIntegration())}),n()()}}function ct(t,l){if(t&1&&(i(0,"p-tab",9),o(1),n()),t&2){let e=l.$implicit,r=l.$index;p("value",r),a(),I(e)}}function ut(t,l){if(t&1&&(i(0,"div",40)(1,"h3",41),o(2," End Of Shift "),n()()),t&2){let e=u(4);p("ngClass",F(2,Ze,e.form.controls.posIntegration.value.createJournalTriggers===0)),a(),p("ngClass",F(4,et,e.form.controls.posIntegration.value.createJournalTriggers===0))}}function st(t,l){if(t&1&&(i(0,"div",40)(1,"h3",41),o(2," Every "),n()()),t&2){let e=u(4);p("ngClass",F(2,Ze,e.form.controls.posIntegration.value.createJournalTriggers===1)),a(),p("ngClass",F(4,et,e.form.controls.posIntegration.value.createJournalTriggers===1))}}function dt(t,l){if(t&1&&d(0,ut,3,6,"div",40)(1,st,3,6,"div",40),t&2){let e,r=u().$implicit;ne((e=r.key)===0?0:e===1?1:-1)}}function ft(t,l){t&1&&(i(0,"h4"),o(1,"Suitable for Cash Sales (Retail & FnB)"),n(),i(2,"p"),o(3," One Journal is generated for all transaction happening within a register open - close period "),n())}function gt(t,l){t&1&&(i(0,"h4"),o(1,"Every"),n(),i(2,"p"),o(3," Suitable for Credit Sales (Wholesale) Journal is generated for each transaction "),n())}function _t(t,l){if(t&1){let e=x();i(0,"div",14),c(1,"p-radiobutton",38),i(2,"p-card",39),y("click",function(){v(e);let m=u(2);return C(m.changeJournalType())}),d(3,dt,2,1,"ng-template",null,2,s)(5,ft,4,0)(6,gt,4,0),n()()}if(t&2){let e,r=l.$implicit;a(),p("inputId",r.value)("value",r.key),a(4),ne((e=r.key)===0?5:e===1?6:-1)}}function vt(t,l){if(t&1&&(i(0,"div",32),c(1,"p-radiobutton",42),i(2,"label",43),o(3),n()()),t&2){let e=l.$implicit;a(),p("value",e.key)("inputId",e.value),a(),p("for",e.value),a(),I(e.value)}}function Ct(t,l){if(t&1&&(i(0,"div",32),c(1,"p-radiobutton",44),i(2,"label",43),o(3),n()()),t&2){let e=l.$implicit;a(),p("value",e.key)("inputId",e.value),a(),p("for",e.value),a(),I(e.value)}}function xt(t,l){if(t&1&&(i(0,"div",32),c(1,"p-radiobutton",45),i(2,"label",43),o(3),n()()),t&2){let e=l.$implicit;a(),p("value",e.key)("inputId",e.value),a(),p("for",e.value),a(),I(e.value)}}function bt(t,l){if(t&1&&(i(0,"div",32),c(1,"p-radiobutton",46),i(2,"label",43),o(3),n()()),t&2){let e=l.$implicit;a(),p("value",e.key)("inputId",e.value),a(),p("for",e.value),a(),I(e.value)}}function ht(t,l){if(t&1&&(i(0,"div",7)(1,"p-tabs",8)(2,"p-tablist"),h(3,ct,2,2,"p-tab",9,b),n(),i(5,"p-tabpanels")(6,"p-tabpanel",9)(7,"h4",10),o(8,"Integration with POS"),n(),i(9,"p"),o(10,"Generate Journal"),n(),i(11,"div",11)(12,"div",12)(13,"div",13),h(14,_t,7,3,"div",14,b),n()()(),c(16,"hr"),i(17,"div",15)(18,"h3",10),o(19,"Journal Generate"),n(),i(20,"p"),o(21,"Configure generate transaction"),n(),i(22,"div",13)(23,"div",16)(24,"div",17)(25,"div",16)(26,"div",18)(27,"label",19),o(28,"Generate EOD Expense Journal"),n(),c(29,"p-toggleswitch",20),n()(),c(30,"div",16),i(31,"div",16)(32,"div",18)(33,"label",19),o(34,"Generate Outlet Delivery Journal"),n(),c(35,"p-toggleswitch",21),n()(),c(36,"div",16),i(37,"div",16)(38,"div",18)(39,"label",19),o(40,"Generate Payment Discount Journal On Payment"),n(),c(41,"p-toggleswitch",22),n()()()()()()(),i(42,"p-tabpanel",23)(43,"div",24)(44,"h3",10),o(45,"Accounting Numbering"),n(),i(46,"p"),o(47,"Configure numbering format and rule for your accounting"),n(),i(48,"div",13)(49,"div",16)(50,"div",17)(51,"div",16)(52,"div",18)(53,"label",25),o(54,"Digit"),n(),c(55,"p-inputnumber",26),n()(),c(56,"div",16),i(57,"div",16)(58,"div",18)(59,"label",27),o(60,"Seed"),n(),c(61,"p-inputnumber",28),n()(),i(62,"div",16)(63,"div",18)(64,"label",29),o(65,"Last Number"),n(),c(66,"p-inputnumber",30),n()(),i(67,"div",16)(68,"div",18)(69,"label",19),o(70,"Reset Every"),n(),i(71,"div",31),h(72,vt,4,4,"div",32,b),n()()(),i(74,"div",16)(75,"div",18)(76,"label",19),o(77,"Format"),n(),c(78,"p-select",33),n()()()()()()(),i(79,"p-tabpanel",34)(80,"div",24)(81,"h3",10),o(82,"Report"),n(),i(83,"p"),o(84,"Configure report behavior"),n(),i(85,"div",13)(86,"div",16)(87,"div",17)(88,"div",16)(89,"div",18)(90,"label",19),o(91,"Audit Journal Transaction"),n(),i(92,"div",31),h(93,Ct,4,4,"div",32,b),n()()(),c(95,"div",16),i(96,"div",16)(97,"div",18)(98,"label",19),o(99,"Accounting For Treatment"),n(),i(100,"div",31),h(101,xt,4,4,"div",32,b),n()()(),c(103,"div",16),i(104,"div",16)(105,"div",18)(106,"label",19),o(107,"Configure Report Access Control in COA"),n(),i(108,"div",31),h(109,bt,4,4,"div",32,b),n()()()()()()()(),i(111,"p-tabpanel",35)(112,"div",24)(113,"h3",10),o(114,"Note"),n(),i(115,"p"),o(116,"Configure show note"),n(),i(117,"div",13)(118,"div",16)(119,"div",17)(120,"div",16)(121,"div",18)(122,"label",19),o(123,"Note Required On Journal"),n(),c(124,"p-toggleswitch",36),n()(),c(125,"div",16),i(126,"div",16)(127,"div",18)(128,"label",19),o(129,"Trial Balance Footer Visible"),n(),c(130,"p-toggleswitch",37),n()(),c(131,"div",16),n()()()()()()()()),t&2){let e,r,m,_,W,M,g=u();a(),p("value",0)("formGroup",g.form),a(2),S(g.tabs()),a(3),p("value",0),a(8),S((e=g.accountingIntegration())==null||e.options==null?null:e.options.journalType),a(28),p("value",1),a(30),S((r=g.accountingIntegration())==null||r.options==null?null:r.options.resetPeriods),a(6),p("options",(m=g.accountingIntegration())==null||m.options==null?null:m.options.monthlyResetPeriodFormat),a(),p("value",2),a(14),S((_=g.accountingIntegration())==null||_.options==null?null:_.options.auditType),a(8),S((W=g.accountingIntegration())==null||W.options==null?null:W.options.generatePrepaidJournal),a(8),S((M=g.accountingIntegration())==null||M.options==null?null:M.options.entityAccess),a(2),p("value",3)}}var tt=(()=>{class t{constructor(){this.accountingSetupService=f(G),this.fb=f(V).nonNullable,this.tabs=B(["Pos","Numbering","Report","Note"]),this.journalType=B(0),this.accountingIntegration=B(null)}ngOnInit(){this.initializeForm(),this.loadAccountingConfiguration()}initializeForm(){this.form=this.fb.group({posIntegration:this.createPosIntegrationGroup(),number:this.createNumberGroup(),report:this.createReportGroup(),journalGenerate:this.createJournalGenerateGroup(),note:this.createNoteGroup()})}createPosIntegrationGroup(){return this.fb.group({createJournalTriggers:this.fb.control(0)})}createNumberGroup(){return this.fb.group({seed:this.fb.control(""),digit:this.fb.control(""),resetEvery:this.fb.control(""),monthlyFormat:this.fb.control(""),lastNumber:this.fb.control(""),lastModified:this.fb.control("")})}createReportGroup(){return this.fb.group({accountingAuditType:this.fb.control(""),accountingEntityAccess:this.fb.control(""),generatePrepaidJournal:this.fb.control("")})}createJournalGenerateGroup(){return this.fb.group({eodExpenseJournal:this.fb.control(""),transferOrder:this.fb.control(""),paymentDiscount:this.fb.control("")})}createNoteGroup(){return this.fb.group({noteMandatory:this.fb.control(""),trialBalanceFooterVisible:this.fb.control("")})}changeJournalType(){let e=this.journalType()===0?1:0;this.journalType.set(e),this.accountingIntegration.update(r=>K(H({},r),{form:K(H({},r.form),{posIntegration:K(H({},r.form.posIntegration),{createJournalTriggers:e})})})),this.form.controls.posIntegration.patchValue({createJournalTriggers:e})}loadAccountingConfiguration(){this.accountingSetupService.fetchLoaderConfiguration().pipe(D(e=>{this.accountingIntegration.set(e);let r=e.form.posIntegration.createJournalTriggers;this.journalType.set(r),this.form.get("posIntegration.createJournalTriggers")?.setValue(r),this.form.patchValue(e.form)})).subscribe()}updateAccountingIntegration(){let e={form:this.form.getRawValue()};this.accountingSetupService.updateAccountingIntegrationConfiguration(e).pipe().subscribe()}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-accounting-integration"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","Accounting Integration"],[1,"d-flex","gap-2"],["routerLink","..",1,"p-button","p-button-secondary","p-button-outlined"],["label","Submit",3,"click"],[1,"overflow-y-auto"],[1,"border-top",3,"value","formGroup"],[3,"value"],[1,"fs-5"],["formGroupName","posIntegration",1,"row"],[1,"col-8"],[1,"row"],[1,"col"],["formGroupName","journalGenerate",1,""],[1,"col-6"],[1,"row","row-gap-3"],[1,"d-flex","flex-column"],["for","",1,"fs-4"],["formControlName","eodExpenseJournal"],["formControlName","transferOrder"],["formControlName","paymentDiscount"],["formGroupName","number",3,"value"],[1,""],["for","digit",1,"fs-4"],["inputId","digit","formControlName","digit"],["for","seed",1,"fs-4"],["inputId","seed","formControlName","seed"],["for","lastNumber",1,"fs-4"],["inputId","lastNumber","formControlName","lastNumber"],[1,"d-flex","flex-column","gap-2"],[1,"d-flex","align-items-center","gap-2"],["appendTo","body","formControlName","monthlyFormat","optionValue","key","optionLabel","value",3,"options"],["formGroupName","report",3,"value"],["formGroupName","note",3,"value"],["formControlName","noteMandatory"],["formControlName","trialBalanceFooterVisible"],["styleClass","d-none","name","createJournalTriggers","formControlName","createJournalTriggers",3,"inputId","value"],["styleClass","h-100",3,"click"],[1,"d-flex","justify-content-center","inactive-state","text-white","py-2",3,"ngClass"],[1,"m-0",3,"ngClass"],["name","resetEvery","formControlName","resetEvery",3,"value","inputId"],[1,"ml-2","m-0",3,"for"],["name","accountingAuditType","formControlName","accountingAuditType",3,"value","inputId"],["name","generatePrepaidJournal","formControlName","generatePrepaidJournal",3,"value","inputId"],["name","accountingEntityAccess","formControlName","accountingEntityAccess",3,"value","inputId"]],template:function(r,m){r&1&&(i(0,"app-main-panel",3),d(1,pt,4,0,"ng-template",null,0,s)(3,ht,132,7,"ng-template",null,1,s),n())},dependencies:[T,Q,Qe,Ke,He,qe,Ue,We,w,Z,Ae,Pe,Je,R,A,P,k,O,X,N,Be,De,Re,Ve,xe,Ce,$,L,Me,Ge],styles:["[_nghost-%COMP%]{display:block}.inactive-state[_ngcontent-%COMP%]{background-color:#e5e5e5}.active-state[_ngcontent-%COMP%]{background-color:var(--p-primary-color)}"],changeDetection:0})}}return t})();var St=()=>({height:"calc(100vh - 150px)"}),yt=()=>[],nt=()=>({});function It(t,l){if(t&1){let e=x();i(0,"div")(1,"p-button",5),y("onClick",function(){v(e);let m=u();return C(m.submitForm())}),n()()}}function Et(t,l){t&1&&(i(0,"tr")(1,"th",16),o(2,"Account Name"),n(),i(3,"th",17),o(4,"Debit"),n(),i(5,"th",17),o(6,"Credit"),n()())}function Ft(t,l){if(t&1&&(i(0,"tr",9)(1,"td",18),o(2),n(),i(3,"td"),c(4,"input",19),n(),i(5,"td"),c(6,"input",20),n()()),t&2){let e,r=l.$implicit,m=l.rowIndex,_=u(4);p("formGroupName",m),a(2),ie(" ",(e=_.asFormGroup(r).get("accountName"))==null?null:e.value," "),a(2),p("autoNumeric",q(4,nt)),a(2),p("autoNumeric",q(5,nt))}}function Tt(t,l){if(t&1&&(i(0,"div",9)(1,"h4",11),o(2),n(),i(3,"div",12)(4,"p-table",13),d(5,Et,7,0,"ng-template",14)(6,Ft,7,6,"ng-template",15),n()()()),t&2){let e=l.$implicit,r=l.$index,m=u(3);p("formGroupName",r),a(2),ie(" ",e.get("name").value," "),a(2),p("value",m.getItemsArray(m.asFormGroup(e)).controls)}}function At(t,l){if(t&1&&(i(0,"tr")(1,"td")(2,"p",21),o(3,"Total"),n()(),i(4,"td",22)(5,"p",21),o(6),oe(7,"number"),n()(),i(8,"td",22)(9,"p",21),o(10),oe(11,"number"),n()()()),t&2){let e=u(3);a(6),I(re(7,2,e.subtotalDebit)),a(4),I(re(11,4,e.subtotalCredit))}}function Nt(t,l){if(t&1&&(i(0,"p-panel",7)(1,"p-scroll-panel")(2,"div",8),h(3,Tt,7,3,"div",9,b),n()(),i(5,"p-table",10),d(6,At,12,6,"ng-template",null,2,s),n()()),t&2){let e=u(2);p("formGroup",e.formGroups),a(),ue(q(4,St)),a(2),S(e.formsArray.controls),a(2),p("value",q(5,yt))}}function wt(t,l){if(t&1&&d(0,Nt,8,6,"p-panel",6),t&2){let e=u();p("ngIf",e.formGroups)}}var rt=(()=>{class t{constructor(){this.subtotalDebit=0,this.subtotalCredit=0,this.fb=f(V),this.accSetupService=f(G)}ngOnInit(){this.initializeForm(),this.loadFormData(),this.calculateSubtotalDebit(),this.formGroups.get("forms").valueChanges.pipe(me(300)).subscribe(()=>{this.calculateSubtotalDebit()})}initializeForm(){this.formGroups=this.fb.group({forms:this.fb.array([])})}get formsArray(){return this.formGroups.get("forms")}getItemsArray(e){return e.get("items")}asFormGroup(e){return e}createFormGroup(e){return this.fb.group({id:[e.id],name:[e.name],items:this.createItemsArray(e.items)})}createItemsArray(e){let r=e.map(m=>this.createItemGroup(m));return this.fb.array(r)}createItemGroup(e){return this.fb.group({accountName:[e.accountName],accountCode:[e.accountCode],id:[e.id],journalID:[e.journalID],accountID:[e.accountID],debitAmount:[e.debitAmount],creditAmount:[e.creditAmount],index:[e.index],note:[e.note]})}loadFormData(){this.accSetupService.fetchOpeningBalanceFormConfiguration().pipe(Ne("response"),D(e=>{for(;this.formsArray.length>0;)this.formsArray.removeAt(0);e.form.filter(m=>m.items&&m.items.length>0).forEach(m=>{this.formsArray.push(this.createFormGroup(m))})})).subscribe({error:e=>console.error("Error loading form data:",e)})}calculateSubtotalDebit(){let e=this.formGroups.controls.forms;this.subtotalDebit=0,this.subtotalCredit=0,e.controls.forEach(r=>{let m=this.getItemsArray(r),_=m.controls.reduce((M,g)=>{let te=g.get("debitAmount").value||0;return M+te},0),W=m.controls.reduce((M,g)=>{let te=g.get("creditAmount").value||0;return M+te},0);this.subtotalDebit+=_,this.subtotalCredit+=W})}submitForm(){let e=this.formGroups.value.forms;this.accSetupService.submitOpeningBalanceFormConfiguration(e).subscribe(),console.log("Submitting form data:",e)}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-acc-opening-balance-form"]],features:[ge([Ie])],decls:6,vars:0,consts:[["actionButton",""],["content",""],["footer",""],["pageTitle","Opening Balance Form"],["preventOpenDuplicates",""],["label","Submit",3,"onClick"],[3,"formGroup",4,"ngIf"],[3,"formGroup"],["formArrayName","forms",1,"d-flex","flex-column","row-gap-4"],[3,"formGroupName"],[3,"value"],[1,"fs-5"],["formArrayName","items"],["dataKey","id",3,"value"],["pTemplate","header"],["pTemplate","body"],[1,"fs-4"],[1,"fs-4",2,"width","200px"],[1,"fs-3"],["pInputText","","formControlName","debitAmount",1,"fs-3",3,"autoNumeric"],["pInputText","","formControlName","creditAmount",1,"fs-3",3,"autoNumeric"],[1,"fw-semibold","fs-4"],[1,"text-end",2,"width","200px"]],template:function(r,m){r&1&&(i(0,"app-main-panel",3),d(1,It,2,0,"ng-template",null,0,s)(3,wt,1,1,"ng-template",null,1,s),n(),c(5,"p-toast",4))},dependencies:[w,Z,Ee,T,_e,ve,we,Oe,ke,Te,Fe,Y,J,A,P,N,j,ze,$,L,U,z,je,R,k,O,X,ye],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var at=t=>({"ng-invalid ng-dirty":t});function Gt(t,l){if(t&1){let e=x();i(0,"p-button",4),y("onClick",function(){v(e);let m=u();return C(m.saveCredentials())}),o(1,"Update"),n()}}function Mt(t,l){t&1&&(i(0,"div",12)(1,"h3",13),o(2,"Account"),n(),i(3,"small",14),o(4,"Configure Client ID and Client Secret"),n()())}function Dt(t,l){if(t&1&&(i(0,"div",5)(1,"p-panel"),d(2,Mt,5,0,"ng-template",null,2,s),i(4,"div",6)(5,"div",7)(6,"div",8)(7,"label",9),o(8,"Client ID"),n(),c(9,"input",10),n()(),i(10,"div",7)(11,"div",8)(12,"label",9),o(13,"Client Secret"),n(),c(14,"input",11),n()()()()()),t&2){let e=u();a(4),p("formGroup",e.credentialForm),a(5),p("ngClass",F(3,at,e.clientIDControl.invalid&&e.clientIDControl.dirty||e.clientIDControl.touched)),a(5),p("ngClass",F(5,at,e.clientSecretControl.invalid&&e.clientSecretControl.dirty||e.clientSecretControl.touched))}}var lt=(()=>{class t{constructor(e){this.fb=e,this.setupService=f(G)}ngOnInit(){this.initForm(),this.setupService.fetchAPICredential().pipe(D(e=>{this.credentialForm.patchValue({clientID:e.clientID||"",clientSecret:e.clientSecret||""})})).subscribe()}initForm(){this.credentialForm=this.fb.group({clientID:["",[ae.required]],clientSecret:["",[ae.required]]})}get clientIDControl(){return this.credentialForm.get("clientID")}get clientSecretControl(){return this.credentialForm.get("clientSecret")}saveCredentials(){if(this.credentialForm.invalid){this.credentialForm.markAllAsTouched();return}let e=this.credentialForm.getRawValue();console.log("Saving credentials:",e),this.setupService.updateAPICredential(e).subscribe()}static{this.\u0275fac=function(r){return new(r||t)(ce(V))}}static{this.\u0275cmp=E({type:t,selectors:[["app-api-credential"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","API Credential"],[3,"onClick"],[1,"d-flex","flex-column","row-gap-4"],[1,"row",3,"formGroup"],[1,"col-6"],[1,"d-flex","flex-column"],["for","outlet"],["type","text","pInputText","","formControlName","clientID",3,"ngClass"],["type","text","pInputText","","formControlName","clientSecret",3,"ngClass"],[1,"d-flex","flex-column","px-2"],[1,"mb-0","fw-bold"],[1,"fst-italic","text-muted"]],template:function(r,m){r&1&&(i(0,"app-main-panel",3),d(1,Gt,2,0,"ng-template",null,0,s)(3,Dt,15,7,"ng-template",null,1,s),n())},dependencies:[T,Q,R,J,A,P,k,O,N,j,U,z,w,$,L],encapsulation:2})}}return t})();function Bt(t,l){if(t&1){let e=x();i(0,"button",4),y("click",function(){v(e);let m=u();return C(m.onFormatJournal())}),o(1," Format "),n()}}function Jt(t,l){t&1&&(i(0,"div",12)(1,"h4",13),o(2,"Journal Configuration"),n(),i(3,"small",14),o(4," Enter your account information to format journal entries "),n()())}function Pt(t,l){if(t&1){let e=x();i(0,"div",5)(1,"p-panel"),d(2,Jt,5,0,"ng-template",null,2,s),i(4,"div",6)(5,"div",7)(6,"p-floatlabel",8)(7,"input",9),fe("ngModelChange",function(m){v(e);let _=u();return de(_.subdomain,m)||(_.subdomain=m),C(m)}),n(),i(8,"label",10),o(9,"Subdomain"),n()(),i(10,"small",11),o(11,"Enter your account subdomain (e.g., mycompany.dealpos.net)"),n()()()()()}if(t&2){let e=u();a(7),se("ngModel",e.subdomain)}}var mt=(()=>{class t{constructor(){this.setupService=f(G),this.subdomain=B(""),this.toastrService=f(be)}onFormatJournal(){if(!this.subdomain()){this.toastrService.error("Please enter a subdomain","Error");return}this.setupService.formatJournal(this.subdomain()).subscribe({next:e=>{this.toastrService.success(e.message,"Success")}})}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=E({type:t,selectors:[["app-format-jurnal"]],decls:5,vars:0,consts:[["actionButton",""],["content",""],["header",""],["pageTitle","Format Journal"],[1,"btn","btn-success","rounded",3,"click"],[1,"d-flex","flex-column","row-gap-4"],[1,"row","mt-6"],[1,"col-12"],["variant","on"],["pInputText","","id","subdomain","autocomplete","off",1,"w-100",3,"ngModelChange","ngModel"],["for","subdomain"],[1,"text-muted","fst-italic",2,"font-size","12px"],[1,"d-flex","flex-column"],[1,"mb-1","fw-bold"],[1,"fst-italic","text-muted"]],template:function(r,m){r&1&&(i(0,"app-main-panel",3),d(1,Bt,2,0,"ng-template",null,0,s)(3,Pt,12,1,"ng-template",null,1,s),n())},dependencies:[T,Y,J,A,Se,N,j,w,U,z,$e,Le],encapsulation:2})}}return t})();var ci=[{path:"",redirectTo:"accounting-integration",pathMatch:"full"},{path:"",children:[{path:"accounting-integration",component:tt},{path:"opening-balance-form",component:rt},{path:"api-crendetial",component:lt},{path:"format-journal",component:mt}]}];export{ci as ACCOUNTING_SETUP_ROUTES};
@@ -0,0 +1 @@
1
+ var l=class{isValid(e){let r=this.getControl(e);return r?!r.invalid||!(r.dirty||r.touched):!1}isInvalid(e){let r=this.getControl(e);return r?r.invalid&&(r.dirty||r.touched):!1}getErrors(e,r={}){let t=this.getControl(e);return!t||!this.isInvalid(e)?null:this.processErrors(t,r)}getControl(e){if(!this.form)return console.warn("Form is not initialized"),null;let r=this.form.get(e);return r||(console.warn(`Control '${e}' not found in form`),null)}processErrors(e,r){if(!e.errors)return null;let t=[];for(let[n,i]of Object.entries(e.errors)){if(r[n]){t.push(typeof r[n]=="function"?r[n](i):r[n]);continue}let s=this.getDefaultErrorMessage(n,i);s&&t.push(s)}return t.length>0?t:null}getDefaultErrorMessage(e,r){switch(e){case"required":return"This field is required.";case"minlength":return`Minimum length is ${r.requiredLength} characters.`;case"maxlength":return`Maximum length is ${r.requiredLength} characters.`;case"email":return"Please enter a valid email address.";case"pattern":return"The format is invalid.";case"min":return`Minimum value is ${r.min}.`;case"max":return`Maximum value is ${r.max}.`;default:return null}}};export{l as a};
@@ -0,0 +1 @@
1
+ import{a as v,b as L}from"./chunk-Q7ITPAXT.js";import"./chunk-IZ2XPL4O.js";import{a as I,b as E}from"./chunk-JHCHHBCW.js";import{c as R,d as D}from"./chunk-ANG5YF2J.js";import"./chunk-4GL5YTWS.js";import{h as H}from"./chunk-2JCKXI2B.js";import{b as N,c as G}from"./chunk-YLHU3GDJ.js";import"./chunk-4S33ZRKF.js";import"./chunk-4FGQ5T64.js";import{w as V,x as j}from"./chunk-TCF45ELT.js";import"./chunk-ZWHB7NI7.js";import"./chunk-ALX7UOMP.js";import"./chunk-HAZ5H5ZV.js";import{a as F}from"./chunk-4LFQJHJZ.js";import"./chunk-F2X3VGZZ.js";import{i as w,m as $}from"./chunk-BYD3JK4R.js";import{Cb as B,Ic as s,Jc as l,Kb as p,Lc as x,Nb as C,Ub as o,V as M,Vb as n,Wb as m,X as y,Z as S,_b as P,dc as h,ec as c,gb as a,h as T,ha as f,pa as g,qa as d,ra as b,s as u,sa as k,wb as A,xc as O,yc as _}from"./chunk-YVEUYFCE.js";import"./chunk-YQFG5XE2.js";var q=()=>({height:"calc(100vh - 100px)"});function J(i,z){if(i&1){let t=P();o(0,"div",3)(1,"p-button",4),h("onClick",function(){g(t);let r=c();return d(r.onFormatCOA())}),n(),o(2,"p-button",5),s(3,"async"),s(4,"async"),h("onClick",function(){g(t);let r=c();return d(r.onMigrateCoaAccount())}),n()()}if(i&2){let t=c();a(2),p("disabled",l(3,2,t.countInBooks$)!==0)("pTooltip",l(4,4,t.countInBooks$)!==0?"Books already has entries. Please format before re-migrating.":null)}}function K(i,z){if(i&1&&(o(0,"p-scroll-panel")(1,"p-panel")(2,"div",6),m(3,"app-migration-cards",7),s(4,"async"),b(),o(5,"svg",8),m(6,"path",9),n(),k(),m(7,"app-migration-cards",10),s(8,"async"),n()()()),i&2){let t=c();C(_(12,q)),a(),C(_(13,q)),a(2),p("migrationCount",l(4,8,t.countInPOS$))("migrationTitle",t.pageTitle),a(4),p("migrationCount",l(8,10,t.countInBooks$))("migrationTitle",t.pageTitle)}}var gt=(()=>{class i{constructor(){this.migrateService=f(v),this.toastr=f(F),this.refresh$=new T(void 0),this.pageTitle="Chart of Account"}ngOnInit(){let t=this.refresh$.pipe(y(()=>this.migrateService.getCOACount()),S(e=>console.log("API response:",e)),M(1));this.countInPOS$=t.pipe(u(e=>Number(e.pos))),this.countInBooks$=t.pipe(u(e=>Number(e.books)))}onMigrateCoaAccount(){this.migrateService.migrateCoaAccount().subscribe(t=>{this.refresh$.next(),this.toastr.success(t.message,"Migration Successful")})}onFormatCOA(){this.migrateService.formatManualCOA().subscribe(t=>{this.refresh$.next(),this.toastr.success(t.message,"Format Successful")})}static{this.\u0275fac=function(e){return new(e||i)}}static{this.\u0275cmp=A({type:i,selectors:[["app-chart-of-account"]],features:[O([v])],decls:5,vars:1,consts:[["actionButton",""],["content",""],[3,"pageTitle"],[1,"d-flex","gap-2"],["label","Format","severity","danger",3,"onClick"],["label","Migrate","tooltipPosition","left",3,"onClick","disabled","pTooltip"],[1,"flex","gap-30","flex-wrap",2,"display","flex","justify-content","center","align-items","center","gap","1rem","margin-top","40px"],["migrationPlace","Accounting",3,"migrationCount","migrationTitle"],["width","40","height","40","viewBox","0 0 24 24","fill","none"],["d","M8 5l8 7-8 7","stroke","#007bff","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["migrationPlace","Books",3,"migrationCount","migrationTitle"]],template:function(e,r){e&1&&(o(0,"app-main-panel",2),B(1,J,5,6,"ng-template",null,0,x)(3,K,9,14,"ng-template",null,1,x),n()),e&2&&p("pageTitle",r.pageTitle)},dependencies:[H,$,w,L,j,V,E,I,D,R,G,N],encapsulation:2})}}return i})();export{gt as ChartOfAccountComponent};
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-HAZ5H5ZV.js";import{ba as o,ha as n,i as c}from"./chunk-YVEUYFCE.js";import{a as i}from"./chunk-YQFG5XE2.js";var C=(()=>{class r{constructor(){this.httpService=n(a),this.categoryOptionsCache$=new c(1),this.isInitialized=!1}getChartOfAccountLoader(){return this.httpService.get("","api/ChartOfAccountLoader")}getPaginatedChartAccounts(t){let e=i({},t);return this.httpService.post("","api/ChartOfAccount/GetPaginatedList",e)}getChartAccountForm(){return this.httpService.get("","api/ChartOfAccount/Form")}getChartAccountById(t){return this.httpService.get("",`api/ChartOfAccount/Info/${t}`)}getChartAccountFormById(t){return this.httpService.get("",`api/ChartOfAccount/Form/${t}`)}submitChartAccount(t,e={}){return this.httpService.post("","api/ChartOfAccount/Submit",t,e)}deleteChartAccount(t){if(t.length>1){let e={body:t};return this.httpService.delete("","api/ChartOfAccount/Batch",e)}else return this.httpService.delete("",`api/ChartOfAccount/${t[0]}`)}fetchCategoryOptions(){return this.httpService.get("","api/ChartOfAccount/CategoryOptions")}getCachedCategoriesOptions(){return this.isInitialized||(this.isInitialized=!0,this.fetchCategoryOptions().subscribe({next:t=>this.categoryOptionsCache$.next(t),error:t=>this.categoryOptionsCache$.error(t)})),this.categoryOptionsCache$.asObservable()}exportChartOfAccounts(t){return this.httpService.post(void 0,"api/ChartOfAccountExport/export",t,{responseType:"blob"})}importPreviewChartOfAccounts(t){return this.httpService.post(void 0,"api/chartofaccount/importpreview",t)}importConfirmChartOfAccounts(t){return this.httpService.post(void 0,"api/chartofaccount/importconfirm",t)}discountedChartAccounts(t,e){return this.httpService.put(void 0,`/api/ChartOfAccount/${t}/discontinued`,e)}static{this.\u0275fac=function(e){return new(e||r)}}static{this.\u0275prov=o({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();export{C as a};
@@ -0,0 +1 @@
1
+ import{a as u}from"./chunk-CVMIZKGH.js";import{E as i}from"./chunk-BYD3JK4R.js";import{ha as e}from"./chunk-YVEUYFCE.js";var d=(t,r)=>{let o=e(u),a=e(i);return console.log("Auth Guard activated",t),console.log("Auth Guard activated",r),!o.isAuthenticated()||o.isTokenExpired()?(console.warn("User is not authenticated or token is expired",t,r),a.navigate(["/"],{queryParams:{returnUrl:r.url}}),!1):!0};export{d as a};
@@ -0,0 +1 @@
1
+ import{a as F}from"./chunk-4WYSO23S.js";import{a as Oe}from"./chunk-DCKLQNGL.js";import{a as He,b as Be}from"./chunk-RZRT24L6.js";import{b as D}from"./chunk-IZ2XPL4O.js";import{a as je}from"./chunk-PSDZXCOR.js";import{a as ae}from"./chunk-CVMIZKGH.js";import"./chunk-VUPF5YJY.js";import"./chunk-MP7S52YU.js";import{a as j,b as H}from"./chunk-JP3F2QND.js";import{d as ke,i as Pe,j as Me,k as ze}from"./chunk-OSFKXKXD.js";import{a as Fe,b as Je}from"./chunk-7GHU4UQ7.js";import"./chunk-P36L53XK.js";import"./chunk-RVTAI3J3.js";import{a as Re,b as Ne}from"./chunk-DAV2SMOY.js";import"./chunk-P5ZPLAYA.js";import"./chunk-CVMP55UZ.js";import"./chunk-7UBLUR5O.js";import"./chunk-AZM2EGTF.js";import"./chunk-HI7JDHS3.js";import"./chunk-JQZRKOKE.js";import{c as Se,d as be}from"./chunk-ANG5YF2J.js";import{g as Ae,h as De}from"./chunk-2JCKXI2B.js";import{b as Te,c as Ve}from"./chunk-YLHU3GDJ.js";import{a as w,b as ve,c as we,d as ye,e as Ee,f as Ie}from"./chunk-4S33ZRKF.js";import"./chunk-4FGQ5T64.js";import{n as ge,o as he,w as xe,x as Ce}from"./chunk-TCF45ELT.js";import"./chunk-ZWHB7NI7.js";import{b as le,c as pe,e as me,f as se,k as ce,m as ue,p as de,w as fe,z as _e}from"./chunk-ALX7UOMP.js";import"./chunk-HAZ5H5ZV.js";import"./chunk-4LFQJHJZ.js";import"./chunk-F2X3VGZZ.js";import{c as ee,e as te,f as ie,i as ne,k as oe,m as re}from"./chunk-BYD3JK4R.js";import{Ab as W,Cb as x,Ga as k,Ic as I,Jc as Z,Kb as c,Kc as A,Lc as v,Nb as $,Ub as r,Vb as o,Wb as S,X as N,Xc as T,Z as U,_b as y,bb as L,c as J,cb as G,dc as E,ec as _,gb as l,ha as C,pa as g,pc as s,qa as h,qc as b,rc as P,s as R,tc as q,uc as Q,vc as M,wb as K,wc as X,xc as Y,yc as z,zc as V}from"./chunk-YVEUYFCE.js";import{a as u,b as f}from"./chunk-YQFG5XE2.js";var qe={data:{data:[],totalCount:0},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4,paymentState:0}}},B=ve(Ie(qe),we(t=>({first:T(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:T(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:T(()=>t.data().data.some(a=>a.checked)),checkedAPCollection:T(()=>t.data().data.filter(a=>a.checked).map(a=>a.id))})),Ee(t=>{let a=C(F),e=C(D);return{updateFilter(n){w(t,i=>f(u({},i),{filter:u(u({},i.filter),n)}))},onRowSelect(n){w(t,i=>{let d=i.data.data.map(m=>m.id===n.id?f(u({},m),{checked:!0}):m);return f(u({},i),{data:f(u({},i.data),{data:d})})})},onRowUnselect(n){w(t,i=>{let d=i.data.data.map(m=>m.id===n.id?f(u({},m),{checked:!1}):m);return f(u({},i),{data:f(u({},i.data),{data:d})})})},onHeaderCheckboxToggle(n){w(t,i=>{let d=i.data.data.map(m=>f(u({},m),{checked:n}));return f(u({},i),{data:f(u({},i.data),{data:d})})})},getAPLoader:j(J(N(()=>a.getAPJournalLoader().pipe(H({next:n=>{w(t,i=>f(u({},i),{meta:n}))},error:n=>{console.error("Error fetching AP journal:",n)}}))))),getARCollection:j(J(R(n=>Object.entries(n).reduce((i,[d,m])=>(m!=null&&(i[d]=m),i),{})),N(n=>a.getAPJournal(n).pipe(R(i=>f(u({},i),{data:i.data.map(d=>f(u({},d),{due:e.from(d.due)?e.from(d.due).format():null,checked:!1}))})),H({next:i=>{w(t,d=>f(u({},d),{data:i}))},error:i=>{console.error("Error fetching customer invoice:",i)}})))))}}),ye(t=>({onInit:()=>{t.getAPLoader(),t.getARCollection(t.filter)}})));var Qe=()=>({height:"calc(100vh - 70px)"}),O=t=>({"ng-invalid ng-dirty":t}),Xe=()=>({});function Ye(t,a){if(t&1){let e=y();r(0,"p-button",10),E("onClick",function(){g(e);let n=_(2);return h(n.onCreateJournal())}),o()}}function Ze(t,a){if(t&1&&x(0,Ye,1,0,"p-button",9),t&2){let e=_();c("ngIf",e.store.hasCheckedRows())}}function et(t,a){t&1&&(r(0,"tr")(1,"th",12),S(2,"p-tableHeaderCheckbox"),o(),r(3,"th",13),s(4,"Outlet"),o(),r(5,"th",14),s(6,"Number"),o(),r(7,"th",15),s(8,"Supplier"),o(),r(9,"th",16),s(10,"Date"),o(),r(11,"th",16),s(12,"Due"),o(),r(13,"th",15),s(14,"Note"),o(),r(15,"th",17),s(16,"Payment"),o(),S(17,"th",12),o())}function tt(t,a){if(t&1&&(r(0,"tr")(1,"td"),S(2,"p-tableCheckbox",18),o(),r(3,"td"),s(4),o(),r(5,"td")(6,"a",19),s(7),o()(),r(8,"td"),s(9),o(),r(10,"td"),s(11),I(12,"date"),o(),r(13,"td"),s(14),I(15,"date"),o(),r(16,"td"),S(17,"div",20),o(),r(18,"td"),s(19),o(),r(20,"td"),S(21,"p-button",21),o()()),t&2){let e=a.$implicit,p=_(2);l(2),c("value",e),l(2),b(e.outlet),l(2),c("href",p.authService.getTenantExternalURL()+"/menu/Debt/Debt/Join_Bill/New_Join_Bill/Info?ID="+e.id,G),l(),P(" ",e.number," "),l(2),b(e.customer),l(2),b(A(12,12,e.date,"d MMM y")),l(3),b(e.due?A(15,15,e.due,"d MMM y hh:mm"):"-"),l(3),c("innerHTML",e.note,L),l(2),b(e.payment),l(2),c("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function it(t,a){if(t&1&&s(0),t&2){let e=_(2);q(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function nt(t,a){t&1&&(r(0,"tr")(1,"td",22)(2,"span"),s(3,"No records found."),o()()())}function ot(t,a){if(t&1){let e=y();r(0,"p-panel")(1,"p-table",11),E("onPage",function(n){g(e);let i=_();return h(i.onPageChange(n))})("onHeaderCheckboxToggle",function(n){g(e);let i=_();return h(i.onHeaderCheckboxToggle(n))})("onRowSelect",function(n){g(e);let i=_();return h(i.onRowSelect(n))})("onRowUnselect",function(n){g(e);let i=_();return h(i.onRowUnselect(n))}),x(2,et,18,0,"ng-template",null,3,v)(4,tt,22,18,"ng-template",null,4,v)(6,it,1,3,"ng-template",null,5,v)(8,nt,4,0,"ng-template",null,6,v),o()()}if(t&2){let e=_();$(z(9,Qe)),l(),c("value",e.store.data().data)("scrollable",!0)("scrollHeight","calc(100vh - 142px)")("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function rt(t,a){if(t&1&&(r(0,"span",32),s(1),I(2,"truncate"),o()),t&2){let e=a.$implicit;c("pTooltip",e.name),l(),P(" ",A(2,2,e.name,30)," ")}}function at(t,a){if(t&1&&(r(0,"div")(1,"span",34),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function lt(t,a){if(t&1&&(r(0,"div"),x(1,at,3,1,"div",33),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("from"))}}function pt(t,a){if(t&1&&(r(0,"div")(1,"span",34),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function mt(t,a){if(t&1&&(r(0,"div"),x(1,pt,3,1,"div",33),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("to"))}}function st(t,a){if(t&1&&(r(0,"div")(1,"span",34),s(2),o()()),t&2){let e=a.$implicit;l(2),b(e)}}function ct(t,a){if(t&1&&(r(0,"div"),x(1,st,3,1,"div",33),o()),t&2){let e=_(2);l(),c("ngForOf",e.getErrors("pageSize"))}}function ut(t,a){if(t&1){let e=y();r(0,"form",23)(1,"div",24)(2,"label",25),s(3,"Outlet"),o(),r(4,"p-select",26),x(5,rt,3,5,"ng-template",null,7,v),o()(),r(7,"div",24)(8,"label",25),s(9,"From"),o(),S(10,"p-datepicker",27),x(11,lt,2,1,"div",28),o(),r(12,"div",24)(13,"label",25),s(14,"To"),o(),S(15,"p-datepicker",29),x(16,mt,2,1,"div",28),o(),r(17,"div",24)(18,"label",25),s(19,"Supplier"),o(),r(20,"p-autocomplete",30),I(21,"async"),E("completeMethod",function(n){g(e);let i=_();return h(i.onSearchSupplier(n))}),o()(),r(22,"div",24)(23,"label",25),s(24,"Page Size"),o(),S(25,"input",31),x(26,ct,2,1,"div",28),o()()}if(t&2){let e=_();c("formGroup",e.form),l(4),c("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),l(6),c("iconDisplay","input")("showIcon",!0)("ngClass",V(17,O,e.isInvalid("from"))),l(),c("ngIf",e.isInvalid("from")),l(4),c("iconDisplay","input")("showIcon",!0)("ngClass",V(19,O,e.isInvalid("to"))),l(),c("ngIf",e.isInvalid("to")),l(4),c("suggestions",Z(21,15,e.supplierSuggestions$)),l(5),c("autoNumeric",z(21,Xe))("ngClass",V(22,O,e.isInvalid("pageSize"))),l(),c("ngIf",e.isInvalid("pageSize"))}}var ti=(()=>{class t extends Oe{constructor(){super(),this.store=C(B),this.generateJournalService=C(F),this.authService=C(ae),this.isDialogFilterVisible=k(!1),this.isInitDialogFilterVisible=k(!1),this.fb=C(fe),this.dayjsService=C(D)}ngOnInit(){this.initform()}initform(){let{outletName:e,number:p,from:n,to:i,paymentState:d,supplierID:m,pageNumber:Ue,rowCount:Le,pageSize:Ge,export:Ke,exportPageNumber:We,exportRowCount:$e}=this.store.filter();this.form=this.fb.group({outletName:this.fb.control(e),number:this.fb.control(p),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),paymentState:this.fb.control(d),supplierID:this.fb.control(m),pageNumber:this.fb.control(Ue),rowCount:this.fb.control(Le),pageSize:this.fb.control(Ge,[pe.required]),export:this.fb.control(Ke),exportPageNumber:this.fb.control(We),exportRowCount:this.fb.control($e)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((p,[n,i])=>(i!=null&&(n==="from"||n==="to"?(typeof i=="string"||typeof i=="number"||i instanceof Date)&&(p[n]=this.dayjsService.from(i)?this.dayjsService.from(i).format():null):p[n]=i),p),{});this.store.updateFilter(e),this.isDialogFilterVisible.update(p=>!p)}onSearch(e){this.store.updateFilter(f(u({},this.store.filter()),{number:e}))}onSearchSupplier(e){this.supplierSuggestions$=this.generateJournalService.getSupplierSuggestions(e.query).pipe()}onPageChange(e){let p=e.first/e.rows;this.store.updateFilter(f(u({},this.store.filter()),{pageNumber:p+1}))}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(p=>{this.store.onRowUnselect(p)});return}else this.store.onRowUnselect(e.data)}onCreateJournal(){this.generateJournalService.createAPJournal(this.store.checkedAPCollection()).pipe(U(()=>{this.store.getARCollection(this.store.filter)})).subscribe()}static{this.\u0275fac=function(p){return new(p||t)}}static{this.\u0275cmp=K({type:t,selectors:[["app-ap-journal"]],features:[Y([B]),W],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","AP Collection",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onHeaderCheckboxToggle","onRowSelect","onRowUnselect","value","scrollable","scrollHeight","paginator","rows","totalRecords","lazy"],[2,"width","4rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"innerHTML"],[3,"icon","severity","text"],["colspan","9"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["virtualScroll","","showClear","","filter","","filterBy","name","formControlName","outletName","appendTo","body","optionLabel","name","optionValue","name","placeholder","Select an Outlet",3,"virtualScrollItemSize","options"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["showClear","","formControlName","supplierID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(p,n){if(p&1){let i=y();r(0,"app-main-panel",8),X("isDialogFilterVisibleChange",function(m){return g(i),M(n.isDialogFilterVisible,m)||(n.isDialogFilterVisible=m),h(m)})("isInitDialogFilterVisibleChange",function(m){return g(i),M(n.isInitDialogFilterVisible,m)||(n.isInitDialogFilterVisible=m),h(m)}),E("filterConfirmed",function(){return g(i),h(n.onFilterOKEvent())})("search",function(m){return g(i),h(n.onSearch(m))}),x(1,Ze,1,1,"ng-template",null,0,v)(3,ot,10,10,"ng-template",null,1,v)(5,ut,27,24,"ng-template",null,2,v),o()}p&2&&(c("isSearchableInput",!0)("isFilterable",!0),Q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[De,ze,ke,Pe,Me,re,ee,te,ie,ne,oe,Ce,xe,be,Se,_e,ce,le,me,se,ue,de,Ne,Re,Je,Fe,he,ge,Be,He,Ve,Te,Ae,je],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();export{ti as ApJournalComponent};
@@ -0,0 +1 @@
1
+ import{a as D}from"./chunk-4WYSO23S.js";import{a as ze}from"./chunk-DCKLQNGL.js";import{a as Le,b as We}from"./chunk-RZRT24L6.js";import{b as N}from"./chunk-IZ2XPL4O.js";import{a as je}from"./chunk-PSDZXCOR.js";import{a as rt}from"./chunk-G4XX7EU2.js";import{a as ne}from"./chunk-CVMIZKGH.js";import{a as Ae,b as Pe}from"./chunk-VUPF5YJY.js";import"./chunk-MP7S52YU.js";import{a as z,b as O}from"./chunk-JP3F2QND.js";import{d as Ne,i as Je,j as Be,k as Me}from"./chunk-OSFKXKXD.js";import{a as Ve,b as De}from"./chunk-7GHU4UQ7.js";import"./chunk-P36L53XK.js";import{a as Fe}from"./chunk-B7JILYJO.js";import"./chunk-RVTAI3J3.js";import{a as Re,b as ke}from"./chunk-DAV2SMOY.js";import"./chunk-P5ZPLAYA.js";import"./chunk-CVMP55UZ.js";import"./chunk-7UBLUR5O.js";import"./chunk-AZM2EGTF.js";import"./chunk-HI7JDHS3.js";import"./chunk-JQZRKOKE.js";import{c as he,d as Se}from"./chunk-ANG5YF2J.js";import{g as Ee,h as Te}from"./chunk-2JCKXI2B.js";import{b as we,c as Ie}from"./chunk-YLHU3GDJ.js";import{a as y,b as Ce,c as xe,d as be,e as ve,f as ye,g as ot}from"./chunk-4S33ZRKF.js";import"./chunk-4FGQ5T64.js";import{n as de,o as fe,w as _e,x as ge}from"./chunk-TCF45ELT.js";import"./chunk-ZWHB7NI7.js";import{b as oe,c as re,e as le,f as ae,k as pe,m as me,p as se,w as ce,z as ue}from"./chunk-ALX7UOMP.js";import"./chunk-HAZ5H5ZV.js";import"./chunk-4LFQJHJZ.js";import"./chunk-F2X3VGZZ.js";import{c as X,e as Y,f as Z,i as nt,k as ee,l as te,m as ie}from"./chunk-BYD3JK4R.js";import{Ab as L,Cb as g,Ga as R,Ic as w,Jc as j,Kb as s,Kc as V,Lc as b,Nb as W,Ub as l,Vb as o,Wb as C,X as B,Xc as I,Z as H,_b as E,c as J,cb as U,dc as T,ec as _,gb as a,ha as v,pa as h,pc as m,qa as S,qc as x,rc as k,s as G,ta as it,tc as K,uc as q,vc as M,wb as A,wc as $,xc as Q,yc as P,zc as F}from"./chunk-YVEUYFCE.js";import{a as c,b as u}from"./chunk-YQFG5XE2.js";var Ct={data:{data:[],totalCount:0},meta:{options:{outlets:[],paymentStates:[],deliveryStates:[]},filter:{number:null,outletName:null,paymentState:0,deliveryState:0,from:null,to:null,customerID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},filter:{number:null,outletName:null,paymentState:0,deliveryState:0,from:null,to:null,customerID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},Qe=Ce(ye(Ct),xe(t=>({first:I(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:I(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:I(()=>t.data().data.some(p=>p.checked)),checkedInvoice:I(()=>t.data().data.filter(p=>p.checked).map(p=>p.id))})),ve(t=>{let p=v(D),e=v(N);return{updateFilter(n){y(t,i=>u(c({},i),{filter:c(c({},i.filter),n),skipRequestFirst:!1}))},onRowSelect(n){y(t,i=>{let f=i.data.data.map(d=>d.id===n.id?u(c({},d),{checked:!0}):d);return u(c({},i),{data:u(c({},i.data),{data:f})})})},onRowUnselect(n){y(t,i=>{let f=i.data.data.map(d=>d.id===n.id?u(c({},d),{checked:!1}):d);return u(c({},i),{data:u(c({},i.data),{data:f})})})},onHeaderCheckboxToggle(n){y(t,i=>{let f=i.data.data.map(d=>u(c({},d),{checked:n}));return u(c({},i),{data:u(c({},i.data),{data:f})})})},getCustomerInvoice:z(J(G(n=>Object.entries(n).reduce((i,[f,d])=>(d!=null&&(i[f]=d),i),{})),B(n=>p.getJournalInvoice(n).pipe(G(i=>u(c({},i),{data:i.data.map(f=>u(c({},f),{due:e.from(f.due)?e.from(f.due).format():null,checked:!1}))})),Fe("getCustomerInvoice"),O({next:i=>{y(t,f=>u(c({},f),{data:u(c({},f.data),{data:i.data,totalCount:i.totalCount})}))},error:i=>{console.error("Error fetching customer invoice:",i)}}))))),getCustomerInvoiceLoader:z(J(B(()=>p.getJournalInvoiceLoader().pipe(O({next:n=>{y(t,i=>u(c({},i),{meta:n}))},error:n=>{console.error("Error fetching customer invoice loader:",n)}})))))}}),be(t=>({onInit:()=>{t.getCustomerInvoiceLoader(),t.getCustomerInvoice(t.filter)}})));var vt=()=>({height:"calc(100vh - 70px)"}),Xe=t=>({"ng-invalid ng-dirty":t}),yt=()=>({});function wt(t,p){if(t&1){let e=E();l(0,"p-button",10),T("onClick",function(){h(e);let n=_(2);return S(n.onGenerateJournal())}),o()}}function It(t,p){if(t&1&&g(0,wt,1,0,"p-button",9),t&2){let e=_();s("ngIf",e.store.hasCheckedRows())}}function Et(t,p){t&1&&(l(0,"tr")(1,"th",12),C(2,"p-tableHeaderCheckbox"),o(),l(3,"th",13),m(4,"Outlet"),o(),l(5,"th",14),m(6,"Number"),o(),l(7,"th",15),m(8,"Customer"),o(),l(9,"th",16),m(10,"Date"),o(),l(11,"th",16),m(12,"Due"),o(),l(13,"th",13),m(14,"Amount"),o(),l(15,"th",17),m(16,"Payment"),o(),l(17,"th",17),m(18,"Delivery"),o(),C(19,"th",12),o())}function Tt(t,p){if(t&1&&(l(0,"tr")(1,"td"),C(2,"p-tableCheckbox",18),o(),l(3,"td"),m(4),o(),l(5,"td")(6,"a",19),m(7),o()(),l(8,"td")(9,"a",19),m(10),o()(),l(11,"td"),m(12),w(13,"date"),o(),l(14,"td"),m(15),w(16,"date"),o(),l(17,"td"),m(18),w(19,"number"),o(),l(20,"td"),C(21,"p-chip",20),o(),l(22,"td"),C(23,"p-chip",20),o(),l(24,"td"),C(25,"p-button",21),o()()),t&2){let e=p.$implicit,r=_(2);a(2),s("value",e),a(2),x(e.outlet),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Orders/Orders/Customer_Invoice/Info?ID="+e.id,U),a(),k(" ",e.number," "),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Contacts/Contact/Customers/Info?ID="+e.customerID,U),a(),k(" ",e.customer," "),a(2),x(V(13,14,e.date,"d MMM y hh:mm")),a(3),x(e.due?V(16,17,e.due,"d MMM y hh:mm"):"-"),a(3),x(j(19,20,e.amount)),a(3),s("label",e.payment),a(2),s("label",e.delivery),a(2),s("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function Ft(t,p){if(t&1&&m(0),t&2){let e=_(2);K(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Vt(t,p){t&1&&(l(0,"tr")(1,"td",22)(2,"span"),m(3,"No records found."),o()()())}function Dt(t,p){if(t&1){let e=E();l(0,"p-panel")(1,"p-table",11),T("onPage",function(n){h(e);let i=_();return S(i.onPageChange(n))})("onRowSelect",function(n){h(e);let i=_();return S(i.onRowSelect(n))})("onRowUnselect",function(n){h(e);let i=_();return S(i.onRowUnselect(n))})("onHeaderCheckboxToggle",function(n){h(e);let i=_();return S(i.onHeaderCheckboxToggle(n))}),g(2,Et,20,0,"ng-template",null,3,b)(4,Tt,26,22,"ng-template",null,4,b)(6,Ft,1,3,"ng-template",null,5,b)(8,Vt,4,0,"ng-template",null,6,b),o()()}if(t&2){let e=_();W(P(9,vt)),a(),s("scrollable",!0)("scrollHeight","calc(100vh - 142px)")("lazy",!0)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("value",e.store.data().data)}}function Rt(t,p){if(t&1&&(l(0,"span",34),m(1),w(2,"truncate"),o()),t&2){let e=p.$implicit;s("pTooltip",e.name),a(),k(" ",V(2,2,e.name,30)," ")}}function kt(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Nt(t,p){if(t&1&&(l(0,"div"),g(1,kt,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("from"))}}function Jt(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Bt(t,p){if(t&1&&(l(0,"div"),g(1,Jt,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("to"))}}function Mt(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Pt(t,p){if(t&1&&(l(0,"div"),g(1,Mt,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("pageSize"))}}function jt(t,p){if(t&1){let e=E();l(0,"form",23)(1,"div",24)(2,"label",25),m(3,"Outlet"),o(),l(4,"p-select",26),g(5,Rt,3,5,"ng-template",null,7,b),o()(),l(7,"div",24)(8,"label",25),m(9,"Payment"),o(),C(10,"p-select",27),o(),l(11,"div",24)(12,"label",25),m(13,"Delivery"),o(),C(14,"p-select",28),o(),l(15,"div",24)(16,"label",25),m(17,"From"),o(),C(18,"p-datepicker",29),g(19,Nt,2,1,"div",30),o(),l(20,"div",24)(21,"label",25),m(22,"To"),o(),C(23,"p-datepicker",31),g(24,Bt,2,1,"div",30),o(),l(25,"div",24)(26,"label",25),m(27,"Customer"),o(),l(28,"p-autocomplete",32),T("completeMethod",function(n){h(e);let i=_();return S(i.onSearchContact(n))}),o()(),l(29,"div",24)(30,"label",25),m(31,"Page Size"),o(),C(32,"input",33),g(33,Pt,2,1,"div",30),o()()}if(t&2){let e=_();s("formGroup",e.form),a(4),s("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),a(6),s("options",e.store.meta().options.paymentStates),a(4),s("options",e.store.meta().options.deliveryStates),a(4),s("iconDisplay","input")("showIcon",!0)("ngClass",F(17,Xe,e.isInvalid("from"))),a(),s("ngIf",e.isInvalid("from")),a(4),s("iconDisplay","input")("showIcon",!0)("ngClass",F(19,Xe,e.isInvalid("to"))),a(),s("ngIf",e.isInvalid("to")),a(4),s("suggestions",e.customerSuggestions()),a(4),s("ngClass",F(21,Xe,e.isInvalid("pageSize")))("autoNumeric",P(23,yt)),a(),s("ngIf",e.isInvalid("pageSize"))}}var gt=(()=>{class t extends ze{constructor(){super(...arguments),this.store=v(Qe),this.dayjsService=v(N),this.generateJournalService=v(D),this.authService=v(ne),this.isDialogFilterVisible=R(!1),this.isInitDialogFilterVisible=R(!1),this.customerSuggestions=R([]),this.fb=v(ce)}ngOnInit(){console.log(this.dayjsService.from('0001-01-01T00:00:00"')&&!0),this.generateFilterForm()}generateFilterForm(){let{number:e,outletName:r,paymentState:n,deliveryState:i,from:f,to:d,customerID:Oe,pageNumber:Ge,rowCount:He,pageSize:Ue,export:Ke,exportPageNumber:qe,exportRowCount:$e}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),outletName:this.fb.control(r),paymentState:this.fb.control(n),deliveryState:this.fb.control(i),from:this.fb.control(this.dayjsService.from(f)?this.dayjsService.from(f).toDate():null),to:this.fb.control(this.dayjsService.from(d)?this.dayjsService.from(d).toDate():null),customerID:this.fb.control(Oe),pageNumber:this.fb.control(Ge),rowCount:this.fb.control(He),pageSize:this.fb.control(Ue,[re.required]),export:this.fb.control(Ke),exportPageNumber:this.fb.control(qe),exportRowCount:this.fb.control($e)})}onSearchContact(e){let{query:r}=e;this.generateJournalService.getCustomerSuggestions(r).pipe(Fe("Customer Suggestions"),H(n=>{this.customerSuggestions.set(n)})).subscribe()}onSearch(e){this.store.updateFilter(u(c({},this.store.filter()),{number:e}))}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(r=>{this.store.onRowUnselect(r)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onPageChange(e){let r=e.first/e.rows;this.store.updateFilter(u(c({},this.store.filter()),{pageNumber:r+1}))}onGenerateJournal(){this.generateJournalService.generateJournalInvoice(this.store.checkedInvoice()).pipe(H(()=>{this.store.getCustomerInvoice(this.store.filter)})).subscribe()}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((r,[n,i])=>{switch(n){case"customerID":i||(r[n]=rt);break;case"from":typeof i=="object"?r[n]=this.dayjsService.from(i)?this.dayjsService.from(i).format():null:r[n]=i!=null?String(i):null;break;case"to":typeof i=="object"?r[n]=this.dayjsService.from(i)?this.dayjsService.from(i).format():null:r[n]=i!=null?String(i):null;break;default:r[n]=i===null?"":i;break}return r},{});console.log("Filter Body:",e),this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}static{this.\u0275fac=(()=>{let e;return function(n){return(e||(e=it(t)))(n||t)}})()}static{this.\u0275cmp=A({type:t,selectors:[["app-customer-invoice"]],features:[Q([Qe]),L],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Customer Invoice",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","scrollable","scrollHeight","lazy","paginator","rows","totalRecords","value"],[2,"width","4rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"label"],[3,"icon","severity","text"],["colspan","10"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["virtualScroll","","showClear","","filter","","filterBy","name","formControlName","outletName","appendTo","body","optionLabel","name","optionValue","name","placeholder","Select an Outlet",3,"virtualScrollItemSize","options"],["showClear","","formControlName","paymentState","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select a Payment",3,"options"],["showClear","","formControlName","deliveryState","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select a Delivery",3,"options"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["showClear","","formControlName","customerID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize",3,"ngClass","autoNumeric"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(r,n){if(r&1){let i=E();l(0,"app-main-panel",8),$("isDialogFilterVisibleChange",function(d){return h(i),M(n.isDialogFilterVisible,d)||(n.isDialogFilterVisible=d),S(d)})("isInitDialogFilterVisibleChange",function(d){return h(i),M(n.isInitDialogFilterVisible,d)||(n.isInitDialogFilterVisible=d),S(d)}),T("filterConfirmed",function(){return h(i),S(n.onFilterOKEvent())})("search",function(d){return h(i),S(n.onSearch(d))}),g(1,It,1,1,"ng-template",null,0,b)(3,Dt,10,10,"ng-template",null,1,b)(5,jt,34,24,"ng-template",null,2,b),o()}r&2&&(s("isSearchableInput",!0)("isFilterable",!0),q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[Te,Me,Ne,Je,Be,ie,X,Y,Z,te,ee,Pe,Ae,Se,he,ge,_e,ke,Re,De,Ve,fe,de,We,Le,ue,pe,oe,le,ae,me,se,Ie,we,Ee,je],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var zt={data:{data:[],totalCount:0},meta:{options:{Outlets:[],PaymentStates:[],DeliveryStates:[]},filter:{number:null,outletName:null,paymentState:0,deliveryState:0,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},filter:{number:null,outletName:null,paymentState:0,deliveryState:0,from:null,to:null,supplierID:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4},skipRequestFirst:!0},Ye=Ce(ot("JournalSupplierBillStore"),ye(zt),xe(t=>({first:I(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:I(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:I(()=>t.data().data.some(p=>p.checked)),checkedSupplierBill:I(()=>t.data().data.filter(p=>p.checked).map(p=>p.id))})),ve(t=>{let p=v(D),e=v(N);return{updateFilter(r){y(t,n=>u(c({},n),{filter:c(c({},n.filter),r),skipRequestFirst:!1}))},onRowSelect(r){y(t,n=>{let i=n.data.data.map(f=>f.id===r.id?u(c({},f),{checked:!0}):f);return u(c({},n),{data:u(c({},n.data),{data:i})})})},onRowUnselect(r){y(t,n=>{let i=n.data.data.map(f=>f.id===r.id?u(c({},f),{checked:!1}):f);return u(c({},n),{data:u(c({},n.data),{data:i})})})},onHeaderCheckboxToggle(r){y(t,n=>{let i=n.data.data.map(f=>u(c({},f),{checked:r}));return u(c({},n),{data:u(c({},n.data),{data:i})})})},getGJSupplierBillLoader:z(J(B(()=>p.getGJSupplierBillLoader().pipe(O({next:r=>{console.log("GJSupplierBillLoader response:",r),y(t,n=>u(c({},n),{meta:r}))},error:r=>{console.error("Error fetching GJSupplierBillLoader:",r)}}))))),getJournalSupplierBill:z(J(G(r=>Object.entries(r).reduce((n,[i,f])=>(f!=null&&(n[i]=f),n),{})),B(r=>p.getJournalSupplierBill(r).pipe(G(n=>u(c({},n),{data:n.data.map(i=>u(c({},i),{due:e.from(i.due)?e.from(i.due).format():null,checked:!1}))})),O({next:n=>{y(t,i=>u(c({},i),{data:n}))},error:n=>{console.error("Error fetching journal supplier bill:",n)}})))))}}),be(t=>({onInit:()=>{t.getGJSupplierBillLoader(),t.getJournalSupplierBill(t.filter)}})));var Ot=()=>({height:"calc(100vh - 70px)"}),Ze=t=>({"ng-invalid ng-dirty":t}),Gt=()=>({});function Ht(t,p){if(t&1){let e=E();l(0,"p-button",10),T("onClick",function(){h(e);let n=_(2);return S(n.onGenerateJournal())}),o()}}function Ut(t,p){if(t&1&&g(0,Ht,1,0,"p-button",9),t&2){let e=_();s("ngIf",e.store.hasCheckedRows())}}function At(t,p){t&1&&(l(0,"tr")(1,"th",12),C(2,"p-tableHeaderCheckbox"),o(),l(3,"th",13),m(4,"Outlet"),o(),l(5,"th",14),m(6,"Number"),o(),l(7,"th",15),m(8,"Supplier"),o(),l(9,"th",16),m(10,"Date"),o(),l(11,"th",16),m(12,"Due"),o(),l(13,"th",13),m(14,"Amount"),o(),l(15,"th",17),m(16,"Payment"),o(),l(17,"th",17),m(18,"Delivery"),o(),C(19,"th",12),o())}function Lt(t,p){if(t&1&&(l(0,"tr")(1,"td"),C(2,"p-tableCheckbox",18),o(),l(3,"td"),m(4),o(),l(5,"td")(6,"a",19),m(7),o()(),l(8,"td"),m(9),o(),l(10,"td"),m(11),w(12,"date"),o(),l(13,"td"),m(14),w(15,"date"),o(),l(16,"td"),m(17),w(18,"number"),o(),l(19,"td"),C(20,"p-chip",20),o(),l(21,"td"),C(22,"p-chip",20),o(),l(23,"td"),C(24,"p-button",21),o()()),t&2){let e=p.$implicit,r=_(2);a(2),s("value",e),a(2),x(e.outlet),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Orders/Orders/Supplier_Bill/Info?ID="+e.id,U),a(),k(" ",e.number," "),a(2),x(e.customer),a(2),x(V(12,13,e.date,"d MMM y hh:mm")),a(3),x(e.due?V(15,16,e.due,"d MMM y hh:mm"):"-"),a(3),x(j(18,19,e.amount)),a(3),s("label",e.payment),a(2),s("label",e.delivery),a(2),s("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function Wt(t,p){if(t&1&&m(0),t&2){let e=_(2);K(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function Kt(t,p){t&1&&(l(0,"tr")(1,"td",22)(2,"span"),m(3,"No records found."),o()()())}function qt(t,p){if(t&1){let e=E();l(0,"p-panel")(1,"p-table",11),T("onPage",function(n){h(e);let i=_();return S(i.onPageChange(n))})("onRowSelect",function(n){h(e);let i=_();return S(i.onRowSelect(n))})("onRowUnselect",function(n){h(e);let i=_();return S(i.onRowUnselect(n))})("onHeaderCheckboxToggle",function(n){h(e);let i=_();return S(i.onHeaderCheckboxToggle(n))}),g(2,At,20,0,"ng-template",null,3,b)(4,Lt,25,21,"ng-template",null,4,b)(6,Wt,1,3,"ng-template",null,5,b)(8,Kt,4,0,"ng-template",null,6,b),o()()}if(t&2){let e=_();W(P(9,Ot)),a(),s("scrollHeight","calc(100vh - 142px)")("value",e.store.data().data)("scrollable",!0)("paginator",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("lazy",!0)}}function $t(t,p){if(t&1&&(l(0,"span",34),m(1),w(2,"truncate"),o()),t&2){let e=p.$implicit;s("pTooltip",e.name),a(),k(" ",V(2,2,e.name,30)," ")}}function Qt(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Xt(t,p){if(t&1&&(l(0,"div"),g(1,Qt,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("from"))}}function Yt(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Zt(t,p){if(t&1&&(l(0,"div"),g(1,Yt,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("to"))}}function ei(t,p){if(t&1&&(l(0,"div")(1,"span",36),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function ti(t,p){if(t&1&&(l(0,"div"),g(1,ei,3,1,"div",35),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("pageSize"))}}function ii(t,p){if(t&1){let e=E();l(0,"form",23)(1,"div",24)(2,"label",25),m(3,"Outlet"),o(),l(4,"p-select",26),g(5,$t,3,5,"ng-template",null,7,b),o()(),l(7,"div",24)(8,"label",25),m(9,"Payment"),o(),C(10,"p-select",27),o(),l(11,"div",24)(12,"label",25),m(13,"Delivery"),o(),C(14,"p-select",28),o(),l(15,"div",24)(16,"label",25),m(17,"From"),o(),C(18,"p-datepicker",29),g(19,Xt,2,1,"div",30),o(),l(20,"div",24)(21,"label",25),m(22,"To"),o(),C(23,"p-datepicker",31),g(24,Zt,2,1,"div",30),o(),l(25,"div",24)(26,"label",25),m(27,"Supplier"),o(),l(28,"p-autocomplete",32),w(29,"async"),T("completeMethod",function(n){h(e);let i=_();return S(i.onSearchSupplier(n))}),o()(),l(30,"div",24)(31,"label",25),m(32,"Page Size"),o(),C(33,"input",33),g(34,ti,2,1,"div",30),o()()}if(t&2){let e=_();s("formGroup",e.form),a(4),s("virtualScrollItemSize",50)("options",e.store.meta().options.Outlets),a(6),s("options",e.store.meta().options.PaymentStates),a(4),s("options",e.store.meta().options.DeliveryStates),a(4),s("iconDisplay","input")("showIcon",!0)("ngClass",F(19,Ze,e.isInvalid("from"))),a(),s("ngIf",e.isInvalid("from")),a(4),s("iconDisplay","input")("showIcon",!0)("ngClass",F(21,Ze,e.isInvalid("to"))),a(),s("ngIf",e.isInvalid("to")),a(4),s("suggestions",j(29,17,e.supplierSuggestions$)),a(5),s("autoNumeric",P(23,Gt))("ngClass",F(24,Ze,e.isInvalid("pageSize"))),a(),s("ngIf",e.isInvalid("pageSize"))}}var ht=(()=>{class t extends ze{constructor(){super(),this.generateJournalService=v(D),this.store=v(Ye),this.authService=v(ne),this.isDialogFilterVisible=R(!1),this.isInitDialogFilterVisible=R(!1),this.fb=v(ce),this.dayjsService=v(N)}ngOnInit(){this.initform()}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((r,[n,i])=>(i!=null&&(n==="from"||n==="to"?(typeof i=="string"||typeof i=="number"||i instanceof Date)&&(r[n]=this.dayjsService.from(i)?this.dayjsService.from(i).format():null):r[n]=i),r),{});this.store.updateFilter(e),this.isDialogFilterVisible.update(r=>!r)}onRowSelect(e){this.store.onRowSelect(e.data)}onSearchSupplier(e){this.supplierSuggestions$=this.generateJournalService.getSupplierSuggestions(e.query).pipe(Fe("Supplier Suggestions"))}initform(){let{outletName:e,number:r,from:n,to:i,paymentState:f,deliveryState:d,supplierID:Oe,pageNumber:Ge,rowCount:He,pageSize:Ue,export:Ke,exportPageNumber:qe,exportRowCount:$e}=this.store.filter();this.form=this.fb.group({outletName:this.fb.control(e),number:this.fb.control(r),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),paymentState:this.fb.control(f),deliveryState:this.fb.control(d),supplierID:this.fb.control(Oe),pageNumber:this.fb.control(Ge),rowCount:this.fb.control(He),pageSize:this.fb.control(Ue,[re.required]),export:this.fb.control(Ke),exportPageNumber:this.fb.control(qe),exportRowCount:this.fb.control($e)})}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(r=>{this.store.onRowUnselect(r)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onGenerateJournal(){this.generateJournalService.generateJournalSupplierBill(this.store.checkedSupplierBill()).pipe(H(()=>{this.store.getJournalSupplierBill(this.store.filter)})).subscribe()}onSearch(e){this.store.updateFilter(u(c({},this.store.filter()),{number:e}))}onPageChange(e){this.store.updateFilter(u(c({},this.store.filter()),{pageNumber:e.first/e.rows+1}))}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=A({type:t,selectors:[["app-journal-supplier-bill"]],features:[Q([Ye]),L],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Supplier Bill",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","scrollHeight","value","scrollable","paginator","rows","totalRecords","lazy"],[2,"width","4rem"],[2,"width","10rem"],[2,"width","12rem"],[2,"width","14rem"],[2,"width","11rem"],[2,"width","9rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"label"],[3,"icon","severity","text"],["colspan","10"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["virtualScroll","","showClear","","filter","","filterBy","name","formControlName","outletName","appendTo","body","optionLabel","name","optionValue","name","placeholder","Select an Outlet",3,"virtualScrollItemSize","options"],["showClear","","formControlName","paymentState","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select a Payment",3,"options"],["showClear","","formControlName","deliveryState","appendTo","body","optionLabel","value","optionValue","key","placeholder","Select a Delivery",3,"options"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["showClear","","formControlName","supplierID","appendTo","body","styleClass","w-100","optionLabel","Value","optionValue","Key","inputStyleClass","w-100",3,"completeMethod","suggestions"],["type","text","pInputText","","formControlName","pageSize",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(r,n){if(r&1){let i=E();l(0,"app-main-panel",8),$("isDialogFilterVisibleChange",function(d){return h(i),M(n.isDialogFilterVisible,d)||(n.isDialogFilterVisible=d),S(d)})("isInitDialogFilterVisibleChange",function(d){return h(i),M(n.isInitDialogFilterVisible,d)||(n.isInitDialogFilterVisible=d),S(d)}),T("filterConfirmed",function(){return h(i),S(n.onFilterOKEvent())})("search",function(d){return h(i),S(n.onSearch(d))}),g(1,Ut,1,1,"ng-template",null,0,b)(3,qt,10,10,"ng-template",null,1,b)(5,ii,35,26,"ng-template",null,2,b),o()}r&2&&(s("isSearchableInput",!0)("isFilterable",!0),q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[Te,Me,Ne,Je,Be,ie,X,Y,Z,nt,te,ee,Pe,Ae,Se,he,ge,_e,ke,Re,De,Ve,We,Le,ue,pe,oe,le,ae,me,se,fe,de,Ee,Ie,we,je],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var ni={data:{data:[],totalCount:0},meta:{options:{outlets:[]},filter:{number:null,outletName:null,from:null,to:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},filter:{number:null,outletName:null,from:null,to:null,pageNumber:1,rowCount:20,pageSize:20,export:!1,exportPageNumber:1,exportRowCount:1e4}},et=Ce(ye(ni),xe(t=>({first:I(()=>(t.filter().pageNumber-1)*t.filter().pageSize+1),end:I(()=>Math.min(t.filter().pageNumber*t.filter().pageSize,t.data().totalCount)),hasCheckedRows:I(()=>t.data().data.some(p=>p.checked)),checkedShift:I(()=>t.data().data.filter(p=>p.checked).map(p=>p.id))})),ve(t=>{let p=v(D);return{updateFilter(e){y(t,r=>u(c({},r),{filter:c(c({},r.filter),e)}))},onRowSelect(e){y(t,r=>{let n=r.data.data.map(i=>i.id===e.id?u(c({},i),{checked:!0}):i);return u(c({},r),{data:u(c({},r.data),{data:n})})})},onRowUnselect(e){y(t,r=>{let n=r.data.data.map(i=>i.id===e.id?u(c({},i),{checked:!1}):i);return u(c({},r),{data:u(c({},r.data),{data:n})})})},onHeaderCheckboxToggle(e){y(t,r=>{let n=r.data.data.map(i=>u(c({},i),{checked:e}));return u(c({},r),{data:u(c({},r.data),{data:n})})})},getGJShiftLoader:z(J(B(()=>p.getGJShiftLoader().pipe(O(e=>y(t,r=>u(c({},r),{meta:e})),e=>console.error("Error fetching GJ Shift Loader:",e)))))),getJournalShift:z(J(G(e=>Object.entries(e).reduce((r,[n,i])=>(i!=null&&(r[n]=i),r),{})),B(e=>p.getJournalShift(e).pipe(O(r=>y(t,n=>u(c({},n),{data:r})),r=>console.error("Error fetching journal shift:",r))))))}}),be(t=>({onInit:()=>{t.getGJShiftLoader(),t.getJournalShift(t.filter)}})));var oi=()=>({height:"calc(100vh - 70px)"}),tt=t=>({"ng-invalid ng-dirty":t}),ri=()=>({});function li(t,p){if(t&1){let e=E();l(0,"p-button",10),T("onClick",function(){h(e);let n=_(2);return S(n.onGenerateJournal())}),o()}}function ai(t,p){if(t&1&&g(0,li,1,0,"p-button",9),t&2){let e=_();s("ngIf",e.store.hasCheckedRows())}}function pi(t,p){t&1&&(l(0,"tr")(1,"th",12),C(2,"p-tableHeaderCheckbox"),o(),l(3,"th",13),m(4,"Number"),o(),l(5,"th",14),m(6,"Open"),o(),l(7,"th",14),m(8,"Close"),o(),l(9,"th",15),m(10,"Cashier"),o(),l(11,"th",16),m(12,"Sales + Tax"),o(),l(13,"th",17),m(14,"Invoices"),o(),l(15,"th",16),m(16,"Outlet"),o(),l(17,"th",17),m(18,"Register"),o(),l(19,"th",17),m(20,"Visitors"),o(),C(21,"th",12),o())}function mi(t,p){if(t&1&&(l(0,"tr")(1,"td"),C(2,"p-tableCheckbox",18),o(),l(3,"td")(4,"a",19),m(5),o()(),l(6,"td"),m(7),w(8,"date"),o(),l(9,"td"),m(10),w(11,"date"),o(),l(12,"td"),m(13),o(),l(14,"td"),m(15),w(16,"number"),o(),l(17,"td"),m(18),w(19,"number"),o(),l(20,"td"),m(21),o(),l(22,"td"),m(23),o(),l(24,"td"),m(25),w(26,"number"),o(),l(27,"td"),C(28,"p-button",20),o()()),t&2){let e=p.$implicit,r=_(2);a(2),s("value",e),a(2),s("href",r.authService.getTenantExternalURL()+"/menu/Shift/Main/Previous_Shift/Register_Shift_Detail?ID="+e.id,U),a(),k(" ",e.number," "),a(2),x(V(8,14,e.open,"dd MMM y hh:mm")),a(3),x(V(11,17,e.close,"dd MMM y hh:mm")),a(3),x(e.cashier),a(2),x(j(16,20,e.salesNTax)),a(3),x(j(19,22,e.totalInvoice)),a(3),x(e.outlet),a(2),x(e.register),a(2),x(j(26,24,e.visitors)),a(3),s("icon",e.integrated?"fa-solid fa-circle-check":"fa-solid fa-circle-xmark")("severity",e.integrated?"success":"danger")("text",!0)}}function si(t,p){if(t&1&&m(0),t&2){let e=_(2);K(" Showing ",e.store.first()," to ",e.store.end()," of ",e.store.data().totalCount," entries ")}}function ci(t,p){t&1&&(l(0,"tr")(1,"td",21)(2,"span"),m(3,"No records found."),o()()())}function ui(t,p){if(t&1){let e=E();l(0,"p-panel")(1,"p-table",11),T("onPage",function(n){h(e);let i=_();return S(i.onPageChange(n))})("onRowSelect",function(n){h(e);let i=_();return S(i.onRowSelect(n))})("onRowUnselect",function(n){h(e);let i=_();return S(i.onRowUnselect(n))})("onHeaderCheckboxToggle",function(n){h(e);let i=_();return S(i.onHeaderCheckboxToggle(n))}),g(2,pi,22,0,"ng-template",null,3,b)(4,mi,29,26,"ng-template",null,4,b)(6,si,1,3,"ng-template",null,5,b)(8,ci,4,0,"ng-template",null,6,b),o()()}if(t&2){let e=_();W(P(9,oi)),a(),s("scrollHeight","calc(100vh - 142px)")("scrollable",!0)("paginator",!0)("lazy",!0)("rows",e.store.filter().pageSize)("totalRecords",e.store.data().totalCount)("value",e.store.data().data)}}function di(t,p){if(t&1&&(l(0,"span",30),m(1),w(2,"truncate"),o()),t&2){let e=p.$implicit;s("pTooltip",e.name),a(),k(" ",V(2,2,e.name,30)," ")}}function fi(t,p){if(t&1&&(l(0,"div")(1,"span",32),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function _i(t,p){if(t&1&&(l(0,"div"),g(1,fi,3,1,"div",31),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("from"))}}function gi(t,p){if(t&1&&(l(0,"div")(1,"span",32),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function hi(t,p){if(t&1&&(l(0,"div"),g(1,gi,3,1,"div",31),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("to"))}}function Si(t,p){if(t&1&&(l(0,"div")(1,"span",32),m(2),o()()),t&2){let e=p.$implicit;a(2),x(e)}}function Ci(t,p){if(t&1&&(l(0,"div"),g(1,Si,3,1,"div",31),o()),t&2){let e=_(2);a(),s("ngForOf",e.getErrors("pageSize"))}}function xi(t,p){if(t&1&&(l(0,"form",22)(1,"div",23)(2,"label",24),m(3,"Outlet"),o(),l(4,"p-select",25),g(5,di,3,5,"ng-template",null,7,b),o()(),l(7,"div",23)(8,"label",24),m(9,"From"),o(),C(10,"p-datepicker",26),g(11,_i,2,1,"div",27),o(),l(12,"div",23)(13,"label",24),m(14,"To"),o(),C(15,"p-datepicker",28),g(16,hi,2,1,"div",27),o(),l(17,"div",23)(18,"label",24),m(19,"Page Size"),o(),C(20,"input",29),g(21,Ci,2,1,"div",27),o()()),t&2){let e=_();s("formGroup",e.form),a(4),s("virtualScrollItemSize",50)("options",e.store.meta().options.outlets),a(6),s("iconDisplay","input")("showIcon",!0)("ngClass",F(14,tt,e.isInvalid("from"))),a(),s("ngIf",e.isInvalid("from")),a(4),s("iconDisplay","input")("showIcon",!0)("ngClass",F(16,tt,e.isInvalid("to"))),a(),s("ngIf",e.isInvalid("to")),a(4),s("autoNumeric",P(18,ri))("ngClass",F(19,tt,e.isInvalid("pageSize"))),a(),s("ngIf",e.isInvalid("pageSize"))}}var St=(()=>{class t extends ze{constructor(){super(),this.generateJournalService=v(D),this.store=v(et),this.authService=v(ne),this.isDialogFilterVisible=R(!1),this.isInitDialogFilterVisible=R(!1),this.fb=v(ce),this.dayjsService=v(N)}ngOnInit(){this.initForm()}initForm(){let{number:e,outletName:r,from:n,to:i,pageNumber:f,rowCount:d,pageSize:Oe,export:Ge,exportPageNumber:He,exportRowCount:Ue}=this.store.filter();this.form=this.fb.group({number:this.fb.control(e),outletName:this.fb.control(r),from:this.fb.control(this.dayjsService.from(n)?this.dayjsService.from(n).toDate():null),to:this.fb.control(this.dayjsService.from(i)?this.dayjsService.from(i).toDate():null),pageNumber:this.fb.control(f),rowCount:this.fb.control(d),pageSize:this.fb.control(Oe,[re.required]),export:this.fb.control(Ge),exportPageNumber:this.fb.control(He),exportRowCount:this.fb.control(Ue)})}onFilterOKEvent(){if(this.form.invalid){this.form.markAllAsTouched();return}let e=Object.entries(this.form.getRawValue()).reduce((r,[n,i])=>{switch(n){case"from":typeof i=="object"?r[n]=this.dayjsService.from(i)?this.dayjsService.from(i).format():null:r[n]=i!=null?String(i):null;break;case"to":typeof i=="object"?r[n]=this.dayjsService.from(i)?this.dayjsService.from(i).format():null:r[n]=i!=null?String(i):null;break;default:r[n]=i===null?"":i;break}return r},{});this.store.updateFilter(e),this.isDialogFilterVisible.set(!1)}onRowSelect(e){this.store.onRowSelect(e.data)}onRowUnselect(e){if(Array.isArray(e.data)){e.data.forEach(r=>{this.store.onRowUnselect(r)});return}else this.store.onRowUnselect(e.data)}onHeaderCheckboxToggle(e){this.store.onHeaderCheckboxToggle(e.checked)}onGenerateJournal(){this.generateJournalService.generateJournalSupplierBill(this.store.checkedShift()).pipe(H(()=>{this.store.getJournalShift(this.store.filter)})).subscribe()}onSearch(e){this.store.updateFilter(u(c({},this.store.filter()),{number:e}))}onPageChange(e){let r=e.first/e.rows;this.store.updateFilter(u(c({},this.store.filter()),{pageNumber:r+1}))}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275cmp=A({type:t,selectors:[["app-journal-shift"]],features:[Q([et]),L],decls:7,vars:4,consts:[["actionButton",""],["content",""],["filters",""],["header",""],["body",""],["paginatorleft",""],["emptymessage",""],["item",""],["pageTitle","Shift Journal",3,"isDialogFilterVisibleChange","isInitDialogFilterVisibleChange","filterConfirmed","search","isSearchableInput","isFilterable","isDialogFilterVisible","isInitDialogFilterVisible"],["label","Generate Journal",3,"onClick",4,"ngIf"],["label","Generate Journal",3,"onClick"],["dataKey","id",3,"onPage","onRowSelect","onRowUnselect","onHeaderCheckboxToggle","scrollHeight","scrollable","paginator","lazy","rows","totalRecords","value"],[2,"width","4rem"],[2,"width","12rem"],[2,"width","11rem"],[2,"width","14rem"],[2,"width","10rem"],[2,"width","9rem"],[3,"value"],["target","_blank",1,"link","link-primary",3,"href"],[3,"icon","severity","text"],["colspan","11"],[1,"d-flex","flex-column","row-gap-3",3,"formGroup"],[1,"d-flex","flex-column"],["for","outlet"],["virtualScroll","","showClear","","filter","","filterBy","name","formControlName","outletName","appendTo","body","optionLabel","name","optionValue","name","placeholder","Select an Outlet",3,"virtualScrollItemSize","options"],["showClear","","formControlName","from","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],[4,"ngIf"],["showClear","","formControlName","to","styleClass","w-100","appendTo","body","inputId","icondisplay",3,"iconDisplay","showIcon","ngClass"],["type","text","pInputText","","formControlName","pageSize",3,"autoNumeric","ngClass"],[3,"pTooltip"],[4,"ngFor","ngForOf"],[1,"text-danger"]],template:function(r,n){if(r&1){let i=E();l(0,"app-main-panel",8),$("isDialogFilterVisibleChange",function(d){return h(i),M(n.isDialogFilterVisible,d)||(n.isDialogFilterVisible=d),S(d)})("isInitDialogFilterVisibleChange",function(d){return h(i),M(n.isInitDialogFilterVisible,d)||(n.isInitDialogFilterVisible=d),S(d)}),T("filterConfirmed",function(){return h(i),S(n.onFilterOKEvent())})("search",function(d){return h(i),S(n.onSearch(d))}),g(1,ai,1,1,"ng-template",null,0,b)(3,ui,10,10,"ng-template",null,1,b)(5,xi,22,21,"ng-template",null,2,b),o()}r&2&&(s("isSearchableInput",!0)("isFilterable",!0),q("isDialogFilterVisible",n.isDialogFilterVisible)("isInitDialogFilterVisible",n.isInitDialogFilterVisible))},dependencies:[Te,Me,Ne,Je,Be,ie,X,Y,Z,te,ee,Pe,Se,he,ge,_e,ue,pe,oe,le,ae,me,se,ke,Re,De,Ve,Ee,Ie,we,fe,de,je],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0})}}return t})();var yo=[{path:"invoice",component:gt},{path:"supplier-bill",component:ht},{path:"shift",component:St},{path:"join-invoice",loadComponent:()=>import("./chunk-VXSF6SQF.js").then(t=>t.ARJournalComponent)},{path:"join-bill",loadComponent:()=>import("./chunk-FIQFBEQK.js").then(t=>t.ApJournalComponent)},{path:"adjustment",loadComponent:()=>import("./chunk-SJ5TWHWM.js").then(t=>t.AdjustmentJournalComponent)}];export{yo as generateJournalRoutes};
@@ -0,0 +1 @@
1
+ import{a as be}from"./chunk-6JZPAN4G.js";import"./chunk-CVMIZKGH.js";import{a as ge,b as ye,c as Ce,d as ve,e as Ee,f as he}from"./chunk-6NDJPEK4.js";import{b as xe,c as Te,d as Ie}from"./chunk-HJPAXVNY.js";import{d as de,f as ce,g as _e,h as ue,k as fe}from"./chunk-OSFKXKXD.js";import"./chunk-7GHU4UQ7.js";import"./chunk-P36L53XK.js";import{a as T}from"./chunk-B7JILYJO.js";import"./chunk-RVTAI3J3.js";import"./chunk-DAV2SMOY.js";import"./chunk-P5ZPLAYA.js";import"./chunk-CVMP55UZ.js";import"./chunk-7UBLUR5O.js";import"./chunk-AZM2EGTF.js";import"./chunk-HI7JDHS3.js";import"./chunk-JQZRKOKE.js";import{c as oe,d as re}from"./chunk-ANG5YF2J.js";import{a as me,b as se}from"./chunk-4GL5YTWS.js";import{e as ae,f as le,h as pe}from"./chunk-2JCKXI2B.js";import"./chunk-YLHU3GDJ.js";import"./chunk-4S33ZRKF.js";import"./chunk-4FGQ5T64.js";import{w as ne,x as ie}from"./chunk-TCF45ELT.js";import"./chunk-ZWHB7NI7.js";import"./chunk-ALX7UOMP.js";import"./chunk-HAZ5H5ZV.js";import"./chunk-4LFQJHJZ.js";import"./chunk-F2X3VGZZ.js";import{E as te,c as G,f as X,k as Y,l as Z,m as ee}from"./chunk-BYD3JK4R.js";import{Cb as c,Ga as h,I as U,Ic as J,Jc as D,Kb as m,Kc as q,Lc as d,Nb as V,Pb as v,Qb as A,Sb as F,Tb as P,Ub as n,Vb as i,Wb as _,X as N,Z as S,_b as C,dc as y,eb as O,ec as s,gb as l,ha as R,jc as K,kc as H,lc as L,m as M,oc as $,pa as x,pc as r,qa as g,qc as u,rc as I,s as B,uc as W,vc as Q,wb as j,wc as z,yc as w,zc as b}from"./chunk-YVEUYFCE.js";import{e as Je}from"./chunk-YQFG5XE2.js";var Se=Je(Te());var ke=["stepper"],Re=()=>({width:"30vw"}),Ve=()=>({"1199px":"75vw","575px":"100vw"}),Ae=()=>({height:"calc(100vh - 70px)"}),Fe=t=>({"justify-content-center":t}),Pe=t=>({"col-12":t}),we=t=>({"state-danger":t});function De(t,p){if(t&1){let e=C();n(0,"p-button",14),y("click",function(){x(e);let o=s(2);return g(o.onPrevStep())}),i()}if(t&2){let e=s(2);m("disabled",e.stepActiveIndex()===1)}}function Me(t,p){if(t&1){let e=C();n(0,"p-button",15),y("click",function(){x(e);let o=s(2);return g(o.onNextStep())}),i()}if(t&2){let e=s(2);m("disabled",e.stepActiveIndex()===3||!e.JournalEntryImport())}}function Be(t,p){if(t&1){let e=C();n(0,"p-button",16),y("click",function(){x(e);let o=s(2);return g(o.onReset())}),i()}}function Ue(t,p){if(t&1&&c(0,De,1,1,"p-button",11)(1,Me,1,1,"p-button",12)(2,Be,1,0,"p-button",13),t&2){let e=s();m("ngIf",e.stepActiveIndex()>1),l(),m("ngIf",e.stepActiveIndex()<3),l(),m("ngIf",e.stepActiveIndex()===3)}}function Ne(t,p){if(t&1){let e=C();n(0,"POS-uppy",25),y("fileUploaded",function(o){x(e);let f=s(2);return g(f.onFileUploaded(o))})("fileRemoved",function(o){x(e);let f=s(2);return g(f.onFileRemoved(o))}),i(),n(1,"p",26),r(2," Please refer this "),n(3,"a",27),r(4,"article"),i(),r(5," for more information "),i()}if(t&2){let e=s(2);m("uppyCoreConfiguration",e.uppyCore)("dashboardPropsConfiguration",e.uppyDashboardConfiguration)("sampleUrl",e.SAMPLE_URL)("subtitle",e.subtitle)}}function Oe(t,p){t&1&&(n(0,"tr"),_(1,"th",29),n(2,"th",30),r(3," Number "),_(4,"p-sortIcon",31),i(),n(5,"th",32),r(6," Outlet "),_(7,"p-sortIcon",33),i(),n(8,"th",34),r(9," Date "),_(10,"p-sortIcon",35),i(),n(11,"th",36),r(12," Status "),_(13,"p-sortIcon",37),i(),n(14,"th"),r(15,"Message"),i()())}function je(t,p){if(t&1&&(n(0,"div",41)(1,"span"),r(2),i(),n(3,"span"),r(4),i()()),t&2){let e=p.$implicit;l(2),u(e.issue),l(2),u(e.solution)}}function Ke(t,p){if(t&1&&(n(0,"div",40),F(1,je,5,2,"div",41,A),i()),t&2){let e=s(2).$implicit;l(),P(e.issues)}}function He(t,p){t&1&&(n(0,"div"),r(1," We found error in account item, please check your item! "),i())}function Le(t,p){if(t&1&&c(0,Ke,3,0,"div",40)(1,He,2,0,"div"),t&2){let e=s().$implicit;v(e.issues&&e.issues.length>0?0:1)}}function $e(t,p){if(t&1&&(n(0,"tr")(1,"td"),_(2,"p-button",38),i(),n(3,"td"),r(4),i(),n(5,"td"),r(6),i(),n(7,"td"),r(8),J(9,"date"),i(),n(10,"td"),r(11),i(),n(12,"td",39),c(13,Le,2,1),i()()),t&2){let e=p.$implicit,a=p.expanded,o=s(4);l(2),m("pRowToggler",e)("text",!0)("rounded",!0)("plain",!0)("icon",a?"fa-solid fa-chevron-down":"fa-solid fa-chevron-right"),l(2),u(e.number),l(2),I(" ",e.outlet," "),l(2),u(q(9,11,e.date,"d MMM y")),l(3),u(e.actionName),l(),m("ngClass",b(14,we,o.hasIssue)),l(),v(o.hasIssue?13:-1)}}function We(t,p){t&1&&(n(0,"tr")(1,"th",45),r(2," Code "),_(3,"p-sortIcon",46),i(),n(4,"th",47),r(5," Name "),_(6,"p-sortIcon",48),i(),n(7,"th",49),r(8," Note "),_(9,"p-sortIcon",50),i(),n(10,"th",51),r(11," Debit "),_(12,"p-sortIcon",52),i(),n(13,"th",53),r(14," Credit "),_(15,"p-sortIcon",54),i(),n(16,"th"),r(17,"Message"),i()())}function Qe(t,p){if(t&1&&(n(0,"div",41)(1,"span"),r(2),i(),n(3,"span"),r(4),i()()),t&2){let e=p.$implicit;l(2),u(e.issue),l(2),u(e.solution)}}function ze(t,p){if(t&1&&(n(0,"div",40),F(1,Qe,5,2,"div",41,A),i()),t&2){let e=s().$implicit;l(),P(e.issues)}}function qe(t,p){if(t&1&&(n(0,"tr")(1,"td"),r(2),i(),n(3,"td"),r(4),i(),n(5,"td"),r(6),i(),n(7,"td"),r(8),J(9,"number"),i(),n(10,"td"),r(11),J(12,"number"),i(),n(13,"td",39),c(14,ze,3,0,"div",40),i()()),t&2){let e=p.$implicit,a=s(5);l(2),u(e.accountCode),l(2),u(e.accountName),l(2),u(e.note),l(2),I(" ",D(9,7,e.debitAmount)," "),l(3),I(" ",D(12,9,e.creditAmount)," "),l(2),m("ngClass",b(11,we,e.issues&&e.issues.length>0)),l(),v(a.hasIssue?14:-1)}}function Ge(t,p){t&1&&(n(0,"tr")(1,"td",55),r(2," There are no order for this product yet. "),i()())}function Xe(t,p){if(t&1&&(n(0,"tr")(1,"td",42)(2,"div",43)(3,"p-table",44),c(4,We,18,0,"ng-template",null,3,d)(6,qe,15,13,"ng-template",null,6,d)(8,Ge,3,0,"ng-template",null,8,d),i()()()()),t&2){let e=p.$implicit;l(3),m("value",e.items)}}function Ye(t,p){if(t&1&&(n(0,"p-table",28),c(1,Oe,16,0,"ng-template",null,3,d)(3,$e,14,16,"ng-template",null,6,d)(5,Xe,10,1,"ng-template",null,7,d),i()),t&2){let e=s(3);m("scrollable",!0)("scrollHeight","calc(100vh - 160px)")("value",e.JournalEntryImport().dataRow)}}function Ze(t,p){if(t&1&&c(0,Ye,7,3,"p-table",28),t&2){let e=s(2);v(e.JournalEntryImport()?0:-1)}}function et(t,p){t&1&&(n(0,"h5"),r(1,"Successfully Imported"),i())}function tt(t,p){if(t&1&&(n(0,"p-panel")(1,"div",17)(2,"div",18)(3,"p-stepper",19,5)(5,"p-step-list")(6,"p-step",20)(7,"div",21),_(8,"i",22),n(9,"span"),r(10,"Upload"),i()()(),n(11,"p-step",20)(12,"div",21),_(13,"i",23),n(14,"span"),r(15,"Preview"),i()()(),n(16,"p-step",20)(17,"div",21),_(18,"i",24),n(19,"span"),r(20,"Finish"),i()()()(),n(21,"p-step-panels")(22,"p-step-panel",20),c(23,Ne,6,4,"ng-template",null,1,d),i(),n(25,"p-step-panel",20),c(26,Ze,1,1,"ng-template",null,1,d),i(),n(28,"p-step-panel",20),c(29,et,2,0,"ng-template",null,1,d),i()()()()()()),t&2){let e=s();V(w(12,Ae)),l(),m("ngClass",b(13,Fe,e.stepActiveIndex()===1||e.stepActiveIndex()===3)),l(),m("ngClass",b(15,Pe,e.stepActiveIndex()===2)),l(),m("linear",!0)("value",e.stepActiveIndex()),l(3),m("value",1),l(5),m("value",2),l(5),m("value",3),l(6),m("value",1),l(3),m("value",2),l(3),m("value",3)}}function nt(t,p){if(t&1){let e=C();n(0,"p-button",56),y("onClick",function(){x(e);let o=s();return g(o.summaryDialogVisible.set(!1))}),i()}t&2&&m("rounded",!0)("text",!0)}function it(t,p){if(t&1&&(n(0,"div",57)(1,"h4",58),r(2,"Import Summary"),i(),n(3,"p",59),r(4),i()()),t&2){let e=s();l(4),I("(",e.CSVRowCount()," rows ready for import)")}}function ot(t,p){t&1&&(n(0,"div",62)(1,"h4",63),r(2,"New"),i()())}function rt(t,p){t&1&&(n(0,"div",64)(1,"h4",63),r(2,"Updated"),i()())}function at(t,p){t&1&&(n(0,"div",65)(1,"h4",63),r(2,"Unchanged"),i()())}function lt(t,p){t&1&&(n(0,"div",66)(1,"h4",63),r(2,"Error"),i()())}function pt(t,p){if(t&1&&(n(0,"div",60)(1,"div",61)(2,"p-card"),c(3,ot,3,0,"ng-template",null,3,d),n(5,"div",60)(6,"div",61)(7,"h5"),r(8),i()()()()()(),_(9,"br"),n(10,"div",60)(11,"div",61)(12,"p-card"),c(13,rt,3,0,"ng-template",null,3,d),n(15,"div",60)(16,"div",61)(17,"h5"),r(18),i()()()()(),n(19,"div",61)(20,"p-card"),c(21,at,3,0,"ng-template",null,3,d),n(23,"div",60)(24,"div",61)(25,"h5"),r(26),i()()()()(),n(27,"div",61)(28,"p-card"),c(29,lt,3,0,"ng-template",null,3,d),n(31,"div",60)(32,"div",61)(33,"h5"),r(34),i()()()()()()),t&2){let e=s(2);l(8),u(e.JournalEntryImport().summary.new),l(10),u(e.JournalEntryImport().summary.updated),l(8),u(e.JournalEntryImport().summary.noChanges),l(8),u(e.JournalEntryImport().summary.error)}}function mt(t,p){if(t&1&&c(0,pt,35,4),t&2){let e=s();v(e.JournalEntryImport()?0:-1)}}function st(t,p){if(t&1){let e=C();n(0,"p-button",67),y("click",function(){x(e);let o=s();return g(o.summaryDialogVisible.set(!1))}),i(),n(1,"p-button",68),y("click",function(){x(e);let o=s();return g(o.onConfirmImport())}),i()}}var Ut=(()=>{class t{constructor(){this.service=R(be),this.router=R(te),this.subtitle="Accepted file format: .csv & max file size: 1MB",this.stepActiveIndex=h(1),this.JournalEntryImport=h(null),this.summaryDialogVisible=h(!1),this.CSVRowCount=h(0),this.uppyDashboardConfiguration={width:250},this.uppyCore={restrictions:{allowedFileTypes:["text/csv","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"]}},this.SAMPLE_URL="https://res.cloudinary.com/pos/raw/upload/POS/CSV/Journal_DealPOS.csv"}ngAfterViewInit(){console.log("Stepper instance:",this.stepperRef)}onFileUpload(e){console.log("File upload event:",e);let a=new FormData;Array.isArray(e.currentFiles)&&e.currentFiles.forEach(o=>{o instanceof File&&a.append("File",o,o.name)}),console.log("Form data prepared for upload:",a.get("File")),this.service.importPreviewJournal(a).pipe(T("Import Preview"),B(o=>({cacheKey:o.cacheKey})),N(o=>this.service.importConfirmJournal(o)),S(()=>{this.router.navigate(["/pages/journal/journal-entry"])})).subscribe()}onFileRemoved(e){console.log("File removed event:",e),this.JournalEntryImport.set(null),this.CSVRowCount.set(0)}onNextStep(){if(this.stepActiveIndex()<3&&(this.stepActiveIndex.update(e=>e+1),this.stepActiveIndex()===3)){this.stepActiveIndex.update(()=>this.stepActiveIndex()-1),this.summaryDialogVisible.set(!0);return}}onPrevStep(){this.stepActiveIndex()>1&&this.stepActiveIndex.update(e=>e-1)}onFileUploaded(e){let a=new FormData;if("name"in e&&typeof e.name=="string")a.append("File",e,e.name),this.service.importPreviewJournal(a).pipe(T("Import Preview"),S(o=>{this.JournalEntryImport.set(o)})).subscribe(),Se.default.parse(e,{header:!0,skipEmptyLines:!0,complete:o=>{console.log("CSV Parsing Results:",o),this.CSVRowCount.set(o.data.length)},error:o=>{console.error("Error parsing CSV:",o)}});else return}getJournalEntryImportCount(){let e=this.JournalEntryImport();return e&&e.summary?.total!==void 0?e.summary.total:0}onConfirmImport(){if(this.JournalEntryImport()&&this.JournalEntryImport().canProceed){let e={cacheKey:this.JournalEntryImport().cacheKey};this.service.importConfirmJournal(e).pipe(T("Import Confirm"),S(()=>{this.router.navigate(["/pages/journal/journal-entry"]),this.stepActiveIndex.update(a=>a+1),this.summaryDialogVisible.update(a=>!a)}),U(a=>(console.error("Error occurred during import confirmation:",a),this.stepActiveIndex.update(o=>o+1),this.summaryDialogVisible.update(o=>!o),M(null)))).subscribe()}else{console.error("Cannot proceed with import, JournalEntryImport is not set or canProceed is false.");return}}onReset(){this.stepActiveIndex.set(1),this.JournalEntryImport.set(null)}handleKeyboardEvent(e){e.key==="F2"&&this.onConfirmImport()}get hasIssue(){let e=this.JournalEntryImport();return e&&Array.isArray(e.dataRow)?e.dataRow.some(a=>{let o=a.issues&&a.issues.length>0,f=a.items&&a.items.some(E=>E.issues&&E.issues.length>0);return o||f}):!1}static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275cmp=j({type:t,selectors:[["app-journal-entry-import"]],viewQuery:function(a,o){if(a&1&&K(ke,5),a&2){let f;H(f=L())&&(o.stepperRef=f.first)}},hostBindings:function(a,o){a&1&&y("keydown",function(E){return o.handleKeyboardEvent(E)},!1,O)},decls:14,vars:10,consts:[["actionButton",""],["content",""],["closeIconTemplate",""],["header",""],["footer",""],["stepper",""],["body",""],["expandedrow",""],["emptymessage",""],["pageTitle","Manual Journal Import"],["position","center","appendTo","body",3,"visibleChange","modal","visible","breakpoints","draggable","closeIconTemplate","dismissableMask"],["label","Back","severity","secondary","variant","outlined",3,"disabled","click",4,"ngIf"],["label","Next","severity","primary",3,"disabled","click",4,"ngIf"],["label","Finish","severity","primary",3,"click",4,"ngIf"],["label","Back","severity","secondary","variant","outlined",3,"click","disabled"],["label","Next","severity","primary",3,"click","disabled"],["label","Finish","severity","primary",3,"click"],[1,"row",3,"ngClass"],[1,"col-6",3,"ngClass"],[1,"basis-[50rem]",3,"linear","value"],[3,"value"],[1,"d-flex","gap-2","align-items-center"],[1,"fa-solid","fa-upload"],[1,"fa-solid","fa-file"],[1,"fa-solid","fa-check"],[3,"fileUploaded","fileRemoved","uppyCoreConfiguration","dashboardPropsConfiguration","sampleUrl","subtitle"],[1,"fst-italic"],["href","#","target","_blank",1,"link","link-primary"],["dataKey","number",3,"scrollable","scrollHeight","value"],[2,"width","5rem"],["pSortableColumn","number"],["field","number"],["pSortableColumn","outlet"],["field","outlet"],["pSortableColumn","date"],["field","date"],["pSortableColumn","inventoryStatus"],["field","inventoryStatus"],["type","button","pRipple","",3,"pRowToggler","text","rounded","plain","icon"],[3,"ngClass"],[1,"d-flex","flex-column","gap-2"],[1,"d-flex","flex-column"],["colspan","8"],[1,"p-4"],["dataKey","accountID",3,"value"],["pSortableColumn","accountCode"],["field","accountCode"],["pSortableColumn","accountName"],["field","accountName"],["pSortableColumn","note"],["field","note"],["pSortableColumn","debitAmount"],["field","debitAmount"],["pSortableColumn","creditAmount"],["field","creditAmount"],["colspan","6"],["severity","secondary","variant","outlined","icon","fa-solid fa-xmark",3,"onClick","rounded","text"],[1,"d-flex","gap-2","align-items-baseline"],[1,"fs-4","text-white","m-0"],[1,"m-0","fs-3"],[1,"row"],[1,"col"],[1,"state-new"],[1,"fs-4","m-0"],[1,"state-updated"],[1,"state-unchanged"],[1,"state-error"],["label","Cancel","severity","secondary","variant","outlined",3,"click"],["label","OK (F2)",3,"click"]],template:function(a,o){if(a&1){let f=C();n(0,"app-main-panel",9),c(1,Ue,3,3,"ng-template",null,0,d)(3,tt,31,17,"ng-template",null,1,d),i(),n(5,"p-dialog",10),z("visibleChange",function(k){return x(f),Q(o.summaryDialogVisible,k)||(o.summaryDialogVisible=k),g(k)}),c(6,nt,1,2,"ng-template",null,2,d)(8,it,5,1,"ng-template",null,3,d)(10,mt,1,1,"ng-template",null,1,d)(12,st,2,0,"ng-template",null,4,d),i()}if(a&2){let f=$(7);l(5),V(w(8,Re)),m("modal",!0),W("visible",o.summaryDialogVisible),m("breakpoints",w(9,Ve))("draggable",!1)("closeIconTemplate",f)("dismissableMask",!0)}},dependencies:[pe,ee,G,X,Z,Y,re,oe,xe,se,me,he,Ee,ge,ve,Ce,ye,Ie,ie,ne,fe,de,ce,ue,_e,le,ae],styles:[".p-datatable-thead>tr>th{background-color:transparent!important;color:#000!important} .p-stepper .p-steplist{max-width:50vw;margin:0 auto} .p-card{border-radius:4px} .p-card .p-card-header{display:flex;align-items:center;width:100%} .p-card .p-card-header .state-new{width:inherit;padding:.75rem;vertical-align:middle;background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important} .p-card .p-card-header .state-updated{width:inherit;padding:.75rem;background:repeating-linear-gradient(-60deg,#fcf3cf,#fcf3cf 15px,#f9e79f 15px 30px)!important} .p-card .p-card-header .state-unchanged{width:inherit;padding:.75rem;border-bottom:1px solid #dee2e6} .p-card .p-card-header .state-error{width:inherit;padding:.75rem;background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important} pos-uppy div div h4{font-size:16px} pos-uppy div div p{font-size:14px!important} pos-uppy div div hr{margin:0}.status-success[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#beeebb,#beeebb 15px,#afeba8 15px 30px)!important}.state-danger[_ngcontent-%COMP%]{background:repeating-linear-gradient(-60deg,#f8d7da,#f8d7da 15px,#f5c6cb 15px 30px)!important}"],changeDetection:0})}}return t})();export{Ut as JournalEntryImportComponent};
@@ -0,0 +1 @@
1
+ import{a as g}from"./chunk-4LFQJHJZ.js";import{v as b,w as f}from"./chunk-BYD3JK4R.js";import{I as n,Z as p,ba as l,ha as c,n as m,r as o,s as h}from"./chunk-YVEUYFCE.js";import{a,b as u}from"./chunk-YQFG5XE2.js";var v=(()=>{class r{constructor(){this.httpClient=c(f),this.toastr=c(g),this.requestTimeout=1e4}get(e="",t,s={}){return this.httpClient.get(`${e}${t}`,s).pipe(o(this.requestTimeout),n(this.handleError.bind(this)))}post(e="",t,s,i={}){return this.httpClient.post(`${e}${t}`,s,a({observe:"response"},i)).pipe(o(this.requestTimeout),p(this.handleResponse.bind(this)),h(d=>d.body),n(this.handleError.bind(this)))}put(e="",t,s,i={}){return this.httpClient.put(`${e}${t}`,s,u(a({},i),{observe:"response"})).pipe(o(this.requestTimeout),p(this.handleResponse.bind(this)),h(d=>d.body),n(this.handleError.bind(this)))}delete(e="",t,s={}){return this.httpClient.delete(`${e}${t}`,u(a({},s),{observe:"response"})).pipe(o(this.requestTimeout),p(this.handleResponse.bind(this)),h(i=>i.body),n(this.handleError.bind(this)))}handleResponse(e){if(e.status===200&&e.body){let t=e.body.message;t&&this.toastr.success(t,"Success")}}handleError(e){let t={header:"API Error",message:"An unknown error occurred"};if(e instanceof b)switch(e.status){case 0:t.message="CORS error: Request blocked or server not responding with proper CORS headers",t.header="CORS Error";break;case 504:t.message=e.statusText||"Gateway Timeout",t.header=`API Error: ${e.status}`;break;default:t.header=`API Error: ${e.status}`,t.message=e.error&&(e.error.Message||e.error.message||e.error.error)||e.message}return this.toastr.error(t.message,t.header),m(()=>t)}static{this.\u0275fac=function(t){return new(t||r)}}static{this.\u0275prov=l({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();export{v as a};
@@ -1,4 +1,4 @@
1
- import{b as ce}from"./chunk-ACQX2T2H.js";import{a as ie}from"./chunk-JG5HGOEX.js";import{a as X,d as J}from"./chunk-U6SRN7P3.js";import{a as oe}from"./chunk-TPGKCMVN.js";import{V as W,W as Y,ka as Z,la as C,ta as ee}from"./chunk-BCXNVGDH.js";import{j as U,m as G,o as H,t as K}from"./chunk-353U23ZQ.js";import{$b as L,Ac as R,Bb as d,Ga as E,Kb as s,Lb as t,Ob as _,Pb as v,Vb as $,Vc as h,Wb as I,Wc as P,Xb as x,Yb as w,Zb as T,aa as M,ba as F,ca as S,ec as Q,fc as f,gb as l,ha as z,jc as V,kc as N,lc as g,mc as m,oa as B,pa as u,qa as p,ta as y,vb as O,wb as q,yc as j,za as k,zb as D,zc as A}from"./chunk-ARSLNNKY.js";var ae=["checkboxicon"],re=["input"],le=()=>({"p-checkbox-input":!0}),he=e=>({checked:e,class:"p-checkbox-icon"});function se(e,a){if(e&1&&x(0,"span",8),e&2){let o=f(3);t("ngClass",o.checkboxIcon),s("data-pc-section","icon")}}function be(e,a){e&1&&x(0,"CheckIcon",9),e&2&&(t("styleClass","p-checkbox-icon"),s("data-pc-section","icon"))}function de(e,a){if(e&1&&(w(0),d(1,se,1,2,"span",7)(2,be,1,2,"CheckIcon",6),T()),e&2){let o=f(2);l(),t("ngIf",o.checkboxIcon),l(),t("ngIf",!o.checkboxIcon)}}function ue(e,a){e&1&&x(0,"MinusIcon",9),e&2&&(t("styleClass","p-checkbox-icon"),s("data-pc-section","icon"))}function pe(e,a){if(e&1&&(w(0),d(1,de,3,2,"ng-container",4)(2,ue,1,2,"MinusIcon",6),T()),e&2){let o=f();l(),t("ngIf",o.checked),l(),t("ngIf",o._indeterminate())}}function ke(e,a){}function xe(e,a){e&1&&d(0,ke,0,0,"ng-template")}var fe=({dt:e})=>`
1
+ import{b as ce}from"./chunk-JQZRKOKE.js";import{a as ie}from"./chunk-ANG5YF2J.js";import{a as oe}from"./chunk-TCF45ELT.js";import{Na as Z,Oa as C,Wa as ee,a as X,d as J,ua as W,va as Y}from"./chunk-ALX7UOMP.js";import{c as U,f as G,h as H,m as K}from"./chunk-BYD3JK4R.js";import{Ab as D,Cb as d,Ga as E,Jb as s,Kb as t,Nb as _,Ob as v,Ub as $,Uc as h,Vb as I,Vc as P,Wb as x,Xb as w,Yb as T,_b as L,aa as M,ba as F,ca as S,dc as Q,ec as f,gb as l,ha as z,ic as V,jc as N,kc as g,lc as m,oa as B,pa as u,qa as p,ta as y,wb as O,xb as q,xc as j,yc as A,za as k,zc as R}from"./chunk-YVEUYFCE.js";var ae=["checkboxicon"],re=["input"],le=()=>({"p-checkbox-input":!0}),he=e=>({checked:e,class:"p-checkbox-icon"});function se(e,a){if(e&1&&x(0,"span",8),e&2){let o=f(3);t("ngClass",o.checkboxIcon),s("data-pc-section","icon")}}function be(e,a){e&1&&x(0,"CheckIcon",9),e&2&&(t("styleClass","p-checkbox-icon"),s("data-pc-section","icon"))}function de(e,a){if(e&1&&(w(0),d(1,se,1,2,"span",7)(2,be,1,2,"CheckIcon",6),T()),e&2){let o=f(2);l(),t("ngIf",o.checkboxIcon),l(),t("ngIf",!o.checkboxIcon)}}function ue(e,a){e&1&&x(0,"MinusIcon",9),e&2&&(t("styleClass","p-checkbox-icon"),s("data-pc-section","icon"))}function pe(e,a){if(e&1&&(w(0),d(1,de,3,2,"ng-container",4)(2,ue,1,2,"MinusIcon",6),T()),e&2){let o=f();l(),t("ngIf",o.checked),l(),t("ngIf",o._indeterminate())}}function ke(e,a){}function xe(e,a){e&1&&d(0,ke,0,0,"ng-template")}var fe=({dt:e})=>`
2
2
  .p-checkbox {
3
3
  position: relative;
4
4
  display: inline-flex;