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