@acorex-platform/module-document-management-client 0.0.56 → 0.0.58

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 (50) hide show
  1. package/fesm2022/{acorex-platform-module-document-management-client-acorex-platform-module-document-management-client-qhcOFKFu.mjs → acorex-platform-module-document-management-client-acorex-platform-module-document-management-client-BAlV-t9L.mjs} +411 -141
  2. package/fesm2022/acorex-platform-module-document-management-client-acorex-platform-module-document-management-client-BAlV-t9L.mjs.map +1 -0
  3. package/fesm2022/{acorex-platform-module-document-management-client-attachment-view-skeleton.component-BeQSbax5.mjs → acorex-platform-module-document-management-client-attachment-view-skeleton.component-CriADt_T.mjs} +2 -2
  4. package/fesm2022/{acorex-platform-module-document-management-client-attachment-view-skeleton.component-BeQSbax5.mjs.map → acorex-platform-module-document-management-client-attachment-view-skeleton.component-CriADt_T.mjs.map} +1 -1
  5. package/fesm2022/{acorex-platform-module-document-management-client-attachment-widget.component-CsrcMMC9.mjs → acorex-platform-module-document-management-client-attachment-widget.component-DqM2ltmp.mjs} +2 -2
  6. package/fesm2022/{acorex-platform-module-document-management-client-attachment-widget.component-CsrcMMC9.mjs.map → acorex-platform-module-document-management-client-attachment-widget.component-DqM2ltmp.mjs.map} +1 -1
  7. package/fesm2022/acorex-platform-module-document-management-client-contracts.mjs +161 -1
  8. package/fesm2022/acorex-platform-module-document-management-client-contracts.mjs.map +1 -1
  9. package/fesm2022/{acorex-platform-module-document-management-client-details-view.component-DkCD8RSd.mjs → acorex-platform-module-document-management-client-details-view.component-BQrDE1DN.mjs} +111 -37
  10. package/fesm2022/acorex-platform-module-document-management-client-details-view.component-BQrDE1DN.mjs.map +1 -0
  11. package/fesm2022/{acorex-platform-module-document-management-client-distribute-document.command-BaCdm2YF.mjs → acorex-platform-module-document-management-client-distribute-document.command-u3nQHky9.mjs} +2 -2
  12. package/fesm2022/{acorex-platform-module-document-management-client-distribute-document.command-BaCdm2YF.mjs.map → acorex-platform-module-document-management-client-distribute-document.command-u3nQHky9.mjs.map} +1 -1
  13. package/fesm2022/{acorex-platform-module-document-management-client-drive-choose.component-up9sAsei.mjs → acorex-platform-module-document-management-client-drive-choose.component-D7B9fi6_.mjs} +2 -2
  14. package/fesm2022/{acorex-platform-module-document-management-client-drive-choose.component-up9sAsei.mjs.map → acorex-platform-module-document-management-client-drive-choose.component-D7B9fi6_.mjs.map} +1 -1
  15. package/fesm2022/{acorex-platform-module-document-management-client-large-icons-view-skeleton.component-C_VbFRKl.mjs → acorex-platform-module-document-management-client-large-icons-view-skeleton.component-C0P-zEpf.mjs} +2 -2
  16. package/fesm2022/{acorex-platform-module-document-management-client-large-icons-view-skeleton.component-C_VbFRKl.mjs.map → acorex-platform-module-document-management-client-large-icons-view-skeleton.component-C0P-zEpf.mjs.map} +1 -1
  17. package/fesm2022/{acorex-platform-module-document-management-client-large-icons-view.component-Cece4n22.mjs → acorex-platform-module-document-management-client-large-icons-view.component-QvwN7k9l.mjs} +2 -2
  18. package/fesm2022/{acorex-platform-module-document-management-client-large-icons-view.component-Cece4n22.mjs.map → acorex-platform-module-document-management-client-large-icons-view.component-QvwN7k9l.mjs.map} +1 -1
  19. package/fesm2022/{acorex-platform-module-document-management-client-large-tiles-view.component-DzWIUZtv.mjs → acorex-platform-module-document-management-client-large-tiles-view.component--HbrSK06.mjs} +2 -2
  20. package/fesm2022/{acorex-platform-module-document-management-client-large-tiles-view.component-DzWIUZtv.mjs.map → acorex-platform-module-document-management-client-large-tiles-view.component--HbrSK06.mjs.map} +1 -1
  21. package/fesm2022/{acorex-platform-module-document-management-client-list-view-skeleton.component-Dgx8lVyN.mjs → acorex-platform-module-document-management-client-list-view-skeleton.component-D_tOw89k.mjs} +2 -2
  22. package/fesm2022/{acorex-platform-module-document-management-client-list-view-skeleton.component-Dgx8lVyN.mjs.map → acorex-platform-module-document-management-client-list-view-skeleton.component-D_tOw89k.mjs.map} +1 -1
  23. package/fesm2022/{acorex-platform-module-document-management-client-list-view.component-DVUfHWHB.mjs → acorex-platform-module-document-management-client-list-view.component-4lKV7vLI.mjs} +2 -2
  24. package/fesm2022/{acorex-platform-module-document-management-client-list-view.component-DVUfHWHB.mjs.map → acorex-platform-module-document-management-client-list-view.component-4lKV7vLI.mjs.map} +1 -1
  25. package/fesm2022/{acorex-platform-module-document-management-client-open-document.command-Bimm2bzt.mjs → acorex-platform-module-document-management-client-open-document.command-ChUbCmwI.mjs} +83 -14
  26. package/fesm2022/acorex-platform-module-document-management-client-open-document.command-ChUbCmwI.mjs.map +1 -0
  27. package/fesm2022/acorex-platform-module-document-management-client-request-document-review.command-DUTxOir5.mjs +456 -0
  28. package/fesm2022/acorex-platform-module-document-management-client-request-document-review.command-DUTxOir5.mjs.map +1 -0
  29. package/fesm2022/acorex-platform-module-document-management-client-sign-document-review.command-B08sgrRi.mjs +121 -0
  30. package/fesm2022/acorex-platform-module-document-management-client-sign-document-review.command-B08sgrRi.mjs.map +1 -0
  31. package/fesm2022/{acorex-platform-module-document-management-client-small-icons-view-skeleton.component-CU2MiVUi.mjs → acorex-platform-module-document-management-client-small-icons-view-skeleton.component-9tV5qpUV.mjs} +2 -2
  32. package/fesm2022/{acorex-platform-module-document-management-client-small-icons-view-skeleton.component-CU2MiVUi.mjs.map → acorex-platform-module-document-management-client-small-icons-view-skeleton.component-9tV5qpUV.mjs.map} +1 -1
  33. package/fesm2022/{acorex-platform-module-document-management-client-small-icons-view.component-CL5cNRtI.mjs → acorex-platform-module-document-management-client-small-icons-view.component-BxGk3N37.mjs} +2 -2
  34. package/fesm2022/{acorex-platform-module-document-management-client-small-icons-view.component-CL5cNRtI.mjs.map → acorex-platform-module-document-management-client-small-icons-view.component-BxGk3N37.mjs.map} +1 -1
  35. package/fesm2022/{acorex-platform-module-document-management-client-small-tiles-view-skeleton.component-DBJldDaS.mjs → acorex-platform-module-document-management-client-small-tiles-view-skeleton.component-DYhUCJLg.mjs} +2 -2
  36. package/fesm2022/{acorex-platform-module-document-management-client-small-tiles-view-skeleton.component-DBJldDaS.mjs.map → acorex-platform-module-document-management-client-small-tiles-view-skeleton.component-DYhUCJLg.mjs.map} +1 -1
  37. package/fesm2022/{acorex-platform-module-document-management-client-small-tiles-view.component-DtsBSVCq.mjs → acorex-platform-module-document-management-client-small-tiles-view.component-Dmyzdd5g.mjs} +2 -2
  38. package/fesm2022/{acorex-platform-module-document-management-client-small-tiles-view.component-DtsBSVCq.mjs.map → acorex-platform-module-document-management-client-small-tiles-view.component-Dmyzdd5g.mjs.map} +1 -1
  39. package/fesm2022/{acorex-platform-module-document-management-client-upload-document.command-D3L6x6CQ.mjs → acorex-platform-module-document-management-client-upload-document.command-CPcrmNAp.mjs} +2 -2
  40. package/fesm2022/{acorex-platform-module-document-management-client-upload-document.command-D3L6x6CQ.mjs.map → acorex-platform-module-document-management-client-upload-document.command-CPcrmNAp.mjs.map} +1 -1
  41. package/fesm2022/acorex-platform-module-document-management-client.mjs +1 -1
  42. package/i18n/en-AU/document-management.json +63 -2
  43. package/i18n/en-US/document-management.json +63 -2
  44. package/i18n/fa-IR/document-management.json +63 -2
  45. package/package.json +2 -2
  46. package/types/acorex-platform-module-document-management-client-contracts.d.ts +34 -2
  47. package/types/acorex-platform-module-document-management-client.d.ts +8 -1
  48. package/fesm2022/acorex-platform-module-document-management-client-acorex-platform-module-document-management-client-qhcOFKFu.mjs.map +0 -1
  49. package/fesm2022/acorex-platform-module-document-management-client-details-view.component-DkCD8RSd.mjs.map +0 -1
  50. package/fesm2022/acorex-platform-module-document-management-client-open-document.command-Bimm2bzt.mjs.map +0 -1
@@ -0,0 +1,456 @@
1
+ import { AXLoadingDialogService } from '@acorex/components/loading-dialog';
2
+ import { AXToastService } from '@acorex/components/toast';
3
+ import { AXTranslationService } from '@acorex/core/translation';
4
+ import { AXPSessionService } from '@acorex-platform/framework-client/auth';
5
+ import { AXPLayoutBuilderService, resolveLayoutBuilderDialogResult } from '@acorex-platform/framework-client/layout/builder';
6
+ import { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';
7
+ import { AXPWorkflowManager } from '@acorex-platform/framework-client/workflow';
8
+ import { buildAXPRecordWorkflowInfo } from '@acorex-platform/framework-shared/entity';
9
+ import { RootConfig, AXPContentDocumentsPermissionKeys } from '@acorex-platform/module-document-management-client/contracts';
10
+ import * as i0 from '@angular/core';
11
+ import { inject, Injectable } from '@angular/core';
12
+ import { j as AXMDocumentManagerService, s as sourcesAllowDocumentReview } from './acorex-platform-module-document-management-client-acorex-platform-module-document-management-client-BAlV-t9L.mjs';
13
+ import { a as asTrimmedId, b as asDisplayName, c as asUserIds, r as resolveCreatedEntityId } from './acorex-platform-module-document-management-client-distribute-document.command.util-Bnw0rh94.mjs';
14
+
15
+ //#region ----- Imports -----
16
+ //#endregion
17
+ //#region ----- Constants -----
18
+ const TASK_MODULE = 'TaskManagement';
19
+ const TASK_ENTITY = 'Task';
20
+ const TASK_ENTITY_NAME = `${TASK_MODULE}.${TASK_ENTITY}`;
21
+ const TASK_TYPE_ENTITY = 'TaskType';
22
+ const TASK_STATUS_ENTITY = 'TaskStatus';
23
+ const TASK_ASSIGNMENT_ENTITY = 'TaskAssignment';
24
+ const DOCUMENT_REVIEW_WORKFLOW_NAME = 'document-review';
25
+ const MOCK_DOCUMENT_REVIEW_TASK_TYPE_ID = 'pm-mock-task-type-document-review';
26
+ const DOCUMENT_ENTITY_NAME = `${RootConfig.module.name}.${RootConfig.entities.document.name}`;
27
+ const FOLDER_ENTITY_NAME = `${RootConfig.module.name}.${RootConfig.entities.folder.name}`;
28
+ const I18N = '@document-management:review';
29
+ //#endregion
30
+ //#region ----- Helpers -----
31
+ function asItems(value) {
32
+ if (Array.isArray(value)) {
33
+ return value;
34
+ }
35
+ if (value && typeof value === 'object' && Array.isArray(value.items)) {
36
+ return value.items;
37
+ }
38
+ return [];
39
+ }
40
+ function statusRef(row) {
41
+ const id = asTrimmedId(row?.id);
42
+ if (!id) {
43
+ return undefined;
44
+ }
45
+ return { id, title: row?.title, color: row?.color, icon: row?.icon };
46
+ }
47
+ function resolveSubject(input = {}) {
48
+ const data = input.data;
49
+ const nodeType = data && typeof data === 'object' && 'type' in data ? data.type : undefined;
50
+ const fromDataId = data && typeof data === 'object' ? asTrimmedId(data.id) : undefined;
51
+ const documentId = asTrimmedId(input.options?.documentId) ??
52
+ asTrimmedId(input.documentId) ??
53
+ (data && typeof data === 'object' ? asTrimmedId(data.documentId) : undefined);
54
+ const folderId = asTrimmedId(input.options?.folderId) ??
55
+ asTrimmedId(input.folderId) ??
56
+ (data && typeof data === 'object' ? asTrimmedId(data.folderId) : undefined);
57
+ if (nodeType === 'folder' && fromDataId) {
58
+ return { kind: 'folder', id: fromDataId, title: asDisplayName(data.name) ?? fromDataId };
59
+ }
60
+ if (nodeType === 'file' && fromDataId) {
61
+ return { kind: 'file', id: fromDataId, title: asDisplayName(data.name) ?? fromDataId };
62
+ }
63
+ if (folderId) {
64
+ return { kind: 'folder', id: folderId, title: folderId };
65
+ }
66
+ if (documentId) {
67
+ return { kind: 'file', id: documentId, title: documentId };
68
+ }
69
+ return null;
70
+ }
71
+ //#endregion
72
+ //#region ----- Request document review command -----
73
+ class AXMRequestDocumentReviewCommand {
74
+ constructor() {
75
+ //#region ----- Services & Dependencies -----
76
+ this.layoutBuilder = inject(AXPLayoutBuilderService);
77
+ this.entityService = inject(AXPEntityService);
78
+ this.sessionService = inject(AXPSessionService);
79
+ this.toastService = inject(AXToastService);
80
+ this.translationService = inject(AXTranslationService);
81
+ this.workflowManager = inject(AXPWorkflowManager);
82
+ this.driveService = inject(AXMDocumentManagerService);
83
+ this.loadingDialog = inject(AXLoadingDialogService);
84
+ this.documentData = this.entityService
85
+ .withEntity(RootConfig.module.name, RootConfig.entities.document.name)
86
+ .data();
87
+ this.folderData = this.entityService
88
+ .withEntity(RootConfig.module.name, RootConfig.entities.folder.name)
89
+ .data();
90
+ this.taskTypeData = this.entityService.withEntity(TASK_MODULE, TASK_TYPE_ENTITY).data();
91
+ this.taskStatusData = this.entityService
92
+ .withEntity(TASK_MODULE, TASK_STATUS_ENTITY)
93
+ .data();
94
+ this.taskData = this.entityService.withEntity(TASK_MODULE, TASK_ENTITY).data();
95
+ this.assignmentData = this.entityService.withEntity(TASK_MODULE, TASK_ASSIGNMENT_ENTITY).data();
96
+ this.documentTypeData = this.entityService
97
+ .withEntity(RootConfig.module.name, RootConfig.entities.documentType.name)
98
+ .data();
99
+ }
100
+ //#endregion
101
+ //#region ----- Command Implementation -----
102
+ async execute(input = {}) {
103
+ if (!this.sessionService.authorize(AXPContentDocumentsPermissionKeys.ManageDocumentReview)) {
104
+ await this.toastError('errors.forbidden');
105
+ return { success: false, message: { text: `${I18N}.errors.forbidden` } };
106
+ }
107
+ const subject = resolveSubject(input);
108
+ if (!subject) {
109
+ await this.toastError('errors.subject-required');
110
+ return { success: false, message: { text: `${I18N}.errors.subject-required` } };
111
+ }
112
+ const loaded = await this.loadSubject(subject);
113
+ if (!loaded) {
114
+ await this.toastError('errors.subject-required');
115
+ return { success: false, message: { text: `${I18N}.errors.subject-required` } };
116
+ }
117
+ const allowsReview = await sourcesAllowDocumentReview([loaded.record, input.data], {
118
+ byNames: (names) => this.driveService.getDocumentTypesByNames(names),
119
+ byKey: (id) => this.documentTypeData.byKey(id),
120
+ }, loaded.kind === 'folder' ? 'folder' : 'document');
121
+ if (!allowsReview) {
122
+ await this.toastError('errors.not-enabled');
123
+ return { success: false, message: { text: `${I18N}.errors.not-enabled` } };
124
+ }
125
+ const setupPromise = this.loadReviewSetup();
126
+ const form = await this.openDialog(loaded.title);
127
+ if (!form) {
128
+ return { success: true, kind: 'object', data: { cancelled: true } };
129
+ }
130
+ const loading = await this.showLoading();
131
+ try {
132
+ const setup = await setupPromise;
133
+ if (!setup?.taskType?.id) {
134
+ await this.toastError('errors.task-type-missing');
135
+ return { success: false, message: { text: `${I18N}.errors.task-type-missing` } };
136
+ }
137
+ if (!setup.openStatus?.id) {
138
+ await this.toastError('errors.status-missing');
139
+ return { success: false, message: { text: `${I18N}.errors.status-missing` } };
140
+ }
141
+ const created = await this.createAndStart({
142
+ form,
143
+ setup,
144
+ subject: loaded,
145
+ });
146
+ if (created.pinFailed) {
147
+ await this.toastWarning('warnings.pin-failed');
148
+ }
149
+ const [title, content] = await Promise.all([
150
+ this.translationService.translateAsync(`${I18N}.success.title`),
151
+ this.translationService.translateAsync(`${I18N}.success.description`),
152
+ ]);
153
+ this.toastService.show({ color: 'success', title, content, timeOut: 3000 });
154
+ return { success: true, kind: 'object', data: { taskId: created.taskId, instanceId: created.instanceId } };
155
+ }
156
+ catch (error) {
157
+ const message = error instanceof Error ? error.message : undefined;
158
+ await this.toastError('errors.failed', message);
159
+ return { success: false, message: { text: message ?? `${I18N}.errors.failed` } };
160
+ }
161
+ finally {
162
+ loading.close();
163
+ }
164
+ }
165
+ //#endregion
166
+ //#region ----- Dialog -----
167
+ async openDialog(defaultTitle) {
168
+ const dueDate = new Date();
169
+ dueDate.setHours(0, 0, 0, 0);
170
+ const result = await this.layoutBuilder
171
+ .create()
172
+ .dialog((dialog) => {
173
+ dialog
174
+ .setTitle(`${I18N}.dialog.title`)
175
+ .setSize('md')
176
+ .setCloseButton(true)
177
+ .setContext({
178
+ title: defaultTitle,
179
+ description: '',
180
+ dueDate,
181
+ reviewerId: null,
182
+ })
183
+ .content((flex) => {
184
+ flex
185
+ .setDirection('column')
186
+ .setGap('12px')
187
+ .formField(`${I18N}.fields.title`, (field) => {
188
+ field.path('title');
189
+ field.textBox({ validations: [{ rule: 'required' }] });
190
+ })
191
+ .formField(`${I18N}.fields.description`, (field) => {
192
+ field.path('description');
193
+ field.textBox({});
194
+ })
195
+ .formField(`${I18N}.fields.due-date`, (field) => {
196
+ field.path('dueDate');
197
+ field.dateTimeBox({ type: 'date', validations: [{ rule: 'required' }] });
198
+ })
199
+ .formField(`${I18N}.fields.reviewer`, (field) => {
200
+ field.path('reviewerId');
201
+ field.lookupBox({
202
+ entity: 'SecurityManagement.User',
203
+ multiple: false,
204
+ look: 'lookup',
205
+ validations: [{ rule: 'required' }],
206
+ });
207
+ });
208
+ })
209
+ .setActions((actions) => {
210
+ actions.cancel('@general:actions.cancel.title');
211
+ actions.submit(`${I18N}.dialog.submit`);
212
+ })
213
+ .onAction(async (dialogRef) => {
214
+ if (dialogRef.action() === 'cancel') {
215
+ return null;
216
+ }
217
+ const ctx = dialogRef.context();
218
+ const title = (ctx.title ?? '').trim();
219
+ const reviewerId = asUserIds(ctx.reviewerId)[0];
220
+ if (!title) {
221
+ throw new Error(`${I18N}.errors.title-required`);
222
+ }
223
+ if (!ctx.dueDate) {
224
+ throw new Error(`${I18N}.errors.due-date-required`);
225
+ }
226
+ if (!reviewerId) {
227
+ throw new Error(`${I18N}.errors.reviewer-required`);
228
+ }
229
+ dialogRef.setLoading(true);
230
+ return {
231
+ title,
232
+ description: (ctx.description ?? '').trim() || undefined,
233
+ dueDate: ctx.dueDate,
234
+ reviewerId,
235
+ };
236
+ });
237
+ })
238
+ .show();
239
+ return resolveLayoutBuilderDialogResult(result);
240
+ }
241
+ //#endregion
242
+ //#region ----- Create and start -----
243
+ async createAndStart(params) {
244
+ const assignedBy = this.sessionService.user?.id ?? params.form.reviewerId;
245
+ const subjectRef = {
246
+ type: params.subject.kind === 'folder' ? FOLDER_ENTITY_NAME : DOCUMENT_ENTITY_NAME,
247
+ id: params.subject.id,
248
+ title: params.subject.title,
249
+ };
250
+ const createdTask = await this.taskData.create({
251
+ title: params.form.title,
252
+ description: params.form.description,
253
+ taskTypeId: params.setup.taskType.id,
254
+ taskType: { id: params.setup.taskType.id, title: params.setup.taskType.title },
255
+ statusId: params.setup.openStatus.id,
256
+ status: statusRef(params.setup.openStatus),
257
+ priority: 'medium',
258
+ progress: 0,
259
+ order: 0,
260
+ startDate: params.form.dueDate,
261
+ dueDate: params.form.dueDate,
262
+ assigneeId: params.form.reviewerId,
263
+ assignee: { id: params.form.reviewerId },
264
+ subjectRef,
265
+ isArchived: false,
266
+ });
267
+ const taskId = resolveCreatedEntityId(createdTask);
268
+ let pinFailed = false;
269
+ const assignmentPromise = this.assignmentData.create({
270
+ taskId,
271
+ assignmentRef: {
272
+ sourceKey: 'employee-user',
273
+ refId: params.form.reviewerId,
274
+ displayName: params.form.reviewerId,
275
+ },
276
+ role: 'reviewer',
277
+ assignedBy,
278
+ assignedAt: new Date(),
279
+ isActive: true,
280
+ });
281
+ const pinPromise = this.pinSubjectOnTask(taskId, params.subject).catch((error) => {
282
+ console.warn('[AXMRequestDocumentReviewCommand] pin shortcut failed', error);
283
+ pinFailed = true;
284
+ });
285
+ const [, , instanceId] = await Promise.all([
286
+ assignmentPromise,
287
+ pinPromise,
288
+ this.startWorkflow(taskId, params),
289
+ ]);
290
+ return { taskId, instanceId, pinFailed };
291
+ }
292
+ async startWorkflow(taskId, params) {
293
+ const startResult = await this.workflowManager.start(params.setup.workflowId, {
294
+ taskId,
295
+ taskTitle: params.form.title,
296
+ documentId: params.subject.kind === 'file' ? params.subject.id : '',
297
+ folderId: params.subject.kind === 'folder' ? params.subject.id : '',
298
+ signerUserId: params.form.reviewerId,
299
+ initiatorUserId: this.sessionService.user?.id,
300
+ openStatusId: params.setup.openStatus.id,
301
+ openStatus: statusRef(params.setup.openStatus),
302
+ signOffStatusId: params.setup.signOffStatus?.id ?? params.setup.openStatus.id,
303
+ signOffStatus: statusRef(params.setup.signOffStatus) ?? statusRef(params.setup.openStatus),
304
+ completedStatusId: params.setup.completedStatus?.id ?? params.setup.openStatus.id,
305
+ completedStatus: statusRef(params.setup.completedStatus) ?? statusRef(params.setup.openStatus),
306
+ correlationId: taskId,
307
+ refId: taskId,
308
+ refType: TASK_ENTITY_NAME,
309
+ dueDate: params.form.dueDate,
310
+ });
311
+ if (!startResult.success) {
312
+ throw new Error(startResult.error ?? 'workflow-failed');
313
+ }
314
+ if (startResult.instanceId) {
315
+ try {
316
+ await this.taskData.update(taskId, {
317
+ workflowInfo: buildAXPRecordWorkflowInfo({
318
+ instanceId: startResult.instanceId,
319
+ definitionId: params.setup.workflowId,
320
+ correlationId: taskId,
321
+ }),
322
+ });
323
+ }
324
+ catch (error) {
325
+ console.warn('[AXMRequestDocumentReviewCommand] stamp workflowInfo failed', error);
326
+ }
327
+ }
328
+ return startResult.instanceId;
329
+ }
330
+ //#endregion
331
+ //#region ----- Pin subject -----
332
+ async pinSubjectOnTask(taskId, subject) {
333
+ const folder = await this.driveService.getRootByEntityRef(`${TASK_MODULE}.${TASK_ENTITY}`, taskId);
334
+ const folderId = folder?.result?.id;
335
+ if (!folderId) {
336
+ throw new Error('Task document folder was not provisioned');
337
+ }
338
+ await this.driveService.createShortcut(subject.id, subject.kind === 'folder' ? 'folder' : 'file', folderId, {
339
+ nameOverride: subject.title,
340
+ });
341
+ }
342
+ //#endregion
343
+ //#region ----- Data Loading -----
344
+ async loadSubject(subject) {
345
+ if (subject.kind === 'folder') {
346
+ const folder = await this.folderData.byKey(subject.id);
347
+ if (!folder?.id) {
348
+ return null;
349
+ }
350
+ return {
351
+ kind: 'folder',
352
+ id: folder.id,
353
+ title: asDisplayName(folder.title) ?? subject.title,
354
+ record: folder,
355
+ };
356
+ }
357
+ const document = await this.documentData.byKey(subject.id);
358
+ if (!document?.id) {
359
+ return null;
360
+ }
361
+ return {
362
+ kind: 'file',
363
+ id: document.id,
364
+ title: asDisplayName(document.name) ?? asDisplayName(document.title) ?? subject.title,
365
+ record: document,
366
+ };
367
+ }
368
+ async loadReviewSetup() {
369
+ const taskType = await this.loadReviewTaskType();
370
+ if (!taskType?.id) {
371
+ return null;
372
+ }
373
+ const statuses = await this.loadStatuses(taskType.id);
374
+ const openStatus = statuses.find((row) => row.isDefault) ?? statuses[0];
375
+ const signOffStatus = statuses.find((row) => row.name === 'sign-off') ?? openStatus;
376
+ const completedStatus = statuses.find((row) => row.isFinal) ?? signOffStatus;
377
+ return {
378
+ taskType,
379
+ openStatus,
380
+ signOffStatus,
381
+ completedStatus,
382
+ workflowId: taskType.workflowConfig?.workflowName?.trim() || DOCUMENT_REVIEW_WORKFLOW_NAME,
383
+ };
384
+ }
385
+ async loadReviewTaskType() {
386
+ try {
387
+ const byId = await this.taskTypeData.byKey(MOCK_DOCUMENT_REVIEW_TASK_TYPE_ID);
388
+ if (byId?.id) {
389
+ return byId;
390
+ }
391
+ }
392
+ catch {
393
+ // hashed tenant copies use different ids
394
+ }
395
+ const result = await this.taskTypeData.query({ skip: 0, take: 200 });
396
+ return (asItems(result).find((row) => row.workflowConfig?.workflowName?.trim() === DOCUMENT_REVIEW_WORKFLOW_NAME) ?? null);
397
+ }
398
+ async loadStatuses(taskTypeId) {
399
+ const result = await this.taskStatusData.query({
400
+ skip: 0,
401
+ take: 50,
402
+ filter: { field: 'taskTypeId', operator: { type: 'equal' }, value: taskTypeId },
403
+ });
404
+ const rows = asItems(result);
405
+ return rows.some((row) => row.taskTypeId === taskTypeId)
406
+ ? rows.filter((row) => row.taskTypeId === taskTypeId)
407
+ : rows;
408
+ }
409
+ async showLoading() {
410
+ const [title, text] = await Promise.all([
411
+ this.translationService.translateAsync(`${I18N}.loading.title`),
412
+ this.translationService.translateAsync(`${I18N}.loading.description`),
413
+ ]);
414
+ return this.loadingDialog.show({
415
+ title,
416
+ mode: 'indeterminate',
417
+ progressColor: 'primary',
418
+ text,
419
+ });
420
+ }
421
+ async toastError(key, detail) {
422
+ const [title, fallback] = await Promise.all([
423
+ this.translationService.translateAsync(`${I18N}.errors.title`),
424
+ this.translationService.translateAsync(`${I18N}.${key}`),
425
+ ]);
426
+ this.toastService.show({
427
+ color: 'danger',
428
+ title,
429
+ content: detail?.trim() || fallback,
430
+ closeButton: true,
431
+ timeOut: 5000,
432
+ });
433
+ }
434
+ async toastWarning(key) {
435
+ const [title, content] = await Promise.all([
436
+ this.translationService.translateAsync(`${I18N}.warnings.title`),
437
+ this.translationService.translateAsync(`${I18N}.${key}`),
438
+ ]);
439
+ this.toastService.show({
440
+ color: 'warning',
441
+ title,
442
+ content,
443
+ closeButton: true,
444
+ timeOut: 5000,
445
+ });
446
+ }
447
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRequestDocumentReviewCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
448
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRequestDocumentReviewCommand, providedIn: 'root' }); }
449
+ }
450
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMRequestDocumentReviewCommand, decorators: [{
451
+ type: Injectable,
452
+ args: [{ providedIn: 'root' }]
453
+ }] });
454
+
455
+ export { AXMRequestDocumentReviewCommand };
456
+ //# sourceMappingURL=acorex-platform-module-document-management-client-request-document-review.command-DUTxOir5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-document-management-client-request-document-review.command-DUTxOir5.mjs","sources":["../../../../libs/modules/document-management/client/src/lib/features/commands/request-document-review.command.ts"],"sourcesContent":["//#region ----- Imports -----\n\nimport { AXLoadingDialogService } from '@acorex/components/loading-dialog';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPSessionService } from '@acorex-platform/framework-client/auth';\nimport {\n AXPLayoutBuilderService,\n resolveLayoutBuilderDialogResult,\n} from '@acorex-platform/framework-client/layout/builder';\nimport { AXPEntityService } from '@acorex-platform/framework-client/layout/entity';\nimport { AXPWorkflowManager } from '@acorex-platform/framework-client/workflow';\nimport type { AXPEntityReference } from '@acorex-platform/framework-shared/core';\nimport { buildAXPRecordWorkflowInfo } from '@acorex-platform/framework-shared/entity';\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport {\n AXPContentDocumentsPermissionKeys,\n RootConfig,\n type AXMDocumentDto,\n type AXMDocumentManagementFolderEntityModel,\n} from '@acorex-platform/module-document-management-client/contracts';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXMDocumentManagerService } from '../shared/document-manager.service';\nimport type { AXMDocumentExplorerNode } from '../shared/document-manager.types';\nimport { sourcesAllowDocumentReview } from '../shared/document-review.util';\nimport {\n asDisplayName,\n asTrimmedId,\n asUserIds,\n resolveCreatedEntityId,\n} from './distribute-document.command.util';\n\n//#endregion\n\n//#region ----- Types -----\n\nexport interface AXMRequestDocumentReviewCommandInput {\n documentId?: string;\n folderId?: string;\n data?: AXMDocumentExplorerNode | { documentId?: string; folderId?: string; id?: string; type?: string };\n options?: { documentId?: string; folderId?: string };\n}\n\ninterface ReviewDialogResult {\n title: string;\n description?: string;\n dueDate: Date | string;\n reviewerId: string;\n}\n\ninterface TaskTypeRow {\n id: string;\n title?: string;\n workflowConfig?: {\n workflowDefinitionId?: string;\n workflowName?: string;\n } | null;\n}\n\ninterface TaskStatusRow {\n id: string;\n name?: string;\n title?: string;\n color?: string;\n icon?: string;\n isDefault?: boolean;\n isFinal?: boolean;\n taskTypeId?: string;\n}\n\ninterface ReviewSetup {\n taskType: TaskTypeRow;\n openStatus: TaskStatusRow;\n signOffStatus: TaskStatusRow | undefined;\n completedStatus: TaskStatusRow | undefined;\n workflowId: string;\n}\n\ninterface LoadingDialogRef {\n close: () => void;\n}\n\ninterface ReviewSubject {\n kind: 'file' | 'folder';\n id: string;\n title: string;\n}\n\n//#endregion\n\n//#region ----- Constants -----\n\nconst TASK_MODULE = 'TaskManagement';\nconst TASK_ENTITY = 'Task';\nconst TASK_ENTITY_NAME = `${TASK_MODULE}.${TASK_ENTITY}`;\nconst TASK_TYPE_ENTITY = 'TaskType';\nconst TASK_STATUS_ENTITY = 'TaskStatus';\nconst TASK_ASSIGNMENT_ENTITY = 'TaskAssignment';\nconst DOCUMENT_REVIEW_WORKFLOW_NAME = 'document-review';\nconst MOCK_DOCUMENT_REVIEW_TASK_TYPE_ID = 'pm-mock-task-type-document-review';\nconst DOCUMENT_ENTITY_NAME = `${RootConfig.module.name}.${RootConfig.entities.document.name}`;\nconst FOLDER_ENTITY_NAME = `${RootConfig.module.name}.${RootConfig.entities.folder.name}`;\nconst I18N = '@document-management:review';\n\n//#endregion\n\n//#region ----- Helpers -----\n\nfunction asItems<T>(value: unknown): T[] {\n if (Array.isArray(value)) {\n return value as T[];\n }\n if (value && typeof value === 'object' && Array.isArray((value as { items?: unknown }).items)) {\n return (value as { items: T[] }).items;\n }\n return [];\n}\n\nfunction statusRef(\n row: TaskStatusRow | undefined,\n): { id: string; title?: string; color?: string; icon?: string } | undefined {\n const id = asTrimmedId(row?.id);\n if (!id) {\n return undefined;\n }\n return { id, title: row?.title, color: row?.color, icon: row?.icon };\n}\n\nfunction resolveSubject(input: AXMRequestDocumentReviewCommandInput = {}): ReviewSubject | null {\n const data = input.data;\n const nodeType =\n data && typeof data === 'object' && 'type' in data ? (data as { type?: unknown }).type : undefined;\n const fromDataId =\n data && typeof data === 'object' ? asTrimmedId((data as { id?: unknown }).id) : undefined;\n const documentId =\n asTrimmedId(input.options?.documentId) ??\n asTrimmedId(input.documentId) ??\n (data && typeof data === 'object' ? asTrimmedId((data as { documentId?: unknown }).documentId) : undefined);\n const folderId =\n asTrimmedId(input.options?.folderId) ??\n asTrimmedId(input.folderId) ??\n (data && typeof data === 'object' ? asTrimmedId((data as { folderId?: unknown }).folderId) : undefined);\n\n if (nodeType === 'folder' && fromDataId) {\n return { kind: 'folder', id: fromDataId, title: asDisplayName((data as { name?: unknown }).name) ?? fromDataId };\n }\n if (nodeType === 'file' && fromDataId) {\n return { kind: 'file', id: fromDataId, title: asDisplayName((data as { name?: unknown }).name) ?? fromDataId };\n }\n if (folderId) {\n return { kind: 'folder', id: folderId, title: folderId };\n }\n if (documentId) {\n return { kind: 'file', id: documentId, title: documentId };\n }\n return null;\n}\n\n//#endregion\n\n//#region ----- Request document review command -----\n\n@Injectable({ providedIn: 'root' })\nexport class AXMRequestDocumentReviewCommand implements AXPCommand<AXMRequestDocumentReviewCommandInput> {\n //#region ----- Services & Dependencies -----\n\n private readonly layoutBuilder = inject(AXPLayoutBuilderService);\n private readonly entityService = inject(AXPEntityService);\n private readonly sessionService = inject(AXPSessionService);\n private readonly toastService = inject(AXToastService);\n private readonly translationService = inject(AXTranslationService);\n private readonly workflowManager = inject(AXPWorkflowManager);\n private readonly driveService = inject(AXMDocumentManagerService);\n private readonly loadingDialog = inject(AXLoadingDialogService);\n\n private readonly documentData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.document.name)\n .data<string, AXMDocumentDto>();\n private readonly folderData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.folder.name)\n .data<string, AXMDocumentManagementFolderEntityModel>();\n private readonly taskTypeData = this.entityService.withEntity(TASK_MODULE, TASK_TYPE_ENTITY).data<string, TaskTypeRow>();\n private readonly taskStatusData = this.entityService\n .withEntity(TASK_MODULE, TASK_STATUS_ENTITY)\n .data<string, TaskStatusRow>();\n private readonly taskData = this.entityService.withEntity(TASK_MODULE, TASK_ENTITY).data<string>();\n private readonly assignmentData = this.entityService.withEntity(TASK_MODULE, TASK_ASSIGNMENT_ENTITY).data<string>();\n private readonly documentTypeData = this.entityService\n .withEntity(RootConfig.module.name, RootConfig.entities.documentType.name)\n .data<string, { id: string; requiresReview?: unknown; metaDataList?: unknown }>();\n\n //#endregion\n\n //#region ----- Command Implementation -----\n\n async execute(input: AXMRequestDocumentReviewCommandInput = {}): AXPCommandExecuteResultPromise {\n if (!this.sessionService.authorize(AXPContentDocumentsPermissionKeys.ManageDocumentReview)) {\n await this.toastError('errors.forbidden');\n return { success: false, message: { text: `${I18N}.errors.forbidden` } };\n }\n\n const subject = resolveSubject(input);\n if (!subject) {\n await this.toastError('errors.subject-required');\n return { success: false, message: { text: `${I18N}.errors.subject-required` } };\n }\n\n const loaded = await this.loadSubject(subject);\n if (!loaded) {\n await this.toastError('errors.subject-required');\n return { success: false, message: { text: `${I18N}.errors.subject-required` } };\n }\n\n const allowsReview = await sourcesAllowDocumentReview(\n [loaded.record, input.data],\n {\n byNames: (names) => this.driveService.getDocumentTypesByNames(names),\n byKey: (id) => this.documentTypeData.byKey(id),\n },\n loaded.kind === 'folder' ? 'folder' : 'document',\n );\n if (!allowsReview) {\n await this.toastError('errors.not-enabled');\n return { success: false, message: { text: `${I18N}.errors.not-enabled` } };\n }\n\n const setupPromise = this.loadReviewSetup();\n const form = await this.openDialog(loaded.title);\n if (!form) {\n return { success: true, kind: 'object', data: { cancelled: true } };\n }\n\n const loading = await this.showLoading();\n try {\n const setup = await setupPromise;\n if (!setup?.taskType?.id) {\n await this.toastError('errors.task-type-missing');\n return { success: false, message: { text: `${I18N}.errors.task-type-missing` } };\n }\n if (!setup.openStatus?.id) {\n await this.toastError('errors.status-missing');\n return { success: false, message: { text: `${I18N}.errors.status-missing` } };\n }\n\n const created = await this.createAndStart({\n form,\n setup,\n subject: loaded,\n });\n\n if (created.pinFailed) {\n await this.toastWarning('warnings.pin-failed');\n }\n\n const [title, content] = await Promise.all([\n this.translationService.translateAsync(`${I18N}.success.title`),\n this.translationService.translateAsync(`${I18N}.success.description`),\n ]);\n this.toastService.show({ color: 'success', title, content, timeOut: 3000 });\n return { success: true, kind: 'object', data: { taskId: created.taskId, instanceId: created.instanceId } };\n } catch (error) {\n const message = error instanceof Error ? error.message : undefined;\n await this.toastError('errors.failed', message);\n return { success: false, message: { text: message ?? `${I18N}.errors.failed` } };\n } finally {\n loading.close();\n }\n }\n\n //#endregion\n\n //#region ----- Dialog -----\n\n private async openDialog(defaultTitle: string): Promise<ReviewDialogResult | null> {\n const dueDate = new Date();\n dueDate.setHours(0, 0, 0, 0);\n const result = await this.layoutBuilder\n .create()\n .dialog<ReviewDialogResult | null>((dialog) => {\n dialog\n .setTitle(`${I18N}.dialog.title`)\n .setSize('md')\n .setCloseButton(true)\n .setContext({\n title: defaultTitle,\n description: '',\n dueDate,\n reviewerId: null,\n })\n .content((flex) => {\n flex\n .setDirection('column')\n .setGap('12px')\n .formField(`${I18N}.fields.title`, (field) => {\n field.path('title');\n field.textBox({ validations: [{ rule: 'required' }] });\n })\n .formField(`${I18N}.fields.description`, (field) => {\n field.path('description');\n field.textBox({});\n })\n .formField(`${I18N}.fields.due-date`, (field) => {\n field.path('dueDate');\n field.dateTimeBox({ type: 'date', validations: [{ rule: 'required' }] });\n })\n .formField(`${I18N}.fields.reviewer`, (field) => {\n field.path('reviewerId');\n field.lookupBox({\n entity: 'SecurityManagement.User',\n multiple: false,\n look: 'lookup',\n validations: [{ rule: 'required' }],\n });\n });\n })\n .setActions((actions) => {\n actions.cancel('@general:actions.cancel.title');\n actions.submit(`${I18N}.dialog.submit`);\n })\n .onAction(async (dialogRef) => {\n if (dialogRef.action() === 'cancel') {\n return null;\n }\n const ctx = dialogRef.context() as {\n title?: string;\n description?: string;\n dueDate?: Date | string | null;\n reviewerId?: unknown;\n };\n const title = (ctx.title ?? '').trim();\n const reviewerId = asUserIds(ctx.reviewerId)[0];\n if (!title) {\n throw new Error(`${I18N}.errors.title-required`);\n }\n if (!ctx.dueDate) {\n throw new Error(`${I18N}.errors.due-date-required`);\n }\n if (!reviewerId) {\n throw new Error(`${I18N}.errors.reviewer-required`);\n }\n dialogRef.setLoading(true);\n return {\n title,\n description: (ctx.description ?? '').trim() || undefined,\n dueDate: ctx.dueDate,\n reviewerId,\n };\n });\n })\n .show();\n\n return resolveLayoutBuilderDialogResult<ReviewDialogResult>(result);\n }\n\n //#endregion\n\n //#region ----- Create and start -----\n\n private async createAndStart(params: {\n form: ReviewDialogResult;\n setup: ReviewSetup;\n subject: ReviewSubject;\n }): Promise<{ taskId: string; instanceId?: string; pinFailed: boolean }> {\n const assignedBy = this.sessionService.user?.id ?? params.form.reviewerId;\n const subjectRef: AXPEntityReference = {\n type: params.subject.kind === 'folder' ? FOLDER_ENTITY_NAME : DOCUMENT_ENTITY_NAME,\n id: params.subject.id,\n title: params.subject.title,\n };\n\n const createdTask = await this.taskData.create({\n title: params.form.title,\n description: params.form.description,\n taskTypeId: params.setup.taskType.id,\n taskType: { id: params.setup.taskType.id, title: params.setup.taskType.title },\n statusId: params.setup.openStatus.id,\n status: statusRef(params.setup.openStatus),\n priority: 'medium',\n progress: 0,\n order: 0,\n startDate: params.form.dueDate,\n dueDate: params.form.dueDate,\n assigneeId: params.form.reviewerId,\n assignee: { id: params.form.reviewerId },\n subjectRef,\n isArchived: false,\n } as never);\n const taskId = resolveCreatedEntityId(createdTask);\n\n let pinFailed = false;\n const assignmentPromise = this.assignmentData.create({\n taskId,\n assignmentRef: {\n sourceKey: 'employee-user',\n refId: params.form.reviewerId,\n displayName: params.form.reviewerId,\n },\n role: 'reviewer',\n assignedBy,\n assignedAt: new Date(),\n isActive: true,\n } as never);\n\n const pinPromise = this.pinSubjectOnTask(taskId, params.subject).catch((error) => {\n console.warn('[AXMRequestDocumentReviewCommand] pin shortcut failed', error);\n pinFailed = true;\n });\n\n const [, , instanceId] = await Promise.all([\n assignmentPromise,\n pinPromise,\n this.startWorkflow(taskId, params),\n ]);\n return { taskId, instanceId, pinFailed };\n }\n\n private async startWorkflow(\n taskId: string,\n params: { form: ReviewDialogResult; setup: ReviewSetup; subject: ReviewSubject },\n ): Promise<string | undefined> {\n const startResult = await this.workflowManager.start(params.setup.workflowId, {\n taskId,\n taskTitle: params.form.title,\n documentId: params.subject.kind === 'file' ? params.subject.id : '',\n folderId: params.subject.kind === 'folder' ? params.subject.id : '',\n signerUserId: params.form.reviewerId,\n initiatorUserId: this.sessionService.user?.id,\n openStatusId: params.setup.openStatus.id,\n openStatus: statusRef(params.setup.openStatus),\n signOffStatusId: params.setup.signOffStatus?.id ?? params.setup.openStatus.id,\n signOffStatus: statusRef(params.setup.signOffStatus) ?? statusRef(params.setup.openStatus),\n completedStatusId: params.setup.completedStatus?.id ?? params.setup.openStatus.id,\n completedStatus: statusRef(params.setup.completedStatus) ?? statusRef(params.setup.openStatus),\n correlationId: taskId,\n refId: taskId,\n refType: TASK_ENTITY_NAME,\n dueDate: params.form.dueDate,\n });\n\n if (!startResult.success) {\n throw new Error(startResult.error ?? 'workflow-failed');\n }\n\n if (startResult.instanceId) {\n try {\n await this.taskData.update(taskId, {\n workflowInfo: buildAXPRecordWorkflowInfo({\n instanceId: startResult.instanceId,\n definitionId: params.setup.workflowId,\n correlationId: taskId,\n }),\n } as never);\n } catch (error) {\n console.warn('[AXMRequestDocumentReviewCommand] stamp workflowInfo failed', error);\n }\n }\n\n return startResult.instanceId;\n }\n\n //#endregion\n\n //#region ----- Pin subject -----\n\n private async pinSubjectOnTask(taskId: string, subject: ReviewSubject): Promise<void> {\n const folder = await this.driveService.getRootByEntityRef(`${TASK_MODULE}.${TASK_ENTITY}`, taskId);\n const folderId = folder?.result?.id;\n if (!folderId) {\n throw new Error('Task document folder was not provisioned');\n }\n await this.driveService.createShortcut(subject.id, subject.kind === 'folder' ? 'folder' : 'file', folderId, {\n nameOverride: subject.title,\n });\n }\n\n //#endregion\n\n //#region ----- Data Loading -----\n\n private async loadSubject(\n subject: ReviewSubject,\n ): Promise<{ kind: 'file' | 'folder'; id: string; title: string; record: unknown } | null> {\n if (subject.kind === 'folder') {\n const folder = await this.folderData.byKey(subject.id);\n if (!folder?.id) {\n return null;\n }\n return {\n kind: 'folder',\n id: folder.id,\n title: asDisplayName(folder.title) ?? subject.title,\n record: folder,\n };\n }\n const document = await this.documentData.byKey(subject.id);\n if (!document?.id) {\n return null;\n }\n return {\n kind: 'file',\n id: document.id,\n title: asDisplayName(document.name) ?? asDisplayName(document.title) ?? subject.title,\n record: document,\n };\n }\n\n private async loadReviewSetup(): Promise<ReviewSetup | null> {\n const taskType = await this.loadReviewTaskType();\n if (!taskType?.id) {\n return null;\n }\n const statuses = await this.loadStatuses(taskType.id);\n const openStatus = statuses.find((row) => row.isDefault) ?? statuses[0];\n const signOffStatus = statuses.find((row) => row.name === 'sign-off') ?? openStatus;\n const completedStatus = statuses.find((row) => row.isFinal) ?? signOffStatus;\n return {\n taskType,\n openStatus,\n signOffStatus,\n completedStatus,\n workflowId: taskType.workflowConfig?.workflowName?.trim() || DOCUMENT_REVIEW_WORKFLOW_NAME,\n };\n }\n\n private async loadReviewTaskType(): Promise<TaskTypeRow | null> {\n try {\n const byId = await this.taskTypeData.byKey(MOCK_DOCUMENT_REVIEW_TASK_TYPE_ID);\n if (byId?.id) {\n return byId;\n }\n } catch {\n // hashed tenant copies use different ids\n }\n\n const result = await this.taskTypeData.query({ skip: 0, take: 200 });\n return (\n asItems<TaskTypeRow>(result).find(\n (row) => row.workflowConfig?.workflowName?.trim() === DOCUMENT_REVIEW_WORKFLOW_NAME,\n ) ?? null\n );\n }\n\n private async loadStatuses(taskTypeId: string): Promise<TaskStatusRow[]> {\n const result = await this.taskStatusData.query({\n skip: 0,\n take: 50,\n filter: { field: 'taskTypeId', operator: { type: 'equal' }, value: taskTypeId },\n });\n const rows = asItems<TaskStatusRow>(result);\n return rows.some((row) => row.taskTypeId === taskTypeId)\n ? rows.filter((row) => row.taskTypeId === taskTypeId)\n : rows;\n }\n\n private async showLoading(): Promise<LoadingDialogRef> {\n const [title, text] = await Promise.all([\n this.translationService.translateAsync(`${I18N}.loading.title`),\n this.translationService.translateAsync(`${I18N}.loading.description`),\n ]);\n return this.loadingDialog.show({\n title,\n mode: 'indeterminate',\n progressColor: 'primary',\n text,\n }) as LoadingDialogRef;\n }\n\n private async toastError(key: string, detail?: string): Promise<void> {\n const [title, fallback] = await Promise.all([\n this.translationService.translateAsync(`${I18N}.errors.title`),\n this.translationService.translateAsync(`${I18N}.${key}`),\n ]);\n this.toastService.show({\n color: 'danger',\n title,\n content: detail?.trim() || fallback,\n closeButton: true,\n timeOut: 5000,\n });\n }\n\n private async toastWarning(key: string): Promise<void> {\n const [title, content] = await Promise.all([\n this.translationService.translateAsync(`${I18N}.warnings.title`),\n this.translationService.translateAsync(`${I18N}.${key}`),\n ]);\n this.toastService.show({\n color: 'warning',\n title,\n content,\n closeButton: true,\n timeOut: 5000,\n });\n }\n\n //#endregion\n}\n\n//#endregion\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;AAyFA;AAEA;AAEA,MAAM,WAAW,GA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ACL,OAAO;AACP,YAAA,WAAW,EAAE,IAAI;AACjB,YAAA,OAAO,EAAE,IAAI;AACd,SAAA,CAAC;IACJ;8GA9aW,+BAA+B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA/B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,+BAA+B,cADlB,MAAM,EAAA,CAAA,CAAA;;2FACnB,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAD3C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;"}
@@ -0,0 +1,121 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, Injectable } from '@angular/core';
3
+ import { isString, trim, isEmpty } from 'lodash';
4
+ import { AXPWidgetsList } from '@acorex-platform/framework-shared/core';
5
+ import { AXPBroadcastEventService } from '@acorex-platform/framework-client/core';
6
+ import { AXPLayoutBuilderService, resolveLayoutBuilderDialogResult } from '@acorex-platform/framework-client/layout/builder';
7
+ import { AXPWorkflowManager, AXP_WORKFLOW_SUPPRESS_CONTINUATION_INPUT_KEY } from '@acorex-platform/framework-client/workflow';
8
+ import { a as asTrimmedId } from './acorex-platform-module-document-management-client-distribute-document.command.util-Bnw0rh94.mjs';
9
+
10
+ //#region ----- Imports -----
11
+ //#endregion
12
+ //#region ----- Sign document review -----
13
+ class AXMSignDocumentReviewCommand {
14
+ constructor() {
15
+ //#region ----- Services & Dependencies -----
16
+ this.layoutBuilder = inject(AXPLayoutBuilderService);
17
+ this.workflowManager = inject(AXPWorkflowManager);
18
+ this.eventService = inject(AXPBroadcastEventService);
19
+ }
20
+ //#endregion
21
+ //#region ----- Command Implementation -----
22
+ async execute(input = {}) {
23
+ const instanceId = asTrimmedId(input.instanceId) ?? asTrimmedId(input.data?.instanceId);
24
+ const bookmarkId = asTrimmedId(input.bookmarkId) ?? asTrimmedId(input.data?.bookmarkId);
25
+ const activityId = asTrimmedId(input.activityId) ?? asTrimmedId(input.data?.activityId);
26
+ const taskToken = asTrimmedId(input.taskToken) ?? asTrimmedId(input.data?.taskToken);
27
+ if (!instanceId || !bookmarkId || !activityId || !taskToken) {
28
+ return { success: false, message: { text: '@document-management:review.errors.workflow-failed' } };
29
+ }
30
+ const dialogResult = await this.showSignOffDialog();
31
+ if (dialogResult.cancelled || !dialogResult.signature) {
32
+ return { success: true, kind: 'object', data: { cancelled: true } };
33
+ }
34
+ const resume = await this.workflowManager.resume(instanceId, activityId, 'sign-off', {
35
+ signature: dialogResult.signature,
36
+ note: dialogResult.note,
37
+ signedAt: new Date().toISOString(),
38
+ bookmarkId,
39
+ [AXP_WORKFLOW_SUPPRESS_CONTINUATION_INPUT_KEY]: true,
40
+ }, taskToken);
41
+ if (resume.success) {
42
+ this.eventService.publish('task-board.refresh', {});
43
+ }
44
+ return resume.success
45
+ ? { success: true, kind: 'object', data: { instanceId } }
46
+ : { success: false, message: resume.error ? { text: resume.error } : undefined };
47
+ }
48
+ //#endregion
49
+ //#region ----- Dialog -----
50
+ async showSignOffDialog() {
51
+ const rawResult = await this.layoutBuilder
52
+ .create()
53
+ .dialog((dialog) => {
54
+ dialog
55
+ .setTitle('@workflow-management:sign-off.activities.sign-off.dialog-title')
56
+ .setMessage('@document-management:review.workflow.sign-off')
57
+ .setContext({ signature: '', note: '' })
58
+ .content((flex) => {
59
+ flex
60
+ .setDirection('column')
61
+ .formField('@workflow-management:sign-off.activities.sign-off.note-label', (field) => {
62
+ field.path('note');
63
+ field.largeTextBox({
64
+ placeholder: '@workflow-management:sign-off.activities.sign-off.note-placeholder',
65
+ maxLength: 1000,
66
+ });
67
+ })
68
+ .formField('@workflow-management:sign-off.activities.sign-off.signature-label', (field) => {
69
+ field.path('signature');
70
+ field.customWidget(AXPWidgetsList.Editors.SignatureBox, {
71
+ validations: [
72
+ {
73
+ rule: 'required',
74
+ options: {
75
+ message: '@workflow-management:sign-off.activities.sign-off.signature-required',
76
+ },
77
+ },
78
+ ],
79
+ });
80
+ });
81
+ })
82
+ .setActions((actions) => {
83
+ actions
84
+ .cancel('@general:actions.cancel.title')
85
+ .submit('@workflow-management:sign-off.activities.sign-off.submit-text');
86
+ })
87
+ .onAction(async (dialogRef) => {
88
+ const context = dialogRef.context();
89
+ const action = dialogRef.action();
90
+ if (!context || action === 'cancel') {
91
+ return null;
92
+ }
93
+ const formData = context;
94
+ const signature = isString(formData.signature) ? trim(formData.signature) : '';
95
+ if (isEmpty(signature)) {
96
+ throw new Error('@workflow-management:sign-off.activities.sign-off.signature-required');
97
+ }
98
+ return {
99
+ signature,
100
+ note: formData.note,
101
+ cancelled: false,
102
+ };
103
+ });
104
+ })
105
+ .show();
106
+ const result = resolveLayoutBuilderDialogResult(rawResult);
107
+ if (!result || result.cancelled) {
108
+ return { signature: '', note: undefined, cancelled: true };
109
+ }
110
+ return result;
111
+ }
112
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMSignDocumentReviewCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
113
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMSignDocumentReviewCommand, providedIn: 'root' }); }
114
+ }
115
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AXMSignDocumentReviewCommand, decorators: [{
116
+ type: Injectable,
117
+ args: [{ providedIn: 'root' }]
118
+ }] });
119
+
120
+ export { AXMSignDocumentReviewCommand };
121
+ //# sourceMappingURL=acorex-platform-module-document-management-client-sign-document-review.command-B08sgrRi.mjs.map