@unifylib/ui-lib 1.0.3 → 1.1.3
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.
- package/ng-package.json +7 -7
- package/package.json +14 -12
- package/src/lib/base-model/SearchStrConfig.ts +12 -12
- package/src/lib/base-model/api-response.ts +23 -23
- package/src/lib/base-model/audit-log-entry.ts +7 -7
- package/src/lib/base-model/button-action-settings.ts +29 -25
- package/src/lib/base-model/column-def.model.ts +34 -34
- package/src/lib/base-model/do-action-request.ts +11 -11
- package/src/lib/base-model/feature-item.ts +9 -0
- package/src/lib/base-model/field-action.ts +7 -7
- package/src/lib/base-model/field-filter.model.ts +7 -14
- package/src/lib/base-model/field-info.ts +102 -98
- package/src/lib/base-model/field-predicate.model.ts +7 -7
- package/src/lib/base-model/filter-request.ts +27 -27
- package/src/lib/base-model/filter.model.ts +49 -49
- package/src/lib/base-model/get-items-list.ts +24 -24
- package/src/lib/base-model/index.ts +11 -11
- package/src/lib/base-model/items-total.model.ts +12 -0
- package/src/lib/base-model/line-item.model.ts +18 -0
- package/src/lib/base-model/lookupItem.ts +21 -21
- package/src/lib/base-model/null-snackmessage.ts +9 -9
- package/src/lib/base-model/page-info.ts +54 -51
- package/src/lib/base-model/report-request.model.ts +33 -33
- package/src/lib/base-model/response-envelop.model.ts +15 -15
- package/src/lib/base-model/snack-message.model.ts +14 -14
- package/src/lib/base-model/snackmessage-interface.ts +7 -7
- package/src/lib/base-model/table-column.interface.ts +29 -29
- package/src/lib/base-model/table-page-user-action.interface.ts +33 -33
- package/src/lib/base-model/workflow/workflow-steps.model.ts +9 -9
- package/src/lib/base-model/workflow/workflow.model.ts +52 -52
- package/src/lib/components/action-comment/action-comment.component.css +52 -0
- package/src/lib/components/action-comment/action-comment.component.html +47 -0
- package/src/lib/components/{rejection-comment → action-comment}/action-comment.component.spec.ts +23 -23
- package/src/lib/components/{rejection-comment → action-comment}/action-comment.component.ts +102 -86
- package/src/lib/components/action-confirmation/action-confirmation.component.css +46 -34
- package/src/lib/components/action-confirmation/action-confirmation.component.html +32 -18
- package/src/lib/components/action-confirmation/action-confirmation.component.spec.ts +23 -23
- package/src/lib/components/action-confirmation/action-confirmation.component.ts +58 -58
- package/src/lib/components/activity-report-form/activity-report-form.component.html +110 -109
- package/src/lib/components/activity-report-form/activity-report-form.component.scss +69 -0
- package/src/lib/components/activity-report-form/activity-report-form.component.spec.ts +25 -25
- package/src/lib/components/activity-report-form/activity-report-form.component.ts +616 -605
- package/src/lib/components/advanced-filter/field-filter/field-filter.component.html +8 -0
- package/src/lib/components/advanced-filter/field-filter/field-filter.component.scss +0 -0
- package/src/lib/components/advanced-filter/field-filter/field-filter.component.spec.ts +25 -0
- package/src/lib/components/advanced-filter/field-filter/field-filter.component.ts +55 -0
- package/src/lib/components/advanced-filter/filter-builder/filter-builder.component.html +36 -0
- package/src/lib/components/advanced-filter/filter-builder/filter-builder.component.scss +130 -0
- package/src/lib/components/advanced-filter/filter-builder/filter-builder.component.spec.ts +25 -0
- package/src/lib/components/advanced-filter/filter-builder/filter-builder.component.ts +186 -0
- package/src/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.css +51 -51
- package/src/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.html +23 -23
- package/src/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.spec.ts +23 -23
- package/src/lib/components/audit-log-details-dialog/audit-log-details-dialog.component.ts +69 -69
- package/src/lib/components/audit-log-list/audit-log.component.html +26 -23
- package/src/lib/components/audit-log-list/audit-log.component.scss +50 -0
- package/src/lib/components/audit-log-list/audit-log.component.spec.ts +25 -25
- package/src/lib/components/audit-log-list/audit-log.component.ts +114 -116
- package/src/lib/components/auto-complete/auto-complete.component.css +55 -14
- package/src/lib/components/auto-complete/auto-complete.component.html +45 -29
- package/src/lib/components/auto-complete/auto-complete.component.spec.ts +23 -23
- package/src/lib/components/auto-complete/auto-complete.component.ts +331 -330
- package/src/lib/components/base-form/base-form.component.html +59 -58
- package/src/lib/components/base-form/base-form.component.scss +68 -0
- package/src/lib/components/base-form/base-form.component.spec.ts +25 -25
- package/src/lib/components/base-form/base-form.component.ts +323 -305
- package/src/lib/components/base-form-canvas/base-form-canvas.component.css +196 -22
- package/src/lib/components/base-form-canvas/base-form-canvas.component.html +1095 -1006
- package/src/lib/components/base-form-canvas/base-form-canvas.component.spec.ts +23 -23
- package/src/lib/components/base-form-canvas/base-form-canvas.component.ts +680 -573
- package/src/lib/components/base-input-dialog/base-input-dialog.component.css +67 -0
- package/src/lib/components/base-input-dialog/base-input-dialog.component.html +47 -42
- package/src/lib/components/base-input-dialog/base-input-dialog.component.spec.ts +23 -23
- package/src/lib/components/base-input-dialog/base-input-dialog.component.ts +77 -78
- package/src/lib/components/base-table/base-table.component.html +268 -242
- package/src/lib/components/base-table/base-table.component.scss +140 -31
- package/src/lib/components/base-table/base-table.component.spec.ts +25 -25
- package/src/lib/components/base-table/base-table.component.ts +621 -568
- package/src/lib/components/button-actions/button-actions.component.html +27 -28
- package/src/lib/components/button-actions/button-actions.component.scss +101 -6
- package/src/lib/components/button-actions/button-actions.component.spec.ts +23 -23
- package/src/lib/components/button-actions/button-actions.component.ts +70 -72
- package/src/lib/components/editable-base-table/editable-base-table.component.html +337 -372
- package/src/lib/components/editable-base-table/editable-base-table.component.scss +126 -44
- package/src/lib/components/editable-base-table/editable-base-table.component.spec.ts +25 -25
- package/src/lib/components/editable-base-table/editable-base-table.component.ts +579 -570
- package/src/lib/components/equation-builder/equation-builder.component.css +39 -0
- package/src/lib/components/equation-builder/equation-builder.component.html +31 -31
- package/src/lib/components/equation-builder/equation-builder.component.spec.ts +23 -23
- package/src/lib/components/equation-builder/equation-builder.component.ts +119 -121
- package/src/lib/components/item-line-editor/item-line-editor.component.html +102 -0
- package/src/lib/components/item-line-editor/item-line-editor.component.scss +152 -0
- package/src/lib/components/item-line-editor/item-line-editor.component.spec.ts +23 -0
- package/src/lib/components/item-line-editor/item-line-editor.component.ts +306 -0
- package/src/lib/components/multi-auto-complete/multi-auto-complete.component.css +19 -11
- package/src/lib/components/multi-auto-complete/multi-auto-complete.component.html +38 -38
- package/src/lib/components/multi-auto-complete/multi-auto-complete.component.spec.ts +23 -23
- package/src/lib/components/multi-auto-complete/multi-auto-complete.component.ts +315 -317
- package/src/lib/components/paginator/paginator.component.css +65 -25
- package/src/lib/components/paginator/paginator.component.html +30 -34
- package/src/lib/components/paginator/paginator.component.ts +87 -94
- package/src/lib/components/report-details-dialog/report-details-dialog.component.css +17 -17
- package/src/lib/components/report-details-dialog/report-details-dialog.component.html +16 -16
- package/src/lib/components/report-details-dialog/report-details-dialog.component.spec.ts +23 -23
- package/src/lib/components/report-details-dialog/report-details-dialog.component.ts +111 -113
- package/src/lib/components/report-form/report-form.component.html +92 -94
- package/src/lib/components/report-form/report-form.component.scss +51 -0
- package/src/lib/components/report-form/report-form.component.spec.ts +25 -25
- package/src/lib/components/report-form/report-form.component.ts +599 -588
- package/src/lib/components/search-bar/search-bar.component.html +51 -62
- package/src/lib/components/search-bar/search-bar.component.scss +63 -8
- package/src/lib/components/search-bar/search-bar.component.spec.ts +25 -25
- package/src/lib/components/search-bar/search-bar.component.ts +68 -70
- package/src/lib/components/section-form-canvas/section-form-canvas.component.html +43 -0
- package/src/lib/components/section-form-canvas/section-form-canvas.component.scss +81 -0
- package/src/lib/components/section-form-canvas/section-form-canvas.component.spec.ts +23 -0
- package/src/lib/components/section-form-canvas/section-form-canvas.component.ts +67 -0
- package/src/lib/components/shared/action-button/action-button.component.html +12 -0
- package/src/lib/components/shared/action-button/action-button.component.scss +45 -0
- package/src/lib/components/shared/action-button/action-button.component.ts +51 -0
- package/src/lib/components/shared/action-card/action-card.component.html +78 -0
- package/src/lib/components/shared/action-card/action-card.component.scss +238 -0
- package/src/lib/components/shared/action-card/action-card.component.ts +56 -0
- package/src/lib/components/shared/attachment-uploader/attachment-uploader.component.css +135 -54
- package/src/lib/components/shared/attachment-uploader/attachment-uploader.component.html +36 -22
- package/src/lib/components/shared/attachment-uploader/attachment-uploader.component.spec.ts +23 -23
- package/src/lib/components/shared/attachment-uploader/attachment-uploader.component.ts +71 -45
- package/src/lib/components/shared-list/shared-list.component.html +17 -17
- package/src/lib/components/shared-list/shared-list.component.spec.ts +23 -23
- package/src/lib/components/shared-list/shared-list.component.ts +53 -53
- package/src/lib/components/snackbar-static/snackbar-static.component.html +20 -0
- package/src/lib/components/snackbar-static/snackbar-static.component.scss +135 -0
- package/src/lib/components/snackbar-static/snackbar-static.component.ts +26 -0
- package/src/lib/components/title-bar/title-bar.component.html +35 -31
- package/src/lib/components/title-bar/title-bar.component.scss +126 -23
- package/src/lib/components/title-bar/title-bar.component.spec.ts +23 -23
- package/src/lib/components/title-bar/title-bar.component.ts +126 -119
- package/src/lib/services/backend-service.ts +287 -286
- package/src/lib/services/index.ts +3 -3
- package/src/lib/services/top-panel.ts +17 -17
- package/src/lib/services/trigger-form.service.ts +11 -11
- package/src/lib/share-module/shared-module.ts +10 -10
- package/src/lib/utils/base-utils.ts +102 -102
- package/src/lib/validators/date-range-validator.ts +31 -31
- package/src/lib/validators/index.ts +3 -3
- package/src/lib/validators/match-list.validator.ts +10 -10
- package/src/lib/validators/multi-email-validator.ts +15 -15
- package/src/public-api.ts +29 -21
- package/tsconfig.lib.json +15 -15
- package/tsconfig.lib.prod.json +11 -11
- package/tsconfig.spec.json +15 -15
- package/src/lib/components/rejection-comment/action-comment.component.css +0 -33
- package/src/lib/components/rejection-comment/action-comment.component.html +0 -46
- package/src/lib/styles/invoiceq-theme.scss +0 -252
- package/src/lib/styles/styles.scss +0 -1723
|
@@ -1,588 +1,599 @@
|
|
|
1
|
-
import {ChangeDetectionStrategy, Component, EventEmitter, Injector, Input, OnInit, Output} from '@angular/core';
|
|
2
|
-
import {FieldInfo} from "../../base-model/field-info";
|
|
3
|
-
import {EMPTY_PAGE_INFO, PageInfo} from "../../base-model/page-info";
|
|
4
|
-
import {TableColumn} from "../../base-model/table-column.interface";
|
|
5
|
-
import {FieldMessage} from "../../base-model/api-response";
|
|
6
|
-
import {TranslateModule, TranslateService} from "@ngx-translate/core";
|
|
7
|
-
import {BackendService} from "../../services/backend-service";
|
|
8
|
-
import {ActivatedRoute, Router} from "@angular/router";
|
|
9
|
-
import {FormBuilder, FormGroup} from "@angular/forms";
|
|
10
|
-
import {formatDate, NgForOf, NgIf} from "@angular/common";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
21
|
-
import {DRILL_DOWN_ACTION, JUNIOR_DOWN_ACTION, SnackMessage, TablePageUserAction} from "../../base-model";
|
|
22
|
-
import {} from "../audit-log-details-dialog/audit-log-details-dialog.component";
|
|
23
|
-
import {MatDialog} from "@angular/material/dialog";
|
|
24
|
-
import {ReportDetailsDialogComponent} from "../report-details-dialog/report-details-dialog.component";
|
|
25
|
-
import { cloneDeep } from 'lodash';
|
|
26
|
-
import {MatTooltip} from "@angular/material/tooltip";
|
|
27
|
-
import {Directionality} from "@angular/cdk/bidi";
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const NON_REPORT_COLUMNS = ['listAction', 'button', 'checkbox'];
|
|
31
|
-
|
|
32
|
-
@Component({
|
|
33
|
-
selector: 'app-report-form',
|
|
34
|
-
standalone: true,
|
|
35
|
-
imports: [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
@Input()
|
|
65
|
-
@Input()
|
|
66
|
-
@Input()
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
private
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
private
|
|
107
|
-
private
|
|
108
|
-
private
|
|
109
|
-
private
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
this.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if (
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
this.
|
|
169
|
-
this.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
})
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
this.
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
this.
|
|
306
|
-
|
|
307
|
-
this.
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
.
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
];
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
this.
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
'
|
|
414
|
-
);
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
private
|
|
418
|
-
return
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
private
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
fieldName,
|
|
432
|
-
label: '',
|
|
433
|
-
filterType: 'FILED_FILTER',
|
|
434
|
-
operator: 'EQUALS',
|
|
435
|
-
valueObject: value,
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
this.
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
this.
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
//
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
if (
|
|
563
|
-
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
return
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
1
|
+
import {ChangeDetectionStrategy, Component, EventEmitter, Injector, Input, OnInit, Output} from '@angular/core';
|
|
2
|
+
import {FieldInfo} from "../../base-model/field-info";
|
|
3
|
+
import {EMPTY_PAGE_INFO, PageInfo} from "../../base-model/page-info";
|
|
4
|
+
import {TableColumn} from "../../base-model/table-column.interface";
|
|
5
|
+
import {FieldMessage} from "../../base-model/api-response";
|
|
6
|
+
import {TranslateModule, TranslateService} from "@ngx-translate/core";
|
|
7
|
+
import {BackendService} from "../../services/backend-service";
|
|
8
|
+
import {ActivatedRoute, Router} from "@angular/router";
|
|
9
|
+
import {FormBuilder, FormGroup} from "@angular/forms";
|
|
10
|
+
import {formatDate, NgForOf, NgIf} from "@angular/common";
|
|
11
|
+
import {MatMenu, MatMenuItem, MatMenuTrigger} from "@angular/material/menu";
|
|
12
|
+
import {MatButton, MatButtonModule} from "@angular/material/button";
|
|
13
|
+
import {BaseTableComponent} from "../base-table/base-table.component";
|
|
14
|
+
import {MatIconModule} from "@angular/material/icon";
|
|
15
|
+
import {FilterRequest} from "../../base-model/filter-request";
|
|
16
|
+
import {ReportRequest} from "../../base-model/report-request.model";
|
|
17
|
+
import {Filter} from "../../base-model/filter.model";
|
|
18
|
+
import {TitleBarComponent} from "../title-bar/title-bar.component";
|
|
19
|
+
import {BaseFormCanvasComponent} from "../base-form-canvas/base-form-canvas.component";
|
|
20
|
+
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
|
|
21
|
+
import {DRILL_DOWN_ACTION, JUNIOR_DOWN_ACTION, SnackMessage, TablePageUserAction} from "../../base-model";
|
|
22
|
+
import {} from "../audit-log-details-dialog/audit-log-details-dialog.component";
|
|
23
|
+
import {MatDialog} from "@angular/material/dialog";
|
|
24
|
+
import {ReportDetailsDialogComponent} from "../report-details-dialog/report-details-dialog.component";
|
|
25
|
+
import { cloneDeep } from 'lodash';
|
|
26
|
+
import {MatTooltip} from "@angular/material/tooltip";
|
|
27
|
+
import {Directionality} from "@angular/cdk/bidi";
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
const NON_REPORT_COLUMNS = ['listAction', 'button', 'checkbox'];
|
|
31
|
+
|
|
32
|
+
@Component({
|
|
33
|
+
selector: 'app-report-form',
|
|
34
|
+
standalone: true,
|
|
35
|
+
imports: [
|
|
36
|
+
TitleBarComponent,
|
|
37
|
+
BaseFormCanvasComponent,
|
|
38
|
+
MatMenu,
|
|
39
|
+
MatMenuItem,
|
|
40
|
+
NgForOf,
|
|
41
|
+
MatMenuTrigger,
|
|
42
|
+
MatButtonModule,
|
|
43
|
+
TranslateModule,
|
|
44
|
+
BaseTableComponent,
|
|
45
|
+
NgIf,
|
|
46
|
+
MatIconModule,
|
|
47
|
+
MatButton,
|
|
48
|
+
MatTooltip
|
|
49
|
+
],
|
|
50
|
+
templateUrl: './report-form.component.html',
|
|
51
|
+
styleUrl: './report-form.component.scss'
|
|
52
|
+
})
|
|
53
|
+
export class ReportFormComponent implements OnInit {
|
|
54
|
+
@Input()
|
|
55
|
+
showDetails : any = [];
|
|
56
|
+
|
|
57
|
+
@Input()
|
|
58
|
+
showExtractButton: boolean = true;
|
|
59
|
+
|
|
60
|
+
@Input()
|
|
61
|
+
columns: TableColumn<any>[] =[];
|
|
62
|
+
|
|
63
|
+
@Input() actionRequestCallback!: (actionRequest: TablePageUserAction) => TablePageUserAction;
|
|
64
|
+
@Input() enrichDrillDownReportRequest!: (actionRequest: TablePageUserAction, reportRequest: ReportRequest) => TablePageUserAction;
|
|
65
|
+
@Input() enrichHyperLinkReportRequest!: (actionRequest: TablePageUserAction, reportRequest: ReportRequest) => TablePageUserAction;
|
|
66
|
+
@Input() enrichJuniorReportRequest!: (actionRequest: TablePageUserAction, reportRequest: ReportRequest) => TablePageUserAction;
|
|
67
|
+
|
|
68
|
+
@Output()
|
|
69
|
+
userAction: EventEmitter<TablePageUserAction> = new EventEmitter<TablePageUserAction>();
|
|
70
|
+
activeLevel: number = 1;
|
|
71
|
+
|
|
72
|
+
private filterRequest: FilterRequest;
|
|
73
|
+
x: any;
|
|
74
|
+
isEditable: boolean = true;
|
|
75
|
+
fields: FieldInfo[] = [];
|
|
76
|
+
pageInfo: PageInfo = EMPTY_PAGE_INFO;
|
|
77
|
+
drillDownPageInfo: PageInfo = EMPTY_PAGE_INFO;
|
|
78
|
+
drillDownColumns: TableColumn<any>[] = [];
|
|
79
|
+
hideDrillDownButton: false;
|
|
80
|
+
|
|
81
|
+
juniorPageInfo: PageInfo = EMPTY_PAGE_INFO;
|
|
82
|
+
juniorColumns: TableColumn<any>[] = [];
|
|
83
|
+
|
|
84
|
+
columnsDefinition: TableColumn<any>[] = [];
|
|
85
|
+
types: string[] = ["pdf", "csv", "xlsx"]
|
|
86
|
+
searchStr: string = '';
|
|
87
|
+
|
|
88
|
+
errors: FieldMessage[] = [];
|
|
89
|
+
|
|
90
|
+
reloadData: boolean = false;
|
|
91
|
+
backButtonEnabled: boolean = true;
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
reportRequest: ReportRequest = new ReportRequest({});
|
|
95
|
+
childReportRequest: ReportRequest = new ReportRequest({});
|
|
96
|
+
juniorReportRequest: ReportRequest = new ReportRequest({});
|
|
97
|
+
public reportForm: FormGroup;
|
|
98
|
+
readyToSearch = false;
|
|
99
|
+
private pageSize: any;
|
|
100
|
+
private dialogReportRequest: any;
|
|
101
|
+
currentDirection: 'ltr' | 'rtl';
|
|
102
|
+
|
|
103
|
+
constructor(private translateService: TranslateService,
|
|
104
|
+
public backendService: BackendService,
|
|
105
|
+
private activatedRoute: ActivatedRoute,
|
|
106
|
+
private injector: Injector,
|
|
107
|
+
private router: Router,
|
|
108
|
+
private route: ActivatedRoute,
|
|
109
|
+
private directionality: Directionality,
|
|
110
|
+
public dialog: MatDialog,
|
|
111
|
+
private fb: FormBuilder) {
|
|
112
|
+
ClassicEditor.defaultConfig = {
|
|
113
|
+
toolbar: {
|
|
114
|
+
items: ['heading', '|', 'bold', 'italic', '|', 'bulletedList', 'numberedList']
|
|
115
|
+
},
|
|
116
|
+
image: {
|
|
117
|
+
toolbar: ['imageStyle:side', '|', 'imageTextAlternative']
|
|
118
|
+
},
|
|
119
|
+
table: {
|
|
120
|
+
contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ]
|
|
121
|
+
},
|
|
122
|
+
language: 'en'
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
disableExportAction : boolean = false;
|
|
127
|
+
|
|
128
|
+
ngOnInit(): void {
|
|
129
|
+
this.currentDirection = this.directionality.value;
|
|
130
|
+
this.directionality.change.subscribe((value) => {
|
|
131
|
+
this.currentDirection = value;
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
this.activatedRoute.data.subscribe(data => {
|
|
135
|
+
this.pageInfo = data['pageInfo'];
|
|
136
|
+
this.pageSize = this.pageInfo.pageSize ?? 10;
|
|
137
|
+
this.filterRequest = new FilterRequest(this.pageSize);
|
|
138
|
+
data['pageInfo'].lazyLoadData = true;
|
|
139
|
+
this.drillDownPageInfo = data['drillDownPageInfo'];
|
|
140
|
+
this.drillDownColumns = data['drillDownColumns']?.filter(c => c.property !== 'selectItem');
|
|
141
|
+
this.hideDrillDownButton = data['hideDrillDownButton'] ?? false;
|
|
142
|
+
this.juniorPageInfo = data['juniorPageInfo'];
|
|
143
|
+
this.juniorColumns = data['juniorColumns'];
|
|
144
|
+
this.columnsDefinition = data['columnsDefinition'].filter(c => (this.drillDownPageInfo && this.drillDownColumns || (!NON_REPORT_COLUMNS.includes(c.type))));
|
|
145
|
+
this.fields = data['fields'];
|
|
146
|
+
if (data['enrichDrillDownReportRequest']) {
|
|
147
|
+
this.enrichDrillDownReportRequest = data['enrichDrillDownReportRequest'](this.injector);
|
|
148
|
+
}
|
|
149
|
+
if (data['enrichJuniorReportRequest']) {
|
|
150
|
+
this.enrichJuniorReportRequest = data['enrichJuniorReportRequest'](this.injector);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (data['enrichHyperLinkReportRequest']) {
|
|
154
|
+
this.enrichHyperLinkReportRequest = data['enrichHyperLinkReportRequest'](this.injector);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
this.route.queryParamMap.subscribe(params => {
|
|
158
|
+
const isComparisonReport = params.get('comparisonReport') === 'true';
|
|
159
|
+
|
|
160
|
+
if (isComparisonReport) {
|
|
161
|
+
const comparisonStr = sessionStorage.getItem('comparisonReportPageInfo');
|
|
162
|
+
|
|
163
|
+
if (comparisonStr) {
|
|
164
|
+
const comparisonData = JSON.parse(comparisonStr);
|
|
165
|
+
|
|
166
|
+
this.pageInfo.lazyLoadData = comparisonData.lazyLoadData ?? false;
|
|
167
|
+
this.activeLevel = comparisonData.activeLevel ?? 2;
|
|
168
|
+
this.isEditable = false;
|
|
169
|
+
this.backButtonEnabled = false;
|
|
170
|
+
this.drillDownPageInfo = comparisonData.drillDownPageInfo;
|
|
171
|
+
this.drillDownColumns = comparisonData.drillDownColumns;
|
|
172
|
+
this.reportForm = this.fb.group({
|
|
173
|
+
directorate: [[]],
|
|
174
|
+
fromDate: [''],
|
|
175
|
+
toDate: [''],
|
|
176
|
+
sector: [''],
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
this.reportForm.patchValue(comparisonData.form)
|
|
180
|
+
this.fields = this.fields.filter(c => c.type !== 'checkbox');
|
|
181
|
+
|
|
182
|
+
const reportRequest = comparisonData.reportRequest;
|
|
183
|
+
|
|
184
|
+
this.childReportRequest = this.backendService.buildReportRequest(
|
|
185
|
+
this.drillDownColumns,
|
|
186
|
+
`${this.drillDownPageInfo.labelsSection}.${this.drillDownPageInfo.id}`,
|
|
187
|
+
reportRequest,
|
|
188
|
+
'',
|
|
189
|
+
this.drillDownPageInfo,
|
|
190
|
+
'LANDSCAPE'
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
// ngOnChanges({item, errors, fields}: SimpleChanges): void {
|
|
200
|
+
// // errors?.currentValue?.forEach((msg: FieldMessage) => {
|
|
201
|
+
// // this.backendService.parentForm.get(msg.fieldName)?.setErrors({serverError: msg.message});
|
|
202
|
+
// // });
|
|
203
|
+
// // if (fields?.currentValue && !fields.isFirstChange()){
|
|
204
|
+
// // this.buildForm();
|
|
205
|
+
// // }
|
|
206
|
+
// // this.buildForm();
|
|
207
|
+
// }
|
|
208
|
+
|
|
209
|
+
isMatchHeight() {
|
|
210
|
+
return this.pageInfo.pageHeight === 'match';
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
doAction(type: string) {
|
|
215
|
+
if (this.backendService.parentForm.valid) {
|
|
216
|
+
this.reloadData = !this.reloadData;
|
|
217
|
+
const filterRequest: FilterRequest = new FilterRequest(this.pageSize);
|
|
218
|
+
filterRequest.filters = [];
|
|
219
|
+
let paramsString: string[] = [];
|
|
220
|
+
this.fields.filter(x => x.type !== 'spacer').forEach(f => {
|
|
221
|
+
if (this.getParamValue(f) != null && this.getParamValue(f).toString().trim() !== '')
|
|
222
|
+
{
|
|
223
|
+
if (f.type === 'multi-select' || f.type === 'lookup') {
|
|
224
|
+
// do not filter if this field as cascading for another one and the other one got selected values
|
|
225
|
+
const childFieldIdx = this.fields.findIndex(field => field.cascadedBy === f.property);
|
|
226
|
+
if (childFieldIdx > -1 && this.backendService.parentForm.get(this.fields[childFieldIdx].property)?.value?.length > 0) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const idz: number[] = [];
|
|
230
|
+
const param: string[] = [];
|
|
231
|
+
if (this.backendService.parentForm.get(f.property)?.value && Array.isArray(this.backendService.parentForm.get(f.property)?.value)
|
|
232
|
+
&& this.backendService.parentForm.get(f.property)?.value.length > 0) {
|
|
233
|
+
this.backendService.parentForm.get(f.property)?.value.forEach((a: {
|
|
234
|
+
channelId: number;
|
|
235
|
+
englishName: string;
|
|
236
|
+
id: number;
|
|
237
|
+
}) => {
|
|
238
|
+
if (f.flattenBySubAttribute) {
|
|
239
|
+
idz.push(a[f.flattenBySubAttribute]);
|
|
240
|
+
param.push(a[f.flattenBySubAttribute]);
|
|
241
|
+
} else if (this.fields.find(s => s.property === 'terminalId')) {
|
|
242
|
+
idz.push(a.channelId);
|
|
243
|
+
param.push(a.englishName);
|
|
244
|
+
} else {
|
|
245
|
+
idz.push(a.id);
|
|
246
|
+
param.push(a.englishName);
|
|
247
|
+
}
|
|
248
|
+
})
|
|
249
|
+
filterRequest.filters?.push(new Filter({
|
|
250
|
+
id: f.property, fieldName: f.property, label: this.translateService.instant(f.label),
|
|
251
|
+
filterType: 'FILED_FILTER', operator: f.filterOperator,
|
|
252
|
+
valueObject: idz
|
|
253
|
+
}));
|
|
254
|
+
paramsString.push(this.translateService.instant(f.label) + ' : ' + param.join(','));
|
|
255
|
+
} else if (this.backendService.parentForm.get(f.property)?.value && f.flattenBySubAttribute) {
|
|
256
|
+
filterRequest.filters?.push(new Filter({
|
|
257
|
+
id: f.property, fieldName: f.property, label: this.translateService.instant(f.label),
|
|
258
|
+
filterType: 'FILED_FILTER', operator: f.filterOperator,
|
|
259
|
+
valueObject: this.getParamValue(f)[f.flattenBySubAttribute]
|
|
260
|
+
}));
|
|
261
|
+
}
|
|
262
|
+
} else {
|
|
263
|
+
if (this.backendService.parentForm.get(f.property)?.value !== null &&
|
|
264
|
+
this.backendService.parentForm.get(f.property)?.value !== undefined &&
|
|
265
|
+
this.backendService.parentForm.get(f.property)?.value !== "") {
|
|
266
|
+
filterRequest.filters?.push(new Filter({
|
|
267
|
+
id: f.property, fieldName: f.property, label: this.translateService.instant(f.label),
|
|
268
|
+
filterType: 'FILED_FILTER', operator: f.filterOperator,
|
|
269
|
+
valueObject: this.getParamValue(f)
|
|
270
|
+
}));
|
|
271
|
+
}
|
|
272
|
+
paramsString.push(this.translateService.instant(f.label) + ' : ' + this.getParamValueLabel(f));
|
|
273
|
+
}
|
|
274
|
+
}})
|
|
275
|
+
const reportRequest = this.backendService.buildReportRequest(this.columnsDefinition, this.pageInfo.labelsSection + '.' + this.pageInfo.id,
|
|
276
|
+
filterRequest, type, this.pageInfo, 'LANDSCAPE');
|
|
277
|
+
reportRequest.searchStr = paramsString.join(' , ');
|
|
278
|
+
this.reportRequest = reportRequest;
|
|
279
|
+
// this.activeLevel = 1;
|
|
280
|
+
} else {
|
|
281
|
+
this.backendService.topPanelMessage$.next(new SnackMessage('INVALID_REPORT_FORM', true, 'error'));
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
private getParamValue(f: FieldInfo) {
|
|
286
|
+
if (f.type === 'date' && this.backendService.parentForm.get(f.property)?.value) {
|
|
287
|
+
return formatDate(this.backendService.parentForm.get(f.property)?.value, 'yyyy-MM-dd', 'en_US')
|
|
288
|
+
}else if (f.type === 'checkbox') {
|
|
289
|
+
return !!this.backendService.parentForm.get(f.property)?.value;
|
|
290
|
+
}else {
|
|
291
|
+
return this.backendService.parentForm.get(f.property)?.value;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
private getParamValueLabel(f: FieldInfo) {
|
|
296
|
+
if (f.type === 'checkbox') {
|
|
297
|
+
return this.backendService.parentForm.get(f.property)?.value ? this.translateService.instant('yes') : this.translateService.instant('no');
|
|
298
|
+
}else {
|
|
299
|
+
return this.backendService.parentForm.get(f.property)?.value;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
getTitle() {
|
|
304
|
+
const pageInfoMap = {
|
|
305
|
+
1: this.pageInfo,
|
|
306
|
+
2: this.drillDownPageInfo,
|
|
307
|
+
3: this.juniorPageInfo
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
const currentInfo = pageInfoMap[this.activeLevel] || this.pageInfo;
|
|
311
|
+
return `${currentInfo.labelsSection}.${currentInfo.id}`;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
updateForm($event: FormGroup) {
|
|
315
|
+
this.reportForm = $event;
|
|
316
|
+
this.backendService.parentForm = $event;
|
|
317
|
+
|
|
318
|
+
this.setupDependentFieldWatchers();
|
|
319
|
+
|
|
320
|
+
this.backendService.parentForm.valueChanges.subscribe(x => {
|
|
321
|
+
this.readyToSearch = this.backendService.parentForm.valid;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
private setupDependentFieldWatchers() {
|
|
328
|
+
this.fields
|
|
329
|
+
.filter(field => field.lookupFilterList && field.lookupFilterList.length > 0)
|
|
330
|
+
.forEach(field => {
|
|
331
|
+
const dependentFields = field.lookupFilterList.map(f => f.fieldName);
|
|
332
|
+
|
|
333
|
+
dependentFields.forEach(dependentFieldName => {
|
|
334
|
+
const dependentControl = this.reportForm.get(dependentFieldName);
|
|
335
|
+
if (dependentControl) {
|
|
336
|
+
dependentControl.valueChanges.subscribe(() => {
|
|
337
|
+
const targetControl = this.reportForm.get(field.property);
|
|
338
|
+
if (targetControl) {
|
|
339
|
+
targetControl.setValue([]);
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
isValidForm() {
|
|
348
|
+
return this.readyToSearch ;
|
|
349
|
+
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
emitUserAction($event: TablePageUserAction) {
|
|
355
|
+
$event.pageInfo = this.pageInfo;
|
|
356
|
+
this.doADrillDownAction($event);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
emitHyperLinkAction($event: TablePageUserAction) {
|
|
360
|
+
if (!this.shouldProcessEventItem($event.item)) return;
|
|
361
|
+
|
|
362
|
+
const item = $event.item;
|
|
363
|
+
this.prepareDialogReportRequest(item);
|
|
364
|
+
const reportRequest = this.buildDialogReportRequest();
|
|
365
|
+
reportRequest.filterRequest.pageIndex = 0
|
|
366
|
+
const dialogRef = this.dialog.open(ReportDetailsDialogComponent, {
|
|
367
|
+
data: {
|
|
368
|
+
pageInfo: this.juniorPageInfo,
|
|
369
|
+
request: reportRequest,
|
|
370
|
+
columns: this.juniorColumns,
|
|
371
|
+
item,
|
|
372
|
+
},
|
|
373
|
+
height: '50vw',
|
|
374
|
+
maxWidth: '120vw',
|
|
375
|
+
direction: this.currentDirection,
|
|
376
|
+
disableClose: false,
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
dialogRef.afterOpened().subscribe(() => this.doHyperLinkAction($event));
|
|
380
|
+
dialogRef.afterClosed().subscribe(() => {});
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
private prepareDialogReportRequest(item: any): void {
|
|
384
|
+
this.dialogReportRequest = cloneDeep(this.reportRequest);
|
|
385
|
+
this.dialogReportRequest.filterRequest = { filters: [] };
|
|
386
|
+
|
|
387
|
+
this.addStandardFilters(item);
|
|
388
|
+
this.addOrReplaceFilter('isec1', 'iSec', item['isec_value']);
|
|
389
|
+
this.addFilterType();
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
private addStandardFilters(item: any): void {
|
|
393
|
+
const standardFilters = [
|
|
394
|
+
{ key: 'period', value: item['period'] },
|
|
395
|
+
{ key: 'year', value: item['year'] },
|
|
396
|
+
{ key: 'sector', value: item['sectorCode'] },
|
|
397
|
+
{ key: 'directorate', value: item['directorateCode'] },
|
|
398
|
+
{ key: 'subTaxRate', value: item['tax_rate_code'] },
|
|
399
|
+
];
|
|
400
|
+
|
|
401
|
+
standardFilters.forEach(({ key, value }) =>
|
|
402
|
+
this.dialogReportRequest.filterRequest.filters.push(
|
|
403
|
+
this.createFilter(key, key, value)
|
|
404
|
+
)
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
private addFilterType(): void {
|
|
409
|
+
const isTax = this.dialogReportRequest.actionKey?.toLowerCase().includes('tax');
|
|
410
|
+
const filterType = isTax ? 'TAX' : 'VALUE';
|
|
411
|
+
|
|
412
|
+
this.dialogReportRequest.filterRequest.filters.push(
|
|
413
|
+
this.createFilter('filterType', 'filterType', filterType)
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
private buildDialogReportRequest(): any {
|
|
418
|
+
return this.backendService.buildReportRequest(
|
|
419
|
+
this.juniorColumns,
|
|
420
|
+
`${this.juniorPageInfo.labelsSection}.${this.juniorPageInfo.id}`,
|
|
421
|
+
{ ...this.dialogReportRequest.filterRequest },
|
|
422
|
+
'',
|
|
423
|
+
this.juniorPageInfo,
|
|
424
|
+
'LANDSCAPE'
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
private createFilter(key: string, fieldName: string, value: any): Filter {
|
|
429
|
+
return new Filter({
|
|
430
|
+
key,
|
|
431
|
+
fieldName,
|
|
432
|
+
label: '',
|
|
433
|
+
filterType: 'FILED_FILTER',
|
|
434
|
+
operator: 'EQUALS',
|
|
435
|
+
valueObject: value,
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
private addOrReplaceFilter(id: string, fieldName: string, value: any): void {
|
|
440
|
+
const filter = new Filter({
|
|
441
|
+
id,
|
|
442
|
+
fieldName,
|
|
443
|
+
label: '',
|
|
444
|
+
filterType: 'FILED_FILTER',
|
|
445
|
+
operator: 'EQUALS',
|
|
446
|
+
valueObject: value,
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
const filters = this.dialogReportRequest.filterRequest.filters;
|
|
450
|
+
const existingIndex = filters.findIndex((f: Filter) => f.id === id);
|
|
451
|
+
|
|
452
|
+
if (existingIndex !== -1) {
|
|
453
|
+
filters.splice(existingIndex, 1, filter);
|
|
454
|
+
} else {
|
|
455
|
+
filters.push(filter);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
emitJuniorAction($event: TablePageUserAction) {
|
|
462
|
+
const juniorAction = JUNIOR_DOWN_ACTION;
|
|
463
|
+
juniorAction.pageInfo = this.drillDownPageInfo;
|
|
464
|
+
this.doJuniorAction($event);
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
drillDown() {
|
|
468
|
+
const drilldownaction = DRILL_DOWN_ACTION;
|
|
469
|
+
drilldownaction.pageInfo = this.drillDownPageInfo;
|
|
470
|
+
this.doADrillDownAction(drilldownaction);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
private doJuniorAction($event: TablePageUserAction) {
|
|
474
|
+
if (this.juniorColumns && this.juniorPageInfo) {
|
|
475
|
+
if (this.enrichJuniorReportRequest) {
|
|
476
|
+
if (this.activeLevel === 2) {
|
|
477
|
+
this.isEditable = false;
|
|
478
|
+
this.disableExportAction = this.juniorPageInfo.hideReportsExtractButton || false;
|
|
479
|
+
this.juniorReportRequest = this.backendService.buildReportRequest(this.juniorColumns,
|
|
480
|
+
this.juniorPageInfo.labelsSection + '.' + this.juniorPageInfo.id,
|
|
481
|
+
this.reportRequest.filterRequest, '', this.juniorPageInfo, 'LANDSCAPE');
|
|
482
|
+
this.enrichJuniorReportRequest($event, this.juniorReportRequest);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
this.activeLevel = this.activeLevel +1;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
private doADrillDownAction($event: TablePageUserAction) {
|
|
489
|
+
if (this.drillDownColumns && this.drillDownPageInfo) {
|
|
490
|
+
if (this.enrichDrillDownReportRequest) {
|
|
491
|
+
if (this.activeLevel === 1) {
|
|
492
|
+
this.isEditable = false;
|
|
493
|
+
this.childReportRequest = this.backendService.buildReportRequest(this.drillDownColumns,
|
|
494
|
+
this.drillDownPageInfo.labelsSection + '.' + this.drillDownPageInfo.id,
|
|
495
|
+
this.reportRequest.filterRequest, '', this.drillDownPageInfo, 'LANDSCAPE');
|
|
496
|
+
this.disableExportAction = this.drillDownPageInfo.hideReportsExtractButton || false;
|
|
497
|
+
this.enrichDrillDownReportRequest($event, this.childReportRequest);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
this.activeLevel = this.activeLevel +1;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
private doHyperLinkAction($event: TablePageUserAction) {
|
|
505
|
+
if (this.enrichHyperLinkReportRequest) {
|
|
506
|
+
this.juniorReportRequest = this.backendService.buildReportRequest(this.juniorColumns,
|
|
507
|
+
this.juniorPageInfo.labelsSection + '.' + this.juniorPageInfo.id,
|
|
508
|
+
this.dialogReportRequest.filterRequest, '', this.juniorPageInfo, 'LANDSCAPE');
|
|
509
|
+
this.disableExportAction = this.juniorPageInfo.hideReportsExtractButton || false;
|
|
510
|
+
this.enrichHyperLinkReportRequest($event, this.juniorReportRequest);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
extractReport(reportType: any) {
|
|
515
|
+
if (this.activeLevel === 1) {
|
|
516
|
+
this.reportRequest.reportType = reportType;
|
|
517
|
+
this.backendService.downloadReport(this.reportRequest, this.pageInfo.apiUri );
|
|
518
|
+
}
|
|
519
|
+
else if (this.activeLevel === 2) {
|
|
520
|
+
this.childReportRequest.reportType = reportType;
|
|
521
|
+
this.backendService.downloadReport(this.childReportRequest, this.drillDownPageInfo.apiUri );
|
|
522
|
+
}
|
|
523
|
+
else if (this.activeLevel === 3) {
|
|
524
|
+
this.juniorReportRequest.reportType = reportType;
|
|
525
|
+
this.backendService.downloadReport(this.juniorReportRequest, this.juniorPageInfo.apiUri );
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
goUp() {
|
|
530
|
+
this.isEditable = true;
|
|
531
|
+
this.activeLevel = this.activeLevel -1;
|
|
532
|
+
this.doAction(this.x);
|
|
533
|
+
this.reloadData = true;
|
|
534
|
+
if (this.activeLevel >1) {
|
|
535
|
+
this.isEditable = false;
|
|
536
|
+
}
|
|
537
|
+
this.disableExportAction = false
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
drillDownEnabled() {
|
|
541
|
+
return this.drillDownPageInfo && !this.hideDrillDownButton && !this.getIsEmptyList();
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
drillDownLabel() {
|
|
545
|
+
return `${this.pageInfo.labelsSection}.drillDownLabel` ;
|
|
546
|
+
}
|
|
547
|
+
getIsEmptyList() {
|
|
548
|
+
return this.backendService.isEmptyItems || this.disableExportAction === true;
|
|
549
|
+
}
|
|
550
|
+
clear() {
|
|
551
|
+
const currentUrl = this.router.url;
|
|
552
|
+
this.router.navigateByUrl('/', { skipLocationChange: true }).then(() => {
|
|
553
|
+
this.router.navigate([currentUrl]);
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
// if (this.reportForm) {
|
|
557
|
+
// this.reportForm.reset();
|
|
558
|
+
//
|
|
559
|
+
// this.fields.forEach(field => {
|
|
560
|
+
// if (field.type === 'lookup' || field.type === 'multi-select') {
|
|
561
|
+
// const control = this.reportForm.get(field.property);
|
|
562
|
+
// if (control) {
|
|
563
|
+
// control.setValue([]);
|
|
564
|
+
// }
|
|
565
|
+
// }
|
|
566
|
+
// });
|
|
567
|
+
// }
|
|
568
|
+
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
isFormEmpty(): boolean {
|
|
573
|
+
if (!this.reportForm || !this.reportForm.value) {
|
|
574
|
+
return true;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
return Object.values(this.reportForm.value).every(value => {
|
|
578
|
+
if (value === null || value === undefined || value === '') {
|
|
579
|
+
return true;
|
|
580
|
+
}
|
|
581
|
+
return Array.isArray(value) && value.length === 0;
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
shouldProcessEventItem(item: any): boolean {
|
|
588
|
+
const groupByProp = this.pageInfo?.groupByProperty;
|
|
589
|
+
const groupByValues = this.pageInfo?.groupByValue;
|
|
590
|
+
|
|
591
|
+
if (!groupByProp || !groupByValues || !item[groupByProp]) {
|
|
592
|
+
return true;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
const value = item[groupByProp].toString();
|
|
596
|
+
|
|
597
|
+
return !groupByValues.some(v => value.includes(v) && value.length >= v.length);
|
|
598
|
+
}
|
|
599
|
+
}
|