@sachin9822/reports-lib 0.0.213 → 0.0.215

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 (211) hide show
  1. package/esm2020/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.mjs +240 -0
  2. package/esm2020/lib/components/accounting-report/accounting-report.component.mjs +614 -0
  3. package/esm2020/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.mjs +218 -0
  4. package/esm2020/lib/components/branch-activity-send-report/branch-activity-send-report.component.mjs +263 -0
  5. package/esm2020/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.mjs +718 -0
  6. package/esm2020/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.mjs +275 -0
  7. package/esm2020/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.mjs +192 -0
  8. package/esm2020/lib/components/funding-report/funding-report.component.mjs +198 -0
  9. package/esm2020/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.mjs +244 -0
  10. package/esm2020/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.mjs +776 -0
  11. package/esm2020/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.mjs +282 -0
  12. package/esm2020/lib/components/transaction-monitoring-report/transaction-monitoring-report.component.mjs +332 -0
  13. package/esm2020/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.mjs +631 -0
  14. package/esm2020/lib/models/acc-gl-details-enquiry-report/accgl-details-enquiry-reportmodel.mjs +2 -0
  15. package/esm2020/lib/models/acc-gl-details-enquiry-report/journal-voucher-entry-model.mjs +2 -0
  16. package/esm2020/lib/models/accounting-report/accounting-report-branch-group.mjs +2 -0
  17. package/esm2020/lib/models/accounting-report/accounting-report-entry-model.mjs +2 -0
  18. package/esm2020/lib/models/accounting-report/accounting-report-model.mjs +2 -0
  19. package/esm2020/lib/models/accounting-report/accounting-report-sub-group.mjs +2 -0
  20. package/esm2020/lib/models/app-config.model.mjs +2 -0
  21. package/esm2020/lib/models/branch-activity-receive-report/branch-activity-receive.model.mjs +2 -0
  22. package/esm2020/lib/models/branch-activity-report/branch-activity-send-report-request-domain-model.mjs +6 -0
  23. package/esm2020/lib/models/branch-activity-report/branch-activity-send-report.mjs +3 -0
  24. package/esm2020/lib/models/cancellation-transaction-report/cancellation-transaction.model.mjs +10 -0
  25. package/esm2020/lib/models/component-loading-states.mjs +7 -0
  26. package/esm2020/lib/models/credit-limit-status-enquiry-report/credit-limit-status-enquiry.model.mjs +5 -0
  27. package/esm2020/lib/models/revenue-per-transaction-report/revenue-per-transaction.model.mjs +2 -0
  28. package/esm2020/lib/models/statement-of-account-report/statement-of-accounts.model.mjs +2 -0
  29. package/esm2020/lib/models/transaction-enquiry-report/transaction-enquiry.model.mjs +8 -0
  30. package/esm2020/lib/models/transaction-monitoring-report/transaction-monitoring-report-request-domain-model.mjs +6 -0
  31. package/esm2020/lib/models/transaction-monitoring-report/transaction-monitoring-report.mjs +5 -0
  32. package/esm2020/lib/models/trial-balance-accounts-report/trial-balance-accounts.models.mjs +3 -0
  33. package/esm2020/lib/reports-lib-routing.module.mjs +24 -0
  34. package/esm2020/lib/reports-lib.component.mjs +22 -0
  35. package/esm2020/lib/reports-lib.module.mjs +172 -0
  36. package/esm2020/lib/reports-lib.service.mjs +14 -0
  37. package/esm2020/lib/services/config.service.mjs +39 -0
  38. package/esm2020/lib/services/report.service.mjs +374 -0
  39. package/esm2020/lib/shared/export-generic.service.mjs +443 -0
  40. package/esm2020/lib/shared/export.service.mjs +379 -0
  41. package/esm2020/lib/shared/loader/loader.component.mjs +11 -0
  42. package/esm2020/lib/shared/metadata/metadata.component.mjs +51 -0
  43. package/esm2020/lib/shared/page-size-selector/page-size-selector.component.mjs +44 -0
  44. package/esm2020/lib/shared/search-filter/search-filter.component.mjs +2147 -0
  45. package/esm2020/lib/shared/shared.module.mjs +21 -0
  46. package/esm2020/public-api.mjs +41 -0
  47. package/esm2020/sachin9822-reports-lib.mjs +5 -0
  48. package/fesm2015/sachin9822-reports-lib.mjs +8649 -0
  49. package/fesm2015/sachin9822-reports-lib.mjs.map +1 -0
  50. package/fesm2020/sachin9822-reports-lib.mjs +8510 -0
  51. package/fesm2020/sachin9822-reports-lib.mjs.map +1 -0
  52. package/index.d.ts +5 -0
  53. package/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.d.ts +70 -0
  54. package/lib/components/accounting-report/accounting-report.component.d.ts +76 -0
  55. package/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.d.ts +58 -0
  56. package/lib/components/branch-activity-send-report/branch-activity-send-report.component.d.ts +69 -0
  57. package/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.d.ts +78 -0
  58. package/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.d.ts +108 -0
  59. package/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.d.ts +55 -0
  60. package/lib/components/funding-report/funding-report.component.d.ts +55 -0
  61. package/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.d.ts +57 -0
  62. package/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.d.ts +109 -0
  63. package/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.d.ts +76 -0
  64. package/lib/components/transaction-monitoring-report/transaction-monitoring-report.component.d.ts +69 -0
  65. package/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.d.ts +71 -0
  66. package/lib/models/acc-gl-details-enquiry-report/accgl-details-enquiry-reportmodel.d.ts +8 -0
  67. package/lib/models/acc-gl-details-enquiry-report/journal-voucher-entry-model.d.ts +18 -0
  68. package/lib/models/accounting-report/accounting-report-branch-group.d.ts +6 -0
  69. package/lib/models/accounting-report/accounting-report-entry-model.d.ts +24 -0
  70. package/lib/models/accounting-report/accounting-report-model.d.ts +6 -0
  71. package/{src/lib/models/accounting-report/accounting-report-sub-group.ts → lib/models/accounting-report/accounting-report-sub-group.d.ts} +2 -3
  72. package/{src/lib/models/app-config.model.ts → lib/models/app-config.model.d.ts} +7 -8
  73. package/lib/models/branch-activity-receive-report/branch-activity-receive.model.d.ts +18 -0
  74. package/lib/models/branch-activity-report/branch-activity-send-report-request-domain-model.d.ts +13 -0
  75. package/lib/models/branch-activity-report/branch-activity-send-report.d.ts +24 -0
  76. package/lib/models/cancellation-transaction-report/cancellation-transaction.model.d.ts +44 -0
  77. package/lib/models/component-loading-states.d.ts +5 -0
  78. package/lib/models/credit-limit-status-enquiry-report/credit-limit-status-enquiry.model.d.ts +26 -0
  79. package/{src/lib/models/revenue-per-transaction-report/revenue-per-transaction.model.ts → lib/models/revenue-per-transaction-report/revenue-per-transaction.model.d.ts} +1 -1
  80. package/lib/models/statement-of-account-report/statement-of-accounts.model.d.ts +18 -0
  81. package/lib/models/transaction-enquiry-report/transaction-enquiry.model.d.ts +113 -0
  82. package/lib/models/transaction-monitoring-report/transaction-monitoring-report-request-domain-model.d.ts +13 -0
  83. package/lib/models/transaction-monitoring-report/transaction-monitoring-report.d.ts +23 -0
  84. package/lib/models/trial-balance-accounts-report/trial-balance-accounts.models.d.ts +38 -0
  85. package/lib/reports-lib-routing.module.d.ts +7 -0
  86. package/lib/reports-lib.component.d.ts +8 -0
  87. package/lib/reports-lib.module.d.ts +33 -0
  88. package/lib/reports-lib.service.d.ts +6 -0
  89. package/lib/services/config.service.d.ts +20 -0
  90. package/lib/services/report.service.d.ts +80 -0
  91. package/lib/shared/export-generic.service.d.ts +50 -0
  92. package/lib/shared/export.service.d.ts +32 -0
  93. package/lib/shared/loader/loader.component.d.ts +5 -0
  94. package/lib/shared/metadata/metadata.component.d.ts +24 -0
  95. package/lib/shared/page-size-selector/page-size-selector.component.d.ts +15 -0
  96. package/lib/shared/search-filter/search-filter.component.d.ts +127 -0
  97. package/lib/shared/shared.module.d.ts +11 -0
  98. package/package.json +31 -16
  99. package/{src/public-api.ts → public-api.d.ts} +7 -17
  100. package/karma.conf.js +0 -44
  101. package/ng-package.json +0 -17
  102. package/src/assets/images/BreadcrumbArrow.png +0 -0
  103. package/src/assets/images/XMCoral.png +0 -0
  104. package/src/lib/assets/images/Search.svg +0 -10
  105. package/src/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.html +0 -27
  106. package/src/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.scss +0 -46
  107. package/src/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.spec.ts +0 -23
  108. package/src/lib/components/acc-gl-details-enquiry-report/acc-gl-details-enquiry-report.component.ts +0 -292
  109. package/src/lib/components/accounting-report/accounting-report.component.html +0 -64
  110. package/src/lib/components/accounting-report/accounting-report.component.scss +0 -24
  111. package/src/lib/components/accounting-report/accounting-report.component.spec.ts +0 -23
  112. package/src/lib/components/accounting-report/accounting-report.component.ts +0 -738
  113. package/src/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.html +0 -46
  114. package/src/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.scss +0 -2
  115. package/src/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.spec.ts +0 -23
  116. package/src/lib/components/branch-activity-receive-report/branch-activity-receive-report.component.ts +0 -247
  117. package/src/lib/components/branch-activity-send-report/branch-activity-send-report.component.html +0 -46
  118. package/src/lib/components/branch-activity-send-report/branch-activity-send-report.component.scss +0 -3
  119. package/src/lib/components/branch-activity-send-report/branch-activity-send-report.component.spec.ts +0 -23
  120. package/src/lib/components/branch-activity-send-report/branch-activity-send-report.component.ts +0 -276
  121. package/src/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.html +0 -51
  122. package/src/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.scss +0 -7
  123. package/src/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.spec.ts +0 -23
  124. package/src/lib/components/branch-activity-send-summary-report/branch-activity-send-summary-report.component.ts +0 -840
  125. package/src/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.html +0 -68
  126. package/src/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.scss +0 -65
  127. package/src/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.spec.ts +0 -23
  128. package/src/lib/components/cancellation-transaction-report/cancellation-transaction-report.component.ts +0 -290
  129. package/src/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.html +0 -25
  130. package/src/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.scss +0 -1
  131. package/src/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.spec.ts +0 -23
  132. package/src/lib/components/credit-limit-status-enquiry-report/credit-limit-status-enquiry-report.component.ts +0 -213
  133. package/src/lib/components/funding-report/funding-report.component.html +0 -49
  134. package/src/lib/components/funding-report/funding-report.component.scss +0 -1
  135. package/src/lib/components/funding-report/funding-report.component.spec.ts +0 -23
  136. package/src/lib/components/funding-report/funding-report.component.ts +0 -221
  137. package/src/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.html +0 -26
  138. package/src/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.scss +0 -1
  139. package/src/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.spec.ts +0 -23
  140. package/src/lib/components/revenue-per-transaction-report/revenue-per-transaction-report.component.ts +0 -267
  141. package/src/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.html +0 -95
  142. package/src/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.scss +0 -54
  143. package/src/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.spec.ts +0 -23
  144. package/src/lib/components/statement-of-accounts-report/statement-of-accounts-report.component.ts +0 -904
  145. package/src/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.html +0 -49
  146. package/src/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.scss +0 -2
  147. package/src/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.spec.ts +0 -32
  148. package/src/lib/components/transaction-enquiry-report/transaction-enquiry-report.component.ts +0 -304
  149. package/src/lib/components/transaction-monitoring-report/transaction-monitoring-report.component.html +0 -46
  150. package/src/lib/components/transaction-monitoring-report/transaction-monitoring-report.component.scss +0 -7
  151. package/src/lib/components/transaction-monitoring-report/transaction-monitoring-report.component.ts +0 -343
  152. package/src/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.html +0 -25
  153. package/src/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.scss +0 -23
  154. package/src/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.spec.ts +0 -23
  155. package/src/lib/components/trial-balance-accounts-report/trial-balance-accounts-report.component.ts +0 -745
  156. package/src/lib/models/acc-gl-details-enquiry-report/accgl-details-enquiry-reportmodel.ts +0 -10
  157. package/src/lib/models/acc-gl-details-enquiry-report/journal-voucher-entry-model.ts +0 -20
  158. package/src/lib/models/accounting-report/accounting-report-branch-group.ts +0 -7
  159. package/src/lib/models/accounting-report/accounting-report-entry-model.ts +0 -25
  160. package/src/lib/models/accounting-report/accounting-report-model.ts +0 -7
  161. package/src/lib/models/branch-activity-receive-report/branch-activity-receive.model.ts +0 -18
  162. package/src/lib/models/branch-activity-report/branch-activity-send-report-request-domain-model.ts +0 -16
  163. package/src/lib/models/branch-activity-report/branch-activity-send-report.ts +0 -26
  164. package/src/lib/models/cancellation-transaction-report/cancellation-transaction.model.ts +0 -65
  165. package/src/lib/models/component-loading-states.ts +0 -5
  166. package/src/lib/models/credit-limit-status-enquiry-report/credit-limit-status-enquiry.model.ts +0 -28
  167. package/src/lib/models/statement-of-account-report/statement-of-accounts.model.ts +0 -21
  168. package/src/lib/models/transaction-enquiry-report/transaction-enquiry.model.ts +0 -127
  169. package/src/lib/models/transaction-monitoring-report/transaction-monitoring-report-request-domain-model.ts +0 -16
  170. package/src/lib/models/transaction-monitoring-report/transaction-monitoring-report.ts +0 -29
  171. package/src/lib/models/trial-balance-accounts-report/trial-balance-accounts.models.ts +0 -46
  172. package/src/lib/reports-lib-routing.module.ts +0 -20
  173. package/src/lib/reports-lib.component.spec.ts +0 -23
  174. package/src/lib/reports-lib.component.ts +0 -20
  175. package/src/lib/reports-lib.module.ts +0 -102
  176. package/src/lib/reports-lib.service.spec.ts +0 -16
  177. package/src/lib/reports-lib.service.ts +0 -9
  178. package/src/lib/services/config.service.ts +0 -43
  179. package/src/lib/services/report.service.spec.ts +0 -16
  180. package/src/lib/services/report.service.ts +0 -463
  181. package/src/lib/shared/export-generic.service.ts +0 -557
  182. package/src/lib/shared/export.service.spec.ts +0 -16
  183. package/src/lib/shared/export.service.ts +0 -457
  184. package/src/lib/shared/loader/loader.component.html +0 -8
  185. package/src/lib/shared/loader/loader.component.scss +0 -52
  186. package/src/lib/shared/loader/loader.component.ts +0 -10
  187. package/src/lib/shared/metadata/metadata.component.html +0 -42
  188. package/src/lib/shared/metadata/metadata.component.scss +0 -95
  189. package/src/lib/shared/metadata/metadata.component.spec.ts +0 -23
  190. package/src/lib/shared/metadata/metadata.component.ts +0 -38
  191. package/src/lib/shared/page-size-selector/page-size-selector.component.html +0 -7
  192. package/src/lib/shared/page-size-selector/page-size-selector.component.scss +0 -42
  193. package/src/lib/shared/page-size-selector/page-size-selector.component.spec.ts +0 -23
  194. package/src/lib/shared/page-size-selector/page-size-selector.component.ts +0 -38
  195. package/src/lib/shared/search-filter/search-filter.component.html +0 -601
  196. package/src/lib/shared/search-filter/search-filter.component.scss +0 -203
  197. package/src/lib/shared/search-filter/search-filter.component.spec.ts +0 -23
  198. package/src/lib/shared/search-filter/search-filter.component.ts +0 -2387
  199. package/src/lib/shared/shared.module.ts +0 -13
  200. package/src/styles/ag-grid-report-style.scss +0 -71
  201. package/src/styles/common-ag-grid-style.scss +0 -146
  202. package/src/styles/common-report-style.scss +0 -395
  203. package/src/styles/common-style.scss +0 -615
  204. package/src/test.ts +0 -27
  205. package/tsconfig.lib.json +0 -15
  206. package/tsconfig.lib.prod.json +0 -10
  207. package/tsconfig.spec.json +0 -17
  208. /package/{src/lib → lib}/assets/config/app-config.json +0 -0
  209. /package/{src → lib}/assets/images/Search.svg +0 -0
  210. /package/{src/lib → lib}/assets/images/XMLogo.png +0 -0
  211. /package/{src/lib → lib}/assets/svg-loaders/blue-tail-spin.svg +0 -0
@@ -1,457 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import jsPDF from 'jspdf';
3
- import 'jspdf-autotable';
4
- import * as ExcelJS from 'exceljs';
5
- import * as FileSaver from 'file-saver';
6
- import { formatDate } from '@angular/common';
7
-
8
- declare module 'jspdf' {
9
- interface jsPDF {
10
- autoTable: (options: any) => jsPDF;
11
- }
12
- }
13
-
14
- @Injectable({
15
- providedIn: 'root'
16
- })
17
- export class ExportService {
18
-
19
- private readonly pdfFontSize = 10;
20
- private readonly pdfLineHeight = 7;
21
- private readonly pdfLeftMargin = 15;
22
- public logoBase64: string | undefined;
23
-
24
- constructor() {
25
- this.loadImageAsBase64('assets/reports-lib/assets/images/XMLogo.png').then(base64 => {
26
- this.logoBase64 = base64;
27
- });
28
- }
29
-
30
- // ------------------------ Utility ------------------------
31
- private loadImageAsBase64(imagePath: string): Promise<string> {
32
- return new Promise((resolve, reject) => {
33
- const img = new Image();
34
- img.crossOrigin = 'anonymous';
35
- img.src = imagePath;
36
-
37
- img.onload = () => {
38
- const scale = 6;
39
- const canvas = document.createElement('canvas');
40
- canvas.width = img.width * scale;
41
- canvas.height = img.height * scale;
42
-
43
- const ctx = canvas.getContext('2d');
44
- if (ctx) {
45
- ctx.scale(scale, scale);
46
- ctx.drawImage(img, 0, 0);
47
- const base64 = canvas.toDataURL('image/png', 1.0); // 1.0 = highest quality
48
- resolve(base64);
49
- } else {
50
- reject('Failed to get canvas context.');
51
- }
52
- };
53
-
54
- img.onerror = () => reject('Failed to load image: ' + imagePath);
55
- });
56
- }
57
-
58
- formatDate(value: any): string {
59
- const date = new Date(value);
60
- return isNaN(date.getTime()) ? '' :
61
- `${date.getDate().toString().padStart(2, '0')}/${(date.getMonth() + 1).toString().padStart(2, '0')}/${date.getFullYear()}`;
62
- }
63
-
64
- formatDateTime(date: Date): string {
65
- const day = date.getDate().toString().padStart(2, '0');
66
- const month = (date.getMonth() + 1).toString().padStart(2, '0');
67
- const year = date.getFullYear();
68
-
69
- // 12-hour format
70
- let hours = date.getHours();
71
- const minutes = date.getMinutes().toString().padStart(2, '0');
72
- const ampm = hours >= 12 ? 'PM' : 'AM';
73
- hours = hours % 12;
74
- hours = hours ? hours : 12; // the hour '0' should be '12'
75
- const hoursStr = hours.toString().padStart(2, '0');
76
-
77
- return `${day}/${month}/${year} ${hoursStr}:${minutes} ${ampm}`;
78
- }
79
-
80
- generateReportMetadata(metadata: [string, string][]): [string, string][] {
81
- return metadata.filter(([_, value]) => value !== undefined && value !== null);
82
- }
83
-
84
- prepareExportTable(data: any[], columnDefs: any[], options: {
85
- excludeFields?: string[],
86
- currencyFields?: string[],
87
- rateFields?: string[],
88
- } = {}): { headers: string[], rows: any[][] } {
89
- const { excludeFields = ['srno'], currencyFields = [], rateFields = [] } = options;
90
-
91
- const filteredColumns = columnDefs.filter(col =>
92
- col.field &&
93
- !excludeFields.some(ex => col.field.toLowerCase().includes(ex)) &&
94
- !excludeFields.some(ex => col.headerName?.toLowerCase().includes(ex))
95
- );
96
-
97
- const headers = ['Sr No', ...filteredColumns.map(col => col.headerName || col.field)];
98
-
99
- const rows = data.map((row, index) => {
100
- const rowData = filteredColumns.map(col => {
101
- let value = row[col.field];
102
- const fieldName = col.field?.toLowerCase() || '';
103
-
104
- // Handle various date field names
105
- if (fieldName.includes('transactiondateandtime') && value) {
106
- value = formatDate(value, 'dd/MM/yyyy hh:mm a', 'en-US');
107
- } else if ((fieldName.includes('date') || fieldName.includes('businessdate')) && value) {
108
- // value = this.formatDate(value);
109
- if (value instanceof Date || !/^\d{2}\/\d{2}\/\d{4}/.test(value)) {
110
- value = this.formatDate(value);
111
- }
112
- }
113
-
114
- // Format currency fields
115
- if (currencyFields.includes(col.field) && value != null) {
116
- value = parseFloat(value).toFixed(3);
117
- }
118
-
119
- if (rateFields.includes(col.field) && value != null) {
120
- value = parseFloat(value).toFixed(8);
121
- }
122
-
123
- return value ?? '';
124
- });
125
- return [index + 1, ...rowData];
126
- });
127
- return { headers, rows };
128
- }
129
-
130
- // ------------------------ PDF Universal ------------------------
131
- async exportToPdfUniversal(title: string, metadata: [string, string][], searchCriteria: [string, string][], headers: string[], rows: any[][], fileName: string): Promise<void> {
132
- let doc;
133
- doc = new jsPDF({ orientation: 'landscape', unit: 'mm', format: [400, 210] });
134
-
135
- const logoWidth = 38.4, logoHeight = 17.5, logoX = 15, logoY = 10;
136
- const pageWidth = doc.internal.pageSize.width;
137
- const titleY = 18;
138
- const marginLeft = 15;
139
-
140
- if (this.logoBase64) {
141
- doc.addImage(this.logoBase64, 'PNG', logoX, logoY, logoWidth, logoHeight);
142
- }
143
-
144
- doc.setFontSize(15);
145
- doc.setFont('helvetica', 'bold');
146
- doc.text(title, pageWidth / 2, titleY, { align: 'center' });
147
-
148
- let currentY = titleY + 14;
149
- doc.setFontSize(this.pdfFontSize);
150
- metadata.forEach(([label, value], i) => {
151
- const y = currentY + i * this.pdfLineHeight;
152
- doc.setFont('helvetica', 'bold');
153
- doc.text(label, this.pdfLeftMargin, y);
154
- const labelWidth = doc.getTextWidth(label + ' ');
155
- doc.setFont('helvetica', 'normal');
156
- doc.text(value, this.pdfLeftMargin + labelWidth, y);
157
- });
158
- currentY += metadata.length * this.pdfLineHeight + 5;
159
-
160
- // --- draw search criteria heading ---
161
- doc.setFont('helvetica', 'bold');
162
- doc.text('Search Criteria:-', marginLeft, currentY);
163
- currentY += 8;
164
-
165
- const rowHeightPerLine = 6;
166
- const minGap = 2; // gap between key and value
167
- const betweenColumnsGap = 15; // gap between left and right columns (you can tune this)
168
- const pageContentWidth = doc.internal.pageSize.width - 2 * marginLeft;
169
-
170
- // --- helper function to measure total width of a key-value pair ---
171
- const measurePairWidth = (key: string, value: string): number => {
172
- doc.setFont('helvetica', 'bold');
173
- const keyWidth = doc.getTextWidth(key + ' ');
174
- doc.setFont('helvetica', 'normal');
175
- const valueWidth = doc.getTextWidth(value);
176
- return keyWidth + minGap + valueWidth;
177
- };
178
-
179
- // --- calculate max width of left column pairs dynamically ---
180
- let maxLeftPairWidth = 0;
181
- for (let i = 0; i < searchCriteria.length; i += 2) {
182
- if (searchCriteria[i]) {
183
- const [key, value] = searchCriteria[i];
184
- const width = measurePairWidth(key, value);
185
- if (width > maxLeftPairWidth) maxLeftPairWidth = width;
186
- }
187
- }
188
-
189
- // --- compute where right column should start ---
190
- const leftColumnStart = marginLeft;
191
- const rightColumnStart = leftColumnStart + maxLeftPairWidth + betweenColumnsGap;
192
-
193
- // --- print search criteria dynamically ---
194
- for (let i = 0; i < searchCriteria.length; i += 2) {
195
- let maxLineCount = 1;
196
-
197
- // Left column
198
- if (searchCriteria[i]) {
199
- const [key, value] = searchCriteria[i];
200
- doc.setFont('helvetica', 'bold');
201
- doc.text(key, leftColumnStart, currentY);
202
-
203
- doc.setFont('helvetica', 'normal');
204
- const keyWidth = doc.getTextWidth(key + ' ');
205
- const valueX = leftColumnStart + keyWidth + minGap;
206
- doc.text(value, valueX, currentY);
207
- }
208
-
209
- // Right column
210
- if (searchCriteria[i + 1]) {
211
- const [key, value] = searchCriteria[i + 1];
212
- doc.setFont('helvetica', 'bold');
213
- doc.text(key, rightColumnStart, currentY);
214
-
215
- doc.setFont('helvetica', 'normal');
216
- const keyWidth = doc.getTextWidth(key + ' ');
217
- const valueX = rightColumnStart + keyWidth + minGap;
218
- doc.text(value, valueX, currentY);
219
- }
220
-
221
- currentY += rowHeightPerLine;
222
- }
223
-
224
- const columnCount = headers.length;
225
- const tableWidth = pageWidth - (this.pdfLeftMargin * 2);
226
- const equalWidth = tableWidth / columnCount;
227
-
228
- const columnStyles: { [key: number]: any } = {};
229
- headers.forEach((_, i) => {
230
- columnStyles[i] = { cellWidth: equalWidth };
231
- });
232
-
233
- doc.autoTable({
234
- head: [headers],
235
- body: rows,
236
- startY: currentY,
237
- theme: 'grid',
238
- headStyles: {
239
- fillColor: [220, 220, 220], textColor: 0,
240
- fontStyle: 'bold', fontSize: 9, halign: 'center',
241
- },
242
- bodyStyles: { fontSize: 8, fillColor: [255, 255, 255], textColor: [0, 0, 0] },
243
- styles: { cellPadding: 2, overflow: 'linebreak', minCellHeight: 6 },
244
- columnStyles
245
- });
246
-
247
- const pageCount = doc.internal.getNumberOfPages();
248
- for (let i = 1; i <= pageCount; i++) {
249
- doc.setFont("helvetica", "bold");
250
- doc.setPage(i);
251
- doc.setFontSize(9);
252
- doc.setTextColor(100);
253
-
254
- const footerY = doc.internal.pageSize.height - 6;
255
-
256
- doc.text(
257
- `Page ${i} of ${pageCount}`,
258
- pageWidth - 15,
259
- footerY,
260
- { align: 'right' }
261
- );
262
- }
263
-
264
- doc.save(fileName);
265
- }
266
-
267
- // ------------------------ Excel Universal ------------------------
268
- exportToExcelUniversal(title: string, metadata: [string, string][], searchCriteria: [string, string][], headers: string[], rows: any[][], fileName: string): void {
269
- const workbook = new ExcelJS.Workbook();
270
- const worksheet = workbook.addWorksheet(title);
271
-
272
- let currentRow = 1;
273
-
274
- // Add image if available
275
- if (this.logoBase64) {
276
- const base64Data = this.logoBase64.replace(/^data:image\/\w+;base64,/, '');
277
- const imageId = workbook.addImage({
278
- base64: base64Data,
279
- extension: 'png',
280
- });
281
-
282
- // Place image at top-left (e.g., A1:C4)
283
- worksheet.addImage(imageId, {
284
- tl: { col: 0, row: 0 },
285
- ext: { width: 145, height: 66 },
286
- editAs: 'oneCell'
287
- });
288
- }
289
-
290
- // Add title aligned in middle horizontally (merged across all columns)
291
- const titleRow = worksheet.getRow(currentRow);
292
- titleRow.getCell(4).value = title;
293
- titleRow.getCell(4).font = { bold: true, size: 16 };
294
- titleRow.getCell(4).alignment = { vertical: 'middle', horizontal: 'left' };
295
-
296
- const titleMergeEnd = String.fromCharCode(64 + headers.length);
297
- worksheet.mergeCells(`D${currentRow}:${titleMergeEnd}${currentRow}`);
298
- currentRow += 3; // Move past image space
299
-
300
- // Add metadata
301
- metadata.forEach(([label, value]) => {
302
- const row = worksheet.getRow(currentRow++);
303
- const cell = row.getCell(1);
304
- cell.value = {
305
- richText: [
306
- { text: `${label}: `, font: { bold: true } },
307
- { text: value ?? '', font: { bold: false } }
308
- ]
309
- };
310
- worksheet.mergeCells(`A${row.number}:${String.fromCharCode(64 + headers.length)}${row.number}`);
311
- });
312
-
313
- worksheet.addRow([]);
314
- currentRow++;
315
- //=========================================================
316
- // --- search criteria heading ---
317
- worksheet.mergeCells(currentRow, 1, currentRow, 6);
318
- worksheet.getCell(currentRow, 1).value = 'Search Criteria:-';
319
- worksheet.getCell(currentRow, 1).font = { bold: true };
320
- currentRow += 2;
321
-
322
- for (let i = 0; i < searchCriteria.length; i += 2) {
323
- const left = searchCriteria[i];
324
- const right = searchCriteria[i + 1]; // may be undefined
325
- const row = worksheet.getRow(currentRow++);
326
-
327
- // Left cell
328
- worksheet.mergeCells(row.number, 1, row.number, 3);
329
- row.getCell(1).value = {
330
- richText: [
331
- { text: (left?.[0] ?? '') + ' ', font: { bold: true } },
332
- { text: left?.[1] ?? '' }
333
- ]
334
- };
335
- row.getCell(1).alignment = { wrapText: true, vertical: 'middle' };
336
-
337
- // Right cell (only if present)
338
- if (right) {
339
- worksheet.mergeCells(row.number, 4, row.number, 6);
340
- row.getCell(4).value = {
341
- richText: [
342
- { text: (right?.[0] ?? '') + ' ', font: { bold: true } },
343
- { text: right?.[1] ?? '' }
344
- ]
345
- };
346
- row.getCell(4).alignment = { wrapText: true, vertical: 'middle' };
347
- }
348
- }
349
- currentRow++;
350
- //============================================================
351
-
352
- // Add table header row
353
- const headerRow = worksheet.getRow(currentRow++);
354
- headers.forEach((header, i) => {
355
- const cell = headerRow.getCell(i + 1);
356
- cell.value = header;
357
- cell.font = { bold: true };
358
- cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'D9D9D9' } };
359
- cell.alignment = { vertical: 'middle', horizontal: 'center' };
360
- cell.border = {
361
- top: { style: 'thin' },
362
- bottom: { style: 'thin' },
363
- left: { style: 'thin' },
364
- right: { style: 'thin' }
365
- };
366
- });
367
-
368
- const dataStartRow = currentRow;
369
- rows.forEach(rowData => {
370
- const row = worksheet.getRow(currentRow++);
371
- rowData.forEach((value, i) => {
372
- const cell = row.getCell(i + 1);
373
- cell.value = value;
374
- cell.border = {
375
- top: { style: 'thin' },
376
- bottom: { style: 'thin' },
377
- left: { style: 'thin' },
378
- right: { style: 'thin' }
379
- };
380
- });
381
- });
382
-
383
- // Auto column widths
384
- for (let i = 1; i <= headers.length; i++) {
385
- let maxLength = headers[i - 1].length;
386
- for (let rowNum = dataStartRow; rowNum <= worksheet.lastRow!.number; rowNum++) {
387
- const val = worksheet.getRow(rowNum).getCell(i).value?.toString() || '';
388
- maxLength = Math.max(maxLength, val.length);
389
- }
390
- worksheet.getColumn(i).width = maxLength + 2;
391
- }
392
-
393
- workbook.xlsx.writeBuffer().then(buffer => {
394
- const blob = new Blob([buffer], {
395
- type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
396
- });
397
- FileSaver.saveAs(blob, fileName);
398
- });
399
- }
400
-
401
-
402
- // ------------------------ CSV Universal ------------------------
403
- exportToCsvUniversal(title: string, metadata: [string, string][], searchCriteria: [string, string][], headers: string[], rows: any[][], fileName: string): void {
404
- const escapeCsv = (value: any) => {
405
- if (value === null || value === undefined) return '';
406
- const str = value.toString();
407
- return str.includes(',') || str.includes('"') || str.includes('\n')
408
- ? `"${str.replace(/"/g, '""')}"`
409
- : str;
410
- };
411
-
412
- const metaRows = metadata.map(([k, v]) => [`${k} ${v}`]);
413
-
414
- // --- Build search criteria section ---
415
- const searchLines: string[] = [];
416
- if (searchCriteria?.length) {
417
- searchLines.push('Search Criteria:-');
418
-
419
- const maxLeftLength = Math.max(...searchCriteria.map(([k, v]) => (k + ' ' + v).length));
420
-
421
- for (let i = 0; i < searchCriteria.length; i += 2) {
422
- const left = searchCriteria[i];
423
- const right = searchCriteria[i + 1];
424
-
425
- const leftText = left ? `${left[0]} ${left[1]}`.padEnd(maxLeftLength + 5, ' ') : '';
426
- const rightText = right ? `${right[0]} ${right[1]}` : '';
427
-
428
- searchLines.push(`"${leftText}${rightText}"`); // wrap in quotes for single CSV cell
429
- }
430
- searchLines.push(''); // blank line after criteria
431
- }
432
-
433
- // --- Combine all parts ---
434
- const csvContent = [
435
- [title].join(','),
436
- ...metaRows.map(e => e.join(',')),
437
- '',
438
- ...searchLines, // ✅ this block is column-independent
439
- headers.join(','),
440
- ...rows.map(row => row.map(value => escapeCsv(value)).join(','))
441
- ].join('\n');
442
-
443
- this.downloadFile(csvContent, fileName, 'text/csv');
444
- }
445
-
446
- private downloadFile(data: string, filename: string, type: string): void {
447
- const blob = new Blob([data], { type });
448
- const link = document.createElement('a');
449
- link.href = URL.createObjectURL(blob);
450
- link.setAttribute('download', filename);
451
- document.body.appendChild(link);
452
- link.click();
453
- document.body.removeChild(link);
454
- }
455
-
456
- }
457
-
@@ -1,8 +0,0 @@
1
- <div class="loaderContainer">
2
- <div class="loading">
3
- <div class="loading-bar"></div>
4
- <div class="loading-bar"></div>
5
- <div class="loading-bar"></div>
6
- <div class="loading-bar"></div>
7
- </div>
8
- </div>
@@ -1,52 +0,0 @@
1
- $Grey: #8091a5;
2
- .loaderContainer {
3
- width: 100%;
4
- height: 100%;
5
- display: block;
6
- position: absolute;
7
- background: rgba(255, 255, 255, 0.75);
8
- top: 0;
9
- left: 0;
10
- z-index: 10;
11
- .loading {
12
- position: absolute;
13
- top: 50%;
14
- left: 50%;
15
- width: 30px;
16
- .loading-bar {
17
- display: inline-block;
18
- width: 3px;
19
- margin-right:2px;
20
- height: 18px;
21
- animation: loading 1s ease-in-out infinite;
22
- &:nth-child(1) {
23
- background-color: $Grey;
24
- animation-delay: 0;
25
- }
26
- &:nth-child(2) {
27
- background-color: $Grey;
28
- animation-delay: 0.09s;
29
- }
30
- &:nth-child(3) {
31
- background-color: $Grey;
32
- animation-delay: 0.18s;
33
- }
34
- &:nth-child(4) {
35
- background-color: $Grey;
36
- animation-delay: 0.27s;
37
- }
38
- }
39
- }
40
- }
41
-
42
- @keyframes loading {
43
- 0% {
44
- transform: scale(1);
45
- }
46
- 20% {
47
- transform: scale(1, 2.2);
48
- }
49
- 40% {
50
- transform: scale(1);
51
- }
52
- }
@@ -1,10 +0,0 @@
1
- import { Component, Input } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'app-loader',
5
- templateUrl: './loader.component.html',
6
- styleUrls: ['./loader.component.scss']
7
- })
8
-
9
- export class LoaderComponent {
10
- }
@@ -1,42 +0,0 @@
1
- <section class="my-2">
2
- <div class="title mb-3">
3
- {{reportName}}
4
- </div>
5
- <div class="meta mb-2">
6
- <div *ngIf="showmetaDataOne" class="data-holder">
7
- <tbody>
8
- <tr *ngFor="let item of metaDataOne | keyvalue:preserveOrder">
9
- <td class="labl meta-td">{{item.key}}</td>
10
- <td class="px-3 meta-td"><span class="info">: {{item.value}}</span></td>
11
- </tr>
12
- </tbody>
13
- </div>
14
- <div *ngIf="showmetaDataTwo" class="data-holder">
15
- <tbody>
16
- <tr *ngFor="let item of metaDataTwo | keyvalue:preserveOrder">
17
- <td class="labl meta-td">{{item.key}}</td>
18
- <td class="px-3 meta-td"><span class="info">: {{item.value}}</span></td>
19
- </tr>
20
- </tbody>
21
- </div>
22
- </div>
23
- <div class="search-export">
24
- <div class="searchBox">
25
- <input type="text" [(ngModel)]="searchText" name="searchText" class="search-input"
26
- (ngModelChange)="onSearch()" placeholder="Search..." autocomplete="off" />
27
-
28
- <button type="button" class="btn btn-sm search-btn" (click)="onSearch()">
29
- <img src="assets/images/Search.svg" alt="Search" class="search-icon" />
30
- </button>
31
- </div>
32
-
33
- <div class="export">
34
- <div class="exp-options">
35
- <ng-select [items]="exportFormats" bindLabel="formatName" bindValue="code" placeholder="Select Format"
36
- [(ngModel)]="selectedExportOption" [clearable]="false" class="export-selector" required>
37
- </ng-select>
38
- </div>
39
- <button class="btn btn-report" (click)="handleExport()">Export</button>
40
- </div>
41
- </div>
42
- </section>
@@ -1,95 +0,0 @@
1
- .title {
2
- text-align: center;
3
- font-size: 18px;
4
- font-weight: bold !important;
5
- }
6
-
7
- .meta{
8
- position:relative;
9
- display: flex;
10
- justify-content: space-between;
11
- align-items: center;
12
- }
13
-
14
- .labl {
15
- font-size: 11.2px;
16
- font-weight: bold !important;
17
- }
18
-
19
- .info {
20
- font-size: 12px !important;
21
- font-weight: 400;
22
- padding-left: 0.5rem;
23
- }
24
- .meta-td{
25
- padding: 0 !important;
26
- }
27
-
28
- .search-export{
29
- position: relative;
30
- display: flex;
31
- justify-content: space-between;
32
- }
33
-
34
- .searchBox{
35
- display: inline-flex;
36
- }
37
-
38
- .search-btn {
39
- height: 32px;
40
- width: 36px;
41
- background-color: #8091a5;
42
- border: none;
43
- border-top-right-radius: 4px;
44
- border-bottom-right-radius: 4px;
45
- border-top-left-radius: 0;
46
- border-bottom-left-radius: 0;
47
- display: flex;
48
- justify-content: center;
49
- align-items: center;
50
- }
51
-
52
- .search-input {
53
- outline: none !important;
54
- border: 1px solid #ccc !important;
55
- width: 190px;
56
- height: 32px !important;
57
- font-size: 0.75rem;
58
- padding: 0.25rem 0.5rem;
59
- border-top-left-radius: 4px;
60
- border-bottom-left-radius: 4px;
61
- border-top-right-radius: 0 !important;
62
- border-bottom-right-radius: 0 !important;
63
- text-transform: uppercase;
64
- }
65
- .search-input:focus{
66
- box-shadow: 0 0 5px 3px rgba(24,119,242,1.000) !important;
67
- }
68
-
69
- .export{
70
- display: flex;
71
- }
72
-
73
- .exp-options{
74
- display: inline-flex;
75
- font-size: 0.75rem;
76
- height: 2rem !important;
77
- width: 5rem !important;
78
- }
79
- :host ::ng-deep .exp-options .ng-select {
80
- width: 100%;
81
- }
82
-
83
- .btn-report{
84
- border-radius: 3px;
85
- background-color: #8091a5;
86
- color: #fff !important;
87
- font-size: 14px !important;
88
- height: 32px !important;
89
- height: 32px;
90
- min-width: 103px;
91
- margin: 0 0 0 20px !important;
92
- padding: 4px 15px !important;
93
- }
94
-
95
-
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { MetadataComponent } from './metadata.component';
4
-
5
- describe('MetadataComponent', () => {
6
- let component: MetadataComponent;
7
- let fixture: ComponentFixture<MetadataComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ MetadataComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(MetadataComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });