@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,305 +1,323 @@
|
|
|
1
|
-
import {Component, EventEmitter, Inject, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core';
|
|
2
|
-
import {FieldInfo, Filter, FilterRequest, NEW, PageInfo, SAVE_AND_COMPLETE, SnackMessage} from "../../base-model";
|
|
3
|
-
import {FieldMessage} from "../../base-model/api-response";
|
|
4
|
-
import {TranslateModule} from "@ngx-translate/core";
|
|
5
|
-
import {BackendService} from "../../services";
|
|
6
|
-
import {FormGroup} from "@angular/forms";
|
|
7
|
-
import {Location, NgIf} from "@angular/common";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import {DoActionRequest, SAVE} from "../../base-model/do-action-request";
|
|
14
|
-
import {ActionCommentComponent} from "../
|
|
15
|
-
import {MatDialog} from "@angular/material/dialog";
|
|
16
|
-
import {BaseUtils, getNegativeWfActionKey, getPositiveWfActionKey, getWfActionId} from "../../utils/base-utils";
|
|
17
|
-
import {ActivatedRoute, Router} from "@angular/router";
|
|
18
|
-
import {AuditLogComponent} from "../audit-log-list/audit-log.component";
|
|
19
|
-
import {Directionality} from "@angular/cdk/bidi";
|
|
20
|
-
|
|
21
|
-
@Component({
|
|
22
|
-
selector: 'app-base-form',
|
|
23
|
-
standalone: true,
|
|
24
|
-
imports: [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
private
|
|
84
|
-
private
|
|
85
|
-
private
|
|
86
|
-
private
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
this.
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
-
|
|
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
|
-
this.
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
1
|
+
import {Component, EventEmitter, Inject, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core';
|
|
2
|
+
import {FieldInfo, Filter, FilterRequest, NEW, PageInfo, SAVE_AND_COMPLETE, SnackMessage} from "../../base-model";
|
|
3
|
+
import {FieldMessage} from "../../base-model/api-response";
|
|
4
|
+
import {TranslateModule} from "@ngx-translate/core";
|
|
5
|
+
import {BackendService} from "../../services";
|
|
6
|
+
import {FormGroup} from "@angular/forms";
|
|
7
|
+
import {Location, NgIf} from "@angular/common";
|
|
8
|
+
import {MatButton, MatButtonModule} from "@angular/material/button";
|
|
9
|
+
import {MatIconModule} from "@angular/material/icon";
|
|
10
|
+
import {TitleBarComponent} from "../title-bar/title-bar.component";
|
|
11
|
+
import {BaseFormCanvasComponent} from "../base-form-canvas/base-form-canvas.component";
|
|
12
|
+
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
|
|
13
|
+
import {DoActionRequest, SAVE} from "../../base-model/do-action-request";
|
|
14
|
+
import {ActionCommentComponent} from "../action-comment/action-comment.component";
|
|
15
|
+
import {MatDialog} from "@angular/material/dialog";
|
|
16
|
+
import {BaseUtils, getNegativeWfActionKey, getPositiveWfActionKey, getWfActionId} from "../../utils/base-utils";
|
|
17
|
+
import {ActivatedRoute, Router} from "@angular/router";
|
|
18
|
+
import {AuditLogComponent} from "../audit-log-list/audit-log.component";
|
|
19
|
+
import {Directionality} from "@angular/cdk/bidi";
|
|
20
|
+
|
|
21
|
+
@Component({
|
|
22
|
+
selector: 'app-base-form',
|
|
23
|
+
standalone: true,
|
|
24
|
+
imports: [
|
|
25
|
+
TitleBarComponent,
|
|
26
|
+
BaseFormCanvasComponent,
|
|
27
|
+
MatButtonModule,
|
|
28
|
+
TranslateModule,
|
|
29
|
+
NgIf,
|
|
30
|
+
MatIconModule,
|
|
31
|
+
MatButton,
|
|
32
|
+
AuditLogComponent
|
|
33
|
+
],
|
|
34
|
+
templateUrl: './base-form.component.html',
|
|
35
|
+
styleUrl: './base-form.component.scss'
|
|
36
|
+
})
|
|
37
|
+
export class BaseFormComponent extends BaseUtils implements OnInit, OnChanges {
|
|
38
|
+
|
|
39
|
+
@Input()
|
|
40
|
+
override pageInfo!: PageInfo;
|
|
41
|
+
|
|
42
|
+
@Input()// @ts-ignore
|
|
43
|
+
fields: FieldInfo[] = [];
|
|
44
|
+
|
|
45
|
+
@Input()// @ts-ignore
|
|
46
|
+
errors: FieldMessage[] = [];
|
|
47
|
+
|
|
48
|
+
@Input()
|
|
49
|
+
editable: boolean = false;
|
|
50
|
+
|
|
51
|
+
@Input()
|
|
52
|
+
itemId: number;
|
|
53
|
+
|
|
54
|
+
@Output()
|
|
55
|
+
actionResultEmitter: EventEmitter<any> = new EventEmitter<any>();
|
|
56
|
+
|
|
57
|
+
@Output()
|
|
58
|
+
formUpdated: EventEmitter<FormGroup> = new EventEmitter<FormGroup>();
|
|
59
|
+
|
|
60
|
+
@Output()
|
|
61
|
+
itemLoaded: EventEmitter<any> = new EventEmitter<any>();
|
|
62
|
+
|
|
63
|
+
@Output()
|
|
64
|
+
extraAction: EventEmitter<any> = new EventEmitter<any>();
|
|
65
|
+
|
|
66
|
+
item : any = {};
|
|
67
|
+
isLoaded : boolean = false;
|
|
68
|
+
|
|
69
|
+
@Output()
|
|
70
|
+
hyperTextEvent: EventEmitter<boolean> = new EventEmitter();
|
|
71
|
+
|
|
72
|
+
currentDirection: 'ltr' | 'rtl';
|
|
73
|
+
isSaveDisabled: boolean = true;
|
|
74
|
+
isRejectDisabled: boolean = true;
|
|
75
|
+
|
|
76
|
+
@Input()
|
|
77
|
+
hideBackButton: boolean = true;
|
|
78
|
+
protected readonly SAVE = SAVE;
|
|
79
|
+
private isPending: boolean;
|
|
80
|
+
|
|
81
|
+
constructor(public dialog: MatDialog,
|
|
82
|
+
private activatedRoute: ActivatedRoute,
|
|
83
|
+
private router:Router,
|
|
84
|
+
private directionality: Directionality,
|
|
85
|
+
private location:Location,
|
|
86
|
+
@Inject('securityManager') private securityManager: any,
|
|
87
|
+
public backendService: BackendService) {
|
|
88
|
+
super();
|
|
89
|
+
ClassicEditor.defaultConfig = {
|
|
90
|
+
toolbar: {
|
|
91
|
+
items: ['heading', '|', 'bold', 'italic', '|', 'bulletedList', 'numberedList']
|
|
92
|
+
},
|
|
93
|
+
image: {
|
|
94
|
+
toolbar: ['imageStyle:side', '|', 'imageTextAlternative']
|
|
95
|
+
},
|
|
96
|
+
table: {
|
|
97
|
+
contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ]
|
|
98
|
+
},
|
|
99
|
+
language: 'en'
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
ngOnInit(): void {
|
|
104
|
+
this.currentDirection = this.directionality.value;
|
|
105
|
+
this.directionality.change.subscribe((value) => {
|
|
106
|
+
this.currentDirection = value;
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
// console.log('editable', this.editable)
|
|
110
|
+
this.securityManager.loadPermissions().subscribe(x => {
|
|
111
|
+
console.log("before edit", this.editable);
|
|
112
|
+
this.loadItem();
|
|
113
|
+
console.log("after edit", this.editable);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
ngOnChanges({item, errors, fields}: SimpleChanges): void {
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
isValid() {
|
|
121
|
+
return this.backendService.parentForm?.valid;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
isMatchHeight() {
|
|
125
|
+
return this.pageInfo.pageHeight === 'match';
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private loadItem() {
|
|
129
|
+
this.editable = false;
|
|
130
|
+
|
|
131
|
+
const modeEncrypted = this.activatedRoute.snapshot.queryParams['mode'];
|
|
132
|
+
this.isPending = !!modeEncrypted && this.backendService.decrypt(modeEncrypted) === 'pending';
|
|
133
|
+
|
|
134
|
+
if (this.activatedRoute.snapshot.queryParams['token'] && this.activatedRoute.snapshot.queryParams['mode']) {
|
|
135
|
+
this.itemId = this.backendService.decrypt(this.activatedRoute.snapshot.queryParams['token']);
|
|
136
|
+
} else {
|
|
137
|
+
// console.log(' ****** ****** ****** ****** error in url ')
|
|
138
|
+
}
|
|
139
|
+
if (this.itemId > 0) {
|
|
140
|
+
const filterRequest = new FilterRequest;
|
|
141
|
+
filterRequest.columns = this.fields.filter(c => c.type !== 'spacer').map(c => c.property);
|
|
142
|
+
filterRequest.pendingPage = this.isPending;
|
|
143
|
+
|
|
144
|
+
filterRequest.filters = [];
|
|
145
|
+
filterRequest.filters.push(new Filter({
|
|
146
|
+
key: 0,
|
|
147
|
+
fieldType: 'Long',
|
|
148
|
+
fieldName: 'id',
|
|
149
|
+
valueObject: this.itemId,
|
|
150
|
+
filterType: 'FILED_FILTER',
|
|
151
|
+
operator: 'EQUALS'
|
|
152
|
+
}));
|
|
153
|
+
///audit-log
|
|
154
|
+
this.backendService.getItemAuditLog(filterRequest, this.pageInfo!.apiUri).subscribe(resp => {
|
|
155
|
+
// console.log('resp', resp);
|
|
156
|
+
});
|
|
157
|
+
this.backendService.getItemsByFilter(filterRequest, this.pageInfo!.apiUri).subscribe(resp => {
|
|
158
|
+
if (resp?.valid && resp.body?.length >= 0) {
|
|
159
|
+
this.item = resp.body[0];
|
|
160
|
+
this.editable = (!this.pageInfo.draftSupported || !this.isPending) && this.securityManager.hasPagePermission(this.pageInfo.id, 'EDIT')
|
|
161
|
+
&& (!this.pageInfo.draftSupported ||this.item['stateType'] === 'COMPLETED' );
|
|
162
|
+
this.itemLoaded.emit(this.item);
|
|
163
|
+
this.isLoaded = true;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
} else {
|
|
167
|
+
this.editable = this.securityManager.hasPagePermission(this.pageInfo.id, 'EDIT');
|
|
168
|
+
this.item = {};
|
|
169
|
+
this.itemLoaded.emit(this.item);
|
|
170
|
+
this.isLoaded = true;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
buildDoActionSubject(): any {
|
|
176
|
+
const newVar = this.editable ? Object.assign(this.item, this.backendService.parentForm.value) : this.item;
|
|
177
|
+
if (this.itemId <= 0 && this.editable ) {
|
|
178
|
+
//TODO this is like a hack and must be handled from backend
|
|
179
|
+
newVar['stateType'] = 'NEW';
|
|
180
|
+
}
|
|
181
|
+
this.fields.forEach(field => {
|
|
182
|
+
if (field.flattenBySubAttribute){
|
|
183
|
+
newVar[field.property] = newVar[field.property][field.flattenBySubAttribute]
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
if (!this.pageInfo.draftSupported){
|
|
187
|
+
newVar['status'] = true;
|
|
188
|
+
}
|
|
189
|
+
return newVar;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
doSaveApproveAction() {
|
|
194
|
+
let actionId = getWfActionId(this.item.stateType);
|
|
195
|
+
if (this.itemId <= 0 && this.editable ) {
|
|
196
|
+
actionId = NEW
|
|
197
|
+
}
|
|
198
|
+
if (!this.pageInfo.draftSupported) {
|
|
199
|
+
actionId = SAVE_AND_COMPLETE
|
|
200
|
+
}
|
|
201
|
+
if (this.editable && this.backendService.parentForm.valid !== true) {
|
|
202
|
+
this.backendService.topPanelMessage$.next(new SnackMessage('INVALID_INPUT_FORM', true, 'error'));
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const request = new DoActionRequest();
|
|
206
|
+
request.actionId = actionId;
|
|
207
|
+
request.subject = this.buildDoActionSubject();
|
|
208
|
+
|
|
209
|
+
const dialogRef = this.dialog.open(ActionCommentComponent, {
|
|
210
|
+
data: {label: 'save', isTermination: false},
|
|
211
|
+
width: '600px',
|
|
212
|
+
height: 'auto',
|
|
213
|
+
direction: this.currentDirection
|
|
214
|
+
});
|
|
215
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
216
|
+
if (result) {
|
|
217
|
+
request.comment = result.comment;
|
|
218
|
+
this.backendService.doActionWithAttachments(request, [], this.pageInfo!).subscribe(resp => {
|
|
219
|
+
console.log('step',actionId);
|
|
220
|
+
this.actionResultEmitter.emit({ valid: resp.valid, actionId: actionId });
|
|
221
|
+
if (resp.valid ) {
|
|
222
|
+
let message = 'approve_successfully';
|
|
223
|
+
switch (actionId) {
|
|
224
|
+
case 1:
|
|
225
|
+
message = 'saved_successfully';
|
|
226
|
+
break;
|
|
227
|
+
case 2:
|
|
228
|
+
message = 'updated_successfully';
|
|
229
|
+
break;
|
|
230
|
+
default:
|
|
231
|
+
message = 'approve_successfully';
|
|
232
|
+
}
|
|
233
|
+
this.backendService.topPanelMessage$.next(new SnackMessage(message, true, 'success'));
|
|
234
|
+
if(!this.pageInfo.stayOnPage){
|
|
235
|
+
this.backToParent();
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
else{
|
|
239
|
+
request.subject['stateType'] = null;
|
|
240
|
+
if (resp.message[0].errorMessage.toLowerCase().includes('duplic'))
|
|
241
|
+
this.backendService.topPanelMessage$.next(new SnackMessage(this.pageInfo.labelsSection + '.' + resp.message[0].errorCode, true, 'error'));
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
backToParent() {
|
|
249
|
+
const idIdx = this.router.url.lastIndexOf('/');
|
|
250
|
+
this.router.navigateByUrl(this.router.url.substring(0, idIdx));
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
getTitle() {
|
|
255
|
+
return `${this.pageInfo.labelsSection}.${this.pageInfo.id}` ;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
updateForm($event: FormGroup) {
|
|
259
|
+
this.backendService.parentForm = $event;
|
|
260
|
+
this.formUpdated.emit($event);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
doCancelRejectAction() {
|
|
264
|
+
if (!this.editable){
|
|
265
|
+
let actionId = 3;
|
|
266
|
+
// console.log('actionId',actionId);
|
|
267
|
+
const request = new DoActionRequest();
|
|
268
|
+
request.actionId = actionId;
|
|
269
|
+
request.subject = this.buildDoActionSubject();
|
|
270
|
+
|
|
271
|
+
const dialogRef = this.dialog.open(ActionCommentComponent, {
|
|
272
|
+
data: {label: 'reject', acceptActionLabel: 'accept', rejectActionLabel: 'return'},
|
|
273
|
+
width: '600px',
|
|
274
|
+
height: 'auto',
|
|
275
|
+
direction: this.currentDirection
|
|
276
|
+
});
|
|
277
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
278
|
+
if (result) {
|
|
279
|
+
request.comment = result.comment;
|
|
280
|
+
this.backendService.doActionWithAttachments(request, [], this.pageInfo!).subscribe(resp => {
|
|
281
|
+
this.actionResultEmitter.emit({ valid: resp.valid, actionId: actionId });
|
|
282
|
+
if (resp.valid) {
|
|
283
|
+
this.backendService.topPanelMessage$.next(new SnackMessage('successful_reject_message', true, 'success'));
|
|
284
|
+
if(!this.pageInfo.stayOnPage){
|
|
285
|
+
this.backToParent();
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
this.location.back()
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
hasWfPermission() {
|
|
298
|
+
return (this.securityManager.hasPagePermission(this.pageInfo.id, 'EDIT')
|
|
299
|
+
|| this.securityManager.hasPagePermission(this.pageInfo.id, 'COMPLETE')
|
|
300
|
+
|| this.securityManager.hasPagePermission(this.pageInfo.id, 'TERMINATE'))
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
protected readonly getPositiveWfActionKey = getPositiveWfActionKey;
|
|
304
|
+
protected readonly getNegativeWfActionKey = getNegativeWfActionKey;
|
|
305
|
+
|
|
306
|
+
hasWfPositivePermission() {
|
|
307
|
+
return (!this.editable && this.securityManager.hasPagePermission(this.pageInfo.id, 'COMPLETE')) ||
|
|
308
|
+
(this.editable && this.securityManager.hasPagePermission(this.pageInfo.id, 'EDIT'))
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
hasWfNegativePermission() {
|
|
312
|
+
return (!this.editable && this.securityManager.hasPagePermission(this.pageInfo.id, 'TERMINATE')) ||
|
|
313
|
+
(this.editable && this.securityManager.hasPagePermission(this.pageInfo.id, 'EDIT'))
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
doExtraAction() {
|
|
317
|
+
this.extraAction.emit()
|
|
318
|
+
}
|
|
319
|
+
disabledSaveButton(element) {
|
|
320
|
+
return (!this.isPending && element.stateType == 'PENDING') && this.pageInfo.draftSupported ;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
}
|